opendp / opendp

The core library of differential privacy algorithms powering the OpenDP Project.
https://opendp.org
MIT License
284 stars 46 forks source link

package Python with cibuildwheel and setuptools-rust #1519

Closed Shoeboxam closed 1 week ago

Shoeboxam commented 3 weeks ago

This PR changes the packaging story for Python:

  1. Python now shares the same pattern as in R, where a stage script copies the rust sources into the package
  2. If there are no binaries but there are sources in the package, then setuptools-rust will cargo build the sources upon pip install.
  3. cibuildwheel then builds the source package, producing wheels for each combination of platform/os/interpreter

When doing a developer install, neither binaries nor sources are in the package, so the wheel is installed without triggering setuptools-rust, and binary loading falls through to the prior mechanism.

Two additional files are built manually:

  1. A source distribution
  2. Since cibuildwheel doesn't support cross-compilation, the aarch64 linux wheel is manually built.
Shoeboxam commented 3 weeks ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @Shoeboxam and the rest of your teammates on Graphite Graphite

Shoeboxam commented 1 week ago

@mccalluc I don't think we need to list individual features, that can be adjusted in a follow-up. Currently the rust_build script expects a list of features, so we'd have to adjust that as well.