Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Detect if shell is in activated virtual environment, but mypy is not installed in it. #17214

Open
ethanhs opened this issue May 4, 2024 · 0 comments

Comments

@ethanhs
Copy link
Collaborator

ethanhs commented May 4, 2024

Feature

Detect if $VIRTUAL_ENV is defined when running mypy, potentially only if we report missing imports.

Pitch

Right now, if mypy is installed globally, and a user activates a virtual environment, they could be confused about missing import errors (e.g. #7237) where the packages are installed in the virtual environment but mypy can't see them. In such a scenario, we'd be able to detect that $VIRTUAL_ENV is set, and we could report a warning if that path doesn't match the prefix of sys.executable.

One question about this is should we report this in general or only if we report a missing import.

I think there probably are use cases where people don't care about running mypy globally, so my initial inclination would be to only report this and suggest --python-executable if an import is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant