Skip to content

Commit

Permalink
Test build to update docs to sphinx 4.x (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascillitoe committed Nov 3, 2021
1 parent 6a0bf9f commit 99806fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
30 changes: 14 additions & 16 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
html_static_path = ["_static"]

# override default theme width
html_context = {"css_files": ["_static/theme_overrides.css"]} # override wide tables in RTD theme
html_css_files = ['theme_overrides.css'] # override wide tables in RTD theme

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand Down Expand Up @@ -317,18 +317,16 @@
# Create heading anchors for h1 to h3 (useful for local toc's)
myst_heading_anchors = 3

## -- Decorators patch --------------------------------------------------------
## Below code fixes a problem with sphinx>=3.2.0 processing functions with
## torch.jit.script decorator. Probably occuring because torch is being mocked
## (see https://github.com/sphinx-doc/sphinx/issues/6709).
## Strangely should be fixed by sphinx #6719 (>=v2.3.0), but doesn't appear to
## be for us...
#def call_mock(self, *args, **kw):
# from types import FunctionType, MethodType
# if args and type(args[0]) in [type, FunctionType, MethodType]:
# # Appears to be a decorator, pass through unchanged
# return args[0]
# return self
#
#from sphinx.ext.autodoc.mock import _MockObject
#_MockObject.__call__ = call_mock
# Below code fixes a problem with sphinx>=3.2.0 processing functions with
# torch.jit.script decorator. Probably occuring because torch is being mocked
# (see https://github.com/sphinx-doc/sphinx/issues/6709).
def call_mock(self, *args, **kw):
from types import FunctionType, MethodType
if args and type(args[0]) in [type, FunctionType, MethodType]:
# Appears to be a decorator, pass through unchanged
return args[0]
return self

from sphinx.ext.autodoc.mock import _MockObject
_MockObject.__call__ = call_mock

8 changes: 4 additions & 4 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dependencies for building docs, separate from dev.txt as this is also used for builds on readthedocs.org
# core dependencies
sphinx>=2.1.2, <3.0.0 # pin to <3.x due to issue documenting classes which inherit mocked classes
sphinx-autodoc-typehints>=1.6.0, <1.13.0 # later versions depend on sphinx 3.0
sphinx-rtd-theme>=0.5.2, <0.6.0
sphinx>=4.2.0, <5.0.0
sphinx-autodoc-typehints>=1.12.0, <=2.0.0
sphinx-rtd-theme>=1.0.0, <=2.0.0
sphinxcontrib-apidoc>=0.3.0, <0.4.0
myst-parser>=0.14, <=0.15.2
myst-parser>=0.14, <0.16
nbsphinx>=0.8.5, <0.9.0
nbsphinx-link>=1.2.0, <2.0.0
ipykernel>=5.1.0, <6.0.0 # required for executing notebooks via nbsphinx
Expand Down

0 comments on commit 99806fe

Please sign in to comment.