labscript-suite / labscript

The 𝗹𝗮𝗯𝘀𝗰𝗿𝗶𝗽𝘁 library provides a translation from expressive Python code to low-level hardware instructions.
http://labscriptsuite.org
BSD 2-Clause "Simplified" License
9 stars 51 forks source link

Initial pass at API docs for labscript #74

Closed dihm closed 3 years ago

dihm commented 3 years ago

This relies on the recursive features and custom templates of the autosummary extension, as described in this stackoverflow post. I think it actually looks pretty good, though the format is a departure from the rest of the docs so far.

I initially tried to abuse apidoc to do something more in line with what we currently have with the hand-made docs, but that proved essentially impossible without the aid of third-party packages that were deemed too complicated to add to sphinx directly.

philipstarkey commented 3 years ago

I think you may need to bump the sphinx version number in setup.cfg to have this build correctly (to at least 3.1.0, see sphinx-doc/sphinx#7536)

dihm commented 3 years ago

Good catch! Everything seems to be working now.

There are lots of holes since the docstring coverage is pretty low, but this should give a pretty good place to start from if we are happy with the general formatting.

philipstarkey commented 3 years ago

Method signatures for __init__ methods of classes are being hidden due to the use of the set_passed_properties decorator. I had thought that the use of functools.wrap avoided this but it seems like this is not the case. It's possible this could be solved by using the decorator package. Unsure how easy that is to swap out and what effect that will have on the formatting of the docs if long function signatures are shown correctly though.

dihm commented 3 years ago

Oops. Turns out this is actually a bug of sphinx autodoc. It was fixed in 3.1.2. Bumped the version again to fix it.

Edit: seems like this is only a partial fix since only some of the classes show their proper signatures. I'm still seeing issues with AnalogIn and DDS. Should I just keep bumping? It works properly in my build environment with 3.2.1.

dihm commented 3 years ago

Rebased to master and bumped sphinx requirement to 3.2.1, which does finally fix all of the decorated function __init__ signatures.

dihm commented 3 years ago

Finished a decent pass at the docstrings. Coverage is 98%. Ready to merge.