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

Persist App state + Cell state in md conversions #1326

Merged
merged 6 commits into from
May 7, 2024

Conversation

dmadisetti
Copy link
Contributor

@dmadisetti dmadisetti commented May 6, 2024

I got marimo edit document.md working locally and realized a few things were missing:

  • "Unparseable Cells" were dropped in conversion, now the "unparsable" flag is set on the markdown block. Empty cells were also dropped.
  • There was additional information like layout_file and width that conversion was dropping on _AppConfig
  • Cell Config was also dropped (disabled, show_code persists now)
  • Markdown cells next to each other were merged. Added a break between cells with an empty HTML comment <!---->

The actual code to get marimo edit document.md working is a bit of a hack. Once this is in, I'll open the PR for reference, but I think that it will require a deeper rework from someone more versed in the internals

Copy link

vercel bot commented May 6, 2024

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 May 7, 2024 6:00pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 7, 2024 6:00pm

@dmadisetti
Copy link
Contributor Author

Oh woops. I didn't realize |= was newer than python 3.8. Will revise once I get home


# Native to python
from xml.etree.ElementTree import Element, SubElement

# Note: yaml is also a python builtin
import yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

i might have lazy imported this, just fyi, if you are not up-to-date with main

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think in exporter, not here

Copy link
Contributor

Choose a reason for hiding this comment

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

oh thats right

```{.python.marimo unparsable="true"}
it's an unparsable cell
```

<!-- Actually markdown -->
```{python} `
Copy link
Contributor

Choose a reason for hiding this comment

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

is this also syntax i wasn't aware of? like an one-line code-fence?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No this is intentionally broken to make sure match works. The newest unit tests turned into more of smoke tests, so yeah- I think more granular tests would be awesome

Copy link
Contributor

Choose a reason for hiding this comment

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

oh gotcha, ha makes more sense

@@ -42,35 +43,60 @@ def _is_code_tag(text: str) -> bool:
return bool(re.search(r"\{.*python.*\}", head))


def formatted_code_block(code: str) -> str:
def formatted_code_block(
Copy link
Contributor

Choose a reason for hiding this comment

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

sometime this week - i may write some small unit tests for these files (as my way to learn this part of the code more)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🛳️

mscolnick
mscolnick previously approved these changes May 6, 2024
Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

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

🚢

@mscolnick
Copy link
Contributor

i can force merge past playwright - its been very flakey lately and i need to investigate

@dmadisetti
Copy link
Contributor Author

i can force merge past playwright - its been very flakey lately and i need to investigate

The python 3.8 error is valid, but I won't be able to get to it for another hour or so

@mscolnick
Copy link
Contributor

@dmadisetti there is a snapshot fail on Python 3.11 for some reason

@dmadisetti
Copy link
Contributor Author

Oh woops. Weird, that's what I run

@dmadisetti
Copy link
Contributor Author

Got it. Probably a bit of randomness. I think tempfile name gets quoted if it contains not path safe characters.

Hopefully this won't be flaky- think I caught it locally. If it is I think it makes sens to just remove the line

@mscolnick mscolnick merged commit 6421f02 into marimo-team:main May 7, 2024
25 of 26 checks passed
@mscolnick
Copy link
Contributor

thanks @dmadisetti for more great work!

Copy link

github-actions bot commented May 7, 2024

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

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.

None yet

2 participants