Skip to content

API Overview

Jay Lee edited this page May 16, 2021 · 6 revisions

The decko framework is divided into the following sections

  • decorators
  • registering decorators

Each decorator can be decorated so that it runs either before or after the wrapping function is decorated.

Installing

Decko is available via pip

pip install -U decko

Getting Started

Getting started is simple: All one needs to do is import Decko after installing. Note: Right now, the application is still under development.

from decko import Decko

dk = Dekco(__name__)

def handle_event(time_elapsed):
    print(f"warning! The event took {time_elapsed} ms")

# Do something 
@dk.slower_than(50, callback=handle_event)
def long_list(n):
    return list(range(n))

for i in range(20):
    long_list(1000000)
Clone this wiki locally