From 8b82d17f444098f6c706de560818edcc11464420 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 6 Mar 2026 07:42:21 -0600 Subject: [PATCH] Support Python 3.13+ on Android (#18301) Python 3.13+ changed how it reports platform information on Android; see https://peps.python.org/pep-0738/#architectures Here we add support for the new platform values, without which uv will fail due to an unrecognized interpreter. Closes #18296 Closes #18285 Closes https://github.com/astral-sh/uv/issues/18313 --------- Co-authored-by: Claude --- .../uv-python/python/get_interpreter_info.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/uv-python/python/get_interpreter_info.py b/crates/uv-python/python/get_interpreter_info.py index 46901a40f..09e94719a 100644 --- a/crates/uv-python/python/get_interpreter_info.py +++ b/crates/uv-python/python/get_interpreter_info.py @@ -487,6 +487,8 @@ def get_operating_system_and_architecture(): "minor": glibc_version[1], } elif hasattr(sys, "getandroidapilevel"): + # On Python <3.13, Android reports itself as "linux" + # See `operation_system == "android"` branch for Python 3.13+ below operating_system = { "name": "android", "api_level": sys.getandroidapilevel(), @@ -550,6 +552,26 @@ def get_operating_system_and_architecture(): "major": int(version[0]), "minor": int(version[1]), } + elif operating_system == "android": + # Python 3.13+ supports Android. We map the Android ABIs to our standard architectures. + # + # See: + # + # - https://peps.python.org/pep-0738/ + # - https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#android + # - https://developer.android.com/ndk/guides/abis#sa + android_abi_to_arch = { + "arm64_v8a": "aarch64", + "armeabi_v7a": "armv7l", + "x86": "i686", + "x86_64": "x86_64", + } + architecture = android_abi_to_arch.get(architecture, architecture) + + operating_system = { + "name": "android", + "api_level": sys.getandroidapilevel(), + } elif operating_system in [ "freebsd", "netbsd",