Incorrect diagnostic on missing submodule
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 20.6k
- Forks
- 3.3k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Bug Report
When untyped module exists but submodule does not, mypy reports that submodule is installed.
To Reproduce
$ pip install fabric
import fabric
from fabric.not_exists import something
$ python3 test.py
Traceback (most recent call last):
File "/media/sf_d/WWPass/git/spm/test.py", line 2, in <module>
from fabric.not_exists import something
ModuleNotFoundError: No module named 'fabric.not_exists'
$ mypy test.py
test.py:1:1: error: Skipping analyzing "fabric": module is installed, but missing library stubs or py.typed marker [import-untyped]
import fabric
^
test.py:2:1: error: Skipping analyzing "fabric.not_exists": module is installed, but missing library stubs or py.typed marker [import-untyped]
from fabric.not_exists import something
^
test.py:2:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 2 errors in 1 file (checked 1 source file)
Expected Behavior
Error in line 2 should be saying that fabric.not_exists does not exist.
Actual Behavior
Error in line 2 says that fabric.not_exists is installed, which it not true and misleading.
Your Environment
$ mypy --version
mypy 1.11.2 (compiled: yes)
$ python3 --version
Python 3.12.3
$ pip list | grep fabric
fabric 3.2.2
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce el informe con la test.py mostrada, un paquete fabric sin tipos instalado y la importación de fabric.not_exists. Empieza rastreando la resolución de importaciones de mypy y el diagnóstico de stub ausente para módulos anidados; el trabajo estará terminado cuando el paquete existente siga mostrando su advertencia actual, mientras que el submódulo ausente reciba un error claro de que no existe.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100