diff --git a/README.md b/README.md index fe4fece0..7d349983 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,14 @@ Images and real-life data make text more engaging and powerful, but be sure what you use is appropriately licensed and available. Here again, even a rough idea for artwork can be polished by others. +The NumPy tutorials are a curated collection of +[MyST-NB](https://myst-nb.readthedocs.io/) notebooks. These notebooks are used +to produce static websites and can be opened as notebooks in Jupyter using +[Jupytext](https://jupytext.readthedocs.io). + +> __Note:__ You should use [CommonMark](https://commonmark.org) markdown +> cells. Jupyter only renders CommonMark. + ### Why Jupyter Notebooks? The choice of Jupyter Notebook in this repo instead of the usual format @@ -42,20 +50,25 @@ used in the main NumPy documentation has two reasons: * Jupyter notebooks are a common format for communicating scientific information. + * Jupyter notebooks can be launched in [Binder](https://www.mybinder.org), so that users can interact + with tutorials * rST may present a barrier for some people who might otherwise be very interested in contributing tutorial material. #### Note -You may notice that some of our content is in markdown format (`.md` files). -This is part of an ongoing restructuring of the repository workflow. However, -you can still submit your content as a Jupyter Notebook file. +You may notice our content is in markdown format (`.md` files). We review and +host notebooks in the [MyST-NB](https://myst-nb.readthedocs.io/) format. We +accept both Jupyter notebooks (`.ipynb`) and MyST-NB notebooks (`.md`). If you want +to sync your `.ipynb` to your `.md` file follow the [pairing +tutorial](content/pairing.md). ### Adding your own tutorials If you have your own tutorial in the form of a Jupyter notebook (a `.ipynb` file) and you'd like to add it to the repository: + #### Create an issue Go to [https://github.com/numpy/numpy-tutorials/issues](https://github.com/numpy/numpy-tutorials/issues) @@ -71,8 +84,6 @@ your content consistent with our existing tutorials. #### Upload your content -Remember to clear all outputs on your notebook before uploading it. -
json .ipynb |
+MyST-NB .md |
+
|---|---|
| + +```json +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This code calculates 2+2 and prints the output" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = 4\n" + ] + } + ], + "source": [ + "x = 2 + 2\n", + "print('x = ', x)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} +``` + + | + ++ +```` +--- +jupytext: + formats: ipynb,md:myst + text_representation: + extension: .md + format_name: myst + format_version: 0.12 + jupytext_version: 1.6.0 +kernelspec: + display_name: Python 3 + language: python + name: python3 +--- + +This code calculates 2+2 and prints the output + +```{code-cell} ipython3 +x = 2 + 2 +print('x = ', x) +``` +```` + | +
+
+
+ jupytext --set-formats ipynb,myst notebook.ipynb
+
+ Then, update either the MyST markdown or notebook file:
+
+ jupytext --sync notebook.ipynb
+
+