Python comes with a lot of modules and they are organized within package manager PIP. To install PIP, refer to installation guide. When it is ready, simply type the following command inside command prompt:
pip install MonkeyType
When it is finished, we could type monkeytype
inside our command prompt terminal:
monkeytype
This command will return documentation how to use it.
commands:
{run,apply,stub,list-modules}
run Run a Python script under MonkeyType tracing
apply Generate and apply a stub
stub Generate a stub
......
To use MonkeyType, run the following in your terminal:
monkeytype run your-script.py
The Use of MonkeyType is to add Annotation
Annotation is a comment to be added to a code. It is often that creating annotation is consuming time almost same like the program code writing itself. It is because, we need to explain, for what we define a variable. What kind of data type it is. What is the purpose of a function and definition.
Without annotation, a code is regarded as useless. Nobody can use it and even the writers themselves occasionally forgot espescially when writing a long script. MonkeyType can help us to create annotation.
MonkeyType is A Python library that generates static type annotations by collecting runtime types
MonkeyType on GitHub
Limitation of MonkeyType
A software does its job based on the availability of the previous input. For example, a module comes with annotation or a data type can be known by how a programmer type, with or without quotes. Moreover, several functions have their specific purposes for example to do math operations. With the availability of those data, MonkeyType could add annotation directly to our code.
Adding annotations to codes writing almost mandatory to developers. Without habit to do it, even themselves can not understand the next they open it. Software can only help a little. More effort will go back to the programmer itself to make his code recognized for what it is, how it works. Otherwise, the code will be throwed into the bin.