fleche.config

Configuration system for fleche.

Example cache.toml:

[default] cache = “mycache” metadata = [“Runtime”, “CallInfo”]

[mycache] values.type = “Memory” calls.type = “Memory”

[transient] values.type = “CloudpickleFile” values.root = “.fleche/values” calls.type = “CloudpickleFile” calls.root = “.fleche/calls”

[global] values.type = “BagOfHoldingH5File” values.root = “~/.fleche/values” calls.type = “CloudpickleFile” calls.root = “~/.fleche/calls”

Attributes

logger

_live_caches

Functions

_load_config(→ dict[str, Any])

_get_config_path(→ pathlib.Path | None)

load_default_metadata()

Load the default metadata from the configuration file.

storage_from_config(→ fleche.storage.Storage)

Construct a Storage from a config dict.

_get_storage(→ fleche.storage.Storage)

Deprecated: use storage_from_config() instead.

storage_to_config(→ dict[str, Any])

Convert a Storage instance to a config dict (inverse of _get_storage).

_create_cache(→ fleche.caches.Cache)

load_cache_config(→ fleche.caches.Cache)

Load a cache from the configuration file.

Module Contents

fleche.config.logger[source]
fleche.config._live_caches: dict[str, fleche.caches.Cache][source]
fleche.config._load_config(path: pathlib.Path) dict[str, Any][source]
fleche.config._get_config_path() pathlib.Path | None[source]
fleche.config.load_default_metadata()[source]

Load the default metadata from the configuration file.

fleche.config.storage_from_config(d: dict[str, Any]) fleche.storage.Storage[source]

Construct a Storage from a config dict.

The dict must contain a "type" key (case-sensitive) and any additional parameters required by that storage backend. The input dict is not mutated.

Supported types: "Memory", "Void", "DestructuringStorage", "PickleFile", "CloudpickleFile", "DillFile", "BagOfHoldingH5File", "Sql".

fleche.config._get_storage(config: dict[str, Any]) fleche.storage.Storage[source]

Deprecated: use storage_from_config() instead.

fleche.config.storage_to_config(s: fleche.storage.Storage) dict[str, Any][source]

Convert a Storage instance to a config dict (inverse of _get_storage).

The returned dict contains a "type" key and any additional parameters needed to reconstruct the storage via _get_storage(). DestructuringStorage is handled as a first-class case, producing a nested "storage" entry for its inner backend.

fleche.config._create_cache(cache_config: dict[str, Any]) fleche.caches.Cache[source]
fleche.config.load_cache_config(name: str | None = None) fleche.caches.Cache[source]

Load a cache from the configuration file.

If name is None, the default cache is loaded. The names ‘memory’ and ‘void’ are special-cased to return a transient in-memory cache and a no-op cache respectively.

Note: The Tags metadata cannot be configured from the config file.