Skip to content

Commit db99547

Browse files
committed
Merge branch 'master' into update-workflow
2 parents f4cd21c + be322a3 commit db99547

18 files changed

+764
-17
lines changed

CITATION.cff

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
cff-version: 1.2.0
2+
message: "If you use the labscript suite to control your experiment or perform analysis, please cite the article from preferred-citation and the software itself."
3+
title: The labscript suite
4+
authors:
5+
- name: "The labscript-suite development team"
6+
abstract: "A powerful and extensible framework for experiment composition, control, execution, and analysis that implements repeated, parameterised, hardware-time experiments."
7+
keywords:
8+
- research
9+
- "experiment composition"
10+
- "experiment control"
11+
- "experiment analysis"
12+
- "quantum science"
13+
- "quantum engineering"
14+
- hardware-timed
15+
license: BSD-2-Clause
16+
repository-code: "https://github.com/labscript-suite"
17+
url: "https://docs.labscriptsuite.org/en/latest/"
18+
19+
references:
20+
- type: software
21+
authors:
22+
- family-names: Billington
23+
given-names: Chris J.
24+
title: zprocess
25+
repository-code: "https://github.com/chrisjbillington/zprocess"
26+
- type: software
27+
authors:
28+
- family-names: Starkey
29+
given-names: Philip
30+
- family-names: Billington
31+
given-names: Chris J.
32+
title: qtutils
33+
repository-code: "https://github.com/philipstarkey/qtutils"
34+
url: "https://qtutils.readthedocs.io/en/stable/"
35+
- type: software
36+
authors:
37+
- family-names: Billington
38+
given-names: Chris J.
39+
title: spinapi
40+
repository-code: "https://github.com/chrisjbillington/spinapi/"
41+
- type: software
42+
authors:
43+
- family-names: Cladé
44+
given-names: Pierre
45+
title: PyDAQmx
46+
repository-code: "https://github.com/clade/PyDAQmx"
47+
url: "https://pythonhosted.org/PyDAQmx/"
48+
- type: software
49+
authors:
50+
- family-names: Johnson
51+
given-names: Peter
52+
- family-names: Billington
53+
given-names: Chris J.
54+
title: pynivision
55+
repository-code: "https://github.com/chrisjbillington/pynivision"
56+
- type: phdthesis
57+
authors:
58+
- family-names: Billington
59+
given-names: Chris J.
60+
title: "State-dependent forces in cold quantum gases"
61+
school: "Monash University"
62+
year: 2018
63+
doi: 10.26180/5bd68acaf0696
64+
scope: "Chapter 4 provides an excellent, detailed overview of the labscript-suite"
65+
- type: phdthesis
66+
authors:
67+
- family-names: Starkey
68+
given-names: Philip
69+
title: "A software framework for control and automation of precisely timed experiments"
70+
school: "Monash University"
71+
year: 2019
72+
doi: 10.26180/5d1db8ffe29ef
73+
scope: "This provides an in-depth description of the labscript-suite, circa 2019"
74+
75+
preferred-citation:
76+
type: article
77+
title: A scripted control system for autonomous hardware-timed experiments
78+
authors:
79+
- family-names: Starkey
80+
given-names: Philip T.
81+
- family-names: Billington
82+
given-names: Christopher J.
83+
orcid: "https://orcid.org/0000-0002-8067-6400"
84+
- family-names: Johnstone
85+
given-names: Shaun P.
86+
orcid: "https://orcid.org/0000-0002-4704-9552"
87+
- family-names: Jasperse
88+
given-names: M.
89+
- family-names: Helmerson
90+
given-names: K.
91+
- family-names: Turner
92+
given-names: Lincoln D.
93+
- family-names: Anderson
94+
given-names: Russell P.
95+
orcid: "https://orcid.org/0000-0002-4495-7926"
96+
doi: "10.1063/1.4817213"
97+
journal: "Review of Scientific Instruments"
98+
month: 8
99+
year: 2013
100+
start: 085111 # page number
101+
issue: 84

docs/source/building_docs.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Building the *labscript suite* docs
2+
===================================
3+
4+
The **labscript-suite** documentation is hosted online at `<https://docs.labscriptsuite.org/en/latest/>`_.
5+
It is composed from documentation for each module of the **labscript-suite**.
6+
If you desire to build the documentation for a module locally, either for off-line usage or to test changes to the documentation, you will need to apply extra configuration beyond a normal installation.
7+
This is because our documentation building pipeline relies on `sphinx <https://www.sphinx-doc.org/en/master/>`_, which introspects documentation from inline docstrings from the source code.
8+
This introspection process requires that the code to be documented is importable and the necessary `sphinx` dependencies are installed.
9+
10+
The below sections describe how to configure your environment for building docs as well as some guidance for writing and contributing documentation.
11+
12+
.. toctree::
13+
:maxdepth: 2
14+
15+
building_docs/docs_install
16+
building_docs/docs_build
17+
building_docs/docs_writing
18+
building_docs/docs_comitting
19+
building_docs/docs_resources
20+
building_docs/docs_minutia
21+
22+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Building the Docs
2+
=================
3+
4+
The **labscript-suite** documentation is built one repository at a time.
5+
To build the documentation for a single repository:
6+
7+
#. Activate the environment where the **labscript-suite** and sphinx dependencies are installed.
8+
#. Change directories to the `docs` subfolder of the repository.
9+
#. Run the appropriate `make` command, described below.
10+
11+
Assuming the appropriate dependencies are installed, the documentation will be built and placed in a subfolder of `docs/build` corresponding to the build command used.
12+
13+
html
14+
----
15+
16+
The web-based documentation, which is what is hosted at `<https://docs.labscriptsuite.org/en/latest/>`_ by Read the Docs, is built locally using the command
17+
18+
.. code-block:: bash
19+
20+
make html
21+
22+
The home page is found at `docs/build/html/index.html`.
23+
Repeated calls of this (and the other) build commands will introspect which source files have changed and only update the corresponding build outputs.
24+
25+
Note that the build on Read the Docs uses the closely related `make dirhtml` command.
26+
This build command organizes the html documentation in a way suitable for web hosting.
27+
For locally inspecting the documentation, the `make html` command is preferred to preserve normal inter-page links.
28+
29+
.. note::
30+
31+
Some cross-referencing used in the markdown files is not cross-compatible between the `html` and `dirthtml` build commands.
32+
When using markdown source files, please ensure cross-references actually work when built on Read the Docs.
33+
34+
latexpdf
35+
--------
36+
37+
Building the pdf documentation is a bit more complicated than the other builds.
38+
Normally it would be done by running the command
39+
40+
.. code-block:: bash
41+
42+
make latexpdf
43+
44+
This would create latex source files which are automatically compiled using an existing, local installation of latex.
45+
The latex compilation requires `perl` and the `latexmk` latex package.
46+
It also requires a great many other latex dependencies.
47+
Successfully building the pdf documentation locally is made easier if your latex installation can install dependencies as required.
48+
49+
Unfortunately, this simple build command :ref:`does not succeed <building_docs/docs_minutia:latexpdf local builds>` for **labscript-suite** documentation.
50+
To build the pdf docs locally, you will need to instead build using the `make latex` command followed by the latex compiling command used on Read the Docs.
51+
52+
.. code-block:: bash
53+
54+
latexmk -r latexmkrc -pdf -f -dvi- -ps- -jobname=repository-name -interaction=nonstopmode
55+
56+
This command is run from within the `docs/build/latex` directory where the `latexmkrc` file resides.
57+
58+
epub
59+
----
60+
61+
This builds the documentation in the EPUB format, for use with e-readers.
62+
It is built using the command
63+
64+
.. code-block:: bash
65+
66+
make epub
67+
68+
clean
69+
-----
70+
71+
This make target will clean the entire `build` directory.
72+
It ensures that a fresh build can be made.
73+
It is helpful when stale build files are interfering with new changes or you wish to see the :ref:`coverage <building_docs/docs_writing:docstring coverage>`.
74+
The command is
75+
76+
.. code-block:: bash
77+
78+
make clean
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Committing Docs
2+
===============
3+
4+
Committing documentation updates/fixes is an important way to contribute to the **labscript-suite** community.
5+
Increasing the amount of technical details in the documentation that are necessary to use the suite but are not obvious from the source is of particular value.
6+
7+
The mechanics of committing documentation to a **labscript-suite** component is nearly identical to committing general code updates/fixes:
8+
:doc:`a pull request needs to be created </contributing>`.
9+
The main difference is that documentation changes necessitate checking the read the docs builds to confirm what was desired actually makes it into the on-line documentation as intended.
10+
11+
Making a PR
12+
-----------
13+
14+
The general steps for creating the PR are outlined in :doc:`here <contributing>`.
15+
When making PRs with documentation changes, a few extra checks are required.
16+
In particular, it is a good idea to locally build the documentation as described :doc:`here <docs_build>`.
17+
If you cannot build locally, the docs will be built automatically for your PR by Read the Docs and can be viewed there (described below).
18+
19+
Checking the RTD Builds
20+
-----------------------
21+
22+
When a PR is created or updated with new commits, an automated check of the documentation build is performed by Read the Docs.
23+
The result of this build can be viewed online by looking at the details of the automated checks.
24+
If the build is completed, this link will take you directly to the home page of your built documentation.
25+
If the build is still in progress, this link will take you to the build progress which shows the commands being run and their outputs.
26+
If you wish to see this progress after the build succeeds, you can find it by clicking the bottom left corner of the Read the Docs page.
27+
This will bring up a small window pane.
28+
Selecting 'Builds' will bring up the build logs for all of the online builds.
29+
If the build did not succeed, this link takes you to the build progress stage with the failing command and corresponding outputs displayed.
30+
31+
Note that Read the Docs will only build the html documentation for a pull request.
32+
When the pull request is merged, Read the Docs will build the html documentation again, as well as downloadable pdf and epub versions.
33+
These downloads are available via the 'Downloads' link next to the 'Builds' link in the bottom left corner pop-up pane on-line.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Setting up the environment
2+
==========================
3+
4+
The build environment generally requires a full **labscript-suite** installation, with a few extra dependencies.
5+
The simplest method is to use the environment of an existing, functioning installation and install the build dependencies.
6+
If you do not want to install the docs dependencies into a working environment of an experiment,
7+
or wish the develop docs on a system that does not control an experiment,
8+
you can create a new environment.
9+
10+
.. note::
11+
12+
These instructions assume you have generally followed the installation instructions for a developer **labscript-suite** installation,
13+
using either the :doc:`pip </installation/developer-pypi>` or :doc:`anaconda </installation/developer-anaconda>` method.
14+
15+
Install build dependencies
16+
--------------------------
17+
18+
If you have an existing, functioning environment for using the **labscript-suite**, you can configure it to build docs by simply installing the docs dependencies found in the `setup.cfg` file of each repository.
19+
For a functioning **labscript** environment, the only additional dependencies should be `sphinx`, `sphinx-rtd-theme`, `recommonmark`, and `m2r`.
20+
21+
The versions pinned in the `setup.cfg` file will be the versions of these packages that are used by Read the Docs when building the documentation.
22+
In order to get an accurate reproduction of what the online docs look like, you should ensure the versions you install match the pins.
23+
24+
Once these dependencies are installed in your **labscript** environment, you are ready to build the docs.
25+
26+
Using a cloned environment
27+
--------------------------
28+
29+
If you have an existing, functioning **labscript** environment, but do not want to install the many build dependecies into it, you can instead build the docs using a cloned copy of the functioning environment.
30+
You clone a conda enviroment using
31+
32+
.. code-block:: bash
33+
34+
conda create -n labscript-sphinx -c labscript
35+
36+
Here we clone an existing `labscript` conda environment into a new environment `labscript-sphinx`.
37+
This new enviroment will be an exact duplicate of the original at the time of cloning.
38+
Changes in one environment will not affect the other.
39+
40+
Once the new environment is created, you can activate it then install the dependencies for the docs as described above.
41+
42+
When using this method, both enviroments will use the same installation of the **labscript-suite**.
43+
44+
Using a new environment
45+
-----------------------
46+
47+
If you desire to build the docs on a computer without an existing **labscript-suite** installation, you will need to first install the suite using one of the developer installation methods described :doc:`here </installation/index>`.
48+
Once installed, follow the directions above to install the docs dependencies into the environment.
49+
50+
.. note::
51+
52+
The normal installation steps to create a labscript profile and the launcher shortcuts should not be necessary when only building docs.
53+
54+
This installation method should also be used if you desire to develop documentation in local repositories separate from an existing installation (i.e. having two environments using different installations of the **labscript-suite**).
55+
This can be desirable if you want to avoid docs dependencies in a function environment *and* want to isolate local changes for a functioning experiment from documentation developement.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
Minutia
2+
=======
3+
4+
Here is a list of minor details that come up when dealing with our docs that are not well documented in the Sphinx docs or are very unique to our project.
5+
6+
autosummary can't find a module
7+
-------------------------------
8+
9+
When you get an error while building the docs stating autosummary could not find a module, it could be due to one of two things:
10+
11+
1. The module actually cannot be found, due to a typo in the `autosummary` command.
12+
2. The much more likely reason, the module is actually found, but cannot be imported.
13+
14+
In order to see the actual error to diagnose the problem properly, temporarily remove that module from the `autosummary` directive and do an explicit `automodule` directive.
15+
Once the import error is fixed, you can move the module back into the `autosummary` directive.
16+
17+
*labscript-devices* API
18+
-----------------------
19+
20+
Unlike the rest of the **labscript-suite**, **labscript-devices** does NOT use recursive `autosummary` calls to generate the API documentation.
21+
This means that, unlike other modules, adding a new device to **labscript-devices** will NOT automatically be captured in the docs build.
22+
When adding a new device, you are expected to make a top-level rst document that implements the necessary `autodoc` calls to document the device.
23+
24+
.. note::
25+
26+
In all modules, adding a sub-module at the top-level likely will not be automatically caught either.
27+
It will need to be added to the relevant `autosummary` directive manually.
28+
29+
latexPDF local builds
30+
---------------------
31+
32+
Local builds of the latexPDF version of the documentation will not work using the standard `make latexpdf` command.
33+
This is because the **labscript-suite** uses svg figure icons that latex cannot process.
34+
This build **does** work on RTD because they do not use the `latexpdf` make target, but instead call `latexmk` with customized options that ignore these little errors.
35+
In order to build the PDF documentation locally, you will need to use the same call as RTD uses.
36+
37+
Note that the RTD latex build is fairly stable, if really ugly, so long as the html docs build.
38+
That said, if there is an error unique to the latex build, discovering its origin can be very difficult since the build process has to ignore errors to complete normally anyway.
39+
40+
One specific error already encounted is when an API documentated value is too long for latex to parse as a single line (a raw bitmap image saved as a class attribute).
41+
This specific error can be overcome by instructing sphinx to not publish the value in the docs using the `:meta hide-value:` rst key for the offending object.
42+
43+
intersphinx references won't link
44+
---------------------------------
45+
46+
Using intersphinx links to reference documentation in other packages (or even the same package) can be tricky.
47+
This is because the exact convention for referring to things is not guaranteed between projects.
48+
The best way to determine the exact reference label to use is to introspect the intersphinx object inventory for that project (the `objects.inv` file).
49+
This can be done by calling, for example,
50+
51+
.. code-block:: shell
52+
53+
python -m sphinx.ext.intersphinx https://www.sphinx-doc.org/en/master/objects.inv
54+
55+
See `this <https://stackoverflow.com/a/30981554>`__ SO post for many details.
56+
57+
This file is typically stored at the top level directory of a project, but not always.
58+
If the above command does not work to obtain the objects inventory for online docs, it can be run on a local copy of the file without issue.
59+
Obtaining the file for online published docs amounts to guessing the correct location and pointing your browser there.
60+
To run the introspection locally, use
61+
62+
.. code-block:: shell
63+
64+
python -m sphinx.ext.intersphinx objects.inv > objects.txt
65+
66+
In this call, we redirect the output to a text file for easier inspection.

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