Versions:
Python 3.9.1
mypy==0.910
I'm unsure why mypy will output a different set of errors when run with mypy . vs running with mypy <path to file>
When running mypy . --strict --show-error-codes the result is different to doing mypy <path to file> --strict --show-error-codes.
For example, looking at code from https://github.com/raphaelvallat/pingouin (commit id ea8b560, file being used as an example here is: https://github.com/raphaelvallat/pingouin/blob/f40df480e137af8df35a3a3164d2d900b79091a6/pingouin/utils.py#L10).
Running : mypy . --strict --show-error-codes --exclude "./venv/" gives:
(venv) ➜ pingouin git:(master) ✗ mypy . --strict --show-error-codes --exclude "./venv/" > mypy_all_files.txt
(venv) ➜ pingouin git:(master) ✗ grep "pingouin/utils.py" mypy_all_files.txt
pingouin/utils.py:3: error: Cannot find implementation or library stub for module named "numpy" [import]
pingouin/utils.py:4: error: Cannot find implementation or library stub for module named "pandas" [import]
pingouin/utils.py:7: error: Library stubs not installed for "tabulate" (or incompatible with Python 3.9) [import]
pingouin/utils.py:7: note: Hint: "python3 -m pip install types-tabulate"
pingouin/utils.py:7: note: (or run "mypy --install-types" to install all missing stub packages)
pingouin/utils.py:440: error: Cannot find implementation or library stub for module named "statsmodels" [import]
pingouin/utils.py:454: error: Cannot find implementation or library stub for module named "sklearn" [import]
pingouin/utils.py:468: error: Cannot find implementation or library stub for module named "mpmath" [import]
And running mypy ./pingouin/utils.py --strict --show-error-codes > mypy_single_file.txt gives:
(venv) ➜ pingouin git:(master) ✗ mypy ./pingouin/utils.py --strict --show-error-codes > mypy_single_file.txt
(venv) ➜ pingouin git:(master) ✗ grep "pingouin/utils.py" mypy_single_file.txt
pingouin/utils.py:3: error: Cannot find implementation or library stub for module named "numpy" [import]
pingouin/utils.py:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
pingouin/utils.py:4: error: Cannot find implementation or library stub for module named "pandas" [import]
pingouin/utils.py:7: error: Library stubs not installed for "tabulate" (or incompatible with Python 3.9) [import]
pingouin/utils.py:7: note: Hint: "python3 -m pip install types-tabulate"
pingouin/utils.py:7: note: (or run "mypy --install-types" to install all missing stub packages)
pingouin/utils.py:16: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:54: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:78: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:113: error: Call to untyped function "_get_round_setting_for" in typed context [no-untyped-call]
pingouin/utils.py:140: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:157: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:176: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:225: error: Call to untyped function "_remove_na_single" in typed context [no-untyped-call]
pingouin/utils.py:227: error: Call to untyped function "_remove_na_single" in typed context [no-untyped-call]
pingouin/utils.py:232: error: Call to untyped function "_remove_na_single" in typed context [no-untyped-call]
pingouin/utils.py:235: error: Call to untyped function "_remove_na_single" in typed context [no-untyped-call]
pingouin/utils.py:236: error: Call to untyped function "_remove_na_single" in typed context [no-untyped-call]
pingouin/utils.py:260: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:303: error: Call to untyped function "_flatten_list" in typed context [no-untyped-call]
pingouin/utils.py:341: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:379: error: Call to untyped function "_flatten_list" in typed context [no-untyped-call]
pingouin/utils.py:382: error: Call to untyped function "_flatten_list" in typed context [no-untyped-call]
pingouin/utils.py:390: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:399: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:437: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:440: error: Cannot find implementation or library stub for module named "statsmodels" [import]
pingouin/utils.py:451: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:454: error: Cannot find implementation or library stub for module named "sklearn" [import]
pingouin/utils.py:465: error: Function is missing a type annotation [no-untyped-def]
pingouin/utils.py:468: error: Cannot find implementation or library stub for module named "mpmath" [import]
The latter is what I'd be more interested in seeing, and would expect others to be also. I'm not sure why there's a difference, and how to go about having the latter output as default.