Add support for reading ~/.pypirc
if no other authentication information is found
#10234
Labels
~/.pypirc
if no other authentication information is found
#10234
Issue Kind
Change in current behaviour
Description
Mentioned in #6320
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
andtwine
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:
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 whattwine
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
The text was updated successfully, but these errors were encountered: