Repository navigation
Conversation
Add a publish-pypi.yml workflow that builds the wheels and sdist and publishes them to PyPI over OIDC, so releases no longer need a PyPI token on a maintainer's machine. Publishing runs in the `pypi` environment, which gates it behind a reviewer approval, and a dry run is the default. The build job checks that every expected wheel exists with the right platform tag and native library, since build-wheels.sh doesn't stop when a single build fails. Pull requests that touch the build run that job as a check. build-wheels.sh gains a USE_PYENV=false mode so CI can call pythonX.Y directly, and the Makefile exposes PYTHON_VERSIONS so CI and local releases build the same versions. The local `make release` path stays as a fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ubuntu-latest now resolves to Ubuntu 26.04, which actions/setup-python has no Python 3.9 build for, so the build job failed while installing Python. Ubuntu 24.04 has builds for every version we ship wheels for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Adds a Publish to PyPI (trusted publishing) workflow (
.github/workflows/publish-pypi.yml). It builds the wheels and sdist and publishes them to PyPI over OIDC, so releasing no longer needs a PyPI token on a maintainer's machine. It follows the same pattern as the JS SDK's npm trusted publishing workflow.workflow_dispatch), withchannel(beta / stable) anddry_runinputs. Dry run is on by default.buildjob (read-only, no OIDC token):version.pyagainst the channel, and against PyPI so an already-released version can't be republished.make build-wheels.twine check --strictpasses. This matters becausebuild-wheels.shdoesn't stop when a single build fails.publishjob: the only job withid-token: write. It runs in thepypienvironment, so it waits for a reviewer's approval, then uploads the files the build job produced with attestations.releasejob: after a real publish, creates thevX.Y.Ztag and the GitHub release, like the JS workflow.buildjob, as a check. They never reachpublish.Supporting changes:
build-wheels.sh: aUSE_PYENV=falsemode for CI that callspythonX.Ydirectly. Local runs still use pyenv by default.Makefile: aprint-python-versionstarget, so CI and local releases build the same Python versions.release.sh: a comment marking it as the fallback path. The localtwineupload is kept as a backup until a CI release has gone through.src/release/README.md: documents the new publish flow, the one-time setup, and the fallback.Why
Python SDK releases are currently uploaded by hand from a laptop with a long-lived PyPI token. Trusted publishing replaces that token with short-lived credentials issued to this workflow, and puts every publish behind a reviewed GitHub environment.
Before the first real publish
These are one-time setup steps outside this PR:
pypienvironment. Allow deployment frommain,betaandrelease/*only. Require review from1Password/open-sourceand turn on "Prevent self-review". No secrets are needed.onepassword-sdkproject (Manage → Publishing) with owner1Password, repositoryonepassword-sdk-python, workflowpublish-pypi.ymland environmentpypi.Merging this before step 2 is safe. Until the trusted publisher exists, a non-dry-run attempt fails at the OIDC exchange and nothing is uploaded.
Notes for reviewers
github-actions[bot]as lightweight tags pointing at the signed merge commit, the same as the JS SDK.release.shused to create GPG-signed annotated tags.workflow_dispatchonly shows up once this is onmain, so the first dry run happens after merge. Before that, this PR's own run of thebuildjob covers the build on all five Python versions.actionlintandshellcheckare clean. A CI-mode build with Python 3.11 and 3.12 produced correctly tagged wheels. The file and version checks also fail as expected on missing wheels, missing native libraries, a channel/version mismatch and an already-published version.🤖 Generated with Claude Code