collective.transmute.settings#
- collective.transmute.settings.get_settings(cwd_path: Path | None = None) TransmuteSettings[source]#
Get the transmute settings, merging defaults and user config.
- Parameters:
cwd_path (Path or None, optional) -- The current working directory. If
None, usesPath.cwd().- Returns:
The settings object for
collective.transmute.- Return type:
TransmuteSettings
Example
>>> from pathlib import Path >>> settings = get_settings(Path("/project")) >>> print(settings.config)
- collective.transmute.settings.logger_settings(cwd: Path) tuple[bool, Path][source]#
Return the debug status and log file path for
collective.transmute.- Parameters:
cwd (Path) -- The current working directory as a
pathlib.Pathobject.- Returns:
A tuple containing: - is_debug (bool): Whether debug mode is enabled. - log_path (Path): The full path to the log file.
- Return type:
Example
>>> from pathlib import Path >>> is_debug, log_path = logger_settings(Path("/project")) >>> print(is_debug) >>> print(log_path)
collective.transmute.settings.parse#
- collective.transmute.settings.parse._as_set(value: list) set[source]#
Cast a list value to a set.
- Parameters:
value (list) -- The list to cast.
- Returns:
The set containing the elements of the list.
- Return type:
Example
>>> _as_set([1, 2, 2]) {1, 2}
- collective.transmute.settings.parse._as_tuple(value: list) tuple[source]#
Cast a list value to a tuple.
- Parameters:
value (list) -- The list to cast.
- Returns:
The tuple containing the elements of the list.
- Return type:
Example
>>> _as_tuple([1, 2, 3]) (1, 2, 3)
- collective.transmute.settings.parse._find_config_path(settings: Settings | LazySettings) Path[source]#
Return the absolute path to the transmute.toml config file.
- Parameters:
settings (Settings or Dynaconf) -- The dynaconf settings object.
- Returns:
The resolved path to the config file.
- Return type:
Path
- collective.transmute.settings.parse._merge_defaults(defaults: dict, settings: dict) dict[source]#
Merge default settings with user settings and apply validators.
- collective.transmute.settings.parse._merge_dicts(defaults: dict, settings: dict) dict[source]#
Merge two dictionaries, with settings overriding defaults.
If a key exists in both and values are dicts, they are merged recursively. Otherwise, the value from settings overwrites the value from defaults.
- collective.transmute.settings.parse._update_value(data: dict, key: str, cast) dict[source]#
Update a nested value in a dictionary using dot notation and apply a cast function.
- collective.transmute.settings.parse.get_default_settings() TransmuteSettings[source]#
Return the default settings used by
collective.transmute.- Returns:
The default settings object for
collective.transmute.- Return type:
TransmuteSettings
Example
>>> settings = get_default_settings() >>> print(settings.config)
- collective.transmute.settings.parse.get_settings(cwd_path: Path | None = None) TransmuteSettings[source]#
Get the transmute settings, merging defaults and user config.
- Parameters:
cwd_path (Path or None, optional) -- The current working directory. If
None, usesPath.cwd().- Returns:
The settings object for
collective.transmute.- Return type:
TransmuteSettings
Example
>>> from pathlib import Path >>> settings = get_settings(Path("/project")) >>> print(settings.config)
- collective.transmute.settings.parse.parse_config(cwd_path: Path) dict[source]#
Parse and return the transmute config settings from
transmute.toml.- Parameters:
cwd_path (Path) -- The current working directory.
- Returns:
The config settings as a dictionary.
- Return type:
- collective.transmute.settings.parse.parse_default() dict[source]#
Parse and return the default transmute settings from
default.toml.- Returns:
The default settings as a dictionary.
- Return type:
- collective.transmute.settings.parse.settings_validators() tuple[Validator, ...][source]#
Return a tuple of
dynaconf.Validatorobjects for settings validation.- Returns:
Validators for the settings structure and types.
- Return type:
tuple[Validator, ...]
Example
>>> validators = settings_validators() >>> isinstance(validators[0], Validator) True