Motivation
----------
Suppose you want to import the contents of A.ipynb into B.ipynb.
Installation
------------
.. code:: bash
pip install import-ipynb
How to use
----------
Place both ipynb files in the same directory. Then, in the B.ipynb:
.. code:: python
import import_ipynb
import A
Congratulations! You can now run any functions defined in A.ipynb from
B.ipynb!
How it works
------------
The code within import\_ipynb.py defines a "notebook loader" that allows
you to 'import' other ipynb files into your current ipynb file. This
entails:
1. load the notebook document into memory
2. create an empty Module
3. execute every cell in the Module namespace
Note that since every cell in the A.ipynb is executed when you import
the the file, A.ipynb should only contain classes and function
definitions (otherwise you'll end up loading all variables and data into
memory).
Credits
-------
The code within imoprt\_ipynb.py comes from
http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Importing%20Notebooks.html.
Riley F. Edmunds (@rileyedmunds) wrote instructions on how to use it
and Lev Maximov (@axil) packaged it.
Raw data
{
"_id": null,
"home_page": "https://github.com/axil/import-ipynb",
"name": "import-ipynb",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "ipynb import jupyter notebook",
"author": "Lev Maximov",
"author_email": "lev.maximov@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7d/5f/07f93b0e5a94b69a65eb108290ae0544210affeb24ec20cf219fe60b4e8e/import-ipynb-0.2.tar.gz",
"platform": null,
"description": "Motivation\r\n----------\r\n\r\nSuppose you want to import the contents of A.ipynb into B.ipynb.\r\n\r\nInstallation\r\n------------\r\n\r\n.. code:: bash\r\n\r\n pip install import-ipynb\r\n\r\nHow to use\r\n----------\r\n\r\nPlace both ipynb files in the same directory. Then, in the B.ipynb:\r\n\r\n.. code:: python\r\n\r\n import import_ipynb\r\n import A\r\n\r\nCongratulations! You can now run any functions defined in A.ipynb from\r\nB.ipynb!\r\n\r\nHow it works\r\n------------\r\n\r\nThe code within import\\_ipynb.py defines a \"notebook loader\" that allows\r\nyou to 'import' other ipynb files into your current ipynb file. This\r\nentails:\r\n\r\n1. load the notebook document into memory\r\n2. create an empty Module\r\n3. execute every cell in the Module namespace\r\n\r\nNote that since every cell in the A.ipynb is executed when you import\r\nthe the file, A.ipynb should only contain classes and function\r\ndefinitions (otherwise you'll end up loading all variables and data into\r\nmemory).\r\n\r\nCredits\r\n-------\r\n\r\nThe code within imoprt\\_ipynb.py comes from\r\nhttp://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Importing%20Notebooks.html.\r\n\r\nRiley F. Edmunds (@rileyedmunds) wrote instructions on how to use it\r\nand Lev Maximov (@axil) packaged it.\r\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Imports A.ipynb into B.ipynb",
"version": "0.2",
"project_urls": {
"Homepage": "https://github.com/axil/import-ipynb"
},
"split_keywords": [
"ipynb",
"import",
"jupyter",
"notebook"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ec62e0b830773060d2a390aa923dcc8afc680d798bdbdadb6394f760fac62517",
"md5": "4275cd29783eaaeb55daa418fb73732f",
"sha256": "cb9e41c65dd81ebaa8e1e3e1b591276f910fbaac9238960d6798aad28d4c323f"
},
"downloads": -1,
"filename": "import_ipynb-0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4275cd29783eaaeb55daa418fb73732f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4005,
"upload_time": "2024-10-09T06:04:52",
"upload_time_iso_8601": "2024-10-09T06:04:52.598128Z",
"url": "https://files.pythonhosted.org/packages/ec/62/e0b830773060d2a390aa923dcc8afc680d798bdbdadb6394f760fac62517/import_ipynb-0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7d5f07f93b0e5a94b69a65eb108290ae0544210affeb24ec20cf219fe60b4e8e",
"md5": "3a9fbc73cf35f33efdabc6a5be681926",
"sha256": "0a6db02db7973a35ed1bf007b837288b13374897282218e226d01a1eaecaff85"
},
"downloads": -1,
"filename": "import-ipynb-0.2.tar.gz",
"has_sig": false,
"md5_digest": "3a9fbc73cf35f33efdabc6a5be681926",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5376,
"upload_time": "2024-10-09T06:04:53",
"upload_time_iso_8601": "2024-10-09T06:04:53.734863Z",
"url": "https://files.pythonhosted.org/packages/7d/5f/07f93b0e5a94b69a65eb108290ae0544210affeb24ec20cf219fe60b4e8e/import-ipynb-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-09 06:04:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "axil",
"github_project": "import-ipynb",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "import-ipynb"
}