Computerized Python dependency injection to make your code extra testable, decoupled, uncomplicated and readable
Dependency Injection (DI) solves many issues by enhancing testability, decoupling, maintainability and readability. Nevertheless, managing dependencies can typically introduce new issues. When can we initialize them? How can we initialize? Can they be reused successfully?
To be able to take DI to the subsequent stage I’ve created FastInject: a Python package deal that simplifies dependency administration with just some decorators. FastInject robotically handles dependency instantiation and injection to be able to focus in your undertaking. Options:
- improved efficiency: Solely create dependencies when they’re really wanted
- easier initialization: Dependencies are resolved dynamically
- keep away from round imports: Dependency decision is deferred till runtime
- improved flexibility: Dependencies could be influenced by runtime info or configuration
Let’s code!
- DI refresher: A comparability of code that makes use of DI versus code that doesn’t
- Dependency administration with FastInject…