Skip to content

Commit aa122de

Browse files
authored
Merge pull request #400 from A5rocks/override-fix
Fix autodoc overriding
2 parents d76d5d9 + 16bdea2 commit aa122de

4 files changed

Lines changed: 62 additions & 52 deletions

File tree

newsfragments/399.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix `sphinxcontrib-trio` for Sphinx 9.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
packages=find_packages(),
1919
url="https://github.com/python-trio/sphinxcontrib-trio",
2020
python_requires=">=3.6",
21-
install_requires=["sphinx >= 2.0"],
21+
install_requires=["sphinx >= 2.2"],
2222
classifiers=[
2323
'Development Status :: 5 - Production/Stable',
2424
"Intended Audience :: Developers",

sphinxcontrib_trio/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ def import_object(self):
380380
# Register everything
381381
################################################################
382382

383+
def mess_with_autodoc(app):
384+
app.add_autodocumenter(ExtendedFunctionDocumenter, override=True)
385+
app.add_autodocumenter(ExtendedMethodDocumenter, override=True)
386+
383387

384388
def setup(app):
385389
app.add_directive_to_domain('py', 'function', ExtendedPyFunction)
@@ -389,12 +393,8 @@ def setup(app):
389393
app.add_directive_to_domain('py', 'decorator', ExtendedPyFunction)
390394
app.add_directive_to_domain('py', 'decoratormethod', ExtendedPyMethod)
391395

392-
# Make sure sphinx.ext.autodoc is loaded before we try to mess with it.
393-
app.setup_extension("sphinx.ext.autodoc")
394-
# We're overriding these on purpose, so disable the warning about it
395-
del directives._directives["autofunction"]
396-
del directives._directives["automethod"]
397-
app.add_autodocumenter(ExtendedFunctionDocumenter)
398-
app.add_autodocumenter(ExtendedMethodDocumenter)
396+
# autodoc registers things at config-inited w/o priority, so
397+
# take the subsequent event
398+
app.connect("builder-inited", mess_with_autodoc)
399399

400400
return {'version': __version__, 'parallel_read_safe': True}

test-requirements.txt

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,91 @@
1-
#
2-
# This file is autogenerated by pip-compile
3-
# To update, run:
4-
#
5-
# pip-compile test-requirements.in
6-
#
7-
alabaster==0.7.12
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile --universal --python-version=3.10 test-requirements.in -o test-requirements.txt
3+
alabaster==1.0.0
84
# via sphinx
95
async-generator==1.10
106
# via -r test-requirements.in
11-
attrs==21.4.0
12-
# via pytest
13-
babel==2.10.1
7+
babel==2.17.0
148
# via sphinx
15-
certifi==2022.5.18.1
9+
certifi==2026.1.4
1610
# via requests
17-
charset-normalizer==2.0.12
11+
charset-normalizer==3.4.4
1812
# via requests
13+
colorama==0.4.6 ; sys_platform == 'win32'
14+
# via
15+
# pytest
16+
# sphinx
1917
contextlib2==21.6.0
2018
# via -r test-requirements.in
21-
coverage[toml]==6.1.1
19+
coverage==7.13.1
2220
# via pytest-cov
23-
cssselect==1.1.0
21+
cssselect==1.3.0
2422
# via -r test-requirements.in
25-
docutils==0.17.1
23+
docutils==0.21.2 ; python_full_version < '3.11'
24+
# via sphinx
25+
docutils==0.22.4 ; python_full_version >= '3.11'
2626
# via sphinx
27-
idna==3.3
27+
exceptiongroup==1.3.1 ; python_full_version < '3.11'
28+
# via pytest
29+
idna==3.11
2830
# via requests
29-
imagesize==1.3.0
31+
imagesize==1.4.1
3032
# via sphinx
31-
iniconfig==1.1.1
33+
iniconfig==2.3.0
3234
# via pytest
33-
jinja2==3.0.3
35+
jinja2==3.1.6
3436
# via sphinx
35-
lxml==4.8.0
37+
lxml==6.0.2
3638
# via -r test-requirements.in
37-
markupsafe==2.0.1
39+
markupsafe==3.0.3
3840
# via jinja2
39-
packaging==21.3
41+
packaging==26.0
4042
# via
4143
# pytest
4244
# sphinx
43-
pluggy==1.0.0
44-
# via pytest
45-
py==1.11.0
46-
# via pytest
47-
pygments==2.12.0
48-
# via sphinx
49-
pyparsing==3.0.9
50-
# via packaging
51-
pytest==7.0.1
45+
pluggy==1.6.0
46+
# via
47+
# pytest
48+
# pytest-cov
49+
pygments==2.19.2
50+
# via
51+
# pytest
52+
# sphinx
53+
pytest==9.0.2
5254
# via
5355
# -r test-requirements.in
5456
# pytest-cov
55-
pytest-cov==3.0.0
57+
pytest-cov==7.0.0
5658
# via -r test-requirements.in
57-
pytz==2022.1
58-
# via babel
59-
requests==2.27.1
59+
requests==2.32.5
6060
# via sphinx
61-
snowballstemmer==2.2.0
61+
roman-numerals==4.1.0 ; python_full_version >= '3.11'
6262
# via sphinx
63-
sphinx==3.4.3
63+
snowballstemmer==3.0.1
64+
# via sphinx
65+
sphinx==8.1.3 ; python_full_version < '3.11'
66+
# via -r test-requirements.in
67+
sphinx==9.0.4 ; python_full_version == '3.11.*'
6468
# via -r test-requirements.in
65-
sphinxcontrib-applehelp==1.0.2
69+
sphinx==9.1.0 ; python_full_version >= '3.12'
70+
# via -r test-requirements.in
71+
sphinxcontrib-applehelp==2.0.0
6672
# via sphinx
67-
sphinxcontrib-devhelp==1.0.2
73+
sphinxcontrib-devhelp==2.0.0
6874
# via sphinx
69-
sphinxcontrib-htmlhelp==2.0.0
75+
sphinxcontrib-htmlhelp==2.1.0
7076
# via sphinx
7177
sphinxcontrib-jsmath==1.0.1
7278
# via sphinx
73-
sphinxcontrib-qthelp==1.0.3
79+
sphinxcontrib-qthelp==2.0.0
7480
# via sphinx
75-
sphinxcontrib-serializinghtml==1.1.5
81+
sphinxcontrib-serializinghtml==2.0.0
7682
# via sphinx
77-
tomli==1.2.2
83+
tomli==2.4.0 ; python_full_version <= '3.11'
7884
# via
7985
# coverage
8086
# pytest
81-
urllib3==1.26.8
87+
# sphinx
88+
typing-extensions==4.15.0 ; python_full_version < '3.11'
89+
# via exceptiongroup
90+
urllib3==2.6.3
8291
# via requests

0 commit comments

Comments
 (0)