Environment variable `POETRY_PYPI_TOKEN_<NAME>` not used by `poetry publish -r <name>`
See original GitHub issue-
I am on the latest Poetry version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option). -
OS version and name: 10.15.3 Mac OS X
-
Poetry version: 1.0.5
-
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/esciara/dfc058348e597f8586d4f678cc163182
Issue
After setting the following environment variables and verifying the system is correctly set:
$ export POETRY_REPOSITORIES_TESTPYPI_URL=https://test.pypi.org/legacy/
$ export POETRY_PYPI_TOKEN_TESTPYPI=<token>
$ env | grep POETRY
POETRY_REPOSITORIES_TESTPYPI_URL=https://test.pypi.org/legacy/
POETRY_PYPI_TOKEN_TESTPYPI=<token>
and building my package:
$ poetry build
Building mypackage (0.0.1)
- Building sdist
- Built mypackage-0.0.1.tar.gz
- Building wheel
- Built mypackage-0.0.1-py3-none-any.whl
I am asked for a username a password when attempting to publish, event thought the token is passed through the environment variable:
$ poetry publish -r testpypi
Publishing mypackage (0.0.1) to testpypi
Username:
I checked the doc (section on environment variables) and it should work.
Workaround
The following workaround using username and password works:
$ export POETRY_REPOSITORIES_TESTPYPI_URL=https://test.pypi.org/legacy/
$ export POETRY_HTTP_BASIC_TESTPYPI_USERNAME=__token__
$ export POETRY_HTTP_BASIC_TESTPYPI_PASSWORD=<token>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:7 (1 by maintainers)
Here’s a one-liner workaround that works for me:
hi, guys.
I think the best practice is this:
first pass env:
config poetry repo. eg: ci action
publish