Skip to content

Android apps. Pure Python.

ApkPy turns a Python interface and CSS-inspired styles into native Android Java and XML. Preview quickly on your computer, then generate an Android Studio project or an installable APK.

:material-rocket-launch: Get started :material-book-open-variant: Browse the API

Why ApkPy?

Native outputReal Android Activities, views, resources and services — not a WebView.
Fast feedbackRun the same app in the desktop Hot Previewer before compiling Android.
One languageBuild layouts, app logic, storage, networking and media flows in Python.
Consistent designTheme tokens and CSS-inspired rules are shared by Previewer and Android output.

A complete app starts small

from apkpy_lib import Screen, Theme, button, label, run, toast

home = Screen(id="home")
label("Hello from ApkPy", id="title", screen=home)
button(
    "Build something native",
    variant="filled",
    icon="arrow_forward",
    command=lambda: toast("Ready!"),
    screen=home,
)

theme = Theme(
    mode="dark",
    primary="#8B5CF6",
    secondary="#22D3EE",
    background="#09090B",
    surface="#18181B",
    text="#FAFAFA",
)

if __name__ == "__main__":
    run(start_screen=home, theme=theme)

Preview it:

python writehere.py

Build it:

apkpy run

What is included in 1.0.0?

Version 1.0.0 brings together the full native app workflow:

  • responsive rows, columns, flex, grid, cards and layered layouts;
  • Material-style buttons, app bars, bottom navigation, overlays and content states;
  • rich lists, carousels and grids;
  • background audio, queues, player controls, favourites and editable playlists;
  • offline file downloads and OAuth login for Google, Spotify and GitHub;
  • encrypted storage, PBKDF2 password hashing, AES-256-GCM on Android and parameterized SQLite;
  • direct APK builds, QR/USB installation and signed releases.

See Version 1.0.0 for the release overview.

Closed source and documentation

The ApkPy implementation can remain in a private repository. A documentation build publishes only the generated site/ directory. See Cloudflare Pages for the safe deployment configuration.