Skip to content

Types

Public type aliases for EzCompiler, importable directly from the top-level package.

All aliases defined here are re-exported via ezcompiler.__init__ and appear in __all__, so they are part of the stable public API.


Overview

The types module centralizes common type aliases used throughout the library. Import them when you want to annotate your own code that calls EzCompiler APIs, or when building extensions on top of the framework.

from ezcompiler import FilePath, CompilerName, UploadTarget, IncludeFiles, JsonMap

They can also be imported from the submodule directly:

from ezcompiler.types import FilePath, IncludeFiles

Path Types

FilePath

FilePath: TypeAlias = str | Path

Accepted wherever a file system path is expected (configuration fields, template loaders, file utility functions). Both a plain string and a pathlib.Path object are valid.

from pathlib import Path
from ezcompiler import FilePath, CompilerConfig

def load_config(path: FilePath) -> CompilerConfig:
    ...

Compiler Types

CompilerName

CompilerName: TypeAlias = str

Narrows the compiler parameter to the set of recognized backend names.

Valid values: "auto", "Cx_Freeze", "PyInstaller", "Nuitka"

from ezcompiler import CompilerName, EzCompiler, CompilerConfig

def build(compiler: CompilerName) -> None:
    config = CompilerConfig(
        version="1.0.0",
        project_name="MyApp",
        main_file="main.py",
        include_files={"files": [], "folders": []},
        output_folder="dist",
    )
    EzCompiler(config).compile_project(compiler=compiler)

UploadTarget

UploadTarget: TypeAlias = str

Narrows the structure parameter of upload operations.

Valid values: "disk", "server"

from ezcompiler import UploadTarget

def upload(target: UploadTarget, destination: str) -> None:
    ...

Configuration Types

IncludeFiles

IncludeFiles: TypeAlias = dict[str, list[str]]

Expected shape for the include_files field of CompilerConfig:

{
    "files": ["path/to/config.yaml", "path/to/data.dll"],
    "folders": ["path/to/assets/", "path/to/locale/"],
}

Both keys are required. Pass empty lists when no files or folders should be included.

from ezcompiler import IncludeFiles, CompilerConfig

bundle: IncludeFiles = {
    "files": ["settings.yaml"],
    "folders": ["assets"],
}
config = CompilerConfig(
    version="1.0.0",
    project_name="MyApp",
    main_file="main.py",
    include_files=bundle,
    output_folder="dist",
)

JsonMap

JsonMap: TypeAlias = dict[str, object]

Generic mapping for JSON-serializable data. Used internally by configuration parsers, template renderers, and YAML/JSON loaders. Useful when passing raw config dictionaries.

from ezcompiler import JsonMap

raw: JsonMap = {"version": "1.0.0", "project_name": "MyApp"}

API Reference

types

Type aliases module for ezcompiler.

This module centralizes common type aliases used throughout the library to improve code readability, maintainability, and type safety.

Example

from ezcompiler.types import IncludeFiles, CompilerName

def build(compiler: CompilerName, files: IncludeFiles) -> None: ... pass

FilePath module-attribute

FilePath: TypeAlias = str | Path

Type alias for file path inputs.

Accepts
  • str: String file path
  • Path: pathlib.Path object

Used by: CompilerConfig, template loaders, file utilities.

CompilerName module-attribute

CompilerName: TypeAlias = str

Type alias for compiler name selection.

Valid values: "auto", "Cx_Freeze", "PyInstaller", "Nuitka"

Used by: CompilerConfig.compiler, EzCompiler.compile_project().

UploadTarget module-attribute

UploadTarget: TypeAlias = str

Type alias for upload destination selection.

Valid values: "disk", "server"

Used by: CompilerConfig.upload_structure, EzCompiler.upload_to_repo().

IncludeFiles module-attribute

IncludeFiles: TypeAlias = dict[str, list[str]]

Type alias for the include_files configuration structure.

Expected shape::

{
    "files": ["path/to/file1.txt", "path/to/file2.dll"],
    "folders": ["path/to/assets/", "path/to/data/"],
}

Used by: CompilerConfig.include_files.

JsonMap module-attribute

JsonMap: TypeAlias = dict[str, object]

Type alias for a generic JSON-serializable mapping.

Used by: configuration parsers, template renderers, YAML/JSON loaders.

options: show_source: false members: - FilePath - CompilerName - UploadTarget - IncludeFiles - JsonMap