From 57a7da7d0dfd12c7156fe1aa980807e28d5b0492 Mon Sep 17 00:00:00 2001 From: CalvinKuo Date: Sun, 5 Jul 2026 04:16:32 +0800 Subject: [PATCH] clarify udf signature annotations --- CHANGELOG.md | 2 ++ docs/udf.rst | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25ad8d11f..14110e419 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Clarify UDF documentation on required function type annotations. ([#757](https://github.com/Open-EO/openeo-python-client/issues/757)) + ## [0.50.0] - 2026-05-18 ### Added diff --git a/docs/udf.rst b/docs/udf.rst index 75ffba82a..038f762ff 100644 --- a/docs/udf.rst +++ b/docs/udf.rst @@ -152,6 +152,26 @@ as defined in the :py:mod:`openeo.udf.udf_signatures` module, so that the back-end knows what the *entrypoint* function is of your UDF implementation. +The function name and Python type annotations are part of that signature: +they are used to detect how the UDF should be invoked. +Do not omit the type annotations on the UDF entrypoint, even if your editor +or linter would otherwise consider them optional. +For example, this is not enough: + +.. code-block:: python + + def apply_datacube(cube, context): + ... + +Instead, write the full annotated signature: + +.. code-block:: python + + import xarray + + def apply_datacube(cube: xarray.DataArray, context: dict) -> xarray.DataArray: + ... + Module ``openeo.udf.udf_signatures`` -------------------------------------