Unable to find types in separate `lib[64]` directories
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- Ø Merge
- 1 T. 18 Std.
- Gemergte PRs (30 T.)
- 54
Beschreibung
I'm having issues with mypy correctly finding type stubs.
After creating a virtual environment on my Fedora machine using virtualenv, I install the following packages:
pip install mypy protobuf types-protobuf
Using mypy to check the following code
import google.protobuf
I get the error messsage:
my_file.py:1: error: Skipping analyzing "google": module is installed, but missing library stubs or py.typed marker [import-untyped]
my_file.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
The reason for this seems that in the virtual environment there are two independent lib directories (my_env/lib and my_env/lib64). One google directory containing code of the protobuf package is in lib64/google and the types (types-protobuf) are installed to lib/google-stubs.
Either moving the google-stubs directory to the lib64 variant or creating an (empty) google directory in lib resolves the issue.
It seems mypy is unable to find the corresponding type stubs in the respectively other lib directory.
Has anybody an idea on how to approach this? I do not even know whether the respective installation locations of either the protobuf or the types-protobuf package are correct or whether this is an issue with mypy resolving types?!
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Den Bericht unter Fedora mit einer virtualenv reproduzieren, dabei mypy, protobuf und types-protobuf installieren und anschließend den Import google.protobuf überprüfen, während die separaten Verzeichnisse lib und lib64 verglichen werden. Das Issue nennt keine mypy-Datei und keinen Test; für den Abschluss muss ermittelt werden, ob mypy Stubs über diese Verzeichnisse hinweg auflösen sollte, und das resultierende Verhalten muss dokumentiert oder validiert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100