Skip to content

Commit 5ca63a7

Browse files
rossbarlarsoner
andauthored
DOC: Switch docs to pydata-sphinx-theme (#313)
* Rm scipy-sphinx-theme submodule. * Add pydata-sphinx-theme to doc reqs. * Modify conf to use pydata theme. * Add github badge via theme. * Update CI. * bump CI sphinx version 1.6.5 -> 1.8 for tests * Experimental: swap sidebars in theme. * Add :notoc: to index to suppress right sidebar. * FIX: No sidebar Co-authored-by: Eric Larson <[email protected]>
1 parent bdda056 commit 5ca63a7

File tree

11 files changed

+35
-61
lines changed

11 files changed

+35
-61
lines changed

.circleci/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ jobs:
1818
name: Get dependencies and install
1919
command: |
2020
pip install --user -q --upgrade pip setuptools
21-
pip install --user -q --upgrade numpy matplotlib sphinx
21+
pip install --user -q --upgrade numpy matplotlib sphinx pydata-sphinx-theme
2222
pip install --user -e .
23-
git submodule init
24-
git submodule update
2523
- save_cache:
2624
key: pip-cache
2725
paths:

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
os: [Ubuntu]
1515
python-version: [3.6, 3.7, 3.8, 3.9]
16-
sphinx-version: ["sphinx==1.6.5", "sphinx==2.1", "sphinx>3.0"]
16+
sphinx-version: ["sphinx==1.8.0", "sphinx==2.1", "sphinx>3.0"]
1717
steps:
1818
- uses: actions/checkout@v2
1919

@@ -53,8 +53,6 @@ jobs:
5353
5454
- name: Setup for doc build
5555
run: |
56-
# Get scipy-sphinx-theme
57-
git submodule update --init
5856
sudo apt install texlive texlive-latex-extra latexmk dvipng
5957
6058
- name: Build documentation

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "doc/scipy-sphinx-theme"]
2-
path = doc/scipy-sphinx-theme
3-
url = https://github.com/scipy/scipy-sphinx-theme

doc/conf.py

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999

100100
# List of patterns, relative to source directory, that match files and
101101
# directories to ignore when looking for source files.
102-
exclude_patterns = ['_build', 'scipy-sphinx-theme']
102+
exclude_patterns = ['_build']
103103

104104
# The reST default role (used for this markup: `text`) to use for all
105105
# documents.
@@ -131,32 +131,15 @@
131131
# The theme to use for HTML and HTML Help pages. See the documentation for
132132
# a list of builtin themes.
133133

134-
themedir = os.path.join(os.path.dirname(__file__), 'scipy-sphinx-theme', '_theme')
135-
if not os.path.isdir(themedir):
136-
raise RuntimeError("Get the scipy-sphinx-theme first, "
137-
"via git submodule init && git submodule update")
138-
139-
html_theme = 'scipy'
140-
html_theme_path = [themedir]
141-
142-
if 'scipyorg' in tags: # noqa: F821
143-
# Build for the scipy.org website
144-
html_theme_options = {
145-
"edit_link": True,
146-
"sidebar": "right",
147-
"scipy_org_logo": True,
148-
"rootlinks": [("https://scipy.org/", "Scipy.org"),
149-
("https://docs.scipy.org/", "Docs")]
150-
}
151-
else:
152-
# Default build
153-
html_theme_options = {
154-
"edit_link": False,
155-
"sidebar": "left",
156-
"scipy_org_logo": False,
157-
"rootlinks": []
158-
}
159-
html_sidebars = {}
134+
html_theme = "pydata_sphinx_theme"
135+
html_theme_options = {
136+
"github_url": "https://github.com/numpy/numpydoc",
137+
"show_prev_next": False,
138+
"search_bar_position": "navbar",
139+
}
140+
html_sidebars = {
141+
"**": [],
142+
}
160143

161144
html_title = "%s v%s Manual" % (project, version)
162145
html_last_updated_fmt = '%b %d, %Y'

doc/example.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
.. _example:
32

43
=======

doc/format.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
21
.. _format:
32

4-
========================
5-
numpydoc docstring guide
6-
========================
7-
8-
.. Contents::
3+
===========
4+
Style guide
5+
===========
96

107
This document describes the syntax and best practices for docstrings used with
118
the numpydoc extension for Sphinx_.
@@ -352,7 +349,7 @@ The sections of a function's docstring are:
352349
code, possibly including a discussion of the algorithm. This
353350
section may include mathematical equations, written in
354351
`LaTeX <https://www.latex-project.org/>`_ format::
355-
352+
356353
Notes
357354
-----
358355
The FFT is a fast implementation of the discrete Fourier transform:

doc/index.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@ Sphinx, and adds the code description directives ``np:function``,
1515
- PyPI: https://pypi.python.org/pypi/numpydoc/
1616

1717

18-
Documentation
19-
=============
20-
2118
.. toctree::
22-
:maxdepth: 2
19+
:hidden:
2320

2421
install
25-
release_notes
2622
format
27-
example
2823
validation
24+
release_notes
25+
example

doc/install.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1+
===============
2+
Getting started
3+
===============
14

2-
============
35
Installation
46
============
57

6-
This extension requires Python 3.5+, sphinx 1.6.5+ and is available from:
8+
This extension requires Python 3.5+, sphinx 1.8+ and is available from:
79

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

11-
'numpydoc' should be added to the ``extensions`` option in your Sphinx
12-
``conf.py``. (Note that `sphinx.ext.autosummary` will automatically be loaded
13-
as well.)
13+
`'numpydoc'` should be added to the ``extensions`` option in your Sphinx
14+
``conf.py``. ``'sphinx.ext.autosummary'`` will automatically be loaded
15+
as well.
1416

15-
Sphinx config options
16-
=====================
17+
Configuration
18+
=============
1719

1820
The following options can be set in your Sphinx ``conf.py``:
1921

doc/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
numpy
22
matplotlib
3+
pydata-sphinx-theme

doc/scipy-sphinx-theme

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/validation.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
==============================
2-
Validating NumpyDoc docstrings
3-
==============================
1+
==========
2+
Validation
3+
==========
4+
5+
Docstring Validation using Python
6+
---------------------------------
47

58
To see the Restructured Text generated for an object, the ``numpydoc`` module
69
can be called. For example, to do it for ``numpy.ndarray``, use:

0 commit comments

Comments
 (0)