Skip to content

fix: replace deprecated use_container_width with width="stretch" (closes #118)#136

Open
voidborne-d wants to merge 1 commit into
AIDC-AI:mainfrom
voidborne-d:fix/streamlit-use-container-width-deprecation
Open

fix: replace deprecated use_container_width with width="stretch" (closes #118)#136
voidborne-d wants to merge 1 commit into
AIDC-AI:mainfrom
voidborne-d:fix/streamlit-use-container-width-deprecation

Conversation

@voidborne-d
Copy link
Copy Markdown

Closes #118.

Summary

Streamlit prints a DeprecationWarning for every use_container_width call and will remove the parameter after 2025-12-31:

Please replace `use_container_width` with `width`.
`use_container_width` will be removed after 2025-12-31.
For `use_container_width=True`, use `width='stretch'`.
For `use_container_width=False`, use `width='content'`.

This PR:

  • Replaces all 47 use_container_width=True call sites with width="stretch" across web/pipelines/, web/components/, web/pages/. There were no =False call sites in the tree, so the mapping is purely True -> "stretch".
  • Bumps streamlit>=1.40.0 -> streamlit>=1.50.0 in pyproject.toml. The uv.lock already pins 1.53.1, so this just prevents an unsupported install on a fresh user environment that resolves to an older Streamlit.

Why bump the floor to 1.50?

I verified empirically across released Streamlit versions when the width keyword landed for the widgets actually used here:

widget width= introduced
st.image 1.46
st.button 1.48
st.download_button 1.48

Anything below 1.48 will TypeError on st.button(..., width="stretch"). 1.50 is a round, post-rollout floor that comfortably covers all three (and is older than this project — Pixelle-Video was created 2025-11, Streamlit 1.50 shipped Aug 2025).

Files changed

  • pyproject.toml (+1/-1, dep floor)
  • web/components/{content_input,digital_tts_config,output_preview,settings,style_config}.py
  • web/pages/2_📚_History.py
  • web/pipelines/{action_transfer,asset_based,digital_human,i2v}.py

Verified locally

  • ast.parse clean across all 10 modified .py files (including the emoji-named 2_📚_History.py).
  • inspect.signature(st.button)["width"] / st.download_button / st.image return non-empty Width annotation with default "content" on Streamlit 1.50.0 — confirms width="stretch" is a documented call shape, not just an undocumented kwarg.
  • Repo has no tests/ directory and no PR-gating CI workflow (only docs.yml), so no test surface to update.

Out of scope (intentionally)

  • Issue asset_default.html does not follow template naming convention #119 (asset_default.html naming convention) — separate concern, separate PR if desired.
  • uv.lock regeneration — left untouched. Pinned 1.53.1 already satisfies >=1.50.0. A uv lock rerun on a different Python version produces ~3,900 lines of platform-metadata churn unrelated to this fix; the maintainer's next routine sync will pick it up cleanly.

Generated with Claude Code.

…etch" (closes AIDC-AI#118)

Streamlit emits a DeprecationWarning for every `use_container_width=True`
call and will remove the parameter after 2025-12-31:

  Please replace `use_container_width` with `width`.
  For `use_container_width=True`, use `width='stretch'`.

This patch:
  - replaces all 47 `use_container_width=True` call sites with
    `width="stretch"` across web/pipelines, web/components, web/pages
  - bumps `streamlit>=1.40.0` -> `streamlit>=1.50.0` so all touched
    widgets (`st.button`, `st.download_button`, `st.image`) accept the
    `width` keyword (`st.button`/`st.download_button` only gained
    `width` in 1.48; `st.image` in 1.46; uv.lock already pins 1.53.1)

No behavior change: the documented mapping is `True -> "stretch"`.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace deprecated use_container_width with width in Streamlit UI

2 participants