Skip to content

trudag.dotstop.core.reference.builder

Tools for managing the construction of BaseReference, whether they are built-in, locally-defined plugins or packaged plugins.

ReferenceBuilder

ReferenceBuilder(dir_path: Path | None = None)

Functionality for building References to Artifacts whose types are not known until runtime.

Create a map of Reference types to their implementation as subclasses of BaseReference. All derived subclasses of BaseReference are available when using this builder, including those provided by local and packaged plugins.

Local reference plugins are loaded from ./.dotstop_extensions/references.py.

Packaged plugins are identified by the presence of a trustable.reference.plugins entry point in their package metadata and imported as objects into the current module namespace.

build

build(
    reference_dict: dict[str, bool | int | float | str],
) -> BaseReference

Build a BaseReference subclass, inferring types from dictionary field type.

Parameters:

Name Type Description Default
reference_dict dict[str, bool | int | float | str]

Dictionary to be passed to BaseReference.from_dict.

required

is_concrete_subclass staticmethod

is_concrete_subclass(anything: Any, cls: type) -> bool

True if the provided object anything is a concrete subclass of cls.