Is automatic documentation from doctests a thing?

56 views
Skip to first unread message

aska...@gmail.com

unread,
Feb 14, 2025, 10:55:48 AM2/14/25
to sage-devel
Hi,

We are working on a package on Geometric Invariant Theory and while writing up the documentation and seeing what other people did, I have noticed that the documentation for the Weyl Group library:

seems to be automatically generated from the code:

I was wondering if there is an automated way to do this (e.g. if written in the write format, to run some command or script that generates the html/pdf). If so, if there is a guide somewhere that explains the format conventions?

Many thanks,

Jesus

John H Palmieri

unread,
Feb 14, 2025, 12:21:30 PM2/14/25
to sage-devel
The format is explained at https://doc.sagemath.org/html/en/developer/coding_basics.html#documentation-strings. Files in the Sage library are included in the documentation if they are cited in one of the files src/doc/en/reference/MODULE/index.rst. Many of those references are explicitly in those files: look at src/doc/en/reference/curves/index.rst. The file src/doc/en/reference/combinat/index.rst, which is relevant to combinat/root_system/weyl_group, is a bit different — it includes a separate file which lists each file to be included.

With this in place, all of those files are automatically included when building the reference manual.

--
John

Dima Pasechnik

unread,
Feb 14, 2025, 4:27:44 PM2/14/25
to sage-...@googlegroups.com
To add a generic Python explainer: generation of documentation from docstrings and function/class signatures is normally done by a Python package sphinx, and Sage is not much of an exception to it (although it's accumulated a lot of outdated "improvements" to it, which we ought to streamline as soon as we can).


Reply all
Reply to author
Forward
0 new messages