apexdevkit 1.20.4__tar.gz → 1.20.6__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.
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/PKG-INFO +1 -2
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/dependable.py +9 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/connector.py +0 -9
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/pyproject.toml +1 -2
- apexdevkit-1.20.4/apexdevkit/repository/mongo.py +0 -82
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/LICENSE +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/README.md +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/error.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/name.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/request.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/http/httpx/__init__.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/http/httpx/client.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/http/httpx/hooks.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/id.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/query/__init__.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/query/generator.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/query/query.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/mssql.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/sql.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/server.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/testing/rest.py +0 -0
- {apexdevkit-1.20.4 → apexdevkit-1.20.6}/apexdevkit/value.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: apexdevkit
|
|
3
|
-
Version: 1.20.
|
|
3
|
+
Version: 1.20.6
|
|
4
4
|
Summary: Apex Development Tools for python.
|
|
5
5
|
Author: Apex Dev
|
|
6
6
|
Author-email: dev@apex.ge
|
|
@@ -11,7 +11,6 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.13
|
|
12
12
|
Requires-Dist: fastapi
|
|
13
13
|
Requires-Dist: httpx
|
|
14
|
-
Requires-Dist: pymongo
|
|
15
14
|
Requires-Dist: pymssql (>=2.3.1,<3.0.0)
|
|
16
15
|
Requires-Dist: python-dotenv
|
|
17
16
|
Requires-Dist: sentry-sdk[fastapi]
|
|
@@ -6,6 +6,7 @@ from fastapi.requests import Request
|
|
|
6
6
|
|
|
7
7
|
from apexdevkit.error import ApiError, DoesNotExistError
|
|
8
8
|
from apexdevkit.fastapi import RestfulServiceBuilder
|
|
9
|
+
from apexdevkit.fastapi.builder import PreBuilt
|
|
9
10
|
from apexdevkit.fastapi.name import RestfulName
|
|
10
11
|
from apexdevkit.fastapi.response import RestfulResponse
|
|
11
12
|
from apexdevkit.fastapi.service import RestfulService
|
|
@@ -93,6 +94,14 @@ class DependableBuilder:
|
|
|
93
94
|
def from_callable(cls, value: _BuilderCallable) -> "DependableBuilder":
|
|
94
95
|
return cls(BuilderCallableDependency(value))
|
|
95
96
|
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_builder(cls, value: RestfulServiceBuilder) -> "DependableBuilder":
|
|
99
|
+
return cls(BuilderCallableDependency(lambda: value))
|
|
100
|
+
|
|
101
|
+
@classmethod
|
|
102
|
+
def from_service(cls, value: RestfulService) -> "DependableBuilder":
|
|
103
|
+
return cls(BuilderCallableDependency(lambda: PreBuilt(value)))
|
|
104
|
+
|
|
96
105
|
def with_parent(self, value: RestfulName) -> "DependableBuilder":
|
|
97
106
|
return DependableBuilder(ParentDependency(value, self.dependency))
|
|
98
107
|
|
|
@@ -7,7 +7,6 @@ from functools import cached_property
|
|
|
7
7
|
from typing import Any, ContextManager
|
|
8
8
|
|
|
9
9
|
import pymssql
|
|
10
|
-
from pymongo import MongoClient
|
|
11
10
|
from pymssql import Connection as _Connection
|
|
12
11
|
from pymssql import Cursor
|
|
13
12
|
|
|
@@ -40,14 +39,6 @@ class SqliteInMemoryConnector:
|
|
|
40
39
|
return connection
|
|
41
40
|
|
|
42
41
|
|
|
43
|
-
@dataclass(frozen=True)
|
|
44
|
-
class PyMongoConnector:
|
|
45
|
-
dsn: str
|
|
46
|
-
|
|
47
|
-
def connect(self) -> ContextManager[MongoClient[Any]]:
|
|
48
|
-
return MongoClient(self.dsn)
|
|
49
|
-
|
|
50
|
-
|
|
51
42
|
@dataclass(frozen=True)
|
|
52
43
|
class MsSqlConnector:
|
|
53
44
|
db_host: str
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "apexdevkit"
|
|
3
|
-
version = "1.20.
|
|
3
|
+
version = "1.20.6"
|
|
4
4
|
description = "Apex Development Tools for python."
|
|
5
5
|
authors = ["Apex Dev <dev@apex.ge>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -9,7 +9,6 @@ readme = "README.md"
|
|
|
9
9
|
python = "^3.11"
|
|
10
10
|
httpx = "*"
|
|
11
11
|
fastapi = "*"
|
|
12
|
-
pymongo = "*"
|
|
13
12
|
uvicorn = "*"
|
|
14
13
|
sentry-sdk = {extras = ["fastapi"], version = "*"}
|
|
15
14
|
python-dotenv = "*"
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from typing import Any, ContextManager, Generic, Iterator, Mapping, Protocol, TypeVar
|
|
5
|
-
|
|
6
|
-
from pymongo import MongoClient, ReturnDocument
|
|
7
|
-
from pymongo.collection import Collection
|
|
8
|
-
|
|
9
|
-
from apexdevkit.error import DoesNotExistError, ExistsError
|
|
10
|
-
from apexdevkit.formatter import Formatter
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class _Item(Protocol): # pragma: no cover
|
|
14
|
-
@property
|
|
15
|
-
def id(self) -> Any:
|
|
16
|
-
pass
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ItemT = TypeVar("ItemT", bound=_Item)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@dataclass(frozen=True)
|
|
23
|
-
class MongoRepository(Generic[ItemT]):
|
|
24
|
-
connector: MongoConnector
|
|
25
|
-
database_name: str
|
|
26
|
-
collection_name: str
|
|
27
|
-
formatter: Formatter[Mapping[str, Any], ItemT]
|
|
28
|
-
|
|
29
|
-
def collection(self, client: MongoClient[Any]) -> Collection[Any]:
|
|
30
|
-
return client[self.database_name][self.collection_name]
|
|
31
|
-
|
|
32
|
-
def __iter__(self) -> Iterator[ItemT]:
|
|
33
|
-
with self.connector.connect() as client:
|
|
34
|
-
for raw in self.collection(client).find():
|
|
35
|
-
yield self.formatter.load(raw)
|
|
36
|
-
|
|
37
|
-
def __len__(self) -> int:
|
|
38
|
-
with self.connector.connect() as client:
|
|
39
|
-
return self.collection(client).count_documents({})
|
|
40
|
-
|
|
41
|
-
def create(self, item: ItemT) -> ItemT:
|
|
42
|
-
try:
|
|
43
|
-
self.read(item.id)
|
|
44
|
-
raise ExistsError(item).with_duplicate(
|
|
45
|
-
lambda i: f"_Item with id<{i.id}> already exists."
|
|
46
|
-
)
|
|
47
|
-
except DoesNotExistError:
|
|
48
|
-
with self.connector.connect() as client:
|
|
49
|
-
self.collection(client).insert_one(self.formatter.dump(item))
|
|
50
|
-
return item
|
|
51
|
-
|
|
52
|
-
def read(self, item_id: str) -> ItemT:
|
|
53
|
-
with self.connector.connect() as client:
|
|
54
|
-
raw = self.collection(client).find_one({"id": item_id})
|
|
55
|
-
|
|
56
|
-
if not raw:
|
|
57
|
-
raise DoesNotExistError(item_id)
|
|
58
|
-
|
|
59
|
-
return self.formatter.load(dict(raw))
|
|
60
|
-
|
|
61
|
-
def update(self, item: ItemT) -> None:
|
|
62
|
-
with self.connector.connect() as client:
|
|
63
|
-
self.collection(client).find_one_and_update(
|
|
64
|
-
{"id": item.id},
|
|
65
|
-
{"$set": self.formatter.dump(item)},
|
|
66
|
-
return_document=ReturnDocument.AFTER,
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
def delete(self, item_id: str) -> None:
|
|
70
|
-
with self.connector.connect() as client:
|
|
71
|
-
result = self.collection(client).delete_one({"id": item_id})
|
|
72
|
-
|
|
73
|
-
if result.deleted_count == 0:
|
|
74
|
-
raise DoesNotExistError(item_id)
|
|
75
|
-
|
|
76
|
-
def bind(self, **kwargs: Any) -> None:
|
|
77
|
-
pass
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class MongoConnector(Protocol): # pragma: no cover
|
|
81
|
-
def connect(self) -> ContextManager[MongoClient[Any]]:
|
|
82
|
-
pass
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|