Skip to main content

Python for Android

If you obtained this README as part of a release package, then the only applicable sections are "Prerequisites", "Testing", and "Using in your own app".

If you obtained this README as part of the CPython source tree, then you can also follow the other sections to compile Python for Android yourself.

However, most app developers should not need to do any of these things manually. Instead, use one of the tools listed here, which will provide a much easier experience.

Prerequisites

If you already have an Android SDK installed, export the ANDROID_HOME environment variable to point at its location. Otherwise, here's how to install it:

  • Download the "Command line tools" from https://developer.android.com/studio.
  • Create a directory android-sdk/cmdline-tools, and unzip the command line tools package into it.
  • Rename android-sdk/cmdline-tools/cmdline-tools to android-sdk/cmdline-tools/latest.
  • export ANDROID_HOME=/path/to/android-sdk

The android.py script will automatically use the SDK's sdkmanager to install any packages it needs.

The script also requires the following commands to be on the PATH:

  • curl
  • java (or set the JAVA_HOME environment variable)

Building

Python can be built for Android on any POSIX platform supported by the Android development tools, which currently means Linux or macOS.

First we'll make a "build" Python (for your development machine), then use it to help produce a "host" Python for Android. So make sure you have all the usual tools and libraries needed to build Python for your development machine.

The easiest way to do a build is to use the android.py script. You can either have it perform the entire build process from start to finish in one step, or you can do it in discrete steps that mirror running configure and make for each of the two builds of Python you end up producing.

The discrete steps for building via android.py are:

./android.py configure-build
./android.py make-build
./android.py configure-host HOST
./android.py make-host HOST

HOST identifies which architecture to build. To see the possible values, run ./android.py configure-host --help.

To do all steps in a single command, run:

./android.py build HOST

In the end you should have a build Python in cross-build/build, and a host Python in cross-build/HOST.

You can use -- as a separator for any of the configure-related commands – including build itself – to pass arguments to the underlying configure call. For example, if you want a pydebug build that also caches the results from configure, you can do:

./android.py build HOST -- -C --with-pydebug

Packaging

After building an architecture as described in the section above, you can package it for release with this command:

./android.py package HOST

HOST is defined in the section above.

This will generate a tarball in cross-build/HOST/dist, whose structure is similar to the Android directory of the CPython source tree.

Testing

The Python test suite can be run on Linux, macOS, or Windows.

On Linux, the emulator needs access to the KVM virtualization interface. This may require adding your user to a group, or changing your udev rules. On GitHub Actions, the test script will do this automatically using the commands shown here.

The test suite can usually be run on a device with 2 GB of RAM, but this is borderline, so you may need to increase it to 4 GB. As of Android Studio Koala, 2 GB is the default for all emulators, although the user interface may indicate otherwise. Locate the emulator's directory under ~/.android/avd, and find hw.ramSize in both config.ini and hardware-qemu.ini. Either set these manually to the same value, or use the Android Studio Device Manager, which will update both files.

You can run the test suite either:

  • Within the CPython repository, after doing a build as described above. On Windows, you won't be able to do the build on the same machine, so you'll have to copy the cross-build/HOST/prefix directory from somewhere else.

  • Or by taking a release package built using the package command, extracting it wherever you want, and using its own copy of android.py.

The test script supports the following modes:

  • In --connected mode, it runs on a device or emulator you have already connected to the build machine. List the available devices with $ANDROID_HOME/platform-tools/adb devices -l, then pass a device ID to the script like this:

    ./android.py test --connected emulator-5554
    
  • In --managed mode, it uses a temporary headless emulator defined in the managedDevices section of testbed/app/build.gradle.kts. This mode is slower, but more reproducible.

    We currently define two devices: minVersion and maxVersion, corresponding to our minimum and maximum supported Android versions. For example:

    ./android.py test --managed maxVersion
    

By default, the only messages the script will show are Python's own stdout and stderr. Add the -v option to also show Gradle output, and non-Python logcat messages.

Any other arguments on the android.py test command line will be passed through to python -m test – use -- to separate them from android.py's own options. See the Python Developer's Guide for common options – most of them will work on Android, except for those that involve subprocesses, such as -j.

Every time you run android.py test, changes in pure-Python files in the repository's Lib directory will be picked up immediately. Changes in C files, and architecture-specific files such as sysconfigdata, will not take effect until you re-run android.py make-host or build.

The testbed app can also be used to test third-party packages. For more details, run android.py test --help, paying attention to the options --site-packages, --cwd, -c and -m.

Using in your own app

See https://docs.python.org/3/using/android.html.

Metadata

Release files for goygram 0.8.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for goygram 0.8.25
File Size Uploaded
goygram-0.8.25.tar.gz 278.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for goygram 0.8.25
File
goygram-0.8.25-cp38-abi3-win_arm64.whl CPython 3.8 abi3 Windows ARM64 Details
goygram-0.8.25-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
goygram-0.8.25-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details
goygram-0.8.25-cp38-abi3-musllinux_1_2_aarch64.whl CPython 3.8 abi3 Linux musl 1.2+ ARM64 Details
goygram-0.8.25-cp38-abi3-manylinux_2_34_x86_64.whl CPython 3.8 abi3 Linux glibc 2.34+ x86-64 Details
goygram-0.8.25-cp38-abi3-manylinux_2_28_aarch64.whl CPython 3.8 abi3 Linux glibc 2.28+ ARM64 Details
goygram-0.8.25-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
goygram-0.8.25-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 Details
goygram-0.8.25-cp38-abi3-android_24_x86_64.whl CPython 3.8 abi3 Android API level 24+ x86-64 Details
goygram-0.8.25-cp38-abi3-android_24_arm64_v8a.whl CPython 3.8 abi3 Android API level 24+ ARM64 v8a Details

Total release size: 6.5 MB

Release files / goygram-0.8.25.tar.gz

Download URL goygram-0.8.25.tar.gz
Size 278.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c66d6c38b06b3f62f9749fd67c9283e7d83d382f2ca2cd1fa583dcbebd1a755b
BLAKE2b-256 checksum
How to use checksums
eb86cea0cde6ec05026249cd2f036ad06ed1b9d7330c2e41a26e435b49a67248
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-win_arm64.whl

Download URL goygram-0.8.25-cp38-abi3-win_arm64.whl
Size 485.0 kB
Tags CPython 3.8 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
49c7733adb39536e1247046d23d7334798d7fa18ead6f41d42ce9077ba683e2c
BLAKE2b-256 checksum
How to use checksums
c9c24280f97f8c0c28a87af15dcf77af7510d8705612d63f2a4304526e34f790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-win_amd64.whl

Download URL goygram-0.8.25-cp38-abi3-win_amd64.whl
Size 497.6 kB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
7db17a9de43f0007879c806c8f175e2d8a60ecca070f86e001a032294b91ff3c
BLAKE2b-256 checksum
How to use checksums
b759fe06cd5d672d586a2db86030d6e02d9bb03c98a3b104a28ff20a3f2fdc30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL goygram-0.8.25-cp38-abi3-musllinux_1_2_x86_64.whl
Size 792.7 kB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
90e0dd5adc589c776f790db95acbde411c7c49f71e91d4c9b4070b52b35cca81
BLAKE2b-256 checksum
How to use checksums
2951d2cb5a0c384c96fb96650bc1a2c8409a9d98666880f4cc5da16f3dafd12f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-musllinux_1_2_aarch64.whl

Download URL goygram-0.8.25-cp38-abi3-musllinux_1_2_aarch64.whl
Size 744.8 kB
Tags CPython 3.8 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
c4f47911ef2651a54ca3ebb65692d45085023fdf74c1653a9a5cb8837a72a878
BLAKE2b-256 checksum
How to use checksums
cdac953ec509d8fbc641f6a61834045dc427bb40ca0b39aeffe628199e863ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-manylinux_2_34_x86_64.whl

Download URL goygram-0.8.25-cp38-abi3-manylinux_2_34_x86_64.whl
Size 580.7 kB
Tags CPython 3.8 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
4840ad1d4bca3a984f0f84d099e4e9a294e722c9a892dc521dad1f8b99a1cc08
BLAKE2b-256 checksum
How to use checksums
1eda1478044369da9de7cfcd326febfec00b48beaa9665ff496da844e9e76ecf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-manylinux_2_28_aarch64.whl

Download URL goygram-0.8.25-cp38-abi3-manylinux_2_28_aarch64.whl
Size 566.0 kB
Tags CPython 3.8 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
7a21bd2662ace8e2b86e52d1133ca089c2e66ad7e227bc5a162fe8e4c2e52f13
BLAKE2b-256 checksum
How to use checksums
e4b1b5d917dd6b0f3a57ed6b0c3627a092e74c3cfd6905f57e68d78783e77342
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-macosx_11_0_arm64.whl

Download URL goygram-0.8.25-cp38-abi3-macosx_11_0_arm64.whl
Size 552.9 kB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
dd56b99e1b4c20366399b998f8ff989189aee3cdf953ef62d280c497ff774603
BLAKE2b-256 checksum
How to use checksums
837f375b318b81ee03f9d59d6796a5785e31d83c2fcdf757cbbeda39b2386c91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL goygram-0.8.25-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 836.1 kB
Tags CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aa6478ebf14ec7de9c14347e8e684456400efb3cecbdfd6b4e3ee7e8570aec6f
BLAKE2b-256 checksum
How to use checksums
7c00ab284f34e210e0f9664765cbffe11e0ce81564a670be790522da16255a3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-android_24_x86_64.whl

Download URL goygram-0.8.25-cp38-abi3-android_24_x86_64.whl
Size 591.8 kB
Tags Android API level 24+ x86-64 CPython 3.8 abi3
SHA-256 checksum
How to use checksums
61fd06437f30956f0b6b1bbb6629fbddb6baa62f041f548aa9d72cf6bf3d7e93
BLAKE2b-256 checksum
How to use checksums
4d30d85361ac3b0bc38d9bd1f0a57192ee4c85ecf5dbf7858a843347547fad8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / goygram-0.8.25-cp38-abi3-android_24_arm64_v8a.whl

Download URL goygram-0.8.25-cp38-abi3-android_24_arm64_v8a.whl
Size 575.6 kB
Tags Android API level 24+ ARM64 v8a CPython 3.8 abi3
SHA-256 checksum
How to use checksums
854ce877b6957cf5415f98c93b149eacd2cb2b8fbcc91feef1dd46d807d2b28f
BLAKE2b-256 checksum
How to use checksums
c8ce674d68ee2056edad1a097c5e05363f592462209955403e6f74ab357907b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release history Release notifications | RSS feed

This release

0.8.25 This release

11 release files

0.8.14

4 release files

0.8.13

4 release files

0.8.12

4 release files

0.8.11

4 release files

0.8.10

4 release files

0.8.9

4 release files

0.8.8

4 release files

0.8.7

4 release files

0.8.6

4 release files

0.8.5

4 release files

0.8.4

4 release files

0.8.3

4 release files

0.8.2

4 release files

0.8.1

4 release files

0.8.0

4 release files

0.7.99

4 release files

0.7.98

4 release files

0.7.97

4 release files

0.7.96

4 release files

0.7.95

4 release files

0.7.94

4 release files

0.7.93

4 release files

0.7.92

4 release files

0.7.91

4 release files

0.7.90

4 release files

0.7.89

4 release files

0.7.88

4 release files

0.7.87

4 release files

0.7.86

4 release files

0.7.85

4 release files

0.7.84

4 release files

0.7.82

4 release files

0.7.81

4 release files

0.7.80

4 release files

0.7.79

4 release files

0.7.78

4 release files

0.7.77

4 release files

0.7.76

4 release files

0.7.75

4 release files

0.7.63

4 release files

0.7.62

4 release files

0.7.61

4 release files

0.7.60

4 release files

0.7.59

4 release files

0.7.58

4 release files

0.7.57

4 release files

0.7.56

4 release files

0.7.55

4 release files

0.7.54

4 release files

0.7.53

4 release files

0.7.52

4 release files

0.7.51

4 release files

0.7.50

4 release files

0.7.49

4 release files

0.7.48

4 release files

0.7.47

4 release files

0.7.46

4 release files

0.7.45

4 release files

0.7.35

4 release files

0.7.34

4 release files

0.7.33

4 release files

0.7.32

4 release files

0.7.31

4 release files

0.7.30

4 release files

0.7.29

4 release files

0.7.28

4 release files

0.7.27

4 release files

0.7.26

4 release files

0.7.25

4 release files

0.7.24

4 release files

0.7.23

4 release files

0.7.22

4 release files

0.7.21

4 release files

0.7.20

4 release files

0.7.19

4 release files

0.7.18

4 release files

0.7.17

4 release files

0.7.16

4 release files

0.7.15

4 release files

0.7.14

4 release files

0.7.13

4 release files

0.7.9

4 release files

0.7.8

4 release files

0.7.7

4 release files

0.7.6

4 release files

0.7.5

4 release files

0.7.4

4 release files

0.7.3

4 release files

0.7.2

4 release files

0.7.1

4 release files

0.7.0

4 release files

0.6.9

4 release files

0.6.8

4 release files

0.6.7

4 release files

0.6.6

4 release files

0.6.5

4 release files

0.6.4

4 release files

0.6.3

4 release files

0.6.2

4 release files

0.6.1

4 release files

0.6.0

4 release files

0.5.7

4 release files

0.5.6

4 release files

0.5.5

4 release files

0.5.3

4 release files

0.5.1

4 release files

0.5.0

4 release files

0.4.9

4 release files

0.4.8

4 release files

0.4.7

4 release files

0.4.2

4 release files

0.4.1

4 release files

0.4.0

4 release files

0.3.9

4 release files

0.3.8

4 release files

0.3.7

4 release files

0.3.6

4 release files

0.3.5

4 release files

0.3.4

4 release files

0.3.2

4 release files

0.3.0

4 release files

0.1.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page