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

Add support for reading ~/.pypirc if no other authentication information is found #10234

Open
kamurani opened this issue Feb 28, 2025 · 0 comments
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@kamurani
Copy link
Contributor

Issue Kind

Change in current behaviour

Description

Mentioned in #6320

Poetry currently does not support pypirc (though it could be added and might be a nice addition once the authenticator code is further cleaned up). It's worth nothing that poetry publish does not think it has credentials, but instead can no longer prompt due to changes in Poetry's dependencies. Interactive use was considered niche and thus only got a changelog callout in a beta version of 1.2 -- so it may fly under the radar for some.

Originally posted by @neersighted in #6320

Originally mentioned in #111

I recently switched to poetry to manage a project, published to PyPI. Because I had already been using setuptools and twine to build / publish the project, I had just gone to the effort of storing my tokens in a newly created ~/.pypirc file, for [testpypi] and [pypi].

When switching to poetry, and then attempting to publish using:

poetry publish --build

My package is built successfully, but fails to push to PyPI with an unhelpful (IMO) message:

HTTP Error 403: Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.

I think that the error message could be improved, as the current one implies that there is a problem with the user's PyPI account, or something to do with the token being invalid (as opposed to the real issue: the user not yet setting the poetry-specific config or environment variables that store ther PyPI tokens).

Perhaps the user could be interactively prompted for their token if this is the first time using the poetry publish command, similar to what twine does if no token is found in ~/.pypirc?

Additionally, I think that if no poetry config value exists for the PyPI token, poetry should at least attempt to read ~/.pypirc before failing to publish - as has been suggested in the issues mentioned above. I would be happy to submit a PR if people still think this would be useful!

Impact

This will hopefully make poetry more usable and friendly to new users, and particularly users who already have published to PyPI with alternative tools.

Workarounds

None

@kamurani kamurani added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant