GitHub - kivy/buildozer: Generic Python packager for Android and iOS (original) (raw)

Buildozer

Buildozer is a development tool for turning Pythonapplications into binary packages ready for installation on any of a number of platforms, including mobile devices.

The app developer provides a single "buildozer.spec" file, which describes the application's requirements and settings, such as title and icons. Buildozer can then create installable packages for Android, iOS, Windows, macOS and/or Linux.

Buildozer is managed by the Kivy Team. It relies on its sibling projects:python-for-android andKivy for iOS. It has features to make building apps using the Kivy framework easier, but it can be used independently - even with other GUI frameworks.

For Android, buildozer will automatically download and prepare the build dependencies. For more information, seeAndroid SDK NDK Information.

Note

This tool is unrelated to the online build service,buildozer.io.

Backers on Open Collective Sponsors on Open Collective GitHub contributors Contributor Covenant

PyPI - Version PyPI - Python Version

Tests Android iOS Coverage Status Docker

Installation

Buildozer

Installing Buildozer with target Python 3 (default):

Buildozer incorporates a number of technologies, and has a complicated dependencies, including platform dependencies outside of Python.

This means installation is more than a simple pip install; many of our support requests are related to missing dependencies.

So, it is important to follow the instructions carefully.

Please see theInstallation documentationspecific to this version.

Buildozer Docker image

A Dockerfile is available to use buildozer through a Docker environment.

docker build --tag=kivy/buildozer .

For macOS, build with:

docker buildx build --platform=linux/amd64 --tag=kivy/buildozer .

docker run --volume "$(pwd)":/home/user/hostcwd kivy/buildozer --version

Example Build with Caching

docker run -v HOME/.buildozer:/home/user/.buildozer−vHOME/.buildozer:/home/user/.buildozer -v HOME/.buildozer:/home/user/.buildozerv(pwd):/home/user/hostcwd kivy/buildozer android debug

The image is published to both Docker Hub and GitHub Container Registry and can be pulled from both:

docker pull kivy/buildozer:latest docker pull ghcr.io/kivy/buildozer:latest

Buildozer GitHub action

Use ArtemSBulgakov/buildozer-action@v1to build your packages automatically on push or pull request. See full workflow example.

Usage

Usage: buildozer [--profile ] [--verbose] [target] ... buildozer --version

Available targets: android Android target, based on python-for-android project ios iOS target, based on kivy-ios project

Global commands (without target): distclean Clean the whole Buildozer environment help Show the Buildozer help init Create an initial buildozer.spec in the current directory serve Serve the bin directory via SimpleHTTPServer setdefault Set the default command to run when no arguments are given version Show the Buildozer version

Target commands: clean Clean the target environment update Update the target dependencies debug Build the application in debug mode release Build the application in release mode deploy Deploy the application on the device run Run the application on the device serve Serve the bin directory via SimpleHTTPServer

Target "ios" commands: list_identities List the available identities to use for signing. xcode Open the xcode project.

Target "android" commands: adb Run adb from the Android SDK. Args must come after --, or use --alias to make an alias logcat Show the log from the device p4a Run p4a commands. Args must come after --, or use --alias to make an alias

Examples of Buildozer commands

buildozer target command

buildozer android clean buildozer android update buildozer android deploy buildozer android debug buildozer android release

or all in one (compile in debug, deploy on device)

buildozer android debug deploy

set the default command if nothing set

buildozer setdefault android debug deploy run

buildozer.spec

Run buildozer init to have a new buildozer.spec file copied into the current working directory. Edit it before running your first build.

See buildozer/default.spec for the template.

Default config

You can override the value of any buildozer.spec config token by setting an appropriate environment variable. These are all of the form $SECTION_TOKEN, where SECTION is the config file section and TOKEN is the config token to override. Dots are replaced by underscores.

For example, here are some config tokens from the [app] section of the config, along with the environment variables that would override them.

License

Buildozer is MIT licensed, actively developed by a great community and is supported by many projects managed by theKivy Organization.

Documentation

Documentation for this repository.

Support

Are you having trouble using Buildozer or any of its related projects in the Kivy ecosystem? Is there an error you don’t understand? Are you trying to figure out how to use it? We have volunteers who can help!

The best channels to contact us for support are listed in the latestContact Us document.

Contributing

Buildozer is part of the Kivy ecosystem - a large group of products used by many thousands of developers for free, but it is built entirely by the contributions of volunteers. We welcome (and rely on) users who want to give back to the community by contributing to the project.

Contributions can come in many forms. See the latestContribution Guidelinesfor how you can help us.

Code of Conduct

In the interest of fostering an open and welcoming community, we as contributors and maintainers need to ensure participation in our project and our sister projects is a harassment-free and positive experience for everyone. It is vital that all interaction is conducted in a manner conveying respect, open-mindedness and gratitude.

Please consult the latest Code of Conduct.

Contributors

This project exists thanks toall the people who contribute. [Become a contributor].

Backers

Thank you to all of our backers! 🙏 [Become a backer]

Sponsors

Special thanks toall of our sponsors, past and present. Support this project by [becoming a sponsor].

Here are our top current sponsors. Please click through to see their websites, and support them as they support us.