lenskit.config#

LensKit general configuration

Submodules#

common

Mixins with commonly-used component configuration capabilities.

Functions#

lenskit_config()

Get the LensKit configuration.

configure(…)

Initialize LensKit configuration.

locate_configuration_root(*[, cwd, ...])

Search for a configuration root containing a lenskit.toml file.

Package Contents#

lenskit.config.lenskit_config()#

Get the LensKit configuration.

If no configuration has been specified, returns a default settings object.

Return type:

lenskit.schemas.settings.LenskitSettings

lenskit.config.configure(cfg_dir: pathlib.Path | None = None) lenskit.schemas.settings.LenskitSettings#
lenskit.config.configure(cfg_dir: pathlib.Path | None = None, *, settings_cls: type[SettingsClass]) SettingsClass
lenskit.config.configure(settings: lenskit.schemas.settings.LenskitSettings, /) lenskit.schemas.settings.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 variables.

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.

lenskit.config.locate_configuration_root(*, cwd=None, abort_at_pyproject=True, abort_at_gitroot=True)#

Search for a configuration root containing a lenskit.toml file.

This searches for a lenskit.toml file, beginning in the current working directory (or the alternate cwd if provided), and searching upward until one is found. Search stops if a pyproject.toml file or .git directory is found without encountering lenskit.toml.

Parameters:
Return type:

pathlib.Path | None

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().

class lenskit.config.LenskitSettings#

Re-exported alias for lenskit.schemas.settings.LenskitSettings.

class lenskit.config.MachineSettings#

Re-exported alias for lenskit.schemas.settings.MachineSettings.

class lenskit.config.ParallelSettings#

Re-exported alias for lenskit.schemas.settings.ParallelSettings.

class lenskit.config.PowerQueries#

Re-exported alias for lenskit.schemas.settings.PowerQueries.

class lenskit.config.PrometheusSettings#

Re-exported alias for lenskit.schemas.settings.PrometheusSettings.

class lenskit.config.RandomSettings#

Re-exported alias for lenskit.schemas.settings.RandomSettings.

class lenskit.config.TuneSettings#

Re-exported alias for lenskit.schemas.settings.TuneSettings.