Skip to content

Update needed for Sphinx 8.0 #619

@WarrenWeckesser

Description

@WarrenWeckesser

Describe the bug

The CI build of the SciPy docs is failing with the recently updated Sphinx 8.0.2. Initially the problem was coming from jupyterlite_sphinx (see jupyterlite/jupyterlite-sphinx#197). A current pull request there fixes the error that occurs in jupyterlite_sphinx, but the build of the SciPy docs fails again in myst_nb code:

[...snip...]
reading sources... [ 96%] tutorial/interpolate/interp_transition_guide
Traceback (most recent call last):
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/cmd/build.py", line 337, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/application.py", line 378, in build
    self.builder.build_update()
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 296, in build_update
    self.build(to_build,
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 317, in build
    updated_docnames = set(self.read())
                           ^^^^^^^^^^^
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 424, in read
    self._read_serial(docnames)
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 476, in _read_serial
    self.read_doc(docname)
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/builders/__init__.py", line 535, in read_doc
    publisher.publish()
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/docutils/core.py", line 234, in publish
    self.document = self.reader.read(self.source, self.parser,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/io.py", line 106, in read
    self.parse()
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/docutils/readers/__init__.py", line 76, in parse
    self.parser.parse(self.input, document)
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/myst_nb/sphinx_.py", line 85, in parse
    nb_reader = create_nb_reader(document_path, md_config, nb_config, inputstring)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/myst_nb/core/read.py", line 71, in create_nb_reader
    if path.endswith(suffix):
       ^^^^^^^^^^^^^
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/util/_pathlib.py", line 96, in __getattr__
    warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
sphinx.deprecation.RemovedInSphinx90Warning: Sphinx 9 will drop support for representing paths as strings. Use "pathlib.Path" or "os.fspath" instead.

Exception occurred:
  File "/home/warren/py3.12.4/lib/python3.12/site-packages/sphinx/util/_pathlib.py", line 96, in __getattr__
    warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
sphinx.deprecation.RemovedInSphinx90Warning: Sphinx 9 will drop support for representing paths as strings. Use "pathlib.Path" or "os.fspath" instead.
The full traceback has been saved in /tmp/sphinx-err-1o84nyhg.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make: *** [Makefile:114: html-build] Error 2

The error occurs in 'core/read.py' at line 71:

if path.endswith(suffix):

If I follow the example of the jupyterlite_sphinx pull request, and change that line to:

         if path.suffix == suffix:

the build of the SciPy docs completes successfully.

Reproduce the bug

See above.

List your environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions