Skip to content

Environment variable POETRY_PYPI_TOKEN_<NAME> not used by poetry publish -r <name> #2210

@esciara

Description

@esciara
  • 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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/publishingRelated to PyPI/PEP 503 publishingkind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions