[IPython-user] Idioms for using custom profiles

Matthew Turk matthewturk@gmail....
Mon Sep 15 14:01:05 CDT 2008

Hi Fernando,

> The idea was to let you keep your main config in your base
> profile and easily layer on top of it 'versions' of ipython tailored
> for specific tasks.  See slide 11 in this old talk from 5 years ago:

This sounds reasonable and consistent with how I had been
understanding the purpose of the profile system; very convenient, very
cool, and tailored to tasks and classes of usage.

> As we move forward with the new unified codebase, we'll be revisiting
> the configuration machinery in depth to make everyone's life easier,
> deprecate the old plaintext profiles and use the new pure-python
> system but retaining all of the old functionality.  We'll be happy to
> listen to feedback.

I think my plan was to target the python-based means of configuring
and modifying IPython; it affords us a great deal of flexibility.
After talking it over with other people involved in the project, it's
becoming obvious that we really only want to provide two main
text-oriented interfaces to the project -- the programmatic API, which
we're alright with having some verbosity in, and the interactive API,
which will be composed of an IPython profile, coming with its
appropriate magic commands and whatnot to make things easier for the
user.  This resides nicely in between a GUI and the scripting
interface, and is perfect for some types of analysis.

> There's in principle no problem with this, it really depends exactly
> on your needs.  Writing your own custom script gives you more control,
> but it also may be nicer to let people start ipython in any way they
> want, as Ville suggests.

That's fair.  I think we're going to do some thinking on this, as we'd
really like to avoid duplication, as well as provide two different
means of accessing the interface -- specifically, it behooves us and
our target audience to provide something like an 'iyt' command that
loads IPython and the IPython profile if available, and if not -- and
there will be installations where it's not, unfortunately -- to
default back to the regular interpreter.  We have a script that does
that already.

Perhaps it would be in our best interests to have a minimal profile,
say, something that does:

(ipy_yt.py installed somewhere in PYTHONPATH)
import IPython.ipapi
import yt.ipython_profile

and then also utilize this means of setting up the namespace in the
'iyt' script, where we generate an instance of IPShellMatplotlib and
manipulate its .IP.getapi() object.  This would enable code reuse, as
well as providing both the profile and the shell command, both of
which will use the same, non-duplicated code.  Thoughts?

> BTW, you may be interested in the new work on making ipython available
> as a WX component that Gael and Laurent have been doing.  With the
> iptyhonx widget, you can put ipython into a larger WX app that uses
> VTK and matplotlib, something that seems in the line of work of yt :)

I'm *definitely* interested in this.  Right now we use a
monkey-patched PyCrust, but something about it, or the way we use it,
causes segfaults on OSX and it has a history of hanging during any
copy/paste operations.  We started taking the interactive interface
much more seriously after seeing (and re-discovering) the awesomeness
during your presentation at SciPy, and what Gael had an opportunity to
show during his talk was also quite astounding.  I will do some
digging myself, but may I ask -- does the %edit magic command work?
If so, is it restricted to GUI text editors?  One of the biggest
things I want to enable is running scripts from inside the GUI -- for
a couple reasons, not the least of whcih is using the GUI as an entry
point via a .app on OSX.

> ps - it would be very nice to hear from you a bit more detail once
> you're settled.  We try to collect user stories about ipython in the
> real world, especially in scientific contexts.  It always helps the
> project...

I'll definitely let you know some fun stories when we're settled and
done with a base level profile.  :)

Thanks again for all your help, everyone!


More information about the IPython-user mailing list