Skip to content

Commit

Permalink
Docs: ignore numpydoc validation checks (#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt authored Jan 8, 2024
1 parent 8fb873c commit 662a0d6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ doc/*.ipynb
doc/*/*.ipynb
doc/*.rst
doc/*/*.rst
builtdocs/
jupyter_execute/

# PyBuilder
target/
Expand Down
21 changes: 21 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,26 @@

nbbuild_cell_timeout = 2000

# Datashader uses sphinx.ext.autodoc (e.g. automodule) for its API reference
# and automatically include a module that contains Image. Image inherits
# from xr.DataArray. Datashader uses numpydoc to parse the docstrings.
# It turns out xarray broke numpydoc https://github.com/pydata/xarray/issues/8596
# This is a bad hack to work around this issue.

import numpydoc.docscrape # noqa

original_error_location = numpydoc.docscrape.NumpyDocString._error_location

def patch_error_location(self, msg, error=True):
try:
original_error_location(self, msg, error)
except ValueError as e:
if "See Also entry ':doc:`xarray-tutorial" in str(e):
return
else:
raise e

numpydoc.docscrape.NumpyDocString._error_location = patch_error_location

# Override the Sphinx default title that appends `documentation`
html_title = f'{project} v{version}'

0 comments on commit 662a0d6

Please sign in to comment.