thebe icon indicating copy to clipboard operation
thebe copied to clipboard

Running immutable code

Open stevejpurves opened this issue 4 years ago • 4 comments

The current use case for thebe is to allow a kernel to attach to and run code that is editable. This is reflected in how there works with any data-executable= cell being converted to a code mirror editor instance.

Instead, we'd like first-class support probable set via configuration options, that allows thebe to execute static immutable code, and to even have that code hidden / not visible on the page and output from its execution to still be displayed.

We've not really considered any other options or how to implement this at this stage, but this came up as a suggestion during the discussion here: https://github.com/executablebooks/thebe/issues/263

Needs to explore some options of how this might work and what the UI would be like when no code blocks were visible.

stevejpurves avatar Jul 19 '21 10:07 stevejpurves

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Jul 19 '21 10:07 welcome[bot]

ok part of this is already exposed in the configuration via:

codeMirrorConfig: {
    readOnly: true
}

stevejpurves avatar Jul 19 '21 21:07 stevejpurves

yeah my thinking here is that for this kind of thing, we want to follow pre-existing Jupyter standards wherever possible in terms of metadata. What have other applications built on top of notebooks used for marking cells as read-only?

For more advanced things like hiding code etc, I have tended to do this at the downstream dependency level (e.g. with Jupyter Book rather than in Thebe, to avoid complexity here). But I'm open to discussing whether that functionality could/should be in thebe if it will be a very common use-case.

choldgraf avatar Jul 20 '21 06:07 choldgraf

In the LibreTexts plugin we have for thebe integration we have an option for hiding the code and only showing the output, so book authors can use code to generate figures but may not want code in the book page for the readers. Our implementation only preserves static outputs from cells, as the kernel isn't connected in that option.

So, this is something useful to users but can be down downstream as @choldgraf mentions.

moorepants avatar Jul 20 '21 08:07 moorepants