Registry / web-framework / uncalled-for

uncalled-for

JSON →
library0.4.0pypypi✓ verified 26d ago

Async dependency injection for Python functions. It allows declaring function dependencies as parameter defaults, which are then resolved when the function runs, offering a zero-ceremony, container-less, and configuration-free approach. The library is async-native and built on standard library features like `AsyncExitStack` and `ContextVar`. It supports context manager lifecycle for generators and nested dependencies, with caching to ensure each dependency resolves once per call. Current version is 0.2.0, with an active release cadence as seen from recent GitHub releases.

pip install uncalled-for
INSTALL
IMPORT
SIG · UNCALLED-FOR
U
uncalled-for
web-frameworkpythonv0.4.0
Install
1.5s avg
Import
Disk
15MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 1.5s
py 3.11
✓ —
✓ 1.6s
py 3.12
✓ —
✓ 1.5s
py 3.13
✓ —
✓ 1.5s
py 3.9
✕ build_error
✕ build_error
15MB installed
● package 15MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

call
from uncalled_for import call
from uncalled_for import call

This example demonstrates how to define an asynchronous dependency using an async generator, and then use `uncalled_for.call` to automatically resolve and inject this dependency into another asynchronous function. The `get_db_connection` acts as a context manager, ensuring resource cleanup.

import asyncio from uncalled_for import call # Define an async generator for a mock database connection async def get_db_connection(): print("Connecting to DB...") try: # Simulate a connection object yield "mock_db_connection_obj" finally: print("Closing DB connection...") # Define a function that depends on the database connection async def get_user_data(db_connection: str): print(f"Fetching user data using: {db_connection}") await asyncio.sleep(0.1) # Simulate async I/O return f"User data fetched with {db_connection}" # Define the main application function async def main_app_logic(): # 'call' resolves get_db_connection and injects its yielded value into get_user_data data = await call(get_user_data, db_connection=get_db_connection) print(f"Received: {data}") if __name__ == "__main__": asyncio.run(main_app_logic())
Debug
Known issues
breakingThe `__aexit__` signature for custom `Dependency` classes changed between versions 0.1.0 and 0.1.1. If you implemented custom asynchronous dependencies, ensure their `__aexit__` method matches the full expected signature.
fix
Update the `__aexit__` method signature in your custom asynchronous `Dependency` implementations to `async def __aexit__(self, exc_type, exc_val, exc_tb):`.
affects: 0.1.0
gotchaAs of version 0.1.2, the library reports concrete types for duplicate single dependencies. This change might alter behavior or error reporting if your application previously had ambiguously defined duplicate dependencies that were implicitly resolved.
fix
Review your dependency definitions to ensure uniqueness where intended or explicitly define how duplicate dependencies should be resolved.
affects: >=0.1.2
gotchaThe library explicitly requires Python 3.10 or newer. Using it with older Python versions will result in `SyntaxError` or `ImportError` due to modern language features utilized.
fix
Ensure your project's Python interpreter is version 3.10 or higher. You may need to upgrade your Python environment or use a tool like `pyenv` or `conda` to manage different Python versions.
affects: <3.10
gotchaAs an async-native library built on `AsyncExitStack` and `ContextVar`, proper asynchronous context management is crucial. Misunderstanding `await` usage or resource lifecycle in async generators can lead to unclosed resources or unexpected behavior.
fix
Always `await` calls to functions decorated or managed by `uncalled-for` if they involve async dependencies. Ensure any custom async generators used as dependencies properly `yield` and handle their `finally` blocks for resource cleanup.
affects: All versions
breakingThe `call` function is no longer available for direct import from the `uncalled_for` package's top level. This indicates a breaking API change where the function has either been removed, renamed, or moved to a different module.
fix
Update your import statements and code to reflect the library's current API for its primary callable functionality. Refer to the library's changelog or documentation to identify the new entry point or alternative method for the `call` functionality.
affects: Specific library versions (where 'call' is not exported)
Upgrade
Version history
0.4.0latest on PyPI · released Aug 10, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
11
Resources
uncalled-for — pip install uncalled-for · libregistry