{"id":23241,"library":"alluka","title":"Alluka","description":"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.","status":"active","version":"0.4.0","language":"python","source_language":"en","source_url":"https://github.com/FasterSpeeding/Alluka","tags":["dependency-injection","type-hints","async","di-framework","python3"],"install":[{"cmd":"pip install alluka","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Client is re-exported from alluka; importing from abc is unnecessary and may break if internals change.","wrong":"from alluka.abc import Client","symbol":"Client","correct":"from alluka import Client"},{"note":"","wrong":"","symbol":"inject","correct":"from alluka import inject"}],"quickstart":{"code":"from alluka import Client, inject\n\nclient = Client()\nclient.set_type_dependency(int, 42)\n\n@inject\ndef foo(value: int) -> str:\n    return f\"Value: {value}\"\n\nresult = client.call(foo)\nprint(result)  # Value: 42","lang":"python","description":"Create a Client, register a type dependency, and call an injected function."},"warnings":[{"fix":"Upgrade Python to 3.11+ or stay on v0.3.x.","message":"Dropped Python 3.9 and 3.10 in v0.4.0; Python 3.11+ required.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Use client.call(my_function) instead of my_function().","message":"Callbacks decorated with @inject must be called through client.call or client.call_async, not directly.","severity":"gotcha","affected_versions":"all"},{"fix":"Use SyncOnlyError from alluka.exceptions.","message":"AsyncOnlyError renamed to SyncOnlyError in v0.1.3; AsyncOnlyError kept as deprecated alias.","severity":"deprecated","affected_versions":">=0.1.3"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Register the dependency: client.set_type_dependency(int, value)","cause":"The requested type dependency (int) was not registered with client.set_type_dependency.","error":"alluka.errors.MissingDependencyError: No type dependency or callback known for type 'int'"},{"fix":"Ensure you are not passing keyword arguments that are meant to be injected. Use positional or key=value for explicit args.","cause":"You passed an argument that conflicts with the callback's parameter names when using client.call.","error":"TypeError: call() got unexpected keyword argument '...'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}