Skip to content

Target Configuration

Target options are specified in [tool.poetry-pyinstaller-plugin.targets.<TARGET>] section of pyproject.toml file. Where <TARGET> is the final executable name produced by PyInstaller.

Since release 2.x of poetry-pyinstaller-plugin all PyInstaller options are configurable at target or plugin level.

Order of precedence for options: target -> plugin -> default

Options

Are listed in this section, supported options allowing you to customize target build.


source path required

Path to your future executable entrypoint.

Example - Minified form
[tool.poetry-pyinstaller-plugin.targets]
my-tool = "my_package/entrypoint.py"
# or
my-tool = { source = "my_package/entrypoint.py" }

Or

Example - Dedicated target block
[tool.poetry-pyinstaller-plugin.targets.my-tool]
source = "my_package/entrypoint.py"

Above examples produces identical target specs, using dedicated target block is heavily recommended to keep your pyproject.toml readable.


type str

Default: onedir

Type of PyInstaller distribution format.

  • onedir: Create a one-folder bundle containing an executable
  • onefile: Create a one-file bundled executable

bundle boolean

Default: false

Bundle executable to Wheels and register them as executable scripts.


no-upx boolean

Default: false

Disable UPX archiving.


strip boolean

Default: false

Apply a symbol-table strip to the executable and shared libraries
Not recommended for Windows


console boolean

Default: false

Open a console window for standard IO (default).
This option has no effect in Windows if the first script is a .pyw file.


windowed boolean

Default: false

Windows and Mac OS X: do not provide a console window for standard IO.
On macOS this also triggers building a macOS .app bundle.
On Windows this option is automatically set if the first script is a .pyw file.

This option is ignored on *NIX systems.


icon path

Default: PyInstaller’s icon

Set the icon for executables.

  • FILE.ico - Apply the icon to a Windows executable.
  • FILE.exe,ID - Extract the icon with ID from an exe.
  • FILE.icns - Apply the icon to the .app bundle on macOS.

Use NONE to not apply any icon, thereby making the OS to show system default.

uac-admin boolean

Default: false

Using this option creates a Manifest that will request elevation upon application start.


uac-uiaccess boolean

Default: false

Using this option allows an elevated application to work with Remote Desktop.


argv-emulation boolean

Default: false

Enable argv emulation for macOS app bundles.

If enabled, the initial open document/URL event is processed by the bootloader and the passed file paths or URLs are appended to sys.argv.


arch str macOS only

Default: null

Target architecture. Accepted values: x86_64, arm64, universal2.


hidden-import str | list[str]

Default: null

Hidden imports needed by the executable.


runtime-hooks list

Default: null

One or more runtime hook paths to bundle with the executable.

These hooks are executed before any other code or module to set up special features of the runtime environment.


add-version bool

Default: false

Suffix executable names with current package version. Dynamic versioning over poetry-dynamic-versioning plugin is supported.

These hooks are executed before any other code or module to set up special features of the runtime environment.


when str

Default: null - targets are always built.

Restrict build depending on package version. Possible values:

  • release
  • prerelease

certifi.append list[str]

Default: []

List of certificates to include in certifi.where()

Warning

certifi package must be registered in project dependencies if enabled.


collect dict[str, list[str]]

Default: null

Define which data from specific package or module must be included in final archive.

Supported keys:

  • submodules: Collect all submodules for specified package(s) or module(s)
  • data: Collect all data for specified package(s) or module(s)
  • binaries: Collect all binaries for specified package(s) or module(s)
  • all: Collect all submodules, data files, and binaries for specified package(s) or module(s)

copy-metadata list[str]

Default: []

List of packages for which metadata must be copied.


include dict[Path, Path]

Default: []

Data file(s) to include. {source: destination}


package dict[Path, Path]

Default: []

File(s) to include with executable. {source: destination}


exclude-poetry-include boolean

Default: false

Disable [tool.poetry.include] and use plugin/target settings instead.