Introduction

Tinyscript aims to quickly prototype tools by sparing as much lines of code as possible and providing base features (especially useful for debugging or understanding the execution flow) like configured logging, preimports, stepping, timing and so forth.

The idea is to make creating tools as easy as this:

1
$ tinyscript new test && gedit test.py

Simply modifying the template to:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from tinyscript import *

__author__     = "John Doe"
__version__    = "1.0"

if __name__ == '__main__':
    parser.add_argument("string", help="string to be displayed")
    initialize()
    logger.info(args.string)

Will give the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$ python test.py --help
Test 1.0
Author   : John Doe

usage: python test.py [-h] [--help] [-v] string

positional arguments:
  string  string to be displayed


extra arguments:
  -h             show usage message and exit
  --help         show this help message and exit
  -v, --verbose  verbose mode (default: False)

$ python test.py "Hello World!"
01:02:03 [INFO] Hello World!

Setup

This library is available on PyPi and can be simply installed using Pip:

1
pip install --user tinyscript

or

1
pip3 install --user tinyscript

Rationale

This library is born from the need of quickly building efficient scripts and tools without caring for redefining various things or rewritting/setting the same functionalities like the logging or parsing of input arguments.

In the meantime, I personnally used this library many times to create tools for my job or during cybersecurity or programming competitions and it proved very useful when dealing with time constraints.