# 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`
Raw data
{
"_id": null,
"home_page": "https://github.com/humblesami/sam-djtools.git",
"name": "sam-pytools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "Sami Akram <eagle.ciit@gmail.com>",
"keywords": "urllib, httplib, http",
"author": null,
"author_email": "Sami Akram <eagle.ciit@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9d/55/ba0909dfe7a5bfde792e663c6871efc22384f576f868263086d841db8d8d/sam_pytools-0.1.3.tar.gz",
"platform": null,
"description": "# PY Tools\n\n`sam_pytools` is a collection of Python utilities that provide commonly used functions for handling dates, HTTP requests, JSON manipulation, logging, and more.\nThese tools help streamline various tasks in Python projects.\n\n\n### Installation\n\n`pip install samPytools`\n\n#### Available Modules\n GlobalValues: Manages global values like home and log directories.\n CoreUtils: Contains utility methods for general operations \n like downloading images, decoding bytes, generating unique IDs, etc.\n DateUtils: Provides date manipulation functions, \n including time difference calculations and interval additions.\n HttpUtils: Offers HTTP helper methods for GET and POST requests.\n JsonUtils: Contains JSON helper functions, like converting dictionaries to objects.\n LogUtils: Manages logging and error handling.\n AsyncUtils: Enables asynchronous execution of given tasks with asyncio or ThreadPoolExecutor.\n\n\n`pip install sam_pytools`\n\n#### Special features\n\nFor easier and clean error tracing\n\n`LogUtils.getErrorMessage()` is the one that can make life easier\n\nAnother is AsyncUtils\n```\n from sam_tools import AsyncUtils\n\n def task1():\n time.sleep(2)\n return 'task1 finished ' + DateUtils.now_str()\n \n def task2(par1):\n time.sleep(3)\n return f'task2 finished {DateUtils.now_str()}, received params => {par1}'\n \n def task3(par1, par2):\n time.sleep(1)\n return f'task3 finished {DateUtils.now_str()}, received params => {par1},{par2}'\n\n task_list = [(task1, []), (task2, [1]), (task3, [1, 2])]\n #Execute tasks asynchronously\n print(f'Tasks reached at {DateUtils.now_str()}')\n AsyncUtils.execute_tasks_with_no_wait(task_list)\n print(f'Tasks started at {DateUtils.now_str()}')\n```\n\n\n#### General about pip\n\nIf you want to reset your testing virtual environment\n\n`pip freeze | xargs pip uninstall -y`\n\nthen to install your requirements\n\n`pip install -r requirements.txt`\n",
"bugtrack_url": null,
"license": null,
"summary": "sam_pytools is a collection of Python utilities that provide commonly used functions, so we do not need to write",
"version": "0.1.3",
"project_urls": {
"Changelog": "https://github.com/humblesami/pyutils/CHANGES.rst",
"Code": "https://github.com/humblesami/pyutils",
"Homepage": "https://github.com/humblesami/sam-djtools.git",
"Issue tracker": "https://github.com/humblesami/pyutils/issues"
},
"split_keywords": [
"urllib",
" httplib",
" http"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2aa4fa3fc5b2319fc08b9730ac64ab90534c1fea6fafcd3d8eb2895c8fa21c5c",
"md5": "25b6b8104f570c72346973fb28c7a67a",
"sha256": "99bdbd56c6968d9a56618739d233b1bbb5c824cd93b9dbf87761bcd894f16d78"
},
"downloads": -1,
"filename": "sam_pytools-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "25b6b8104f570c72346973fb28c7a67a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 5506,
"upload_time": "2024-11-08T21:01:11",
"upload_time_iso_8601": "2024-11-08T21:01:11.656765Z",
"url": "https://files.pythonhosted.org/packages/2a/a4/fa3fc5b2319fc08b9730ac64ab90534c1fea6fafcd3d8eb2895c8fa21c5c/sam_pytools-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9d55ba0909dfe7a5bfde792e663c6871efc22384f576f868263086d841db8d8d",
"md5": "5cddb02195f7f8359dde7df02832e68e",
"sha256": "af43f0ce8b023a834e03f870c80e5c7094c8f980b555f3066fb2532552ca7d45"
},
"downloads": -1,
"filename": "sam_pytools-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "5cddb02195f7f8359dde7df02832e68e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 8101,
"upload_time": "2024-11-08T21:01:13",
"upload_time_iso_8601": "2024-11-08T21:01:13.805830Z",
"url": "https://files.pythonhosted.org/packages/9d/55/ba0909dfe7a5bfde792e663c6871efc22384f576f868263086d841db8d8d/sam_pytools-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-08 21:01:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "humblesami",
"github_project": "sam-djtools",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "build",
"specs": [
[
"==",
"1.2.2.post1"
]
]
},
{
"name": "setuptools",
"specs": [
[
">=",
"70.0.0"
]
]
}
],
"lcname": "sam-pytools"
}