python-cq 0.5.1__tar.gz → 0.6.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-cq
3
- Version: 0.5.1
3
+ Version: 0.6.0
4
4
  Summary: Lightweight CQRS library.
5
5
  Project-URL: Repository, https://github.com/100nm/python-cq
6
6
  Author: remimd
@@ -19,7 +19,6 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Classifier: Typing :: Typed
20
20
  Requires-Python: <4,>=3.12
21
21
  Requires-Dist: anyio
22
- Requires-Dist: pydantic<3,>=2
23
22
  Requires-Dist: python-injection
24
23
  Description-Content-Type: text/markdown
25
24
 
@@ -1,13 +1,11 @@
1
1
  from ._core.dispatcher.bus import Bus
2
2
  from ._core.dispatcher.pipe import Pipe
3
- from ._core.dto import DTO
4
3
  from ._core.message import (
5
4
  AnyCommandBus,
6
5
  Command,
7
6
  CommandBus,
8
7
  Event,
9
8
  EventBus,
10
- Message,
11
9
  Query,
12
10
  QueryBus,
13
11
  command_handler,
@@ -27,10 +25,8 @@ __all__ = (
27
25
  "CQScope",
28
26
  "Command",
29
27
  "CommandBus",
30
- "DTO",
31
28
  "Event",
32
29
  "EventBus",
33
- "Message",
34
30
  "Middleware",
35
31
  "MiddlewareResult",
36
32
  "Pipe",
@@ -1,10 +1,8 @@
1
- from abc import ABC
2
1
  from typing import Any
3
2
 
4
3
  import injection
5
4
 
6
5
  from cq._core.dispatcher.bus import Bus, SimpleBus, TaskBus
7
- from cq._core.dto import DTO
8
6
  from cq._core.handler import (
9
7
  HandlerDecorator,
10
8
  MultipleHandlerManager,
@@ -13,22 +11,9 @@ from cq._core.handler import (
13
11
  from cq._core.scope import CQScope
14
12
  from cq.middlewares.scope import InjectionScopeMiddleware
15
13
 
16
-
17
- class Message(DTO, ABC):
18
- __slots__ = ()
19
-
20
-
21
- class Command(Message, ABC):
22
- __slots__ = ()
23
-
24
-
25
- class Event(Message, ABC):
26
- __slots__ = ()
27
-
28
-
29
- class Query(Message, ABC):
30
- __slots__ = ()
31
-
14
+ Command = object
15
+ Event = object
16
+ Query = object
32
17
 
33
18
  type CommandBus[T] = Bus[Command, T]
34
19
  type EventBus = Bus[Event, None]
@@ -20,7 +20,7 @@ class RelatedEvents(Protocol):
20
20
 
21
21
 
22
22
  @dataclass(repr=False, eq=False, frozen=True, slots=True)
23
- class _RelatedEvents(RelatedEvents):
23
+ class SimpleRelatedEvents(RelatedEvents):
24
24
  items: list[Event] = field(default_factory=list)
25
25
 
26
26
  def add(self, *events: Event) -> None:
@@ -29,7 +29,7 @@ class _RelatedEvents(RelatedEvents):
29
29
 
30
30
  @injection.scoped(CQScope.ON_COMMAND, mode="fallback")
31
31
  async def related_events_recipe(event_bus: EventBus) -> AsyncIterator[RelatedEvents]:
32
- yield (instance := _RelatedEvents())
32
+ yield (instance := SimpleRelatedEvents())
33
33
  events = instance.items
34
34
 
35
35
  if not events:
@@ -10,6 +10,7 @@ dev = [
10
10
  ]
11
11
  example = [
12
12
  "fastapi",
13
+ "msgspec",
13
14
  ]
14
15
  test = [
15
16
  "pytest",
@@ -19,7 +20,7 @@ test = [
19
20
 
20
21
  [project]
21
22
  name = "python-cq"
22
- version = "0.5.1"
23
+ version = "0.6.0"
23
24
  description = "Lightweight CQRS library."
24
25
  license = { text = "MIT" }
25
26
  readme = "README.md"
@@ -41,7 +42,6 @@ classifiers = [
41
42
  ]
42
43
  dependencies = [
43
44
  "anyio",
44
- "pydantic (>=2, <3)",
45
45
  "python-injection",
46
46
  ]
47
47
 
@@ -71,15 +71,9 @@ disallow_subclassing_any = true
71
71
  disallow_untyped_defs = true
72
72
  follow_imports = "silent"
73
73
  no_implicit_reexport = true
74
- plugins = ["pydantic.mypy"]
75
74
  warn_redundant_casts = true
76
75
  warn_unused_ignores = true
77
76
 
78
- [tool.pydantic-mypy]
79
- init_forbid_extra = true
80
- init_typed = true
81
- warn_required_dynamic_aliases = true
82
-
83
77
  [tool.pytest.ini_options]
84
78
  python_files = "test_*.py"
85
79
  addopts = "--tb short --cov ./ --cov-report term-missing:skip-covered"
@@ -1,10 +0,0 @@
1
- from abc import ABC
2
- from typing import ClassVar
3
-
4
- from pydantic import BaseModel, ConfigDict
5
-
6
-
7
- class DTO(BaseModel, ABC):
8
- __slots__ = ()
9
-
10
- model_config: ClassVar[ConfigDict] = ConfigDict(frozen=True)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes