Check out https://github.com/ipython/ipynb. It does something similar to what you want, although I much prefer your explicit tagged solution to its heuristics.
On Thursday, 22 March 2018 03:23:22 UTC-7, Tony Hirst wrote: > > Recipes such as > http://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Importing%20Notebooks.html > > provide a means for importing the contents of a notebook as a module, but > they do so by executing all code cells. > > My development notebooks tend to have functions defined as well as lots of > little test cells that test the functions, or that include literal bits of > code that I'm trying to test before working them up into a function. > > Sometimes I want to make use of the functions in other notebooks, but > don't want to run all the other bits of code. > > I was thinking it might be handy to define some code cell metadata > ('exportable':boolean, perhaps), that I could set on a code cell to say > whether that cell was exportable as a notebook-module function or just > littering a notebook as a bit of development testing. > > The notebook-as-module recipe would then test to see whether a notebook > cell was not just a code cell, but an exportable code cell, before running > it. The metadata could also hook into a custom template that could export > the notebook as python with the code cells set to *exportable:False* > commented out. > > Is anyone using such a recipe? Does it help with workflow? > > --tony > -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/985e1d1d-603c-498d-a541-d7a948e1a2ad%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
