Skip to content

CLI Reference

aaalllexxx edited this page Jun 30, 2026 · 3 revisions

CLI Reference

The framework installs a single command: paf.

paf <command> [options]
Command Purpose
paf create Scaffold a new project
paf run Start the dev server (browser preview + live reload)
paf serve Serve a built APK over Wi-Fi for the Companion app
paf build Build an Android APK/AAB
paf doctor Check the build environment
paf info Print the current project's config
paf update Update PAF to the latest version

Run paf with no command to see a summary and quick-start hints.


paf create

Create a new ENPAF project from the template.

paf create <name> [--package PKG] [--template NAME]
Option Default Description
name (positional) Project name. Must match ^[A-Za-z][A-Za-z0-9_-]*$.
--package, -p com.enpaf.<name> Android application id (e.g. com.acme.app).
--template, -t default Project template.

Creates a <name>/ directory with enpaf.json, main.py, and app/. Fails if the directory already exists or the name is invalid.


paf run

Start the development server and (optionally) open the browser. Runs the same app you'll ship, with the bridge backed by Socket.IO instead of the Android WebView.

paf run [--host HOST] [--port PORT] [--no-browser] [--debug]
Option Default Description
--host 127.0.0.1 Bind address.
--port 8080 Port.
--no-browser off Don't auto-open the browser.
--debug off Enable debug mode (more logging).

Endpoints while running:

  • http://<host>:<port>/ — your app.
  • http://<host>:<port>/enpaf-settings — a built-in settings/inspector panel.
  • POST /enpaf-api/bridge-call — HTTP fallback used by the JS bridge when Socket.IO isn't available.

paf serve

Serve a previously built APK over the local network so the Companion app can download and install it — no USB cable.

paf serve [--port PORT]
Option Default Description
--port 8000 Port to serve on.

It prints an enpaf://debug?... link and a QR code (with a one-time token and your Wi-Fi SSID). Scan it from the Companion app to fetch and install the APK via the Android PackageInstaller. Requires a build in dist/ first.


paf build

Build the project into an installable artifact with Gradle + Chaquopy.

paf build <target> [--release] [--keystore PATH] [--clean]
Argument / Option Values / Default Description
target (positional) apk · debug-apk · aab What to build.
--release off Build the release variant (optimized + release-signed). aab implies release.
--keystore auto Path to a keystore for signing (see Release & Signing).
--clean off Wipe the previous build directory first.

Output is copied to dist/<name>-<version>.apk. Examples:

paf build apk                 # debug, auto-signed, installable
paf build apk --release       # release, optimized, signed
paf build apk --release --keystore mykeys.jks
paf build apk --clean         # force a clean rebuild

A debug APK is fine for testing. A release APK is what you distribute. Both are signed so they install — see Building APKs.


paf doctor

Diagnose the build environment: detects a compatible JDK 17–21, locates the Android SDK, and reports anything missing with fix-it hints.

paf doctor

Run this first whenever a build fails.


paf info

Print the current project's configuration (name, package, version, SDK levels, orientation, permissions, Python requirements) read from enpaf.json.

paf info

paf update

Update the installed PAF (the enpaf package) to the latest release on PyPI. It shows your installed version and the latest available, skips the upgrade if you're already current, then runs pip install --upgrade enpaf.

paf update            # upgrade to the latest stable release
paf update --pre      # include pre-release versions
Option Description
--pre Include pre-release versions in the upgrade.

Environment variables

Variable Effect
ENPAF_BUILD_DIR Override where the Gradle build is generated (default: .enpaf_build/, or %LOCALAPPDATA%\enpaf\builds under OneDrive).
JAVA_HOME Pin the JDK used for the build (must be 17–21).
ANDROID_HOME / ANDROID_SDK_ROOT Locate the Android SDK.
ENPAF_ANDROID Set to 1 by the on-device runtime to signal Android mode. (Set automatically; don't set by hand.)
ENPAF_DATA_DIR Writable directory for the SQLite DB. Set automatically on-device; defaults to data/ in dev.
ENPAF_SECRET_KEY Flask SECRET_KEY for the dev server (defaults to a static dev value). Set this if you bind the dev server to a non-loopback host.

Clone this wiki locally