@@ -88,6 +88,40 @@ def check_sphinx_version(expected_version):
88
88
89
89
suppress_warnings = ['app.add_directive' , ]
90
90
91
+ # -- NumpyDoc X-Ref ------------------------
92
+
93
+ # Whether to create cross-references for the parameter types in the
94
+ # Parameters, Other Parameters, Returns and Yields sections of the docstring.
95
+ # Should be set = True in packages manually! included here as reference.
96
+ # numpydoc_xref_param_type = False
97
+
98
+ # Words not to cross-reference. Most likely, these are common words used in
99
+ # parameter type descriptions that may be confused for classes of the same
100
+ # name. This can be overwritten or modified in packages and is provided here for
101
+ # convenience.
102
+ numpydoc_xref_ignore = {
103
+ 'type' , 'optional' , 'default' , 'or' , 'of' , 'method' , 'instance' , "like" ,
104
+ "class" , 'subclass' , "keyword-only" , "default" , "thereof"
105
+ }
106
+
107
+ # Mappings to fully qualified paths (or correct ReST references) for the
108
+ # aliases/shortcuts used when specifying the types of parameters.
109
+ # Numpy provides some defaults
110
+ # https://github.com/numpy/numpydoc/blob/b352cd7635f2ea7748722f410a31f937d92545cc/numpydoc/xref.py#L62-L94
111
+ # numpydoc_xref_aliases = {}
112
+
113
+ # TODO! refactor if #11678 is implemented
114
+ from astropy .units .physical import _units_and_physical_types
115
+ numpydoc_xref_aliases_astropy_physical_type = {}
116
+ for _ , ptypes in _units_and_physical_types :
117
+ ptypes = {ptypes } if isinstance (ptypes , str ) else ptypes
118
+ for ptype in ptypes :
119
+ key = f"'{ ptype } '"
120
+ val = f":ref:`:ref: '{ ptype } ' <astropy:{ ptype } >`" # <= intersphinxed.
121
+ numpydoc_xref_aliases_astropy_physical_type [key ] = val
122
+
123
+ del ptypes , key , val
124
+
91
125
# -- Project information ------------------------------------------------------
92
126
93
127
# There are two options for replacing |today|: either, you set today to some
0 commit comments