Get help from the marimo community

Updated 4 weeks ago

lazy downloads?

At a glance
Can the data for a download button be "computed when needed", i.e., only once the user clicks the button? Currently I have
Plain Text
mo.download(
        data=expensive_function_generating_the_data(),
    )

which means expensive_function_generating_the_data is called already when the button is created. Instead, I'd prefer something like
Plain Text
mo.download(
        data=expensive_function_generating_the_data,
    )

where the function would only generate / provide the data when the button is actually clicked, as not the output expensive_function_generating_the_data() is passed to the data keyword, but the function handle expensive_function_generating_the_data.

I know that this currently does not match the signature of mo.download, but is there a way to work around this?
M
B
2 comments
It currently does not. But that is somewhat an oversight, can you file a Feature request, we can add that this week
Wow, that's a very positive and impressive response. Many thanks, will make the request on github.
Add a reply
Sign up and join the conversation on Discord