Skip to main content

clockitpy �

A small Python library to measure function execution time easily.

Installation

pip install clockitpy

Usage

Using as a decorator

from clockitpy import measure_time

@measure_time
def my_function():
    # Your code here
    sum([i for i in range(1000000)])

my_function()
# Output: my_function executed in 0.045123 seconds

Using timeit function

from clockitpy import timeit

def my_function():
    return sum([i for i in range(1000000)])

duration, result = timeit(my_function)
print(f"Execution time: {duration:.6f} seconds")
print(f"Result: {result}")

Features

  • measure_time: A decorator to automatically measure and print execution time
  • timeit: A function to measure execution time and get both duration and result

Requirements

  • Python >= 3.7

License

MIT License - see LICENSE file for details

Metadata

Release files for clockitpy 0.1.0

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

Source distribution (sdist)

Source distribution for clockitpy 0.1.0
File Size Uploaded
clockitpy-0.1.0.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clockitpy 0.1.0
File Interpreter ABI Platform
clockitpy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.8 kB

Release files / clockitpy-0.1.0.tar.gz

Download URL clockitpy-0.1.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2a57e7712ad016eebb69420a2fc472e3967f1f75af1ead4384d1c9dca8106545
BLAKE2b-256 checksum
How to use checksums
17d96fe1970d701264296f8099595c1f410d48931989801c668762a8e8775bd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / clockitpy-0.1.0-py3-none-any.whl

Download URL clockitpy-0.1.0-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0945256e49928af3803f8105f863b1c6878e2c15e5e1fd3baa2b3dfbb3d4a94d
BLAKE2b-256 checksum
How to use checksums
d9f35292d1b1a109dd81a9869cb471bf359942096d07089aa2f54ffe0f76f09d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

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