fast-clean 1.4.1__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 +32 -13
- {fast_clean-1.4.1.dist-info → fast_clean-1.4.3.dist-info}/METADATA +1 -1
- {fast_clean-1.4.1.dist-info → fast_clean-1.4.3.dist-info}/RECORD +5 -5
- {fast_clean-1.4.1.dist-info → fast_clean-1.4.3.dist-info}/WHEEL +0 -0
- {fast_clean-1.4.1.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,6 +110,15 @@ class CoreProvider(Provider):
|
|
106
110
|
"""
|
107
111
|
return await settings_repository.get(CoreSettingsSchema)
|
108
112
|
|
113
|
+
@provide(scope=Scope.APP)
|
114
|
+
@staticmethod
|
115
|
+
async def get_cache_settings(settings_repository: SettingsRepositoryProtocol) -> CoreCacheSettingsSchema:
|
116
|
+
"""
|
117
|
+
Получаем настройки кеша.
|
118
|
+
"""
|
119
|
+
return await settings_repository.get(CoreCacheSettingsSchema)
|
120
|
+
|
121
|
+
@provide
|
109
122
|
@staticmethod
|
110
123
|
async def get_broker_repository(settings_repository: SettingsRepositoryProtocol) -> AsyncIterator[KafkaBroker]:
|
111
124
|
"""
|
@@ -114,7 +127,7 @@ class CoreProvider(Provider):
|
|
114
127
|
kafka_settings = await settings_repository.get(CoreKafkaSettingsSchema)
|
115
128
|
yield BrokerFactory.make_static(kafka_settings)
|
116
129
|
|
117
|
-
@provide
|
130
|
+
@provide(scope=Scope.APP)
|
118
131
|
@staticmethod
|
119
132
|
async def get_cache_repository(settings_repository: SettingsRepositoryProtocol) -> CacheRepositoryProtocol:
|
120
133
|
"""
|
@@ -123,7 +136,7 @@ class CoreProvider(Provider):
|
|
123
136
|
cache_settings = await settings_repository.get(CoreCacheSettingsSchema)
|
124
137
|
return CacheManager.init(cache_settings)
|
125
138
|
|
126
|
-
@provide
|
139
|
+
@provide
|
127
140
|
@staticmethod
|
128
141
|
async def get_storage_repository(
|
129
142
|
settings_repository: SettingsRepositoryProtocol,
|
@@ -150,13 +163,19 @@ class CoreProvider(Provider):
|
|
150
163
|
|
151
164
|
# --- db ---
|
152
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
|
+
|
153
173
|
@provide
|
154
174
|
@staticmethod
|
155
|
-
async def get_async_session(
|
175
|
+
async def get_async_session(session_maker: async_sessionmaker[AsyncSession]) -> AsyncIterator[AsyncSession]:
|
156
176
|
"""
|
157
177
|
Получаем асинхронную сессию.
|
158
178
|
"""
|
159
|
-
session_maker = await SessionFactory.make_async_session_dynamic(settings_repository)
|
160
179
|
async with session_maker() as session:
|
161
180
|
yield session
|
162
181
|
|
@@ -170,10 +189,10 @@ class CoreProvider(Provider):
|
|
170
189
|
|
171
190
|
# --- services ---
|
172
191
|
|
173
|
-
seed_service = provide(SeedService)
|
192
|
+
seed_service = provide(SeedService, scope=Scope.APP)
|
174
193
|
transaction_service = provide(TransactionService)
|
175
194
|
|
176
|
-
@provide
|
195
|
+
@provide(scope=Scope.APP)
|
177
196
|
@staticmethod
|
178
197
|
def get_cryptography_service_factory(settings: CoreSettingsSchema) -> CryptographyServiceFactory:
|
179
198
|
"""
|
@@ -191,7 +210,7 @@ class CoreProvider(Provider):
|
|
191
210
|
"""
|
192
211
|
return await cryptography_service_factory.make(CryptographicAlgorithmEnum.AES_GCM)
|
193
212
|
|
194
|
-
@provide
|
213
|
+
@provide(scope=Scope.APP)
|
195
214
|
@staticmethod
|
196
215
|
def get_lock_service(cache_settings: CoreCacheSettingsSchema) -> LockServiceProtocol:
|
197
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
|