Package: poetry-pyinstaller-plugin
PyInstaller plugin for PoetryEasily create executable binaries from yourpyproject.tomlusingPyInstaller.FeaturesMultiple distribution formatsSingle filecreated indistfolder (executable archive)Foldercreated indistfolder (containing executable and libraries)Bundledexecutable in platform specific wheels as scriptsBoth single file & folder distribution type can be bundled in wheelsInstallationTo installpoetry-pyinstaller-pluginrun the following command:poetryselfaddpoetry-pyinstaller-pluginIf you are having troubles to install the plugin please refer to Poetry documentation:https://python-poetry.org/docs/plugins/#using-pluginsConfigurationAre listed in this sections all options available to configurepoetry-pyinstaller-pluginin yourpyproject.toml[tool.poetry-pyinstaller-plugin]scripts(dictionary)Where key is the program name and value a path to script or aPyInstallerTargetspecExample:prog-name = "my_package/script.py"certifi(dictionary)append(list): List of certificates to include incertifi.where()PyinstallerTargetspec:source(string): Path to your program entrypointtype(string,default:onedir): Type of distribution format. Must be one ofonefile,onedirbundle(boolean,default:false): Include executable binary onto wheelExamples[tool.poetry-pyinstaller-plugin.scripts]hello-world="my_package/main.py"# Equivalent tohello-world={source="my_package/main.py",type="onedir",bundle=false}# Single file bundled in wheelsingle-file-bundled={source="my_package/main.py",type="onefile",bundle=true}# Folder bundled in wheelfolder-bundled={source="my_package/main.py",type="onedir",bundle=true}[tool.poetry-pyinstaller-plugin.certifi]# Section dedicated to certifi, required if certificates must be included in certifi storeappend=['certs/my_cert.pem']UsageOnce configuredpoetry-pyinstaller-pluginis attached to thepoetry buildcommand.$ poetry build
Building binaries with PyInstaller Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
  - Building hello-world DIRECTORY
  - Built hello-world -> 'dist/pyinstaller/hello-world'
  - Building single-file-bundled SINGLE_FILE BUNDLED
  - Built single-file-bundled -> 'dist/pyinstaller/single-file-bundled'
  - Building folder-bundled DIRECTORY BUNDLED
  - Built folder-bundled -> 'dist/pyinstaller/folder-bundled'
Building my_package (0.0.0)
  - Building sdist
  - Built my_package-0.0.0.tar.gz
  - Building wheel
  - Built my_package-0.0.0-py3-none-any.whl
  - Adding single-file-bundled to data scripts my_package-0.0.0-py3-none-any.whl
  - Adding folder-bundled to data scripts my_package-0.0.0-py3-none-any.whl
Replacing platform in wheels (manylinux_2_35_x86_64)
  - my_package-0.0.0-py3-none-manylinux_2_35_x86_64.whlExpected directory structure:.
├── build ...................... PyInstaller intermediate build directory
│    ├── folder-bundled
│    ├── hello-world
│    └── single-file-bundled 
├── dist ....................... Result of `poetry build` command
│    ├── pyinstaller ............. PyInstaller output
│    │    ├── .specs/ ............ Specs files
│    │    ├── hello-world/
│    │    ├── folder-bundled/ 
│    │    └── single-file-bundled
│    ├── my_package-0.0.0-py3-none-manylinux_2_35_x86_64.whl ... Wheel with bundled binaries
│    └── my_package-0.0.0.tar.gz ............................... Source archive, binaries are never included
├── pyproject.toml
└── my_package
    ├── __init__.py
    └── main.pyDependencies noticeMajor benefit of this plugin is to create dependency free wheels with executable binaries (including dependencies).It is then recommended to include your dependencies as optional in yourpyproject.tomlExample[tool.poetry]name="my-package"[tool.poetry.dependencies]python="^3.8"rich={version="^13.7.0",optional=true}[tool.poetry.extras]with-deps=["rich"]Resulting package will not require any dependency except if installed with extrawith-deps.# Installation without dependencies (included in executable binaries)$pipinstallmy-package# Installation with dependencies (If package imported as modules in another project)$pipinstallmy-package[with-deps]Bundled binaries must be built with all dependencies installed in build environment.