Skip to content

Commit 5cacfc4

Browse files
authored
docs: Document the skore.project.metadata.Metadata class (#1754)
Right now, we don't document `skore.project.metadata.Metadata`. In short, it means that no one is aware of the API of the output of `project.reports.metadata()` and what to do with it. I avoid to list the inherited methods from the pandas dataframe since the import in this case would not work. Instead I modify the documentation to refer to the original documentation in the docstring.
1 parent e732266 commit 5cacfc4

File tree

3 files changed

+46
-15
lines changed

3 files changed

+46
-15
lines changed

skore/src/skore/project/metadata.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,21 @@ class Metadata(DataFrame):
1818
"""
1919
Metadata and metrics for all reports persisted in a project at a given moment.
2020
21-
A metadata object is an extended ``pandas.DataFrame``, containing all the metadata
22-
and metrics of the reports that have been persisted in a project. It implements a
23-
custom HTML representation, that allows user to filter its reports using a parallel
24-
coordinates plot. In a Jupyter Notebook, this representation automatically replaces
25-
the standard ``pandas.DataFrame`` one and displays an interactive plot.
21+
A metadata object is an extended :class:`pandas.DataFrame`, containing all the
22+
metadata and metrics of the reports that have been persisted in a project. It
23+
implements a custom HTML representation, that allows user to filter its reports
24+
using a parallel coordinates plot. In a Jupyter Notebook, this representation
25+
automatically replaces the standard :class:`pandas.DataFrame` one and displays an
26+
interactive plot.
2627
2728
The parallel coordinates plot is interactive, such the user can select a filter path
2829
and retrieve the corresponding reports.
2930
3031
Outside a Jupyter Notebook, the metadata object can be used as a standard
31-
``pandas.DataFrame`` object. This means that it can be questioned, divided etc.,
32-
using the standard ``pandas.DataFrame`` functions.
32+
:class:`pandas.DataFrame` object. This means that it can be questioned, divided
33+
etc., using the standard :class:`pandas.DataFrame` functions.
3334
34-
Methods
35-
-------
36-
reports(filter=True) -> list[skore.sklearn.EstimatorReport]
37-
Return the reports referenced by the metadata object from the project.
38-
If a query string selection exists, it will be automatically applied before, to
39-
filter the reports to return. Otherwise, returns all reports.
35+
Refer to :class:`pandas.DataFrame` for the standard methods and attributes.
4036
"""
4137

4238
_metadata = ["project"]
@@ -54,7 +50,7 @@ def factory(project, /):
5450
Notes
5551
-----
5652
This function is not intended for direct use. Instead simply use the accessor
57-
``skore.Project.reports.metadata``.
53+
:meth:`skore.Project.reports.metadata`.
5854
"""
5955
metadata = DataFrame(project.reports.metadata(), copy=False)
6056

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{ objname | escape | underline(line="=") }}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autoclass:: {{ objname }}
6+
:members:
7+
:no-inherited-members:
8+
:special-members: __call__

sphinx/reference/project.rst

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ Managing a project
33

44
.. currentmodule:: skore
55

6-
These functions and classes are meant for managing a Project and its reports.
6+
Skore project
7+
^^^^^^^^^^^^^
8+
9+
These functions and classes are meant for managing a `Project` and its reports.
710

811
.. autosummary::
912
:toctree: api/
@@ -33,3 +36,27 @@ These functions and classes are meant for managing a Project and its reports.
3336

3437
Project.reports.get
3538
Project.reports.metadata
39+
40+
Skore project's metadata
41+
^^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
When calling :meth:`Project.reports.metadata`, a
44+
:class:`~skore.project.metadata.Metadata` object is returned. This object is a
45+
:class:`pandas.DataFrame` with a specific HTML representation to allow you filter and
46+
retrieve the reports.
47+
48+
.. autosummary::
49+
:toctree: api/
50+
:template: class_without_inherited_members.rst
51+
52+
project.metadata.Metadata
53+
54+
.. autosummary::
55+
:toctree: api/
56+
:template: class_methods_no_index.rst
57+
58+
project.metadata.Metadata.reports
59+
60+
.. note::
61+
This class :class:`~skore.project.metadata.Metadata` is not meant to be used
62+
directly. Instead, use the accessor :meth:`Project.reports.metadata`.

0 commit comments

Comments
 (0)