fast-clean 1.4.0__tar.gz → 1.4.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.
Files changed (81) hide show
  1. {fast_clean-1.4.0 → fast_clean-1.4.1}/PKG-INFO +1 -1
  2. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/depends.py +4 -14
  3. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/cache/__init__.py +10 -4
  4. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/cache/redis.py +0 -1
  5. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/services/lock.py +2 -1
  6. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/settings.py +6 -1
  7. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean.egg-info/PKG-INFO +1 -1
  8. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean.egg-info/SOURCES.txt +0 -1
  9. {fast_clean-1.4.0 → fast_clean-1.4.1}/pyproject.toml +1 -1
  10. fast_clean-1.4.0/fast_clean/redis.py +0 -23
  11. {fast_clean-1.4.0 → fast_clean-1.4.1}/README.md +0 -0
  12. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/__init__.py +0 -0
  13. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/broker.py +0 -0
  14. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/cli/__init__.py +0 -0
  15. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/cli/cryptography.py +0 -0
  16. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/cli/load_seed.py +0 -0
  17. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/container.py +0 -0
  18. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/__init__.py +0 -0
  19. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/healthcheck/__init__.py +0 -0
  20. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/healthcheck/router.py +0 -0
  21. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/healthcheck/schemas.py +0 -0
  22. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/logging/__init__.py +0 -0
  23. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/logging/enums.py +0 -0
  24. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/logging/sentry.py +0 -0
  25. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/monitoring/__init__.py +0 -0
  26. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/monitoring/middleware.py +0 -0
  27. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/monitoring/router.py +0 -0
  28. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/sqlalchemy_utils/__init__.py +0 -0
  29. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/contrib/sqlalchemy_utils/utils.py +0 -0
  30. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/db.py +0 -0
  31. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/enums.py +0 -0
  32. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/exceptions.py +0 -0
  33. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/loggers.py +0 -0
  34. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/middleware.py +0 -0
  35. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/models.py +0 -0
  36. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/py.typed +0 -0
  37. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/__init__.py +0 -0
  38. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/cache/in_memory.py +0 -0
  39. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/crud/__init__.py +0 -0
  40. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/crud/db.py +0 -0
  41. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/crud/in_memory.py +0 -0
  42. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/crud/type_vars.py +0 -0
  43. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/settings/__init__.py +0 -0
  44. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/settings/enums.py +0 -0
  45. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/settings/env.py +0 -0
  46. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/settings/exceptions.py +0 -0
  47. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/settings/type_vars.py +0 -0
  48. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/storage/__init__.py +0 -0
  49. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/storage/enums.py +0 -0
  50. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/storage/local.py +0 -0
  51. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/storage/reader.py +0 -0
  52. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/storage/s3.py +0 -0
  53. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/repositories/storage/schemas.py +0 -0
  54. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/schemas/__init__.py +0 -0
  55. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/schemas/exceptions.py +0 -0
  56. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/schemas/pagination.py +0 -0
  57. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/schemas/repository.py +0 -0
  58. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/schemas/request_response.py +0 -0
  59. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/services/__init__.py +0 -0
  60. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/services/cryptography/__init__.py +0 -0
  61. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/services/cryptography/aes.py +0 -0
  62. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/services/cryptography/enums.py +0 -0
  63. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/services/seed.py +0 -0
  64. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/services/transaction.py +0 -0
  65. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/__init__.py +0 -0
  66. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/process.py +0 -0
  67. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/pydantic.py +0 -0
  68. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/ssl_context.py +0 -0
  69. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/string.py +0 -0
  70. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/thread.py +0 -0
  71. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/time.py +0 -0
  72. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/toml.py +0 -0
  73. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/type_converters.py +0 -0
  74. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean/utils/typer.py +0 -0
  75. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean.egg-info/dependency_links.txt +0 -0
  76. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean.egg-info/requires.txt +0 -0
  77. {fast_clean-1.4.0 → fast_clean-1.4.1}/fast_clean.egg-info/top_level.txt +0 -0
  78. {fast_clean-1.4.0 → fast_clean-1.4.1}/setup.cfg +0 -0
  79. {fast_clean-1.4.0 → fast_clean-1.4.1}/tests/test_broker.py +0 -0
  80. {fast_clean-1.4.0 → fast_clean-1.4.1}/tests/test_db.py +0 -0
  81. {fast_clean-1.4.0 → fast_clean-1.4.1}/tests/test_exceptions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-clean
3
- Version: 1.4.0
3
+ Version: 1.4.1
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
@@ -16,7 +16,6 @@ from stringcase import snakecase
16
16
 
17
17
  from .broker import BrokerFactory
18
18
  from .db import SessionFactory, SessionManagerImpl, SessionManagerProtocol
19
- from .redis import RedisManager
20
19
  from .repositories import (
21
20
  CacheManager,
22
21
  CacheRepositoryProtocol,
@@ -121,15 +120,8 @@ class CoreProvider(Provider):
121
120
  """
122
121
  Получаем репозиторий кеша.
123
122
  """
124
- settings = await settings_repository.get(CoreSettingsSchema)
125
- if settings.redis_dsn is not None:
126
- RedisManager.init(settings.redis_dsn)
127
123
  cache_settings = await settings_repository.get(CoreCacheSettingsSchema)
128
- if CacheManager.cache_repository is None:
129
- CacheManager.init(cache_settings, RedisManager.redis)
130
- if CacheManager.cache_repository is not None:
131
- return CacheManager.cache_repository
132
- raise ValueError('Cache is not initialized')
124
+ return CacheManager.init(cache_settings)
133
125
 
134
126
  @provide(scope=Scope.REQUEST)
135
127
  @staticmethod
@@ -201,14 +193,12 @@ class CoreProvider(Provider):
201
193
 
202
194
  @provide
203
195
  @staticmethod
204
- def get_lock_service(settings: CoreSettingsSchema) -> LockServiceProtocol:
196
+ def get_lock_service(cache_settings: CoreCacheSettingsSchema) -> LockServiceProtocol:
205
197
  """
206
198
  Получаем сервис распределенной блокировки.
207
199
  """
208
- assert settings.redis_dsn is not None
209
- RedisManager.init(settings.redis_dsn)
210
- assert RedisManager.redis is not None
211
- return RedisLockService(RedisManager.redis)
200
+ redis_client = CacheManager.init(cache_settings)
201
+ return RedisLockService(redis_client) # type: ignore
212
202
 
213
203
 
214
204
  provider = CoreProvider()
@@ -9,9 +9,9 @@
9
9
  from typing import ClassVar, Protocol, Self, cast
10
10
 
11
11
  from fastapi_cache import FastAPICache
12
+ from redis import asyncio as aioredis
12
13
 
13
14
  from fast_clean.settings import CoreCacheSettingsSchema
14
- from redis import asyncio as aioredis
15
15
 
16
16
  from .in_memory import InMemoryCacheRepository as InMemoryCacheRepository
17
17
  from .redis import RedisCacheRepository as RedisCacheRepository
@@ -67,7 +67,7 @@ class CacheManager:
67
67
  cache_repository: ClassVar[CacheRepositoryProtocol | None] = None
68
68
 
69
69
  @classmethod
70
- def init(cls, cache_settings: CoreCacheSettingsSchema, redis: aioredis.Redis | None) -> None:
70
+ def init(cls, cache_settings: CoreCacheSettingsSchema):
71
71
  """
72
72
  Инициализируем кеш.
73
73
  """
@@ -77,7 +77,13 @@ class CacheManager:
77
77
  case 'in_memory':
78
78
  cache_backend = InMemoryCacheRepository()
79
79
  case 'redis':
80
- assert redis is not None
81
- cache_backend = RedisCacheRepository(redis)
80
+ if not cache_settings.redis:
81
+ raise ValueError('Redis not configured in settings')
82
+ cache_backend = RedisCacheRepository(
83
+ aioredis.from_url(url=str(cache_settings.redis.dsn), decode_responses=True) # type: ignore
84
+ )
85
+ case _:
86
+ raise ValueError('Cache is not initialized')
82
87
  FastAPICache.init(cache_backend, prefix=cache_settings.prefix)
83
88
  cls.cache_repository = cast(CacheRepositoryProtocol, cache_backend)
89
+ return cls.cache_repository
@@ -6,7 +6,6 @@ from typing import Self
6
6
 
7
7
  from fastapi_cache.backends.redis import RedisBackend
8
8
  from overrides import override
9
-
10
9
  from redis.asyncio.client import Redis
11
10
 
12
11
 
@@ -6,10 +6,11 @@ from collections.abc import AsyncIterator
6
6
  from contextlib import asynccontextmanager
7
7
  from typing import AsyncContextManager, Protocol
8
8
 
9
- from fast_clean.exceptions import LockError
10
9
  from redis import asyncio as aioredis
11
10
  from redis.exceptions import LockError as AIORedisLockError
12
11
 
12
+ from fast_clean.exceptions import LockError
13
+
13
14
 
14
15
  class LockServiceProtocol(Protocol):
15
16
  """
@@ -39,6 +39,10 @@ class CoreDbSettingsSchema(BaseModel):
39
39
  return f'{self.provider}://{self.user}:{self.password}@{self.host}:{self.port}/{self.name}'
40
40
 
41
41
 
42
+ class CoreRedisSettingsSchema(BaseModel):
43
+ dsn: RedisDsn
44
+
45
+
42
46
  class CoreCacheSettingsSchema(BaseModel):
43
47
  """
44
48
  Схема настроек кеша.
@@ -48,6 +52,8 @@ class CoreCacheSettingsSchema(BaseModel):
48
52
 
49
53
  prefix: str
50
54
 
55
+ redis: CoreRedisSettingsSchema | None = None
56
+
51
57
 
52
58
  class CoreS3SettingsSchema(BaseModel):
53
59
  """
@@ -178,7 +184,6 @@ class CoreSettingsSchema(BaseSettingsSchema):
178
184
  base_dir: Path = Path(os.getcwd())
179
185
  secret_key: str
180
186
  cors_origins: Annotated[list[str], Field(default_factory=list)]
181
- redis_dsn: RedisDsn | None = None
182
187
  sentry_dsn: str | None = None
183
188
 
184
189
  model_config = SettingsConfigDict(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-clean
3
- Version: 1.4.0
3
+ Version: 1.4.1
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
@@ -11,7 +11,6 @@ fast_clean/loggers.py
11
11
  fast_clean/middleware.py
12
12
  fast_clean/models.py
13
13
  fast_clean/py.typed
14
- fast_clean/redis.py
15
14
  fast_clean/settings.py
16
15
  fast_clean.egg-info/PKG-INFO
17
16
  fast_clean.egg-info/SOURCES.txt
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fast-clean"
3
- version = "1.4.0"
3
+ version = "1.4.1"
4
4
  description = "FastAPI Clean Architecture implementation"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -1,23 +0,0 @@
1
- """
2
- Модуль, содержащий функционал, связанный с Redis.
3
- """
4
-
5
- from pydantic import RedisDsn
6
-
7
- from redis import asyncio as aioredis
8
-
9
-
10
- class RedisManager:
11
- """
12
- Менеджер для управления клиентом Redis.
13
- """
14
-
15
- redis: aioredis.Redis | None = None
16
-
17
- @classmethod
18
- def init(cls, redis_dsn: RedisDsn) -> None:
19
- """
20
- Инициализируем клиент Redis.
21
- """
22
- if cls.redis is None:
23
- cls.redis = aioredis.from_url(url=str(redis_dsn), decode_responses=True)
File without changes
File without changes
File without changes
File without changes