Skip to content

common: drop args from the meta model - #143

Merged
rr- merged 1 commit into
mainfrom
rework/5-drop-args
Nov 6, 2026
Merged

rr- merged 1 commit into
mainfrom
rework/5-drop-args

Conversation

@rr-

@rr- rr- commented Nov 6, 2026

Copy link
Copy Markdown
Owner

This PR removes DocstringMeta.args.

args held a meta's key plus the words of its head, shaped differently by every style: ReST's :param int x: gave ["param", "int", "x"], Google's x (int): gave ["param", "x (int)"], Numpydoc's x : int gave ["param", "x"]. Now that a meta has a kind, its own fields cover the rest:

  • key: the field or section name it was written with (param, keyword, see_also...).
  • name: for a text item, the words after its key, such as x in ReST's :ivar x:.
  • extra: words after a Google param's type, as in x (int) more:. These only lived in args before; Google compose now writes them back.

The meta classes no longer take args; they take key= instead. This is a breaking change. None of the 7 known PyPI users of docstring_parser (cyclopts, jsonargparse, tyro, instructor, mirascope, simple_parsing, tap) reads args or builds metas.

No output change besides the case files and the 3 Google docstrings with words after a type (just parity). Speed is within 2% of main.

@rr- rr- self-assigned this Nov 6, 2026
`DocstringMeta.args` held a field's key and the words of its head, in a
shape that differed by style: ReST's `:param int x:` gave
`["param", "int", "x"]`, Google's `x (int):` gave `["param", "x (int)"]`
and Numpydoc's `x : int` gave `["param", "x"]`. With `kind` saying what
a meta documents, its own fields say the rest, so remove `args`.

What only `args` held moves to fields: `key`, the name the item was
written with, and for a text item `name`, the words after its key, as
in ReST's `:ivar x:`. The meta classes take the key as a keyword
argument instead of `args` first.

The words after a Google param's type, as in `x (int) more:`, lived
only in `args`. They are the meta's new `extra`, which Google's
`compose()` writes back.

None of the 7 packages on PyPI known to use docstring_parser reads
`args`. Case files lose `args` and show `key`, `name` and `extra`;
`just parity` shows 3 of 29,063 docstrings changing, the Google ones
with words after a type, which compose now keeps.
@rr-
rr- force-pushed the rework/5-drop-args branch from d26a66f to 437fe5f Compare November 6, 2026 09:57
@rr-
rr- merged commit 0ded151 into main Nov 6, 2026
26 checks passed
@rr-
rr- deleted the rework/5-drop-args branch November 6, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant