tilman
tilman8mo ago

Hide cells

I am just starting using Marimo and I love it. I'd like to use it as an interactive "Learn Python"-worksheet. Is there a way to hide some code completely (e.g. test cases) ? Some kind of "student view" where certain blocks are inaccessible or run in the background but other blocks are still editable?
3 Replies
Myles Scolnick
Myles Scolnick8mo ago
You can hide the code in the action menu, but it doesn’t hide the cell, and the student could unhide it. We also have early support for composition and something we want to continue to build. So you could import your notebook from another notebook (eg have the student view and then import that into your view). You can also import the notebook into a normal Python file as well to run tests against. It’s definitely a use case we want to support better, so your feedback is helpful
tilman
tilmanOP8mo ago
Thank you Myles. I think a hidden cell at the end of a document is a good enough solution for now. I don't mind if students can unhide it to explore how it works as soon as it does not confuse them. Regarding composition, I think I'll have to wrap my head around the fact that notebooks are simply .py-files. Automatically grading student solutions is really easy when I can import the submitted solution files...
Myles Scolnick
Myles Scolnick8mo ago
yep - there is some useful things you can do there. you are able to name a cell (either Command Palette or Cell action menu). once you do, you can import it. so you could have a cell called solution and your grader python file just grabs that cell and runs it. Here is the API for a cell: https://docs.marimo.io/api/cell.html#cell