qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: John Snow
Subject: [PATCH RFC 1/3] python: expose typing information via PEP 561
Date: Fri, 4 Jun 2021 12:39:05 -0400

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 --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__,
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]