Skip to content

Commit df347c9

Browse files
authored
Fixups for recent changes in sphinx dependencies (#954)
# Pull Request ## Title Fixups for recent changes in sphinx dependencies ______________________________________________________________________ ## Description - Changes the type resolution for a few type aliases from `data` to `type` - Excludes flaml's `Domain` type from resolution. - Excludes `Future` from resolution nitpick (similar error to `Ellipsis`) - Documents the new versions that caused these. ______________________________________________________________________ ## Type of Change - 🛠️ Bug fix - 📝 Documentation update ______________________________________________________________________
1 parent d168d87 commit df347c9

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

doc/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
setuptools-scm>=8.1.0
2-
sphinx
3-
sphinx-autoapi
2+
sphinx>=8.2.0
3+
sphinx-autoapi>=3.6.0
44
intersphinx_registry>=0.2501.23 # https://github.com/Quansight-Labs/intersphinx_registry/pull/58
55
nbsphinx
66
jupyter_core>=4.11.2 # nbsphix dependency - addresses CVE-2022-39286

doc/source/conf.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,17 @@ def is_on_github_actions():
167167
("ConcreteSpaceAdapter", "class"): "data",
168168
("DistributionName", "class"): "data",
169169
("mlos_bench.tunables.tunable_types.DistributionName", "class"): "data",
170-
("FlamlDomain", "class"): "data",
171-
("mlos_core.spaces.converters.flaml.FlamlDomain", "class"): "data",
172-
("TunableValue", "class"): "data",
173-
("mlos_bench.tunables.tunable_types.TunableValue", "class"): "data",
174-
("TunableValueType", "class"): "data",
175-
("mlos_bench.tunables.tunable_types.TunableValueType", "class"): "data",
170+
("FlamlDomain", "class"): "type",
171+
("mlos_core.spaces.converters.flaml.FlamlDomain", "class"): "type",
172+
("TunableValue", "class"): "type",
173+
("mlos_bench.tunables.tunable_types.TunableValue", "class"): "type",
174+
("TunableValueType", "class"): "type",
175+
("mlos_bench.tunables.tunable_types.TunableValueType", "class"): "type",
176176
("TunableValueTypeName", "class"): "data",
177177
("mlos_bench.tunables.tunable_types.TunableValueTypeName", "class"): "data",
178178
("T_co", "class"): "data",
179179
("CoroReturnType", "class"): "data",
180-
("FutureReturnType", "class"): "data",
180+
("FutureReturnType", "class"): "type",
181181
("NullableT", "class"): "data",
182182
}
183183

@@ -192,10 +192,11 @@ def resolve_type_aliases(
192192
if node["refdomain"] != "py":
193193
return None
194194
(orig_type, reftarget) = (node["reftype"], node["reftarget"])
195+
# warning(f"Resolving {orig_type} {reftarget}...")
195196
new_type = CUSTOM_REF_TYPE_MAP.get((reftarget, orig_type))
196197
if new_type:
197198
# warning(f"Resolved {orig_type} {reftarget} to {new_type}")
198-
return app.env.get_domain("py").resolve_xref(
199+
resolved = app.env.get_domain("py").resolve_xref(
199200
env,
200201
node["refdoc"],
201202
app.builder,
@@ -204,6 +205,8 @@ def resolve_type_aliases(
204205
node,
205206
contnode,
206207
)
208+
# warning(f"Resolved {orig_type} {reftarget} to xref {resolved}")
209+
return resolved
207210
return None
208211

209212

@@ -216,6 +219,7 @@ def setup(app: SphinxApp) -> None:
216219
# sphinx has a hard time finding typealiases and typevars instead of classes.
217220
# See Also: https://github.com/sphinx-doc/sphinx/issues/10974
218221
nitpick_ignore = [
222+
("py:class", "Future"),
219223
("py:class", "Ellipsis"),
220224
# Internal typevars and aliases:
221225
("py:class", "EnvironType"),
@@ -229,6 +233,7 @@ def setup(app: SphinxApp) -> None:
229233
("py:class", "sqlalchemy.MetaData"),
230234
("py:exc", "jsonschema.exceptions.SchemaError"),
231235
("py:exc", "jsonschema.exceptions.ValidationError"),
236+
("py:class", "Domain"), # flaml
232237
]
233238
nitpick_ignore_regex = [
234239
# Ignore some external references that don't use sphinx for their docs.

mlos_bench/mlos_bench/tunables/tunable_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
4343
Notes
4444
-----
45-
For checking whether a param is a :py:data:`.TunableValue` with
45+
For checking whether a param is a :py:type:`.TunableValue` with
4646
:py:func:`isinstance`.
4747
"""
4848

0 commit comments

Comments
 (0)