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

Alignment with mystjs #57

Closed
rowanc1 opened this issue Jan 3, 2023 · 30 comments
Closed

Alignment with mystjs #57

rowanc1 opened this issue Jan 3, 2023 · 30 comments

Comments

@rowanc1
Copy link
Member

rowanc1 commented Jan 3, 2023

I wanted to bring some visibility to a conversation @stevejpurves, @agoose77, and I had in December to discuss some possible ways to align the work here with the evolving mystjs ecosystem.

There has been a lot of work going into a javascript implementation of MyST over the last year which can now support the rich-rendering / cross-referencing that would be awesome to have directly in the editing experience in JupyterLab. There is some background about mystjs here, executablebooks/meta#838. See docs: https://js.myst.tools/ and Demo: https://myst.tools/sandbox

Currently jupyterlab-myst supports the basic markdown parsing (i.e. markdown-it plugins), but has no information about cross-cell/notebook references and limited features for reconciling citations/references/frontmatter/enumeration etc that are possible in both sphinx and mystjs.

@stevejpurves and I had a brief conversation with @agoose77 to discuss some possible ways forward to adopt more of the work that we have been putting into mystjs (parsing, enumeration, and rendering). At a Jupyter community event in Dec, @stevejpurves spun up a mirror repository (https://github.com/executablebooks/jupyterlab-mystjs) that is a different approach than the markdown-it centered approach taken in this repository. The thinking was that MyST has it's own extension ecosystem, and that it may not strictly be markdown-it in the future (e.g. reliance on unifiedjs). There are also a number of features that require global or even persisted state (e.g. references between cells) which are going to be myst-specific.

We have now gotten to a first demo/proof-of-concept of working with the full toolchain:

jupyterlab-myst

(please ignore styling, which I haven't figured out fully yet!)

This is showing some of the cross-referencing capability and callouts to other information like github code, citations, and wikipedia (see docs on external references and hover-cross-references).

Over the next month we will continue to push in the other repository to get that up to parity with the existing implementation here, and ideally (at least what we discussed with @agoose77) figure out a way to bring the two threads together in ~February - that might look like a major version bump here or some other way forward.

Super excited about the progress and showing off the mystjs work off in new ways, and hoping it can all come together soon! 🚀

cc @choldgraf @fperez, I will also give an update on this at the team meeting tomorrow:

@welcome
Copy link

welcome bot commented Jan 3, 2023

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

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! 🎉

@rowanc1
Copy link
Member Author

rowanc1 commented Jan 10, 2023

Some updates! I have done most of the pulling out and am getting things into a state to be pushed. I am really liking the experience so far, a bit of a gif below:

jupyterlab-myst-frontmatter

As a part of this I am also significantly cleaning up the UI components, which need to be packaged differently for JuptyerLab. Taking the chance to add some extra-things around creating demos and showcases so that-- in the future, people can mix and match these pieces.

image

@agoose77
Copy link
Collaborator

This is honestly stunning.

Not sure where this fits into the idea of a MyST-for-notebooks distribution, but Notebooks obviously benefit from executable content. I have two thoughts (probably both long-term).

  1. It would be nice if there were a way to plug-into the document rendering to provide expression interpolation (like we currently have in jupyterlab-imarkdown 🤮). Jupyter Book renders JupyterLab MIME bundles, so that's the interface I'd expect here; it's fairly well known and used among different frontends (with varying degrees of support, of course). As you've probably observed, JupyterLab is built from a collection of extensions that interoperate. I'm thinking that expression rendering would be a separate extension that provides the necessary interface for the core MyST extension, ie. IExpressionRenderer.
  2. I wonder whether it would be in-scope to support cell-metadata-driven figures. Right now, these are invisible in jupyterlab-myst because we try not to be too clever. However, maybe the cell output renderer could be modified to check for MyST metadata, and properly render the figure. That said I'm fairly certain that would be non-trivial amounts of work.

@chrisjsewell
Copy link

Looking cool @rowanc1 👍
definitely +1 that markdown-it (or whatever Markdown parser) should be "hid" as an implementation detail

@stevejpurves
Copy link
Contributor

stevejpurves commented Jan 11, 2023

@agoose77

"cell-metadata-driven figures"

I'm not sure what these are exactly... is this cell metadata defining a figure label & caption, that gets associated with the [code] cell output and rendered "around" it? or is that something else?

@agoose77
Copy link
Collaborator

agoose77 commented Jan 11, 2023

One can modify the cell metadata with a mystnb key, e.g.

"mystnb": {
 "figure": {
  "caption": "A 3D model of the detector, with ....",
  "name": "detector-3d"
 },
 "image": {
  "align": "center",
  "alt": "A time-projection-chamber detector with a MicroMeGAS anode and array of silicon detectors surrounding the exterior of the active volume.",
  "width": "512px"
 }
}

such that the code-cell outputs are embedded in a figure. It's a Jupyter Book feature, but I think some of these are in-scope for this project (even though I never got around to them!)

In jupyterlab-myst, this would require modifying the output renderer to perform this decoration

@choldgraf
Copy link

choldgraf commented Jan 11, 2023

I think we should definitely start to leverage cell (and notebook) metadata to control behavior.

My main concern is that the UI/UX in JupyterLab around this is really bad. I much prefer writing YAML configuration via myst-nb text notebooks, but that requires too many extra steps w/ jupytext etc. I think that if we want to move in this direction, we should:

  • State this as a strategic goal for development
  • Note the challenges we need to overcome (e.g., hand-editing JSON is not acceptable long-term)
  • Make it minimally possible to control behavior via cell metadata, so people have an incentive to do this
  • Then focus some time on improving the UX for cell metadata to make it easier for people to do something they want to do
  • After that's done we can try to refine and improve cool things you can do with cell metadata.

@agoose77
Copy link
Collaborator

Let me start by acknowledging that we definitely need to avoid feature creep; read my discussions as high-level ambitions rather than first deliverables.

@choldgraf are you attending the notebook format workshop? I mentioned to @rowanc1 and @chrisjsewell that I was hoping (but unsure) to attend, but my calendar is incompatible with the dates 😢. I think the importance of cell metadata relates to the notebook format, so it might be worth keeping in mind for those who are attending?

Notebook metadata editing is notoriously bad. JupyterLab has added a JSONSchema-derived UX for settings management, I wonder whether the next logical extension is for JupyterLab extensions to be able to declare a metadata schema (and JupyterLab provides the UX for free? A short-term improvement would be e.g. a front-end extension that adds a YAML view over the cell metadata. To make it slightly less painful ! I'll look into this topic. It's a broader problem than MyST.

@chrisjsewell
Copy link

I'm not sure what these are exactly.

https://myst-nb.readthedocs.io/en/latest/configuration.html#cell-level-configuration
https://myst-nb.readthedocs.io/en/latest/render/format_code_cells.html

@choldgraf
Copy link

Notebook metadata editing is notoriously bad. JupyterLab has added a JSONSchema-derived UX for settings management, I wonder whether the next logical extension is for JupyterLab extensions to be able to declare a metadata schema (and JupyterLab provides the UX for free? A short-term improvement would be e.g. a front-end extension that adds a YAML view over the cell metadata. To make it slightly less painful ! I'll look into this topic. It's a broader problem than MyST.

I think "a quick way to see and edit cell metadata as YAML" is definitely low-hanging fruit to try. I've wanted this for years haha (as much as YAML annoys me...)

are you attending the notebook format workshop

probably not - it coincides with the expected birth date of my second child :-D .

I would strongly urge you to request that the workshop discussions be available in an asynchronous fashion so that you can participate. I think that you (and others in the EB community) have a unique perspective on this because I suspect the tools in this community are making more use of cell-level data than most other tools that exist.

@stevejpurves
Copy link
Contributor

stevejpurves commented Jan 11, 2023

I am attending that workshop @agoose77 (and would bee very happy to prep with you to get all points across/represented) - @fcollonval is heading up the organisation I believe? and I think there is a virtual component/option??

on mystnb thanks for explaining, I wasn't aware.

One point that came up in earlier conversations was should figure support be integrated further down the stack, i.e. should there be an IPython.display.Figure that pulls the label, caption and figureness down into the output rather than it being a side effect in cell metadata?

and 👍🏼 the Jupyterlb metadata editing experience -- although that is something can be maybe improved in the lab or an extension created to improve that? (ops as people have said, YAML view would be one option -- some dedicated key/value editing UI perhaps a step further?)

@agoose77
Copy link
Collaborator

and would bee very happy to prep with you to get all points across/represented)

I will take you up on that!

i.e. should there be an IPython.display.Figure that pulls the label, caption and figureness down into the output rather than it being a side effect in cell metadata?

Yes, I wondered about this too. This should be fairly easy; we can use the same schema subset of the MyST format. That said, I don't think these are mutually exclusive ­— having the figure metadata defined "statically" (i.e., not in code that must be executed) is probably a useful thing, and would afford a nice UX.

although that is something can be maybe improved in the lab or an extension created to improve that?

Yes, this is 100% out of scope for jupyterlab-myst: we can author this separately, or upstream into JupyterLab.

@chrisjsewell
Copy link

One point that came up in earlier conversations was should figure support be integrated further down the stack, i.e. should there be an IPython.display.Figure that pulls the label, caption and figureness down into the output rather than it being a side effect in cell metadata?

that would certainly be nice, but this is obviously only a solution for Python kernels, ideally "Jupyter stuff" should be kernel agnostic

@chrisjsewell
Copy link

I think "a quick way to see and edit cell metadata as YAML" is definitely low-hanging fruit to try. I've wanted this for years haha (as much as YAML annoys me...)

or TOML, ... lol, but yeh it feels like this should be pretty simple to implement in Jupyter, as React component or whatever

@agoose77
Copy link
Collaborator

that would certainly be nice, but this is obviously only a solution for Python kernels, ideally "Jupyter stuff" should be kernel agnostic

Oh, I refer to using the display-data mechanism, which is kernel agnostic. I know that xeus-cling actually defines a display API that users can invoke, but I am not sure how widespread this is in other kernels; some more primitive implementations might only cover primitive repl.

@agoose77
Copy link
Collaborator

Lol, talk about poor Google-fu ... jupyterlab/jupyterlab#13056

@stevejpurves
Copy link
Contributor

ok -- so that's maybe in the 3.6rc0 that was released a few days ago!

@rowanc1
Copy link
Member Author

rowanc1 commented Jan 12, 2023

First live prototype is here:

https://mybinder.org/v2/gh/executablebooks/jupyterlab-mystjs/myst-theme?urlpath=lab

If you go to examples folder, and then open the notebook in there can reproduce the screenshot above!

@choldgraf
Copy link

@rowanc1 I don't believe the branch is published, you could double check the link?

@agoose77
Copy link
Collaborator

@choldgraf
Copy link

It works! Wow that is so damn cool.

chrome_zX7EgQBcpP

@rowanc1
Copy link
Member Author

rowanc1 commented Feb 10, 2023

From the top of the issue, we are surprisingly right on track! 🚀

figure out a way to bring the two threads together in ~February - that might look like a major version bump here or some other way forward.

@agoose77 and I just got off a call and we are planning to bring the two repositories together today and release a major version tomorrow. This allows us to have this in place before the announcement post and clean up that paragraph talking about the two repositories. Our thinking is that this will clean up any user confusion, and put all our focus on improving the next version.

Tasks following through on this that I will complete over the next hour or so:

Tomorrow:

  • test
  • work with @agoose77 on any outstanding pieces
  • release major version under jupyterlab-myst

Monday:

@fperez
Copy link
Contributor

fperez commented Feb 10, 2023

Congrats and a huge amount of thanks to @rowanc1 @agoose77 @stevejpurves & team for all this!! I'm so excited about this, and will be providing a ton of feedback as I continue using it in production with my students this term.

Beautiful job, excited and grateful 🎉 ❤️

@rowanc1
Copy link
Member Author

rowanc1 commented Feb 10, 2023

Thanks @fperez, I am stoked that this has merged with the original project! A few things to get back to in the next few weeks including another pass at resurrecting inline execution (#72). Had a really good chat with @agoose77 about that today!

To our early users/beta testers @mcauthorn @nthiery @fperez @stevejpurves @fwkoch @mmcky @choldgraf @echarles, thanks so much for your help so far in the jupyterlab-mystjs repository! We would love your continued help as we push on this implementation in it's new home jupyterlab-myst (no js at the end!). 🎉

We have deprecated and archived jupyterlab-mystjs, but not yet released the next major version -- that will happen hopefully tomorrow and then a blog post by @choldgraf going out on Monday mentioning this and many other new things in the myst world!

We would appreciate help in spreading the word, it is also international Love Data Week, so all very appropriate. ❤️ 🚀

@mcauthorn
Copy link

Congrats on the rapid progress! I'm happy to take a look at the new extension, as I see a ton of potential here.

@agoose77
Copy link
Collaborator

@rowanc1 LGTM! I think we're ready for release.

@rowanc1 rowanc1 mentioned this issue Feb 11, 2023
@rowanc1
Copy link
Member Author

rowanc1 commented Feb 13, 2023

Hi all -- this has been released as v1.0.0 of jupyterlab-myst -- we announced it on a twitter and mastodon would love help boosting the visibility of this extension over the coming months! Lots of plans to make it even better, so please keep the bug reports rolling in.

I am going to close this issue now that the merge is complete. 🚀

@fperez
Copy link
Contributor

fperez commented Feb 13, 2023

🎉 huge congrats and ❤️ to everyone who got us here!

I'm super excited about where this goes next - I see enormous opportunity, esp. in tandem with the great new RTC machinery, that opens a path for a lot of new collaborative experiences with the Jupyter tools.

I'll do my part to continue dog-fooding, providing input, and signal-boosting this. Fantastic work, team!

@fperez
Copy link
Contributor

fperez commented Feb 13, 2023

BTW, quick note - any reason why the 1.0.0 tag isn't currently listed in the releases?

image

(I see it fine on PyPI, but it's odd that the tag isn't on GH. Did someone forget a git push --tags somewhere?

@rowanc1
Copy link
Member Author

rowanc1 commented Feb 13, 2023

I have added the release here, thanks for the reminder! We will do better with release notes in the future now that we are all in the same repository.

I think that there is a blog post in our future as well @agoose77. :)

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

No branches or pull requests

7 participants