oso.framework.config package

Subpackages

Module contents

Configuration Management.

class oso.framework.config.AutoLoadConfig[source]

Bases: BaseModel, ABC

Config that is registered on import.

A configuration model that will be automatically registered with .ConfigManager when imported.

__config_prefix__

If set to an empty string, the configuration model’s fields will be added to the root model. Otherwise, the configuration model will be added to the root model under this value, merged with other configuration models with the same value.

Type:

ClassVar`[str]

oso.framework.config.ImportListMixin(fields: Mapping[str, type[ImportableConfig]]) type[_ImportList][source]

Define a mixin that adds fields into the config model.

Parameters:

fields (collections.abc.Mapping[str, type[ImportableConfig]]) – A mapping of field names to subclass of ImportableConfig to be included in the concrete class.

Returns:

A concrete type.

Return type:

type[‘_ImportList’]

Examples

The following:

class A(ImportableConfig): pass

class B(ImportListMixin({"a": A})): pass

Equates to:

class A:
    type: ImportString

class B:
    __importable_fields_map__ = { "a": A }
    a: A
class oso.framework.config.ImportableConfig(*, type: ImportString)[source]

Bases: BaseModel, ABC

Config object that defines an type import.

Defines an configuration model that is importable with additional configuration fields. This is resolved to a fully discriminated type when configuration is rendered.

__importable_subclasses__

A set of classes that subclass this.

Type:

ClassVar[set[type[Any]]]

type

The module that is required.

Type:

pydantic.ImportString