Build Python wheels on CI with minimal configuration.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Cibuildwheel provides comprehensive cross-platform wheel building with native support for major operating systems and Python implementations.
Automatic detection of the current platform for default build configuration.
def native_platform() -> PlatformName:
"""
Detect the current platform based on sys.platform.
Returns:
PlatformName: One of "linux", "macos", "windows"
Raises:
ConfigurationError: If platform cannot be detected or is unsupported
"""Core platform type definitions and constants.
PlatformName = Literal["linux", "macos", "windows", "pyodide", "android", "ios"]
PLATFORMS: Final[frozenset[PlatformName]] = frozenset({
"linux", "macos", "windows", "pyodide", "android", "ios"
})Generate build identifiers for specific platform configurations.
def get_build_identifiers(
platform_module: PlatformModule,
build_selector: BuildSelector,
architectures: set[Architecture],
) -> list[str]:
"""
Get list of build identifiers that match the selection criteria.
Args:
platform_module: Platform-specific implementation module
build_selector: Build selection criteria
architectures: Set of target architectures
Returns:
List of build identifier strings (e.g., ['cp311-linux_x86_64', 'cp312-linux_x86_64'])
"""Interface that all platform modules must implement.
class PlatformModule(Protocol):
def all_python_configurations(self) -> Sequence[GenericPythonConfiguration]:
"""Get all available Python configurations for this platform."""
def get_python_configurations(
self, build_selector: BuildSelector, architectures: set[Architecture]
) -> Sequence[GenericPythonConfiguration]:
"""Get Python configurations that match the selection criteria."""
def build(self, options: Options, tmp_path: Path) -> None:
"""Execute the build process for this platform."""Registry of all available platform implementation modules.
ALL_PLATFORM_MODULES: Final[dict[PlatformName, PlatformModule]] = {
"linux": linux,
"windows": windows,
"macos": macos,
"pyodide": pyodide,
"android": android,
"ios": ios,
}Builds manylinux and musllinux wheels using Docker/Podman containers.
Supported Architectures:
x86_64: 64-bit Intel/AMD (primary)i686: 32-bit Intel/AMDaarch64: 64-bit ARMppc64le: 64-bit PowerPC Little Endians390x: IBM System zarmv7l: 32-bit ARM (experimental)riscv64: RISC-V 64-bit (experimental)Python Implementations:
Key Features:
Builds universal and architecture-specific wheels for macOS.
Supported Architectures:
x86_64: Intel Macsarm64: Apple Silicon Macsuniversal2: Universal binaries (both architectures)Python Implementations:
Key Features:
Builds wheels for Windows across multiple architectures.
Supported Architectures:
AMD64: 64-bit Windows (x86_64)x86: 32-bit WindowsARM64: Windows on ARM (experimental)Python Implementations:
Key Features:
Builds wheels for the Pyodide WebAssembly platform.
Supported Architectures:
wasm32: WebAssembly 32-bitPython Implementations:
Key Features:
Builds wheels for Android devices and emulators.
Supported Architectures:
arm64_v8a: 64-bit ARM for AndroidPython Implementations:
Key Features:
Builds wheels for iOS devices and simulators.
Supported Architectures:
arm64_iphoneos: iOS devices (ARM64)arm64_iphonesimulator: iOS Simulator on Apple Siliconx86_64_iphonesimulator: iOS Simulator on Intel MacsPython Implementations:
Key Features:
# Specify custom container images
CIBW_MANYLINUX_X86_64_IMAGE = "quay.io/pypa/manylinux2014_x86_64"
CIBW_MUSLLINUX_X86_64_IMAGE = "quay.io/pypa/musllinux_1_1_x86_64"
# Choose container engine
CIBW_CONTAINER_ENGINE = "docker" # or "podman"# Linux ARM64 on x86_64 (requires emulation)
CIBW_ARCHS_LINUX = "x86_64 aarch64"
# Windows ARM64 (cross-compilation)
CIBW_ARCHS_WINDOWS = "AMD64 ARM64"
# macOS Universal binaries
CIBW_ARCHS_MACOS = "universal2"# Pass host environment variables to containers
CIBW_ENVIRONMENT_PASS_LINUX = "SECRET_TOKEN API_KEY"Different CI platforms support different combinations of operating systems and architectures:
| CI Platform | Linux | macOS | Windows | Linux ARM | macOS ARM | Windows ARM | Android | iOS |
|---|---|---|---|---|---|---|---|---|
| GitHub Actions | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Azure Pipelines | ✅ | ✅ | ✅ | - | ✅ | ✅ | ✅ | ✅ |
| Travis CI | ✅ | - | ✅ | ✅ | - | - | ✅ | - |
| CircleCI | ✅ | ✅ | - | ✅ | ✅ | - | ✅ | ✅ |
| GitLab CI | ✅ | ✅ | ✅ | ✅* | ✅ | - | ✅ | ✅ |
| Cirrus CI | ✅ | ✅ | ✅ | ✅ | ✅ | - | ✅ | - |
*Requires emulation setup
Install with Tessl CLI
npx tessl i tessl/pypi-cibuildwheel