Skip to content

Home

CI CD ProjectTester

ByteOrderMarkerFormatter CaseConflictChecker DependencyChecker EndOfFileFormatter EndOfLineFormatter JSONFormatter JSONLinter LargeFileChecker MarkdownLinter MergeConflictChecker ModuleTestNamingChecker PythonLinter SecretsChecker SecurityChecker ShellFormatter ShellLinter SpellChecker TOMLLinter TrailingWhitespaceFormatter TypeChecker YAMLLinter

PackageManager Pyrigger RemoteVersionController VersionControlHookManager VersionController

DocsBuilder PackageIndex ProgrammingLanguage License


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:

  1. Create account at pypi.org
  2. Create an API token
  3. Scope: "Entire account" (recommended change to specific project after first publish)
  4. Click "Add token"
  5. Copy token immediately (you won't see it again)
  6. 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:

  • DeployWorkflowConfigFile to add the PyPI upload step to the deployment workflow.
  • ProgrammingLanguage to replace the python badge with a PyPI pyversions badge.
  • PackageManager to add the args for publishing to PyPI.
  • PyprojectConfigFile to add PyPI trove classifiers and keywords to the project metadata.

And adds its own tool class:

  • PackageIndex to 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.