Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cq/_core/routing/dispatchers/bus.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from abc import ABC, abstractmethod
from collections.abc import Awaitable, Callable, Iterator
from typing import Any, Concatenate, Protocol, Self, runtime_checkable
Expand All @@ -14,6 +15,11 @@
SingleHandlerRegistry,
)

if sys.version_info >= (3, 13): # pragma: no cover
from warnings import deprecated
else: # pragma: no cover
from typing_extensions import deprecated

type Listener[T] = Callable[[T], Awaitable[Any]]


Expand All @@ -29,6 +35,11 @@ def add_listeners(self, *listeners: Listener[I]) -> Self:
def add_middlewares(self, *middlewares: Middleware[Concatenate[I, ...], O]) -> Self:
raise NotImplementedError

@deprecated(
"`Bus.subscribe` is intended for tests, register handlers with the router "
"decorators (`command_handler`, `event_handler`, `query_handler`) instead.",
category=None,
)
@abstractmethod
def subscribe(
self,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ classifiers = [
dependencies = [
"anyio",
"type-analyzer",
"typing-extensions; python_version < '3.13'",
]

[project.optional-dependencies]
Expand Down
2 changes: 2 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading