Python: Replace wildcard imports with explicit imports#3908
Merged
eavanvalkenburg merged 3 commits intomicrosoft:mainfrom Feb 13, 2026
Merged
Python: Replace wildcard imports with explicit imports#3908eavanvalkenburg merged 3 commits intomicrosoft:mainfrom
eavanvalkenburg merged 3 commits intomicrosoft:mainfrom
Conversation
- Replace all 'from ... import *' with explicit symbol imports - Add __all__ declarations to namespace packages for re-exports - Update CODING_STANDARD.md to prohibit wildcard imports - Maintain exported API and preserve all functionality fixes microsoft#3605
Member
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request successfully eliminates all wildcard imports (from ... import *) across the Python codebase and replaces them with explicit symbol imports. The changes affect the core agent_framework package, the openai subpackage, and three lab namespace packages (tau2, lightning, gaia).
Changes:
- Replaced 10 wildcard imports in the core package with ~100 explicit imports using the
import X as Xpattern for re-exporting - Replaced 6 wildcard imports in the OpenAI subpackage with explicit imports
- Replaced 3 wildcard imports in lab namespace packages and added
__all__declarations - Updated CODING_STANDARD.md to prohibit wildcard imports and document the rationale
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/packages/core/agent_framework/init.py | Replaced 10 wildcard imports with 387 lines of explicit imports using import X as X pattern |
| python/packages/core/agent_framework/openai/init.py | Replaced 6 wildcard imports with explicit imports for 13 symbols |
| python/packages/lab/namespace/agent_framework/lab/tau2/init.py | Replaced wildcard import with explicit imports for 6 symbols and added __all__ |
| python/packages/lab/namespace/agent_framework/lab/lightning/init.py | Replaced wildcard import with explicit import for 1 symbol and added __all__ |
| python/packages/lab/namespace/agent_framework/lab/gaia/init.py | Replaced wildcard import with explicit imports for 10 symbols and added __all__ |
| python/CODING_STANDARD.md | Added prohibition of wildcard imports with rationale and examples |
westey-m
approved these changes
Feb 13, 2026
SergeyMenshykh
approved these changes
Feb 13, 2026
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.
Fixes #3605
Summary
Replaced all wildcard imports (
from ... import *) with explicit symbol imports across the Python codebase.Changes
agent_framework/__init__.py): Replaced 10 wildcard imports with explicit imports for ~100 symbolsagent_framework/openai/__init__.py): Replaced 6 wildcard imports with explicit imports__all__declarations for re-exportsImpact
Testing
Wildcard Count