Closed MrGreenTea closed 10 months ago
I've built a first draft in my fork for setting this from the pylsp-mypy
configuration. I would prefer also being able to read the configuration from the mypy
configuration, but as this does not yet happen for anything else I am reluctant to add it.
What is wrong with having this set in pyproject.toml?
What is wrong with having this set in pyproject.toml?
How do you mean that? I dont't see anything wrong with it.
My issue is that I have set it for mypy
in pyproject.toml
as described in this issue. I'd love for pylsp-mypy
to read that info from my pyproject.toml
and not run mypy
for my test files as currently I get a lot of diagnostics in my tests which makes it hard to work on and I often have to disable the pylsp-mypy
plugin completely when writing tests.
As mentioned in the PR #68 I didn't implement reading in the mypy
section from pyproject.toml
because it would be something that the plugin does not yet do for anything else. Because of that my PR needs this to be set specifically for pylsp-mypy
(and therefore duplicated from the mypy
config).
pylsp-mypy does detect the presence of a mypy section in the pyproject.toml
and if present hands it to mypy.
Does that not cover what you intend to do, or does it not work?
Does that not cover what you intend to do, or does it not work?
@Richardk2n The exclude
configuration inside pyproject.toml
for mypy
is correctly handed over to mypy
, but it is not used when you invoke mypy on a single document. In other words: This exclude
option is only used for discovering documents when running mypy
on a whole directory. Which means there is currently not a way fot excluding mypy for a subset of files (eg tests, utility files etc.) with pylsp-mypy
.
What @MrGreenTea introduced in #68 is actually a good workaround and simple solutiom by adding a separate setting to pylsp-mypy
for this. I took the liberty to improve this a bit, see #71
I see. This seems sensible.
Completed with #71
For example I don't want my
test_
files littered withmypy
diagnostics. For this reason mypyproject.toml
looks something like this:I propose to include this configuration option somehow and not run
mypy
on files that match a regex insideexclude
. But I am open to other options as well if they make more sense or are easier to implement :)