lenskit.config#
LensKit general configuration
Submodules#
Mixins with commonly-used component configuration capabilities. |
Classes#
Definition of LensKit settings. |
|
Definition for a single machine. |
|
Configuration for LensKit's parallel processing. These settings are in the |
|
Queries for requesting power consumption data from Prometheus. |
|
Prometheus configuration settings. |
|
Random number generator configuration. |
|
LensKit hyperparameter tuning settings. |
Functions#
General-purpose function to automatically load configuration data and |
|
|
Search for a configuration root containing a |
Get the LensKit configuration. |
|
|
Initialize LensKit configuration. |
Package Contents#
- lenskit.config.load_config_data(path: pathlib.Path | os.PathLike[str], model: None = None) pydantic.JsonValue#
- lenskit.config.load_config_data(path: pathlib.Path | os.PathLike[str], model: type[M]) M
General-purpose function to automatically load configuration data and optionally validate with a model.
- Parameters:
path – The path to the configuration file.
model – The Pydantic model class to validate.
- lenskit.config.locate_configuration_root(*, cwd=None, abort_at_pyproject=True, abort_at_gitroot=True)#
Search for a configuration root containing a
lenskit.tomlfile.This searches for a
lenskit.tomlfile, beginning in the current working directory (or the alternatecwdif provided), and searching upward until one is found. Search stops if apyproject.tomlfile or.gitdirectory is found without encounteringlenskit.toml.- Parameters:
cwd (pathlib.Path | str | os.PathLike[str] | None)
abort_at_pyproject (bool)
abort_at_gitroot (bool)
- Return type:
pathlib.Path | None
- lenskit.config.lenskit_config()#
Get the LensKit configuration.
If no configuration has been specified, returns a default settings object.
- Return type:
- lenskit.config.configure(cfg_dir: pathlib.Path | None = None) _schema.LenskitSettings#
- lenskit.config.configure(cfg_dir: pathlib.Path | None = None, *, settings_cls: type[SettingsClass]) SettingsClass
- lenskit.config.configure(settings: _schema.LenskitSettings, /) _schema.LenskitSettings
Initialize LensKit configuration.
LensKit does not automatically read configuration files — if this function is never called, then configuration will entirely be done through defaults and environment varibles.
This function will automatically configure the global RNG, if a seed is specified. It does not configure logging.
- Parameters:
cfg_dir – The directory in which to look for configuration files.. If not provided, uses the current directory.
settings_cls – The base LensKit settings class. Rarely used, only needed if a project wants to to extend LensKit settings with their own settings.
- Returns:
The configured LensKit settings.
Exported Aliases#
- exception lenskit.config.ConfigWarning#
Re-exported alias for
lenskit.diagnostics.ConfigWarning.
- lenskit.config.get_logger()#
Re-exported alias for
lenskit.logging.get_logger().
- lenskit.config.init_global_rng()#
Re-exported alias for
lenskit.random.init_global_rng().