--- id: in-n-out version: "0.2.1" license: BSD 3-Clause License license_treatment: permissive maintenance: active --- # in-n-out — plugable dependency injection and result processing License: permissive · Maintenance: active · Downloads: 179.8K/mo ## What it is and what it does in-n-out is a dependency injection framework that uses Python type hints to automatically resolve and provide dependencies to decorated functions. It lets you register provider functions that return instances of specific types, then mark functions with @ino.inject to have those dependencies automatically supplied at call time based on their type annotations. The framework also supports registering result processors—functions that receive and handle return values from injected functions, enabling intentional side effects. The design emphasizes minimal code changes: you decorate functions and register providers, and the framework handles resolution at runtime. It supports weighted providers (allowing temporary overrides via context managers) and works across Python 3.8–3.12. With no runtime dependencies and low install friction, it's suitable for applications ranging from simple scripts to larger frameworks that need pluggable dependency resolution. Use it for: - Inject database connections or configuration objects into handler functions without passing them explicitly - Register mock providers in tests to override real dependencies without modifying source code - Build plugin systems where different implementations of a type can be swapped at runtime - Attach logging or monitoring processors to function results for cross-cutting concerns - Manage service instances in web frameworks or CLI applications with dependency scoping ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Lightweight dependency injection framework using type hints to automatically resolve and inject dependencies into functions, with optional result processing via registered processors. Yes, if you need lightweight dependency injection with type-hint-based resolution and minimal overhead. The permissive license, zero runtime dependencies, and active maintenance make it low-risk. However, it's still in Alpha status; evaluate whether the API is stable enough for your use case, and consider that more mature alternatives exist if you need battle-tested production guarantees. ## Install pip install in-n-out uv add in-n-out poetry add in-n-out ## Installing in-n-out Before you install: Low install friction with no runtime dependencies. Actively maintained as of 2026-08-03 with recent activity, though marked as Alpha status and relatively young (first released 2022-06-30). License in practice: BSD 3-Clause License is permissive; you can use this in commercial or proprietary projects with minimal restrictions beyond retaining the license notice. Quickstart: import in_n_out as ino class Thing: def __init__(self, name: str): self.name = name @ino.inject def func(thing: Thing): return thing.name def give_me_a_thing() -> Thing: return Thing("Thing") ino.register_provider(give_me_a_thing) print(func()) # prints "Thing" Verify before relying: - Whether the package handles circular dependencies or complex dependency graphs gracefully - Performance characteristics under high-frequency injection scenarios - Compatibility with async/await patterns and coroutine injection ## Package facts - License: BSD 3-Clause License (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 179.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dependency injection python, type hint based DI, lightweight IoC container, function dependency resolver, result processor framework, python inject decorator, pluggable provider registry, dependency-injection, type-hints, decorator-based [View on SkillFed](https://skillfed.io/packages/in-n-out) · [View on PyPI](https://pypi.org/project/in-n-out/)