typeshed
typeshed copied to clipboard
types-openssl-python does not contain stubs?
Running mypy --install-types on a project containing import OpenSSL.crypto suggests installing types-openssl-python but installing this package does not resolve the issue.
Ona repeated run, I still get the following error and hint.
error: Library stubs not installed for "OpenSSL.crypto" (or incompatible with Python 3.8)
note: Hint: "python3 -m pip install types-openssl-python"
note: (or run "mypy --install-types" to install all missing stub packages)
The stubs for that library appear to be Python 2-only (https://github.com/python/typeshed/blob/master/stubs/openssl-python/METADATA.toml). Are you running on Python 3?
If that's the issue, mypy shouldn't suggest installing them on Python 3.
Yes, I have tried py 3.8 and 3.9.
This also affects types-fb303.
There's arguably two bugs here, one in mypy and one in typeshed:
- mypy should not suggest installing a stub package that doesn't work for the Python version you're running
- typeshed shouldn't upload a wheel that claims to be Python 3 compatible if the stubs are Python 2-only
I believe that the wheel needs to be Python 3 compatible so that type checkers written in Python 3 (such as mypy) can use it easily, without needing a Python 2 virtual environment. We ship a metadata toml file along with the wheel that indicates whether the stubs are compatible with Python 2/3.
I agree that mypy should understand which stubs are only Python 2/3 compatible.
It doesn't sound like there's anything actionable for typeshed here (and if there were, it sounds to me like it would need to be addressed over at the https://github.com/typeshed-internal/stub_uploader repo).