nlbone 0.6.12__py3-none-any.whl → 0.6.13__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.
nlbone/container.py CHANGED
@@ -1,8 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any, Mapping, Optional
3
+ from typing import Dict, Optional
4
4
 
5
5
  from dependency_injector import containers, providers
6
+ from pydantic_settings import BaseSettings
6
7
 
7
8
  from nlbone.adapters.auth.keycloak import KeycloakAuthService
8
9
  from nlbone.adapters.auth.token_provider import ClientTokenProvider
@@ -15,7 +16,6 @@ from nlbone.adapters.http_clients import PricingService
15
16
  from nlbone.adapters.http_clients.uploadchi import UploadchiClient
16
17
  from nlbone.adapters.http_clients.uploadchi.uploadchi_async import UploadchiAsyncClient
17
18
  from nlbone.adapters.messaging import InMemoryEventBus
18
- from nlbone.config.settings import Settings
19
19
  from nlbone.core.ports import EventBusPort
20
20
  from nlbone.core.ports.cache import AsyncCachePort, CachePort
21
21
  from nlbone.core.ports.files import AsyncFileServicePort, FileServicePort
@@ -35,7 +35,7 @@ class Container(containers.DeclarativeContainer):
35
35
  event_bus: providers.Singleton[EventBusPort] = providers.Singleton(InMemoryEventBus)
36
36
 
37
37
  # --- Services ---
38
- auth: providers.Singleton[KeycloakAuthService] = providers.Singleton(KeycloakAuthService, settings=config)
38
+ auth: providers.Singleton[KeycloakAuthService] = providers.Singleton(KeycloakAuthService)
39
39
  token_provider = providers.Singleton(ClientTokenProvider, auth=auth, skew_seconds=30)
40
40
  file_service: providers.Singleton[FileServicePort] = providers.Singleton(
41
41
  UploadchiClient, token_provider=token_provider
@@ -60,15 +60,11 @@ class Container(containers.DeclarativeContainer):
60
60
  )
61
61
 
62
62
 
63
- def create_container(settings: Optional[Any] = None) -> Container:
63
+ def create_container(settings: Optional[BaseSettings | Dict] = None) -> Container:
64
64
  c = Container()
65
65
  if settings is not None:
66
- if isinstance(settings, Settings):
67
- c.config.override(settings)
68
- elif hasattr(settings, "model_dump"):
69
- c.config.from_dict(settings.model_dump()) # Pydantic v2
70
- elif hasattr(settings, "dict"):
71
- c.config.from_dict(settings.dict()) # Pydantic v1
72
- elif isinstance(settings, Mapping):
73
- c.config.from_dict(dict(settings))
66
+ if isinstance(settings, BaseSettings):
67
+ c.config.from_pydantic(settings)
68
+ elif isinstance(settings, Dict):
69
+ c.config.from_dict(settings)
74
70
  return c
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nlbone
3
- Version: 0.6.12
3
+ Version: 0.6.13
4
4
  Summary: Backbone package for interfaces and infrastructure in Python projects
5
5
  Author-email: Amir Hosein Kahkbazzadeh <a.khakbazzadeh@gmail.com>
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  nlbone/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- nlbone/container.py,sha256=VPGkfQO0HS4SbQy2ja3HVKyuMjD94p5ZmDPSqYHGhNo,3317
2
+ nlbone/container.py,sha256=rVYzH-jIM8iCcefDOo29mNjvFdf3nJ4EtPNUws9SDnA,3089
3
3
  nlbone/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  nlbone/adapters/__init__.py,sha256=NzUmk4XPyp3GJOw7VSE86xkQMZLtG3MrOoXLeoB551M,41
5
5
  nlbone/adapters/auth/__init__.py,sha256=hkDHvsFhw_UiOHG9ZSMqjiAhK4wumEforitveSZswVw,42
@@ -84,8 +84,8 @@ nlbone/utils/context.py,sha256=MmclJ24BG2uvSTg1IK7J-Da9BhVFDQ5ag4Ggs2FF1_w,1600
84
84
  nlbone/utils/http.py,sha256=UXUoXgQdTRNT08ho8zl-C5ekfDsD8uf-JiMQ323ooqw,872
85
85
  nlbone/utils/redactor.py,sha256=-V4HrHmHwPi3Kez587Ek1uJlgK35qGSrwBOvcbw8Jas,1279
86
86
  nlbone/utils/time.py,sha256=DjjyQ9GLsfXoT6NK8RDW2rOlJg3e6sF04Jw6PBUrSvg,1268
87
- nlbone-0.6.12.dist-info/METADATA,sha256=l0a2XnCXdUv6VvOv_p880moTJFSwVLzLCC6L8NtapMg,2228
88
- nlbone-0.6.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
89
- nlbone-0.6.12.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
90
- nlbone-0.6.12.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
- nlbone-0.6.12.dist-info/RECORD,,
87
+ nlbone-0.6.13.dist-info/METADATA,sha256=Q34YJD_7dJxWCLX_t_Ihh-JY8jDahy_mkSCpP7vMM9Y,2228
88
+ nlbone-0.6.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
89
+ nlbone-0.6.13.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
90
+ nlbone-0.6.13.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
+ nlbone-0.6.13.dist-info/RECORD,,