python-cq 0.11.3__tar.gz → 0.11.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {python_cq-0.11.3 → python_cq-0.11.4}/PKG-INFO +1 -1
  2. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/message.py +25 -9
  3. {python_cq-0.11.3 → python_cq-0.11.4}/pyproject.toml +5 -5
  4. {python_cq-0.11.3 → python_cq-0.11.4}/.gitignore +0 -0
  5. {python_cq-0.11.3 → python_cq-0.11.4}/LICENSE +0 -0
  6. {python_cq-0.11.3 → python_cq-0.11.4}/README.md +0 -0
  7. {python_cq-0.11.3 → python_cq-0.11.4}/cq/__init__.py +0 -0
  8. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/__init__.py +0 -0
  9. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/dispatcher/__init__.py +0 -0
  10. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/dispatcher/base.py +0 -0
  11. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/dispatcher/bus.py +0 -0
  12. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/dispatcher/lazy.py +0 -0
  13. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/dispatcher/pipe.py +0 -0
  14. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/handler.py +0 -0
  15. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/middleware.py +0 -0
  16. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/pipetools.py +0 -0
  17. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/related_events.py +0 -0
  18. {python_cq-0.11.3 → python_cq-0.11.4}/cq/_core/scope.py +0 -0
  19. {python_cq-0.11.3 → python_cq-0.11.4}/cq/exceptions.py +0 -0
  20. {python_cq-0.11.3 → python_cq-0.11.4}/cq/ext/__init__.py +0 -0
  21. {python_cq-0.11.3 → python_cq-0.11.4}/cq/ext/fastapi.py +0 -0
  22. {python_cq-0.11.3 → python_cq-0.11.4}/cq/middlewares/__init__.py +0 -0
  23. {python_cq-0.11.3 → python_cq-0.11.4}/cq/middlewares/retry.py +0 -0
  24. {python_cq-0.11.3 → python_cq-0.11.4}/cq/middlewares/scope.py +0 -0
  25. {python_cq-0.11.3 → python_cq-0.11.4}/cq/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-cq
3
- Version: 0.11.3
3
+ Version: 0.11.4
4
4
  Summary: Lightweight CQRS library for async Python projects.
5
5
  Project-URL: Repository, https://github.com/100nm/python-cq
6
6
  Author: remimd
@@ -2,6 +2,7 @@ from typing import Any, Final
2
2
 
3
3
  import injection
4
4
 
5
+ from cq._core.dispatcher.base import Dispatcher
5
6
  from cq._core.dispatcher.bus import Bus, SimpleBus, TaskBus
6
7
  from cq._core.handler import (
7
8
  HandlerDecorator,
@@ -15,9 +16,9 @@ Command = object
15
16
  Event = object
16
17
  Query = object
17
18
 
18
- type CommandBus[T] = Bus[Command, T]
19
- type EventBus = Bus[Event, None]
20
- type QueryBus[T] = Bus[Query, T]
19
+ type CommandBus[T] = Dispatcher[Command, T]
20
+ type EventBus = Dispatcher[Event, None]
21
+ type QueryBus[T] = Dispatcher[Query, T]
21
22
 
22
23
  AnyCommandBus = CommandBus[Any]
23
24
 
@@ -33,8 +34,7 @@ query_handler: Final[HandlerDecorator[Query, Any]] = HandlerDecorator(
33
34
  )
34
35
 
35
36
 
36
- @injection.injectable(inject=False, mode="fallback")
37
- def new_command_bus(*, threadsafe: bool | None = None) -> CommandBus: # type: ignore[type-arg]
37
+ def new_command_bus(*, threadsafe: bool | None = None) -> Bus[Command, Any]:
38
38
  bus = SimpleBus(command_handler.manager)
39
39
  transaction_scope_middleware = InjectionScopeMiddleware(
40
40
  CQScope.TRANSACTION,
@@ -45,11 +45,27 @@ def new_command_bus(*, threadsafe: bool | None = None) -> CommandBus: # type: i
45
45
  return bus
46
46
 
47
47
 
48
- @injection.injectable(inject=False, mode="fallback")
49
- def new_event_bus() -> EventBus:
48
+ def new_event_bus() -> Bus[Event, None]:
50
49
  return TaskBus(event_handler.manager)
51
50
 
52
51
 
53
- @injection.injectable(inject=False, mode="fallback")
54
- def new_query_bus() -> QueryBus: # type: ignore[type-arg]
52
+ def new_query_bus() -> Bus[Query, Any]:
55
53
  return SimpleBus(query_handler.manager)
54
+
55
+
56
+ @injection.injectable(inject=False, mode="fallback")
57
+ def _() -> CommandBus: # type: ignore[type-arg]
58
+ return new_command_bus()
59
+
60
+
61
+ @injection.injectable(inject=False, mode="fallback")
62
+ def _() -> EventBus:
63
+ return new_event_bus()
64
+
65
+
66
+ @injection.injectable(inject=False, mode="fallback")
67
+ def _() -> QueryBus: # type: ignore[type-arg]
68
+ return new_query_bus()
69
+
70
+
71
+ del _
@@ -23,7 +23,7 @@ test = [
23
23
 
24
24
  [project]
25
25
  name = "python-cq"
26
- version = "0.11.3"
26
+ version = "0.11.4"
27
27
  description = "Lightweight CQRS library for async Python projects."
28
28
  license = "MIT"
29
29
  license-files = ["LICENSE"]
@@ -81,12 +81,12 @@ no_implicit_reexport = true
81
81
  warn_redundant_casts = true
82
82
  warn_unused_ignores = true
83
83
 
84
- [tool.pytest.ini_options]
85
- python_files = "test_*.py"
86
- addopts = "--tb short --cov ./ --cov-report term-missing:skip-covered"
84
+ [tool.pytest]
85
+ python_files = ["test_*.py"]
86
+ addopts = ["--tb", "short", "--cov", "./", "--cov-report", "term-missing:skip-covered"]
87
87
  asyncio_default_fixture_loop_scope = "session"
88
88
  asyncio_mode = "auto"
89
- testpaths = "**/tests/"
89
+ testpaths = ["**/tests/"]
90
90
 
91
91
  [tool.ruff]
92
92
  line-length = 88
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes