Skip to content

Commit e812161

Browse files
adam-lightningpre-commit-ci[bot]Borda
authored
[App] fix panel requirements (#14450)
* update base requirements * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * try main * Apply suggestions from code review * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * extract into separate function * drop * up * up * optional * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * . Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jirka <[email protected]> Co-authored-by: Jirka Borovec <[email protected]>
1 parent 74304db commit e812161

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/lightning_app/frontend/panel/app_state_comm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import asyncio
77
import logging
88
import os
9-
import threading
9+
from threading import Thread
1010
from typing import Callable
1111

1212
import websockets
@@ -16,7 +16,7 @@
1616
_logger = logging.getLogger(__name__)
1717

1818
_CALLBACKS = []
19-
_THREAD: None | threading.Thread = None
19+
_THREAD: Thread = None
2020

2121

2222
def _get_ws_port():
@@ -62,7 +62,7 @@ def _start_websocket():
6262
global _THREAD # pylint: disable=global-statement
6363
if not _THREAD:
6464
_logger.debug("Starting the watch_app_state thread.")
65-
_THREAD = threading.Thread(target=_target_fn)
65+
_THREAD = Thread(target=_target_fn)
6666
_THREAD.setDaemon(True)
6767
_THREAD.start()
6868
_logger.debug("thread started")

src/lightning_app/frontend/panel/panel_serve_render_fn.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ def _render_fn_wrapper():
4242
return render_fn
4343

4444

45-
if __name__.startswith("bokeh"):
45+
def main():
4646
import panel as pn
4747

4848
# I use caching for efficiency reasons. It shaves off 10ms from having
4949
# to get_render_fn_from_environment every time
5050
if "lightning_render_fn" not in pn.state.cache:
5151
pn.state.cache["lightning_render_fn"] = _get_render_fn()
5252
pn.state.cache["lightning_render_fn"]()
53+
54+
55+
if __name__.startswith("bokeh"):
56+
main()

0 commit comments

Comments
 (0)