Skip to main content

Custom timer for your Python coding pleasure

Project description

code_timer

Simple python timer to use for single lines of code, or entire functions/classes

Latest version Python versions CircleCI

New Features!

  • codetimer logger allowing you to set the streaming level or hide the logging entirely
  • Ability to use code_timer.Timer as a class, context manager, decorator
  • Ability to use separate code_timer.timer decorator

Basic Usage

You can use code_timer.Timer in several different ways:

  1. As a class:

    t = Timer(name="class")
    t.start()
    # Do something
    t.stop()
    
  2. As a context manager:

    with Timer(name="context manager"):
        # Do something
    
  3. As a decorator:

    @Timer(name="decorator")
    def stuff():
        # Do something
    

You can also use the function defined decorator code_timer.timer.

  1. Without braces

    @timer
    def your_func():
        # Do something
    
  2. With braces

    @timer(name="my_timer")
    def your_func():
        # Do something
    

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

code_timer-1.1.0.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file code_timer-1.1.0.tar.gz.

File metadata

  • Download URL: code_timer-1.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for code_timer-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e74b0889da9eb0cab70bbf4497b1481d036b779baf089badf914fd8fa7c6251b
MD5 a5fe39dc9733b97f8be95055e524abfa
BLAKE2b-256 421bab6fc40bd778de04adc26bfe9a21940ff08c43ec68f1a7276af04d787632

See more details on using hashes here.

Supported by

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