nteract / scrapbook

A library for recording and reading data in notebooks.
https://nteract-scrapbook.readthedocs.io
BSD 3-Clause "New" or "Revised" License
281 stars 26 forks source link

How do you add custom metadata as you would to display? #33

Open mpacer opened 5 years ago

mpacer commented 5 years ago

When I went to use scrapbook as a replacement for a display call I discovered that you can no longer use custom metadata.

For example, I used to do something like

    display(IPython.display.SVG(flag._repr_mimebundle_()['text/html']), metadata={"filename": flag_def['name']})

To dump the content of a VDOM object to be able to then extract as an SVG automatically with name "flag_def['name'] by using nbconvert.

This is a particular use case that happens to reflect some of the aspects of how scrapbook could be used (since I can use this with papermill to change out the meaning of flag and flag_def parametrically).

However, it more generally points to the need for an escape hatch to attach additional metadata to the displayed object that should be associated with the displayed object in a persistent fashion.

If we think it would be helpful to add a metadata keyword arg to the glue function (that would just get passed through), I would be happy to make the contribution.

MSeal commented 5 years ago

Sounds reasonable to me. Please do feel free to PR the feature.