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

Make Tag objects usable as context managers #76

Merged
merged 4 commits into from
Dec 12, 2023
Merged

Conversation

jcheng5
Copy link
Collaborator

@jcheng5 jcheng5 commented Dec 8, 2023

When used as a context manager, upon exit, the tag displays itself.

TODO: Currently, the tag just appends its "children" to itself. This is probably too simplistic. We need to decide how this code, Shiny Express's top-level, and @display_body/@render.display go from sys.displayhook to UI, hopefully in a unified way.

Note: CI tests are failing because I intentionally left a type error in 👆 part of the code.

When used as a context manager, upon exit, the tag displays itself.
@jcheng5 jcheng5 requested a review from wch December 8, 2023 23:47
@jcheng5
Copy link
Collaborator Author

jcheng5 commented Dec 8, 2023

Ideally I'd want to use IPython.core.display but that seems like a heavy dependency to take, if we can get 95% of the way by doing something simpler in htmltools/shiny.

htmltools/_core.py Outdated Show resolved Hide resolved
htmltools/_core.py Outdated Show resolved Hide resolved
@wch wch merged commit 9587466 into main Dec 12, 2023
16 checks passed
@wch wch deleted the tag-context-managers branch December 12, 2023 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants