Skip to content

Remove express.ui.output_* functions, add shiny.express.render #1018

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

Merged
merged 26 commits into from
Jan 17, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Restore argument passing
  • Loading branch information
wch committed Jan 16, 2024
commit 2a2941b99e0db92fb1bd4ce239aaa842a7dc446a
18 changes: 15 additions & 3 deletions shiny/render/renderer/_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ def _set_output_metadata(
"""
self.output_id = output_name

def auto_output_ui(self, id: str) -> DefaultUIFnResultOrNone:
def auto_output_ui(
self,
id: str,
# *args: object,
# **kwargs: object,
) -> DefaultUIFnResultOrNone:
return None

@abstractmethod
Expand All @@ -150,20 +155,27 @@ def __init__(self) -> None:
# Tagify-like methods
# ######
def _repr_html_(self) -> str | None:
rendered_ui = self.auto_output_ui(self.__name__)
rendered_ui = self._render_auto_output_ui()
if rendered_ui is None:
return None
return TagList(rendered_ui)._repr_html_()

def tagify(self) -> DefaultUIFnResult:
rendered_ui = self.auto_output_ui(self.__name__)
rendered_ui = self._render_auto_output_ui()
if rendered_ui is None:
raise TypeError(
"No default UI exists for this type of render function: ",
self.__class__.__name__,
)
return rendered_ui

def _render_auto_output_ui(self) -> DefaultUIFnResultOrNone:
return self.auto_output_ui(
self.__name__,
# Pass the `@ui_kwargs(foo="bar")` kwargs through to the default_ui function.
**self._auto_output_ui_kwargs,
)

# ######
# Auto registering output
# ######
Expand Down