Skip to content
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

Attribute Error when running the docs #11604

Closed
rohanbabbar04 opened this issue Aug 17, 2023 · 4 comments
Closed

Attribute Error when running the docs #11604

rohanbabbar04 opened this issue Aug 17, 2023 · 4 comments

Comments

@rohanbabbar04
Copy link

rohanbabbar04 commented Aug 17, 2023

Describe the bug

Thanks for this great project, I have been using it a lot..
Recently switching to sphinx==7.2.0, I am getting an AttributeError which was not there in the earlier version(

Theme error:
An error happened in rendering the page adding.
Reason: AttributeError("'TocTree' object has no attribute 'get_toctree_ancestors'")

Expecting a quick reply from you all...

How to Reproduce

These are some of the files that may be required:

Environment Information

Platform:              linux; (Linux-6.2.0-26-generic-x86_64-with-glibc2.35)
Python version:        3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0])
Python implementation: CPython
Sphinx version:        7.2.0
Docutils version:      0.19
Jinja2 version:        3.1.2
Pygments version:      2.15.1

Sphinx extensions

No response

Additional context

No response

@RobPasMue
Copy link

RobPasMue commented Aug 17, 2023

Yes, also seeing this issue in other repositories!

For example:

@picnixz
Copy link
Member

picnixz commented Aug 17, 2023

We refactored the TocTree adapter here #11565 (which also caused some other issues e.g., pydata/pydata-sphinx-theme#1404). However, TocTree is not meant to be a public API (there is no external documentation provided), so such internal changes should not considered as breaking changes (see pydata/pydata-sphinx-theme#1404 (comment) and pydata/pydata-sphinx-theme#1404 (comment)).

Now, in order to fix this, either pydata fixes it upstream or we could re-expose Toctree.get_toctree_ancestors as:

def get_toctree_ancestors(self, docname: str) -> set[str]:
    return _get_toctree_ancestors(self.env.toctree_includes, docname)

What do you think @AA-Turner

@sr-murthy
Copy link

sr-murthy commented Aug 17, 2023

Had the same error with the docs stage in one of my (Gitlab) CI pipelines - I was leaving Sphinx unpinned, so it installed 7.2 in the runner. When I switched back to 7.1.2 the error went away. I thought this was a theme error so I posted in the pydata Sphinx theme project

pydata/pydata-sphinx-theme#1412

@AA-Turner
Copy link
Member

Please test with Sphinx 7.2.1.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants