• 0 Posts
  • 1 Comment
Joined 10 months ago
cake
Cake day: December 4th, 2023

help-circle
  • I think the tact that fastapi takes, i.e. foo: Annotated[x, Depends(dependency)] , is honestly the best mechanism I’ve seen (so much so that I’ve utilized something similar, in my own cli library)

    It keeps your function arguments agnostic to the dependency, retain typing ability, “easily” composes into nested dependencies, various other things.

    By contrast, I’m not especially a fan of this because the function argument name is hardcoded, the object presumably has no ability to type the dependencies, it’s unclear how nested dependencies would work, and it’s also unclear if/whether dependencies are resolved eagerly or on access