ci(python-sdk): add automated PyPI release workflow#375
Conversation
- Add release-python-sdk.yml triggered by python-sdk-v* tags or manual dispatch. Validates tag/__version__ consistency, builds sdist+wheel, runs twine check --strict, publishes to PyPI via CUBE_PYPI_TOKEN, then creates a GitHub Release with the built artifacts. Manual dispatch also supports a TestPyPI dry-run target. - Exclude python-sdk-v* tags from release-one-click.yml so the two release pipelines are mutually exclusive. - Make cubesandbox.__version__ the single source of truth: pyproject.toml now reads version dynamically via setuptools attr lookup, and the package metadata (readme, classifiers, urls, keywords, authors) is filled in for a proper PyPI listing. - Update sdk/python/README.md to document pip install cubesandbox. - Add bilingual maintainer guide docs/guide/maintainer/release-python-sdk.md (and the zh translation) covering prerequisites, version rules, tag conventions, the standard release procedure, and recovery paths. Assisted-by: Cursor:claude-opus-4.7 Signed-off-by: jinlong <jinlong@tencent.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
Claude finished @fslongjin's task in 58s —— View job Code Review: CI-driven Python SDK PyPI release pipelineOverall, this is a well-structured PR. The workflow and documentation are thorough and production-ready. A few observations below. Workflow (
|
| Category | Count |
|---|---|
| 🐛 Bugs | 0 |
| 0 | |
| 💡 Suggestions | 4 (see above) |
No blocking issues. The two actionable items are the stale version badge and confirming whether requests is needed as a direct dependency. The workflow itself is clean and well-structured.
Summary
Add a CI-driven release pipeline so the
cubesandboxPython SDK can bepublished to PyPI automatically from a git tag, and document the procedure
for maintainers.
.github/workflows/release-python-sdk.ymltriggered bypython-sdk-v*tags (or manualworkflow_dispatch). It validatestag↔
__version__consistency, builds sdist+wheel viapython -m build,runs
twine check --strict, publishes to PyPI using theCUBE_PYPI_TOKENsecret, and creates the matching GitHub Release withthe built distributions attached. Manual dispatch additionally supports
a TestPyPI dry-run target.
python-sdk-v*fromrelease-one-click.ymlso the two releasepipelines are mutually exclusive — Python SDK tags will not trigger the
one-click bundle, and regular
vX.Y.Ztags will not trigger PyPIpublishes.
cubesandbox.__version__the single source of truth:pyproject.tomlnow usesdynamic = ["version"]with[tool.setuptools.dynamic].version = { attr = "cubesandbox.__version__" }.Also fill in proper PyPI metadata:
readme,authors,keywords,classifiers, andRepository/Issues/DocumentationURLs.sdk/python/README.mdto advertisepip install cubesandboxwhile still documenting the source install path.
(
docs/guide/maintainer/release-python-sdk.mdand the zh translation)covering prerequisites, version rules, tag conventions, standard
release procedure, recovery paths, and future improvements (Trusted
Publishing, test gating).
Local validation
python -m buildsucceeds and producescubesandbox-0.2.0.tar.gz/cubesandbox-0.2.0-py3-none-any.whl(dynamic version resolves from__version__correctly).python -m twine check --strict dist/*PASSES on both sdist and wheel.pyproject.tomlparses cleanly.Test plan
CUBE_PYPI_TOKEN(project-scoped oncecubesandboxexists on PyPI; user-scoped for the very firstpublish, then rotated).
target: testpypifrom theActions UI to verify the build/publish path against TestPyPI.
master:git tag python-sdk-v0.2.0 && git push origin python-sdk-v0.2.0,then verify
pip install cubesandboxfrom a clean venv.release-one-click.ymlis not triggered by thepython-sdk-v*tag.Assisted-by: Cursor:claude-opus-4.7
Made with Cursor