-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
API to make finding the available files for a project and version easier #48
Comments
PEP 427 suggests that the build number is a tie-breaker for the same wheel tags:
But what a "wheel" encompasses is ambiguous; is any wheel with the same version the same, or only if all the tags are the same otherwise? |
Data structure will end up being {project_name:
{version: (sdist_archive_link, {tag: archive_link})}
} |
I don't quite follow here, the struct proposed would be: {"ProjectName": {"Version": (None, {"cp38-cp38-linux", ArchiveLink} ) }}
# or
{"ProjectName": {"Version": (ArchiveLink, None) }} So my questions would be:
|
Dict would be, e.g. for https://pypi.org/project/mousebender/#files: {
"mousebender": {
"1.0.0": (sdist_archivelink, {Tag("py3", "none", "any"): wheel_archivelink})
}
} This allows you to go from project name, to version, and then get the sdist and whatever wheel(s) are available. And iterating through And to answer the questions ...
Nowhere. The build tag is only useful in overriding/replacing another wheel file. So if there's multiple wheel files with the same tag, then the build tag represents which one ultimately wins out.
No, the build number is part of the version number. |
I believe we've not added any functionality for determining if an |
I think I may have a solution here, but I'll definitely need you to verify it makes sense. I found |
- goal: get early feedback - add simple `sdist` recognition via packaging.utils - add tests for output (no unit tests for indexing yet) Fix for brettcannon#48
You don't even need to go that far. You can check the file extension first to know which function to use and then do the parsing. No need to care about Windows |
One thing I have never been fully satisfied with is the return of a tuple of |
But then having to constantly key off of a dict also seemed a little heavy since the chances of another format for either is rather slim. Plus either sdist or wheel changes would probably have a file name extension shift to make identifying them easier. 🤷♂️ |
Could key off of the dicts based on an enum representing the official artifact types that packages can come as (source tree, sdist, wheel). |
So thanks to build numbers, I think the grouping idea won't work. For instance, if you record the version of 1.0.0+42 and go looking for 1.0.0 to meet your installation needs, you're still going to have to iterate through all versions to find what you're looking for. So the grouping really becomes just a caching benefit and not an actual easier way to interact with the collection of archive links. And at that top the common thing to do is search a collection of archive links from a single page once for the one project, at which point caching isn't really beneficial if it adds adding code complexity (e.g. you're only going to go looking for Django once and the archive link page most likely will only have Django on it, so you won't reuse the same archive links in another search). It might be better to provide a "find" method where you provide the archive links, the name of the project you're interested in, the version specifier, and the wheel tag priority order to find the best fitting archive link. Something like:
Trick is what to do about sdists versus wheels (i.e. pip's binary-only/prefer-binary/source-only situation), support yanked files, etc. For sdists/wheels, could return two |
I.e. group the results from a Simple details page by:
That way it's easy to drill down to just what you are after and finding the best file to use.
One open question is what does pip prioritize: wheel tag or build number? This will dictate whether things are sorted by build number and then wheel tags or wheel tags and then build number.
The text was updated successfully, but these errors were encountered: