You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases where we know exactly on which model field an infra should depend, it would be much easier and safer to have a mode infra.apply(include_in_cache_uid).
Easier because it avoids copying all model fields.
Safer because if we subsequently add fields during the class development, we don't have to remember to add the new field in the exclude_from_cache_uid
Imagine if we only want infra to depend on foo.bar1.
With the include logic, we could do infra.apply(include="foo.foo1")
With the current logic, it is impossible to do this: we would have to do sth horribly hacky like this (had to do in my pipeline)
def exclude(cls):
out = [k for k in cls.model_fields.keys()]
out.remove("foo")
out += ["foo."+k for k in Foo.model_fields.keys()]
out.remove("foo.bar1")
The include exclude logic would become quite hard.
Can’t you simply use _ for the excluded params ? Eg _foo, _bar , this automatically exclude
No because I have multiple infras on my object which depend on different fields…
Why do you think this would be hard? If it’s too complex we could make them mutually exclusive in which case it would be easy
Activity
sdascoli commentedon Oct 8, 2025
The lack of this feature is particularly annoying in the following situation:
Imagine if we only want infra to depend on foo.bar1.
With the include logic, we could do infra.apply(include="foo.foo1")
With the current logic, it is impossible to do this: we would have to do sth horribly hacky like this (had to do in my pipeline)
kingjr commentedon Oct 9, 2025
The include exclude logic would become quite hard.
Can’t you simply use _ for the excluded params ? Eg _foo, _bar , this automatically exclude
sdascoli commentedon Oct 9, 2025
No because I have multiple infras on my object which depend on different fields…
Why do you think this would be hard? If it’s too complex we could make them mutually exclusive in which case it would be easy
kingjr commentedon Oct 9, 2025
Yes, we could add
include_only.My gut feeling is that this need is diagnostic of an improvable class design, but we'd need to discuss this with concrete examples.