Skip to content

google+numpydoc: stop customising via internals - #145

Merged
rr- merged 1 commit into
mainfrom
rework/7-drop-hooks
Nov 6, 2026
Merged

rr- merged 1 commit into
mainfrom
rework/7-drop-hooks

Conversation

@rr-

@rr- rr- commented Nov 6, 2026

Copy link
Copy Markdown
Owner

This PR stops treating parser internals as a way to customise parsing, now that SectionSpec covers it.

  • Google: titles_re is private, and _build_meta, _build_single_meta and _build_multi_meta are folded into private methods and functions.
  • Numpydoc: Section.title_pattern, Section.parse and KV_REGEX are private, and overriding _parse_item is no longer supported.

This is a breaking change. None of the 7 known PyPI users of docstring_parser overrides any of these. The README table maps each old way to its SectionSpec replacement.

Auto-detection no longer checks Numpydoc sections for custom title patterns. The tests that pinned overriding are gone; the ones for title_colon=False and custom Section objects stay.

No output change (just parity), and speed matches main.

`SectionSpec` covers what overriding a parser's internals was for, so
those internals stop being a way to customise parsing:

- Google's `titles_re` becomes private, and `_build_meta`,
  `_build_single_meta` and `_build_multi_meta` are folded into private
  methods and functions.
- Numpydoc's `Section.title_pattern`, `Section.parse` and `KV_REGEX`
  become private, and `_parse_item` is no longer meant to be overridden.

None of the 7 packages on PyPI known to use docstring_parser overrides
any of them. Auto-detection no longer checks the Numpydoc sections for
custom title patterns, and the tests that pinned overriding go; those
for `title_colon=False` and custom `Section` objects stay.

No output changes: `just parity` finds no difference.
@rr- rr- self-assigned this Nov 6, 2026
@rr-
rr- merged commit 2e317ff into main Nov 6, 2026
26 checks passed
@rr-
rr- deleted the rework/7-drop-hooks 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