Better error reporting for unavailable version or platform specific stub features

Abierto
#2,898 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python
Área
compilers

Línea de trabajo

Start with build.py: State.init() and the find_module call that searches manager.lib_path, then inspect default.py: PYTHON3_version and default_lib_path. Determine how unavailable or older platform-specific stubs should be reported and whether Python 3.6 belongs in the search paths. Done means the behavior clearly alerts users when the selected stub is unavailable or older, with the version-search behavior matching the supported Python versions.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

feature priority-1-normal topic-usability

When type-checking a python 3.6 file that contains from enum import auto, the latest build of mypy ( commit 0bb2d16 from master) complains: error: Module 'enum' has no attribute 'auto'. The reason is that build.py: State.__init__() finds the stub for enum using path = find_module(file_id, manager.lib_path); and the paths in manager.lib_path are something like

('.../typeshed/stdlib/3.4', .../typeshed/stdlib/3.3', '.../typeshed/stdlib/3', '.../third_party/3', '.../stdlib/2and3', '.../third_party/2and3')

It's understandable that stubs aren't yet available for the most recent library versions in typeshed, but I think mypy should perhaps warn the user about it to make it easier to figure out what the problem is. For instance, whenever a library stub used is for an older version, a warning could be logged?

Related to this is the fact that the default.py: PYTHON3_version is (3, 5); perhaps it should be updated to (3, 6)? As is, the default_lib_path doesn't even attempt to search in .../typeshed/stdlib/3.6 folder. (This wouldn't have helped in my case, since there's no enum.pyi in the 3.6 folder.)

Also related is #2897 that I just opened.

Lenguaje dominante
Python
Estrellas
20.6k
Forks
3.3k
Merge medio
1 d 18 h
PR fusionados (30 d)
54

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de python/mypy

Todos los issues de python/mypy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.