[Distutils] Proposal: using /etc/os-release in the "platform tag" definition for wheel files
ncoghlan at gmail.com
Fri Nov 28 07:03:59 CET 2014
We've discussed the idea of changing the wheel file naming scheme to
deal with Linux previously, but never put together a concrete
The closest we've got is the idea of allowing the platform tag to be
customised in pip and perhaps bdist_wheel, and while that's good from
an "enabling experimentation" perspective, it may be overkill if the
primary goal is just to better support handling of Linux distros.
For starters, here's the current definition of the platform tag in PEP 425:
The platform tag is simply distutils.util.get_platform() with all
hyphens - and periods . replaced with underscore _ .
Here's my proposed change:
The default platform tag is distutils.util.get_platform() with all
hyphens - and periods . replaced with underscore _ . If
/etc/os-release [N] exists on the system, then the values in the 'ID'
and 'VERSION_ID' fields are read, all hyphens - and periods . replaced
with underscore _ , and the results appended to the default tag after
a separating underscore."
The [N] reference would then be a reference to
the definition of the format of os-release. (Note that while the
format originated with systemd, plenty of distros have also started
providing it regardless of which init system they use)
Now, this slightly overspecifies on the *consumer* side. A binary
wheel that works on "rhel_7_0" for example, should almost certainly
work on "rhel_7_1". However, that can be addressed on the tooling side
(e.g. permitting the specification of "additional compatible
platforms" when invoking pip), rather than needing to be in the
This also won't help with older Linux distros that don't offer
/etc/os-release, but I'm OK with that - those can just continue to
show up as "linux_x86_64", and PyPI can continue to disallow those
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Distutils-SIG