The default behaviour of put
is not sane enough for unknown object types
#822
Labels
enhancement
New feature or request
put
is not sane enough for unknown object types
#822
Is your feature request related to a problem? Please describe.
The current default when an unknown object type is
put
is to raise anItemTypeError
.The user has two solutions if they want to store their object in skore:
MediaItem
, i.e. rather than:write for example
This means the user has the responsibility of passing the media type and to convert their object to bytes or string form, which they are unlikely to do in practice.
Item
type (or open a PR adding it). See FEAT: Support a skrub TableReport #806 for example.Both of these solutions lower the usability of skore.
Describe the solution you'd like
We should support
put
for any object that has a_repr_html_
method, and when this is the case we do the conversion toMediaItem
ourselves.In the future we can also consider other media types by detecting other
_repr_xxx_
methods, e.g. by looking first for_repr_html_
, then_repr_svg_
, then_repr_png_
, etc. We might also make use of_repr_mimebundle_
.Describe alternatives you've considered, if relevant
Use pickle (not environment-dependent, but could be more useful for users)
Additional context
This issue is derived from #810 (comment)
The text was updated successfully, but these errors were encountered: