`MYPYPATH` is not being used when no modules or packages are specified
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
I'm doing unit tests on some files where I make some assertions using typing.assert_type, and want to run mypy on these files. I need to specify a custom stubs directory, and I've tried using mypy_path with no success. It looks like it is only taken into account if modules (-m) or packages (-p) are being specified?
I'm basically running mypy like the following: MYPYPATH=/path/to/custom/stubs mypy file_under_test.py
Is there a reason/technical limitation to not take it into account?
Thanks!
To Reproduce
See command above
Your Environment
- Mypy version used: 1.8.0
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 reproducing the command shown in the issue, then inspect mypy/main.py around lines 1405-1410 to trace how file arguments differ from module or package arguments. The work is done when MYPYPATH is honored for a direct file invocation and the behavior is covered by an appropriate regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100