anyioc
Another simple ioc framework for python.
Usage
from anyioc import ServiceProvider
provider = ServiceProvider()
provider.register_singleton('the key', lambda ioc: 102) # ioc will be a `IServiceProvider`
value = provider.get('the key')
assert value == 102
Register and resolve
By default, you can use following methods to register services:
ServiceProvider.register_singleton(key, factory)ServiceProvider.register_scoped(key, factory)ServiceProvider.register_transient(key, factory)ServiceProvider.register(key, factory, lifetime)ServiceProvider.register_value(key, value)ServiceProvider.register_group(key, keys)ServiceProvider.register_bind(new_key, target_key)
And use following methods to resolve services:
ServiceProvider.__getitem__(key)ServiceProvider.get(key)ServiceProvider.get_many(key)
get return None if the service was not found, but __getitem__ will raise a ServiceNotFoundError.
Read full documentation.
Metadata
Release files for anyioc 0.15.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 |
|---|---|---|---|---|
| anyioc-0.15.0.tar.gz | 13.9 kB | Without provenance | Details for anyioc-0.15.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anyioc-0.15.0-py3-none-any.whl | Python 3 | none | any | Details for anyioc-0.15.0-py3-none-any.whl |
Total release size: 32.4 kB
Release files / anyioc-0.15.0.tar.gz
| Download URL | anyioc-0.15.0.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
644ed60a221d30e835fb75897180c9c90b4eb0fc5c8d8586026ac95e7f4b7624
|
|
BLAKE2b-256 checksum How to use checksums |
c520839c0b651df9e4dec0d5dd0c591a9a2c1cf2314b47e9852d66f5712e011e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.7 Windows/10
|
Release files / anyioc-0.15.0-py3-none-any.whl
| Download URL | anyioc-0.15.0-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a448c794c34917667954ad49c9c966000cd85511bd4daaf11ef55e435262aa0
|
|
BLAKE2b-256 checksum How to use checksums |
8af6a67aaeeceda59678e6ed61e9005fa667bc0599841981ce894c401ebf2898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.10.7 Windows/10
|
Security for anyioc 0.15.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.