Skip to main content

A simple and functional dependency injection toolkit for Python

Project description

https://img.shields.io/pypi/v/PyDio:alt:PyPI https://img.shields.io/pypi/l/PyDio:alt:PyPI-License https://img.shields.io/pypi/dm/PyDio:alt:PyPI-Downloads https://codecov.io/gl/zef1r/pydio/branch/master/graph/badge.svg?token=6EVGTI0KZ0

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:

  1. From PyPI (only official releases):

    $ pip install PyDio
  2. From test PyPI (official + development releases):

    $ pip install -i https://test.pypi.org/simple/ PyDio
  3. 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.

Author

Maciej Wiatrzyk <maciej.wiatrzyk@gmail.com>

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

PyDio-0.1.0rc3.tar.gz (19.1 kB view hashes)

Uploaded Source

Built Distribution

PyDio-0.1.0rc3-py3-none-any.whl (10.7 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