Skip to content

Commit

Permalink
Do not import pyppeteer for installation check (#1947)Co-authored-by:…
Browse files Browse the repository at this point in the history
… pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Matthias Bussonnier <[email protected]>

* Do not import pyppeteer for installation check

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix lint

* more details ignore type

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Matthias Bussonnier <[email protected]>
  • Loading branch information
3 people authored Feb 20, 2023
1 parent 7bf3fb8 commit 857631d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions nbconvert/exporters/webpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
import concurrent.futures
import os
import tempfile
from importlib import util as importlib_util

from traitlets import Bool, default

from .html import HTMLExporter

try:
import pyppeteer # type:ignore # noqa

PYPPETEER_INSTALLED = True
except ImportError:
PYPPETEER_INSTALLED = False
PYPPETEER_INSTALLED = importlib_util.find_spec("pyppeteer") is not None


class WebPDFExporter(HTMLExporter):
Expand Down Expand Up @@ -71,7 +67,7 @@ def _template_name_default(self):

def _check_launch_reqs(self):
try:
from pyppeteer import launch
from pyppeteer import launch # type: ignore[import]
from pyppeteer.util import check_chromium # type:ignore
except ModuleNotFoundError as e:
msg = (
Expand Down

0 comments on commit 857631d

Please sign in to comment.