Import `async_playwright`, raising :class:`ScreenshotError` if missing.
()
| 63 | |
| 64 | |
| 65 | def _require_playwright() -> Any: |
| 66 | """Import `async_playwright`, raising :class:`ScreenshotError` if missing.""" |
| 67 | from marimo._dependencies.dependencies import DependencyManager |
| 68 | |
| 69 | if not DependencyManager.playwright.has(): |
| 70 | raise ScreenshotError( |
| 71 | "Playwright is not installed.\n" |
| 72 | "Fix:\n" |
| 73 | " 1. pip install playwright\n" |
| 74 | " 2. python -m playwright install chromium" |
| 75 | ) |
| 76 | |
| 77 | from playwright.async_api import ( # type: ignore[import-not-found] |
| 78 | async_playwright, |
| 79 | ) |
| 80 | |
| 81 | return async_playwright |
| 82 | |
| 83 | |
| 84 | def _raise_browser_missing(err: Exception) -> None: |
no test coverage detected
searching dependent graphs…