API Guide
Model Class
- class configmelt.configmelt.ConfigMeld(**attrs)
A class to load and manage configurations from JSON or YAML files.
- generate_schema() dict
Generate a JSON schema based on existing configurations.
- Returns:
dict: The generated JSON schema.
- get(item, default: Any | None = None)
Get a configuration item from the ConfigMeld object.
- Args:
item: The item to retrieve. default (Optional[Any]): The default value if the item is not found.
- Returns:
Any: The value of the requested item or the default value.
- load_config_as_environ_vars() None
Load configurations as environment variables.
- load_config_as_kwargs() dict
Load configurations as keyword arguments.
- Returns:
dict: Configurations represented as keyword arguments.
- load_config_as_string() str
Load configurations as a string.
- Returns:
str: Configurations represented as a string.
- classmethod load_config_from_file(path: str, schema_validator: str | None = None, **kwargs) ConfigMeld
Load configuration from a file.
- Args:
path (str): The path to the configuration file. schema_validator (Optional[str]): The path to the schema validator file. **kwargs: Additional keyword arguments.
- Returns:
ConfigMeld: A ConfigMeld instance with loaded configurations.
- Raises:
FileNotFoundError: If the file is not found. ValueError: If an unrecognized extension is encountered.
- map_to_jsonschema_type(python_type) str
Map Python types to JSONSchema types.
- Args:
python_type (type): The Python type.
- Returns:
str: JSONSchema equivalent type.