--- id: simple-di version: "0.1.5" license: Apache License 2.0 license_treatment: permissive maintenance: active --- # simple-di — simple dependency injection library License: permissive · Maintenance: active · Downloads: 171.8K/mo ## What it is and what it does simple-di is a dependency injection framework for Python that uses type annotations to wire dependencies into functions and methods. It provides a container pattern where you define providers (Static, Factory, SingletonFactory, Configuration) that compute or store values, then use the @inject decorator to automatically pass those values into function arguments. The library supports runtime value overrides via set() and reset() methods, making it useful for testing and configuration management. The package depends only on dataclasses and types-dataclasses, keeping the runtime footprint minimal. It supports Python 3.6 through 3.9 and is actively maintained, though it remains in pre-alpha status. The strict typing support means you get IDE autocomplete and type checking for injected dependencies. Use it for: - Wiring configuration values (database URLs, API keys, feature flags) into application functions without passing them as arguments - Testing by temporarily overriding provider values without modifying production code - Building modular applications where components declare their dependencies declaratively rather than instantiating them directly - Creating factory-based object graphs where computed dependencies depend on other dependencies in a defined order ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A strictly typed dependency injection library that lets you define and inject dependencies into functions using type annotations and a container pattern. Yes, if you need lightweight typed dependency injection for Python 3.6+. The low install friction, permissive license, and active maintenance make it safe to adopt. However, be aware it remains pre-alpha—verify that its feature set and stability match your project's needs before relying on it in production. ## Install pip install simple-di uv add simple-di poetry add simple-di ## Installing simple-di Before you install: Low friction install with no compiled dependencies. The package is actively maintained as of July 2026, though it has been in pre-alpha status since its first release in June 2021. License in practice: Licensed under Apache License 2.0 (permissive), so you can use it freely in commercial and open-source projects with minimal restrictions. Quickstart: pip install simple-di from simple_di import inject, Provide, Provider, container from simple_di.providers import Static, Factory @container class Options(container): cpu: Provider[int] = Static(2) worker: Provider[int] = Factory(lambda c: 2 * c + 1, c=cpu) @inject def process(worker: int = Provide[Options.worker]): return worker print(process()) # 5 Verify before relying: - Whether the pre-alpha status reflects incomplete features or simply conservative versioning - Production readiness and stability guarantees given the 0.1.5 version number ## Package facts - License: Apache License 2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 171.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dependency injection, typed di container, python dependency injection, inject decorators, service container, factory providers, inversion of control, dependency-injection, type-hints [View on SkillFed](https://skillfed.io/packages/simple-di) · [View on PyPI](https://pypi.org/project/simple-di/)