-
Notifications
You must be signed in to change notification settings - Fork 28
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
Automatically use mypy.ini or pyproject.toml when not in the root directory of the workspace #190
Comments
https://mypy.readthedocs.io/en/latest/config_file.html#the-mypy-configuration-file suggests the configuration file is detected automatically by mypy and so the extension shouldn't have to do anything special. Or am I misunderstanding what you're asking for? |
However, mypy will auto-detect |
@theomessin ah, gotcha. And since mypy doesn't walk up the directory hierarchy looking for a config it won't find it if you're linting a file in a subdirectory. Please do consider upvoting microsoft/vscode-python#1577 as that's probably going to be the easiest way to see this resolved. |
Any updates? |
@brettcannon With the PEP-621 migration, mypy is also able to read Maybe we should rename this ticket into "mypy-plugin support should load config from same default locations as mypy itself, without requiring any configuration" |
@ssbarnea We have a usecase where we don't store the mypy settings in Currently we have to do this to make mypy work:
|
I renamed it to try to make it clearer while keeping some keywords in it to facilitate searching. |
There is a |
@karthiknadig can we please reopen? What does seem to work without any hiccups is the following: "mypy-type-checker.args": [
"--config-file=${workspaceFolder}/pyproject.toml"
] However, it would be nice not to have to specify this since it is quite boilerplate configuration |
@evbo Can you elaborate on your scenario? like what is the directory structure and where are your config files. From your what is see above it looks like you have a single The |
It is a mono repo, like: project_root
python_module_a
pyproject.toml
venv
folder
source.py
source.py
python_module_b |
Do you have a settings file you can share? and also do you have or tried using |
Thanks, I have not used the multi-workspace configuration but am not really interested in using it for two reasons:
|
@evbo This really is a bug on I recommend creating an issue, and we are open to a PR on this.
The changes should happen in here: vscode-mypy/bundled/tool/lsp_server.py Line 204 in 85a7af3
|
When using the Mypy linter, our standard is to have a
mypy.ini
in the project's root with a bunch of config values. Currently we have our developers use this setting for vscode:However, if a project doesn't have a
mypy.ini
file linting fails silently (which can cause a lot of issues as a dev might think that mypy worked fine).I think that auto-detecting and using the
mypy.ini
file should be a part of the plugin itself.The text was updated successfully, but these errors were encountered: