- Create PyPI Account: https://pypi.org/account/register/
- Create TestPyPI Account (for testing): https://test.pypi.org/account/register/
- Install build tools:
pip install --upgrade build twine
cd /Users/pinkleshparjapati/Desktop/fastapi-create-project
rm -rf dist/ build/ *.egg-infopython -m buildThis creates:
dist/fastapi-create-project-0.1.0.tar.gz(source distribution)dist/fastapi_create_project-0.1.0-py3-none-any.whl(wheel)
# Upload to TestPyPI
python -m twine upload --repository testpypi dist/*
# Test installation from TestPyPI
pip install --index-url https://test.pypi.org/simple/ fastapi-create-project# Upload to PyPI (PRODUCTION)
python -m twine upload dist/*You'll be prompted for your PyPI username and password.
# Install from PyPI
pip install fastapi-create-project
# Test it
fastapi-create-project --versionInstead of username/password, use API tokens:
- Go to https://pypi.org/manage/account/token/
- Create a new API token
- Create
~/.pypirc:
[pypi]
username = __token__
password = pypi-YOUR-TOKEN-HERE
[testpypi]
username = __token__
password = pypi-YOUR-TESTPYPI-TOKEN-HEREThen upload:
python -m twine upload dist/*- Update version in
fastapi_scaffold/__init__.py - Update version in
setup.py - Update
README.mdwith latest features - Test locally:
pip install -e . - Create a test project and verify it works
- Clean build artifacts:
rm -rf dist/ build/ *.egg-info - Build:
python -m build - Upload to TestPyPI first
- Test installation from TestPyPI
- Upload to PyPI
- Create Git tag:
git tag v0.1.0 && git push origin v0.1.0
When releasing a new version:
-
Update version number in both files:
fastapi_scaffold/__init__.py→__version__ = "0.2.0"setup.py→version="0.2.0"
-
Clean and rebuild:
rm -rf dist/ build/ *.egg-info python -m build -
Upload:
python -m twine upload dist/*
Your package will be available at:
- PyPI: https://pypi.org/project/fastapi-create-project/
- Installation:
pip install fastapi-create-project
Users can install it globally:
pip install fastapi-create-project
# or
pipx install fastapi-create-projectThen use from anywhere:
fastapi-create-project --version
fastapi-create-project# One-liner for publishing
cd /Users/pinkleshparjapati/Desktop/fastapi-create-project && \
rm -rf dist/ build/ *.egg-info && \
python -m build && \
python -m twine upload dist/*- Package name must be unique on PyPI
- Can't delete or re-upload same version number
- Test on TestPyPI first before production
- Use semantic versioning: MAJOR.MINOR.PATCH (e.g., 0.1.0, 0.2.0, 1.0.0)
- Create GitHub releases matching your PyPI versions
After publishing, view stats at:
- https://pypi.org/project/fastapi-create-project/
- https://pypistats.org/packages/fastapi-create-project
Track downloads:
pip install pypistats
pypistats overall fastapi-create-project