numpy / numpy/numpydoc

Exclude Files in Test Modules from Numpydoc Validation

Open
#497 0 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
355
Forks
181
Avg merge
1d 9h
Merged PRs (30d)
3

Description

I love the ability to include the numpydoc validations in my pre-commit routine.

Sorry, I got busy and couldn't help with testing.

As I've been implementing the validations as a pre-commit routine I realized I'm having trouble coming up with a pattern to exclude my test files in the "exclude" option in my pyproject.toml.

I want to exclude any object in a "tests" directory from validation.

I've succeeded by doing this in the .pre-commit-config.yaml file (as shown below). But do you have any suggestions on how I get that to work in the pre-commit routine and specify it in the pyproject.toml configuration?

  - repo: https://github.com/numpy/numpydoc
    rev: v1.6.0rc2
    hooks:
      - id: numpydoc-validation
        exclude: |
          (?x)(
              /tests/|
              docs/source
          )

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 comparing the existing .pre-commit-config.yaml exclude pattern with the requested pyproject.toml configuration, then trace how the numpydoc-validation hook reads exclusions. Done means objects in any tests directory can be excluded through pyproject.toml when the pre-commit hook runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.