Skip to content

Commit 4095608

Browse files
committed
Seed some python terms to numpy_xref_aliases
Signed-off-by: Nathaniel Starkman (@nstarman) <[email protected]>
1 parent 86d9015 commit 4095608

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

setup.cfg

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ universal = 1
2222
zip_safe = False
2323
packages = find:
2424
install_requires =
25-
sphinx>=1.7
26-
astropy-sphinx-theme
27-
numpydoc
28-
sphinx-automodapi
29-
sphinx-gallery
30-
pillow
25+
sphinx>=1.7
26+
astropy-sphinx-theme
27+
numpydoc
28+
sphinx-automodapi
29+
sphinx-gallery
30+
pillow
3131
astropy
3232

3333
[options.package_data]

sphinx_astropy/conf/v1.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,17 @@ def check_sphinx_version(expected_version):
109109
# aliases/shortcuts used when specifying the types of parameters.
110110
# Numpy provides some defaults
111111
# https://github.com/numpy/numpydoc/blob/b352cd7635f2ea7748722f410a31f937d92545cc/numpydoc/xref.py#L62-L94
112-
# numpydoc_xref_aliases = {}
112+
numpydoc_xref_aliases = {
113+
# Python terms
114+
"function": ":term:`python:function`",
115+
"iterator": ":term:`python:iterator`",
116+
"mapping": ":term:`python:mapping`",
117+
}
113118

114-
numpydoc_xref_aliases_astropy_physical_type = {}
119+
# Aliases to Astropy's physical types. In packages these can be turned on with
120+
# ``numpydoc_xref_aliases.update(numpydoc_xref_aliases_astropy_physical_type)``
121+
# (if astropy is in the intersphinx mapping).
122+
numpydoc_xref_aliases_astropy_physical_type = {} # works even if older astropy
115123
if float(astropy.__version__[:3]) >= 4.3:
116124

117125
# TODO! refactor if #11678 is implemented
@@ -122,8 +130,8 @@ def check_sphinx_version(expected_version):
122130
key = f"'{ptype}'"
123131
val = f":ref:`:ref: '{ptype}' <astropy:{ptype}>`" # <= intersphinxed.
124132
numpydoc_xref_aliases_astropy_physical_type[key] = val
125-
126-
del ptypes, key, val
133+
134+
del ptypes, key, val, _units_and_physical_types
127135

128136
# -- Project information ------------------------------------------------------
129137

0 commit comments

Comments
 (0)