lenskit.config ============== .. py:module:: lenskit.config .. autoapi-nested-parse:: LensKit general configuration Submodules ---------- .. autoapisummary:: lenskit.config.common .. toctree:: :hidden: :maxdepth: 1 /api/lenskit/config/common/index Classes ------- .. toctree:: :hidden: /api/lenskit/config/LenskitSettings /api/lenskit/config/MachineSettings /api/lenskit/config/ParallelSettings /api/lenskit/config/PowerQueries /api/lenskit/config/PrometheusSettings /api/lenskit/config/RandomSettings /api/lenskit/config/TuneSettings .. autoapisummary:: lenskit.config.LenskitSettings lenskit.config.MachineSettings lenskit.config.ParallelSettings lenskit.config.PowerQueries lenskit.config.PrometheusSettings lenskit.config.RandomSettings lenskit.config.TuneSettings Functions --------- .. autoapisummary:: lenskit.config.load_config_data lenskit.config.locate_configuration_root lenskit.config.lenskit_config lenskit.config.configure Package Contents ---------------- .. py:function:: load_config_data(path: pathlib.Path | os.PathLike[str], model: None = None) -> pydantic.JsonValue 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. :param path: The path to the configuration file. :param model: The Pydantic model class to validate. .. py:function:: 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``. .. py:function:: lenskit_config() Get the LensKit configuration. If no configuration has been specified, returns a default settings object. .. py:function:: configure(cfg_dir: pathlib.Path | None = None) -> _schema.LenskitSettings configure(cfg_dir: pathlib.Path | None = None, *, settings_cls: type[SettingsClass]) -> SettingsClass 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. :param cfg_dir: The directory in which to look for configuration files.. If not provided, uses the current directory. :param 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 ---------------- .. py:exception:: lenskit.config.ConfigWarning Re-exported alias for :py:exc:`lenskit.diagnostics.ConfigWarning`. .. py:function:: lenskit.config.get_logger Re-exported alias for :py:func:`lenskit.logging.get_logger`. .. py:function:: lenskit.config.init_global_rng Re-exported alias for :py:func:`lenskit.random.init_global_rng`.