diff --git a/pyproject.toml b/pyproject.toml index 1f58e61..4614818 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,10 @@ dependencies = [ [project.optional-dependencies] charts = ["plotext>=5.2.0"] dashboard = [ - "streamlit>=1.30.0", + # 1.60 is the floor because the dashboard passes width="stretch", the + # replacement for use_container_width, which older releases do not accept. + # Capped below 2.0 so a major release cannot silently change widget APIs. + "streamlit>=1.60.0,<2.0.0", "plotly>=5.18.0", ] dev = [ @@ -24,7 +27,10 @@ dev = [ "pyflakes>=3.2.0", "respx>=0.22.0", # The dashboard journey tests drive the real app through streamlit's AppTest. - "streamlit>=1.30.0", + # 1.60 is the floor because the dashboard passes width="stretch", the + # replacement for use_container_width, which older releases do not accept. + # Capped below 2.0 so a major release cannot silently change widget APIs. + "streamlit>=1.60.0,<2.0.0", "plotly>=5.18.0", # Terminal charts are an optional feature, but one test covers what happens # when drawing them fails, so the test install needs them present. diff --git a/src/perfect_choice/dashboard/views/detail.py b/src/perfect_choice/dashboard/views/detail.py index a48cd49..90fa6fd 100644 --- a/src/perfect_choice/dashboard/views/detail.py +++ b/src/perfect_choice/dashboard/views/detail.py @@ -73,7 +73,7 @@ def render() -> None: yaxis=dict(autorange="reversed"), height=max(250, len(decision.criteria) * 45), ) - st.plotly_chart(fig_weights, use_container_width=True) + st.plotly_chart(fig_weights, width="stretch") else: st.info("No criteria defined.") @@ -99,7 +99,7 @@ def render() -> None: yaxis_title="Score", height=350, ) - st.plotly_chart(fig_rank, use_container_width=True) + st.plotly_chart(fig_rank, width="stretch") else: st.info("No rankings computed.") @@ -119,7 +119,7 @@ def render() -> None: # Reorder columns by criteria order col_order = [c.name for c in decision.criteria if c.name in df.columns] df = df[col_order] - st.dataframe(df, use_container_width=True) + st.dataframe(df, width="stretch") else: st.info("No scores recorded.") @@ -217,4 +217,4 @@ def _render_sensitivity_chart(decision) -> None: yaxis=dict(autorange="reversed"), height=max(250, len(names) * 45), ) - st.plotly_chart(fig, use_container_width=True) + st.plotly_chart(fig, width="stretch") diff --git a/src/perfect_choice/dashboard/views/new_decision.py b/src/perfect_choice/dashboard/views/new_decision.py index abffbd8..52c4795 100644 --- a/src/perfect_choice/dashboard/views/new_decision.py +++ b/src/perfect_choice/dashboard/views/new_decision.py @@ -588,7 +588,7 @@ def _render_ranking_chart(rankings: dict[str, list[RankingResult]]) -> None: yaxis_title="Score", xaxis_title="Alternative", ) - st.plotly_chart(fig, use_container_width=True) + st.plotly_chart(fig, width="stretch") def _render_weight_donut(criteria: list[Criterion]) -> None: @@ -624,7 +624,7 @@ def _render_weight_donut(criteria: list[Criterion]) -> None: **PLOTLY_LAYOUT, title="Criteria Weights", ) - st.plotly_chart(fig, use_container_width=True) + st.plotly_chart(fig, width="stretch") def _render_sensitivity_chart(sensitivity: list) -> None: @@ -666,7 +666,7 @@ def _render_sensitivity_chart(sensitivity: list) -> None: xaxis_title="Weight Perturbation (%)", yaxis=dict(autorange="reversed"), ) - st.plotly_chart(fig, use_container_width=True) + st.plotly_chart(fig, width="stretch") # --------------------------------------------------------------------------- diff --git a/src/perfect_choice/dashboard/views/replay.py b/src/perfect_choice/dashboard/views/replay.py index 42fb90f..7d85e58 100644 --- a/src/perfect_choice/dashboard/views/replay.py +++ b/src/perfect_choice/dashboard/views/replay.py @@ -195,7 +195,7 @@ def _run_comparison(decision, new_criteria): yaxis_title="Weight (%)", height=350, ) - st.plotly_chart(fig, use_container_width=True) + st.plotly_chart(fig, width="stretch") def _render_ranking_chart(rankings, label): @@ -223,4 +223,4 @@ def _render_ranking_chart(rankings, label): yaxis_title="Score", height=300, ) - st.plotly_chart(fig, use_container_width=True) + st.plotly_chart(fig, width="stretch")