eventsourcing 9.4.0a6__tar.gz → 9.4.0a7__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.
Potentially problematic release.
This version of eventsourcing might be problematic. Click here for more details.
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/PKG-INFO +1 -1
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/application.py +1 -10
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/domain.py +39 -4
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/pyproject.toml +2 -2
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/AUTHORS +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/LICENSE +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/README.md +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/__init__.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/cipher.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/compressor.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/cryptography.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/dispatch.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/interface.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/persistence.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/popo.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/postgres.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/projection.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/py.typed +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/sqlite.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/system.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/tests/__init__.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/tests/application.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/tests/domain.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/tests/persistence.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/tests/postgres_utils.py +0 -0
- {eventsourcing-9.4.0a6 → eventsourcing-9.4.0a7}/eventsourcing/utils.py +0 -0
|
@@ -19,8 +19,6 @@ from typing import (
|
|
|
19
19
|
)
|
|
20
20
|
from warnings import warn
|
|
21
21
|
|
|
22
|
-
from typing_extensions import deprecated
|
|
23
|
-
|
|
24
22
|
from eventsourcing.domain import (
|
|
25
23
|
Aggregate,
|
|
26
24
|
CanMutateProtocol,
|
|
@@ -905,14 +903,7 @@ class Application:
|
|
|
905
903
|
TApplication = TypeVar("TApplication", bound=Application)
|
|
906
904
|
|
|
907
905
|
|
|
908
|
-
|
|
909
|
-
"AggregateNotFound is deprecated, use AggregateNotFoundError instead", category=None
|
|
910
|
-
)
|
|
911
|
-
class AggregateNotFound(EventSourcingError): # noqa: N818
|
|
912
|
-
pass
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
class AggregateNotFoundError(AggregateNotFound):
|
|
906
|
+
class AggregateNotFoundError(EventSourcingError):
|
|
916
907
|
"""
|
|
917
908
|
Raised when an :class:`~eventsourcing.domain.Aggregate`
|
|
918
909
|
object is not found in a :class:`Repository`.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import dataclasses
|
|
4
|
+
import importlib
|
|
3
5
|
import inspect
|
|
4
6
|
import os
|
|
5
|
-
from dataclasses import dataclass
|
|
6
7
|
from datetime import datetime, tzinfo
|
|
7
8
|
from functools import cache
|
|
8
9
|
from types import FunctionType, WrapperDescriptorType
|
|
@@ -336,7 +337,7 @@ class MetaDomainEvent(type):
|
|
|
336
337
|
event_cls = cast(
|
|
337
338
|
type[TDomainEvent], super().__new__(cls, name, bases, cls_dict)
|
|
338
339
|
)
|
|
339
|
-
event_cls = dataclass(frozen=True)(event_cls)
|
|
340
|
+
event_cls = dataclasses.dataclass(frozen=True)(event_cls)
|
|
340
341
|
event_cls.__signature__ = inspect.signature(event_cls.__init__) # type: ignore
|
|
341
342
|
return event_cls
|
|
342
343
|
|
|
@@ -886,6 +887,34 @@ _annotations_mention_id: set[MetaAggregate[Aggregate]] = set()
|
|
|
886
887
|
_init_mentions_id: set[MetaAggregate[Aggregate]] = set()
|
|
887
888
|
|
|
888
889
|
|
|
890
|
+
def _ensure_idempotent_dataclass(module_name: str) -> None:
|
|
891
|
+
module = importlib.import_module(module_name)
|
|
892
|
+
if (
|
|
893
|
+
"dataclass" in module.__dict__
|
|
894
|
+
and module.__dict__["dataclass"] == dataclasses.dataclass
|
|
895
|
+
and "__original_dataclass_func__" not in module.__dict__
|
|
896
|
+
):
|
|
897
|
+
module.__dict__["__original_dataclass_func__"] = module.__dict__["dataclass"]
|
|
898
|
+
module.__dict__["dataclass"] = _idempotent_dataclass
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
def _idempotent_dataclass(cls: type[object] | None = None, /, **kwargs: Any) -> Any:
|
|
902
|
+
|
|
903
|
+
def idempotent_wrap(cls: type[object]) -> type[object]:
|
|
904
|
+
# Avoid processing dataclass twice.
|
|
905
|
+
if "__dataclass_fields__" in cls.__dict__:
|
|
906
|
+
return cls
|
|
907
|
+
return dataclasses.dataclass(**kwargs)(cls)
|
|
908
|
+
|
|
909
|
+
# See if we're being called as @dataclass or @dataclass().
|
|
910
|
+
if cls is None:
|
|
911
|
+
# We're called with parens.
|
|
912
|
+
return idempotent_wrap
|
|
913
|
+
|
|
914
|
+
# We're called as @dataclass without parens.
|
|
915
|
+
return idempotent_wrap(cls)
|
|
916
|
+
|
|
917
|
+
|
|
889
918
|
class MetaAggregate(type, Generic[TAggregate]):
|
|
890
919
|
"""
|
|
891
920
|
Metaclass for aggregate classes.
|
|
@@ -924,6 +953,12 @@ class MetaAggregate(type, Generic[TAggregate]):
|
|
|
924
953
|
"""
|
|
925
954
|
Configures aggregate class definition.
|
|
926
955
|
"""
|
|
956
|
+
|
|
957
|
+
# Avoid processing dataclass twice. This avoids dataclasses.Field(init=False)
|
|
958
|
+
# attributes being reduced to annotation only and then appearing in __init__
|
|
959
|
+
# method signature when class is reprocessed, and other similar problems.
|
|
960
|
+
_ensure_idempotent_dataclass(module_name=args[2]["__module__"])
|
|
961
|
+
|
|
927
962
|
try:
|
|
928
963
|
class_annotations = args[2]["__annotations__"]
|
|
929
964
|
except KeyError:
|
|
@@ -937,8 +972,8 @@ class MetaAggregate(type, Generic[TAggregate]):
|
|
|
937
972
|
else:
|
|
938
973
|
annotations_mention_id = True
|
|
939
974
|
aggregate_cls = type.__new__(cls, *args)
|
|
940
|
-
if class_annotations:
|
|
941
|
-
aggregate_cls = dataclass(eq=False, repr=False)(aggregate_cls)
|
|
975
|
+
if class_annotations or any(dataclasses.is_dataclass(base) for base in args[1]):
|
|
976
|
+
aggregate_cls = dataclasses.dataclass(eq=False, repr=False)(aggregate_cls)
|
|
942
977
|
if annotations_mention_id:
|
|
943
978
|
_annotations_mention_id.add(aggregate_cls)
|
|
944
979
|
return aggregate_cls
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "eventsourcing"
|
|
3
|
-
version = "9.4.
|
|
3
|
+
version = "9.4.0a7"
|
|
4
4
|
|
|
5
5
|
description = "Event sourcing in Python"
|
|
6
6
|
authors = [
|
|
@@ -74,7 +74,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
74
74
|
|
|
75
75
|
[tool.black]
|
|
76
76
|
line-length = 88
|
|
77
|
-
target-version = ["
|
|
77
|
+
target-version = ["py39"]
|
|
78
78
|
include = '\.pyi?$'
|
|
79
79
|
preview = true
|
|
80
80
|
exclude = '''
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|