PY Tools
sam_pytools is a collection of Python utilities that provide commonly used functions for handling dates, HTTP requests, JSON manipulation, logging, and more.
These tools help streamline various tasks in Python projects.
Installation
pip install samPytools
Available Modules
GlobalValues: Manages global values like home and log directories.
CoreUtils: Contains utility methods for general operations
like downloading images, decoding bytes, generating unique IDs, etc.
DateUtils: Provides date manipulation functions,
including time difference calculations and interval additions.
HttpUtils: Offers HTTP helper methods for GET and POST requests.
JsonUtils: Contains JSON helper functions, like converting dictionaries to objects.
LogUtils: Manages logging and error handling.
AsyncUtils: Enables asynchronous execution of given tasks with asyncio or ThreadPoolExecutor.
pip install sam_pytools
Special features
For easier and clean error tracing
LogUtils.getErrorMessage() is the one that can make life easier
Another is AsyncUtils
from sam_tools import AsyncUtils
def task1():
time.sleep(2)
return 'task1 finished ' + DateUtils.now_str()
def task2(par1):
time.sleep(3)
return f'task2 finished {DateUtils.now_str()}, received params => {par1}'
def task3(par1, par2):
time.sleep(1)
return f'task3 finished {DateUtils.now_str()}, received params => {par1},{par2}'
task_list = [(task1, []), (task2, [1]), (task3, [1, 2])]
#Execute tasks asynchronously
print(f'Tasks reached at {DateUtils.now_str()}')
AsyncUtils.execute_tasks_with_no_wait(task_list)
print(f'Tasks started at {DateUtils.now_str()}')
General about pip
If you want to reset your testing virtual environment
pip freeze | xargs pip uninstall -y
then to install your requirements
pip install -r requirements.txt
Metadata
Release files for sam-pytools 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sam_pytools-0.1.3.tar.gz | 8.1 kB | Without provenance | Details for sam_pytools-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sam_pytools-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for sam_pytools-0.1.3-py3-none-any.whl |
Total release size: 13.6 kB
Release files / sam_pytools-0.1.3.tar.gz
| Download URL | sam_pytools-0.1.3.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af43f0ce8b023a834e03f870c80e5c7094c8f980b555f3066fb2532552ca7d45
|
|
BLAKE2b-256 checksum How to use checksums |
9d55ba0909dfe7a5bfde792e663c6871efc22384f576f868263086d841db8d8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Release files / sam_pytools-0.1.3-py3-none-any.whl
| Download URL | sam_pytools-0.1.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99bdbd56c6968d9a56618739d233b1bbb5c824cd93b9dbf87761bcd894f16d78
|
|
BLAKE2b-256 checksum How to use checksums |
2aa4fa3fc5b2319fc08b9730ac64ab90534c1fea6fafcd3d8eb2895c8fa21c5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Security for sam-pytools 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.