Skip to content

KeyError: 'backrefs' with docutils==0.22 #206

@mgorny

Description

@mgorny

Describe the bug

context
When docutils is updated to 0.22, sphinx-tabs fails over removed backrefs key.

expectation
sphinx-tabs working.

bug

translator = <sphinx.writers.html5.HTML5Translator object at 0x7f934a6d8050>, node = <div: <button...><button...><button...>>

    def visit(translator, node):
        # Borrowed from `sphinx-inline-tabs`
        attrs = node.attributes.copy()
        attrs.pop("classes")
        attrs.pop("ids")
        attrs.pop("names")
        attrs.pop("dupnames")
>       attrs.pop("backrefs")
E       KeyError: 'backrefs'

sphinx_tabs/tabs.py:69: KeyError

problem
Since Sphinx 8.2.3 is already compatible with docutils 0.22 itself, the pin is going to be updated in the next release. This will cause projects using sphinx-tabs to fail.

Reproduce the bug

uv pip install -e .[testing]
uv pip install -U docutils
pytest

(optionally gh pr checkout 200 to get fixes for Sphinx 8.1)

List your environment

Package                       Version  Editable project location
----------------------------- -------- -------------------------
alabaster                     1.0.0
appdirs                       1.4.4
babel                         2.17.0
beautifulsoup4                4.13.5
bs4                           0.0.2
certifi                       2025.8.3
charset-normalizer            3.4.3
coverage                      7.10.6
docutils                      0.22
idna                          3.10
imagesize                     1.4.1
iniconfig                     2.1.0
jinja2                        3.1.6
markdown-it-py                3.0.0
markupsafe                    3.0.2
mdit-py-plugins               0.5.0
mdurl                         0.1.2
myst-parser                   4.0.1
packaging                     25.0
pluggy                        1.6.0
pygments                      2.19.2
pytest                        7.4.4
pytest-cov                    6.3.0
pytest-datadir                1.8.0
pytest-regressions            2.8.3
pyyaml                        6.0.2
requests                      2.32.5
rinoh-typeface-dejavuserif    0.1.3
rinoh-typeface-texgyrecursor  0.1.1
rinoh-typeface-texgyreheros   0.1.1
rinoh-typeface-texgyrepagella 0.1.1
rinohtype                     0.5.5
roman-numerals-py             3.1.0
snowballstemmer               3.0.1
soupsieve                     2.8
sphinx                        8.2.3
sphinx-tabs                   3.4.7    /tmp/sphinx-tabs
sphinxcontrib-applehelp       2.0.0
sphinxcontrib-devhelp         2.0.0
sphinxcontrib-htmlhelp        2.1.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          2.0.0
sphinxcontrib-serializinghtml 2.0.0
typing-extensions             4.15.0
urllib3                       2.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions