Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

ci: locate maturin-built .so via filesystem, not via import

chopratejasdd0697a7c962
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1cd25b963..1cc022b8c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -60,11 +60,23 @@ jobs:
# 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.
+ #
+ # We locate the `.so` via filesystem (not via `import headroom._core`)
+ # because the import would fail at this point — the editable install's
+ # in-tree `headroom/` directory shadows site-packages and doesn't
+ # contain the `.so` yet. That's exactly the problem this step fixes.
- name: Build Rust extension (headroom._core)
run: |
+ set -euo pipefail
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())")
+ SITE_PACKAGES=$(python -c "import site; print(site.getsitepackages()[0])")
+ SO_FILE=$(ls "$SITE_PACKAGES"/headroom/_core.cpython-*.so 2>/dev/null | head -1)
+ if [[ -z "$SO_FILE" ]]; then
+ echo "error: could not find _core.cpython-*.so under $SITE_PACKAGES/headroom/" >&2
+ ls -la "$SITE_PACKAGES/headroom/" || true
+ exit 1
+ fi
ln -sf "$SO_FILE" "headroom/$(basename "$SO_FILE")"
python -c "from headroom._core import DiffCompressor; print('headroom._core OK:', DiffCompressor)"