From 1a5159e507a21ceb9da721b1e08d66fc212f84fc Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Tue, 24 Dec 2024 09:02:52 +0100 Subject: [PATCH] Import import_object from non-public module --- src/nbsphinx/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nbsphinx/__init__.py b/src/nbsphinx/__init__.py index 3bd0ed18..173871b0 100644 --- a/src/nbsphinx/__init__.py +++ b/src/nbsphinx/__init__.py @@ -34,6 +34,12 @@ except ImportError: # This will be removed in Sphinx 8: from sphinx.util import status_iterator +try: + from sphinx.util._importer import import_object +except ImportError: + # This will hopefully be un-deprecated, see + # https://github.com/sphinx-doc/sphinx/issues/13083 + from sphinx.util import import_object import traitlets @@ -594,7 +600,7 @@ def parse(self, inputstring, document): else: kwargs = {} if isinstance(converter, str): - converter = sphinx.util.import_object(converter) + converter = import_object(converter) try: nb = converter(inputstring, **kwargs) except Exception: