halib 0.1.96__tar.gz → 0.1.98__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 (55) hide show
  1. {halib-0.1.96 → halib-0.1.98}/PKG-INFO +6 -2
  2. {halib-0.1.96 → halib-0.1.98}/README.md +4 -1
  3. halib-0.1.98/halib/filetype/ipynb.py +63 -0
  4. {halib-0.1.96 → halib-0.1.98}/halib.egg-info/PKG-INFO +6 -2
  5. {halib-0.1.96 → halib-0.1.98}/halib.egg-info/SOURCES.txt +1 -0
  6. {halib-0.1.96 → halib-0.1.98}/halib.egg-info/requires.txt +1 -0
  7. {halib-0.1.96 → halib-0.1.98}/setup.py +1 -1
  8. {halib-0.1.96 → halib-0.1.98}/.gitignore +0 -0
  9. {halib-0.1.96 → halib-0.1.98}/GDriveFolder.txt +0 -0
  10. {halib-0.1.96 → halib-0.1.98}/LICENSE.txt +0 -0
  11. {halib-0.1.96 → halib-0.1.98}/MANIFEST.in +0 -0
  12. {halib-0.1.96 → halib-0.1.98}/guide_publish_pip.pdf +0 -0
  13. {halib-0.1.96 → halib-0.1.98}/halib/__init__.py +0 -0
  14. {halib-0.1.96 → halib-0.1.98}/halib/common.py +0 -0
  15. {halib-0.1.96 → halib-0.1.98}/halib/cuda.py +0 -0
  16. {halib-0.1.96 → halib-0.1.98}/halib/filetype/__init__.py +0 -0
  17. {halib-0.1.96 → halib-0.1.98}/halib/filetype/csvfile.py +0 -0
  18. {halib-0.1.96 → halib-0.1.98}/halib/filetype/jsonfile.py +0 -0
  19. {halib-0.1.96 → halib-0.1.98}/halib/filetype/textfile.py +0 -0
  20. {halib-0.1.96 → halib-0.1.98}/halib/filetype/videofile.py +0 -0
  21. {halib-0.1.96 → halib-0.1.98}/halib/filetype/yamlfile.py +0 -0
  22. {halib-0.1.96 → halib-0.1.98}/halib/online/__init__.py +0 -0
  23. {halib-0.1.96 → halib-0.1.98}/halib/online/gdrive.py +0 -0
  24. {halib-0.1.96 → halib-0.1.98}/halib/online/gdrive_mkdir.py +0 -0
  25. {halib-0.1.96 → halib-0.1.98}/halib/online/gdrive_test.py +0 -0
  26. {halib-0.1.96 → halib-0.1.98}/halib/online/projectmake.py +0 -0
  27. {halib-0.1.96 → halib-0.1.98}/halib/research/__init__.py +0 -0
  28. {halib-0.1.96 → halib-0.1.98}/halib/research/base_config.py +0 -0
  29. {halib-0.1.96 → halib-0.1.98}/halib/research/base_exp.py +0 -0
  30. {halib-0.1.96 → halib-0.1.98}/halib/research/dataset.py +0 -0
  31. {halib-0.1.96 → halib-0.1.98}/halib/research/flop_csv.py +0 -0
  32. {halib-0.1.96 → halib-0.1.98}/halib/research/flops.py +0 -0
  33. {halib-0.1.96 → halib-0.1.98}/halib/research/metrics.py +0 -0
  34. {halib-0.1.96 → halib-0.1.98}/halib/research/mics.py +0 -0
  35. {halib-0.1.96 → halib-0.1.98}/halib/research/params_gen.py +0 -0
  36. {halib-0.1.96 → halib-0.1.98}/halib/research/perfcalc.py +0 -0
  37. {halib-0.1.96 → halib-0.1.98}/halib/research/perftb.py +0 -0
  38. {halib-0.1.96 → halib-0.1.98}/halib/research/plot.py +0 -0
  39. {halib-0.1.96 → halib-0.1.98}/halib/research/profiler.py +0 -0
  40. {halib-0.1.96 → halib-0.1.98}/halib/research/torchloader.py +0 -0
  41. {halib-0.1.96 → halib-0.1.98}/halib/research/wandb_op.py +0 -0
  42. {halib-0.1.96 → halib-0.1.98}/halib/rich_color.py +0 -0
  43. {halib-0.1.96 → halib-0.1.98}/halib/system/__init__.py +0 -0
  44. {halib-0.1.96 → halib-0.1.98}/halib/system/cmd.py +0 -0
  45. {halib-0.1.96 → halib-0.1.98}/halib/system/filesys.py +0 -0
  46. {halib-0.1.96 → halib-0.1.98}/halib/utils/__init__.py +0 -0
  47. {halib-0.1.96 → halib-0.1.98}/halib/utils/dataclass_util.py +0 -0
  48. {halib-0.1.96 → halib-0.1.98}/halib/utils/dict_op.py +0 -0
  49. {halib-0.1.96 → halib-0.1.98}/halib/utils/gpu_mon.py +0 -0
  50. {halib-0.1.96 → halib-0.1.98}/halib/utils/listop.py +0 -0
  51. {halib-0.1.96 → halib-0.1.98}/halib/utils/tele_noti.py +0 -0
  52. {halib-0.1.96 → halib-0.1.98}/halib/utils/video.py +0 -0
  53. {halib-0.1.96 → halib-0.1.98}/halib.egg-info/dependency_links.txt +0 -0
  54. {halib-0.1.96 → halib-0.1.98}/halib.egg-info/top_level.txt +0 -0
  55. {halib-0.1.96 → halib-0.1.98}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: halib
3
- Version: 0.1.96
3
+ Version: 0.1.98
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -40,6 +40,7 @@ Requires-Dist: timebudget
40
40
  Requires-Dist: tqdm
41
41
  Requires-Dist: tube_dl
42
42
  Requires-Dist: wandb
43
+ Requires-Dist: ipynbname
43
44
  Dynamic: author
44
45
  Dynamic: author-email
45
46
  Dynamic: classifier
@@ -52,8 +53,11 @@ Dynamic: summary
52
53
 
53
54
  # Helper package for coding and automation
54
55
 
56
+ **Version 0.1.98**
57
+ + `filetype/ipynb`: add `gen_ipynb_name` generator to create file name based on current notebook name as prefix (with optional timestamp)
58
+
55
59
  **Version 0.1.96**
56
- + `research/plot': add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
60
+ + `research/plot`: add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
57
61
 
58
62
 
59
63
  **Version 0.1.91**
@@ -1,7 +1,10 @@
1
1
  # Helper package for coding and automation
2
2
 
3
+ **Version 0.1.98**
4
+ + `filetype/ipynb`: add `gen_ipynb_name` generator to create file name based on current notebook name as prefix (with optional timestamp)
5
+
3
6
  **Version 0.1.96**
4
- + `research/plot': add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
7
+ + `research/plot`: add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
5
8
 
6
9
 
7
10
  **Version 0.1.91**
@@ -0,0 +1,63 @@
1
+ from contextlib import contextmanager
2
+ from pathlib import Path
3
+
4
+ import ipynbname
5
+
6
+ from ..common import console, now_str
7
+
8
+
9
+ @contextmanager
10
+ def gen_ipynb_name(
11
+ filename,
12
+ add_time_stamp=False,
13
+ nb_prefix="nb__",
14
+ separator="__",
15
+ ):
16
+ """
17
+ Context manager that prefixes the filename with the notebook name.
18
+ Output: NotebookName_OriginalName.ext
19
+ """
20
+ try:
21
+ nb_name = ipynbname.name()
22
+ except FileNotFoundError:
23
+ nb_name = "script" # Fallback
24
+
25
+ p = Path(filename)
26
+
27
+ # --- FIX START ---
28
+
29
+ # 1. Get the parts separately
30
+ original_stem = p.stem # "test" (no extension)
31
+ extension = p.suffix # ".csv"
32
+
33
+ now_string = now_str() if add_time_stamp else ""
34
+
35
+ # 2. Construct the base name (Notebook + Separator + OriginalName)
36
+ base_name = f"{nb_prefix}{nb_name}{separator}{original_stem}"
37
+
38
+ # 3. Append timestamp if needed
39
+ if now_string:
40
+ base_name = f"{base_name}{separator}{now_string}"
41
+
42
+ # 4. Add the extension at the VERY END
43
+ new_filename = f"{base_name}{extension}"
44
+
45
+ # --- FIX END ---
46
+
47
+ final_path = p.parent / new_filename
48
+
49
+ # Assuming you use 'rich' console based on your snippet
50
+ # console.rule()
51
+ # print(f"📝 Saving as: {final_path}")
52
+
53
+ yield str(final_path)
54
+
55
+
56
+ if __name__ == "__main__":
57
+ # --- Usage Example ---
58
+ # Assume Notebook Name is: "MyThesisWork"
59
+ filename = "results.csv"
60
+ with gen_ipynb_name(filename) as filename_ipynb:
61
+ # filename_ipynb is now: "MyThesisWork_results.csv"
62
+ print(f"File to save: {filename_ipynb}")
63
+ # df.to_csv(filename_ipynb)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: halib
3
- Version: 0.1.96
3
+ Version: 0.1.98
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -40,6 +40,7 @@ Requires-Dist: timebudget
40
40
  Requires-Dist: tqdm
41
41
  Requires-Dist: tube_dl
42
42
  Requires-Dist: wandb
43
+ Requires-Dist: ipynbname
43
44
  Dynamic: author
44
45
  Dynamic: author-email
45
46
  Dynamic: classifier
@@ -52,8 +53,11 @@ Dynamic: summary
52
53
 
53
54
  # Helper package for coding and automation
54
55
 
56
+ **Version 0.1.98**
57
+ + `filetype/ipynb`: add `gen_ipynb_name` generator to create file name based on current notebook name as prefix (with optional timestamp)
58
+
55
59
  **Version 0.1.96**
56
- + `research/plot': add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
60
+ + `research/plot`: add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
57
61
 
58
62
 
59
63
  **Version 0.1.91**
@@ -16,6 +16,7 @@ halib.egg-info/requires.txt
16
16
  halib.egg-info/top_level.txt
17
17
  halib/filetype/__init__.py
18
18
  halib/filetype/csvfile.py
19
+ halib/filetype/ipynb.py
19
20
  halib/filetype/jsonfile.py
20
21
  halib/filetype/textfile.py
21
22
  halib/filetype/videofile.py
@@ -28,3 +28,4 @@ timebudget
28
28
  tqdm
29
29
  tube_dl
30
30
  wandb
31
+ ipynbname
@@ -8,7 +8,7 @@ with open("requirements.txt") as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name="halib",
11
- version="0.1.96",
11
+ version="0.1.98",
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes