
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Simple and functional dependency injection toolkit for Python.
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)
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!
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]
You have two options available:
Visit PyDio's ReadTheDocs site.
Take a tour around functional tests.
This project is released under the terms of the MIT license.
See LICENSE.txt for more details.
Maciej Wiatrzyk maciej.wiatrzyk@gmail.com
FAQs
Simple and functional dependency injection toolkit for Python
We found that pydio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.