Releases are published to PyPI by the
Publish to PyPI workflow (.github/workflows/publish.yml). It runs when a
GitHub Release is published, builds the sdist and wheel, checks them with
twine, and uploads them using PyPI Trusted Publishing (OIDC), so no API token
is stored anywhere.
- Bump the version in
rohlik_api/__init__.py(__version__). It is the single source of truth;pyproject.tomlreads it dynamically. Follow semantic versioning: patch (0.3.1) for fixes, minor (0.4.0) for new features, and major for breaking changes. Merge the bump tomain. - Make sure CI is green on
main(ruff, black, mypy, pytest). - Create a GitHub Release (Releases → Draft a new release):
- Tag:
v<version>, e.g.v0.3.0, created frommain. It must match__version__; PyPI rejects a version that was already uploaded. - Title:
v<version> - <short headline>. - Notes:
## Added/## Changed/## Fixedsections as needed, plus a## Compatibilitynote on breaking changes and the minimum Python version.
- Tag:
- Publish the release. The workflow uploads the package. Watch it under
Actions → Publish to PyPI; the
publishjob runs in thepypienvironment.
pip install --upgrade rohlik-api
python -c "import rohlik_api; print(rohlik_api.__version__)"To check the distribution without publishing:
pip install build twine
python -m build
python -m twine check dist/*This creates dist/rohlik_api-<version>-py3-none-any.whl and
dist/rohlik_api-<version>.tar.gz. To try an upload without touching the real
index, use TestPyPI:
python -m twine upload --repository testpypi dist/*
pip install --index-url https://test.pypi.org/simple/ rohlik-api- PyPI project → Publishing: a trusted publisher for this repository, the
publish.ymlworkflow and thepypienvironment. - GitHub repository → Settings → Environments: an environment named
pypi.