wauth.deprecation module
Deprecation utilities for WAuth.
Provides a decorator and helper functions to mark deprecated APIs
with proper warnings, enabling graceful migration across versions.
-
wauth.deprecation.deprecated(since, removal, replacement=None, reason='')[source]
Mark a function or method as deprecated.
Emits a DeprecationWarning on first use and logs the deprecation
via loguru.
- Parameters:
since (str) – Version when the deprecation was introduced (e.g., "1.6.0").
removal (str) – Version when the API will be removed (e.g., "2.0.0").
replacement (str | None) – Name of the replacement API, if any.
reason (str) – Additional explanation for the deprecation.
- Returns:
Decorated function that emits a warning on invocation.
- Return type:
Callable[[T], T]
Example
>>> @deprecated(since="1.6.0", removal="2.0.0", replacement="get_secret")
... def old_method():
... pass
-
wauth.deprecation.warn_deprecated(name, since, removal, replacement=None)[source]
Emit a deprecation warning without a decorator.
Useful for code paths that cannot be decorated (e.g., inside
conditional branches).
- Parameters:
name (str) – Name of the deprecated element.
since (str) – Version when the deprecation was introduced.
removal (str) – Version when it will be removed.
replacement (str | None) – Name of the replacement, if any.