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.
They can also be imported from the submodule directly:
Path Types¶
FilePath¶
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¶
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¶
Narrows the structure parameter of upload operations.
Valid values: "disk", "server"
Configuration Types¶
IncludeFiles¶
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¶
Generic mapping for JSON-serializable data. Used internally by configuration parsers, template renderers, and YAML/JSON loaders. Useful when passing raw config dictionaries.
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
¶
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
¶
Type alias for compiler name selection.
Valid values: "auto", "Cx_Freeze", "PyInstaller", "Nuitka"
Used by: CompilerConfig.compiler, EzCompiler.compile_project().
UploadTarget
module-attribute
¶
Type alias for upload destination selection.
Valid values: "disk", "server"
Used by: CompilerConfig.upload_structure, EzCompiler.upload_to_repo().
IncludeFiles
module-attribute
¶
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
¶
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