python / python/mypy

Unable to find types in separate `lib[64]` directories

Aperta
#16,434 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug
Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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?!

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre la segnalazione su Fedora con un virtualenv, installando mypy, protobuf e types-protobuf, quindi controllare l’import google.protobuf confrontando le directory separate lib e lib64. L’issue non indica alcun file o test di mypy; per completare il lavoro sarebbe necessario determinare se mypy debba risolvere gli stub tra queste directory e documentare o validare il comportamento risultante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.