diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b999e43e..8cf61b07 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,7 @@ jobs: tests: strategy: + fail-fast: false matrix: os: [ubuntu-latest] python-version: [3.6, 3.7, 3.8] diff --git a/docs/conf.py b/docs/conf.py index f88e8702..890f6652 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -61,6 +61,7 @@ "repository_branch": "master", "use_edit_page_button": True, "path_to_docs": "docs/", + "show_navbar_depth": 2, } intersphinx_mapping = { @@ -96,10 +97,13 @@ execution_show_tb = "READTHEDOCS" in os.environ execution_timeout = 60 # Note: 30 was timing out on RTD -myst_admonition_enable = True -myst_amsmath_enable = True -myst_html_img_enable = True -myst_deflist_enable = True +myst_enable_extensions = [ + "amsmath", + "colon_fence", + "deflist", + "dollarmath", + "html_image", +] myst_url_schemes = ("http", "https", "mailto") panels_add_bootstrap_css = False diff --git a/docs/examples/basic.md b/docs/examples/basic.md index 9e331bef..f7b9de56 100644 --- a/docs/examples/basic.md +++ b/docs/examples/basic.md @@ -30,9 +30,13 @@ See the [MyST configuration options](myst:intro/config-options) for the full set To build documentation from this notebook, the following options are set: ```python -myst_admonition_enable = True -myst_amsmath_enable = True -myst_html_img_enable = True +myst_enable_extensions = [ + "amsmath", + "colon_fence", + "deflist", + "dollarmath", + "html_image", +] myst_url_schemes = ("http", "https", "mailto") ``` @@ -47,7 +51,7 @@ For example, here's the MyST-NB logo: ![myst-nb logo](../_static/logo.png) -With the `myst_html_img_enable=True` ([see here](myst:syntax/images)), you can even add HTML img tags with attributes: +By adding `"html_image"` to the `myst_enable_extensions` list in the sphinx configuration ([see here](myst:syntax/images)), you can even add HTML `img` tags with attributes: ```html logo @@ -70,7 +74,7 @@ It was generated with this code ([as explained here](myst:syntax/admonitions)): ::::: -If you wish to use "bare" LaTeX equations, then you should set `myst_amsmath_enable = True` in the sphinx configuration. +If you wish to use "bare" LaTeX equations, then you should add `"amsmath"` to the `myst_enable_extensions` list in the sphinx configuration. This is [explained here](myst:syntax/amsmath), and works as such: ```latex diff --git a/docs/examples/custom-formats.Rmd b/docs/examples/custom-formats.Rmd index a43afe7f..3d37c215 100644 --- a/docs/examples/custom-formats.Rmd +++ b/docs/examples/custom-formats.Rmd @@ -71,7 +71,7 @@ nb_custom_formats = { ``` :::{important} -For full compatibility with `myst-nb`, `jupytext>=1.6.0` should be used. +For full compatibility with `myst-nb`, `jupytext>=1.8.0` should be used. ::: For example: diff --git a/myst_nb/__init__.py b/myst_nb/__init__.py index c3763926..c0e2178f 100644 --- a/myst_nb/__init__.py +++ b/myst_nb/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.10.1" +__version__ = "0.11.0" from collections.abc import Sequence import os diff --git a/setup.py b/setup.py index 44301b49..d717cebc 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ python_requires=">=3.6", package_data={"myst_nb": ["_static/*"]}, install_requires=[ - "myst-parser~=0.12.9", + "myst-parser~=0.13.1", "docutils>=0.15", "sphinx>=2,<4", # TODO 0.3.2 requires some changes to the pytests @@ -74,10 +74,10 @@ "numpy", "sympy", "pandas", - "jupytext>=1.6.0", + "jupytext~=1.8.0", ], "rtd": [ - "jupytext>=1.6.0", + "jupytext~=1.8.0", "coconut~=1.4.3", "sphinxcontrib-bibtex", "ipywidgets", diff --git a/tests/notebooks/complex_outputs_unrun_timeout.ipynb b/tests/notebooks/complex_outputs_unrun_timeout.ipynb deleted file mode 100644 index 572fc144..00000000 --- a/tests/notebooks/complex_outputs_unrun_timeout.ipynb +++ /dev/null @@ -1,463 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "init_cell": true, - "slideshow": { - "slide_type": "skip" - } - }, - "outputs": [], - "source": [ - "import matplotlib.pyplot as plt\n", - "import pandas as pd\n", - "pd.set_option('display.latex.repr', True)\n", - "import sympy as sym\n", - "sym.init_printing(use_latex=True)\n", - "import numpy as np\n", - "from IPython.display import Image, Latex" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "slide": true - } - }, - "source": [ - "# Markdown" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "slide": true - } - }, - "source": [ - "## General" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "slide": true - } - }, - "source": [ - "Some markdown text.\n", - "\n", - "A list:\n", - "\n", - "- something\n", - "- something else\n", - "\n", - "A numbered list\n", - "\n", - "1. something\n", - "2. something else\n", - "\n", - "non-ascii characters TODO" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": {} - }, - "source": [ - "This is a long section of text, which we only want in a document (not a presentation)\n", - "some text\n", - "some more text\n", - "some more text\n", - "some more text\n", - "some more text\n", - "some more text\n", - "some more text\n", - "some more text\n", - "some more text\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "slide": true, - "slideonly": true - } - }, - "source": [ - "This is an abbreviated section of the document text, which we only want in a presentation\n", - "\n", - "- summary of document text" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "slide": true - } - }, - "source": [ - "## References and Citations" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "slide": true - } - }, - "source": [ - "References to \\cref{fig:example}, \\cref{tbl:example}, =@eqn:example_sympy and \\cref{code:example_mpl}.\n", - "\n", - "A latex citation.\\cite{zelenyak_molecular_2016}\n", - "\n", - "A html citation.(Kirkeminde, 2012) " - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "slide": true - } - }, - "source": [ - "## Todo notes" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "slide": true - } - }, - "source": [ - "\\todo[inline]{an inline todo}\n", - "\n", - "Some text.\\todo{a todo in the margins}" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Text Output" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "ipub": { - "text": { - "format": { - "backgroundcolor": "\\color{blue!10}" - } - } - } - }, - "outputs": [], - "source": [ - "print(\"\"\"\n", - "This is some printed text,\n", - "with a nicely formatted output.\n", - "\"\"\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Images and Figures" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Displaying a plot with its code" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "caption": "fig:example_mpl" - } - }, - "source": [ - "A matplotlib figure, with the caption set in the markdowncell above the figure." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "caption": "code:example_mpl" - } - }, - "source": [ - "The plotting code for a matplotlib figure (\\cref{fig:example_mpl})." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "slideshow": { - "slide_type": "slide" - } - }, - "source": [ - "# Tables (with pandas)" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "caption": "code:example_pd" - } - }, - "source": [ - "The plotting code for a pandas Dataframe table (\\cref{tbl:example})." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "ipub": { - "code": { - "asfloat": true, - "caption": "", - "label": "code:example_pd", - "placement": "H", - "widefigure": false - }, - "table": { - "alternate": "gray!20", - "caption": "An example of a table created with pandas dataframe.", - "label": "tbl:example", - "placement": "H" - } - } - }, - "outputs": [], - "source": [ - "np.random.seed(0) \n", - "df = pd.DataFrame(np.random.rand(3,4),columns=['a','b','c','d'])\n", - "df.a = ['$\\delta$','x','y']\n", - "df.b = ['l','m','n']\n", - "df.set_index(['a','b'])\n", - "df.round(3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Equations (with ipython or sympy)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "ipub": { - "equation": { - "label": "eqn:example_ipy" - } - } - }, - "outputs": [], - "source": [ - "Latex('$$ a = b+c $$')" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "ipub": { - "caption": "code:example_sym" - } - }, - "source": [ - "The plotting code for a sympy equation (=@eqn:example_sympy)." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "ipub": { - "code": { - "asfloat": true, - "caption": "", - "label": "code:example_sym", - "placement": "H", - "widefigure": false - }, - "equation": { - "environment": "equation", - "label": "eqn:example_sympy" - } - } - }, - "outputs": [], - "source": [ - "y = sym.Function('y')\n", - "n = sym.symbols(r'\\alpha')\n", - "f = y(n)-2*y(n-1/sym.pi)-5*y(n-2)\n", - "sym.rsolve(f,y(n),[1,4])" - ] - } - ], - "metadata": { - "celltoolbar": "Edit Metadata", - "hide_input": false, - "execution": { - "timeout": 1 - }, - "ipub": { - "bibliography": "example.bib", - "biboptions": [ - "super", - "sort" - ], - "bibstyle": "unsrtnat", - "language": "portuges", - "listcode": true, - "listfigures": true, - "listtables": true, - "pandoc": { - "at_notation": true, - "use_numref": true - }, - "sphinx": { - "bib_title": "My Bibliography" - }, - "titlepage": { - "author": "Authors Name", - "email": "authors@email.com", - "institution": [ - "Institution1", - "Institution2" - ], - "logo": "logo_example.png", - "subtitle": "Sub-Title", - "supervisors": [ - "First Supervisor", - "Second Supervisor" - ], - "tagline": "A tagline for the report.", - "title": "Main-Title" - }, - "toc": { - "depth": 2 - } - }, - "jupytext": { - "notebook_metadata_filter": "ipub" - }, - "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.6.10" - }, - "latex_envs": { - "LaTeX_envs_menu_present": true, - "autocomplete": true, - "bibliofile": "example.bib", - "cite_by": "apalike", - "current_citInitial": 1, - "eqLabelWithNumbers": true, - "eqNumInitial": 1, - "hotkeys": { - "equation": "Ctrl-E", - "itemize": "Ctrl-I" - }, - "labels_anchors": false, - "latex_user_defs": false, - "report_style_numbering": false, - "user_envs_cfg": true - }, - "nav_menu": {}, - "toc": { - "colors": { - "hover_highlight": "#DAA520", - "navigate_num": "#000000", - "navigate_text": "#333333", - "running_highlight": "#FF0000", - "selected_highlight": "#FFD700", - "sidebar_border": "#EEEEEE", - "wrapper_background": "#FFFFFF" - }, - "moveMenuLeft": true, - "nav_menu": { - "height": "161px", - "width": "252px" - }, - "navigate_menu": true, - "number_sections": true, - "sideBar": true, - "threshold": 4, - "toc_cell": false, - "toc_section_display": "block", - "toc_window_display": true, - "widenNotebook": false - }, - "varInspector": { - "cols": { - "lenName": 16, - "lenType": 16, - "lenVar": 40 - }, - "kernels_config": { - "python": { - "delete_cmd_postfix": "", - "delete_cmd_prefix": "del ", - "library": "var_list.py", - "varRefreshCmd": "print(var_dic_list())" - }, - "r": { - "delete_cmd_postfix": ") ", - "delete_cmd_prefix": "rm(", - "library": "var_list.r", - "varRefreshCmd": "cat(var_dic_list()) " - } - }, - "types_to_exclude": [ - "module", - "function", - "builtin_function_or_method", - "instance", - "_Feature" - ], - "window_display": false - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/tests/notebooks/sleep_10.ipynb b/tests/notebooks/sleep_10.ipynb new file mode 100644 index 00000000..7473264a --- /dev/null +++ b/tests/notebooks/sleep_10.ipynb @@ -0,0 +1,41 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "init_cell": true + }, + "outputs": [], + "source": [ + "import time\n", + "time.sleep(10)" + ] + } + ], + "metadata": { + "celltoolbar": "Edit Metadata", + "hide_input": false, + "execution": {}, + "jupytext": {}, + "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.6.10" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/tests/notebooks/sleep_10_metadata_timeout.ipynb b/tests/notebooks/sleep_10_metadata_timeout.ipynb new file mode 100644 index 00000000..946cb38a --- /dev/null +++ b/tests/notebooks/sleep_10_metadata_timeout.ipynb @@ -0,0 +1,43 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "init_cell": true + }, + "outputs": [], + "source": [ + "import time\n", + "time.sleep(10)" + ] + } + ], + "metadata": { + "celltoolbar": "Edit Metadata", + "hide_input": false, + "execution": { + "timeout": 1 + }, + "jupytext": {}, + "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.6.10" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/tests/test_execute.py b/tests/test_execute.py index b6ddb2ba..42216438 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -228,7 +228,7 @@ def test_relative_path_force(sphinx_run, file_regression, check_nbs): # Execution timeout configuration @pytest.mark.sphinx_params( - "complex_outputs_unrun.ipynb", + "sleep_10.ipynb", conf={"jupyter_execute_notebooks": "cache", "execution_timeout": 1}, ) def test_execution_timeout(sphinx_run, file_regression, check_nbs): @@ -239,7 +239,7 @@ def test_execution_timeout(sphinx_run, file_regression, check_nbs): @pytest.mark.sphinx_params( - "complex_outputs_unrun_timeout.ipynb", + "sleep_10_metadata_timeout.ipynb", conf={"jupyter_execute_notebooks": "cache", "execution_timeout": 60}, ) def test_execution_metadata_timeout(sphinx_run, file_regression, check_nbs): diff --git a/tox.ini b/tox.ini index 63a4450d..29f61ffc 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,10 @@ commands = pytest {posargs} extras = rtd deps = ipython<=7.11.0 # required by coconut -whitelist_externals = rm +whitelist_externals = + echo + rm commands = clean: rm -rf docs/_build sphinx-build -nW --keep-going -b {posargs:html} docs/ docs/_build/{posargs:html} +commands_post = echo "open file://{toxinidir}/docs/_build/{posargs:html}/index.html"