Treat relative paths in config file relative to config file, not cwd
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
When using mypy_path = src it should be treated relative to the config file (if any), not the current working directory.
This also applies to the default of cache_dir (.cache_dir), which currently gets created in the current working directory always.
I.e. a detected/found (project) config file could be treated as the root for options with relative defaults also.
As for mypy_path this could be achieved in the type callback, which then however would need the config file / root as a new argument:
https://github.com/python/mypy/blob/84126ab9985844d8cda3809688034af895fdaf7c/mypy/config_parser.py#L75
As for global user config files, it should treat relative files therein relative to it, but it should not be used as a root for default settings like cache_dir.
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 in mypy/config_parser.py around the type callback at line 75 and trace how the detected project config root is passed into option handling. Verify that relative mypy_path values and cache_dir defaults use the project config directory, while relative paths in global user config files use that file's directory without making it the root for default settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100