Skip to content

GL01 catches valid docstring example#574

Merged
larsoner merged 2 commits into
numpy:mainfrom
stefanv:GL01-standard-incompatible
May 23, 2026
Merged

GL01 catches valid docstring example#574
larsoner merged 2 commits into
numpy:mainfrom
stefanv:GL01-standard-incompatible

Conversation

@stefanv
Copy link
Copy Markdown
Contributor

@stefanv stefanv commented Jul 17, 2024

def my_func():
   """Docstring on first line.

   Should be totally fine.
   """
   ...

@stefanv
Copy link
Copy Markdown
Contributor Author

stefanv commented Jul 17, 2024

@rossbar It seems like numpydoc validate has been catching this "error" for a long time, but in my mind it's definitely not a mistake to start the docstring on the line of the triple quotes. Looks like it was an artifact brought over from a Pandas style preference?

Will fix up the tests if we decide this is the right way forward.

@rossbar
Copy link
Copy Markdown
Contributor

rossbar commented Jul 17, 2024

This is one of those things that's totally subjective and not really useful IMO, but it's been there since validation was introduced so 🤷

@stefanv
Copy link
Copy Markdown
Contributor Author

stefanv commented Jul 17, 2024 via email

@rossbar
Copy link
Copy Markdown
Contributor

rossbar commented Jul 18, 2024

What options are available to us?

Well, it could be removed outright. Personally I'd be in favor of that - not only for this rule, but for many of the more nitty "rules" that don't actually have anything to do with numpydoc. IMO these types of things are best left to other doc linting tools (e.g. pydocstyle, though that doesn't seem to be actively supported any longer).

The non-breaking way would be to recommend users not use this rule - there are hooks for all the user APIs (pre-commit, sphinx conf, etc.) to ignore certain rules.

@stefanv
Copy link
Copy Markdown
Contributor Author

stefanv commented Jul 18, 2024

I'd be fine with removing them, or packaging them as optional nitpick rules that can be enabled (but that are disabled by default). But the job here really is to ensure that docs confirm with the numpydoc standard (and not to venture much beyond that).

stefanv added 2 commits May 22, 2026 16:32
```
def my_func():
   """Docstring on first line.

   Should be totally fine.
   """
   ...
```
@stefanv stefanv force-pushed the GL01-standard-incompatible branch from ece6695 to 8895cef Compare May 23, 2026 00:09
@stefanv
Copy link
Copy Markdown
Contributor Author

stefanv commented May 23, 2026

I'd be glad to get this in @rossbar @larsoner. I think important for our default warnings to be in alignment with the specification.

Copy link
Copy Markdown
Collaborator

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a bugfix for me. Looks like in MNE-Python we've been ignoring GL01 for exactly this reason. It'll be nice to reenable it!

@larsoner larsoner merged commit ccbd523 into numpy:main May 23, 2026
26 checks passed
@stefanv stefanv added this to the 1.10.0 milestone May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants