Skip to content

Tolerate uv truncated pyvenv.cfg version_info#153

Merged
gaborbernat merged 3 commits into
tox-dev:mainfrom
gaborbernat:fix-152-uv-pyvenv-version
Jun 19, 2026
Merged

Tolerate uv truncated pyvenv.cfg version_info#153
gaborbernat merged 3 commits into
tox-dev:mainfrom
gaborbernat:fix-152-uv-pyvenv-version

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

What

uv 0.11.22 (astral-sh/uv#19890) changed seeded venvs to record only major.minor in pyvenv.cfg (e.g. version_info = 3.14) instead of the full 3.14.6. pre-commit's health_check does an exact-string comparison against our _version_info override, so the second hook run failed with:

AssertionError: BUG: expected environment for python to be healthy immediately after install
virtualenv python version did not match created version:
- actual version: 3.14.6
- expected version: 3.14

Fix

Override python.health_check with a prefix-aware comparison that checks only the version components uv actually wrote, so it passes whether uv records two or three components. The now-redundant _version_info monkeypatch is dropped — health_check was its only consumer.

Verified by reproducing the issue scenario end-to-end with uv 0.11.22 (fails on main, passes here) and added unit tests covering truncated/full/mismatched/missing-config cases.

Fixes #152

uv 0.11.22 (astral-sh/uv#19890) writes only the major.minor into a
seeded venv's pyvenv.cfg (e.g. "3.14") instead of the full "3.14.6".
pre-commit's health_check then fails the exact-match comparison against
our _version_info override, raising "expected environment to be healthy
immediately after install".

Override health_check with a prefix-aware comparison that checks only
the version components uv actually recorded, so it passes whether uv
writes two or three components. Drop the now-redundant _version_info
monkeypatch since health_check was its only consumer.

Fixes tox-dev#152
@gaborbernat gaborbernat merged commit dfe7d0c into tox-dev:main Jun 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken by uv 0.11.22

1 participant