Adnexus Framework
Adnexus is a modern and declarative DI and IoC framework using pydantic for config and data.
Key features
- Fast: Very high performance thanks to pydantic and preemptive wiring
- Developer friendly: Declarative Container definition to take the "Magic" out of DI
- Good compatibility: Can be used with almost every framework and supports async
Installation
pip install adnexus
Basic Example
from pathlib import Path
from datetime import datetime
from pydantic import BaseModel
from adnexus.containers import DeclarativeContainer
from adnexus.config.builtin import TOMLLoader
from adnexus.config import load_config
from adnexus.providers import FactoryProvider
from adnexus.markers import Provide
from adnexus.decorators import inject
class UpstreamInjectable:
def __init__(self):
self.time = datetime.now()
def get_time(self):
return self.time
class TestInjectable:
def __init__(self, name: str, timer: Provide[UpstreamInjectable]):
self.timer = timer
self.name = name
def greet(self):
print(self.timer.get_time())
return f"Hello {self.name}"
@inject
def test(greeter: Provide[TestInjectable]):
print(greeter.greet())
class MyConfig(BaseModel):
name: str
class MyContainer(DeclarativeContainer):
# the loaded config can be accessed by calling MyContainer.config.<name>
config = load_config(TOMLLoader(Path("/path/to/settings.toml")))
injectables = [
FactoryProvider(TestInjectable, config.name),
FactoryProvider(UpstreamInjectable)
]
if __name__ == "__main__":
container = MyContainer()
container.wire([__name__])
test() # <-- dependencies are injected automatically
Metadata
Release files for adnexus 0.1.7
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 |
|---|---|---|---|---|
| adnexus-0.1.7.tar.gz | 7.8 kB | Without provenance | Details for adnexus-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adnexus-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for adnexus-0.1.7-py3-none-any.whl |
Total release size: 18.4 kB
Release files / adnexus-0.1.7.tar.gz
| Download URL | adnexus-0.1.7.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37c3afb53b964c343ec48831b7048fba5c0759cc0879d0886a56d62dc30bc40a
|
|
BLAKE2b-256 checksum How to use checksums |
7ecfa135533a0b1c0d94770dc327ddeae71b4847be145de49b15351a4d42f11d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.7 Linux/6.5.0-1025-azure
|
Release files / adnexus-0.1.7-py3-none-any.whl
| Download URL | adnexus-0.1.7-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f617d5d42a77de8f6a8d88fe232ff9b44dbdd2b56b77d1cf7fa168fa2f75bf6c
|
|
BLAKE2b-256 checksum How to use checksums |
c809c2f369324036ac36e20dd3d62f94a40f3f7d1278a9c20c6e243276ed035c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.7 Linux/6.5.0-1025-azure
|
Security for adnexus 0.1.7
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.