-
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
Use packaging.tags for doing compatible wheel tag calculation #7354
Commits on Jan 7, 2020
-
Convert return values in pep425tags.get_supported
Now we can incrementally use utility functions from pep425tags without switching everything at once or converting in multiple places.
Configuration menu - View commit details
-
Copy full SHA for 3ada01f - Browse repository at this point
Copy the full SHA 3ada01fView commit details -
Copy get_supported into packaging.tags-like functions
packaging.tags provides a simple `sys_tags` function for getting applicable tags for the running interpreter, but it does not allow customization of arguments. packaging.tags provides three functions for getting custom tags: 1. `cpython_tags` - for CPython only 2. `generic_tags` - for any non-CPython Python implementation 3. `compatible_tags` - tags that are not specific to an interpreter implementation Since pip allows users to provide explicit impl, platform, abi, and version, we have to use these functions. `cpython_tags` and `generic_tags` are mutually exclusive, and return tags that are the highest priority. These capture the most specific tags. `compatible_tags` are always applicable, and a lower priority since they may just be compatible with e.g. the Python language version, but lack any optimizations available in the interpreter-specific tags. To be able to do a meaningful comparison between our current implementation and the above functions, we need to segment the pip code into pieces that look like them. To that end, we now have copies of the current `get_supported` function, one for each of the functions provided by packaging.tags, and will walk through converting them to rely on packaging.tags. For each simplification step, if desired, we can compare the implementation in the packaging.tags function with what we're replacing in pip. Specifically, for each function in turn, we will: 1. Refactor it locally, taking into account its new, more limited, responsibilities 2. Introduce the packaging.tags function for the case where there are no custom arguments provided 3. Customize arguments one-by-one and delegate to the packaging.tags function 4. When there is no pip-specific logic left, remove the intermediate function and use the packaging.tags function directly in `get_supported` In the end all these functions will be gone again and we'll be left with an implementation that relies solely on the tag generation in packaging.tags.
Configuration menu - View commit details
-
Copy full SHA for d386bb2 - Browse repository at this point
Copy the full SHA d386bb2View commit details -
Use _cpython_tags, _generic_tags, and _compatible_tags
Since these functions are copies of the existing code, there is no behavior change except each tag will now be present 3 times. To accommodate this we remove all but the first duplicate tag from the set of all tags. We put `_compatible_tags` last because it will provide the lowest priority tags. The order of `_cpython_tags` and `_generic_tags` here is not significant - when we start customizing them we will introduce a condition so that they are mutually exclusive.
Configuration menu - View commit details
-
Copy full SHA for 54db17c - Browse repository at this point
Copy the full SHA 54db17cView commit details -
Only calculate py-compatible tags in one place
Since `_compatible_tags` is the function that will be responsible for generating the non-interpreter-specific tags, we remove the corresponding sections from `_cpython_tags` and `_generic_tags`. The resulting tags in `get_supported` are equivalent because these were the last tags to be computed in those functions, and `_compatible_tags` is executed after them (so any non-duplicate tags it produces will be last). To reinforce the reponsibility of `_compatible_tags` we also remove the abi-related tag generation, which is already handled in `_cpython_tags` and `_generic_tags`.
Configuration menu - View commit details
-
Copy full SHA for 1c8c481 - Browse repository at this point
Copy the full SHA 1c8c481View commit details -
Configuration menu - View commit details
-
Copy full SHA for 480911b - Browse repository at this point
Copy the full SHA 480911bView commit details -
Use packaging.tags.compatible_tags
We assume this function improves on our existing behavior, so use it as-is. We will customize the arguments over the next few commits. Since packaging.tags internally calculates platforms when not provided, we skip the tests which patch functions assuming that manylinux compatibility determination depends on them.
Configuration menu - View commit details
-
Copy full SHA for 4659a78 - Browse repository at this point
Copy the full SHA 4659a78View commit details -
Configuration menu - View commit details
-
Copy full SHA for 750abca - Browse repository at this point
Copy the full SHA 750abcaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 72d00dd - Browse repository at this point
Copy the full SHA 72d00ddView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2de0b7c - Browse repository at this point
Copy the full SHA 2de0b7cView commit details -
Configuration menu - View commit details
-
Copy full SHA for c514c6b - Browse repository at this point
Copy the full SHA c514c6bView commit details -
Configuration menu - View commit details
-
Copy full SHA for b91286c - Browse repository at this point
Copy the full SHA b91286cView commit details -
Only use _cpython_tags for CPython
Since the behavior for both of these functions is the same, there is no behavior change here. This will let us simplify `_cpython_tags` a bit.
Configuration menu - View commit details
-
Copy full SHA for 8f1c60e - Browse repository at this point
Copy the full SHA 8f1c60eView commit details -
Remove impl from _cpython_tags
We only call this function when the user or platform-provided implementation is "cp", so we can inline the literal in place of the parameter. This will make refactoring easier.
Configuration menu - View commit details
-
Copy full SHA for e388df6 - Browse repository at this point
Copy the full SHA e388df6View commit details -
Use packaging.tags.cpython_tags
We assume this function improves the status quo over the current `_cpython_tags`, so we use it when no arguments need to be customized. Since `packaging.tags` has its own tests and derives defaults differently than pep425tags, we also remove the applicable tests that were testing against the result of a plain call to `pep425tags.get_supported()`.
Configuration menu - View commit details
-
Copy full SHA for 5dbef5d - Browse repository at this point
Copy the full SHA 5dbef5dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 147680a - Browse repository at this point
Copy the full SHA 147680aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 05045e7 - Browse repository at this point
Copy the full SHA 05045e7View commit details
Commits on Jan 8, 2020
-
Configuration menu - View commit details
-
Copy full SHA for fecfadb - Browse repository at this point
Copy the full SHA fecfadbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 56840c3 - Browse repository at this point
Copy the full SHA 56840c3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1574872 - Browse repository at this point
Copy the full SHA 1574872View commit details -
Remove unused abi3 branch in _generic_tags
Since this function is only called for non-CPython interpreters, the abi3-related branches are not relevant.
Configuration menu - View commit details
-
Copy full SHA for fa1ec40 - Browse repository at this point
Copy the full SHA fa1ec40View commit details -
Use packaging.tags.generic_tags
As with cpython_tags and compatible_tags, we assume this function covers our use cases in the no-argument case and will customize our arguments for it in a few steps.
Configuration menu - View commit details
-
Copy full SHA for 281273d - Browse repository at this point
Copy the full SHA 281273dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 77dbd27 - Browse repository at this point
Copy the full SHA 77dbd27View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0bebeb6 - Browse repository at this point
Copy the full SHA 0bebeb6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 293b778 - Browse repository at this point
Copy the full SHA 293b778View commit details -
Configuration menu - View commit details
-
Copy full SHA for 72dcd34 - Browse repository at this point
Copy the full SHA 72dcd34View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3e66ab0 - Browse repository at this point
Copy the full SHA 3e66ab0View commit details -
Remove unnecessary conversion in get_supported
Now that we're fully using packaging.tags, everything in the supported list is already Tag. Further, since each function is responsible for its own set of non-overlapping tags, we can also remove the de-duplication.
Configuration menu - View commit details
-
Copy full SHA for ad546b5 - Browse repository at this point
Copy the full SHA ad546b5View commit details -
Simplify _get_custom_platforms
Since we only call this function when platform is not None, we can drop one of the branches. This is the only place using our manylinux auto-deduction functions, so those can be removed next.
Configuration menu - View commit details
-
Copy full SHA for 9b34435 - Browse repository at this point
Copy the full SHA 9b34435View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2455977 - Browse repository at this point
Copy the full SHA 2455977View commit details -
The remaining glibc-related functions are required to allow us to put the libc version in the pip user agent (for stats).
Configuration menu - View commit details
-
Copy full SHA for 7aaa705 - Browse repository at this point
Copy the full SHA 7aaa705View commit details -
Previously, these were used when the user did not provide an explicit ABI. Now this is handled internally in `packaging.tags` (by `_cpython_abi` and `_generic_abi`).
Configuration menu - View commit details
-
Copy full SHA for 896317d - Browse repository at this point
Copy the full SHA 896317dView commit details -
Remove unused get_platform function
Now handled internally in `packaging.tags` (in `_platform_tags`).
Configuration menu - View commit details
-
Copy full SHA for 2b1b60f - Browse repository at this point
Copy the full SHA 2b1b60fView commit details -
Configuration menu - View commit details
-
Copy full SHA for ae21af7 - Browse repository at this point
Copy the full SHA ae21af7View commit details -
Configuration menu - View commit details
-
Copy full SHA for d7fda71 - Browse repository at this point
Copy the full SHA d7fda71View commit details