Skip to main content

A package for timing python code

Project description

Time It!

pip install time-it to install

  • Python Decorator for timing functions. Its fast, and fun!
from time_it import time_def

@time_def
def time_max(A):
  return max(A)
  
time_max([1,4,2,5,3,3]) # prints execution time of time_max function and returns max value

With a logger

# setup logger
logger = logging.getLogger("gen")
logger.setLevel(logging.DEBUG)
stdh = logging.StreamHandler(sys.stdout)
stdh.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
stdh.setFormatter(formatter)
logger.addHandler(stdh)

# add decorator to function
@time_def(log_name="gen")
def time_with_log(A):
    return max(A)

time_with_log([1,4,2,5,3,3]) 

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

time_it-3.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

time_it-3-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file time_it-3.tar.gz.

File metadata

  • Download URL: time_it-3.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for time_it-3.tar.gz
Algorithm Hash digest
SHA256 baa0f6764b52bb4e1ed9a4a2f5e8725b080f34bda756ec9ad7fca52d180ada67
MD5 f76ab1aa2da36a232986609c9259b9ae
BLAKE2b-256 d68438b4571f56f6f214567d519650f6f9f28f5aea5649be2ffa29544eb03b36

See more details on using hashes here.

File details

Details for the file time_it-3-py3-none-any.whl.

File metadata

  • Download URL: time_it-3-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for time_it-3-py3-none-any.whl
Algorithm Hash digest
SHA256 edfa5a35d6583a8e22616c46f1dcd7f7650c61565960dac84d19802fa8c25ae4
MD5 bd0ece249dd1f54324c1d2aa81fbaaab
BLAKE2b-256 7db4038ece8ff4e31211bf6dbf60ae4e1c2f97ae722f953136cb14eff933f54e

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