pydata / xarray

N-D labeled arrays and datasets in Python
https://xarray.dev
Apache License 2.0
3.63k stars 1.09k forks source link

Typing annotations for arithmetic overrides (e.g., DataArray + Dataset) #9688

Closed shoyer closed 3 weeks ago

shoyer commented 3 weeks ago

This change explicitly adds annotations for arithmetic like DataArray + Dataset in _typed_ops.py.

To test this, I've updated mypy on GitHub actions to use Python 3.12

Note: I've added a dependency on jinja2, a standard Python templating engine. It is only required for manually regenerating typed operations, which should impact only a handful of xarray developers.

shoyer commented 3 weeks ago

Any chance we can add jinja2 to the dev dependencies in pyproject.toml? Or I can do it at some point. (and if we have an equivalent for conda). That way, our instructions for generating these remain valid.

Done!