Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt playwright #2013

Merged
merged 22 commits into from
Jul 15, 2023
Merged

Adopt playwright #2013

merged 22 commits into from
Jul 15, 2023

Conversation

brichet
Copy link
Contributor

@brichet brichet commented Jun 28, 2023

Since pyppeteer is now unmaintained we should adopt playwright instead.

@brichet
Copy link
Contributor Author

brichet commented Jun 28, 2023

The workaround commit is to fix the tests when the chromium browser is not available.

This test worked only if pytest do not capture the output (pytest -s).
I don't understand why, but os.path.isfile(chromium.executable_path) was True when capturing the output but False otherwise...

@brichet
Copy link
Contributor Author

brichet commented Jun 29, 2023

I have no clue on this test failure too (occurs locally also):
https://github.com/jupyter/nbconvert/actions/runs/5402860958/jobs/9814806087?pr=2013#step:5:379

Don't know why it used to pass as exporter.from_file(f, resources={}) is supposed to return a tuple

def from_file(
self, file_stream: t.Any, resources: t.Optional[dict] = None, **kw: t.Any
) -> t.Tuple[NotebookNode, dict]:

but exporter.from_notebook_node(nb) expects a NotebookNode (it lead to exporter.html.from_notebook_node(nb)):

def from_notebook_node( # type:ignore
self, nb: NotebookNode, resources: Optional[Dict] = None, **kw: Any
) -> Tuple[str, Dict]:

@brichet
Copy link
Contributor Author

brichet commented Jul 4, 2023

Since it fails with python<3.8, I wonder if we should drop support to Python 3.7 (easy fix).
Playwright will drop support to it in the next release: microsoft/playwright-python#1980

@blink1073
Copy link
Contributor

I'm removing Python 3.7 support in #2008. I'm updating this branch to pick up those changes.

Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!

@blink1073 blink1073 merged commit 68dbb34 into jupyter:main Jul 15, 2023
19 of 21 checks passed
@brichet brichet deleted the playwright branch July 17, 2023 08:25
@brichet
Copy link
Contributor Author

brichet commented Jul 17, 2023

Thanks @blink1073 for fixing the tests

handleSIGINT=False, handleSIGTERM=False, handleSIGHUP=False, args=args
)
page = await browser.newPage()
await page.emulateMedia("print")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that that option was lost in the upgrade process. As the option is available in playwright, I guess it will be better to restore it to increase backward compatibility.

cc @brichet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fcollonval. I opened #2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants