Coverage for src / ezcompiler / types.py: 100.00%
14 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-27 06:49 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-27 06:49 +0000
1# ///////////////////////////////////////////////////////////////
2# TYPES - Type Aliases Module
3# Project: ezcompiler
4# ///////////////////////////////////////////////////////////////
6"""
7Type aliases module for ezcompiler.
9This module centralizes common type aliases used throughout the library
10to improve code readability, maintainability, and type safety.
12Example:
13 >>> from ezcompiler.types import IncludeFiles, CompilerName
14 >>>
15 >>> def build(compiler: CompilerName, files: IncludeFiles) -> None:
16 ... pass
17"""
19from __future__ import annotations
21# ///////////////////////////////////////////////////////////////
22# IMPORTS
23# ///////////////////////////////////////////////////////////////
24# Standard library imports
25from pathlib import Path
26from typing import TypeAlias
28# ///////////////////////////////////////////////////////////////
29# TYPE ALIASES
30# ///////////////////////////////////////////////////////////////
32# ------------------------------------------------
33# Path Types
34# ------------------------------------------------
36FilePath: TypeAlias = str | Path
37"""Type alias for file path inputs.
39Accepts:
40 - str: String file path
41 - Path: pathlib.Path object
43Used by: CompilerConfig, template loaders, file utilities.
44"""
46# ------------------------------------------------
47# Compiler Types
48# ------------------------------------------------
50CompilerName: TypeAlias = str
51"""Type alias for compiler name selection.
53Valid values: "auto", "Cx_Freeze", "PyInstaller", "Nuitka"
55Used by: CompilerConfig.compiler, EzCompiler.compile_project().
56"""
58UploadTarget: TypeAlias = str
59"""Type alias for upload destination selection.
61Valid values: "disk", "server"
63Used by: CompilerConfig.upload_structure, EzCompiler.upload_to_repo().
64"""
66# ------------------------------------------------
67# Configuration Types
68# ------------------------------------------------
70IncludeFiles: TypeAlias = dict[str, list[str]]
71"""Type alias for the include_files configuration structure.
73Expected shape::
75 {
76 "files": ["path/to/file1.txt", "path/to/file2.dll"],
77 "folders": ["path/to/assets/", "path/to/data/"],
78 }
80Used by: CompilerConfig.include_files.
81"""
83JsonMap: TypeAlias = dict[str, object]
84"""Type alias for a generic JSON-serializable mapping.
86Used by: configuration parsers, template renderers, YAML/JSON loaders.
87"""
89# ///////////////////////////////////////////////////////////////
90# PUBLIC API
91# ///////////////////////////////////////////////////////////////
93__all__ = [
94 "FilePath",
95 "CompilerName",
96 "UploadTarget",
97 "IncludeFiles",
98 "JsonMap",
99]