taskiq-dependencies
FastAPI like dependency injection implementation
What it is and what it does
Taskiq-dependencies is a standalone dependency injection library inspired by FastAPI's design. It builds a dependency graph from function signatures, validates for cycles at initialization, and resolves dependencies in the correct order. You define dependencies using the Depends() marker and call DependencyGraph to analyze a target function, then use sync_ctx() or async_ctx() to resolve and inject them.
The library handles generator-based dependencies with setup/teardown semantics, supports async dependencies and async generators, allows runtime dependency replacement for testing, and can inject metadata about parameters via ParamInfo. It also supports generic type parameters for class-based dependencies. The package has no external dependencies beyond typing-extensions and works across Python 3.9–3.13.
Use it for:
- Add dependency injection to web frameworks or custom async applications without pulling in a full framework.
- Manage database sessions, connection pools, or other resources with automatic setup and cleanup via generator dependencies.
- Mock or replace dependencies in unit tests by passing replaced_deps to the context without modifying production code.
- Build plugin systems or modular architectures where components declare their dependencies as function parameters.
- Handle async initialization and teardown logic in async generators for service startup and resource cleanup.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides FastAPI-style dependency injection for Python projects, resolving dependency graphs and managing both synchronous and asynchronous dependency lifecycles.
Yes, if you need lightweight dependency injection in a Python project and are comfortable with an aging but stable library. Low install friction and no external dependencies make it easy to adopt. Verify the license first, and be aware that maintenance is slow—suitable for stable use but not for projects requiring active upstream support.
Install
taskiq-dependencies on PyPI
pip
pip install taskiq-dependenciesuv
uv add taskiq-dependenciespoetry
poetry add taskiq-dependenciesInstalling taskiq-dependencies
Before you install
Low install friction with a single runtime dependency (typing-extensions). Maintenance status is aging—last release was 534 days ago—so expect slower response to issues, though the package remains stable for existing use.
License in practice
License status is unclear; no SPDX identifier or raw license text is available in the metadata. Verify the actual license before using in proprietary or restricted contexts.
Quickstart
pip install taskiq-dependencies
from taskiq_dependencies import Depends, DependencyGraph
def dep1() -> int:
return 1
def target_func(some_int: int = Depends(dep1)):
return some_int + 1
graph = DependencyGraph(target_func)
with graph.sync_ctx() as ctx:
result = target_func(**ctx.resolve_kwargs())
Verify before relying
- Whether the package is still actively maintained or in maintenance-only mode
- What the actual license is (unclear in metadata)
- Performance characteristics when resolving large or deeply nested dependency graphs
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | aging — 534 days since the last release |
| First released | |
| Downloads | 1,806,804/month — #3,534 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: taskiq_dependencies-1.5.7-py3-none-any.whl
Keywords: taskiq, dependencies, injection, async, DI
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
fast-dependsFastDepends provides a standalone dependency…
permissive · top 5,000 on PyPI
taskiq-fastapiIntegrates FastAPI request and dependency…
permissive · top 15,000 on PyPI
fastapi-injectableEnables FastAPI's Depends() dependency…
permissive · top 15,000 on PyPI
typer-injectorAdds FastAPI-style dependency injection to…
permissive · top 15,000 on PyPI
rodiRodi is a dependency injection container for…
permissive · top 15,000 on PyPI
taskiqTaskiq is an asynchronous distributed task…
permissive · top 5,000 on PyPI
allukaAlluka is a type-based dependency injection…
permissive · top 15,000 on PyPI
taskiq-redisAdds Redis-based message brokers and result…
permissive · top 5,000 on PyPI
injectorInjector is a Python dependency injection…
permissive · top 5,000 on PyPI
wireupWireup is a type-driven dependency injection…
permissive · top 15,000 on PyPI