Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

import-ipynb

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

import-ipynb

Imports A.ipynb into B.ipynb

  • 0.2
  • PyPI
  • Socket score

Maintainers
1

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc