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

available_modules()

Return the list of registered config module names.

generate_toml([output_path, modules, ...])

Generate a commented TOML template filtered by modules and profile.

generate_toml_from_instances(instances[, ...])

Generate a fully-filled TOML from instantiated Pydantic models.