Skip to main content

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

dependency_resolution-0.1.1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

dependency_resolution-0.1.1-py3-none-any.whl (3.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page