Home
A pyrig plugin for publishing Python packages to PyPI.
Overview
Drop-in pyrig plugin that wires PyPI into your project:
- Adds a build-and-publish-to-PyPI job to the deploy workflow that runs after a successful release.
- Replaces the static Python badge with one sourced from PyPI's pyversions endpoint, and adds a badge for the package's current version on PyPI.
No pyrig configuration to write by hand — installing the package as a development dependency and regenerating your pyrig configs as usual is enough for the plugin's overrides to be picked up automatically. Publishing itself still needs the one-time token setup below before the first release.
Installation
uv add pyrig-pypi --dev
uv run pyrig sync
Setup
One-time setup before the first publish:
- Create account at pypi.org
- Create an API token
- Scope: "Entire account" (recommended change to specific project after first publish)
- Click "Add token"
- Copy token immediately (you won't see it again)
- Add token to your repository secrets as
PYPI_TOKEN
After that, the deploy workflow will automatically upload your package to PyPI after every release.
How it works
The plugin subclasses some pyrig base classes:
DeployWorkflowConfigFileto add the PyPI upload step to the deployment workflow.ProgrammingLanguageto replace the python badge with a PyPI pyversions badge.PackageManagerto add the args for publishing to PyPI.PyprojectConfigFileto add PyPI trove classifiers and keywords to the project metadata.
And adds its own tool class:
PackageIndexto wrap PyPI information and add the PyPI version badge.
API Reference
For class- and method-level details, see the API Reference, generated automatically from the source.