[python] Consider publishing a source distribution (sdist) for the PyO3-based Python package
Author: reyammerCreated Sep 25, 2026Updated Sep 25, 2026
With the transition of the magika Python package to native Rust bindings via PyO3 and Maturin (removing the legacy pure-Python wheel and sdist jobs), we currently only build and publish pre-compiled abi3-py38 binary wheels across our supported target matrix.
We may want to re-introduce building and publishing a source distribution (sdist) alongside the binary wheels for corner-case users and downstream packagers:
Motivation
- Fallback on unsupported platforms/architectures: Users on platforms without pre-built wheels (e.g., FreeBSD, OpenBSD,
ppc64le,s390x, Linux ARMv6, or musl ARMv7) can installmagikafrom source viapip install magika/uv add magikausing a local Rust toolchain instead of failing withNo matching distribution found. - Downstream distribution maintainers: Maintainers for Linux/BSD distributions (Debian, Fedora, Arch, Alpine, Nixpkgs, Homebrew,
conda-forge) typically build packages from the PyPIsdist.
Implementation Notes & Considerations
- Workspace / path dependencies:
maturin sdistsupports bundling local relative path dependencies (rust/pyo3,rust/lib,rust/rules,rust/tract-runtime), provided each crate'sCargo.tomlincludelist covers all required build assets (models, rulesets,build.rs). - Standalone
magikaCLI binary: Binary wheels currently bundle the pre-compiledrust/clibinary staged viapython/scripts/stage_cli.shintopython/wheel_data/scripts/. Since ansdistis platform-independent and Maturin's PEP 517 build backend only compiles themanifest-pathcrate (rust/pyo3), we should decide whethersdistinstalls only provide themagikaPython library (or also expose a CLI entrypoint/warning).
Source: google/magika