Skip to content

Commit

Permalink
Remove handling of optional import for mdinclude
Browse files Browse the repository at this point in the history
Since commit 1e95ac6 ("Actualize information in setup.py"), the
dependency on m2r, now replaced with mdinclude, is no longer part of the
"extras_require", but of the "install_requires" in setup.py. So the
dependency should always be satisfied, and we don't need to handle the
case where the import fails.
  • Loading branch information
qmonnet authored and stephenfin committed Dec 6, 2022
1 parent 160a126 commit 1d7a5d8
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions sphinxcontrib/openapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
from contextlib import closing
import jsonschema
import yaml
try:
from sphinx_mdinclude import convert as convert_markdown
except ImportError:
convert_markdown = None
import sphinx_mdinclude

from urllib.parse import urlsplit
from urllib.request import urlopen
Expand Down Expand Up @@ -113,12 +110,7 @@ def get_text_converter(options):
"""Decide on a text converter for prose."""
if 'format' in options:
if options['format'] == 'markdown':
if convert_markdown is None:
raise ValueError(
"Markdown conversion isn't available, "
"install the [markdown] extra."
)
return convert_markdown
return sphinx_mdinclude.convert

# No conversion needed.
return lambda s: s

0 comments on commit 1d7a5d8

Please sign in to comment.