15

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.

Mark Bao
  • 896
  • 1
  • 10
  • 19

1 Answers1

11

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
Giannis Spiliopoulos
  • 2,628
  • 18
  • 27
  • 1
    that checker can handle numpy (among others such as Sphinx) style and check those things, but I don't think it has a way of differentiating it from those other styles. For example, if you write code with Sphinx documentation that linter would still say it was fine, even if you only want numpy style - I don't see a way to specify an exclusive documentation style – Andrew Apr 05 '17 at 02:00
  • @Andrew, hmmm sorry it seems I missed to take into account that part of adherence, I have updated my answer. – Giannis Spiliopoulos Apr 05 '17 at 02:24