@@ -58,6 +58,40 @@ def get_wheelhouse_assets_dictionary():
58
58
return assets
59
59
60
60
61
+ def intersphinx_pyansys_geometry (switcher_version : str ):
62
+ """
63
+ Auxiliary method to build the intersphinx mapping for PyAnsys Geometry.
64
+
65
+ Notes
66
+ -----
67
+ If the objects.inv file is not found whenever it is a release, the method
68
+ will default to the "dev" version. If the objects.inv file is not found
69
+ for the "dev" version, the method will return an empty string.
70
+
71
+ Parameters
72
+ ----------
73
+ switcher_version : str
74
+ Version of the PyAnsys Geometry package.
75
+
76
+ Returns
77
+ -------
78
+ str
79
+ The intersphinx mapping for PyAnsys Geometry.
80
+ """
81
+ prefix = "https://geometry.docs.pyansys.com/version"
82
+
83
+ # Check if the object.inv file exists
84
+ response = requests .get (f"{ prefix } /{ switcher_version } /objects.inv" )
85
+
86
+ if response .status_code == 404 :
87
+ if switcher_version == "dev" :
88
+ return ""
89
+ else :
90
+ return intersphinx_pyansys_geometry ("dev" )
91
+ else :
92
+ return f"{ prefix } /{ switcher_version } "
93
+
94
+
61
95
# Project information
62
96
project = "ansys-geometry-core"
63
97
copyright = f"(c) { datetime .now ().year } ANSYS, Inc. All rights reserved"
@@ -136,9 +170,15 @@ def get_wheelhouse_assets_dictionary():
136
170
"beartype" : ("https://beartype.readthedocs.io/en/stable/" , None ),
137
171
"docker" : ("https://docker-py.readthedocs.io/en/stable/" , None ),
138
172
"pypim" : ("https://pypim.docs.pyansys.com/version/stable" , None ),
139
- "ansys.geometry.core" : (f"https://geometry.docs.pyansys.com/version/{ switcher_version } " , None ),
140
173
}
141
174
175
+ # Conditional intersphinx mapping
176
+ if intersphinx_pyansys_geometry (switcher_version ):
177
+ intersphinx_mapping ["ansys.geometry.core" ] = (
178
+ intersphinx_pyansys_geometry (switcher_version ),
179
+ None ,
180
+ )
181
+
142
182
# numpydoc configuration
143
183
numpydoc_show_class_members = False
144
184
numpydoc_xref_param_type = True
0 commit comments