Skip to content

docs: add sphinx-domain rST generator to qapidoc

John Snow qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest42 patches 24 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/42docs/qapidoc: support header-less freeform sectionsdocs/sphinx/qapidoc.py+2 -02 replies
2/42qapi/parser: adjust info location for doc body sectionscripts/qapi/parser.py+5 -10 replies
3/42docs/qapidoc: remove example section supportdocs/sphinx/qapidoc.py+1 -80 replies
4/42qapi: 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/42qapi/schema: add __repr__ to QAPIDoc.Sectionscripts/qapi/parser.py+3 -00 replies
6/42docs/qapidoc: add transmogrifier stubdocs/sphinx/qapidoc.py+28 -130 replies
7/42docs/qapidoc: add transmogrifier class stubdocs/sphinx/qapidoc.py+65 -10 replies
8/42docs/qapidoc: add visit_module() methoddocs/sphinx/qapidoc.py+9 -00 replies
9/42qapi/source: allow multi-line QAPISourceInfo advancingscripts/qapi/source.py+2 -20 replies
10/42docs/qapidoc: add visit_freeform() methoddocs/sphinx/qapidoc.py+47 -00 replies
11/42docs/qapidoc: add preamble() methoddocs/sphinx/qapidoc.py+31 -10 replies
12/42docs/qapidoc: add visit_paragraph() methoddocs/sphinx/qapidoc.py+9 -00 replies
13/42docs/qapidoc: add visit_errors() methoddocs/sphinx/qapidoc.py+6 -00 replies
14/42docs/qapidoc: add format_type() methoddocs/sphinx/qapidoc.py+28 -20 replies
15/42docs/qapidoc: add add_field() and generate_field() helper methodsdocs/sphinx/qapidoc.py+25 -00 replies
16/42docs/qapidoc: add visit_feature() methoddocs/sphinx/qapidoc.py+9 -00 replies
17/42docs/qapidoc: prepare to record entity being transmogrifieddocs/sphinx/qapidoc.py+6 -00 replies
18/42docs/qapidoc: add visit_returns() methoddocs/sphinx/qapidoc.py+14 -00 replies
19/42docs/qapidoc: add visit_member() methoddocs/sphinx/qapidoc.py+27 -00 replies
20/42docs/qapidoc: add visit_sections() methoddocs/sphinx/qapidoc.py+23 -00 replies
21/42docs/qapidoc: add visit_entity()docs/sphinx/qapidoc.py+13 -00 replies
22/42docs/qapidoc: implement transmogrify() methoddocs/sphinx/qapidoc.py+46 -10 replies
23/42docs: disambiguate cross-referencesdocs/devel/codebase.rst docs/glossary.rst+8 -80 replies
24/42docs/qapidoc: add transmogrifier test documentdocs/index.rst docs/qapi/index.rst+54 -00 replies
25/42docs/qapidoc: generate entries for undocumented membersdocs/sphinx/qapidoc.py+1 -20 replies
26/42qapi/parser: add undocumented stub members to all_sectionsscripts/qapi/parser.py+12 -00 replies
27/42qapi: differentiate "intro" and "detail" sectionsdocs/sphinx/qapidoc.py scripts/qapi/parser.py tests/qapi-schema/doc-good.out+25 -172 replies
28/42qapi/parser: prohibit untagged sections between tagged sectionsqapi/net.json qapi/qom.json scripts/qapi/parser.py +3 more+28 -124 replies
29/42qapi: Add "Details:" disambiguation markerqapi/machine.json qapi/migration.json qapi/qom.json +2 more+20 -010 replies
30/42docs/qapidoc: add minimalistic inlinerdocs/sphinx/qapidoc.py+172 -20 replies
31/42docs/qapidoc: autogenerate undocumented return docsdocs/sphinx/qapidoc.py+13 -70 replies
32/42docs/qapidoc: Add generated returns documentation to inlinerdocs/sphinx/qapidoc.py+8 -00 replies
33/42docs/qmp: add target to Out-of-band execution sectiondocs/interop/qmp-spec.rst+2 -00 replies
34/42docs/qapidoc: document the "out-of-band" pseudofeaturedocs/sphinx/qapidoc.py+8 -20 replies
35/42docs/qapidoc: generate out-of-band pseudofeature sectionsdocs/sphinx/qapidoc.py+6 -00 replies
36/42qapi/parser: add "meta" kind to QAPIDoc.Kindscripts/qapi/parser.py+1 -00 replies
37/42qapi/schema: add __iter__ method to QAPISchemaVariantsdocs/sphinx/qapidoc.py scripts/qapi/introspect.py scripts/qapi/schema.py +2 more+13 -90 replies
38/42docs/qapi: add branch support to inlinerdocs/sphinx/qapidoc.py+56 -10 replies
39/42qapi/schema: add doc_visible property to QAPISchemaDefinitionscripts/qapi/schema.py+40 -00 replies
40/42docs/qapidoc: cull (most) un-named entities from docsdocs/sphinx/qapidoc.py+7 -00 replies
41/42qapi: resolve filenames in info structuresscripts/qapi/parser.py tests/qapi-schema/test-qapi.py+4 -10 replies
42/42docs/qapidoc: add intermediate output debuggerdocs/sphinx/qapidoc.py+37 -40 replies

Reviews trailers per patch

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

PatchMarkus Armbruster
1/42
2/42
3/42
4/42
5/42
6/42
7/42
8/42
9/42R-b
10/42
11/42
12/42
13/42
14/42
15/42
16/42
17/42
18/42
19/42
20/42
21/42
22/42
23/42
24/42
25/42
26/42
27/42
28/42
29/42
30/42
31/42
32/42
33/42
34/42
35/42
36/42
37/42
38/42
39/42
40/42
41/42
42/42

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

Read the v1 thread

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

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

Hiya! This series is based on a rebased version of the above series. Apply the above patches to origin/master and then apply this series and you should be good to go. Or just snitch the patches from my GitLab branch:

https://gitlab.com/jsnow/qemu/-/commits/sphinx-domain-blergh2

(... ignore the branch name. I ran into some problems with stacked git corrupting my branches ...)

If you're just tuning in, this series adds a new sphinx documentation generator for QAPI as presented on at KVM Forum; the big win here is cross-references and indices for QMP commands and events. It depends on the qapi-domain plugin for sphinx which is posted in the pre-requisite series; it's not polished for review and should be considered POC-quality. I felt it was easier to review this series backwards, because the design of the rST generator informs the design of the domain plugin. (Which makes sense: the rST is generated first, and then it's parsed. Our review follows the flow of data through the generator.)

Overview:

Patches 1-24: Mostly the same as in v2; implements the very basics of
the new qapidoc generator. "type" was changed to "kind" for the doc section metadata, and "untagged" changed to "plain". Some small phrasing tweaks here and there.

Patches 25-26: Add auto-generated stub docs for undocumented members.

Patches 27-29: Restrict the source QAPIDoc syntax slightly and
differentiate "plain" sections as either intro or details. Necessary for the inliner.

Patch 30: Add the "inliner", the component that squishes "inherited"
arguments/members into a single reference for commands/events.

Patches 31-32: Add auto-generated documentation for commands that return
a value that is not documented.

Patches 33-35: Document the "out-of-band" property on QMP commands.

Patches 36-38: Add branch support to the inliner. Ish. See below.

Patches 39-40: Cull unused definitions from the generated QMP docs; cull
anything that has been inlined and no longer needs to be documented separately.

Patches 41-42: Add intermediate representation rST document writing in
DEBUG mode

Things notably still not perfect:

(ignoring aesthetics; we care only about the rST generator itself in this series.)

- ifcond for anything other than root level entires is still ignored
- branch inliner ignores all sections except members (ifcond, details, features)
- intro/details separation enforces no plain paragraphs to appear in the "middle" of the documentation section; new markup may be desired if we want to add annotations to categories/regions instead of to specific members/features.

If you want to give this a whirl yourself, build QEMU with documentation support enabled and look at docs/manual/qapi/index.html for a sample generation of the QMP manual using the new system. You probably need sphinx >= 4.0 for the time being to do so.

John Snow (42):
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: disambiguate cross-references
docs/qapidoc: add transmogrifier test document docs/qapidoc: generate entries for undocumented members qapi/parser: add undocumented stub members to all_sections
qapi: differentiate "intro" and "detail" sections qapi/parser: prohibit untagged sections between tagged sections
qapi: Add "Details:" disambiguation marker docs/qapidoc: add minimalistic inliner
docs/qapidoc: autogenerate undocumented return docs docs/qapidoc: Add generated returns documentation to inliner docs/qmp: add target to Out-of-band execution section docs/qapidoc: document the "out-of-band" pseudofeature docs/qapidoc: generate out-of-band pseudofeature sections qapi/parser: add "meta" kind to QAPIDoc.Kind qapi/schema: add __iter__ method to QAPISchemaVariants docs/qapi: add branch support to inliner
qapi/schema: add doc_visible property to QAPISchemaDefinition docs/qapidoc: cull (most) un-named entities from docs
qapi: resolve filenames in info structures docs/qapidoc: add intermediate output debugger

 docs/devel/codebase.rst         |   6 +-
 docs/glossary.rst               |  10 +-
 docs/index.rst                  |   1 +
 docs/interop/qmp-spec.rst       |   2 +
 docs/qapi/index.rst             |  53 +++
 docs/sphinx/qapidoc.py          | 716 ++++++++++++++++++++++++++++++--
 qapi/machine.json               |   2 +
 qapi/migration.json             |   4 +
 qapi/net.json                   |   4 +-
 qapi/qom.json                   |   8 +-
 qapi/yank.json                  |   2 +
 scripts/qapi/introspect.py      |   4 +-
 scripts/qapi/parser.py          | 178 ++++++--
 scripts/qapi/schema.py          |  48 ++-
 scripts/qapi/source.py          |   4 +-
 scripts/qapi/types.py           |   4 +-
 scripts/qapi/visit.py           |   4 +-
 tests/qapi-schema/doc-good.json |   4 +-
 tests/qapi-schema/doc-good.out  |  12 +-
 tests/qapi-schema/doc-good.txt  |   8 +-
 tests/qapi-schema/test-qapi.py  |   4 +-
 21 files changed, 975 insertions(+), 103 deletions(-)
 create mode 100644 docs/qapi/index.rst
Signature · 1 line
2.48.1