Better error reporting for unavailable version or platform specific stub features
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 54
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/mypy
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug topic-configuration topic-error-reporting
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100