-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
PEP 656: Platform Tag for Linux Distributions Using Musl #1876
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
91995a2
Propose musllinux
uranusjr fccea0b
Switch to named references
uranusjr 0b6b83d
Remove the 1.1-1.2 exception
uranusjr 4818814
Add refs on ABI backwards compatibility guarantees
uranusjr 0466634
Recommendation to package indexes
uranusjr 7d1c3ef
Set Brett as sponsor
uranusjr 98ce5e7
Set creation date
uranusjr d82f83f
Assign musllinux as PEP 656
uranusjr 3f33807
musllinux tag value examples
uranusjr c5449ad
The name is musllinux, not just musl
uranusjr 3efba0f
Update pep-0656.rst
brettcannon 5c161c6
Update pep-0656.rst
brettcannon 0529d27
Update pep-0656.rst
brettcannon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| PEP: 656 | ||
| Title: Platform Tag for Linux Distributions Using Musl | ||
| Author: Tzu-ping Chung <uranusjr@gmail.com> | ||
| Sponsor: Brett Cannon <brett@python.org> | ||
| PEP-Delegate: TBD | ||
| Discussions-To: https://discuss.python.org/t/7165 | ||
| Status: Draft | ||
| Type: Informational | ||
| Content-Type: text/x-rst | ||
| Created: 2021-03-17 | ||
|
|
||
|
|
||
| Abstract | ||
| ======== | ||
|
|
||
| This PEP proposes a new platfrom tag series ``musllinux`` for | ||
| binary Python package distributions for a Python installation linked | ||
| against 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. | ||
|
|
||
|
|
||
| Motivation | ||
| ========== | ||
|
|
||
| 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. | ||
|
|
||
|
|
||
| Rationale | ||
| ========= | ||
|
|
||
| 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. | ||
brettcannon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Logic behind the new platform tag largely follows :pep:`600`, and | ||
| require wheels using this tag make similar promises. Please refer to | ||
| the PEP for more details on rationale and reasoning behind the design. | ||
|
|
||
|
|
||
| Specification | ||
| ============= | ||
|
|
||
| Tags using the new scheme will take the form:: | ||
|
|
||
| musllinux_${MUSLMAJOR}_${MUSLMINOR}_${ARCH} | ||
|
|
||
| Distributions using the tag make similar promises to those discribed | ||
brettcannon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| in :pep:`600`, including: | ||
|
|
||
| 1. The distribution works on any mainstream Linux distributions with | ||
| musl version ``${MUSLMAJOR}.${MUSLMINOR}`` or later. | ||
| 2. The distribution's ``${ARCH}`` matches the return value of | ||
| ``sysconfig.get_platform()`` on the host system. | ||
|
|
||
| Example values:: | ||
|
|
||
| musllinux_1_1_x86_64 # musl 1.1 running on x86-64. | ||
| musllinux_1_2_aarch64 # musl 1.2 running on ARM 64-bit. | ||
|
|
||
| The value can be formatted with the following Python code:: | ||
|
|
||
| import sysconfig | ||
|
|
||
| def format_musllinux(musl_version: tuple[int, int]) -> str: | ||
| os_name, sep, arch = sysconfig.get_platform().partition("-") | ||
| assert os_name == "linux" and sep, "Not a Linux" | ||
| arch = arch.replace("-", "_") | ||
| return f"musllinux_{musl_version[0]}_{musl_version[1]}_{arch}" | ||
|
|
||
| It is recommended for Python package repositories, including PyPI, to | ||
| accept platform tags matching the following regular expression:: | ||
|
|
||
| musllinux_([0-9]+)_([0-9]+)_([^-]+) | ||
|
|
||
| Python package repositories may impose additional requirements to | ||
| reject Wheels with known issues, including but not limited to: | ||
|
|
||
| * A ``musl_1_1`` wheel containing symbols only available in musl 1.2. | ||
| * Wheel that depends on external libraries not considered generally | ||
| available to the intended audience of the package index. | ||
| * A platform tag claiming compatibility to a non-existent musl version | ||
| (like ``musl_9000_0``). | ||
|
|
||
| Such policies are ultimately up to individual package repositories. | ||
| It is not the author's intention to impose restrictions to the | ||
| maintainers. | ||
|
|
||
|
|
||
| Backwards Compatibility | ||
| ======================= | ||
|
|
||
| There are no backwards compatibility concerns in this PEP. | ||
|
|
||
|
|
||
| Rejected Ideas | ||
| ============== | ||
|
|
||
| Create a platform tag based specifically for Alpine Linux | ||
| --------------------------------------------------------- | ||
|
|
||
| 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. | ||
|
|
||
|
|
||
| References | ||
| ========== | ||
|
|
||
| .. [alpine] https://alpinelinux.org/ | ||
|
|
||
| .. [musl] https://musl.libc.org | ||
|
|
||
| .. [musl-compatibility] https://wiki.musl-libc.org/compatibility.html | ||
|
|
||
| .. [compare-libcs] https://www.etalabs.net/compare_libcs.html | ||
|
|
||
| .. [musl-compat-ml] https://mail.python.org/archives/list/distutils-sig@python.org/message/VRXSTNXWHPAVUW253ZCWWMP7WDTBAQDL/ | ||
|
|
||
|
|
||
| Copyright | ||
| ========= | ||
|
|
||
| This document is placed in the public domain or under the | ||
| CC0-1.0-Universal license, whichever is more permissive. | ||
|
|
||
|
|
||
| .. | ||
| Local Variables: | ||
| mode: indented-text | ||
| indent-tabs-mode: nil | ||
| sentence-end-double-space: t | ||
| fill-column: 70 | ||
| coding: utf-8 | ||
| End: | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.