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

uv publish giving Missing credentials for https://upload.pypi.org/legacy/ #8023

Closed
Tracked by #7839
jamesbraza opened this issue Oct 8, 2024 · 7 comments · Fixed by #8045
Closed
Tracked by #7839

uv publish giving Missing credentials for https://upload.pypi.org/legacy/ #8023

jamesbraza opened this issue Oct 8, 2024 · 7 comments · Fixed by #8045
Assignees
Labels
error messages Messaging when something goes wrong

Comments

@jamesbraza
Copy link

I moved from this GitHub Actions that publishes to PyPI using:

      - uses: pypa/gh-action-pypi-publish@release/v1
        with:
          password: ${{ secrets.PYPI_API_TOKEN }}

To this with uv==0.4.20:

      - run: uv publish
        env:
          UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

However, uv publish fails with:

warning: `uv publish` is experimental and may change without warning
Publishing 2 files https://upload.pypi.org/legacy/
Uploading ldp-0.10.0-py3-none-any.whl (90.7KiB)
error: Failed to publish `dist/repo-0.10.0-py3-none-any.whl` to https://upload.pypi.org/legacy/
  Caused by: Failed to send POST request
  Caused by: Missing credentials for https://upload.pypi.org/legacy/
Error: Process completed with exit code 2.

What am I doing wrong here? Also, I am thinking perhaps the stack could be made more user friendly

@charliermarsh
Copy link
Member

\cc @konstin

@charliermarsh
Copy link
Member

I think you need UV_PUBLISH_TOKEN instead?

@charliermarsh charliermarsh added the question Asking for clarification or support label Oct 8, 2024
@zanieb
Copy link
Member

zanieb commented Oct 8, 2024

Yeah I think you want to set it via the token variable or provide a username (UV_PUBLISH_USERNAME=__token__)

@charliermarsh charliermarsh added the error messages Messaging when something goes wrong label Oct 8, 2024
@charliermarsh
Copy link
Member

(If that's the issue, we should def have a custom error for this.)

@jamesbraza
Copy link
Author

This worked indeed:

      - run: uv publish
        env:
---          UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
+++          UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

It's slightly strange to me because pypa/gh-action-pypi-publish@release/v1 had password configured. I wonder if they automatically fail over from trying password to trying token.

So yes perhaps uv can nice-ify Missing credentials a bit

@charliermarsh
Copy link
Member

Okay awesome. Yeah, let's fix up this error message etc.

@charliermarsh charliermarsh removed the question Asking for clarification or support label Oct 8, 2024
@konstin
Copy link
Member

konstin commented Oct 9, 2024

it's unfortunate that pypa/gh-action-pypi-publish@release/v1 calls the token a password. We can catch using a password without a username in clap, I don't think we need to special case the password -> token migration: #8045.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Messaging when something goes wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants