Skip to content

Publishing Django Orbit

Prerequisites

  1. Create accounts:
  2. PyPI (production)
  3. TestPyPI (testing)

  4. Install build tools:

    pip install build twine
    

Build the Package

# Clean previous builds
rm -rf dist/ build/ *.egg-info/

# Build
python -m build

This creates: - dist/django_orbit-0.1.0.tar.gz (source) - dist/django_orbit-0.1.0-py3-none-any.whl (wheel)

Test on TestPyPI First

# Upload to TestPyPI
twine upload --repository testpypi dist/*

# Test installation
pip install --index-url https://test.pypi.org/simple/ django-orbit

Publish to PyPI

# Upload to production PyPI
twine upload dist/*

You'll be prompted for your PyPI username and password (or API token).

  1. Go to https://pypi.org/manage/account/token/
  2. Create a token for this project
  3. Use with twine:
    twine upload dist/* -u __token__ -p pypi-YOUR_TOKEN_HERE
    

Or create ~/.pypirc:

[pypi]
username = __token__
password = pypi-YOUR_TOKEN_HERE

After Publishing

Test the installation:

pip install django-orbit

Version Updates

  1. Update version in orbit/__init__.py
  2. Update CHANGELOG.md
  3. Rebuild and upload:
    python -m build
    twine upload dist/*