xarray-contrib / xeofs

Comprehensive EOF analysis in Python with xarray: A versatile, multidimensional, and scalable tool for advanced climate data analysis
https://xeofs.readthedocs.io/
MIT License
109 stars 20 forks source link

Avoid recreating API on every child model class #218

Open nicrie opened 2 months ago

nicrie commented 2 months ago

Looking again at the inheritance structure, I'm noticing we recreate the entire API on every child model class. This has the benefit of making the signature explicit and the auto built docstrings complete, but it also becomes a hassle to maintain such long argument lists. For example I also had to add verbose back to these classes to get the parameter serialization list complete.

An alternative is to only specify whatever new parameters are included on the child class and pass everything else to the parent with **kwargs, but this makes the signature less explicit. We could consider something like pydantic's BaseModel which I believe helps with this. Just something for future consideration.

_Originally posted by @slevang in https://github.com/xarray-contrib/xeofs/pull/196#discussion_r1739904352_

slevang commented 2 months ago

Looks like this might "just work" in the docs by adding autodoc_inherit_docstrings = True to the conf.py.