skillfed

in-n-out

plugable dependency injection and result processing

in-n-out v0.2.1 179.8K downloads/30d#10,163 on PyPI13
Permissive license BSD 3-Clause License Active released

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 on this page — 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

in-n-out on PyPI

pip

pip install in-n-out

uv

uv add in-n-out

poetry

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 the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 844 days since the last release
Last repo commit
First released
Downloads 179,778/month — #10,163 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: in_n_out-0.2.1-py3-none-any.whl

Development Status :: 3 - AlphaLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Typing :: Typed

Tags

dependency injection pythontype hint based DIlightweight IoC containerfunction dependency resolverresult processor frameworkpython inject decoratorpluggable provider registry
dependency-injectiontype-hintsdecorator-based

More Application Frameworks packages