The desired project name and version are configured with the PYAPP_PROJECT_NAME and PYAPP_PROJECT_VERSION options, respectively. The project name must adhere to PEP 508 and will be normalized during builds according to PEP 503.
You may install your project using a dependency file with the PYAPP_PROJECT_DEPENDENCY_FILE option which should be a local path to the file. In this mode, the project name and version have nothing to do with installation and are just used as metadata.
You may embed the project with the PYAPP_PROJECT_PATH option which should be a path to a wheel ending in .whl or a source distribution ending in .tar.gz.
Note
The project name and version is automatically derived from the metadata files inside.
You may set the PYAPP_PROJECT_FEATURES option to select optional dependency groups that would usually be passed to installers within square brackets after the package name e.g. pkg[foo,bar]. In that example, you would set PYAPP_PROJECT_FEATURES to foo,bar.
If you are packaging a graphical user interface (GUI), you can set PYAPP_IS_GUI to true or 1.
On Windows, this will use pythonw.exe instead of python.exe to execute the application, which avoids a console window from appearing. Running a GUI application with pythonw.exe means that all stdout and stderr output from your GUI will be discarded.
Otherwise, the application will execute as usual. PyApp will run your GUI by spawning a new process, such that the console window that runs the application terminates after successful spawning.
Even when PYAPP_IS_GUI is enabled you can still run the application from the command line. Furthermore, PyApp-specific logic (e.g. installation and setup) will still display a console window with status messages.
Note
On macOS, the console by default does not automatically close when processes have terminated (however it can be closed manually without interferring with the GUI). The default console behavior can be changed in the user settings to close after the last process terminates successfully.
Setting the PYAPP_PYTHON_VERSION option will determine the distribution used at runtime based on the environment at build time. If unset then the default will be the latest stable minor version of CPython.
You may explicitly set the PYAPP_DISTRIBUTION_SOURCE option which overrides the known distribution settings. The source must be a URL that points to an archived version of the desired Python distribution.
Setting this manually may require you to define extra metadata about the distribution that is required for correct runtime behavior.
You may set the relative path to the Python executable after unpacking the archive with the PYAPP_DISTRIBUTION_PYTHON_PATH option. The default is python.exe on Windows and bin/python3 on all other platforms.
You may set the relative path to the site-packages directory after unpacking the archive with the PYAPP_DISTRIBUTION_SITE_PACKAGES_PATH option. The default is Lib\site-packages on Windows and lib/python<ID>/site-packages on all other platforms where <ID> is the distribution ID is defined.
You may indicate whether pip is already installed by setting the PYAPP_DISTRIBUTION_PIP_AVAILABLE option to true or 1. This elides the check for installation when upgraded virtual environments are enabled.
You may set the PYAPP_DISTRIBUTION_EMBED option to true or 1 to embed the distribution in the executable at build time to avoid fetching it at runtime.
You can set the PYAPP_DISTRIBUTION_PATH option to use a local path rather than fetching the source, which implicitly enables embedding. The local archive should be similar to the default distributions in that there should be a Python interpreter ready for use.
You may set the PYAPP_PIP_EXTRA_ARGS option to provide extra arguments to the pip install command at runtime when installing or updating the project e.g. --only-binary :all: --index-url URL.
You may set the PYAPP_FULL_ISOLATION option to true or 1 to provide each installation with a full copy of the distribution rather than a virtual environment.
When full isolation is not enabled, you may set the PYAPP_UPGRADE_VIRTUALENV option to true or 1 to create virtual environments with virtualenv rather than the standard library's venv module.
You may set the PYAPP_SKIP_INSTALL option to true or 1 to skip installing the project in the distribution. This allows for entirely predefined distributions and thus no network calls at runtime if used in conjunction with distribution embedding.
The environment variable that is used for detection may be set to the path of the executable at runtime if you set the PYAPP_PASS_LOCATION option to true or 1. This is useful if your application wishes to in some way manage itself.
You may set the PYAPP_SELF_COMMAND option to override the default name (self) of the management command group. Setting this to none effectively disables the use of management commands.
When enabled, the value will be available at runtime as the PYAPP_COMMAND_NAME environment variable.
You may set a custom template used to output metadata with the PYAPP_METADATA_TEMPLATE option which supports the following placeholders:
Placeholder
Description
{project}
The normalized project name
{version}
The currently installed version of the project
The default template is {project} v{version} if this option is unset.
This is useful for setting custom commands for the Starship prompt. The following example configuration assumes that the built executable has been renamed to foo:
The desired project name and version are configured with the PYAPP_PROJECT_NAME and PYAPP_PROJECT_VERSION options, respectively. The project name must adhere to PEP 508 and will be normalized during builds according to PEP 503.
You may install your project using a dependency file with the PYAPP_PROJECT_DEPENDENCY_FILE option which should be a local path to the file. In this mode, the project name and version have nothing to do with installation and are just used as metadata.
You may embed the project with the PYAPP_PROJECT_PATH option which should be a path to a wheel ending in .whl or a source distribution ending in .tar.gz.
Note
The project name and version is automatically derived from the metadata files inside.
You may set the PYAPP_PROJECT_FEATURES option to select optional dependency groups that would usually be passed to installers within square brackets after the package name e.g. pkg[foo,bar]. In that example, you would set PYAPP_PROJECT_FEATURES to foo,bar.
If you are packaging a graphical user interface (GUI), you can set PYAPP_IS_GUI to true or 1.
On Windows, this will use pythonw.exe instead of python.exe to execute the application, which avoids a console window from appearing. Running a GUI application with pythonw.exe means that all stdout and stderr output from your GUI will be discarded.
Otherwise, the application will execute as usual. PyApp will run your GUI by spawning a new process, such that the console window that runs the application terminates after successful spawning.
Even when PYAPP_IS_GUI is enabled you can still run the application from the command line. Furthermore, PyApp-specific logic (e.g. installation and setup) will still display a console window with status messages.
Note
On macOS, the console by default does not automatically close when processes have terminated (however it can be closed manually without interferring with the GUI). The default console behavior can be changed in the user settings to close after the last process terminates successfully.
Setting the PYAPP_PYTHON_VERSION option will determine the distribution used at runtime based on the environment at build time. If unset then the default will be the latest stable minor version of CPython.
You may explicitly set the PYAPP_DISTRIBUTION_SOURCE option which overrides the known distribution settings. The source must be a URL that points to an archived version of the desired Python distribution.
Setting this manually may require you to define extra metadata about the distribution that is required for correct runtime behavior.
You may set the relative path to the Python executable after unpacking the archive with the PYAPP_DISTRIBUTION_PYTHON_PATH option. The default is python.exe on Windows and bin/python3 on all other platforms.
You may set the relative path to the site-packages directory after unpacking the archive with the PYAPP_DISTRIBUTION_SITE_PACKAGES_PATH option. The default is Lib\site-packages on Windows and lib/python<ID>/site-packages on all other platforms where <ID> is the distribution ID is defined.
You may indicate whether pip is already installed by setting the PYAPP_DISTRIBUTION_PIP_AVAILABLE option to true or 1. This elides the check for installation when upgraded virtual environments are enabled.
You may set the PYAPP_DISTRIBUTION_EMBED option to true or 1 to embed the distribution in the executable at build time to avoid fetching it at runtime.
You can set the PYAPP_DISTRIBUTION_PATH option to use a local path rather than fetching the source, which implicitly enables embedding. The local archive should be similar to the default distributions in that there should be a Python interpreter ready for use.
You may use a specific X.Y.Z version by setting the PYAPP_UV_VERSION option.
By default, a version of UV that has already been downloaded by a PyApp application is used. If UV has not yet been downloaded then the latest version is used.
You may set the PYAPP_UV_ONLY_BOOTSTRAP option to true or 1 to only use UV for virtual environment creation and continue using pip for project installation.
You may set the PYAPP_PIP_EXTRA_ARGS option to provide extra arguments to the pip install command at runtime when installing or updating the project e.g. --only-binary :all: --index-url URL.
You may set the PYAPP_FULL_ISOLATION option to true or 1 to provide each installation with a full copy of the distribution rather than a virtual environment.
When full isolation is not enabled, you may set the PYAPP_UPGRADE_VIRTUALENV option to true or 1 to create virtual environments with virtualenv rather than the standard library's venv module.
You may set the PYAPP_SKIP_INSTALL option to true or 1 to skip installing the project in the distribution. This allows for entirely predefined distributions and thus no network calls at runtime if used in conjunction with distribution embedding.
The environment variable that is used for detection may be set to the path of the executable at runtime if you set the PYAPP_PASS_LOCATION option to true or 1. This is useful if your application wishes to in some way manage itself.
You may set the PYAPP_SELF_COMMAND option to override the default name (self) of the management command group. Setting this to none effectively disables the use of management commands.
When enabled, the value will be available at runtime as the PYAPP_COMMAND_NAME environment variable.
You may set a custom template used to output metadata with the PYAPP_METADATA_TEMPLATE option which supports the following placeholders:
Placeholder
Description
{project}
The normalized project name
{version}
The currently installed version of the project
The default template is {project} v{version} if this option is unset.
This is useful for setting custom commands for the Starship prompt. The following example configuration assumes that the built executable has been renamed to foo: