You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support glob patterns when configuring mypy_path #9965
Support the glob patterns * and ** in the mypy_path configuration.
Should work the same way as it does for the files configuration.
Pitch
I have a monorepo, with a bunch of python libraries located in a directory called libs.
All packages are namespace packages with the same namespace, but they are kept in their own directory inside of the libs directory:
I don't fully understand why, but mypy seems to recognize the packages when putting a py.typed file in the top namespace (such as in pkg-a in your example).
Do you think this is a good enough workaround until the feature would be added @gustavgransbo?
EDIT:
maybe I went a little bit too fast here. The code editor is happy, but when running the mypy cli I get a new set of errors such as ...Source file found twice under different module names...
4 years later, mypy still doesn't support PEP 420-based implicit namespace packages properly, forcing us to deal with mypy_path. But as mentioned by @gustavgransbo - it's a total pain when used in a monorepo which could be easily improved with glob support...
Activity
gustavgransbo commentedon Apr 13, 2021
I could have a go at implementing this, unless someone opposes the feature.
DavidVujic commentedon Nov 16, 2022
This would be a great feature! I am trying to figure out how to set the
mypy_pathwith a wildcard, to avoid specifying all paths, also a monorepo.DavidVujic commentedon Nov 16, 2022
I don't fully understand why, but mypy seems to recognize the packages when putting a
py.typedfile in the top namespace (such as inpkg-ain your example).Do you think this is a good enough workaround until the feature would be added @gustavgransbo?
EDIT:
maybe I went a little bit too fast here. The code editor is happy, but when running the
mypycli I get a new set of errors such as...Source file found twice under different module names...jaklan commentedon Mar 22, 2025
4 years later,
mypystill doesn't support PEP 420-based implicit namespace packages properly, forcing us to deal withmypy_path. But as mentioned by @gustavgransbo - it's a total pain when used in a monorepo which could be easily improved withglobsupport...