Skip to content

Commit f732504

Browse files
committed
DEP: workaround deprecation
1 parent 515c9db commit f732504

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

myst_nb/core/read.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ def create_nb_reader(
5757
:returns: the notebook reader, and the (potentially modified) MdParserConfig,
5858
or None if the input cannot be read as a notebook.
5959
"""
60-
# the import is here so this module can be loaded without sphinx
61-
from importlib import import_module
60+
61+
try:
62+
from sphinx.util._importer import import_object
63+
except ImportError:
64+
from sphinx.util import import_object
6265

6366
# get all possible readers
6467
readers = nb_config.custom_formats.copy()
@@ -71,7 +74,7 @@ def create_nb_reader(
7174
if str(Path(path)).endswith(suffix):
7275
if isinstance(reader, str):
7376
# attempt to load the reader as an object path
74-
reader = import_module(reader)
77+
reader = import_object(reader)
7578
if commonmark_only:
7679
# Markdown cells should be read as Markdown only
7780
md_config = dc.replace(md_config, commonmark_only=True)

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ show_error_codes = true
131131
check_untyped_defs = true
132132
strict_equality = true
133133
no_implicit_optional = true
134+
ignore_missing_imports = true
134135
warn_unused_ignores = true
135136

136137
[[tool.mypy.overrides]]

0 commit comments

Comments
 (0)