소스 검색

code review

Falko Schindler 3 년 전
부모
커밋
32a005f876
2개의 변경된 파일14개의 추가작업 그리고 9개의 파일을 삭제
  1. 3 3
      README.md
  2. 11 6
      nicegui/run.py

+ 3 - 3
README.md

@@ -71,9 +71,9 @@ You can call `ui.run()` with optional arguments for some high-level configuratio
 - `show`: automatically open the ui in a browser tab (default: `True`)
 - `on_connect`: default function or coroutine which is called for each new client connection; the optional `request` argument provides session infos
 - `uvicorn_logging_level`: logging level for uvicorn server (default: `'warning'`)
-- `uvicorn_reload_dirs`: string with comma separated list for directories to be monitored (default is current working dir only)
-- `uvicorn_reload_includes`: string with comma separated list of glob-patterns which trigger reload on modification (default is all files; can be changed to `'.py'` or `'.py, .yaml'` for example)
-- `uvicorn_reload_excludes`: string with comma separated list of glob-patterns which should be ignored for reload (default is `'.*, .py[cod], .sw.*, ~*'`)
+- `uvicorn_reload_dirs`: string with comma-separated list for directories to be monitored (default is current working directory only)
+- `uvicorn_reload_includes`: string with comma-separated list of glob-patterns which trigger reload on modification (default is all files; can be changed to `'.py'` or `'.py, .yaml'` for example)
+- `uvicorn_reload_excludes`: string with comma-separated list of glob-patterns which should be ignored for reload (default is `'.*, .py[cod], .sw.*, ~*'`)
 - `main_page_classes`: configure Quasar classes of main page (default: `'q-ma-md column items-start'`)
 - `binding_refresh_interval`: time between binding updates (default: `0.1` seconds, bigger is more cpu friendly)
 - `interactive`: used internally when run in interactive Python shell (default: `False`)

+ 11 - 6
nicegui/run.py

@@ -1,4 +1,3 @@
-from distutils.command.config import config
 from typing import Awaitable, Callable, Optional, Union
 import inspect
 import sys
@@ -11,11 +10,17 @@ if not globals.config.interactive and globals.config.reload and not inspect.stac
 
     if globals.config.show:
         webbrowser.open(f'http://{globals.config.host}:{globals.config.port}/')
-    uvicorn.run('nicegui:app', host=globals.config.host, port=globals.config.port, lifespan='on', reload=True,
-                reload_includes=globals.config.uvicorn_reload_includes,
-                reload_excludes=globals.config.uvicorn_reload_excludes,
-                reload_dirs=globals.config.uvicorn_reload_dirs,
-                log_level=globals.config.uvicorn_logging_level)
+    uvicorn.run(
+        'nicegui:app',
+        host=globals.config.host,
+        port=globals.config.port,
+        lifespan='on',
+        reload=True,
+        reload_includes=globals.config.uvicorn_reload_includes,
+        reload_excludes=globals.config.uvicorn_reload_excludes,
+        reload_dirs=globals.config.uvicorn_reload_dirs,
+        log_level=globals.config.uvicorn_logging_level,
+    )
     sys.exit()
 
 def run(self, *,