mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.59k stars 386 forks source link

The `rst2md` tests fail in the CI #1266

Open mwouts opened 1 month ago

mwouts commented 1 month ago

In the recent runs of the CI like here, the conversion from rst to md fails:

ImportError while loading conftest '/home/runner/work/jupytext/jupytext/tests/conftest.py'.
tests/conftest.py:18: in <module>
    import jupytext
src/jupytext/__init__.py:3: in <module>
    from .formats import NOTEBOOK_EXTENSIONS, get_format_implementation, guess_format
src/jupytext/formats.py:13: in <module>
    from .cell_reader import (
src/jupytext/cell_reader.py:18: in <module>
    from sphinx_gallery.notebook import rst2md
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/sphinx_gallery/notebook.py:20: in <module>
    from .py_source_parser import split_code_and_text_blocks
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/sphinx_gallery/py_source_parser.py:21: in <module>
    from .sphinx_compatibility import getLogger
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/sphinx_gallery/sphinx_compatibility.py:71: in <module>
    status_iterator = sphinx.util.status_iterator
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/sphinx/util/__init__.py:271: in __getattr__
    raise AttributeError(msg)
E   AttributeError: module 'sphinx.util' has no attribute 'status_iterator'

This might be caused by a new version of sphinx. We might have to either pin the version of sphinx used in those tests, or even transition to a more up-to-date conversion framework like rst-to-myst

mwouts commented 1 month ago

With sphinx==7.2.6 the test passes but yields this warning:

RemovedInSphinx80Warning: The alias 'sphinx.util.status_iterator' is deprecated, use 'sphinx.util.display.status_iterator' instead. Check CHANGES for Sphinx API modifications.
    status_iterator = sphinx.util.status_iterator

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
juanep97 commented 3 weeks ago

Hi! I also encountered this issue using Sphinx 8.0.2. By running sphinx with --verbose, it seems that the error stems from the interaction with sphinx_gallery<=0.7, which uses 'sphinx.util.status_iterator', removed in Sphinx 8.

It seems that running with the latest sphinx_gallery version does not result in any problem, although jupytext still complains that it is not compatible?