Skip to main content

sam_pytools is a collection of Python utilities that provide commonly used functions, so we do not need to write

Project description

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

To install sam_pytools, use pip:

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()}')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sam_pytools-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sam_pytools-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file sam_pytools-0.1.0.tar.gz.

File metadata

  • Download URL: sam_pytools-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sam_pytools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c2eb1ef1f981be2bf3ec43fb55381be6574cd0fa81c948606d7a2849db54ec4e
MD5 a98258e4a39fe5ebf61242473a535b6d
BLAKE2b-256 d82427743fc0e4cfef3edc6c557503d5c4b39ed145b9cc4202f037e5c24f8816

See more details on using hashes here.

File details

Details for the file sam_pytools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sam_pytools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for sam_pytools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24da098bd45b8a75bdc578e75644d93d07998cdb420e0aecbeb6c58e079a2325
MD5 d7ec6d113fbdb77bb4eacae9dac7d79e
BLAKE2b-256 2d04d4f8a51d63592274c85a3ffafe9487d349c8c7ff2891e12d73ef97897f0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page