Skip to content

Commit

Permalink
Update to Sphinx 7
Browse files Browse the repository at this point in the history
  • Loading branch information
drasmuss committed Jan 15, 2024
1 parent 0a1bf0d commit 806136b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 28 deletions.
9 changes: 3 additions & 6 deletions .nengobones.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ setup_py:
- nengo_sphinx_theme=nengo_sphinx_theme
include_package_data: True
install_req:
- docutils<0.17 # can remove this if we upgrade to more recent sphinx
- sphinx>=3.1.2,<4.0
- sphinx-notfound-page>=0.5.0
- sphinx>=7.2.6
- sphinx-notfound-page>=1.0.0
- backoff>=1.10.0
- jinja2<3.1.0 # can remove this if we upgrade to sphinx>=4.0
docs_req:
- jupyter
- matplotlib
Expand All @@ -47,8 +45,7 @@ setup_py:
- "Operating System :: Microsoft :: Windows"
- "Operating System :: POSIX :: Linux"
- "Programming Language :: Python"
- "Programming Language :: Python :: 3.6"
- "Programming Language :: Python :: 3.7"
- "Programming Language :: Python :: 3.9"
- "Topic :: Software Development"

setup_cfg:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Nengo Sphinx Theme license
**************************

Copyright (c) 2019-2023 Applied Brain Research
Copyright (c) 2019-2024 Applied Brain Research

**ABR License**

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

project = "Nengo Sphinx Theme"
authors = "Applied Brain Research"
copyright = "2019-2023 Applied Brain Research"
copyright = "2019-2024 Applied Brain Research"
version = ".".join(nengo_sphinx_theme.__version__.split(".")[:2]) # Short X.Y version
release = nengo_sphinx_theme.__version__ # Full version, with tags

Expand Down
18 changes: 6 additions & 12 deletions nengo_sphinx_theme/ext/autoautosummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from docutils.parsers.rst import directives
from sphinx.ext import autodoc, autosummary
from sphinx.ext.autodoc import StringList, _
from sphinx.util.typing import stringify
from sphinx.util.typing import stringify_annotation

# We import nengo_sphinx_theme here to test the issue that
# `patch_autosummary_import_by_name` fixes.
Expand Down Expand Up @@ -149,10 +149,10 @@ def patch_autosummary_import_by_name():

orig_f = autosummary.import_by_name

def import_by_name(name, prefixes):
def import_by_name(name, prefixes=(None,)):
# We currently do not support prefixes, because they can cause cycles. If we
# need this in the future, we can go back to filtering problematic prefixes.
prefixes = [None]
prefixes = (None,)
return orig_f(name, prefixes)

autosummary.import_by_name = import_by_name
Expand Down Expand Up @@ -187,26 +187,20 @@ def add_directive_header(self, sig):
class RenameClassDocumenter(RenameMixin, autodoc.ClassDocumenter):
"""Class autodocumenter with optional renaming."""

def add_content(self, more_content, no_docstring=False):
def add_content(self, more_content):
# This is a modified version of autodoc.ClassDocumenter.add_content
# that changes the module name for aliases
no_docstring = False
if self.doc_as_attr:
fullname = stringify(self.object)
fullname = stringify_annotation(self.object)
modname = self.env.config["autoautosummary_change_modules"].get(
fullname, ".".join(fullname.split(".")[:-1])
)

more_content = StringList(
[_(f"alias of :class:`{modname}.{fullname.split('.')[-1]}`")], source=""
)
no_docstring = True

# no_docstring only needs to be specified in sphinx<3.4
# pylint: disable=bad-super-call
super(autodoc.ClassDocumenter, self).add_content(
more_content, no_docstring=no_docstring
)
super(autodoc.ClassDocumenter, self).add_content(more_content)


class RenameFunctionDocumenter(RenameMixin, autodoc.FunctionDocumenter):
Expand Down
4 changes: 2 additions & 2 deletions nengo_sphinx_theme/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
tagged with the version.
"""

version_info = (23, 11, 7) # bones: ignore
version_info = (24, 1, 15) # bones: ignore

name = "nengo-sphinx-theme"
dev = 0
Expand All @@ -22,4 +22,4 @@
if dev is not None:
version += ".dev%d" % dev # pragma: no cover

copyright = "Copyright (c) 2019-2023 Applied Brain Research"
copyright = "Copyright (c) 2019-2024 Applied Brain Research"
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ def read(*filenames, **kwargs):
version = runpy.run_path(str(root / "nengo_sphinx_theme" / "version.py"))["version"]

install_req = [
"docutils<0.17",
"sphinx>=3.1.2,<4.0",
"sphinx-notfound-page>=0.5.0",
"sphinx>=7.2.6",
"sphinx-notfound-page>=1.0.0",
"backoff>=1.10.0",
"jinja2<3.1.0",
]
docs_req = [
"jupyter",
Expand Down Expand Up @@ -77,8 +75,7 @@ def read(*filenames, **kwargs):
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development",
],
)

0 comments on commit 806136b

Please sign in to comment.