Skip to content

Version 0.20.0

Choose a tag to compare

@tarsil tarsil released this 12 Sep 08:47
44aae34

Added

  • New request‑agnostic Depends for DI anywhere (sync/async, nested deps, overrides, per‑instance caching).
  • Added @Inject decorator to auto‑resolve Depends on call. This preserves signature and honors explicit args.

Example

from lilya.dependencies import Depends, inject


def get_db():
    session = Sessionlocal()
    try:
        yield session
    finally:
        session.close()


@inject
def get_db_session(db = Depends(get_db)) -> Any:
    return db