IPython is a Python console that's great to use, but that did not have compatibility with Blender yet. Mathias Panzenböck (panzi) changed that.
IPython is a Python console with several frontends (terminal, Qt, web). It reminds a bit of Mathematica & Co. because of the code cells. It is especially useful in a scientific context. Here is a read-only example of an IPython notebook. Here are some more examples.If it's not read-only you can add/edit/remove/execute code cells and write your Python script in that nice web based editor. It supports code completion and inline help. The nice thing is you can have nice Markdown text and the (image) output of the scripts directly in the same document as the code. (I didn't work out how to show Blender render output in a notebook, but I guess it should be relatively easy. Just load the written images.)
In non-scientific contexts it is still a nice Python shell. You can think of it as a better idle (the GUI Python shell included with Python). In the context of Blender one would use it to draft scripts, like you use the Python console that is integrated in Blender.
But if you want to use IPython to write and run a Blender script you have a problem. The bpy module is only accessible to embedded Blender scripts, it's not a stand alone module. But because IPython uses a separate process for the kernel (which executes the Python scripts) I could hook it all up so that the kernel to which the IPython frontend connects runs as Blender script, even though the frontend runs outside of Blender in the system's Python 3 installation.
I wrote a little script that lets you run an IPython console or notebook in the context of Blender's embedded Python interpreter. This can be used to draft Blender scripts or for whatever you would use the integrated Python shell. See:
I wrote this because this article claims Blender has bad Python bindings.
When asked what's so bad about Blender's Python bindings in the reddit comments I was told that the .blend format is too complex (no idea what that has to do with anything) and you can't use IPython with blender. Well, now you can. See (I'm bloody-albatross there).
Maybe this script is of any use to other Blender scripters?
5 Comments
Sounds as a small update, but its a major breakthrough i believe.
Lets put it in perspective, now suddenly people with experience in ipython who untill would use
matplotlib or other more simple drawing methods,
have now suddenly the option to represent their scientific work, using blender.
And with that there are chances for code xenogamy, maybe they will use /extend addons etc.
What !!! I can't believe it, this is great news for programmers .....
Looks nice, I'll have to try it... just to sound like an old grump now, but I've been using IPython with Blender for years :), its terminal only but has auto-completion and color still, see: http://www.blender.org/api/blender_python_api_2_72_release/info_tips_and_tricks.html#drop-into-a-python-interpreter-in-your-script
I often use this to quickly drop into a Python command-line from a running script.
Yes, calling IPython.embed() let's you debug a script by spawning a console at that point. This script though lets you do the opposite: run a blender instance "in" IPython. It also gives you access to the GUI tools of the Qt console or IPython Notebooks. I don't know if this is actually any useful, but the critique was that you can't do that with blender. With my script you can.
Nice hack. Doesn't change the fact that blender could do more to be easily integrateable into Python applications.