Skip to content

README

liblaf.cherries.plugins

Modules:

Classes:

  • Comet

    Send run metadata, parameters, and metrics to Comet.

  • Git

    Record Git metadata and optionally commit dirty experiment outputs.

  • Local

    Copy the entrypoint, logs, and artifacts into .cherries/runs/.

  • Logging

    Initialize Python logging and mirror metrics to the run log.

Comet

Bases: Plugin, PluginProtocol


              flowchart TD
              liblaf.cherries.plugins.Comet[Comet]
              liblaf.cherries.core.plugin._plugin.Plugin[Plugin]
              liblaf.cherries.core._protocol.PluginProtocol[PluginProtocol]
              liblaf.cherries.core.assets._protocol.AssetPluginProtocol[AssetPluginProtocol]
              liblaf.cherries.core.metrics._protocol.MetricPluginProtocol[MetricPluginProtocol]
              liblaf.cherries.core.others._protocol.OtherPluginProtocol[OtherPluginProtocol]
              liblaf.cherries.core.params._protocol.ParamPluginProtocol[ParamPluginProtocol]

                              liblaf.cherries.core.plugin._plugin.Plugin --> liblaf.cherries.plugins.Comet
                
                liblaf.cherries.core._protocol.PluginProtocol --> liblaf.cherries.plugins.Comet
                                liblaf.cherries.core.assets._protocol.AssetPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.metrics._protocol.MetricPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.others._protocol.OtherPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.params._protocol.ParamPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                



              click liblaf.cherries.plugins.Comet href "" "liblaf.cherries.plugins.Comet"
              click liblaf.cherries.core.plugin._plugin.Plugin href "" "liblaf.cherries.core.plugin._plugin.Plugin"
              click liblaf.cherries.core._protocol.PluginProtocol href "" "liblaf.cherries.core._protocol.PluginProtocol"
              click liblaf.cherries.core.assets._protocol.AssetPluginProtocol href "" "liblaf.cherries.core.assets._protocol.AssetPluginProtocol"
              click liblaf.cherries.core.metrics._protocol.MetricPluginProtocol href "" "liblaf.cherries.core.metrics._protocol.MetricPluginProtocol"
              click liblaf.cherries.core.others._protocol.OtherPluginProtocol href "" "liblaf.cherries.core.others._protocol.OtherPluginProtocol"
              click liblaf.cherries.core.params._protocol.ParamPluginProtocol href "" "liblaf.cherries.core.params._protocol.ParamPluginProtocol"
            

Send run metadata, parameters, and metrics to Comet.

Attributes:

Parameters:

  • name (PluginName, default: <dynamic> ) –
  • run (Run) –
  • disabled (bool, default: False ) –

Methods:

  • end

    End the active Comet experiment after Git finalization.

  • log_asset

    Reserve the asset hook for future Comet artifact support.

  • log_metric

    Log one metric to Comet.

  • log_metrics

    Log multiple metrics to Comet.

  • log_other

    Log one metadata value to Comet.

  • log_others

    Log multiple metadata values to Comet.

  • log_param

    Log one parameter to Comet.

  • log_params

    Log multiple parameters to Comet.

  • start

    Start a Comet experiment for the owning run.

disabled class-attribute instance-attribute

disabled: bool = field(default=False)

experiment property

experiment: CometExperiment

Currently running Comet experiment, or a mock fallback.

name class-attribute instance-attribute

name: PluginName = field(
    default=Factory(_default_name, takes_self=True),
    kw_only=True,
)

run class-attribute instance-attribute

run: Run = field(repr=False)

end

end(exc: BaseException | None = None) -> None

End the active Comet experiment after Git finalization.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl(after=("Git",))
def end(self, exc: BaseException | None = None) -> None:
    """End the active Comet experiment after Git finalization."""
    self.experiment.end()

log_asset

log_asset(
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None

Reserve the asset hook for future Comet artifact support.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl
def log_asset(
    self,
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None:
    """Reserve the asset hook for future Comet artifact support."""

log_metric

log_metric(
    name: str, value: float, *, step: int, time: datetime
) -> None

Log one metric to Comet.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl
def log_metric(self, name: str, value: float, *, step: int, time: datetime) -> None:
    """Log one metric to Comet."""
    return self.experiment.log_metric(name, value, step=step)

log_metrics

log_metrics(
    metrics: dict[str, float], *, step: int, time: datetime
) -> None

Log multiple metrics to Comet.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl
def log_metrics(
    self, metrics: dict[str, float], *, step: int, time: datetime
) -> None:
    """Log multiple metrics to Comet."""
    return self.experiment.log_metrics(metrics, step=step)

log_other

log_other(name: str, value: Any) -> None

Log one metadata value to Comet.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl
def log_other(self, name: str, value: Any) -> None:
    """Log one metadata value to Comet."""
    return self.experiment.log_other(name, value)

log_others

log_others(others: dict[str, Any]) -> None

Log multiple metadata values to Comet.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl
def log_others(self, others: dict[str, Any]) -> None:
    """Log multiple metadata values to Comet."""
    return self.experiment.log_others(others)

log_param

log_param(name: str, value: Any) -> None

Log one parameter to Comet.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl
def log_param(self, name: str, value: Any) -> None:
    """Log one parameter to Comet."""
    return self.experiment.log_parameter(name, value)

log_params

log_params(params: dict[str, Any]) -> None

Log multiple parameters to Comet.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl
def log_params(self, params: dict[str, Any]) -> None:
    """Log multiple parameters to Comet."""
    return self.experiment.log_parameters(params)

start

start() -> None

Start a Comet experiment for the owning run.

Source code in src/liblaf/cherries/plugins/comet.py
@override
@core.impl
def start(self) -> None:
    """Start a Comet experiment for the owning run."""
    try:
        exp: comet.CometExperiment = comet.start(
            project_name=self.run.project_name,
            experiment_config=comet.ExperimentConfig(
                disabled=self.disabled, name=self.run.run_name, tags=self.run.tags
            ),
        )
    except ValueError:
        logger.exception("")
    else:
        self.run.log_other("cherries/comet/url", exp.url)

Git

Bases: Plugin, PluginProtocol


              flowchart TD
              liblaf.cherries.plugins.Git[Git]
              liblaf.cherries.core.plugin._plugin.Plugin[Plugin]
              liblaf.cherries.core._protocol.PluginProtocol[PluginProtocol]
              liblaf.cherries.core.assets._protocol.AssetPluginProtocol[AssetPluginProtocol]
              liblaf.cherries.core.metrics._protocol.MetricPluginProtocol[MetricPluginProtocol]
              liblaf.cherries.core.others._protocol.OtherPluginProtocol[OtherPluginProtocol]
              liblaf.cherries.core.params._protocol.ParamPluginProtocol[ParamPluginProtocol]

                              liblaf.cherries.core.plugin._plugin.Plugin --> liblaf.cherries.plugins.Git
                
                liblaf.cherries.core._protocol.PluginProtocol --> liblaf.cherries.plugins.Git
                                liblaf.cherries.core.assets._protocol.AssetPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.metrics._protocol.MetricPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.others._protocol.OtherPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.params._protocol.ParamPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                



              click liblaf.cherries.plugins.Git href "" "liblaf.cherries.plugins.Git"
              click liblaf.cherries.core.plugin._plugin.Plugin href "" "liblaf.cherries.core.plugin._plugin.Plugin"
              click liblaf.cherries.core._protocol.PluginProtocol href "" "liblaf.cherries.core._protocol.PluginProtocol"
              click liblaf.cherries.core.assets._protocol.AssetPluginProtocol href "" "liblaf.cherries.core.assets._protocol.AssetPluginProtocol"
              click liblaf.cherries.core.metrics._protocol.MetricPluginProtocol href "" "liblaf.cherries.core.metrics._protocol.MetricPluginProtocol"
              click liblaf.cherries.core.others._protocol.OtherPluginProtocol href "" "liblaf.cherries.core.others._protocol.OtherPluginProtocol"
              click liblaf.cherries.core.params._protocol.ParamPluginProtocol href "" "liblaf.cherries.core.params._protocol.ParamPluginProtocol"
            

Record Git metadata and optionally commit dirty experiment outputs.

Attributes:

Parameters:

  • name (PluginName, default: <dynamic> ) –
  • run (Run) –
  • commit (bool, default: False ) –
  • verify (bool, default: False ) –

Methods:

  • end

    Commit dirty changes if configured and log the final Git SHA.

  • log_asset

    Record an existing artifact path.

  • log_metric

    Record one metric sample.

  • log_metrics

    Record a batch of already-flattened metric samples.

  • log_other

    Record one flattened metadata value.

  • log_others

    Record multiple already-flattened metadata values.

  • log_param

    Record one flattened parameter value.

  • log_params

    Record multiple already-flattened parameter values.

  • start

    Start a run.

commit class-attribute instance-attribute

commit: bool = field(default=False, kw_only=True)

name class-attribute instance-attribute

name: PluginName = field(
    default=Factory(_default_name, takes_self=True),
    kw_only=True,
)

repo cached property

repo: Repo | None

Repository associated with the owning run.

run class-attribute instance-attribute

run: Run = field(repr=False)

verify class-attribute instance-attribute

verify: bool = field(default=False, kw_only=True)

end

end(exc: BaseException | None = None) -> None

Commit dirty changes if configured and log the final Git SHA.

Source code in src/liblaf/cherries/plugins/git.py
@override
@core.impl(before=("Comet",))
def end(self, exc: BaseException | None = None) -> None:
    """Commit dirty changes if configured and log the final Git SHA."""
    if self.repo is None:
        return
    if self.commit and self.repo.is_dirty(untracked_files=True):
        message: str = self._make_commit_message()
        try:
            self.repo.git.add(all=True)
            subprocess.run(["git", "status"], check=False)
            self.repo.git.commit(message=message, no_verify=not self.verify)
        except git.GitCommandError:
            logger.exception("")
    self.run.log_other("cherries/git/sha", self.repo.head.commit.hexsha)

log_asset

log_asset(
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None

Record an existing artifact path.

Parameters:

  • path (Path) –

    Existing file or directory to record.

  • metadata (Mapping[str, Any] | None, default: None ) –

    Optional artifact metadata, usually including type.

  • report (bool, default: True ) –

    Whether the path is the primary user-facing artifact. Companion files are logged with report=False.

Source code in src/liblaf/cherries/core/assets/_protocol.py
def log_asset(
    self,
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None:
    """Record an existing artifact path.

    Args:
        path: Existing file or directory to record.
        metadata: Optional artifact metadata, usually including `type`.
        report: Whether the path is the primary user-facing artifact.
            Companion files are logged with `report=False`.
    """
    ...

log_metric

log_metric(
    name: str, value: float, *, step: int, time: datetime
) -> None

Record one metric sample.

Source code in src/liblaf/cherries/core/metrics/_protocol.py
def log_metric(
    self, name: str, value: float, *, step: int, time: datetime.datetime
) -> None:
    """Record one metric sample."""
    ...

log_metrics

log_metrics(
    metrics: dict[str, float], *, step: int, time: datetime
) -> None

Record a batch of already-flattened metric samples.

Source code in src/liblaf/cherries/core/metrics/_protocol.py
def log_metrics(
    self, metrics: dict[str, float], *, step: int, time: datetime.datetime
) -> None:
    """Record a batch of already-flattened metric samples."""
    ...

log_other

log_other(name: str, value: Any) -> None

Record one flattened metadata value.

Source code in src/liblaf/cherries/core/others/_protocol.py
7
8
9
def log_other(self, name: str, value: Any) -> None:
    """Record one flattened metadata value."""
    ...

log_others

log_others(others: dict[str, Any]) -> None

Record multiple already-flattened metadata values.

Source code in src/liblaf/cherries/core/others/_protocol.py
def log_others(self, others: dict[str, Any]) -> None:
    """Record multiple already-flattened metadata values."""
    ...

log_param

log_param(name: str, value: Any) -> None

Record one flattened parameter value.

Source code in src/liblaf/cherries/core/params/_protocol.py
7
8
9
def log_param(self, name: str, value: Any) -> None:
    """Record one flattened parameter value."""
    ...

log_params

log_params(params: dict[str, Any]) -> None

Record multiple already-flattened parameter values.

Source code in src/liblaf/cherries/core/params/_protocol.py
def log_params(self, params: dict[str, Any]) -> None:
    """Record multiple already-flattened parameter values."""
    ...

start

start() -> None

Start a run.

Source code in src/liblaf/cherries/core/_protocol.py
def start(self) -> None:
    """Start a run."""
    raise NotImplementedError

Local

Bases: Plugin, PluginProtocol


              flowchart TD
              liblaf.cherries.plugins.Local[Local]
              liblaf.cherries.core.plugin._plugin.Plugin[Plugin]
              liblaf.cherries.core._protocol.PluginProtocol[PluginProtocol]
              liblaf.cherries.core.assets._protocol.AssetPluginProtocol[AssetPluginProtocol]
              liblaf.cherries.core.metrics._protocol.MetricPluginProtocol[MetricPluginProtocol]
              liblaf.cherries.core.others._protocol.OtherPluginProtocol[OtherPluginProtocol]
              liblaf.cherries.core.params._protocol.ParamPluginProtocol[ParamPluginProtocol]

                              liblaf.cherries.core.plugin._plugin.Plugin --> liblaf.cherries.plugins.Local
                
                liblaf.cherries.core._protocol.PluginProtocol --> liblaf.cherries.plugins.Local
                                liblaf.cherries.core.assets._protocol.AssetPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.metrics._protocol.MetricPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.others._protocol.OtherPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.params._protocol.ParamPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                



              click liblaf.cherries.plugins.Local href "" "liblaf.cherries.plugins.Local"
              click liblaf.cherries.core.plugin._plugin.Plugin href "" "liblaf.cherries.core.plugin._plugin.Plugin"
              click liblaf.cherries.core._protocol.PluginProtocol href "" "liblaf.cherries.core._protocol.PluginProtocol"
              click liblaf.cherries.core.assets._protocol.AssetPluginProtocol href "" "liblaf.cherries.core.assets._protocol.AssetPluginProtocol"
              click liblaf.cherries.core.metrics._protocol.MetricPluginProtocol href "" "liblaf.cherries.core.metrics._protocol.MetricPluginProtocol"
              click liblaf.cherries.core.others._protocol.OtherPluginProtocol href "" "liblaf.cherries.core.others._protocol.OtherPluginProtocol"
              click liblaf.cherries.core.params._protocol.ParamPluginProtocol href "" "liblaf.cherries.core.params._protocol.ParamPluginProtocol"
            

Copy the entrypoint, logs, and artifacts into .cherries/runs/.

Attributes:

Parameters:

  • name (PluginName, default: <dynamic> ) –
  • run (Run) –

Methods:

  • end

    End a run.

  • log_asset

    Copy path under the snapshot's assets/ directory.

  • log_metric

    Record one metric sample.

  • log_metrics

    Record a batch of already-flattened metric samples.

  • log_other

    Record one flattened metadata value.

  • log_others

    Record multiple already-flattened metadata values.

  • log_param

    Record one flattened parameter value.

  • log_params

    Record multiple already-flattened parameter values.

  • start

    Configure local logging and copy the entrypoint.

folder cached property

folder: Path

Snapshot directory for this run.

log_file property

log_file: Path

Log file inside the local snapshot.

name class-attribute instance-attribute

name: PluginName = field(
    default=Factory(_default_name, takes_self=True),
    kw_only=True,
)

run class-attribute instance-attribute

run: Run = field(repr=False)

end

end(exc: BaseException | None = None) -> None

End a run.

Parameters:

  • exc (BaseException | None, default: None ) –

    Exception raised by the experiment, if any.

Source code in src/liblaf/cherries/core/_protocol.py
def end(self, exc: BaseException | None = None) -> None:
    """End a run.

    Args:
        exc: Exception raised by the experiment, if any.
    """
    raise NotImplementedError

log_asset

log_asset(
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None

Copy path under the snapshot's assets/ directory.

Source code in src/liblaf/cherries/plugins/local.py
@override
@core.impl
def log_asset(
    self,
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None:
    """Copy `path` under the snapshot's `assets/` directory."""
    if path.is_relative_to(self.run.working_dir):
        target: Path = self.folder / path.relative_to(self.run.working_dir)
    else:
        target: Path = self.folder / "assets" / path.name
    self._copy(path, target)

log_metric

log_metric(
    name: str, value: float, *, step: int, time: datetime
) -> None

Record one metric sample.

Source code in src/liblaf/cherries/core/metrics/_protocol.py
def log_metric(
    self, name: str, value: float, *, step: int, time: datetime.datetime
) -> None:
    """Record one metric sample."""
    ...

log_metrics

log_metrics(
    metrics: dict[str, float], *, step: int, time: datetime
) -> None

Record a batch of already-flattened metric samples.

Source code in src/liblaf/cherries/core/metrics/_protocol.py
def log_metrics(
    self, metrics: dict[str, float], *, step: int, time: datetime.datetime
) -> None:
    """Record a batch of already-flattened metric samples."""
    ...

log_other

log_other(name: str, value: Any) -> None

Record one flattened metadata value.

Source code in src/liblaf/cherries/core/others/_protocol.py
7
8
9
def log_other(self, name: str, value: Any) -> None:
    """Record one flattened metadata value."""
    ...

log_others

log_others(others: dict[str, Any]) -> None

Record multiple already-flattened metadata values.

Source code in src/liblaf/cherries/core/others/_protocol.py
def log_others(self, others: dict[str, Any]) -> None:
    """Record multiple already-flattened metadata values."""
    ...

log_param

log_param(name: str, value: Any) -> None

Record one flattened parameter value.

Source code in src/liblaf/cherries/core/params/_protocol.py
7
8
9
def log_param(self, name: str, value: Any) -> None:
    """Record one flattened parameter value."""
    ...

log_params

log_params(params: dict[str, Any]) -> None

Record multiple already-flattened parameter values.

Source code in src/liblaf/cherries/core/params/_protocol.py
def log_params(self, params: dict[str, Any]) -> None:
    """Record multiple already-flattened parameter values."""
    ...

start

start() -> None

Configure local logging and copy the entrypoint.

Source code in src/liblaf/cherries/plugins/local.py
@override
@core.impl
def start(self) -> None:
    """Configure local logging and copy the entrypoint."""
    self._config_logging()
    self._copy(self.run.entrypoint, self.folder / "src" / self.run.entrypoint.name)

Logging

Bases: Plugin, PluginProtocol


              flowchart TD
              liblaf.cherries.plugins.Logging[Logging]
              liblaf.cherries.core.plugin._plugin.Plugin[Plugin]
              liblaf.cherries.core._protocol.PluginProtocol[PluginProtocol]
              liblaf.cherries.core.assets._protocol.AssetPluginProtocol[AssetPluginProtocol]
              liblaf.cherries.core.metrics._protocol.MetricPluginProtocol[MetricPluginProtocol]
              liblaf.cherries.core.others._protocol.OtherPluginProtocol[OtherPluginProtocol]
              liblaf.cherries.core.params._protocol.ParamPluginProtocol[ParamPluginProtocol]

                              liblaf.cherries.core.plugin._plugin.Plugin --> liblaf.cherries.plugins.Logging
                
                liblaf.cherries.core._protocol.PluginProtocol --> liblaf.cherries.plugins.Logging
                                liblaf.cherries.core.assets._protocol.AssetPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.metrics._protocol.MetricPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.others._protocol.OtherPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                
                liblaf.cherries.core.params._protocol.ParamPluginProtocol --> liblaf.cherries.core._protocol.PluginProtocol
                



              click liblaf.cherries.plugins.Logging href "" "liblaf.cherries.plugins.Logging"
              click liblaf.cherries.core.plugin._plugin.Plugin href "" "liblaf.cherries.core.plugin._plugin.Plugin"
              click liblaf.cherries.core._protocol.PluginProtocol href "" "liblaf.cherries.core._protocol.PluginProtocol"
              click liblaf.cherries.core.assets._protocol.AssetPluginProtocol href "" "liblaf.cherries.core.assets._protocol.AssetPluginProtocol"
              click liblaf.cherries.core.metrics._protocol.MetricPluginProtocol href "" "liblaf.cherries.core.metrics._protocol.MetricPluginProtocol"
              click liblaf.cherries.core.others._protocol.OtherPluginProtocol href "" "liblaf.cherries.core.others._protocol.OtherPluginProtocol"
              click liblaf.cherries.core.params._protocol.ParamPluginProtocol href "" "liblaf.cherries.core.params._protocol.ParamPluginProtocol"
            

Initialize Python logging and mirror metrics to the run log.

Attributes:

Parameters:

  • name (PluginName, default: <dynamic> ) –
  • run (Run) –

Methods:

  • end

    End a run.

  • log_asset

    Record an existing artifact path.

  • log_metric

    Write one metric to the Python logger.

  • log_metrics

    Write multiple metrics to the Python logger.

  • log_other

    Record one flattened metadata value.

  • log_others

    Record multiple already-flattened metadata values.

  • log_param

    Record one flattened parameter value.

  • log_params

    Record multiple already-flattened parameter values.

  • start

    Initialize liblaf.logging for the run log file.

log_file cached property

log_file: Path

Default log file below the run working directory.

name class-attribute instance-attribute

name: PluginName = field(
    default=Factory(_default_name, takes_self=True),
    kw_only=True,
)

run class-attribute instance-attribute

run: Run = field(repr=False)

end

end(exc: BaseException | None = None) -> None

End a run.

Parameters:

  • exc (BaseException | None, default: None ) –

    Exception raised by the experiment, if any.

Source code in src/liblaf/cherries/core/_protocol.py
def end(self, exc: BaseException | None = None) -> None:
    """End a run.

    Args:
        exc: Exception raised by the experiment, if any.
    """
    raise NotImplementedError

log_asset

log_asset(
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None

Record an existing artifact path.

Parameters:

  • path (Path) –

    Existing file or directory to record.

  • metadata (Mapping[str, Any] | None, default: None ) –

    Optional artifact metadata, usually including type.

  • report (bool, default: True ) –

    Whether the path is the primary user-facing artifact. Companion files are logged with report=False.

Source code in src/liblaf/cherries/core/assets/_protocol.py
def log_asset(
    self,
    path: Path,
    *,
    metadata: Mapping[str, Any] | None = None,
    report: bool = True,
) -> None:
    """Record an existing artifact path.

    Args:
        path: Existing file or directory to record.
        metadata: Optional artifact metadata, usually including `type`.
        report: Whether the path is the primary user-facing artifact.
            Companion files are logged with `report=False`.
    """
    ...

log_metric

log_metric(
    name: str, value: float, *, step: int, time: datetime
) -> None

Write one metric to the Python logger.

Source code in src/liblaf/cherries/plugins/logging.py
@override
@core.impl
def log_metric(self, name: str, value: float, *, step: int, time: datetime) -> None:
    """Write one metric to the Python logger."""
    logger.info("step: %s, %s: %s", step, name, value)

log_metrics

log_metrics(
    metrics: Mapping[str, float],
    *,
    step: int,
    time: datetime,
) -> None

Write multiple metrics to the Python logger.

Source code in src/liblaf/cherries/plugins/logging.py
@override
@core.impl
def log_metrics(
    self, metrics: Mapping[str, float], *, step: int, time: datetime
) -> None:
    """Write multiple metrics to the Python logger."""
    logger.info("step: %s, %s", step, metrics)

log_other

log_other(name: str, value: Any) -> None

Record one flattened metadata value.

Source code in src/liblaf/cherries/core/others/_protocol.py
7
8
9
def log_other(self, name: str, value: Any) -> None:
    """Record one flattened metadata value."""
    ...

log_others

log_others(others: dict[str, Any]) -> None

Record multiple already-flattened metadata values.

Source code in src/liblaf/cherries/core/others/_protocol.py
def log_others(self, others: dict[str, Any]) -> None:
    """Record multiple already-flattened metadata values."""
    ...

log_param

log_param(name: str, value: Any) -> None

Record one flattened parameter value.

Source code in src/liblaf/cherries/core/params/_protocol.py
7
8
9
def log_param(self, name: str, value: Any) -> None:
    """Record one flattened parameter value."""
    ...

log_params

log_params(params: dict[str, Any]) -> None

Record multiple already-flattened parameter values.

Source code in src/liblaf/cherries/core/params/_protocol.py
def log_params(self, params: dict[str, Any]) -> None:
    """Record multiple already-flattened parameter values."""
    ...

start

start(*args, **kwargs) -> None

Initialize liblaf.logging for the run log file.

Source code in src/liblaf/cherries/plugins/logging.py
@override
@core.impl
def start(self, *args, **kwargs) -> None:
    """Initialize `liblaf.logging` for the run log file."""
    liblaf.logging.init(file=self.log_file, force=True)