-
Notifications
You must be signed in to change notification settings - Fork 84
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
Change the metadata we use to check for "is a myst markdown notebook" #214
Comments
How would you still use jupytext, without jupytext metadata? Also this would make these files incompatible with binder/jupyterhub. It may be possible to change the metadata that jupytext uses to identify myst notebooks, but obviously this must be first done upstream in that repo |
Well I believe that jupytext can be run on any file if you call the input / output explicitly. E.g. in a markdown file like:
and then run then it works fine. If you then add metadata about the kernel like
Then it also adds the kernel metadata to the resulting ipynb file. good point about making it incompatible with binder/jupyterhub - though that's something we can always document "if you want auto-opening in jupyterhub, you need to add jupytext metadata". tbh I feel like the minimal thing that should be needed is just a kernel name in the metadata, rather than the full kernelspec - that's something that I think most people can remember rather than requiring them to look it up or use a helper function like |
Only using kernelspec would not distinguish it from other jupytext markdown formats though. So there may be scope to also add Note I already want to "refresh" how myst markdown is parsed in jupytext: mwouts/jupytext#556 (comment), it would be ideal if the approach in this repo was similar to that |
I guess the main confusion currently faced by users of myst markdown with jupytext, is that jupytext defaults to using the jupytext markdown format if there are any issues with the myst metadata with not much warning |
yeah - mostly I am just trying to make the "minimal number of steps to making a myst markdown notebook" as short as possible. The ideal would be for people to just open a text editor and start writing MyST Notebook Markdown. A slightly more cumbersome approach is to require |
Hi @chrisjsewell , @choldgraf , well that is an interesting question! I came to the same issue myself when I wanted to write a test I think I have a fix for the jupytext part of the question at mwouts/jupytext@535766f . With this, Jupytext will correctly recognize a The approach that I have used there is the following: does metadata.get("jupytext", {})
.get("text_representation", {})
.get("format_name")
== "myst" We can of course change that. Maybe indeed we can distinguish between MyST-Markdown and Jupytext-Markdown documents based on whether a |
Currently we check for
jupytext
metadata in order to decide if a markdown file is a "myst markdown notebook":MyST-NB/myst_nb/converter.py
Line 65 in 9f88924
I think that this is sub-optimal for two reasons:
I wonder if we could instead change the definition of a "MyST Markdown Notebook" to be either:
myst-notebook: true
in the header.kernelspec:
section in the header.Then we could still use jupytext to convert to
ipynb
at build time, but we don't need to use the full Jupytext metadata to trigger it.What do folks think?
The text was updated successfully, but these errors were encountered: