-
Notifications
You must be signed in to change notification settings - Fork 4k
Migrate spinner to a Mixin #12829
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
Migrate spinner to a Mixin #12829
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
📉 Frontend coverage change detectedThe frontend unit test (vitest) coverage has decreased by 0.0000%
✅ Coverage change is within normal range. |
1af2b5d to
cd702ac
Compare
fd2949a to
a08f533
Compare
d65e147 to
db19d8c
Compare
25fb3a2 to
ab774d5
Compare
📈 Python coverage change detectedThe Python unit test coverage has increased by 0.0003%
✅ Coverage change is within normal range. Coverage by files
|
db19d8c to
3c58aef
Compare
ab774d5 to
ce454a9
Compare
3c58aef to
5c773b0
Compare
0879ec2 to
4f097c8
Compare
98489a8 to
9733c23
Compare
4f097c8 to
fd93002
Compare
901f681 to
a48d051
Compare
fd93002 to
3f00766
Compare
a48d051 to
652f605
Compare
3f00766 to
2df50ee
Compare
652f605 to
79af71b
Compare
2df50ee to
01f5182
Compare
01f5182 to
de9041b
Compare
79af71b to
4230417
Compare
📈 Significant wheel size change detectedThe wheel file size has increased by 11.37% (threshold: 0.25%)
Please verify this change is expected. |
| # basically like auto-setting "show_spinner=False" on the @st.cache decorators | ||
| # on behalf of the user. | ||
| is_nested_cache_function = in_cached_function.get() | ||
| import streamlit as st |
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.
I believe there is was some reason why its cleaner/better to use the delate generator singleton in these situations instead of importing the main st namespace within our commands, e.g.:
from streamlit.delta_generator_singletons import get_dg_singleton_instance
get_dg_singleton_instance().main_dg.spinner(...)
``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.
Do I need to worry about the following:
with st.sidebar:
@st.cache_data(....)
def ...This would put the spinner on the main area, right?
Or maybe I am getting confused with the Delta Generator. Let me test
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.
Alright, tested and it works. I'll update.
| # raised by Apache Spark if we do not collect dataframe before | ||
| # using `st.cache_data`.) | ||
| if is_unevaluated_data_object(computed_value): | ||
| from streamlit import type_util |
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.
question: Whats the reason why this is moved to lazy-loading?
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.
I'm not sure anymore. I'll revert.
4230417 to
fc88b4d
Compare
de9041b to
ba10df4
Compare
ba10df4 to
e4daf07
Compare
3ba5eb9 to
c7891e9
Compare
e4daf07 to
44dff07
Compare
44dff07 to
04ad86f
Compare
04ad86f to
406d68b
Compare

Describe your changes
Refactored the
spinnerfunction to be a mixin class method instead of a standalone function. This change follows the pattern used for other Streamlit elements, making the codebase more consistent.Key changes:
SpinnerMixinclass inelements/spinner.pyDeltaGeneratorclass__init__.pyto expose the spinner function from_maininstead of directly from the elements moduleGitHub 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.