This guide explains how to publish claude-log-viewer to PyPI.
-
PyPI Account: Create accounts on both:
- PyPI (production): https://pypi.org/account/register/
- TestPyPI (testing): https://test.pypi.org/account/register/
-
API Tokens: Generate API tokens for authentication:
-
Install build tools:
pip install --upgrade build twine
Edit pyproject.toml and increment the version:
version = "1.0.1" # Change from 1.0.0# Clean previous builds
rm -rf dist/ build/ *.egg-info
# Build source distribution and wheel
python -m buildThis creates:
dist/claude-log-viewer-1.0.0.tar.gz(source distribution)dist/claude_log_viewer-1.0.0-py3-none-any.whl(wheel)
# Upload to TestPyPI
python -m twine upload --repository testpypi dist/*
# Test installation
pip install --index-url https://test.pypi.org/simple/ claude-log-viewer# Upload to PyPI
python -m twine upload dist/*You'll be prompted for:
- Username:
__token__ - Password: Your PyPI API token (starts with
pypi-)
# Install from PyPI
pip install claude-log-viewer
# Test it works
claude-log-viewer --help# Tag the release
git tag v1.0.0
git push origin v1.0.0
# Create release on GitHub
gh release create v1.0.0 \
--title "v1.0.0 - Initial Release" \
--notes "See CHANGELOG.md for details"For automated releases, we can set up GitHub Actions. See .github/workflows/publish.yml.
Follow semantic versioning (SemVer):
- Major (1.x.x): Breaking changes
- Minor (x.1.x): New features, backward compatible
- Patch (x.x.1): Bug fixes
- All tests pass (
pytest) - README is up to date
- Version number incremented in
pyproject.toml - CHANGELOG updated (if exists)
- No sensitive data in repository
- All files included in MANIFEST.in
- Package builds without errors
- Tested on TestPyPI
Check MANIFEST.in includes all necessary files:
include README.md
include LICENSE
include INSTALL.md
recursive-include claude_log_viewer/templates *.html
recursive-include claude_log_viewer/static *
Verify pyproject.toml package-data includes static files:
[tool.setuptools.package-data]
claude_log_viewer = ["templates/*.html", "static/css/*.css", "static/js/*.js"]- Use
__token__as username (not your PyPI username) - Use API token as password (not your account password)
- Token must start with
pypi-for PyPI orpypi-for TestPyPI
- PyPI: https://pypi.org/
- TestPyPI: https://test.pypi.org/
- Packaging Guide: https://packaging.python.org/
- Twine Docs: https://twine.readthedocs.io/