Skip to content
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

Rendering in the notebook. #188

Closed
koaning opened this issue Aug 19, 2024 · 4 comments
Closed

Rendering in the notebook. #188

koaning opened this issue Aug 19, 2024 · 4 comments

Comments

@koaning
Copy link
Contributor

koaning commented Aug 19, 2024

This is definately a design decision, but I found this to be somewhat confusing. The readme currently reads this:

# The store infers the type of the inserted object by default, but sometimes it
# is necessary to be explicit.
# For example, strings are assumed to be Markdown:
store.insert("my string", "<p>Hello world!</p>")

So I figured, "ah, that means it might render as markdown too then". This was not the case.

CleanShot 2024-08-19 at 11 35 57

Do we want to render it as markdown in Jupyter? This is a product decision, but figured I might raise this as an example of the larger "how do we render stuff in the notebook" discussion.

@tuscland
Copy link
Member

I would say this is a bug because the documentation says "strings are assumed to be Markdown", and <p>Hello world!</p> and **world** are valid Markdown strings.

Do we want to render it as markdown in Jupyter?

I think it is interesting to offer the ability to render a Mandr item in a Jupyter notebook. Thank you for this suggestion.

@augustebaum
Copy link
Contributor

It does render as Markdown, but currently only in the webapp.

On the one hand, I think I get how the readme brought you to this conclusion, and it's an interesting thought. On the other hand, if a Mandr is meant to be something like a glorified dict, I would expect the output to be the same as the input (i.e. if you insert a string and then read it, you get a string), and I would be surprised to see something else (although that might be a good surprise!)

@tuscland
Copy link
Member

I believe there is a larger discussion to have about (hosted) Jupyter notebooks. I will open an issue about that.

@tuscland
Copy link
Member

tuscland commented Sep 17, 2024

One purpose of skore amongst others is to build reports. So, while integrating with notebooks is nice to have, it is not a primary goal.

However it is interesting to see if there are any opportunities: with the new API (see #303), you can give more context to items, like creating a MediaItem object with the text/markdown MIME type. This object could be then converted to something that renders well in a notebook.

It seems Jupyter relies on the IPython.display module to create objects that are then rendered:

from IPython.display import display, Markdown, Latex
display(Markdown('**world**'))

So I don't know how to automagically convert types, but it seems there is a conversion path from a skore item type to something IPython can handle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants