Skip to content

mannasoumya/py-docstring-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto Generate Python Docstrings

Quick Start

$ python3 docstring_generator_auto.py test.py

Function `hello1`
Params ['a:str', 'b:list', 'c']
Do you want to write docstring for `hello1` ? (y/n)  y
Enter function summary:  This is first hello
Are you sure? (y/n)  y

a : str
Enter parameter summary:  first param
Are you sure? (y/n)  y

b : list
Enter parameter summary:  second param
Are you sure? (y/n)  y

c : 
Enter parameter summary:  third param
Are you sure? (y/n)  y


No explicit return type found for function `hello1`
Enter return summary:  Returns None
Are you sure? (y/n)  y

Function `hello2`
Params ['a:tuple']
Do you want to write docstring for `hello2` ? (y/n)  y
Enter function summary:  This is second hello
Are you sure? (y/n)  y

a : tuple
Enter parameter summary:  tuple param
Are you sure? (y/n)  y


No explicit return type found for function `hello2`
Enter return summary:  Returns None
Are you sure? (y/n)  y

Function `hello3` has no parameters
Do you want to write docstring for `hello3` ? (y/n)  y
Enter function summary:  This is third hello
Are you sure? (y/n)  y

Return type of function `hello3` is `str`
Enter return summary:  Returns hello3
Are you sure? (y/n)  y

New file with docstings saved at : `test_docstrings.py`

When all docstrings are added, skip all functions

$ python3 docstring_generator_auto.py test.py

Function `hello1`
Params ['a:str', 'b:list', 'c']
Do you want to write docstring for `hello1` ? (y/n)  n

Function `hello2`
Params ['a:tuple']
Do you want to write docstring for `hello2` ? (y/n)  n

Function `hello3` has no parameters
Do you want to write docstring for `hello3` ? (y/n)  n

No docstrings to save... Exiting

New file with docstring is generated at <file-path_docstrings.py>