-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: [BREAKING] Standardize TypeVar naming convention (TName → NameT) #3770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR standardizes Python TypeVar naming across the Agent Framework to use a ...T suffix instead of a T... prefix, aligning typing identifiers across core, provider packages, tests, and samples (resolving #3594).
Changes:
- Renamed TypeVars throughout Python packages (core + integrations) to the
NameT/NameBoundT/OptionsCoTstyle. - Updated affected generics/overloads/annotations in core typing surfaces (
_types.py,_clients.py, middleware/layers) and downstream provider packages to match. - Updated samples/tests to import and use the renamed TypeVars (plus a small pyright-import suppression tweak in an OTel sample).
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/getting_started/observability/configure_otel_providers_with_parameters.py | Adds pyright suppression for optional OTLP exporter imports in the sample. |
| python/samples/getting_started/chat_client/custom_chat_client.py | Updates sample generics to use renamed options TypeVar. |
| python/packages/purview/agent_framework_purview/_models.py | Renames TypeVar used for _AliasSerializable helper typing. |
| python/packages/ollama/agent_framework_ollama/_chat_client.py | Renames response/options TypeVars used by Ollama chat client/options. |
| python/packages/github_copilot/agent_framework_github_copilot/_agent.py | Renames agent options TypeVar and updates method signatures accordingly. |
| python/packages/foundry_local/agent_framework_foundry_local/_foundry_local_client.py | Renames response/options TypeVars used by Foundry Local client/options. |
| python/packages/durabletask/tests/test_durable_entities.py | Renames test TypeVar used for entity state typing. |
| python/packages/devui/tests/devui/conftest.py | Updates test mocks to use renamed options TypeVar. |
| python/packages/declarative/agent_framework_declarative/_models.py | Renames connection/tool TypeVars used by serialization helpers. |
| python/packages/core/tests/core/conftest.py | Updates core test mock chat client generics to renamed options TypeVar. |
| python/packages/core/agent_framework/openai/_responses_client.py | Renames response-format/options TypeVars for OpenAI Responses client. |
| python/packages/core/agent_framework/openai/_chat_client.py | Renames response/options TypeVars for OpenAI Chat client. |
| python/packages/core/agent_framework/openai/_assistants_client.py | Renames response/options TypeVars for OpenAI Assistants client. |
| python/packages/core/agent_framework/openai/_assistant_provider.py | Renames provider options TypeVar for typed ChatAgent[...] returns. |
| python/packages/core/agent_framework/observability.py | Renames TypeVars used by telemetry layers and related overloads. |
| python/packages/core/agent_framework/azure/_responses_client.py | Renames Azure Responses options TypeVar. |
| python/packages/core/agent_framework/azure/_chat_client.py | Renames Azure Chat response/options/client TypeVars. |
| python/packages/core/agent_framework/azure/_assistants_client.py | Renames Azure Assistants options TypeVar. |
| python/packages/core/agent_framework/_workflows/_model_utils.py | Renames model TypeVar used by workflow dict/json conversion helpers. |
| python/packages/core/agent_framework/_types.py | Renames many core TypeVars (responses/content/stream generics) and updates exports. |
| python/packages/core/agent_framework/_tools.py | Renames TypeVars used by tool layers and overloads. |
| python/packages/core/agent_framework/_threads.py | Renames thread/store TypeVars used by (de)serialization classmethods. |
| python/packages/core/agent_framework/_serialization.py | Renames protocol/class TypeVars used in serialization helpers. |
| python/packages/core/agent_framework/_pydantic.py | Renames settings TypeVar used for AFBaseSettings.__new__ typing. |
| python/packages/core/agent_framework/_middleware.py | Renames middleware TypeVars (context/update/options) used by layers and helpers. |
| python/packages/core/agent_framework/_clients.py | Renames client protocol/base client TypeVars (options, input, response model bound). |
| python/packages/core/agent_framework/_agents.py | Renames agent TypeVars (thread/options/response-model bound) used in agent typing/overloads. |
| python/packages/claude/agent_framework_claude/_agent.py | Renames agent options TypeVar and updates method signatures accordingly. |
| python/packages/bedrock/agent_framework_bedrock/_chat_client.py | Renames response/options TypeVars used by Bedrock chat client/options. |
| python/packages/azurefunctions/tests/test_entities.py | Renames test TypeVar used for decorator/function typing. |
| python/packages/azurefunctions/tests/test_app.py | Renames test TypeVar used for decorator/function typing. |
| python/packages/azure-ai/agent_framework_azure_ai/_project_provider.py | Renames provider options TypeVar for typed ChatAgent[...] returns. |
| python/packages/azure-ai/agent_framework_azure_ai/_client.py | Renames Azure AI client options TypeVar and updates derived generics. |
| python/packages/azure-ai/agent_framework_azure_ai/_chat_client.py | Renames Azure AI agent options TypeVar and updates as_agent typing. |
| python/packages/azure-ai/agent_framework_azure_ai/_agent_provider.py | Renames provider options TypeVar for typed ChatAgent[...] returns. |
| python/packages/anthropic/agent_framework_anthropic/_chat_client.py | Renames response/options TypeVars used by Anthropic client/options. |
| python/packages/ag-ui/tests/ag_ui/conftest.py | Updates AG-UI test stubs to use renamed options TypeVar. |
| python/packages/ag-ui/agent_framework_ag_ui_examples/agents/ui_generator_agent.py | Renames example options TypeVar used for agent factory typing. |
| python/packages/ag-ui/agent_framework_ag_ui/_types.py | Renames AG-UI options/response TypeVars used by AG-UI TypedDict options. |
| python/packages/ag-ui/agent_framework_ag_ui/_client.py | Renames client/options TypeVars and decorator TypeVar used by AG-UI client. |
Motivation and Context
Standardizes TypeVar naming across the Python codebase to use suffix
Tinstead of prefixT, aligning with common Python conventions.Notable renames
TResponseModelResponseModelTTResponseModelTResponseModelBoundTTAgentRunResponseAgentResponseTResolves #3594
Description
Contribution Checklist