From 78f738d7b06d9f4b39c055c396ebd76538f8c712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 20 Jul 2022 11:27:55 +0200 Subject: Add instructions on how to publish via Twine Make the existing instructions more concrete by including a config file example and the actual commands to install & run Twine. --- README.md | 23 +++++++++++++++++++++-- update_version.sh | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 542926f..b2efa7b 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,28 @@ use this token when publishing instead of your username and password. As username, use `__token__`. As password, use the token itself, including the `pypi-` prefix. -See https://pypi.org/help/#apitoken for help using API tokens to publish. +See https://pypi.org/help/#apitoken for help using API tokens to publish. This is what I have in `~/.pypirc`: + +``` +[distutils] +index-servers = + rsa + +# Use `twine upload -r rsa` to upload with this token. +[rsa] + username = __token__ + password = pypi-token +``` ``` . ./.venv/bin/activate -poetry publish --build +pip install twine + +poetry build +twine check dist/rsa-4.9.tar.gz dist/rsa-4.9-*.whl +twine upload -r rsa dist/rsa-4.9.tar.gz dist/rsa-4.9-*.whl ``` + +The `pip install twine` is necessary as Python-RSA requires Python >= 3.6, and +Twine requires at least version 3.7. This means Poetry refuses to add it as +dependency. diff --git a/update_version.sh b/update_version.sh index 10e2555..a44f45a 100755 --- a/update_version.sh +++ b/update_version.sh @@ -9,6 +9,7 @@ DATE=$(date +'%Y-%m-%d') sed "s/__date__\s=\s\"[^\"]*\"/__date__ = \"$DATE\"/" -i rsa/__init__.py sed "s/__version__\s=\s\"[^\"]*\"/__version__ = \"$1\"/" -i rsa/__init__.py +sed "s+dist/rsa-[\d.]+.tar.gz+__version__ = \"$1\"/" -i README.md poetry version "$1" git diff -- cgit v1.2.1