Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter Notebook Python auto docstring generation with triple quotation

I'm working in a jupyter notebook using python and trying to use the auto-documentation function to generate docstrings like below. When working in an IDE like pycharm a triple quotation + Enter underneath the function generates docstrings like shown below.

def test_function(df: pd.DataFrame, probs: dict) -> int:
    """
    :param df: 
    :param probs: 
    :return: 
    """

Currently my output from the notebook gives the output below and does not parse any arguments inside the function.

def test_function(df: pd.DataFrame, probs: dict) -> int:
    """

    """
like image 227
Roel van der Burg Avatar asked Jun 13 '19 10:06

Roel van der Burg


1 Answers

You can have that functionality in VScode, sublime, pytorch and other IDEs but not in jupyter the closest solution I found was to install nbextensions and use snippets to add a docstring template. it decreases typing by 50% but still not auto generating.

like image 76
sh.e.salh Avatar answered Oct 30 '22 17:10

sh.e.salh