Skip to content

Repository files navigation

Social Card of Python Stopwatch 2

This is a fork from python-stopwatch, which adds static typing and a few other things.

PyPi VersionPyPi DownloadsPython VersionsRepo SizeMIT LicensedStarsContributors

TestsCoverage Status

  • This package requires python 3.10 or higher.

Step 1. Install the library:

poetry add python-stopwatch2

Other platform? ➜ https://stopwatch2.vercel.app/guide/getting-started.html

Step 2. Import the Stopwatch class:

from stopwatch import Stopwatch

Step 3. Create a new Stopwatch object:

sw = Stopwatch()

Step 4. Place your code here:

from time import sleep
sleep(2)

Step 5. Stop the stopwatch:

sw.stop()

Step 6. Get the elapsed time:

print(f'Time elapsed: {sw.elapsed}') # Time elapsed: 2.0031827000002522# or
print(f'Time elapsed: {sw}') # Time elapsed: 2.00s

You'll find installation instructions and full documentation on https://stopwatch2.vercel.app.

Run the tests with:

poetry run pytest --cov=stopwatch

Please see CHANGELOG for detailed changes for each release.

Please see CONTRIBUTING for details.

  • MIT

  • Copyright (c) 2021-2022 Jonghwan Hyeon, 2022-present Rafael

Releases

Used by

Contributors

Languages