mxcube / mxcubecore

Backend used by MXCuBE
http://mxcube.github.io/mxcube/
GNU Lesser General Public License v3.0
11 stars 51 forks source link

Build API documentation from docstrings without executing nor importing the code #907

Closed fabcor-maxiv closed 2 months ago

fabcor-maxiv commented 3 months ago

Currently, as far as I understand, to build the API documentation out of the docstrings the code needs to be imported and/or run. This is quite inconvenient. Of course we could renounce on building this API documentation, modern IDEs do a good job (if not better) for these things. But maybe an extension can give us way to build the API documentation without running nor importing the code.

Possible extension candidates:

fabcor-maxiv commented 2 months ago

I tried sphinx-autoapi, but it makes build time much longer. Sphinx-autoapi claims to reduce build time but for us it does the opposite, at least 2x the time for a clean build from scratch compared to our current solution (autodoc and autosummary). And since it does not support incremental builds then subsequent builds are as long as the initial build. While with our current solution (autodoc and autosummary), the subsequent builds take advantage of incremental builds and are much shorter than the initial build. Maybe I did something wrong, I might retry it in the future.

It would be nice to to have doc build without import (which would also mean we can have doc build without installing mxcubecore nor its dependencies).

Anyway, this helped me uncover a bunch of other unrelated issues with current codebase. One of them being that we have import package directories without __init__.py (of course not critical, but still every import package should have __init__.py.)