-
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
repositories: add support for PEP 658 #5509
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
96f3f22
repositories: add support for PEP 658
abn 2e8dd46
fix parsing of metadata attribute, add test
radoering 9f65db1
apply review feedback, hash is optional
radoering 9c950c2
repositories: add support for PEP 691 as fallback for PyPI
radoering 6c9bc28
only download metadata we need (instead of all metadata)
radoering 971f780
handle deprecation of link.metadata_hash
radoering b1bcbc2
use packaging.metadata instead of pkginfo
radoering File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
repositories: add support for PEP 658
This change allows Poetry to make use of PEP 503 "simple" API repositories that implement PEP 658 for core metadata. Co-authored-by: Bartosz Sokorski <[email protected]>
- Loading branch information
commit 96f3f225f74d3136839bf76e6992e2b31ea69216
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Links for isort</title> | ||
</head> | ||
<body> | ||
<h1>Links for isort</h1> | ||
<a href="https://files.pythonhosted.org/packages/1f/2c/non-existant/isort-metadata-4.3.4-py3-none-any.whl#sha256=1153601da39a25b14ddc54955dbbacbb6b2d19135386699e2ad58517953b34af" | ||
data-dist-info-metadata="sha256=e360bf0ed8a06390513d50dd5b7e9d635c789853a93b84163f9de4ae0647580c">isort-metadata-4.3.4-py3-none-any.whl</a><br/> | ||
</body> | ||
</html> | ||
<!--SERIAL 3575149--> |
28 changes: 28 additions & 0 deletions
28
tests/repositories/fixtures/legacy/metadata/isort-metadata-4.3.4-py3-none-any.whl.metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Metadata-Version: 2.0 | ||
Name: isort-metadata | ||
Version: 4.3.4 | ||
Summary: A Python utility / library to sort Python imports. | ||
Home-page: https://github.com/timothycrosley/isort | ||
Author: Timothy Crosley | ||
Author-email: [email protected] | ||
License: MIT | ||
Keywords: Refactor,Python,Python2,Python3,Refactoring,Imports,Sort,Clean | ||
Platform: UNKNOWN | ||
Classifier: Development Status :: 6 - Mature | ||
Classifier: Intended Audience :: Developers | ||
Classifier: Natural Language :: English | ||
Classifier: Environment :: Console | ||
Classifier: License :: OSI Approved :: MIT License | ||
Classifier: Programming Language :: Python | ||
Classifier: Programming Language :: Python :: 2 | ||
Classifier: Programming Language :: Python :: 2.7 | ||
Classifier: Programming Language :: Python :: 3 | ||
Classifier: Programming Language :: Python :: 3.4 | ||
Classifier: Programming Language :: Python :: 3.5 | ||
Classifier: Programming Language :: Python :: 3.6 | ||
Classifier: Programming Language :: Python :: Implementation :: CPython | ||
Classifier: Programming Language :: Python :: Implementation :: PyPy | ||
Classifier: Topic :: Software Development :: Libraries | ||
Classifier: Topic :: Utilities | ||
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* | ||
Requires-Dist: futures; python_version=="2.7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As far as I got it, we risk falling back to package inspection when:
In this case we would get the sdist metadata from the repository but then we wouldn't use it.
I would prefer a more aggressive strategy that favours PEP 658 over package inspection. Something like (in this order):
While currently it feels more like:
One way you could achieve this is by reverting changes to
_get_info_from_urls
(which would still act on packages only) and inside_links_to_data
something like: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.
Possible network optimization in case we go for the "random" approach: as soon as we got PEP 658 metadata from one url, stop querying others as we don't need anything else
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 we can keep it as is for now. The current approach has the advantage that it does not change our logic (which wheel's metadata we chose) so we get the same results no matter if we can download metadata or if we have to download the wheel/sdist.
Further, I suppose that in 99 % of use cases it's not relevant because either all files of a release have PEP 658 metadata or none of them. (I may be wrong, but in that case we can adjust it later.)