Simple Dependency Injection for Python
Project description
picodi
Simple Dependency Injection for Python
Experimental dependency injection library for Python. Use it at your own risk.
Installation
pip install picodi
Example
from picodi import inject, Provide
def get_redis() -> str:
yield "redis"
print("closing redis")
@inject
def get_storage_service(redis: str = Provide(get_redis)) -> str:
return f"storage_service({redis})"
assert get_storage_service() == "storage_service(redis)"
License
Credits
This project was generated with yakimka/cookiecutter-pyproject
.
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.
Source Distribution
picodi-0.2.0.tar.gz
(5.5 kB
view hashes)
Built Distribution
picodi-0.2.0-py3-none-any.whl
(5.6 kB
view hashes)