apexdevkit 1.14.4__tar.gz → 1.15.1__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.14.4 → apexdevkit-1.15.1}/PKG-INFO +4 -1
- apexdevkit-1.15.1/apexdevkit/server.py +116 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/pyproject.toml +5 -1
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/LICENSE +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/README.md +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/__init__.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/annotation/__init__.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/annotation/deprecate.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/environment.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/error.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/__init__.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/builder.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/dependable.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/docs.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/resource.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/response.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/router.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/schema.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fastapi/service.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/fluent.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/formatter.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/http/__init__.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/http/fake.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/http/fluent.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/http/httpx.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/http/json.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/http/url.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/key_fn.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/py.typed +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/__init__.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/base.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/connector.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/database.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/decorator.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/in_memory.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/interface.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/mongo.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/repository/sqlite.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/synchronization.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/testing/__init__.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/testing/database.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/testing/fake.py +0 -0
- {apexdevkit-1.14.4 → apexdevkit-1.15.1}/apexdevkit/testing/rest.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apexdevkit
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.15.1
|
|
4
4
|
Summary: Apex Development Tools for python.
|
|
5
5
|
Author: Apex Dev
|
|
6
6
|
Author-email: dev@apex.ge
|
|
@@ -12,6 +12,9 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
12
12
|
Requires-Dist: fastapi
|
|
13
13
|
Requires-Dist: httpx
|
|
14
14
|
Requires-Dist: pymongo
|
|
15
|
+
Requires-Dist: python-dotenv
|
|
16
|
+
Requires-Dist: sentry-sdk[fastapi]
|
|
17
|
+
Requires-Dist: uvicorn
|
|
15
18
|
Description-Content-Type: text/markdown
|
|
16
19
|
|
|
17
20
|
# apexdevkit
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging.config
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import sentry_sdk
|
|
8
|
+
import uvicorn
|
|
9
|
+
from dotenv import load_dotenv
|
|
10
|
+
from fastapi import FastAPI
|
|
11
|
+
|
|
12
|
+
from apexdevkit.environment import environment_variable
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class UvicornServer:
|
|
17
|
+
logging_config: dict[str, Any]
|
|
18
|
+
|
|
19
|
+
host: str = "0.0.0.0"
|
|
20
|
+
port: int = 8000
|
|
21
|
+
path: str = ""
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def from_env(cls) -> UvicornServer:
|
|
25
|
+
load_dotenv()
|
|
26
|
+
Sentry().setup()
|
|
27
|
+
|
|
28
|
+
return cls(LoggingConfig().setup().as_dict())
|
|
29
|
+
|
|
30
|
+
def with_host(self, value: str) -> UvicornServer:
|
|
31
|
+
self.host = value
|
|
32
|
+
|
|
33
|
+
return self
|
|
34
|
+
|
|
35
|
+
def and_port(self, value: int | str) -> UvicornServer:
|
|
36
|
+
self.port = int(value)
|
|
37
|
+
|
|
38
|
+
return self
|
|
39
|
+
|
|
40
|
+
def on_path(self, value: str) -> UvicornServer:
|
|
41
|
+
self.path = value
|
|
42
|
+
|
|
43
|
+
return self
|
|
44
|
+
|
|
45
|
+
def run(self, api: FastAPI) -> None:
|
|
46
|
+
uvicorn.run(
|
|
47
|
+
api,
|
|
48
|
+
host=self.host,
|
|
49
|
+
port=self.port,
|
|
50
|
+
root_path=self.path,
|
|
51
|
+
log_config=self.logging_config,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class Sentry:
|
|
57
|
+
dsn: str = environment_variable("SENTRY_DSN", default="")
|
|
58
|
+
release: str = environment_variable("RELEASE", default="unknown")
|
|
59
|
+
|
|
60
|
+
def setup(self) -> None:
|
|
61
|
+
if not self.dsn:
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
sentry_sdk.init(
|
|
65
|
+
release=self.release,
|
|
66
|
+
traces_sample_rate=1.0,
|
|
67
|
+
profiles_sample_rate=1.0,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class LoggingConfig:
|
|
73
|
+
level: str = environment_variable("LOGGING_LEVEL", default=str(logging.INFO))
|
|
74
|
+
|
|
75
|
+
def setup(self) -> LoggingConfig:
|
|
76
|
+
logging.config.dictConfig(self.as_dict())
|
|
77
|
+
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def as_dict(self) -> dict[str, Any]:
|
|
81
|
+
return {
|
|
82
|
+
"version": 1,
|
|
83
|
+
"disable_existing_loggers": True,
|
|
84
|
+
"formatters": {
|
|
85
|
+
"standard": {
|
|
86
|
+
"format": "%(asctime)s [%(levelname)s] %(name)s: %(message)s",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
"handlers": {
|
|
90
|
+
"console": {
|
|
91
|
+
"class": "logging.StreamHandler",
|
|
92
|
+
"formatter": "standard",
|
|
93
|
+
"level": int(self.level),
|
|
94
|
+
},
|
|
95
|
+
"file": {
|
|
96
|
+
"class": "logging.handlers.RotatingFileHandler",
|
|
97
|
+
"formatter": "standard",
|
|
98
|
+
"level": int(self.level),
|
|
99
|
+
"filename": "app.log",
|
|
100
|
+
"maxBytes": 1024 * 1024,
|
|
101
|
+
"backupCount": 10,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
"loggers": {
|
|
105
|
+
"": {
|
|
106
|
+
"handlers": ["console", "file"],
|
|
107
|
+
"level": int(self.level),
|
|
108
|
+
"propagate": False,
|
|
109
|
+
},
|
|
110
|
+
"uvicorn": {
|
|
111
|
+
"handlers": ["console", "file"],
|
|
112
|
+
"level": int(self.level),
|
|
113
|
+
"propagate": False,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "apexdevkit"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.15.1"
|
|
4
4
|
description = "Apex Development Tools for python."
|
|
5
5
|
authors = ["Apex Dev <dev@apex.ge>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -10,6 +10,9 @@ python = "^3.11"
|
|
|
10
10
|
httpx = "*"
|
|
11
11
|
fastapi = "*"
|
|
12
12
|
pymongo = "*"
|
|
13
|
+
uvicorn = "*"
|
|
14
|
+
sentry-sdk = {extras = ["fastapi"], version = "*"}
|
|
15
|
+
python-dotenv = "*"
|
|
13
16
|
|
|
14
17
|
[tool.poetry.group.dev.dependencies]
|
|
15
18
|
pytest = "*"
|
|
@@ -30,6 +33,7 @@ strict = true
|
|
|
30
33
|
exclude = [
|
|
31
34
|
"apexdevkit/fastapi/schema.py",
|
|
32
35
|
"apexdevkit/fastapi/dependable.py",
|
|
36
|
+
"apexdevkit/server.py",
|
|
33
37
|
]
|
|
34
38
|
|
|
35
39
|
[tool.ruff]
|
|
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
|