docs: suppress @typing.overload signature stacking#2034
Open
g-despot wants to merge 2 commits into
Open
Conversation
Sphinx autodoc detects @overload via AST parsing and stacks every overload variant with full inline type hints, ignoring autodoc_typehints = "description". Patch ModuleAnalyzer.analyze to clear overload collection so each method renders as a single clean signature with type info in the description block. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
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.
Summary
@typing.overloadvia AST parsing and stacks every overload variant inline with full type hints, overridingautodoc_typehints = "description". The result on the live RTD site is, for example,QueryAgent.streamrendered as 4 stacked signatures (one per overload) instead of a single clean signature.ModuleAnalyzer.analyzeindocs/conf.pyto clear the overload collection so autodoc falls back to documenting only the implementation. Each method now renders as one signature with type info in the prose Parameters block.Trade-off
Per-overload return-type variants are no longer surfaced in the rendered docs (e.g.
include_progress=True → Generator[ProgressMessage | StreamedTokens | QueryAgentResponse, ...]vsinclude_progress=False → Generator[StreamedTokens, ...]). The merged signature shows defaults; types live in the description.The patch is global (affects the main
weaviatepackage too), but no public-API methods inweaviate/**currently use@overloadin a way that would be visibly affected.Test plan
stream/ask_streammethods now render as a single clean signature instead of 4 stacked overload variants.run,search,suggest_queries) and main-client methods are unchanged.🤖 Generated with Claude Code