Skip to content

Commit c9a9f32

Browse files
committed
Merge branch 'main' into fix/deprecate-chat-features
2 parents d514a9f + 0c1e224 commit c9a9f32

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
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+
126
from ._chat import Chat as ChatController
227

328
__all__ = ["ChatController"]

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ requires-python = ">=3.9"
66
license = { text = "MIT" }
77
dependencies = [
88
"htmltools>=0.6.0",
9-
"shiny>=1.4.0",
10-
"playwright>=1.43.0",
9+
"shiny>=1.4.0"
1110
]
1211
dynamic = ["version"]
1312
authors = [
@@ -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.

0 commit comments

Comments
 (0)