Skip to content

Environment variables

kivyforge reads the environment variables on this page. Use them for session defaults, for secrets that must stay out of pyproject.toml, and to point kivyforge at tools installed in non-default locations.

Target selection

Variable Effect
KIVYFORGE_PLATFORM Default target when you don't pass -p, for example android or its alias win for windows. -p overrides it. See Choose a target platform.

Version

Variable Effect
KIVYFORGE_APP_VERSION The version build, package and run write into the app, instead of [project].version or the build backend's. --app-version overrides it. Ignored by run --no-build and run --list-devices, which build nothing. See Set the app version.

Output

Variable Effect
NO_COLOR Disables coloured output. Any value counts, including 0.
FORCE_COLOR Forces coloured output, even when the output is not a terminal. --no-color and NO_COLOR both take precedence over it.
KIVYFORGE_VERBOSE 1 or 2, the same as passing -v or -vv to every verb. A -v on the command line replaces it. Higher numbers count as 2 and an empty value means 0; anything else, such as abc or -1, is a usage error. Only Android's Gradle acts on it for now. See Verbose output.

Signing

Keep signing passwords and identities out of pyproject.toml.

Variable Platform Effect
KIVYFORGE_KEYSTORE_PASSWORD Android Password of the release keystore. package fails if it is unset.
KIVYFORGE_KEY_PASSWORD Android Password of the release key. If unset, the keystore password is used.
KIVYFORGE_TEAM_ID iOS Apple Developer Team ID. --team-id overrides it; it overrides [tool.kivy.ios.signing].team_id.
KIVYFORGE_SIGNING_IDENTITY iOS Signing identity. --signing-identity overrides it; it overrides [tool.kivy.ios.signing].identity.

The two Android names are defaults. To read the passwords from different variables, set store_password_env and key_password_env in [tool.kivy.android.signing]. See the Android overlay reference.

Toolchain locations

Variable Platform Effect
ANDROID_HOME Android Root of the Android SDK. Checked first.
ANDROID_SDK_ROOT Android Root of the Android SDK, used when ANDROID_HOME is unset or not a directory. If neither is set, kivyforge looks in %LOCALAPPDATA%\Android\Sdk on Windows, ~/Library/Android/sdk on macOS, and ~/Android/Sdk and ~/android-sdk on macOS and Linux.
JAVA_HOME Android JDK location that doctor checks when java is not on PATH.

Network

Variable Effect
GH_TOKEN Token for the GitHub API, which lock queries to resolve the desktop Python runtime and the host CPython that byte-compiles. Takes precedence over GITHUB_TOKEN.
GITHUB_TOKEN Same, used when GH_TOKEN is unset. On GitHub Actions, set it from secrets.GITHUB_TOKEN.

Unauthenticated, the GitHub API allows 60 requests per hour per IP address. A token raises the limit to 5,000 per hour. An empty or whitespace-only value is ignored, so an unset CI secret falls back to an anonymous request.

Host CPython for byte-compiling

iOS and Android releases, and Linux aarch64 ones, are byte-compiled by a CPython the lock pins for each build host, which the first release build downloads and caches. These two variables affect only that download: runtimes, wheels and other pinned artifacts download as before.

Variable Effect
KIVYFORGE_HOST_PYTHON_DOWNLOADS automatic (the default) or never. With never, a build compiles only with a host CPython already in the cache (installed, or as the archive kivyforge upgrade fetched), and otherwise ships source or fails, as byte_compile decides. --no-cache with never is an error, and so is any other value.
KIVYFORGE_HOST_PYTHON_MIRROR A base URL that replaces https://github.com/astral-sh/python-build-standalone/releases/download when downloading the pinned build, for networks that block GitHub or that serve reviewed copies. The lock's SHA-256 still checks what the mirror serves. It applies to builds only: kivyforge lock still needs GitHub to pin the build.

To prepare a machine that builds without network access, run kivyforge upgrade -p PLATFORM (or a full kivyforge package, which also fills the wheel cache) while it has access, then set KIVYFORGE_HOST_PYTHON_DOWNLOADS=never.

Artifact cache location

kivyforge caches downloaded artifacts per user. On Linux, it honours the XDG base directory convention.

Host Cache directory
Linux $XDG_CACHE_HOME/kivyforge/artifacts, or ~/.cache/kivyforge/artifacts if XDG_CACHE_HOME is unset
macOS ~/Library/Caches/kivyforge/artifacts
Windows %LOCALAPPDATA%\kivyforge\Cache\artifacts

What's next