Uncoupled
Modern Dependency Injection Container for Python 3.12+
Usage
from typing import Protocol
from uncoupled.container import Container, Depends
# Define the protocol (i.e the interface)
class IService(Protocol):
def compute(self) -> int: ...
# Define a concrete implementation of the protocol
class ServiceImpl(IService):
def compute(self) -> int:
return 42
# Inject with `Depends` the required protocol
def my_function(svc: IService = Depends(IService)) -> None:
print(svc.compute()) # Should return 42 !
if __name__ == "__main__":
# Create a container and map a protocol to an implementation with a specific lifetime
Container.create().add_transient(IService, ServiceImpl)
# Call the function without arguments, `Depends` will take care of the injection
my_function()
Have a look at the
examplefolder for more examples !
Metadata
Release files for uncoupled 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| uncoupled-0.1.1.tar.gz | 11.5 kB | Without provenance | Details for uncoupled-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| uncoupled-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for uncoupled-0.1.1-py3-none-any.whl |
Total release size: 19.2 kB
Release files / uncoupled-0.1.1.tar.gz
| Download URL | uncoupled-0.1.1.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2c3b188c6a8166269741d041d13d72eb86908941e09bc8f5f4ddad38e6dfced
|
|
BLAKE2b-256 checksum How to use checksums |
a39db23aaf5a529526016945e9e15a039ed918e3e1cf6cb1effb489ecddf5c27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.8
|
Release files / uncoupled-0.1.1-py3-none-any.whl
| Download URL | uncoupled-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c301ec5616bf1c868c76492a05249ac5aa46cf1db37281fa70e7e92545acc41c
|
|
BLAKE2b-256 checksum How to use checksums |
f0810a04da28af4540479bf7d7d36e56db610e8bf2818e44af53c672771a8785
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.8
|
Security for uncoupled 0.1.1
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.