et-stopwatch
A class for timing code. A Stopwatch object can be used to time code using its start and stop methods:
from et_stopwatch import Stopwatch stopwatch = Stopwatch() # create and start the stopwatch sleep(1) stopwatch.stop() print(stopwatch) stopwatch : 1.003744 s
Use as a context manager:
with Stopwatch(message='This took') as sw: # using a custom message
for i in range(3):
sleep(1)
print(i, sw.stop(), 's') # stop() returns the time since the last call to start|stop in seconds
0 1.004943
1 1.004948
2 1.003404
This took :
total : 3.013295 s
minimum: 1.003404 s
maximum: 1.004948 s
mean : 1.004432 s
stddev : 0.000727 s
count : 3
Since stop was called more than once, some statistics are printed.
Use as a decorator:
@Stopwatch(name="say_hi_and_sleep_two_seconds", ndigits=3) # custom message, print only 3 digits.
def say_hi_and_sleep_two_seconds():
print("hi")
sleep(2)
say_hi_and_sleep_two_seconds()
hi
say_hi_and_sleep_two_seconds : 2.003 s
Free software: MIT license
Documentation: https://et-stopwatch.readthedocs.io.
Metadata
Release files for et-stopwatch 1.3.1
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 | |
|---|---|---|---|---|
| et_stopwatch-1.3.1.tar.gz | 5.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| et_stopwatch-1.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / et_stopwatch-1.3.1.tar.gz
| Download URL | et_stopwatch-1.3.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e4bbb86d11476d776f63d062638a69c1ffffd0be4baef8a241df3c5c1176952
|
|
BLAKE2b-256 checksum How to use checksums |
23c5ed488f649469e03e4b0b0be40b0054963d2d12498be5bf73a29861dad60c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.9.5 Darwin/22.2.0
|
Release files / et_stopwatch-1.3.1-py3-none-any.whl
| Download URL | et_stopwatch-1.3.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7744a22c28301fe9602b4abcb368cb33df3d61d60be9d252c8e5bb576f060dff
|
|
BLAKE2b-256 checksum How to use checksums |
5c0f90ff65a40f5ed3639474d8b2598046e947fa3bc02905afc050c5cd79d726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.9.5 Darwin/22.2.0
|
Security for et-stopwatch 1.3.1
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.