Require `prefect>=3.9.0` so the `prefect` extra imports on current FastAPI

Merged
DO
1mo ago
+127-74

The Latest Versions Canary errors at setup on every Prefect test with TypeError: Body() got an unexpected keyword argument 'min_items', raised while prefect.server.api imports. It resolved prefect 3.8.8 with fastapi 0.159.1.

  • FastAPI 0.155.0 removed the **extra catch-all from Body() and the other parameter functions (fastapi/fastapi#16545), so Prefect's Body(..., min_items=1) now raises. FastAPI 0.151.0 also changed how JSON null bodies validate (fastapi/fastapi#16536), which makes about 144 Prefect body parameters return 422.
  • Prefect 3.7.x and 3.8.x declare fastapi<1.0.0. Prefect 3.9.0 fixes the keywords (PrefectHQ/prefect#23476) and caps fastapi<0.151 (PrefectHQ/prefect#23478).

Any environment that already needs a newer FastAPI, such as one with pydantic-clai2 (fastapi>=0.115.0), gets an older Prefect paired with a FastAPI it can't import. This PR raises the prefect extra's floor to >=3.9.0 so Prefect's own cap applies. I didn't add our own fastapi<0.151 cap: it would duplicate Prefect's cap and would stay in place after Prefect lifts it.

Prefect 3.9.0 is less than 7 days old, so pyproject.toml gets a dated exclude-newer-package override with a removal TODO, like the certifi, pillow and boxlite entries. uv.lock moves prefect 3.7.7 → 3.9.0 and fastapi 0.138.1 → 0.143.2. The runner script lock is regenerated.

New public surface: none.

Verification: I reproduced the import error locally with prefect==3.8.8 and fastapi==0.159.1. On the new lock, the Prefect durable-exec and harness test files pass, apart from the 12 cache/retry tests that also fail locally on the unchanged main lock and pass in CI. I'll trigger the canary on this branch to confirm. Its anthropic 2.x failures are a separate cause, handled in the callable-union work.

What changes for existing users: installing pydantic-ai-slim[prefect] now needs Prefect 3.9.0 or later.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
  • PR title is fit for the release changelog.

🤖 Generated with Claude Code