diff --git a/.github/workflows/publish_coverage.yml b/.github/workflows/publish_coverage.yml index 04983682f8..99486e096b 100644 --- a/.github/workflows/publish_coverage.yml +++ b/.github/workflows/publish_coverage.yml @@ -19,7 +19,7 @@ jobs: - run: pip install smokeshow - - uses: dawidd6/action-download-artifact@v3.1.4 # nosemgrep + - uses: dawidd6/action-download-artifact@v5 # nosemgrep with: workflow: pr_tests.yaml workflow_conclusion: success diff --git a/docs/docs_src/getting_started/subscription/confluent/filter.py b/docs/docs_src/getting_started/subscription/confluent/filter.py index bb9deabbc3..f9cbfccf43 100644 --- a/docs/docs_src/getting_started/subscription/confluent/filter.py +++ b/docs/docs_src/getting_started/subscription/confluent/filter.py @@ -4,21 +4,21 @@ broker = KafkaBroker("localhost:9092") app = FastStream(broker) +subscriber = broker.subscriber("test-topic") -@broker.subscriber( - "test-topic", +@subscriber( filter=lambda msg: msg.content_type == "application/json", ) async def handle(name: str, user_id: int): assert name == "John" assert user_id == 1 - -@broker.subscriber("test-topic") +@subscriber async def default_handler(msg: str): assert msg == "Hello, FastStream!" + @app.after_startup async def test(): await broker.publish( diff --git a/docs/docs_src/getting_started/subscription/kafka/filter.py b/docs/docs_src/getting_started/subscription/kafka/filter.py index e0ae82f2f0..10737827a3 100644 --- a/docs/docs_src/getting_started/subscription/kafka/filter.py +++ b/docs/docs_src/getting_started/subscription/kafka/filter.py @@ -4,21 +4,21 @@ broker = KafkaBroker("localhost:9092") app = FastStream(broker) +subscriber = broker.subscriber("test-topic") -@broker.subscriber( - "test-topic", +@subscriber( filter=lambda msg: msg.content_type == "application/json", ) async def handle(name: str, user_id: int): assert name == "John" assert user_id == 1 - -@broker.subscriber("test-topic") +@subscriber async def default_handler(msg: str): assert msg == "Hello, FastStream!" + @app.after_startup async def test(): await broker.publish( diff --git a/docs/docs_src/getting_started/subscription/nats/filter.py b/docs/docs_src/getting_started/subscription/nats/filter.py index 6ab5913933..26c4419db1 100644 --- a/docs/docs_src/getting_started/subscription/nats/filter.py +++ b/docs/docs_src/getting_started/subscription/nats/filter.py @@ -4,21 +4,21 @@ broker = NatsBroker("nats://localhost:4222") app = FastStream(broker) +subscriber = broker.subscriber("test-subject") -@broker.subscriber( - "test-subject", +@subscriber( filter=lambda msg: msg.content_type == "application/json", ) async def handle(name: str, user_id: int): assert name == "John" assert user_id == 1 - -@broker.subscriber("test-subject") +@subscriber async def default_handler(msg: str): assert msg == "Hello, FastStream!" + @app.after_startup async def test(): await broker.publish( diff --git a/docs/docs_src/getting_started/subscription/rabbit/filter.py b/docs/docs_src/getting_started/subscription/rabbit/filter.py index 9c50aa548b..73c6d3339b 100644 --- a/docs/docs_src/getting_started/subscription/rabbit/filter.py +++ b/docs/docs_src/getting_started/subscription/rabbit/filter.py @@ -4,21 +4,21 @@ broker = RabbitBroker("amqp://guest:guest@localhost:5672/") app = FastStream(broker) +subscriber = broker.subscriber("test-queue") -@broker.subscriber( - "test-queue", +@subscriber( filter=lambda msg: msg.content_type == "application/json", ) async def handle(name: str, user_id: int): assert name == "John" assert user_id == 1 - -@broker.subscriber("test-queue") +@subscriber async def default_handler(msg: str): assert msg == "Hello, FastStream!" + @app.after_startup async def test(): await broker.publish( diff --git a/docs/docs_src/getting_started/subscription/redis/filter.py b/docs/docs_src/getting_started/subscription/redis/filter.py index 02a017c8a9..ac116f8cf0 100644 --- a/docs/docs_src/getting_started/subscription/redis/filter.py +++ b/docs/docs_src/getting_started/subscription/redis/filter.py @@ -4,21 +4,21 @@ broker = RedisBroker("redis://localhost:6379") app = FastStream(broker) +subscriber = broker.subscriber("test-channel") -@broker.subscriber( - "test-channel", +@subscriber( filter=lambda msg: msg.content_type == "application/json", ) async def handle(name: str, user_id: int): assert name == "John" assert user_id == 1 - -@broker.subscriber("test-channel") +@subscriber async def default_handler(msg: str): assert msg == "Hello, FastStream!" + @app.after_startup async def test(): await broker.publish( diff --git a/docs/includes/getting_started/subscription/filtering/1.md b/docs/includes/getting_started/subscription/filtering/1.md index 4c45e97160..807a7a5e6e 100644 --- a/docs/includes/getting_started/subscription/filtering/1.md +++ b/docs/includes/getting_started/subscription/filtering/1.md @@ -1,24 +1,24 @@ === "AIOKafka" - ```python linenums="1" hl_lines="10 17" - {!> docs_src/getting_started/subscription/kafka/filter.py [ln:1-19] !} + ```python linenums="1" hl_lines="7 9-11 16" + {!> docs_src/getting_started/subscription/kafka/filter.py [ln:1-18] !} ``` === "Confluent" - ```python linenums="1" hl_lines="10 17" - {!> docs_src/getting_started/subscription/confluent/filter.py [ln:1-19] !} + ```python linenums="1" hl_lines="7 9-11 16" + {!> docs_src/getting_started/subscription/confluent/filter.py [ln:1-18] !} ``` === "RabbitMQ" - ```python linenums="1" hl_lines="10 17" - {!> docs_src/getting_started/subscription/rabbit/filter.py [ln:1-19] !} + ```python linenums="1" hl_lines="7 9-11 16" + {!> docs_src/getting_started/subscription/rabbit/filter.py [ln:1-18] !} ``` === "NATS" - ```python linenums="1" hl_lines="10 17" - {!> docs_src/getting_started/subscription/nats/filter.py [ln:1-19] !} + ```python linenums="1" hl_lines="7 9-11 16" + {!> docs_src/getting_started/subscription/nats/filter.py [ln:1-18] !} ``` === "Redis" - ```python linenums="1" hl_lines="10 17" - {!> docs_src/getting_started/subscription/redis/filter.py [ln:1-19] !} + ```python linenums="1" hl_lines="7 9-11 16" + {!> docs_src/getting_started/subscription/redis/filter.py [ln:1-18] !} ``` diff --git a/pyproject.toml b/pyproject.toml index 1442a88388..fb22a76a80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,7 +79,7 @@ otel = ["opentelemetry-sdk>=1.24.0,<2.0.0"] optionals = ["faststream[rabbit,kafka,confluent,nats,redis,otel]"] devdocs = [ - "mkdocs-material==9.5.25", + "mkdocs-material==9.5.26", "mkdocs-static-i18n==1.2.3", "mdx-include==1.4.2", "mkdocstrings[python]==0.25.1", @@ -113,13 +113,13 @@ lint = [ "faststream[types]", "ruff==0.4.8", "bandit==1.7.8", - "semgrep==1.74.0", + "semgrep==1.75.0", "codespell==2.3.0", ] test-core = [ "coverage[toml]==7.5.3", - "pytest==8.2.1", + "pytest==8.2.2", "pytest-asyncio==0.23.7", "dirty-equals==0.7.1.post0", "typing-extensions>=4.8.0,<4.12.1; python_version < '3.9'", # to fix dirty-equals