Skip to content

Commit 3f78207

Browse files
Merge pull request #56 from philipstarkey/master
Added links to other component docs
2 parents bbd928a + bf9d10e commit 3f78207

14 files changed

+1894
-136
lines changed

.gitignore

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# This gitignore file consists of 2 parts:
2+
# * The standard Python .gitignore rules from GitHub
3+
# * custom ignore rules for the labscript suite.
4+
#
5+
# These should be kept separate so that the generic rules can be updated with a
6+
# copy/paste without having to worry about whether we are removing custom rules
7+
18
# Byte-compiled / optimized / DLL files
29
__pycache__/
310
*.py[cod]
@@ -20,7 +27,6 @@ parts/
2027
sdist/
2128
var/
2229
wheels/
23-
pip-wheel-metadata/
2430
share/python-wheels/
2531
*.egg-info/
2632
.installed.cfg
@@ -50,6 +56,7 @@ coverage.xml
5056
*.py,cover
5157
.hypothesis/
5258
.pytest_cache/
59+
cover/
5360

5461
# Translations
5562
*.mo
@@ -69,11 +76,10 @@ instance/
6976
.scrapy
7077

7178
# Sphinx documentation
72-
docs/html/
7379
docs/_build/
74-
docs/source/_build/
7580

7681
# PyBuilder
82+
.pybuilder/
7783
target/
7884

7985
# Jupyter Notebook
@@ -84,6 +90,8 @@ profile_default/
8490
ipython_config.py
8591

8692
# pyenv
93+
# For a library or package, you might want to ignore these files since the code is
94+
# intended to run in multiple environments; otherwise, check them in:
8795
.python-version
8896

8997
# pipenv
@@ -130,9 +138,24 @@ dmypy.json
130138
# Pyre type checker
131139
.pyre/
132140

141+
# pytype static type analyzer
142+
.pytype/
143+
144+
# Cython debug symbols
145+
cython_debug/
146+
147+
#
148+
# Custom labscript suite .gitignore rules start below
149+
#
150+
133151
# Editors
134152
.vscode/
135153

136154
# conda build results
137155
conda_build/
138156
conda_packages/
157+
158+
# Sphinx documentation
159+
docs/html/
160+
docs/source/_build/
161+
docs/source/components.rst

docs/source/_static/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@ details {
5757
0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);
5858
margin-bottom: 24px;
5959
}
60+
61+
img.labscript-suite-icon {
62+
min-width: 32px;
63+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{% if current_project != 'the labscript suite' %}
2+
.. toctree::
3+
:maxdepth: 2
4+
:hidden:
5+
6+
the labscript suite <{{intersphinx_mapping['labscript-suite'][0]}}>
7+
8+
{% endif %}
9+
*labscript suite* components
10+
============================
11+
12+
The *labscript suite* is modular by design, and is comprised of:
13+
14+
.. list-table:: Python libraries
15+
:widths: 10 90
16+
:header-rows: 0
17+
18+
{% for prog, item in programs.items() if item.type == 'lib' %}
19+
* - .. image:: {{img_path}}/{{item.icon}}
20+
:target: {{intersphinx_mapping['%s' | format(prog)][0]}}
21+
:class: labscript-suite-icon
22+
- |{{prog}}|_ --- {{item.desc}}
23+
{% endfor %}
24+
25+
.. list-table:: Graphical applications
26+
:widths: 10 90
27+
:header-rows: 0
28+
29+
{% for prog, item in programs.items() if item.type == 'gui' %}
30+
* - .. image:: {{img_path}}/{{item.icon}}
31+
:target: {{intersphinx_mapping['%s' | format(prog)][0]}}
32+
:class: labscript-suite-icon
33+
- |{{prog}}|_ --- {{item.desc}}
34+
{% endfor %}
35+
36+
.. toctree::
37+
:maxdepth: 2
38+
:hidden:
39+
40+
{% for prog in programs|sort if prog != current_project %}
41+
{{prog}} <{{intersphinx_mapping['%s' | format(prog)][0]}}>
42+
{% endfor %}
43+
44+
{% for prog in programs %}
45+
.. |{{prog}}| replace:: **{{prog}}**
46+
.. _{{prog}}: {{intersphinx_mapping['%s' | format(prog)][0]}}
47+
{% endfor %}

docs/source/conf.py

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
1313
import os
14+
from pathlib import Path
1415
from m2r import MdInclude
1516
from recommonmark.transform import AutoStructify
17+
from jinja2 import FileSystemLoader, Environment
1618

1719
# -- Project information (unique to each project) -------------------------------------
1820

@@ -26,8 +28,9 @@
2628
release = version
2729

2830
# HTML icons
29-
html_logo = "img/{}.svg".format(project)
30-
html_favicon = "img/{}.ico".format(project)
31+
img_path = 'img'
32+
html_logo = img_path + "/labscript_64x64.svg"
33+
html_favicon = img_path + "/labscript.ico"
3134

3235
# -- General configuration (should be identical across all projects) ------------------
3336

@@ -79,38 +82,64 @@
7982
'matplotlib': ('https://matplotlib.org/', None),
8083
'h5py': ('http://docs.h5py.org/en/stable/', None),
8184
'pydaqmx': ('https://pythonhosted.org/PyDAQmx/', None),
82-
# from https://github.com/MSLNZ/msl-qt/blob/master/docs/create_pyqt_objects.py
83-
# under MIT License
8485
'qt': (
8586
'',
8687
'pyqt5-modified-objects.inv',
87-
)
88+
) # from https://github.com/MSLNZ/msl-qt/blob/master/docs/create_pyqt_objects.py
89+
# under MIT License
8890
# TODO
8991
# desktop-app
9092
# spinapi/pynivision/etc
9193
}
9294

9395
# list of all labscript suite components that have docs
94-
labscript_suite_programs = [
95-
'labscript',
96-
'runmanager',
97-
'runviewer',
98-
'blacs',
99-
'lyse',
100-
'labscript-utils',
101-
'labscript-devices',
102-
]
103-
# remove this current repo from the list
104-
if project in labscript_suite_programs:
105-
labscript_suite_programs.remove(project)
96+
labscript_suite_programs = {
97+
'labscript': {
98+
'desc': 'Expressive composition of hardware-timed experiments',
99+
'icon': 'labscript_32nx32n.svg',
100+
'type': 'lib',
101+
},
102+
'labscript-devices': {
103+
'desc': 'Plugin architecture for controlling experiment hardware',
104+
'icon': 'labscript_32nx32n.svg',
105+
'type': 'lib',
106+
},
107+
'labscript-utils': {
108+
'desc': 'Shared modules used by the *labscript suite*',
109+
'icon': 'labscript_32nx32n.svg',
110+
'type': 'lib',
111+
},
112+
'runmanager': {
113+
'desc': 'Graphical and remote interface to parameterized experiments',
114+
'icon': 'runmanager_32nx32n.svg',
115+
'type': 'gui',
116+
},
117+
'blacs': {
118+
'desc': 'Graphical interface to scientific instruments and experiment supervision',
119+
'icon': 'blacs_32nx32n.svg',
120+
'type': 'gui',
121+
},
122+
'lyse': {
123+
'desc': 'Online analysis of live experiment data',
124+
'icon': 'lyse_32nx32n.svg',
125+
'type': 'gui',
126+
},
127+
'runviewer': {
128+
'desc': 'Visualize hardware-timed experiment instructions',
129+
'icon': 'runviewer_32nx32n.svg',
130+
'type': 'gui',
131+
},
132+
}
106133

107134
# whether to use stable or latest version
108-
labscript_suite_doc_version = 'stable' # 'stable' or 'latest'
135+
labscript_suite_doc_version = os.environ.get('READTHEDOCS_VERSION', 'latest')
136+
if labscript_suite_doc_version not in ['stable', 'latest']:
137+
labscript_suite_doc_version = 'stable'
109138

110139
# add intersphinx references for each component
111140
for ls_prog in labscript_suite_programs:
112141
intersphinx_mapping[ls_prog] = (
113-
'https://docs.labscript_suite.org/projects/{}/en/{}/'.format(
142+
'https://docs.labscriptsuite.org/projects/{}/en/{}/'.format(
114143
ls_prog, labscript_suite_doc_version
115144
),
116145
None,
@@ -119,7 +148,7 @@
119148
# add intersphinx reference for the metapackage
120149
if project != "the labscript suite":
121150
intersphinx_mapping['labscript-suite'] = (
122-
'https://docs.labscript_suite.org/en/{}/'.format(labscript_suite_doc_version),
151+
'https://docs.labscriptsuite.org/en/{}/'.format(labscript_suite_doc_version),
123152
None,
124153
)
125154

@@ -137,6 +166,7 @@
137166
todo_include_todos = False
138167
else:
139168
todo_include_todos = True
169+
140170
# -- Options for HTML output -------------------------------------------------
141171

142172
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -158,7 +188,6 @@
158188
# Customize the html_theme
159189
html_theme_options = {'navigation_depth': 3}
160190

161-
162191
# Use m2r only for mdinclude and recommonmark for everything else
163192
# https://github.com/readthedocs/recommonmark/issues/191#issuecomment-622369992
164193
def setup(app):
@@ -177,3 +206,18 @@ def setup(app):
177206
app.add_config_value('m2r_disable_inline_math', False, 'env')
178207
app.add_directive('mdinclude', MdInclude)
179208
app.add_stylesheet('custom.css')
209+
210+
# generate the components.rst file dynamically so it points to stable/latest
211+
# of subprojects correctly
212+
loader = FileSystemLoader(Path(__file__).resolve().parent / templates_path[0])
213+
env = Environment(loader=loader)
214+
template = env.get_template('components.rst')
215+
with open(Path(__file__).resolve().parent / 'components.rst', 'w') as f:
216+
f.write(
217+
template.render(
218+
intersphinx_mapping=intersphinx_mapping,
219+
programs=labscript_suite_programs,
220+
current_project=project,
221+
img_path=img_path
222+
)
223+
)

0 commit comments

Comments
 (0)