halib 0.1.51__tar.gz → 0.1.53__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.51 → halib-0.1.53}/PKG-INFO +6 -2
  2. {halib-0.1.51 → halib-0.1.53}/README.md +5 -1
  3. {halib-0.1.51 → halib-0.1.53}/halib/research/perftb.py +2 -3
  4. halib-0.1.53/halib/utils/dataclass_util.py +39 -0
  5. {halib-0.1.51 → halib-0.1.53}/halib.egg-info/PKG-INFO +6 -2
  6. {halib-0.1.51 → halib-0.1.53}/halib.egg-info/SOURCES.txt +1 -0
  7. {halib-0.1.51 → halib-0.1.53}/halib.egg-info/requires.txt +1 -0
  8. {halib-0.1.51 → halib-0.1.53}/setup.py +1 -1
  9. {halib-0.1.51 → halib-0.1.53}/.gitignore +0 -0
  10. {halib-0.1.51 → halib-0.1.53}/GDriveFolder.txt +0 -0
  11. {halib-0.1.51 → halib-0.1.53}/LICENSE.txt +0 -0
  12. {halib-0.1.51 → halib-0.1.53}/MANIFEST.in +0 -0
  13. {halib-0.1.51 → halib-0.1.53}/guide_publish_pip.pdf +0 -0
  14. {halib-0.1.51 → halib-0.1.53}/halib/__init__.py +0 -0
  15. {halib-0.1.51 → halib-0.1.53}/halib/common.py +0 -0
  16. {halib-0.1.51 → halib-0.1.53}/halib/cuda.py +0 -0
  17. {halib-0.1.51 → halib-0.1.53}/halib/filetype/__init__.py +0 -0
  18. {halib-0.1.51 → halib-0.1.53}/halib/filetype/csvfile.py +0 -0
  19. {halib-0.1.51 → halib-0.1.53}/halib/filetype/jsonfile.py +0 -0
  20. {halib-0.1.51 → halib-0.1.53}/halib/filetype/textfile.py +0 -0
  21. {halib-0.1.51 → halib-0.1.53}/halib/filetype/videofile.py +0 -0
  22. {halib-0.1.51 → halib-0.1.53}/halib/filetype/yamlfile.py +0 -0
  23. {halib-0.1.51 → halib-0.1.53}/halib/online/__init__.py +0 -0
  24. {halib-0.1.51 → halib-0.1.53}/halib/online/gdrive.py +0 -0
  25. {halib-0.1.51 → halib-0.1.53}/halib/online/gdrive_mkdir.py +0 -0
  26. {halib-0.1.51 → halib-0.1.53}/halib/online/gdrive_test.py +0 -0
  27. {halib-0.1.51 → halib-0.1.53}/halib/online/projectmake.py +0 -0
  28. {halib-0.1.51 → halib-0.1.53}/halib/research/__init__.py +0 -0
  29. {halib-0.1.51 → halib-0.1.53}/halib/research/dataset.py +0 -0
  30. {halib-0.1.51 → halib-0.1.53}/halib/research/plot.py +0 -0
  31. {halib-0.1.51 → halib-0.1.53}/halib/research/torchloader.py +0 -0
  32. {halib-0.1.51 → halib-0.1.53}/halib/research/wandb_op.py +0 -0
  33. {halib-0.1.51 → halib-0.1.53}/halib/rich_color.py +0 -0
  34. {halib-0.1.51 → halib-0.1.53}/halib/system/__init__.py +0 -0
  35. {halib-0.1.51 → halib-0.1.53}/halib/system/cmd.py +0 -0
  36. {halib-0.1.51 → halib-0.1.53}/halib/system/filesys.py +0 -0
  37. {halib-0.1.51 → halib-0.1.53}/halib/utils/__init__.py +0 -0
  38. {halib-0.1.51 → halib-0.1.53}/halib/utils/listop.py +0 -0
  39. {halib-0.1.51 → halib-0.1.53}/halib/utils/tele_noti.py +0 -0
  40. {halib-0.1.51 → halib-0.1.53}/halib.egg-info/dependency_links.txt +0 -0
  41. {halib-0.1.51 → halib-0.1.53}/halib.egg-info/top_level.txt +0 -0
  42. {halib-0.1.51 → halib-0.1.53}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: halib
3
- Version: 0.1.51
3
+ Version: 0.1.53
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -15,7 +15,11 @@ License-File: LICENSE.txt
15
15
 
16
16
  Helper package for coding and automation
17
17
 
18
- **Version 0.1.51**
18
+ **Version 0.1.53**
19
+
20
+ + add `util/dataclass_util` to help dynamically create `dataclass` classes from dictionary or YAML file, including support for nested dataclasses. From there, we can use `dataclass_wizard` to create a list of `dataclass` classes with the help from ChatGPT.
21
+
22
+ **Version 0.1.52**
19
23
 
20
24
  + add `research/perftb` module to allow creating and managing performance tables for experiments, including filtering by datasets, metrics, and experiments.
21
25
 
@@ -1,6 +1,10 @@
1
1
  Helper package for coding and automation
2
2
 
3
- **Version 0.1.51**
3
+ **Version 0.1.53**
4
+
5
+ + add `util/dataclass_util` to help dynamically create `dataclass` classes from dictionary or YAML file, including support for nested dataclasses. From there, we can use `dataclass_wizard` to create a list of `dataclass` classes with the help from ChatGPT.
6
+
7
+ **Version 0.1.52**
4
8
 
5
9
  + add `research/perftb` module to allow creating and managing performance tables for experiments, including filtering by datasets, metrics, and experiments.
6
10
 
@@ -1,6 +1,6 @@
1
1
  import warnings
2
2
  warnings.filterwarnings("ignore", category=DeprecationWarning)
3
-
3
+ import os
4
4
  import random
5
5
  import itertools
6
6
  import plotly.express as px
@@ -304,8 +304,7 @@ class PerfTB:
304
304
  # Save and open plot
305
305
  if save_path:
306
306
  fig.write_image(save_path, engine="kaleido")
307
- print(f"Saved: {os.path.abspath(save_path)}")
308
-
307
+ # pprint(f"Saved: {os.path.abspath(save_path)}")
309
308
  if open_plot and os.name == "nt": # Windows
310
309
  os.system(f'start "" "{os.path.abspath(save_path)}"')
311
310
  return fig
@@ -0,0 +1,39 @@
1
+ import yaml
2
+ from typing import Any
3
+ from rich.pretty import pprint
4
+ from ..filetype import yamlfile
5
+ # from halib.filetype import yamlfile
6
+ from dataclasses import make_dataclass
7
+
8
+ def dict_to_dataclass(name: str, data: dict):
9
+ fields = []
10
+ values = {}
11
+
12
+ for key, value in data.items():
13
+ if isinstance(value, dict):
14
+ sub_dc = dict_to_dataclass(key.capitalize(), value)
15
+ fields.append((key, type(sub_dc)))
16
+ values[key] = sub_dc
17
+ else:
18
+ field_type = type(value) if value is not None else Any
19
+ fields.append((key, field_type))
20
+ values[key] = value
21
+
22
+ DC = make_dataclass(name.capitalize(), fields)
23
+ return DC(**values)
24
+
25
+ def yaml_to_dataclass(name: str, yaml_str: str):
26
+ data = yaml.safe_load(yaml_str)
27
+ return dict_to_dataclass(name, data)
28
+
29
+ def yamlfile_to_dataclass(name: str, file_path: str):
30
+ data_dict = yamlfile.load_yaml(file_path, to_dict=True)
31
+ if "__base__" in data_dict:
32
+ del data_dict["__base__"]
33
+ return dict_to_dataclass(name, data_dict)
34
+
35
+ if __name__ == "__main__":
36
+ cfg = yamlfile_to_dataclass("Config", "test/dataclass_util_test_cfg.yaml")
37
+
38
+ # ! NOTICE: after print out this dataclass, we can copy the output and paste it into CHATGPT to generate a list of needed dataclass classes using `from dataclass_wizard import YAMLWizard`
39
+ pprint(cfg)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: halib
3
- Version: 0.1.51
3
+ Version: 0.1.53
4
4
  Summary: Small library for common tasks
5
5
  Author: Hoang Van Ha
6
6
  Author-email: hoangvanhauit@gmail.com
@@ -15,7 +15,11 @@ License-File: LICENSE.txt
15
15
 
16
16
  Helper package for coding and automation
17
17
 
18
- **Version 0.1.51**
18
+ **Version 0.1.53**
19
+
20
+ + add `util/dataclass_util` to help dynamically create `dataclass` classes from dictionary or YAML file, including support for nested dataclasses. From there, we can use `dataclass_wizard` to create a list of `dataclass` classes with the help from ChatGPT.
21
+
22
+ **Version 0.1.52**
19
23
 
20
24
  + add `research/perftb` module to allow creating and managing performance tables for experiments, including filtering by datasets, metrics, and experiments.
21
25
 
@@ -35,5 +35,6 @@ halib/system/__init__.py
35
35
  halib/system/cmd.py
36
36
  halib/system/filesys.py
37
37
  halib/utils/__init__.py
38
+ halib/utils/dataclass_util.py
38
39
  halib/utils/listop.py
39
40
  halib/utils/tele_noti.py
@@ -27,3 +27,4 @@ timebudget
27
27
  tqdm
28
28
  tube_dl
29
29
  wandb
30
+ dataclass-wizard
@@ -8,7 +8,7 @@ with open("requirements.txt") as f:
8
8
 
9
9
  setuptools.setup(
10
10
  name="halib",
11
- version="0.1.51",
11
+ version="0.1.53",
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