Skip to content

Add support for Android - #10233

Open
mhsmith wants to merge 24 commits into
python-pillow:mainfrom
mhsmith:android
Open

mhsmith wants to merge 24 commits into
python-pillow:mainfrom
mhsmith:android

Conversation

@mhsmith

@mhsmith mhsmith commented Oct 17, 2026 •

Copy link
Copy Markdown

As with iOS, most of the work was in wheels-dependencies.sh. I've explained the Android-specific changes with comments in the code, but here's a summary of changes that affect other platforms:

  • wheels-dependencies.sh now runs as a before-build script rather than before-all. This has several advantages:

    • It allows the script to determine the current OS and architecture from the CIBUILDWHEEL_BUILD_IDENTIFIER environment variable. This means you can now run cibuildwheel in any of its supported modes, including building multiple architectures in one command, or using --only with no environment variables at all.
    • The script runs within a temporary virtual environment, so it can install Python packages without modifying cibuildwheel's own environment.
    • Although the script may run multiple times for different Python versions, they all share the same WORKDIR, so the later runs will see all the stamp files and finish quickly without rebuilding anything.
  • To improve consistency between platforms, and reduce clutter in the build directory, WORKDIR is now set to build/deps/os_arch, where os_arch is the second half of CIBUILDWHEEL_BUILD_IDENTIFIER, e.g. android_x86_64 or macosx_arm64.

    • On all platforms except Linux, BUILD_PREFIX is now set to $WORKDIR/prefix. Linux continues to install dependencies to /usr/local as before.
  • Introduced an IS_LINUX flag, since -z $IS_MACOS can now mean either Linux or Android.

  • For consistency, cmake is now installed from PyPI on all platforms, not just macOS. pkg-config is now also installed from PyPI rather than building it from source.

  • Factored out the test sequence (selftest, check_wheel, Tests) into a wheels_test script which is shared by all platforms. This was necessary because on Android, cibuildwheel requires test-command to be a single Python command.

@radarhere

Copy link
Copy Markdown
Member

Hi. Could you let me know - what was your thinking behind creating this as a draft? You could simply run our CI in your own fork and inspect the results there. Or do you think this is close to being finished, and are hoping for support?

@mhsmith

mhsmith commented Oct 19, 2026

Copy link
Copy Markdown
Author

You could simply run our CI in your own fork and inspect the results there.

Sorry, I didn't realize the project required CI approval for new contributors. I'll work on a different branch on my own fork, and update the PR once it's ready for review, which should be within the next few days.

@CVFA

CVFA commented Oct 25, 2026

Copy link
Copy Markdown

@mhsmith I just want to say that you're probably the most important person for Python developers on Android—please never give up on porting popular Python packages to Android.

@mhsmith
mhsmith marked this pull request as ready for review October 26, 2026 01:25
@mhsmith

mhsmith commented Oct 26, 2026

Copy link
Copy Markdown
Author

This PR is now ready for review. I've updated the description above.

@radarhere

Copy link
Copy Markdown
Member

Is the bzip2 patch intended to be permanent? It would be ideal if the functionality could one day be added upstream.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wheels for Android?

3 participants