Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-numpydoc for openSUSE:Factory checked in at 2025-08-02 00:41:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-numpydoc (Old) and /work/SRC/openSUSE:Factory/.python-numpydoc.new.1085 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-numpydoc" Sat Aug 2 00:41:16 2025 rev:19 rq:1296857 version:1.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-numpydoc/python-numpydoc.changes 2025-02-27 16:40:38.355831039 +0100 +++ /work/SRC/openSUSE:Factory/.python-numpydoc.new.1085/python-numpydoc.changes 2025-08-02 00:41:21.605588128 +0200 @@ -1,0 +2,39 @@ +Thu Jul 31 18:06:59 UTC 2025 - Ben Greiner <c...@bnavigator.de> + +- Need to mention: + * Drop numpydoc-pr523-py312deprecation.patch + * Drop mockapp.patch + +------------------------------------------------------------------- +Thu Jul 31 15:43:39 UTC 2025 - Felix Stegmeier <felix.stegme...@suse.com> + +- update to 1.9.0 + * ignore some errors at module level (#593). + * Rework hook output to remove the table (#611). + * Switch to storing AST nodes on the stack for more accurate method signature check and easy access to parent nodes (#623). + * MAINT: Changed class constructor init GL08 reporting (#592). + * BUG: Correct functionality of numpydoc SS05 (#613). + * Specity the types of numpydoc_xref_ignore option (#631). + * DOC: Do not use types for *args, **kwargs (#585). + * mention conda-forge in installation docs (#595). + * Fix typo in validation.rst (#605). + * Fix broken link in format.rst (#628). + * CI: use hashes for actions' versions in publishing job (#579). + * Bump the actions group with 2 updates (#581). + * Bump pypa/gh-action-pypi-publish from 1.10.0 to 1.10.2 in the actions group (#582). + * [pre-commit.ci] pre-commit autoupdate (#583). + * MAINT: Add _exception_on_warning to MockApp (#586). + * Bump the actions group across 1 directory with 2 updates (#590). + * don't pass maxsplit as positional arg (#596). + * [pre-commit.ci] pre-commit autoupdate (#598). + * Add Python 3.13 support (#599). + * Update readthedocs config (#600). + * Bump the actions group with 2 updates (#603). + * Bump the actions group with 3 updates (#609). + * [pre-commit.ci] pre-commit autoupdate (#614). + * Bump actions/download-artifact from 4.2.1 to 4.3.0 in the actions group (#620). + * Bump scientific-python/circleci-artifacts-redirector-action from 1.0.0 to 1.1.0 in the actions group (#627). + * Switch to dependency groups (#626). + * Fix pip setup command in github workflow (#629). + +------------------------------------------------------------------- Old: ---- mockapp.patch numpydoc-1.8.0.tar.gz numpydoc-pr523-py312deprecation.patch New: ---- numpydoc-1.9.0.tar.gz ----------(Old B)---------- Old: * Drop numpydoc-pr523-py312deprecation.patch * Drop mockapp.patch Old:- Need to mention: * Drop numpydoc-pr523-py312deprecation.patch * Drop mockapp.patch ----------(Old E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-numpydoc.spec ++++++ --- /var/tmp/diff_new_pack.TEcAWQ/_old 2025-08-02 00:41:22.253614437 +0200 +++ /var/tmp/diff_new_pack.TEcAWQ/_new 2025-08-02 00:41:22.257614600 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-numpydoc -Version: 1.8.0 +Version: 1.9.0 Release: 0 Summary: Sphinx extension to support docstrings in Numpy format License: BSD-3-Clause @@ -27,22 +27,16 @@ Source: https://files.pythonhosted.org/packages/source/n/numpydoc/numpydoc-%{version}.tar.gz # https://docs.python.org/3/objects.inv (changes from time to time, accessed 2024-02-29) Source1: python-objects.inv -# PATCH-FIX-UPSTREAM numpydoc-pr523-py312deprecation.patch gh#numpy/numpydoc#523 -Patch0: numpydoc-pr523-py312deprecation.patch -# PATCH-FIX-UPSTREAM https://github.com/numpy/numpydoc/pull/586 MAINT: Add _exception_on_warning to MockApp -Patch1: mockapp.patch BuildRequires: %{python_module Sphinx >= 5} BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module tabulate >= 0.8.10} BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires(post): update-alternatives Requires(postun): update-alternatives Requires: python-Sphinx >= 5 -Requires: python-tabulate >= 0.8.10 BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module pytest} ++++++ numpydoc-1.8.0.tar.gz -> numpydoc-1.9.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/MANIFEST.in new/numpydoc-1.9.0/MANIFEST.in --- old/numpydoc-1.8.0/MANIFEST.in 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/MANIFEST.in 2025-06-24 14:22:17.000000000 +0200 @@ -2,7 +2,6 @@ include *.txt include *.rst recursive-include doc * -recursive-include requirements * recursive-include numpydoc * # Exclude what we don't want to include diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/PKG-INFO new/numpydoc-1.9.0/PKG-INFO --- old/numpydoc-1.8.0/PKG-INFO 2024-08-09 17:52:01.653280000 +0200 +++ new/numpydoc-1.9.0/PKG-INFO 2025-06-24 14:22:24.037762600 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 2.1 +Metadata-Version: 2.4 Name: numpydoc -Version: 1.8.0 +Version: 1.9.0 Summary: Sphinx extension to support docstrings in Numpy format Author-email: Pauli Virtanen and others <p...@iki.fi> License: Copyright (C) 2008-2023 Stefan van der Walt <ste...@mentat.za.net>, Pauli Virtanen <p...@iki.fi> @@ -42,26 +42,14 @@ Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 Classifier: Topic :: Documentation Requires-Python: >=3.9 Description-Content-Type: text/x-rst License-File: LICENSE.txt Requires-Dist: sphinx>=6 -Requires-Dist: tabulate>=0.8.10 Requires-Dist: tomli>=1.1.0; python_version < "3.11" -Provides-Extra: developer -Requires-Dist: pre-commit>=3.3; extra == "developer" -Requires-Dist: tomli; python_version < "3.11" and extra == "developer" -Provides-Extra: doc -Requires-Dist: numpy>=1.22; extra == "doc" -Requires-Dist: matplotlib>=3.5; extra == "doc" -Requires-Dist: pydata-sphinx-theme>=0.13.3; extra == "doc" -Requires-Dist: sphinx>=7; extra == "doc" -Requires-Dist: intersphinx_registry; extra == "doc" -Provides-Extra: test -Requires-Dist: pytest; extra == "test" -Requires-Dist: pytest-cov; extra == "test" -Requires-Dist: matplotlib; extra == "test" +Dynamic: license-file ===================================== numpydoc -- Numpy's Sphinx extensions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/doc/format.rst new/numpydoc-1.9.0/doc/format.rst --- old/numpydoc-1.8.0/doc/format.rst 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/doc/format.rst 2025-06-24 14:22:17.000000000 +0200 @@ -225,11 +225,11 @@ Input arrays, description of `x1`, `x2`. When documenting variable length positional, or keyword arguments, leave the -leading star(s) in front of the name:: +leading star(s) in front of the name and do not specify a type:: - *args : tuple + *args Additional arguments should be passed as keyword arguments - **kwargs : dict, optional + **kwargs Extra arguments to `metric`: refer to each metric documentation for a list of all possible arguments. @@ -557,7 +557,9 @@ Use the same sections as outlined above (all except :ref:`Returns <returns>` are applicable). The constructor (``__init__``) should also be documented here, the :ref:`Parameters <params>` section of the docstring details the -constructor's parameters. +constructor's parameters. While repetition is unnecessary, a docstring for +the class constructor (``__init__``) can, optionally, be added to provide +detailed initialization documentation. An **Attributes** section, located below the :ref:`Parameters <params>` section, may be used to describe non-method attributes of the class:: @@ -767,9 +769,9 @@ enclosed within ````double backticks````. A more extensive example of reST markup can be found in `this example -document <http://docutils.sourceforge.net/docs/user/rst/demo.txt>`_; +document <https://docutils.sourceforge.net/docs/user/rst/demo.rst>`_; the `quick reference -<http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ is +<https://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ is useful while editing. Line spacing and indentation are significant and should be carefully diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/doc/install.rst new/numpydoc-1.9.0/doc/install.rst --- old/numpydoc-1.8.0/doc/install.rst 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/doc/install.rst 2025-06-24 14:22:17.000000000 +0200 @@ -9,6 +9,7 @@ * `numpydoc on PyPI <http://pypi.python.org/pypi/numpydoc>`_ * `numpydoc on GitHub <https://github.com/numpy/numpydoc/>`_ +* `numpydoc on conda-forge <https://prefix.dev/channels/conda-forge/packages/numpydoc>`_ `'numpydoc'` should be added to the ``extensions`` option in your Sphinx ``conf.py``. ``'sphinx.ext.autosummary'`` will automatically be loaded diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/doc/release/notes.rst new/numpydoc-1.9.0/doc/release/notes.rst --- old/numpydoc-1.8.0/doc/release/notes.rst 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/doc/release/notes.rst 2025-06-24 14:22:17.000000000 +0200 @@ -1,3 +1,82 @@ +1.9.0 +===== + +We're happy to announce the release of numpydoc 1.9.0! + +Enhancements +------------ + +- ignore some errors at module level (`#593 <https://github.com/numpy/numpydoc/pull/593>`_). +- Rework hook output to remove the table (`#611 <https://github.com/numpy/numpydoc/pull/611>`_). +- Switch to storing AST nodes on the stack for more accurate method signature check and easy access to parent nodes (`#623 <https://github.com/numpy/numpydoc/pull/623>`_). + +Bug Fixes +--------- + +- MAINT: Changed class constructor __init__ GL08 reporting (`#592 <https://github.com/numpy/numpydoc/pull/592>`_). +- BUG: Correct functionality of numpydoc SS05 (`#613 <https://github.com/numpy/numpydoc/pull/613>`_). +- Specity the types of ``numpydoc_xref_ignore`` option (`#631 <https://github.com/numpy/numpydoc/pull/631>`_). + +Documentation +------------- + +- DOC: Do not use types for *args, **kwargs (`#585 <https://github.com/numpy/numpydoc/pull/585>`_). +- mention conda-forge in installation docs (`#595 <https://github.com/numpy/numpydoc/pull/595>`_). +- Fix typo in validation.rst (`#605 <https://github.com/numpy/numpydoc/pull/605>`_). +- Fix broken link in ``format.rst`` (`#628 <https://github.com/numpy/numpydoc/pull/628>`_). + +Maintenance +----------- + +- CI: use hashes for actions' versions in publishing job (`#579 <https://github.com/numpy/numpydoc/pull/579>`_). +- Bump the actions group with 2 updates (`#581 <https://github.com/numpy/numpydoc/pull/581>`_). +- Bump pypa/gh-action-pypi-publish from 1.10.0 to 1.10.2 in the actions group (`#582 <https://github.com/numpy/numpydoc/pull/582>`_). +- [pre-commit.ci] pre-commit autoupdate (`#583 <https://github.com/numpy/numpydoc/pull/583>`_). +- MAINT: Add _exception_on_warning to MockApp (`#586 <https://github.com/numpy/numpydoc/pull/586>`_). +- Bump the actions group across 1 directory with 2 updates (`#590 <https://github.com/numpy/numpydoc/pull/590>`_). +- don't pass maxsplit as positional arg (`#596 <https://github.com/numpy/numpydoc/pull/596>`_). +- [pre-commit.ci] pre-commit autoupdate (`#598 <https://github.com/numpy/numpydoc/pull/598>`_). +- Add Python 3.13 support (`#599 <https://github.com/numpy/numpydoc/pull/599>`_). +- Update readthedocs config (`#600 <https://github.com/numpy/numpydoc/pull/600>`_). +- Bump the actions group with 2 updates (`#603 <https://github.com/numpy/numpydoc/pull/603>`_). +- Bump the actions group with 3 updates (`#609 <https://github.com/numpy/numpydoc/pull/609>`_). +- [pre-commit.ci] pre-commit autoupdate (`#614 <https://github.com/numpy/numpydoc/pull/614>`_). +- Bump actions/download-artifact from 4.2.1 to 4.3.0 in the actions group (`#620 <https://github.com/numpy/numpydoc/pull/620>`_). +- Bump scientific-python/circleci-artifacts-redirector-action from 1.0.0 to 1.1.0 in the actions group (`#627 <https://github.com/numpy/numpydoc/pull/627>`_). +- Switch to dependency groups (`#626 <https://github.com/numpy/numpydoc/pull/626>`_). +- Fix pip setup command in github workflow (`#629 <https://github.com/numpy/numpydoc/pull/629>`_). + +Contributors +------------ + +13 authors added to this release (alphabetically): + +- Brigitta Sipőcz (`@bsipocz <https://github.com/bsipocz>`_) +- Daniel McCloy (`@drammock <https://github.com/drammock>`_) +- Eric Larson (`@larsoner <https://github.com/larsoner>`_) +- Gilles Peiffer (`@Peiffap <https://github.com/Peiffap>`_) +- Jarrod Millman (`@jarrodmillman <https://github.com/jarrodmillman>`_) +- Lucas Colley (`@lucascolley <https://github.com/lucascolley>`_) +- Matt Gebert (`@mattgebert <https://github.com/mattgebert>`_) +- Maxine Hartnett (`@maxinelasp <https://github.com/maxinelasp>`_) +- Ross Barnowski (`@rossbar <https://github.com/rossbar>`_) +- Stefan van der Walt (`@stefanv <https://github.com/stefanv>`_) +- Stefanie Molin (`@stefmolin <https://github.com/stefmolin>`_) +- Tim Hoffmann (`@timhoffm <https://github.com/timhoffm>`_) +- Yuki Kobayashi (`@koyuki7w <https://github.com/koyuki7w>`_) + +7 reviewers added to this release (alphabetically): + +- Charles Harris (`@charris <https://github.com/charris>`_) +- Eric Larson (`@larsoner <https://github.com/larsoner>`_) +- Jarrod Millman (`@jarrodmillman <https://github.com/jarrodmillman>`_) +- Lucas Colley (`@lucascolley <https://github.com/lucascolley>`_) +- Matt Gebert (`@mattgebert <https://github.com/mattgebert>`_) +- Ross Barnowski (`@rossbar <https://github.com/rossbar>`_) +- Stefan van der Walt (`@stefanv <https://github.com/stefanv>`_) + +_These lists are automatically generated, and may not be complete or may contain duplicates._ + 1.8.0 ===== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/doc/validation.rst new/numpydoc-1.9.0/doc/validation.rst --- old/numpydoc-1.8.0/doc/validation.rst 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/doc/validation.rst 2025-06-24 14:22:17.000000000 +0200 @@ -183,6 +183,9 @@ def __init__(self): # numpydoc ignore=GL08 pass +Note that a properly formatted :ref:`class <classdoc>` docstring +silences ``GL08`` for an ``__init__`` constructor without a docstring. + This is supported by the :ref:`CLI <validation_via_cli>`, :ref:`pre-commit hook <pre_commit_hook>`, and :ref:`Sphinx extension <validation_during_sphinx_build>`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/__main__.py new/numpydoc-1.9.0/numpydoc/__main__.py --- old/numpydoc-1.8.0/numpydoc/__main__.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/__main__.py 2025-06-24 14:22:17.000000000 +0200 @@ -1,6 +1,6 @@ """ -Implementing `python -m numpydoc` functionality. -""" +Implementing `python -m numpydoc` functionality +""" # '.' omitted at end of docstring for testing purposes! from .cli import main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/_version.py new/numpydoc-1.9.0/numpydoc/_version.py --- old/numpydoc-1.8.0/numpydoc/_version.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/_version.py 2025-06-24 14:22:17.000000000 +0200 @@ -1 +1 @@ -__version__ = "1.8.0" +__version__ = "1.9.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/cli.py new/numpydoc-1.9.0/numpydoc/cli.py --- old/numpydoc-1.8.0/numpydoc/cli.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/cli.py 2025-06-24 14:22:17.000000000 +0200 @@ -104,10 +104,11 @@ nargs="*", help=( f"""Check codes to ignore.{ - ' Currently ignoring the following from ' - f'{Path(project_root_from_cwd) / config_file}: {ignored_checks_text}' - 'Values provided here will be in addition to the above, unless an alternate config is provided.' - if ignored_checks else '' + " Currently ignoring the following from " + f"{Path(project_root_from_cwd) / config_file}: {ignored_checks_text}" + "Values provided here will be in addition to the above, unless an alternate config is provided." + if ignored_checks + else "" }""" ), ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/docscrape.py new/numpydoc-1.9.0/numpydoc/docscrape.py --- old/numpydoc-1.8.0/numpydoc/docscrape.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/docscrape.py 2025-06-24 14:22:17.000000000 +0200 @@ -232,8 +232,7 @@ # NOTE: param line with single element should never have a # a " :" before the description line, so this should probably # warn. - if header.endswith(" :"): - header = header[:-2] + header = header.removesuffix(" :") if single_element_is_type: arg_name, arg_type = "", header else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/docscrape_sphinx.py new/numpydoc-1.9.0/numpydoc/docscrape_sphinx.py --- old/numpydoc-1.8.0/numpydoc/docscrape_sphinx.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/docscrape_sphinx.py 2025-06-24 14:22:17.000000000 +0200 @@ -160,7 +160,7 @@ display_param = f":obj:`{param} <{link_prefix}{param}>`" if obj_doc: # Overwrite desc. Take summary logic of autosummary - desc = re.split(r"\n\s*\n", obj_doc.strip(), 1)[0] + desc = re.split(r"\n\s*\n", obj_doc.strip(), maxsplit=1)[0] # XXX: Should this have DOTALL? # It does not in autosummary m = re.search(r"^([A-Z].*?\.)(?:\s|$)", " ".join(desc.split())) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/hooks/validate_docstrings.py new/numpydoc-1.9.0/numpydoc/hooks/validate_docstrings.py --- old/numpydoc-1.8.0/numpydoc/hooks/validate_docstrings.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/hooks/validate_docstrings.py 2025-06-24 14:22:17.000000000 +0200 @@ -14,8 +14,6 @@ from pathlib import Path from typing import Any, Dict, List, Tuple, Union -from tabulate import tabulate - from .. import docscrape, validate from .utils import find_project_root @@ -35,7 +33,12 @@ """ def __init__( - self, *, ast_node: ast.AST, filename: os.PathLike, obj_name: str + self, + *, + ast_node: ast.AST, + filename: os.PathLike, + obj_name: str, + ancestry: list[ast.AST], ) -> None: self.node: ast.AST = ast_node self.raw_doc: str = ast.get_docstring(self.node, clean=False) or "" @@ -48,6 +51,8 @@ self.is_class: bool = isinstance(ast_node, ast.ClassDef) self.is_module: bool = isinstance(ast_node, ast.Module) + self.ancestry: list[ast.AST] = ancestry + @staticmethod def _load_obj(name): raise NotImplementedError("AstValidator does not support this method.") @@ -61,6 +66,10 @@ return isinstance(self.node, (ast.FunctionDef, ast.AsyncFunctionDef)) @property + def is_mod(self) -> bool: + return self.is_module + + @property def is_generator_function(self) -> bool: if not self.is_function_or_method: return False @@ -89,7 +98,7 @@ @property def signature_parameters(self) -> Tuple[str]: - def extract_signature(node): + def extract_signature(node, parent): args_node = node.args params = [] for arg_type in ["posonlyargs", "args", "vararg", "kwonlyargs", "kwarg"]: @@ -102,17 +111,21 @@ else: params.extend([arg.arg for arg in entries]) params = tuple(params) - if params and params[0] in {"self", "cls"}: + if ( + params + and params[0] in {"self", "cls"} + and isinstance(parent, ast.ClassDef) + ): return params[1:] return params params = tuple() if self.is_function_or_method: - params = extract_signature(self.node) + params = extract_signature(self.node, self.ancestry[-1]) elif self.is_class: for child in self.node.body: if isinstance(child, ast.FunctionDef) and child.name == "__init__": - params = extract_signature(child) + params = extract_signature(child, self.node) return params @property @@ -142,9 +155,23 @@ self.config: dict = config self.filepath: str = filepath self.module_name: str = Path(self.filepath).stem - self.stack: list[str] = [] + self.stack: list[ast.AST] = [] self.findings: list = [] + @property + def node_name(self) -> str: + """ + Get the full name of the current node in the stack. + + Returns + ------- + str + The full name of the current node in the stack. + """ + return ".".join( + [getattr(node, "name", self.module_name) for node in self.stack] + ) + def _ignore_issue(self, node: ast.AST, check: str) -> bool: """ Check whether the issue should be ignored. @@ -183,13 +210,17 @@ node : ast.AST The node under inspection. """ - name = ".".join(self.stack) + name = self.node_name report = validate.validate( - name, AstValidator, ast_node=node, filename=self.filepath + name, + AstValidator, + ast_node=node, + filename=self.filepath, + ancestry=self.stack[:-1], ) self.findings.extend( [ - [f'{self.filepath}:{report["file_line"]}', name, check, description] + [f"{self.filepath}:{report['file_line']}", name, check, description] for check, description in report["errors"] if not self._ignore_issue(node, check) ] @@ -207,13 +238,11 @@ if isinstance( node, (ast.Module, ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef) ): - self.stack.append( - self.module_name if isinstance(node, ast.Module) else node.name - ) + self.stack.append(node) if not ( self.config["exclude"] - and re.search(self.config["exclude"], ".".join(self.stack)) + and re.search(self.config["exclude"], self.node_name) ): self._get_numpydoc_issues(node) @@ -367,19 +396,12 @@ config_options = parse_config(config or project_root) config_options["checks"] -= set(ignore or []) - findings = [] + findings = False for file in files: - findings.extend(process_file(file, config_options)) + if file_issues := process_file(file, config_options): + findings = True - if findings: - print( - tabulate( - findings, - headers=["file", "item", "check", "description"], - tablefmt="grid", - maxcolwidths=50, - ), - file=sys.stderr, - ) - return 1 - return 0 + for line, obj, check, description in file_issues: + print(f"\n{line}: {check} {description}", file=sys.stderr) + + return int(findings) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/numpydoc.py new/numpydoc-1.9.0/numpydoc/numpydoc.py --- old/numpydoc-1.8.0/numpydoc/numpydoc.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/numpydoc.py 2025-06-24 14:22:17.000000000 +0200 @@ -296,7 +296,7 @@ app.add_config_value("numpydoc_attributes_as_param_list", True, True) app.add_config_value("numpydoc_xref_param_type", False, True) app.add_config_value("numpydoc_xref_aliases", dict(), True) - app.add_config_value("numpydoc_xref_ignore", set(), True) + app.add_config_value("numpydoc_xref_ignore", set(), True, types=[set, str]) app.add_config_value("numpydoc_validation_checks", set(), True) app.add_config_value("numpydoc_validation_exclude", set(), False) app.add_config_value("numpydoc_validation_overrides", dict(), False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/tests/hooks/example_module.py new/numpydoc-1.9.0/numpydoc/tests/hooks/example_module.py --- old/numpydoc-1.8.0/numpydoc/tests/hooks/example_module.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/tests/hooks/example_module.py 2025-06-24 14:22:17.000000000 +0200 @@ -23,8 +23,8 @@ *args """ - def process(self): - """Process stuff.""" + def create(self): + """Creates stuff.""" class NewClass: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/tests/hooks/test_validate_hook.py new/numpydoc-1.9.0/numpydoc/tests/hooks/test_validate_hook.py --- old/numpydoc-1.8.0/numpydoc/tests/hooks/test_validate_hook.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/tests/hooks/test_validate_hook.py 2025-06-24 14:22:17.000000000 +0200 @@ -8,7 +8,7 @@ from numpydoc.hooks.validate_docstrings import run_hook -@pytest.fixture() +@pytest.fixture def example_module(request): fullpath = ( Path(request.config.rootdir) @@ -26,55 +26,47 @@ expected = inspect.cleandoc( """ - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | file | item | check | description | - +===========================================+=====================================+=========+====================================================+ - | numpydoc/tests/hooks/example_module.py:1 | example_module | EX01 | No examples section found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | ES01 | No extended summary found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | PR01 | Parameters {'name'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | SA01 | See Also section not found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | EX01 | No examples section found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:8 | example_module.MyClass | ES01 | No extended summary found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:8 | example_module.MyClass | SA01 | See Also section not found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:8 | example_module.MyClass | EX01 | No examples section found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:11 | example_module.MyClass.__init__ | GL08 | The object does not have a docstring | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | ES01 | No extended summary found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR01 | Parameters {'**kwargs'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR07 | Parameter "*args" has no description | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | SA01 | See Also section not found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | EX01 | No examples section found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:26 | example_module.MyClass.process | SS05 | Summary must start with infinitive verb, not third | - | | | | person (e.g. use "Generate" instead of | - | | | | "Generates") | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:26 | example_module.MyClass.process | ES01 | No extended summary found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:26 | example_module.MyClass.process | SA01 | See Also section not found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:26 | example_module.MyClass.process | EX01 | No examples section found | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:30 | example_module.NewClass | GL08 | The object does not have a docstring | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ + numpydoc/tests/hooks/example_module.py:4: ES01 No extended summary found + + numpydoc/tests/hooks/example_module.py:4: PR01 Parameters {'name'} not documented + + numpydoc/tests/hooks/example_module.py:4: SA01 See Also section not found + + numpydoc/tests/hooks/example_module.py:4: EX01 No examples section found + + numpydoc/tests/hooks/example_module.py:8: ES01 No extended summary found + + numpydoc/tests/hooks/example_module.py:8: SA01 See Also section not found + + numpydoc/tests/hooks/example_module.py:8: EX01 No examples section found + + numpydoc/tests/hooks/example_module.py:11: GL08 The object does not have a docstring + + numpydoc/tests/hooks/example_module.py:17: ES01 No extended summary found + + numpydoc/tests/hooks/example_module.py:17: PR01 Parameters {'**kwargs'} not documented + + numpydoc/tests/hooks/example_module.py:17: PR07 Parameter "*args" has no description + + numpydoc/tests/hooks/example_module.py:17: SA01 See Also section not found + + numpydoc/tests/hooks/example_module.py:17: EX01 No examples section found + + numpydoc/tests/hooks/example_module.py:26: SS05 Summary must start with infinitive verb, not third person (e.g. use "Generate" instead of "Generates") + + numpydoc/tests/hooks/example_module.py:26: ES01 No extended summary found + + numpydoc/tests/hooks/example_module.py:26: SA01 See Also section not found + + numpydoc/tests/hooks/example_module.py:26: EX01 No examples section found + + numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring """ ) return_code = run_hook([example_module], config=config) assert return_code == 1 - assert capsys.readouterr().err.rstrip() == expected + assert capsys.readouterr().err.strip() == expected def test_validate_hook_with_ignore(example_module, capsys): @@ -85,30 +77,24 @@ expected = inspect.cleandoc( """ - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | file | item | check | description | - +===========================================+=====================================+=========+====================================================+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | PR01 | Parameters {'name'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:11 | example_module.MyClass.__init__ | GL08 | The object does not have a docstring | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR01 | Parameters {'**kwargs'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR07 | Parameter "*args" has no description | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:26 | example_module.MyClass.process | SS05 | Summary must start with infinitive verb, not third | - | | | | person (e.g. use "Generate" instead of | - | | | | "Generates") | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ - | numpydoc/tests/hooks/example_module.py:30 | example_module.NewClass | GL08 | The object does not have a docstring | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------------------+ + numpydoc/tests/hooks/example_module.py:4: PR01 Parameters {'name'} not documented + + numpydoc/tests/hooks/example_module.py:11: GL08 The object does not have a docstring + + numpydoc/tests/hooks/example_module.py:17: PR01 Parameters {'**kwargs'} not documented + + numpydoc/tests/hooks/example_module.py:17: PR07 Parameter "*args" has no description + + numpydoc/tests/hooks/example_module.py:26: SS05 Summary must start with infinitive verb, not third person (e.g. use "Generate" instead of "Generates") + + numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring """ ) return_code = run_hook([example_module], ignore=["ES01", "SA01", "EX01"]) assert return_code == 1 - assert capsys.readouterr().err.rstrip() == expected + assert capsys.readouterr().err.strip() == expected def test_validate_hook_with_toml_config(example_module, tmp_path, capsys): @@ -130,9 +116,7 @@ ] exclude = '\\.__init__$' override_SS05 = [ - '^Process', - '^Assess', - '^Access', + '^Creates', ] """ ) @@ -140,23 +124,19 @@ expected = inspect.cleandoc( """ - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | file | item | check | description | - +===========================================+=====================================+=========+========================================+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | PR01 | Parameters {'name'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR01 | Parameters {'**kwargs'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR07 | Parameter "*args" has no description | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | numpydoc/tests/hooks/example_module.py:30 | example_module.NewClass | GL08 | The object does not have a docstring | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ + numpydoc/tests/hooks/example_module.py:4: PR01 Parameters {'name'} not documented + + numpydoc/tests/hooks/example_module.py:17: PR01 Parameters {'**kwargs'} not documented + + numpydoc/tests/hooks/example_module.py:17: PR07 Parameter "*args" has no description + + numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring """ ) return_code = run_hook([example_module], config=tmp_path) assert return_code == 1 - assert capsys.readouterr().err.rstrip() == expected + assert capsys.readouterr().err.strip() == expected def test_validate_hook_with_setup_cfg(example_module, tmp_path, capsys): @@ -172,30 +152,26 @@ [tool:numpydoc_validation] checks = all,EX01,SA01,ES01 exclude = \\.__init__$ - override_SS05 = ^Process,^Assess,^Access + override_SS05 = ^Creates """ ) ) expected = inspect.cleandoc( """ - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | file | item | check | description | - +===========================================+=====================================+=========+========================================+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | PR01 | Parameters {'name'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR01 | Parameters {'**kwargs'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR07 | Parameter "*args" has no description | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | numpydoc/tests/hooks/example_module.py:30 | example_module.NewClass | GL08 | The object does not have a docstring | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ + numpydoc/tests/hooks/example_module.py:4: PR01 Parameters {'name'} not documented + + numpydoc/tests/hooks/example_module.py:17: PR01 Parameters {'**kwargs'} not documented + + numpydoc/tests/hooks/example_module.py:17: PR07 Parameter "*args" has no description + + numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring """ ) return_code = run_hook([example_module], config=tmp_path) assert return_code == 1 - assert capsys.readouterr().err.rstrip() == expected + assert capsys.readouterr().err.strip() == expected def test_validate_hook_exclude_option_pyproject(example_module, tmp_path, capsys): @@ -220,9 +196,7 @@ '\.__init__$', ] override_SS05 = [ - '^Process', - '^Assess', - '^Access', + '^Creates', ] """ ) @@ -230,19 +204,15 @@ expected = inspect.cleandoc( """ - +-------------------------------------------+------------------------------+---------+--------------------------------------+ - | file | item | check | description | - +===========================================+==============================+=========+======================================+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | PR01 | Parameters {'name'} not documented | - +-------------------------------------------+------------------------------+---------+--------------------------------------+ - | numpydoc/tests/hooks/example_module.py:30 | example_module.NewClass | GL08 | The object does not have a docstring | - +-------------------------------------------+------------------------------+---------+--------------------------------------+ + numpydoc/tests/hooks/example_module.py:4: PR01 Parameters {'name'} not documented + + numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring """ ) return_code = run_hook([example_module], config=tmp_path) assert return_code == 1 - assert capsys.readouterr().err.rstrip() == expected + assert capsys.readouterr().err.strip() == expected def test_validate_hook_exclude_option_setup_cfg(example_module, tmp_path, capsys): @@ -258,25 +228,21 @@ [tool:numpydoc_validation] checks = all,EX01,SA01,ES01 exclude = \\.NewClass$,\\.__init__$ - override_SS05 = ^Process,^Assess,^Access + override_SS05 = ^Creates """ ) ) expected = inspect.cleandoc( """ - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | file | item | check | description | - +===========================================+=====================================+=========+========================================+ - | numpydoc/tests/hooks/example_module.py:4 | example_module.some_function | PR01 | Parameters {'name'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR01 | Parameters {'**kwargs'} not documented | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ - | numpydoc/tests/hooks/example_module.py:17 | example_module.MyClass.do_something | PR07 | Parameter "*args" has no description | - +-------------------------------------------+-------------------------------------+---------+----------------------------------------+ + numpydoc/tests/hooks/example_module.py:4: PR01 Parameters {'name'} not documented + + numpydoc/tests/hooks/example_module.py:17: PR01 Parameters {'**kwargs'} not documented + + numpydoc/tests/hooks/example_module.py:17: PR07 Parameter "*args" has no description """ ) return_code = run_hook([example_module], config=tmp_path) assert return_code == 1 - assert capsys.readouterr().err.rstrip() == expected + assert capsys.readouterr().err.strip() == expected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/tests/test_docscrape.py new/numpydoc-1.9.0/numpydoc/tests/test_docscrape.py --- old/numpydoc-1.8.0/numpydoc/tests/test_docscrape.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/tests/test_docscrape.py 2025-06-24 14:22:17.000000000 +0200 @@ -1596,8 +1596,8 @@ self.numpydoc_validation_overrides = dict() xref_aliases_complete = deepcopy(DEFAULT_LINKS) - for key in xref_aliases: - xref_aliases_complete[key] = xref_aliases[key] + for key, val in xref_aliases.items(): + xref_aliases_complete[key] = val config = Config(xref_aliases, xref_aliases_complete) app = namedtuple("config", "config")(config) update_config(app) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/tests/test_main.py new/numpydoc-1.9.0/numpydoc/tests/test_main.py --- old/numpydoc-1.8.0/numpydoc/tests/test_main.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/tests/test_main.py 2025-06-24 14:22:17.000000000 +0200 @@ -117,26 +117,14 @@ assert exit_status == 0 -@pytest.mark.parametrize("args", [[], ["--ignore", "ES01", "SA01", "EX01"]]) +@pytest.mark.parametrize("args", [[], ["--ignore", "SS03"]]) def test_lint(capsys, args): argv = ["lint", "numpydoc/__main__.py"] + args if args: expected = "" expected_status = 0 else: - expected = inspect.cleandoc( - """ - +------------------------+----------+---------+----------------------------+ - | file | item | check | description | - +========================+==========+=========+============================+ - | numpydoc/__main__.py:1 | __main__ | ES01 | No extended summary found | - +------------------------+----------+---------+----------------------------+ - | numpydoc/__main__.py:1 | __main__ | SA01 | See Also section not found | - +------------------------+----------+---------+----------------------------+ - | numpydoc/__main__.py:1 | __main__ | EX01 | No examples section found | - +------------------------+----------+---------+----------------------------+ - """ - ) + expected = "numpydoc/__main__.py:1: SS03 Summary does not end with a period" expected_status = 1 return_status = numpydoc.cli.main(argv) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/tests/test_numpydoc.py new/numpydoc-1.9.0/numpydoc/tests/test_numpydoc.py --- old/numpydoc-1.8.0/numpydoc/tests/test_numpydoc.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/tests/test_numpydoc.py 2025-06-24 14:22:17.000000000 +0200 @@ -36,6 +36,7 @@ class MockBuilder: config = MockConfig() + _translator = None class MockApp: @@ -49,6 +50,7 @@ self.verbosity = 2 self._warncount = 0 self.warningiserror = False + self._exception_on_warning = False def test_mangle_docstrings_basic(): @@ -142,7 +144,7 @@ assert _clean_text_signature("func($self, *args)") == "func(*args)" -@pytest.fixture() +@pytest.fixture def f(): def _function_without_seealso_and_examples(): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/tests/test_validate.py new/numpydoc-1.9.0/numpydoc/tests/test_validate.py --- old/numpydoc-1.8.0/numpydoc/tests/test_validate.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/tests/test_validate.py 2025-06-24 14:22:17.000000000 +0200 @@ -1198,6 +1198,113 @@ """ +class ConstructorDocumentedInClassAndInit: + """ + Class to test constructor documented via class and constructor docstrings. + + A case where both the class docstring and the constructor docstring are + defined. + + Parameters + ---------- + param1 : int + Description of param1. + + See Also + -------- + otherclass : A class that does something else. + + Examples + -------- + This is an example of how to use ConstructorDocumentedInClassAndInit. + """ + + def __init__(self, param1: int) -> None: + """ + Constructor docstring with additional information. + + Extended information. + + Parameters + ---------- + param1 : int + Description of param1 with extra details. + + See Also + -------- + otherclass : A class that does something else. + + Examples + -------- + This is an example of how to use ConstructorDocumentedInClassAndInit. + """ + + +class ConstructorDocumentedInClass: + """ + Class to test constructor documented via class docstring. + + Useful to ensure that validation of `__init__` does not signal GL08, + when the class docstring properly documents the `__init__` constructor. + + Parameters + ---------- + param1 : int + Description of param1. + + See Also + -------- + otherclass : A class that does something else. + + Examples + -------- + This is an example of how to use ConstructorDocumentedInClass. + """ + + def __init__(self, param1: int) -> None: + pass + + +class ConstructorDocumentedInClassWithNoParameters: + """ + Class to test constructor documented via class docstring with no parameters. + + Useful to ensure that validation of `__init__` does not signal GL08, + when the class docstring properly documents the `__init__` constructor. + + See Also + -------- + otherclass : A class that does something else. + + Examples + -------- + This is an example of how to use ConstructorDocumentedInClassWithNoParameters. + """ + + def __init__(self) -> None: + pass + + +class IncompleteConstructorDocumentedInClass: + """ + Class to test an incomplete constructor docstring. + + This class does not properly document parameters. + Unnecessary extended summary. + + See Also + -------- + otherclass : A class that does something else. + + Examples + -------- + This is an example of how to use IncompleteConstructorDocumentedInClass. + """ + + def __init__(self, param1: int): + pass + + class TestValidator: def _import_path(self, klass=None, func=None): """ @@ -1536,6 +1643,40 @@ for msg in msgs: assert msg in " ".join(err[1] for err in result["errors"]) + @pytest.mark.parametrize( + "klass,exp_init_codes,exc_init_codes,exp_klass_codes", + [ + ("ConstructorDocumentedInClass", tuple(), ("GL08",), tuple()), + ("ConstructorDocumentedInClassAndInit", tuple(), ("GL08",), tuple()), + ( + "ConstructorDocumentedInClassWithNoParameters", + tuple(), + ("GL08",), + tuple(), + ), + ( + "IncompleteConstructorDocumentedInClass", + ("GL08",), + tuple(), + ("PR01"), # Parameter not documented in class constructor + ), + ], + ) + def test_constructor_docstrings( + self, klass, exp_init_codes, exc_init_codes, exp_klass_codes + ): + # First test the class docstring itself, checking expected_klass_codes match + result = validate_one(self._import_path(klass=klass)) + for err in result["errors"]: + assert err[0] in exp_klass_codes + + # Then test the constructor docstring + result = validate_one(self._import_path(klass=klass, func="__init__")) + for code in exp_init_codes: + assert code in " ".join(err[0] for err in result["errors"]) + for code in exc_init_codes: + assert code not in " ".join(err[0] for err in result["errors"]) + def decorator(x): """Test decorator.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc/validate.py new/numpydoc-1.9.0/numpydoc/validate.py --- old/numpydoc-1.8.0/numpydoc/validate.py 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc/validate.py 2025-06-24 14:22:17.000000000 +0200 @@ -80,8 +80,7 @@ "PR06": 'Parameter "{param_name}" type should use "{right_type}" instead ' 'of "{wrong_type}"', "PR07": 'Parameter "{param_name}" has no description', - "PR08": 'Parameter "{param_name}" description should start with a ' - "capital letter", + "PR08": 'Parameter "{param_name}" description should start with a capital letter', "PR09": 'Parameter "{param_name}" description should finish with "."', "PR10": 'Parameter "{param_name}" requires a space before the colon ' "separating the parameter name and type", @@ -278,6 +277,10 @@ return inspect.isfunction(self.obj) @property + def is_mod(self): + return inspect.ismodule(self.obj) + + @property def is_generator_function(self): return inspect.isgeneratorfunction(_unwrap(self.obj)) @@ -633,7 +636,29 @@ errs = [] if not doc.raw_doc: - if "GL08" not in ignore_validation_comments: + report_GL08: bool = True + # Check if the object is a class and has a docstring in the constructor + # Also check if code_obj is defined, as undefined for the AstValidator in validate_docstrings.py. + if ( + doc.name.endswith(".__init__") + and doc.is_function_or_method + and hasattr(doc, "code_obj") + ): + cls_name = doc.code_obj.__qualname__.split(".")[0] + cls = Validator._load_obj(f"{doc.code_obj.__module__}.{cls_name}") + # cls = Validator._load_obj(f"{doc.name[:-9]}.{cls_name}") ## Alternative + cls_doc = Validator(get_doc_object(cls)) + + # Parameter_mismatches, PR01, PR02, PR03 are checked for the class docstring. + # If cls_doc has PR01, PR02, PR03 errors, i.e. invalid class docstring, + # then we also report missing constructor docstring, GL08. + report_GL08 = len(cls_doc.parameter_mismatches) > 0 + + # Check if GL08 is to be ignored: + if "GL08" in ignore_validation_comments: + report_GL08 = False + # Add GL08 error? + if report_GL08: errs.append(error("GL08")) return { "type": doc.type, @@ -685,12 +710,18 @@ errs.append(error("SS03")) if doc.summary != doc.summary.lstrip(): errs.append(error("SS04")) - elif doc.is_function_or_method and doc.summary.split(" ")[0][-1] == "s": + # Heuristic to check for infinitive verbs - shouldn't end in "s" + elif ( + doc.is_function_or_method + and len(doc.summary.split(" ")[0]) > 1 + and doc.summary.split(" ")[0][-1] == "s" + and doc.summary.split(" ")[0][-2] != "s" + ): errs.append(error("SS05")) if doc.num_summary_lines > 1: errs.append(error("SS06")) - if not doc.extended_summary: + if not doc.is_mod and not doc.extended_summary: errs.append(("ES01", "No extended summary found")) # PR01: Parameters not documented @@ -742,20 +773,21 @@ if not doc.yields and doc.is_generator_function: errs.append(error("YD01")) - if not doc.see_also: - errs.append(error("SA01")) - else: - for rel_name, rel_desc in doc.see_also.items(): - if rel_desc: - if not rel_desc.endswith("."): - errs.append(error("SA02", reference_name=rel_name)) - if rel_desc[0].isalpha() and not rel_desc[0].isupper(): - errs.append(error("SA03", reference_name=rel_name)) - else: - errs.append(error("SA04", reference_name=rel_name)) + if not doc.is_mod: + if not doc.see_also: + errs.append(error("SA01")) + else: + for rel_name, rel_desc in doc.see_also.items(): + if rel_desc: + if not rel_desc.endswith("."): + errs.append(error("SA02", reference_name=rel_name)) + if rel_desc[0].isalpha() and not rel_desc[0].isupper(): + errs.append(error("SA03", reference_name=rel_name)) + else: + errs.append(error("SA04", reference_name=rel_name)) - if not doc.examples: - errs.append(error("EX01")) + if not doc.examples: + errs.append(error("EX01")) errs = [err for err in errs if err[0] not in ignore_validation_comments] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc.egg-info/PKG-INFO new/numpydoc-1.9.0/numpydoc.egg-info/PKG-INFO --- old/numpydoc-1.8.0/numpydoc.egg-info/PKG-INFO 2024-08-09 17:52:01.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc.egg-info/PKG-INFO 2025-06-24 14:22:24.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 2.1 +Metadata-Version: 2.4 Name: numpydoc -Version: 1.8.0 +Version: 1.9.0 Summary: Sphinx extension to support docstrings in Numpy format Author-email: Pauli Virtanen and others <p...@iki.fi> License: Copyright (C) 2008-2023 Stefan van der Walt <ste...@mentat.za.net>, Pauli Virtanen <p...@iki.fi> @@ -42,26 +42,14 @@ Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 Classifier: Topic :: Documentation Requires-Python: >=3.9 Description-Content-Type: text/x-rst License-File: LICENSE.txt Requires-Dist: sphinx>=6 -Requires-Dist: tabulate>=0.8.10 Requires-Dist: tomli>=1.1.0; python_version < "3.11" -Provides-Extra: developer -Requires-Dist: pre-commit>=3.3; extra == "developer" -Requires-Dist: tomli; python_version < "3.11" and extra == "developer" -Provides-Extra: doc -Requires-Dist: numpy>=1.22; extra == "doc" -Requires-Dist: matplotlib>=3.5; extra == "doc" -Requires-Dist: pydata-sphinx-theme>=0.13.3; extra == "doc" -Requires-Dist: sphinx>=7; extra == "doc" -Requires-Dist: intersphinx_registry; extra == "doc" -Provides-Extra: test -Requires-Dist: pytest; extra == "test" -Requires-Dist: pytest-cov; extra == "test" -Requires-Dist: matplotlib; extra == "test" +Dynamic: license-file ===================================== numpydoc -- Numpy's Sphinx extensions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc.egg-info/SOURCES.txt new/numpydoc-1.9.0/numpydoc.egg-info/SOURCES.txt --- old/numpydoc-1.8.0/numpydoc.egg-info/SOURCES.txt 2024-08-09 17:52:01.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc.egg-info/SOURCES.txt 2025-06-24 14:22:24.000000000 +0200 @@ -47,8 +47,4 @@ numpydoc/tests/tinybuild/Makefile numpydoc/tests/tinybuild/conf.py numpydoc/tests/tinybuild/index.rst -numpydoc/tests/tinybuild/numpydoc_test_module.py -requirements/default.txt -requirements/developer.txt -requirements/doc.txt -requirements/test.txt \ No newline at end of file +numpydoc/tests/tinybuild/numpydoc_test_module.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/numpydoc.egg-info/requires.txt new/numpydoc-1.9.0/numpydoc.egg-info/requires.txt --- old/numpydoc-1.8.0/numpydoc.egg-info/requires.txt 2024-08-09 17:52:01.000000000 +0200 +++ new/numpydoc-1.9.0/numpydoc.egg-info/requires.txt 2025-06-24 14:22:24.000000000 +0200 @@ -1,23 +1,4 @@ sphinx>=6 -tabulate>=0.8.10 [:python_version < "3.11"] tomli>=1.1.0 - -[developer] -pre-commit>=3.3 - -[developer:python_version < "3.11"] -tomli - -[doc] -numpy>=1.22 -matplotlib>=3.5 -pydata-sphinx-theme>=0.13.3 -sphinx>=7 -intersphinx_registry - -[test] -pytest -pytest-cov -matplotlib diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/pyproject.toml new/numpydoc-1.9.0/pyproject.toml --- old/numpydoc-1.8.0/pyproject.toml 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/pyproject.toml 2025-06-24 14:22:17.000000000 +0200 @@ -24,11 +24,11 @@ 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Topic :: Documentation', ] dependencies = [ 'sphinx>=6', - 'tabulate>=0.8.10', "tomli>=1.1.0;python_version<'3.11'", ] @@ -43,10 +43,12 @@ Homepage = 'https://numpydoc.readthedocs.io' Source = 'https://github.com/numpy/numpydoc/' -[project.optional-dependencies] -developer = [ +[dependency-groups] +dev = [ 'pre-commit>=3.3', "tomli; python_version < '3.11'", + { include-group = "doc" }, + { include-group = "test" } ] doc = [ 'numpy>=1.22', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/requirements/default.txt new/numpydoc-1.9.0/requirements/default.txt --- old/numpydoc-1.8.0/requirements/default.txt 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/requirements/default.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -# Generated via tools/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -sphinx>=6 -tabulate>=0.8.10 -tomli>=1.1.0;python_version<'3.11' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/requirements/developer.txt new/numpydoc-1.9.0/requirements/developer.txt --- old/numpydoc-1.8.0/requirements/developer.txt 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/requirements/developer.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -# Generated via tools/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -pre-commit>=3.3 -tomli; python_version < '3.11' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/requirements/doc.txt new/numpydoc-1.9.0/requirements/doc.txt --- old/numpydoc-1.8.0/requirements/doc.txt 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/requirements/doc.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -# Generated via tools/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -numpy>=1.22 -matplotlib>=3.5 -pydata-sphinx-theme>=0.13.3 -sphinx>=7 -intersphinx_registry diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numpydoc-1.8.0/requirements/test.txt new/numpydoc-1.9.0/requirements/test.txt --- old/numpydoc-1.8.0/requirements/test.txt 2024-08-09 17:51:54.000000000 +0200 +++ new/numpydoc-1.9.0/requirements/test.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -# Generated via tools/generate_requirements.py and pre-commit hook. -# Do not edit this file; modify pyproject.toml instead. -pytest -pytest-cov -matplotlib