skillfed

taskiq-dependencies

FastAPI like dependency injection implementation

taskiq-dependencies v1.5.7 1.8M downloads/30d#3,534 on PyPI
License unclear AGING released

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-dependencies

uv

uv add taskiq-dependencies

poetry

poetry add taskiq-dependencies

Installing 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

Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Typing :: Typed

Tags

dependency injection frameworkfastapi-like di systemasync dependency resolutiondependency graph resolverpython di libraryfunction parameter injectiondependency lifecycle management
dependency-injectionasync-supportfastapi-inspired

More Application Frameworks packages