How to package Python apps with BeeWare Briefcase

Python falls short in a couple of areas. For instance, Python isn’t the quickest language all around, but 3rd-social gathering libraries like NumPy let you operate all around that. Exactly where Python is most deficient, nevertheless, is packaging. That is, Python lacks a regular inner mechanism for creating a standalone binary from an software. Go and Rust do this. Why just cannot Python?

It largely arrives down to Python not having a lifestyle of these use situations until finally reasonably not too long ago in its history. And so, only reasonably not too long ago did 3rd-social gathering modules start off showing up that enable Python applications to be packaged as standalone binaries. PyInstaller — which I covered beforehand — is one these app. In this short article we’ll seem at an even a lot more exquisite and strong utility for Python app packaging, BeeWare’s Briefcase.

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

However, there are two caveats truly worth pointing out about Briefcase. Very first, Briefcase doesn’t do cross-platform packaging you will need to construct on the platform you’re deploying for. Next, Briefcase performs greatest with applications that make use of a GUI toolkit of some sort. We’ll go into detail about these concerns underneath.

What is BeeWare Briefcase?

Briefcase is component of a standard suite of instruments by BeeWare for making applications, with the distinct parts complementing each individual other. For instance, BeeWare’s Kivy lets you build cross-platform GUI applications in Python that operate not only on all the main OS platforms but also on the world wide web. But here we’ll target on Briefcase, which can be employed with or with out the other instruments.

Briefcase deals applications for all the OSes it supports by way of a popular structure for applications on that platform:

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

To deploy on iOS or Android, you are going to will need the enhancement kits for individuals platforms.

One particular thing Briefcase does not support is cross-platform deployment. For instance, if you’re a Windows person, you just cannot construct a macOS app you are going to will need macOS to do that. Other app bundlers for Python are likewise constrained, so this restriction is by no means exclusive to Briefcase.

Briefcase is also not a “compiler” — it doesn’t remodel Python programs into their native machine-code equivalents. Your applications will not operate any more rapidly when deployed as Briefcase applications than they do typically.

Copyright © 2020 IDG Communications, Inc.