Explicit DI
A library for explicit Dependency Injection
Documentation: https://depeche-py.github.io/explicit-di/
Source code: https://github.com/depeche-py/explicit-di
Explicit DI is modern Python library for explicit Dependency Injection
Requirements
Python 3.9+
Installation
pip install explicit-di
# OR
poetry add explicit-di
Example
import explicit_di as _di
class A:
pass
class B:
def __init__(self, a: A, config : str):
self.config = config
self.a = a
class C:
def __init__(self, b: B):
self.b = b
def create_b(a: A):
return B(a=a, config="foo")
def function_with_dependencies(one : int, two : str, my_c : C):
print(my_c)
def main():
container = _di.Container()
container.register(A)
container.register(B, create_b)
container.register(C)
b = container.resolve(B)
assert isinstance(b, B)
container.inject(function_with_dependencies, one=1, two="two")
Metadata
Release files for explicit-di 0.2.0
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 | Actions |
|---|---|---|---|---|
| explicit_di-0.2.0.tar.gz | 3.5 kB | Without provenance | Details for explicit_di-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| explicit_di-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for explicit_di-0.2.0-py3-none-any.whl |
Total release size: 7.5 kB
Release files / explicit_di-0.2.0.tar.gz
| Download URL | explicit_di-0.2.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1bd5e17162cd4590f6c5593fdd0a09740e889dcf9132d49217dd4c4a00b96dd7
|
|
BLAKE2b-256 checksum How to use checksums |
9001b18c2ddb3967ed46dc42c8eb41844d46f0fa760ff9bf6faf9de4a7843a4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Release files / explicit_di-0.2.0-py3-none-any.whl
| Download URL | explicit_di-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70fb4e9f4920778181bc2e83314d06a1da7225f7a1ae11b5f5c05ae3b9157447
|
|
BLAKE2b-256 checksum How to use checksums |
92cb177f8009226b5f494d715088b0902ea9541eba572917ef2d54cc36a9d1f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.22
|
Security for explicit-di 0.2.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.