Skip to content

CI: prevent virtualenv redirect from occupying .venv - #26167

Merged
Eleanor Boyd (eleanorjboyd) merged 3 commits into
microsoft:mainfrom
eleanorjboyd:agents/venv-ci-path-diagnostics
Sep 25, 2026
Merged

Eleanor Boyd (eleanorjboyd) merged 3 commits into
microsoft:mainfrom
eleanorjboyd:agents/venv-ci-path-diagnostics

Conversation

@eleanorjboyd

@eleanorjboyd Eleanor Boyd (eleanorjboyd) commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Why

The virtualenv 21.12.0 update introduced a PEP 832 .venv redirect: when a project has a pyproject.toml, creating .virtualenv can also write a .venv file pointing to it. Our CI workflow copies in a pyproject.toml, creates .virtualenv for virtualenv tests, then runs python -m venv .venv for separate stdlib venv tests. Once virtualenv started writing that file, the latter command could no longer create its .venv directory. The passing run installed virtualenv 21.11.1; the failing release-branch runs installed 21.12.1.

Change

Pass --no-venv-redirect when creating .virtualenv. This opts out of the newly added side effect while keeping the two existing test environments at their original paths: .virtualenv for virtualenv and .venv for stdlib venv. Stop immediately if stdlib venv creation fails rather than reporting the subsequent missing executable as the primary error.

Related to #26164. The release branch still needs this fix and a passing Build workflow before release.

The venv matrix failed on both Windows and Linux when .venv was already occupied. Give the venv test interpreter a distinct path and log .venv state around setup so the producer of the collision can be identified in the next CI run.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@eleanorjboyd Eleanor Boyd (eleanorjboyd) added the no-changelog No news entry required label Sep 24, 2026
virtualenv 21.12 writes a .venv redirect file next to .virtualenv when a pyproject.toml exists. Disable that redirect so the following stdlib venv step can create its intended .venv directory.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@eleanorjboyd Eleanor Boyd (eleanorjboyd) changed the title CI: diagnose and avoid venv setup path collision CI: prevent virtualenv redirect from occupying .venv Sep 24, 2026
Keep the virtualenv redirect opt-out and explicit venv creation failure check; the path logging is no longer needed now that the collision is confirmed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@eleanorjboyd
Eleanor Boyd (eleanorjboyd) marked this pull request as ready for review September 25, 2026 15:10
@eleanorjboyd
Eleanor Boyd (eleanorjboyd) merged commit 70f695e into microsoft:main Sep 25, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog No news entry required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants