Upgrading from Briefcase v0.2¶
Briefcase v0.2 was built as a setuptools extension. The configuration for your
project was contained in a
setup.cfg file, and you invoked
python setup.py <platform>.
Briefcase v0.3 represents a significant change in the development of Briefcase.
Briefcase is now a PEP518-compliant build tool. It uses
configuration, and is invoked using a standalone
briefcase command. This
change gives significantly improved flexibility in configuring Briefcase apps,
and much better control over the development process.
However, this change is also backwards incompatible. If you have a project that was using Briefcase v0.2, you’ll need to make some major changes to your configuration and processes as part of upgrading to v0.3.
To port your application’s configuration to Briefcase v0.3, you’ll need to add
pyproject.toml file (in, as the extension suggests, TOML format). This file contains similar content to
The following is a minimal starting point for your
[tool.briefcase] project_name = "My Project" bundle = "com.example" version = "0.1" author = "Jane Developer" author_email = "[email protected]" requires =  [tool.briefcase.app.myapp] formal_name = "My App" description = "My first Briefcase App" requires =  sources = ['src/myapp'] [tool.briefcase.app.myapp.macOS] requires = ['toga-cocoa==0.3.0.dev15'] [tool.briefcase.app.myapp.windows] requires = ['toga-winforms==0.3.0.dev15'] [tool.briefcase.app.myapp.linux] requires = ['toga-gtk==0.3.0.dev15'] [tool.briefcase.app.myapp.iOS] requires = ['toga-iOS==0.3.0.dev15']
The configuration sections are tool specific, and start with the prefix
tool.briefcase. Additional dotted paths define the specificity of the
settings that follow.
Most of the keys in your
setup.py will map directly to
the same key in your
However, the following pointers may help port other values.
Briefcase v0.2 assumed that a
setup.pyfile described a single app. Briefcase v0.3 allows a project to define multiple distributable applications. The
project_nameis the name for the collection of apps described by this
formal_nameis the name for a single app. If your project defines a single app, your formal name and project name will probably be the same.
There is no explicit definition for the app’s
name- the app name is derived from the section header name (i.e.,
[tool.briefcase.app.myapp]defines the existence of an app named
versionmust be defined as a string in your
pyproject.tomlfile. If you need to know the version of your app (or the value of any other app metadata specified in
pyproject.toml) at runtime, you should use importlib.metadata. Briefcase will create
myapp.dist-infofor your application (using your app name instead of
Briefcase v0.3 configuration files are heirarchical.
[tool.briefcase]describes configuration arguments for the entire project;
[tool.briefcase.app.myapp]describes configuration arguments for the application named
[tool.briefcase.app.myapp.macOS]describes configuration arguments for macOS deployments of
[tool.briefcase.app.myapp.macOS.dmg]describes configuration arguments for DMG deployments of
myappon macOS. The example above doesn’t contain a
dmgsection; generally, you won’t need one unless you’re packaging for multiple output formats on a single platform.
For most keys, the “most specific” value wins - so, a value for
descriptiondefined at the platform level will override any value at the app level, and so on. The two exceptions are
sources, which are cumulative - the values defined at the platform level will be appended to the values at the app level and the project level.
setup.pyare replaced by
requirescan be specified at the project level, the app level, the platform level, or the output format level.
packages(and other various source code and data-defining attributes) in
setup.pyhave been replaced with a single
sourceskey. The paths specified in sources will be copied in their entirety into the packaged application.
Once you’ve created and tested your
pyproject.toml, you can delete your
setup.py file. You may also be able to delete your
depending on whether it defines any tool configurations (e.g.,
In Briefcase v0.2, there was only one entry point:
<platform>. This would generate a complete output artefact; and, if you
-s argument, would also start the app.
Briecase v0.3 uses it’s own
briefcase entry point, with subcommands to perform specific functions:
briefcase new- Bootstrap a new project (generating a
pyproject.tomland other stub content).
briefcase dev- Run the app in developer mode, using the current virtual environment.
briefcase create- Use the platform template to generate the files needed to build a distributable artefact for the platform.
briefcase update- Update the source code of the application in the generated project.
briefcase build- Run whatever compilation process is necessary to produce an executable file for the platform.
briefcase run- Run the executable file for the platform.
briefcase package- Perform whatever post-processing is necessary to wrap the executable into a distributable artefact (e.g., an installer).
When using these commands, there is no need to specify the platform (i.e.
macOS when on a Mac). The current platform will be detected and the
appropriate output format will be selected.
If you want to target a different platform, you can specify that platform as an
argument. This will be required when building for mobile platforms (since
you’ll never be running Briefcase where the mobile platform is “native”). For
example, if you’re on a Mac,
briefcase create macOS and
create would perform the same task;
briefcase create iOS would build an
The exceptions to this platform specification are
briefcase new and
briefcase dev. These two commands are platform agnostic.
The Briefcase subcommands will also detect if previous steps haven’t been
executed, and invoke any prior steps that are required. For example, if you
briefcase run on clean project, Briefcase will detect that there
are no platform files, and will automatically run
briefcase create and
briefcase build. This won’t occur on subsequent runs.
Briefcase v0.3 also allows for multiple output formats on a single platform.
The only platform that currently exposes capability is macOS, which supports
dmg output formats (with
dmg being the platform
To use a different output format, add the format as an extra argument to each
command after the platform. For example, to create a
app file for macOS,
you would run:
$ briefcase create macOS app $ briefcase build macOS app $ briefcase run macOS app $ briefcase package macOS app
In the future, we hope to add other output formats for other platforms - Snap and FlatPak on Linux; NSIS installers on Windows, and possibly others. If you’re interested in adding support for one of these platforms, please get in touch (or, submit a pull request!)