-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve typing annotations for file_uploader and text_input #6371
Conversation
@schaumb Thanks for improving our typing :) Our Python tests are failing since One additional small suggestion, maybe we can update the docstring here from |
Thanks @lukasmasuch for the review. I replaced |
@schaumb Seems like the internal function https://github.com/streamlit/streamlit/actions/runs/4547249875/jobs/8017434164?pr=6371#step:10:17 You can see an example for casting in some of our other widgets, e.g.: streamlit/lib/streamlit/elements/slider.py Line 630 in a87132b
|
Thanks again @lukasmasuch I resolve this issue too. |
Oh, I think I was actually wrong here. Python does already know about the type of And I think you can actually replace |
Done @lukasmasuch |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM 👍
* develop: StreamlitEndpoints.buildAppPageURL (streamlit#6386) Rename query param ?testing to ?_stcore_testing (streamlit#6392) supress warning when call `get_script_run_ctx` from `gather_metrics` decorator (streamlit#6384) Improve typing annotations for file_uploader and text_input (streamlit#6371) Add support for Pandas 2.0 (streamlit#6378) Remove UriUtil.buildMediaUri (streamlit#6379) Allow pytest unit test to be discoverable via IDE v2 (streamlit#6374) Allow session state to only allow serializable items (streamlit#6165)
…t#6371) * Add text_input 'type' parameter type hints * Add file_uploader return value type hint * Add missing import * Enable any sequence on `file_uploader` type * Replace NoneType to None * Change `text_input` "type" parameter docstring * Add `file_uploader` return cast * Add type hint and cast to `_file_uploader` * Update file_uploader.py * Fix import
…t#6371) * Add text_input 'type' parameter type hints * Add file_uploader return value type hint * Add missing import * Enable any sequence on `file_uploader` type * Replace NoneType to None * Change `text_input` "type" parameter docstring * Add `file_uploader` return cast * Add type hint and cast to `_file_uploader` * Update file_uploader.py * Fix import
…t#6371) * Add text_input 'type' parameter type hints * Add file_uploader return value type hint * Add missing import * Enable any sequence on `file_uploader` type * Replace NoneType to None * Change `text_input` "type" parameter docstring * Add `file_uploader` return cast * Add type hint and cast to `_file_uploader` * Update file_uploader.py * Fix import
…t#6371) * Add text_input 'type' parameter type hints * Add file_uploader return value type hint * Add missing import * Enable any sequence on `file_uploader` type * Replace NoneType to None * Change `text_input` "type" parameter docstring * Add `file_uploader` return cast * Add type hint and cast to `_file_uploader` * Update file_uploader.py * Fix import
📚 Context
Complete some python typing annotation
What kind of change does this PR introduce?
🧠 Description of Changes
Add typing information for
file_uploader
not overloaded versionReplace
text_input
functiontype
argument annotation fromstr
toLiteral
Revised:
.
Current:
.
🧪 Testing Done
🌐 References
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.