Skip to main content

Simple Dependency Injection for Python

Project description

picodi

Build Status Codecov PyPI - Version PyPI - Downloads

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

MIT

Credits

This project was generated with yakimka/cookiecutter-pyproject.

Project details


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)

Uploaded Source

Built Distribution

picodi-0.2.0-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page