vt-commons 0.0.1__py3-none-any.whl → 0.0.1.dev1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vt-commons
3
- Version: 0.0.1
3
+ Version: 0.0.1.dev1
4
4
  Summary: Reusable common utilities, interfaces and implementations for python projects.
5
5
  Author-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
6
6
  Maintainer-email: Suhas Krishna Srivastava <suhas.srivastava@vaastav.tech>
@@ -28,79 +28,90 @@ Dynamic: license-file
28
28
 
29
29
  # vt-commons
30
30
 
31
+ ![PyPI - Types](https://img.shields.io/pypi/types/vt-commons)
32
+ ![GitHub License](https://img.shields.io/github/license/Vaastav-Technologies/py-commons)
31
33
  [![🔧 test](https://github.com/Vaastav-Technologies/py-commons/actions/workflows/test.yml/badge.svg)](https://github.com/Vaastav-Technologies/py-commons/actions/workflows/test.yml)
32
34
  [![💡 typecheck](https://github.com/Vaastav-Technologies/py-commons/actions/workflows/typecheck.yml/badge.svg)](https://github.com/Vaastav-Technologies/py-commons/actions/workflows/typecheck.yml)
33
35
  [![🛠️ lint](https://github.com/Vaastav-Technologies/py-commons/actions/workflows/lint.yml/badge.svg)](https://github.com/Vaastav-Technologies/py-commons/actions/workflows/lint.yml)
34
36
  [![📊 coverage](https://codecov.io/gh/Vaastav-Technologies/py-commons/branch/main/graph/badge.svg)](https://codecov.io/gh/Vaastav-Technologies/py-commons)
35
37
  [![📤 Upload Python Package](https://github.com/Vaastav-Technologies/py-commons/actions/workflows/python-publish.yml/badge.svg)](https://github.com/Vaastav-Technologies/py-commons/actions/workflows/python-publish.yml)
38
+ ![PyPI - Version](https://img.shields.io/pypi/v/vt-commons)
36
39
 
37
40
  ---
38
- Commons methods, utils, interfaces and implementations for python projects.
41
+ A fully typed library for commons methods, utils, interfaces and implementations for python projects.
39
42
 
40
43
  ### Install
41
44
 
42
- ```shell
43
- pip install vt-commons
44
- ```
45
+ ```shell
46
+ pip install vt-commons
47
+ ```
45
48
 
46
49
  #### Usage examples
47
50
 
48
51
  - Check for OS
49
52
  ```python
50
- from vt.utils.commons.commons.os import is_windows
53
+ from vt.utils.commons.commons.os import is_windows
51
54
 
52
- is_windows()
55
+ windows = is_windows()
53
56
  ```
54
57
  Check in `vt.utils.commons.commons.os` and documentation for more functions and utilities related to OS.
58
+
59
+
55
60
  - Perform some operation on a root directory
56
61
  ```python
57
- from vt.utils.commons.commons.op import RootDirOp, CWDRootDirOp, RootDirOps
58
- from pathlib import Path
62
+ from vt.utils.commons.commons.op import RootDirOp, CWDRootDirOp, RootDirOps
63
+ from pathlib import Path
59
64
 
60
- class MyRootDirectoryOperation(RootDirOp):
61
- ...
62
- @property
63
- def root_dir(self)-> Path:
64
- return Path('path', 'to', 'my', 'root-directory')
65
+ class MyRootDirectoryOperation(RootDirOp):
66
+ ...
67
+ @property
68
+ def root_dir(self)-> Path:
69
+ return Path('path', 'to', 'my', 'root-directory')
65
70
 
66
- certain_root_dir_operation: CWDRootDirOp = RootDirOps.from_path(Path('path', 'to', 'my', 'root-directory'))
71
+ certain_root_dir_operation: CWDRootDirOp = RootDirOps.from_path(Path('path', 'to', 'my', 'root-directory'))
67
72
  ```
68
73
  Check in `vt.utils.commons.commons.op` and documentation for more functions and utilities related to operations.
74
+
75
+
69
76
  - Perform state operations
70
77
  ```python
71
- from vt.utils.commons.commons.state import DoneMarker
72
-
73
- # Track state by marking done
74
- class MyStateManager(DoneMarker[int]):
75
- def __init__(self, *args, **kwargs):
76
- self.id_state = {1: False}
77
- ...
78
-
79
- def mark_done(self, _id: int)-> bool:
80
- # mark done for _id
81
- if self.id_state[_id] is True:
82
- return False
83
- self.id_state[_id] = True
84
- return True
78
+ from vt.utils.commons.commons.state import DoneMarker
79
+
80
+ # Track state by marking done
81
+ class MyStateManager(DoneMarker[int]):
82
+ def __init__(self, *args, **kwargs):
83
+ self.id_state = {1: False}
84
+ ...
85
+
86
+ def mark_done(self, _id: int)-> bool:
87
+ # mark done for _id
88
+ if self.id_state[_id] is True:
89
+ return False
90
+ self.id_state[_id] = True
91
+ return True
85
92
  ```
86
93
  Check in `vt.utils.commons.commons.state` and documentation for more functions and utilities related to tracking state.
94
+
95
+
87
96
  - Check if a value is `MISSING`
88
97
  ```python
89
- from vt.utils.commons.commons.core_py import MISSING, Missing, is_missing
90
-
91
- def some_operation(arg: Missing = MISSING):
92
- """
93
- ``MISSING`` can be used as a default value sentinel when ``None`` is a valid value for arg.
94
- """
95
- arg = 10 if is_missing(arg) else arg
96
- ...
98
+ from vt.utils.commons.commons.core_py import MISSING, Missing, is_missing
99
+
100
+ def some_operation(arg: Missing = MISSING):
101
+ """
102
+ ``MISSING`` can be used as a default value sentinel when ``None`` is a valid value for arg.
103
+ """
104
+ arg = 10 if is_missing(arg) else arg
105
+ ...
97
106
  ```
98
107
  Check in `vt.utils.commons.commons.core_py` and documentation for more functions and utilities related to function management.
108
+
109
+
99
110
  - Query and operate on iterables
100
111
  ```python
101
- from vt.utils.commons.commons.collections import get_first_true
112
+ from vt.utils.commons.commons.collections import get_first_true
102
113
 
103
- assert 3 == get_first_true([1, 3, 5, 7, 2, 1], 8, lambda x: x>2)
114
+ assert 3 == get_first_true([1, 3, 5, 7, 2, 1], 8, lambda x: x>2)
104
115
  ```
105
116
  Check in `vt.utils.commons.commons.collections` and documentation for more functions and utilities related to collection management.
106
117
 
@@ -15,8 +15,8 @@ vt/utils/commons/commons/os/posix.py,sha256=V8kij7pGDXj6uJWWf4gUhjzYlBMDMKvWqcVJ
15
15
  vt/utils/commons/commons/os/windows.py,sha256=fJeVn0cdNplzPOiJbeGY8yyriug28Jei1WGKaLBFJFw,671
16
16
  vt/utils/commons/commons/state/__init__.py,sha256=sKFo9_VSnv_VyFlnzUnET7_QkKnqXYrj9cEU1u3w83I,494
17
17
  vt/utils/commons/commons/state/done.py,sha256=fGs0yNWgwRwm44gzmR6FNX7NKq7-39rEnsri9ztyZ4o,5146
18
- vt_commons-0.0.1.dist-info/licenses/LICENSE,sha256=pOzr5bMWS6mHi3vro8d5vw0qW1i14rVq2XFrDuystVY,11372
19
- vt_commons-0.0.1.dist-info/METADATA,sha256=M-_m3IVJCzejea3o2OAm0uOmWMivNE8JXBF1nFIuyHQ,4718
20
- vt_commons-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- vt_commons-0.0.1.dist-info/top_level.txt,sha256=aN5KWgJq84W0MDifCX3yRJAp04FH7pd5PDh7qa2P8sM,3
22
- vt_commons-0.0.1.dist-info/RECORD,,
18
+ vt_commons-0.0.1.dev1.dist-info/licenses/LICENSE,sha256=pOzr5bMWS6mHi3vro8d5vw0qW1i14rVq2XFrDuystVY,11372
19
+ vt_commons-0.0.1.dev1.dist-info/METADATA,sha256=DUvDCRNfElJ2EJVlVBna7g7gvY3vJOda8joYgdl1gW8,4924
20
+ vt_commons-0.0.1.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ vt_commons-0.0.1.dev1.dist-info/top_level.txt,sha256=aN5KWgJq84W0MDifCX3yRJAp04FH7pd5PDh7qa2P8sM,3
22
+ vt_commons-0.0.1.dev1.dist-info/RECORD,,