halib 0.1.49__py3-none-any.whl → 0.1.50__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.
halib/__init__.py CHANGED
@@ -21,7 +21,9 @@ __all__ = [
21
21
  "plt",
22
22
  "pprint",
23
23
  "pprint_box",
24
+ "pprint_local_path",
24
25
  "px",
26
+ "pprint_local_path",
25
27
  "rcolor_all_str",
26
28
  "rcolor_palette_all",
27
29
  "rcolor_palette",
@@ -36,6 +38,7 @@ __all__ = [
36
38
  "time",
37
39
  ]
38
40
  import warnings
41
+
39
42
  warnings.filterwarnings("ignore", message="Unable to import Axes3D")
40
43
 
41
44
  # common libraries
@@ -54,7 +57,15 @@ from .system import cmd
54
57
  from .system import filesys as fs
55
58
  from .filetype import csvfile
56
59
  from .cuda import tcuda
57
- from .common import console, console_log, ConsoleLog, now_str, norm_str, pprint_box
60
+ from .common import (
61
+ console,
62
+ console_log,
63
+ ConsoleLog,
64
+ now_str,
65
+ norm_str,
66
+ pprint_box,
67
+ pprint_local_path,
68
+ )
58
69
 
59
70
  # for log
60
71
  from loguru import logger
halib/common.py CHANGED
@@ -1,13 +1,17 @@
1
- import arrow
2
1
  import re
2
+ import rich
3
+ import arrow
4
+ import pathlib
5
+ from pathlib import Path
6
+ import urllib.parse
7
+
8
+ from rich import print
9
+ from rich.panel import Panel
3
10
  from rich.console import Console
4
11
  from rich.pretty import pprint, Pretty
5
- from rich.panel import Panel
6
- import rich
7
12
 
8
13
  console = Console()
9
14
 
10
-
11
15
  def seed_everything(seed=42):
12
16
  import random
13
17
  import numpy as np
@@ -54,7 +58,6 @@ def pprint_box(obj, title="", border_style="green"):
54
58
  Panel(Pretty(obj, expand_all=True), title=title, border_style=border_style)
55
59
  )
56
60
 
57
-
58
61
  def console_rule(msg, do_norm_msg=True, is_end_tag=False):
59
62
  msg = norm_str(msg) if do_norm_msg else msg
60
63
  if is_end_tag:
@@ -86,3 +89,20 @@ class ConsoleLog:
86
89
  if exc_type is not None:
87
90
  print(f"An exception of type {exc_type} occurred.")
88
91
  print(f"Exception message: {exc_value}")
92
+
93
+
94
+ def pprint_local_path(local_path, tag=""):
95
+ # Create a file URI
96
+ file_path = Path(local_path).resolve()
97
+ is_file = file_path.is_file()
98
+ is_dir = file_path.is_dir()
99
+ type_str = "📄" if is_file else "📁" if is_dir else "❓"
100
+ file_uri = file_path.as_uri()
101
+ content_str = f"{type_str} [link={file_uri}]{file_uri}[/link]"
102
+ if isinstance(tag, str) and len(tag) > 0:
103
+ with ConsoleLog(tag):
104
+ console.print(content_str)
105
+ else:
106
+ # If tag is not provided, just print the link
107
+ console.print(f"{content_str}")
108
+ return file_uri
@@ -1,156 +1,162 @@
1
- Metadata-Version: 2.1
2
- Name: halib
3
- Version: 0.1.49
4
- Summary: Small library for common tasks
5
- Author: Hoang Van Ha
6
- Author-email: hoangvanhauit@gmail.com
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.8
11
- Description-Content-Type: text/markdown
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
42
-
43
- Helper package for coding and automation
44
-
45
- **Version 0.1.49**
46
-
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.
49
-
50
- **Version 0.1.47**
51
- + add `pprint_box` to print object/string in a box frame (like in `inspect`)
52
-
53
- **Version 0.1.46**
54
- + filter the warning message of `UserWarning: Unable to import Axes3D.`
55
- + auto_wrap_text for `fn_display_df` to avoid long text in the table
56
-
57
- **Version 0.1.42**
58
- + add <rich_color.py>: add basic color list (for easy usage)
59
-
60
- **Version 0.1.41**
61
- + add <rich_color.py> to display rich color information in <rich> python package (rcolor_str, rcolor_pallet_all, etc.)
62
-
63
- **Version 0.1.40**
64
-
65
- + update <csvfile.py> to use `itables` and `pygwalker` to display dataframe in jupyter notebook.
66
-
67
- **Version 0.1.38**
68
-
69
- + add <torchloader.py> to search for best cfg for torch dataloader (num_workers, batch_size, pin_memory, et.)
70
-
71
- **Version 0.1.37**
72
-
73
- + add <dataset.py> to help split classification dataset into train/val(test)
74
- ---
75
- **Version 0.1.33**
76
-
77
- + add `plot.py` module to plot DL model training history (with columlns: epoch, train_accuracy, val_accuracy, train_loss, val_loss) using `seaborn` and `matplotlib`
78
- ---
79
- **Version 0.1.29**
80
-
81
- + for `tele_noti` module, `kaleido==0.1.*` is required for plotly since `kaleido 0.2.*` is not working (taking for ever to generate image)
82
- ---
83
- **Version 0.1.24**
84
-
85
- + rename `sys` to `system` to avoid conflict with built-in `sys` module
86
- + add `tele_noti` module to send notification to telegram after a specific interval for training progress monitoring
87
- ---
88
- **Version 0.1.22**
89
-
90
- + add `cuda.py` module to check CUDA availability (for both pytorch and tensorflow)
91
- ---
92
- **Version 0.1.21**
93
-
94
- + using `networkx` and `omegaconf` to allow yaml file inheritance and override
95
- ---
96
- **Version 0.1.15**
97
-
98
- + `__init__.py`: add common logging library; also `console_log` decorator to log function (start and end)
99
-
100
- ---
101
-
102
- **Version 0.1.10**
103
-
104
- + filesys: fix typo on "is_exit" to "is_exist"
105
- + gdrive: now support uploading file to folder and return direct link (shareable link)
106
-
107
- **Version 0.1.9**
108
-
109
- + add dependencies requirement.txt
110
-
111
- **Version 0.1.8**
112
-
113
- Fix bugs:
114
-
115
- + [performance] instead of inserting directly new rows into table dataframe, first insert it into in-memory `row_pool_dict`, that fill data in that dict into the actual dataframe when needed.
116
-
117
- ---
118
-
119
- **Version 0.1.7**
120
-
121
- Fix bugs:
122
-
123
- + fix insert into table so slow by allowing insert multiple rows at once
124
-
125
- ---
126
-
127
- **Version 0.1.6**
128
-
129
- New features:
130
-
131
- + add DFCreator for manipulating table (DataFrame) - create, insert row, display, write to file
132
-
133
- ---
134
-
135
- **Version 0.1.5**
136
-
137
- New Features
138
-
139
- + add cmd module
140
- + new package structure
141
-
142
- ---
143
-
144
- **Version 0.1.4**
145
-
146
- New Features
147
-
148
- + add support to create Bitbucket Project from template
149
-
150
- ---
151
-
152
- **Version 0.1.2**
153
-
154
- New Features
155
-
156
- + add support to upload local to google drive.
1
+ Metadata-Version: 2.1
2
+ Name: halib
3
+ Version: 0.1.50
4
+ Summary: Small library for common tasks
5
+ Author: Hoang Van Ha
6
+ Author-email: hoangvanhauit@gmail.com
7
+ License: UNKNOWN
8
+ Platform: UNKNOWN
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE.txt
15
+ Requires-Dist: arrow
16
+ Requires-Dist: click
17
+ Requires-Dist: enlighten
18
+ Requires-Dist: kaleido (==0.1.*)
19
+ Requires-Dist: loguru
20
+ Requires-Dist: more-itertools
21
+ Requires-Dist: moviepy
22
+ Requires-Dist: networkx
23
+ Requires-Dist: numpy
24
+ Requires-Dist: omegaconf
25
+ Requires-Dist: opencv-python
26
+ Requires-Dist: pandas
27
+ Requires-Dist: Pillow
28
+ Requires-Dist: Pyarrow
29
+ Requires-Dist: pycurl
30
+ Requires-Dist: python-telegram-bot
31
+ Requires-Dist: requests
32
+ Requires-Dist: rich
33
+ Requires-Dist: scikit-learn
34
+ Requires-Dist: matplotlib
35
+ Requires-Dist: seaborn
36
+ Requires-Dist: plotly
37
+ Requires-Dist: pygwalker
38
+ Requires-Dist: tabulate
39
+ Requires-Dist: itables
40
+ Requires-Dist: timebudget
41
+ Requires-Dist: tqdm
42
+ Requires-Dist: tube-dl
43
+ Requires-Dist: wandb
44
+
45
+ Helper package for coding and automation
46
+
47
+ **Version 0.1.50**
48
+
49
+ + add `pprint_local_path` to print local path (file/directory) in clickable link (as file URI)
50
+
51
+ + add `research` package to help with research tasks, including `benchquery` for benchmarking queries from dataframe
52
+ + add `wandb` module to allow easy sync offline data to Weights & Biases (wandb) and batch clear wandb runs.
53
+
54
+ **Version 0.1.47**
55
+ + add `pprint_box` to print object/string in a box frame (like in `inspect`)
56
+
57
+ **Version 0.1.46**
58
+ + filter the warning message of `UserWarning: Unable to import Axes3D.`
59
+ + auto_wrap_text for `fn_display_df` to avoid long text in the table
60
+
61
+ **Version 0.1.42**
62
+ + add <rich_color.py>: add basic color list (for easy usage)
63
+
64
+ **Version 0.1.41**
65
+ + add <rich_color.py> to display rich color information in <rich> python package (rcolor_str, rcolor_pallet_all, etc.)
66
+
67
+ **Version 0.1.40**
68
+
69
+ + update <csvfile.py> to use `itables` and `pygwalker` to display dataframe in jupyter notebook.
70
+
71
+ **Version 0.1.38**
72
+
73
+ + add <torchloader.py> to search for best cfg for torch dataloader (num_workers, batch_size, pin_memory, et.)
74
+
75
+ **Version 0.1.37**
76
+
77
+ + add <dataset.py> to help split classification dataset into train/val(test)
78
+ ---
79
+ **Version 0.1.33**
80
+
81
+ + add `plot.py` module to plot DL model training history (with columlns: epoch, train_accuracy, val_accuracy, train_loss, val_loss) using `seaborn` and `matplotlib`
82
+ ---
83
+ **Version 0.1.29**
84
+
85
+ + for `tele_noti` module, `kaleido==0.1.*` is required for plotly since `kaleido 0.2.*` is not working (taking for ever to generate image)
86
+ ---
87
+ **Version 0.1.24**
88
+
89
+ + rename `sys` to `system` to avoid conflict with built-in `sys` module
90
+ + add `tele_noti` module to send notification to telegram after a specific interval for training progress monitoring
91
+ ---
92
+ **Version 0.1.22**
93
+
94
+ + add `cuda.py` module to check CUDA availability (for both pytorch and tensorflow)
95
+ ---
96
+ **Version 0.1.21**
97
+
98
+ + using `networkx` and `omegaconf` to allow yaml file inheritance and override
99
+ ---
100
+ **Version 0.1.15**
101
+
102
+ + `__init__.py`: add common logging library; also `console_log` decorator to log function (start and end)
103
+
104
+ ---
105
+
106
+ **Version 0.1.10**
107
+
108
+ + filesys: fix typo on "is_exit" to "is_exist"
109
+ + gdrive: now support uploading file to folder and return direct link (shareable link)
110
+
111
+ **Version 0.1.9**
112
+
113
+ + add dependencies requirement.txt
114
+
115
+ **Version 0.1.8**
116
+
117
+ Fix bugs:
118
+
119
+ + [performance] instead of inserting directly new rows into table dataframe, first insert it into in-memory `row_pool_dict`, that fill data in that dict into the actual dataframe when needed.
120
+
121
+ ---
122
+
123
+ **Version 0.1.7**
124
+
125
+ Fix bugs:
126
+
127
+ + fix insert into table so slow by allowing insert multiple rows at once
128
+
129
+ ---
130
+
131
+ **Version 0.1.6**
132
+
133
+ New features:
134
+
135
+ + add DFCreator for manipulating table (DataFrame) - create, insert row, display, write to file
136
+
137
+ ---
138
+
139
+ **Version 0.1.5**
140
+
141
+ New Features
142
+
143
+ + add cmd module
144
+ + new package structure
145
+
146
+ ---
147
+
148
+ **Version 0.1.4**
149
+
150
+ New Features
151
+
152
+ + add support to create Bitbucket Project from template
153
+
154
+ ---
155
+
156
+ **Version 0.1.2**
157
+
158
+ New Features
159
+
160
+ + add support to upload local to google drive.
161
+
162
+
@@ -1,5 +1,5 @@
1
- halib/__init__.py,sha256=r3xoKNX_4QxzC7MsdSXRZSge29xBI5LdMwNouzf3xv8,1543
2
- halib/common.py,sha256=bR0MPbUmsBhLdu5LMRr-dnf6XG8iyjLEJsVxT_q-qKw,2315
1
+ halib/__init__.py,sha256=dHuxmYnZjeFT2VXuZU5yKX7c81XqcXX5tsKFtcaxkqI,1657
2
+ halib/common.py,sha256=ZWKT46IBnXygJIJyy2Mi1PNK_f9GfuppNxYYOrqFAx8,3001
3
3
  halib/csvfile.py,sha256=Eoeni0NIbNG3mB5ESWAvNwhJxOjmCaPd1qqYRHImbvk,1567
4
4
  halib/cuda.py,sha256=1bvtBY8QvTWdLaxalzK9wqXPl0Ft3AfhcrebupxGzEA,1010
5
5
  halib/dataset.py,sha256=QU0Hr5QFb8_XlvnOMgC9QJGIpwXAZ9lDd0RdQi_QRec,6743
@@ -42,8 +42,8 @@ halib/system/filesys.py,sha256=ERpnELLDKJoTIIKf-AajgkY62nID4qmqmX5TkE95APU,2931
42
42
  halib/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  halib/utils/listop.py,sha256=Vpa8_2fI0wySpB2-8sfTBkyi_A4FhoFVVvFiuvW8N64,339
44
44
  halib/utils/tele_noti.py,sha256=-4WXZelCA4W9BroapkRyIdUu9cUVrcJJhegnMs_WpGU,5928
45
- halib-0.1.49.dist-info/LICENSE.txt,sha256=qZssdna4aETiR8znYsShUjidu-U4jUT9Q-EWNlZ9yBQ,1100
46
- halib-0.1.49.dist-info/METADATA,sha256=G3MPTsD8-W3o1MptmTpzCvslPuQg6uVISpkSwRoLJqw,4208
47
- halib-0.1.49.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
48
- halib-0.1.49.dist-info/top_level.txt,sha256=7AD6PLaQTreE0Fn44mdZsoHBe_Zdd7GUmjsWPyQ7I-k,6
49
- halib-0.1.49.dist-info/RECORD,,
45
+ halib-0.1.50.dist-info/LICENSE.txt,sha256=qZssdna4aETiR8znYsShUjidu-U4jUT9Q-EWNlZ9yBQ,1100
46
+ halib-0.1.50.dist-info/METADATA,sha256=resodiH8D_oUSzB_YnE91Z__8oAqIlCErBqkUVRl_Cw,4187
47
+ halib-0.1.50.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
48
+ halib-0.1.50.dist-info/top_level.txt,sha256=7AD6PLaQTreE0Fn44mdZsoHBe_Zdd7GUmjsWPyQ7I-k,6
49
+ halib-0.1.50.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.2.0)
2
+ Generator: bdist_wheel (0.37.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5