jupyter / jupyter-sphinx

Sphinx extension for rendering of Jupyter interactive widgets.
https://jupyter-sphinx.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
186 stars 65 forks source link

PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall() #238

Closed GergelyKalmar closed 8 months ago

GergelyKalmar commented 8 months ago

I'm seeing the following warning when using the current version of jupyter-sphinx with Sphinx 7.1.2:

.../site-packages/sphinx/application.py:351: in build
    self.builder.build_update()
.../site-packages/sphinx/builders/__init__.py:290: in build_update
    self.build(to_build,
.../site-packages/sphinx/builders/__init__.py:310: in build
    updated_docnames = set(self.read())
.../site-packages/sphinx/builders/__init__.py:417: in read
    self._read_serial(docnames)
.../site-packages/sphinx/builders/__init__.py:438: in _read_serial
    self.read_doc(docname)
.../site-packages/sphinx/builders/__init__.py:494: in read_doc
    publisher.publish()
.../site-packages/docutils/core.py:236: in publish
    self.apply_transforms()
.../site-packages/docutils/core.py:216: in apply_transforms
    self.document.transformer.apply_transforms()
.../site-packages/sphinx/transforms/__init__.py:80: in apply_transforms
    super().apply_transforms()
.../site-packages/docutils/transforms/__init__.py:182: in apply_transforms
    transform.apply(**kwargs)
.../site-packages/jupyter_sphinx/ast.py:628: in apply
    for cell_node in self.document.traverse(JupyterCellNode):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <document: <section "development"...>>, condition = <class 'jupyter_sphinx.ast.JupyterCellNode'>, include_self = True, descend = True, siblings = False, ascend = False

    def traverse(self, condition=None, include_self=True, descend=True,
                 siblings=False, ascend=False):
        """Return list of nodes following `self`.

        For looping, Node.findall() is faster and more memory efficient.
        """
        # traverse() may be eventually removed:
>       warnings.warn('nodes.Node.traverse() is obsoleted by Node.findall().',
                      PendingDeprecationWarning, stacklevel=2)
E       PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall().

.../site-packages/docutils/nodes.py:225: PendingDeprecationWarning

It seems to be coming from https://github.com/jupyter/jupyter-sphinx/blob/main/jupyter_sphinx/ast.py#L628.

akhmerov commented 8 months ago

This will be closed by #237

GergelyKalmar commented 8 months ago

Awesome, thank you! Could we potentially get a new release? It's been a while since the last one :).

Happy holidays, too!

12rambau commented 8 months ago

The repository was recently revived and updated to the current Jupyter standards. Let me try to do a 0.5.0 release today using the new workflow.

12rambau commented 8 months ago

@GergelyKalmar I was forced to make small adjustments but I think it now works, could you try v0.5.3 and let me know if it works as expected from your side ?

GergelyKalmar commented 8 months ago

It seems to have worked, thank you! However, the License field now contains the text of the license for the package, which is a little suboptimal. I'm using pip-licenses for license checks and it used to show the correct license before.

12rambau commented 8 months ago

let me deal with that in another issue