Metadata-Version: 2.4
Name: installer_creator
Version: 0.3.0
Summary: Python package for compiling projects with Nuitka and creating Windows installers with Wix Toolset
License-Expression: LGPL-3.0-or-later
Project-URL: homepage, https://github.com/steveway/installer_creator
Project-URL: issues, https://github.com/steveway/installer_creator/issues
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nuitka
Requires-Dist: pyyaml
Requires-Dist: psutil
Requires-Dist: rich
Requires-Dist: pywinpty; platform_system == "Windows"
Provides-Extra: gui
Requires-Dist: PySide6; extra == "gui"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: PySide6; extra == "dev"
Dynamic: license-file

# Installer Creator

Python package for compiling projects with Nuitka and creating Windows installers with Wix Toolset.

## Features

- **One-click builds** - Compile Python to EXE and create installers with a single command
- **Graphical Config Editor** - Intuitive UI for managing build configurations
- **Python Path Selection** - Manually specify Python executable or auto-detect virtual environments
- **Automatic Resource Discovery** - Bundle conventional resource folders and files referenced by Python code
- **Clear Resource Destinations** - Choose whether manually added resources go inside or beside the executable
- **File Browser Integration** - Easily add files and resources with a file dialog
- **Real-time Progress** - View build output and cancel long-running operations
- **Upgrade Code Management** - Generate consistent UUIDs for product upgrades
- **Flexible Configuration** - Support for complex build scenarios and dependencies

## Installation

```bash
pip install installer-creator
```

To use the graphical configuration editor, install the GUI extra:

```bash
pip install installer-creator[gui]
```

## Prerequisites

1. **Wix Toolset** (required for installer creation):
   ```bash
   dotnet tool install --global wix
   ```
   The package will automatically install the Wix UI extension if missing

2. **Nuitka** (will be installed automatically)

## Quick Start

1. Create a basic configuration:
   ```bash
   installer-creator config-editor
   ```
2. Build your application:
   ```bash
   installer-creator build-exe
   ```
3. Build the executable and configured installer together:
   ```bash
   installer-creator build
   ```

## Configuration Editor GUI

The graphical interface provides:

- **Visual Editing** of all configuration options
- **Automatic Resource Discovery** with preview
- **One-click Builds** directly from the interface
- **Validation** of configuration values
- **Progress Monitoring** with cancel option

Launch the GUI with:
```bash
installer-creator config-editor
```

> **Note:** The GUI requires PySide6. Install it with `pip install installer-creator[gui]`.

## Command Line Usage

```bash
# Generate deterministic UUID for upgrade codes
installer-creator generate-uuid -s "MyAppName"

# Preview automatic and configured resource placement
installer-creator resources -c custom_config.yaml

# Build only the executable with a custom config
installer-creator build-exe -c custom_config.yaml --verbose

# Build with specific Python executable
installer-creator build-exe --python-path "C:\\path\\to\\python.exe"

# Build executable and installer together
installer-creator build -c custom_config.yaml --verbose

# Create installer with debug output
installer-creator build-installer -c custom_config.yaml --debug
```

## Troubleshooting

**Common Issues:**

- **Missing Wix Toolset**: Ensure `wix` is installed globally
- **Missing GUI dependencies**: Run `pip install installer-creator[gui]` for the config editor
- **Permission Errors**: Run commands as administrator when needed
- **Build Failures**: Check paths and file permissions in configuration

For detailed debugging:
```bash
installer-creator build-exe --debug
```

## Testing

The project includes comprehensive tests covering:

- Build process validation
- Installer creation
- Automatic resource discovery
- Configuration handling
- Edge case scenarios

Run tests with:
```bash
pip install -e ".[dev]"
pytest tests/
```

## Configuration

Create a `build_config.yaml` file:

```yaml
# Nuitka build configuration
project:
  name: "MyApp"  # Application name
  version: "1.0.0"
  description: "My Application Description"
  company: ""
  icon: "app_icon.ico"  # Optional icon file
  main_file: "main.py"  # Entry point file
  python_path: ""  # Optional path to Python executable (auto-detected if empty)

build:
  output:
    directory: "dist"
    filename: "my_app.exe"  # Output executable name
  options:
    standalone: true
    onefile: true
    splash_screen: ""
    remove_output: true
  include:
    packages: []
    plugins: []
    data_dirs: []  # Additional folders bundled inside the EXE
    files: []  # Additional files bundled inside the EXE
    external_data: []  # Advanced: move matching bundled data outside one-file EXE
  resources:
    auto_discover: true
  copy_beside: []  # Editable files/folders placed next to the EXE

installer:
  enabled: true
  output:
    directory: "dist"
    filename: "my_app_installer.msi"
  metadata:
    manufacturer: "Your Company"
    product_name: "My Application"
    upgrade_code: ""  # Generate with installer-creator generate-uuid
  ui:
    banner_image: "banner.bmp"
    dialog_image: "dialog.bmp"
  license_file: "license.rtf"
  shortcuts:
    desktop: true
    start_menu: true

debug:
  enabled: false
  console:
    mode: "disabled"
    stdout: null
    stderr: null

exclude:
  - "__pycache__"
  - "*.pyc"
  - "*.pyo"
  - "*.pyd"
  - "build"
  - "dist"

```

## Resource Placement

Automatic discovery is enabled by default. It finds conventional resource folders such as `assets`, `resources`, `static`, and `templates`, including those inside local packages. It also finds existing project files used by common Python resource APIs such as `open()`, `Path()`, `QFile`, and `QIcon`. Use `installer-creator resources` to preview the result or `--no-auto-resources` to build with configured resources only.

Manual resources have two clear destinations:
- `build.include.files` and `build.include.data_dirs` are bundled **inside the EXE**.
- `build.copy_beside` contains editable or replaceable files and folders placed **beside the EXE** and included in the MSI.
- `build.include.external_data` is an advanced Nuitka pattern. It moves matching data that is already bundled outside a one-file EXE; it does not include source files itself.

UI images and the license file can use absolute paths or paths relative to the configuration file.

## GUI Features

The configuration editor provides a graphical interface for:
- Editing all aspects of the build configuration
- Managing project details, build settings, and installer options
- Previewing configuration changes
- Building executables and installers directly from the GUI
- Viewing real-time build output
- Canceling builds in progress
- Specifying a custom Python executable path
- Browsing and selecting files with a native file dialog

To launch the GUI, simply run:
```bash
installer-creator config-editor
```

The GUI will automatically create a default configuration file if none exists.
