in-n-out
raw JSON → 0.2.1 verified Mon Apr 27 auth: no python
A plugable dependency injection and result processing library for Python. Current version 0.2.1, released June 2025. Active development with monthly releases.
pip install in-n-out Common errors
error ModuleNotFoundError: No module named 'in_n_out' ↓
cause Library not installed or Python environment mismatch.
fix
Run
pip install in-n-out and ensure you are using Python >=3.8. error TypeError: 'NoneType' object is not callable ↓
cause Return value from `processor.process()` is None because no registered processor handles the function's return type.
fix
Register a result processor for the return type using
@processor.register. error AttributeError: module 'in_n_out' has no attribute 'Injector' ↓
cause Incorrect import path; the class is exported from the top-level package.
fix
Use
from in_n_out import Injector or import in_n_out; injector = in_n_out.Injector(). Warnings
deprecated The `register` decorator with both Injector and Processor on the same function is deprecated; use `@injector.register` and `@processor.register` separately. ↓
fix Decorate the function twice, once per instance.
gotcha Processor returns a coroutine object if the function is async; you must await it. ↓
fix Use `await processor.process(...)` for async functions.
breaking Before v0.2.0, the `inject` decorator existed; it was removed and replaced with `Injector.register`. ↓
fix Upgrade to 0.2.x and use `Injector.register`.
Imports
- Injector
from in_n_out import Injector - Processor
from in_n_out import Processor - intake
from in_n_out import intake
Quickstart
from in_n_out import Injector, Processor, intake
class MyService:
def greet(self, name: str) -> str:
return f"Hello, {name}!"
injector = Injector()
processor = Processor()
@injector.register
@processor.register
def my_function(name: str) -> str:
service = MyService()
return service.greet(name)
result = processor.process(my_function, name="World")
print(result)