version 1.5.1
- support extra params to dependencies and overrides-reuse, this allows us to do complex dependency resolution,
dg = Graph()
def dep3(e: int) -> Ignore[str]:
return "ok"
def dependency(a: int, a2: Annotated[str, use(dep3)]) -> Ignore[int]:
return a
def dep2(k: str, g: Annotated[int, use(dependency)]) -> Ignore[str]:
assert g == 1
return k
def main(
a: int,
b: int,
c: Annotated[int, use(dependency)],
d: Annotated[str, use(dep2)],
) -> Ignore[float]:
assert d == "f"
return a + b + c
assert dg.resolve(main, a=1, b=2, k="f", e="e") == 4
the downside is that now Graph.resolve
is 1.3x slower, we might find a way to reduce this in next few patches, but this feature is really needy right now.
Graph.entry
no longer ignore builtin-types by default, now user should specifically ignore builtin params. This is mainly for
- resolve and entry to have similar behaviors
- user might be confused by what will be automatically ignored, Ignore[T] is more explicit
-
rollback a behavior introduced in
version 1.4.3
, where Ignored params were not considered as dependencies, now they are dependencies again. -
Graph.resolve
no longer maintain ParamSpec, since for a factoryCallable[P, T]
,Graph.resolve
can accept either more params than P, less params P, or no params P at all, it does not make much sense to maintain paramspec anymore