Distributing Panda3D Applications
Starting with Panda3D 1.10.0, Panda3D provides new tools that make it easy to compile Python applications using Panda3D into a self-contained executable file, which can then be hosted on a website or store front for distribution to end-users.
These tools are unique among packaging tools in that they will automatically produce binaries for Windows, Linux and macOS. You do not need to own those systems in order to compile a binary for them. In the future, we will extend this list as we add support for more platforms.
Furthermore, they are able to automatically pull in a special optimized version of Panda3D that is lighter and faster than the builds on the website, since they are built without debugging aids and error messages enabled. Building Panda3D from source code is therefore not necessary to create an optimized build.
The old system that shipped with Panda3D 1.9 and operated on .p3d files is no longer supported. It was too complex to use and maintain, required special builds of Panda3D, and did not work with Python 3.
These tools are implemented as plug-ins to setuptools, which is the standard
build system for packaging Python applications. You can read more about it in
its documentation, but the basic
idea is that you create a setup.py
or setup.cfg
file describing the
application with a list of files that need to be compiled into the
distribution. Then, setup.py
is run with a command that tells it what
plug-in to invoke to do the appropriate packaging operation.
Panda3D adds two new commands to setuptools:
build_apps: compile the application into one or more stand-alone executable files
bdist_apps: runs build_apps
, then packages
the compiled executables into various archives and installers for
distribution
Thus, the basic steps to deploy a Panda3D application are:
Create a
setup.py
orsetup.cfg
file for your applicationExecute
python setup.py bdist_apps
Upload the resulting files (e.g. zip, tar.gz, exe) to a store front or web site