python/deploy_to_pypi
2# Deploy a new version of a Python library:
6# 3. Push to PyPI and GitHub.
8# This probably works for other projects as well, but relies on certain
9# aspects of the way the repos are laid out that may not be universal.
11# Note: unlike most Python scripts in this repo, this should run in
12# the project virtualenv rather than the script virtualenv.
17print_info
'-> rm -rv dist/*'
22print_info
"-> uv build"
27print_info
"-> uv publish --username=__token__ --password=$(…
)"
28uv publish --username
=__token__ --password
=$(security find-generic-password -s
'https://upload.pypi.org/legacy/' -a __token__ -w
)
32version=$(find src -name __init__.py
\
33 | xargs grep
'__version__ =' \
37print_info
"-> git tag v$version"
42print_info
"-> git push origin main --tag"
43git push origin main --tag