-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow for App
server=
to take input
only
#920
Conversation
shiny/_app.py
Outdated
def has_only_input( | ||
x: Callable[[Inputs], None] | Callable[[Inputs, Outputs, Session], None] | ||
) -> TypeGuard[Callable[[Inputs], None]]: | ||
return len(signature(x).parameters) == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that the TypeGuard
does provide some help for the type checker here, but still, I think it's clearer if the len(...) == 1
check is inlined in the elif
statements above, and then a cast
is used inside the elif
blocks. As it is, I find myself jumping up and down in the code to understand what it's doing.
It would be nice if Python type checking were smarter and didn't require either of these workarounds.
shiny/_app.py
Outdated
pass | ||
|
||
|
||
def ignore_output_session_server( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def ignore_output_session_server( | |
def wrap_server_fn_with_output_session( |
shiny/_app.py
Outdated
@@ -446,3 +452,29 @@ def file_response_handler(req: Request) -> FileResponse: | |||
file_response_handler, | |||
name="shiny-app-static-assets-" + mount_point, | |||
) | |||
|
|||
|
|||
def noop_server(input: Inputs, output: Outputs, session: Session) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity:
def noop_server(input: Inputs, output: Outputs, session: Session) -> None: | |
def noop_server_fn(input: Inputs, output: Outputs, session: Session) -> None: |
* main: (24 commits) Use dynamic version of py-shiny for deploy tests (#970) Add underscores to hide some imports (#978) Add rsconnect json files(shinyapps.io tests) and folium tests (#928) Express' `value_box()` no longer includes named positional args (#966) Include `tooltip()` and `popover()` in express (#949) Remove extra call to run_express() Call `tagify()` early to intercept `AttributeErrors` (#941) Don't pass sidebar twice to navbar_page Update changelog Update changelog Switch from `requests` to `urllib` (#940) Bump version to 0.6.1.1 Fix docstring for page_opts Fix API doc sections for Express Smarter, lazier, and more complete page default/api for express (#893) Change `express.layout` to `express.ui` (#904) Remove `@output` from examples (#790) feat: Allow for `App` `server=` to take `input` only (#920) Add fixes for type stub generation (#828) Move quarto express docs to bottom ...
Related: #793