Small Python utility for importing functions, classes, and constants from .ipynb files.
Project description
Small Python utility for importing functions, classes, and constants from .ipynb files. A few other packages offer to provide similar functionality; I wrote this because none of them worked on the first try for me.
Notebooks can be imported from other notebooks or from normal Python scripts. The target notebook is assumed to be located in the current working directory.
You just import the notebook as if it was a submodule of from_notebook
. So to import definitions from example.ipynb
, any of the following will work:
import from_notebook.example
import from_notebook.example as example
from from_notebook.example import example_function, ExampleClass
No notebook code is executed except for imports, class
and def
statements, and SNAKE_CAPS = ...
assignments. All of these will be executed, so make sure they don't set off any unwanted side effects.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for from_notebook-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b4553d143c1c129171967fcb4170e79486457c10fe777489664ce712c4c0b30 |
|
MD5 | 6f1157978fe271e0f9fb1f93d3e3e885 |
|
BLAKE2b-256 | 58c0792a0e5eb38ce91475540e7282dc8254ff77e5c7d758cec35cc54b23c36f |