config api

High-level convenience API for axisfuzzy configuration subsystem.

This module exposes simple convenience functions around a single global ConfigManager instance so library users can quickly read or mutate configuration without dealing with the manager class directly.

The functions are intentionally thin wrappers and preserve the behaviour of the underlying manager (validation, load/save semantics, etc.).

axisfuzzy.config.api.get_config()[source]

Return the active configuration object.

Returns:

The current Config instance.

Return type:

Config

Examples

>>> from axisfuzzy.config.api import get_config
>>> cfg = get_config()
>>> isinstance(cfg, Config)
True
axisfuzzy.config.api.get_config_manager()[source]

Return the global configuration manager instance.

This is the main entry point for accessing and modifying configuration. It provides methods to get, set, load, and save configurations.

Returns:

The global ConfigManager instance.

Return type:

ConfigManager

Examples

>>> from axisfuzzy.config.api import get_config_manager
>>> manager = get_config_manager()
>>> isinstance(manager, ConfigManager)
True
axisfuzzy.config.api.load_config_file(file_path)[source]

Load configuration from a JSON file and apply it.

Parameters:

file_path (str or pathlib.Path) – Path to a JSON configuration file.

Raises:
  • FileNotFoundError – If the given file does not exist.

  • ValueError – If the file is not valid JSON or contains invalid configuration values.

  • RuntimeError – For unexpected errors while reading or applying the file.

axisfuzzy.config.api.reset_config()[source]

Reset the active configuration to defaults.

This restores Config to its default state and clears any source metadata.

axisfuzzy.config.api.save_config_file(file_path)[source]

Save the current configuration to a JSON file.

Parameters:

file_path (str or pathlib.Path) – Path where the configuration will be saved. Parent directories will be created if necessary.

Raises:

RuntimeError – If writing the file fails.

axisfuzzy.config.api.set_config(**kwargs)[source]

Update multiple configuration entries.

Parameters:

**kwargs (Any) – Keyword arguments mapping configuration field names to new values. Field names must match the dataclass attributes defined in Config.

Raises:

ValueError – If an unknown configuration key is provided or validation fails.

Examples

>>> set_config(DEFAULT_PRECISION=6)