Package: deep-timeit
Deep time-itDeep time-it is an open source module that was intended to be an extension of the timeit library, that not only times a function, but can also time each individual line and chunk of code within it, and produce a visual break-down of the slower and faster parts to aid with debugging and refactoring.ImportantBe careful if your function that you are timing has side effects. If it does, then as sometimes the function may be run twice, the side effect might occur twice. To disable double running, set themaxrepeatsflag to None. This is done be default.InstallationTo install the Deep time-it library, usepip install deep_timeit. The documentation can be found at TODO. We support Python versions 3.6 to 3.10.UsageRundeep_timeit.deepTimeit(function), and replacefunctionwith a reference to the function you want to time. It includes the additional flagsargsandkwargs, which you can set to a list and dictionary respectively that includes additional arguments and keyword arguments to include when timing the function. The other flags aremaxrepeats, which if set to an integer, which it is by default, will check if any lines are run more than the threshold and in which case will reattempt timing the function without timing those particular lines. This is a feature because if it times a line a large number of times, the timing itself will start to contribute to the time taken. The function returns anInfoobject, which can be displayed by runninginfoob.show().ExamplesExample 1import deep_timeit
import time

def add(a, b):
    accumilator = 0
    for i in range(a):
      accumilator += 1
    for i in range(b):
      accumilator += 1
    print(f"The result of the addition of a and b is: {accumilator}")

deep_timeit.deepTimeit(add, args=[100000, 200000]).show()Example 2from deep_timeit import deepTimeit

def incrementalTime():
    """This is a function that takes incrementally long to run
    and is a good test of the range of colours."""
    for i in range(4):
        time.sleep(0.1)
        time.sleep(0.2)
        time.sleep(0.3)
        time.sleep(0.4)
        time.sleep(0.5)
        time.sleep(0.6)
        time.sleep(0.7)
        time.sleep(0.8)
        time.sleep(0.9)
        time.sleep(1)
    for i in range(2):
        time.sleep(0.1)
        time.sleep(0.2)
        time.sleep(0.3)
        time.sleep(0.4)
        time.sleep(0.5)
        time.sleep(0.6)
        time.sleep(0.7)
        time.sleep(0.8)
        time.sleep(0.9)
        time.sleep(1)
        for j in range(3):
            time.sleep(0.01)
            time.sleep(0.02)
            time.sleep(0.03)
            time.sleep(0.04)
            time.sleep(0.05)
            time.sleep(0.06)
            time.sleep(0.07)
            time.sleep(0.08)
            time.sleep(0.09)
            time.sleep(0.1)

deepTimeit(incrementalTime).show()Example 3from deep_timeit import deepTimeit, Colour
import random

deepTimeit(random._test).show()Example 4from deep_timeit import deepTimeit

def incrementalTime():
    """This is a function that takes incrementally long to run
    and is a good test of the range of colours."""
    for i in range(4):
        time.sleep(0.1)
        time.sleep(0.2)
        time.sleep(0.3)
        time.sleep(0.4)
        time.sleep(0.5)
        time.sleep(0.6)
        time.sleep(0.7)
        time.sleep(0.8)
        time.sleep(0.9)
        time.sleep(1)
    for i in range(2):
        time.sleep(0.1)
        time.sleep(0.2)
        time.sleep(0.3)
        time.sleep(0.4)
        time.sleep(0.5)
        time.sleep(0.6)
        time.sleep(0.7)
        time.sleep(0.8)
        time.sleep(0.9)
        time.sleep(1)
        for j in range(3):
            time.sleep(0.01)
            time.sleep(0.02)
            time.sleep(0.03)
            time.sleep(0.04)
            time.sleep(0.05)
            time.sleep(0.06)
            time.sleep(0.07)
            time.sleep(0.08)
            time.sleep(0.09)
            time.sleep(0.1)

deepTimeit(incrementalTime).show(colourrange=ColourRange.RAINBOW)Release notesGithub releasesSimilar librariestimeitline_profilerpprofileTODO'sMake code work with functions that have:Multiline bracketsMake code work with:Class methodsRecursive functions