Add support for Android and iOS platforms#12220
Conversation
for more information, see https://pre-commit.ci
Merging this PR will not alter performance
Comparing Footnotes
|
Have you tested a simple server app too? |
Not yet, but I can also do a simple test for this. But it will take a few days. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #12220 +/- ##
===========================================
+ Coverage 47.33% 98.79% +51.46%
===========================================
Files 131 129 -2
Lines 46732 46746 +14
Branches 2420 2415 -5
===========================================
+ Hits 22120 46183 +24063
+ Misses 24006 433 -23573
+ Partials 606 130 -476
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
I now added the unittests for Android and iOS to the CI, to verify that everything is working. To run the unittests I use cibuildwheel, that automatically starts an Android Emulator / iOS Simulator and runs the whole pytests inside this Emulator/Simulator. The only issue is that the unit tests have some binary dependencies that aren't yet available for Android and iOS. Hopefully this will improve over time, but for now I had to add environment markers to quite a few dependencies and skip the tests that use these dependencies. Another problem was that pip-compile doesn’t use the environment markers for transitive dependencies as well. Therefore, I had to include some of the transitive dependencies in the |
…t that uses that file.
…This simplifies the problem, that pip-compile does not handle environment markers for transitive dependencies correctly.
|
@timrid Did you want to finish off this PR? It looks like there's only some minor comments and now several conflicts to resolve in order to get this merged. |
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
for more information, see https://pre-commit.ci
Backport to 3.14: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply bc504da on top of patchback/backports/3.14/bc504dafcecad929eeb20cfcab71d2d66df9e28e/pr-12220 Backporting merged PR #12220 into master
🤖 @patchback |
|
@timrid Could you follow the backport instructions above in order to get it included in the 3.14 release? |
(cherry picked from commit bc504da)
|
The test failure output is awful on these CI jobs. Do you think we can have a separate test step like normal, rather than running it as a side-effect of cibuildwheel? |
Building wheels and running the tests on Android and iOS are pretty complicated tasks, because they have to be cross compiled an the tests run in the iOS simulator/Android emulator. These simulator/emulator has to be started first, then an dummy iOS/Android app has to be created containing the test files and then this app has to be copied and run in in simulator/emulator and then the python stdout has to be captured from the simulator/emulator and shown in the Github output. So all in all a hard task that is luckily integrated in cibuildwheel. I am not aware of an cibuildwheel option to split building and testing in two separate steps to run it in two different Github Action steps. I am also not sure what exactly you think is awful in the output? Is it the missing colored output? Or the fact, that you have to expand the |
|
I think that is the most annoying issue. It seems that the grouping in Github Actions has an long standing performance issue. Maybe the performance is better when the grouping is removed. cibuildwheel is detecting Github Actions automatically and then adds grouping to the logs, but maybe we could trick it into thinking that it is not running in Github Actions, so that it does not add grouping.
It is easily possible to add color to Android logs. iOS is more difficult, because that probably needs an upstream CPython change in the way the test runner captures and prints the output, because there the color infos get lost. I added a issue for that problem: python/cpython#150932
This is also only an issue on iOS and not on Android. It has also something to do with the way the test runner captures and prints the output. I addressed that in the same CPython issue. |
What do these changes do?
This PR adds support for Android and iOS platforms.
Since Python 3.13, Android (PEP738) and iOS (PEP730) are officially supported. In addition, Android and iOS have been supported since cibuildwheel v3.1. This makes it very easy to build wheels for Android and iOS.
PyPI now also supports uploading Android and iOS wheels (see pypi/warehouse#17559).
At https://beeware.org/mobile-wheels/, you can find an overview of all binary packages available for Android and iOS. Currently, there aren't that many, but I hope
aiohttpwill appear there soon :)Are there changes in behavior for the user?
No.
Is it a substantial burden for the maintainers to support this?
Most of the compiling work is taken care of by cibuildwheel. However, the pytests are currently not run on Android and iOS, so it is theoretically possible that there may be problems during runtime on Android/iOS.
In principle, cibuildwheel also offers the option of running the pytests on Android and iOS using
test-command, but this requires the Android emulator/iOS simulator to be started in the CI, which significantly slows down the building of the wheels. In addition,test-commandis not currently used, which would require more adjustments to the CI. Therefore, I have decided not to use it for now and have only manually performed a very simple “smoke test” in a briefcase application to check whether the wheel is importable and usable.Related issue number
Fixes #11750
Checklist
CONTRIBUTORS.txtCHANGES/folder