Skip to content

docs: suppress @typing.overload signature stacking#2034

Open
g-despot wants to merge 2 commits into
mainfrom
docs/suppress-overload-stacking
Open

docs: suppress @typing.overload signature stacking#2034
g-despot wants to merge 2 commits into
mainfrom
docs/suppress-overload-stacking

Conversation

@g-despot
Copy link
Copy Markdown
Contributor

Summary

  • Sphinx autodoc detects @typing.overload via AST parsing and stacks every overload variant inline with full type hints, overriding autodoc_typehints = "description". The result on the live RTD site is, for example, QueryAgent.stream rendered as 4 stacked signatures (one per overload) instead of a single clean signature.
  • This patches ModuleAnalyzer.analyze in docs/conf.py to 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, ...] vs include_progress=False → Generator[StreamedTokens, ...]). The merged signature shows defaults; types live in the description.

The patch is global (affects the main weaviate package too), but no public-API methods in weaviate/** currently use @overload in a way that would be visibly affected.

Test plan

  • Wait for the Read the Docs PR preview build and confirm the agents stream / ask_stream methods now render as a single clean signature instead of 4 stacked overload variants.
  • Spot-check that other agents methods (run, search, suggest_queries) and main-client methods are unchanged.

🤖 Generated with Claude Code

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>
Copy link
Copy Markdown

@orca-security-eu orca-security-eu Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

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