Skip to main content

A reusable timer utility for Python programming

Project description

Code-Time: A Reusable Timer Utility for Python Scripts

time-checker is a lightweight and reusable Python package for measuring the execution time of scripts, functions, and code blocks. It's perfect for developers who want to profile their Python code quickly.

Features

  • Function Timing: Use a decorator to measure the execution time of any function.
  • Code Block Timing: Use a context manager to time specific blocks of code.

Installation

Install Time-Checker using pip:

pip install time-checker

Usage

1. Timing Code Blocks

Use the time_block context manager to measure the time taken by a specific block of code:

from time_checker.timer import time_block

with time_block("Processing Loop"):
    for _ in range(10**6):
        pass

Output:

Processing Loop executed in 0.1234 seconds

2. Timing Functions

Use the time_function decorator to measure the time taken by any function:

from time_checker.timer import time_function

@time_function
def example_function():
    for _ in range(10**7):
        pass

example_function()

Output:

Function 'example_function' executed in 0.4567 seconds

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Author

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_checker-0.0.7.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

time_checker-0.0.7-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file time_checker-0.0.7.tar.gz.

File metadata

  • Download URL: time_checker-0.0.7.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for time_checker-0.0.7.tar.gz
Algorithm Hash digest
SHA256 6c808c93384c5c4b0318e04eeb568365e60296205523a1fad31b8fbae77f5370
MD5 09f07c511d8c196e64dccc8ed646ce85
BLAKE2b-256 ba774af19768035e23fc0f2b335d70ebb097e0598843b96fa945805aa90baf46

See more details on using hashes here.

File details

Details for the file time_checker-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: time_checker-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for time_checker-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7d0eae3b2eadd3507f1e051f1933c5d663db7fe369bebc26795c3d6ba6393a1f
MD5 fd51514654535e328f66e765b013c8e5
BLAKE2b-256 dade715f7dfd8fee798e2bb25a756ea1bf5b0544d196c1e3c036850df19816a6

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