A simple and functional dependency injection toolkit for Python
Project description
PyDio
A simple and functional dependency injection toolkit for Python.
About
Dependency injection in Python is basically map lookup; you need a key that will point you to either an object to be injected or an object factory to be used to create object to be injected.
PyDio is designed to follow that simple assumption: it uses providers that are sort of key-to-factory maps, and injectors that are used by application to search for a factory to use.
Key features:
Support for any hashable keys: classes, strings, ints etc.
Support for any type of object factories: function, coroutine, generator, asynchronous generator.
Automatic resource management via generator-based factories (similar to pytest’s fixtures)
Multiple environment support: testing, development, production etc.
Limiting created object’s lifetime to custom-defined scopes: global, application, use-case etc.
No singletons used == no global state.
Installation
You can install PyDio using one of following methods:
From PyPI (only official releases):
$ pip install PyDio
From test PyPI (official + development releases):
$ pip install -i https://test.pypi.org/simple/ PyDio
Directly from source code repository (for not yet released versions):
$ pip install git+https://gitlab.com/zef1r/PyDio.git@[branch-or-tag]
Quickstart
TBD
In the meantime, you can read functional tests: https://gitlab.com/zef1r/pydio/-/tree/master/tests/functional
License
This project is released under the terms of the MIT license.
See LICENSE.txt for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.