I gave it a quick test to see how it looks and got lots of errors:
building [html]: targets for 511 source files that are out of date
updating environment: [new config] 511 added, 0 changed, 0 removed
reading sources... [100%] whatsnew/3.14 .. whatsnew/index
Traceback (most recent call last):
File "Doc/venv/lib/python3.13/site-packages/sphinx_codeautolink/extension/__init__.py", line 46, in wrapper
return func(*args, **kwargs)
File "Doc/venv/lib/python3.13/site-packages/sphinx_codeautolink/extension/__init__.py", line 182, in create_references
self.filter_and_resolve(transforms, skipped, doc)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "Doc/venv/lib/python3.13/site-packages/sphinx_codeautolink/extension/__init__.py", line 206, in filter_and_resolve
key = resolve_location(name, self.inventory)
File "Doc/venv/lib/python3.13/site-packages/sphinx_codeautolink/extension/resolve.py", line 40, in resolve_location
cursor = locate_type(cursor, tuple(comps), inventory)
File "Doc/venv/lib/python3.13/site-packages/sphinx_codeautolink/extension/resolve.py", line 94, in locate_type
return locate_type(previous, components[i:], inventory)
File "Doc/venv/lib/python3.13/site-packages/sphinx_codeautolink/extension/resolve.py", line 94, in locate_type
return locate_type(previous, components[i:], inventory)
File "Doc/venv/lib/python3.13/site-packages/sphinx_codeautolink/extension/resolve.py", line 94, in locate_type
return locate_type(previous, components[i:], inventory)
[Previous line repeated 983 more times]
File "Doc/venv/lib/python3.13/site-packages/sphinx_codeautolink/extension/resolve.py", line 68, in locate_type
cursor = Cursor(
cursor.location + "." + component,
getattr(cursor.value, component, None),
cursor.instance,
)
RecursionError: maximum recursion depth exceeded
Doc/library/ast.rst:1216: WARNING: unterminated triple-quoted string literal (detected at line 24) (<unknown>, line 1) in document 'library/ast'
Parsed source in `pycon` block:
block source: >>> print(ast.dump(ast.parse("""\
... for a in b:
... if a > 5:
... break
... else:
... continue
...
... """), indent=4))
Module(
body=[
For(
target=Name(id='a', ctx=Store()),
iter=Name(id='b', ctx=Load()),
body=[
If(
test=Compare(
left=Name(id='a', ctx=Load()),
ops=[
Gt()],
comparators=[
Constant(value=5)]),
body=[
Break()],
orelse=[
Continue()])])]) [codeautolink.parse_block]
Doc/library/configparser.rst:347: WARNING: unterminated triple-quoted string literal (detected at line 9) (<unknown>, line 1) in document 'library/configparser'
Parsed source in `pycon` block:
block source: >>> config = """
... option = value
...
... [ Section 2 ]
... another = val
... """
>>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)
>>> unnamed.read_string(config)
>>> unnamed.get(configparser.UNNAMED_SECTION, 'option')
'value' [codeautolink.parse_block]
Doc/library/configparser.rst:778: WARNING: unterminated triple-quoted string literal (detected at line 19) (<unknown>, line 1) in document 'library/configparser'
Parsed source in `pycon` block:
block source: >>> config = """
... [Section1]
... Key = Value
...
... [Section2]
... AnotherKey = Value
... """
>>> typical = configparser.ConfigParser()
>>> typical.read_string(config)
>>> list(typical['Section1'].keys())
['key']
>>> list(typical['Section2'].keys())
['anotherkey']
>>> custom = configparser.RawConfigParser()
>>> custom.optionxform = lambda option: option
>>> custom.read_string(config)
>>> list(custom['Section1'].keys())
['Key']
>>> list(custom['Section2'].keys())
['AnotherKey'] [codeautolink.parse_block]
Doc/library/configparser.rst:815: WARNING: unterminated triple-quoted string literal (detected at line 16) (<unknown>, line 2) in document 'library/configparser'
Parsed source in `pycon` block:
block source: >>> import re
>>> config = """
... [Section 1]
... option = value
...
... [ Section 2 ]
... another = val
... """
>>> typical = configparser.ConfigParser()
>>> typical.read_string(config)
>>> typical.sections()
['Section 1', ' Section 2 ']
>>> custom = configparser.ConfigParser()
>>> custom.SECTCRE = re.compile(r"\[ *(?P<header>[^]]+?) *\]")
>>> custom.read_string(config)
>>> custom.sections()
['Section 1', 'Section 2'] [codeautolink.parse_block]
Doc/library/re.rst:1730: WARNING: unterminated triple-quoted string literal (detected at line 6) (<unknown>, line 1) in document 'library/re'
Parsed source in `pycon` block:
block source: >>> text = """Ross McFluff: 834.345.1254 155 Elm Street
...
... Ronald Heathmore: 892.345.3428 436 Finley Avenue
... Frank Burger: 925.541.7625 662 South Dogwood Way
...
...
... Heather Albrecht: 548.326.4584 919 Park Place""" [codeautolink.parse_block]
Doc/using/windows.rst:421: WARNING: invalid syntax (<unknown>, line 1) in document 'using/windows'
Parsed source in `python` block:
block source: >>> import os
>>> test_file = 'C:\\Users\\example\\AppData\\Local\\test.txt'
>>> os.path.realpath(test_file)
'C:\\Users\\example\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\Local\\test.txt' [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:160: WARNING: '{' was never closed (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,
38: 4, 39: 4, 45: 5, 46: 5, 47: 5, 48: 5, 49: 5, 54: 6,
some_other_code = foo() [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:169: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: File "example.py", line 3
some_other_code = foo()
^
SyntaxError: invalid syntax [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:178: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: File "example.py", line 1
expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,
^
SyntaxError: '{' was never closed [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:199: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> foo(x, z for z in range(10), t, w)
File "<stdin>", line 1
foo(x, z for z in range(10), t, w)
^
SyntaxError: Generator expression must be parenthesized [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:209: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> foo(x, z for z in range(10), t, w)
File "<stdin>", line 1
foo(x, z for z in range(10), t, w)
^^^^^^^^^^^^^^^^^^^^
SyntaxError: Generator expression must be parenthesized [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:224: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> if rocket.position > event_horizon
File "<stdin>", line 1
if rocket.position > event_horizon
^
SyntaxError: expected ':' [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:236: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> {x,y for x,y in zip('abcd', '1234')}
File "<stdin>", line 1
{x,y for x,y in zip('abcd', '1234')}
^
SyntaxError: did you forget parentheses around the comprehension target? [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:248: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> items = {
... x: 1,
... y: 2
... z: 3,
File "<stdin>", line 3
y: 2
^
SyntaxError: invalid syntax. Perhaps you forgot a comma? [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:263: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> try:
... build_dyson_sphere()
... except NotEnoughScienceError, NotEnoughResourcesError:
File "<stdin>", line 3
except NotEnoughScienceError, NotEnoughResourcesError:
^
SyntaxError: multiple exception types must be parenthesized [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:277: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> values = {
... x: 1,
... y: 2,
... z:
... }
File "<stdin>", line 4
z:
^
SyntaxError: expression expected after dictionary key and ':'
>>> values = {x:1, y:2, z w:3}
File "<stdin>", line 1
values = {x:1, y:2, z w:3}
^
SyntaxError: ':' expected after dictionary key [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:299: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> try:
... x = 2
... something = 3
File "<stdin>", line 3
something = 3
^^^^^^^^^
SyntaxError: expected 'except' or 'finally' block [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:313: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> if rocket.position = event_horizon:
File "<stdin>", line 1
if rocket.position = event_horizon:
^
SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='? [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:325: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> f"Black holes {*all_black_holes} and revelations"
File "<stdin>", line 1
(*all_black_holes)
^
SyntaxError: f-string: cannot use starred expression here [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:341: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> def foo():
... if lel:
... x = 2
File "<stdin>", line 3
x = 2
^
IndentationError: expected an indented block after 'if' statement in line 2 [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:359: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> collections.namedtoplo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple? [codeautolink.parse_block]
Doc/whatsnew/3.10.rst:380: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.10'
Parsed source in `python` block:
block source: >>> schwarzschild_black_hole = None
>>> schwarschild_black_hole
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole? [codeautolink.parse_block]
Doc/whatsnew/3.11.rst:118: WARNING: invalid syntax. Perhaps you forgot a comma? (<unknown>, line 1) in document 'whatsnew/3.11'
Parsed source in `python` block:
block source: Traceback (most recent call last):
File "distance.py", line 11, in <module>
print(manhattan_distance(p1, p2))
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "distance.py", line 6, in manhattan_distance
return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y)
^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'x' [codeautolink.parse_block]
Doc/whatsnew/3.11.rst:133: WARNING: invalid syntax. Perhaps you forgot a comma? (<unknown>, line 1) in document 'whatsnew/3.11'
Parsed source in `python` block:
block source: Traceback (most recent call last):
File "query.py", line 37, in <module>
magic_arithmetic('foo')
File "query.py", line 18, in magic_arithmetic
return add_counts(x) / 25
^^^^^^^^^^^^^
File "query.py", line 24, in add_counts
return 25 + query_user(user1) + query_user(user2)
^^^^^^^^^^^^^^^^^
File "query.py", line 32, in query_user
return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)
~~~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable [codeautolink.parse_block]
Doc/whatsnew/3.11.rst:151: WARNING: invalid syntax. Perhaps you forgot a comma? (<unknown>, line 1) in document 'whatsnew/3.11'
Parsed source in `python` block:
block source: Traceback (most recent call last):
File "calculation.py", line 54, in <module>
result = (x / y / z) * (a / b / c)
~~~~~~^~~
ZeroDivisionError: division by zero [codeautolink.parse_block]
Doc/whatsnew/3.12.rst:310: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.12'
Parsed source in `python` block:
block source: >>> my_string = f"{x z y}" + f"{1 + 1}"
File "<stdin>", line 1
(x z y)
^^^
SyntaxError: f-string: invalid syntax. Perhaps you forgot a comma? [codeautolink.parse_block]
Doc/whatsnew/3.12.rst:322: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.12'
Parsed source in `python` block:
block source: >>> my_string = f"{x z y}" + f"{1 + 1}"
File "<stdin>", line 1
my_string = f"{x z y}" + f"{1 + 1}"
^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma? [codeautolink.parse_block]
Doc/whatsnew/3.12.rst:459: WARNING: Did you mean to use 'from ... import ...' instead? (<unknown>, line 1) in document 'whatsnew/3.12'
Parsed source in `pycon` block:
block source: >>> import a.y.z from b.y.z
Traceback (most recent call last):
File "<stdin>", line 1
import a.y.z from b.y.z
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Did you mean to use 'from ... import ...' instead? [codeautolink.parse_block]
Doc/whatsnew/3.13.rst:502: WARNING: unterminated triple-quoted string literal (detected at line 9) (<unknown>, line 2) in document 'whatsnew/3.13'
Parsed source in `pycon` block:
block source: >>> def spam():
... """
... This is a docstring with
... leading whitespace.
...
... It even has multiple paragraphs!
... """
...
>>> spam.__doc__
'\nThis is a docstring with\n leading whitespace.\n\nIt even has multiple paragraphs!\n' [codeautolink.parse_block]
Doc/library/symtable.rst:206: WARNING: unterminated triple-quoted string literal (detected at line 18) (<unknown>, line 2) in document 'library/symtable'
Parsed source in `pycon` block:
block source: >>> import symtable
>>> st = symtable.symtable('''
... def outer(): pass
...
... class A:
... def f():
... def w(): pass
...
... def g(self): pass
...
... @classmethod
... async def h(cls): pass
...
... global outer
... def outer(self): pass
... ''', 'test', 'exec')
>>> class_A = st.get_children()[2]
>>> class_A.get_methods()
('f', 'g', 'h') [codeautolink.parse_block]
Doc/whatsnew/3.14.rst:168: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.14'
Parsed source in `python` block:
block source: >>> x, y, z = 1, 2, 3, 4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
x, y, z = 1, 2, 3, 4
^^^^^^^
ValueError: too many values to unpack (expected 3, got 4) [codeautolink.parse_block]
Doc/whatsnew/3.14.rst:182: WARNING: invalid syntax (<unknown>, line 1) in document 'whatsnew/3.14'
Parsed source in `python` block:
block source: >>> "The interesting object "The important object" is very important"
Traceback (most recent call last):
SyntaxError: invalid syntax. Is this intended to be part of the string? [codeautolink.parse_block]
Extension error (sphinx_codeautolink.extension):
Handler <bound method SphinxCodeAutoLink.create_references of <sphinx_codeautolink.extension.SphinxCodeAutoLink object at 0x106ed4ec0>> for event 'env-updated' threw an exception (exception: maximum recursion depth exceeded)
make: *** [build] Error 2
Iâve not checked those closely but weâd need a way to configure it not to parse new and unreleased Python syntax that the extension doesnât support, and it looks like we have lots of code blocks that intentionally demonstrate buggy code that weâd have to somehow tell it to ignore.
Is that possible?