fix: replace deprecated use_container_width with width="stretch" (closes #118)#136
Open
voidborne-d wants to merge 1 commit into
Open
Conversation
…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"`.
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #118.
Summary
Streamlit prints a
DeprecationWarningfor everyuse_container_widthcall and will remove the parameter after 2025-12-31:This PR:
use_container_width=Truecall sites withwidth="stretch"acrossweb/pipelines/,web/components/,web/pages/. There were no=Falsecall sites in the tree, so the mapping is purelyTrue -> "stretch".streamlit>=1.40.0->streamlit>=1.50.0inpyproject.toml. Theuv.lockalready 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
widthkeyword landed for the widgets actually used here:width=introducedst.imagest.buttonst.download_buttonAnything below 1.48 will
TypeErroronst.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}.pyweb/pages/2_📚_History.pyweb/pipelines/{action_transfer,asset_based,digital_human,i2v}.pyVerified locally
ast.parseclean across all 10 modified.pyfiles (including the emoji-named2_📚_History.py).inspect.signature(st.button)["width"]/st.download_button/st.imagereturn non-emptyWidthannotation with default"content"on Streamlit 1.50.0 — confirmswidth="stretch"is a documented call shape, not just an undocumented kwarg.tests/directory and no PR-gating CI workflow (onlydocs.yml), so no test surface to update.Out of scope (intentionally)
asset_default.htmlnaming convention) — separate concern, separate PR if desired.uv.lockregeneration — left untouched. Pinned 1.53.1 already satisfies>=1.50.0. Auv lockrerun 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.