Skip to content

Conversation

@cburroughs
Copy link
Contributor

pants_venv maintains two different fingerprints:

  • venv_dir: Where to put the venv
  • activate_pants_venv: Should we delete and recreate the venv

activate_pants_venv hashes the requirements.txt, but venv_dir does not. not so if you ran more than one pants from source -- such as through worktrees or multiple checkouts -- you would get terrible unpredictable results when requirements.txt differed. One script doing pip install while the other does rm -rf does not go well.

Adding the repo/checkout directory to the venv_dir hash gives each Pants checkout

The alternative would be to add requirements.txt to the venv_dir hash, but then you would get many venvs sitting around needing some sort of pruning. Hashing on the repo dir maintains the current "one checkout" = "one activate_pants_venv" behavior like one would have with a regular old.venv.

`pants_venv` maintains two *different* fingerprints:
 * `venv_dir`: Where to put the venv
 * `activate_pants_venv`: Should we delete and recreate the venv

`activate_pants_venv` hashes the requirements.txt, but `venv_dir` does
not.  not so if you ran more than one pants from source -- such as
through worktrees or multiple checkouts -- you would get terrible
unpredictable results when requirements.txt differed.  One script
doing `pip install` while the other does `rm -rf` does not go well.

Adding the repo/checkout directory to the `venv_dir` hash gives each
Pants checkout

The alternative would be to add requirements.txt to the `venv_dir`
hash, but then you would get many venvs sitting around needing some
sort of pruning.  Hashing on the repo dir maintains the current "one
checkout" = "one activate_pants_venv" behavior like one would have
with a regular old`.venv`.
@cburroughs cburroughs self-assigned this Jan 15, 2026
@cburroughs cburroughs added the release-notes:not-required [CI] PR doesn't require mention in release notes label Jan 15, 2026
@cburroughs cburroughs marked this pull request as ready for review January 15, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes:not-required [CI] PR doesn't require mention in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant