harp.config.configurables¶
- class Configurable[source]¶
Bases:
BaseConfigurable
A settings definition base.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class LazyService[source]¶
Bases:
BaseConfigurable
A lazy service definition, that will be resolved at runtime.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- resolve(resolver, context)[source]¶
Resolve reference value in using the given resolver (callable) and resolution context.
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'type': FieldInfo(annotation=Union[str, list[str]], required=True, description='Reference to the service to resolve at runtime.')}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class Service[source]¶
Bases:
BaseConfigurable
A settings base class for service definitions.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- to_service_definition(name, lifestyle='singleton')[source]¶
Convert the service settings to a service definition.
- Parameters:
- Return type:
- base: str | None¶
Base type for service definition. This is not usually the base interface that the service implements, and you should use the type field to override the actually instanciated type.
- constructor: str | None¶
Constructor for service definition. If provided, will be used instead of the default constructor.
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'arguments': FieldInfo(annotation=Union[dict, NoneType], required=False, default_factory=dict, description='Arguments for the service constructor.'), 'base': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='Base type for service definition.'), 'constructor': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='Optional custom constructor for the service.'), 'type': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='Type for service definition.')}¶
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- class Stateful[source]¶
Bases:
BaseConfigurable
,Generic
[TSettings
]A base class for stateful objects that are related to a settings class. Usually, it’s used for live status of settings-defined objects, that may vary over time. It allows to separate the concerns of the imuatable, environment-provided settings, and the mutable, runtime-related state of the object.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].