diff mbox series

[RFC,1/3] python: expose typing information via PEP 561

Message ID 20210604163907.1511224-2-jsnow@redhat.com
State New
Headers show
Series python/iotests: Run iotest linters during Python CI | expand

Commit Message

John Snow June 4, 2021, 4:39 p.m. UTC
Create 'py.typed' files in each subpackage that indicate to mypy that
this is a typed module, so that users of any of these packages can use
mypy to check their code as well.

(Note: theoretically it's possible to ditch MANIFEST.in in favor of
using package_data, but I genuinely could not figure out how to get it
to include things from the source root into the package root. I
tried!...)

https: //www.python.org/dev/peps/pep-0561/#specification
Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/machine/py.typed | 0
 python/qemu/qmp/py.typed     | 0
 python/qemu/utils/py.typed   | 0
 python/setup.cfg             | 3 +++
 4 files changed, 3 insertions(+)
 create mode 100644 python/qemu/machine/py.typed
 create mode 100644 python/qemu/qmp/py.typed
 create mode 100644 python/qemu/utils/py.typed
diff mbox series

Patch

diff --git a/python/qemu/machine/py.typed b/python/qemu/machine/py.typed
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/python/qemu/qmp/py.typed b/python/qemu/qmp/py.typed
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/python/qemu/utils/py.typed b/python/qemu/utils/py.typed
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/python/setup.cfg b/python/setup.cfg
index 0fcdec6f32..a1f9e9d76d 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -37,6 +37,9 @@  devel =
     pylint >= 2.8.0
     tox >= 3.18.0
 
+[options.package_data]
+* = py.typed
+
 [flake8]
 extend-ignore = E722  # Prefer pylint's bare-except checks to flake8's
 exclude = __pycache__,