#17739 We can/should partition more tools by config (black, flake8, etc...)
Issue created by
mpcusack-color
Is your feature request related to a problem? Please describe.
Originally discussed on slack:
https://pantsbuild.slack.com/archives/C046T6T9U/p1670281834539229
A large (and knotted) portion of my monorepo is a django project. We would like start using pants to do mypy type checking on it and use
mypy_django_plugin. The problem is mypy config plugin installation applies everywhere and installing this plugin requires that we add our entire django project as a mypy dependency, even when checking a file that is not part of the django code.
Having the django plugin is not absolutely required to run mypy on this code, but it makes the user experience significantly better and would likely speed up fixing all the current errors.
Mypy doesn’t have support for only enabling a plugin for a subset files/roots. There is only one configuration file ($ROOT/mypy.ini) and it doesn’t support hierarchical config like pytest’s conftest.py.
To enable the django plugin in mypy you need to make the project settings module and all transitive deps (the entire django app) a mypy tool resolve dependency. The plugin throws an error if the project can’t be
django.setup()
.
Describe the solution you'd like
What I need is a way in pants to specify more than one mypy config file and then specify that certain targets should use the non default one. Apparently scalafmt already somewhat does this?
Related:
#17328
pantsbuild/pants