Re: Historical QMP schema

2024-06-06 Thread John Snow
was X command introduced?", but possibly also to generate changelog QMP reports for auditing QMP changes for each version during the release candidate window. On Thu, Jun 6, 2024 at 6:25 AM Victor Toso wrote: > Hi John! > > On Wed, Jun 05, 2024 at 11:47:53AM GMT, John Snow wrote: >

Re: [PATCH 08/20] qapi/parser: differentiate intro and outro paragraphs

2024-05-16 Thread John Snow
On Thu, May 16, 2024 at 11:06 AM John Snow wrote: > > > On Thu, May 16, 2024, 5:34 AM Markus Armbruster wrote: > >> John Snow writes: >> >> > Add a semantic tag to paragraphs that appear *before* tagged >> > sections/members/features and those tha

Re: [PATCH 06/20] qapi/parser: fix comment parsing immediately following a doc block

2024-05-16 Thread John Snow
On Thu, May 16, 2024 at 2:01 AM Markus Armbruster wrote: > John Snow writes: > > > If a comment immediately follows a doc block, the parser doesn't ignore > > that token appropriately. Fix that. > > Reproducer? > > > > > Signed-off-by: John Snow

Re: [PATCH 08/20] qapi/parser: differentiate intro and outro paragraphs

2024-05-16 Thread John Snow
On Thu, May 16, 2024, 5:34 AM Markus Armbruster wrote: > John Snow writes: > > > Add a semantic tag to paragraphs that appear *before* tagged > > sections/members/features and those that appear after. This will control > > how they are inlined when doc sections

Re: [PATCH 07/20] qapi/parser: add semantic 'kind' parameter to QAPIDoc.Section

2024-05-16 Thread John Snow
On Thu, May 16, 2024, 2:18 AM Markus Armbruster wrote: > John Snow writes: > > > When iterating all_sections, this is helpful to be able to distinguish > > "members" from "features"; the only other way to do so is to > > cross-reference these secti

Re: [PATCH 05/20] qapi/parser: adjust info location for doc body section

2024-05-16 Thread John Snow
On Thu, May 16, 2024, 1:58 AM Markus Armbruster wrote: > John Snow writes: > > > Instead of using the info object for the doc block as a whole, update > > the info pointer for each call to ensure_untagged_section when the > > existing section is otherwise empty

Re: [PATCH 03/20] docs/qapidoc: delint a tiny portion of the module

2024-05-15 Thread John Snow
On Wed, May 15, 2024, 1:27 PM Markus Armbruster wrote: > John Snow writes: > > > On Wed, May 15, 2024 at 5:17 AM Markus Armbruster > wrote: > > > >> John Snow writes: > >> > >> > In the coming patches, it's helpful to have a linting bas

Re: [PATCH 04/20] qapi/parser: preserve indentation in QAPIDoc sections

2024-05-15 Thread John Snow
On Wed, May 15, 2024 at 10:18 AM Markus Armbruster wrote: > John Snow writes: > > > On Wed, May 15, 2024, 7:50 AM Markus Armbruster > wrote: > > > >> John Snow writes: > >> > >> > Prior to this patch, a section like this: > &

Re: [PATCH 03/20] docs/qapidoc: delint a tiny portion of the module

2024-05-15 Thread John Snow
On Wed, May 15, 2024 at 5:17 AM Markus Armbruster wrote: > John Snow writes: > > > In the coming patches, it's helpful to have a linting baseline. However, > > there's no need to shuffle around the deck chairs too much, because most > > of this code will be remo

Re: [PATCH 04/20] qapi/parser: preserve indentation in QAPIDoc sections

2024-05-15 Thread John Snow
On Wed, May 15, 2024, 7:50 AM Markus Armbruster wrote: > John Snow writes: > > > Prior to this patch, a section like this: > > > > @name: lorem ipsum > >dolor sit amet > > consectetur adipiscing elit > > > > would be parsed as: >

Re: [PATCH 03/20] docs/qapidoc: delint a tiny portion of the module

2024-05-15 Thread John Snow
On Wed, May 15, 2024, 5:17 AM Markus Armbruster wrote: > John Snow writes: > > > In the coming patches, it's helpful to have a linting baseline. However, > > there's no need to shuffle around the deck chairs too much, because most > > of this code will be removed once t

[PATCH 08/20] qapi/parser: differentiate intro and outro paragraphs

2024-05-14 Thread John Snow
Add a semantic tag to paragraphs that appear *before* tagged sections/members/features and those that appear after. This will control how they are inlined when doc sections are merged and flattened. Signed-off-by: John Snow --- scripts/qapi/parser.py | 22 +- 1 file changed

[PATCH 11/20] qapi/schema: add doc_visible property to QAPISchemaDefinition

2024-05-14 Thread John Snow
he objects that should be rendered *are* by failing if any cross-references are missing, verifying everything is in place. Signed-off-by: John Snow --- scripts/qapi/schema.py | 40 1 file changed, 40 insertions(+) diff --git a/scripts/qapi/schema.py b/scripts/qapi

[PATCH 18/20] qapi: ensure all errors sections are uniformly typset

2024-05-14 Thread John Snow
Transactions have the only instance of an Errors section that isn't a rST list; turn it into one. Signed-off-by: John Snow --- qapi/transaction.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qapi/transaction.json b/qapi/transaction.json index 5749c133d4a..07afc269d54

[PATCH 09/20] qapi/parser: add undocumented stub members to all_sections

2024-05-14 Thread John Snow
This helps simplify the doc generator if it doesn't have to check for undocumented members. Signed-off-by: John Snow --- scripts/qapi/parser.py | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index

[PATCH 05/20] qapi/parser: adjust info location for doc body section

2024-05-14 Thread John Snow
Instead of using the info object for the doc block as a whole, update the info pointer for each call to ensure_untagged_section when the existing section is otherwise empty. This way, Sphinx error information will match precisely to where the text actually starts. Signed-off-by: John Snow

[PATCH 19/20] qapi: convert "Note" sections to plain rST

2024-05-14 Thread John Snow
: .. Note:: ... .. admonition:: custom title admonition body text This patch uses ".. notes::" almost everywhere, with just two "caution" directives. ".. admonition:: notes" is used in a few places where we had an ordered list of multiple notes. Signed-off-

[PATCH 16/20] qapi: rewrite StatsFilter comment

2024-05-14 Thread John Snow
Rewrite the StatsFilter intro paragraph to be more meaningful to end-users when it is inlined in generated documentation. Signed-off-by: John Snow --- qapi/stats.json | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/qapi/stats.json b/qapi/stats.json index 578b52c7ef7

[PATCH 06/20] qapi/parser: fix comment parsing immediately following a doc block

2024-05-14 Thread John Snow
If a comment immediately follows a doc block, the parser doesn't ignore that token appropriately. Fix that. Signed-off-by: John Snow --- scripts/qapi/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 41b9319e5cb

[PATCH 07/20] qapi/parser: add semantic 'kind' parameter to QAPIDoc.Section

2024-05-14 Thread John Snow
ll_sections, we need *something* accessible to distinguish them. To keep types simple, add this semantic parameter to the base Section and not just ArgSection; we can use this to filter out paragraphs and tagged sections, too. Signed-off-by: John Snow --- scripts/qapi/parser.py | 25 +

[PATCH 01/20] [DO-NOT-MERGE]: Add some ad-hoc linting helpers.

2024-05-14 Thread John Snow
orry about that! Signed-off-by: John Snow --- scripts/qapi-lint.sh | 51 +++ scripts/qapi/Makefile | 5 + 2 files changed, 56 insertions(+) create mode 100755 scripts/qapi-lint.sh create mode 100644 scripts/qapi/Makefile diff --git a/scripts/qapi

[PATCH 04/20] qapi/parser: preserve indentation in QAPIDoc sections

2024-05-14 Thread John Snow
or rST.) Signed-off-by: John Snow --- docs/sphinx/qapidoc.py | 36 +- scripts/qapi/parser.py | 8 ++-- tests/qapi-schema/doc-good.out | 32 +++--- 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/docs/sphinx/qapi

[PATCH 02/20] qapi: linter fixups

2024-05-14 Thread John Snow
Fix minor irritants to pylint/flake8 et al. (Yes, these need to be guarded by the Python tests. That's a work in progress, a series that's quite likely to follow once I finish this Sphinx project. Please pardon the temporary irritation.) Signed-off-by: John Snow --- scripts/qapi/introspect.py

[PATCH 20/20] qapi: convert "Example" sections to rST

2024-05-14 Thread John Snow
aptions manually. (Tedious, oh well.) 3. Add captions where still needed: sed -zi 's|# .. code-block:: QMP\n#\n|# .. code-block:: QMP\n#:caption: Example\n#\n|g' *.json Not fully ideal, but hopefully not something that has to be done very often. (Or ever aga

[PATCH 14/20] qapi: fix non-compliant JSON examples

2024-05-14 Thread John Snow
t;, so two examples have been adjusted to support that format here. Signed-off-by: John Snow --- qapi/control.json | 3 ++- qapi/machine.json | 2 +- qapi/migration.json | 2 +- qapi/misc.json | 3 ++- qapi/net.json | 6 +++--- qapi/rocker.json| 2 +- qapi/ui.json| 2 +

[PATCH 15/20] qapi: remove developer factoring comments from QAPI doc blocks

2024-05-14 Thread John Snow
to *either* audience, and convert what's left to garden-variety comments to prevent it from showing up in rendered documentation. Signed-off-by: John Snow --- qapi/audio.json| 5 ++--- qapi/block-core.json | 47 ++ qapi/block-export.json | 10 -

[PATCH 17/20] qapi: rewrite BlockExportOptions doc block

2024-05-14 Thread John Snow
Rephrase this paragraph so that it can apply to any commands that inherit from this object. Signed-off-by: John Snow --- qapi/block-export.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qapi/block-export.json b/qapi/block-export.json index dc328097a94

[PATCH 03/20] docs/qapidoc: delint a tiny portion of the module

2024-05-14 Thread John Snow
tall black" (without root permissions) if you do not have it installed otherwise. Signed-off-by: John Snow --- docs/sphinx/qapidoc.py | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/sphinx/qapidoc.py b/docs/sphinx/qapidoc.py index f270b494f01..165568

[PATCH 00/20] qapi: new sphinx qapi domain pre-requisites

2024-05-14 Thread John Snow
cleanup Patches 4-12: QAPI generator fixes/miscellany Patch 13: qapidoc.py fix (to prepare for rST conversion) Patches 14-20: QAPI documentation modifications, rST conversion Sorry, --js John Snow (20): [DO-NOT-MERGE]: Add some ad-hoc linting helpers. qapi: linter fixups docs/qapidoc: delint

[PATCH 13/20] docs/qapidoc: fix nested parsing under untagged sections

2024-05-14 Thread John Snow
parsing an untagged section (free paragraphs), skip making a hollow section and instead append the parse results to the prior section. Many Bothans died to bring us this information. Signed-off-by: John Snow --- docs/sphinx/qapidoc.py | 16 +++- 1 file changed, 11 insertions(+), 5

[PATCH 10/20] qapi/schema: add __iter__ method to QAPISchemaVariants

2024-05-14 Thread John Snow
else []: ... against: for var in variants or []: ... Update callsites to reflect the new usage pattern. Signed-off-by: John Snow --- docs/sphinx/qapidoc.py | 2 +- scripts/qapi/introspect.py | 4 ++-- scripts/qapi/schema.py | 8 ++-- scripts/qapi/types.py | 4

[PATCH 12/20] qapi/source: allow multi-line QAPISourceInfo advancing

2024-05-14 Thread John Snow
This is for the sake of the new rST generator (the "transmogrifier") so we can advance multiple lines on occasion while keeping the generated<-->source mappings accurate. next_line now simply takes an optional n parameter which chooses the number of lines to advance. Signed-o

Re: [PATCH 00/27] Add qapi-domain Sphinx extension

2024-04-23 Thread John Snow
On Tue, Apr 23, 2024, 3:48 AM Markus Armbruster wrote: > John Snow writes: > > > On Mon, Apr 22, 2024 at 12:38 PM John Snow wrote: > >> > >> On Mon, Apr 22, 2024 at 5:20 AM Markus Armbruster > wrote: > >> > > >> > John Snow writ

Re: [PATCH 00/27] Add qapi-domain Sphinx extension

2024-04-22 Thread John Snow
On Mon, Apr 22, 2024 at 12:38 PM John Snow wrote: > > On Mon, Apr 22, 2024 at 5:20 AM Markus Armbruster wrote: > > > > John Snow writes: > > > > > On Fri, Apr 19, 2024, 10:45 AM Markus Armbruster > > > wrote: > > > > > >> John S

Re: [PATCH 00/27] Add qapi-domain Sphinx extension

2024-04-22 Thread John Snow
On Mon, Apr 22, 2024 at 5:20 AM Markus Armbruster wrote: > > John Snow writes: > > > On Fri, Apr 19, 2024, 10:45 AM Markus Armbruster wrote: > > > >> John Snow writes: > >> > >> > This series adds a new qapi-domain extension for Sphi

Re: [PATCH 24/27] docs/qapi-domain: add type cross-refs to field lists

2024-04-19 Thread John Snow
On Fri, Apr 19, 2024 at 12:38 AM John Snow wrote: > > This commit, finally, adds cross-referencing support to various field > lists; modeled tightly after Sphinx's own Python domain code. > > Cross-referencing support is added to type names provided to :arg:, > :memb:, :re

Re: [PATCH 00/27] Add qapi-domain Sphinx extension

2024-04-19 Thread John Snow
On Fri, Apr 19, 2024, 10:45 AM Markus Armbruster wrote: > John Snow writes: > > > This series adds a new qapi-domain extension for Sphinx, which adds a > > series of custom directives for documenting QAPI definitions. > > > > GitLab CI: https://gitlab.com/jsn

[PATCH 21/27] docs/qapi-domain: RFC patch - add malformed field list entries

2024-04-18 Thread John Snow
This patch demonstrates what happens when you mess up a field list entry. The next patch adds a safeguard against this. Signed-off-by: John Snow --- docs/qapi/index.rst | 4 1 file changed, 4 insertions(+) diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst index c68e2044890

[PATCH 11/27] docs/qapi-domain: add "Errors:" field lists

2024-04-18 Thread John Snow
it as a regular field list and doesn't apply the special Grouping postprocessing to it.) Signed-off-by: John Snow --- docs/qapi/index.rst| 4 docs/sphinx/qapi-domain.py | 6 ++ 2 files changed, 10 insertions(+) diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst index a570c37abb2

[PATCH 20/27] docs/qapi-domain: add :ifcond: directive option

2024-04-18 Thread John Snow
nes!" Signed-off-by: Harmonie Snow Signed-off-by: John Snow --- docs/qapi/index.rst| 1 + docs/sphinx-static/theme_overrides.css | 13 + docs/sphinx/qapi-domain.py | 37 -- 3 files changed, 49 insertions(+), 2 deletions(

[PATCH 13/27] docs/qapi-domain: add qapi:enum directive

2024-04-18 Thread John Snow
type names, but will exclude commands, events, and modules from consideration. Signed-off-by: John Snow --- docs/qapi/index.rst| 14 ++ docs/sphinx/qapi-domain.py | 24 2 files changed, 38 insertions(+) diff --git a/docs/qapi/index.rst b/docs/qapi/index

[PATCH 14/27] docs/qapi-domain: add qapi:alternate directive

2024-04-18 Thread John Snow
ation is superfluous for user documentation. Room for future improvement, but not now. Signed-off-by: John Snow --- docs/qapi/index.rst| 7 +++ docs/sphinx/qapi-domain.py | 19 +++ 2 files changed, 26 insertions(+) diff --git a/docs/qapi/index.rst b/docs/qapi/index.r

[PATCH 08/27] docs/qapi-domain: add :since: directive option

2024-04-18 Thread John Snow
Add a little special markup for registering "Since:" information. Adding it as an option instead of generic content lets us hoist the information into the Signature bar, optionally put it in the index, etc. Signed-off-by: John Snow --- docs/qapi/index.rst| 1 + docs/s

[PATCH 24/27] docs/qapi-domain: add type cross-refs to field lists

2024-04-18 Thread John Snow
al, so we're a bit hosed either way. Do the simpler thing. Signed-off-by: John Snow --- docs/qapi/index.rst| 34 docs/sphinx/qapi-domain.py | 110 +++-- 2 files changed, 138 insertions(+), 6 deletions(-) diff --git a/docs/qapi/index.rst b/doc

[PATCH 04/27] docs/qapi-domain: add QAPI index

2024-04-18 Thread John Snow
Use the QAPI object registry to generate a special index just for QAPI definitions. The index can show entries both by definition type and alphabetically. The index can be linked from anywhere in the QEMU manual by using `qapi-index`. Signed-off-by: John Snow --- docs/qapi/index.rst

[PATCH 02/27] docs/qapi-domain: add qapi:module directive

2024-04-18 Thread John Snow
, this commit also adds a test document that demonstrates the functionality-so-far to allow reviewers to easily test and experiment with each commit. The eventual submission for inclusion will remove this playground file.) Signed-off-by: John Snow --- docs/index.rst | 1 + docs/qapi

[PATCH 25/27] docs/qapi-domain: implement error context reporting fix

2024-04-18 Thread John Snow
Sphinx's own parsing a no-op. Then, in transform_content (which occurs after Sphinx's nested parse), we simply swap our own parsed content tree back in for Sphinx's. It appears a little tricky, but it's the nicest solution I can find. Signed-off-by: John Snow --- docs/sphinx/qapi-domain.py | 22

[PATCH 17/27] docs/qapi-domain: add qapi:union and qapi:branch directives

2024-04-18 Thread John Snow
.) I'm open to suggestions, but wrestling with Sphinx, html and css is time consuming (for me, at least), so ultimately, I'm afraid I must say: ***PATCHES WELCOME***. Signed-off-by: John Snow --- docs/qapi/index.rst| 37 ++ docs/sphinx/qapi-domain.py | 98 +

[PATCH 18/27] docs/qapi-domain: add :deprecated: directive option

2024-04-18 Thread John Snow
;) Signed-off-by: Harmonie Snow Signed-off-by: John Snow --- docs/qapi/index.rst| 4 docs/sphinx-static/theme_overrides.css | 25 + docs/sphinx/qapi-domain.py | 24 3 files changed, 53 insertions(+) diff

[PATCH 07/27] docs/qapi-domain: add qapi:command directive

2024-04-18 Thread John Snow
th a pragma. Signed-off-by: John Snow --- docs/qapi/index.rst| 34 ++ docs/sphinx/qapi-domain.py | 132 - 2 files changed, 165 insertions(+), 1 deletion(-) diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst index e2223d5f363..5516f762a24 10

[PATCH 16/27] docs/qapi-domain: add qapi:struct directive

2024-04-18 Thread John Snow
at for now. Signed-off-by: John Snow --- docs/qapi/index.rst| 16 docs/sphinx/qapi-domain.py | 9 + 2 files changed, 25 insertions(+) diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst index d81bccfb06a..b07e6e9e2e3 100644 --- a/docs/qapi/index.rst +++ b

[PATCH 15/27] docs/qapi-domain: add qapi:event directive

2024-04-18 Thread John Snow
or example blocks in this sample demo. Signed-off-by: John Snow --- docs/qapi/index.rst| 40 ++ docs/sphinx/qapi-domain.py | 25 2 files changed, 65 insertions(+) diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst index 9

[PATCH 19/27] docs/qapi-domain: add :unstable: directive option

2024-04-18 Thread John Snow
t attached to a definition contains the "unstable" entry.) RFC: Same comments as last patch. Signed-off-by: Harmonie Snow Signed-off-by: John Snow --- docs/qapi/index.rst| 4 +++- docs/sphinx-static/theme_overrides.css | 6 +- docs/sphinx/qapi-domain.py |

[PATCH 10/27] docs/qapi-domain: add "Features:" field lists

2024-04-18 Thread John Snow
-member features as deemed appropriate. It's essentially free-form text. Signed-off-by: John Snow --- docs/qapi/index.rst| 6 ++ docs/sphinx/qapi-domain.py | 11 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst index

[PATCH 06/27] docs/qapi-domain: add QAPI xref roles

2024-04-18 Thread John Snow
s possible it's extraneous. It may possibly be worth keeping just to keep feature parity with Sphinx's other domains; e.g. "principle of least surprise". Dunno. Signed-off-by: John Snow --- docs/qapi/index.rst| 4 +++ docs/sphinx/qapi-domain.py | 67 +++

[PATCH 27/27] docs/qapi-domain: add CSS styling

2024-04-18 Thread John Snow
From: Harmonie Snow Improve the general look and feel of generated QAPI docs. Attempt to limit line lengths to offer a more comfortable measure on maximized windows, and improve some margin and spacing for field lists. Signed-off-by: Harmonie Snow Signed-off-by: John Snow --- docs/sphinx

[PATCH 23/27] docs/qapi-domain: RFC patch - delete malformed field lists

2024-04-18 Thread John Snow
Cleanup of the last patch to fix the build before closing out this RFC series. Signed-off-by: John Snow --- docs/qapi/index.rst | 4 1 file changed, 4 deletions(-) diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst index ef58dfc4bcd..8352a27d4a5 100644 --- a/docs/qapi/index.rst +++ b

[PATCH 01/27] docs/sphinx: create QAPI domain extension stub

2024-04-18 Thread John Snow
It doesn't really do anything yet, we'll get to it brick-by-brick in the forthcoming commits to keep the series breezy and the git history informative. Signed-off-by: John Snow --- docs/conf.py | 3 ++- docs/sphinx/qapi-domain.py | 50 ++ 2

[PATCH 22/27] docs/qapi-domain: add warnings for malformed field lists

2024-04-18 Thread John Snow
r checking in action. The next commit drops the erroneous fields. Signed-off-by: John Snow --- docs/conf.py | 12 docs/qapi/index.rst| 27 + docs/sphinx/qapi-domain.py | 59 ++ 3 files changed, 98 insertions(+) diff

[PATCH 09/27] docs/qapi-domain: add "Arguments:" field lists

2024-04-18 Thread John Snow
t what you want. Signed-off-by: John Snow --- docs/qapi/index.rst| 15 +++ docs/sphinx/qapi-domain.py | 14 -- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/qapi/index.rst b/docs/qapi/index.rst index 33b9349a3ee..197587bbc81 100644 --- a

[PATCH 26/27] docs/qapi-domain: RFC patch - Add one last sample command

2024-04-18 Thread John Snow
Just to have a bit more to look at in the generated doc, here's a fairly complex command with a lot of bells and whistles. Signed-off-by: John Snow --- docs/qapi/index.rst | 67 + 1 file changed, 67 insertions(+) diff --git a/docs/qapi/index.rst b

[PATCH 03/27] docs/qapi-module: add QAPI domain object registry

2024-04-18 Thread John Snow
is adapted directly from sphinx.domains.python; it is unclear to me if there ever would be a collision on merge, hence the assertion. I haven't been able to trigger it or find better code to use as a template, so probably I'll just leave the assertion in there. Signed-off-by: John Snow --- docs

[PATCH 00/27] Add qapi-domain Sphinx extension

2024-04-18 Thread John Snow
Hope you like it! --js Harmonie Snow (1): docs/qapi-domain: add CSS styling John Snow (26): docs/sphinx: create QAPI domain extension stub docs/qapi-domain: add qapi:module directive docs/qapi-module: add QAPI domain object registry docs/qapi-domain: add QAPI index docs/qapi-domain: add re

[PATCH 05/27] docs/qapi-domain: add resolve_any_xref()

2024-04-18 Thread John Snow
in this series.) Once again, this code is based very heavily on sphinx.domains.python. Signed-off-by: John Snow --- docs/qapi/index.rst| 7 +++ docs/sphinx/qapi-domain.py | 95 +- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/docs/qapi

[PATCH 12/27] docs/qapi-domain: add "Returns:" field lists

2024-04-18 Thread John Snow
both the imperative and indicative forms (:return: and :returns:) to allow doc writers to use whichever mood "feels right" in the source document. The rendered output will always use the "Returns:" label, however. I'm sure you'll let me know how you feel about that. O:-) Signed-off-b

Re: [PATCH 3/3] qapi: Fix bogus documentation of query-migrationthreads

2024-03-22 Thread John Snow
> > The command name violates QAPI naming rules: it should be > query-migration-threads. Too late to fix. > > Reported-by: John Snow > Fixes: 671326201dac (migration: Introduce interface query-migrationthreads) > Signed-off-by: Markus Armbruster > Reviewed-by: John Snow -

Re: [PATCH 01/12] qapi: Drop stray Arguments: line from qmp_capabilities docs

2024-03-22 Thread John Snow
On Fri, Mar 22, 2024, 10:09 AM Markus Armbruster wrote: > Reported-by: John Snow > Fixes: 119ebac1feb2 (qapi-schema: use generated marshaller for > 'qmp_capabilities') > Signed-off-by: Markus Armbruster > Reviewed-by: John Snow --- > qapi/control.json | 2 -- > 1 file

Re: [PATCH v5 24/25] qapi: Tighten check whether implicit object type already exists

2024-03-19 Thread John Snow
On Tue, Mar 19, 2024, 12:02 PM Markus Armbruster wrote: > John Snow writes: > > > On Fri, Mar 15, 2024, 11:23 AM Markus Armbruster > wrote: > > > >> Entities with names starting with q_obj_ are implicit object types. > >> Therefore, QAPISchema._make_

Re: [PATCH v5 25/25] qapi: Dumb down QAPISchema.lookup_entity()

2024-03-19 Thread John Snow
urn typ > +typ = self.lookup_entity(name) > +if isinstance(typ, QAPISchemaType): > +return typ > + return None > > def resolve_type( > self, > -- > 2.44.0 > Sure, dealer's choice. with your commit message fixup: Reviewed-by: John Snow >

Re: [PATCH v5 24/25] qapi: Tighten check whether implicit object type already exists

2024-03-19 Thread John Snow
Seems obviously fine, though I don't suppose this narrowing will be "remembered" by the type system. Do we care? Reviewed-by: John Snow >

Re: [PATCH v5 12/25] qapi: Assert built-in types exist

2024-03-19 Thread John Snow
pe to work queue if new > if typ not in self._used_types: > self._used_types.append(typ) > -- > 2.44.0 > Yeah, if you like this more, go ahead. I know it works because I did it this way at one point! Matter of taste and preference etc. Reviewed-by: John Snow >

Re: [PATCH v4 21/23] qapi/schema: add type hints

2024-03-15 Thread John Snow
On Fri, Mar 15, 2024, 10:03 AM Markus Armbruster wrote: > John Snow writes: > > > This patch only adds type hints, which aren't utilized at runtime and > > don't change the behavior of this module in any way. > > > > In a scant few locations, type hints are removed

Re: [PATCH v4 00/23] qapi: statically type schema.py

2024-03-14 Thread John Snow
On Thu, Mar 14, 2024, 10:43 AM Markus Armbruster wrote: > John Snow writes: > > > This is *v4*, for some definitions of "version" and "four". > > Series > Reviewed-by: Markus Armbruster > > I'll replace PATCH 12, not because it's wrong, just bec

Re: [PATCH v4 05/23] qapi: create QAPISchemaDefinition

2024-03-14 Thread John Snow
On Thu, Mar 14, 2024, 10:04 AM Markus Armbruster wrote: > John Snow writes: > > > On Thu, Mar 14, 2024, 5:12 AM Markus Armbruster > wrote: > > > >> John Snow writes: > >> > >> > Include entities don't have names, but we generally expec

Re: [PATCH v4 16/23] qapi/schema: Don't initialize "members" with `None`

2024-03-14 Thread John Snow
On Thu, Mar 14, 2024, 9:58 AM Markus Armbruster wrote: > John Snow writes: > > > On Thu, Mar 14, 2024, 9:01 AM Markus Armbruster > wrote: > > > >> John Snow writes: > >> > >> > Declare, but don't initialize the "members

Re: [PATCH v4 16/23] qapi/schema: Don't initialize "members" with `None`

2024-03-14 Thread John Snow
On Thu, Mar 14, 2024, 9:01 AM Markus Armbruster wrote: > John Snow writes: > > > Declare, but don't initialize the "members" field with type > > List[QAPISchemaObjectTypeMember]. > > > > This simplifies the typing from what would otherwise b

Re: [PATCH v4 05/23] qapi: create QAPISchemaDefinition

2024-03-14 Thread John Snow
On Thu, Mar 14, 2024, 5:12 AM Markus Armbruster wrote: > John Snow writes: > > > Include entities don't have names, but we generally expect "entities" to > > have names. Reclassify all entities with names as *definitions*, leaving > > the nameless include enti

Re: [PATCH v3 14/20] qapi/schema: Don't initialize "members" with `None`

2024-03-13 Thread John Snow
On Wed, Mar 13, 2024, 2:57 AM Markus Armbruster wrote: > John Snow writes: > > > On Tue, Feb 20, 2024 at 10:03 AM Markus Armbruster > wrote: > >> > >> John Snow writes: > >> > >> > Declare, but don't initialize the "memb

[PATCH v4 05/23] qapi: create QAPISchemaDefinition

2024-03-12 Thread John Snow
ers expect for properties of an "entity". Suggested-by: Markus Armbruster Signed-off-by: John Snow --- scripts/qapi/schema.py | 144 +++-- 1 file changed, 82 insertions(+), 62 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.

[PATCH v4 09/23] qapi/schema: adjust type narrowing for mypy's benefit

2024-03-12 Thread John Snow
"Optional[QAPISchemaObjectType]") [assignment] qapi/schema.py:893: error: Incompatible types in assignment (expression has type "QAPISchemaType", variable has type "Optional[QAPISchemaObjectType]") [assignment] A simple change to use a temporary variable helps the med

[PATCH v4 21/23] qapi/schema: add type hints

2024-03-12 Thread John Snow
need string quotes are changed. Signed-off-by: John Snow --- scripts/qapi/schema.py | 568 - 1 file changed, 396 insertions(+), 172 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 3b8c2ebbb5f..d2faaea6eac 100644 --- a/scripts

[PATCH v4 12/23] qapi: use schema.resolve_type instead of schema.lookup_type

2024-03-12 Thread John Snow
SchemaType = ret which can be replaced with the simpler: typ = resolve_type("foo") Signed-off-by: John Snow --- scripts/qapi/introspect.py | 4 ++-- scripts/qapi/schema.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/qapi/introspect.py b/script

[PATCH v4 15/23] qapi/schema: add _check_complete flag

2024-03-12 Thread John Snow
l to check()) in order to simplify the static typing of that field; avoiding the need of assertions littered at many callsites to eliminate the possibility of the None value. Signed-off-by: John Snow --- scripts/qapi/schema.py | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sc

[PATCH v4 03/23] qapi: sort pylint suppressions

2024-03-12 Thread John Snow
Suggested-by: Markus Armbruster Signed-off-by: John Snow --- scripts/qapi/pylintrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/pylintrc b/scripts/qapi/pylintrc index 90546df5345..1342412c3cf 100644 --- a/scripts/qapi/pylintrc +++ b/scripts/qapi

[PATCH v4 07/23] qapi/schema: declare type for QAPISchemaArrayType.element_type

2024-03-12 Thread John Snow
-by: John Snow --- scripts/qapi/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 8440a7243d8..c549a4e3bd0 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -381,7 +381,7 @@ def __init__(self, name

[PATCH v4 22/23] qapi/schema: turn on mypy strictness

2024-03-12 Thread John Snow
This patch can be rolled in with the previous one once the series is ready for merge, but for work-in-progress' sake, it's separate here. Signed-off-by: John Snow --- scripts/qapi/mypy.ini | 5 - 1 file changed, 5 deletions(-) diff --git a/scripts/qapi/mypy.ini b/scripts/qapi/mypy.ini

[PATCH v4 14/23] qapi/schema: assert info is present when necessary

2024-03-12 Thread John Snow
the hump, to enable adding type hints in a forthcoming commit. Signed-off-by: John Snow --- scripts/qapi/schema.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 22e065fc13d..d514b3c28f6 100644 --- a/scripts/qapi/schema.py +++ b/scripts

[PATCH v4 13/23] qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type

2024-03-12 Thread John Snow
Optional[str]. mypy does not know that 'info', when it is a QAPISourceInfo object, cannot ever be false.) Signed-off-by: John Snow --- scripts/qapi/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 58ec3a7c41c

[PATCH v4 18/23] qapi/schema: assert inner type of QAPISchemaVariants in check_clash()

2024-03-12 Thread John Snow
s enforced at runtime in QAPISchemaVariants.check(). This relationship is not embedded in the type system though, so QAPISchemaVariants.check_clash() needs to re-assert this property in order to call QAPISchemaVariant.type.check_clash(). Signed-off-by: John Snow --- scripts/qapi/schema.py | 5 +++

[PATCH v4 02/23] qapi/parser: shush up pylint

2024-03-12 Thread John Snow
Shhh! Signed-off-by: John Snow --- scripts/qapi/parser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index fed88e9074d..ec4ebef4e33 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -607,6 +607,7 @@ class QAPIDoc

[PATCH v4 23/23] qapi/schema: remove unnecessary asserts

2024-03-12 Thread John Snow
With strict typing enabled, these runtime statements aren't necessary anymore; we can prove them statically. Signed-off-by: John Snow --- scripts/qapi/schema.py | 25 - 1 file changed, 25 deletions(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index

[PATCH v4 10/23] qapi/schema: add type narrowing to lookup_type()

2024-03-12 Thread John Snow
This function is a bit hard to type as-is; mypy needs some assertions to assist with the type narrowing. Signed-off-by: John Snow --- scripts/qapi/schema.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index eeecdda1b58

[PATCH v4 08/23] qapi/schema: make c_type() and json_type() abstract methods

2024-03-12 Thread John Snow
These methods should always return a str, it's only the default abstract implementation that doesn't. They can be marked "abstract", which requires subclasses to override the method with the proper return type. Signed-off-by: John Snow --- scripts/qapi/schema.py | 5 - 1 file

[PATCH v4 19/23] qapi/parser: demote QAPIExpression to Dict[str, Any]

2024-03-12 Thread John Snow
strictness improvements later. Signed-off-by: John Snow --- scripts/qapi/parser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index ec4ebef4e33..2f3c704fa24 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -

[PATCH v4 16/23] qapi/schema: Don't initialize "members" with `None`

2024-03-12 Thread John Snow
pty object as an example. For this reason, we cannot use the empty list as a replacement test for full initialization and instead rely on the _checked/_check_complete fields.) Signed-off-by: John Snow --- scripts/qapi/schema.py | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git

[PATCH v4 17/23] qapi/schema: fix typing for QAPISchemaVariants.tag_member

2024-03-12 Thread John Snow
the typing in quite a few places and avoids needing to assert that the "tag_member is not None" at a dozen callsites, which can be confusing and suggest the wrong thing to a drive-by contributor. Signed-off-by: John Snow --- scripts/qapi/schema.py | 22 +++-

[PATCH v4 00/23] qapi: statically type schema.py

2024-03-12 Thread John Snow
api/parser: demote QAPIExpression to Dict[str, Any]' 017/19:[0042] [FC] 'qapi/schema: add type hints' Mostly contextual changes. 018/19:[] [--] 'qapi/schema: turn on mypy strictness' 019/19:[0006] [FC] 'qapi/schema: remove unnecessary asserts' Zapped a few more. John Snow (23): qapi/

[PATCH v4 20/23] qapi/parser.py: assert member.info is present in connect_member

2024-03-12 Thread John Snow
Signed-off-by: John Snow --- scripts/qapi/parser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 2f3c704fa24..7b13a583ac1 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -707,6 +707,7 @@ def append_line(self, line

[PATCH v4 11/23] qapi/schema: assert resolve_type has 'info' and 'what' args on error

2024-03-12 Thread John Snow
tually use a None value in practice, currently. Signed-off-by: John Snow --- scripts/qapi/schema.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index b157a3b2bd8..f5c7789d98f 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -99

[PATCH v4 01/23] qapi/parser: fix typo - self.returns.info => self.errors.info

2024-03-12 Thread John Snow
Small copy-pasto. The correct info field to use in this conditional block is self.errors.info. Fixes: 3a025d3d1ffa Signed-off-by: John Snow --- scripts/qapi/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index

  1   2   3   4   5   6   7   8   9   10   >