Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The problem found by mypy do not shown in PROBLEMS #206

Open
astro-jingtao opened this issue Nov 2, 2023 · 7 comments
Open

The problem found by mypy do not shown in PROBLEMS #206

astro-jingtao opened this issue Nov 2, 2023 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug needs investigation

Comments

@astro-jingtao
Copy link

In OUTPUT-Mypy Type Checker I can see mypy really runs and finds some problem in my file, but there are not shown in PROBLEMS

The OUTPUT-Mypy Type Checker ouput:

2023-11-02 13:15:50.666 [info] file://path/to/file//ks.py :
path/to/file//x_xerr.py:5:1:5:1: error: Library stubs not installed for "pandas"  [import-untyped]
path/to/file//x_xerr.py:5:1:5:1: note: Hint: "python3 -m pip install pandas-stubs"
path/to/file//x_xerr.py:5:1:5:1: note: (or run "mypy --install-types" to install all missing stub packages)
path/to/file//x_xerr.py:6:1:6:1: error: Skipping analyzing "optax": module is installed, but missing library stubs or py.typed marker  [import-untyped]
path/to/file//x_xerr.py:7:1:7:1: error: Skipping analyzing "pzflow": module is installed, but missing library stubs or py.typed marker  [import-untyped]
path/to/file//reg.py:2:1:2:1: error: Skipping analyzing "scipy.spatial": module is installed, but missing library stubs or py.typed marker  [import-untyped]
path/to/file//ks.py:2:1:2:1: error: Skipping analyzing "utilize.ndtest": module is installed, but missing library stubs or py.typed marker  [import-untyped]
path/to/file//ks.py:2:1:2:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
path/to/file//ks.py:3:1:3:1: error: Skipping analyzing "utilize.Bcorner": module is installed, but missing library stubs or py.typed marker  [import-untyped]
path/to/file//ks.py:5:1:5:1: error: Skipping analyzing ".grid_search": module is installed, but missing library stubs or py.typed marker  [import-untyped]
path/to/file//ks.py:94:1:94:16: error: Missing positional arguments "arg0", "arg1" in call to "print_mean_std"  [call-arg]

When I set Reporting Scope as workspace, it actually show all problems in PROBLEMS, but when I click the problem, it open a new file named path/to/file/ks.py but not jump to the corresponding line in current opened file (ks.py). Actually, path/to/file/ks.py and ks.py are same file.
image

If this behavior is by design, how could I set the extention to make it as previous. By "previous", I mean when we use

{
    "python.linting.mypyEnabled": true,
    "python.linting.enabled": true
}

to use mypy. In that time, all found problems will be shown in PROBLEMS, when I click the reported preblems, it just jump to the corresponding line in current file.

@karthiknadig
Copy link
Member

This looks like a bug. I will need to look into this.

The following settings are deprecated:

{
    "python.linting.mypyEnabled": true,
    "python.linting.enabled": true
}

@karthiknadig karthiknadig self-assigned this Nov 2, 2023
@karthiknadig
Copy link
Member

Can some one running into this issue provide logs with actual file names? it seems like the file name computation is going wrong somehow.

@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster labels Dec 13, 2023
@tlc
Copy link

tlc commented Dec 19, 2023

  1. Thank you OP for pointing out "Reporting Scope". It was very frustrating getting nothing in my "Problems" list.
  2. I confirm the "Opens new copy of file" behavior.

These are the mypy logs from clicking on the problem

2023-12-19 14:42:31.346 [info] [Trace - 2:42:31 PM] Sending notification 'textDocument/didOpen'.
2023-12-19 14:42:31.357 [info] [Trace - 2:42:31 PM] Received notification 'window/logMessage'.
2023-12-19 14:42:31.357 [info] /home/tlc/miniconda3/envs/PROJ/bin/python -m mypy --no-color-output --no-error-summary --show-absolute-path --show-column-numbers --show-error-codes --no-pretty --show-error-end /home/tlc/my/workplace
2023-12-19 14:42:31.359 [info] [Trace - 2:42:31 PM] Received notification 'window/logMessage'.
2023-12-19 14:42:31.359 [info] CWD Server: /home/tlc/my/workplace

Other clues:

  1. In the opened files tab, it shows "name.py ~/.../abbrev/path..." This is probably automatic differentiation by VSCode.
  2. Subsequent clicks on problems in that file go to the same wrongly opened copy. They don't open another.

@tlc
Copy link

tlc commented Dec 19, 2023

Please note that this is two bugs. "extra files opened when in Reporting Scope is 'workplace'" and "no problems shown when Reporting Scope is 'file'"

@iCasture
Copy link

Has there been any progress on this issue? I’m experiencing the same problem.

@karthiknadig
Copy link
Member

@iCasture can you share your full logs from Output > mypy type checker?

@iCasture
Copy link

iCasture commented Feb 2, 2025

@karthiknadig Sorry for the delayed response. Below is the complete log:

2025-02-02 21:49:21.003 [info] Server: Stop requested
2025-02-02 21:49:21.003 [info] [Trace - 21:49:21] Sending request 'shutdown - (1)'.
2025-02-02 21:49:21.006 [info] [Trace - 21:49:21] Received response 'shutdown - (1)' in 3ms.
2025-02-02 21:49:21.006 [info] [Trace - 21:49:21] Sending notification 'exit'.
2025-02-02 21:49:21.009 [info] Server run command: /Users/icasture/.dotfiles/python_scripts/.venv/bin/python /Users/icasture/.vscode/extensions/ms-python.mypy-type-checker-2024.0.0/bundled/tool/lsp_server.py
2025-02-02 21:49:21.009 [info] Server: Start requested.
2025-02-02 21:49:21.283 [info] CWD Server: /Users/icasture/Projects/GitHub/dotfiles/shell_commands/dot-dotfiles/python_scripts
2025-02-02 21:49:21.283 [info] Settings used to run Server:
[
    {
        "cwd": "/Users/icasture/.dotfiles/python_scripts",
        "workspace": "file:///Users/icasture/.dotfiles/python_scripts",
        "args": [],
        "severity": {
            "error": "Error",
            "note": "Information"
        },
        "path": [],
        "ignorePatterns": [],
        "interpreter": [
            "/Users/icasture/.dotfiles/python_scripts/.venv/bin/python"
        ],
        "importStrategy": "useBundled",
        "showNotifications": "off",
        "extraPaths": [],
        "reportingScope": "file",
        "preferDaemon": false
    }
]

2025-02-02 21:49:21.283 [info] Global settings:
{
    "cwd": "${workspaceFolder}",
    "workspace": "/",
    "args": [],
    "severity": {
        "error": "Error",
        "note": "Information"
    },
    "path": [],
    "ignorePatterns": [],
    "interpreter": [],
    "importStrategy": "useBundled",
    "showNotifications": "off",
    "extraPaths": [],
    "reportingScope": "file",
    "preferDaemon": false
}

2025-02-02 21:49:21.283 [info] sys.path used to run Server:
   /Users/icasture/Projects/GitHub/dotfiles/shell_commands/dot-dotfiles/python_scripts
   /Users/icasture/.vscode/extensions/ms-python.mypy-type-checker-2024.0.0/bundled/libs
   /Users/icasture/.vscode/extensions/ms-python.mypy-type-checker-2024.0.0/bundled/tool
   /Users/icasture/.local/share/python-libs
   /Users/icasture/.pyenv/versions/3.13.1/lib/python313.zip
   /Users/icasture/.pyenv/versions/3.13.1/lib/python3.13
   /Users/icasture/.pyenv/versions/3.13.1/lib/python3.13/lib-dynload
   /Users/icasture/.dotfiles/python_scripts/.venv/lib/python3.13/site-packages
2025-02-02 21:49:21.284 [info] /Users/icasture/.dotfiles/python_scripts/.venv/bin/python -m mypy --version
2025-02-02 21:49:21.284 [info] CWD Server: /Users/icasture/.dotfiles/python_scripts
2025-02-02 21:49:21.367 [info] 
mypy 1.11.2 (compiled: no)


2025-02-02 21:49:21.367 [info] Version info for linter running for /Users/icasture/Projects/GitHub/dotfiles/shell_commands/dot-dotfiles/python_scripts:
mypy 1.11.2 (compiled: no)

2025-02-02 21:49:21.367 [info] SUPPORTED mypy>=1.0.0
FOUND mypy==1.11.2

2025-02-02 21:49:21.372 [info] [Trace - 21:49:21] Received notification 'window/logMessage'.
2025-02-02 21:49:21.372 [info] /Users/icasture/.dotfiles/python_scripts/.venv/bin/python -m mypy --no-color-output --no-error-summary --show-absolute-path --show-column-numbers --show-error-codes --no-pretty --show-error-end /Users/icasture/.dotfiles/python_scripts/src/common/setup_logging.py
2025-02-02 21:49:21.372 [info] [Trace - 21:49:21] Received notification 'window/logMessage'.
2025-02-02 21:49:21.372 [info] CWD Server: /Users/icasture/.dotfiles/python_scripts
2025-02-02 21:49:21.652 [info] [Trace - 21:49:21] Received notification 'window/logMessage'.
2025-02-02 21:49:21.652 [info] file:///Users/icasture/.dotfiles/python_scripts/src/common/setup_logging.py :
/Users/icasture/.dotfiles/python_scripts/src/common/setup_logging.py:412:32:412:64: error: Incompatible types in assignment (expression has type "TimeFormatter", variable has type "TimeColorFormatter")  [assignment]

2025-02-02 21:49:21.652 [info] [Trace - 21:49:21] Received notification 'window/logMessage'.
2025-02-02 21:49:21.652 [info] file:///Users/icasture/.dotfiles/python_scripts/src/common/setup_logging.py :
/Users/icasture/.dotfiles/python_scripts/src/common/setup_logging.py:412:32:412:64: error: Incompatible types in assignment (expression has type "TimeFormatter", variable has type "TimeColorFormatter")  [assignment]

2025-02-02 21:49:21.655 [info] [Trace - 21:49:21] Received notification 'textDocument/publishDiagnostics'.

From the log, we can see that mypy detected errors, but there is no output from the mypy extension in the PROBLEMS window of VS Code. Additionally, there are no corresponding markers in the file.

@karthiknadig karthiknadig added needs investigation and removed triage-needed info-needed Issue requires more information from poster labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug needs investigation
Projects
None yet
Development

No branches or pull requests

4 participants