Skip to content

Commit e83e952

Browse files
Feature/server generalize (#2526)
1 parent 3c6f791 commit e83e952

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2196
-727
lines changed

.github/workflows/overall-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: ./.github/workflows/partial-tests.yml
1919

2020
coverage:
21-
timeout-minutes: 50
21+
timeout-minutes: 60
2222
runs-on: ubuntu-latest
2323

2424
if: github.event_name == 'pull_request' && github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name

.github/workflows/partial-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
tests:
2424
needs: linter
25-
timeout-minutes: 50
25+
timeout-minutes: 70
2626
strategy:
2727
fail-fast: false
2828
matrix:

Pipfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ apispec-webframeworks = "==0.5.2"
99
cookiecutter = "==2.1.1"
1010
deepdiff = "==6.7.1"
1111
flask = "==3.1.0"
12-
flask-cors = "==5.0.0"
13-
flask-socketio = "==5.4.1"
12+
flask-cors = "==5.0.1"
13+
flask-socketio = "==5.5.1"
1414
Flask-RESTful = ">=0.3.9"
1515
gevent = "==24.11.1"
1616
gevent-websocket = "==0.10.1"
@@ -72,6 +72,7 @@ types-python-dateutil = "*"
7272
types-pytz = "*"
7373
types-toml = ">=0.10.0"
7474
types-tzlocal = "*"
75+
websocket-client = "*"
7576

7677
[requires]
7778
python_version = "3"

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ markers =
1111
teste2e:End-to-end tests
1212
orchestrator_dispatcher:Orchestrator dispatcher tests
1313
standalone:Tests starting a standalone dispatcher thread
14+
skip_if_not_server:Skip test if not running in specific server mode

taipy/_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _run(*services: _AppType, **kwargs) -> t.Optional[Flask]:
5757
return None
5858

5959
if gui and rest:
60-
gui._set_flask(rest._app) # type: ignore[union-attr]
60+
gui._set_web_server(rest._app) # type: ignore[union-attr]
6161
return gui.run(**kwargs)
6262
else:
6363
app = rest or gui

taipy/gui/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ demo*/
4848
docker-compose-dev*.yml
4949
Dockerfile.dev
5050

51-
# Ignore jupyter notebook files except the simple_gui.ipynb
52-
!simple_gui.ipynb
53-
5451
# GUI generation
5552
taipy_webapp/
5653

taipy/gui/_default_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"debug": False,
5353
"extended_status": False,
5454
"favicon": None,
55-
"flask_log": False,
55+
"server_log": False,
5656
"host": "127.0.0.1",
5757
"light_theme": None,
5858
"margin": "1em",

taipy/gui/config.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import pytz
1717
import tzlocal
1818
from dotenv import dotenv_values
19-
from werkzeug.serving import is_running_from_reloader
2019

2120
from taipy.common.logger._taipy_logger import _TaipyLogger
2221

@@ -27,6 +26,9 @@
2726
from .partial import Partial
2827
from .utils import _is_in_notebook, _is_true
2928

29+
if t.TYPE_CHECKING:
30+
from .gui import Gui
31+
3032
ConfigParameter = t.Literal[
3133
"allow_unsafe_werkzeug",
3234
"async_mode",
@@ -40,7 +42,7 @@
4042
"debug",
4143
"extended_status",
4244
"favicon",
43-
"flask_log",
45+
"server_log",
4446
"host",
4547
"light_theme",
4648
"margin",
@@ -114,7 +116,7 @@
114116
"debug": bool,
115117
"extended_status": bool,
116118
"favicon": t.Optional[str],
117-
"flask_log": bool,
119+
"server_log": bool,
118120
"host": str,
119121
"light_theme": t.Optional[t.Dict[str, t.Any]],
120122
"margin": t.Optional[str],
@@ -150,13 +152,14 @@ class _Config(object):
150152
r"^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"
151153
)
152154

153-
def __init__(self) -> None:
155+
def __init__(self, gui: "Gui") -> None:
154156
self.pages: t.List[_Page] = []
155157
self.root_page: t.Optional[_Page] = None
156158
self.routes: t.List[str] = []
157159
self.partials: t.List[Partial] = []
158160
self.partial_routes: t.List[str] = []
159161
self.config: Config = {}
162+
self._gui = gui
160163

161164
def _load(self, config: Config) -> None:
162165
self.config.update(config)
@@ -290,7 +293,11 @@ def _build_config(self, root_dir, env_filename, kwargs): # pragma: no cover
290293
self._handle_argparse()
291294

292295
def __log_outside_reloader(self, logger, msg):
293-
if not is_running_from_reloader():
296+
if (
297+
hasattr(self._gui, "_server")
298+
and self._gui._server is not None
299+
and not self._gui._server.is_running_from_reloader()
300+
):
294301
logger.info(msg)
295302

296303
def resolve(self):

0 commit comments

Comments
 (0)