Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/axil/import-ipynb
import an ipynb into an ipynb (or into just a py)
https://github.com/axil/import-ipynb
import ipynb jupyter-notebook
Last synced: about 16 hours ago
JSON representation
import an ipynb into an ipynb (or into just a py)
- Host: GitHub
- URL: https://github.com/axil/import-ipynb
- Owner: axil
- License: bsd-3-clause
- Created: 2017-10-24T10:01:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-09T06:07:53.000Z (3 months ago)
- Last Synced: 2024-12-16T02:05:37.740Z (8 days ago)
- Topics: import, ipynb, jupyter-notebook
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 28
- Watchers: 3
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
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 ACongratulations! 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 namespaceNote 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.