Skip to main content

Serialize elapsed time of functions, loops and code blocks.

Project description


Serialize elapsed time of functions, loops and code blocks.

test PyPI version license: MIT code style: black



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]"

Run linters

  • 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

  • Run tests

    python -m unittest discover -s tests  
  • Run doctests for clock face

    python -m doctest -v timeti/  

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timeti-0.4.0.tar.gz (4.9 kB view hashes)

Uploaded source

Built Distribution

timeti-0.4.0-py3-none-any.whl (6.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page