liblaf-cherries 0.0.14__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- liblaf/cherries/__init__.pyi +71 -44
- liblaf/cherries/_run.py +38 -26
- liblaf/cherries/_version.py +2 -2
- liblaf/cherries/config/__init__.pyi +23 -0
- liblaf/cherries/config/_asset.py +72 -0
- liblaf/cherries/config/_config.py +6 -0
- liblaf/cherries/integration/__init__.pyi +66 -0
- liblaf/cherries/integration/_abc.py +144 -0
- liblaf/cherries/integration/_exp.py +97 -0
- liblaf/cherries/integration/comet.py +142 -0
- liblaf/cherries/integration/dvc.py +51 -0
- liblaf/cherries/integration/git.py +44 -0
- liblaf/cherries/integration/logging.py +45 -0
- liblaf/cherries/meta/__init__.py +3 -0
- liblaf/cherries/{info → meta}/__init__.pyi +2 -2
- liblaf/cherries/meta/_name.py +25 -0
- liblaf/cherries/pathutils/__init__.pyi +2 -2
- liblaf/cherries/pathutils/_convert.py +0 -4
- liblaf/cherries/pathutils/_path.py +6 -6
- liblaf/cherries/pathutils/_special.py +2 -2
- liblaf/cherries/presets/__init__.pyi +3 -1
- liblaf/cherries/presets/_default.py +37 -23
- liblaf/cherries/presets/_playground.py +11 -0
- liblaf/cherries/presets/typed.py +5 -0
- {liblaf_cherries-0.0.14.dist-info → liblaf_cherries-0.1.1.dist-info}/METADATA +5 -5
- liblaf_cherries-0.1.1.dist-info/RECORD +40 -0
- liblaf/cherries/_config.py +0 -22
- liblaf/cherries/info/_name.py +0 -30
- liblaf/cherries/plugin/__init__.pyi +0 -77
- liblaf/cherries/plugin/_abc.py +0 -131
- liblaf/cherries/plugin/_dvc.py +0 -63
- liblaf/cherries/plugin/_git.py +0 -46
- liblaf/cherries/plugin/_logging.py +0 -31
- liblaf/cherries/plugin/_mlflow.py +0 -88
- liblaf/cherries/plugin/_run.py +0 -105
- liblaf_cherries-0.0.14.dist-info/RECORD +0 -35
- /liblaf/cherries/{info → config}/__init__.py +0 -0
- /liblaf/cherries/{plugin → integration}/__init__.py +0 -0
- /liblaf/cherries/{info → meta}/_git.py +0 -0
- {liblaf_cherries-0.0.14.dist-info → liblaf_cherries-0.1.1.dist-info}/WHEEL +0 -0
- {liblaf_cherries-0.0.14.dist-info → liblaf_cherries-0.1.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,142 @@
|
|
1
|
+
from collections.abc import Iterable, Mapping
|
2
|
+
from pathlib import Path
|
3
|
+
from typing import Any, override
|
4
|
+
from unittest import mock
|
5
|
+
|
6
|
+
import attrs
|
7
|
+
import comet_ml as comet
|
8
|
+
from loguru import logger
|
9
|
+
|
10
|
+
from liblaf.cherries import meta
|
11
|
+
from liblaf.cherries.typed import PathLike
|
12
|
+
|
13
|
+
from . import _abc
|
14
|
+
|
15
|
+
|
16
|
+
class Comet:
|
17
|
+
@property
|
18
|
+
def exp(self) -> comet.CometExperiment:
|
19
|
+
exp: comet.CometExperiment | None = comet.get_running_experiment()
|
20
|
+
if exp is None:
|
21
|
+
exp = mock.MagicMock()
|
22
|
+
return exp
|
23
|
+
|
24
|
+
|
25
|
+
@attrs.define
|
26
|
+
class AddTag(Comet, _abc.AddTag):
|
27
|
+
@override
|
28
|
+
def __call__(self, tag: str, **kwargs) -> None:
|
29
|
+
self.exp.add_tag(tag)
|
30
|
+
|
31
|
+
|
32
|
+
@attrs.define
|
33
|
+
class AddTags(Comet, _abc.AddTags):
|
34
|
+
@override
|
35
|
+
def __call__(self, tags: Iterable[str], **kwargs) -> None:
|
36
|
+
self.exp.add_tags(list(tags))
|
37
|
+
|
38
|
+
|
39
|
+
@attrs.define
|
40
|
+
class End(Comet, _abc.End):
|
41
|
+
@override
|
42
|
+
def __call__(self, **kwargs) -> None:
|
43
|
+
comet.end()
|
44
|
+
|
45
|
+
|
46
|
+
@attrs.define
|
47
|
+
class LogAsset(Comet, _abc.LogAsset):
|
48
|
+
@override
|
49
|
+
def __call__(self, path: PathLike, prefix: str | None = None, **kwargs) -> None:
|
50
|
+
path = Path(path)
|
51
|
+
if (dvc_path := path.with_name(path.name + ".dvc")).exists():
|
52
|
+
path = dvc_path
|
53
|
+
if path.is_file():
|
54
|
+
filename: str | None = f"{prefix}/{path.name}" if prefix else None
|
55
|
+
self.exp.log_asset(path, file_name=filename, **kwargs)
|
56
|
+
elif path.is_dir():
|
57
|
+
self.exp.log_asset_folder(str(path), **kwargs)
|
58
|
+
else:
|
59
|
+
logger.warning("Neither file nor directory: {}", path)
|
60
|
+
|
61
|
+
|
62
|
+
@attrs.define
|
63
|
+
class LogCode(Comet, _abc.LogCode):
|
64
|
+
@override
|
65
|
+
def __call__(self, path: PathLike, **kwargs) -> None:
|
66
|
+
path = Path(path)
|
67
|
+
if path.is_file():
|
68
|
+
self.exp.log_code(str(path), **kwargs)
|
69
|
+
elif path.is_dir():
|
70
|
+
self.exp.log_code(folder=str(path), **kwargs)
|
71
|
+
else:
|
72
|
+
logger.warning("Neither file nor directory: {}", path)
|
73
|
+
|
74
|
+
|
75
|
+
@attrs.define
|
76
|
+
class LogMetric(Comet, _abc.LogMetric):
|
77
|
+
@override
|
78
|
+
def __call__(
|
79
|
+
self,
|
80
|
+
name: str,
|
81
|
+
value: float,
|
82
|
+
step: int | None = None,
|
83
|
+
epoch: int | None = None,
|
84
|
+
**kwargs,
|
85
|
+
) -> None:
|
86
|
+
self.exp.log_metric(name, value, step=step, epoch=epoch)
|
87
|
+
|
88
|
+
|
89
|
+
@attrs.define
|
90
|
+
class LogMetrics(Comet, _abc.LogMetrics):
|
91
|
+
@override
|
92
|
+
def __call__(
|
93
|
+
self,
|
94
|
+
metrics: Mapping[str, Any],
|
95
|
+
step: int | None = None,
|
96
|
+
epoch: int | None = None,
|
97
|
+
**kwargs,
|
98
|
+
) -> None:
|
99
|
+
self.exp.log_metrics(metrics, step=step, epoch=epoch) # pyright: ignore[reportArgumentType]
|
100
|
+
|
101
|
+
|
102
|
+
@attrs.define
|
103
|
+
class LogOther(Comet, _abc.LogOther):
|
104
|
+
@override
|
105
|
+
def __call__(self, key: str, value: Any, **kwargs) -> None:
|
106
|
+
self.exp.log_other(key, value)
|
107
|
+
|
108
|
+
|
109
|
+
@attrs.define
|
110
|
+
class LogOthers(Comet, _abc.LogOthers):
|
111
|
+
@override
|
112
|
+
def __call__(self, others: Mapping[str, Any], **kwargs) -> None:
|
113
|
+
self.exp.log_others(others) # pyright: ignore[reportArgumentType]
|
114
|
+
|
115
|
+
|
116
|
+
@attrs.define
|
117
|
+
class LogParam(Comet, _abc.LogParam):
|
118
|
+
@override
|
119
|
+
def __call__(self, name: str, value: Any, **kwargs) -> None:
|
120
|
+
self.exp.log_parameter(name, value)
|
121
|
+
|
122
|
+
|
123
|
+
@attrs.define
|
124
|
+
class LogParams(Comet, _abc.LogParams):
|
125
|
+
@override
|
126
|
+
def __call__(self, params: Any, **kwargs: Any) -> None:
|
127
|
+
self.exp.log_parameters(params)
|
128
|
+
|
129
|
+
|
130
|
+
@attrs.define
|
131
|
+
class Start(Comet, _abc.Start):
|
132
|
+
text: bool = True
|
133
|
+
jsonl: bool = False
|
134
|
+
|
135
|
+
@override
|
136
|
+
def __call__(self, **kwargs) -> None:
|
137
|
+
comet.start(
|
138
|
+
project_name=meta.project_name(),
|
139
|
+
experiment_config=comet.ExperimentConfig(
|
140
|
+
auto_output_logging="native", name=meta.exp_name()
|
141
|
+
),
|
142
|
+
)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import subprocess as sp
|
2
|
+
from pathlib import Path
|
3
|
+
from typing import override
|
4
|
+
|
5
|
+
import attrs
|
6
|
+
import git
|
7
|
+
import git.exc
|
8
|
+
|
9
|
+
from liblaf.cherries import pathutils as _path
|
10
|
+
from liblaf.cherries.typed import PathLike
|
11
|
+
|
12
|
+
from . import _abc
|
13
|
+
|
14
|
+
|
15
|
+
@attrs.define
|
16
|
+
class End(_abc.End):
|
17
|
+
priority: int = attrs.field(default=-2, kw_only=True) # after logging
|
18
|
+
|
19
|
+
@override
|
20
|
+
def __call__(self, **kwargs) -> None:
|
21
|
+
sp.run(["dvc", "status"], check=True)
|
22
|
+
sp.run(["dvc", "push"], check=True)
|
23
|
+
|
24
|
+
|
25
|
+
@attrs.define
|
26
|
+
class LogAsset(_abc.LogAsset):
|
27
|
+
priority: int = attrs.field(default=-1, kw_only=True) # before Comet
|
28
|
+
|
29
|
+
@override
|
30
|
+
def __call__(self, path: PathLike, prefix: str | None = None, **kwargs) -> None:
|
31
|
+
path: Path = _path.as_path(path)
|
32
|
+
if check_ignore(path) or tracked_by_git(path):
|
33
|
+
return
|
34
|
+
sp.run(["dvc", "add", "--quiet", path], check=True)
|
35
|
+
|
36
|
+
|
37
|
+
def check_ignore(path: PathLike) -> bool:
|
38
|
+
proc: sp.CompletedProcess[bytes] = sp.run(
|
39
|
+
["dvc", "check-ignore", "--quiet", path], check=False
|
40
|
+
)
|
41
|
+
return proc.returncode == 0
|
42
|
+
|
43
|
+
|
44
|
+
def tracked_by_git(path: PathLike) -> bool:
|
45
|
+
path: Path = _path.as_path(path).absolute()
|
46
|
+
try:
|
47
|
+
repo = git.Repo(search_parent_directories=True)
|
48
|
+
repo.git.ls_files(path, error_unmatch=True)
|
49
|
+
except git.exc.GitCommandError:
|
50
|
+
return False
|
51
|
+
return True
|
@@ -0,0 +1,44 @@
|
|
1
|
+
from typing import override
|
2
|
+
|
3
|
+
import attrs
|
4
|
+
|
5
|
+
from liblaf.cherries import meta as _info
|
6
|
+
|
7
|
+
from . import _abc
|
8
|
+
from ._exp import exp
|
9
|
+
|
10
|
+
|
11
|
+
@attrs.define
|
12
|
+
class End(_abc.End):
|
13
|
+
priority: int = attrs.field(default=-3, kw_only=True) # before dvc
|
14
|
+
dry_run: bool = False
|
15
|
+
|
16
|
+
@override
|
17
|
+
def __call__(self, **kwargs) -> None:
|
18
|
+
git_auto_commit(
|
19
|
+
"chore(cherries): auto commit (on run end)", dry_run=self.dry_run
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
@attrs.define
|
24
|
+
class Start(_abc.Start):
|
25
|
+
dry_run: bool = False
|
26
|
+
|
27
|
+
@override
|
28
|
+
def __call__(self, **kwargs) -> None:
|
29
|
+
git_auto_commit(
|
30
|
+
"chore(cherries): auto commit (on run start)", dry_run=self.dry_run
|
31
|
+
)
|
32
|
+
|
33
|
+
|
34
|
+
def git_auto_commit(
|
35
|
+
header: str = "chore(cherries): auto commit", *, dry_run: bool = False
|
36
|
+
) -> None:
|
37
|
+
body: str = ""
|
38
|
+
if exp.exp_name and exp.exp_url:
|
39
|
+
body += f"🧪 View experiment {exp.exp_name} at: {exp.exp_url}\n"
|
40
|
+
message: str = f"{header}\n\n{body}" if body else header
|
41
|
+
_info.git_auto_commit(message, dry_run=dry_run)
|
42
|
+
exp.log_other("cherries.git.branch", _info.git_branch())
|
43
|
+
exp.log_other("cherries.git.sha", _info.git_commit_sha())
|
44
|
+
exp.log_other("cherries.git.url", _info.git_commit_url())
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from typing import override
|
2
|
+
|
3
|
+
import attrs
|
4
|
+
import loguru
|
5
|
+
from loguru import logger
|
6
|
+
|
7
|
+
from liblaf import grapes
|
8
|
+
|
9
|
+
from . import _abc
|
10
|
+
from ._exp import exp
|
11
|
+
|
12
|
+
|
13
|
+
@attrs.define
|
14
|
+
class End(_abc.End):
|
15
|
+
priority: int = attrs.field(default=-1, kw_only=True) # before Comet
|
16
|
+
text: bool = True
|
17
|
+
jsonl: bool = False
|
18
|
+
|
19
|
+
@override
|
20
|
+
def __call__(self, **kwargs) -> None:
|
21
|
+
logger.complete()
|
22
|
+
if self.text and (exp.exp_dir / "run.log").exists():
|
23
|
+
exp.log_asset(exp.exp_dir / "run.log")
|
24
|
+
if self.jsonl and (exp.exp_dir / "run.log.jsonl").exists():
|
25
|
+
exp.log_asset(exp.exp_dir / "run.log.jsonl")
|
26
|
+
|
27
|
+
|
28
|
+
@attrs.define
|
29
|
+
class Start(_abc.Start):
|
30
|
+
priority: int = attrs.field(default=-1, kw_only=True) # before Comet
|
31
|
+
text: bool = True
|
32
|
+
jsonl: bool = False
|
33
|
+
|
34
|
+
@override
|
35
|
+
def __call__(self, **kwargs) -> None:
|
36
|
+
handlers: list[loguru.HandlerConfig] = [
|
37
|
+
grapes.logging.rich_handler(enable_link=False)
|
38
|
+
]
|
39
|
+
if self.text:
|
40
|
+
handlers.append(grapes.logging.file_handler(sink=exp.exp_dir / "run.log"))
|
41
|
+
if self.jsonl:
|
42
|
+
handlers.append(
|
43
|
+
grapes.logging.jsonl_handler(sink=exp.exp_dir / "run.log.jsonl")
|
44
|
+
)
|
45
|
+
grapes.init_logging(handlers=handlers)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from ._git import git_auto_commit, git_branch, git_commit_sha, git_commit_url, git_info
|
2
|
-
from ._name import exp_name,
|
2
|
+
from ._name import exp_name, project_name
|
3
3
|
|
4
4
|
__all__ = [
|
5
5
|
"exp_name",
|
@@ -8,5 +8,5 @@ __all__ = [
|
|
8
8
|
"git_commit_sha",
|
9
9
|
"git_commit_url",
|
10
10
|
"git_info",
|
11
|
-
"
|
11
|
+
"project_name",
|
12
12
|
]
|
@@ -0,0 +1,25 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
import git.exc
|
4
|
+
|
5
|
+
from liblaf import grapes
|
6
|
+
from liblaf.cherries import pathutils as _path
|
7
|
+
|
8
|
+
from ._git import git_info
|
9
|
+
|
10
|
+
|
11
|
+
def project_name() -> str:
|
12
|
+
try:
|
13
|
+
info: grapes.git.GitInfo = git_info()
|
14
|
+
except git.exc.InvalidGitRepositoryError:
|
15
|
+
return "Default"
|
16
|
+
else:
|
17
|
+
return info.repo
|
18
|
+
|
19
|
+
|
20
|
+
def exp_name() -> str:
|
21
|
+
exp_dir: Path = _path.entrypoint(absolute=False)
|
22
|
+
exp_name: str = _path.as_posix(exp_dir)
|
23
|
+
exp_name = exp_name.removeprefix("exp")
|
24
|
+
exp_name = exp_name.removeprefix("/")
|
25
|
+
return exp_name
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from ._convert import as_os_path, as_path, as_posix
|
2
|
-
from ._path import entrypoint, git_root, git_root_safe
|
2
|
+
from ._path import entrypoint, exp_dir, git_root, git_root_safe
|
3
3
|
from ._special import config, data, inputs, outputs, params, path, src
|
4
4
|
|
5
5
|
__all__ = [
|
@@ -9,12 +9,12 @@ __all__ = [
|
|
9
9
|
"config",
|
10
10
|
"data",
|
11
11
|
"entrypoint",
|
12
|
+
"exp_dir",
|
12
13
|
"git_root",
|
13
14
|
"git_root_safe",
|
14
15
|
"inputs",
|
15
16
|
"outputs",
|
16
17
|
"params",
|
17
18
|
"path",
|
18
|
-
"run_dir",
|
19
19
|
"src",
|
20
20
|
]
|
@@ -11,8 +11,6 @@ def as_os_path(path: None) -> None: ...
|
|
11
11
|
def as_os_path(path: PathLike | None) -> str | None:
|
12
12
|
if path is None:
|
13
13
|
return None
|
14
|
-
if isinstance(path, str):
|
15
|
-
return path
|
16
14
|
return str(path)
|
17
15
|
|
18
16
|
|
@@ -20,8 +18,6 @@ def as_os_path(path: PathLike | None) -> str | None:
|
|
20
18
|
def as_path(path: PathLike) -> Path: ...
|
21
19
|
@overload
|
22
20
|
def as_path(path: None) -> None: ...
|
23
|
-
|
24
|
-
|
25
21
|
def as_path(path: PathLike | None) -> Path | None:
|
26
22
|
if path is None:
|
27
23
|
return None
|
@@ -32,10 +32,10 @@ def git_root_safe() -> Path:
|
|
32
32
|
|
33
33
|
|
34
34
|
@utils.cache
|
35
|
-
def
|
35
|
+
def exp_dir(*, absolute: bool = False) -> Path:
|
36
36
|
if absolute:
|
37
|
-
return
|
38
|
-
return
|
37
|
+
return _exp_dir_absolute()
|
38
|
+
return _exp_dir_relative()
|
39
39
|
|
40
40
|
|
41
41
|
@utils.cache
|
@@ -51,7 +51,7 @@ def _entrypoint_relative() -> Path:
|
|
51
51
|
|
52
52
|
|
53
53
|
@utils.cache
|
54
|
-
def
|
54
|
+
def _exp_dir_absolute() -> Path:
|
55
55
|
entrypoint: Path = _entrypoint_absolute()
|
56
56
|
for path in entrypoint.parents:
|
57
57
|
if (path / "exp.cherries.toml").is_file():
|
@@ -62,7 +62,7 @@ def _run_dir_absolute() -> Path:
|
|
62
62
|
|
63
63
|
|
64
64
|
@utils.cache
|
65
|
-
def
|
66
|
-
absolute: Path =
|
65
|
+
def _exp_dir_relative() -> Path:
|
66
|
+
absolute: Path = _exp_dir_absolute()
|
67
67
|
root: Path = git_root_safe()
|
68
68
|
return absolute.relative_to(root)
|
@@ -2,7 +2,7 @@ from pathlib import Path
|
|
2
2
|
|
3
3
|
from liblaf.grapes.typed import PathLike
|
4
4
|
|
5
|
-
from ._path import
|
5
|
+
from ._path import exp_dir
|
6
6
|
|
7
7
|
|
8
8
|
def config(
|
@@ -44,7 +44,7 @@ def src(path: PathLike = "", *, mkdir: bool = True, prefix: PathLike = "src") ->
|
|
44
44
|
def _path(path: PathLike = "", *, mkdir: bool = True, prefix: PathLike = "") -> Path:
|
45
45
|
path = Path(path)
|
46
46
|
if not path.is_absolute():
|
47
|
-
path =
|
47
|
+
path = exp_dir(absolute=True) / prefix / path
|
48
48
|
if mkdir:
|
49
49
|
path.parent.mkdir(parents=True, exist_ok=True)
|
50
50
|
return path
|
@@ -1,32 +1,46 @@
|
|
1
|
-
from liblaf.cherries import
|
1
|
+
from liblaf.cherries import integration
|
2
2
|
|
3
3
|
|
4
|
-
def default() ->
|
5
|
-
|
6
|
-
|
7
|
-
plugin.GitEnd(),
|
8
|
-
plugin.DvcEnd(),
|
9
|
-
plugin.MlflowEnd(),
|
4
|
+
def default(exp: integration.Experiment) -> integration.Experiment:
|
5
|
+
exp.add_tag.add(
|
6
|
+
integration.comet.AddTag(),
|
10
7
|
)
|
11
|
-
|
12
|
-
|
13
|
-
plugin.MlflowLogArtifact(),
|
8
|
+
exp.add_tags.add(
|
9
|
+
integration.comet.AddTags(),
|
14
10
|
)
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
exp.end.add(
|
12
|
+
integration.git.End(),
|
13
|
+
integration.dvc.End(),
|
14
|
+
integration.logging.End(),
|
15
|
+
integration.comet.End(),
|
18
16
|
)
|
19
|
-
|
20
|
-
|
17
|
+
exp.log_asset.add(
|
18
|
+
integration.dvc.LogAsset(),
|
19
|
+
integration.comet.LogAsset(),
|
21
20
|
)
|
22
|
-
|
23
|
-
|
21
|
+
exp.log_code.add(
|
22
|
+
integration.comet.LogCode(),
|
24
23
|
)
|
25
|
-
|
26
|
-
|
24
|
+
exp.log_metric.add(
|
25
|
+
integration.comet.LogMetric(),
|
27
26
|
)
|
28
|
-
|
29
|
-
|
30
|
-
plugin.MlflowStart(),
|
27
|
+
exp.log_metrics.add(
|
28
|
+
integration.comet.LogMetrics(),
|
31
29
|
)
|
32
|
-
|
30
|
+
exp.log_other.add(
|
31
|
+
integration.comet.LogOther(),
|
32
|
+
)
|
33
|
+
exp.log_others.add(
|
34
|
+
integration.comet.LogOthers(),
|
35
|
+
)
|
36
|
+
exp.log_param.add(
|
37
|
+
integration.comet.LogParam(),
|
38
|
+
)
|
39
|
+
exp.log_params.add(
|
40
|
+
integration.comet.LogParams(),
|
41
|
+
)
|
42
|
+
exp.start.add(
|
43
|
+
integration.logging.Start(),
|
44
|
+
integration.comet.Start(),
|
45
|
+
)
|
46
|
+
return integration.exp
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: liblaf-cherries
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.1.1
|
4
4
|
Summary: Add your description here
|
5
5
|
Project-URL: Changelog, https://github.com/liblaf/cherries/blob/main/CHANGELOG.md
|
6
6
|
Project-URL: Documentation, https://liblaf.github.io/cherries/
|
@@ -31,15 +31,15 @@ Classifier: Topic :: System :: Logging
|
|
31
31
|
Classifier: Topic :: Utilities
|
32
32
|
Classifier: Typing :: Typed
|
33
33
|
Requires-Python: >=3.12
|
34
|
+
Requires-Dist: comet-ml<4,>=3.49.10
|
34
35
|
Requires-Dist: dvc[webdav]<4,>=3.59.2
|
35
|
-
Requires-Dist: environs<15,>=14.
|
36
|
+
Requires-Dist: environs<15,>=14.2.0
|
36
37
|
Requires-Dist: gitpython<4,>=3.1.44
|
37
38
|
Requires-Dist: lazy-loader<0.5,>=0.4
|
38
|
-
Requires-Dist: liblaf-grapes<0.2,>=0.1.
|
39
|
+
Requires-Dist: liblaf-grapes<0.2,>=0.1.26
|
39
40
|
Requires-Dist: loguru<0.8,>=0.7.3
|
40
|
-
Requires-Dist: mlflow<3,>=2.22.0
|
41
41
|
Requires-Dist: pydantic-settings<3,>=2.9.1
|
42
|
-
Requires-Dist: pydantic<3,>=2.11.
|
42
|
+
Requires-Dist: pydantic<3,>=2.11.5
|
43
43
|
Requires-Dist: rich<15,>=14.0.0
|
44
44
|
Description-Content-Type: text/markdown
|
45
45
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
liblaf/cherries/__init__.py,sha256=OHb6Xou2v6u42swTgjRfzej4CIlRg4OmgOIQXUiRjKA,97
|
2
|
+
liblaf/cherries/__init__.pyi,sha256=lG35qH2fKn4yYWiDwrdym76VkyzSA9ExgpFkL1cr3vY,1767
|
3
|
+
liblaf/cherries/_run.py,sha256=9zbivlGOUc-S4Luu14FQeRP2fNSBDca8EkSYWaES5EQ,1479
|
4
|
+
liblaf/cherries/_version.py,sha256=Mmxse1R0ki5tjz9qzU8AQyqUsLt8nTyCAbYQp8R87PU,511
|
5
|
+
liblaf/cherries/_version.pyi,sha256=Pnv4Bxw13LHeuVkPLPsTtnp4N4jOGcAfFJw05uMMgBY,108
|
6
|
+
liblaf/cherries/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
liblaf/cherries/typed.py,sha256=mim8QVtwczTSHyw5mhEdfFcXis9o32n0CZyu8BrEorE,50
|
8
|
+
liblaf/cherries/config/__init__.py,sha256=OHb6Xou2v6u42swTgjRfzej4CIlRg4OmgOIQXUiRjKA,97
|
9
|
+
liblaf/cherries/config/__init__.pyi,sha256=1CMEQlPneeRXCG51KDUj6Zmqs0xzUF3gilqeuHPlsVc,359
|
10
|
+
liblaf/cherries/config/_asset.py,sha256=7WEkyDxX4X389s0UqoBRbOtHOU9Dlh4NtAq9KXHXbPI,2485
|
11
|
+
liblaf/cherries/config/_config.py,sha256=WPwwk-3O96FyHGb2W8__LDfHpXBHLQM44aOcrMPjDL4,171
|
12
|
+
liblaf/cherries/integration/__init__.py,sha256=OHb6Xou2v6u42swTgjRfzej4CIlRg4OmgOIQXUiRjKA,97
|
13
|
+
liblaf/cherries/integration/__init__.pyi,sha256=sKlkQs9jO37c5HmrQvsayJd2pqiSQOUGP201hqn4dFc,940
|
14
|
+
liblaf/cherries/integration/_abc.py,sha256=0xsoAxxRAhBAOEx0qNx7THDVF8zdYuaAUHX7INe0r8U,3817
|
15
|
+
liblaf/cherries/integration/_exp.py,sha256=DBscR2AWpOei-45mWZ0yCF02Oylw0Vpfl2WXs6VYgOQ,2820
|
16
|
+
liblaf/cherries/integration/comet.py,sha256=BbY88hwo3rVphirYVSBSfQgs8z0UB9RNlCqK5wMUCRY,3709
|
17
|
+
liblaf/cherries/integration/dvc.py,sha256=ClIyT-xj7jx_8knwdFKMzXH6Gq7lQnNWBzW8zycZB8g,1358
|
18
|
+
liblaf/cherries/integration/git.py,sha256=GPRPpftlkDfb1z4oSQ6gRhnbPowKB0euOK8Ak4oAJpw,1209
|
19
|
+
liblaf/cherries/integration/logging.py,sha256=lIjF_2PE6TGT-uFXAnQOnPZ4kP-e982yrGL03L4Gn3s,1267
|
20
|
+
liblaf/cherries/meta/__init__.py,sha256=OHb6Xou2v6u42swTgjRfzej4CIlRg4OmgOIQXUiRjKA,97
|
21
|
+
liblaf/cherries/meta/__init__.pyi,sha256=kQFneP3IiV9rBIzpep_uX0z-5IRPrXkPmyNRt19j8fg,282
|
22
|
+
liblaf/cherries/meta/_git.py,sha256=oy1xx23sXWA7RqQuLGc3HxcLCF7zHTSpZvZ9pukJGdI,1232
|
23
|
+
liblaf/cherries/meta/_name.py,sha256=LskfsW0yv9WEAl8WqGFG3D82_mULulV5N9p9Ogjt7Q0,561
|
24
|
+
liblaf/cherries/pathutils/__init__.py,sha256=OHb6Xou2v6u42swTgjRfzej4CIlRg4OmgOIQXUiRjKA,97
|
25
|
+
liblaf/cherries/pathutils/__init__.pyi,sha256=mr3Dk8ragpNGXmXJriMt21vc7YmqUD6X587exFe9tCI,413
|
26
|
+
liblaf/cherries/pathutils/_convert.py,sha256=IrXN_9s-rfH7EKk0_ilr1giGmfN8FlvB_edm2kI-k3I,807
|
27
|
+
liblaf/cherries/pathutils/_path.py,sha256=PLcVzBO6r99qspf5ZKqVtWm6mT8Ud5cUGsUkyJkTqyM,1548
|
28
|
+
liblaf/cherries/pathutils/_special.py,sha256=b5D3PtW__u0Zpiv69OYoV7TTYc6Dgs4Bu-P8jwrROV4,1415
|
29
|
+
liblaf/cherries/presets/__init__.py,sha256=OHb6Xou2v6u42swTgjRfzej4CIlRg4OmgOIQXUiRjKA,97
|
30
|
+
liblaf/cherries/presets/__init__.pyi,sha256=3ug6RF4DSBOEankXOEgotQw_E0fMvQ5yuhps7EHf6b0,139
|
31
|
+
liblaf/cherries/presets/_default.py,sha256=-sm9IBvXP_JfWXUfZdwc9u5WcLOQXloDmBgwjiw2EPk,1095
|
32
|
+
liblaf/cherries/presets/_playground.py,sha256=F0dphGgJ_6MD5mBGm0chrxWIufZtYgtt5c2l-TVPNso,260
|
33
|
+
liblaf/cherries/presets/typed.py,sha256=LztTXKiiCD1NW1fb2Od6giaU0vaXdOidjsqxbTkIlJY,152
|
34
|
+
liblaf/cherries/utils/__init__.py,sha256=OHb6Xou2v6u42swTgjRfzej4CIlRg4OmgOIQXUiRjKA,97
|
35
|
+
liblaf/cherries/utils/__init__.pyi,sha256=F5aTcXpWVmUoctPbLfmQXKyuXYRspAIjaIzfL1_3Lrw,51
|
36
|
+
liblaf/cherries/utils/_functools.py,sha256=0Puwvj1Wq4kp3S--hI-CXwUBZ56AtfkqIzFHllQtuug,181
|
37
|
+
liblaf_cherries-0.1.1.dist-info/METADATA,sha256=vCeLQZRfuhnJ9-Jme3CbRajKWugsZky-eN-p3pnzx_A,1946
|
38
|
+
liblaf_cherries-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
39
|
+
liblaf_cherries-0.1.1.dist-info/licenses/LICENSE,sha256=Ph4NzyU3lGVDeYv-mf8aRmImH8v9rVL9F362FV4G6Ow,1063
|
40
|
+
liblaf_cherries-0.1.1.dist-info/RECORD,,
|
liblaf/cherries/_config.py
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
import pydantic_settings as ps
|
2
|
-
|
3
|
-
|
4
|
-
class BaseConfig(ps.BaseSettings):
|
5
|
-
model_config = ps.SettingsConfigDict(cli_parse_args=True, yaml_file="params.yaml")
|
6
|
-
|
7
|
-
@classmethod
|
8
|
-
def settings_customise_sources(
|
9
|
-
cls,
|
10
|
-
settings_cls: type[ps.BaseSettings],
|
11
|
-
init_settings: ps.PydanticBaseSettingsSource,
|
12
|
-
env_settings: ps.PydanticBaseSettingsSource,
|
13
|
-
dotenv_settings: ps.PydanticBaseSettingsSource,
|
14
|
-
file_secret_settings: ps.PydanticBaseSettingsSource,
|
15
|
-
) -> tuple[ps.PydanticBaseSettingsSource, ...]:
|
16
|
-
return (
|
17
|
-
init_settings,
|
18
|
-
env_settings,
|
19
|
-
dotenv_settings,
|
20
|
-
file_secret_settings,
|
21
|
-
ps.YamlConfigSettingsSource(settings_cls),
|
22
|
-
)
|
liblaf/cherries/info/_name.py
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
from pathlib import Path
|
2
|
-
|
3
|
-
import git.exc
|
4
|
-
from environs import env
|
5
|
-
|
6
|
-
from liblaf import grapes
|
7
|
-
from liblaf.cherries import pathutils as _path
|
8
|
-
|
9
|
-
from ._git import git_info
|
10
|
-
|
11
|
-
|
12
|
-
def exp_name() -> str:
|
13
|
-
if name := env.str("LIBLAF_CHERRIES_EXPERIMENT_NAME", "").strip():
|
14
|
-
return name
|
15
|
-
if name := env.str("MLFLOW_EXPERIMENT_NAME", "").strip():
|
16
|
-
return name
|
17
|
-
try:
|
18
|
-
info: grapes.git.GitInfo = git_info()
|
19
|
-
except git.exc.InvalidGitRepositoryError:
|
20
|
-
return "Default"
|
21
|
-
else:
|
22
|
-
return info.repo
|
23
|
-
|
24
|
-
|
25
|
-
def run_name() -> str:
|
26
|
-
run_dir: Path = _path.run_dir(absolute=False)
|
27
|
-
run_name: str = _path.as_posix(run_dir)
|
28
|
-
run_name = run_name.removeprefix("exp")
|
29
|
-
run_name = run_name.removeprefix("/")
|
30
|
-
return run_name
|