apexdevkit 2.4.1__py3-none-any.whl → 2.4.2__py3-none-any.whl
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.
- apexdevkit/__init__.py +0 -2
- apexdevkit/observer.py +72 -0
- apexdevkit/server.py +2 -3
- {apexdevkit-2.4.1.dist-info → apexdevkit-2.4.2.dist-info}/METADATA +1 -2
- {apexdevkit-2.4.1.dist-info → apexdevkit-2.4.2.dist-info}/RECORD +7 -6
- {apexdevkit-2.4.1.dist-info → apexdevkit-2.4.2.dist-info}/WHEEL +0 -0
- {apexdevkit-2.4.1.dist-info → apexdevkit-2.4.2.dist-info}/licenses/LICENSE +0 -0
apexdevkit/__init__.py
CHANGED
apexdevkit/observer.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
from typing import TYPE_CHECKING, Protocol, Self
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from collections.abc import Iterable
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass(frozen=True, kw_only=True)
|
|
11
|
+
class Publisher[T]:
|
|
12
|
+
observers: list[_Subscriber[T]] = field(default_factory=list)
|
|
13
|
+
|
|
14
|
+
def attach(self, observer: _Subscriber[T]) -> Self:
|
|
15
|
+
self.observers.append(observer)
|
|
16
|
+
|
|
17
|
+
return self
|
|
18
|
+
|
|
19
|
+
def notify_create_one(self, item: T) -> T:
|
|
20
|
+
self.notify_create(items=[item])
|
|
21
|
+
|
|
22
|
+
return item
|
|
23
|
+
|
|
24
|
+
def notify_create(self, *, items: list[T]) -> Iterable[T]:
|
|
25
|
+
for observer in self.observers:
|
|
26
|
+
observer.on_create(items=items)
|
|
27
|
+
|
|
28
|
+
return items
|
|
29
|
+
|
|
30
|
+
def notify_update_one(self, item: T) -> T:
|
|
31
|
+
self.notify_update(items=[item])
|
|
32
|
+
|
|
33
|
+
return item
|
|
34
|
+
|
|
35
|
+
def notify_update(self, *, items: list[T]) -> Iterable[T]:
|
|
36
|
+
for observer in self.observers:
|
|
37
|
+
observer.on_update(items=items)
|
|
38
|
+
|
|
39
|
+
return items
|
|
40
|
+
|
|
41
|
+
def notify_delete_one(self, item: T) -> T:
|
|
42
|
+
self.notify_delete(items=[item])
|
|
43
|
+
|
|
44
|
+
return item
|
|
45
|
+
|
|
46
|
+
def notify_delete(self, *, items: list[T]) -> Iterable[T]:
|
|
47
|
+
for observer in self.observers:
|
|
48
|
+
observer.on_delete(items=items)
|
|
49
|
+
|
|
50
|
+
return items
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class _Subscriber[T](Protocol): # pragma: no cover
|
|
54
|
+
def on_create(self, *, items: list[T]) -> None:
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
def on_update(self, *, items: list[T]) -> None:
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
def on_delete(self, *, items: list[T]) -> None:
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class Subscriber[T]: # pragma: no cover
|
|
65
|
+
def on_create(self, *, items: list[T]) -> None:
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
def on_update(self, *, items: list[T]) -> None:
|
|
69
|
+
pass
|
|
70
|
+
|
|
71
|
+
def on_delete(self, *, items: list[T]) -> None:
|
|
72
|
+
pass
|
apexdevkit/server.py
CHANGED
|
@@ -6,8 +6,7 @@ from typing import TYPE_CHECKING, Any
|
|
|
6
6
|
|
|
7
7
|
import sentry_sdk
|
|
8
8
|
import uvicorn
|
|
9
|
-
from
|
|
10
|
-
from pypebbles.runtime import Environment
|
|
9
|
+
from pypebbles import Environment
|
|
11
10
|
|
|
12
11
|
if TYPE_CHECKING:
|
|
13
12
|
from collections.abc import Callable
|
|
@@ -28,7 +27,7 @@ class UvicornServer:
|
|
|
28
27
|
|
|
29
28
|
@classmethod
|
|
30
29
|
def from_env(cls, path: str = ".env") -> UvicornServer:
|
|
31
|
-
|
|
30
|
+
Environment().load(path)
|
|
32
31
|
Sentry().setup()
|
|
33
32
|
|
|
34
33
|
return cls(LoggingConfig().setup().as_dict())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apexdevkit
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.2
|
|
4
4
|
Summary: Apex Development Tools for python.
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Author: Apex Dev
|
|
@@ -14,7 +14,6 @@ Requires-Dist: fastapi
|
|
|
14
14
|
Requires-Dist: pydantic
|
|
15
15
|
Requires-Dist: pymssql (==2.*)
|
|
16
16
|
Requires-Dist: pypebbles (==0.5.*)
|
|
17
|
-
Requires-Dist: python-dotenv
|
|
18
17
|
Requires-Dist: sentry-sdk[fastapi]
|
|
19
18
|
Requires-Dist: uvicorn
|
|
20
19
|
Description-Content-Type: text/markdown
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
apexdevkit/__init__.py,sha256=
|
|
1
|
+
apexdevkit/__init__.py,sha256=z6IDoaHCHK8h5SEEHSKw_n_sEZE5BGgZ3X7lw0Guox8,129
|
|
2
2
|
apexdevkit/annotation/__init__.py,sha256=pgFxbJ_Ip8MnsqwIc3A_aczneVMi_T4v1s0VQ4qX4b4,81
|
|
3
3
|
apexdevkit/annotation/deprecate.py,sha256=V5ZmGWG153U_UFcAIfrek8KX4NS6RLu79YTfIItvS7A,1544
|
|
4
4
|
apexdevkit/date.py,sha256=vtvGc8BDOxGi7PMRsRrq2i_nAjV1pfVZu1jXXO8M48g,2133
|
|
@@ -14,6 +14,7 @@ apexdevkit/fastapi/schema.py,sha256=U6RAwS7wkOayktMOUV5FHQkPbBytR3MtZV1VMdB2KZk,
|
|
|
14
14
|
apexdevkit/fastapi/service.py,sha256=H8cACuQ8mVb5M0mTsI87PV3gHR5gFI2RgQC-TTKJm2o,4096
|
|
15
15
|
apexdevkit/formatter.py,sha256=okL3fyEgTUJAJ2xkZSundJjCu_iA7xe-nYL824AGQ2g,3899
|
|
16
16
|
apexdevkit/key_fn.py,sha256=5NssHJzeOHmDqVLNcDZ9RCqkpCxCRlG85wos8cNo_KI,323
|
|
17
|
+
apexdevkit/observer.py,sha256=4HPAIcbJVdSL4HDjBKECXGKtCseaNn_MMeDju-SbenE,1761
|
|
17
18
|
apexdevkit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
19
|
apexdevkit/query/__init__.py,sha256=MExLzdKsES-hWZ5JAMOxLuW4VJoAwTlh1SIgHN_qSn8,568
|
|
19
20
|
apexdevkit/query/generator.py,sha256=QpQ0La2nT3TxnDkn24zclI1PM_7Mk6-tgfNo6VocGjE,11609
|
|
@@ -37,9 +38,9 @@ apexdevkit/repository/sql/mssql/table.py,sha256=X8g7J1j3s9sHVojlAc-fI7Aicegqc6n6
|
|
|
37
38
|
apexdevkit/repository/sql/sqlite/__init__.py,sha256=dG08No5TFPL4P2ymZkVBgDxxBq-UPcCUNIZVr_JOmXg,178
|
|
38
39
|
apexdevkit/repository/sql/sqlite/repository.py,sha256=goMCJle7U0-Fa9QuhpvtBiDbIW3-n6ootPxvz6fe20w,2176
|
|
39
40
|
apexdevkit/repository/sql/sqlite/table.py,sha256=iVMDAbeUVjcktSsl1STbNtWZgtITFU3TFIYdNiipweQ,7537
|
|
40
|
-
apexdevkit/server.py,sha256=
|
|
41
|
+
apexdevkit/server.py,sha256=zo72jPZ0hCT_BlD-cpKaLetMSsYf5KGW3Dd0CCISSKA,4343
|
|
41
42
|
apexdevkit/testing.py,sha256=7Xc0HMWgkj8vjdBI7KS86Uknhlbaitw6U20sI_7IblQ,4505
|
|
42
|
-
apexdevkit-2.4.
|
|
43
|
-
apexdevkit-2.4.
|
|
44
|
-
apexdevkit-2.4.
|
|
45
|
-
apexdevkit-2.4.
|
|
43
|
+
apexdevkit-2.4.2.dist-info/METADATA,sha256=u3C4zpsVc2LOOFKZP98oBiOKjQm9h54JLALB_VQgVzw,616
|
|
44
|
+
apexdevkit-2.4.2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
|
|
45
|
+
apexdevkit-2.4.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
46
|
+
apexdevkit-2.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|