Message ID | 20210211185856.3975616-16-jsnow@redhat.com |
---|---|
State | New |
Headers | show |
Series | python: create installable package | expand |
On Thu, Feb 11, 2021 at 01:58:47PM -0500, John Snow wrote: > 0.730 appears to be about the oldest version that works with the > features we want, including nice human readable output (to make sure > iotest 297 passes), and type-parameterized Popen generics. > > 0.770, however, supports adding 'strict' to the config file, so require > at least 0.770. > > Now that we are checking a namespace package, we need to tell mypy to > allow PEP420 namespaces, so modify the mypy config as part of the move. > > mypy can now be run from the python root by typing 'mypy qemu'. > $ mypy qemu qemu/utils/accel.py: error: Source file found twice under different module names: 'qmp' and 'qemu.qmp' Found 1 error in 1 file (errors prevented further checking) I guess you meant 'mypy -p qemu'. > Signed-off-by: John Snow <jsnow@redhat.com> > --- > python/Pipfile | 1 + > python/Pipfile.lock | 37 ++++++++++++++++++++++++++++++++++++- > python/setup.cfg | 1 + > 3 files changed, 38 insertions(+), 1 deletion(-) > With that change, Reviewed-by: Cleber Rosa <crosa@redhat.com> Tested-by: Cleber Rosa <crosa@redhat.com>
On 2/16/21 11:38 PM, Cleber Rosa wrote: > On Thu, Feb 11, 2021 at 01:58:47PM -0500, John Snow wrote: >> 0.730 appears to be about the oldest version that works with the >> features we want, including nice human readable output (to make sure >> iotest 297 passes), and type-parameterized Popen generics. >> >> 0.770, however, supports adding 'strict' to the config file, so require >> at least 0.770. >> >> Now that we are checking a namespace package, we need to tell mypy to >> allow PEP420 namespaces, so modify the mypy config as part of the move. >> >> mypy can now be run from the python root by typing 'mypy qemu'. >> > > $ mypy qemu > qemu/utils/accel.py: error: Source file found twice under different module names: 'qmp' and 'qemu.qmp' > Found 1 error in 1 file (errors prevented further checking) > > I guess you meant 'mypy -p qemu'. > Ah, crud! Yes, this is something that has popped up recently. mypy's "figure out where we are when run without arguments" functionality does not work exactly correct in some cases. I forget the specifics, but "mypy qemu" used to work for this series, and at some point it ... stopped working. I updated the pytest invocation, but I didn't update the comments here. There's a github meta-issue about this, and about how mypy's package discovery is extremely confusing: https://github.com/python/mypy/issues/8584 It's extremely a big landmine on which you may hoist yourself. >> Signed-off-by: John Snow <jsnow@redhat.com> >> --- >> python/Pipfile | 1 + >> python/Pipfile.lock | 37 ++++++++++++++++++++++++++++++++++++- >> python/setup.cfg | 1 + >> 3 files changed, 38 insertions(+), 1 deletion(-) >> > > With that change, > > Reviewed-by: Cleber Rosa <crosa@redhat.com> > Tested-by: Cleber Rosa <crosa@redhat.com> >
diff --git a/python/Pipfile b/python/Pipfile index d1f7045f680..51c537b0d10 100644 --- a/python/Pipfile +++ b/python/Pipfile @@ -5,6 +5,7 @@ verify_ssl = true [dev-packages] flake8 = ">=3.6.0" +mypy = ">=0.770" pylint = ">=2.6.0" [packages] diff --git a/python/Pipfile.lock b/python/Pipfile.lock index 869b0bdf67f..5f8aab117c3 100644 --- a/python/Pipfile.lock +++ b/python/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "9f6d4857a6c72ad40fc1ec1e58cdb76f187a2986ac4156f0027e5eb798ec69a9" + "sha256": "65f010a8f2e55e9870d2b7e0d8af129516097d23abf2504f396552748b067ade" }, "pipfile-spec": 6, "requires": { @@ -83,6 +83,41 @@ ], "version": "==0.6.1" }, + "mypy": { + "hashes": [ + "sha256:0d2fc8beb99cd88f2d7e20d69131353053fbecea17904ee6f0348759302c52fa", + "sha256:2b216eacca0ec0ee124af9429bfd858d5619a0725ee5f88057e6e076f9eb1a7b", + "sha256:319ee5c248a7c3f94477f92a729b7ab06bf8a6d04447ef3aa8c9ba2aa47c6dcf", + "sha256:3e0c159a7853e3521e3f582adb1f3eac66d0b0639d434278e2867af3a8c62653", + "sha256:5615785d3e2f4f03ab7697983d82c4b98af5c321614f51b8f1034eb9ebe48363", + "sha256:5ff616787122774f510caeb7b980542a7cc2222be3f00837a304ea85cd56e488", + "sha256:6f8425fecd2ba6007e526209bb985ce7f49ed0d2ac1cc1a44f243380a06a84fb", + "sha256:74f5aa50d0866bc6fb8e213441c41e466c86678c800700b87b012ed11c0a13e0", + "sha256:90b6f46dc2181d74f80617deca611925d7e63007cf416397358aa42efb593e07", + "sha256:947126195bfe4709c360e89b40114c6746ae248f04d379dca6f6ab677aa07641", + "sha256:a301da58d566aca05f8f449403c710c50a9860782148332322decf73a603280b", + "sha256:aa9d4901f3ee1a986a3a79fe079ffbf7f999478c281376f48faa31daaa814e86", + "sha256:b9150db14a48a8fa114189bfe49baccdff89da8c6639c2717750c7ae62316738", + "sha256:b95068a3ce3b50332c40e31a955653be245666a4bc7819d3c8898aa9fb9ea496", + "sha256:ca7ad5aed210841f1e77f5f2f7d725b62c78fa77519312042c719ed2ab937876", + "sha256:d16c54b0dffb861dc6318a8730952265876d90c5101085a4bc56913e8521ba19", + "sha256:e0202e37756ed09daf4b0ba64ad2c245d357659e014c3f51d8cd0681ba66940a", + "sha256:e1c84c65ff6d69fb42958ece5b1255394714e0aac4df5ffe151bc4fe19c7600a", + "sha256:e32b7b282c4ed4e378bba8b8dfa08e1cfa6f6574067ef22f86bee5b1039de0c9", + "sha256:e3b8432f8df19e3c11235c4563a7250666dc9aa7cdda58d21b4177b20256ca9f", + "sha256:e497a544391f733eca922fdcb326d19e894789cd4ff61d48b4b195776476c5cf", + "sha256:f5fdf935a46aa20aa937f2478480ebf4be9186e98e49cc3843af9a5795a49a25" + ], + "index": "pypi", + "version": "==0.800" + }, + "mypy-extensions": { + "hashes": [ + "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", + "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8" + ], + "version": "==0.4.3" + }, "pycodestyle": { "hashes": [ "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367", diff --git a/python/setup.cfg b/python/setup.cfg index 0bd55c5e373..f919e95f95b 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -26,6 +26,7 @@ extend-ignore = E722 # Prefer pylint's bare-except checks to flake8's strict = True python_version = 3.6 warn_unused_configs = True +namespace_packages = True [pylint.messages control] # Disable the message, report, category or checker with the given id(s). You
0.730 appears to be about the oldest version that works with the features we want, including nice human readable output (to make sure iotest 297 passes), and type-parameterized Popen generics. 0.770, however, supports adding 'strict' to the config file, so require at least 0.770. Now that we are checking a namespace package, we need to tell mypy to allow PEP420 namespaces, so modify the mypy config as part of the move. mypy can now be run from the python root by typing 'mypy qemu'. Signed-off-by: John Snow <jsnow@redhat.com> --- python/Pipfile | 1 + python/Pipfile.lock | 37 ++++++++++++++++++++++++++++++++++++- python/setup.cfg | 1 + 3 files changed, 38 insertions(+), 1 deletion(-)