arviz-devs / arviz

Exploratory analysis of Bayesian models with Python
https://python.arviz.org
Apache License 2.0
1.56k stars 388 forks source link

Doc strings for InferenceData methods generated by `_extend_xr_method` are missing #2257

Closed astoeriko closed 1 year ago

astoeriko commented 1 year ago

Many xarray methods can be called directly on InferenceData objects, applying them to all or a selection of groups. Inspecting the code, I see that they are automatically generated with _extend_xr_method. These functions do not seem to have a doc string, and documentation is also missing in the HTML version of the API reference, see for example assign_coords. As far as I see, these functions should have an automatically generated doc string that refers to the original xarray function and documents the groups, filter_groups and in_place keyword arguments. Currently, it is not obvious that the functions even have these keyword arguments, because they do not show up in the function signature either.

To Reproduce

This is what the doc string looks like for me (output of az.InferenceData.assign_coords? in jupyter):

Signature:
az.InferenceData.assign_coords(
    self: 'T_DataWithCoords',
    coords: 'Mapping[Any, Any] | None' = None,
    **coords_kwargs: 'Any',
) -> 'T_DataWithCoords'
File:      ~/mambaforge/envs/pymc/lib/python3.10/site-packages/xarray/core/common.py
Type:      function

Expected behavior The automatically generated docstring shows up both in the HTML documentation and in the doc string shown in jupyter or with help.

Additional context I am using ArviZ version 0.15.1.

OriolAbril commented 1 year ago

https://github.com/arviz-devs/arviz/pull/2263 should fix it. Can you double check everything does indeed look as expected? There is a link to the docs preview in the PR description

astoeriko commented 1 year ago

It looks as expected now on the docs page linked in the PR and also in a python console if I check out the branch. Thanks for fixing this.