chore: migrate to faststream 0.7#42
Merged
Merged
Conversation
Pure compat migration; no new 0.7 features adopted. Internal break points fixed: - pyproject.toml: pin bumped to faststream>=0.7,<0.8. - publisher/producer.py: OutboxProducer gained a `codec` attribute to satisfy ProducerProto[0.7]. The outbox owns its own encoding pipeline via _encode_payload and ignores the attribute at runtime. - testing.py: FakeOutboxProducer gained the same `codec` attribute; create_publisher_fake_subscriber converted from @staticmethod to instance method to match upstream's abstract base. - registrator.py: dropped `middlewares_=` from the SubscriberUsecase .add_call call (kwarg removed upstream in 0.7). Public surface (BREAKING): - Dropped the per-call `middlewares=` kwarg from OutboxRegistrator.subscriber, OutboxRegistrator.publisher, OutboxRoute, and the FastAPI router's subscriber/publisher overrides. Upstream removed publisher- and subscriber-level middlewares as a public surface in 0.7; install middleware at the broker scope instead via `OutboxBroker(middlewares=[...])`. Broker-scope middlewares on OutboxBroker, OutboxRouter, and the FastAPI router are unchanged. Spec: planning/specs/2026-06-03-faststream-0.7-migration-design.md. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Pure-compat migration from FastStream 0.6 to 0.7. Pin bumped to
faststream>=0.7,<0.8; no new 0.7 features adopted (broker-levelAckPolicydefault, multi-broker, MQTT, etc. each get their own follow-up spec).Internal break points fixed
pyproject.toml: pin bumped.publisher/producer.py:OutboxProducergained acodecattribute (DefaultCodec()) to satisfyProducerProto[0.7]. The outbox owns its own encoding pipeline (_encode_payload) and ignorescodecat runtime.testing.py:FakeOutboxProducergained the samecodecattribute (typing.Any = None);create_publisher_fake_subscriberconverted from@staticmethodto instance method to match upstream's abstract base.registrator.py: droppedmiddlewares_=from theSubscriberUsecase.add_callcall (kwarg removed upstream in 0.7).Public surface (BREAKING)
Dropped the per-call
middlewares=kwarg from:OutboxRegistrator.subscriber()andOutboxRegistrator.publisher()OutboxRoutesubscriber()andpublisher()overridesUpstream removed publisher- and subscriber-level middlewares as a public surface in 0.7. Install middleware at the broker scope instead via
OutboxBroker(middlewares=[...]). Broker-scope middlewares onOutboxBroker,OutboxRouter, and the FastAPI router are unchanged.Two new structural tests pin the producer protocol compliance (
test_outbox_producer_satisfies_producer_proto,test_fake_outbox_producer_satisfies_producer_proto) using the publictyping.get_protocol_members()API.Test plan
just lint-ci— cleanjust test— 391 passed,--cov-fail-under=100satisfieduv run pytest tests/test_unit.py tests/test_fake.py(no-Postgres tier) — 271 passed standalonegit grep -n "middlewares=" faststream_outbox/ tests/ docs/shows only broker-scope referencesgit grep -n "faststream<0.7\|faststream>=0.6" .returns nothingpython -c "from faststream_outbox import OutboxBroker; from faststream_outbox.fastapi import OutboxRouter"exits 0Spec:
planning/specs/2026-06-03-faststream-0.7-migration-design.mdPlan:
planning/plans/2026-06-03-faststream-0.7-migration-plan.md🤖 Generated with Claude Code