marimo icon indicating copy to clipboard operation
marimo copied to clipboard

feat: Account for state and variable type in save

Open dmadisetti opened this issue 1 year ago • 1 comments

📝 Summary

Changes the hashing to account for state, UI variables, and allows for "pure" functions / classes

Had some merge res issues, since I haven't touched this in a while, so just squashed it all.

I read over Mandala, and took a few ideas: https://github.com/amakelov/mandala/discussions/15

🔍 Description of Changes

Does this by:

  • Adding state registry
  • Doing a "primitive check" (I might remove is_pure_fn and is_pure_class until I know they are bug free)

TODO:

  • [ ] Tests
  • [ ] Other easily serializable types like numpy arrays (good tips from joblib: https://github.com/joblib/joblib/blob/bca1f4216a38cff82a85371c45dde79bed977d0e/joblib/hashing.py#L245

dmadisetti avatar Aug 10 '24 00:08 dmadisetti

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 15, 2024 4:24pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 15, 2024 4:24pm

vercel[bot] avatar Aug 10 '24 00:08 vercel[bot]

I think final TODOs:

  • [x] state registry should be attached to context instead of global
  • [x] ui registry lookup not working as intended

dmadisetti avatar Sep 03 '24 12:09 dmadisetti

Up for me:

  • [x] doc strings
  • [x] Cache cleanup
  • [ ] explicit tensor tests
  • [x] Organizing with BlockHash

Maybe registry changes? https://github.com/marimo-team/marimo/pull/1993#discussion_r1752489900

dmadisetti avatar Sep 11 '24 14:09 dmadisetti

TODOs sound good.

Maybe registry changes? #1993 (comment)

Registry changes not required in this PR.

akshayka avatar Sep 11 '24 17:09 akshayka

Are we OK adding something as large as torch or scipy to optional deps? Thoughts on what to add? Addressed everything but exploring more than numpy for tensors.

Additionally:

  • patched primitive hashing from an experimental branch,
  • also, maybe preemptively, added a meta slot for cache

dmadisetti avatar Sep 12 '24 19:09 dmadisetti

Are we OK adding something as large as torch or scipy to optional deps?

Yea, I'm okay with it. Hopefully with uv it's magically fast. If not we can find a way to make the CI more efficient, for example we could split up the optional deps into multiple groups, and run just one workflow with the tensors deps. But that's likely premature.

Thoughts on what to add?

Whatever we'd like to support should be added, I believe.

akshayka avatar Sep 14 '24 18:09 akshayka

Not sure why the FE build was stuck on pending. rebased from main to trigger CI again

dmadisetti avatar Sep 15 '24 15:09 dmadisetti

Hmm. Maybe a github bug? Looks like the action path was changed after this PR. Weird, because it's rebased. Closing out an opening new PR #2316

dmadisetti avatar Sep 15 '24 16:09 dmadisetti

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.8.16-dev1

github-actions[bot] avatar Sep 15 '24 18:09 github-actions[bot]