File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
pkg-py/src/shinychat/playwright Expand file tree Collapse file tree 2 files changed +29
-3
lines changed 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
+
1
26
from ._chat import Chat as ChatController
2
27
3
28
__all__ = ["ChatController" ]
Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ requires-python = ">=3.9"
6
6
license = { text = " MIT" }
7
7
dependencies = [
8
8
" htmltools>=0.6.0" ,
9
- " shiny>=1.4.0" ,
10
- " playwright>=1.43.0" ,
9
+ " shiny>=1.4.0"
11
10
]
12
11
dynamic = [" version" ]
13
12
authors = [
@@ -41,6 +40,7 @@ test = [
41
40
" plotly" ,
42
41
" pyright>=1.1.398" ,
43
42
" pytest>=6.2.4" ,
43
+ " playwright>=1.43.0" ,
44
44
" pytest-playwright>=0.3.0" ,
45
45
" shinylive" ,
46
46
" shinywidgets" ,
@@ -140,7 +140,8 @@ ignore = [
140
140
" A001" , # Variable shadowing Python builtin, e.g. `input`
141
141
" A002" , # Argument shadowing Python builtin, e.g. `id`
142
142
" A004" , # Import shadowing Python builtin, e.g. `input`
143
- " E501"
143
+ " E501" ,
144
+ " PLC0415" , # Import outside top-level
144
145
]
145
146
146
147
# Allow fix for all enabled rules (when `--fix`) is provided.
You can’t perform that action at this time.
0 commit comments