Skip to content

✨ feat(overloads): add opt-out control for overload rendering#645

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:642
Mar 1, 2026
Merged

✨ feat(overloads): add opt-out control for overload rendering#645
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:642

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

PR #625 introduced automatic overload signature rendering, which works well for many cases but can produce noisy output when overloads are better described in prose. Users need a way to selectively disable this behavior without losing it entirely across their project.

This adds two complementary opt-out mechanisms: a typehints_document_overloads Sphinx config option (default True) for project-wide control, and a :no-overloads: docstring directive for per-function suppression. The directive is automatically stripped from the rendered output. Both approaches follow existing patterns — the config mirrors typehints_document_rtype, and the directive works like other RST field-list markers.

The overload injection logic was also refactored from a single monolithic function into three focused helpers to stay within linting complexity thresholds while accommodating the new checks.

Closes #642

@gaborbernat
gaborbernat force-pushed the 642 branch 2 times, most recently from 07a942c to e55b02f Compare March 1, 2026 15:29
Overload signatures injected by PR tox-dev#625 are sometimes better described
in prose. This adds two mechanisms to disable them:

- `typehints_document_overloads` config option (default True) for
  global control
- `:no-overloads:` docstring directive for per-function opt-out,
  stripped from output automatically

Refactored _inject_overload_signatures into focused helpers to keep
complexity within linting thresholds.

Closes tox-dev#642
@gaborbernat
gaborbernat enabled auto-merge (squash) March 1, 2026 15:30
@gaborbernat
gaborbernat merged commit 622b562 into tox-dev:main Mar 1, 2026
8 checks passed
@gaborbernat
gaborbernat deleted the 642 branch July 10, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Option to globally disable overload rendering

1 participant