python / python/mypy

Put the .mypy_cache directory near the project configuration file instead of at the current working directory

Open
#15,466 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Feature

If there is a project configuration file (pyproject.toml, mypy.ini etc), make the default .mypy_cache directory be near the configuration file instead of at the current working directory.

Pitch

Currently, the .mypy_cache directory is created by default in the current working directory. I was very surprised to find this. It means that I probably have many .mypy_cache directories hanging around in unexpected places, possibly in unrelated projects. It also means that I had to wait for the cache to be rebuilt when there was a perfectly good cache sitting elsewhere.

I think that when there is a notion of a project, the .mypy_cache directory should be at the root of the project. So, when mypy uses a project configuration file, I think that since there is an obvious project directory, the .mypy_cache directory should be there.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing mypy's project-configuration discovery and the code that chooses the default .mypy_cache location. Check how pyproject.toml, mypy.ini, and related configuration files establish a project directory, then define and test the behavior for configured versus current-working-directory runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.