|
|
|
|
|
by lrem
4938 days ago
|
|
Most of my programming these days is actually done in IPython notebook. Having an instant feedback is invaluable. I put my code in plain old .py files only once it needs to be imported. I'm even wondering: if there was a way for notebooks to import each other, would I still bother with modules? |
|
1. In ipython_notebook_config.py, set the following:
# Save .py for each notebook for import elsewhere
c.NotebookManager.save_script = True
2. Restart your notebook server. 3. Save any notebooks you'd like to import under module friendly names. (They wind up in the same dir as the ipynb files.) 4. In your interactive notebook, import your_other_notebook.
This works well when all your notebooks are in the same folder, which is the default. I haven't given much thought to how you might create packages this way, but perhaps with a few code changes you could?