Skip to content

Commit 5d0175c

Browse files
Merge branch 'numpy:main' into main
2 parents 65cae8d + 7ea993a commit 5d0175c

25 files changed

+344
-199
lines changed

.circleci/config.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,47 @@ version: 2
22
jobs:
33
build_docs:
44
docker:
5-
- image: circleci/python:3.7-stretch
5+
- image: "cimg/python:3.10"
66
steps:
77
- checkout
88
- run:
9-
name: Set BASH_ENV
10-
command: |
11-
echo "set -e" >> $BASH_ENV;
12-
echo "export PATH=~/.local/bin:$PATH" >> $BASH_ENV;
13-
sudo apt update
14-
sudo apt install dvipng texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra texlive-generic-extra latexmk texlive-xetex
9+
name: Update apt-get
10+
command: sudo apt-get update
11+
- run:
12+
name: Install TeX
13+
command: sudo apt install dvipng texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra latexmk texlive-xetex
1514
- restore_cache:
1615
keys:
1716
- pip-cache
1817
- run:
1918
name: Get dependencies and install
2019
command: |
21-
pip install --user -q --upgrade pip setuptools
22-
pip install --user -q --upgrade numpy matplotlib sphinx pydata-sphinx-theme
23-
pip install --user -e .
20+
python3 -m venv venv
21+
source venv/bin/activate
22+
python -m pip install --upgrade pip wheel setuptools
23+
python -m pip install --upgrade -r requirements/doc.txt
24+
python -m pip list
2425
- save_cache:
2526
key: pip-cache
2627
paths:
2728
- ~/.cache/pip
2829
- run:
29-
name: make html
30+
name: Install
31+
command: |
32+
source venv/bin/activate
33+
pip install -e .
34+
- run:
35+
name: Build docs
3036
command: |
37+
source venv/bin/activate
3138
make -C doc html
3239
- store_artifacts:
3340
path: doc/_build/html/
3441
destination: html
3542
- run:
3643
name: make tinybuild
3744
command: |
45+
source venv/bin/activate
3846
make -C numpydoc/tests/tinybuild html
3947
- store_artifacts:
4048
path: numpydoc/tests/tinybuild/_build/html/

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v3
11-
- uses: actions/setup-python@v3
12-
- uses: pre-commit/action@v2.0.3
11+
- uses: actions/setup-python@v4
12+
- uses: pre-commit/action@v3.0.0

.github/workflows/test.yml

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,33 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [Ubuntu]
15-
python-version: ["3.7", "3.8", "3.9", "3.10"]
16-
sphinx-version: ["sphinx==3.0", "sphinx==4.0", "sphinx>4.4"]
15+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
16+
sphinx-version:
17+
["sphinx==4.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"]
1718
steps:
18-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
1920

2021
- name: Python setup
21-
uses: actions/setup-python@v2
22+
uses: actions/setup-python@v4
2223
with:
2324
python-version: ${{ matrix.python-version }}
2425

2526
- name: Setup environment
2627
run: |
2728
python -m pip install --upgrade pip wheel setuptools
28-
python -m pip install -r requirements/test.txt -r doc/requirements.txt
29+
python -m pip install -r requirements/test.txt -r requirements/doc.txt
2930
python -m pip install codecov
3031
python -m pip install ${{ matrix.sphinx-version }}
3132
python -m pip list
3233
33-
- name: Downgrade Jinja2 for sphinx<4
34-
if: ${{ matrix.sphinx-version }} == 'sphinx<4.0.2'
35-
run: python -m pip install jinja2==3.0.3 markupsafe==2.0.1 pydata-sphinx-theme==0.8.0
36-
3734
- name: Install
3835
run: |
3936
python -m pip install .
4037
pip list
4138
4239
- name: Run test suite
4340
run: |
44-
pytest -v --pyargs .
41+
pytest -v --pyargs numpydoc
4542
4643
- name: Test coverage
4744
run: |
@@ -64,67 +61,24 @@ jobs:
6461
make -C doc html SPHINXOPTS="-nT"
6562
make -C doc latexpdf SPHINXOPTS="-nT"
6663
67-
base:
68-
runs-on: ${{ matrix.os }}-latest
69-
strategy:
70-
matrix:
71-
os: [ubuntu, macos, windows]
72-
python-version: ["3.11-dev"]
73-
sphinx-version: ["sphinx==4.0", "sphinx==4.5"]
74-
steps:
75-
- uses: actions/checkout@v2
76-
77-
- name: Python setup
78-
uses: actions/setup-python@v2
79-
with:
80-
python-version: ${{ matrix.python-version }}
81-
82-
- name: Setup environment
83-
run: |
84-
python -m pip install --upgrade pip wheel setuptools
85-
python -m pip install pytest pytest-cov
86-
python -m pip install ${{ matrix.sphinx-version }}
87-
python -m pip list
88-
89-
- name: Downgrade Jinja2 for sphinx<4
90-
if: ${{ matrix.sphinx-version }} == 'sphinx<4.0.2'
91-
run: python -m pip install jinja2==3.0.3 markupsafe==2.0.1 pydata-sphinx-theme==0.8.0
92-
93-
- name: Install
94-
run: |
95-
python -m pip install .
96-
pip list
97-
98-
- name: Run test suite
99-
run: |
100-
pytest -v --pyargs numpydoc
101-
102-
- name: Make sure CLI works
103-
run: |
104-
python -m numpydoc numpydoc.tests.test_main._capture_stdout
105-
echo '! python -m numpydoc numpydoc.tests.test_main._invalid_docstring' | bash
106-
python -m numpydoc --validate numpydoc.tests.test_main._capture_stdout
107-
echo '! python -m numpydoc --validate numpydoc.tests.test_main._docstring_with_errors' | bash
108-
10964
prerelease:
11065
runs-on: ${{ matrix.os }}-latest
11166
strategy:
11267
matrix:
11368
os: [ubuntu]
11469
python-version: ["3.9", "3.10"]
11570
steps:
116-
- uses: actions/checkout@v2
71+
- uses: actions/checkout@v3
11772

11873
- name: Python setup
119-
uses: actions/setup-python@v2
74+
uses: actions/setup-python@v4
12075
with:
12176
python-version: ${{ matrix.python-version }}
12277

12378
- name: Setup environment
12479
run: |
12580
python -m pip install --upgrade pip wheel setuptools
126-
python -m pip install --pre -r requirements/test.txt -r doc/requirements.txt
127-
python -m pip install docutils==0.17.1 # FIXME
81+
python -m pip install --pre -r requirements/test.txt -r requirements/doc.txt
12882
python -m pip install codecov
12983
python -m pip list
13084

.pre-commit-config.yaml

Lines changed: 4 additions & 4 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: v4.2.0
6+
rev: v4.3.0
77
hooks:
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
@@ -17,12 +17,12 @@ repos:
1717
- id: check-added-large-files
1818

1919
- repo: https://github.com/psf/black
20-
rev: 22.3.0
20+
rev: 22.8.0
2121
hooks:
2222
- id: black
2323

2424
- repo: https://github.com/pre-commit/mirrors-prettier
25-
rev: v2.6.2
25+
rev: v2.7.1
2626
hooks:
2727
- id: prettier
2828
files: \.(html|md|yml|yaml)
@@ -34,7 +34,7 @@ repos:
3434
- id: blacken-docs
3535

3636
- repo: https://github.com/asottile/pyupgrade
37-
rev: v2.32.1
37+
rev: v2.38.2
3838
hooks:
3939
- id: pyupgrade
4040
args: [--py37-plus]

README.rst

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

21-
numpydoc requires Python 3.7+ and sphinx 3.0+.
21+
numpydoc requires Python 3.7+ and sphinx 4.2+.
2222

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

doc/conf.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,26 @@
8585
"show_prev_next": False,
8686
"navbar_end": ["search-field.html", "navbar-icon-links.html"],
8787
}
88+
# NOTE: The following is required for supporting of older sphinx toolchains.
89+
# The "theme-switcher" templated should be added directly to navbar_end
90+
# above and the following lines removed when the minimum supported
91+
# version of pydata_sphinx_theme is 0.9.0
92+
# Add version switcher for versions of pydata_sphinx_theme that support it
93+
import packaging
94+
import pydata_sphinx_theme
95+
96+
if packaging.version.parse(pydata_sphinx_theme.__version__) >= packaging.version.parse(
97+
"0.9.0"
98+
):
99+
html_theme_options["navbar_end"].insert(0, "theme-switcher")
100+
101+
88102
html_sidebars = {
89103
"**": [],
90104
}
105+
html_context = {
106+
"default_mode": "light",
107+
}
91108

92109
html_title = f"{project} v{version} Manual"
93110
html_last_updated_fmt = "%b %d, %Y"

doc/format.rst

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Use a code checker:
3131
* pyflakes_: a tool to check Python code for errors by parsing
3232
the source file instead of importing it.
3333
* pycodestyle_: (formerly ``pep8``) a tool to check Python code against
34-
some of the style conventions in PEP 8.
34+
some of the style conventions in :pep:`8`.
3535
* flake8_: a tool that glues together ``pycodestyle``, ``pyflakes``,
3636
``mccabe`` to check the style and quality of Python code.
3737
* vim-flake8_: a ``flake8`` plugin for Vim.
@@ -287,14 +287,18 @@ takes the same form as the :ref:`Returns <returns>` section::
287287
Support for the :ref:`Yields <yields>` section was added in `numpydoc
288288
<https://github.com/numpy/numpydoc>`_ version 0.6.
289289

290+
.. _receives:
291+
290292
7. Receives
291293
```````````
292294

293295
Explanation of parameters passed to a generator's ``.send()`` method,
294-
formatted as for Parameters, above. Since, like for Yields and Returns, a
295-
single object is always passed to the method, this may describe either the
296-
single parameter, or positional arguments passed as a tuple. If a docstring
297-
includes Receives it must also include Yields.
296+
formatted as for :ref:`Parameters <params>`, above. Since, like for
297+
:ref:`Yields <yields>` and :ref:`Returns <returns>`, a single object is
298+
always passed to the method, this may describe either the single parameter,
299+
or positional arguments passed as a tuple. If a docstring
300+
includes :ref:`Receives <receives>` it must also include
301+
:ref:`Yields <yields>`.
298302

299303
8. Other Parameters
300304
```````````````````
@@ -303,6 +307,8 @@ An optional section used to describe infrequently used parameters.
303307
It should only be used if a function has a large number of keyword
304308
parameters, to prevent cluttering the :ref:`Parameters <params>` section.
305309

310+
.. _raises:
311+
306312
9. Raises
307313
`````````
308314

@@ -321,7 +327,7 @@ that are non-obvious or have a large chance of getting raised.
321327
`````````
322328

323329
An optional section detailing which warnings get raised and
324-
under what conditions, formatted similarly to Raises.
330+
under what conditions, formatted similarly to :ref:`Raises <raises>`.
325331

326332
11. Warnings
327333
````````````
@@ -545,8 +551,8 @@ Documenting classes
545551

546552
Class docstring
547553
```````````````
548-
Use the same sections as outlined above (all except ``Returns`` are
549-
applicable). The constructor (``__init__``) should also be documented
554+
Use the same sections as outlined above (all except :ref:`Returns <returns>`
555+
are applicable). The constructor (``__init__``) should also be documented
550556
here, the :ref:`Parameters <params>` section of the docstring details the
551557
constructor's parameters.
552558

doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:html_theme.sidebar_secondary.remove: true
2+
13
=====================================
24
numpydoc -- Numpy's Sphinx extensions
35
=====================================

doc/install.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Getting started
55
Installation
66
============
77

8-
This extension requires Python 3.7+, sphinx 3.0+ and is available from:
8+
This extension requires Python 3.7+, sphinx 4.2+ and is available from:
99

1010
* `numpydoc on PyPI <http://pypi.python.org/pypi/numpydoc>`_
1111
* `numpydoc on GitHub <https://github.com/numpy/numpydoc/>`_
@@ -26,10 +26,18 @@ numpydoc_show_class_members : bool
2626
Whether to show all members of a class in the Methods and Attributes
2727
sections automatically.
2828
``True`` by default.
29-
numpydoc_show_inherited_class_members : bool
29+
numpydoc_show_inherited_class_members : bool | dict
3030
Whether to show all inherited members of a class in the Methods and Attributes
3131
sections automatically. If it's false, inherited members won't shown.
32-
``True`` by default.
32+
``True`` by default. It can also be a dict mapping names of classes to
33+
boolean values (missing keys are treated as ``True``).
34+
For example, ``defaultdict(lambda: False, {'mymod.MyClass': True})``
35+
would only show inherited class members for ``MyClass``, whereas
36+
``{'mymod.MyClass': False}`` would show inherited class members for all
37+
classes except ``MyClass``. Note that disabling this for a limited set of
38+
classes might simultaneously require the use of a separate, custom
39+
autosummary class template with ``:no-inherited-members:`` in the
40+
``autoclass`` directive options.
3341
numpydoc_class_members_toctree : bool
3442
Whether to create a Sphinx table of contents for the lists of class
3543
methods and attributes. If a table of contents is made, Sphinx expects
@@ -40,10 +48,6 @@ numpydoc_citation_re : str
4048
should be mangled to avoid conflicts due to
4149
duplication across the documentation. Defaults
4250
to ``[\w-]+``.
43-
numpydoc_use_blockquotes : bool
44-
Until version 0.8, parameter definitions were shown as blockquotes, rather
45-
than in a definition list. If your styling requires blockquotes, switch
46-
this config option to True. This option will be removed in version 0.10.
4751
numpydoc_attributes_as_param_list : bool
4852
Whether to format the Attributes section of a class page in the same way
4953
as the Parameter section. If it's False, the Attributes section will be

0 commit comments

Comments
 (0)