Skip to content

liblaf.cherries.plugins.git_ ¤

Classes:

Attributes:

logger module-attribute ¤

logger: Logger = getLogger(__name__)

Git ¤

Bases: PluginSchema


              flowchart TD
              liblaf.cherries.plugins.git_.Git[Git]
              liblaf.cherries.core._plugin_schema.PluginSchema[PluginSchema]
              liblaf.cherries.core._plugin.Plugin[Plugin]

                              liblaf.cherries.core._plugin_schema.PluginSchema --> liblaf.cherries.plugins.git_.Git
                                liblaf.cherries.core._plugin.Plugin --> liblaf.cherries.core._plugin_schema.PluginSchema
                



              click liblaf.cherries.plugins.git_.Git href "" "liblaf.cherries.plugins.git_.Git"
              click liblaf.cherries.core._plugin_schema.PluginSchema href "" "liblaf.cherries.core._plugin_schema.PluginSchema"
              click liblaf.cherries.core._plugin.Plugin href "" "liblaf.cherries.core._plugin.Plugin"
            

Parameters:

  • id ¤

    (PluginId, default: <dynamic> ) –
  • commit ¤

    (bool, default: False ) –
  • inputs ¤

    (list[Path], default: <dynamic> ) –

    Built-in mutable sequence.

    If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

  • outputs ¤

    (list[Path], default: <dynamic> ) –

    Built-in mutable sequence.

    If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

  • repo ¤

    (Repo, default: None ) –
  • temps ¤

    (list[Path], default: <dynamic> ) –

    Built-in mutable sequence.

    If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

  • verify ¤

    (bool, default: False ) –

Attributes:

Methods:

commit class-attribute instance-attribute ¤

commit: bool = False

id class-attribute instance-attribute ¤

id: PluginId = field(
    default=Factory(_default_id, takes_self=True),
    kw_only=True,
)

inputs class-attribute instance-attribute ¤

inputs: list[Path] = field(factory=list)

manager class-attribute instance-attribute ¤

manager: PluginManager = field(
    default=None, repr=False, init=False, kw_only=True
)

outputs class-attribute instance-attribute ¤

outputs: list[Path] = field(factory=list)

repo class-attribute instance-attribute ¤

repo: Repo = field(default=None)

run property ¤

run: Run

temps class-attribute instance-attribute ¤

temps: list[Path] = field(factory=list)

verify class-attribute instance-attribute ¤

verify: bool = False

end ¤

end(*args, **kwargs) -> None
Source code in src/liblaf/cherries/plugins/git_.py
26
27
28
29
30
31
32
33
34
35
36
37
@override
@core.impl(before=("Comet",))
def end(self, *args, **kwargs) -> None:
    if self.commit and self.repo.is_dirty(untracked_files=True):
        try:
            self.repo.git.add(all=True)
            subprocess.run(["git", "status"], check=False)
            message: str = self._make_commit_message()
            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)

get_other ¤

get_other(name: str) -> Any
Source code in src/liblaf/cherries/core/_plugin_schema.py
24
25
def get_other(self, name: str) -> Any:
    raise NotImplementedError

get_others ¤

get_others() -> Mapping[str, Any]
Source code in src/liblaf/cherries/core/_plugin_schema.py
27
28
def get_others(self) -> Mapping[str, Any]:
    raise NotImplementedError

get_param ¤

get_param(name: str) -> Any
Source code in src/liblaf/cherries/core/_plugin_schema.py
30
31
def get_param(self, name: str) -> Any:
    raise NotImplementedError

get_params ¤

get_params() -> Mapping[str, Any]
Source code in src/liblaf/cherries/core/_plugin_schema.py
33
34
def get_params(self) -> Mapping[str, Any]:
    raise NotImplementedError

get_step ¤

get_step() -> int | None
Source code in src/liblaf/cherries/core/_plugin_schema.py
36
37
def get_step(self) -> int | None:
    raise NotImplementedError

get_url ¤

get_url() -> str
Source code in src/liblaf/cherries/core/_plugin_schema.py
39
40
def get_url(self) -> str:
    raise NotImplementedError

log_asset ¤

log_asset(
    path: Path,
    name: Path,
    *,
    bundle: bool = False,
    **kwargs,
) -> None
Source code in src/liblaf/cherries/core/_plugin_schema.py
42
43
44
45
def log_asset(
    self, path: Path, name: Path, *, bundle: bool = False, **kwargs
) -> None:
    raise NotImplementedError

log_input ¤

log_input(
    path: Path,
    name: Path,
    *,
    bundle: bool = False,
    **kwargs,
) -> None
Source code in src/liblaf/cherries/plugins/git_.py
39
40
41
42
43
44
45
46
@override
@core.impl
def log_input(
    self, path: Path, name: Path, *, bundle: bool = False, **kwargs
) -> None:
    if bundle:
        return
    self.inputs.append(self._relative_to_repo(path))

log_metric ¤

log_metric(
    name: str, value: Any, step: int | None = None, **kwargs
) -> None
Source code in src/liblaf/cherries/core/_plugin_schema.py
52
53
54
55
def log_metric(
    self, name: str, value: Any, step: int | None = None, **kwargs
) -> None:
    raise NotImplementedError

log_metrics ¤

log_metrics(
    metrics: Mapping[str, Any],
    step: int | None = None,
    **kwargs,
) -> None
Source code in src/liblaf/cherries/core/_plugin_schema.py
57
58
59
60
def log_metrics(
    self, metrics: Mapping[str, Any], step: int | None = None, **kwargs
) -> None:
    raise NotImplementedError

log_other ¤

log_other(name: str, value: Any) -> None
Source code in src/liblaf/cherries/core/_plugin_schema.py
62
63
def log_other(self, name: str, value: Any) -> None:
    raise NotImplementedError

log_others ¤

log_others(others: Mapping[str, Any]) -> None
Source code in src/liblaf/cherries/core/_plugin_schema.py
65
66
def log_others(self, others: Mapping[str, Any]) -> None:
    raise NotImplementedError

log_output ¤

log_output(
    path: Path,
    name: Path,
    *,
    bundle: bool = False,
    **kwargs,
) -> None
Source code in src/liblaf/cherries/plugins/git_.py
48
49
50
51
52
53
54
55
@override
@core.impl
def log_output(
    self, path: Path, name: Path, *, bundle: bool = False, **kwargs
) -> None:
    if bundle:
        return
    self.outputs.append(self._relative_to_repo(path))

log_param ¤

log_param(name: str, value: Any) -> None
Source code in src/liblaf/cherries/core/_plugin_schema.py
73
74
def log_param(self, name: str, value: Any) -> None:
    raise NotImplementedError

log_params ¤

log_params(params: Mapping[str, Any]) -> None
Source code in src/liblaf/cherries/core/_plugin_schema.py
76
77
def log_params(self, params: Mapping[str, Any]) -> None:
    raise NotImplementedError

log_temp ¤

log_temp(
    path: Path,
    name: Path,
    *,
    bundle: bool = False,
    **kwargs,
) -> None
Source code in src/liblaf/cherries/plugins/git_.py
57
58
59
60
61
62
63
64
@override
@core.impl
def log_temp(
    self, path: Path, name: Path, *, bundle: bool = False, **kwargs
) -> None:
    if bundle:
        return
    self.temps.append(self._relative_to_repo(path))

set_step ¤

set_step(step: int | None = None) -> None
Source code in src/liblaf/cherries/core/_plugin_schema.py
84
85
def set_step(self, step: int | None = None) -> None:
    raise NotImplementedError

start ¤

start(*args, **kwargs) -> None
Source code in src/liblaf/cherries/plugins/git_.py
66
67
68
69
@override
@core.impl
def start(self, *args, **kwargs) -> None:
    self.repo = git.Repo(search_parent_directories=True)