PUBLISHING
Copied Raw Markdown!
Publishing to PyPI
Prerequisites
- Install build tools:
Copied
pip install build twine
Create accounts on:
Create API tokens:
Build the Package
Copied
# Clean previous builds
rm -rf dist/ build/ *.egg-info
# Build the package
python -m build
This creates:
dist/vyasa-0.1.0-py3-none-any.whl(wheel)dist/vyasa-0.1.0.tar.gz(source distribution)
Test Locally
Copied
# Install from the wheel
pip install dist/vyasa-0.1.0-py3-none-any.whl
# Test the CLI
vyasa demo/
Publish to TestPyPI (recommended first)
Copied
python -m twine upload --repository testpypi dist/*
Test installation from TestPyPI:
Copied
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ vyasa
Publish to PyPI
Copied
python -m twine upload dist/*
Post-Publication
- Create a git tag:
Copied
git tag v0.1.0
git push origin v0.1.0
Create a GitHub release with the changelog
Test installation:
Copied
pip install vyasa
Updating the Package
Update version in:
pyproject.tomlsettings.inivyasa/__init__.py
Update CHANGELOG.md
Rebuild and republish:
Copied
rm -rf dist/ build/ *.egg-info
python -m build
python -m twine upload dist/*
Using PyPI API Tokens
Store your tokens in ~/.pypirc:
Copied
[distutils]
index-servers =
pypi
testpypi
[pypi]
username = __token__
password = pypi-YOUR-API-TOKEN-HERE
[testpypi]
username = __token__
password = pypi-YOUR-TESTPYPI-TOKEN-HERE
Then you can upload without entering credentials:
Copied
python -m twine upload dist/*