Detect if shell is in activated virtual environment, but mypy is not installed in it.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
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. https://github.com/python/mypy/issues/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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how mypy reports missing imports and how it determines the running interpreter from sys.executable. Compare that prefix with the VIRTUAL_ENV value, and decide whether the warning should be limited to missing-import cases and recommend --python-executable; done means the behavior and scope are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100