-
Notifications
You must be signed in to change notification settings - Fork 3k
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 error message if METADATA or PKG-INFO metadata is None #6542
Improve error message if METADATA or PKG-INFO metadata is None #6542
Conversation
db4906f
to
cd5bd2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea with raising an exception.
# Use `dist` in the error message because its stringification | ||
# includes more information, like the version and location. | ||
return ( | ||
'None {} metadata found for distribution: {}'.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"No metadata found for distribution: {dist}" seems enough to me.
The distribution usually contains egg-info or dist-info extension on the string representation, right? If not, I'd prefer to keep the file name after the distribution, since that's more of a debugging detail IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"No metadata found for distribution: {dist}" seems enough to me.
There's a distinction here the message is trying to preserve. dist.has_metadata()
can return False
, which is one form of "no metadata," but the case of this exception is dist.has_metadata()
True but the return value being None
. The former case doesn't currently raise an exception and is being logged as, "No metadata found in ...". The latter is a very specific kind of error (and maybe shouldn't ever be happening).
The distribution usually contains egg-info or dist-info extension on the string representation, right?
I checked, and no, it doesn't include that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look. Your rationale sounds good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, great. And thanks a lot for reviewing this quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. Thanks for filing such polished PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, the exception approach you liked was I think inspired subconsciously by this issue you had filed earlier: #6541 👍
Fixes #5082.