diff --git a/docs/source/examples/Notebook/Importing Notebooks.ipynb b/docs/source/examples/Notebook/Importing Notebooks.ipynb index a4dde144b..a7cdbcbce 100644 --- a/docs/source/examples/Notebook/Importing Notebooks.ipynb +++ b/docs/source/examples/Notebook/Importing Notebooks.ipynb @@ -40,7 +40,7 @@ "outputs": [], "source": [ "from IPython import get_ipython\n", - "from IPython.nbformat import current\n", + "from nbformat import read\n", "from IPython.core.interactiveshell import InteractiveShell" ] }, @@ -130,7 +130,7 @@ " \n", " # load the notebook object\n", " with io.open(path, 'r', encoding='utf-8') as f:\n", - " nb = current.read(f, 'json')\n", + " nb = read(f, 4)\n", " \n", " \n", " # create the module and add it to sys.modules\n", @@ -148,10 +148,10 @@ " self.shell.user_ns = mod.__dict__\n", " \n", " try:\n", - " for cell in nb.worksheets[0].cells:\n", - " if cell.cell_type == 'code' and cell.language == 'python':\n", + " for cell in nb.cells:\n", + " if cell.cell_type == 'code':\n", " # transform the input to executable Python\n", - " code = self.shell.input_transformer_manager.transform_cell(cell.input)\n", + " code = self.shell.input_transformer_manager.transform_cell(cell.source)\n", " # run the code in themodule\n", " exec(code, mod.__dict__)\n", " finally:\n", @@ -261,7 +261,18 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "So I should be able to `import nbimp.mynotebook`.\n" + "So I should be able to `import nbpackage.mynotebook`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "import nbpackage.mynotebook" ] }, { @@ -316,12 +327,12 @@ "def show_notebook(fname):\n", " \"\"\"display a short summary of the cells of a notebook\"\"\"\n", " with io.open(fname, 'r', encoding='utf-8') as f:\n", - " nb = current.read(f, 'json')\n", + " nb = read(f, 4)\n", " html = []\n", - " for cell in nb.worksheets[0].cells:\n", + " for cell in nb.cells:\n", " html.append(\"
%s\" % cell.source)\n", " display(HTML('\\n'.join(html)))\n", @@ -463,7 +474,7 @@ "outputs": [], "source": [ "import shutil\n", - "from IPython.utils.path import get_ipython_package_dir\n", + "from IPython.paths import get_ipython_package_dir\n", "\n", "utils = os.path.join(get_ipython_package_dir(), 'utils')\n", "shutil.copy(os.path.join(\"nbpackage\", \"mynotebook.ipynb\"),\n", @@ -515,7 +526,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.1" + "version": "3.5.1+" } }, "nbformat": 4, diff --git a/docs/source/examples/Notebook/nbpackage/mynotebook.ipynb b/docs/source/examples/Notebook/nbpackage/mynotebook.ipynb index fd3920ca4..191e181af 100644 --- a/docs/source/examples/Notebook/nbpackage/mynotebook.ipynb +++ b/docs/source/examples/Notebook/nbpackage/mynotebook.ipynb @@ -61,7 +61,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.2" + "version": "3.5.1+" } }, "nbformat": 4,