Floor on released `pydantic-ai` 2.38.0

Merged
DO
3mo ago
+28-29

Summary

Prerequisite for #711. The three adoption PRs — #712 (filesystem events), #713 (compaction lifecycle
events) and #714 (callback deprecations) — all import CapabilityEvent at module scope, and it does
not exist on the floor we advertise. On pydantic-ai-slim>=2.37.0 every one of them fails at
collection:

ImportError: cannot import name 'CapabilityEvent' from 'pydantic_ai'. Did you mean: 'CapabilityFunc'?

Unlike #766's, this is not a straddle we can carry: the events are the feature, so there is no
2.37-compatible branch to fall back to. 2.38.0 is the release that has the family — CustomEvent,
CapabilityEvent, ctx.emit() and @on_event (pydantic-ai#6258, f8cc1d603).

  • the six general pydantic-ai-slim floors go to >=2.38.0 (the base dependency plus the five
    pass-through extras). The >=2.18.0 feature-specific floors are subsumed and unchanged;
  • uv.lock moves pydantic-ai-slim and pydantic-graph from 2.37.0 to 2.38.0, and picks up
    genai-prices 0.1.6 with them;
  • the [tool.uv] anthropic override goes to >=1.3.0, because 2.38.0 raised slim's own
    anthropic floor from 1.0.0 to 1.3.0. An override replaces every requirement on the package it
    names, including slim's, so the entry exists to repeat whatever slim declares; its comment says to
    move it whenever slim's moves. Left at >=1.0.0, lowest-direct resolves slim 2.38.0 against an
    anthropic below the floor it declares.

The comment paragraph that named the specific generation (anthropic>=1 is the HTTPX2 generation)
comes out. The override's job is to repeat whatever slim declares, whatever that is; naming one
generation dated the comment to a floor that has since moved twice.

Precedent: 3d0a7524 (#769) and 7c8aee30 (#743) before it.

Linked Issue

Fixes #779

Checklist

  • Linked issue exists and is referenced above

  • Tests added/updated for new behavior (no behavior change; the existing suite is the check)

  • make lint && make typecheck && make test passes locally

  • pyproject.toml and uv.lock are unchanged, or a maintainer added dependencies:approved to the current head

    Needs dependencies:approved. Raising the floor is the point of the PR, so pyproject.toml
    and uv.lock necessarily change.

  • Docstrings use single backticks (not RST double backticks)

Verification

Ran locally against the resolutions the CI jobs use:

resolutionpydantic-ai-slimanthropicresult
locked (uv sync --locked)2.38.01.3.05,594 passed, 63 skipped
--resolution lowest-direct2.38.01.3.05,594 passed, 63 skipped

The latest-version job resolves to the same pair: 2.38.0 is the newest release, so the lock is
already at it.

lowest-direct is where the anthropic override matters. Left at >=1.0.0 it resolves
anthropic==1.0.0 against slim 2.38.0, which declares >=1.3.0 — the override erases that
requirement, so uv resolves it happily and nothing complains until something reaches for an API
only the newer SDK has. At >=1.3.0 both halves of the pair land on the floor slim actually
advertises.

uv lock --locked is clean, and pre-commit's check toml passes.