How to package Python apps with BeeWare Briefcase

Python falls brief in a number of regions. For instance, Python is not the speediest language all over, but 3rd-social gathering libraries like NumPy enable you perform all over that. In which Python is most deficient, even though, is packaging. That is, Python lacks a regular interior mechanism for making a standalone binary from an application. Go and Rust do this. Why cannot Python?

It generally comes down to Python not having a tradition of such use situations right up until fairly recently in its heritage. And so, only fairly recently did 3rd-social gathering modules commence displaying up that let Python apps to be packaged as standalone binaries. PyInstaller — which I covered formerly — is one particular such application. In this report we’ll seem at an even far more sophisticated and powerful utility for Python application packaging, BeeWare’s Briefcase.

[ Also on InfoWorld: Python virtualenv and venv do’s and don’ts ]

Nevertheless, there are two caveats really worth pointing out about Briefcase. First, Briefcase doesn’t do cross-system packaging you require to construct on the system you are deploying for. 2nd, Briefcase functions ideal with apps that make use of a GUI toolkit of some kind. We’ll go into depth about these concerns under.

What is BeeWare Briefcase?

Briefcase is part of a general suite of tools by BeeWare for creating apps, with the diverse pieces complementing every other. For instance, BeeWare’s Kivy lets you build cross-system GUI apps in Python that run not only on all the important OS platforms but also on the net. But in this article we’ll concentration on Briefcase, which can be utilised with or without the need of the other tools.

Briefcase offers apps for all the OSes it supports by way of a widespread structure for apps on that system:

  • Microsoft Home windows (MSI installer)
  • macOS (.application format file)
  • Linux (AppImage)
  • iOS (Xcode job)
  • Android (Gradle job)

To deploy on iOS or Android, you’ll require the enhancement kits for those platforms.

A single thing Briefcase does not support is cross-system deployment. For instance, if you are a Home windows consumer, you cannot construct a macOS application you’ll require macOS to do that. Other application bundlers for Python are likewise minimal, so this restriction is by no signifies unique to Briefcase.

Briefcase is also not a “compiler” — it doesn’t remodel Python courses into their native machine-code equivalents. Your apps won’t run any a lot quicker when deployed as Briefcase apps than they do typically.

Copyright © 2020 IDG Communications, Inc.