flux-docs icon indicating copy to clipboard operation
flux-docs copied to clipboard

idea: create a sphinx extension to insert output of flux commands in examples directly into docs

Open grondo opened this issue 3 years ago • 1 comments

This is just an idea -- I'm unsure if it could work in practice, but it would be neat if we could develop a sphinx extension that could substitute output of flux command examples in the docs directly during the docs build.

There already exists a sphinxcontrib-programoutput extension that can substitute program output into docs at build time, e.g.:

.. command-output:: python -V

Output:

$ python -V
Python 2.7.1

Perhaps starting from this implementation, someone clever could create an extension that was capable of interacting with a Flux instance and would substitute output of commands. Perhaps our deployed docker images could be used in the Readthedocs build (not sure if that is possible).

grondo avatar Jan 21 '22 17:01 grondo

This actually would work if we just had them generated in a running container, e.g., I do it with the flux-restful-api (although it's using python and interacting with flux via REST, see this tutorial: https://flux-framework.org/flux-restful-api/auto_examples/api_tutorial.html#sphx-glr-auto-examples-api-tutorial-py. That's possible with sphinx gallery which (typically) you run Python for - could you elaborate if you are just interested in running flux python examples or something else?

vsoch avatar Jan 30 '23 20:01 vsoch