Computerized Python dependency injection to make your code extra testable, decoupled, uncomplicated and readable
Dependency Injection (DI) solves many issues by bettering testability, decoupling, maintainability and readability. Nonetheless, managing dependencies can generally introduce new issues. When will we initialize them? How will we initialize? Can they be reused successfully?
With the intention 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 so to focus in your mission. Options:
- improved efficiency: Solely create dependencies when they’re truly wanted
- less complicated 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…