dlt.common.warnings
DltDeprecationWarning Objects
class DltDeprecationWarning(DeprecationWarning)
A dlt specific deprecation warning.
This warning is raised when using deprecated functionality in dlt. It provides information on when the deprecation was introduced and the expected version in which the corresponding functionality will be removed.
Attributes:
message- Description of the warning.since- Version in which the deprecation was introduced.expected_due- Version in which the corresponding functionality is expected to be removed.
TNoExtraKwargs Objects
class TNoExtraKwargs(typing_extensions.TypedDict)
Empty schema for a **kwargs that only collects deprecated argument names.
SkipDeprecation Objects
class SkipDeprecation()
Sentinel returned by a Deprecated.convert to write nothing to the replacement field.
Deprecated Objects
class Deprecated()
Marks a deprecation-schema field as deprecated in favor of maps_to.
Used inside Annotated[<old value type>, Deprecated(...)] in a deprecation schema
consumed by apply_deprecations.
Arguments:
maps_tostr - Name of the replacement field the old value is written to.convertCallable[[Any], Any] - Maps the old value to the replacement value. ReturnSkipDeprecationto write nothing. Defaults to identity.messageOptional[str] - Custom deprecation message. Defaults to a generated one.sinceOptional[VersionString] - Version the field was deprecated in. Overrides the default passed toapply_deprecations.expected_dueOptional[VersionString] - Version the field is removed in.
apply_deprecations
def apply_deprecations(deprecation_spec: typing.Type[_TypedDict],
doc: DictStrAny,
*,
path: str = ".",
since: typing.Optional[VersionString] = None,
expected_due: typing.Optional[VersionString] = None,
warn: bool = True,
remove: bool = True,
prefer_new: bool = True,
stacklevel: int = 2) -> DictStrAny
Convert deprecated keys in doc to their replacements declared in deprecation_spec.
For every Annotated[..., Deprecated(...)] field of deprecation_spec present in doc:
emits a DltDeprecationWarning (unless warn is False), runs the marker's convert,
writes the result under Deprecated.maps_to, and drops the old key (unless remove is
False). A field typed as a nested deprecation TypedDict migrates its sub-document
recursively. Mutates doc in place and returns it.
Arguments:
deprecation_spec_Type[TypedDict] - TypedDict whose keys are deprecated field names.docDictStrAny - Dictionary to migrate in place.pathstr - Location label used in the warning message.sinceOptional[VersionString] - Default deprecation version for fields without one.expected_dueOptional[VersionString] - Default removal version.warnbool - EmitDltDeprecationWarningfor each converted field.removebool - Drop the old key after conversion.prefer_newbool - When both old and replacement keys are present, keep the replacement.stacklevelint -warnings.warnstacklevel, points at the caller's caller by default.
Returns:
DictStrAny- The samedoc, mutated.