Skip to main content

A utility python library for writing certain tasks in python easily & elegantly.

Project description

CAPSLOCK


A utility python library for writing certain tasks in python easily & elegantly.


[The library is still in development. The doc is not completed yet. You can contribute to improve the library.]

Background

capslock is a high level utility library written in python for writing certain frequently needed task in faster & efficient way. For example, if you want to keep track of the execution time of one of your method while optimizing it, witing code for tracking execution time can be done easily using capslock.


Installation

Install using the following command -

pip install capslock

Uninstall using the following command -

pip uninstall capslock

Getting Started

How to use decorators from capslock

Capslock defines different decorators that can be used out of the box for certain frequent tasks. E.g. getting the run time of certain function over the period of optimization in development phase.

Timing Decorator

To keep track of the execution time of a function in your project for optimizing it over the time, just put the "timing" decorator in your desired function. Capslock will keep track of different run of that function and will plot a well visualized graph for last five execution time of that function.

from capslock import timing

@timing
def say_hello():
    print("Hello World")

if __name__ == '__main__':
    say_hello()

This will generate output like bellow:

Output of Capslock Timing Decorator

And it will also keep track of runtime for different runs of the say_hello() function. and will plot a graph in the same directory of your python script.

Runtime tracking using Capslock Timing Decorator

Debug Decorator

To get debug information of anyof your function, follow the bellow instruction-

from capslock import debug

@debug
def add(number1, number2):
    return number1 + number2

if __name__ == '__main__':
    print(add(20, 30))

will provide you the following output with some debug information-

Debug Information using Capslock Debug Decorator

How to Contribute

You can contribute in different ways. You can add more decorators for frequently used tasks in day to day development works.

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

capslock-1.0.4.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

capslock-1.0.4-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

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