Publishing Aditi to PyPI
This document describes how to publish Aditi to the Python Package Index (PyPI).
Prerequisites
- PyPI Account: Create an account at https://pypi.org
- API Token: Generate an API token at https://pypi.org/manage/account/token/
- Build Tools: Install the required tools:
pip install -r requirements-publish.txt
Configuration
- Create
~/.pypirc
file based on.pypirc.template
:cp .pypirc.template ~/.pypirc chmod 600 ~/.pypirc
- Edit
~/.pypirc
and replaceYOUR_API_TOKEN_HERE
with your actual PyPI API token.
Publishing Process
Automated Publishing
Use the provided script for a guided publishing process:
./scripts/publish-to-pypi.sh
This script will:
- Clean previous builds
- Run tests
- Check code quality
- Build the package
- Optionally upload to TestPyPI first
- Upload to PyPI
Manual Publishing
- Clean previous builds:
rm -rf dist/ build/ src/*.egg-info
- Build the package:
python -m build
- Upload to TestPyPI (optional but recommended):
python -m twine upload --repository testpypi dist/*
- Test the package:
pip install -i https://test.pypi.org/simple/ aditi
- Upload to PyPI:
python -m twine upload dist/*
Post-Publishing
After publishing:
- Create a GitHub Release:
- Tag:
v0.1.0
(match the version in pyproject.toml) - Title: “Aditi v0.1.0”
- Include the CHANGELOG content
- Tag:
-
Update Version: Bump the version in
pyproject.toml
for the next release - Announce: Consider announcing the release on relevant channels
Troubleshooting
- Authentication Error: Ensure your API token starts with
pypi-
and is correctly set in~/.pypirc
- Package Name Conflict: If the name is taken, you’ll need to choose a different name in
pyproject.toml
- Missing Files: Check
MANIFEST.in
to ensure all necessary files are included