timework
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| timework-0.4.3.tar.gz | 4.9 kB | Without provenance | Details for timework-0.4.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| timework-0.4.3-py3-none-any.whl | Python 3 | none | any | Details for timework-0.4.3-py3-none-any.whl |
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
|
Security for timework 0.4.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.