traitlets icon indicating copy to clipboard operation
traitlets copied to clipboard

what happened to EventfulList and friends?

Open mattvonrocketstein opened this issue 11 years ago • 6 comments

in IPython 3.0, I was importing EventfulList like so:

from IPython.utils.traitlets import EventfulList

In IPython 4.0, traitlets is abstracted, which is awesome by the way, but I can't find traitlets.eventful.

What am I missing?

mattvonrocketstein avatar May 09 '15 23:05 mattvonrocketstein

Eventful was kept with widgets, which is the only thing in IPython that used it:

https://github.com/ipython/ipywidgets/blob/master/ipython_widgets/widgets/eventful.py

takluyver avatar May 09 '15 23:05 takluyver

I need eventful containers (List, Dict and Set) in my application. The link above is not working. Can anyone suggest what is the recommended module to use now in 2017?

jmsuresh avatar Aug 30 '17 05:08 jmsuresh

@jmsuresh I am unsure of why they were removed. However there is a pull request to implement them again - https://github.com/jupyter-widgets/ipywidgets/pull/1071

rmorshea avatar Aug 30 '17 05:08 rmorshea

The above PR uses spectate under the hood:

pip install spectate

Check out the examples and let me know what you think.

rmorshea avatar Aug 30 '17 05:08 rmorshea

Thanks for this. I was trying to test this but could not as it depends on FrozenBunch which is not available in the version I have. Any suggestions? I am trying to use this eventful container to do a clean MVC pattern for a GUI. I am wondering why there is no popular way to do this as this requirement should be very common.

jmsuresh avatar Aug 30 '17 13:08 jmsuresh

@jmsuresh, I am trying to find time to uncouple the pull request from its dependance on the (as yet) unreleased 5.0 version of traitlets. However even when I do, that branch will probably be unstable since its a WIP and will need to respond to changes during review.

The reason eventful traits haven't been done before is twofold:

  1. It's hard and requires a deep knowledge of traitlets to implement (which few people have).
  2. It is possible to trigger change notifications if you assign a new instance to the trait.
    • this is obviously not ideal though.

rmorshea avatar Aug 30 '17 19:08 rmorshea