Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid recreating API on every child model class #218

Open
nicrie opened this issue Sep 5, 2024 · 1 comment
Open

Avoid recreating API on every child model class #218

nicrie opened this issue Sep 5, 2024 · 1 comment

Comments

@nicrie
Copy link
Contributor

nicrie commented Sep 5, 2024

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 #196 (comment)

@slevang
Copy link
Contributor

slevang commented Sep 5, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants