Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry isn't using the POETRY_PYPI_TOKEN_PYPI variable when publishing #2801

Closed
3 tasks done
arnavb opened this issue Aug 12, 2020 · 3 comments
Closed
3 tasks done

Poetry isn't using the POETRY_PYPI_TOKEN_PYPI variable when publishing #2801

arnavb opened this issue Aug 12, 2020 · 3 comments
Labels
status/duplicate Duplicate issues

Comments

@arnavb
Copy link

arnavb commented Aug 12, 2020

  • 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: MacOS 10.15.5 Catalina
  • Poetry version: 1.0.10
  • Link of a Gist with the contents of your pyproject.toml file: Gist

Issue

I was trying to deploy the latest version of my package, pypokedex to PyPI, using Travis CI (the link is to my build log). I'm using the following deploy config from .travis.yml

    ...
    - stage: deploy
      python: "3.6"
      script: skip
      deploy:
        provider: script
        script: ./deploy.sh
        on:
          tags: true
        skip_cleanup: true
    ...

and:

deploy.sh
#!/usr/bin/env bash

if ! poetry build; then
  echo "Failed to build pypokedex. Rerun 'poetry build'. Aborting."
  exit 1
fi

echo "Built pypokedex in dist folder"

# Requires rename utility with perl replace support
if ! rename 's/py3/py36/' dist/pypokedex-1.5.0-py3-none-any.whl; then
  echo "Unable to rename built wheel. Aborting."
  exit 1
fi

echo "Renamed wheel"

if ! poetry publish; then
  echo "Failed to publish pypokedex. Rerun 'poetry publish'. Aborting."
  exit 1
fi

echo "Successfully published package to PyPI"
exit 0

Notably, for my Travis build, I have set the variable POETRY_PYPI_TOKEN_PYPI to an API token from pypi.org. However, as seen from the build output, which is

Publishing pypokedex (1.5.0) to PyPI
No suitable keyring backends were found
Using a plaintext file to store and retrieve credentials
Username: 

Poetry is ignoring the presence of this environment variable and asking for my username and password. The documentation states that I should be able to publish with just the token set. I initially thought that I needed my username as well, but according PyPI documentation it isn't necessary. I can produce the same behavior locally if I just set the token to an environment variable (and not a username password combo) before running poetry publish.

@arnavb arnavb added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 12, 2020
@abn
Copy link
Member

abn commented Aug 12, 2020

@arnavb you can, as a workaround, do something like this.

      script:	
        - poetry config http-basic.pypi "__token__" "${POETRY_PYPI_TOKEN_PYPI}"	
        - poetry publish --build

This is a duplicate of #2210

@abn abn added status/duplicate Duplicate issues and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 12, 2020
@abn abn closed this as completed Aug 12, 2020
@arnavb
Copy link
Author

arnavb commented Aug 12, 2020

@abn Oh I saw that issue, I thought it only applied to non-PyPI repositories but I was mistaken. Thanks for the quick response!

Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

2 participants