This PEP proposes a new platform tag series musllinux for binary Python package distributions for a Python installation that depends on musl on a Linux distribution. The tag works similarly to the “perennial manylinux” platform tags specified in PEP 600, but targeting platforms based on musl instead.
With the wide use of containers, distributions such as Alpine Linux [alpine], have been gaining more popularity than ever. Many of them based on musl [musl], a different libc implementation from glibc, and therefore cannot use the existing manylinux platform tags. This means that Python package projects cannot deploy binary distributions on PyPI for them. Users of such projects demand build constraints from those projects, putting unnecessary burden on project maintainers.
According to the documentation, musl has a stable ABI, and maintains backwards compatibility [musl-compatibility] [compare-libcs], so a binary compiled against an earlier version of musl is guaranteed to run against a newer musl runtime [musl-compat-ml]. Therefore, we use a scheme similar to the glibc-version-based manylinux tags, but against musl versions instead of glibc.
Logic behind the new platform tag largely follows PEP 600 (“perennial manylinux”), and requires wheels using this tag make similar promises. Please refer to PEP 600 for more details on rationale and reasoning behind the design.
The musllinux platform tags only apply to Python interpreters dynamically linked against the musl libc and executed on the runtime shared library, on a Linux operating system. Statically linked interpreters or mixed builds with other libc implementations (such as glibc) are out of scope and not supported by platform tags defined in this document. Such interpreters should not claim compatibility with musllinux platform tags.
Tags using the new scheme will take the form:
This tag promises the wheel works on any mainstream Linux distribution that uses musl version ${MUSLMAJOR}.${MUSLMINOR}, following the perennial design. All other system-level dependency requirements rely on the community’s definition to the intentionally vague “mainstream” description introduced in PEP 600. A wheel may make use of newer system dependencies when all mainstream distributions using the specified musl version provide the dependency by default; once all mainstream distributions on the musl version ship a certain dependency version by default, users relying on older versions are automatically removed from the coverage of that musllinux tag.
The musl version values can be obtained by executing the musl libc shared library the Python interpreter is currently running on, and parsing the output:
There are currently two possible ways to find the musl library’s location that a Python interpreter is running on, either with the system ldd command [ldd], or by parsing the PT_INTERP section’s value from the executable’s ELF header [elf].
Distributions using the tag make similar promises to those described in PEP 600, including:
Example values:
The value can be formatted with the following Python code:
It is recommended for Python package repositories, including PyPI, to accept platform tags matching the following regular expression:
Python package repositories may impose additional requirements to reject Wheels with known issues, including but not limited to:
Such policies are ultimately up to individual package repositories. It is not the author’s intention to impose restrictions to the maintainers.
There are no backwards compatibility concerns in this PEP.
Past experience on the manylinux tag series shows this approach would be too costly time-wise. The author feels the “works well with others” rule both is more inclusive and works well enough in practice.
This document is placed in the public domain or under the CC0-1.0-Universal license, whichever is more permissive.
Source: https://github.com/python/peps/blob/main/peps/pep-0656.rst
Last modified: 2025-02-01 08:55:40 UTC