Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ignore CWD for explicit package bases #14269

Open
greschd opened this issue Dec 9, 2022 · 0 comments
Open

Ignore CWD for explicit package bases #14269

greschd opened this issue Dec 9, 2022 · 0 comments
Labels

Comments

@greschd
Copy link

greschd commented Dec 9, 2022

Feature

Add an option (name TBD) to ignore the current directory when looking for namespace package bases.

As far as I can tell, the behavior would have to be modified here (optionally leaving out [os.getcwd()]:

roots = mypy_path() + options.mypy_path + [os.getcwd()]

Pitch

When type-checking a repository with src/ structure, there can be conflicts between installed Python modules, and directories which are located at the root of the repository (assuming that is the CWD for running mypy).
I stumbled upon this by having a directory called docker/, while also having https://pypi.org/project/docker/ installed.

As far as I could tell, there's currently no satisfactory way for mypy to accept this, besides renaming the directory.

Happy to take a stab at implementing this, if you feel it's worth adding.

Related discussion: #8584

@greschd greschd added the feature label Dec 9, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant