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
Improve logging when keyring fails #889
Comments
We should just use logger.exception and let that get the appropriate details |
I wasn't familiar with logger.exception, but that looks good enough in this case, if we're ok with having an ERROR logged, rather than a WARNING, but since we're talking about exception handling, I think that would be enough. Can I go ahead and make a PR for this? |
I'm not entirely sure what a complete solution is yet, but starting with a PR sounds good. I'm happy to work through it from there. @fedexist When you open the PR, it'd be helpful to have screenshots of the output. |
Also please paste the exact text for those who can't see or rely on screenshots |
Your Environment
/etc/os-release
Version of python you are running: python3.9
How did you install twine? Did you use your operating system's package manager or pip or something else? Running in a virtual environment created by tox
Version of twine you have installed (include complete output of): 4.0.0
Which package repository are you targeting? Artifact Registry on Google Cloud Platform, using the additional keyring:
keyrings.google-artifactregistry-auth
.The Issue
When launching twine from within a tox step, defined as follows:
when uploading there was a warning saying
Iand then failing to upload the package.
After investigating, I've found out that this is due to keyring failing with the exception
Of course, after seeing this error, the issue was clear and I then added the
HOME
environment variable to passenv intox.ini
.passenv = PYPI_REPO GOOGLE_APPLICATION_CREDENTIALS HOME
Steps to Reproduce
Just unset
HOME
before running twine.It would be nice if the warning included the traceback from the keyring exception, which is basically silenced by the current implementation in
auth.py
:maybe using
exc_info
logger.warning(str(exc), exc_info=exc)
?
The text was updated successfully, but these errors were encountered: