Repository navigation
Mypy linting not working for mypy 0.990 - no issues found #20182
Copy link
Copy link
Closed as not planned
Labels
area-lintingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Type: Bug
Behaviour
Expected vs. Actual
Expected: mypy errors are found.
Actual: mypy reports no errors.
Steps to reproduce:
- Introduce a deliberate type error
- Run
mypy <filepath>on the command line to confirm that the problem is genuine - Inspect the Python Output panel to see that you get nothing:
##########Linting Output - mypy########## Success: no issues found in 1 source file
Mypy version: mypy 0.990 (compiled: yes)
Edit: I have tested and linting works for mypy 0.981
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.6
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServersetting: Pylance
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
> /opt/conda/bin/conda run -n env_name --no-capture-output python /net/~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py /net/~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/linter.py -m mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers --show-error-codes --explicit-package-bases --namespace-packages ./path/to/file.py
cwd: .
##########Linting Output - mypy##########
Success: no issues found in 1 source file
User Settings
condaPath: "<placeholder>"
languageServer: "Pylance"
linting
• mypyArgs: "<placeholder>"
• mypyEnabled: true
formatting
• autopep8Args: "<placeholder>"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Extension version: 2022.16.1
VS Code version: Code 1.72.2 (d045a5eda657f4d7b676dedbfa7aab8207f8a075, 2022-10-12T22:16:26.920Z)
OS version: Linux x64 3.10.0-1160.76.1.el7.x86_64
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60GHz (4 x 2599) |
| GPU Status | 2d_canvas: unavailable_software canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: disabled_software multiple_raster_threads: enabled_on opengl: disabled_off rasterization: disabled_software raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: disabled_software video_encode: disabled_software vulkan: disabled_off webgl: unavailable_software webgl2: unavailable_software webgpu: disabled_off |
| Load (avg) | 1, 3, 3 |
| Memory (System) | 7.62GB (1.80GB free) |
| Process Argv | --unity-launch --crash-reporter-id 4cb3165e-6680-471f-992f-0c1e623756f7 |
| Screen Reader | no |
| VM | 100% |
| DESKTOP_SESSION | 1-gnome |
| XDG_CURRENT_DESKTOP | GNOME |
| XDG_SESSION_DESKTOP | 1-gnome |
| XDG_SESSION_TYPE | x11 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-lintingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from postertriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Activity
[-]Mypy not working - no issues found[/-][+]Mypy linting not working for mypy 0.990 - no issues found[/+]karthiknadig commentedon Nov 8, 2022
There should be a linter command arguments in the Output > python logs. can you run that in the terminal? it should be running
linter.pywith few arguments.MetRonnie commentedon Nov 9, 2022
/net/~/, probably a quirk to do with NFS, but copying and pasting the command and removing the/net/works for me and shows the mypy errorspython.linting.mypyArgs). Removing them didn't help.najtin commentedon Nov 9, 2022
Same issue here, without the /net/ thing. The paths look fine.
I use poetry and installed flake8 and mypy in a local venv using poetry. Flake works fine but mypy does not report any issues. To be clear it does report something:
Success: no issues found in 1 source fileBut it should instead report an issue with the code.Here is the code i want to check:
Clearly, mypy should complain about the missing return statement.
Here is the output of the Output tab:
When we run the exact same command in the terminal window (with venv activated) or in a fresh shell without activating the venv we get the expected result:
Extension version: 2022.16.1
VSCodium version: VSCodium 1.72.2 (378660f7dd07287aa34acf90e8fec157425c1ac8, 2022-10-16T23:03:19.989Z)
OS version: Linux x64 5.15.0-52-generic snap
Modes:
Sandboxed: No
System Info
karthiknadig commentedon Nov 9, 2022
Jan Philipp Bittner (@najtin) For flake8 can you try using the flake8 extension from marketplace https://marketplace.visualstudio.com/items?itemName=ms-python.flake8
najtin commentedon Nov 9, 2022
I think this is related to the issue above (for completeness python/mypy#14042 )
najtin commentedon Nov 9, 2022
No, flake8 works as expected. This issue does also occur when flake8 is not installed.
karthiknadig commentedon Nov 10, 2022
The difference between
mypy0.982 vs 0.990 is that with 0.990 mypy shows error code.mypy == 0.982
mypy == 0.990
Even with that difference it seems to be working for me:

karthiknadig commentedon Nov 10, 2022
Can you share the output from
pip list?najtin commentedon Nov 10, 2022
While trying to recreate a minimal working example i found that for some reason it works if you add mypy through
poetry add --dev mypy, but it does not work if you change the pyproject.toml by hand and runpoetry install. You can also first add mypy through poetry (it works at that moment) and then delete the .venv folder, then runpoetry install, resulting in no working linting.I am really baffled and confused why this would make a difference.
In more detail
To reproduce case (poetry add --dev mypy) run the following:
To reproduce case (poetry install) run the following:
pyproject.toml:
Here is the pip list you requested case (poetry add --dev mypy) (mypy works):
case (poetry install) (mypy does not work)
These results make me think that this issue should be tracked at mypy under python/mypy#14054 because it seems like the working folder has been added to the path, otherwise pip would not list the project as an installed package. Therefore the plugin here seems to work fine but mypy introduced breaking changes in 0.990, making it an issue with mypy.
MetRonnie commentedon Nov 10, 2022
My
pip listoutput:Click to show
karthiknadig commentedon Nov 12, 2022
Looks like this might be a mypy issue, closing this for now.
Track here: python/mypy#14054
MetRonnie commentedon Nov 15, 2022
Can confirm working again with Mypy 0.991