mypy evaluates `files` config property relative to current working directory iso config file location
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
In https://github.com/python/mypy/pull/18482 support was added for walking up the file system to find the appropriate config file. I wanted to try this out, but ran into a problem.
The config file might contain a section files (and also exclude).
IMO the paths specified there should be considered relative to the location of the config file.
Instead mypy considers them relative to the current working directory (where mypy was invoked).
In order for the 'walk up' functionality to be useful the paths should be interpreted as relative to the config file location.
Actual Behavior
$ mypy
mypy: can't read file 'tests': No such file or directory
Your Environment
- Mypy version used: 1.15
- Mypy configuration options from
mypy.ini(and other config files):files = tests
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
Review PR 18482 and the configuration handling for mypy.ini, especially the files and exclude options. Reproduce the failure from a subdirectory with files = tests, then trace how the config location and current working directory are used. Done means configured paths resolve relative to the config file and the behavior has regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100