-
-
Notifications
You must be signed in to change notification settings - Fork 203
Contribute MyST-NB with jupytext #48
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this, @cooperrc ! I left some suggestions about MyST mainly noting that MyST markdown is the format and MyST-NB is a tool. I wonder if we should add a note about not using MyST directives in the notebook so we avoid the trouble that @a-elhag went through with his first tutorial - can you help here, Al?
@melissawm corrected my mistake: MyST-NB is a program while MyST Markdown is the file. also caught a few typos. Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
It might help to update the "Learn to write a NumPy tutorial" with the best practices for pairing, common mark, and other general advice (like using docs/stable links). I think if we keep the README limited to just a few how-to steps it will be easier to reference for a new contributor. @melissawm and @a-elhag, would updating Learn to write a NumPy tutorial fit within this PR? or should we keep all of this advice in the README? |
My first time writing a tutorial I thought that since you can go from Jupyter Notebook -----> Myst Markdown flawlessly, then it should logically work in the reverse direction too Myst Markdown -----> Jupyter Notebook. To add on to what @melissawm and @rossbar said, for the front page I think it would be best to not go into too much detail about the flavour of markdown, at least for the main README.md. @cooperrc What do you think of making the front page one just for .ipynb to .md and/maybe as little details as possible about .md to ipynb. And an additional How to write NumPy tutorials in the Command Line document linked where you can go into more details about the particulars of setting up Myst Markdown? |
I like the approach of possibly leaving a more advanced workflow for users who wish to deal with that. This could be a separate document or live at the end of the readme (though personally I would prefer a shorter readme) |
I agree - I don't think we should be making any recommendations about tooling or workflow. There's a ton of flexibility (sphinx-based, nbconvert-based, jupytext-based, vscode plugins, etc.) and I think users need to find what's right for them. |
I'll simplify the steps and remove the MyST-NB/MyST markdown/etc. discussions. I agree with the consensus here: keep it simple. To @rossbar's point, there are a lot of different workflows that people can use, so its better to leave it up to the user. One lingering question though: What is the final format we want to review?
If we just want users to submit markdown, then I don't think we need much of a discussion. If we want users to submit MyST markdown, it helps to at least give a potential workflow (and mention that there are plenty of other methods). Jupytext plugin recognizes both headers and will allow you to open both |
Could you clarify what you mean here? We currently have the |
Yes, that was not clear. In the markdown format, code cells are formatted as
These cells do not get executed by The myst markdown uses
|
Gotcha, thanks for the clarification. For I would expect this not to be too much of a problem as |
Ok. How about this:
The readme can mention uploading ipynb files and include a short optional step ("If you have jupytext installed, you can download your notebook as myst markdown and submit that in your PR"). The only problem with that is that notebooks and .md files live in separate folders so this might lead to user error, but I don't think those would be too much of a problem (I'm not expecting to see hundreds of PR's to this repo :)) |
Sounds good to me! - I had always envisioned reviewers assuming the burden of converting to myst markdown since it's unlikely that authors would be familiar with it and it should be super easy for authors to submit |
If you fork the repo, would the CI convert for you? The reason I ask is that the CI could do a jupytext --set-formats ipynb,myst notebook.ipynb # Turn notebook.ipynb into a paired ipynb/myst notebook
jupytext --sync notebook.ipynb # Update whichever of notebook.ipynb/notebook.md is outdated That way the user/reviewer can update in either format. That's why I had added the discussion of pairing in the README. |
Ah, ok - I think I'm finally grasping the context I was missing! The workflow I've been advocating for assumes that the .ipynb -> myst conversion happens only once (if necessary) on PR submission. I had assumed that all subsequent review/authoring would be done in md format. This was one of the main motivations for using the md-based notebook format rather than .ipynb (so that the diffs would be sensible, and things like the github suggestion feature work work). So to summarize, this workflow looks something like:
This workflow makes an assumption that the original authors will be comfortable making edits in the md-based notebook format rather than |
:) Probably on me for not being clear.
This workflow makes sense. The only part is what happens to the
We don't need the |
Yup, the original jupytext --from notebook --to myst tutorial.ipynb
rm tutorial.ipynb Thus (as soon as we're done with the PRs converting existing material to this workflow, see #44, #47, #49) there will be no |
Nice, can we remove any failed checks due to outputs still being included? Is it possible to ignore the |
the last commit moved most of these changes to a new tutorial: I link to the tutorial in the README so a user can find the information if they are so inclined. Now, the README has two messages: we review in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cooperrc - thanks for the patience! Here are my comments, all minor - thanks for doing this, I think this makes it all much clearer, even for me!
tutorials. Now you can work in either a simple text editor like VIM | ||
or emacs or continue building notebooks in your browser. Jupytext can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nit: I think some people may object to your suggestion of vim or emacs as simple text editors :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha!
simple text editor as opposed to a simple text editor.
This was a conversation I first had in grad school: vim/emacs are editors for simple text i.e. ASCII characters. I would agree, they are not simple.
Maybe cut out the simple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the last change before we merge this; I'd suggest something like plain text editor.
Great catches from Melissa. I think its much clearer. Last _nit:_ is the reference to vim/emacs as "simple text editors" should we change to vim/emacs as text editors? Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Let's merge this and if we think we need to do more, this can be done in a follow-up. Thanks again, @cooperrc ! |
Thanks @melissawm! This semester has not had much free time for my FOSS work. Looking forward to getting back to it come May timeframe. This merge will definitely help users, we can fine tune it later. |
@melissawm, I have added a short description in the README using Jupytext to convert or pair notebooks to the desired MyST-NB format.
This PR also includes 2 more gifs for pairing in the classic notebook and jupyterlab.
We should also update the "file upload" gif to a
.md
upload.