hydromodpy.core.toml_io.generator#
Auto-generate commented TOML templates from Pydantic models.
Reads field names, types, defaults, descriptions, and Profile metadata directly from Pydantic model_fields. Supports filtering by module and profile.
Supports list[BaseModel] fields, rendered as TOML array-of-tables
([[section.field]]).
Usage:
from hydromodpy.core.toml_io.generator import generate_toml
print(generate_toml(modules=["geographic"], profile="user"))
from hydromodpy.core.toml_io.generator import generate_toml_from_instances
generate_toml_from_instances(
{"hydrometry": cfg_h, "piezometry": cfg_p},
output_path="config.toml",
)
Functions
|
Return the list of registered config module names. |
|
Generate a commented TOML template filtered by modules and profile. |
|
Generate a fully-filled TOML from instantiated Pydantic models. |