-
|
I'm facing a configuration problem with Pants + mypy in a monorepo. I’m trying to keep a monorepo layout. The problem arises when executing: I have set mypy to use django-stubs for type checking inside of django_project, but the Django-specific mypy configuration is being applied to all Python targets including pure_python. This causes errors such as: because pure_python obviously has no Django settings module. I want Django type-checking with django-stubs only for django_project/. However MyPy seems to apply plugin config globally. This makes non-Django packages fail pants check. Is there a recommended way to scope mypy configuration to only certain targets / source roots so that Django settings aren't required for unrelated packages? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
|
Can you mock up a repo that demonstrates this? There are potentially many moving parts, and it's hard to know what exactly is going on without seeing them all in action |
Beta Was this translation helpful? Give feedback.
-
|
How do you reproduce the mypy issue you're having? |
Beta Was this translation helpful? Give feedback.
-
|
Going to close this as answered, but feel free to reopen if necessary! |
Beta Was this translation helpful? Give feedback.
OK, this is not surprising.
pythondoes not depend onserverand so does not pull it in to the sandbox. But yourpyproject.tomlcontainsdjango_settings_module = "server.core.settings"which causes Django to look for that package.In other words you've configured your repo under the assumption that
serveris always available.Note that you can run
pants check ::in the root directory, and that works becauseserveris part of that::.