Sub-plan 21.3 row G-1. 3-step procedure for publishing a new version of
the Python SDK to PyPI as blockchain0x.
-
PyPI account + project: register the
blockchain0xproject on https://pypi.org/. The owner who runs the publish workflow must be a maintainer or owner of that project. -
Public mirror repo: create the public repo
Tosh-Labs/blockchain0x-python(Apache-2.0; default branchmain; no README/license at creation - the first mirror snapshot supplies them). -
GitHub PAT: mint a fine-grained PAT with Contents: read+write on
Tosh-Labs/blockchain0x-pythononly. Store as the secretMIRROR_TO_PUBLIC_GITHUB_PAT_TOKENonTosh-Labs/blockchain0x-app(reused across SDK mirror workflows). -
PyPI Trusted Publisher binding: on the project's PyPI settings page (Publishing tab), add a new publisher with:
- Publisher: GitHub
- Owner:
Tosh-Labs - Repository name:
blockchain0x-python - Workflow filename:
publish.yml - Environment:
pypi(matches theenvironment: pypifield in the publish workflow)
Trusted Publisher OIDC replaces any long-lived API token; no
PYPI_TOKENsecret is needed.
The Python SDK does not yet have a npm version-equivalent helper, so
edit packages/sdk-python/pyproject.toml directly:
[project]
version = "0.0.2a0" # was "0.0.1a0"PEP 440 pre-release tags: 0.0.2a0 is alpha 0; 0.0.2b0 is beta 0;
0.0.2rc1 is release-candidate 1; 0.0.2 is the final release.
Commit + push to dev:
git add packages/sdk-python/pyproject.toml
git commit -m "chore(sdk-python): bump to 0.0.2a0"
git push origin devFrom the GitHub Actions tab on Tosh-Labs/blockchain0x-app:
- Open the
mirror-sdk-pythonworkflow. - Click Run workflow -> branch
dev. The defaultdry_run=falseis correct for a real release; toggledry_run=truefirst if you want to preview the staged snapshot. - The workflow:
- reads the version from
pyproject.toml, - runs a stdlib-only Python smoke test (compiles every file +
verifies
webhooks.verifyround-trips), - stages the snapshot into
/tmp/snapshot/, - replaces the public repo's contents with the snapshot,
- commits, tags
vX.Y.Z, and pushes.
- reads the version from
On Tosh-Labs/blockchain0x-python:
- Open the
publishworkflow. - Click Run workflow -> branch
main. Thetaginput is informational (PyPI infers alpha/beta from the version string per PEP 440); pickalphafor the typical pre-release iteration. - The workflow:
- builds sdist + wheel via
python -m build, - validates metadata via
twine check, - publishes to PyPI via the
pypa/gh-action-pypi-publishaction, which exchanges the GitHub OIDC token for a short-lived PyPI publish token through the Trusted Publisher binding.
- builds sdist + wheel via
pip install blockchain0x==0.0.2a0 is live within ~1 minute.
pip install --upgrade blockchain0x
python -c "import blockchain0x; print(blockchain0x.__version__)"
python -c "from blockchain0x import webhooks; print(webhooks.SIGNATURE_MISSING)"webhooks.SIGNATURE_MISSING should print webhook.signature_missing.
PyPI does NOT permit overwriting a published version. A bad release is
yanked (still in the index but excluded from pip install resolution)
and a fixed version published:
# On pypi.org, navigate to the version row and click "Options" -> "Yank"
# with a short reason ("regression: <description>").Then bump pyproject.toml to the NEXT patch and re-run Steps 1-3.
- packages/sdk-node/RELEASING.md - the npm flow this procedure parallels.
- docs/concept-api-key-types.md - the SDK's surface decision tree.
- .github/workflows/mirror-sdk-python.yml - the mirror workflow source.
- .public-templates/.github/workflows/publish.yml - the publish workflow template mirrored into the public repo.