Skip to content

Commit 7ca682c

Browse files
authored
Merge pull request #122 from dihm/rtd_fixes
Sphinx autosummary fixes
2 parents a1d736f + ba54319 commit 7ca682c

File tree

5 files changed

+46
-22
lines changed

5 files changed

+46
-22
lines changed

docs/source/_templates/autosummary-module.rst

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.. automodule:: {{ fullname }}
44

55
{% block attributes %}
6-
{% if attributes %}
6+
{%- if attributes %}
77
.. rubric:: {{ _('Module Attributes') }}
88

99
.. autosummary::
@@ -12,10 +12,10 @@
1212
{{ item }}
1313
{%- endfor %}
1414
{% endif %}
15-
{% endblock %}
15+
{%- endblock %}
1616

17-
{% block functions %}
18-
{% if functions %}
17+
{%- block functions %}
18+
{%- if functions %}
1919
.. rubric:: {{ _('Functions') }}
2020

2121
.. autosummary::
@@ -24,10 +24,10 @@
2424
{{ item }}
2525
{%- endfor %}
2626
{% endif %}
27-
{% endblock %}
27+
{%- endblock %}
2828

29-
{% block classes %}
30-
{% if classes %}
29+
{%- block classes %}
30+
{%- if classes %}
3131
.. rubric:: {{ _('Classes') }}
3232

3333
.. autosummary::
@@ -37,10 +37,10 @@
3737
{{ item }}
3838
{%- endfor %}
3939
{% endif %}
40-
{% endblock %}
40+
{%- endblock %}
4141

42-
{% block exceptions %}
43-
{% if exceptions %}
42+
{%- block exceptions %}
43+
{%- if exceptions %}
4444
.. rubric:: {{ _('Exceptions') }}
4545

4646
.. autosummary::
@@ -49,4 +49,18 @@
4949
{{ item }}
5050
{%- endfor %}
5151
{% endif %}
52-
{% endblock %}
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/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ API Reference
44

55
.. autosummary::
66
:toctree: _autosummary
7+
:template: autosummary-module.rst
78
:recursive:
89

910
runmanager

docs/source/conf.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,20 +194,29 @@ def set_process_name(self,*args,**kwargs):
194194
labscript_suite_doc_version = 'latest'
195195

196196
# add intersphinx references for each component
197+
labscript_intersphinx_mapping = {}
197198
for ls_prog in labscript_suite_programs:
198-
intersphinx_mapping[ls_prog] = (
199+
val = (
199200
'https://docs.labscriptsuite.org/projects/{}/en/{}/'.format(
200201
ls_prog, labscript_suite_doc_version
201202
),
202203
None,
203204
)
205+
labscript_intersphinx_mapping[ls_prog] = val
206+
if ls_prog != project:
207+
# don't add intersphinx for current project
208+
# if internal links break, they can silently be filled by links to existing online docs
209+
# this is confusing and difficult to detect
210+
intersphinx_mapping[ls_prog] = val
204211

205212
# add intersphinx reference for the metapackage
206213
if project != "the labscript suite":
207-
intersphinx_mapping['labscript-suite'] = (
214+
val = (
208215
'https://docs.labscriptsuite.org/en/{}/'.format(labscript_suite_doc_version),
209216
None,
210217
)
218+
intersphinx_mapping['labscript-suite'] = val
219+
labscript_intersphinx_mapping['labscript-suite'] = val
211220

212221
# Make `some code` equivalent to :code:`some code`
213222
default_role = 'code'
@@ -257,7 +266,7 @@ def setup(app):
257266
with open(Path(__file__).resolve().parent / 'components.rst', 'w') as f:
258267
f.write(
259268
template.render(
260-
intersphinx_mapping=intersphinx_mapping,
269+
intersphinx_mapping=labscript_intersphinx_mapping,
261270
programs=labscript_suite_programs,
262271
current_project=project,
263272
img_path=img_path

docs/source/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ located in a always visible toolbar at the top of the runmanager interface. Thes
4848
into hardware instructions (see :doc:`labscript <labscript:index>`).
4949
#. The shot output folder: The location to store the hdf5 shot files. By default, the
5050
location in specified by the combination of a value in the laboratory PC configuration
51-
file (see :doc:`labconfig <labscript-suite:labconfig>`), the name of the experiment logic Python file and
51+
file (see :doc:`labconfig <labscript-utils:labconfig>`), the name of the experiment logic Python file and
5252
the current date. The location automatically updates, at midnight, to a new folder
5353
for the day provided the folder location is left as the default.
5454
#. The BLACS hostname: The network hostname of the PC the hdf5 shot files are to

runmanager/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,8 @@ def compile_labscript_async(labscript_file, run_file,
825825
done_callback will be called with a boolean argument indicating success. Note that
826826
the zmq communication will be encrypted, or not, according to security settings in
827827
labconfig. If you want to receive the data on a zmq socket, do so using a PULL
828-
socket created from a labscript_utils.ls_zprocess.Context, or using a
829-
labscript_utils.ls_zprocess.ZMQServer. These subclasses will also be configured
828+
socket created from a :class:`labscript_utils.ls_zprocess.Context`, or using a
829+
:class:`labscript_utils.ls_zprocess.ZMQServer`. These subclasses will also be configured
830830
with the appropriate security settings and will be able to receive the messages.
831831
832832
Args:
@@ -867,8 +867,8 @@ def compile_multishot_async(labscript_file, run_files,
867867
stream_port via zmq push as it spews forth, and when each compilation is complete,
868868
done_callback will be called with a boolean argument indicating success. Compilation
869869
will stop after the first failure. If you want to receive the data on a zmq socket,
870-
do so using a PULL socket created from a labscript_utils.ls_zprocess.Context, or
871-
using a labscript_utils.ls_zprocess.ZMQServer. These subclasses will also be
870+
do so using a PULL socket created from a :class:`labscript_utils.ls_zprocess.Context`, or
871+
using a :class:`labscript_utils.ls_zprocess.ZMQServer`. These subclasses will also be
872872
configured with the appropriate security settings and will be able to receive the
873873
messages.
874874
@@ -913,12 +913,12 @@ def compile_labscript_with_globals_files_async(labscript_file, globals_files, ou
913913
"""Compiles labscript_file with multiple globals files into a directory.
914914
915915
Instead, stderr and stdout will be put to
916-
stream_port via zmq push in the multipart message format ['stdout','hello, world\n']
916+
stream_port via zmq push in the multipart message format `['stdout','hello, world\\n']`
917917
etc. When compilation is finished, the function done_callback will be called a
918918
boolean argument indicating success or failure. If you want to receive the data on
919919
a zmq socket, do so using a PULL socket created from a
920-
labscript_utils.ls_zprocess.Context, or using a
921-
labscript_utils.ls_zprocess.ZMQServer. These subclasses will also be configured with
920+
:external:class:`labscript_utils.ls_zprocess.Context`, or using a
921+
:external:class:`labscript_utils.ls_zprocess.ZMQServer`. These subclasses will also be configured with
922922
the appropriate security settings and will be able to receive the messages.
923923
924924
Args:

0 commit comments

Comments
 (0)