Poetry Uploads
Uploading Packages to PyPi With Poetry
Setting a pypi repository token:
-
create a token on pypi. Create a specific token for each package.
-
copy the token and put it somewhere safe.
-
Save your token with poetry. Poetry will try to use keyring to store the token:
poetry config pypi-token.dover-test
poetry config pyi-token.pypi my-token
this is what poetry does
-
fetches the repo url from your local config file (On Linux Mint this is located here: ~/.config/pypoetry/config.toml. )
[repositories.dover-test] url = "https://test.pypi.org/legacy" -
fetches the token by name and username.
The name is the repo name - in this case “dover-test”. Username is token which is defined by PyPI’s API.
- generates a keyring entry name:
This consists of the poetry namespace name and the repo name:
The namespace is: poetry-repository Repo name: dover-test
Keyring Service Name: poetry-repository-dover-test Keyring User Name: token
Setting and Accessing a Keyring Token Manually
First you need keyring installed.
-
Setting the token:
... keyring set poetry-repository-dover-test __token__ Password for '__token__' in 'poetry-repository-dover-test': -
Getting the token:
... keyring get poetry-repository-dover-test __token__ pypi-indwi87kk276l2396-3387sdlk.....
Setting and Access Token With Poetry
-
Setting the token:
... poetry config pypi-token.pypi my-tokenThis is translated into the keyring form of:
keyring set poetry-repository-pypi __token__ my-token