-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
a way to exclude directories from files or ignore errors in certain directories #8309
Comments
It is unlikely mypy will support file wildcards in foreseeable future, since module is a "fundamental" build unit. For such complex cases you can have a short script to calculate exact list of files to check and pass it to mypy using |
That works for CI, now all of the other developers on my projects need to know that they need to run some script that I write to wrap mypy, and sort of breaks the elegance of pre-configuring a mypy.ini file and then just being able to run I understand your explanation of why you wouldn't want to support sections based on file wildcards, but why not an |
IMO this would be really low priority, since this is a rare case and there is already one way to do it. However, if anyone else on the team thinks this may be useful, they will re-open the issue. |
Would it help if I were to volunteer to implement it? |
Most likely yes, I will leave this up to @JukkaL to decide. |
@JukkaL did you get a chance to consider this use case? |
I don't think it's such a rare use case. flake8 and black both have |
Hi, +1 for |
Basically a dupe of #4675, which I re-opened |
@hauntsaninja -- but perhaps helpful if you answer @brianmaissy 's question as to whether he could contribute a PR here -- IMHO no reason for him to have to run around to different threads with his offer to help... |
Isn't an exclude option documented on https://mypy.readthedocs.io/en/latest/command_line.html#cmdoption-mypy-exclude ? |
Maybe that would have covered my use case if it had existed then; honestly in the last year and a half I've forgotten exactly what my original use case was. Apparently I found an acceptable workaround. 🤷♂️ |
I have a use case for which I am having trouble finding a way to configure my
mypy.ini
.I have a project which includes (for whatever legacy reason) a directory containing nested subdirectories (not modules) of python scripts inside my codebase.
The directory structure is something like this:
These files are included in my
files=myproject/**/*.py wildcard
, but I would like to find a way to exclude them from mypy (or to ignore errors found in them).I can define
ignore_errors = True
for specific submodules, but the scripts are not part themyproject.scripts
module because the subdirectories aren't modules.Obviously the correct solution is to move the scripts directory outside of the
myproject
module, but let's say that isn't within my power.I could also create
__init__.py
files in all of the subdirectories (and nested subdirectories), turning them into artificial modules, but let's also that that isn't within my power.What I'm looking for is a way to define a wildcard of files to be excluded from the
files=
configuration parameter, or a way to define a subsection in the configuration file based on a files wildcard rather than a module wildcard, and then I can configureignore_errors = True
.Is there some other suggested solution, or could something along the lines of one of these be implemented?
The text was updated successfully, but these errors were encountered: