An easy to use lightweight dependency injection framework
Smart-injector is an lightweight dependency injection framework for Python. It was designed to be an easy to use tool to implement dependency injection in your application in a pythonic way.
Key features are: - Ligtweight - pure python - leverages type annotations - scopes - non invasive
pip install smart-injector
You can also install the in-development version with:
pip install https://github.com/hlevering/python-smart-injector/archive/master.zip
>>> class A: ... pass ... >>> class B: ... def __init__(self, a: A): ... self.a = a ... >>> container = create_container(StaticContainer) >>> b = container.get(B) >>> isinstance(b.a, A) True
Detailed documentation can be found here:
Further usage examples can be found here: https://python-smart-injector.readthedocs.io/en/latest/usage.html
To run the all tests run:
Note, to combine the coverage data from all the tox environments run:
set PYTEST_ADDOPTS=--cov-append tox
- First release on PyPI.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size smart_injector-0.0.5-py2.py3-none-any.whl (22.5 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View hashes|
Hashes for smart_injector-0.0.5-py2.py3-none-any.whl