Skip to content

Conversation

@dmadisetti
Copy link
Collaborator

📝 Summary

Enables the override of values into embed, allowing for birectional communication of embedded and parent apps

@vercel
Copy link

vercel bot commented Nov 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Nov 19, 2025 10:22pm

@dmadisetti dmadisetti changed the title feat: app.embded(defs={'mine': value}) feat: app.embed(defs={'mine': value}) Nov 11, 2025
Copy link
Contributor

@akshayka akshayka left a comment

Choose a reason for hiding this comment

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

Let's remove kwargs and only add it if necessary.

There is also I believe a correctness problem, see my comment.

If am down to prioritize this to unblock @zilto, but we need to make sure the correctness issue is resolved.

Comment on lines 834 to +846
if not app_kernel_runner.outputs:
outputs, glbls = await app_kernel_runner.run(
set(self._execution_order)
# Inject provided defs into the kernel's globals
if defs:
Copy link
Contributor

Choose a reason for hiding this comment

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

Today app.embed() executes the app once and then serves cached outputs thereafter.

What happens if app.embed() is called with one defs relation, then called again with another defs relation? I think as written in this PR the user will get stale results, because app_kernel_runner.outputs will be non empty.

So, I think we need to retain some kind of cache that is keyed by a tuple of (key, value) pairs in defs.

Comment on lines +1240 to +1244
# Check second result with first override - output then defs
assert "x is large" in result_override.output.text
assert "x is small" not in result_override.output.text
assert result_override.defs["x"] == 100

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@akshayka this current fails. Is this the behavior you were thinking of, or a different issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, this is an example of the incorrect logic.

#7146 (comment)

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.

3 participants