Dependency Injection over Dynaconf
Project description
Dypendence
Dependency Injection over Dynaconf
Usage example
Example settings.toml
[DY.FileStorageService]
Type = "S3FileStorage"
[DY.FileStorageService.LocalFileStorage]
some_value = "This is Local File Storage"
[DY.FileStorageService.S3FileStorage]
some_value = "This is S3 File Storage"
Example application code:
from dypendence import DY
class FileStorageService(DY):
def save_file(self) -> str:
raise NotImplementedError
def get_value_from_settings(self):
return self.settings.some_value
class LocalFileStorage(FileStorageService):
def save_file(self) -> str:
return 'Saved file to local file system'
class S3FileStorage(FileStorageService):
def save_file(self) -> str:
return 'Saved file to S3-like storage'
if __name__ == '__main__':
file_storage = FileStorageService(settings_files=['settings.toml'])
assert isinstance(file_storage, S3FileStorage)
assert file_storage.save_file() == 'Saved file to S3-like storage'
assert file_storage.get_value_from_settings() == 'This is S3 File Storage'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dypendence-0.1.6.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file dypendence-0.1.6.tar.gz
.
File metadata
- Download URL: dypendence-0.1.6.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.2 CPython/3.8.6 Linux/5.4.0-1026-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5e19c03ba84a733701417a2d2c2408697d658973d3234b35ec5fcf1a7a628a4 |
|
MD5 | d004410c7353001f019874186d1020c9 |
|
BLAKE2b-256 | 3d96b91e6bf7da1ae1f7edee1185db01b3ec68d574c03a4b3443a734802fc29b |
File details
Details for the file dypendence-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: dypendence-0.1.6-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.2 CPython/3.8.6 Linux/5.4.0-1026-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 577178fd56346d660201fa2d0d30a906f5a53dde891d75d5b869961875550f95 |
|
MD5 | 2a7393a0f750d0b96de3857e1aa793ec |
|
BLAKE2b-256 | 75ee6f6ea3e1205d853a6c843e40c792e673005ac810f5024458cf9a24ce72f5 |