Skip to content

[PETOSS-980] Fix twine install escaping the venv in publish workflow - #239

Merged
the-chris-mitchell merged 2 commits into
masterfrom
PETOSS-980-fix-publish-twine-install
Aug 10, 2026
Merged

[PETOSS-980] Fix twine install escaping the venv in publish workflow#239
the-chris-mitchell merged 2 commits into
masterfrom
PETOSS-980-fix-publish-twine-install

Conversation

@the-chris-mitchell

Copy link
Copy Markdown
Contributor

Summary

  • The Publish & Release SDK workflow's Install dependencies step ran sudo pip install twine after activating a venv. sudo doesn't inherit the venv's PATH, so twine was installed into the runner's system Python instead.
  • Twine 7.0.0 requires packaging>=26.1, so pip tried to upgrade the system's packaging package — which was installed via apt/debian and has no pip RECORD metadata — causing ERROR: Cannot uninstall packaging 24.0, RECORD file not found and failing the job (run 31346531884).
  • Each run: block is a fresh shell, so the venv activated in Install dependencies didn't carry over to the later Publish to PyPi step anyway — that's why the original code used sudo in the first place (to force twine onto the system Python so it stayed reachable). The real fix: install twine inside the venv, then append the venv's bin dir to $GITHUB_PATH so it stays resolvable in later steps without ever touching the apt-managed system packages.

Test plan

  • Verified locally with act (catthehacker/ubuntu:act-latest, which ships the same apt-installed python3-packaging 24.0-1 as the real runner):
    • Reproduced the original failure with the old sudo pip install twine step.
    • Confirmed the fixed step installs twine cleanly inside the venv, twine --version resolves correctly in a later step with no venv re-activation, and the apt packaging package is left untouched.
  • Re-run the Publish & Release SDK workflow via workflow_dispatch and confirm the Install dependencies and Publish to PyPi steps succeed end to end.

Chris Mitchell added 2 commits August 10, 2026 13:33
sudo pip install twine ran outside the activated venv and tried to
upgrade the system's apt-installed packaging package, which has no
pip RECORD metadata and can't be uninstalled, failing the Install
dependencies step. Install twine via the venv's pip instead.
Each workflow run: block is a fresh shell, so the venv activated in
Install dependencies didn't carry over to the Publish to PyPi step.
Append the venv's bin dir to GITHUB_PATH so twine keeps resolving
there without needing to escape the venv via sudo.

Verified locally with act (catthehacker/ubuntu:act-latest, which has
the same apt-installed python3-packaging 24.0 as the real runner):
the old sudo pip install step fails the same way, the new step
installs twine cleanly inside the venv, twine --version resolves
correctly in a later step with no venv activation, and the apt
packaging package is left untouched.
@the-chris-mitchell
the-chris-mitchell marked this pull request as ready for review August 10, 2026 02:01

@ryanNexus ryanNexus left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔥

@the-chris-mitchell
the-chris-mitchell merged commit 7e27f98 into master Aug 10, 2026
4 checks passed
@the-chris-mitchell
the-chris-mitchell deleted the PETOSS-980-fix-publish-twine-install branch August 10, 2026 02:03
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.

2 participants