Loader
Env-spec loader.
======================================================================================================================== Name: core/env/loader.py Description: Parses env_data_model.yaml into typed Pydantic models that represent every environment variable defined for the project.
Copyright ©2026 PyModeller. All rights reserved.
Classes:
| Name | Description |
|---|---|
DBField |
Database column specification for ORM code generation. |
DBSpec |
Database table-level configuration for Peewee models. |
DestinationType |
Destination module layer for the generated model. |
EnvSection |
A logical grouping of related environment variables. |
EnvSpec |
Complete specification container parsed from YAML source files. |
EnvVarSpec |
Specification for a single environment variable. |
SectionType |
Categorization for environment configuration sections. |
Functions:
| Name | Description |
|---|---|
load_env_spec |
Load and parse the environment specification file or directory containing YAML specs. |
DBField
Bases: BaseModel
Database column specification for ORM code generation.
DBSpec
Bases: BaseModel
Database table-level configuration for Peewee models.
DestinationType
EnvSection
Bases: BaseModel
A logical grouping of related environment variables.
Methods:
| Name | Description |
|---|---|
parse_pyproject_header |
Parse comma-separated string headers into a list of strings. |
propagate_section_to_variables |
Propagate section metadata and environment prefixes down to child variables. |
uppercase_prefix |
Ensure environmental variable prefix is uppercase. |
parse_pyproject_header
classmethod
Parse comma-separated string headers into a list of strings.
propagate_section_to_variables
propagate_section_to_variables() -> EnvSection
Propagate section metadata and environment prefixes down to child variables.
EnvSpec
Bases: BaseModel
Complete specification container parsed from YAML source files.
Methods:
| Name | Description |
|---|---|
validate_no_duplicates |
Ensure no name collisions exist between env variable keys or Python aliases. |
Attributes:
| Name | Type | Description |
|---|---|---|
all_vars |
list[EnvVarSpec]
|
A flattened list of all variable specifications across sections. |
all_vars
property
all_vars: list[EnvVarSpec]
A flattened list of all variable specifications across sections.
validate_no_duplicates
validate_no_duplicates() -> EnvSpec
Ensure no name collisions exist between env variable keys or Python aliases.
EnvVarSpec
Bases: BaseModel
Specification for a single environment variable.
Methods:
| Name | Description |
|---|---|
compute_derived_fields |
Derive aliases, environmental names, and secret status post-initialization. |
display_value |
Return a masked or plain default value suitable for documentation output. |
normalize_name |
Normalize the variable name to snake_case. |
normalize_type |
Map generic or YAML type names to standardized Python types. |
compute_derived_fields
compute_derived_fields() -> EnvVarSpec
Derive aliases, environmental names, and secret status post-initialization.
display_value
display_value() -> str
Return a masked or plain default value suitable for documentation output.
SectionType
load_env_spec
Load and parse the environment specification file or directory containing YAML specs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path | None
|
Path to a YAML file or directory containing spec files. Defaults to DEFAULT_SPEC_PATH. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
EnvSpec |
EnvSpec
|
Fully validated specification model populated from YAML content. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the designated spec path does not exist. |
ValueError
|
If no section definitions were found. |