Skip to content

Commit

Permalink
Add instructions on how to publish via Twine
Browse files Browse the repository at this point in the history
Make the existing instructions more concrete by including a config file
example and the actual commands to install & run Twine.
  • Loading branch information
sybrenstuvel committed Jul 20, 2022
1 parent e59132d commit 78f738d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 1 addition & 0 deletions update_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 78f738d

Please sign in to comment.