MCPcopy
hub / github.com/marimo-team/marimo / _require_playwright

Function _require_playwright

marimo/_code_mode/screenshot.py:65–81  ·  view source on GitHub ↗

Import `async_playwright`, raising :class:`ScreenshotError` if missing.

()

Source from the content-addressed store, hash-verified

63
64
65def _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
84def _raise_browser_missing(err: Exception) -> None:

Callers 1

_init_browserMethod · 0.85

Calls 2

ScreenshotErrorClass · 0.85
hasMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…