PublicAPI#

ray.util.annotations.PublicAPI(obj: F) → F[source]#
ray.util.annotations.PublicAPI(*, stability: str = 'stable', api_group: str = 'Others') → Callable[[F], F]

Annotation for documenting public APIs.

Public APIs are classes and methods exposed to end users of Ray.

If stability="alpha", the API can be used by advanced users who are tolerant to and expect breaking changes.

If stability="beta", the API is still public and can be used by early users, but are subject to change.

If stability="stable", the APIs will remain backwards compatible across minor Ray releases (e.g., Ray 1.4 -> 1.8).

For a full definition of the stability levels, please refer to the Ray API Stability definitions.

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

  • **kwargs – Supported keyword arguments are stability (one of "stable", "beta", "alpha") and api_group (used only for doc rendering; APIs in the same group are grouped together in the API doc pages).

Returns:

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

Examples

>>> from ray.util.annotations import PublicAPI
>>> @PublicAPI
... def func(x):
...     return x
>>> @PublicAPI(stability="beta")
... def func(y):
...     return y