Skip to content

docs: add basic sphinx-domain rST generator to qapidoc

John Snow qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest23 patches 2 repliesIn review
  2. v123 patches 35 repliesSuperseded

Changes in v2 from the cover letter

- Mostly adjusted commit messages and comments per list feedback
- Changed "tag" to "kind" and adjusted code, comments and commits accordingly
- removed assertion around special features + conditionals, for now

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23docs/qapidoc: support header-less freeform sectionsdocs/sphinx/qapidoc.py+2 -00 replies
2/23qapi/parser: adjust info location for doc body sectionscripts/qapi/parser.py+5 -10 replies
3/23docs/qapidoc: remove example section supportdocs/sphinx/qapidoc.py+1 -80 replies
4/23qapi: expand tags to all doc sectionsdocs/sphinx/qapidoc.py scripts/qapi/parser.py tests/qapi-schema/doc-good.out +1 more+90 -380 replies
5/23qapi/schema: add __repr__ to QAPIDoc.Sectionscripts/qapi/parser.py+3 -02 replies
6/23docs/qapidoc: add transmogrifier stubdocs/sphinx/qapidoc.py+28 -130 replies
7/23docs/qapidoc: add transmogrifier class stubdocs/sphinx/qapidoc.py+65 -10 replies
8/23docs/qapidoc: add visit_module() methoddocs/sphinx/qapidoc.py+9 -00 replies
9/23qapi/source: allow multi-line QAPISourceInfo advancingscripts/qapi/source.py+2 -20 replies
10/23docs/qapidoc: add visit_freeform() methoddocs/sphinx/qapidoc.py+47 -00 replies
11/23docs/qapidoc: add preamble() methoddocs/sphinx/qapidoc.py+31 -10 replies
12/23docs/qapidoc: add visit_paragraph() methoddocs/sphinx/qapidoc.py+9 -00 replies
13/23docs/qapidoc: add visit_errors() methoddocs/sphinx/qapidoc.py+6 -00 replies
14/23docs/qapidoc: add format_type() methoddocs/sphinx/qapidoc.py+28 -20 replies
15/23docs/qapidoc: add add_field() and generate_field() helper methodsdocs/sphinx/qapidoc.py+25 -00 replies
16/23docs/qapidoc: add visit_feature() methoddocs/sphinx/qapidoc.py+9 -00 replies
17/23docs/qapidoc: prepare to record entity being transmogrifieddocs/sphinx/qapidoc.py+6 -00 replies
18/23docs/qapidoc: add visit_returns() methoddocs/sphinx/qapidoc.py+14 -00 replies
19/23docs/qapidoc: add visit_member() methoddocs/sphinx/qapidoc.py+27 -00 replies
20/23docs/qapidoc: add visit_sections() methoddocs/sphinx/qapidoc.py+23 -00 replies
21/23docs/qapidoc: add visit_entity()docs/sphinx/qapidoc.py+13 -00 replies
22/23docs/qapidoc: implement transmogrify() methoddocs/sphinx/qapidoc.py+46 -10 replies
23/23docs/qapidoc: add transmogrifier test documentdocs/index.rst docs/qapi/index.rst+54 -00 replies

Reviews trailers per patch

1 of 23 patches has a Reviewed-by or Acked-by.

PatchMarkus Armbruster
1/23
2/23
3/23
4/23
5/23
6/23
7/23
8/23
9/23R-b
10/23
11/23
12/23
13/23
14/23
15/23
16/23
17/23
18/23
19/23
20/23
21/23
22/23
23/23

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/23] docs: add basic sphinx-domain rST generator to qapidoc

based-on: https://patchew.org/QEMU/[email protected]/

Hi!

This series is a very, very barebones implementation for the new QAPI doc generator. It does not have many features that I presented on at KVM Forum; the point of this patch set is instead to present a stripped down basis for ongoing work so we can discuss on-list with full context of the code available to do so.

The documentation this series generates is *not suitable* for replacing the current document generator, it has a few glaring omissions - on purpose - those features have been factored out intentionally so they can be reviewed with fuller context and more careful review.

What this series does:

- Adds the new "Transmogrifier" rST generator to qapidoc.py, which generates an in-memory rST document using qapi-domain directives. - Adds a test document that showcases this new transmogrifier. (located at build/docs/manual/qapi/index.html; also visible at the bottom of the left column TOC on generated docs.)

What this series currently *regresses* /if/ it were to replace the current doc generator:

- "ifcond" data for anything other than top-level entities is not considered or rendered. This means "if" statements for features and members are entirely absent. This includes "special features" that have been hoisted into the preamble as well, such as :unstable: or :deprecated:. This issue is largely unaddressed in my WIP so far, I need to solve this in future patch discussion.

- *branches* are themselves not considered at all; they're skipped entirely for now. They will be included alongside the inliner later.

- "inherited" members (Markus hates that I use this term, I'm sorry, I know it isn't 1:1 with OO inheritance I just don't have a nicer word that my brain remembers, forgive me) are skipped; "The members of ..." messages are not rendered either. This is addressed by the inliner.

- Undocumented members are not auto-generated.

Other things unhandled, but are not regressions per se:

- The inliner is not present at all. This series renders only documentation exactly as it is exists in the source files.

- Undocumented return types are not autogenerated.

- Pseudofeatures (Things like allow-oob) are not generated as documented features.

- Documentation culling: all entities are documented whether or not they're relevant to the wire format.

Everything else *should* be no worse off than it was, and in many cases better.

My current goal is to tentatively agree that these patches look good (save for some minor nits like terminology/comments/docs/commit nits), then to send an updated version of this series with additional commits that start addressing the regressions and adding the new features like the inliner.

Once the new generator as a whole looks good, I will shift focus back to review on the qapi-domain extension itself. The reason for doing the review in reverse order is because the design of the generator informs the design of the domain, but reviewers are currently more familiar with the generator - so we're doing the review backwards. Treat it as a magical black box for now that somehow magically transforms rST into pretty docs.

V2:
- Mostly adjusted commit messages and comments per list feedback
- Changed "tag" to "kind" and adjusted code, comments and commits accordingly
- removed assertion around special features + conditionals, for now

John Snow (23):
docs/qapidoc: support header-less freeform sections qapi/parser: adjust info location for doc body section docs/qapidoc: remove example section support
qapi: expand tags to all doc sections
qapi/schema: add __repr__ to QAPIDoc.Section docs/qapidoc: add transmogrifier stub
docs/qapidoc: add transmogrifier class stub docs/qapidoc: add visit_module() method
qapi/source: allow multi-line QAPISourceInfo advancing docs/qapidoc: add visit_freeform() method docs/qapidoc: add preamble() method
docs/qapidoc: add visit_paragraph() method docs/qapidoc: add visit_errors() method
docs/qapidoc: add format_type() method
docs/qapidoc: add add_field() and generate_field() helper methods docs/qapidoc: add visit_feature() method
docs/qapidoc: prepare to record entity being transmogrified docs/qapidoc: add visit_returns() method
docs/qapidoc: add visit_member() method
docs/qapidoc: add visit_sections() method docs/qapidoc: add visit_entity()
docs/qapidoc: implement transmogrify() method docs/qapidoc: add transmogrifier test document

 docs/index.rst                 |   1 +
 docs/qapi/index.rst            |  53 +++++
 docs/sphinx/qapidoc.py         | 418 ++++++++++++++++++++++++++++++---
 scripts/qapi/parser.py         | 118 +++++++---
 scripts/qapi/source.py         |   4 +-
 tests/qapi-schema/doc-good.out |  10 +-
 tests/qapi-schema/test-qapi.py |   2 +-
 7 files changed, 541 insertions(+), 65 deletions(-)
 create mode 100644 docs/qapi/index.rst
Signature · 1 line
2.47.1