-
Notifications
You must be signed in to change notification settings - Fork 38
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
Support distro specific wheels on Linux, *BSD, etc #69
Comments
(Note: retitled the issue, as I can never find this one when I want to reference it, and my usual search terms are "Linux distro specific wheels"). The primary driver of previous work in this area has been @natefoo, who was seeking to do something more robust for https://galaxyproject.org than relying on the fact that a Linux wheel was obtained from https://wheels.galaxyproject.org to indicate the target platform. The result of that work can be seen at https://wheels.galaxyproject.org/simple/psycopg2/ where in addition to generic Unfortunately, as of 2018, the status quo is that the standard installation tools won't pick up these distro-specific wheels automatically - folks wanting to support the default versions of The most relevant distutils-sig thread is still Nate's "Working toward Linux wheel support" thread from 2015: : https://mail.python.org/mm3/archives/list/[email protected]/thread/KCLRIN4PTUGZLLL7GOUM23S46ZZ2D4FU/ Two key links from that thread are:
Since 2015, we've adopted TOML as the preferred format for configuration files that we expects humans to be reading and editing, so the modern version of my proposal would like: Binary compatible config file locations
File formatThe format would consist of a
(Possible future fields might include For example, a comprehensive compatibility file on a recent CentOS 7 box might look like:
This is a deliberately complex example to show that just these two fields should suffice to cover even the more esoteric situations that can come up with Linux distros:
Note: Nate's original thread also contains a digression on the specification management process, which eventually became part of PEP 566 where the core metadata is concerned (https://www.python.org/dev/peps/pep-0566/#summary-of-differences-from-pep-345 ). For this change, the update would be to PEP 425, and would involve making https://packaging.python.org/specifications/platform-compatibility-tags/ the reference link for all compatibility tag processing guidelines. (cc @pfmoore) |
I wonder whether it would be better to attach this tag at It might also be useful for the config file to record a list of libraries that can be assumed to be on any system with this tag, and that therefore don't need to be vendored. |
We won't want to use this file for stuff that may vary as the system state gets mutated, as that's a recipe for file corruption as other system packages get installed and uninstalled. However, it could be used as a config file for a PEP 517 style "platform installer" interface, whereby a Python level installer and a system installer could collaborate to use system level packages where possible, and Python level packages otherwise. That would push even more strongly in the direction of a more general purpose |
This is what I am questioning. There are advantages to pushing people to go through |
We're not going to require people to use However, we can likely make it so that such wheels get flagged as distro-specific by default (even the ones implicitly generated by |
Can I take a step back here, as I'm very unfamiliar with the issues around wheels on Linix? PEP 425 says that the platform tag is "simply Nick's discussion of a "build suffix" is confusing to me, because I don't see where it fits into PEP 425 - what I think he's saying is that the platform tag should be made up of So, can I suggest that we need an update to PEP 425 that does the following:
I'd also explicitly call out that Windows and MacOS environments are not allowed to use the build suffix mechanism, at least initially, because that's an extra level of complexity we don't want to get into right now (I could see mingw or msys2 builds of Python trying to use a build suffix to distinguish themselves from "standard" Windows Python, and establishing precedents that we're not ready to consider yet). Apologies if I'm completely missing a load of important complexities here, but I really do think that we need to be aiming for PEP 425 (or a consolidated successor) to be clear enough that someone could, from scratch, write either a build tool or an installer, just referring to the PEP, and know that they are handling wheels as we intended. |
Yep, the expected outcome of doing this would be an update to PEP 425 that provided a full tag specification at https://packaging.python.org/specifications/platform-compatibility-tags/ (similar to the core metadata spec, we've already partially migrated there, since that's the page that points out the manylinux PEPs effectively amend PEP 425 to include new platform tags and define what those tags mean) I believe you've also correctly understood the gist of the problem that needs to be addressed: Windows and Mac OS X can mostly get by with the PEP 425 platform tag definition, since they're primarily a single linear stream of releases, and the corresponding CPython binary installer sets the minimum supported operating system ABI version. However, even there support for platform suffixes would have potential use cases, since it would allows folks to target newer CPU features (like the AVX instruction sets for fast vectorised operations), while keeping those wheel files from being considered as installation candidates on systems that aren't explicitly flagged as being compatible. The critical essence of my draft design sketch above is that Python level installers wouldn't need to know any of those low level technical details about why someone might want to define a custom platform tag. All they'd need to know is:
The initial use case driving the concrete design would be for Linux distro specific wheels, but ideally we'd get an outcome that allowed folks to use reasonably arbitrary compatibility markers for private build pipelines (e.g. define a |
OK, cool - thanks @ncoghlan. As I apparently have not misunderstood the situation too badly, I'll leave it to the experts to debate the details. Ping me if you need anything from me. |
Of course not. But we might want to require people to use Another possibility to consider is whether we want to move towards
I'm getting worried about scope creep here... is the goal to expand the ABI tag to include options for "long tail" environments that are currently underserved (Alpine, conda, *BSD), or is it to provide a domain-specific language for inventing new kinds of ABI compatibility checking, in the form of a config file? If we want to support wheels tagged by AVX vs non-AVX, IMO we should handle that as a feature in its own right (and e.g. you're going to want pip to autodetect CPU capabilities). |
I don't want to allow custom tags or platform suffixes on PyPI, ever. Instead, I want to enable folks running purpose-specific index servers like piwheels.org or wheels.galaxyproject.org, as well as orgs running private index servers, to set up their build & deployment pipelines such that everything "just works" for their environments, but if one of their pre-built wheel files escapes into the wild, other platforms will ignore it as being inapplicable to them. Any cleverness related to platform feature detection would then live in the platform level configuration and installation tools that generate So I don't see it as scope creep, I see it as deliberate scope limiting: Python tools read |
Custom tags 100% should not be on PyPI. Platform tags seem like they'd be a good thing to add though? Like I don't see anything wrong with being able to add a Ubuntu 16.04 wheel to PyPI. |
Aye, if it's a platform where PyPA explicitly defines the form and content of permitted suffixes, then I agree it would be reasonable to allow it on PyPI. We have a potentially plausible way forward for that on Linux thanks to One potential approach would be akin to IANA allocating private IP address ranges: reserve the |
Hmm, to me then it sounds like there are two separate issues here:
These seem like pretty different use cases, with different stakeholders, pain points, etc., so I think it'd be more productive to consider them separately. |
I view the custom tagging as more like include the My main concern is that I see significant scope for "But what about..." questions arising when considering the possibilities for platform subtagging, so having "Use a custom platform tag if you want that" as a readily available answer should make it a lot easier to put those kinds of questions aside. |
Just a heads up, I broke the platform detection work out in to its own library at natefoo/lionshead. I also have outdated branches of pip and wheel that support "distro wheels" and With the success of manylinux, I haven't kept up my work on distro wheels, but if there's renewed interest I'd certainly revisit it. |
This is probably super relevant to the gRPC and TensorFlow teams @ Google. @mehrdada @kpayson64 |
Some additional prior art from the NuGet world: https://github.com/dotnet/corefx/blob/master/pkg/Microsoft.NETCore.Platforms/runtime.json Rather than relying on platforms to document their own derivation chains, the .NET folks came to the conclusion that it would be easier and more reliable to maintain their own database of derivation links. That means the Python ecosystem could potentially adopt the same approach, but use the .NET target environment database as its starting point (note though that the NuGet list appears to only cover Linux and Windows - no Mac OS X or iOS). Additional explanation here: https://natemcmaster.com/blog/2016/05/19/nuget3-rid-graph/ I wasn't able to find any of their platform detection code. (from @edenhill in pypa/manylinux#37 (comment) ) |
Might be nice to echew the "detection" step in favor of how the packaging system "conan.io" does distro detection (https://github.com/conan-io/conan). In short: the builder of the package is responsible for detection of any platform specific things. In python, a two phase process involves downloading a packageinfo.py file, if available at the repo, and running it locally. The output is an arbitrary set of wheel tags needed. By doing this we push off the need to build-in platform detection and leave it up to the developer to determine what is relevant. For example, a developer can choose to add an optional tag "is_alpine" to a wheel. Whereas another developer can choose to specify the exact version of glibc as a tag. And yet another developer can detect which version of openssl is installed locally ... and create wheels for each version. It doesn't seem like a huge stretch to make this a two phase feature and this vastly reduces the herculean task of figuring out every possible platform specific tag and how to detect it reliably in the past present and futures. If anyone thinks that this is a good solution and a PEP is warranted, I'd be happy to start writing one. |
It would be great to have this feature, as I'm using devpi to host internal wheels, and the current workaround is to have separate parallel indices with |
The compatibility tags defined in PEP 425 really only work for Windows and Mac OS X, where the python.org binaries and the versions of the OS they support provide a clear guide as to the versions extension modules should also support.
This approach doesn't work for all the other *nix releases, where python.org only publishes a source tarball, rather than prebuilt binaries.
The currently generated wheel filenames and the "find which wheel to download" algorithm don't work for these cases, which is why PyPI wheel uploads are currently limited to Windows and Mac OS X, as well as the cross-distro
manylinux
ABI tags.(I didn't see an existing overarching issue for this problem, so I filed a new one. There are links to some relevant distutils-sig threads which should be added...)
The text was updated successfully, but these errors were encountered: