Universal‑PyInstaller‑Builder is a lightweight, modern Windows GUI for packaging Python projects into standalone executables with PyInstaller. It provides a clean, guided workflow—pick your entry script, choose one‑file or one‑dir, add data files, list hidden imports, pick an icon, choose an output folder, and build.
Platform: Windows only (developed and tested on Windows).
Scope: 100% GUI usage. No terminal commands required.
- Modern dark UI (CustomTkinter) with a clear layout.
- Inline help: a small “❓” button explains each section directly in the interface.
- One‑file / one‑dir builds via a single checkbox.
- Data bundling
- Add individual files or entire folders.
- When prompted, select the destination inside your packaged app (e.g.,
.orassets/).
- Hidden imports: enter a comma‑separated list for modules PyInstaller might not detect automatically.
- Icon embedding: select a
.icofile for your executable (you can also type a path). - Custom output folder: defaults to
dist, editable in the UI. - Live build log: real‑time output streaming plus a Copy log button for easy sharing.
- Smart PyInstaller selection (to reduce “wrong‑environment” builds):
- Prefer a
.venvnext to your target entry script. - If this app is frozen, prefer a
.venvnext to this app. - Otherwise use the current interpreter.
- Fall back to
pyinstalleronPATH.
- Prefer a
- Optional UPX: if UPX is installed and on
PATH, the build uses it automatically. - Pre/Post cleanup: removes the previous
build/directory and any*.specfiles in the project root before and after each build to keep outputs clean.
- Launch Universal‑PyInstaller‑Builder on Windows.
- Entry Point: choose your main
.pyfile. - (Optional) Executable Name: set a custom name.
- Additional Data:
- Add File or Add Folder.
- When prompted, choose the destination path inside your bundle (e.g.,
.orassets/).
- Hidden Imports: enter modules as a comma‑separated list (e.g.,
package_a.submodule, mypkg.utils). - Icon: select a
.icofile (or type a path). - Output Directory: keep
distor select another folder. - Build Mode: toggle Build one‑file executable as needed.
- Click Build Executable and monitor the Build Log.
- Use Copy log to copy the full output for troubleshooting or sharing.
-
PyInstaller invocation
The app decides how to call PyInstaller in this order:- Python from a
.venvnext to your target entry script →python -m PyInstaller - If the app is frozen, Python from a
.venvnext to this app →python -m PyInstaller - The current interpreter →
python -m PyInstaller - Fallback →
pyinstalleronPATH
- Python from a
-
Command assembly
Based on your selections, the generated build includes:--onefileor--onedir--noconsole(optimized for GUI applications)--exclude-module sitecustomizeand a few stdlib excludes (unittest,test,pydoc)--name,--icon,--add-data,--hidden-import,--distpathas configured in the UI--upx-dirif UPX is found onPATH
-
Windows environment help
When possible, the app setsTCL_LIBRARY/TK_LIBRARYfor the invoked Python to reduce Tk/Tcl packaging issues on Windows. -
Artifact hygiene
Before and after each build, the app clearsbuild/and any*.specfiles in the project root to avoid confusion from stale outputs.
- Simplicity first: opinionated defaults and a minimal set of controls cover the most common packaging scenarios.
- Smarter environment picking: prioritizes a
.venvalongside your target project to reduce mismatched‑environment builds. - Clean builds by default: automatic pre/post cleanup reduces “it worked yesterday” surprises.
- Focused UX: consistent dark theme, inline help, readable sections, and a copyable log.
- Fewer exposed flags than power‑user GUIs:
- No explicit toggle for console apps (the build applies
--noconsole). - No built‑in debug/verbosity toggles.
- No spec‑file viewing/editing UI (and default cleanup removes
*.spec). - No dedicated UI for advanced collection settings (hooks, binaries, etc.).
- No explicit toggle for console apps (the build applies
- No cancel button: once a build starts, it runs to completion; closing mid‑build can leave a background process.
- Windows‑only focus: designed and tested on Windows; other platforms are not supported or claimed.
- Requires PyInstaller and a working Python environment on Windows.
- Console builds: not exposed in the UI (the app adds
--noconsole). - Spec files: the app deletes any
*.specfiles in the project root before and after building. - Cancellation: no in‑GUI cancellation; if a build hangs, you must terminate the PyInstaller process externally.
- UPX: used only if present on
PATH; not bundled. - Hidden imports must be provided by you if auto‑detection misses something.
- “PyInstaller not found” → ensure PyInstaller is installed in the same environment the app ends up using (ideally a
.venvnext to your entry script). - Tk/Tcl issues in packaged apps → confirm a consistent Python base; the app attempts to supply
TCL_LIBRARY/TK_LIBRARYwhen it can infer them. - Missing modules at runtime → add them to Hidden Imports (comma‑separated).
- Data files not found → verify each entry follows
source_path;destination_inside_bundleand that the destination is correct relative to your app.
- universal_executable_builder.py: Main GUI and build logic
- utility.py: Tooltips, cleanup helpers, CTkToolTip monkey patches
Note: The executable in the repository was created using this application (the application created its own executable).