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

Improve error message if METADATA or PKG-INFO metadata is None #6542

Merged
merged 1 commit into from
May 26, 2019

Conversation

cjerdonek
Copy link
Member

Fixes #5082.

Copy link
Member

@pradyunsg pradyunsg left a 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(
Copy link
Member

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.

Copy link
Member Author

@cjerdonek cjerdonek May 26, 2019

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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 👍

@cjerdonek cjerdonek merged commit 30855ff into pypa:master May 26, 2019
@cjerdonek cjerdonek deleted the issue-5082-missing-metadata-error branch May 26, 2019 23:17
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 26, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cryptic error when a dependency's PKG_INFO/METADATA is missing
2 participants