Skip to main content

Automatic hook and data file bundler for PyInstaller.

Project description

pyi-autobundle

Automatic hook and data file bundler for PyInstaller — a tool to help generate hooks, collect package assets, and produce PyInstaller spec files automatically so you can build portable binaries with a single command.

Key Features

  • Static AST import scanning and basic dynamic import detection.
  • Optional runtime import tracing to capture imports that only appear at runtime.
  • Package inspection to collect datas (images, JSON, templates, ML models) and native binaries.
  • Automatic generation of PyInstaller hook-*.py files and a working .spec file.
  • One-command CLI: pybundle (entrypoint: pyi_autobundle.cli:main).
  • Centralized configuration via pyproject.toml under [tool.pyi-autobundle].
  • .buildignore support to exclude files, directories, or patterns from inclusion.
  • Built-in hidden-imports database for common problematic packages (numpy, pandas, torch, PIL).
  • --dry-run mode to audit what would be included without building.

Installation

Install in editable/development mode or as a package in your Python environment:

python -m pip install -e .
python -m pip install pyinstaller

CLI Usage

Basic one-command build:

pybundle path\to\main.py --trace

Common flags:

  • --trace : run the runtime import tracer in addition to static scanning
  • --onefile : build a single-file executable (PyInstaller --onefile)
  • --windowed : create a windowed app (no console)
  • --hooks-dir : directory to write generated hooks (default: .pyi-hooks)
  • --buildignore : path to a .buildignore file to exclude assets
  • --dry-run : list files/modules that would be included and exit

Configuration (pyproject.toml)

You can set default build options in pyproject.toml under the tool.pyi-autobundle table. Example:

[tool.pyi-autobundle]
onefile = true
windowed = false
name = "myapp"
icon = "assets/app.ico"

The CLI will merge values from this config with any flags you pass on the command line.

.buildignore

Place a .buildignore file in your project root to exclude files or patterns from being collected. Lines starting with # are treated as comments. Example:

# exclude tests and dataset
tests/
data/raw/
*.log

Resource discovery

If your code uses a helper like get_resource_path("assets/icon.png"), the static scanner attempts to detect literal calls and automatically include referenced files in the build.

Dry-run audit

Use --dry-run to print a report of datas, binaries, and hiddenimports that would be included by the build process without invoking PyInstaller.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyi_autobundle-0.1.85.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyi_autobundle-0.1.85-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file pyi_autobundle-0.1.85.tar.gz.

File metadata

  • Download URL: pyi_autobundle-0.1.85.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for pyi_autobundle-0.1.85.tar.gz
Algorithm Hash digest
SHA256 74871004e5ce34ae5c2d01afce96686747a427987c902616be879fda9258b030
MD5 07ea0b95c7d669f11616bba72e30c902
BLAKE2b-256 e60c96c2e20ec299e03254b726ab91c8677bd18a159162f8c88da831dae6e94d

See more details on using hashes here.

File details

Details for the file pyi_autobundle-0.1.85-py3-none-any.whl.

File metadata

File hashes

Hashes for pyi_autobundle-0.1.85-py3-none-any.whl
Algorithm Hash digest
SHA256 d09d41ee9c0ade300678a4133a04d33e69423f7bba474396c1790033e1d91b51
MD5 6785b5a2203366b9658f8be4fee2d6da
BLAKE2b-256 9337f26ba2af71c0e412f558f49377d130fc41e47bc3c84a0589e3134f88bf92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page