-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TocTree manipulation on Sphinx 7.2+ #1406
Conversation
src/pydata_sphinx_theme/toctree.py
Outdated
from bs4 import BeautifulSoup | ||
from docutils import nodes | ||
from docutils.nodes import Node | ||
from sphinx import addnodes | ||
from sphinx.addnodes import toctree as toctree_node | ||
from sphinx.application import Sphinx | ||
from sphinx.environment.adapters.toctree import TocTree | ||
from sphinx.environment.adapters.toctree import _get_toctree_ancestors, TocTree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll need to version-guard this import too:
Running Sphinx v5.3.0
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/pydata-sphinx-theme/envs/1406/lib/python3.9/site-packages/sphinx/config.py", line 350, in eval_config_file
exec(code, namespace)
File "/home/docs/checkouts/readthedocs.org/user_builds/pydata-sphinx-theme/checkouts/1406/docs/conf.py", line 14, in <module>
import pydata_sphinx_theme
File "/home/docs/checkouts/readthedocs.org/user_builds/pydata-sphinx-theme/envs/1406/lib/python3.9/site-packages/pydata_sphinx_theme/__init__.py", line 15, in <module>
from . import edit_this_page, logo, pygment, short_link, toctree, translator, utils
File "/home/docs/checkouts/readthedocs.org/user_builds/pydata-sphinx-theme/envs/1406/lib/python3.9/site-packages/pydata_sphinx_theme/toctree.py", line 14, in <module>
from sphinx.environment.adapters.toctree import _get_toctree_ancestors, TocTree
ImportError: cannot import name '_get_toctree_ancestors' from 'sphinx.environment.adapters.toctree' (/home/docs/checkouts/readthedocs.org/user_builds/pydata-sphinx-theme/envs/1406/lib/python3.9/site-packages/sphinx/environment/adapters/toctree.py)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, of course!
thanks @AA-Turner |
Thank you! To make you aware, Sphinx 7.2 is planned for release this week, so users of A |
thanks for the heads-up. We're overdue for a release anyway so I'll try to wrap up our remaining blockers ASAP |
See #1404
This is the bare minimum required to restore the previous state. I intend to look into how
pydata-sphinx-theme
usesget_toctree_ancestors
and if there are any longer-term improvements to be made.A