Skip to main content

🐍 Anpyra · Python to Native Android

Write small Android apps in a typed Python subset, compile them directly to DEX, and build signed APKs. Anpyra is a Python-written compiler and build framework based on the PyAndroid experiments 001–008.

Status: v0.1.2 alpha. Android is the only implemented target. This release includes native Screen styling and expanded TextView typography with system/local fonts, size, alignment, padding, spacing, overflow, decorations, shadows and selection. Screen rendering passed 25 pixel checks and typography passed 30 recorded cases on Android API 33. Other Android versions, broader lifecycle behavior and independent binary verification still need recorded coverage.

🐍 Python-based builds

Build with Python 3.11+ and Python dependencies. No Java/JDK, Kotlin, Android SDK build kit, Android NDK, Android Studio, Gradle, D8, R8, AAPT2 or apksigner is required. cryptography and Pillow are installed automatically for signing and Screen image/color handling. Optional adb provides device installation.

⚡ Install the published package

Install from PyPI using uv (recommended):

uv venv --python 3.12
uv pip install "anpyra==0.1.2"

Or use pip inside a virtual environment:

python -m pip install "anpyra==0.1.2"

Activate your environment, then:

anpyra doctor
anpyra init myapp --package dev.example.myapp --label "My App"
anpyra check myapp
anpyra build myapp
anpyra verify myapp/build/dev.example.myapp.apk

For checkout installation and host-specific commands, see the installation guide.

🔄 Upgrade from 0.1.0 or 0.1.1

Use the same environment where you installed Anpyra. With that environment activated, choose uv (recommended) or pip:

uv pip install --upgrade "anpyra==0.1.2"
# Or:
python -m pip install --upgrade "anpyra==0.1.2"
python -m anpyra --version

The version should print Anpyra 0.1.2. To upgrade to the latest compatible release, use --upgrade anpyra without the version pin. Keep your app's .anpyra/ signing identity and rebuild its APK after upgrading. See the upgrade guide for explicit environment paths.

🧩 Application example

from anpyra import Activity
from anpyra.components import Font, TextView


class MainActivity(Activity):
    def on_create(self, state):
        title = TextView(self, text="Hello from Anpyra!")
        title.style.color = "#663399"
        title.style.size = 28
        title.style.font = Font(family="sans-serif", bold=True)
        title.style.padding = (16, 24)
        title.style.width = "match_parent"
        title.style.alignment = "center"
        self.set_content_view(title)

Anpyra parses application source on the host. Android runs the generated bytecode. The authoring classes provide editor support; they do not preview a UI on the host.

📦 Supported features and limits

  • One Activity and TextView with Font/Shadow/TextStyle declarations, constructor text, typography, dp dimensions/padding, sp size and native selection.
  • Validated standalone local TTF/OTF fonts preserved in signed digest-named APK assets.
  • Screen colors, local raster images with seven fit modes, linear/radial/sweep gradients and transparency.
  • Initialized str, int and bool locals, simple integer arithmetic and comparisons.
  • Nested conditions and typed integer helper functions.
  • DEX, binary manifest, signed APK and JSON report generation.
  • Retained project debug identity and local APK/DEX integrity checks.

This is a restricted compiler, not general Python on Android. A Screen supports one TextView content child and static styling. General layouts/multiple children, callbacks, arbitrary imports, collections, reassignment, multi-module apps and release/store signing are not implemented. Source locals/temporaries have a 14-symbol budget; rendering uses separate scratch registers. See the Screen guide, TextView guide and language guide.

📚 Documentation and contribution

User guide · Developer guide · Roadmap · Issues · Contributing

Anpyra is licensed under Apache-2.0.

Metadata

Release files for anpyra 0.1.2

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

Source distribution (sdist)

Source distribution for anpyra 0.1.2
File Size Uploaded
anpyra-0.1.2.tar.gz 176.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anpyra 0.1.2
File Interpreter ABI Platform
anpyra-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 240.9 kB

Release files / anpyra-0.1.2.tar.gz

Download URL anpyra-0.1.2.tar.gz
Size 176.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b324a27c5d9b4064c1e0f7a5175c0c3aa6d9f129f5a40d405493e364d1745de9
BLAKE2b-256 checksum
How to use checksums
a42d65554afb944220e937eebe013296c26e17be70e87c853daa66ef019c6965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / anpyra-0.1.2-py3-none-any.whl

Download URL anpyra-0.1.2-py3-none-any.whl
Size 64.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b4c0d00f53210835b83dea3841c00eaa8c745b980eb429f07655e49922538a9
BLAKE2b-256 checksum
How to use checksums
abee0227b9b3144599d688e1d2e1380c6c8ae6f97015ab0702cb1c9497707dc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 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