fast-clean 1.4.2__py3-none-any.whl → 1.4.4__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.
- fast_clean/depends.py +27 -15
- {fast_clean-1.4.2.dist-info → fast_clean-1.4.4.dist-info}/METADATA +1 -1
- {fast_clean-1.4.2.dist-info → fast_clean-1.4.4.dist-info}/RECORD +5 -5
- {fast_clean-1.4.2.dist-info → fast_clean-1.4.4.dist-info}/WHEEL +0 -0
- {fast_clean-1.4.2.dist-info → fast_clean-1.4.4.dist-info}/top_level.txt +0 -0
fast_clean/depends.py
CHANGED
@@ -10,7 +10,7 @@ from dishka import Provider, Scope, provide
|
|
10
10
|
from fastapi import Depends, Request
|
11
11
|
from faststream.kafka import KafkaBroker
|
12
12
|
from flatten_dict import unflatten
|
13
|
-
from sqlalchemy.ext.asyncio import AsyncSession
|
13
|
+
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
|
14
14
|
from starlette.datastructures import FormData
|
15
15
|
from stringcase import snakecase
|
16
16
|
|
@@ -81,14 +81,18 @@ class CoreProvider(Provider):
|
|
81
81
|
Провайдер зависимостей.
|
82
82
|
"""
|
83
83
|
|
84
|
-
scope = Scope.
|
84
|
+
scope = Scope.REQUEST
|
85
85
|
|
86
86
|
# --- repositories ---
|
87
87
|
|
88
|
-
settings_repository_factory = provide(
|
89
|
-
|
88
|
+
settings_repository_factory = provide(
|
89
|
+
SettingsRepositoryFactoryImpl, provides=SettingsRepositoryFactoryProtocol, scope=Scope.APP
|
90
|
+
)
|
91
|
+
storage_repository_factory = provide(
|
92
|
+
StorageRepositoryFactoryImpl, provides=StorageRepositoryFactoryProtocol, scope=Scope.APP
|
93
|
+
)
|
90
94
|
|
91
|
-
@provide
|
95
|
+
@provide(scope=Scope.APP)
|
92
96
|
@staticmethod
|
93
97
|
async def get_settings_repository(
|
94
98
|
settings_repository_factory: SettingsRepositoryFactoryProtocol,
|
@@ -98,7 +102,7 @@ class CoreProvider(Provider):
|
|
98
102
|
"""
|
99
103
|
return await settings_repository_factory.make(SettingsSourceEnum.ENV)
|
100
104
|
|
101
|
-
@provide
|
105
|
+
@provide(scope=Scope.APP)
|
102
106
|
@staticmethod
|
103
107
|
async def get_settings(settings_repository: SettingsRepositoryProtocol) -> CoreSettingsSchema:
|
104
108
|
"""
|
@@ -106,7 +110,7 @@ class CoreProvider(Provider):
|
|
106
110
|
"""
|
107
111
|
return await settings_repository.get(CoreSettingsSchema)
|
108
112
|
|
109
|
-
@provide
|
113
|
+
@provide(scope=Scope.APP)
|
110
114
|
@staticmethod
|
111
115
|
async def get_cache_settings(settings_repository: SettingsRepositoryProtocol) -> CoreCacheSettingsSchema:
|
112
116
|
"""
|
@@ -114,6 +118,7 @@ class CoreProvider(Provider):
|
|
114
118
|
"""
|
115
119
|
return await settings_repository.get(CoreCacheSettingsSchema)
|
116
120
|
|
121
|
+
@provide
|
117
122
|
@staticmethod
|
118
123
|
async def get_broker_repository(settings_repository: SettingsRepositoryProtocol) -> AsyncIterator[KafkaBroker]:
|
119
124
|
"""
|
@@ -122,7 +127,7 @@ class CoreProvider(Provider):
|
|
122
127
|
kafka_settings = await settings_repository.get(CoreKafkaSettingsSchema)
|
123
128
|
yield BrokerFactory.make_static(kafka_settings)
|
124
129
|
|
125
|
-
@provide
|
130
|
+
@provide(scope=Scope.APP)
|
126
131
|
@staticmethod
|
127
132
|
async def get_cache_repository(settings_repository: SettingsRepositoryProtocol) -> CacheRepositoryProtocol:
|
128
133
|
"""
|
@@ -131,7 +136,7 @@ class CoreProvider(Provider):
|
|
131
136
|
cache_settings = await settings_repository.get(CoreCacheSettingsSchema)
|
132
137
|
return CacheManager.init(cache_settings)
|
133
138
|
|
134
|
-
@provide
|
139
|
+
@provide
|
135
140
|
@staticmethod
|
136
141
|
async def get_storage_repository(
|
137
142
|
settings_repository: SettingsRepositoryProtocol,
|
@@ -154,17 +159,24 @@ class CoreProvider(Provider):
|
|
154
159
|
)
|
155
160
|
async with storage_repository:
|
156
161
|
yield storage_repository
|
157
|
-
|
162
|
+
else:
|
163
|
+
raise NotImplementedError(f'Storage {storage_settings.provider} is not allowed')
|
158
164
|
|
159
165
|
# --- db ---
|
160
166
|
|
167
|
+
@provide(scope=Scope.APP)
|
168
|
+
@staticmethod
|
169
|
+
async def get_async_sessionmaker(
|
170
|
+
settings_repository: SettingsRepositoryProtocol,
|
171
|
+
) -> async_sessionmaker[AsyncSession]:
|
172
|
+
return await SessionFactory.make_async_session_dynamic(settings_repository)
|
173
|
+
|
161
174
|
@provide
|
162
175
|
@staticmethod
|
163
|
-
async def get_async_session(
|
176
|
+
async def get_async_session(session_maker: async_sessionmaker[AsyncSession]) -> AsyncIterator[AsyncSession]:
|
164
177
|
"""
|
165
178
|
Получаем асинхронную сессию.
|
166
179
|
"""
|
167
|
-
session_maker = await SessionFactory.make_async_session_dynamic(settings_repository)
|
168
180
|
async with session_maker() as session:
|
169
181
|
yield session
|
170
182
|
|
@@ -178,10 +190,10 @@ class CoreProvider(Provider):
|
|
178
190
|
|
179
191
|
# --- services ---
|
180
192
|
|
181
|
-
seed_service = provide(SeedService)
|
193
|
+
seed_service = provide(SeedService, scope=Scope.REQUEST)
|
182
194
|
transaction_service = provide(TransactionService)
|
183
195
|
|
184
|
-
@provide
|
196
|
+
@provide(scope=Scope.APP)
|
185
197
|
@staticmethod
|
186
198
|
def get_cryptography_service_factory(settings: CoreSettingsSchema) -> CryptographyServiceFactory:
|
187
199
|
"""
|
@@ -199,7 +211,7 @@ class CoreProvider(Provider):
|
|
199
211
|
"""
|
200
212
|
return await cryptography_service_factory.make(CryptographicAlgorithmEnum.AES_GCM)
|
201
213
|
|
202
|
-
@provide
|
214
|
+
@provide(scope=Scope.APP)
|
203
215
|
@staticmethod
|
204
216
|
def get_lock_service(cache_settings: CoreCacheSettingsSchema) -> LockServiceProtocol:
|
205
217
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fast-clean
|
3
|
-
Version: 1.4.
|
3
|
+
Version: 1.4.4
|
4
4
|
Summary: FastAPI Clean Architecture implementation
|
5
5
|
Author-email: Luferov Victor <luferovvs@yandex.ru>, Orlov Artem <squakrazv@yandex.ru>, Kashapov Rustam <hardtechnik91@gmail.com>
|
6
6
|
Requires-Python: >=3.13
|
@@ -2,7 +2,7 @@ fast_clean/__init__.py,sha256=sT4tb75t5PXws8W_7wpA0jNtNxkWPFLAMrPlDGS7RHw,51
|
|
2
2
|
fast_clean/broker.py,sha256=CHnL4Jd6jF5gKgtUXi33j9QFG2EUM4uqhVqdLuxIrZs,4474
|
3
3
|
fast_clean/container.py,sha256=E1e0H1JqGOacH4uBNwkjTDXYhzN56yZi0AmWXQ3DkEQ,3535
|
4
4
|
fast_clean/db.py,sha256=uZHXXHdLstqhyzGtBL5Z7VvXwIe6mxuPOUheJEzSMyM,5776
|
5
|
-
fast_clean/depends.py,sha256=
|
5
|
+
fast_clean/depends.py,sha256=0gcMT_Ag1GJA3kb_q4yrM3E4MFIUz9rV29ljVqZZMPI,8020
|
6
6
|
fast_clean/enums.py,sha256=lPhC_2_r6YFby7Mq-9u_JSiuyZ0e57F2VxBfUwnBZ18,826
|
7
7
|
fast_clean/exceptions.py,sha256=Sp-k-a5z1Gedu0slzj1-rORnr4GP1FXDHKCKRaJq-7o,9485
|
8
8
|
fast_clean/loggers.py,sha256=hVvZSDMMxYnK-p_yyjd4R7SyHpmxQF3eKQEeMu9Q-jo,705
|
@@ -66,7 +66,7 @@ fast_clean/utils/time.py,sha256=nvavbtG4zR_gkrGSbsqKAsBdePxO3LuTeoISbFZIgn0,307
|
|
66
66
|
fast_clean/utils/toml.py,sha256=NbP7EfgKNYQ18LH8Hc-DmY1gks92bUSBW3D3-tMrY4E,737
|
67
67
|
fast_clean/utils/type_converters.py,sha256=bMEJeoQB9Q6Qok1-ppn4Ii8ZpIkZwJbD2IzCydSStHw,523
|
68
68
|
fast_clean/utils/typer.py,sha256=1O7BsNGn68bBzNbj0-Ycfhv35WpLzwvYTKn510YNXQQ,663
|
69
|
-
fast_clean-1.4.
|
70
|
-
fast_clean-1.4.
|
71
|
-
fast_clean-1.4.
|
72
|
-
fast_clean-1.4.
|
69
|
+
fast_clean-1.4.4.dist-info/METADATA,sha256=2CqHlg85rKSSKHR05cMKIJYyKXfZHZ5jafoCqd-7E1g,1200
|
70
|
+
fast_clean-1.4.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
71
|
+
fast_clean-1.4.4.dist-info/top_level.txt,sha256=QfsGs-QLmPCZWWPFOukD0zhMnokH68FoO2KeObl6ZIA,11
|
72
|
+
fast_clean-1.4.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|