Skip to content

Make cache more agnostic to venvs #18013

@Redoubts

Description

@Redoubts

I noticed that the mypy cache will mark almost everything as stale if the cache was produced with a venv different from the one running mypy. I think this is due to a full path being placed into cache files & interface_hashes, for files that are stdlib or packages. Then those packages, and everything depending on them, gets invalidated (which ends up being 99% of everything in big projects). I think it would be cool if the cache were more agnostic to this, for two reasons:

  1. when testing locally, I occasionally use a second venv with maybe 1 or 2 different packages to test out changes (maybe a package upgraded or added types). Ideally only those packages and their descendants would be invalidated.
  2. when trying out remote caches, the CI venv will be "different" (existing at a different path), but the lockfile will be exactly the same. Ideally nothing would be invalidated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions