Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?



You can import notebooks in other notebooks if you turn on the option to autosave your ipynb files as .py files too.

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?


We don't really envisage the notebook as a tool for creating modules and packages. It's not a replacement for a traditional editor or IDE; indeed you could use it alongside one.

We might even pair it with a web-based editor, like ACE, so you can comfortably write modules on the same server.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: