-
Notifications
You must be signed in to change notification settings - Fork 2.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
Fix ValueError when finding packages with invalid metadata #1346
Conversation
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 tackling this.
A couple things:
- It looks like a test could go in
test_pypi_repository.py
. You could mock out ServerProxy to return test data with invalid versions. - If possible, I'd like to more narrowly catch the error. With a testcase it will be easier to see if this is possible
Some packages (like `pygame-music-grid`) have unparseable metadata. This resulted in a ValueError. pip ignores packages like these, so it's reasonable to do the same in poetry itself and only display the well-formed ones. Fixes python-poetry#1345. Fixes python-poetry#637.
c7dd55b
to
7ea16fa
Compare
Hi @brycedrennan, I updated my branch with:
|
'Unable to parse version "{}" for the {} package, skipping'.format( | ||
hit["version"], hit["name"] | ||
), | ||
level="debug", |
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.
I wonder if this should be a warning that's printed to the shell? This way it's much more likely that someone will raise the issue with the upstream.
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.
I think there is a fairly large number of malformed (and abandoned) packages on pypi that are easy to run into when you search for a fragment of a package name. This is almost the same logging that is done in find_packages
in the same file.
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.
Good point - and it would still show up when running with higher verbosity, right?
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.
Yep
Thanks! |
N.B. This does not fix having already-installed packages with un-parseable versions. It seems to only fix Poetry searches that result in unparseable versions. See #2167. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Some packages (like
pygame-music-grid
) have unparseable metadata. This resulted in a ValueError. pip ignores packages like these, so it's reasonable to do the same in poetry itself and only display the well-formed ones.Fixes #1345.
Pull Request Check List