Skip to content

Commit 26209ef

Browse files
committed
Restructure and simplify API doc generation
* use flat structure for each module, do not nest classes in separate files * remove unused templates * fix whitespace problems This gives a considerable speed-up, achieving now normal durations around five minutes.
1 parent d367cfd commit 26209ef

File tree

7 files changed

+97
-158
lines changed

7 files changed

+97
-158
lines changed

bayesflow/utils/serialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def deserialize_value_or_type(config, name):
6666
6767
See Also
6868
--------
69-
`serialize_value_or_type`
69+
serialize_value_or_type
7070
"""
7171
updated_config = config.copy()
7272
if f"{PREFIX}{name}_type" in config:

docsrc/source/_templates/custom-base-template.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

docsrc/source/_templates/custom-class-template.rst

Lines changed: 0 additions & 32 deletions
This file was deleted.

docsrc/source/_templates/custom-module-template.rst

Lines changed: 58 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,61 @@
22

33
.. automodule:: {{ fullname }}
44

5-
{% block attributes %}
6-
{% if attributes %}
7-
.. rubric:: Module Attributes
8-
9-
.. autosummary::
10-
:toctree:
11-
{% for item in attributes %}
12-
{{ item }}
13-
{%- endfor %}
14-
{% endif %}
15-
{% endblock %}
16-
17-
{% block functions %}
18-
{% if functions %}
19-
.. rubric:: {{ _('Functions') }}
20-
21-
.. autosummary::
22-
:toctree:
23-
{% for item in functions %}
24-
{{ item }}
25-
{%- endfor %}
26-
{% endif %}
27-
{% endblock %}
28-
29-
{% block classes %}
30-
{% if classes %}
31-
.. rubric:: {{ _('Classes') }}
32-
33-
.. autosummary::
34-
:toctree:
35-
:template: custom-class-template.rst
36-
{% for item in classes %}
37-
{{ item }}
38-
{%- endfor %}
39-
{% endif %}
40-
{% endblock %}
41-
42-
{% block exceptions %}
43-
{% if exceptions %}
44-
.. rubric:: {{ _('Exceptions') }}
45-
46-
.. autosummary::
47-
:toctree:
48-
{% for item in exceptions %}
49-
{{ item }}
50-
{%- endfor %}
51-
{% endif %}
52-
{% endblock %}
53-
54-
{% block modules %}
55-
{% if modules %}
56-
.. rubric:: Modules
57-
58-
.. autosummary::
59-
:toctree:
60-
:template: custom-module-template.rst
61-
:recursive:
62-
{% for item in modules %}
63-
{{ item }}
64-
{%- endfor %}
65-
66-
.. rubric:: Submodules
67-
.. toctree::
68-
:maxdepth: 1
69-
:titlesonly:
70-
{% for item in modules %}
71-
{{ item }}
72-
{%- endfor %}
73-
74-
{% endif %}
75-
{% endblock %}
5+
{% block attributes %}
6+
{% if attributes %}
7+
.. rubric:: Module Attributes
8+
9+
.. autosummary::
10+
{% for item in attributes %}
11+
{{ item }}
12+
{%- endfor %}
13+
{% endif %}
14+
{% endblock %}
15+
16+
{% block functions %}
17+
{% if functions %}
18+
.. rubric:: {{ _('Functions') }}
19+
20+
.. autosummary::
21+
{% for item in functions %}
22+
{{ item }}
23+
{%- endfor %}
24+
{% endif %}
25+
{% endblock %}
26+
27+
{% block classes %}
28+
{% if classes %}
29+
.. rubric:: {{ _('Classes') }}
30+
31+
.. autosummary::
32+
{% for item in classes %}
33+
{{ item }}
34+
{%- endfor %}
35+
{% endif %}
36+
{% endblock %}
37+
38+
{% block exceptions %}
39+
{% if exceptions %}
40+
.. rubric:: {{ _('Exceptions') }}
41+
42+
.. autosummary::
43+
{% for item in exceptions %}
44+
{{ item }}
45+
{%- endfor %}
46+
{% endif %}
47+
{% endblock %}
48+
49+
{% block modules %}
50+
{% if modules %}
51+
.. rubric:: Modules
52+
53+
.. autosummary::
54+
:toctree:
55+
:template: custom-module-template.rst
56+
:recursive:
57+
{% for item in modules %}
58+
{{ item }}
59+
{%- endfor %}
60+
61+
{% endif %}
62+
{% endblock %}

docsrc/source/api/bayesflow.rst

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,15 @@ Autosummary
1111
:template: custom-module-template.rst
1212
:recursive:
1313

14-
bayesflow.adapters
15-
bayesflow.approximators
16-
bayesflow.benchmarks
17-
bayesflow.datasets
18-
bayesflow.diagnostics
19-
bayesflow.distributions
20-
bayesflow.metrics
21-
bayesflow.networks
22-
bayesflow.simulators
23-
bayesflow.types
24-
bayesflow.utils
25-
bayesflow.workflows
26-
27-
28-
Submodules
29-
----------
30-
31-
.. toctree::
32-
:maxdepth: 2
33-
34-
bayesflow.adapters
35-
bayesflow.approximators
36-
bayesflow.benchmarks
37-
bayesflow.datasets
38-
bayesflow.diagnostics
39-
bayesflow.distributions
40-
bayesflow.metrics
41-
bayesflow.networks
42-
bayesflow.simulators
43-
bayesflow.types
44-
bayesflow.utils
45-
bayesflow.workflows
14+
bayesflow.adapters
15+
bayesflow.approximators
16+
bayesflow.benchmarks
17+
bayesflow.datasets
18+
bayesflow.diagnostics
19+
bayesflow.distributions
20+
bayesflow.metrics
21+
bayesflow.networks
22+
bayesflow.simulators
23+
bayesflow.types
24+
bayesflow.utils
25+
bayesflow.workflows

docsrc/source/conf.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
project = "BayesFlow"
3030
author = "The BayesFlow authors"
31-
copyright = "2023, BayesFlow authors (lead maintainer: Stefan T. Radev)"
31+
copyright = "2023-2025, BayesFlow authors (lead maintainer: Stefan T. Radev)"
3232

3333

3434
# -- General configuration ---------------------------------------------------
@@ -61,13 +61,6 @@
6161
"html_image",
6262
]
6363
myst_url_schemes = ["http", "https", "mailto"]
64-
autodoc_default_options = {
65-
"members": "var1, var2",
66-
"special-members": "__call__,__init__",
67-
"undoc-members": True,
68-
"exclude-members": "__weakref__",
69-
"member-order": "bysource",
70-
}
7164

7265
# Define shorthand for external links:
7366
extlinks = {
@@ -83,7 +76,23 @@
8376
# directories to ignore when looking for source files.
8477
# This pattern also affects html_static_path and html_extra_path.
8578
exclude_patterns = []
79+
80+
# Options for autodoc and autosummary
81+
autodoc_default_options = {
82+
"members": True,
83+
"undoc-members": True,
84+
"imported-members": True,
85+
"inherited-members": True,
86+
"show-inheritance": True,
87+
"special-members": "__call__",
88+
"memberorder": "bysource",
89+
}
90+
# do not ignore __all__, use it to determine public members
91+
autosummary_ignore_module_all = False
92+
# include imported members in autosummary
8693
autosummary_imported_members = True
94+
# selects content to insert into the main body of an autoclass directive.
95+
autoclass_content = "both"
8796

8897

8998
# -- Options for HTML output -------------------------------------------------

docsrc/source/index.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ Indices
113113

114114

115115
.. toctree::
116-
:maxdepth: 0
117-
:titlesonly:
118-
:hidden:
119-
120-
self
121-
examples
122-
api/bayesflow
123-
contributing
124-
about
116+
:maxdepth: 0
117+
:titlesonly:
118+
:hidden:
119+
120+
self
121+
examples
122+
api/bayesflow
123+
contributing
124+
about

0 commit comments

Comments
 (0)