soleil.loader.loader#
Functions
|
Creates a new package with root at the parent of the specified configuration path, and loads the specified configuration path as a module in that package. |
Classes
Loads solconf packages and applies CLI overrides. |
Exceptions
|
- exception soleil.loader.loader.UnusedOverrides(unused_ovrds, prefix='Unused overrides')#
Bases:
ValueError
- soleil.loader.loader.load_solconf(conf_path: str | Path, package_name=None, overrides: List[str | Dict[str, Any] | Override] | None = None, resolve=True, promoted=True, _var_path=[])#
Creates a new package with root at the parent of the specified configuration path, and loads the specified configuration path as a module in that package.
- Parameters:
conf_path – The path of the module to load.
package_name – The package name – defaults to a random string.
overrides – The overrides to apply when loading the module – these will be overriden by any package-level overrides specified when creating the pacakge.
(See
ConfigLoader.load()for the interpretation of parametersresolveandpromoted)
- class soleil.loader.loader.ConfigLoader#
Bases:
objectLoads solconf packages and applies CLI overrides.
See the documentation for
load_solconf().- modules: Dict[str, SolConfModule]#
Contains previously-loaded modules or package paths
- package_roots: Dict[str, Path]#
Contains the roots of solconf pacakges
- init_package(path: str | Path, name: str | None = None, overrides: List[str | Dict[str, Any] | Override] | None = None)#
Initializes a solconf package at the specified path and with the given name (random name by default).
- get_sub_module_path(abs_module_name, check_exists=True) Path#
Maps an absolute module name to a file path.
- load(abs_module_name: str, resolve: bool = True, promoted: bool = True, reqs: List[str | Dict[str, Any] | Override] | None = None, _var_path: str | None = None, _root_config: SolConfModule | None = None)#
- Parameters:
module_name – The absolute module name (e.g.,
package_name.sub_module_1.sub_module_2)resolve – Return the model’s resolved value if
True, otherwise the module itself.promoted – Whether to return the promoted member of teh full module. Only has an effect when
resolve=False.reqs – Default values for all
reqmembers provided as part of load/submodule within a solconf file._var_path – When loading a module from within another module, this will point to the variable/attribute name sequence relative to the root module. Used to apply overrides.
_root_config – The root configuration of the module being loaded. Root configurations are the starting point where variable paths are resolved from.