DM-55493: cap fastapi below 0.140 (faststream incompatibility) - #299
Merged
Conversation
FastAPI 0.140 made Dependant a slotted dataclass, which breaks FastStream's FastAPI plugin (it monkey-patches model, custom_fields and flat_params onto the instance). Upstream bug ag2ai/faststream#2959 is still open, so cap fastapi until it is fixed. The lockfile already resolved fastapi 0.139.2; relocking with plain 'uv lock' records the constraint without moving any package.
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.
Cap FastAPI at
<0.140in[project] dependenciesso a futuremake updatecannot silently bake a broken FastAPI into the lockfile.Why
FastAPI 0.140.0 (2026-07-24, fastapi/fastapi#16049 "Reduce memory usage in dependencies") changed
Dependantto@dataclass(slots=True). FastStream's FastAPI plugin monkey-patchesdependant.model,.custom_fieldsand.flat_paramsonto that instance (faststream/_internal/fastapi/get_dependant.py:131,135,136), which now raises:Upstream bug: ag2ai/faststream#2959 — open and unfixed on main (note the repo moved from
airtai/toag2ai/). faststream 0.7.2 is the latest release and is still broken; downgrading does not help either, since 0.6.7 carries the same patch.Ook depends on FastStream both directly (
faststream[kafka]) and viasafir[db,kafka].Impact today
The committed
uv.lockstill pins a pre-break FastAPI (0.139.2), so production and per-PR CI are green. Only the scheduled Periodic CI job — which resolves dependencies unpinned — is red. This PR is preventative: without the cap, the nextmake updatewould resolve to 0.140.x and ship a broken image.Changes
pyproject.toml:"fastapi"->"fastapi<0.140", with a# TODO: remove when ag2ai/faststream#2959 is fixedcomment.uv.lock: relocked with plainuv lock(deliberately not--upgrade). The only change is the constraint metadata:The resolved fastapi version is unchanged at 0.139.2. No other package moved.
Changelog fragment under
changelog.d/.Testing
nox -s typing testpasses locally:typing: mypy clean — "Success: no issues found in 202 source files".test: 451 passed, 1 skipped in 464.61s.Note this run exercises the locked FastAPI 0.139.2, so it confirms the cap breaks nothing — it does not itself reproduce the 0.140 failure.
Follow-up
Remove the cap once ag2ai/faststream#2959 ships a fix.