From 7fd5b2196c64d427d9717dff3a07e3ed1237fbff Mon Sep 17 00:00:00 2001 From: chopratejas Date: Sun, 26 Apr 2026 10:04:06 -0700 Subject: [PATCH] ci: use maturin build + pip install instead of maturin develop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `maturin develop` requires a virtualenv (it errors with "Couldn't find a virtualenv or conda environment"). CI's setup-python provides a bare system Python without a venv, so the dev script's build path doesn't work there. This switches CI to build a release wheel via `maturin build` and install it with `pip install --force-reinstall --no-deps`. Then symlink the installed `.so` into the in-tree `headroom/` package so the editable install resolves `import headroom._core` past the source-dir shadowing of site-packages. `scripts/build_rust_extension.sh` is unchanged — it stays optimized for local dev (where there IS a venv). --- .github/workflows/ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40ed3fe3b..1cd25b963 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,9 +55,18 @@ jobs: run: | pip install 'maturin>=1.5,<2.0' + # `scripts/build_rust_extension.sh` uses `maturin develop` which requires + # a virtualenv. CI runs against bare setup-python with no venv, so build + # a wheel + pip-install it instead. Then symlink the `.so` into the + # in-tree `headroom/` package so the editable install resolves + # `import headroom._core` past the source dir shadowing site-packages. - name: Build Rust extension (headroom._core) run: | - bash scripts/build_rust_extension.sh + maturin build --release -m crates/headroom-py/Cargo.toml --out dist + pip install --force-reinstall --no-deps dist/headroom_core_py-*.whl + SO_FILE=$(python -c "import headroom._core, pathlib; print(pathlib.Path(headroom._core.__file__).resolve())") + ln -sf "$SO_FILE" "headroom/$(basename "$SO_FILE")" + python -c "from headroom._core import DiffCompressor; print('headroom._core OK:', DiffCompressor)" - name: Run linting if: matrix.python-version == '3.12'