This release is a pre-release and may not be stable for production use.
PyDio
A simple and functional dependency injection toolkit for Python.
About
PyDio aims to be simple, yet still powerful, allowing you to feed dependencies inside your application in a flexible way. PyDio design is based on simple assumption, that dependency injection can be achieved using simple key-to-function map, where key specifies type of object you want to inject and function is a factory function that creates instances of that type.
In PyDio, this is implemented using providers and injectors. You use providers to configure your key-to-function mapping, and then you use injectors to perform a lookup of a specific key and creation of the final object.
Here’s a simple example:
import abc
from pydio.api import Provider, Injector
provider = Provider()
@provider.provides('greet')
def make_greet():
return 'Hello, world!'
def main():
injector = Injector(provider)
greet_message = injector.inject('greet')
print(greet_message)
And if you now call main() function, then the output will be following:
Hello, world!
Key features
Support for any hashable keys: class objects, 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 user-defined scopes: global, application, use-case etc.
No singletons used, so there is no global state…
…but you still can create global injector on your own if you need it :-)
Installation
You can install PyDio using one of following methods:
From PyPI (for stable releases):
$ pip install PyDio
From test PyPI (for stable and development releases):
$ pip install -i https://test.pypi.org/simple/ PyDio
Directly from source code repository (for all releases):
$ pip install git+https://gitlab.com/zef1r/PyDio.git@[branch-or-tag]
Documentation
You have two options available:
Visit PyDio’s ReadTheDocs site
Take a tour around functional tests
License
This project is released under the terms of the MIT license.
See LICENSE.txt for more details.
Metadata
Release files for PyDIO 0.1.0rc4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| PyDio-0.1.0rc4.tar.gz | 22.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyDio-0.1.0rc4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.9 kB
Release files / PyDio-0.1.0rc4.tar.gz
| Download URL | PyDio-0.1.0rc4.tar.gz |
|---|---|
| Size | 22.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55f457f9513392a9ea2766d728e3dc2950deccd3a987f1aa15d16898a5155502
|
|
BLAKE2b-256 checksum How to use checksums |
35347f445631b2ec8475775da722b1f000a148a5225ddd2fac96d3c84a7331d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9
|
Release files / PyDio-0.1.0rc4-py3-none-any.whl
| Download URL | PyDio-0.1.0rc4-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3827edb950f2177f231598657468fb61074246825585951c75fbb8dab44ca600
|
|
BLAKE2b-256 checksum How to use checksums |
cf50cd3c775fa403c744877a04b1763aaafcca48272ec50b128774f9ba4d1a08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9
|
Security for PyDIO 0.1.0rc4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.