How to configure a compiler¶
Select and configure a compilation backend for an EzCompiler project.
🔧 Prerequisites¶
- EzCompiler installed (
uv add ezcompilerorpip install ezcompiler) - Target backend installed:
cx-freeze,pyinstaller, ornuitka - A
main.py(or equivalent) entry point for your project
📝 Steps¶
-
Create a
CompilerConfigwith the required fields. -
Pass the config to
EzCompilerand compile. -
Add compiler-specific options when needed.
config = CompilerConfig( version="1.0.0", project_name="MyApp", main_file="main.py", include_files={"files": ["icon.ico"], "folders": ["assets"]}, output_folder="dist", compiler="PyInstaller", packages=["requests", "pandas"], excludes=["debugpy", "pytest"], compiler_options={"onefile": True, "windowed": False}, )Why pass packages and excludes?
Compilation backends do not auto-discover every transitive dependency. Listing
packagesensures they are bundled;excludesreduces binary size by stripping development-only tools. -
Load configuration from a YAML or JSON file instead of inline code.
# ezcompiler.yaml version: "1.0.0" project_name: "MyApp" main_file: "main.py" output_folder: "dist" compiler: "PyInstaller" packages: - "requests" excludes: - "debugpy" include_files: files: ["config.yaml"] folders: ["assets"] # Compiler-specific options: only the section matching 'compiler' is used. pyinstaller: onefile: true
⚙️ Variations¶
Choose the backend that matches your distribution requirements.
✅ Result¶
Your project compiles to the output_folder using the configured backend.
Explicit packages, excludes, and compiler_options give you full control
over binary size and distribution structure.