Skip to main content

Project compilation and distribution framework for Python projects

Project description

EzCompiler

PyPI version Python versions PyPI status License CI Docs uv linter type checker

EzCompiler Logo

EzCompiler is a professional Python library for compiling projects into executable files with automatic version management, packaging, and distribution. It provides a unified interface for multiple compilers (Cx_Freeze, PyInstaller, Nuitka) with modular architecture and complete type hints.

๐Ÿ“ฆ Installation

pip install ezcompiler

Or from source:

git clone https://github.com/neuraaak/ezcompiler.git
cd ezcompiler && pip install .

๐Ÿš€ Quick Start

from ezcompiler import EzCompiler

# Initialize
compiler = EzCompiler()

# Configure project
compiler.init_project(
    version="1.0.0",
    project_name="MyApp",
    main_file="main.py",
    include_files={"files": [], "folders": []},
    output_folder="dist",
)

# Run the full build pipeline with DLP progress display
compiler.run_pipeline(
    console=True,
    upload_structure="disk",
    upload_destination="./releases",
)

๐ŸŽฏ Key Features

  • โœ… Multi-Compiler Support: Cx_Freeze, PyInstaller, and Nuitka with unified interface
  • โœ… Automatic File Generation: Version files, setup.py, and configuration from templates
  • โœ… Template System: Flexible file generation based on customizable templates
  • โœ… Packaging: Automatic ZIP archive creation for distribution
  • โœ… Distribution: Upload support for local disk and remote HTTP/HTTPS servers
  • โœ… Configuration Management: Centralized configuration with automatic validation
  • โœ… Structured Logging: Integration with Ezpl for professional logging
  • โœ… Full Type Hints: Complete typing support for IDEs and linters

๐Ÿ“š Documentation

๐Ÿงช Testing

Comprehensive test suite with 233 test cases covering unit, integration, and robustness scenarios (~63% coverage).

# Install dev dependencies
pip install -e ".[dev]"

# Run all tests
pytest tests/

# Run specific test types
python tests/run_tests.py --type unit
python tests/run_tests.py --type integration
python tests/run_tests.py --type robustness

# With coverage
python tests/run_tests.py --coverage

See Development Guide for testing details.

๐Ÿ› ๏ธ Development Setup

For contributors and developers:

# Install in development mode with all dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/

# Run linting and formatting
ruff check .
ruff format --check .
ty check src/ezcompiler/
pyright src/ezcompiler/
PYTHONPATH=src lint-imports

๐ŸŽจ Main Components

  • EzCompiler: Main facade class for orchestrating the entire compilation process
  • CompilerConfig: Centralized configuration management
  • CompilationResult: Result type for compilation operations (shared layer)
  • PipelineService: Full compile โ†’ zip โ†’ upload pipeline orchestration
  • CompilerService: Compiler selection and execution
  • ConfigService: Configuration loading with cascade merge
  • TemplateService: Template processing and file generation
  • CompilerFactory: Factory for creating compiler instances
  • BaseCompiler: Abstract base class for compiler adapters
  • CxFreezeCompiler: Cx_Freeze compiler implementation
  • PyInstallerCompiler: PyInstaller compiler implementation
  • NuitkaCompiler: Nuitka compiler implementation (standalone & onefile)
  • BaseFileWriter / DiskFileWriter: File writer port and disk adapter
  • BaseUploader: Abstract base class for uploader adapters
  • DiskUploader: Local disk uploader
  • ServerUploader: HTTP/HTTPS uploader

๐Ÿ“ฆ Dependencies

Package Version Description
cx_Freeze 7.0-9.0 Python to executable compiler
PyInstaller 5.0+ Python to executable compiler
Nuitka 2.4+ Python to executable compiler
InquirerPy 0.3.4+ Interactive CLI interface
requests 2.32.3+ HTTP library for uploads
PyYAML 6.0+ YAML file processing
click 8.0.0+ CLI framework
ezplog 1.0.0+ Structured logging framework

๐Ÿ”ง Quick API Reference

from ezcompiler import EzCompiler, CompilerConfig

# Create compiler instance
compiler = EzCompiler()

# Initialize project
compiler.init_project(
    version="1.0.0",
    project_name="MyApp",
    main_file="main.py",
    include_files={"files": ["config.yaml"], "folders": ["assets"]},
    output_folder="dist",
)

# Run full pipeline with DLP progress (version, compile, zip, upload)
compiler.run_pipeline(
    console=True,
    upload_structure="disk",
    upload_destination="./releases",
)

# Or call individual steps manually:
# compiler.generate_version_file()
# compiler.compile_project(compiler="Nuitka")
# compiler.zip_compiled_project()
# compiler.upload_to_repo(structure="disk", repo_path="./releases")

๐Ÿ›ก๏ธ Robustness

EzCompiler is designed for production use with comprehensive error handling:

  • Full type hints for IDE support and static analysis
  • Robust error handling with specific exceptions
  • Automatic validation of configuration
  • Cross-platform file operations
  • Support for various file encodings and special characters

๐Ÿ’ป CLI Usage

# Interactive project initialization
ezcompiler init

# Generate configuration
ezcompiler generate config \
  --project-name "MyApp" \
  --version "1.0.0" \
  --main-file "main.py"

# Generate setup.py
ezcompiler generate setup --config ezcompiler.yaml

# Generate version file
ezcompiler generate version --config ezcompiler.yaml

# Generate templates
ezcompiler generate template --type config --mockup

See CLI Reference for complete reference.

๐Ÿ”„ Configuration

YAML Configuration

version: "1.0.0"
project_name: "MyApp"
main_file: "main.py"
output_folder: "dist"

include_files:
  files:
    - "config.yaml"
  folders:
    - "assets"

packages:
  - "requests"
  - "pandas"

excludes:
  - "debugpy"
  - "test"

compilation:
  compiler: "auto" # "auto", "Cx_Freeze", "PyInstaller", or "Nuitka"
  console: true
  zip_needed: true
  repo_needed: false

See Configuration Guide for detailed configuration options.

๐Ÿ“Š Architecture

ezcompiler/
โ”œโ”€โ”€ interfaces/          # CLI and Python API (entry points)
โ”œโ”€โ”€ services/            # Business logic orchestration
โ”‚   โ”œโ”€โ”€ compiler_service.py
โ”‚   โ”œโ”€โ”€ config_service.py
โ”‚   โ”œโ”€โ”€ pipeline_service.py
โ”‚   โ”œโ”€โ”€ template_service.py
โ”‚   โ””โ”€โ”€ uploader_service.py
โ”œโ”€โ”€ adapters/            # Concrete compiler and uploader implementations
โ”‚   โ”œโ”€โ”€ cx_freeze_compiler.py
โ”‚   โ”œโ”€โ”€ pyinstaller_compiler.py
โ”‚   โ”œโ”€โ”€ nuitka_compiler.py
โ”‚   โ”œโ”€โ”€ compiler_factory.py
โ”‚   โ”œโ”€โ”€ disk_file_writer.py
โ”‚   โ”œโ”€โ”€ disk_uploader.py
โ”‚   โ””โ”€โ”€ server_uploader.py
โ”œโ”€โ”€ shared/              # Configuration, result types and exceptions
โ”‚   โ”œโ”€โ”€ compiler_config.py
โ”‚   โ””โ”€โ”€ compilation_result.py
โ”œโ”€โ”€ utils/               # Utility functions
โ””โ”€โ”€ assets/templates/    # Template files (config, setup, version)

assets/ is a dedicated resource layer for non-executable project artifacts (template files, static generation resources). It is consumed by services through template loaders and remains isolated from business orchestration logic.

๐Ÿš€ Use Cases

Python Project Compilation

  • Create Windows executables from Python scripts
  • Package projects with dependencies
  • Automatically generate configuration files

Automated Distribution

  • Create ZIP archives for distribution
  • Automatic upload to local or remote repositories
  • Version management and metadata handling

Development Tools

  • Generate setup.py files for PyPI distribution
  • Create Windows version information files
  • Automate build workflows

Project Management

  • Centralized configuration via YAML/JSON files
  • Customizable templates for file generation
  • Integration into CI/CD pipelines

๐Ÿค Contributing

Contributions are welcome! Please feel free to:

  1. ๐Ÿด Fork the project
  2. ๐ŸŒฟ Create a feature branch (git checkout -b feature/AmazingFeature)
  3. ๐Ÿ’พ Commit your changes (git commit -m 'Add some AmazingFeature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/AmazingFeature)
  5. ๐Ÿ”€ Open a Pull Request

โญ Support

๐Ÿ“ License

MIT License โ€“ See LICENSE file for details.

๐Ÿ”— Links


EzCompiler โ€“ Professional Python project compilation and distribution. ๐Ÿš€

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

ezcompiler-2.3.2.tar.gz (230.7 kB view details)

Uploaded Source

Built Distribution

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

ezcompiler-2.3.2-py3-none-any.whl (102.5 kB view details)

Uploaded Python 3

File details

Details for the file ezcompiler-2.3.2.tar.gz.

File metadata

  • Download URL: ezcompiler-2.3.2.tar.gz
  • Upload date:
  • Size: 230.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ezcompiler-2.3.2.tar.gz
Algorithm Hash digest
SHA256 868a6032613e23bed21f99e5929cc6bf7c13ca81e429188cde2c3b01174bfe3b
MD5 a50946aa40cf94918a2f0a050220008d
BLAKE2b-256 34a7d48b552f6a919472d5966e54bfc95f48d9252d08a1ef433a16c05dded73e

See more details on using hashes here.

File details

Details for the file ezcompiler-2.3.2-py3-none-any.whl.

File metadata

  • Download URL: ezcompiler-2.3.2-py3-none-any.whl
  • Upload date:
  • Size: 102.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ezcompiler-2.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40901aa7754b1a560f75827aaf1b662001b042df721e4dcc852acfc267654e21
MD5 64cdc5b40bfbc48ff9bee0ac8821c44e
BLAKE2b-256 f2b7b47da6b85cc661e184bae509c77cd8e655187c0dfb8f2541629655bba4f3

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