File tree Expand file tree Collapse file tree
pkg-py/src/shinychat/playwright Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ try :
2+ import playwright # noqa: F401 # pyright: ignore[reportUnusedImport, reportMissingTypeStubs]
3+ except ImportError :
4+ raise ImportError (
5+ "The shinychat.playwright module requires the playwright package to be installed. "
6+ "Please install it with: `pip install playwright`"
7+ )
8+
9+ # If `pytest` is installed...
10+ try :
11+ import pytest # noqa: F401 # pyright: ignore[reportUnusedImport, reportMissingTypeStubs]
12+
13+ # At this point, `playwright` and `pytest` are installed.
14+ # Try to make sure `pytest-playwright` is installed
15+ try :
16+ import pytest_playwright # noqa: F401 # pyright: ignore[reportUnusedImport, reportMissingTypeStubs]
17+
18+ except ImportError :
19+ raise ImportError (
20+ "If you are using pytest to test your shiny app, install the pytest-playwright "
21+ "shim package with: `pip install pytest-playwright`"
22+ )
23+ except ImportError :
24+ pass
25+
126from ._chat import Chat as ChatController
227
328__all__ = ["ChatController" ]
Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ requires-python = ">=3.9"
66license = { text = " MIT" }
77dependencies = [
88 " htmltools>=0.6.0" ,
9- " shiny>=1.4.0" ,
10- " playwright>=1.43.0" ,
9+ " shiny>=1.4.0"
1110]
1211dynamic = [" version" ]
1312authors = [
@@ -41,6 +40,7 @@ test = [
4140 " plotly" ,
4241 " pyright>=1.1.398" ,
4342 " pytest>=6.2.4" ,
43+ " playwright>=1.43.0" ,
4444 " pytest-playwright>=0.3.0" ,
4545 " shinylive" ,
4646 " shinywidgets" ,
@@ -140,7 +140,8 @@ ignore = [
140140 " A001" , # Variable shadowing Python builtin, e.g. `input`
141141 " A002" , # Argument shadowing Python builtin, e.g. `id`
142142 " A004" , # Import shadowing Python builtin, e.g. `input`
143- " E501"
143+ " E501" ,
144+ " PLC0415" , # Import outside top-level
144145]
145146
146147# Allow fix for all enabled rules (when `--fix`) is provided.
You can’t perform that action at this time.
0 commit comments