Skip to content

rfc (api): Revisit the API of put and get #1269

@glemaitre

Description

@glemaitre

In the past, we had many discussions where @GaelVaroquaux or myself complain with the needs to use .put and specified the name of an item to store it (and get it).

I came #949 to mention that I wanted my CrossValidationReport accessible from project such that this operation happen. However, one limitation as mentioned by @auguste-probabl is that native Python type cannot benefit from this API. There is also discussion that you can use the same class into different ways that could be confusing.

In an IRL with @adrinjalali, an API that seems much better would be to have a dict/Bunch UX to deal with this use case:

project.put("my_int, 1)

would be replaced by:

project.artifacts.my_int = 1

or for a report

report = CrossValidationReport(...)
project.put("estimator_report, report)

would be replaced by:

project.artifacts.estimator_report = CrossValidateRerport(...)

To access, the latest version of an items:

# pushing to the extreme without storing the artifact in another variable
project.artifacts.estimator_report.metrics.roc.plot()

would work.

All of those would work if we consider that skore.open set implicitly the "run" for which we store and access the items. We would still need .get if one wants to access an item from a different run where we come back to the discussion on having skore.get_metadata or similar to be able to query the database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API 🧑‍💻Improvement of the API facing usersfeature 🎁Feature or enhancementneeds API design 🎨Requires public/private API design before implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions