From 80ba9e8a99fffc156903421abe49857d8ddb0290 Mon Sep 17 00:00:00 2001 From: Himanshu Agrawal Date: Wed, 19 Aug 2026 14:14:41 +0530 Subject: [PATCH 1/2] docs: support Sphinx 9 --- docs/requirements.txt | 2 +- docs/source/conf.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index af08a5a075f..3b8f197617f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,7 +3,7 @@ tornado toolz cloudpickle git+https://github.com/dask/dask -sphinx>=8,<9 # FIXME https://github.com/dask/distributed/issues/9189 +sphinx>=8 dask-sphinx-theme>=4.0.0 sphinx-click memray diff --git a/docs/source/conf.py b/docs/source/conf.py index 3c0155a592e..dd4556a691a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -7,11 +7,25 @@ # -- Configuration to keep autosummary in sync with autoclass::members ---------------------------------------------- # Fixes issues/3693 # See https://stackoverflow.com/questions/20569011/python-sphinx-autosummary-automated-listing-of-member-functions -from sphinx.ext.autosummary import Autosummary, get_documenter +from sphinx.ext.autodoc import DataDocumenter +from sphinx.ext.autosummary import Autosummary from sphinx.util.inspect import safe_getattr import distributed + +def get_documenter(app, obj, parent): + """Return the highest-priority autodoc documenter for an object.""" + documenters = [ + documenter + for documenter in app.registry.documenters.values() + if documenter.can_document_member(obj, "", False, parent) + ] + return max( + documenters, key=lambda documenter: documenter.priority, default=DataDocumenter + ) + + # # Dask.distributed documentation build configuration file, created by # sphinx-quickstart on Tue Oct 6 14:42:44 2015. From e6fc22303054ce1fd8bf586c7ca2c602f5eef7a5 Mon Sep 17 00:00:00 2001 From: Himanshu Agrawal Date: Wed, 19 Aug 2026 15:01:00 +0530 Subject: [PATCH 2/2] docs: use Sphinx documenter selection --- docs/source/conf.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index dd4556a691a..91eb1aaa69a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,5 +1,6 @@ from __future__ import annotations +from inspect import signature from pathlib import Path from docutils.parsers.rst import directives @@ -7,23 +8,19 @@ # -- Configuration to keep autosummary in sync with autoclass::members ---------------------------------------------- # Fixes issues/3693 # See https://stackoverflow.com/questions/20569011/python-sphinx-autosummary-automated-listing-of-member-functions -from sphinx.ext.autodoc import DataDocumenter +from sphinx.ext import autosummary as sphinx_autosummary from sphinx.ext.autosummary import Autosummary from sphinx.util.inspect import safe_getattr import distributed -def get_documenter(app, obj, parent): - """Return the highest-priority autodoc documenter for an object.""" - documenters = [ - documenter - for documenter in app.registry.documenters.values() - if documenter.can_document_member(obj, "", False, parent) - ] - return max( - documenters, key=lambda documenter: documenter.priority, default=DataDocumenter - ) +def get_documenter_objtype(app, obj, parent): + """Return the Sphinx autodoc object type for an object.""" + get_documenter = sphinx_autosummary._get_documenter + if "registry" in signature(get_documenter).parameters: + return get_documenter(obj, parent, registry=app.registry).objtype + return get_documenter(obj, parent) # @@ -472,10 +469,10 @@ def get_members(app, obj, typ, include_public=None): items = [] for name in sorted(obj.__dict__.keys()): try: - documenter = get_documenter(app, safe_getattr(obj, name), obj) + objtype = get_documenter_objtype(app, safe_getattr(obj, name), obj) except AttributeError: continue - if documenter.objtype in typ: + if objtype in typ: items.append(name) public = [x for x in items if x in include_public or not x.startswith("_")] return public, items