Repository navigation
Bump: require pydantic-ai 2.40 - #63
Merged
Merged
Conversation
The `pydantic-ai` extra moves to `pydantic-ai-slim>=2.40.0`, and the lock follows: pydantic-ai-slim and pydantic-graph 2.40.0, and griffe as pydantic-ai 2 wants it — `griffelib` for the library, with the `griffe` meta-package kept at 1.x, since at 2.0.2 the two together leave `griffe` without an `__init__` and `import pydantic_ai` fails. That failure used to pass unnoticed: the bridge tests skip through `pytest.importorskip`, which treated any ImportError as "not installed". They now skip only when the module is missing, so a broken install fails the run. The README and the bridge docstring say Pydantic AI 2 is required, where they described the 1.x deprecation of `Agent.to_a2a()`. No code change was needed: the bridge and its tests pass on 2.40 as they are. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The updated pytest.importorskip(..., exc_type=ModuleNotFoundError) can still incorrectly skip when a transitive dependency is missing (also raising ModuleNotFoundError), leaving the bridge untested in some broken environments.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates FastA2A’s optional Pydantic AI integration to require Pydantic AI 2 (via pydantic-ai-slim>=2.40.0), refreshes the lockfile for the new dependency set, and updates tests/docs to match the Pydantic AI 2 bridge expectations.
Changes:
- Bump the
pydantic-aiextra topydantic-ai-slim>=2.40.0and updateuv.lockaccordingly (incl. new transitive deps likehttpx2/httpcore2/truststore). - Update Pydantic-AI-related tests to avoid masking some import failures.
- Update README and bridge module docstring to reflect that
agent_to_a2areplaces removedAgent.to_a2a()in Pydantic AI 2.
File summaries
| File | Description |
|---|---|
| uv.lock | Refresh lockfile for Pydantic AI 2 / pydantic-ai-slim>=2.40.0 dependency graph. |
| pyproject.toml | Require pydantic-ai-slim>=2.40.0 for the pydantic-ai optional extra. |
| tests/test_pydantic_ai.py | Tighten skip logic around importing pydantic_ai. |
| tests/test_pydantic_ai_streaming.py | Tighten skip logic around importing pydantic_ai for streaming bridge tests. |
| tests/test_extensions.py | Tighten skip logic around importing pydantic_ai in extension-forwarding test. |
| README.md | Document that the bridge requires Pydantic AI 2 and agent_to_a2a replaces Agent.to_a2a(). |
| fasta2a/pydantic_ai/init.py | Update bridge module docstring to reflect Pydantic AI 2 API changes. |
Review details
- Files reviewed: 6/7 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
`importorskip(..., exc_type=ModuleNotFoundError)` still skipped when pydantic-ai was installed but one of its own dependencies was not, since that raises ModuleNotFoundError too. The import is now explicit and skips only when the missing module is `pydantic_ai`; anything else is re-raised. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
What
pydantic-aiextra now requirespydantic-ai-slim>=2.40.0; the lock moves pydantic-ai-slim and pydantic-graph from 1.93.0 to 2.40.0 (plus pydantic-ai 2's own dependencies: httpx2, httpcore2, truststore).griffelib2.3.0 for the library, with thegriffemeta-package kept at 1.14. With both at 2.0.2 (what a plain relock gives),griffeends up without an__init__andimport pydantic_aifails.pytest.importorskip('pydantic_ai'), which treated any ImportError as "not installed", so a broken environment produced a green run with the bridge untested. The skips now passexc_type=ModuleNotFoundError: a missing module skips, a broken one fails.agent_to_a2areplaces the removedAgent.to_a2a().What did not change
No code. The bridge and all its tests pass on 2.40 as they are — the streaming fallback from #62 already covered the one behavioural difference (a non-streaming model's refusal surfaces on the first read rather than on entering the stream). No deprecation warnings from 2.40 in the test run.
Verified locally on Python 3.12 with the new lock (
uv sync --frozen --extra pydantic-ai --python 3.12): 34 tests pass with none skipped, pyright strict 0 errors, ruff clean.🤖 Generated with Claude Code