Skip to content

Math domain regression in Sphinx 8.2.0rc1 #13346

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

Closed
mgeier opened this issue Feb 16, 2025 · 4 comments
Closed

Math domain regression in Sphinx 8.2.0rc1 #13346

mgeier opened this issue Feb 16, 2025 · 4 comments
Labels
extensions:mathematics The `sphinx.ext.imgmath`, `sphinx.ext.jsmath`, or `sphinx.ext.mathjax` extensions type:regression
Milestone

Comments

@mgeier
Copy link
Contributor

mgeier commented Feb 16, 2025

Describe the bug

See https://github.com/mgeier/nbsphinx/actions/runs/13354246486/job/37294757350

$SPHINX doc _build -b html
Running Sphinx v8.2.0rc1
...


Versions
========

* Platform:         linux; (Linux-6.8.0-1021-azure-x86_64-with-glibc2.39)
* Python version:   3.13.2 (CPython)
* Sphinx version:   8.2.0rc1
* Docutils version: 0.21.2
* Jinja2 version:   3.1.5
* Pygments version: 2.19.1

Last Messages
=============

    writing output...

    building [html]: targets for 39 source files that are out of date
    updating environment:
    [new config]
    39 added, 0 changed, 0 removed

    reading sources... [  3%]
    a-markdown-file

Loaded Extensions
=================

* sphinx.ext.mathjax (8.2.0rc1)
* alabaster (1.0.0)
* sphinxcontrib.applehelp (2.0.0)
* sphinxcontrib.devhelp (2.0.0)
* sphinxcontrib.htmlhelp (2.1.0)
* sphinxcontrib.serializinghtml (2.0.0)
* sphinxcontrib.qthelp (2.0.0)
* nbsphinx (0.9.6)
* sphinxcontrib.bibtex (2.6.3)
* sphinx_last_updated_by_git (0.3.8)
* sphinx.ext.autodoc.preserve_defaults (8.2.0rc1)
* sphinx.ext.autodoc.type_comment (8.2.0rc1)
* sphinx.ext.autodoc.typehints (8.2.0rc1)
* sphinx.ext.autodoc (8.2.0rc1)
* sphinx_codeautolink (0.16.2)
* sphinx.ext.intersphinx (8.2.0rc1)

Traceback
=========

      File "/opt/hostedtoolcache/Python/3.13.2/x64/lib/python3.13/site-packages/nbsphinx/__init__.py", line 1473, in apply
        env.get_domain('math').data['has_equations'][env.docname] = True
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
    KeyError: 'has_equations'

How to Reproduce

Build the docs of https://github.com/spatialaudio/nbsphinx with Sphinx 8.2.0rc1.

If needed, I can try to come up with a more minimal example.

Environment Information

see above

Sphinx extensions

Additional context

No response

@AA-Turner AA-Turner added this to the 8.2.0 milestone Feb 16, 2025
@AA-Turner AA-Turner added the extensions:mathematics The `sphinx.ext.imgmath`, `sphinx.ext.jsmath`, or `sphinx.ext.mathjax` extensions label Feb 16, 2025
@AA-Turner
Copy link
Member

Caused by the performance improvement in #13044. I had thought we kept the key for backwards compatibility, though.

A

@mgeier
Copy link
Contributor Author

mgeier commented Feb 16, 2025

What I'm trying to do in the line that fails: I want to force the math extension to believe that there are equations on each Jupyter notebook. Otherwise, MathJax wouldn't be loaded and equations wouldn't be displayed correctly.

Is there another way to achieve that?

In the long term, it would probably be better if nbsphinx could check each Jupyter notebook whether it actually uses math equations, but that's a bit more involved (and I would still need a way to signal to Sphinx that MathJax should be activated).

@AA-Turner
Copy link
Member

The new method in #13044 is to detect maths by if the visitor methods were called. If you don't override these, it might be picked up automatically. Do you have time to test this? Otherwise I will have a go, but I'm less familiar with nbphinx.

A

@AA-Turner
Copy link
Member

2982b7a restores the key so the extension no longer fails with an exception, but work may be needed in nbsphinx still.

A

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extensions:mathematics The `sphinx.ext.imgmath`, `sphinx.ext.jsmath`, or `sphinx.ext.mathjax` extensions type:regression
Projects
None yet
Development

No branches or pull requests

2 participants