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.

feat: support Python 3.14+ via pyo3 abi3 stable ABI (#516)

Frank Borkin19eac8e00dc9
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f32084614..e2b4a2114 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -603,6 +603,22 @@ jobs:
*) echo "ERROR: unknown wheel target $WHEEL_TARGET" >&2; exit 1 ;;
esac
whl=$(find /wheels -maxdepth 1 -type f -name "headroom_ai-*-${py_tag}-${py_tag}-${arch_tag}.whl" -print -quit)
+ if [ -z "$whl" ]; then
+ # No version-specific wheel — fall back to a stable-ABI
+ # (abi3) wheel. A cp3<floor>-abi3 wheel installs on any
+ # CPython >= floor, which is what makes a single wheel
+ # forward-compatible to 3.14+ (Cargo.toml pyo3 abi3-py310).
+ # Pick the abi3 wheel whose floor is <= the interpreter.
+ py_minor=${PYTHON_VERSION#*.}
+ abi3=$(find /wheels -maxdepth 1 -type f -name "headroom_ai-*-abi3-${arch_tag}.whl" -print -quit)
+ if [ -n "$abi3" ]; then
+ abi3_base=${abi3##*/}
+ abi3_floor=${abi3_base#*-cp3}
+ abi3_floor=${abi3_floor%%-*}
+ case "$abi3_floor" in *[!0-9]*) abi3_floor= ;; esac
+ if [ -n "$abi3_floor" ] && [ "$abi3_floor" -le "$py_minor" ]; then whl="$abi3"; fi
+ fi
+ fi
if [ -z "$whl" ]; then
echo "ERROR: no wheel matching python=$PYTHON_VERSION arch=$arch_tag in /wheels/" >&2
find /wheels -maxdepth 1 -type f -printf "%f\n" >&2
@@ -632,6 +648,19 @@ jobs:
py_tag=cp$(echo "$PYTHON_VERSION" | tr -d .)
# macOS wheels are tagged macosx_*_arm64 (Apple Silicon only).
whl=$(find dist -maxdepth 1 -type f -name "headroom_ai-*-${py_tag}-${py_tag}-macosx_*_arm64.whl" -print -quit)
+ if [ -z "$whl" ]; then
+ # Stable-ABI (abi3) fallback — see the Linux path above. A
+ # cp3<floor>-abi3 wheel installs on any CPython >= floor.
+ py_minor=${PYTHON_VERSION#*.}
+ abi3=$(find dist -maxdepth 1 -type f -name "headroom_ai-*-abi3-macosx_*_arm64.whl" -print -quit)
+ if [ -n "$abi3" ]; then
+ abi3_base=${abi3##*/}
+ abi3_floor=${abi3_base#*-cp3}
+ abi3_floor=${abi3_floor%%-*}
+ case "$abi3_floor" in *[!0-9]*) abi3_floor= ;; esac
+ if [ -n "$abi3_floor" ] && [ "$abi3_floor" -le "$py_minor" ]; then whl="$abi3"; fi
+ fi
+ fi
if [ -z "$whl" ]; then
echo "ERROR: no macOS wheel matching python=$PYTHON_VERSION"
find dist -maxdepth 1 -type f -exec basename {} \;
diff --git a/Cargo.toml b/Cargo.toml
index 4adfcbaa7..6f80f0e74 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -55,7 +55,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread", "signal"] }
axum = "0.7"
tower = "0.5"
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
-pyo3 = "0.22"
+pyo3 = { version = "0.22", features = ["abi3-py310"] }
# Phase D PR-D1: AWS SigV4 signing for native Bedrock InvokeModel route.
# `aws-sigv4` provides the canonical-request + signing-key implementation;
# `aws-config` resolves credentials from the standard provider chain
diff --git a/pyproject.toml b/pyproject.toml
index acd9ceb0c..e1c9865d2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -39,6 +39,8 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
+ "Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",