Repository navigation
common: drop args from the meta model - #143
Merged
Merged
Conversation
`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-
force-pushed
the
rework/5-drop-args
branch
from
November 6, 2026 09:57
d26a66f to
437fe5f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes
DocstringMeta.args.argsheld 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'sx (int):gave["param", "x (int)"], Numpydoc'sx : intgave["param", "x"]. Now that a meta has akind, 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 asxin ReST's:ivar x:.extra: words after a Google param's type, as inx (int) more:. These only lived inargsbefore; Google compose now writes them back.The meta classes no longer take
args; they takekey=instead. This is a breaking change. None of the 7 known PyPI users of docstring_parser (cyclopts, jsonargparse, tyro, instructor, mirascope, simple_parsing, tap) readsargsor 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.