Skip to content

Commit b35056d

Browse files
authored
Merge branch 'numpy:main' into ConstructorChecking_ASTValidator
2 parents 9f70d0f + dd09c6d commit b35056d

File tree

14 files changed

+43
-37
lines changed

14 files changed

+43
-37
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
name: Run CircleCI artifacts redirector
66
steps:
77
- name: GitHub Action step
8-
uses: scientific-python/circleci-artifacts-redirector-action@7eafdb60666f57706a5525a2f5eb76224dc8779b # v1.1.0
8+
uses: scientific-python/circleci-artifacts-redirector-action@839631420e45a08af893032e5a5e8843bf47e8ff # v1.2.0
99
with:
1010
repo-token: ${{ secrets.GITHUB_TOKEN }}
1111
api-token: ${{ secrets.CIRCLECI_ARTIFACT_REDIRECTOR_TOKEN }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: sdist and wheels
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
15+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1616
with:
1717
fetch-depth: 0
1818
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
@@ -40,7 +40,7 @@ jobs:
4040
# IMPORTANT: this permission is mandatory for trusted publishing
4141
id-token: write
4242
steps:
43-
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
43+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
4444
with:
4545
name: dist
4646
path: dist

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: [Ubuntu]
19-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
19+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2020
sphinx-version:
2121
["sphinx==6.0", "sphinx==6.2", "sphinx==7.0", "sphinx>=7.3"]
2222
include:
@@ -27,7 +27,7 @@ jobs:
2727
run:
2828
shell: bash -eo pipefail {0}
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v5
3131

3232
- name: Python setup
3333
uses: actions/setup-python@v5
@@ -81,7 +81,7 @@ jobs:
8181
os: [ubuntu]
8282
python-version: ["3.11", "3.12", "3.13"]
8383
steps:
84-
- uses: actions/checkout@v4
84+
- uses: actions/checkout@v5
8585

8686
- name: Python setup
8787
uses: actions/setup-python@v5

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
6+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
77
hooks:
88
- id: check-added-large-files
99
- id: check-ast
@@ -25,7 +25,7 @@ repos:
2525
args: [--prose-wrap=preserve]
2626

2727
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: "971923581912ef60a6b70dbf0c3e9a39563c9d47" # frozen: v0.11.4
28+
rev: "9c89adb347f6b973f4905a4be0051eb2ecf85dea" # frozen: v0.13.3
2929
hooks:
3030
- id: ruff
3131
args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"]

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ docstrings formatted according to the NumPy documentation format.
1717
The extension also adds the code description directives
1818
``np:function``, ``np-c:function``, etc.
1919

20-
numpydoc requires Python 3.9+ and sphinx 6+.
20+
numpydoc requires Python 3.10+ and sphinx 6+.
2121

2222
For usage information, please refer to the `documentation
2323
<https://numpydoc.readthedocs.io/>`_.

doc/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Getting started
55
Installation
66
============
77

8-
This extension requires Python 3.9+, sphinx 6+ and is available from:
8+
This extension requires Python 3.10+, sphinx 6+ and is available from:
99

1010
* `numpydoc on PyPI <http://pypi.python.org/pypi/numpydoc>`_
1111
* `numpydoc on GitHub <https://github.com/numpy/numpydoc/>`_

numpydoc/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import ast
55
from collections.abc import Sequence
66
from pathlib import Path
7-
from typing import List, Union
7+
from typing import List
88

99
from .docscrape_sphinx import get_doc_object
1010
from .hooks import utils, validate_docstrings
1111
from .validate import ERROR_MSGS, Validator, validate
1212

1313

14-
def render_object(import_path: str, config: Union[List[str], None] = None) -> int:
14+
def render_object(import_path: str, config: List[str] | None = None) -> int:
1515
"""Test numpydoc docstring generation for a given object."""
1616
# TODO: Move Validator._load_obj to a better place than validate
1717
print(get_doc_object(Validator._load_obj(import_path), config=dict(config or [])))
@@ -117,7 +117,7 @@ def _parse_config(s):
117117
return ap
118118

119119

120-
def main(argv: Union[Sequence[str], None] = None) -> int:
120+
def main(argv: Sequence[str] | None = None) -> int:
121121
"""CLI for numpydoc."""
122122
ap = get_parser()
123123

numpydoc/docscrape.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def get_func(self):
597597
def __str__(self):
598598
out = ""
599599

600-
func, func_name = self.get_func()
600+
_func, func_name = self.get_func()
601601

602602
roles = {"func": "function", "meth": "method"}
603603

@@ -701,7 +701,7 @@ def properties(self):
701701
and not self._should_skip_member(name, self._cls)
702702
and (
703703
func is None
704-
or isinstance(func, (property, cached_property))
704+
or isinstance(func, property | cached_property)
705705
or inspect.isdatadescriptor(func)
706706
)
707707
and self._is_show_member(name)

numpydoc/hooks/validate_docstrings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def name(self) -> str:
6363

6464
@property
6565
def is_function_or_method(self) -> bool:
66-
return isinstance(self.node, (ast.FunctionDef, ast.AsyncFunctionDef))
66+
return isinstance(self.node, ast.FunctionDef | ast.AsyncFunctionDef)
6767

6868
@property
6969
def is_mod(self) -> bool:
@@ -236,7 +236,7 @@ def visit(self, node: ast.AST) -> None:
236236
The node to visit.
237237
"""
238238
if isinstance(
239-
node, (ast.Module, ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)
239+
node, ast.Module | ast.ClassDef | ast.FunctionDef | ast.AsyncFunctionDef
240240
):
241241
self.stack.append(node)
242242

@@ -395,8 +395,8 @@ def process_file(filepath: os.PathLike, config: dict) -> "list[list[str]]":
395395
def run_hook(
396396
files: List[str],
397397
*,
398-
config: Union[Dict[str, Any], None] = None,
399-
ignore: Union[List[str], None] = None,
398+
config: Dict[str, Any] | None = None,
399+
ignore: List[str] | None = None,
400400
) -> int:
401401
"""
402402
Run the numpydoc validation hook.

numpydoc/numpydoc.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _is_cite_in_numpydoc_docstring(citation_node):
8888
section_node = citation_node.parent
8989

9090
def is_docstring_section(node):
91-
return isinstance(node, (section, desc_content))
91+
return isinstance(node, section | desc_content)
9292

9393
while not is_docstring_section(section_node):
9494
section_node = section_node.parent
@@ -185,8 +185,12 @@ def mangle_docstrings(app: SphinxApp, what, name, obj, options, lines):
185185
"xref_aliases": app.config.numpydoc_xref_aliases_complete,
186186
"xref_ignore": app.config.numpydoc_xref_ignore,
187187
}
188-
189-
cfg.update(options or {})
188+
# TODO: Find a cleaner way to take care of this change away from dict
189+
# https://github.com/sphinx-doc/sphinx/issues/13942
190+
try:
191+
cfg.update(options or {})
192+
except TypeError:
193+
cfg.update(options.__dict__ or {})
190194
u_NL = "\n"
191195
if what == "module":
192196
# Strip top title

0 commit comments

Comments
 (0)