ipython --pylab without namespace pollution?

Hi folks,

Does anyone know if there is a way to use ipython with the advantages of the -pylab option (separate gui thread, etc.), but without the whole pylab namespace getting sucked in?

I love ipython pylab mode, but like to use namespaces to keep things clean.

thanks,

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

ipython -wthread

···

On 2009-07-22 18:09, Christopher Barker wrote:

Hi folks,

Does anyone know if there is a way to use ipython with the advantages of
the -pylab option (separate gui thread, etc.), but without the whole
pylab namespace getting sucked in?

I love ipython pylab mode, but like to use namespaces to keep things clean.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

Put this in your ~/.ipython/ipythonrc:

pylab_import_all 0

That gives you exactly what you want. In my case, I also made a profile that imports numpy as np and matplotlib.pyplot as plt, so that I can get the equivalent of the ease pylab without the pollution.

Ryan

···

On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker <Chris.Barker@…259…> wrote:

Hi folks,

Does anyone know if there is a way to use ipython with the advantages of

the -pylab option (separate gui thread, etc.), but without the whole

pylab namespace getting sucked in?


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States

Hey Ryan -- could you write up a sphinx/rest FAQ that describes all
these steps in detail, eg how you create the profile and how you start
ipython, so we can add it to the site docs? If you are uncomfortable
with the docs, I can apply the patch.

Thanks
JDH

···

On Wed, Jul 22, 2009 at 8:04 PM, Ryan May<rmay31@...287...> wrote:

On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker <Chris.Barker@...2155.....> > wrote:

Hi folks,

Does anyone know if there is a way to use ipython with the advantages of
the -pylab option (separate gui thread, etc.), but without the whole
pylab namespace getting sucked in?

Put this in your ~/.ipython/ipythonrc:

pylab_import_all 0

That gives you exactly what you want. In my case, I also made a profile
that imports numpy as np and matplotlib.pyplot as plt, so that I can get the
equivalent of the ease pylab without the pollution.

I’m willing to. However, I just noticed that with just the pylab_import_all 0, you get the import numpy as np and import matplotlib.pyplot as plt automatically. Also, nicely, these don’t show up when you type ‘whos’. This is with ipython 0.9.1. Should I just add the pylab_import_all 0 to the FAQ?

Ryan

···

On Wed, Jul 22, 2009 at 8:34 PM, John Hunter <jdh2358@…287…> wrote:

On Wed, Jul 22, 2009 at 8:04 PM, Ryan May<rmay31@…287…> wrote:

On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker <Chris.Barker@…259…> > > > wrote:

Hi folks,

Does anyone know if there is a way to use ipython with the advantages of

the -pylab option (separate gui thread, etc.), but without the whole

pylab namespace getting sucked in?

Put this in your ~/.ipython/ipythonrc:

pylab_import_all 0

That gives you exactly what you want. In my case, I also made a profile

that imports numpy as np and matplotlib.pyplot as plt, so that I can get the

equivalent of the ease pylab without the pollution.

Hey Ryan – could you write up a sphinx/rest FAQ that describes all

these steps in detail, eg how you create the profile and how you start

ipython, so we can add it to the site docs? If you are uncomfortable

with the docs, I can apply the patch.


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States

Should be enough, but it would be nice to have a little bit on how to
write a profile to add extra imports (eg scipy as sp) to an ipython
profile and load it in the same FAQ. Yes, they could find it reading
the ipython docs, but the easier it is to get the info the more useful
it will be.

···

On Wed, Jul 22, 2009 at 8:50 PM, Ryan May<rmay31@...287...> wrote:

I'm willing to. However, I just noticed that with just the pylab_import_all
0, you get the import numpy as np and import matplotlib.pyplot as plt
automatically. Also, nicely, these don't show up when you type 'whos'. This
is with ipython 0.9.1. Should I just add the pylab_import_all 0 to the FAQ?

Ryan May wrote:

     > Put this in your ~/.ipython/ipythonrc:
     >
     > pylab_import_all 0

I finally got around to doing this, and found:

# ===========================================================
# Deprecation note: you should look into modifying ipy_user_conf.py (located
# in ~/.ipython or ~/_ipython, depending on your platform) instead, it's a
# more flexible and robust (and better supported!) configuration
# method.
# ===========================================================

So I took that to heart, and added:

     o.pylab_import_all = 0

to my ipy_user_conf.py file, and that had the same effect.

thanks,

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Good to know. When I get around to that FAQ entry, I’ll be sure to include that nugget.

Ryan

···

On Mon, Jul 27, 2009 at 2:40 PM, Christopher Barker <Chris.Barker@…259…> wrote:

Ryan May wrote:

Put this in your ~/.ipython/ipythonrc:

 >

 > pylab_import_all 0

I finally got around to doing this, and found:

===========================================================

Deprecation note: you should look into modifying ipy_user_conf.py (located

in ~/.ipython or ~/_ipython, depending on your platform) instead, it’s a

more flexible and robust (and better supported!) configuration

method.

===========================================================

So I took that to heart, and added:

o.pylab_import_all = 0

to my ipy_user_conf.py file, and that had the same effect.


Ryan May

Graduate Research Assistant
School of Meteorology
University of Oklahoma