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

Feature request: context manager on "rest of run" #725

Open
tjltjl opened this issue Feb 2, 2024 · 0 comments
Open

Feature request: context manager on "rest of run" #725

tjltjl opened this issue Feb 2, 2024 · 0 comments

Comments

@tjltjl
Copy link

tjltjl commented Feb 2, 2024

Description

I want to start a background thread or open a persistent connection to a server. Usually, in python, the way to do these things cleanly is to use a context manager.

Suggested solution

In Marimo, what I'd like to do is basically say "run the rest of the computation within this context manager" so that if any of the descendants of a cell are run, the context is not broken but if the cell or its parents are edited, the context manager first exits and then restarts. Something like

do things
with my_background_thread():
    mo.descend()

where mo.descend only returns if this cell or its parents are edited.

Alternative

Some other way to set contexts that are torn down at the right time

Additional context

No response

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

No branches or pull requests

1 participant