mystmd icon indicating copy to clipboard operation
mystmd copied to clipboard

Thebe integration: Modify sources

Open HelgeGehring opened this issue 2 years ago • 12 comments

Which area is this feature request for?

Website User Interface

Describe the feature you'd like to request

Using jupyter-book it is possible to modify the source code after activating the thebe integration. Using mystjs, it seems that I can run the examples, but not modify them (which takes away the greatest advantage of thebe)

Describe the solution you'd like

Would there be a solution to change the source code fields to edit fields like in jupyter-book once "live code" is clicked?

Describe alternatives you've considered

No response

HelgeGehring avatar Jun 27 '23 13:06 HelgeGehring

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 Jun 27 '23 13:06 welcome[bot]

Thanks @HelgeGehring for the feedback! Agree completely. :) Working hard on getting there!!

The immediate next step we are working on is to enable being able to import a figure from a notebook into an article:

  • https://github.com/executablebooks/myst-theme/pull/136

This is requiring quite a bit of rewiring of thebe in how it works with the theme, and how it keeps track of active kernels. I think that the editing is likely the next step in thebe support -- thoughts on that @stevejpurves?

rowanc1 avatar Jun 28 '23 21:06 rowanc1

Sounds great! :)

Thanks a lot!

HelgeGehring avatar Jun 29 '23 12:06 HelgeGehring

Yay, the first step seems to be done :partying_face:

Would you have a rough idea when the editing becomes a feature? This is the one thing holding me back from moving over from jupyterbook :)

Thanks a lot for the great project! :smile:

HelgeGehring avatar Aug 04 '23 00:08 HelgeGehring

+1 this would be very useful!

simbilod avatar Aug 11 '23 17:08 simbilod

@HelgeGehring thanks for the question - we're refining how thebe integrates with the base myst-theme packages and components - where there is some flakiness and edge case failures still to work though.

For example, around ipywidgets stability and how interactive outputs integrate into markdown documents -- e.g. for now that still requires power on + run, and trickily the current structure makes it difficult to do that with one click! So i think we'll need to do another pass on improving the code structure before adding more features like codemirrior + editing.

I'd like to think that we can get to it in the next couple of months though!

stevejpurves avatar Aug 14 '23 09:08 stevejpurves

Sounds great, thanks a lot!

For starting I'd already be happy to just edit the example and get new non-interactive output. To me it seems, that the current version could already do that, the only tweak which would need to be done is automatically replacing the textview by an textedit? I'd guess that'd be enough for me to switch over and then happily see new features being added :)

One other minor thing I'm thinking of (I can make a separate issue):

  • It would be great to have notebooks re-run with different parameters (i.e. one variable I set in the very beginning). Sometimes it's handy to have the same notebook run and see the output of each cell, but see the effect of one variable on all the cells. (More precisely, instead of copying a notebook and running changing just one line, I'd be super happy to have a way to set which variables I'd like to try and have the build command building all three variants of the notebook). I'd be grateful for any advice on how to achieve this :)

Besides, thanks again for the great project!

HelgeGehring avatar Aug 14 '23 21:08 HelgeGehring

@rowanc1 @stevejpurves Just wanted to ask if you have any update on this :) I'd be super happy to switch to mystmd and I think this is the last blocker for me :smile: Thanks a lot for the great project!

HelgeGehring avatar Feb 22 '24 03:02 HelgeGehring

Hey @rowanc1 @stevejpurves !

Have you any update on this feature? I would really like to also use it in one of my project :)

(Also congrats for mystmd!)

lucasgrjn avatar Mar 14 '24 02:03 lucasgrjn

The hesitance here is that the state management of notebook execution in myst-theme is essentially entwined with the react render state. There are already some undesirable effects and edge cases going on that need to be addressed and it's likely that these might be worse if we get into editable cells.

So there are two options; wait for a refactor and introduce editing after we have better state management in place -- or -- drop editing in as-is and see how it behaves, perhaps as an opt-in beta feature and then fix as we go?

stevejpurves avatar Mar 15 '24 12:03 stevejpurves

Hmm, that sounds like an annoying problem @stevejpurves :/ any rough idea when we could hope for a refactor? And when do these undesirable effects appear? For interactive content? Or what doesn't work right now?

Yeah, would be great to just give it a try and see what happens if we drop it in :) Mystmd looks amazing, and I'd be super happy to give it a try :) I really like citing things by just using the doi instead of providing a bib file! Also the integration with pyodide is really nice!

HelgeGehring avatar Mar 15 '24 16:03 HelgeGehring

The effects are intermittent and race condition like, so definitely annoying. I hit them when trying to execute a notebook "quickly" after the session has started, so hit the power button and play close together, the effect is that the cells do not execute but the spinners run. There are similar effects occasionally when navigating that need page refreshes to fix. So the issues are not that huge, but you can see the hesitating to build on that foundation.

If we try just dropping something simple in, I think there will be more feature requests pretty quickly :) to extend basic editing but maybe that helps push things along. Timing wise, 🤔 thinking...

stevejpurves avatar Mar 18 '24 09:03 stevejpurves