$ show brentvollebregt/auto-py-to-exe
Auto PY to EXE is a desktop application that provides a graphical interface for converting Python scripts (.py) into standalone Windows executables (.exe) using PyInstaller under the hood. The application is structured as a Python package with a web-based frontend served locally via the Eel framework, which bridges JavaScript UI components with a Python backend. The backend handles argument parsing, configuration management, file dialogs (via tkinter), and orchestrates PyInstaller execution, capturing logs and output to display in real-time in the browser UI. The tool supports a wide range of PyInstaller options, including onefile/onedir modes, console hiding, icon assignment, additional files, and many advanced flags, all exposed through a dynamically generated settings panel. It also includes version checking against GitHub API for both itself and PyInstaller, along with compatibility shims (e.g., for Python 3.12 bottle issues). The codebase is well-organized into distinct modules (validation, packaging, UI, dialogs, utils, shims) with a clear separation between Python backend and frontend presentation, though some cross-module coupling exists via a global config singleton. Tests cover basic packaging, library imports, and dependency availability, though they are limited in scope.
The LLM identified 4 files worth highlighting for reuse:
Provides three reusable argparse validators (argparse_file_exists, argparse_file_json, argparse_logging_level) that can be extracted into any Python CLI project requiring robust input validation. They are self-contained, clean, and follow standard argparse patterns.
Contains the ForwardToFunctionStream class, which turns a function into a writable stream (e.g., for routing logging to a UI callback), and parse_version_tuple for safe version comparison. Also includes get_port for finding a free TCP port and open_output_in_explorer for cross-platform file manager integration. These utilities are modular and reusable in other Python applications.
Provides cross-platform file/folder selection dialogs using tkinter with graceful fallbacks and error messages for missing Tkinter. Can be extracted and used in any Python application that needs native file dialogs without external dependencies beyond the standard library.
Implements a targeted shim to fix Python 3.12 incompatibility with older versions of Bottle (used by Eel) by monkey-patching the _ImportRedirect class. This is a clean example of a temporary compatibility layer that can be adapted for similar cross-version library fixes.