-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Support package and module in config files #10728
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
Labels
Comments
Reasonable feature request. |
akkornel
added a commit
to stanford-rc/mais-apis-python
that referenced
this issue
Jun 28, 2021
This switches to using MyPy's package-discovery mechanism, having it enumerate and then type-check everything within and under `stanford.mais`. (`stanford.mais` is used instead of `stanford` in case anything else starts using that namespace.) This is better than listing a directory to check, because it ensures that all modules have been discovered, and their relationships laid out. Unfortunately, although it's possible to provide a list of files/directories in config, you can't do this with modules/packages. I've requested support for this in python/mypy#10728
hauntsaninja
added a commit
that referenced
this issue
Oct 4, 2022
Closes #10728 Co-authored-by: Shantanu <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature
Allow listing modules/packages to check, within the MyPy config files.
Pitch
Today, it is possible to use the
files
config item (in mypy.ini, pyproject.toml, etc.) to tell MyPy what files to check. You can also do this on the command-line, by simply listing the files.If you want MyPy to check an entire module or package, you can do so on the command line (with
-m
or-p
), but there is no way to do this in a config file. Since it is possible to setfiles
in config files, I think it should also be possible to setmodule
andpackage
. (I am suggesting not-plural names "module" and "package" to match the command-line arguments).One question you might ask is "Why don't you just list the directory containing your modules/packages?" In my case, doing so gives me an error like this:
… or an error like this:
All of my code is in the
src
directory. In mypyproject.toml
, I havenamespace_packages = true
andmypy_path = ["src"]
. The above error only happens if I try to specify a file or directory to check. If instead I use-p namespace1
(or-p namespace1.namespace2
), everything is located, loaded, and typechecked successfully.The text was updated successfully, but these errors were encountered: