liblaf-cherries 0.1.2__tar.gz → 0.1.4__tar.gz
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-0.1.4/PKG-INFO +155 -0
- liblaf_cherries-0.1.4/README.md +109 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/pyproject.toml +4 -3
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/__init__.pyi +8 -1
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/_version.py +2 -2
- liblaf_cherries-0.1.4/src/liblaf/cherries/core/__init__.pyi +12 -0
- liblaf_cherries-0.1.4/src/liblaf/cherries/core/_exp.py +119 -0
- liblaf_cherries-0.1.4/src/liblaf/cherries/core/_spec.py +177 -0
- liblaf_cherries-0.1.4/src/liblaf/cherries/utils/__init__.py +3 -0
- liblaf_cherries-0.1.2/PKG-INFO +0 -46
- liblaf_cherries-0.1.2/docs/README.md +0 -1
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/.gitignore +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/LICENSE +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/__init__.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/_run.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/_version.pyi +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/config/__init__.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/config/__init__.pyi +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/config/_asset.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/config/_config.py +0 -0
- {liblaf_cherries-0.1.2/src/liblaf/cherries/integration → liblaf_cherries-0.1.4/src/liblaf/cherries/core}/__init__.py +0 -0
- {liblaf_cherries-0.1.2/src/liblaf/cherries/meta → liblaf_cherries-0.1.4/src/liblaf/cherries/integration}/__init__.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/integration/__init__.pyi +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/integration/_abc.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/integration/_exp.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/integration/comet.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/integration/dvc.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/integration/git.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/integration/logging.py +0 -0
- {liblaf_cherries-0.1.2/src/liblaf/cherries/pathutils → liblaf_cherries-0.1.4/src/liblaf/cherries/meta}/__init__.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/meta/__init__.pyi +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/meta/_git.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/meta/_name.py +0 -0
- {liblaf_cherries-0.1.2/src/liblaf/cherries/presets → liblaf_cherries-0.1.4/src/liblaf/cherries/pathutils}/__init__.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/pathutils/__init__.pyi +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/pathutils/_convert.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/pathutils/_path.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/pathutils/_special.py +0 -0
- {liblaf_cherries-0.1.2/src/liblaf/cherries/utils → liblaf_cherries-0.1.4/src/liblaf/cherries/presets}/__init__.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/presets/__init__.pyi +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/presets/_default.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/presets/_playground.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/presets/typed.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/py.typed +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/typed.py +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/utils/__init__.pyi +0 -0
- {liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/utils/_functools.py +0 -0
@@ -0,0 +1,155 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: liblaf-cherries
|
3
|
+
Version: 0.1.4
|
4
|
+
Summary: Add your description here
|
5
|
+
Project-URL: Changelog, https://github.com/liblaf/cherries/blob/main/CHANGELOG.md
|
6
|
+
Project-URL: Documentation, https://liblaf.github.io/cherries/
|
7
|
+
Project-URL: Homepage, https://github.com/liblaf/cherries
|
8
|
+
Project-URL: Issue Tracker, https://github.com/liblaf/cherries/issues
|
9
|
+
Project-URL: Release Notes, https://github.com/liblaf/cherries/releases
|
10
|
+
Project-URL: Source Code, https://github.com/liblaf/cherries
|
11
|
+
Author-email: liblaf <30631553+liblaf@users.noreply.github.com>
|
12
|
+
License-Expression: MIT
|
13
|
+
License-File: LICENSE
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
15
|
+
Classifier: Intended Audience :: Developers
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
17
|
+
Classifier: License :: OSI Approved
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
19
|
+
Classifier: Operating System :: OS Independent
|
20
|
+
Classifier: Programming Language :: Python
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
24
|
+
Classifier: Topic :: Software Development
|
25
|
+
Classifier: Topic :: Software Development :: Bug Tracking
|
26
|
+
Classifier: Topic :: Software Development :: Debuggers
|
27
|
+
Classifier: Topic :: Software Development :: Libraries
|
28
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
29
|
+
Classifier: Topic :: System
|
30
|
+
Classifier: Topic :: System :: Logging
|
31
|
+
Classifier: Topic :: Utilities
|
32
|
+
Classifier: Typing :: Typed
|
33
|
+
Requires-Python: >=3.12
|
34
|
+
Requires-Dist: comet-ml<4,>=3.49.10
|
35
|
+
Requires-Dist: dvc[webdav]<4,>=3.60.0
|
36
|
+
Requires-Dist: environs<15,>=14.2.0
|
37
|
+
Requires-Dist: gitpython<4,>=3.1.44
|
38
|
+
Requires-Dist: lazy-loader<0.5,>=0.4
|
39
|
+
Requires-Dist: liblaf-grapes<0.3,>=0.2
|
40
|
+
Requires-Dist: loguru<0.8,>=0.7.3
|
41
|
+
Requires-Dist: networkx<4,>=3.5
|
42
|
+
Requires-Dist: pydantic-settings<3,>=2.9.1
|
43
|
+
Requires-Dist: pydantic<3,>=2.11.5
|
44
|
+
Requires-Dist: rich<15,>=14.0.0
|
45
|
+
Description-Content-Type: text/markdown
|
46
|
+
|
47
|
+
<div align="center" markdown><a name="readme-top"></a>
|
48
|
+
|
49
|
+
<img src="https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Cherries/3D/cherries_3d.png" style="height: 120px" />
|
50
|
+
<img src="https://gw.alipayobjects.com/zos/kitchen/qJ3l3EPsdW/split.svg" style="height: 120px" />
|
51
|
+
<img src="https://api.iconify.design/logos/python.svg" style="height: 120px; padding: 12px" />
|
52
|
+
|
53
|
+
# Cherries
|
54
|
+
|
55
|
+
TODO: DESCRIPTION <br />
|
56
|
+
[**Explore the docs »**](https://liblaf.github.io/cherries/)
|
57
|
+
|
58
|
+
[](https://pypi.org/project/liblaf-cherries)
|
59
|
+
[](https://pypi.org/project/liblaf-cherries)
|
60
|
+
[](https://pypi.org/project/liblaf-cherries)
|
61
|
+
[](https://codecov.io/gh/liblaf/cherries)
|
62
|
+
[](https://github.com/liblaf/cherries/actions/workflows/test.yaml)
|
63
|
+
<br />
|
64
|
+
[](https://github.com/liblaf/cherries/graphs/contributors)
|
65
|
+
[](https://github.com/liblaf/cherries/forks)
|
66
|
+
[](https://github.com/liblaf/cherries/stargazers)
|
67
|
+
[](https://github.com/liblaf/cherries/issues)
|
68
|
+
[](https://github.com/liblaf/cherries/blob/main/LICENSE)
|
69
|
+
|
70
|
+
[Changelog](https://github.com/liblaf/cherries/blob/main/CHANGELOG.md) · [Report Bug](https://github.com/liblaf/cherries/issues) · [Request Feature](https://github.com/liblaf/cherries/issues)
|
71
|
+
|
72
|
+

|
73
|
+
|
74
|
+
</div>
|
75
|
+
|
76
|
+
## ✨ Features
|
77
|
+
|
78
|
+
- [x] ✨ **TODO:** FEATURES;
|
79
|
+
|
80
|
+
<div align="right" markdown>
|
81
|
+
|
82
|
+
[](#readme-top)
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
## 📦 Installation
|
87
|
+
|
88
|
+
To install `liblaf-cherries`, run the following command:
|
89
|
+
|
90
|
+
```bash
|
91
|
+
$ uv add liblaf-cherries
|
92
|
+
```
|
93
|
+
|
94
|
+
<div align="right" markdown>
|
95
|
+
|
96
|
+
[](#readme-top)
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
## ⌨️ Local Development
|
101
|
+
|
102
|
+
You can use Github Codespaces for online development:
|
103
|
+
|
104
|
+
[](https://codespaces.new/liblaf/cherries)
|
105
|
+
|
106
|
+
Or clone it for local development:
|
107
|
+
|
108
|
+
```bash
|
109
|
+
$ gh repo clone liblaf/cherries
|
110
|
+
$ cd cherries
|
111
|
+
$ just test
|
112
|
+
```
|
113
|
+
|
114
|
+
<div align="right" markdown>
|
115
|
+
|
116
|
+
[](#readme-top)
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
## 🤝 Contributing
|
121
|
+
|
122
|
+
Contributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub [Issues](https://github.com/liblaf/cherries/issues) to get stuck in to show us what you're made of.
|
123
|
+
|
124
|
+
[](https://github.com/liblaf/cherries/pulls)
|
125
|
+
|
126
|
+
[](https://github.com/liblaf/cherries/graphs/contributors)
|
127
|
+
|
128
|
+
<div align="right" markdown>
|
129
|
+
|
130
|
+
[](#readme-top)
|
131
|
+
|
132
|
+
</div>
|
133
|
+
|
134
|
+
## 🔗 Links
|
135
|
+
|
136
|
+
### More Projects
|
137
|
+
|
138
|
+
- **[🍇 Grapes](https://github.com/liblaf/grapes)** - Powerful Python utilities for logging, timing, and more, making development smoother!
|
139
|
+
|
140
|
+
### Credits
|
141
|
+
|
142
|
+
- **Python** - <https://www.python.org/>
|
143
|
+
|
144
|
+
<div align="right" markdown>
|
145
|
+
|
146
|
+
[](#readme-top)
|
147
|
+
|
148
|
+
</div>
|
149
|
+
|
150
|
+
---
|
151
|
+
|
152
|
+
#### 📝 License
|
153
|
+
|
154
|
+
Copyright © 2025 [liblaf](https://github.com/liblaf). <br />
|
155
|
+
This project is [MIT](https://github.com/liblaf/cherries/blob/main/LICENSE) licensed.
|
@@ -0,0 +1,109 @@
|
|
1
|
+
<div align="center" markdown><a name="readme-top"></a>
|
2
|
+
|
3
|
+
<img src="https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Cherries/3D/cherries_3d.png" style="height: 120px" />
|
4
|
+
<img src="https://gw.alipayobjects.com/zos/kitchen/qJ3l3EPsdW/split.svg" style="height: 120px" />
|
5
|
+
<img src="https://api.iconify.design/logos/python.svg" style="height: 120px; padding: 12px" />
|
6
|
+
|
7
|
+
# Cherries
|
8
|
+
|
9
|
+
TODO: DESCRIPTION <br />
|
10
|
+
[**Explore the docs »**](https://liblaf.github.io/cherries/)
|
11
|
+
|
12
|
+
[](https://pypi.org/project/liblaf-cherries)
|
13
|
+
[](https://pypi.org/project/liblaf-cherries)
|
14
|
+
[](https://pypi.org/project/liblaf-cherries)
|
15
|
+
[](https://codecov.io/gh/liblaf/cherries)
|
16
|
+
[](https://github.com/liblaf/cherries/actions/workflows/test.yaml)
|
17
|
+
<br />
|
18
|
+
[](https://github.com/liblaf/cherries/graphs/contributors)
|
19
|
+
[](https://github.com/liblaf/cherries/forks)
|
20
|
+
[](https://github.com/liblaf/cherries/stargazers)
|
21
|
+
[](https://github.com/liblaf/cherries/issues)
|
22
|
+
[](https://github.com/liblaf/cherries/blob/main/LICENSE)
|
23
|
+
|
24
|
+
[Changelog](https://github.com/liblaf/cherries/blob/main/CHANGELOG.md) · [Report Bug](https://github.com/liblaf/cherries/issues) · [Request Feature](https://github.com/liblaf/cherries/issues)
|
25
|
+
|
26
|
+

|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
## ✨ Features
|
31
|
+
|
32
|
+
- [x] ✨ **TODO:** FEATURES;
|
33
|
+
|
34
|
+
<div align="right" markdown>
|
35
|
+
|
36
|
+
[](#readme-top)
|
37
|
+
|
38
|
+
</div>
|
39
|
+
|
40
|
+
## 📦 Installation
|
41
|
+
|
42
|
+
To install `liblaf-cherries`, run the following command:
|
43
|
+
|
44
|
+
```bash
|
45
|
+
$ uv add liblaf-cherries
|
46
|
+
```
|
47
|
+
|
48
|
+
<div align="right" markdown>
|
49
|
+
|
50
|
+
[](#readme-top)
|
51
|
+
|
52
|
+
</div>
|
53
|
+
|
54
|
+
## ⌨️ Local Development
|
55
|
+
|
56
|
+
You can use Github Codespaces for online development:
|
57
|
+
|
58
|
+
[](https://codespaces.new/liblaf/cherries)
|
59
|
+
|
60
|
+
Or clone it for local development:
|
61
|
+
|
62
|
+
```bash
|
63
|
+
$ gh repo clone liblaf/cherries
|
64
|
+
$ cd cherries
|
65
|
+
$ just test
|
66
|
+
```
|
67
|
+
|
68
|
+
<div align="right" markdown>
|
69
|
+
|
70
|
+
[](#readme-top)
|
71
|
+
|
72
|
+
</div>
|
73
|
+
|
74
|
+
## 🤝 Contributing
|
75
|
+
|
76
|
+
Contributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub [Issues](https://github.com/liblaf/cherries/issues) to get stuck in to show us what you're made of.
|
77
|
+
|
78
|
+
[](https://github.com/liblaf/cherries/pulls)
|
79
|
+
|
80
|
+
[](https://github.com/liblaf/cherries/graphs/contributors)
|
81
|
+
|
82
|
+
<div align="right" markdown>
|
83
|
+
|
84
|
+
[](#readme-top)
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
## 🔗 Links
|
89
|
+
|
90
|
+
### More Projects
|
91
|
+
|
92
|
+
- **[🍇 Grapes](https://github.com/liblaf/grapes)** - Powerful Python utilities for logging, timing, and more, making development smoother!
|
93
|
+
|
94
|
+
### Credits
|
95
|
+
|
96
|
+
- **Python** - <https://www.python.org/>
|
97
|
+
|
98
|
+
<div align="right" markdown>
|
99
|
+
|
100
|
+
[](#readme-top)
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
---
|
105
|
+
|
106
|
+
#### 📝 License
|
107
|
+
|
108
|
+
Copyright © 2025 [liblaf](https://github.com/liblaf). <br />
|
109
|
+
This project is [MIT](https://github.com/liblaf/cherries/blob/main/LICENSE) licensed.
|
@@ -60,12 +60,13 @@ classifiers = [
|
|
60
60
|
]
|
61
61
|
dependencies = [
|
62
62
|
"comet-ml>=3.49.10,<4",
|
63
|
-
"dvc[webdav]>=3.
|
63
|
+
"dvc[webdav]>=3.60.0,<4",
|
64
64
|
"environs>=14.2.0,<15",
|
65
65
|
"gitpython>=3.1.44,<4",
|
66
66
|
"lazy-loader>=0.4,<0.5",
|
67
|
-
"liblaf-grapes>=0.
|
67
|
+
"liblaf-grapes>=0.2,<0.3",
|
68
68
|
"loguru>=0.7.3,<0.8",
|
69
|
+
"networkx>=3.5,<4",
|
69
70
|
"pydantic-settings>=2.9.1,<3",
|
70
71
|
"pydantic>=2.11.5,<3",
|
71
72
|
"rich>=14.0.0,<15",
|
@@ -75,7 +76,7 @@ dynamic = ["version"]
|
|
75
76
|
keywords = []
|
76
77
|
license = "MIT"
|
77
78
|
name = "liblaf-cherries"
|
78
|
-
readme = "
|
79
|
+
readme = "README.md"
|
79
80
|
requires-python = ">=3.12"
|
80
81
|
|
81
82
|
[project.urls]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from . import config, integration, meta, pathutils, presets, utils
|
1
|
+
from . import config, core, integration, meta, pathutils, presets, utils
|
2
2
|
from ._run import end, run, start
|
3
3
|
from .config import (
|
4
4
|
AssetKind,
|
@@ -11,6 +11,7 @@ from .config import (
|
|
11
11
|
input, # noqa: A004
|
12
12
|
output,
|
13
13
|
)
|
14
|
+
from .core import ConcreteImpl, ImplDef, SpecDef, impl, spec
|
14
15
|
from .integration import (
|
15
16
|
AddTag,
|
16
17
|
AddTags,
|
@@ -61,8 +62,10 @@ __all__ = [
|
|
61
62
|
"AddTags",
|
62
63
|
"AssetKind",
|
63
64
|
"BaseConfig",
|
65
|
+
"ConcreteImpl",
|
64
66
|
"End",
|
65
67
|
"Experiment",
|
68
|
+
"ImplDef",
|
66
69
|
"LogAsset",
|
67
70
|
"LogCode",
|
68
71
|
"LogMetric",
|
@@ -74,6 +77,7 @@ __all__ = [
|
|
74
77
|
"MetaAsset",
|
75
78
|
"PathProvider",
|
76
79
|
"Plugin",
|
80
|
+
"SpecDef",
|
77
81
|
"Start",
|
78
82
|
"add_tag",
|
79
83
|
"add_tags",
|
@@ -81,6 +85,7 @@ __all__ = [
|
|
81
85
|
"as_path",
|
82
86
|
"as_posix",
|
83
87
|
"config",
|
88
|
+
"core",
|
84
89
|
"current_exp",
|
85
90
|
"data",
|
86
91
|
"end",
|
@@ -93,6 +98,7 @@ __all__ = [
|
|
93
98
|
"get_outputs",
|
94
99
|
"git_root",
|
95
100
|
"git_root_safe",
|
101
|
+
"impl",
|
96
102
|
"input",
|
97
103
|
"inputs",
|
98
104
|
"integration",
|
@@ -115,6 +121,7 @@ __all__ = [
|
|
115
121
|
"presets",
|
116
122
|
"run",
|
117
123
|
"run",
|
124
|
+
"spec",
|
118
125
|
"src",
|
119
126
|
"start",
|
120
127
|
"start",
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import datetime
|
2
|
+
import functools
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import Any
|
5
|
+
|
6
|
+
from liblaf.cherries import pathutils as _path
|
7
|
+
from liblaf.cherries.typed import PathLike
|
8
|
+
|
9
|
+
from ._spec import Plugin, spec
|
10
|
+
|
11
|
+
|
12
|
+
class Experiment(Plugin):
|
13
|
+
@functools.cached_property
|
14
|
+
def exp_dir(self) -> Path:
|
15
|
+
return _path.exp_dir(absolute=True)
|
16
|
+
|
17
|
+
@property
|
18
|
+
def exp_id(self) -> str:
|
19
|
+
return self.get_exp_id()
|
20
|
+
|
21
|
+
@property
|
22
|
+
def exp_name(self) -> str:
|
23
|
+
return self.get_exp_name()
|
24
|
+
|
25
|
+
@exp_name.setter
|
26
|
+
def exp_name(self, value: str) -> None:
|
27
|
+
self.set_exp_name(value)
|
28
|
+
|
29
|
+
@property
|
30
|
+
def exp_url(self) -> str:
|
31
|
+
return self.get_exp_url()
|
32
|
+
|
33
|
+
@property
|
34
|
+
def project_id(self) -> str:
|
35
|
+
return self.get_project_id()
|
36
|
+
|
37
|
+
@property
|
38
|
+
def project_name(self) -> str:
|
39
|
+
return self.get_project_name()
|
40
|
+
|
41
|
+
@functools.cached_property
|
42
|
+
def start_time(self) -> datetime.datetime:
|
43
|
+
return datetime.datetime.now().astimezone()
|
44
|
+
|
45
|
+
def log_input(self, path: PathLike, /, **kwargs) -> None:
|
46
|
+
self.log_asset(path, prefix="inputs/", **kwargs)
|
47
|
+
|
48
|
+
def log_output(self, path: PathLike, /, **kwargs) -> None:
|
49
|
+
self.log_asset(path, prefix="outputs/", **kwargs)
|
50
|
+
|
51
|
+
@spec
|
52
|
+
def add_tag(self, tag: str, /) -> None: ...
|
53
|
+
|
54
|
+
@spec
|
55
|
+
def add_tags(self, tags: list[str], /) -> None: ...
|
56
|
+
|
57
|
+
@spec
|
58
|
+
def end(self) -> None: ...
|
59
|
+
|
60
|
+
@spec(firstresult=True)
|
61
|
+
def get_exp_id(self) -> str: ...
|
62
|
+
|
63
|
+
@spec(firstresult=True)
|
64
|
+
def get_exp_name(self) -> str: ...
|
65
|
+
|
66
|
+
@spec(firstresult=True)
|
67
|
+
def get_exp_url(self) -> str: ...
|
68
|
+
|
69
|
+
@spec(firstresult=True)
|
70
|
+
def get_project_id(self) -> str: ...
|
71
|
+
|
72
|
+
@spec(firstresult=True)
|
73
|
+
def get_project_name(self) -> str: ...
|
74
|
+
|
75
|
+
@spec(firstresult=True)
|
76
|
+
def get_project_url(self) -> str: ...
|
77
|
+
|
78
|
+
@spec
|
79
|
+
def log_asset(self, path: PathLike, /, prefix: str | None = None) -> None: ...
|
80
|
+
|
81
|
+
@spec
|
82
|
+
def log_code(self, path: str, /) -> None: ...
|
83
|
+
|
84
|
+
@spec
|
85
|
+
def log_metric(
|
86
|
+
self,
|
87
|
+
key: str,
|
88
|
+
value: float,
|
89
|
+
/,
|
90
|
+
step: int | None = None,
|
91
|
+
epoch: int | None = None,
|
92
|
+
) -> None: ...
|
93
|
+
|
94
|
+
@spec
|
95
|
+
def log_metrics(
|
96
|
+
self,
|
97
|
+
metrics: dict[str, float],
|
98
|
+
/,
|
99
|
+
step: int | None = None,
|
100
|
+
epoch: int | None = None,
|
101
|
+
) -> None: ...
|
102
|
+
|
103
|
+
@spec
|
104
|
+
def log_other(self, key: str, value: Any, /) -> None: ...
|
105
|
+
|
106
|
+
@spec
|
107
|
+
def log_others(self, others: dict[str, Any], /) -> None: ...
|
108
|
+
|
109
|
+
@spec
|
110
|
+
def log_param(self, key: str, value: Any, /) -> None: ...
|
111
|
+
|
112
|
+
@spec
|
113
|
+
def log_params(self, params: dict[str, Any], /) -> None: ...
|
114
|
+
|
115
|
+
@spec
|
116
|
+
def set_exp_name(self, name: str, /) -> None: ...
|
117
|
+
|
118
|
+
@spec
|
119
|
+
def start(self) -> None: ...
|
@@ -0,0 +1,177 @@
|
|
1
|
+
import functools
|
2
|
+
import inspect
|
3
|
+
from collections.abc import Callable, Generator, Iterable, Sequence
|
4
|
+
from typing import Any, Self, overload, override
|
5
|
+
|
6
|
+
import attrs
|
7
|
+
import networkx as nx
|
8
|
+
|
9
|
+
from liblaf.grapes.typed import Decorator
|
10
|
+
|
11
|
+
|
12
|
+
def as_seq(value: str | Iterable[str] | None = None) -> Sequence[str]:
|
13
|
+
if value is None:
|
14
|
+
return ()
|
15
|
+
if isinstance(value, (str, bytes)):
|
16
|
+
return (value,)
|
17
|
+
return tuple(value)
|
18
|
+
|
19
|
+
|
20
|
+
@attrs.frozen
|
21
|
+
class SpecDef:
|
22
|
+
name: str
|
23
|
+
firstresult: bool
|
24
|
+
|
25
|
+
|
26
|
+
@attrs.frozen
|
27
|
+
class ImplDef:
|
28
|
+
name: str
|
29
|
+
after: str | Sequence[str] = attrs.field(default=(), converter=as_seq)
|
30
|
+
before: str | Sequence[str] = attrs.field(default=(), converter=as_seq)
|
31
|
+
priority: int = 0
|
32
|
+
|
33
|
+
|
34
|
+
@attrs.frozen
|
35
|
+
class ConcreteImpl[C: Callable](ImplDef):
|
36
|
+
fn: C = attrs.field(kw_only=True)
|
37
|
+
plugin_name: str = attrs.field(kw_only=True)
|
38
|
+
|
39
|
+
|
40
|
+
@attrs.define(slots=False)
|
41
|
+
class Plugin:
|
42
|
+
plugins: list[Self] = attrs.field(factory=list)
|
43
|
+
|
44
|
+
@classmethod
|
45
|
+
def get_spec(cls, name: str | SpecDef) -> SpecDef:
|
46
|
+
if isinstance(name, SpecDef):
|
47
|
+
return name
|
48
|
+
fn: Callable | None = getattr(cls, name, None)
|
49
|
+
if fn is None:
|
50
|
+
raise KeyError(name)
|
51
|
+
spec: SpecDef | None = getattr(fn, "spec", None)
|
52
|
+
if spec is None:
|
53
|
+
raise KeyError(name)
|
54
|
+
return spec
|
55
|
+
|
56
|
+
@classmethod
|
57
|
+
def iter_specs(cls) -> Generator[SpecDef]:
|
58
|
+
for _name, fn in inspect.getmembers(cls):
|
59
|
+
spec: SpecDef | None = getattr(fn, "spec", None)
|
60
|
+
if spec is None:
|
61
|
+
continue
|
62
|
+
yield spec
|
63
|
+
|
64
|
+
@property
|
65
|
+
def name(self) -> str:
|
66
|
+
return type(self).__name__
|
67
|
+
|
68
|
+
@functools.cached_property
|
69
|
+
def impls(self) -> dict[str, Sequence[ConcreteImpl]]:
|
70
|
+
return {spec.name: tuple(self.iter_impls(spec)) for spec in self.iter_specs()}
|
71
|
+
|
72
|
+
def call(self, spec: str | SpecDef, /, *args, **kwargs) -> Any:
|
73
|
+
spec: SpecDef = self.get_spec(spec)
|
74
|
+
impls: Sequence[ConcreteImpl] = self.impls.get(spec.name, ())
|
75
|
+
if spec.firstresult:
|
76
|
+
if len(impls) == 0:
|
77
|
+
return None
|
78
|
+
return impls[0].fn(*args, **kwargs)
|
79
|
+
return [impl.fn(*args, **kwargs) for impl in impls]
|
80
|
+
|
81
|
+
def get_impl(self, spec: str | SpecDef, /) -> ConcreteImpl | None:
|
82
|
+
spec: SpecDef = self.get_spec(spec)
|
83
|
+
fn: Callable | None = getattr(self, spec.name, None)
|
84
|
+
if fn is None:
|
85
|
+
return None
|
86
|
+
impl: ImplDef | None = getattr(fn, "impl", None)
|
87
|
+
if impl is None:
|
88
|
+
return None
|
89
|
+
return ConcreteImpl(
|
90
|
+
name=impl.name,
|
91
|
+
after=impl.after,
|
92
|
+
before=impl.before,
|
93
|
+
priority=impl.priority,
|
94
|
+
fn=fn,
|
95
|
+
plugin_name=self.name,
|
96
|
+
)
|
97
|
+
|
98
|
+
def iter_impls(self, spec: str | SpecDef, /) -> Generator[ConcreteImpl]:
|
99
|
+
graph = nx.DiGraph()
|
100
|
+
impls: dict[str, ConcreteImpl] = {}
|
101
|
+
for impl in self.iter_impls_unordered(spec):
|
102
|
+
impls[impl.plugin_name] = impl
|
103
|
+
graph.add_node(impl.plugin_name)
|
104
|
+
for after in impl.after:
|
105
|
+
graph.add_edge(after, impl.plugin_name)
|
106
|
+
for before in impl.before:
|
107
|
+
graph.add_edge(impl.plugin_name, before)
|
108
|
+
for impl in nx.lexicographical_topological_sort(
|
109
|
+
graph, key=lambda n: impls[n].priority if n in impls else 0
|
110
|
+
):
|
111
|
+
if impl not in impls:
|
112
|
+
continue
|
113
|
+
yield impls[impl]
|
114
|
+
|
115
|
+
def iter_impls_unordered(self, spec: str | SpecDef, /) -> Generator[ConcreteImpl]:
|
116
|
+
spec: SpecDef = self.get_spec(spec)
|
117
|
+
for plugin in self.plugins:
|
118
|
+
impl: ConcreteImpl | None = plugin.get_impl(spec)
|
119
|
+
if impl is None:
|
120
|
+
continue
|
121
|
+
yield impl
|
122
|
+
|
123
|
+
def register(self, plugin: Self) -> None:
|
124
|
+
self.plugins.append(plugin)
|
125
|
+
|
126
|
+
|
127
|
+
@overload
|
128
|
+
def spec(*, firstresult: bool = False) -> Decorator: ...
|
129
|
+
@overload
|
130
|
+
def spec[C: Callable](fn: C, /, *, firstresult: bool = False) -> C: ...
|
131
|
+
def spec(
|
132
|
+
fn: Callable | None = None, /, *, firstresult: bool = False
|
133
|
+
) -> Decorator | Callable:
|
134
|
+
if fn is None:
|
135
|
+
return functools.partial(spec, firstresult=firstresult)
|
136
|
+
|
137
|
+
@functools.wraps(fn)
|
138
|
+
def wrapper(self: Plugin, *args, **kwargs) -> Any:
|
139
|
+
return self.call(wrapper.spec, *args, **kwargs) # pyright: ignore[reportAttributeAccessIssue]
|
140
|
+
|
141
|
+
wrapper.spec = SpecDef(name=fn.__name__, firstresult=firstresult) # pyright: ignore[reportAttributeAccessIssue]
|
142
|
+
return wrapper
|
143
|
+
|
144
|
+
|
145
|
+
@overload
|
146
|
+
def impl(
|
147
|
+
*,
|
148
|
+
name: str,
|
149
|
+
after: str | Sequence[str] = (),
|
150
|
+
before: str | Sequence[str] = (),
|
151
|
+
priority: int = 0,
|
152
|
+
) -> Decorator: ...
|
153
|
+
@overload
|
154
|
+
def impl[C: Callable](
|
155
|
+
fn: C,
|
156
|
+
/,
|
157
|
+
*,
|
158
|
+
name: str,
|
159
|
+
after: str | Sequence[str] = (),
|
160
|
+
before: str | Sequence[str] = (),
|
161
|
+
priority: int = 0,
|
162
|
+
) -> C: ...
|
163
|
+
def impl(
|
164
|
+
fn: Callable | None = None,
|
165
|
+
/,
|
166
|
+
*,
|
167
|
+
name: str,
|
168
|
+
after: str | Sequence[str] = (),
|
169
|
+
before: str | Sequence[str] = (),
|
170
|
+
priority: int = 0,
|
171
|
+
) -> Decorator | Callable:
|
172
|
+
if fn is None:
|
173
|
+
return functools.partial(
|
174
|
+
impl, name=name, after=after, before=before, priority=priority
|
175
|
+
)
|
176
|
+
fn.impl = ImplDef(name=name, after=after, before=before, priority=priority) # pyright: ignore[reportFunctionMemberAccess]
|
177
|
+
return override(fn)
|
liblaf_cherries-0.1.2/PKG-INFO
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: liblaf-cherries
|
3
|
-
Version: 0.1.2
|
4
|
-
Summary: Add your description here
|
5
|
-
Project-URL: Changelog, https://github.com/liblaf/cherries/blob/main/CHANGELOG.md
|
6
|
-
Project-URL: Documentation, https://liblaf.github.io/cherries/
|
7
|
-
Project-URL: Homepage, https://github.com/liblaf/cherries
|
8
|
-
Project-URL: Issue Tracker, https://github.com/liblaf/cherries/issues
|
9
|
-
Project-URL: Release Notes, https://github.com/liblaf/cherries/releases
|
10
|
-
Project-URL: Source Code, https://github.com/liblaf/cherries
|
11
|
-
Author-email: liblaf <30631553+liblaf@users.noreply.github.com>
|
12
|
-
License-Expression: MIT
|
13
|
-
License-File: LICENSE
|
14
|
-
Classifier: Development Status :: 4 - Beta
|
15
|
-
Classifier: Intended Audience :: Developers
|
16
|
-
Classifier: Intended Audience :: Science/Research
|
17
|
-
Classifier: License :: OSI Approved
|
18
|
-
Classifier: License :: OSI Approved :: MIT License
|
19
|
-
Classifier: Operating System :: OS Independent
|
20
|
-
Classifier: Programming Language :: Python
|
21
|
-
Classifier: Programming Language :: Python :: 3
|
22
|
-
Classifier: Programming Language :: Python :: 3.12
|
23
|
-
Classifier: Programming Language :: Python :: 3.13
|
24
|
-
Classifier: Topic :: Software Development
|
25
|
-
Classifier: Topic :: Software Development :: Bug Tracking
|
26
|
-
Classifier: Topic :: Software Development :: Debuggers
|
27
|
-
Classifier: Topic :: Software Development :: Libraries
|
28
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
29
|
-
Classifier: Topic :: System
|
30
|
-
Classifier: Topic :: System :: Logging
|
31
|
-
Classifier: Topic :: Utilities
|
32
|
-
Classifier: Typing :: Typed
|
33
|
-
Requires-Python: >=3.12
|
34
|
-
Requires-Dist: comet-ml<4,>=3.49.10
|
35
|
-
Requires-Dist: dvc[webdav]<4,>=3.59.2
|
36
|
-
Requires-Dist: environs<15,>=14.2.0
|
37
|
-
Requires-Dist: gitpython<4,>=3.1.44
|
38
|
-
Requires-Dist: lazy-loader<0.5,>=0.4
|
39
|
-
Requires-Dist: liblaf-grapes<0.2,>=0.1.26
|
40
|
-
Requires-Dist: loguru<0.8,>=0.7.3
|
41
|
-
Requires-Dist: pydantic-settings<3,>=2.9.1
|
42
|
-
Requires-Dist: pydantic<3,>=2.11.5
|
43
|
-
Requires-Dist: rich<15,>=14.0.0
|
44
|
-
Description-Content-Type: text/markdown
|
45
|
-
|
46
|
-
{% include "../README.md" %}
|
@@ -1 +0,0 @@
|
|
1
|
-
{% include "../README.md" %}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{liblaf_cherries-0.1.2 → liblaf_cherries-0.1.4}/src/liblaf/cherries/integration/__init__.pyi
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|