Package: alphadoc
alphadocAutomatic docstring generator and style guide that supports a number of specified conventions for documentation in Python.FeaturesAuto-generates docstrings with a customizable template for functions.Automatically fixes the code according to the standard PEP-8 style convention for python.Support for common and widely used docstrings formats such as Numpy, Google, ReStructured Text and Epytext (Javadoc)InstallationUsing pip:$ pip install alphadocUsagealphadoc takes your filename and format type as arguments$ alphadoc <filename> --d <doc_format>Seealphadoc --helpfor more command-line switches and options!Options :Usage: alphadoc [OPTIONS] FILENAME

  Automatic docstring generator and style guide that  supports a
  number of specified conventions for formatting  as well as
  documentation in Python.

Options:
  -d, --doc_format TEXT  Specified format for docstrings from Options-
                         ReST : For ReStructured Text (default); Epytext
                         :  For Epytext (Javadoc); Google : For Google-
                         Style ; Numpydoc : For Numpydoc

  --help                 Show this message and exit.Example :Before alphadocimportastimportsysdeftop_level_functions(body):return(fforfinbodyifisinstance(f,ast.FunctionDef))defparse_ast(filename):withopen(filename,"rt")asfile:returnast.parse(file.read(),filename=filename)defget_func(filename):tree=parse_ast(filename)func_list=[]forfuncintop_level_functions(tree.body):func_list.append(func.name)returnfunc_listAfter alphadocDocstring format:ReStructured Text(default)importastimportsysdeftop_level_functions(body):"""This is reST style.:param param1: this is a first param:param param2: this is a second param:returns: this is a description of what is returned:raises keyError: raises an exception"""return(fforfinbodyifisinstance(f,ast.FunctionDef))defparse_ast(filename):"""This is reST style.:param param1: this is a first param:param param2: this is a second param:returns: this is a description of what is returned:raises keyError: raises an exception"""withopen(filename,"rt")asfile:returnast.parse(file.read(),filename=filename)defget_func(filename):"""This is reST style.:param param1: this is a first param:param param2: this is a second param:returns: this is a description of what is returned:raises keyError: raises an exception"""tree=parse_ast(filename)func_list=[]forfuncintop_level_functions(tree.body):func_list.append(func.name)returnfunc_listEpytext (Javadoc)importastimportsysdeftop_level_functions(body):"""This is javadoc style.@param param1: this is a first param@param param2: this is a second param@return: this is a description of what is returned@raise keyError: raises an exception"""return(fforfinbodyifisinstance(f,ast.FunctionDef))defparse_ast(filename):"""This is javadoc style.@param param1: this is a first param@param param2: this is a second param@return: this is a description of what is returned@raise keyError: raises an exception"""withopen(filename,"rt")asfile:returnast.parse(file.read(),filename=filename)defget_func(filename):"""This is javadoc style.@param param1: this is a first param@param param2: this is a second param@return: this is a description of what is returned@raise keyError: raises an exception"""tree=parse_ast(filename)func_list=[]forfuncintop_level_functions(tree.body):func_list.append(func.name)returnfunc_listGoogleimportastimportsysdeftop_level_functions(body):"""This is an example of Google style.Args:param1: This is the first param.param2: This is a second param.Returns:This is a description of what is returned.Raises:KeyError: Raises an exception."""return(fforfinbodyifisinstance(f,ast.FunctionDef))defparse_ast(filename):"""This is an example of Google style.Args:param1: This is the first param.param2: This is a second param.Returns:This is a description of what is returned.Raises:KeyError: Raises an exception."""withopen(filename,"rt")asfile:returnast.parse(file.read(),filename=filename)defget_func(filename):"""This is an example of Google style.Args:param1: This is the first param.param2: This is a second param.Returns:This is a description of what is returned.Raises:KeyError: Raises an exception."""tree=parse_ast(filename)func_list=[]forfuncintop_level_functions(tree.body):func_list.append(func.name)returnfunc_listNumpydocimportastimportsysdeftop_level_functions(body):"""Numpydoc description of a kindof very exhautive numpydoc format docstring.Parameters----------first : array_likethe 1st param name `first`second :the 2nd paramthird : {'value', 'other'}, optionalthe 3rd param, by default 'value'Returns-------stringa value in a stringRaises------KeyErrorwhen a key errorOtherErrorwhen an other error"""return(fforfinbodyifisinstance(f,ast.FunctionDef))defparse_ast(filename):"""Numpydoc description of a kindof very exhautive numpydoc format docstring.Parameters----------first : array_likethe 1st param name `first`second :the 2nd paramthird : {'value', 'other'}, optionalthe 3rd param, by default 'value'Returns-------stringa value in a stringRaises------KeyErrorwhen a key errorOtherErrorwhen an other error"""withopen(filename,"rt")asfile:returnast.parse(file.read(),filename=filename)defget_func(filename):"""Numpydoc description of a kindof very exhautive numpydoc format docstring.Parameters----------first : array_likethe 1st param name `first`second :the 2nd paramthird : {'value', 'other'}, optionalthe 3rd param, by default 'value'Returns-------stringa value in a stringRaises------KeyErrorwhen a key errorOtherErrorwhen an other error"""tree=parse_ast(filename)func_list=[]forfuncintop_level_functions(tree.body):func_list.append(func.name)returnfunc_listReferenceshttp://daouzli.com/blog/docstring.htmlContributingalphadoc is fully Open-Source and open for contributions! We request you to respect our contribution guidelines as defined in ourCODE_OF_CONDUCT.mdandCONTRIBUTING.md