[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 <jirka.borovec@seznam.cz> Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
This commit is contained in:
parent
74304db6f8
commit
e8121610a4
|
@ -6,7 +6,7 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
from threading import Thread
|
||||
from typing import Callable
|
||||
|
||||
import websockets
|
||||
|
@ -16,7 +16,7 @@ from lightning_app.core.constants import APP_SERVER_PORT
|
|||
_logger = logging.getLogger(__name__)
|
||||
|
||||
_CALLBACKS = []
|
||||
_THREAD: None | threading.Thread = None
|
||||
_THREAD: Thread = None
|
||||
|
||||
|
||||
def _get_ws_port():
|
||||
|
@ -62,7 +62,7 @@ def _start_websocket():
|
|||
global _THREAD # pylint: disable=global-statement
|
||||
if not _THREAD:
|
||||
_logger.debug("Starting the watch_app_state thread.")
|
||||
_THREAD = threading.Thread(target=_target_fn)
|
||||
_THREAD = Thread(target=_target_fn)
|
||||
_THREAD.setDaemon(True)
|
||||
_THREAD.start()
|
||||
_logger.debug("thread started")
|
||||
|
|
|
@ -42,7 +42,7 @@ def _get_render_fn():
|
|||
return render_fn
|
||||
|
||||
|
||||
if __name__.startswith("bokeh"):
|
||||
def main():
|
||||
import panel as pn
|
||||
|
||||
# I use caching for efficiency reasons. It shaves off 10ms from having
|
||||
|
@ -50,3 +50,7 @@ if __name__.startswith("bokeh"):
|
|||
if "lightning_render_fn" not in pn.state.cache:
|
||||
pn.state.cache["lightning_render_fn"] = _get_render_fn()
|
||||
pn.state.cache["lightning_render_fn"]()
|
||||
|
||||
|
||||
if __name__.startswith("bokeh"):
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue