![]() ![]() gitignore file that comes pre-customized with common directories to omit from any Git repository created for the project. The top level of the app directory contains the project’s license, pyproject.toml file, a sample README file in ReStructured Text format, and a.Briefcase project structureĪ freshly initiated Briefcase app directory comes with several files pre-installed: But there is as of yet no option to allow Briefcase programs with no UI package installed to run with a console. This is useful if you’re deploying a program that doesn’t require console interaction - for instance, if it runs as a local web server and uses a web browser for interaction. Note that if you install no UI toolkit, the app will have no console interactivity whatsoever - i.e., it won’t open a console window and it won’t print anything to the console. Or you could select “None” and create a “headless” app that runs from the command line, or you could use a third-party UI toolkit or windowing system such as Pyglet or PyQT. If you want to jump into learning Toga while also working with Briefcase, there’s nothing stopping you. One of BeeWare’s other offerings is a UI toolkit called Toga, for creating GUIs in Python programs using platform-native UI components. But one of the questions you’ll be asked - the last one, in fact - matters greatly: the choice of GUI framework to use. You’ll need to answer some questions about the project at first, and for most of them you can just press Enter to accept the default. This creates scaffolding in your project directory for a Briefcase project. To kick off a new Briefcase project, open the CLI in your project directory, activate the virtual environment (assuming you’re not using an IDE’s CLI to do that automatically), and type briefcase new. This is akin to the way tools like Poetry work: Most of your high-level interactions with the project are through the tool, so you don’t have to manually create files or edit configurations. If you’re not familiar with “ venvs” yet, as Python virtual environments are called, it’s worth getting up to speed on them, as state-of-the-art Python development revolves heavily around them.Īfter you set up a venv and pip install briefcase into it, you’ll use Briefcase’s own command-line tooling to set up, manage, and deliver Briefcase-packaged projects. Briefcase project setupīriefcase requires you to set up a dedicated project directory with its own virtual environment. Your apps won’t run any faster when deployed as Briefcase apps than they do normally. Other app bundlers for Python are similarly limited, so this restriction is by no means exclusive to Briefcase.īriefcase is also not a “compiler” - it doesn’t transform Python programs into their native machine-code equivalents. For instance, if you’re a Windows user, you can’t build a macOS app you’ll need macOS to do that. One thing Briefcase does not support is cross-platform deployment. To deploy on iOS or Android, you’ll need the development kits for those platforms. But here we’ll focus on Briefcase, which can be used with or without the other tools.īriefcase packages apps for all the OSes it supports by way of a common format for apps on that platform: ![]() For instance, BeeWare’s Kivy lets you create cross-platform GUI apps in Python that run not only on all the major OS platforms but also on the web. We’ll go into detail about these issues below.īriefcase is part of a general suite of tools by BeeWare for creating apps, with the different pieces complementing each other. Second, Briefcase works best with apps that make use of a GUI toolkit of some kind. ![]() First, Briefcase doesn’t do cross-platform packaging you need to build on the platform you’re deploying for. However, there are two caveats worth pointing out about Briefcase. In this article we’ll look at an even more elegant and powerful utility for Python app packaging, BeeWare’s Briefcase. PyInstaller - which I covered previously - is one such app. And so, only relatively recently did third-party modules start showing up that allow Python apps to be packaged as standalone binaries. It mostly comes down to Python not having a culture of such use cases until relatively recently in its history. That is, Python lacks a consistent internal mechanism for generating a standalone binary from an application. Where Python is most deficient, though, is packaging. For instance, Python isn’t the fastest language around, but third-party libraries like NumPy let you work around that. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |