April 17, 2024


The Internet Generation

How to package Python apps with BeeWare Briefcase

Python falls quick in a number of spots. For occasion, Python isn’t the fastest language around, but third-party libraries like NumPy permit you function around that. Wherever Python is most deficient, while, is packaging. That is, Python lacks a steady inside system for making a standalone binary from an software. Go and Rust do this. Why can not Python?

It mainly comes down to Python not owning a tradition of these types of use scenarios till comparatively lately in its heritage. And so, only comparatively lately did third-party modules start out demonstrating up that allow for Python applications to be packaged as standalone binaries. PyInstaller — which I included earlier — is 1 these types of application. In this posting we’ll search at an even a lot more elegant and effective utility for Python application packaging, BeeWare’s Briefcase.

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

Having said that, there are two caveats well worth pointing out about Briefcase. First, Briefcase doesn’t do cross-system packaging you need to build on the system you are deploying for. Second, Briefcase performs most effective with applications that make use of a GUI toolkit of some form. We’ll go into depth about these issues below.

What is BeeWare Briefcase?

Briefcase is part of a general suite of equipment by BeeWare for creating applications, with the distinctive parts complementing every single other. For occasion, BeeWare’s Kivy allows you create cross-system GUI applications in Python that operate not only on all the important OS platforms but also on the web. But in this article we’ll focus on Briefcase, which can be utilized with or without the other equipment.

Briefcase packages applications for all the OSes it supports by way of a frequent format for applications on that system:

  • Microsoft Windows (MSI installer)
  • macOS (.application format file)
  • Linux (AppImage)
  • iOS (Xcode undertaking)
  • Android (Gradle undertaking)

To deploy on iOS or Android, you’ll need the advancement kits for people platforms.

A person issue Briefcase does not support is cross-system deployment. For occasion, if you are a Windows person, you can not build a macOS application you’ll need macOS to do that. Other application bundlers for Python are in the same way constrained, so this restriction is by no usually means exceptional to Briefcase.

Briefcase is also not a “compiler” — it doesn’t remodel Python plans into their indigenous device-code equivalents. Your applications won’t operate any faster when deployed as Briefcase applications than they do typically.

Copyright © 2020 IDG Communications, Inc.