A simple dependency resolution library using container concepts
Project description
Dependency Resolution
How to use
from dependency_resolution import ProviderCache
class Image:
def __init__(self, file: str):
self.file = file
class ImageProcessor:
def __init__(self, image: Image):
self.image = image
def sharpen(self):
pass
def init_image():
instance = ProviderCache.get_instance()
instance += Image("image.png")
# Can also be done like this
# instance[Image] = Image("image.png")
def init_processor():
instance = ProviderCache.get_instance()
instance += ImageProcessor(instance[Image])
def process_image():
instance = ProviderCache.get_instance()
processor = instance[ImageProcessor]
processor.sharpen()
if __name__ == "__main__":
init_image()
init_processor()
process_image()
Future Plans
- Add autowire support
- Add Providers to pass specific arguments to the constructor
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
Built Distribution
Close
Hashes for dependency_resolution-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61917ca547ffc7468dd0176ddccd9529ecf426be5d782ee3d281174171a82742 |
|
MD5 | b89d31cd54033fe00cb0bf19396ec91b |
|
BLAKE2b-256 | 851fd63419d28e05532f1ff0f4b0be1d4a4867d907e37cd9e6c887d40e275e2f |
Close
Hashes for dependency_resolution-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aef32f702bc5b5b6f061cb30a991c1e085f2fc04679627dcc4975afcfb2996c4 |
|
MD5 | b828491bbe0b81b5dfa9e09c7105b2fb |
|
BLAKE2b-256 | cc55e619ce1973d27105e3d69c7ed7571406988f0115706f27a160a8fecfcb59 |