|
@@ -11,9 +11,8 @@ import uvicorn
|
|
from uvicorn.main import STARTUP_FAILURE
|
|
from uvicorn.main import STARTUP_FAILURE
|
|
from uvicorn.supervisors import ChangeReload, Multiprocess
|
|
from uvicorn.supervisors import ChangeReload, Multiprocess
|
|
|
|
|
|
-from . import globals, helpers
|
|
|
|
|
|
+from . import globals, helpers, native_mode
|
|
from . import native as native_module
|
|
from . import native as native_module
|
|
-from . import native_mode
|
|
|
|
from .air import Air
|
|
from .air import Air
|
|
from .language import Language
|
|
from .language import Language
|
|
|
|
|
|
@@ -53,7 +52,7 @@ def run(*,
|
|
uvicorn_reload_includes: str = '*.py',
|
|
uvicorn_reload_includes: str = '*.py',
|
|
uvicorn_reload_excludes: str = '.*, .py[cod], .sw.*, ~*',
|
|
uvicorn_reload_excludes: str = '.*, .py[cod], .sw.*, ~*',
|
|
tailwind: bool = True,
|
|
tailwind: bool = True,
|
|
- endpoint_documentation: str = '',
|
|
|
|
|
|
+ endpoint_documentation: Literal['none', 'internal', 'page', 'all'] = 'none',
|
|
storage_secret: Optional[str] = None,
|
|
storage_secret: Optional[str] = None,
|
|
**kwargs: Any,
|
|
**kwargs: Any,
|
|
) -> None:
|
|
) -> None:
|
|
@@ -80,7 +79,7 @@ def run(*,
|
|
:param uvicorn_reload_includes: string with comma-separated list of glob-patterns which trigger reload on modification (default: `'.py'`)
|
|
:param uvicorn_reload_includes: string with comma-separated list of glob-patterns which trigger reload on modification (default: `'.py'`)
|
|
:param uvicorn_reload_excludes: string with comma-separated list of glob-patterns which should be ignored for reload (default: `'.*, .py[cod], .sw.*, ~*'`)
|
|
:param uvicorn_reload_excludes: string with comma-separated list of glob-patterns which should be ignored for reload (default: `'.*, .py[cod], .sw.*, ~*'`)
|
|
:param tailwind: whether to use Tailwind (experimental, default: `True`)
|
|
:param tailwind: whether to use Tailwind (experimental, default: `True`)
|
|
- :param endpoint_documentation: control what endpoints appear in the autogenerated OpenAPI docs (default: '', options: 'all internal page')
|
|
|
|
|
|
+ :param endpoint_documentation: control what endpoints appear in the autogenerated OpenAPI docs (default: 'none', options: 'none', 'internal', 'page', 'all')
|
|
:param storage_secret: secret key for browser based storage (default: `None`, a value is required to enable ui.storage.individual and ui.storage.browser)
|
|
:param storage_secret: secret key for browser based storage (default: `None`, a value is required to enable ui.storage.individual and ui.storage.browser)
|
|
:param kwargs: additional keyword arguments are passed to `uvicorn.run`
|
|
:param kwargs: additional keyword arguments are passed to `uvicorn.run`
|
|
'''
|
|
'''
|
|
@@ -93,20 +92,20 @@ def run(*,
|
|
globals.language = language
|
|
globals.language = language
|
|
globals.binding_refresh_interval = binding_refresh_interval
|
|
globals.binding_refresh_interval = binding_refresh_interval
|
|
globals.tailwind = tailwind
|
|
globals.tailwind = tailwind
|
|
-
|
|
|
|
- if 'all' in endpoint_documentation:
|
|
|
|
- endpoint_documentation = 'internal page' # any additional documentation groups need to be added here
|
|
|
|
|
|
+ globals.endpoint_documentation = endpoint_documentation
|
|
|
|
|
|
# routes are already created by this point, so we have to iterate through and fix them
|
|
# routes are already created by this point, so we have to iterate through and fix them
|
|
for route in globals.app.routes:
|
|
for route in globals.app.routes:
|
|
if route.path.startswith('/_nicegui'):
|
|
if route.path.startswith('/_nicegui'):
|
|
if hasattr(route, 'methods'):
|
|
if hasattr(route, 'methods'):
|
|
- if 'internal' not in endpoint_documentation:
|
|
|
|
- route.include_in_schema = False
|
|
|
|
|
|
+ route.include_in_schema = False
|
|
|
|
+ if endpoint_documentation in ['internal', 'all']:
|
|
|
|
+ route.include_in_schema = True
|
|
|
|
|
|
if route.name == 'decorated':
|
|
if route.name == 'decorated':
|
|
- if 'page' not in endpoint_documentation:
|
|
|
|
- route.include_in_schema = False
|
|
|
|
|
|
+ route.include_in_schema = False
|
|
|
|
+ if endpoint_documentation in ['page', 'all']:
|
|
|
|
+ route.include_in_schema = True
|
|
|
|
|
|
if on_air:
|
|
if on_air:
|
|
globals.air = Air('' if on_air is True else on_air)
|
|
globals.air = Air('' if on_air is True else on_air)
|