-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Feature
Offer configuration variables for packages and modules to match the command-line flags, much like files matches listing files on the command line. Intended to work exactly like the command line flags, with the exception that they would not override a files key and having files and either of the new keys in the same config file would create a conflict.
Usage meant to be something like this (actual code this would work with linked below):
[mypy]
python_version = 3.7
packages=spack,builtin.packages,builtin_mock.packages
mypy_path=bin,lib/spack,lib/spack/external,var/spack/repos/builtinTo match a command line like mypy -p spack -p builtin.packages -p builtin_mock.packages
Pitch
The main use comes from, spack, a project I'm adding type checking to. It's a package manager where the libraries, tool and all package definition files are written in python. Having mypy check the library without arguments is simple, I can just write a files key that covers all files and it will work fine, but the packages are in a structure like this:
./var/spack/repos/
├── builtin
│ ├── packages
│ │ ├── 3proxy
│ │ │ └── package.py
│ │ ├── abduco
│ │ │ └── package.py
│ │ ├── abi-compliance-checker
│ │ │ └── package.py
... etc.
If I use a files key for these, they are all treated as duplicate package modules, and mypy errors out (probably appropriately). They can however be treated as a package, and mypy works quite well on the library and the whole package tree in that mode (especially after the recursive checking fixes). The trick now is that I can't make running mypy check the packages tree without arguments or wrapping or similar.
I'd like to add support for specifying these in the configuration file to bring them up to the same level of support as listing files, as mentioned in PR #9834.