RANDOM USER PROJECTS
An advanced rendering pipeline for Panda3D
Angels Fall First: the Second Antarean War
Disney's Pirates of the Caribbean Online

Panda3D Manual: Setuptools Examples

Simple Console Application

The most basic and simplest application to package is a simple console app with no dependencies:

print("Hello world")

Assuming this is saved as main.py, we can use the following requirements.txt file:

panda3d

and setup.py file:

import setuptools
 
setup(
name="Hello World",
options = {
'build_apps': {
'console_apps': {'hello_world': 'main.py'},
}
}
)

to build binaries using python setup.py build_apps.

A build directory will be created and contain a directory for each platform that binaries were built for. Since no platforms were specified, the defaults were used (manylinux1_x86_64, macosx_10_6_x86_64, win_amd64).

Note, win32 is missing from the defaults. If a win32 build is desired, then platforms must be defined in setup.py and win_amd64 added to the list:

import setuptools
 
setup(
name="Hello World",
options = {
'build_apps': {
'console_apps': {'hello_world': 'main.py'},
'platforms': [
'manylinux1_x86_64',
'macosx_10_6_x86_64',
'win_amd64',
'win32',
],
}
}
)

Asteroids Sample

Below is an example of a setup.py that can be used to build the asteroids sample.

from setuptools import setup
 
setup(
name="asteroids",
options = {
'build_apps': {
'include_patterns': [
'**/*.png',
'**/*.jpg',
'**/*.egg',
],
'gui_apps': {
'asteroids': 'main.py',
},
'plugins': [
'pandagl',
'p3openal_audio',
],
}
}
)

With the setup.py in place, it can be run with: python setup.py bdist_apps

The name field and options dictionary in the above setup.py can also be replaced by the following setup.cfg file:

[metadata]
name = asteroids
 
[build_apps]
include_patterns =
**/*.png
**/*.jpg
**/*.egg
gui_apps =
asteroids = main.py
plugins =
pandagl
p3openal_audio