Python DocString Generator AI
Installation
From the vscode market place (recommended):
- Open VSCode
- Go to the marketplace
- Write pyDocGenAI
- Install this extension. That's all.
From source:
- Clone this repository
- Go in
code/pyDocGenAI
- Open a terminal and run
npm install
- Open VSCode from the pyDocGenAI folder (! important its mandatory)
- Open the
extension.ts file and click on Run > Start with debugging
- A window will appear, then open a python file and here we go.
Usage
When a python file is open, you can select a valid python function.
When you have a python file open in vscode, select a valid python function (like copy/paste text).
Then, you have several choices to generate the docstring of your function:
Use right click > Generate DocString
Use the shortcut CTRL + SHIFT + L (macos: CMD+SHIFT+L )
Stay with the mouse on the python function then click on the pop-up click here to generate docstring
Use command palette (CTRL+SHIFT+P or View > Command Palette ) , execute the command : Generate DocString .
Configuration
This extension is highly configurable. You can customize a lot of things like the docstring template generated by the model.
Be careful to put the keyword into bracket [PRED] to get the prediction of the model!
For those who like it can tweak the hyperparameters of the deep learning model.
The deep learning model used is codeBERT from microsoft.
To access to the configuration file go on File> Preferences > Settings > Extension > PyDocGenAI
| |