Python: give the Anthropic and OpenAI packages their own dependency-probe Pyright configs - #8051
Closed
Manjunath Janardhan (manjunathshiva) wants to merge 2 commits into
Conversation
…onfig The weekly dependency-bounds gate has failed at packages/anthropic on every run since 2026-08-03. The upper-bound step that follows it is gated on that step's outcome, so it has been skipped ever since, leaving every package's dependency bounds unmaintained while the workflow still reports success. agent_framework_anthropic/_vertex_client.py type-checks against google.auth.credentials, but the package declares plain anthropic without the vertex extra and nothing in the repo declares google-auth. A full workspace sync resolves it transitively, so repo-wide Pyright passes and the gap is invisible outside the isolated probe. Add the dependency-pyright escape hatch that packages/core already uses, so the probe can type-check the implementation without requiring the undeclared namespace package. Repo-wide Pyright is unchanged and still covers _vertex_client.py in full. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
packages/openai is the second package the dependency-bounds gate stops at, for
the same reason as packages/anthropic: it type-checks against namespaces it
deliberately does not declare. _chat_client.py, _chat_completion_client.py,
_embedding_client.py and _shared.py reference azure.core.credentials under
TYPE_CHECKING and azure.identity from a lazy import, because Entra ID support
is optional -- the docstrings say so ("Credential objects require the optional
azure-identity package"). A full workspace sync resolves both transitively, so
repo-wide Pyright passes and only the isolated probe sees them missing.
Unlike anthropic, no exclusion is needed. The dependency-pyright task reuses the
root workspace test dependency group, whose azure-monitor-opentelemetry pulls
azure-monitor-opentelemetry-exporter and in turn azure-identity, so the probe
resolves the whole package as-is. Excluding files would not have worked here in
any case: the azure references span four of seven modules, 97% of the package by
line count.
Generalize the regression test over both packages rather than duplicating it,
and keep the anthropic-specific exclusion assertion separate.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
September 4, 2026 07:05 — with
GitHub Actions
Active
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
September 4, 2026 07:05 — with
GitHub Actions
Active
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
September 4, 2026 07:05 — with
GitHub Actions
Active
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
September 4, 2026 07:05 — with
GitHub Actions
Active
Copilot started reviewing on behalf of
Manjunath Janardhan (manjunathshiva)
September 4, 2026 07:06
View session
Manjunath Janardhan (manjunathshiva)
marked this pull request as ready for review
September 4, 2026 07:07
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
September 4, 2026 07:08 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The Fixes #8049 link would close an issue whose reported maintenance freeze remains active.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds package-specific Pyright probes for optional Anthropic and OpenAI dependency surfaces.
Changes:
- Adds dependency-specific Pyright configurations.
- Registers package-level
dependency-pyrighttasks. - Adds regression tests for task selection and configuration.
File summaries
| File | Description |
|---|---|
python/packages/anthropic/pyrightconfig.dependency.json |
Excludes the optional Vertex client from isolated checks. |
python/packages/anthropic/pyproject.toml |
Registers the Anthropic probe task. |
python/packages/openai/pyrightconfig.dependency.json |
Defines the OpenAI probe scope. |
python/packages/openai/pyproject.toml |
Registers the OpenAI probe task. |
python/scripts/dependencies/tests/test_dependency_bounds_runtime.py |
Tests package probe configuration and selection. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Manjunath Janardhan (manjunathshiva)
deployed
to
github-app-auth
September 4, 2026 07:13 — with
GitHub Actions
Active
Member
|
That workflow is a work in progress, but we prefer to update it ourselves, so closing this. |
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 weekly
python-dependency-maintenanceworkflow has reported success on every scheduled run since 2026-08-03 while validating no dependency bounds at all. ItsRun dependency upper-bound validationstep was skipped on all five runs; the last time it executed was 2026-07-27.The step is gated on
if: steps.validate_bounds_test.outcome == 'success', and the step it gates on carriescontinue-on-error: true. That maps the failing step's conclusion to success — which is what the job status and the run badge report — while leaving outcome at failure. The result is a green run that silently maintains nothing, repo-wide, for five weeks.The bounds test aborts on the first failing package, and since 2026-08-03 that is always
packages/anthropic:_vertex_client.py:23importsgoogle.auth.credentialsunderTYPE_CHECKING, but the package declares plainanthropic(no[vertex]extra) and nothing in the repo declaresgoogle-auth. A full workspace sync resolves it transitively, sopoe pyrightpasses and PR CI is clean; only the isolated probe sees it missing.This became a failure with #7342 (merged 2026-07-28, one day after the last passing run), which narrowed probe surfaces so packages stop inheriting transitive extras such as
core[all]. That was the correct change —packages/corereceived adependency-pyrightescape hatch for precisely this case.packages/anthropicandpackages/openaineeded one and did not get it.Description & Review Guide
What are the major changes?
Five files, mirroring the existing
packages/coreprecedent.packages/anthropic/pyrightconfig.dependency.json— includesagent_framework_anthropic, excludes the single file needing the undeclared namespace.packages/openai/pyrightconfig.dependency.json— includesagent_framework_openai, no exclusions needed.packages/anthropic/pyproject.toml,packages/openai/pyproject.toml— add[tool.poe.tasks.dependency-pyright]. This is the documented extension point, not a workaround;scripts/dependencies/README.md:49describes it as "a package-defineddependency-pyrighttask … allowing dependency probes to type-check the package implementation without requiring optional lazy namespace packages." The probe machinery already prefers it when present (validate_dependency_bounds.py:107,CHECK_TASK_PRIORITYin both optimizers), so no tooling changes were needed.scripts/dependencies/tests/test_dependency_bounds_runtime.py— regression coverage, parametrized over both packages, in the suite Python: isolate dependency-bound validation #7342 added for this machinery.Both packages type-check against surfaces they deliberately do not declare because those surfaces are optional —
openai's own docstrings say "Credential objects require the optionalazure-identitypackage".openaineeds no exclusion becausedependency-pyrightreuses the roottestdependency group, whoseazure-monitor-opentelemetrypullsazure-monitor-opentelemetry-exporterand in turnazure-identity. Excluding files would not have worked there anyway: the azure references span four of seven modules, 97% of the package by line count.What is the impact of these changes?
Repo-wide Pyright is unchanged and still checks every file in both packages. Verified by planting a deliberate error in
_vertex_client.pyand running both configs frompackages/anthropic/:The narrowed surface applies only inside isolated dependency probes.
On what this does and does not achieve. The gate aborts on the first failure, so I probed all 35 packages individually to get the real picture rather than a lower bound: 29 pass, 6 fail. These two fixes take it to 31/35. The remaining four are genuine defects, not probe artifacts —
declarativeandlabunder-declare runtime dependencies (mcp,agent-framework-openai);azure-contentunderstandingdeclares a floor whose API lacks a parameter the code passes;foundry_hostingfails an MCP test at its floor. Those are separate packages and separate bounds, two of them changing a published dependency surface, so they are written up in the issue rather than fixed here. The gate will not go green until they are addressed too — this PR is a prerequisite for reaching them at all.As an illustration of what a restored gate does, the
fastapiceiling from Python: [Bug]: agent-framework-ag-ui caps fastapi<0.140.0, which excludes every current release #8042 — which this PR deliberately does not touch:Bound values are a maintainer policy call and
--mode upperis the component designed to choose and validate them, so hand-raising them here would pre-empt it.What do you want reviewers to focus on?
Whether the escape hatch is the right long-term answer for these two, or a stopgap. Both packages ship a feature (
AnthropicVertexClient, Entra ID auth) while leaving its dependency undeclared. If those are meant to work out of the box,anthropic[vertex]/ an explicitazure-identityis the real fix and these configs could be deleted. That changes the shipped dependency surface, so I left it as a maintainer call and raised it in the issue.Also worth a look:
core's config excludes a leaf file, whereas_vertex_client.pyis imported and re-exported byagent_framework_anthropic/__init__.py. Pyright suppresses diagnostics for excluded files without breaking inference in the importer, which the probe run confirms empirically, but it is the one way this differs from the precedent.Related Issue
Refs #8049
Deliberately
Refsrather than a closing keyword: #8049 tracks the repo-wide bounds-maintenance outage, and this PR clears two of its six blockers. The freeze stays active after this merges, so #8049 must stay open to track the remaining four.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.