✨ feat(overloads): add opt-out control for overload rendering#645
Merged
Conversation
gaborbernat
force-pushed
the
642
branch
2 times, most recently
from
March 1, 2026 15:29
07a942c to
e55b02f
Compare
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
enabled auto-merge (squash)
March 1, 2026 15:30
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.
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_overloadsSphinx config option (defaultTrue) 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 mirrorstypehints_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