Skip to main content

timework

pypi codefactor coverage platform

measure / limit execution time using with-statements or decorators, cross-platform

Install

pip install timework

Usage

import timework as tw

Statement with

timework.Stopwatch

measure execution time

Example
with tw.Stopwatch() as s:
    s.split()
    s.stop()
    s.restart()
    s.pause()
    s.resume()
    s.get_sec()
    s.get_hms()
Functions
get_sec()  get_hms()  restart()  pause()
resume()   split()    stop()

Decorator @

timework.timer

measure execution time

Example
@tw.timer(logging.warning)
def your_function():
    ...
Arguments
output: A function object that specifies where to log messages.
        For example: print. timework.nil does not log messages.
detail: A boolean value, whether to print start and end time.
        This argument must be passed using keywords.

timework.limit

limit execution time

Example
@tw.limit(3)
def your_function():
    ...
Arguments
timeout: This argument sets the timeout limit of the decorated
         function. Once the run time of the process reaches
         [timeout] seconds but not yet finishes, then raise
         TimeoutException and stop the inner function.

License

MIT License © bugstop

Metadata

Release files for timework 0.4.3

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

Source distribution (sdist)

Source distribution for timework 0.4.3
File Size Uploaded
timework-0.4.3.tar.gz 4.9 kB Details

Built distribution (wheel)

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

Total release size: 11.3 kB

Release files / timework-0.4.3.tar.gz

Download URL timework-0.4.3.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
633fc71a8f275cb7aaa7c269caf49b21786fb0d13a11164c3de5fc98d94f73f2
BLAKE2b-256 checksum
How to use checksums
83dafd0a7f2ee332aa3a0047eea9c8109b118db374f7e19656af0ee00b58fcc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1

Release files / timework-0.4.3-py3-none-any.whl

Download URL timework-0.4.3-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b898dc8d979617535361086d32b8c40a839bdafa03c731529e57b8ac44966db4
BLAKE2b-256 checksum
How to use checksums
d7820f675c7e90abca241ae606466f3e4a3733561637a104fa60e08cedfab9bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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