From d8965d725ccba0a74a36642363eb8ea1f24a25eb Mon Sep 17 00:00:00 2001 From: A5rocks Date: Fri, 23 Jan 2026 09:16:35 +0900 Subject: [PATCH 1/3] Fix autodoc overriding --- sphinxcontrib_trio/__init__.py | 14 ++--- test-requirements.txt | 97 +++++++++++++++++++--------------- 2 files changed, 60 insertions(+), 51 deletions(-) diff --git a/sphinxcontrib_trio/__init__.py b/sphinxcontrib_trio/__init__.py index 6936661..411ffad 100644 --- a/sphinxcontrib_trio/__init__.py +++ b/sphinxcontrib_trio/__init__.py @@ -380,6 +380,10 @@ def import_object(self): # Register everything ################################################################ +def mess_with_autodoc(app): + app.add_autodocumenter(ExtendedFunctionDocumenter, override=True) + app.add_autodocumenter(ExtendedMethodDocumenter, override=True) + def setup(app): app.add_directive_to_domain('py', 'function', ExtendedPyFunction) @@ -389,12 +393,8 @@ def setup(app): app.add_directive_to_domain('py', 'decorator', ExtendedPyFunction) app.add_directive_to_domain('py', 'decoratormethod', ExtendedPyMethod) - # Make sure sphinx.ext.autodoc is loaded before we try to mess with it. - app.setup_extension("sphinx.ext.autodoc") - # We're overriding these on purpose, so disable the warning about it - del directives._directives["autofunction"] - del directives._directives["automethod"] - app.add_autodocumenter(ExtendedFunctionDocumenter) - app.add_autodocumenter(ExtendedMethodDocumenter) + # autodoc registers things at config-inited w/o priority, so + # take the subsequent event + app.connect("builder-inited", mess_with_autodoc) return {'version': __version__, 'parallel_read_safe': True} diff --git a/test-requirements.txt b/test-requirements.txt index 11b36c6..7193659 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,82 +1,91 @@ -# -# This file is autogenerated by pip-compile -# To update, run: -# -# pip-compile test-requirements.in -# -alabaster==0.7.12 +# This file was autogenerated by uv via the following command: +# uv pip compile --universal --python-version=3.10 test-requirements.in -o test-requirements.txt +alabaster==1.0.0 # via sphinx async-generator==1.10 # via -r test-requirements.in -attrs==21.4.0 - # via pytest -babel==2.10.1 +babel==2.17.0 # via sphinx -certifi==2022.5.18.1 +certifi==2026.1.4 # via requests -charset-normalizer==2.0.12 +charset-normalizer==3.4.4 # via requests +colorama==0.4.6 ; sys_platform == 'win32' + # via + # pytest + # sphinx contextlib2==21.6.0 # via -r test-requirements.in -coverage[toml]==6.1.1 +coverage==7.13.1 # via pytest-cov -cssselect==1.1.0 +cssselect==1.3.0 # via -r test-requirements.in -docutils==0.17.1 +docutils==0.21.2 ; python_full_version < '3.11' + # via sphinx +docutils==0.22.4 ; python_full_version >= '3.11' # via sphinx -idna==3.3 +exceptiongroup==1.3.1 ; python_full_version < '3.11' + # via pytest +idna==3.11 # via requests -imagesize==1.3.0 +imagesize==1.4.1 # via sphinx -iniconfig==1.1.1 +iniconfig==2.3.0 # via pytest -jinja2==3.0.3 +jinja2==3.1.6 # via sphinx -lxml==4.8.0 +lxml==6.0.2 # via -r test-requirements.in -markupsafe==2.0.1 +markupsafe==3.0.3 # via jinja2 -packaging==21.3 +packaging==26.0 # via # pytest # sphinx -pluggy==1.0.0 - # via pytest -py==1.11.0 - # via pytest -pygments==2.12.0 - # via sphinx -pyparsing==3.0.9 - # via packaging -pytest==7.0.1 +pluggy==1.6.0 + # via + # pytest + # pytest-cov +pygments==2.19.2 + # via + # pytest + # sphinx +pytest==9.0.2 # via # -r test-requirements.in # pytest-cov -pytest-cov==3.0.0 +pytest-cov==7.0.0 # via -r test-requirements.in -pytz==2022.1 - # via babel -requests==2.27.1 +requests==2.32.5 # via sphinx -snowballstemmer==2.2.0 +roman-numerals==4.1.0 ; python_full_version >= '3.11' # via sphinx -sphinx==3.4.3 +snowballstemmer==3.0.1 + # via sphinx +sphinx==8.1.3 ; python_full_version < '3.11' + # via -r test-requirements.in +sphinx==9.0.4 ; python_full_version == '3.11.*' # via -r test-requirements.in -sphinxcontrib-applehelp==1.0.2 +sphinx==9.1.0 ; python_full_version >= '3.12' + # via -r test-requirements.in +sphinxcontrib-applehelp==2.0.0 # via sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==2.0.0 # via sphinx -sphinxcontrib-htmlhelp==2.0.0 +sphinxcontrib-htmlhelp==2.1.0 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==2.0.0 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==2.0.0 # via sphinx -tomli==1.2.2 +tomli==2.4.0 ; python_full_version <= '3.11' # via # coverage # pytest -urllib3==1.26.8 + # sphinx +typing-extensions==4.15.0 ; python_full_version < '3.11' + # via exceptiongroup +urllib3==2.6.3 # via requests From 97808cced801ee26ce0cad4601ef40d7efa32460 Mon Sep 17 00:00:00 2001 From: A5rocks Date: Fri, 23 Jan 2026 09:34:00 +0900 Subject: [PATCH 2/3] Add a changelog --- newsfragments/399.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/399.bugfix.rst diff --git a/newsfragments/399.bugfix.rst b/newsfragments/399.bugfix.rst new file mode 100644 index 0000000..6d0af88 --- /dev/null +++ b/newsfragments/399.bugfix.rst @@ -0,0 +1 @@ +Fix `sphinxcontrib-trio` for Sphinx 9.0 From 16bdea26d7cd20eff65c6ae843e90d55a747482e Mon Sep 17 00:00:00 2001 From: A5rocks Date: Fri, 23 Jan 2026 09:41:01 +0900 Subject: [PATCH 3/3] Bump minimum Sphinx --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7b6a71e..12915e5 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ packages=find_packages(), url="https://github.com/python-trio/sphinxcontrib-trio", python_requires=">=3.6", - install_requires=["sphinx >= 2.0"], + install_requires=["sphinx >= 2.2"], classifiers=[ 'Development Status :: 5 - Production/Stable', "Intended Audience :: Developers",