Skip to content

Publishing to PyPI

This project is configured to automatically publish to PyPI when a new GitHub release is created.

Setting up PyPI Token

To enable automatic publishing, you need to set up a PyPI API token as a GitHub secret:

  1. Create a PyPI API token:
  2. Log in to your PyPI account at https://pypi.org/
  3. Go to Account Settings → API tokens
  4. Create a new API token with scope "Entire account (all projects)"
  5. Copy the token value (you won't be able to see it again)

  6. Add the token to GitHub secrets:

  7. Go to your GitHub repository
  8. Navigate to Settings → Secrets and variables → Actions
  9. Click "New repository secret"
  10. Name: PYPI_API_TOKEN
  11. Value: Paste your PyPI token
  12. Click "Add secret"

Creating a Release

To trigger the publishing workflow:

  1. Go to your GitHub repository
  2. Navigate to Releases
  3. Click "Create a new release"
  4. Choose a tag version (e.g., v0.1.3)
  5. Add a title and description
  6. Click "Publish release"

The GitHub Actions workflow will automatically build and publish your package to PyPI.

Manual Publishing

If you need to publish manually, you can use uv for faster builds and publishing:

# Install uv if you don't have it already
curl -LsSf https://astral.sh/uv/install.sh | sh

# Build the package
uv build

# Upload to PyPI
uv publish --username __token__ --password YOUR_PYPI_TOKEN

Alternatively, you can use the standard Python tools:

# Build the package
python -m build

# Upload to PyPI
python -m twine upload dist/*