Skip to content

ServiceCollection API

wd.di.service_collection.ServiceCollection

Bases: Generic[T]

Collects :class:~wd.di.descriptors.ServiceDescriptor objects and builds a provider.

add_instance(service_type, instance)

Register an already‑constructed singleton instance.

configure(options_type, *, section=None)

Bind options_type from the shared :pydata:IConfiguration instance.

services.configure(MySettings) automatically registers Options[MySettings] as a singleton whose value is built by binding MySettings against the configuration tree at provider‑build time.