Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Build Status Coverage Status PyPI version

The simplest ever library for measuring time of python code execution.

Installation

pip install timepy

How to use

from timepy import Timer

It’s simple:

t = Timer()

t.start()
# Your code which you want to measure
t.stop()
print(t.total_time)

You can give a name fro your timer:

t = Timer('My second timer')

Keep every moment you want

You can

t = Timer()
t.start()
# Some heavy work 1
t.commit('Work 1 is done')
# Some heave work 2
t.commit('Work 2 is done')
t.stop()

print(t.events)

# will output:
# [<TimerStarted: 0.0 s>,
#  <TimerCommitted: 10.0 s (Work 1 is done)>,
#  <TimerCommitted: 20.0 s (Work 2 is done)>,
#  <TimerStopped: 20.001 s>]

Measure your iterations

t = Timer()
t.start
for i in some_list:
    # do heavy work
    t.lap()
t.stop()

print(t.laps[0])      # <Lap 0: 123 s>
print(t.laps)         # see all laps
print(t.average_lap)  # average lap duration

Metadata

Release files for timepy 0.1a

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

Source distribution (sdist)

Source distribution for timepy 0.1a
File Size Uploaded
timepy-0.1a.tar.gz 3.4 kB Details

Release files / timepy-0.1a.tar.gz

Download URL timepy-0.1a.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e76cf6431ec7c0cf7e6a282acdbfb5f4bb0669c7669a39355d38086536aad07d
BLAKE2b-256 checksum
How to use checksums
2b0ba99f37640ff7493beeb54dd8a3f85043a87aa5c4077e9fa39459b88212db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1a This release

1 release file

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