common.reflection.spec
spec_from_signature
def spec_from_signature(
f: AnyFun,
sig: Signature,
include_defaults: bool = True,
base: Type[BaseConfiguration] = BaseConfiguration
) -> Tuple[Type[BaseConfiguration], Dict[str, Any]]
Creates a SPEC on base base1 for a function
fwith signature
sig`.
All the arguments in sig
that are valid SPEC hints and have defaults will be part of the SPEC.
Special markers for required SPEC fields dlt.secrets.value
and dlt.config.value
are parsed using
module source code, which is a hack and will not work for modules not imported from a file.
The name of a SPEC type is inferred from qualname of f
and type will refer to f
module and is unique
for a module. NOTE: the SPECS are cached in the module by using name as an id.
Return value is a tuple of SPEC and SPEC fields created from a sig
.