programmatically add cells to an ipython notebook for report generation

There’s a Notebook gist by Fernando Perez here that demonstrates how to programmatically create new cells. Note that you can also pass metadata in, so if you’re generating a report and want to turn the notebook into a slideshow, you can easily indicate whether the cell should be a slide, sub-slide, fragment, etc. You can … Read more

Where should I place my settings and profiles for use with IPython/Jupyter 4.0?

First of all, check what’s in your ~/.jupyter/ folder. Some of the comments under the question mention you have a file named “MIGRATED” that contains only a timestamp. If you are in this state, run the command: jupyter notebook –generate-config which will create a new file ~/.jupyter/jupyter_notebook_config.py. If you already have this file, you don’t … Read more

ipython: %paste over ssh connection

I think this is exactly what %cpaste is for (I am always forgetting about all the things IPython does). %cpaste enters a state allowing you to paste already formatted or indented code, and it will strip leading indentation and prompts, so you can copy/paste indented code from files, or even from an interactive Python session … Read more

How can I block comment code in the IPython notebook?

Default solution In IPython 2.x and 3.x (cmd|ctrl)-/ works but requires an english (american) keyboard layout, see https://github.com/ipython/ipython/pull/3673. Other keyboard layouts In case you have a non-english keyboard layout, you can define a custom keybinding for the codemirror editor via your custom.js. To this end add e.g. the following lines define([ ‘base/js/namespace’, ‘base/js/events’ ], function(IPython, … Read more