Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.5.2 instead.
Reason given by maintainers: Error in uv config resulting in empty wheel package

PyPI PyPI - Python Version PyPI - License PyPI - Downloads codecov

PyDIO

Lightweight and functional dependency injection library for Python.

Name

PyDIO (stylized as PyDIO, installable as pydio, pronounced "pie-dee-o") stands for Python dependency injection library.

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 a straightforward key-to-function mapping, 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)

if __name__ == '__main__':
    main()

Now you can save the snippet from above as example.py file and execute to see the output:

$ python example.py
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:

  1. From PyPI (for stable releases):

    $ pip install PyDIO
    
  2. From test PyPI (for stable and development releases):

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

  1. Visit PyDIO's ReadTheDocs site.

  2. Take a tour around functional tests.

Disclaimer

PyDIO is an independent open-source project in the Python ecosystem. It is not affiliated with, sponsored by, or endorsed by any company, organization, or product of the same or similar name. Any similarity in names is purely coincidental and does not imply any association.

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

Metadata

Release files for PyDIO 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyDIO 0.5.0
File Size Uploaded Provenance
pydio-0.5.0.tar.gz 151.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for PyDIO 0.5.0
File Interpreter ABI Platform
pydio-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 155.0 kB

Release files / pydio-0.5.0.tar.gz

Download URL pydio-0.5.0.tar.gz
Size 151.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1e53133488ef141645f4128ed0b7b8b3bff48e4a93e2a41844e0d8e45d6e50c6
BLAKE2b-256 checksum
How to use checksums
a8eca30ed484f1ebe667657c34ca357564e527c60ed3ed22eff9e423415105c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Release files / pydio-0.5.0-py3-none-any.whl

Download URL pydio-0.5.0-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e00b5dd60228e1423c5a33e4982733284bcbbae9182853b2ac45ad4abb7c3e98
BLAKE2b-256 checksum
How to use checksums
d047255b422e5dc55e98d98bec49f120780b6d30a3e3b14509fc5369ec3dff39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Security for PyDIO 0.5.0

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.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page