Skip to content

Add sphinx-codeautolink extension to docs build #7011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies:
- sparse
- sphinx-autosummary-accessors
- sphinx-book-theme >= 0.0.38
- sphinx-codeautolink
- sphinx-copybutton
- sphinx-design
- sphinx!=4.4.0
Expand Down
14 changes: 14 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"IPython.sphinxext.ipython_console_highlighting",
"nbsphinx",
"sphinx_autosummary_accessors",
"sphinx_codeautolink",
"sphinx.ext.linkcode",
"sphinxext.opengraph",
"sphinx_copybutton",
Expand Down Expand Up @@ -121,6 +122,19 @@
autosummary_generate = True
autodoc_typehints = "none"

# codeautolink
codeautolink_concat_default = True
codeautolink_global_preface = """
import dask
import numpy as np
import pandas as pd
import xarray as xr
"""
codeautolink_inventory_map = {
"xarray.core.dataarray.DataArray": "xarray.DataArray",
"xarray.core.dataset.Dataset": "xarray.Dataset",
}

# Napoleon configurations

napoleon_google_docstring = False
Expand Down