Package for Importing Jupyter Notebooks as Modules

Hey everyone,

I was curious if there is a package that builds on top of Importing Jupyter Notebooks as Modules — Jupyter Notebook 6.4.8 documentation to easily import functions or classes from jupyter notebooks?

I copied and changed the code from the docs a bit to fit my requirements and put it into

I added some regular expressions to filter out function calls and will likely extend that in the future.
I copied parts of the code straight from the official documentation and also reference that in the code but I was wondering if the authors of the docs see any issues with me using their code and publishing it (on PyPi)?

Ideally if something like that already exists I would like to use that.


1 Like

ipynb is also in the ipython org and on pypi, and probably works, but hasn’t had a ton of development in a while. Probably doesn’t have filtering.

importnb (disclaimer: contributor) is a third package, and works fairly well. An interesting thing it does is actually uses an appropriately-updated line cache, so some surprising tools like debuggers actually “work” with it… but you’re stepping over JSON. It provides no capability to filter out content, though this has been requested several times.