Skip to main content

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

Metadata

Release files for time-checker 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for time-checker 0.0.7
File Size Uploaded
time_checker-0.0.7.tar.gz 2.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for time-checker 0.0.7
File Interpreter ABI Platform
time_checker-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 kB

Release files / time_checker-0.0.7.tar.gz

Download URL time_checker-0.0.7.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6c808c93384c5c4b0318e04eeb568365e60296205523a1fad31b8fbae77f5370
BLAKE2b-256 checksum
How to use checksums
ba774af19768035e23fc0f2b335d70ebb097e0598843b96fa945805aa90baf46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release files / time_checker-0.0.7-py3-none-any.whl

Download URL time_checker-0.0.7-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d0eae3b2eadd3507f1e051f1933c5d663db7fe369bebc26795c3d6ba6393a1f
BLAKE2b-256 checksum
How to use checksums
dade715f7dfd8fee798e2bb25a756ea1bf5b0544d196c1e3c036850df19816a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page