Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ install_requires =
websockets>=10.0
python-multipart
htmltools>=0.2.1
click>=8.0.3
click>=8.1.4
markdown-it-py>=1.1.0
# This is needed for markdown-it-py. Without it, when loading shiny/ui/_markdown.py,
# Python emits the following: "UserWarning: The 'tasklists' feature of GitHub
Expand Down
13 changes: 10 additions & 3 deletions shiny/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
import shiny

from . import _autoreload, _hostenv, _static, _utils
from ._typing_extensions import NotRequired, TypedDict


@click.group() # pyright: ignore[reportUnknownMemberType]
@click.group("main")
def main() -> None:
pass

Expand Down Expand Up @@ -233,7 +234,7 @@ def run_app(
else:
setup_hot_reload(log_config, autoreload_port, port, launch_browser)

reload_args: dict[str, bool | str | list[str]] = {}
reload_args: ReloadArgs = {}
if reload:
reload_dirs = []
if app_dir is not None:
Expand All @@ -253,7 +254,7 @@ def run_app(
maybe_setup_rsw_proxying(log_config)

uvicorn.run( # pyright: ignore[reportUnknownMemberType]
app, # pyright: ignore[reportGeneralTypeIssues]
app,
host=host,
port=port,
ws_max_size=ws_max_size,
Expand Down Expand Up @@ -446,3 +447,9 @@ def static_assets(command: str) -> None:
_static.print_shinylive_local_info()
else:
raise click.UsageError(f"Unknown command: {command}")


class ReloadArgs(TypedDict):
reload: NotRequired[bool]
reload_includes: NotRequired[list[str]]
reload_dirs: NotRequired[list[str]]
16 changes: 9 additions & 7 deletions shiny/_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
# flake8: noqa: F401
# pyright: reportUnusedImport=false

__all__ = (
"Concatenate",
"ParamSpec",
"TypeGuard",
"NotRequired",
"TypedDict",
"assert_type",
)


import sys

Expand All @@ -17,10 +26,3 @@
from typing import NotRequired, TypedDict, assert_type
else:
from typing_extensions import NotRequired, TypedDict, assert_type


# The only purpose of the following line is so that pyright will put all of the
# conditional imports into the .pyi file when generating type stubs. Without this line,
# pyright will not include the above imports in the generated .pyi file, and it will
# result in a lot of red squiggles in user code.
_: 'Concatenate[str, ParamSpec("P")] | ParamSpec | TypeGuard | NotRequired | TypedDict | assert_type' # type:ignore