Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to lint a Python file to check for Numpy documentation style adherence? [closed]

I'm working on a project that requires Numpy documentation. In my Java days, I remember having linters that checked for Javadoc adherence in Eclipse/IDEA; is there an equivalent that checks for Numpy documentation style adherence?

I know about PEP257, but it doesn't seem to have any specific checks for Numpy documentation.

like image 583
Mark Bao Avatar asked Feb 08 '17 21:02

Mark Bao


1 Answers

Pylint seems to support that. Take a look at pylint.extensions.docparams.

To sum it up. You activate this checker of pylint by adding

load-plugins=pylint.extensions.docparams

in the Master section of your .pylintrc.

This checker verifies that all function, method, and constructor docstrings include documentation of the

  • parameters and their types

  • return value and its type

  • exceptions raised


Actually pydocstyle (formerly pep257) recently added support for the numpy docstring convention. Although, it's not perfect I think it's the closest to what you want to achieve and it will probably improve in the near future.

pydocstyle --convention=numpy example.py
like image 85
Giannis Spiliopoulos Avatar answered Nov 15 '22 15:11

Giannis Spiliopoulos