🔥Reusable common utilities, interfaces and implementations for python projects.
Project description
vt-commons
🔥Reusable common utilities, interfaces and implementations for python projects.
A fully typed library for common methods, utils, interfaces and implementations for python projects.
Install
pip install vt-commons
Usage examples
-
Check for OS
from vt.utils.commons.commons.os import is_windows windows = is_windows()
Check in
vt.utils.commons.commons.osand documentation for more functions and utilities related to OS. -
Perform some operation on a root directory
from vt.utils.commons.commons.op import RootDirOp, CWDRootDirOp, RootDirOps from pathlib import Path from typing import override class MyRootDirectoryOperation(RootDirOp): ... @override @property def root_dir(self)-> Path: return Path('path', 'to', 'my', 'root-directory') certain_root_dir_operation: CWDRootDirOp = RootDirOps.from_path(Path('path', 'to', 'my', 'root-directory'))
Check in
vt.utils.commons.commons.opand documentation for more functions and utilities related to operations. -
Perform state operations
from vt.utils.commons.commons.state import DoneMarker from typing import override # Track state by marking done class MyStateManager(DoneMarker[int]): def __init__(self, *args, **kwargs): self.id_state = {1: False} ... @override def mark_done(self, _id: int)-> bool: # mark done for _id if self.id_state[_id] is True: return False self.id_state[_id] = True return True
Check in
vt.utils.commons.commons.stateand documentation for more functions and utilities related to tracking state. -
Check if a value is
MISSINGfrom vt.utils.commons.commons.core_py import MISSING, Missing, is_missing def some_operation(arg: Missing = MISSING): """ ``MISSING`` can be used as a default value sentinel when ``None`` is a valid value for arg. """ arg = 10 if is_missing(arg) else arg ...
Check in
vt.utils.commons.commons.core_pyand documentation for more functions and utilities related to function management. -
Query and operate on iterables
>>> from vt.utils.commons.commons.collections import get_first_true, get_first_non_none >>> assert 3 == get_first_true([1, 3, 5, 7, 2, 1], 8, lambda x: x>2) >>> assert 10 == get_first_non_none([None, None, 10, 2, 6], 9)
Check in
vt.utils.commons.commons.collectionsand documentation for more functions and utilities related to collection management. -
String operations
>>> from vt.utils.commons.commons.string import generate_random_string >>> generate_random_string() #doctest: +ELLIPSIS '...'
Check in
vt.utils.commons.commons.stringand documentation for more functions and utilities related to strings
Contribute
Want to contribute?
Checkout Guidelines for contributions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vt_commons-0.0.1.dev7.tar.gz.
File metadata
- Download URL: vt_commons-0.0.1.dev7.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92dfff4b9724e0f3d4fefa2d0f3d28f056afed2aa77291f829af28eed6c5d9c9
|
|
| MD5 |
0a5f10823ed6523c016f2a3ab042055e
|
|
| BLAKE2b-256 |
760b18d37d0bdc278fbc945e5b84f749275afe8b47c06ba0c006f855b2d73211
|
Provenance
The following attestation bundles were made for vt_commons-0.0.1.dev7.tar.gz:
Publisher:
python-publish.yml on Vaastav-Technologies/py-commons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vt_commons-0.0.1.dev7.tar.gz -
Subject digest:
92dfff4b9724e0f3d4fefa2d0f3d28f056afed2aa77291f829af28eed6c5d9c9 - Sigstore transparency entry: 626511102
- Sigstore integration time:
-
Permalink:
Vaastav-Technologies/py-commons@f1ba3070271b3a45879e6f967eefca5d0c2a9fde -
Branch / Tag:
refs/tags/v0.0.1dev7 - Owner: https://github.com/Vaastav-Technologies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f1ba3070271b3a45879e6f967eefca5d0c2a9fde -
Trigger Event:
push
-
Statement type:
File details
Details for the file vt_commons-0.0.1.dev7-py3-none-any.whl.
File metadata
- Download URL: vt_commons-0.0.1.dev7-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3be92b96c6ea1ac653472abfbd72b6f892218a6ea1f6986cc11e2ea81c5fd176
|
|
| MD5 |
33830c99049472d171c60dc8435d1091
|
|
| BLAKE2b-256 |
6447926545a8c074da4bf3d45fa37ac8401022e50fbea8b36c44fceca81b5dc7
|
Provenance
The following attestation bundles were made for vt_commons-0.0.1.dev7-py3-none-any.whl:
Publisher:
python-publish.yml on Vaastav-Technologies/py-commons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vt_commons-0.0.1.dev7-py3-none-any.whl -
Subject digest:
3be92b96c6ea1ac653472abfbd72b6f892218a6ea1f6986cc11e2ea81c5fd176 - Sigstore transparency entry: 626511112
- Sigstore integration time:
-
Permalink:
Vaastav-Technologies/py-commons@f1ba3070271b3a45879e6f967eefca5d0c2a9fde -
Branch / Tag:
refs/tags/v0.0.1dev7 - Owner: https://github.com/Vaastav-Technologies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f1ba3070271b3a45879e6f967eefca5d0c2a9fde -
Trigger Event:
push
-
Statement type: