Releases: ag2ai/faststream
v0.7.0rc1
What's Changed
- fix: corrected security parsing for mqtt broker by @lemmehoop in #2832
- chore: add MQTT code ownership for borisalekseev by @Lancetnik in #2825
- feat: support broker-level ack_policy with per-subscriber override by @ce1ebrimbor in #2827
- tests: add MQTT AsyncAPI tests by @Lancetnik in #2830
New Contributors
- @ce1ebrimbor made their first contribution in #2827
- @lemmehoop made their first contribution in #2832
Full Changelog: 0.7.0rc0...0.7.0rc1
v0.7.0rc0
What's Changed
Just two main changes:
from faststream.mqtt import MQTTBroker(thanks @borisalekseev)- All deprecations removed:
- publisher/subscriber-level middlewares
- ack_policy now replaces several deprecated options
- RedisJSONMessageParser removed. Now all services should use the binary message format.
broker.closeremoved, usebroker.stopinstead
You install the release manually
pip install "faststream[mqtt]==0.7.0rc0"
# or
uv add --pre "faststream[mqtt]==0.7.0rc0"We will release a stable version as soon as we test MQTTBroker with production services (in a few weeks).
- feat: FastStream[mqtt] by @borisalekseev in #2819
- fix: include pattern subscribers in AsyncAPI specification by @aazmv in #2813
- fix: cli preserve import errors by @vovkka in #2817
- docs: fix images generation in release notes by @Lancetnik in #2792
- docs: add multiple topics registration with a single call by @benaduo in #2814
- docs: add How-To section placeholders for RabbitMQ, Confluent, and Redis by @benaduo in #2815
- docs: change polling_interval units (seconds -> milliseconds) by @MikhailWar in #2821
- chore: Prepare 0.7.0 update by @borisalekseev in #2822
- ci: Test basic 3.14 by @vvlrff in #2795
New Contributors
- @aazmv made their first contribution in #2813
- @vovkka made their first contribution in #2817
- @benaduo made their first contribution in #2814
- @MikhailWar made their first contribution in #2821
Full Changelog: 0.6.7...0.7.0rc0
v0.6.7
What's Changed
The main feature of this release is the Try It Out feature for your Async API documentation!
Now you can test your developing application directly from the web, just like Swagger for HTTP. It supports in-memory publication to test a subscriber and real broker publication to verify behavior in real scenarios.
Full updates:
- feat: Static membership for aiokafka broker (group_instance_id) by @tmlnv in #2783
- feat: add on_assign, on_revoke, on_lost callbacks for Confluent subscriber by @Br1an67 in #2789
- feat: use MRO-based exception handler resolution by @Br1an67 in #2788
- fix: Bug: AsyncAPI documentation fails when Confluent uses oauth bearer authentication by @yann-combarnous in #2775
- fix: preserve exception chains in AsgiFastStream startup by @zoni in #2781
- fix: use sentinel in StreamMessage.decode() to cache None results by @benedikt-bartscher in #2784
- fix: propagate expiration property in rabbit test broker by @marcm-ml in #2787
- docs: Add schedule parameter for NATS publishing by @Majajashka in #2763
- docs: fix publish_scope by @kurrbanov in #2768
New Contributors
- @kurrbanov made their first contribution in #2768
- @yann-combarnous made their first contribution in #2775
- @zoni made their first contribution in #2781
- @tmlnv made their first contribution in #2783
- @benedikt-bartscher made their first contribution in #2784
- @marcm-ml made their first contribution in #2787
- @Br1an67 made their first contribution in #2789
Full Changelog: 0.6.6...0.6.7
v0.6.6
What's Changed
- Add support for aiokafka 0.13 by @dolfinus in #2754
- docs: replaced missing coverage commands with existing ones by @literally-user in #2734
- Feature: Add raw client bench by @Flosckow in #2645
- chore: revert fastapi v128 check by @Flosckow in #2740
- chore: ruff
F811by @chirizxc in #2737 - chore: add hash to actions by @Flosckow in #2741
- fix: xautoclaim compatibility with old version redis by @ksayer in #2750
New Contributors
- @literally-user made their first contribution in #2734
- @ksayer made their first contribution in #2750
Full Changelog: 0.6.5...0.6.6
0.6.5
What's Changed
- fix: FastAPI 0.128 compatibility
- fix(docs): dependencies installation by @theseriff in #2710
- Add tests for XREADGROUP vs XAUTOCLAIM selection based on min_idle_time by @vvlrff in #2713
- fix: polish middleware types in favor to Pycharm by @Lancetnik in #2715
- suppress
ServiceUnavailableErrorfor nats by @swelborn in #2720
New Contributors
Full Changelog: 0.6.4...0.6.5
v0.6.4
What's Changed
- feat: Enables message keys for batch publishing by @ozeranskii in #2586
- feat: add env variable to disable rich CLI output by @Lancetnik in #2654
- feat: Add api for nats message scheduling by @sheldygg in #2640
- feat: trace is printed only once by @fil1n in #2661
- fix: update fast depends config when setting a broker by @borisalekseev in #2701
- fix: Dont raise on unknown content types by @borisalekseev in #2702
- fix(redis): fix xautoclaim consumption by @JonathanSerafini in #2628
- fix: bug in AsyncAPI schema by @kittywaresz in #2638
- fix(rabbit): handle leading slash in virtualhost correctly by @Vitaly312 in #2707
- fix: use publisher's exchange when applicable to send reply by @lachaib in #2655
- fix: kafka ack policies` behaviour by @borisalekseev in #2644
- refactor: streamline conditional logic in
get_onemethod of stream … by @powersemmi in #2667 - refactor: restructure justfile and unify cross-platform commands by @suiseriff in #2690
- refactor(docs): actualize kafka how to by @WorkHardes in #2692
- docs: Added a Code examples article by @RenameMe1 in #2670
- docs: Fix kafka subscribe docs and llms.txt by @borisalekseev in #2700
- docs: Fix link reference in FastAPI integration docs by @supadrupa in #2681
- chore: LICENSE copying added by @ZoRex15 in #2685
- chore: Add warning when using AckPolicy.REJECT_ON_ERROR with kafka by @borisalekseev in #2686
- chore: skip relator notifications for dependabot events by @if-i in #2669
- chore: added no_confirm=True warning by @roma-frolov in #2703
- chore: update relator by @Sehat1137 in #2650
New Contributors
- @if-i made their first contribution in #2669
- @supadrupa made their first contribution in #2681
- @ZoRex15 made their first contribution in #2685
- @WorkHardes made their first contribution in #2692
- @Vitaly312 made their first contribution in #2707
- @lachaib made their first contribution in #2655
Full Changelog: 0.6.3...0.6.4
v0.6.3
What's Changed
- Fix annotation for group_instance_id parameter by @gandhis1 in #2606
- Add support for
min_idle_timein Redis StreamSub and XAUTOCLAIM by @powersemmi in #2607 - fix incorrect nats annotations by @swelborn in #2619
- docs(healthchecks): Fix typing example by @redb0 in #2624
- add nats kv message annotation by @swelborn in #2626
- redis: allow tasks to be added to subscribers by @JonathanSerafini in #2622
- Reusing router in multiple brokers or routers by @borisalekseev in #2591
- fix: remove UltraJSON (ujson) dependency by @Sehat1137 in #2634
- fix: allow explicit publishing to partition #0 of a topic from a Kafka publisher by @antoinehumbert in #2629
- docs: Versioning policy by @RenameMe1 in #2623
- docs: Update faststream.md by @RenameMe1 in #2631
- docs: Added reference to broker's RPC modes by @RenameMe1 in #2636
- docs: Add Guidilines: Links in documentation by @RenameMe1 in #2637
- fix enable.auto.commit kafka setting by @borisalekseev in #2612
- docs: fix checkboxes by @Lancetnik in #2643
- fix: FastAPI 0.121 compat by @Lancetnik in #2648
New Contributors
- @gandhis1 made their first contribution in #2606
- @swelborn made their first contribution in #2619
- @redb0 made their first contribution in #2624
Full Changelog: 0.6.2...0.6.3
v0.6.2
What's Changed
- Asgi request validation error and docs by @borisalekseev in #2525
- fix: docs render if broker is set by set_broker by @Sehat1137 in #2592
- feat: custom labels in prometheus metrics by @roma-frolov in #2555
- Add LICENSE file info in distribution by @Nifacy in #2595
- Mock
xackandxdelmethods in Redis testing setup. by @powersemmi in #2599 - fix: correct group_id default usage by @Lancetnik in #2601
- fix: force ERROR log level in CriticalLogMiddleware by @Lancetnik in #2602
- fix: AsyncAPI 3.0 server security use ref by @Lancetnik in #2603
- lint: fix confluent subscriber decorator annotation by @Lancetnik in #2604
New Contributors
Full Changelog: 0.6.1...0.6.2
v0.6.1
What's Changed
- feat: add --loop option to run command by @dimastbk in #2572
- chore(deps): typing extensions to >=4.12.0 by @maksimv0202 in #2575
- chore: update reagento/relator by @Sehat1137 in #2577
- feat(otel): Allows configurable message counters by @ozeranskii in #2579
- chore: Updates CODE_OF_CONDUCT link in README.md by @ozeranskii in #2583
- fix: expose ContextRepo to public API by @Lancetnik in #2581
- fix: pass serializer to message in RMQ TestClient by @Lancetnik in #2582
New Contributors
- @dimastbk made their first contribution in #2572
- @maksimv0202 made their first contribution in #2575
- @ozeranskii made their first contribution in #2579
Full Changelog: 0.6.0...0.6.1
v0.6.0
Description
FastStream 0.6 is a significant technical release that aimed to address many of the current project design issues and unlock further improvements on the path to version 1.0.0. We tried our best to minimize breaking changes, but unfortunately, some aspects were simply not working well. Therefore, we decided to break them in order to move forward.
This release includes:
- Finalized Middleware API
- Finalized Router API
- Introduced dynamic subscribers
- Added support for various serializer backends (such as Msgspec)
- Support for AsyncAPI 3.0 specification
- A range of minor refactors and improvements
The primary goal of this release is to unlock the path towards further features. Therefore, we are pleased to announce that after this release, we plan to work on MQTT #956 and SQS #794 support and move towards version 1.0.0!
Breaking changes
Firstly, we have dropped support for Python 3.8 and Python 3.9. Python 3.9 is almost at the end of its life cycle, so it's a good time to update our minimum version.
FastStream object changes
The broker has become a POSITIONAL-ONLY argument. This means that FastStream(broker=broker) is no longer valid. You should always pass the broker as a separate positional argument, like FastStream(brokers), to ensure proper usage.
This is a preparatory step for FastStream(*brokers) support, which will be introduced in 1.0.0.
AsyncAPI changes
In 0.6, you can't directly pass custom AsyncAPI options to the FastStream constructor anymore.
app = FastStream( # doesn't work anymore
...,
title="My App",
version="1.0.0",
description="Some description",
)You need to create a specification object and pass it manually to the constructor.
from faststream import FastStream, AsyncAPI
FastStream(
...
specification=AsyncAPI(
title="My App",
version="1.0.0",
description="Some description",
)
)Retry feature removed
Previously, you were able to configure retry attempts for a handler by using the following option:
@broker.subscriber("in", retry=True) # was removed
async def handler(): ...Unfortunately, this option was a design mistake. We apologize for any confusion it may have caused. Technically, it was just a shortcut to message.nack() on error. We have decided that manual acknowledgement control would be more idiomatic and better for the framework. Therefore, we have provided a new feature in its place: ack_policy control.
@broker.subscriber("test", ack_policy=AckPolicy.ACK_FIRST)
async def handler() -> None: ...With ack_policy, you can now control the default acknowledge behavior for your handlers. AckPolicy offers the following options:
- REJECT_ON_ERROR (default) – to permanently discard messages on failure.
- NACK_ON_ERROR – to redeliver messages in case of failure.
- ACK_FIRST – for scenarios with high throughput where some message loss can be acceptable.
- ACK – if you want the message to be acknowledged, regardless of success or failure.
- MANUAL – fully manually control message acknowledgment (for example, calling #!python message.ack() yourself).
In addition, we have deprecated a few more options prior to ack_policy.
ack_first=True->AckPolicy.ACK_FIRSTno_ack=True->AckPolicy.MANUAL
Context changes
We have made some changes to our Dependency Injection system, so the global context is no longer available.
Currently, you cannot simply import the context from anywhere and use it freely.
from faststeam import context # was removedInstead, you should create the context in a slightly different way. The FastStream object serves as an entry point for this, so you can place it wherever you need it:
from typing import Annotated
from faststream import Context, ContextRepo, FastStream
from faststream.rabbit import RabbitBroker
broker = RabbitBroker()
app = FastStream(
broker,
context=ContextRepo({
"global_dependency": "value",
}),
)Everything else about using the context remains the same. You can request it from the context at any place that supports it.
Additionally, Context("broker") and Context("logger") have been moved to the local context. They cannot be accessed from lifespan hooks any longer.
@app.after_startup
async def start(
broker: Broker # does not work anymore
): ...
@router.subscriber
async def handler(
broker: Broker # still working
): ...This change was also made to support multiple brokers.
Middlewares changes
Also, we have finalized our Middleware API. It now supports all the features we wanted, and we have no plans to change it anymore. First of all, the BaseMiddleware class constructor requires a context (which is no longer global).
class BaseMiddleware:
def __init__(self, msg: Any | None, context: ContextRepo) -> None:
self.msg = msg
self.context = contextThe context is now available as self.context in all middleware methods.
We also changed the publish_scope function signature.
class BaseMiddleware: # old signature
async def publish_scope(
self,
call_next: "AsyncFunc",
msg: Any,
*args: Any,
**kwargs: Any,
) -> Any: ...Previously, any options passed to brocker.publish("msg", "destination") had to be consumed as *args, **kwargs.
Now, you can consume them all as a single PublishCommand object.
from faststream import PublishCommand
class BaseMiddleware:
async def publish_scope(
self,
call_next: Callable[[PublishCommand], Awaitable[Any]],
cmd: PublishCommand,
) -> Any: ...Thanks to Python 3.13's TypeVars with defaults, BaseMiddleware becomes a generic class and you can specify the PublishCommand for the broker you want to work with.
from faststream.rabbit import RabbitPublishCommand
class Middleware(BaseMiddleware[RabbitPublishCommand]):
async def publish_scope(
self,
call_next: Callable[[RabbitPublishCommand], Awaitable[Any]],
cmd: RabbitPublishCommand,
) -> Any: ...Warning: The methods on_consume, after_consume, on_publish and after_publish will be deprecated and removed in version 0.7. Please use consume_scope and publish_scope instead.
Redis Default Message format changes
In FastStream 0.6 we are using BinaryMessageFormatV1 as a default instead of JSONMessageFormat .
You can find more details in the documentation: https://faststream.ag2.ai/latest/redis/message_format/
New Features:
-
AsyncAPI3.0 support – now you can choose between
AsyncAPI(schema_version="3.0.0")(default) andAsyncAPI(schema_version="2.6.0")schemas generation -
Msgspec native support
from fast_depends.msgspec import MsgSpecSerializer broker = Broker(serializer=MsgSpecSerializer())
-
Subscriber iteration support. This features supports all middlewares and other FastStream features.
subscriber = broker.subscriber(..., persistent=False) await subscriber.start() async for msg in subscriber: ...
Deprecation removed
@broker.subscriber(..., filters=...)removedmessage.decoded_bodyremoved, useawait message.decode()insteadpublish(..., rpc=True)removed, usebroker.request()instead- RabbitMQ
@broker.subscriber(..., reply_config=...)removed, useResponseinstead
What's Changed
- ConfuentConfig delivery.timeout.ms option added by @stepanbobrik in #2381
- chore: create notification for new issue by @Sehat1137 in #2384
- docs: Add Serialization details & Partial body consuming by @RenameMe1 in #2378
- 0.6.0 by @Lancetnik in #1779
- ci: correct just-install job by @Lancetnik in #2393
- ci: ignore secret detection false positive by @bsoyka in #2399
- fix(redis): assign serializer to internal producer in LogicPublisher by @loRes228 in #2396
- types: add Rabbit type tests by @RenameMe1 in #2401
- docs: updated manual run with broker examples by @ArtyomVysotskiy in #2402
- tests: remove useless tests by @Lancetnik in #2403
- fix: Added missing DecodedMessage export to faststream.types by @loRes228 in #2405
- types: add Nats type tests by @RenameMe1 in #2406
- types: add Confluent type tests by @RenameMe1 in #2407
- ci: add zizmor and implement related fixes by @bsoyka in #2398
- Docs: fix list of modes by @Totorokrut in #2413
- CI: use pre-commit-ci-lite instead of manual commit step during linters by @kittywaresz in #2416
- lint(rabbit): check publisher and subscriber by @ApostolFet in #2415
- dont replace hyphen in cli values by @borisa...