Deprecated#

ray.util.annotations.Deprecated(obj: F) → F[source]#
ray.util.annotations.Deprecated(*, message: str = ..., warning: bool = False) → Callable[[F], F]

Annotation for documenting a deprecated API.

Deprecated APIs may be removed in future releases of Ray.

Parameters:
  • *args – When used as a bare @Deprecated decorator, contains the wrapped function or class as the single positional argument.

  • **kwargs – Supported keyword arguments are message (a string to help users understand the reason for the deprecation and provide a migration path) and warning (whether to also emit a RayDeprecationWarning at runtime; defaults to False).

Returns:

Either the annotated object (when used as @Deprecated) or a decorator that annotates an object (when used as @Deprecated(...)).

Examples

>>> from ray.util.annotations import Deprecated
>>> @Deprecated
... def func(x):
...     return x
>>> @Deprecated(message="g() is deprecated because the API is error "
...   "prone. Please call h() instead.")
... def g(y):
...     return y