chore: migrate to faststream 0.7 (drop 0.6 support)#28
Merged
Conversation
- pyproject.toml: faststream[kafka] >=0.6,<0.7 -> >=0.7,<0.8. Drops 0.6 support entirely; users on 0.6 stay on previously-released wheels. Unanticipated 0.7 break — TestKafkaBroker.__init__ became variadic (*brokers: Broker), and __aenter__ now returns Broker | list[Broker]. This made ty flag all 23 `async with TestKafkaBroker(broker) as test_broker:` sites in tests/ as Liskov violations. - tests/mocks.py: new fake_test_broker async-with helper that wraps TestKafkaBroker and narrows the single-broker case to KafkaBroker. Mirrors the existing patched_message helper's shape. - tests/test_healthcheck.py: 4 callsites switched to fake_test_broker. - tests/test_middleware.py: 19 callsites switched to fake_test_broker. - faststream_concurrent_aiokafka/middleware.py: added a 3-line "why" comment to consume_scope's existing # ty: ignore[invalid-method-override]. 0.7's BaseMiddleware.consume_scope is typed (call_next: AsyncFuncAny, msg: StreamMessage[AnyMsg]); the override's KafkaAckableMessage narrowing remains intentional documentation of the MANUAL-ack design center, and ty flags the narrowing as a Liskov violation that the ignore comment continues to suppress. No new 0.7 features adopted (no broker-level AckPolicy default, no multi-broker, no RedisClusterBroker analog). Local verification: `just lint` clean; `just test` 111 passed at 100% coverage on Python 3.13. CI matrix (3.11/3.12/3.13/3.14) will be the final gate on the 3.11 coverage quirk PR1 already addressed. 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
faststream[kafka]from>=0.6,<0.7to>=0.7,<0.8.Break points
TestKafkaBroker.__init__became variadic in 0.7.__aenter__now returnsBroker | list[Broker]instead ofBroker. All 23async with TestKafkaBroker(broker) as test_broker:sites intests/were affected.fake_test_brokerhelper intests/mocks.pywrapsTestKafkaBrokerand narrows the single-broker case toKafkaBroker. 23 callsites switched to use the helper.BaseMiddleware.consume_scopesignature in 0.7:(self, call_next: AsyncFuncAny, msg: StreamMessage[AnyMsg]) -> Any. The override infaststream_concurrent_aiokafka/middleware.pynarrowsmsgtoKafkaAckableMessage(Liskov violation). The 0.6-era# ty: ignore[invalid-method-override]continues to suppress this — the narrowing is intentional documentation of the MANUAL-ack design center. Added a 3-line "why" comment above the ignore.FakeConsumerclass name unchanged, all 5 public import paths (BaseMiddleware,ContextRepo,ConsumerRecord,TopicPartition,KafkaBroker,KafkaRouter,TestKafkaBroker,KafkaAckableMessage,AckPolicy.MANUAL,AsgiFastStream) still resolve. NoProducer/TestBroker/Registratorsubclass to touch.Test plan
just lintpasses (ruff + ty)just testpasses at 100% coverage on Python 3.13 locallyfake_test_brokerhelper is the sole new public test surface; lives next to existingpatched_messageintests/mocks.pypython -c "from faststream_concurrent_aiokafka import KafkaConcurrentProcessingMiddleware, initialize_concurrent_processing, stop_concurrent_processing, is_kafka_handler_healthy, ConsumerRebalanceListener"