Skip to content

Commit c233a50

Browse files
reint-fischerreint-fischer
authored andcommitted
restructure API pages to have classes on separate pages
1 parent 3aa1037 commit c233a50

5 files changed

Lines changed: 103 additions & 7 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{% if obj.display %}
2+
{% if is_own_page %}
3+
{{ obj.id }}
4+
{{ "=" * obj.id | length }}
5+
{% endif %}
6+
{% set visible_children = obj.children|selectattr("display")|list %}
7+
{% set own_page_children = visible_children|selectattr("type", "in", own_page_types)|list %}
8+
{% if is_own_page and own_page_children %}
9+
.. toctree::
10+
:hidden:
11+
{% for child in own_page_children %}
12+
{{ child.include_path }}
13+
{% endfor %}
14+
{% endif %}
15+
.. py:{{ obj.type }}:: {% if is_own_page %}{{ obj.id }}{% else %}{{ obj.short_name }}{% endif %}{% if obj.args %}({{ obj.args }}){% endif %}
16+
17+
{% for (args, return_annotation) in obj.overloads %}
18+
{{ " " * (obj.type | length) }} {{ obj.short_name }}{% if args %}({{ args }}){% endif %}
19+
20+
{% endfor %}
21+
{% if obj.bases %}
22+
{% if "show-inheritance" in autoapi_options %}
23+
24+
Bases: {% for base in obj.bases %}{{ base|link_objs }}{% if not loop.last %}, {% endif %}{% endfor %}
25+
{% endif %}
26+
{% if "show-inheritance-diagram" in autoapi_options and obj.bases != ["object"] %}
27+
.. autoapi-inheritance-diagram:: {{ obj.obj["full_name"] }}
28+
:parts: 1
29+
{% if "private-members" in autoapi_options %}
30+
:private-bases:
31+
{% endif %}
32+
33+
{% endif %}
34+
{% endif %}
35+
{% if obj.docstring %}
36+
{{ obj.docstring|indent(3) }}
37+
{% endif %}
38+
{% for obj_item in visible_children %}
39+
{% if obj_item.type not in own_page_types %}
40+
{{ obj_item.render()|indent(3) }}
41+
{% endif %}
42+
{% endfor %}
43+
{% if is_own_page and own_page_children %}
44+
{% set visible_methods = visible_children|selectattr("type", "equalto", "method")|list %}
45+
{% if visible_methods %}
46+
Methods
47+
-------
48+
49+
.. autoapisummary::
50+
51+
{% for method in visible_methods %}
52+
{{ method.id }}
53+
{% endfor %}
54+
55+
56+
{% endif %}
57+
{% set visible_attributes = visible_children|selectattr("type", "equalto", "attribute")|list %}
58+
{% if visible_attributes %}
59+
Attributes
60+
----------
61+
62+
.. autoapisummary::
63+
64+
{% for attribute in visible_attributes %}
65+
{{ attribute.id }}
66+
{% endfor %}
67+
68+
69+
{% endif %}
70+
{% set visible_exceptions = own_page_children|selectattr("type", "equalto", "exception")|list %}
71+
{% if visible_exceptions %}
72+
Exceptions
73+
----------
74+
75+
.. autoapisummary::
76+
77+
{% for exception in visible_exceptions %}
78+
{{ exception.id }}
79+
{% endfor %}
80+
81+
82+
{% endif %}
83+
{% set visible_classes = own_page_children|selectattr("type", "equalto", "class")|list %}
84+
{% if visible_classes %}
85+
Classes
86+
-------
87+
88+
.. autoapisummary::
89+
90+
{% for klass in visible_classes %}
91+
{{ klass.id }}
92+
{% endfor %}
93+
{% endif %}
94+
{% endif %}
95+
{% endif %}

docs/_autoapi_templates/python/module.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Submodules
7373

7474
.. toctree::
7575
:caption: Submodules
76-
:ma: 1
76+
:maxdepth: 1
7777

7878
{% for submodule in visible_submodules %}
7979
{{ submodule.include_path }}
@@ -153,4 +153,4 @@ Functions
153153
{{ obj_item.render()|indent(3) }}
154154
{% endfor %}
155155
{% endif %}
156-
{% endif %}
156+
{% endif %}

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,16 @@ def linkcode_resolve(domain, info):
533533

534534
# -- Options for autoapi --------------------------------------------------
535535
autoapi_dirs = ["../src/parcels"]
536-
autoapi_add_toctree_entry = False
536+
# autoapi_add_toctree_entry = False
537537
autoapi_root = "reference"
538538
autoapi_options = [
539539
"members",
540540
# "show-inheritance",
541-
# "undoc-members",
541+
"undoc-members",
542542
"show-module-summary",
543543
"imported-members",
544544
]
545545
autoapi_member_order = "bysource"
546-
autodoc_typehints = "signature"
546+
autodoc_typehints = "none"
547547
autoapi_template_dir = "_autoapi_templates"
548548
autoapi_own_page_level = "class"

src/parcels/_core/basegrid.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class GridType(IntEnum):
2222

2323

2424
class BaseGrid(ABC):
25+
"""Docstring for Basegrid class"""
2526
@abstractmethod
2627
def search(self, z: float, y: float, x: float, ei=None) -> dict[str, tuple[int, float | np.ndarray]]:
2728
"""

src/parcels/_core/fieldset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class FieldSet:
5151
to and what parent model the field is associated with. Parcels uses this metadata
5252
during execution for interpolation. Each `UXDataArray.attributes` field dictionary
5353
must have:
54-
* "location" key set to "face", "node", or "edge" to define which pairing of points a field is associated with.
55-
* "mesh" key to define which parent model the fields are associated with (e.g. "fesom_mesh", "icon_mesh")
54+
* "location" key set to "face", "node", or "edge" to define which pairing of points a field is associated with.
55+
* "mesh" key to define which parent model the fields are associated with (e.g. "fesom_mesh", "icon_mesh")
5656
5757
"""
5858

0 commit comments

Comments
 (0)