Enaml-native

Build Android apps with Python

DocsCodeChat

Mobile + Python

enaml-native is a project designed to let you build Android and iOS apps using python.

Note: Currently only Android is fully supported

It targets apps that need to have a "native" look and feel and achieves this by reusing existing native Android and iOS widgets over a "native bridge". Conceptually, it inherits from react-native (hence the name).

enaml-native app

Package system

enaml-native's package system lets you download and install pre-compiled packages which work on android devices. It is open source and you can create you're own packages and repositories.

Originally it was based on python-for-android but for several reasons, switched to it's own package system based on miniconda, called conda-mobile.

Each app has a virtual environment where you specify which packages your app uses. These can be either pure-python libraries or ones that use compiled extensions (such as numpy).

Dependencies are entered into

Anbex

# Name
name: console
bundle_id: com.codelv.console

# Channels to look for any specific libraries
channels:
  - local
  - codelv

# App dependencies to be installed
dependencies:
  - python=3.10
  - pip
  - pip-tornado
  - android-python * py310*
  - enaml-native
  - pip:
    - enaml-native-cli

The user interface is defined declaratively using enaml.

enamldef SignInScreen(PagerFragment): view:
    attr app: App
    attr pager << view.parent
    attr error = ""
    Flexbox:
        flex_direction = "column"
        background_color = "#eee"
        justify_content = "center"
        padding = (30, 30, 30, 30)
        Flexbox:
            justify_content = "center"
            Flexbox:
                height = "wrap_content"
                width = "wrap_content"
                flex_direction = "column"
                justify_content = "center"
                Icon:
                    text = "{fa-rocket}"
                    text_size = 128
                    text_color << view.app.theme_color
                TextView:
                    text = "Your company"