Repository navigation
Python: Declare every lazy namespace export in its type stub - #9750
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
Conversation
agent_framework.anthropic, .foundry and .orchestrations export names at runtime that their __init__.pyi stubs omit, and .hyperlight has no stub, so type checkers reject imports that work. Add the missing names, add a hyperlight stub, and test that every lazy namespace's _IMPORTS matches its stub. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
October 27, 2026 12:35 — with
GitHub Actions
Inactive
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
October 27, 2026 12:35 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes preserve runtime behavior, and the only remaining feedback is a minor test-helper organization issue.
1 open issue
What changed in this PR
This PR aligns Python’s lazy namespace type stubs with existing runtime exports, improving type-checker visibility without changing runtime behavior.
Changes:
- Add missing exports to the Anthropic, Foundry, and orchestrations stubs.
- Introduce the Hyperlight namespace stub.
- Add static regression coverage for stub existence, exported names, and source-package alignment without requiring optional connectors.
| File | Description |
|---|---|
python/packages/core/tests/core/test_namespace_stubs.py |
Checks lazy namespace exports against their stubs. |
python/packages/core/agent_framework/orchestrations/__init__.pyi |
Declares six missing orchestration exports. |
python/packages/core/agent_framework/hyperlight/__init__.pyi |
Adds typing declarations for all six namespace exports. |
python/packages/core/agent_framework/foundry/__init__.pyi |
Exports FoundryAgentOptions. |
python/packages/core/agent_framework/anthropic/__init__.pyi |
Exports RawClaudeAgent. |
Review effort: Balanced
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
November 6, 2026 21:52 — with
GitHub Actions
Inactive
This branch was previously deployed
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.

Motivation & Context
The
agent_framework.<namespace>modules re-export connector classes lazily through_IMPORTSand__getattr__. Each has an__init__.pyiso type checkers see the same names. Four of them have drifted:agent_framework.anthropicRawClaudeAgentagent_framework.foundryFoundryAgentOptionsagent_framework.orchestrationsBaseGroupChatOrchestrator,GroupChatResponseReceivedEvent,OrchestrationState,TerminationCondition,clean_conversation_for_handoff,create_completion_messageagent_framework.hyperlight__init__.pyiat all, so every export isAnyAll of these imports work at runtime. For example, the
RawClaudeAgentdocstring itself showsfrom agent_framework.anthropic import RawClaudeAgent. Onmain, pyright 1.1.408 rejects the first three groups with"RawClaudeAgent" is unknown import symbol(8 errors for the names above).Description & Review Guide
anthropic,foundryandorchestrationsstubs.agent_framework/hyperlight/__init__.pyi, following themontystub.packages/core/tests/core/test_namespace_stubs.py. For every namespace that declares_IMPORTS, it parses__init__.pyand__init__.pyiwithastand checks three things: the stub exists, its imports and__all__match_IMPORTS, and each name comes from the same distribution package. It needs no optional connector installed.Verification:
mainforanthropic,foundry,hyperlightandorchestrations, and passes for all 22 namespaces with this change.HyperlightCodeActProvidernow resolves to its class instead ofAny._IMPORTSname in every namespace resolves at runtime with all workspace packages installed.Related Issue
N/A - trivial change: the stubs are meant to mirror
_IMPORTS, and this adds the names they are missing without changing any runtime export.AI Assistance
AI assistance details: Claude Code helped find the drift by comparing each namespace's
_IMPORTSwith its stub, write the stub updates and test, and draft this description.Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code