numpy / numpy/numpydoc

nosetesting modules for adherance to numpydoc docstring standards?

Open
#13 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docstring integrity help-wanted type: Enhancement
Dominant language
Python
Stars
355
Forks
181
Avg merge
1d 9h
Merged PRs (30d)
3

Description

Copied from https://github.com/numpy/numpy/issues/2778


@rmcgibbo

I've always thought it would be cool to automatically to automatically validate (at least in a minimal way) my docstrings during build testing. (Because of issues like this, its not going to be perfect, but whatever.)

Well, I went ahead and did it. I'm wondering if there's any interest in the numpy community for adding this feature into the numpydoc codebase.

With code like this in the test suite:

# test.py
from numpydoc import DocStringFormatTester
import my_module_to_be_tested
TestDocstrings = DocStringFormatTester(my_module_to_be_tested)
[... rest of your test suite ...]

you get behavior like:

$ nosetests
[... your regular test results ...]
NumpyDoc: mymodule.function1 ... ok
NumpyDoc: mymodule.function2 ... ok
NumpyDoc: mymodule.class1.method1 ... ok
NumpyDoc: mymodule.class1.method2 ... ok

The mechanism is just a class factory that builds classes with names like "Test_XXX" so that they get discovered by nose. Perhaps it could be done more cleverly with a nose extension.

If there's any interest in this (Perhaps it's outside the scope of numpy/numpydoc) I will write it up for a PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed DocStringFormatTester factory and its nose discovery examples, then inspect the current numpydoc codebase and test setup. Clarify the intended integration and acceptance checks with maintainers; done means documented, working docstring validation is exercised by the test runner.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.