-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any way to make this work with mutable data structures? #252
Comments
you would need to use an evented container like You would need to do something like this: from psygnal import EventedModel
from psygnal.containers import EventedList
class MyModel(EventedModel):
data: dict = {}
values: EventedList[int] however, on a quick try, I'm noticing a couple issues at the moment with using an unmodified EventedList as a hint for a pydantic model (both v1 and v2). So, let me have a closer look tomorrow. |
also related... even once it does work as a field (which it should)... you'll have the issue of nested events. That is, since an evented list has many events (not just a single change event), it's not immediately clear how one should access them on the model.events field itself. This was being addressed in #169 ... but it hasn't seen action in a while. Let me know if you specifically need the nesting for your use case, or if using |
After this has seen some work but no answer from OP so far, I thought I'd chime in: |
thanks for chiming in @ndxmrb, it definitely helps to know what features people would like to see implemented! I'll look at reviving that PR, as I'm also still interested in using it myself |
Description
After connecting events to mutable types, I would expect that events are called when they are mutated.
What I Did
This doesn't print anything.
The text was updated successfully, but these errors were encountered: