pastas.decorators.PastasDeprecationWarning#

pastas.decorators.PastasDeprecationWarning(version: str, reason: str = '') Any#

Provide a warning or error when a Pastas class, method or function is deprecated.

This decorator manages deprecation of classes, functions, or methods across Pastas versions. The behavior depends on the current version:

  • If current version < version: logs a warning and allows execution to continue

  • If current version >= version: raises AttributeError which indicates

that it can be removed from the codebase entirely in the (near) future.

Parameters:
  • version (str) – The version in which the function, method or class raises an AttributeError.

  • reason (str, optional) – The reason why the function or class is deprecated, or a message directing users to an alternative. Default is an empty string.

Returns:

A decorator that wraps the target class or function.

Return type:

callable