windlass.interfaces.base¶
base
¶
The base every Windlass component shares.
:class:Component gives all thirteen component kinds the same three things:
- Identity — a
nameused in traces, errors and registry lookups. - Configuration — a validated
configmapping, echoed inreprand traces so a misbehaving pipeline is debuggable from its logs alone. - Native access (Level 3) — :meth:
Component.nativehands back the underlying SDK object. Windlass simplifies libraries; it never hides them.
Subclasses implement async methods. The sync variants are derived once, here and in each interface, so the two APIs can never drift.
SupportsNative
¶
Bases: ABC
Mixin declaring the Level 3 escape hatch.
Any adapter wrapping a third-party object should return it from
:meth:native so advanced users can reach past Windlass without forking it.
native
abstractmethod
¶
Return the underlying provider object.
Returns:
| Type | Description |
|---|---|
Any
|
The wrapped SDK client, index, graph or handle. Adapters with no |
Any
|
third-party object behind them return |
Example
from windlass.providers.llm.fake import FakeLLM FakeLLM().native() is not None True
Source code in src\windlass\interfaces\base.py
Component
¶
Bases: SupportsNative
Abstract base for every registrable Windlass component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Identifier used in traces and error messages. Defaults to the class's registered name, or its class name. |
None
|
**config
|
Any
|
Arbitrary component configuration, kept on :attr: |
{}
|
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The component's identifier. |
|
config |
dict[str, Any]
|
The configuration it was constructed with. |
Example
class Upper(Component): ... def apply(self, text: str) -> str: ... return text.upper() Upper(name="upper").name 'upper'
Source code in src\windlass\interfaces\base.py
option
¶
Read a configuration value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Configuration key. |
required |
default
|
Any
|
Returned when the key is absent. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The configured value or |
Source code in src\windlass\interfaces\base.py
require_option
¶
Read a configuration value that must be present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Configuration key. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The configured value. |
Raises:
| Type | Description |
|---|---|
ConfigurationError
|
When the key is missing or |
Source code in src\windlass\interfaces\base.py
with_config
¶
Return a new component of the same type with merged configuration.
Components are treated as immutable once built; reconfiguring produces a copy so a shared component cannot be mutated out from under another pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**overrides
|
Any
|
Configuration to merge over the current values. |
{}
|
Returns:
| Type | Description |
|---|---|
Component
|
A new instance of the same class. |
Source code in src\windlass\interfaces\base.py
aclose
async
¶
Release resources held by the component.
The default is a no-op. Adapters holding sockets, file handles or thread pools should override it. Safe to call more than once.
close
¶
native
¶
Return the wrapped provider object.
The default returns self, which is correct for pure-Python
components that wrap nothing.
describe
¶
Return a JSON-safe summary of this component.
Used by tracing, by Pipeline.describe() and by the CLI.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dict with |