halib 0.1.48__tar.gz → 0.1.49__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.
Files changed (42) hide show
  1. {halib-0.1.48/halib.egg-info → halib-0.1.49}/PKG-INFO +33 -7
  2. {halib-0.1.48 → halib-0.1.49}/README.md +3 -2
  3. halib-0.1.49/halib/research/wandb_op.py +116 -0
  4. {halib-0.1.48 → halib-0.1.49/halib.egg-info}/PKG-INFO +33 -7
  5. {halib-0.1.48 → halib-0.1.49}/halib.egg-info/SOURCES.txt +1 -0
  6. {halib-0.1.48 → halib-0.1.49}/halib.egg-info/requires.txt +1 -0
  7. {halib-0.1.48 → halib-0.1.49}/setup.py +1 -1
  8. {halib-0.1.48 → halib-0.1.49}/.gitignore +0 -0
  9. {halib-0.1.48 → halib-0.1.49}/GDriveFolder.txt +0 -0
  10. {halib-0.1.48 → halib-0.1.49}/LICENSE.txt +0 -0
  11. {halib-0.1.48 → halib-0.1.49}/guide_publish_pip.pdf +0 -0
  12. {halib-0.1.48 → halib-0.1.49}/halib/__init__.py +0 -0
  13. {halib-0.1.48 → halib-0.1.49}/halib/common.py +0 -0
  14. {halib-0.1.48 → halib-0.1.49}/halib/cuda.py +0 -0
  15. {halib-0.1.48 → halib-0.1.49}/halib/filetype/__init__.py +0 -0
  16. {halib-0.1.48 → halib-0.1.49}/halib/filetype/csvfile.py +0 -0
  17. {halib-0.1.48 → halib-0.1.49}/halib/filetype/jsonfile.py +0 -0
  18. {halib-0.1.48 → halib-0.1.49}/halib/filetype/textfile.py +0 -0
  19. {halib-0.1.48 → halib-0.1.49}/halib/filetype/videofile.py +0 -0
  20. {halib-0.1.48 → halib-0.1.49}/halib/filetype/yamlfile.py +0 -0
  21. {halib-0.1.48 → halib-0.1.49}/halib/online/__init__.py +0 -0
  22. {halib-0.1.48 → halib-0.1.49}/halib/online/gdrive.py +0 -0
  23. {halib-0.1.48 → halib-0.1.49}/halib/online/gdrive_mkdir.py +0 -0
  24. {halib-0.1.48 → halib-0.1.49}/halib/online/gdrive_test.py +0 -0
  25. {halib-0.1.48 → halib-0.1.49}/halib/online/projectmake.py +0 -0
  26. {halib-0.1.48 → halib-0.1.49}/halib/research/__init__.py +0 -0
  27. {halib-0.1.48 → halib-0.1.49}/halib/research/benchquery.py +0 -0
  28. {halib-0.1.48 → halib-0.1.49}/halib/research/dataset.py +0 -0
  29. {halib-0.1.48 → halib-0.1.49}/halib/research/plot.py +0 -0
  30. {halib-0.1.48 → halib-0.1.49}/halib/research/torchloader.py +0 -0
  31. {halib-0.1.48 → halib-0.1.49}/halib/rich_color.py +0 -0
  32. {halib-0.1.48 → halib-0.1.49}/halib/system/__init__.py +0 -0
  33. {halib-0.1.48 → halib-0.1.49}/halib/system/cmd.py +0 -0
  34. {halib-0.1.48 → halib-0.1.49}/halib/system/filesys.py +0 -0
  35. {halib-0.1.48 → halib-0.1.49}/halib/utils/__init__.py +0 -0
  36. {halib-0.1.48 → halib-0.1.49}/halib/utils/listop.py +0 -0
  37. {halib-0.1.48 → halib-0.1.49}/halib/utils/tele_noti.py +0 -0
  38. {halib-0.1.48 → halib-0.1.49}/halib.egg-info/dependency_links.txt +0 -0
  39. {halib-0.1.48 → halib-0.1.49}/halib.egg-info/top_level.txt +0 -0
  40. {halib-0.1.48 → halib-0.1.49}/setup.cfg +0 -0
  41. {halib-0.1.48 → halib-0.1.49}/test/test15.py +0 -0
  42. {halib-0.1.48 → halib-0.1.49}/test/test_df_creator.py +0 -0
@@ -1,23 +1,51 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: halib
3
- Version: 0.1.48
3
+ Version: 0.1.49
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
7
- License: UNKNOWN
8
- Platform: UNKNOWN
9
7
  Classifier: Programming Language :: Python :: 3
10
8
  Classifier: License :: OSI Approved :: MIT License
11
9
  Classifier: Operating System :: OS Independent
12
10
  Requires-Python: >=3.8
13
11
  Description-Content-Type: text/markdown
14
12
  License-File: LICENSE.txt
13
+ Requires-Dist: arrow
14
+ Requires-Dist: click
15
+ Requires-Dist: enlighten
16
+ Requires-Dist: kaleido==0.1.*
17
+ Requires-Dist: loguru
18
+ Requires-Dist: more-itertools
19
+ Requires-Dist: moviepy
20
+ Requires-Dist: networkx
21
+ Requires-Dist: numpy
22
+ Requires-Dist: omegaconf
23
+ Requires-Dist: opencv-python
24
+ Requires-Dist: pandas
25
+ Requires-Dist: Pillow
26
+ Requires-Dist: Pyarrow
27
+ Requires-Dist: pycurl
28
+ Requires-Dist: python-telegram-bot
29
+ Requires-Dist: requests
30
+ Requires-Dist: rich
31
+ Requires-Dist: scikit-learn
32
+ Requires-Dist: matplotlib
33
+ Requires-Dist: seaborn
34
+ Requires-Dist: plotly
35
+ Requires-Dist: pygwalker
36
+ Requires-Dist: tabulate
37
+ Requires-Dist: itables
38
+ Requires-Dist: timebudget
39
+ Requires-Dist: tqdm
40
+ Requires-Dist: tube_dl
41
+ Requires-Dist: wandb
15
42
 
16
43
  Helper package for coding and automation
17
44
 
18
- **Version 0.1.48**
45
+ **Version 0.1.49**
19
46
 
20
- + add `research` module to help with research tasks, including `benchquery` for benchmarking queries from dataframe
47
+ + add `research` package to help with research tasks, including `benchquery` for benchmarking queries from dataframe
48
+ + add `wandb` module to allow easy sync offline data to Weights & Biases (wandb) and batch clear wandb runs.
21
49
 
22
50
  **Version 0.1.47**
23
51
  + add `pprint_box` to print object/string in a box frame (like in `inspect`)
@@ -126,5 +154,3 @@ New Features
126
154
  New Features
127
155
 
128
156
  + add support to upload local to google drive.
129
-
130
-
@@ -1,8 +1,9 @@
1
1
  Helper package for coding and automation
2
2
 
3
- **Version 0.1.48**
3
+ **Version 0.1.49**
4
4
 
5
- + add `research` module to help with research tasks, including `benchquery` for benchmarking queries from dataframe
5
+ + add `research` package to help with research tasks, including `benchquery` for benchmarking queries from dataframe
6
+ + add `wandb` module to allow easy sync offline data to Weights & Biases (wandb) and batch clear wandb runs.
6
7
 
7
8
  **Version 0.1.47**
8
9
  + add `pprint_box` to print object/string in a box frame (like in `inspect`)
@@ -0,0 +1,116 @@
1
+ import glob
2
+ from rich.pretty import pprint
3
+ import os
4
+ import subprocess
5
+ import argparse
6
+ import wandb
7
+ from tqdm import tqdm
8
+ from rich.console import Console
9
+ console = Console()
10
+
11
+ def sync_runs(outdir):
12
+ outdir = os.path.abspath(outdir)
13
+ assert os.path.exists(outdir), f"Output directory {outdir} does not exist."
14
+ sub_dirs = [name for name in os.listdir(outdir) if os.path.isdir(os.path.join(outdir, name))]
15
+ assert len(sub_dirs) > 0, f"No subdirectories found in {outdir}."
16
+ console.rule("Parent Directory")
17
+ console.print(f"[yellow]{outdir}[/yellow]")
18
+
19
+ exp_dirs = [os.path.join(outdir, sub_dir) for sub_dir in sub_dirs]
20
+ wandb_dirs = []
21
+ for exp_dir in exp_dirs:
22
+ wandb_dirs.extend(glob.glob(f"{exp_dir}/wandb/*run-*"))
23
+ if len(wandb_dirs) == 0:
24
+ console.print(f"No wandb runs found in {outdir}.")
25
+ return
26
+ else:
27
+ console.print(f"Found [bold]{len(wandb_dirs)}[/bold] wandb runs in {outdir}.")
28
+ for i, wandb_dir in enumerate(wandb_dirs):
29
+ console.rule(f"Syncing wandb run {i + 1}/{len(wandb_dirs)}")
30
+ console.print(f"Syncing: {wandb_dir}")
31
+ process = subprocess.Popen(
32
+ ["wandb", "sync", wandb_dir],
33
+ stdout=subprocess.PIPE,
34
+ stderr=subprocess.STDOUT,
35
+ text=True,
36
+ )
37
+
38
+ for line in process.stdout:
39
+ console.print(line.strip())
40
+ if " ERROR Error while calling W&B API" in line:
41
+ break
42
+ process.stdout.close()
43
+ process.wait()
44
+ if process.returncode != 0:
45
+ console.print(f"[red]Error syncing {wandb_dir}. Return code: {process.returncode}[/red]")
46
+ else:
47
+ console.print(f"Successfully synced {wandb_dir}.")
48
+
49
+ def delete_runs(project, pattern=None):
50
+ console.rule("Delete W&B Runs")
51
+ confirm_msg = f"Are you sure you want to delete all runs in"
52
+ confirm_msg += f" \n\tproject: [red]{project}[/red]"
53
+ if pattern:
54
+ confirm_msg += f"\n\tpattern: [blue]{pattern}[/blue]"
55
+
56
+ console.print(confirm_msg)
57
+ confirmation = input(f"This action cannot be undone. [y/N]: ").strip().lower()
58
+ if confirmation != "y":
59
+ print("Cancelled.")
60
+ return
61
+
62
+ print("Confirmed. Proceeding...")
63
+ api = wandb.Api()
64
+ runs = api.runs(project)
65
+
66
+ deleted = 0
67
+ console.rule("Deleting W&B Runs")
68
+ if len(runs) == 0:
69
+ print("No runs found in the project.")
70
+ return
71
+ for run in tqdm(runs):
72
+ if pattern is None or pattern in run.name:
73
+ run.delete()
74
+ console.print(f"Deleted run: [red]{run.name}[/red]")
75
+ deleted += 1
76
+
77
+ console.print(f"Total runs deleted: {deleted}")
78
+
79
+
80
+ def valid_argument(args):
81
+ if args.op == "sync":
82
+ assert os.path.exists(args.outdir), f"Output directory {args.outdir} does not exist."
83
+ elif args.op == "delete":
84
+ assert isinstance(args.project, str) and len(args.project.strip()) > 0, "Project name must be a non-empty string."
85
+ else:
86
+ raise ValueError(f"Unknown operation: {args.op}")
87
+
88
+ def parse_args():
89
+ parser = argparse.ArgumentParser(description="Operations on W&B runs")
90
+ parser.add_argument("-op", "--op", type=str, help="Operation to perform", default="sync", choices=["delete", "sync"])
91
+ parser.add_argument("-prj", "--project", type=str, default="fire-paper2-2025", help="W&B project name")
92
+ parser.add_argument("-outdir", "--outdir", type=str, help="arg1 description", default="./zout/train")
93
+ parser.add_argument("-pt", "--pattern",
94
+ type=str,
95
+ default=None,
96
+ help="Run name pattern to match for deletion",
97
+ )
98
+
99
+ return parser.parse_args()
100
+
101
+
102
+ def main():
103
+ args = parse_args()
104
+ # Validate arguments, stop if invalid
105
+ valid_argument(args)
106
+
107
+ op = args.op
108
+ if op == "sync":
109
+ sync_runs(args.outdir)
110
+ elif op == "delete":
111
+ delete_runs(args.project, args.pattern)
112
+ else:
113
+ raise ValueError(f"Unknown operation: {op}")
114
+
115
+ if __name__ == "__main__":
116
+ main()
@@ -1,23 +1,51 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: halib
3
- Version: 0.1.48
3
+ Version: 0.1.49
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
7
- License: UNKNOWN
8
- Platform: UNKNOWN
9
7
  Classifier: Programming Language :: Python :: 3
10
8
  Classifier: License :: OSI Approved :: MIT License
11
9
  Classifier: Operating System :: OS Independent
12
10
  Requires-Python: >=3.8
13
11
  Description-Content-Type: text/markdown
14
12
  License-File: LICENSE.txt
13
+ Requires-Dist: arrow
14
+ Requires-Dist: click
15
+ Requires-Dist: enlighten
16
+ Requires-Dist: kaleido==0.1.*
17
+ Requires-Dist: loguru
18
+ Requires-Dist: more-itertools
19
+ Requires-Dist: moviepy
20
+ Requires-Dist: networkx
21
+ Requires-Dist: numpy
22
+ Requires-Dist: omegaconf
23
+ Requires-Dist: opencv-python
24
+ Requires-Dist: pandas
25
+ Requires-Dist: Pillow
26
+ Requires-Dist: Pyarrow
27
+ Requires-Dist: pycurl
28
+ Requires-Dist: python-telegram-bot
29
+ Requires-Dist: requests
30
+ Requires-Dist: rich
31
+ Requires-Dist: scikit-learn
32
+ Requires-Dist: matplotlib
33
+ Requires-Dist: seaborn
34
+ Requires-Dist: plotly
35
+ Requires-Dist: pygwalker
36
+ Requires-Dist: tabulate
37
+ Requires-Dist: itables
38
+ Requires-Dist: timebudget
39
+ Requires-Dist: tqdm
40
+ Requires-Dist: tube_dl
41
+ Requires-Dist: wandb
15
42
 
16
43
  Helper package for coding and automation
17
44
 
18
- **Version 0.1.48**
45
+ **Version 0.1.49**
19
46
 
20
- + add `research` module to help with research tasks, including `benchquery` for benchmarking queries from dataframe
47
+ + add `research` package to help with research tasks, including `benchquery` for benchmarking queries from dataframe
48
+ + add `wandb` module to allow easy sync offline data to Weights & Biases (wandb) and batch clear wandb runs.
21
49
 
22
50
  **Version 0.1.47**
23
51
  + add `pprint_box` to print object/string in a box frame (like in `inspect`)
@@ -126,5 +154,3 @@ New Features
126
154
  New Features
127
155
 
128
156
  + add support to upload local to google drive.
129
-
130
-
@@ -29,6 +29,7 @@ halib/research/benchquery.py
29
29
  halib/research/dataset.py
30
30
  halib/research/plot.py
31
31
  halib/research/torchloader.py
32
+ halib/research/wandb_op.py
32
33
  halib/system/__init__.py
33
34
  halib/system/cmd.py
34
35
  halib/system/filesys.py
@@ -26,3 +26,4 @@ itables
26
26
  timebudget
27
27
  tqdm
28
28
  tube_dl
29
+ wandb
@@ -8,7 +8,7 @@ with open("requirements.txt") as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name="halib",
11
- version="0.1.48",
11
+ version="0.1.49",
12
12
  author="Hoang Van Ha",
13
13
  author_email="hoangvanhauit@gmail.com",
14
14
  description="Small library for common tasks",
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