Replies: 1 comment 4 replies
-
Related mypy feature request: python/mypy#10633 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
We are using PDM version 1.8.1 with Python 3.7 (we have also experimented with Python 3.9, where we have the same issue). We are also using Mypy, installed and steered through PDM, to type check our Python code.
The problem we are having starts with Mypy being unable to locate the type stub packages for external libraries, for example
jsonschema
needs an additionaltypes-jsonschema
package to be installed. We have added these type stub packages with pdm, and confirm they are present in the__pypackages__
structure. In order to find type stubs installed by pdm, my understanding is that themypy_path
config option needs to be added to Mypy. On adding this to the[tool.mypy]
section of thepyproject.toml
file Mypy does seem to include the pdm installations in its search path, but unfortunately mypy now fails with the errorThe
typing_extensions
module is in fact required by Mypy and gets installed by PDM as part of the Mypy installation. Mypy then finds its own dependency and (incorrectly) assumes there is a name clash because it thinks thetyping_extensions
module it found is a user module.The general problem seems to be that Mypy expects to be installed globally and doesn't play nicely with the local PDM installation inside
__pypackages__
. There is a proposed patch to Mypy for this, but it seems like the devs are not going to accept itpython/mypy#10833
I'm hoping the PDM experts have experienced this issue and maybe have a way around it for the time being?
Thanks for your help
James
Beta Was this translation helpful? Give feedback.
All reactions