Skip to content

It's often convenient to prototype code in a jupyter notebook, but annoying to copy/paste codeblocks to a python file when you want to use functions in another script or notebook; this package makes that easier

License

Notifications You must be signed in to change notification settings

rlhjansen/nbprototyping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notebook prototyping

This repo makes prototyping via notebooks easier, by providing a way to strip them of experimental/veryfying function calls only retaining function/class definitions and imports. In this manner, jupyter notebooks can be used to write, check, experiment, etc. with code while writing it while taking away the hassle of pasting all definitions into a new file.

With this you can:

  • strip notebooks to their bare class/function definitions & imports.

Usage

To install:

pip install notebook-prototyping

Then to convert the currently active notebook to a python file:

import ipynbname
nb_fname = ipynbname.name()
convert_to_module(nb_fname, overwrite=True)

You can also convert different notebooks form within a notebook or python file

convert_to_module("path/to/my/notebook_file", overwrite=True)

However, especially with overwrite=True this might be ill-advised, overwrite is set to False by default

Todos

About

It's often convenient to prototype code in a jupyter notebook, but annoying to copy/paste codeblocks to a python file when you want to use functions in another script or notebook; this package makes that easier

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published