Skip to content

Commit

Permalink
DEP: workaround deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Nov 12, 2024
1 parent 042da92 commit 135a90b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions myst_nb/core/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ def create_nb_reader(
:returns: the notebook reader, and the (potentially modified) MdParserConfig,
or None if the input cannot be read as a notebook.
"""
# the import is here so this module can be loaded without sphinx
from importlib import import_module

try:
from sphinx.util._importer import import_object
except ImportError:
from sphinx.util import import_object

# get all possible readers
readers = nb_config.custom_formats.copy()
Expand All @@ -71,7 +74,7 @@ def create_nb_reader(
if Path(path).suffix == suffix:
if isinstance(reader, str):
# attempt to load the reader as an object path
reader = import_module(reader)
reader = import_object(reader)
if commonmark_only:
# Markdown cells should be read as Markdown only
md_config = dc.replace(md_config, commonmark_only=True)
Expand Down

0 comments on commit 135a90b

Please sign in to comment.