Skip to content

Automation foundation model for tiny devices: 2-bit, 8-29 MB, tool calls, ASR, structured extraction and embeddings on phones, wearables, smart homes, robots, cars and microcontrollers.

refactor: remove Android Bionic wheel support and update related tests for clarity

jakmroc1b9f3364df8
diff --git a/needle/agent/fetch.py b/needle/agent/fetch.py
index 28d61ea..8b83f1e 100644
--- a/needle/agent/fetch.py
+++ b/needle/agent/fetch.py
@@ -35,8 +35,6 @@ WHEEL_TAGS = ("macosx_11_0_arm64", "macosx_11_0_x86_64",
"manylinux2014_aarch64", "manylinux2014_x86_64",
"musllinux_1_2_aarch64", "musllinux_1_2_x86_64",
"win_amd64", "win_arm64")
-# Bionic, for Termux. Only the generation 3 engine is built for it.
-ANDROID_TAG = "android_24_arm64_v8a"
PLATFORMS = ("macos-arm64", "linux-x86_64", "linux-arm64", "linux-armv7",
"linux-riscv64", "linux-mipsel", "windows-x86_64", "windows-arm64",
@@ -108,7 +106,7 @@ _ENGINE_ARCHES = {"x86_64": "x86_64", "amd64": "x86_64", "aarch64": "aarch64", "
def _is_android():
- """Android reports itself as Linux but links Bionic, where the Linux wheels cannot load.
+ """Android reports itself as Linux but links Bionic, where no published engine loads.
Termux is the usual way this is reached. ``platform.libc_ver()`` finds no glibc
there, so the Linux path would pick the musl aarch64 wheel and fail to load it.
@@ -124,12 +122,12 @@ def _platform_tag():
arch = "arm64" if machine in ("arm64", "aarch64") else "x86_64"
return "macosx_11_0_" + arch
if _is_android():
- if machine != "aarch64":
- raise RuntimeError(
- f"no Needle engine is published for Android on {platform.machine()}; the Android "
- "engine is built for arm64. Build libneedle for this machine and point "
- "NEEDLE3_LIB_PATH (NEEDLE2_LIB_PATH for Needle 2) at it.")
- return ANDROID_TAG
+ raise RuntimeError(
+ "no Needle engine wheel is published for Android (Bionic): the Linux wheels link "
+ "glibc or musl, so libneedle fails to load with a missing libm.so.6. The Android "
+ "builds ship a static library and the needle CLI (needle download android-arm64), "
+ "not a shared library for ctypes; to use the Python API here, build a shared "
+ "libneedle for Bionic and point NEEDLE3_LIB_PATH (NEEDLE2_LIB_PATH for Needle 2) at it.")
arch = _ENGINE_ARCHES.get(machine)
if arch is None:
# Any other machine (32-bit ARM or x86, riscv64, a 32-bit Python on
@@ -182,8 +180,7 @@ def unpublished_engine_wheels():
listings[repo] = set(list_repo_files(repo))
except Exception:
listings[repo] = set()
- tags = WHEEL_TAGS + (ANDROID_TAG,) if generation == 3 else WHEEL_TAGS
- for tag in tags:
+ for tag in WHEEL_TAGS:
wheel = engine_wheel(ENGINE_VERSIONS[generation], tag, generation)
if wheel not in listings[repo]:
missing.append(repo + "/" + wheel)
diff --git a/tests/test_fetch.py b/tests/test_fetch.py
index 468a6a4..1496ea0 100644
--- a/tests/test_fetch.py
+++ b/tests/test_fetch.py
@@ -116,9 +116,6 @@ def test_unpublished_engine_wheels_lists_every_missing_tag(monkeypatch):
fetch.engine_wheel(version, tag, generation) for tag in fetch.WHEEL_TAGS)
monkeypatch.setattr("huggingface_hub.list_repo_files",
lambda repo: sorted(published[repo]) + ["needle3.cact"])
- android = fetch.engine_wheel(fetch.ENGINE_VERSIONS[3], fetch.ANDROID_TAG, 3)
- assert fetch.unpublished_engine_wheels() == [fetch.ENGINE_REPOS[3] + "/" + android]
- published[fetch.ENGINE_REPOS[3]].add(android)
assert fetch.unpublished_engine_wheels() == []
repo3 = fetch.ENGINE_REPOS[3]
@@ -140,7 +137,7 @@ def test_a_repo_that_cannot_be_listed_holds_none_of_its_wheels(monkeypatch):
monkeypatch.setattr("huggingface_hub.list_repo_files", refuse)
missing = fetch.unpublished_engine_wheels()
engines = len(fetch.ENGINE_VERSIONS) - len(fetch.WEIGHTS_ONLY)
- assert len(missing) == engines * len(fetch.WHEEL_TAGS) + 1 # plus the generation 3 Android wheel
+ assert len(missing) == engines * len(fetch.WHEEL_TAGS)
def test_release_gate_runs_before_the_publish_step():
@@ -300,7 +297,7 @@ def test_engine_load_falls_back_to_the_other_libc(monkeypatch, tmp_path):
assert loaded["path"].endswith("musl/libneedle.so")
-def test_android_gets_the_bionic_wheel_instead_of_a_glibc_one(monkeypatch):
+def test_android_is_refused_instead_of_being_handed_a_glibc_wheel(monkeypatch):
"""Termux reports Linux/aarch64, so it used to download a wheel Bionic cannot load."""
import platform
from needle.agent import fetch
@@ -313,11 +310,7 @@ def test_android_gets_the_bionic_wheel_instead_of_a_glibc_one(monkeypatch):
assert fetch._platform_tag() == "manylinux2014_aarch64"
monkeypatch.setattr(fetch, "_is_android", lambda: True)
- assert fetch._platform_tag() == "android_24_arm64_v8a"
- assert fetch.other_libc_tag() is None
-
- monkeypatch.setattr(platform, "machine", lambda: "x86_64")
- with pytest.raises(RuntimeError, match="Android on x86_64;.*NEEDLE3_LIB_PATH"):
+ with pytest.raises(RuntimeError, match="Android .Bionic.*libm.so.6.*NEEDLE3_LIB_PATH"):
fetch._platform_tag()