Hello community, here is the log from the commit of package python3-jupyter_nbsphinx for openSUSE:Factory checked in at 2016-11-12 13:01:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-jupyter_nbsphinx (Old) and /work/SRC/openSUSE:Factory/.python3-jupyter_nbsphinx.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-jupyter_nbsphinx" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-jupyter_nbsphinx/python3-jupyter_nbsphinx.changes 2016-07-30 00:27:57.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python3-jupyter_nbsphinx.new/python3-jupyter_nbsphinx.changes 2016-11-12 13:01:48.000000000 +0100 @@ -1,0 +2,12 @@ +Tue Nov 1 20:23:56 UTC 2016 - toddrme2...@gmail.com + +- Fix version number + +------------------------------------------------------------------- +Tue Nov 1 15:31:59 UTC 2016 - toddrme2...@gmail.com + +- Update to 0.2.10 + * Enable JavaScript output cells +- Install extension. + +------------------------------------------------------------------- Old: ---- nbsphinx-0.2.9.tar.gz New: ---- nbsphinx-0.2.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-jupyter_nbsphinx.spec ++++++ --- /var/tmp/diff_new_pack.2tGcAK/_old 2016-11-12 13:01:49.000000000 +0100 +++ /var/tmp/diff_new_pack.2tGcAK/_new 2016-11-12 13:01:49.000000000 +0100 @@ -17,7 +17,7 @@ Name: python3-jupyter_nbsphinx -Version: 0.2.9 +Version: 0.2.10 Release: 0 Summary: Jupyter Notebook Tools for Sphinx License: MIT @@ -31,12 +31,14 @@ BuildRequires: python3-docutils BuildRequires: python3-jupyter_nbconvert BuildRequires: python3-jupyter_nbformat +BuildRequires: python3-jupyter_notebook BuildRequires: python3-sphinx_rtd_theme Requires: python3-Jinja2 Requires: python3-Sphinx Requires: python3-docutils Requires: python3-jupyter_nbconvert Requires: python3-jupyter_nbformat +Requires: python3-jupyter_notebook Requires: python3-sphinx_rtd_theme Recommends: mathjax Recommends: pandoc @@ -59,10 +61,14 @@ %install python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} +jupyter nbextension install --nbextensions=%{buildroot}%{_datadir}/jupyter_python%{py3_ver}/nbextensions/ nbsphinx.py %files %defattr(-,root,root,-) %doc LICENSE NEWS.rst README.rst -%{python3_sitelib}/* +%{python3_sitelib}/nbsphinx.py +%{python3_sitelib}/__pycache__/nbsphinx.*.pyc +%{python3_sitelib}/nbsphinx-%{version}-py*.egg-info +%{_datadir}/jupyter_python%{py3_ver}/nbextensions/nbsphinx.py %changelog ++++++ nbsphinx-0.2.9.tar.gz -> nbsphinx-0.2.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/NEWS.rst new/nbsphinx-0.2.10/NEWS.rst --- old/nbsphinx-0.2.9/NEWS.rst 2016-07-26 21:40:39.000000000 +0200 +++ new/nbsphinx-0.2.10/NEWS.rst 2016-10-16 11:37:05.000000000 +0200 @@ -1,3 +1,6 @@ +Version 0.2.10 (2016-10-16): + * Enable JavaScript output cells + Version 0.2.9 (2016-07-26): * Add option ``nbsphinx_prompt_width`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/PKG-INFO new/nbsphinx-0.2.10/PKG-INFO --- old/nbsphinx-0.2.9/PKG-INFO 2016-07-26 21:42:15.000000000 +0200 +++ new/nbsphinx-0.2.10/PKG-INFO 2016-10-16 11:38:27.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: nbsphinx -Version: 0.2.9 +Version: 0.2.10 Summary: Jupyter Notebook Tools for Sphinx Home-page: http://nbsphinx.rtfd.org/ Author: Matthias Geier diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/doc/a-normal-rst-file.rst new/nbsphinx-0.2.10/doc/a-normal-rst-file.rst --- old/nbsphinx-0.2.9/doc/a-normal-rst-file.rst 2016-07-10 11:54:41.000000000 +0200 +++ new/nbsphinx-0.2.10/doc/a-normal-rst-file.rst 2016-08-27 15:11:11.000000000 +0200 @@ -39,44 +39,6 @@ * "``../``" is not allowed, you have to specify the full path even if the current source file is in a subdirectory! -Sphinx Directives for Jupyter Notebook Cells --------------------------------------------- - -For comparison, this is a "normal" Sphinx code block using ``ipython3`` -syntax highlighting: - -.. code-block:: ipython3 - - %file helloworld.py - #!/usr/bin/env python3 - print('Hello, world!') - -The ``nbsphinx`` extension provides custom directives to show notebook cells: - -.. nbinput:: ipython3 - :execution-count: 42 - - 6 * 7 - -.. nboutput:: - :execution-count: 42 - - 42 - -This was created with - -.. code-block:: rst - - .. nbinput:: ipython3 - :execution-count: 42 - - 6 * 7 - - .. nboutput:: - :execution-count: 42 - - 42 - Sphinx Directives for Info/Warning Boxes ---------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/doc/allow-errors.ipynb new/nbsphinx-0.2.10/doc/allow-errors.ipynb --- old/nbsphinx-0.2.9/doc/allow-errors.ipynb 2016-06-23 18:14:11.000000000 +0200 +++ new/nbsphinx-0.2.10/doc/allow-errors.ipynb 2016-10-16 11:23:39.000000000 +0200 @@ -19,7 +19,7 @@ "\n", "If a notebook contains errors on purpose (or if you are too lazy to fix them right now), you have three options:\n", "\n", - "1. Manually execute the notebook in question and save the results, see [the pre-executed example notebook](pre-executed.ipynb#Exceptions).\n", + "1. Manually execute the notebook in question and save the results, see [the pre-executed example notebook](pre-executed.ipynb).\n", "\n", "2. Allow errors in all notebooks by setting this option in [conf.py](conf.py):\n", "```\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/doc/code-cells.ipynb new/nbsphinx-0.2.10/doc/code-cells.ipynb --- old/nbsphinx-0.2.9/doc/code-cells.ipynb 2016-06-23 18:14:11.000000000 +0200 +++ new/nbsphinx-0.2.10/doc/code-cells.ipynb 2016-09-29 14:02:43.000000000 +0200 @@ -150,6 +150,30 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "## Cell Magics\n", + "\n", + "Cells can contain code in other languages by means of [cell magics](http://ipython.readthedocs.io/en/stable/interactive/magics.html#cell-magics):" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "%%bash\n", + "for i in 1 2 3\n", + "do\n", + " echo $i\n", + "done" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ "## Special Display Formats\n", "\n", "See [IPython example notebook](https://nbviewer.jupyter.org/github/ipython/ipython/blob/master/examples/IPython Kernel/Rich Output.ipynb).\n", @@ -346,6 +370,47 @@ }, { "cell_type": "markdown", + "metadata": { + "deletable": true, + "editable": true + }, + "source": [ + "### Arbitrary JavaScript Output (HTML only)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "%%javascript\n", + "\n", + "var text = document.createTextNode(\"Hello, I was generated with JavaScript!\");\n", + "// Content appended to \"element\" will be visible in the output area:\n", + "element.append(text);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "<div class=\"alert alert-info\">\n", + "\n", + "**Note:**\n", + "\n", + "jQuery should be available, but using the readthedocs.org default theme, it's not. See [the issue on Github](https://github.com/snide/sphinx_rtd_theme/issues/328).\n", + "Other Sphinx themes are not affected by this.\n", + "\n", + "</div>" + ] + }, + { + "cell_type": "markdown", "metadata": {}, "source": [ "### Unsupported Output Types\n", @@ -489,7 +554,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.1+" + "version": "3.5.2+" } }, "nbformat": 4, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/doc/markdown-cells.ipynb new/nbsphinx-0.2.10/doc/markdown-cells.ipynb --- old/nbsphinx-0.2.9/doc/markdown-cells.ipynb 2016-07-10 11:32:54.000000000 +0200 +++ new/nbsphinx-0.2.10/doc/markdown-cells.ipynb 2016-09-29 13:35:51.000000000 +0200 @@ -284,7 +284,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.1+" + "version": "3.4.4" } }, "nbformat": 4, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/doc/subdir/a-notebook-in-a-subdir.ipynb new/nbsphinx-0.2.10/doc/subdir/a-notebook-in-a-subdir.ipynb --- old/nbsphinx-0.2.9/doc/subdir/a-notebook-in-a-subdir.ipynb 2016-06-23 18:14:11.000000000 +0200 +++ new/nbsphinx-0.2.10/doc/subdir/a-notebook-in-a-subdir.ipynb 2016-10-16 11:23:39.000000000 +0200 @@ -36,6 +36,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "<div class=\"alert alert-warning\">\n", + "\n", + "**Warning:**\n", + "\n", + "There may be problems with images in output cells if your source directory contains symbolic links, see [issue #49](https://github.com/spatialaudio/nbsphinx/issues/49).\n", + "\n", + "</div>\n", + "\n", "A link to a notebook in the parent directory: [link](../markdown-cells.ipynb).\n", "\n", "A link to a local file: [link](../images/notebook_icon.png).\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/doc/timeout.ipynb new/nbsphinx-0.2.10/doc/timeout.ipynb --- old/nbsphinx-0.2.9/doc/timeout.ipynb 2016-06-23 18:14:11.000000000 +0200 +++ new/nbsphinx-0.2.10/doc/timeout.ipynb 2016-10-16 11:23:39.000000000 +0200 @@ -28,10 +28,10 @@ "```json\n", "\"nbsphinx\": {\n", " \"timeout\": 60\n", - "}\n", + "},\n", "```\n", "\n", - "Alternatively, you can manually execute the notebook in question and save the results, see [the pre-executed example notebook](pre-executed.ipynb#Long-Running-Cells)." + "Alternatively, you can manually execute the notebook in question and save the results, see [the pre-executed example notebook](pre-executed.ipynb)." ] } ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/doc/usage.ipynb new/nbsphinx-0.2.10/doc/usage.ipynb --- old/nbsphinx-0.2.9/doc/usage.ipynb 2016-06-25 12:17:39.000000000 +0200 +++ new/nbsphinx-0.2.10/doc/usage.ipynb 2016-09-29 13:35:51.000000000 +0200 @@ -27,7 +27,28 @@ "\n", "Depending on your Python installation, you may have to use `python` instead of `python3`.\n", "Recent versions of Python already come with `pip` pre-installed.\n", - "If you don't have it, you can [install it manually](https://pip.pypa.io/en/latest/installing/)." + "If you don't have it, you can [install it manually](https://pip.pypa.io/en/latest/installing/).\n", + "\n", + "### Syntax Highlighting\n", + "\n", + "To get proper syntax highlighting in code cells, you'll need an appropriate *Pygments lexer*.\n", + "This of course depends on the programming language of your Jupyter notebooks (more specifically, the `pygments_lexer` metadata of your notebooks).\n", + "\n", + "For example, if you use Python in your notebooks, you'll have to have the `IPython` package installed:\n", + "\n", + " python3 -m pip install IPython --user\n", + "\n", + "You'll most likely have this installed already.\n", + "\n", + "### Jupyter Kernel\n", + "\n", + "If you want to execute your notebooks during the Sphinx build process (see [Executing Notebooks](executing-notebooks.ipynb)), you need an appropriate [Jupyter kernel](http://jupyter.readthedocs.io/en/latest/projects/kernels.html) installed.\n", + "\n", + "For example, if you use Python, you should install the `ipykernel` package:\n", + "\n", + " python3 -m pip install ipykernel --user\n", + "\n", + "Again, it's very likely that you have that installed already." ] }, { @@ -53,7 +74,20 @@ "exclude_patterns = ['_build', '**.ipynb_checkpoints']\n", "```\n", "\n", - "Once your `conf.py` is in place, edit the file named `index.rst` and add the file names of your notebooks (with or without the `.ipynb` extension) to the [toctree](http://www.sphinx-doc.org/en/stable/markup/toctree.html) directive." + "Once your `conf.py` is in place, edit the file named `index.rst` and add the file names of your notebooks (with or without the `.ipynb` extension) to the [toctree](http://www.sphinx-doc.org/en/stable/markup/toctree.html) directive.\n", + "\n", + "<div class=\"alert alert-info\">\n", + "\n", + "**autosummary bug:**\n", + "\n", + "If you are using the `sphinx.ext.autosummary` Sphinx extension, there is [a bug in Sphinx (below version 1.5)](https://github.com/sphinx-doc/sphinx/issues/2485) which prevents notebooks from being parsed. \n", + "As a work-around you can explicitly list all the files for which autosummary should be ran using the [autosummary_generate](http://www.sphinx-doc.org/en/stable/ext/autosummary.html#confval-autosummary_generate) variable in `conf.py`. For example,\n", + "\n", + "```python\n", + "autosummary_generate = ['myfile1.rst', 'myfile2.rst']\n", + "```\n", + "\n", + "</div>" ] }, { @@ -244,7 +278,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.1+" + "version": "3.4.4" } }, "nbformat": 4, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/nbsphinx.egg-info/PKG-INFO new/nbsphinx-0.2.10/nbsphinx.egg-info/PKG-INFO --- old/nbsphinx-0.2.9/nbsphinx.egg-info/PKG-INFO 2016-07-26 21:42:09.000000000 +0200 +++ new/nbsphinx-0.2.10/nbsphinx.egg-info/PKG-INFO 2016-10-16 11:38:26.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: nbsphinx -Version: 0.2.9 +Version: 0.2.10 Summary: Jupyter Notebook Tools for Sphinx Home-page: http://nbsphinx.rtfd.org/ Author: Matthias Geier diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/nbsphinx.egg-info/requires.txt new/nbsphinx-0.2.10/nbsphinx.egg-info/requires.txt --- old/nbsphinx-0.2.9/nbsphinx.egg-info/requires.txt 2016-07-26 21:42:09.000000000 +0200 +++ new/nbsphinx-0.2.10/nbsphinx.egg-info/requires.txt 2016-10-16 11:38:26.000000000 +0200 @@ -1,5 +1,6 @@ docutils jinja2 nbconvert +traitlets nbformat sphinx diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/nbsphinx.py new/nbsphinx-0.2.10/nbsphinx.py --- old/nbsphinx-0.2.9/nbsphinx.py 2016-07-26 21:41:06.000000000 +0200 +++ new/nbsphinx-0.2.10/nbsphinx.py 2016-10-16 11:34:35.000000000 +0200 @@ -23,24 +23,26 @@ http://nbsphinx.rtfd.org/ """ -__version__ = '0.2.9' +__version__ = '0.2.10' import copy -import docutils -from docutils.parsers import rst -import jinja2 import json -import nbconvert -import nbformat import os import re -import sphinx import subprocess try: from urllib.parse import unquote # Python 3.x except ImportError: from urllib2 import unquote # Python 2.x +import docutils +from docutils.parsers import rst +import jinja2 +import nbconvert +import nbformat +import sphinx +import traitlets + _ipynbversion = 4 # See nbconvert/exporters/html.py: @@ -88,8 +90,10 @@ {% block input -%} -.. nbinput:: {% if nb.metadata.language_info -%} -{{ nb.metadata.language_info.pygments_lexer }} +.. nbinput:: {% if cell.metadata.magics_language -%} +{{ cell.metadata.magics_language }} +{%- elif nb.metadata.language_info -%} +{{ nb.metadata.language_info.pygments_lexer or nb.metadata.language_info.name }} {%- else -%} {{ resources.codecell_lexer }} {%- endif -%} @@ -141,6 +145,16 @@ .. raw:: html {{ output.data['text/html'] | indent | indent }} +{%- elif datatype == 'application/javascript' %} +{% set div_id = uuid4() %} + + .. raw:: html + + <div id="{{ div_id }}"></div> + <script type="text/javascript"> + var element = document.getElementById('{{ div_id }}'); +{{ output.data['application/javascript'] | indent | indent }} + </script> {%- elif datatype == 'ansi' %} .. rst-class:: highlight @@ -442,6 +456,13 @@ 'get_output_type': _get_output_type, }) + @property + def default_config(self): + c = traitlets.config.Config( + {'HighlightMagicsPreprocessor': {'enabled': True}}) + c.merge(super(Exporter, self).default_config) + return c + def from_notebook_node(self, nb, resources=None, **kw): nb = copy.deepcopy(nb) if resources is None: @@ -1004,13 +1025,29 @@ def builder_inited(app): - """Add color definitions to LaTeX preamble.""" + # Add color definitions to LaTeX preamble latex_elements = app.builder.config.latex_elements latex_elements['preamble'] = '\n'.join([ LATEX_PREAMBLE, latex_elements.get('preamble', ''), ]) + # Set default value for CSS prompt width + if app.config.nbsphinx_prompt_width is None: + app.config.nbsphinx_prompt_width = { + 'agogo': '7ex', + 'classic': '7ex', + 'cloud': '8ex', + 'dotted': '8ex', + 'haiku': '7ex', + 'nature': '8ex', + 'pyramid': '8ex', + 'redcloud': '8ex', + 'sphinx_py3doc_enhanced_theme': '8ex', + 'sphinx_rtd_theme': '8ex', + 'traditional': '6ex', + }.get(app.config.html_theme, '9ex') + def html_page_context(app, pagename, templatename, context, doctree): """Add CSS string to HTML pages that contain code cells.""" @@ -1168,7 +1205,8 @@ app.add_config_value('nbsphinx_allow_errors', False, rebuild='') app.add_config_value('nbsphinx_timeout', 30, rebuild='') app.add_config_value('nbsphinx_codecell_lexer', 'none', rebuild='env') - app.add_config_value('nbsphinx_prompt_width', '9ex', rebuild='html') + # Default value is set in builder_inited(): + app.add_config_value('nbsphinx_prompt_width', None, rebuild='html') app.add_directive('nbinput', NbInput) app.add_directive('nboutput', NbOutput) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbsphinx-0.2.9/setup.py new/nbsphinx-0.2.10/setup.py --- old/nbsphinx-0.2.9/setup.py 2016-06-23 18:14:11.000000000 +0200 +++ new/nbsphinx-0.2.10/setup.py 2016-09-29 13:35:51.000000000 +0200 @@ -14,6 +14,7 @@ 'docutils', 'jinja2', 'nbconvert', + 'traitlets', 'nbformat', 'sphinx', ],