ruithnadsteud / yt_georaster

A package for handling geotiff files and georeferenced datasets within yt.
1 stars 2 forks source link

Build wheels in CI #59

Open R2ZER0 opened 2 years ago

R2ZER0 commented 2 years ago

We've found ourselves needing to install this package in a minimal container environment with no access to build tools like Cython or gcc, where the usual pip install -e ... isn't an option. So I've built pre-compiled binary wheels.

I figured others might have a similar use case, so if you're interested in building wheels too, this PR has the CI setup I used to build the wheels.

I based this off upstream yt's setup for building wheels: https://github.com/yt-project/yt/blob/main/.github/workflows/wheels.yaml but simplified to remove the upstream/yt-specific stuff, and updated to use PyPa's recommended pre-built action: https://cibuildwheel.readthedocs.io/en/stable/setup/#github-actions

The result is using PyPa's cibuildwheel package and their integration with Github Actions (every open source repo/user has 2000 free Actions minutes per month).

Currently it's configured to build Python 3.7 through to 3.10, on Win32/64, Linux and macOS, but note that so far I've only tested the Linux wheels, and I don't have access to a Mac to test the macOS wheels.

The resulting wheels are pretty small, less than 1M each! Here's the output from today: https://github.com/R2ZER0/yt_georaster/actions/runs/1553724929

I'd be happy to make changes, e.g. if you'd prefer to use CircleCI as you already do (but note that apparantly CircleCI can't build Windows wheels: https://cibuildwheel.readthedocs.io/en/stable/#usage), or if you'd like to build wheels for extra branches, or only certain tags etc.