inject
Python dependency injection framework.
Decision gist · record as of 2026-08-14
Yes. Inject is a mature, actively maintained dependency injection framework with no external dependencies, permissive licensing, and no known vulnerabilities. It is well-suited for Python projects that need lightweight, non-invasive dependency management. Install it if you want a simple alternative to heavier frameworks; skip it if your project already uses a framework with built-in DI (Django, FastAPI) or if you prefer explicit parameter passing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; type annotations are required for autoparams decorator to work.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained with a recent release 32 days ago; repo shows 774 stars and last commit on 2026-07-27.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
last release 2026-07-13 (32 days) · last repo commit 2026-07-27 · 774 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,322,011 downloads/mo, #3,141 on PyPI
Alternatives
Verify before relying
pip install inject
import inject
@inject.autoparams
def my_function(cache: RedisCache):
pass
def config(binder):
binder.bind(RedisCache, RedisCache('localhost:1234'))
inject.configure(config)
my_function() # cache is automatically injected- Whether the package's thread-safety guarantees hold under all concurrent binding scenarios
- Performance characteristics when managing large dependency graphs or high-frequency injection calls
What it is and what it does
Inject is a dependency injection framework that decouples object creation from usage by automatically wiring dependencies into functions and classes. It uses type annotations or explicit binding declarations to resolve and inject dependencies at runtime. The framework does not intercept or modify class constructors, instead offering decorators like @autoparams and @params, instance attributes via inject.attr, and direct instance retrieval via inject.instance.
The package supports multiple binding strategies: instance bindings (always return the same object), constructor bindings (create singletons on first injection), and provider bindings (call a function on each injection). It integrates transparently with tests through configuration clearing, handles context managers, and is thread-safe after initial configuration. Runtime binding can be disabled to catch unbound dependencies early.
Use it for
- Decouple service implementations from their consumers in web frameworks or CLI applications by binding interfaces to concrete implementations.
- Simplify test setup by configuring mock dependencies without modifying production code or class constructors.
- Manage shared resources like database connections or caches across an application by binding them once and injecting where needed.
- Build modular applications where different environments (dev, test, production) use different implementations of the same interface.
- Reduce boilerplate in class hierarchies by using inject.attr to declare dependencies as class properties instead of constructor parameters.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Inject is a mature, actively maintained dependency injection framework with no external dependencies, permissive licensing, and no known vulnerabilities. It is well-suited for Python projects that need lightweight, non-invasive dependency management. Install it if you want a simple alternative to heavier frameworks; skip it if your project already uses a framework with built-in DI (Django, FastAPI) or if you prefer explicit parameter passing.
Install
inject on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with a recent release 32 days ago; repo shows 774 stars and last commit on 2026-07-27. Requires Python 3.10+.
Requires Python 3.10 or later; type annotations are required for autoparams decorator to work.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install inject
import inject
@inject.autoparams
def my_function(cache: RedisCache):
pass
def config(binder):
binder.bind(RedisCache, RedisCache('localhost:1234'))
inject.configure(config)
my_function() # cache is automatically injected
Verify before relying
- Whether the package's thread-safety guarantees hold under all concurrent binding scenarios
- Performance characteristics when managing large dependency graphs or high-frequency injection calls
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 32 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,322,011 / month, #3,141 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python Modules |
Evidence: inject-5.5.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 › “autoparams type annotations”
- injectProvides a lightweight dependency injection framework for Python that…
- types-PyYAMLProvides type stubs for PyYAML to enable static type checking of code…
- mypy-boto3-bedrock-runtimeProvides type annotations and IDE autocompletion for boto3's…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also in-n-out · injector · dependency-injector · conda-inject · pinject · Flask-Injector · simple-di · kink · alluka · fastapi-injector