Skip to content
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

Update custom-components import paths and tests #8666

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

raethlein
Copy link
Collaborator

@raethlein raethlein commented May 14, 2024

Describe your changes

Closes #8644

From this comment:
The usage of components.html via st.components.v1.html was possible prior to 1.34 due to this import: from streamlit.components.v1.components import ComponentRegistry, which made it transiently available. This means that the usage via st.components.v1.html is only possible when server.py is imported at one point, which is not the case for example when running Streamlit as a bare-script.

We have discussed this and thought about bringing the behavior back, but this time explicitly and with tests 🙂
Final decision is still pending.

Testing Plan

  • E2E Tests
    • Added new e2e test to the playwright-custom-component suite to test this import behavior. It is in an extra file in order to start with a fresh context.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@raethlein raethlein requested a review from vdonato May 16, 2024 20:27
Copy link
Collaborator

@vdonato vdonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes LGTM, but I'm guessing whether or not we want to revive this behavior (given it was an unintentional implication of how the Python module system works) ends up being on the product team to make a final decision.

If not many people are running into this, I'd lean toward not doing so given this was never supposed to be exported to begin with, but I don't have a strong opinion either way

@raethlein
Copy link
Collaborator Author

Code changes LGTM, but I'm guessing whether or not we want to revive this behavior (given it was an unintentional implication of how the Python module system works) ends up being on the product team to make a final decision.

If not many people are running into this, I'd lean toward not doing so given this was never supposed to be exported to begin with, but I don't have a strong opinion either way

fyi Vincent's opinion on this @jrieke @sfc-gh-jcarroll
What do you think the final decision should be?

@sfc-gh-jcarroll
Copy link
Collaborator

My understanding is we only saw this a couple times in the wild and it's easy to fix in a backwards compatible way inside of a given component or app.

Assuming that's true, I'm also fine to NOT revive this behavior and not merge this (and I think I have a slight preference to same). We should just make sure we fix the instances like these in the docs that refer to this now-not-functioning behavior. Unless someone else sees a good reason to keep it.

cc @sfc-gh-dmatthews thoughts?

Copy link

github-actions bot commented Jun 1, 2024

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.

@github-actions github-actions bot added the stale label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Streamlit 1.34] AttributeError: module 'streamlit.components' has no attribute 'v1'
3 participants