main is the only long-lived branch. Changes reach it through pull requests, merge commits only, and
every pull request and push to main must pass the build check (.github/workflows/build.yml: the
tests on Python 3.10–3.14, then build and check the sdist and wheel). Merging publishes nothing.
A release is a GitHub Release whose tag is the version, published by tomasr78:
gh release create v2.0.1 --repo ConvertAPI/convertapi-library-python --target main --title v2.0.1 --generate-notesThat runs .github/workflows/publish.yml, which:
- refuses a Release published or re-run by anyone else;
- checks the tag (
v2.0.1,v2.1.0-rc.1), that the GitHub pre-release tick matches the version, that a stable version is a commit onmain, and that PyPI has never had that version; - writes the version into
convertapi/__init__.py, builds the sdist and wheel, and runs the tests against the installed wheel (thelivetests too, when theCONVERTAPI_SECRETsecret exists); - uploads both files to PyPI from the
pypienvironment with Trusted Publishing (no stored token, PEP 740 attestations) and waits until PyPI serves them.
Pre-releases work the same way and may come from any branch. PyPI needs PEP 440 versions, so the
pre-release label is alpha.N, beta.N or rc.N (v2.1.0-rc.1 becomes 2.1.0rc1):
gh release create v2.1.0-rc.1 --repo ConvertAPI/convertapi-library-python --target my-branch --prerelease --title v2.1.0-rc.1 --notes "Release candidate for ..."PyPI versions are permanent: a file name can never be uploaded again, even after the release is deleted. A bad version can only be yanked on PyPI, then fixed by releasing the next version. Never delete and re-create a release tag.
__version__ in convertapi/__init__.py is a 0.0.0.dev0 placeholder; pull request builds produce
0.0.0.dev{run}+g{sha} as a downloadable artifact so a change can be tried before it is released.
Update CHANGELOG.md in the pull request that changes behaviour.
- Rulesets:
maintakes pull requests with merge commits and a passingbuild(admins can bypass); only repository admins create, move or deletev*tags, and av*tag must match the pattern above. - The
pypienvironment accepts deployments fromv*tags only. - PyPI trusts
ConvertAPI/convertapi-library-python, workflowpublish.yml, environmentpypi(https://pypi.org/manage/project/convertapi/settings/publishing/). Renaming the workflow file or the environment breaks publishing until the trusted publisher is changed to match.