PyxDI
PyxDI is a modern, lightweight and async-friendly Python Dependency Injection library that leverages type annotations (PEP 484)
to effortlessly manage dependencies in your applications.
Documentation
Requirements
Python 3.8+
and optional dependencies:
- anyio (for supporting synchronous resources with an asynchronous runtime)
Installation
Install using pip:
pip install pyxdi
or using poetry:
poetry add pyxdi
Quick Example
app.py
from pyxdi import dep, PyxDI
di = PyxDI()
@di.provider(scope="singleton")
def message() -> str:
return "Hello, world!"
@di.inject
def say_hello(message: str = dep) -> None:
print(message)
if __name__ == "__main__":
say_hello()
Metadata
Release files for pyxdi 0.18.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyxdi-0.18.1.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyxdi-0.18.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.3 kB
Release files / pyxdi-0.18.1.tar.gz
| Download URL | pyxdi-0.18.1.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96cd1bf93915a572922e2653c0a346b3ef36bfa25cd52f6bcbd307fdb9f05193
|
|
BLAKE2b-256 checksum How to use checksums |
fabf855dbf81c6b19bd07369f6cf73ef969f8883c2f838f3e7937fcb01cfb34d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.2 Darwin/23.2.0
|
Release files / pyxdi-0.18.1-py3-none-any.whl
| Download URL | pyxdi-0.18.1-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0d8659db93b913ec05e94bc7505dadc4f005c0f9f7675c1349a668acda63b21
|
|
BLAKE2b-256 checksum How to use checksums |
3f461c4d0c6d33592e65ab465a33112b6bcf74d58361d345e25ea6520ac8566c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.2 Darwin/23.2.0
|