Skip to content

deprecated

deprecated(deprecated_in, removed_in, help_message=None)

Mark functions as deprecated.

Adding this will result in a warning being emitted when the function is used.

Source code in pyiceberg/utils/deprecated.py
def deprecated(deprecated_in: str, removed_in: str, help_message: Optional[str] = None) -> Callable:  # type: ignore
    """Mark functions as deprecated.

    Adding this will result in a warning being emitted when the function is used.
    """
    if help_message is not None:
        help_message = f" {help_message}."

    def decorator(func: Callable):  # type: ignore
        @functools.wraps(func)
        def new_func(*args: Any, **kwargs: Any) -> Any:
            message = f"Call to {func.__name__}, deprecated in {deprecated_in}, will be removed in {removed_in}.{help_message}"

            _deprecation_warning(message)

            return func(*args, **kwargs)

        return new_func

    return decorator

deprecation_message(deprecated_in, removed_in, help_message)

Mark properties or behaviors as deprecated.

Adding this will result in a warning being emitted.

Source code in pyiceberg/utils/deprecated.py
def deprecation_message(deprecated_in: str, removed_in: str, help_message: Optional[str]) -> None:
    """Mark properties or behaviors as deprecated.

    Adding this will result in a warning being emitted.
    """
    _deprecation_warning(deprecation_notice(deprecated_in, removed_in, help_message))

deprecation_notice(deprecated_in, removed_in, help_message)

Return a deprecation notice.

Source code in pyiceberg/utils/deprecated.py
def deprecation_notice(deprecated_in: str, removed_in: str, help_message: Optional[str]) -> str:
    """Return a deprecation notice."""
    return f"Deprecated in {deprecated_in}, will be removed in {removed_in}. {help_message}"