Registry / web-framework / alluka

alluka

JSON →
library0.4.0pypypi✓ verified 84d ago

A type-based dependency injection framework for Python 3.11+ (up to <3.15). Current version 0.4.0, released 2024-11-24. Uses type hints to resolve dependencies; supports both sync and async callbacks. Active development, breaking changes in minor versions before 1.0.

pip install alluka
INSTALL
IMPORT
SIG · ALLUKA
A
alluka
web-frameworkpythonv0.4.0
Install
1.7s avg
Import
224ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.3 · 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
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.238s · 18.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.210s · 19MB
16MB installed
● package 16MB
Code
Verified usage

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

Client
from alluka import Client
from alluka.abc import Client
Client is re-exported from alluka; importing from abc is unnecessary and may break if internals change.
inject
from alluka import inject

Create a Client, register a type dependency, and call an injected function.

from alluka import Client, inject client = Client() client.set_type_dependency(int, 42) @inject def foo(value: int) -> str: return f"Value: {value}" result = client.call(foo) print(result) # Value: 42
Debug
Known issues
breakingDropped Python 3.9 and 3.10 in v0.4.0; Python 3.11+ required.
fix
Upgrade Python to 3.11+ or stay on v0.3.x.
affects: >=0.4.0
gotchaCallbacks decorated with @inject must be called through client.call or client.call_async, not directly.
fix
Use client.call(my_function) instead of my_function().
affects: all
deprecatedAsyncOnlyError renamed to SyncOnlyError in v0.1.3; AsyncOnlyError kept as deprecated alias.
fix
Use SyncOnlyError from alluka.exceptions.
affects: >=0.1.3
Errors
Common errors & fixes
alluka.errors.MissingDependencyError: No type dependency or callback known for type 'int'
The requested type dependency (int) was not registered with client.set_type_dependency.
fix
Register the dependency: client.set_type_dependency(int, value)
TypeError: call() got unexpected keyword argument '...'
You passed an argument that conflicts with the callback's parameter names when using client.call.
fix
Ensure you are not passing keyword arguments that are meant to be injected. Use positional or key=value for explicit args.
Upgrade
Version history
0.4.0latest on PyPI · released Nov 24, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources