Skip to main content

Serialize elapsed time of functions, loops and code blocks.

Project description

timeti

Serialize elapsed time of functions, loops and code blocks.

test PyPI version license: MIT code style: black

Experience

Install

pip install timeti

Usage

  • 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
    

Development

Install

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/clockface.py  
    

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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file timeti-0.4.0.tar.gz.

File metadata

  • Download URL: timeti-0.4.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for timeti-0.4.0.tar.gz
Algorithm Hash digest
SHA256 68698af38b5361a44b2c20f357b44ce32cbbdf931feb142e4c77116580bb77bb
MD5 0e2e0e72b8aa2e9d5f484ae845a78c10
BLAKE2b-256 315ee41351740d8b2c9d6a7eba2d10245fc7f356d5f6eeb29117c140a6e385ca

See more details on using hashes here.

File details

Details for the file timeti-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: timeti-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for timeti-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43fe5f2fa063dcd4daf48a5fe0056bb18d6a5702dfb8ebb3f05c39ea930f4873
MD5 5e97e3a70b02a47a5e6b31a9d4ad171b
BLAKE2b-256 e2bd5dc616905afd21c81483b21fdc73f583b1e1392f9eec09874050aa1885e4

See more details on using hashes here.

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