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

mypy running twice? #253

Closed
shaperilio opened this issue Jan 3, 2024 · 2 comments
Closed

mypy running twice? #253

shaperilio opened this issue Jan 3, 2024 · 2 comments

Comments

@shaperilio
Copy link

I open VSCode, put some bad code in a file, save it, and this is the output I see:

2024-01-02 17:07:49.655 [info] Name: Mypy Type Checker
2024-01-02 17:07:49.655 [info] Module: mypy
2024-01-02 17:07:49.655 [info] Python extension loading
2024-01-02 17:07:49.655 [info] Waiting for interpreter from python extension.
2024-01-02 17:07:49.655 [info] Python extension loaded
2024-01-02 17:07:49.655 [info] Server run command: c:\Users\1\repo\venv\Scripts\python.exe c:\Users\1\.vscode\extensions\ms-python.mypy-type-checker-2023.6.0\bundled\tool\lsp_server.py
2024-01-02 17:07:49.655 [info] Server: Start requested.
2024-01-02 17:07:50.305 [info] CWD Server: c:\Users\1\repo
2024-01-02 17:07:50.315 [info] Settings used to run Server:
[
    {
        "cwd": "c:\\Users\\1\\repo",
        "workspace": "file:///c%3A/Users/1/repo",
        "args": [],
        "severity": {
            "error": "Error",
            "note": "Information"
        },
        "path": [],
        "ignorePatterns": [],
        "interpreter": [
            "c:\\Users\\1\\repo\\venv\\Scripts\\python.exe"
        ],
        "importStrategy": "useBundled",
        "showNotifications": "off",
        "extraPaths": [],
        "reportingScope": "file",
        "preferDaemon": false
    }
]

2024-01-02 17:07:50.316 [info] Global settings:
{
    "cwd": "${workspaceFolder}",
    "workspace": "C:\\Users\\1\\AppData\\Local\\Programs\\Microsoft VS Code",
    "args": [],
    "severity": {
        "error": "Error",
        "note": "Information"
    },
    "path": [],
    "ignorePatterns": [],
    "interpreter": [],
    "importStrategy": "useBundled",
    "showNotifications": "off",
    "extraPaths": [],
    "reportingScope": "file",
    "preferDaemon": false
}

2024-01-02 17:07:50.318 [info] sys.path used to run Server:
   c:\Users\1\repo
   c:\Users\1\.vscode\extensions\ms-python.mypy-type-checker-2023.6.0\bundled\libs
   c:\Users\1\.vscode\extensions\ms-python.mypy-type-checker-2023.6.0\bundled\tool
   C:\Program Files\Python38\python38.zip
   C:\Program Files\Python38\DLLs
   C:\Program Files\Python38\lib
   C:\Program Files\Python38
   c:\Users\1\repo\venv
   c:\Users\1\repo\venv\lib\site-packages
   c:\Users\1\repo\venv\lib\site-packages\win32
   c:\Users\1\repo\venv\lib\site-packages\win32\lib
   c:\Users\1\repo\venv\lib\site-packages\Pythonwin
2024-01-02 17:07:50.318 [info] c:\Users\1\repo\venv\Scripts\python.exe -m mypy --version
2024-01-02 17:07:50.318 [info] CWD Server: c:\Users\1\repo
2024-01-02 17:07:50.558 [info] 
mypy 1.6.1 (compiled: no)


2024-01-02 17:07:50.558 [info] Version info for linter running for C:\Users\1\repo:
mypy 1.6.1 (compiled: no)

2024-01-02 17:07:50.558 [info] SUPPORTED mypy>=1.0.0
FOUND mypy==1.6.1

2024-01-02 17:07:50.569 [info] [Trace - 5:07:50 PM] Received notification 'window/logMessage'.
2024-01-02 17:07:50.569 [info] c:\Users\1\repo\venv\Scripts\python.exe -m mypy --no-color-output --no-error-summary --show-absolute-path --show-column-numbers --show-error-codes --no-pretty --show-error-end c:\Users\1\repo\setup.py
2024-01-02 17:07:50.569 [info] [Trace - 5:07:50 PM] Received notification 'window/logMessage'.
2024-01-02 17:07:50.569 [info] CWD Server: c:\Users\1\repo
2024-01-02 17:07:51.244 [info] [Trace - 5:07:51 PM] Received notification 'window/logMessage'.
2024-01-02 17:07:51.244 [info] file:///c%3A/Users/1/repo/setup.py :
c:\Users\1\repo\setup.py:14:1:32:7: error: Missing return statement  [empty-body]

2024-01-02 17:07:51.250 [info] [Trace - 5:07:51 PM] Received notification 'window/logMessage'.
2024-01-02 17:07:51.250 [info] file:///c%3A/Users/1/repo/setup.py :
c:\Users\1\repo\setup.py:14:1:32:7: error: Missing return statement  [empty-body]

2024-01-02 17:07:51.251 [info] [Trace - 5:07:51 PM] Received notification 'textDocument/publishDiagnostics'.

It looks as if mypy is running twice; the version is reported twice and the same error is reported twice.

@karthiknadig
Copy link
Member

mypy has only run once, we log the raw output from mypy and once more when we parse it. So you see the result shown twice in logs. But you see the command line run only once.

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Jan 3, 2024
@ollie-bell
Copy link

ollie-bell commented Oct 6, 2024

mypy has only run once, we log the raw output from mypy and once more when we parse it. So you see the result shown twice in logs. But you see the command line run only once.

It seems to me like duplicate error reporting is an issue. Every mypy error is duplicated when I use this extension. Happy to open a new issue if this is not related to this issue, but OP reports "same error is reported twice." so I believe I am seeing the same issue.

image

EDIT:

It seems like uninstalling and re-installing the extension has resolved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants