GridTools / gt4py

Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL).
https://GridTools.github.io/gt4py
Other
106 stars 48 forks source link

feat[next]: better wrap decorated program and field_operator #1603

Open havogt opened 1 month ago

havogt commented 1 month ago

Just an idea to eventually get autodoc work for GT4Py programs.

Maybe the cleaner way would be to add in indirection in the decorators and wrap them.

We still seem to have this issue https://github.com/sphinx-doc/sphinx/issues/10221, which could be worked-around with something like https://docs.celeryq.dev/en/latest/_modules/celery/contrib/sphinx.html.

DropD commented 2 weeks ago

The current failures on CI are because FieldOperatorFromPast inherits __post_init__ from FieldOperator, but has .definition set to None. Either _frozen_update_wrapper() should be called inside .from_function, guaranteeing it is only called when there is actually a function or FieldOperatorFromPast will have to override .__post_init__ to do everything the superclass does except the _frozen_update_wrapper() call.

havogt commented 2 weeks ago

TODO check this https://stackoverflow.com/questions/78802585/abbreviating-dataclass-decorator-without-losing-intellisense