typer-injector
Dependency injection for typer
Decision gist · record as of 2026-08-14
Yes, if you're building a Typer CLI with multiple commands that share parameters or need centralized dependency logic. The package is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. Start with it if you're already using Typer and find yourself repeating option definitions across commands.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction installation with a single runtime dependency on typer.
- Actively maintained with recent commits and broad Python version support from 3.9 through 3.14.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2026-04-29 (107 days) · last repo commit 2026-04-29 · 1 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 102,870 downloads/mo, #12,839 on PyPI
Alternatives
Verify before relying
pip install typer-injector
import typer
from typer_injector import Depends, InjectingTyper
from typing import Annotated
app = InjectingTyper()
def my_dependency(value: str) -> str:
return value.upper()
Dep = Annotated[str, Depends(my_dependency)]
@app.command()
def my_command(dep: Dep) -> None:
print(dep)- Whether dependency caching or lifecycle management (request-scoped, singleton, etc.) is supported beyond the FastAPI pattern.
- Performance characteristics when many commands share complex dependency graphs.
- Compatibility with Typer's async command support.
What it is and what it does
typer-injector bridges Typer CLI applications with FastAPI-style dependency injection, letting you define reusable parameter factories and inject them into commands via type annotations. Instead of repeating the same option parsing logic across multiple commands, you write a dependency function once and reference it by annotating parameters with Depends().
The package wraps Typer's InjectingTyper class and works with Typer's Option and Argument annotations. It's useful when your CLI has multiple commands that share common parameters—like database connections, configuration objects, or parsed composite arguments—that you want to define and validate in one place. The dependency system resolves these at command invocation time, similar to how FastAPI resolves dependencies for route handlers.
Use it for
- Share parsed configuration (host, port, credentials) across multiple CLI commands without repeating option definitions.
- Build composite parameters from multiple CLI options—e.g., combine host and port into an Address tuple for reuse.
- Centralize validation logic for common parameter types across a multi-command CLI tool.
- Reduce boilerplate in CLI tools with many commands that accept overlapping sets of options.
- Organize CLI parameter handling using dependency injection patterns familiar from web frameworks.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you're building a Typer CLI with multiple commands that share parameters or need centralized dependency logic.
The package is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. Start with it if you're already using Typer and find yourself repeating option definitions across commands.
Install
typer-injector on PyPI
Before you install
Low friction installation with a single runtime dependency on typer. Actively maintained with recent commits and broad Python version support from 3.9 through 3.14.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install typer-injector
import typer
from typer_injector import Depends, InjectingTyper
from typing import Annotated
app = InjectingTyper()
def my_dependency(value: str) -> str:
return value.upper()
Dep = Annotated[str, Depends(my_dependency)]
@app.command()
def my_command(dep: Dep) -> None:
print(dep)
Verify before relying
- Whether dependency caching or lifecycle management (request-scoped, singleton, etc.) is supported beyond the FastAPI pattern.
- Performance characteristics when many commands share complex dependency graphs.
- Compatibility with Typer's async command support.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyper |
| Maintenance | Actively maintained 107 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 102,870 / month, #12,839 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: typer_injector-0.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “typer dependency injection”
- typer-injectorAdds FastAPI-style dependency injection to Typer CLI applications,…
- wireupWireup is a type-driven dependency injection container for Python…
- typer-slimtyper-slim is a deprecated migration shim that installs the full…
Give your agent the search over MCP, or paste the wish link into any chat.
More Application Frameworks packages
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Textual is a Python framework for building cross-platform user interfaces that run in the terminal or web browser using a modern, component-based API.
Install it if you're developing CLI tools, dashboards, or interactive terminal applications.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Build and connect to Model Context Protocol servers that expose tools, resources, and prompts to LLM applications over stdio, HTTP, or SSE transports.
Install it if you need to build or connect to servers.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
See also fastapi-injectable · typer-cli · typer-config · typer-slim · taskiq-dependencies · sphinxcontrib-typer · fast-depends · django-typer · injector