Base interfaces and metaclasses for implementation plug-ins.
This module defines
- Impl: Marker base for concrete implementation backends.
- ImplClientMeta: Metaclass that aggregates and propagates required operation names.
- ImplClient: Mixin for objects using implementations to declare/query required operations.
Impl
Marker base class for concrete implementation backends.
ImplClient
Client-side mixin for declaring and checking required operations.
Clients refer to objects that use an implementation backend. ImplClient ensures to list the names of operations they need the implementation to provide via the class attribute require. This mixin offers methods to: - report which operations are missing on a given Impl - test if an implementation satisfies all requirements - extend or inherit requirement sets dynamically
add_requirements(funcnames)
Add function names to the set of required operations.
inherit_requirements(*others)
Merge requirement sets from other ImplClient-like classes.
is_supported(impl)
classmethod
Return True if impl provides all operations listed in require.
missing_ops(impl)
classmethod
Return the names of required operations not found on impl.
ImplClientMeta
Bases: type
Metaclass that aggregates required operation names across inheritance.
Classes using this metaclass can declare a tuple[str, ...] in require. During class creation, this metaclass unions all require tuples found in the base classes (that also use ImplClientMeta) with the one declared on the subclass, storing the result back into require.