Repository navigation
Conversation
T-Dynamos
approved these changes
Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Any Rust recipe that builds a wheel through
maturinfails onarmeabi-v7awith:Note the ordering, because it is what makes this expensive: cargo compiles the entire crate first, and only then does the PEP 517 backend reject the build.
On a slow machine that is roughly twelve minutes of work discarded on every attempt, and it reads like an unrelated failure at the very end of the build.
Why this belongs in the base class
RustCompiledComponentsRecipe.get_recipe_env()exportsRUSTFLAGSandPYO3_CROSS_LIB_DIR, but neverANDROID_API_LEVEL:https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipe.py#L1652
Five in-tree recipes subclass it:
pydantic-core,cryptography,tiktoken,primpandwatchfiles.Only
watchfilesworks around the problem, by overridingget_recipe_env()inside the recipe itself:https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/recipes/watchfiles/__init__.py#L9-L13
That workaround computes the correct value, but it places it one level too low, so every other Rust recipe still fails.
This PR moves the same assignment up into the base class, which leaves the
watchfilesoverride harmless and redundant.The change
ctx.ndk_apiis the correct value rather thanctx.android_api.maturin tags the wheel with the minimum supported API level, which is the NDK API, so the artifact is correctly labelled
android_28_arminstead of claiming compatibility it does not have.Verification
I built
pydantic-core2.41.4 forarmeabi-v7awith--minsdk 28 --ndk-api 28on top ofdevelopwith exactly this one-line change:pydantic_core-2.41.4-cp314-cp314-android_28_arm.whl_pydantic_core.cpython-314-arm-linux-androideabi.sochecked withfileand reported asELF 32-bit LSB shared object, ARM, EABI5, for Android 28, built by NDK r28carmeabi-v7a)Without the change, the identical build stops at the maturin step with the error quoted above.
Safety of
ctx.ndk_apiIt is always an
intby the time a recipe builds.prepare_build()doesndk_api = int(ndk_api)andcheck_ndk_api()validates it before any recipe is constructed, and the property raises a clearValueErrorif it were ever accessed unset.Follow-up, deliberately not in this PR
Once this lands, the per-recipe override in
recipes/watchfiles/__init__.pycan be deleted.I left it alone to keep this change to the single line that fixes the class of bug.