Context
PR #515 improves Sphinx and reStructuredText formatting across API docstrings and the documentation. During review, concerns were raised that markup which renders well in HTML can make docstrings harder to read in source code and through help() in a Python REPL.
There is also a broader question about equation-heavy docstrings: detailed mathematical expressions and derivations may be more useful in the relevant pages under docs/, while docstrings can focus on the API and link to that material.
This issue is intended to agree on the approach before revisiting #515.
Points to discuss
- How should we balance typographical/semantic correctness in rendered HTML against readability of raw docstrings?
- When should superscripts and subscripts use Unicode characters (for example,
m⁻³ or nₑ) rather than reStructuredText or LaTeX markup?
- Should docstrings containing LaTeX be raw strings (
r"""...""") to avoid doubled backslashes?
- How much mathematical detail belongs in a docstring?
- When equations or derivations are moved to
docs/, how should docstrings reference the corresponding documentation section?
Possible direction
- Keep docstrings focused on how to use the API: parameters, return values, behavior, caveats, and concise examples.
- Keep short equations in docstrings when they materially help explain the API, possibly in a
Notes section.
- Move long equations and derivations to an appropriate page under
docs/ and add a cross-reference from the docstring.
- Prefer readable Unicode superscripts/subscripts for common units and simple notation where the characters are available and unambiguous.
- Prefer semantic reStructuredText/LaTeX formatting in documentation pages that are primarily consumed as rendered HTML.
Origin
Raised by @jacklovell in the review discussion on #515, particularly this comment. See also the preceding readability discussion.
Context
PR #515 improves Sphinx and reStructuredText formatting across API docstrings and the documentation. During review, concerns were raised that markup which renders well in HTML can make docstrings harder to read in source code and through
help()in a Python REPL.There is also a broader question about equation-heavy docstrings: detailed mathematical expressions and derivations may be more useful in the relevant pages under
docs/, while docstrings can focus on the API and link to that material.This issue is intended to agree on the approach before revisiting #515.
Points to discuss
m⁻³ornₑ) rather than reStructuredText or LaTeX markup?r"""...""") to avoid doubled backslashes?docs/, how should docstrings reference the corresponding documentation section?Possible direction
Notessection.docs/and add a cross-reference from the docstring.Origin
Raised by @jacklovell in the review discussion on #515, particularly this comment. See also the preceding readability discussion.