Registry / devops / typer-injector

typer-injector

JSON →
library0.3.0pypypi✓ verified 81d ago

Dependency injection for Typer CLI applications, providing decorators and utilities to integrate dependency injection containers (like inject or dependency-injector) with Typer commands. Current version 0.3.0, requires Python >=3.9. Release cadence is irregular.

pip install typer-injector
INSTALL
IMPORT
SIG · TYPER-INJECTOR
T
typer-injector
devopspythonv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Depends
from typer_injector import Depends
from typer_injector import Inject
InjectingTyper
from typer_injector import InjectingTyper
exceptions
from typer_injector import exceptions

Minimal example using Inject to inject a string into a Typer command.

import typer from typer_injector import Inject, configure def config(binder): binder.bind(str, "Hello from DI!") configure(config) app = typer.Typer() @app.command() def greet(message: str = Inject()): typer.echo(message) if __name__ == "__main__": app()
Debug
Known issues
gotchaThe `Inject` type annotation must be used as a default argument value (e.g., `message: str = Inject()`). Using it without parentheses or in other positions will not trigger injection.
fix
Always use `Inject()` as the default value, not `Inject`.
affects: all
gotchaThe `configure` function must be called before defining any Typer commands that use `Inject`, otherwise injection may not work.
fix
Call `configure(config)` at module level before defining commands.
affects: all
deprecatedThe library is in early development (0.x) and APIs may change without notice. There is no stable release yet.
fix
Pin to a specific version and test upgrades carefully.
affects: <1.0.0
Upgrade
Version history
0.3.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
typerrequiredRequired for Typer integration
injectoptionalCommon dependency injection framework used with typer-injector
Agent activity
6 hits · last 30 days
node
6
Resources
typer-injector — pip install typer-injector · libregistry