--- id: injector version: "0.24.0" license: BSD license_treatment: permissive maintenance: active --- # injector — Injector - Python dependency injection framework, inspired by Guice License: permissive · Maintenance: active · Downloads: 4.0M/mo ## What it is and what it does Injector is a dependency injection framework that automatically wires dependencies into your classes and functions, inspired by Guice but designed for Python idioms. Rather than manually passing dependencies or relying on global state, you declare what your code needs via type hints, and Injector constructs and provides those dependencies for you. It supports scoping like singletons, custom providers, and modular configuration through Module classes, making it particularly useful for decoupling configuration from business logic and reducing boilerplate in larger applications. The framework emphasizes simplicity and non-intrusiveness: your classes remain standard Python classes that can be instantiated manually if needed, and the framework avoids global state by requiring explicit Injector instances. It cooperates with static type checkers, allowing type-safe dependency retrieval. The main runtime dependency is typing_extensions, making installation straightforward with low friction. Use it for: - Decoupling configuration and database initialization in web applications or services - Automatically providing shared resources like database connections to multiple handlers - Building testable code by swapping real implementations for mocks through different Injector configurations - Organizing large codebases into modules with clear dependency boundaries and reusable components - Reducing constructor boilerplate when many classes need the same set of dependencies ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Injector is a Python dependency injection framework that automatically resolves and provides dependencies to your code, reducing boilerplate in larger applications through constructor injection and modular configuration. Yes. Injector is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It's worth installing if you're building a larger application where dependency injection reduces boilerplate and improves testability; for small scripts or projects where manual dependency passing is simpler, it adds unnecessary overhead. ## Install pip install injector uv add injector poetry add injector ## Installing injector Before you install: Low friction install with a single runtime dependency on typing_extensions. The package is actively maintained with a recent release and 1536 repository stars, indicating stable, ongoing support. License in practice: BSD permissive license allows use in most projects, including commercial ones, with minimal restrictions beyond attribution. Quickstart: pip install injector from injector import Injector, inject class Inner: def __init__(self): self.forty_two = 42 class Outer: @inject def __init__(self, inner: Inner): self.inner = inner injector = Injector() outer = injector.get(Outer) print(outer.inner.forty_two) Verify before relying: - Whether the package supports Python 3.8+ as stated in the description excerpt (requires_python field is unspecified in metadata) - Whether PyPy 3 support mentioned in the description is actively tested and maintained ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 4.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags dependency injection framework, python IoC container, automatic dependency resolution, constructor injection, inversion of control, guice-inspired DI, modular configuration, dependency-injection, inversion-of-control, application-architecture [View on SkillFed](https://skillfed.io/packages/injector) · [View on PyPI](https://pypi.org/project/injector/)