- β Created comprehensive README.md with examples
- β Built the package (dist/dtor-0.1.0.tar.gz and .whl)
- β Verified package is valid (twine check passed)
- β Created upload script (upload_to_pypi.py)
dist/dtor-0.1.0.tar.gz(source distribution)dist/dtor-0.1.0-py3-none-any.whl(wheel)
-
Create PyPI account (if you don't have one):
- Go to: https://pypi.org/account/register/
- Verify your email
-
Create API Token:
- Login to PyPI
- Go to: https://pypi.org/manage/account/token/
- Click "Add API token"
- Token name:
dtor-upload - Scope: "Entire account" (you can limit it later)
- Click "Add token"
- COPY THE TOKEN (starts with
pyp-...) β οΈ You won't see it again!
# Set your token as environment variable
$env:TWINE_PASSWORD = "pyp-your-token-here"
# Run upload script
python upload_to_pypi.pyThe script will:
- Optionally test on TestPyPI first
- Upload to real PyPI
- Give you confirmation
# Set environment variables
$env:TWINE_USERNAME = "__token__"
$env:TWINE_PASSWORD = "pyp-your-token-here"
# Upload
twine upload dist/*After upload, check:
- PyPI page: https://pypi.org/project/dtor/
- Test install:
pip install dtor
- Update version in
setup.pyanddtor/__init__.py - Rebuild:
python -m build - Upload:
python upload_to_pypi.py
OR use GitHub releases (automatic via .github/workflows/publish.yml)
To use automatic GitHub Actions publishing:
- Go to: https://github.com/QudsLab/dtor/settings/secrets/actions
- Click "New repository secret"
- Name:
PYPI_API_TOKEN - Value: Your PyPI token
- Click "Add secret"
Then create a GitHub release and it auto-publishes!
- Have PyPI account
- Created API token
- Copied token somewhere safe
- Set
$env:TWINE_PASSWORD - Run
python upload_to_pypi.py - Verify on PyPI
- Test:
pip install dtor - (Optional) Add token to GitHub secrets
"Package already exists"
- Version 0.1.0 is already uploaded
- Update version in setup.py to 0.1.1
- Rebuild:
python -m build - Upload again
"Invalid token"
- Make sure token starts with
pyp- - Username should be
__token__(with double underscores) - Token scope should include upload permissions
"403 Forbidden"
- Package name might be taken
- Try different name in setup.py
- Or contact PyPI to claim the name
- PyPI Help: https://pypi.org/help/
- Packaging Guide: https://packaging.python.org/
- Twine Docs: https://twine.readthedocs.io/
The package is 100% ready to upload. You just need your PyPI token!