ipython/ipython — pull request #6128 by jasongrout (2014-07-13 04:43:29+00:00)
Title: Widget trait serialization

Here's a rough draft of a pull request to enable custom serialization for traits on widgets. I also added a default klass attribute to the Instance traitlet, so you could subclass Instance to easily get a new traitlet for a certain class. Here is an example where this is useful:
```python
def np_to_list(a):
if a is not None:
return a.tolist()
def np_from_list(a):
if a is not None:
return np.array(a)

class NDArray(Instance):
klass = np.ndarray
metadata = {'to_json': np_to_list,
'from_json': np_from_list}
```
Then the NDArray traitlet will by default have the klass and some custom metadata.

TODO:
- [ ] Write tests