Skip to content
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

feat: add musllinux support (PEP 656) #768

Merged
merged 6 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ Python wheels are great. Building them across **Mac, Linux, Windows**, on **mult
What does it do?
----------------

| | macOS Intel | macOS Apple Silicon | Windows 64bit | Windows 32bit | manylinux x86_64 | manylinux i686 | manylinux aarch64 | manylinux ppc64le | manylinux s390x |
| | macOS Intel | macOS Apple Silicon | Windows 64bit | Windows 32bit | manylinux<br/>musllinux x86_64 | manylinux<br/>musllinux i686 | manylinux<br/>musllinux aarch64 | manylinux<br/>musllinux ppc64le | manylinux<br/>musllinux s390x |
|---------------|----|-----|-----|-----|----|-----|----|-----|-----|
| CPython 3.6 | ✅ | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.7 | ✅ | N/A | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.8 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| PyPy 3.7 v7.3 | ✅ | N/A | ✅ | N/A | ✅ | ✅ | ✅ | N/A | N/A |
| PyPy 3.7 v7.3 | ✅ | N/A | ✅ | N/A | ✅¹ | ✅¹ | ✅¹ | N/A | N/A |

<sup>¹ PyPy is only supported for manylinux wheels.</sup><br>

- Builds manylinux, macOS 10.9+, and Windows wheels for CPython and PyPy
- Builds manylinux, musllinux, macOS 10.9+, and Windows wheels for CPython and PyPy
- Works on GitHub Actions, Azure Pipelines, Travis CI, AppVeyor, CircleCI, and GitLab CI
- Bundles shared library dependencies on Linux and macOS through [auditwheel](https://github.com/pypa/auditwheel) and [delocate](https://github.com/matthew-brett/delocate)
- Runs your library's tests against the wheel-installed version of your library
Expand Down Expand Up @@ -62,7 +63,7 @@ Usage
Example setup
-------------

To build manylinux, macOS, and Windows wheels on GitHub Actions, you could use this `.github/workflows/wheels.yml`:
To build manylinux, musllinux, macOS, and Windows wheels on GitHub Actions, you could use this `.github/workflows/wheels.yml`:

```yaml
name: Build
Expand Down Expand Up @@ -114,7 +115,7 @@ Options
| | [`CIBW_BEFORE_ALL`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-all) | Execute a shell command on the build system before any wheels are built. |
| | [`CIBW_BEFORE_BUILD`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-build) | Execute a shell command preparing each wheel's build |
| | [`CIBW_REPAIR_WHEEL_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#repair-wheel-command) | Execute a shell command to repair each (non-pure Python) built wheel |
| | [`CIBW_MANYLINUX_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) | Specify alternative manylinux Docker images |
| | [`CIBW_MANYLINUX_*_IMAGE`<br/>`CIBW_MUSLLINUX_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image) | Specify alternative manylinux / musllinux Docker images |
| | [`CIBW_DEPENDENCY_VERSIONS`](https://cibuildwheel.readthedocs.io/en/stable/options/#dependency-versions) | Specify how cibuildwheel controls the versions of the tools it uses |
| **Testing** | [`CIBW_TEST_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#test-command) | Execute a shell command to test each built wheel |
| | [`CIBW_BEFORE_TEST`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-test) | Execute a shell command before testing each wheel |
Expand Down
13 changes: 10 additions & 3 deletions bin/update_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ class Image(NamedTuple):


images = [
# manylinux1 images
Image("manylinux1", "x86_64", "quay.io/pypa/manylinux1_x86_64", None),
Image("manylinux1", "i686", "quay.io/pypa/manylinux1_i686", None),
# 2010 images
# manylinux2010 images
Image("manylinux2010", "x86_64", "quay.io/pypa/manylinux2010_x86_64", None),
Image("manylinux2010", "i686", "quay.io/pypa/manylinux2010_i686", None),
Image("manylinux2010", "pypy_x86_64", "quay.io/pypa/manylinux2010_x86_64", None),
Image("manylinux2010", "pypy_i686", "quay.io/pypa/manylinux2010_i686", None),
# 2014 images
# manylinux2014 images
Image("manylinux2014", "x86_64", "quay.io/pypa/manylinux2014_x86_64", None),
Image("manylinux2014", "i686", "quay.io/pypa/manylinux2014_i686", None),
Image("manylinux2014", "aarch64", "quay.io/pypa/manylinux2014_aarch64", None),
Expand All @@ -35,7 +36,7 @@ class Image(NamedTuple):
Image("manylinux2014", "pypy_x86_64", "quay.io/pypa/manylinux2014_x86_64", None),
Image("manylinux2014", "pypy_i686", "quay.io/pypa/manylinux2014_i686", None),
Image("manylinux2014", "pypy_aarch64", "quay.io/pypa/manylinux2014_aarch64", None),
# 2_24 images
# manylinux_2_24 images
Image("manylinux_2_24", "x86_64", "quay.io/pypa/manylinux_2_24_x86_64", None),
Image("manylinux_2_24", "i686", "quay.io/pypa/manylinux_2_24_i686", None),
Image("manylinux_2_24", "aarch64", "quay.io/pypa/manylinux_2_24_aarch64", None),
Expand All @@ -44,6 +45,12 @@ class Image(NamedTuple):
Image("manylinux_2_24", "pypy_x86_64", "quay.io/pypa/manylinux_2_24_x86_64", None),
Image("manylinux_2_24", "pypy_i686", "quay.io/pypa/manylinux_2_24_i686", None),
Image("manylinux_2_24", "pypy_aarch64", "quay.io/pypa/manylinux_2_24_aarch64", None),
# musllinux_1_1 images
Image("musllinux_1_1", "x86_64", "quay.io/pypa/musllinux_1_1_x86_64", None),
Image("musllinux_1_1", "i686", "quay.io/pypa/musllinux_1_1_i686", None),
Image("musllinux_1_1", "aarch64", "quay.io/pypa/musllinux_1_1_aarch64", None),
Image("musllinux_1_1", "ppc64le", "quay.io/pypa/musllinux_1_1_ppc64le", None),
Image("musllinux_1_1", "s390x", "quay.io/pypa/musllinux_1_1_s390x", None),
]

config = configparser.ConfigParser()
Expand Down
31 changes: 29 additions & 2 deletions cibuildwheel/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
"pypy_i686",
)

MUSLLINUX_ARCHS = (
"x86_64",
"i686",
"aarch64",
"ppc64le",
"s390x",
)


def main() -> None:
platform: PlatformName
Expand Down Expand Up @@ -167,10 +175,13 @@ def main() -> None:
manylinux_identifiers = {
f"manylinux-{build_platform}-image" for build_platform in MANYLINUX_ARCHS
}
musllinux_identifiers = {
f"musllinux-{build_platform}-image" for build_platform in MUSLLINUX_ARCHS
}
disallow = {
"linux": {"dependency-versions"},
"macos": manylinux_identifiers,
"windows": manylinux_identifiers,
"macos": manylinux_identifiers | musllinux_identifiers,
"windows": manylinux_identifiers | musllinux_identifiers,
}
options = ConfigOptions(package_dir, args.config_file, platform=platform, disallow=disallow)
output_dir = Path(
Expand Down Expand Up @@ -278,6 +289,7 @@ def main() -> None:
sys.exit(0)

manylinux_images: Dict[str, str] = {}
musllinux_images: Dict[str, str] = {}
if platform == "linux":
pinned_docker_images_file = resources_dir / "pinned_docker_images.cfg"
all_pinned_docker_images = ConfigParser()
Expand All @@ -303,6 +315,20 @@ def main() -> None:

manylinux_images[build_platform] = image

for build_platform in MUSLLINUX_ARCHS:
pinned_images = all_pinned_docker_images[build_platform]

config_value = options(f"musllinux-{build_platform}-image")

if config_value is None:
image = pinned_images.get("musllinux_1_1")
elif config_value in pinned_images:
image = pinned_images[config_value]
else:
image = config_value

musllinux_images[build_platform] = image

build_options = BuildOptions(
architectures=archs,
package_dir=package_dir,
Expand All @@ -320,6 +346,7 @@ def main() -> None:
environment=environment,
dependency_constraints=dependency_constraints,
manylinux_images=manylinux_images or None,
musllinux_images=musllinux_images or None,
build_frontend=build_frontend,
)

Expand Down
6 changes: 6 additions & 0 deletions cibuildwheel/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def build(options: BuildOptions) -> None:
sys.exit(2)

assert options.manylinux_images is not None
assert options.musllinux_images is not None
python_configurations = get_python_configurations(options.build_selector, options.architectures)
platforms = [
("cp", "manylinux_x86_64", options.manylinux_images["x86_64"]),
Expand All @@ -71,6 +72,11 @@ def build(options: BuildOptions) -> None:
("pp", "manylinux_x86_64", options.manylinux_images["pypy_x86_64"]),
("pp", "manylinux_aarch64", options.manylinux_images["pypy_aarch64"]),
("pp", "manylinux_i686", options.manylinux_images["pypy_i686"]),
("cp", "musllinux_x86_64", options.musllinux_images["x86_64"]),
("cp", "musllinux_i686", options.musllinux_images["i686"]),
("cp", "musllinux_aarch64", options.musllinux_images["aarch64"]),
("cp", "musllinux_ppc64le", options.musllinux_images["ppc64le"]),
("cp", "musllinux_s390x", options.musllinux_images["s390x"]),
]

cwd = Path.cwd()
Expand Down
5 changes: 5 additions & 0 deletions cibuildwheel/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
"manylinux_aarch64": "manylinux aarch64",
"manylinux_ppc64le": "manylinux ppc64le",
"manylinux_s390x": "manylinux s390x",
"musllinux_x86_64": "musllinux x86_64",
"musllinux_i686": "musllinux i686",
"musllinux_aarch64": "musllinux aarch64",
"musllinux_ppc64le": "musllinux ppc64le",
"musllinux_s390x": "manylinux s390x",
"win32": "Windows 32bit",
"win_amd64": "Windows 64bit",
"macosx_x86_64": "macOS x86_64",
Expand Down
25 changes: 25 additions & 0 deletions cibuildwheel/resources/build-platforms.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@ python_configurations = [
{ identifier = "cp310-manylinux_s390x", version = "3.10", path_str = "/opt/python/cp310-cp310" },
{ identifier = "pp37-manylinux_aarch64", version = "3.7", path_str = "/opt/python/pp37-pypy37_pp73" },
{ identifier = "pp37-manylinux_i686", version = "3.7", path_str = "/opt/python/pp37-pypy37_pp73" },
{ identifier = "cp36-musllinux_x86_64", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_x86_64", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_x86_64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-musllinux_x86_64", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "cp310-musllinux_x86_64", version = "3.10", path_str = "/opt/python/cp310-cp310" },
{ identifier = "cp36-musllinux_i686", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_i686", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_i686", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-musllinux_i686", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "cp310-musllinux_i686", version = "3.10", path_str = "/opt/python/cp310-cp310" },
{ identifier = "cp36-musllinux_aarch64", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_aarch64", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_aarch64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-musllinux_aarch64", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "cp310-musllinux_aarch64", version = "3.10", path_str = "/opt/python/cp310-cp310" },
{ identifier = "cp36-musllinux_ppc64le", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_ppc64le", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_ppc64le", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-musllinux_ppc64le", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "cp310-musllinux_ppc64le", version = "3.10", path_str = "/opt/python/cp310-cp310" },
{ identifier = "cp36-musllinux_s390x", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_s390x", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_s390x", version = "3.8", path_str = "/opt/python/cp38-cp38" },
{ identifier = "cp39-musllinux_s390x", version = "3.9", path_str = "/opt/python/cp39-cp39" },
{ identifier = "cp310-musllinux_s390x", version = "3.10", path_str = "/opt/python/cp310-cp310" },
]

[macos]
Expand Down
6 changes: 6 additions & 0 deletions cibuildwheel/resources/defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ manylinux-pypy_x86_64-image = "manylinux2010"
manylinux-pypy_i686-image = "manylinux2010"
manylinux-pypy_aarch64-image = "manylinux2014"

musllinux-x86_64-image = "musllinux_1_1"
musllinux-i686-image = "musllinux_1_1"
musllinux-aarch64-image = "musllinux_1_1"
musllinux-ppc64le-image = "musllinux_1_1"
musllinux-s390x-image = "musllinux_1_1"


[tool.cibuildwheel.linux]
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"
Expand Down
45 changes: 25 additions & 20 deletions cibuildwheel/resources/pinned_docker_images.cfg
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
[x86_64]
manylinux1 = quay.io/pypa/manylinux1_x86_64:2021-09-18-65abb78
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-09-18-c1afc21
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-09-18-c1afc21
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-09-18-c1afc21
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-09-18-f12faf3
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-09-18-f12faf3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-09-18-f12faf3
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2021-09-18-f12faf3

[i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2021-09-18-65abb78
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-09-18-c1afc21
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-09-18-c1afc21
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-09-18-c1afc21
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-09-18-f12faf3
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-09-18-f12faf3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-09-18-f12faf3
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2021-09-18-f12faf3

[pypy_x86_64]
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-09-18-c1afc21
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-09-18-c1afc21
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-09-18-c1afc21
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-09-18-f12faf3
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-09-18-f12faf3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-09-18-f12faf3

[pypy_i686]
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-09-18-c1afc21
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-09-18-c1afc21
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-09-18-c1afc21
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-09-18-f12faf3
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-09-18-f12faf3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-09-18-f12faf3

[aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-09-18-c1afc21
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-09-18-c1afc21
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-09-18-f12faf3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-09-18-f12faf3
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2021-09-18-f12faf3

[ppc64le]
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2021-09-18-c1afc21
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2021-09-18-c1afc21
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2021-09-18-f12faf3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2021-09-18-f12faf3
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2021-09-18-f12faf3

[s390x]
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2021-09-18-c1afc21
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2021-09-18-c1afc21
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2021-09-18-f12faf3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2021-09-18-f12faf3
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2021-09-18-f12faf3

[pypy_aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-09-18-c1afc21
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-09-18-c1afc21
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-09-18-f12faf3
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-09-18-f12faf3

1 change: 1 addition & 0 deletions cibuildwheel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class BuildOptions(NamedTuple):
before_build: Optional[str]
repair_command: str
manylinux_images: Optional[Dict[str, str]]
musllinux_images: Optional[Dict[str, str]]
dependency_constraints: Optional[DependencyConstraints]
test_command: Optional[str]
test_selector: TestSelector
Expand Down
6 changes: 3 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ _1 May 2021_
_22 Feb 2021_

- ✨ Added `manylinux_2_24` support. To use these new Debian-based manylinux
images, set your [manylinux image](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image)
images, set your [manylinux image](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image)
options to `manylinux_2_24`.
- 🛠 On macOS, we now set `MACOSX_DEPLOYMENT_TARGET` in before running
`CIBW_BEFORE_ALL`. This is useful when using `CIBW_BEFORE_ALL` to build a
Expand Down Expand Up @@ -321,7 +321,7 @@ _2 May 2020_
Studio can still effect things.

This can be controlled using the [CIBW_DEPENDENCY_VERSIONS](https://cibuildwheel.readthedocs.io/en/stable/options/#dependency-versions)
and [manylinux image](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image)
and [manylinux image](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image)
options - if you always want to use the latest toolchain, you can still do
that, or you can specify your own pip constraints file and manylinux image.
(#256)
Expand Down Expand Up @@ -396,7 +396,7 @@ _10 November 2019_
build using the manylinux2010 images by default. If your project is still
manylinux1 compatible, you should get both manylinux1 and manylinux2010
wheels - you can upload both to PyPI. If you always require manylinux1 wheels, you can
build using the old manylinux1 image using the [manylinux image](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) option.
build using the old manylinux1 image using the [manylinux image](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image) option.
(#155)
- 📚 Documentation is now on its [own mini-site](https://cibuildwheel.readthedocs.io),
rather than on the README (#169)
Expand Down
Loading