You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug:
My specific use case was combining sp.pydantic_form and a List data field:
fromtypingimportListimportstreamlit_pydanticasspfrompydanticimportBaseModel, FieldclassShowcaseModel(BaseModel):
int_list: List[int] =Field(..., title="Int List title", description="Int List desc")
str_list: List[str]
session_data=sp.pydantic_form(
key="form",
model=ShowcaseModel
)
This yields the following:
Note: I'm filing this as a bug since the current behavior renders a hard to debug, unexpected UI.
Expected behaviour:
I expected something similar to using sp.pydantic_input:
Additional context: streamlit does not support buttons inside forms (see feature request in streamlit/streamlit#4892).
This is the real culprit of the half-rendered output. But it has a pretty way to inform users about what happened:
falcaopetri
changed the title
InputUI.render_ui silences import streamlit exceptions
InputUI.render_ui silences important streamlit exceptions
May 25, 2023
Describe the bug:
My specific use case was combining
sp.pydantic_form
and aList
data field:This yields the following:
Expected behaviour:
I expected something similar to using
sp.pydantic_input
:Additional context:
streamlit
does not supportbuttons
insideforms
(see feature request in streamlit/streamlit#4892).This is the real culprit of the half-rendered output. But it has a pretty way to inform users about what happened:
Possible Fix:
Considering the example in this issue, the rendering process stops at the first
st.button
found:https://github.com/LukasMasuch/streamlit-pydantic/blob/99aea848d2b8c8301cf8622fe57aaf0c59c7a176/src/streamlit_pydantic/ui_renderer.py#L986
Then
streamlit
raises aStreamlitAPIException
, that is silenced withinInputUI.render_ui
:https://github.com/LukasMasuch/streamlit-pydantic/blob/99aea848d2b8c8301cf8622fe57aaf0c59c7a176/src/streamlit_pydantic/ui_renderer.py#L175-L180
It would be helpful to do at least one of:
sp.pydantic_form
+fields that use buttons
StreamlitAPIException
(sostreamlit
properly renders it)OutputUI.render_ui
)A similar issue can happen in other scenarios that trigger the
except -> pass
behavior.I can also create a PR if you point me in the right direction.
The text was updated successfully, but these errors were encountered: