expr_tracker 0.1.0__tar.gz → 0.1.2__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.
@@ -10,3 +10,4 @@ wandb/
10
10
  .env
11
11
  # Virtual environments
12
12
  .venv
13
+ test.ipynb
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: expr_tracker
3
+ Version: 0.1.2
4
+ Summary: Add your description here
5
+ Author-email: HSPK <whxway@whu.edu.cn>
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: jsonlines>=4.0.0
8
+ Requires-Dist: loguru>=0.7.3
9
+ Requires-Dist: slark>=0.1.28
10
+ Requires-Dist: wandb>=0.21.0
11
+ Description-Content-Type: text/markdown
12
+
13
+ # Experiment Tracker
14
+
15
+ A simple experiment tracker that supports `wandb`, `trackio` and local `jsonl` storage. Features include:
16
+
17
+ ## Features
18
+ 1. **Multi-Backend Support**: Compatible with `wandb`, `trackio`, and local `jsonl` storage.
19
+ 2. **Alert System**: Send alerts via Lark, with email and other platforms to be added.
20
+ 3. **Resume Functionality**: Allows resuming experiments using project and name as unique identifiers.
21
+ 4. **Simple API**: Provides a straightforward API similar to `wandb`, making it easy to integrate into existing workflows.
22
+
23
+ ## Usage
24
+
25
+ Add dependency to your project:
26
+
27
+ ```bash
28
+ uv add expr_tracker
29
+ ```
30
+
31
+ Simple usage example:
32
+ ```python
33
+ import expr_tracker as et
34
+
35
+ et.init(project="my_project", name="my_experiment", backends=["wandb", "jsonl"])
36
+ et.log({"accuracy": 0.95, "loss": 0.05})
37
+ et.alert("Experiment completed!", text="Your experiment has finished successfully.", subtitle="Experiment Status")
38
+ et.finish()
39
+ ```
@@ -0,0 +1,27 @@
1
+ # Experiment Tracker
2
+
3
+ A simple experiment tracker that supports `wandb`, `trackio` and local `jsonl` storage. Features include:
4
+
5
+ ## Features
6
+ 1. **Multi-Backend Support**: Compatible with `wandb`, `trackio`, and local `jsonl` storage.
7
+ 2. **Alert System**: Send alerts via Lark, with email and other platforms to be added.
8
+ 3. **Resume Functionality**: Allows resuming experiments using project and name as unique identifiers.
9
+ 4. **Simple API**: Provides a straightforward API similar to `wandb`, making it easy to integrate into existing workflows.
10
+
11
+ ## Usage
12
+
13
+ Add dependency to your project:
14
+
15
+ ```bash
16
+ uv add expr_tracker
17
+ ```
18
+
19
+ Simple usage example:
20
+ ```python
21
+ import expr_tracker as et
22
+
23
+ et.init(project="my_project", name="my_experiment", backends=["wandb", "jsonl"])
24
+ et.log({"accuracy": 0.95, "loss": 0.05})
25
+ et.alert("Experiment completed!", text="Your experiment has finished successfully.", subtitle="Experiment Status")
26
+ et.finish()
27
+ ```
@@ -1,22 +1,23 @@
1
1
  [project]
2
2
  name = "expr_tracker"
3
- version = "0.1.0"
4
3
  description = "Add your description here"
5
4
  readme = "README.md"
6
5
  authors = [{ name = "HSPK", email = "whxway@whu.edu.cn" }]
7
6
  requires-python = ">=3.10"
8
7
  dependencies = [
9
8
  "jsonlines>=4.0.0",
10
- "loguru>=0.7.3",
11
- "slark>=0.1.27",
12
- "wandb>=0.21.0",
9
+ "loguru>=0.7.3",
10
+ "slark>=0.1.28",
11
+ "wandb>=0.21.0",
13
12
  ]
13
+ dynamic = ["version"]
14
+
15
+ [dependency-groups]
16
+ dev = ["ipykernel>=6.30.1"]
14
17
 
15
18
  [build-system]
16
- requires = ["hatchling"]
19
+ requires = ["hatchling", "uv-dynamic-versioning"]
17
20
  build-backend = "hatchling.build"
18
21
 
19
- [dependency-groups]
20
- dev = [
21
- "ipykernel>=6.30.1",
22
- ]
22
+ [tool.hatch.version]
23
+ source = "uv-dynamic-versioning"
@@ -1,4 +1,16 @@
1
1
  from typing import Literal
2
+ from loguru import logger
3
+
4
+
5
+ def ignore_exception(func):
6
+ def wrapper(*args, **kwargs):
7
+ try:
8
+ return func(*args, **kwargs)
9
+ except Exception as e:
10
+ logger.warning(f"Error occurred in {func.__name__}: {e}")
11
+ return None
12
+
13
+ return wrapper
2
14
 
3
15
 
4
16
  class LarkBackend:
@@ -29,6 +41,7 @@ class LarkBackend:
29
41
  )
30
42
 
31
43
 
44
+ @ignore_exception
32
45
  def alert(
33
46
  title: str,
34
47
  text: str,
@@ -50,6 +63,11 @@ def alert(
50
63
  for backend in backends:
51
64
  if backend == "lark":
52
65
  lark_backend = LarkBackend()
66
+ if lark_backend.lark._webhook_url is None:
67
+ logger.warning(
68
+ "Lark webhook URL is not set. Please set the WEBHOOK_URL environment variable."
69
+ )
70
+ return
53
71
  lark_backend.publish_alert(title, text, subtitle, level, traceback)
54
72
  else:
55
73
  raise NotImplementedError(f"Backend '{backend}' is not implemented.")
@@ -1253,7 +1253,7 @@ wheels = [
1253
1253
 
1254
1254
  [[package]]
1255
1255
  name = "slark"
1256
- version = "0.1.27"
1256
+ version = "0.1.28"
1257
1257
  source = { registry = "https://pypi.org/simple" }
1258
1258
  dependencies = [
1259
1259
  { name = "arrow" },
@@ -1264,9 +1264,9 @@ dependencies = [
1264
1264
  { name = "pydantic" },
1265
1265
  { name = "requests-toolbelt" },
1266
1266
  ]
1267
- sdist = { url = "https://files.pythonhosted.org/packages/6e/78/aa5ef330646ca00132371c4172ac08232a689f4a7aca67f4c7b1a7529a87/slark-0.1.27.tar.gz", hash = "sha256:4a1032f95fe1bce34dc3792e0f172bc2e5473392da354ad8eeaa250ab121df98", size = 103293 }
1267
+ sdist = { url = "https://files.pythonhosted.org/packages/76/6c/1632d06e19f3039c5fe4e8310056cf2cfaf4e2812b6ffe0176acefb8dca1/slark-0.1.28.tar.gz", hash = "sha256:f1f08bf5f82cbfadc0752b2339fb39c0c35faa834da4191e6c8e1ddca8ea49b5", size = 103331 }
1268
1268
  wheels = [
1269
- { url = "https://files.pythonhosted.org/packages/db/04/66d843aefb74e4e38cf8196a264eb76f17818967f723cbe14a884ff7dfcd/slark-0.1.27-py3-none-any.whl", hash = "sha256:7e13e55e49ee8200bb1f05455113367623970b2cc01edea1cbb78f8bbfe35d11", size = 155583 },
1269
+ { url = "https://files.pythonhosted.org/packages/d6/35/3d38da087da91451617012b3303ade17d271f48972f01fae293dd96418b2/slark-0.1.28-py3-none-any.whl", hash = "sha256:5c7ac2bc48192acfbf3dd691c9de48c47032beb4cfa072bad5115e0b37d9a9b7", size = 155638 },
1270
1270
  ]
1271
1271
 
1272
1272
  [[package]]
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: expr_tracker
3
- Version: 0.1.0
4
- Summary: Add your description here
5
- Author-email: HSPK <whxway@whu.edu.cn>
6
- Requires-Python: >=3.10
7
- Requires-Dist: jsonlines>=4.0.0
8
- Requires-Dist: loguru>=0.7.3
9
- Requires-Dist: slark>=0.1.27
10
- Requires-Dist: wandb>=0.21.0
File without changes