{"id":21123,"library":"dependencies","title":"dependencies","description":"A Python library for constructor injection designed with OOP in mind. Current version 7.7.1. It uses a simple decorator-based API to inject dependencies into class constructors, supporting type hints and aliases. Release cadence is irregular.","status":"active","version":"7.7.1","language":"python","source_language":"en","source_url":"https://github.com/proofit404/dependencies","tags":["dependency-injection","ioc","oop","constructor-injection"],"install":[{"cmd":"pip install dependencies","lang":"bash","label":"pip"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"Inject","correct":"from dependencies import Inject"},{"note":"","wrong":"","symbol":"This","correct":"from dependencies import This"},{"note":"","wrong":"","symbol":"value","correct":"from dependencies import value"}],"quickstart":{"code":"from dependencies import Inject, This, value\n\nclass Logger:\n    pass\n\nclass Database:\n    def __init__(self, logger: Logger = This()):\n        self.logger = logger\n\ndef configure(binder):\n    db = Database()\n    binder.bind(Database, value(db))\n    binder.bind(Logger, value(Logger()))\n\ncontainer = Inject(autoload=False)\ncontainer.configure(configure)\ndb = container.instance(Database)\nprint(db.logger.__class__.__name__)  # Logger","lang":"python","description":"Basic dependency injection setup: bind implementations and get instances."},"warnings":[{"fix":"Use `container = Inject(); container.configure(...)` instead of `@Inject`.","message":"Inject must be used as a class instance, not a decorator. Common mistake: decorating with @Inject instead of instantiating and calling configure.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Use `from dependencies import Inject` (class). Code using `@inject` must be rewritten.","message":"In version 6.x, `Inject` was a decorator. In 7.x, it became a class. Import paths changed.","severity":"breaking","affected_versions":"7.0.0 to present"},{"fix":"Always provide type hints for parameters using `This()`.","message":"Using `This()` with non-type-hinted arguments may be deprecated in future versions.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Bind all dependencies with `binder.bind(...)` inside `configure` function.","message":"When using `autoload=False`, you must explicitly configure all dependencies. Common mistake: forgetting to bind a dependency leads to `DependencyError`.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Avoid circular references or use lazy injection with `This(lazy=True)`.","message":"Circular dependencies are not detected automatically and cause recursion errors.","severity":"gotcha","affected_versions":">=7.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add `binder.bind(Logger, value(Logger()))` inside your configure function.","cause":"Missing binding for 'Logger' class.","error":"dependencies.errors.DependencyError: 'Logger' is not registered."},{"fix":"Change `@Inject` to `container = Inject(); container.configure(...)`.","cause":"Using `Inject` as a decorator instead of instantiating.","error":"AttributeError: 'Inject' object has no attribute 'configure'"},{"fix":"Add type hint: `def __init__(self, logger: Logger = This()):`","cause":"Using `This()` without type hint or incorrect usage.","error":"TypeError: __init__() missing 1 required positional argument: 'logger'"},{"fix":"Refactor to break the cycle or use `This(lazy=True)` for one of the dependencies.","cause":"Circular dependency between classes.","error":"RecursionError: maximum recursion depth exceeded"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}