chore: migrate use_container_width → width (Streamlit deprecation)

``use_container_width`` is being removed after 2025-12-31. Streamlit
log was flooding the terminal with the deprecation notice on every
rerun. Mechanical sweep:

  use_container_width=True   →  width="stretch"
  use_container_width=False  →  width="content"

51 call sites across 11 page files + ``app_demo.py``. Also renamed
the ``local_download_button`` helper's ``use_container_width`` kwarg
to ``width`` (default ``"stretch"``); it has no external callers
passing the old name, so this is a safe rename.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-18 22:43:52 +00:00
parent e011c0b6e6
commit 61e63913cb
12 changed files with 54 additions and 54 deletions

View File

@@ -174,7 +174,7 @@ def _home_page() -> None:
key=f"_home_remove_{digest}",
help=f"Remove {name}",
type="secondary",
use_container_width=True,
width="stretch",
):
to_remove = name
@@ -240,14 +240,14 @@ def _home_page() -> None:
type="primary",
key="home_run_analysis",
disabled=not pending,
use_container_width=True,
width="stretch",
)
with col_clear:
clear_clicked = st.button(
t("upload.clear_results"),
key="home_clear_results",
disabled=not findings_by_file,
use_container_width=True,
width="stretch",
)
if clear_clicked:

View File

@@ -314,7 +314,7 @@ else:
# ---------------------------------------------------------------------------
st.markdown(f"#### BEFORE — {len(df_in)} rows, {len(df_in.columns)} columns")
st.dataframe(df_in.head(10), use_container_width=True, hide_index=True)
st.dataframe(df_in.head(10), width="stretch", hide_index=True)
st.markdown("---")
@@ -338,7 +338,7 @@ st.markdown(pipe_summary)
run_clicked = st.button(
"▶ Run pipeline",
type="primary",
use_container_width=True,
width="stretch",
key="demo_run_button",
)
@@ -404,7 +404,7 @@ if result is not None:
)
st.markdown("".join(pills_html), unsafe_allow_html=True)
st.dataframe(result.final_df.head(10), use_container_width=True, hide_index=True)
st.dataframe(result.final_df.head(10), width="stretch", hide_index=True)
# ----- Download with watermark row -----
watermark_row = pd.DataFrame([{
@@ -422,7 +422,7 @@ if result is not None:
data=csv_bytes,
file_name=Path(persona["data_file"]).stem + "_cleaned_demo.csv",
mime="text/csv",
use_container_width=True,
width="stretch",
)
with col_cta:
st.markdown(

View File

@@ -215,7 +215,7 @@ def _render_diagnostics_sidebar() -> None:
"📂 Open log folder",
key="_diag_open_logs",
type="secondary",
use_container_width=True,
width="stretch",
):
opened = _open_in_file_manager(audit_log_dir(), select=log_path)
if not opened:
@@ -448,7 +448,7 @@ def local_download_button(
mime: str = "application/octet-stream", # noqa: ARG001 — kept for API compat
disabled: bool = False,
help: str | None = None,
use_container_width: bool = True,
width: str = "stretch",
) -> None:
"""Save bytes directly to the user's Downloads folder.
@@ -497,7 +497,7 @@ def local_download_button(
disabled=disabled,
help=help,
type="secondary",
use_container_width=use_container_width,
width=width,
)
if clicked:
@@ -1412,7 +1412,7 @@ def match_group_card(
return styles
styled = compare_df.style.apply(_highlight_diffs, axis=0)
st.dataframe(styled, use_container_width=True)
st.dataframe(styled, width="stretch")
if len(keep_indices) == n_rows:
st.info("Decision: Kept All")
@@ -1470,7 +1470,7 @@ def match_group_card(
editor_df,
column_config=col_config,
disabled=disabled_cols,
use_container_width=True,
width="stretch",
hide_index=True,
key=f"editor_{gid}",
)
@@ -1514,7 +1514,7 @@ def match_group_card(
columns=["Keep"],
).reset_index(drop=True)
st.markdown("**Surviving rows preview:**")
st.dataframe(preview, use_container_width=True, hide_index=True)
st.dataframe(preview, width="stretch", hide_index=True)
# Confirm
def _on_confirm(
@@ -1848,7 +1848,7 @@ def render_findings_panel(
_t("findings.open_tool", tool=name),
key=f"_findings_open_{tool_id}_{ns}",
type="primary",
use_container_width=False,
width="content",
):
st.switch_page(page_slug)

View File

@@ -192,7 +192,7 @@ if uploaded is not None:
# markdown/caption/subheader collections.
st.subheader(f"Preview: {uploaded.name}")
st.caption(f"{len(df)} rows, {len(df.columns)} columns")
st.dataframe(df.head(10), use_container_width=True)
st.dataframe(df.head(10), width="stretch")
# Advanced options
with st.expander("Options", expanded=not _has_result):
@@ -213,7 +213,7 @@ if uploaded is not None:
st.divider()
if st.button("Find Duplicates", type="primary", use_container_width=True):
if st.button("Find Duplicates", type="primary", width="stretch"):
progress_bar = st.progress(0, text="Comparing rows...")
def _gui_progress(current: int, total: int) -> None:
@@ -350,7 +350,7 @@ if uploaded is not None:
if st.button(
"Apply Review Decisions & Download",
type="primary",
use_container_width=True,
width="stretch",
):
reviewed_df, reviewed_removed = apply_review_decisions(
df, result.match_groups, decisions,

View File

@@ -119,7 +119,7 @@ with st.expander(f"Preview: {uploaded.name}", expanded=not _has_result):
if preview_show_hidden:
render_hidden_aware_preview(df, n_rows=10)
else:
st.dataframe(df.head(10), use_container_width=True)
st.dataframe(df.head(10), width="stretch")
st.divider()
@@ -213,7 +213,7 @@ with st.expander("Options", expanded=not _has_result):
st.divider()
if st.button("Clean Text", type="primary", use_container_width=True):
if st.button("Clean Text", type="primary", width="stretch"):
with st.spinner("Cleaning..."):
try:
result = clean_dataframe(df, options)
@@ -280,7 +280,7 @@ if result.cells_changed:
st.markdown("**Changes by column**")
st.dataframe(
counts.rename("cells_changed").to_frame(),
use_container_width=True,
width="stretch",
)
st.markdown("**Examples (first 25 changes)**")
@@ -326,7 +326,7 @@ if result.cells_changed:
unsafe_allow_html=True,
)
else:
st.dataframe(examples, use_container_width=True, hide_index=True)
st.dataframe(examples, width="stretch", hide_index=True)
st.markdown("**Cleaned preview (first 10 rows)**")
# Reuse the same toggle the Examples table uses so the user controls both
@@ -334,7 +334,7 @@ st.markdown("**Cleaned preview (first 10 rows)**")
if show_hidden:
render_hidden_aware_preview(result.cleaned_df, n_rows=10)
else:
st.dataframe(result.cleaned_df.head(10), use_container_width=True)
st.dataframe(result.cleaned_df.head(10), width="stretch")
# ---------------------------------------------------------------------------
# Downloads

View File

@@ -107,7 +107,7 @@ except Exception as e:
_has_result = st.session_state.get("fmtstd_result") is not None
with st.expander(f"Preview: {uploaded.name}", expanded=not _has_result):
st.caption(f"{len(df)} rows, {len(df.columns)} columns")
st.dataframe(df.head(10), use_container_width=True)
st.dataframe(df.head(10), width="stretch")
st.divider()
@@ -478,7 +478,7 @@ with st.expander("Options", expanded=not _has_result):
edited = st.data_editor(
starter,
num_rows="dynamic",
use_container_width=True,
width="stretch",
column_config={
"abbreviation": st.column_config.TextColumn(
"Short form",
@@ -530,7 +530,7 @@ run_disabled = not column_types
if st.button(
"Standardize Formats",
type="primary",
use_container_width=True,
width="stretch",
disabled=run_disabled,
):
with st.spinner("Standardizing..."):
@@ -592,16 +592,16 @@ if result.cells_changed:
st.markdown("**Changes by column**")
st.dataframe(
counts.rename("cells_changed").to_frame(),
use_container_width=True,
width="stretch",
)
st.markdown("**Examples (first 25 changes)**")
examples = result.changes.head(25).copy()
examples["row"] = examples["row"] + 1
st.dataframe(examples, use_container_width=True, hide_index=True)
st.dataframe(examples, width="stretch", hide_index=True)
st.markdown("**Standardized preview (first 10 rows)**")
st.dataframe(result.standardized_df.head(10), use_container_width=True)
st.dataframe(result.standardized_df.head(10), width="stretch")
# ---------------------------------------------------------------------------

View File

@@ -106,7 +106,7 @@ _has_result = st.session_state.get("missing_result") is not None
with st.expander(f"Preview: {uploaded.name}", expanded=not _has_result):
st.caption(f"{len(df)} rows, {len(df.columns)} columns")
st.dataframe(df.head(10), use_container_width=True)
st.dataframe(df.head(10), width="stretch")
st.divider()
@@ -134,7 +134,7 @@ with st.expander("Options", expanded=not _has_result):
m3.metric("% cells missing", f"{initial_profile.cells_missing_pct:.1f}%")
m4.metric("Complete rows", initial_profile.rows_complete)
st.dataframe(prof_df, use_container_width=True, hide_index=True)
st.dataframe(prof_df, width="stretch", hide_index=True)
if initial_profile.cells_missing == 0:
st.success("No missing values or disguised nulls detected. Nothing to handle.")
@@ -259,7 +259,7 @@ with st.expander("Options", expanded=not _has_result):
})
edited = st.data_editor(
edit_df,
use_container_width=True,
width="stretch",
hide_index=True,
column_config={
"column": st.column_config.TextColumn("Column", disabled=True),
@@ -285,7 +285,7 @@ with st.expander("Options", expanded=not _has_result):
st.divider()
if st.button("Handle Missing Values", type="primary", use_container_width=True):
if st.button("Handle Missing Values", type="primary", width="stretch"):
with st.spinner("Handling..."):
try:
result = handle_missing(df, options)
@@ -345,25 +345,25 @@ after = result.profile_after.to_dataframe().set_index("column")[
["missing", "missing_pct"]
].rename(columns={"missing": "after_missing", "missing_pct": "after_pct"})
combined = before.join(after, how="outer").fillna(0)
st.dataframe(combined, use_container_width=True)
st.dataframe(combined, width="stretch")
if result.strategy_per_column:
st.markdown("**Strategy applied per column**")
strat_df = pd.DataFrame(
[{"column": c, "strategy": s} for c, s in result.strategy_per_column.items()]
)
st.dataframe(strat_df, use_container_width=True, hide_index=True)
st.dataframe(strat_df, width="stretch", hide_index=True)
if not result.changes.empty:
st.markdown("**Audit (first 50 changes)**")
audit_view = result.changes.head(50).copy()
audit_view["row"] = audit_view["row"].apply(lambda x: "" if x == -1 else x + 1)
st.dataframe(audit_view, use_container_width=True, hide_index=True)
st.dataframe(audit_view, width="stretch", hide_index=True)
if len(result.changes) > 50:
st.caption(f"… and {len(result.changes) - 50} more (download the full audit below).")
st.markdown("**Handled preview (first 10 rows)**")
st.dataframe(result.handled_df.head(10), use_container_width=True)
st.dataframe(result.handled_df.head(10), width="stretch")
# ---------------------------------------------------------------------------
# Downloads

View File

@@ -98,7 +98,7 @@ _has_result = st.session_state.get("colmap_result") is not None
with st.expander(f"Preview: {uploaded.name}", expanded=not _has_result):
st.caption(f"{len(df)} rows, {len(df.columns)} columns")
st.dataframe(df.head(10), use_container_width=True)
st.dataframe(df.head(10), width="stretch")
st.divider()
# ---------------------------------------------------------------------------
@@ -165,7 +165,7 @@ with st.expander("Options", expanded=not _has_result):
})
edited = st.data_editor(
initial,
use_container_width=True,
width="stretch",
num_rows="dynamic",
column_config={
"name": st.column_config.TextColumn("Target name"),
@@ -276,7 +276,7 @@ with st.expander("Options", expanded=not _has_result):
})
rename_edited = st.data_editor(
rename_initial,
use_container_width=True,
width="stretch",
column_config={
"source": st.column_config.TextColumn("Source", disabled=True),
"target": st.column_config.TextColumn("Target"),
@@ -304,7 +304,7 @@ with st.expander("Options", expanded=not _has_result):
})
map_edited = st.data_editor(
map_initial,
use_container_width=True,
width="stretch",
column_config={
"source": st.column_config.TextColumn("Source", disabled=True),
"target": st.column_config.SelectboxColumn(
@@ -332,7 +332,7 @@ with st.expander("Options", expanded=not _has_result):
st.divider()
if st.button("Apply Column Mapping", type="primary", use_container_width=True):
if st.button("Apply Column Mapping", type="primary", width="stretch"):
with st.spinner("Mapping..."):
try:
result = map_columns(df, options)
@@ -400,10 +400,10 @@ if result.mapping:
for s, t in result.mapping.items()
],
)
st.dataframe(map_df, use_container_width=True, hide_index=True)
st.dataframe(map_df, width="stretch", hide_index=True)
st.markdown("**Mapped preview (first 10 rows)**")
st.dataframe(result.mapped_df.head(10), use_container_width=True)
st.dataframe(result.mapped_df.head(10), width="stretch")
# ---------------------------------------------------------------------------
# Downloads

View File

@@ -72,7 +72,7 @@ if uploaded is not None:
df = pd.read_csv(uploaded)
st.subheader(f"Preview: {uploaded.name}")
st.caption(f"{len(df)} rows, {len(df.columns)} columns")
st.dataframe(df.head(10), use_container_width=True)
st.dataframe(df.head(10), width="stretch")
except Exception as e:
from src.core.errors import format_for_user
st.error(
@@ -95,5 +95,5 @@ st.subheader("Handling")
st.selectbox("Action", ["Flag only (add column)", "Remove outlier rows", "Cap / Winsorize to bounds"], disabled=True)
st.divider()
st.button("Detect Outliers", type="primary", use_container_width=True, disabled=True)
st.button("Detect Outliers", type="primary", width="stretch", disabled=True)

View File

@@ -74,7 +74,7 @@ if uploaded_files:
df = pd.read_csv(f)
st.subheader(f"Preview: {f.name}")
st.caption(f"{len(df)} rows, {len(df.columns)} columns — Columns: {', '.join(df.columns[:10])}{'...' if len(df.columns) > 10 else ''}")
st.dataframe(df.head(5), use_container_width=True)
st.dataframe(df.head(5), width="stretch")
except Exception as e:
from src.core.errors import format_for_user
st.error(
@@ -93,5 +93,5 @@ st.selectbox("Mismatched columns", ["Fill with null", "Drop non-shared columns",
st.checkbox("Add source filename column", value=True, disabled=True)
st.divider()
st.button("Merge Files", type="primary", use_container_width=True, disabled=True)
st.button("Merge Files", type="primary", width="stretch", disabled=True)

View File

@@ -72,7 +72,7 @@ if uploaded is not None:
df = pd.read_csv(uploaded)
st.subheader(f"Preview: {uploaded.name}")
st.caption(f"{len(df)} rows, {len(df.columns)} columns")
st.dataframe(df.head(10), use_container_width=True)
st.dataframe(df.head(10), width="stretch")
except Exception as e:
from src.core.errors import format_for_user
st.error(
@@ -100,5 +100,5 @@ st.subheader("Report Format")
st.selectbox("Output format", ["Excel (flagged rows)", "PDF summary", "Both"], disabled=True)
st.divider()
st.button("Validate & Generate Report", type="primary", use_container_width=True, disabled=True)
st.button("Validate & Generate Report", type="primary", width="stretch", disabled=True)

View File

@@ -99,7 +99,7 @@ _has_result = st.session_state.get("pipeline_result") is not None
with st.expander(f"Preview: {uploaded.name}", expanded=not _has_result):
st.caption(f"{len(df)} rows, {len(df.columns)} columns")
st.dataframe(df.head(10), use_container_width=True)
st.dataframe(df.head(10), width="stretch")
st.divider()
@@ -170,7 +170,7 @@ with st.expander("Options", expanded=not _has_result):
)
edited = st.data_editor(
st.session_state["pipeline_rows"],
use_container_width=True,
width="stretch",
num_rows="dynamic",
column_config={
"tool": st.column_config.SelectboxColumn(
@@ -246,7 +246,7 @@ run_disabled = current_pipeline is None or not current_pipeline.steps
if st.button(
"Run Pipeline",
type="primary",
use_container_width=True,
width="stretch",
disabled=run_disabled,
):
progress = st.progress(0.0, text="Starting...")
@@ -343,10 +343,10 @@ step_df = pd.DataFrame([
}
for sr in result.step_results
])
st.dataframe(step_df, use_container_width=True, hide_index=True)
st.dataframe(step_df, width="stretch", hide_index=True)
st.markdown("**Output preview (first 10 rows)**")
st.dataframe(result.final_df.head(10), use_container_width=True)
st.dataframe(result.final_df.head(10), width="stretch")
# ---------------------------------------------------------------------------
# Downloads