modern-di integration for taskiq
Project description
modern-di-taskiq
Modern-DI integration for taskiq.
Quickstart
import typing
from modern_di import Container, Group, Scope, providers
from modern_di_taskiq import FromDI, setup_di
from taskiq import InMemoryBroker
class Settings:
def __init__(self) -> None:
self.greeting = "hello"
class Dependencies(Group):
settings = providers.Factory(scope=Scope.APP, creator=Settings)
broker = InMemoryBroker()
setup_di(broker, Container(groups=[Dependencies], validate=True))
@broker.task
async def greet(name: str, settings: typing.Annotated[Settings, FromDI(Dependencies.settings)]) -> str:
return f"{settings.greeting}, {name}"
See the documentation for the full guide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modern_di_taskiq-2.0.0.tar.gz.
File metadata
- Download URL: modern_di_taskiq-2.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e5adf0694c0824d1a0ae6fbadeef3b14002b8f9faba96cf82c574c54a459df
|
|
| MD5 |
f0a0d9980396f9095091ab0239b3fdd3
|
|
| BLAKE2b-256 |
e19c31393a3e0797b0302feeb3a4f1af111deeb95b059432c6cb189d2d3fb258
|
File details
Details for the file modern_di_taskiq-2.0.0-py3-none-any.whl.
File metadata
- Download URL: modern_di_taskiq-2.0.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
935c8acce4087228e7ed26df4d660ef1dc8826befb3f1ac74a54210de5e09d32
|
|
| MD5 |
ce4a3034a63558895fd303aa4c48b3a5
|
|
| BLAKE2b-256 |
a09e0dab67c00fa7e5f973fbfe83203a7f05c1d907a18891e006439ff60ccfa7
|