dr-wandb 0.1.0__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.

Potentially problematic release.


This version of dr-wandb might be problematic. Click here for more details.

dr_wandb/__init__.py CHANGED
@@ -1,2 +1,9 @@
1
- def hello() -> str:
2
- return "Hello from dr-wandb!"
1
+ """dr_wandb public API."""
2
+
3
+ from .fetch import fetch_project_runs, serialize_history_entry, serialize_run
4
+
5
+ __all__ = [
6
+ "fetch_project_runs",
7
+ "serialize_history_entry",
8
+ "serialize_run",
9
+ ]
dr_wandb/fetch.py ADDED
@@ -0,0 +1,80 @@
1
+ """Lightweight WandB fetch utilities that avoid database storage."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Callable, Iterator
6
+ from typing import Any
7
+
8
+ import wandb
9
+
10
+ from dr_wandb.history_entry_record import HistoryEntryRecord
11
+ from dr_wandb.run_record import RunRecord
12
+ from dr_wandb.utils import default_progress_callback
13
+
14
+ ProgressFn = Callable[[int, int, str], None]
15
+
16
+
17
+ def _iterate_runs(
18
+ entity: str,
19
+ project: str,
20
+ *,
21
+ runs_per_page: int,
22
+ ) -> Iterator[wandb.apis.public.Run]:
23
+ api = wandb.Api()
24
+ yield from api.runs(f"{entity}/{project}", per_page=runs_per_page)
25
+
26
+
27
+ def serialize_run(run: wandb.apis.public.Run) -> dict[str, Any]:
28
+ """Convert a WandB run into a JSON-friendly dict."""
29
+
30
+ record = RunRecord.from_wandb_run(run)
31
+ return record.to_dict(include="all")
32
+
33
+
34
+ def serialize_history_entry(
35
+ run: wandb.apis.public.Run, history_entry: dict[str, Any]
36
+ ) -> dict[str, Any]:
37
+ """Convert a raw history payload into a structured dict."""
38
+
39
+ record = HistoryEntryRecord.from_wandb_history(history_entry, run.id)
40
+ return {
41
+ "run_id": record.run_id,
42
+ "step": record.step,
43
+ "timestamp": record.timestamp,
44
+ "runtime": record.runtime,
45
+ "wandb_metadata": record.wandb_metadata,
46
+ "metrics": record.metrics,
47
+ }
48
+
49
+
50
+ def fetch_project_runs(
51
+ entity: str,
52
+ project: str,
53
+ *,
54
+ runs_per_page: int = 500,
55
+ include_history: bool = True,
56
+ progress_callback: ProgressFn | None = None,
57
+ ) -> tuple[list[dict[str, Any]], list[list[dict[str, Any]]]]:
58
+ """Download runs (and optional history) without requiring Postgres."""
59
+
60
+ progress = progress_callback or default_progress_callback
61
+
62
+ runs: list[dict[str, Any]] = []
63
+ histories: list[list[dict[str, Any]]] = []
64
+
65
+ run_iter = list(_iterate_runs(entity, project, runs_per_page=runs_per_page))
66
+ total = len(run_iter)
67
+
68
+ for index, run in enumerate(run_iter, start=1):
69
+ runs.append(serialize_run(run))
70
+ if include_history:
71
+ history_payloads = [
72
+ serialize_history_entry(run, entry) for entry in run.scan_history()
73
+ ]
74
+ histories.append(history_payloads)
75
+ progress(index, total, run.name)
76
+
77
+ if not include_history:
78
+ histories = []
79
+
80
+ return runs, histories
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dr-wandb
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Interact with wandb from python
5
5
  Author-email: Danielle Rothermel <danielle.rothermel@gmail.com>
6
6
  License-File: LICENSE
@@ -17,6 +17,8 @@ Description-Content-Type: text/markdown
17
17
 
18
18
  A command-line utility for downloading and archiving Weights & Biases experiment data to local storage formats optimized for offline analysis. Stores to PostgreSQL db + Parquet files, supports incremental updates and selective data retrieval.
19
19
 
20
+ > For shared context and onboarding steps, see the [Agent Guide](../dr_ref/docs/guides/AGENT_GUIDE_dr_wandb.md).
21
+
20
22
  ## Installation
21
23
 
22
24
  ```bash
@@ -120,4 +122,3 @@ The tool generates the following files in the output directory:
120
122
  - **runtime**: Elapsed time since run start
121
123
  - **wandb_metadata**: Platform logging metadata (JSONB)
122
124
  - **metrics**: All logged metrics and values (JSONB, flattened in Parquet export)
123
-
@@ -1,6 +1,7 @@
1
- dr_wandb/__init__.py,sha256=aAqpPH5MBqIT_dPF5aEdqnjglgsas1MTaYqEJxyHc6s,54
1
+ dr_wandb/__init__.py,sha256=C1FWh869zNWF5XU4XKyGfBPJ2hVpW_UsawIIusfXuQQ,199
2
2
  dr_wandb/constants.py,sha256=aKbkVU08aRdfrcSYu_UYXPI48ZpSTZUSpVZeXK2L4L8,534
3
3
  dr_wandb/downloader.py,sha256=X-NN1A1GilnUoxdEyHCsKJolqGBke_dIzS5wJWEAvvE,3888
4
+ dr_wandb/fetch.py,sha256=ZtCghL-FLftTF9nDp4TqA7IxVtitygkzAFyTPYuuuwA,2305
4
5
  dr_wandb/history_entry_record.py,sha256=ni9rXhYWxOg2kdidQ4norYAK37tGWj8xaB8R_lU4tw0,2010
5
6
  dr_wandb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
7
  dr_wandb/run_record.py,sha256=X3fmNOhsBfJsaCZEWhOtnulI16mXAYiH8K194CPdjfk,3794
@@ -8,8 +9,8 @@ dr_wandb/store.py,sha256=gWvlC0NIjcKeRP1rZooBz6dDq2nS2wIudsgahLso3VM,7063
8
9
  dr_wandb/utils.py,sha256=zzpHVOVo0QD82ik9ksQCP_vN7Zw0ov9dPGFfNMFgfmg,1796
9
10
  dr_wandb/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
11
  dr_wandb/cli/download.py,sha256=XvUY8Jl2u9BGo1l8QXn0foEFi5a3SfCARbvzZ-HxPoA,3710
11
- dr_wandb-0.1.0.dist-info/METADATA,sha256=2UBB8JfOPTCMWJbjXG8jOa0KC91GFwKlZguSzBdRwc8,4226
12
- dr_wandb-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- dr_wandb-0.1.0.dist-info/entry_points.txt,sha256=l4X0h3JbfOr_-3pgqiq3iy4MqUTSiaFUMeVf0DTck88,74
14
- dr_wandb-0.1.0.dist-info/licenses/LICENSE,sha256=6tUm1Q55M1UBMbbawzFlF0-DgCazM1BELo_5-RXA1K4,1075
15
- dr_wandb-0.1.0.dist-info/RECORD,,
12
+ dr_wandb-0.1.1.dist-info/METADATA,sha256=P57U_hJKc03-2KhR2lTPoCyYfjhH2enDJern4uIrLeM,4339
13
+ dr_wandb-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ dr_wandb-0.1.1.dist-info/entry_points.txt,sha256=l4X0h3JbfOr_-3pgqiq3iy4MqUTSiaFUMeVf0DTck88,74
15
+ dr_wandb-0.1.1.dist-info/licenses/LICENSE,sha256=6tUm1Q55M1UBMbbawzFlF0-DgCazM1BELo_5-RXA1K4,1075
16
+ dr_wandb-0.1.1.dist-info/RECORD,,