Skip to content

Home

Drop the beat on your dependencies.

dijay is the "remix" your architecture needs: NestJS-style modularity, native async performance, and rigorous typing for Python 3.13+. Less boilerplate, more harmony.

ci coverage release pypi license


Features

  • Modular Architecture — Organize code into @modules with imports, providers, and exports.
  • Constructor Injection — Clean, testable injection via __init__ and Annotated.
  • Flexible ScopesSINGLETON, TRANSIENT, and REQUEST.
  • Async Native — First-class support for asynchronous factories and lifecycle hooks.
  • Custom ProvidersProvide dataclass for value, class and factory bindings.
  • Lifecycle Hooks@on_bootstrap and @on_shutdown decorators.
  • Circular Dependency Detection — Immediate RuntimeError on cycles.

Quick Example

import asyncio
from dijay import Container, injectable, module

@injectable()
class CatsService:
    def get_all(self):
        return ["Meow", "Purr"]

@module(providers=[CatsService], exports=[CatsService])
class CatsModule: ...

@module(imports=[CatsModule])
class AppModule: ...

async def main():
    async with Container.from_module(AppModule) as container:
        service = await container.resolve(CatsService)
        print(service.get_all())

if __name__ == "__main__":
    asyncio.run(main())

Next Steps