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

What happened to pm.display? #88

Closed VincentKetelaars closed 3 years ago

VincentKetelaars commented 3 years ago

I am trying to move us from an old version (0.18) to the most recent and a few things changed :)

The main one that I am struggling with is pm.display. In our setup we would have a small notebook (ipynb) file, which through the execute_notebook parameters we would provide certain functions + parameters to run. This allows us to create functions that we can properly lint, unit test, etc. and 'inject' in a notebook that we can run with papermill. It's awesome.

These functions that we would inject were using pm.display and pm.record to display and record objects. Mostly plots and dataframes. It is unclear to me exactly how this is supposed to work now. I see that with scrapbook I can glue scraps, which looks like what I need. (Also has the display=True, which is nice) But this glue is more restrictive in what it can and cannot save, and so it can't be used for displaying everything. (e.g. multi index dataframes)

Any help would be appreciated. Thanks!

MSeal commented 3 years ago

In general scrapbook.glue should be supporting everything the old pm.record supported. If you could open an issue in scrapbook with a specific code snippet that's failing but should work, likely we can identify what needs to be added as a valid encoder there and patch scrapbook.

willingc commented 3 years ago

Transferring issue to scrapbook repo since that is where the fix would happen.

VincentKetelaars commented 3 years ago

I don't have the original problem with pm.record on hand anymore. But it was a problem with multi indexed pandas dataframes.

I checked what pm.display actually did and just copied over the lines from https://github.com/nteract/papermill/blob/0.18.2/papermill/api.py#L60, which works fine for me.

Feel free to close this issue. I'm happy with the above code.

MSeal commented 3 years ago

Thanks and do let us know if something comes up that you think should be changed.