-
Notifications
You must be signed in to change notification settings - Fork 4k
Refine st.date_input to ensure consistent and accurate return types
#9620
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
Refine st.date_input to ensure consistent and accurate return types
#9620
Conversation
| DateWidgetReturn: TypeAlias = Union[ | ||
| date, Tuple[()], Tuple[date], Tuple[date, date], None | ||
| ] | ||
| DateTupleReturn: TypeAlias = Union[Tuple[()], Tuple[date], Tuple[date, date], None] |
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.
What do you think about calling DateTupleReturn something like DateWidgetRangeReturn to help document that this is used to specify date ranges?
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.
Yeah, Sounds good to me. It would certainly help to clearly document that this is used specifically to specify date ranges and helps with readability.
sfc-gh-nbellante
left a comment
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 for the contribution!
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Hey @pranaybattu, seems like a bunch of tests are failing. Might be worth bringing this on the latest state of develop, since it looks like some of the failures are because of pillow being pinned to <11, but on the latest develop branch we increased that limit to <12. As soon as the tests are running through, we can merge this! |
|
@jrieke seems issue with test cases, forgot to rename in tests. Updating code |
st.date_input to ensure consistent and accurate return types
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.
LGTM 👍 I applied a couple of fixes to get it through our CI.
…streamlit#9620) ## Describe your changes - refine date_input to ensure consistent and accurate return types - Added overloads to handle both single and range date inputs with specific return types - Added type tests using assert_type for various scenarios, including single dates, date ranges, formats, min/max values, disabled state, and on_change callbacks ## GitHub Issue Link (if applicable) - Closes to streamlit#9477 ## Testing Plan - Explanation of why no additional tests are needed - Unit Tests (JS and/or Python) - E2E Tests - Any manual testing needed? --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license. --------- Co-authored-by: Lukas Masuch <[email protected]> Co-authored-by: Lukas Masuch <[email protected]>
Describe your changes
GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.