fast-clean 1.4.2__py3-none-any.whl → 1.4.3__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 +25 -14
- {fast_clean-1.4.2.dist-info → fast_clean-1.4.3.dist-info}/METADATA +1 -1
- {fast_clean-1.4.2.dist-info → fast_clean-1.4.3.dist-info}/RECORD +5 -5
- {fast_clean-1.4.2.dist-info → fast_clean-1.4.3.dist-info}/WHEEL +0 -0
- {fast_clean-1.4.2.dist-info → fast_clean-1.4.3.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,
|
@@ -158,13 +163,19 @@ class CoreProvider(Provider):
|
|
158
163
|
|
159
164
|
# --- db ---
|
160
165
|
|
166
|
+
@provide(scope=Scope.APP)
|
167
|
+
@staticmethod
|
168
|
+
async def get_async_sessionmaker(
|
169
|
+
settings_repository: SettingsRepositoryProtocol,
|
170
|
+
) -> async_sessionmaker[AsyncSession]:
|
171
|
+
return await SessionFactory.make_async_session_dynamic(settings_repository)
|
172
|
+
|
161
173
|
@provide
|
162
174
|
@staticmethod
|
163
|
-
async def get_async_session(
|
175
|
+
async def get_async_session(session_maker: async_sessionmaker[AsyncSession]) -> AsyncIterator[AsyncSession]:
|
164
176
|
"""
|
165
177
|
Получаем асинхронную сессию.
|
166
178
|
"""
|
167
|
-
session_maker = await SessionFactory.make_async_session_dynamic(settings_repository)
|
168
179
|
async with session_maker() as session:
|
169
180
|
yield session
|
170
181
|
|
@@ -178,10 +189,10 @@ class CoreProvider(Provider):
|
|
178
189
|
|
179
190
|
# --- services ---
|
180
191
|
|
181
|
-
seed_service = provide(SeedService)
|
192
|
+
seed_service = provide(SeedService, scope=Scope.APP)
|
182
193
|
transaction_service = provide(TransactionService)
|
183
194
|
|
184
|
-
@provide
|
195
|
+
@provide(scope=Scope.APP)
|
185
196
|
@staticmethod
|
186
197
|
def get_cryptography_service_factory(settings: CoreSettingsSchema) -> CryptographyServiceFactory:
|
187
198
|
"""
|
@@ -199,7 +210,7 @@ class CoreProvider(Provider):
|
|
199
210
|
"""
|
200
211
|
return await cryptography_service_factory.make(CryptographicAlgorithmEnum.AES_GCM)
|
201
212
|
|
202
|
-
@provide
|
213
|
+
@provide(scope=Scope.APP)
|
203
214
|
@staticmethod
|
204
215
|
def get_lock_service(cache_settings: CoreCacheSettingsSchema) -> LockServiceProtocol:
|
205
216
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fast-clean
|
3
|
-
Version: 1.4.
|
3
|
+
Version: 1.4.3
|
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=kFjBX1hxAVIK4JYFlNOb46IUKGgDT-SoTHpn83ST-jc,7995
|
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.3.dist-info/METADATA,sha256=u8zRYcBTysNj21otVbpMVVBADPdxNG5ZUxVIZrSEfHM,1200
|
70
|
+
fast_clean-1.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
71
|
+
fast_clean-1.4.3.dist-info/top_level.txt,sha256=QfsGs-QLmPCZWWPFOukD0zhMnokH68FoO2KeObl6ZIA,11
|
72
|
+
fast_clean-1.4.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|