Skip to content

Commit 0e91b09

Browse files
committed
Initial pass at API docs for labscript.
This relies on recursive features and custom templates for autosummary, as described in https://stackoverflow.com/questions/2701998/sphinx-autodoc-is-not-automatic-enough/62613202#62613202
1 parent a805b69 commit 0e91b09

File tree

10 files changed

+111
-46
lines changed

10 files changed

+111
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ instance/
7777

7878
# Sphinx documentation
7979
docs/_build/
80+
docs/source/api/_autosummary/
8081

8182
# PyBuilder
8283
.pybuilder/
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{ fullname | escape | underline}}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autoclass:: {{ objname }}
6+
:members:
7+
:undoc-members:
8+
:show-inheritance:
9+
10+
{% block methods %}
11+
.. automethod:: __init__
12+
13+
{% if methods %}
14+
.. rubric:: {{ _('Methods') }}
15+
16+
.. autosummary::
17+
{% for item in methods %}
18+
~{{ name }}.{{ item }}
19+
{%- endfor %}
20+
{% endif %}
21+
{% endblock %}
22+
23+
{% block attributes %}
24+
{% if attributes %}
25+
.. rubric:: {{ _('Attributes') }}
26+
27+
.. autosummary::
28+
{% for item in attributes %}
29+
~{{ name }}.{{ item }}
30+
{%- endfor %}
31+
{% endif %}
32+
{% endblock %}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{{ fullname | escape | underline}}
2+
3+
.. automodule:: {{ fullname }}
4+
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: autosummary-class.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: autosummary-module.rst
61+
:recursive:
62+
{% for item in modules %}
63+
{{ item }}
64+
{%- endfor %}
65+
{% endif %}
66+
{% endblock %}

docs/source/api/clockline.rst

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

docs/source/api/device.rst

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

docs/source/api/index.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
API Reference
33
=============
44

5-
.. toctree::
5+
.. autosummary::
6+
:toctree: _autosummary
7+
:template: autosummary-module.rst
8+
:recursive:
9+
10+
labscript.labscript
11+
labscript.functions
12+
13+
.. toctree:
614
:maxdepth: 2
715
816
device

docs/source/api/intermediatedevice.rst

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

docs/source/api/pseudoclock.rst

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

docs/source/api/pseudoclockdevice.rst

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

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
# ones.
3939
extensions = [
4040
"sphinx.ext.autodoc",
41+
"sphinx.ext.autosummary",
4142
"sphinx.ext.autosectionlabel",
4243
"sphinx.ext.intersphinx",
4344
"sphinx.ext.napoleon",
@@ -48,6 +49,8 @@
4849
]
4950

5051
autodoc_typehints = 'description'
52+
autosummary_generate = True
53+
add_module_names = False
5154

5255
# Prefix each autosectionlabel with the name of the document it is in and a colon
5356
autosectionlabel_prefix_document = True

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy