Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions skore-local-project/src/skore_local_project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os
from functools import wraps
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING
from uuid import uuid4

Expand Down Expand Up @@ -270,32 +269,6 @@ def summarize(self) -> list[Metadata]:
if value["project_name"] == self.name
]

@property
def reports(self):
"""Accessor for interaction with the persisted reports."""

def get(id: str) -> EstimatorReport | CrossValidationReport:
"""
Get a persisted report by its id.

.. deprecated
The ``Project.reports.get`` function will be removed in favor of
``Project.get`` in a near future.
"""
return self.get(id)

def metadata() -> list[Metadata]:
"""
Obtain metadata/metrics for all persisted reports in insertion order.

.. deprecated
The ``Project.reports.metadata`` function will be removed in favor of
``Project.summarize`` in a near future.
"""
return self.summarize()

return SimpleNamespace(get=get, metadata=metadata)

def __repr__(self) -> str: # noqa: D105
return (
f"Project(mode='local', name='{self.name}', workspace='{self.workspace}')"
Expand Down
24 changes: 8 additions & 16 deletions skore-local-project/tests/unit/test_project.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from io import BytesIO
from types import SimpleNamespace

import joblib
from pandas import DataFrame
Expand Down Expand Up @@ -297,27 +296,20 @@ def test_put_cross_validation_report(self, tmp_path, nowstr, cv_regression):
assert len(project._Project__artifacts_storage) == 1
assert len(project._Project__metadata_storage) == 2

def test_reports(self, tmp_path):
project = Project("<project>", workspace=tmp_path)

assert isinstance(project.reports, SimpleNamespace)
assert hasattr(project.reports, "get")
assert hasattr(project.reports, "metadata")

def test_reports_get(self, tmp_path, regression):
def test_get(self, tmp_path, regression):
project = Project("<project>", workspace=tmp_path)
project.put("<key>", regression)
project.put("<key>", regression)

report = project.reports.get(next(project._Project__artifacts_storage.keys()))
report = project.get(next(project._Project__artifacts_storage.keys()))

assert len(project._Project__artifacts_storage) == 1
assert len(project._Project__metadata_storage) == 2
assert isinstance(report, EstimatorReport)
assert report.estimator_name_ == regression.estimator_name_
assert report._ml_task == regression._ml_task

def test_reports_get_exception(self, tmp_path, regression):
def test_get_exception(self, tmp_path, regression):
import re

project = Project("<project>", workspace=tmp_path)
Expand All @@ -331,9 +323,9 @@ def test_reports_get_exception(self, tmp_path, regression):
f"does not exist anymore."
),
):
project.reports.get(None)
project.get(None)

def test_reports_metadata(self, tmp_path, Datetime, regression, cv_regression):
def test_summarize(self, tmp_path, Datetime, regression, cv_regression):
project = Project("<project>", workspace=tmp_path)

project.put("<key1>", regression)
Expand All @@ -344,7 +336,7 @@ def test_reports_metadata(self, tmp_path, Datetime, regression, cv_regression):

assert len(project._Project__artifacts_storage) == 2
assert len(project._Project__metadata_storage) == 3
assert project.reports.metadata() == [
assert project.summarize() == [
{
"id": artifact_ids[0],
"key": "<key1>",
Expand Down Expand Up @@ -404,7 +396,7 @@ def test_reports_metadata(self, tmp_path, Datetime, regression, cv_regression):
},
]

def test_reports_metadata_exception(self, tmp_path, regression):
def test_summarize_exception(self, tmp_path, regression):
import re

project = Project("<project>", workspace=tmp_path)
Expand All @@ -418,7 +410,7 @@ def test_reports_metadata_exception(self, tmp_path, regression):
f"does not exist anymore."
),
):
project.reports.metadata()
project.summarize()

def test_delete(self, tmp_path, binary_classification, regression):
project1 = Project("<project1>", workspace=tmp_path)
Expand Down