Serialize elapsed time of functions, loops and code blocks.
pip install timeti -
Profile function with decorator
>>> @timeti.profiler ... def ultimative_question(*args, **kwargs): ... sum(range(100_000)) ... >>> ultimative_question() Elapsed time of 'ultimative_question' function: 4 ms
-
Profile loop with wrap
>>> for i in timeti.profiler(range(2)): ... _ = sum(range(100_000)) ... Elapsed time of loop iteration 0: 4 ms Elapsed time of loop iteration 1: 3 ms Elapsed time of loop: 8 ms
-
Profile code blocks with context manager
>>> with timeti.profiler(): ... _ = sum(range(100_000)) ... Elapsed time of block: 5 ms
pip install -e ".[dev]" -
Format Python code with black
python -m black . -
Check types with mypy
python -m mypy . -
Sort imports alphabetically with isort
python -m isort . -
Analyze Python docstring with pydocstyle
python -m pydocstyle .
-
Run tests
python -m unittest discover -s tests -
Run doctests for clock face
python -m doctest -v timeti/clockface.py