From ondrej at certik.cz  Mon Jan 12 01:55:46 2009
From: ondrej at certik.cz (Ondrej Certik)
Date: Sun, 11 Jan 2009 22:55:46 -0800
Subject: [IPython-dev] sympy in parallel ipython works
Message-ID: <85b5c3130901112255j22251efbx8be9e5e3f55fd40c@mail.gmail.com>

Hi,

thanks to Robert Kern, the pickling problem in protocol 2 in sympy was
fixed, so sympy seems to be working in ipython parallel. Here is how
to try it:

Checkout the latest git sympy, go to the sympy root directory (so that
"import sympy" works), and do:

$ ipcluster -n 4
Starting controller: Controller PID: 21443
Starting engines:    Engines PIDs:   [21449, 21450, 21451, 21452]
[...]

Leave it running and start ipython in another terminal (in the same dir):

In [1]: from IPython.kernel import client

In [2]: mec = client.MultiEngineClient()

In [3]: mec.get_ids()
Out[3]: [0, 1, 2, 3]

If this works, then ipython parallel works for you. Then play with sympy:

In [5]: from sympy import var

In [6]: var("x y z")
Out[6]: (x, y, z)

In [7]: e = (x+y)**5

In [9]: mec.push({"e": e})
Out[9]: [None, None, None, None]

In [10]: mec.pull("e")
Out[10]: [(x + y)**5, (x + y)**5, (x + y)**5, (x + y)**5]


And do something in parallel:

In [12]: mec.execute("from sympy import *")
Out[12]:
<Results List>
[0] In [4]: from sympy import *
[1] In [4]: from sympy import *
[2] In [4]: from sympy import *
[3] In [4]: from sympy import *

In [19]: mec.execute("var('x y')")
Out[19]:
<Results List>
[0] In [9]: var('x y')
[1] In [9]: var('x y')
[2] In [9]: var('x y')
[3] In [9]: var('x y')

In [17]: mec.scatter("a", range(4))
Out[17]: [None, None, None, None]

In [18]: mec.execute("print a")
Out[18]:
<Results List>
[0] In [8]: print a
[0] Out[8]: [0]

[1] In [8]: print a
[1] Out[8]: [1]

[2] In [8]: print a
[2] Out[8]: [2]

[3] In [8]: print a
[3] Out[8]: [3]

In [21]: mec.execute("print expand((x+y)**a[0])")
Out[21]:
<Results List>
[0] In [11]: print expand((x+y)**a[0])
[0] Out[11]: 1

[1] In [11]: print expand((x+y)**a[0])
[1] Out[11]: x + y

[2] In [11]: print expand((x+y)**a[0])
[2] Out[11]: 2*x*y + x**2 + y**2

[3] In [11]: print expand((x+y)**a[0])
[3] Out[11]: 3*x*y**2 + 3*y*x**2 + x**3 + y**3


Brian, now you can finally play with sympy in parallel, it should
work. Do you have in mind some cool calculation that could be done? :)

Ondrej

P.S. The isympy script isn't working for this, I don't know why, I'll
try to investigate later.


From dsdale24 at gmail.com  Mon Jan 12 08:20:26 2009
From: dsdale24 at gmail.com (Darren Dale)
Date: Mon, 12 Jan 2009 08:20:26 -0500
Subject: [IPython-dev] requesting guidance with a custom completer for a
	dictionary-like object
In-Reply-To: <a08e5f80812141507y4b023810x24846c84a3b8d9f7@mail.gmail.com>
References: <a08e5f80812141507y4b023810x24846c84a3b8d9f7@mail.gmail.com>
Message-ID: <a08e5f80901120520k67c794f6v27dd579787afbfd@mail.gmail.com>

Please excuse me for bumping this one time. Can anyone offer some guidance
on implementing a custom completer for getitem access?

On Sun, Dec 14, 2008 at 6:07 PM, Darren Dale <dsdale24 at gmail.com> wrote:

> Hello,
>
> I am working on a custom completer for h5py, which provides a nice
> interface to hdf5 files with a dictionary-style interface. I would like to
> enable tab completion for these h5py objects (which share a common ancestor
> called _DictCompat), but I am testing with regular dictionaries.
>
> If I have:
>
> d={'a':{'b':1},'b':2}
>
> I can currently do:
>
> d['<tab>
>
> and get
>
>   a     b
>
> if I do:
>
> d['a<tab>
>
> I would like to get:
>
> d['a']
>
> but I get
>
> d['a'
>
> and then if I do
>
> d['a'<tab>
>
> I get
>
> d['a'a
>
> Also, it is common to have deeply nested hierarchies with h5py, so I would
> like to be able to do:
>
> d['a'].<tab>
>
> or
>
> d['a']['<tab>
>
> I think I remember hearing that IPython used to do tab completion of
> dict-like objects, but the feature was removed because it was causing
> problems with user code. I was hoping someone might remember how this could
> be done, and could provide some guidance.
>
> Thanks,
> Darren
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090112/f667ef7d/attachment.html>

From ellisonbg.net at gmail.com  Mon Jan 12 12:04:30 2009
From: ellisonbg.net at gmail.com (Brian Granger)
Date: Mon, 12 Jan 2009 09:04:30 -0800
Subject: [IPython-dev] [sympy] sympy in parallel ipython works
In-Reply-To: <85b5c3130901112255j22251efbx8be9e5e3f55fd40c@mail.gmail.com>
References: <85b5c3130901112255j22251efbx8be9e5e3f55fd40c@mail.gmail.com>
Message-ID: <6ce0ac130901120904h3b2d83c3veefcbb461d464535@mail.gmail.com>

Ondrej,

Very nice!  And thanks to Reobert Kern for figuring out the problem
with pickling.  I will begin playing with this soon.

Cheers,

Brian

On Sun, Jan 11, 2009 at 10:55 PM, Ondrej Certik <ondrej at certik.cz> wrote:
>
> Hi,
>
> thanks to Robert Kern, the pickling problem in protocol 2 in sympy was
> fixed, so sympy seems to be working in ipython parallel. Here is how
> to try it:
>
> Checkout the latest git sympy, go to the sympy root directory (so that
> "import sympy" works), and do:
>
> $ ipcluster -n 4
> Starting controller: Controller PID: 21443
> Starting engines:    Engines PIDs:   [21449, 21450, 21451, 21452]
> [...]
>
> Leave it running and start ipython in another terminal (in the same dir):
>
> In [1]: from IPython.kernel import client
>
> In [2]: mec = client.MultiEngineClient()
>
> In [3]: mec.get_ids()
> Out[3]: [0, 1, 2, 3]
>
> If this works, then ipython parallel works for you. Then play with sympy:
>
> In [5]: from sympy import var
>
> In [6]: var("x y z")
> Out[6]: (x, y, z)
>
> In [7]: e = (x+y)**5
>
> In [9]: mec.push({"e": e})
> Out[9]: [None, None, None, None]
>
> In [10]: mec.pull("e")
> Out[10]: [(x + y)**5, (x + y)**5, (x + y)**5, (x + y)**5]
>
>
> And do something in parallel:
>
> In [12]: mec.execute("from sympy import *")
> Out[12]:
> <Results List>
> [0] In [4]: from sympy import *
> [1] In [4]: from sympy import *
> [2] In [4]: from sympy import *
> [3] In [4]: from sympy import *
>
> In [19]: mec.execute("var('x y')")
> Out[19]:
> <Results List>
> [0] In [9]: var('x y')
> [1] In [9]: var('x y')
> [2] In [9]: var('x y')
> [3] In [9]: var('x y')
>
> In [17]: mec.scatter("a", range(4))
> Out[17]: [None, None, None, None]
>
> In [18]: mec.execute("print a")
> Out[18]:
> <Results List>
> [0] In [8]: print a
> [0] Out[8]: [0]
>
> [1] In [8]: print a
> [1] Out[8]: [1]
>
> [2] In [8]: print a
> [2] Out[8]: [2]
>
> [3] In [8]: print a
> [3] Out[8]: [3]
>
> In [21]: mec.execute("print expand((x+y)**a[0])")
> Out[21]:
> <Results List>
> [0] In [11]: print expand((x+y)**a[0])
> [0] Out[11]: 1
>
> [1] In [11]: print expand((x+y)**a[0])
> [1] Out[11]: x + y
>
> [2] In [11]: print expand((x+y)**a[0])
> [2] Out[11]: 2*x*y + x**2 + y**2
>
> [3] In [11]: print expand((x+y)**a[0])
> [3] Out[11]: 3*x*y**2 + 3*y*x**2 + x**3 + y**3
>
>
> Brian, now you can finally play with sympy in parallel, it should
> work. Do you have in mind some cool calculation that could be done? :)
>
> Ondrej
>
> P.S. The isympy script isn't working for this, I don't know why, I'll
> try to investigate later.
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To post to this group, send email to sympy at googlegroups.com
> To unsubscribe from this group, send email to sympy+unsubscribe at googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sympy?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>


From ondrej at certik.cz  Mon Jan 12 21:15:02 2009
From: ondrej at certik.cz (Ondrej Certik)
Date: Mon, 12 Jan 2009 18:15:02 -0800
Subject: [IPython-dev] [sympy] Re: sympy in parallel ipython works
In-Reply-To: <6ce0ac130901120904h3b2d83c3veefcbb461d464535@mail.gmail.com>
References: <85b5c3130901112255j22251efbx8be9e5e3f55fd40c@mail.gmail.com>
	<6ce0ac130901120904h3b2d83c3veefcbb461d464535@mail.gmail.com>
Message-ID: <85b5c3130901121815o25914d1dn858c6dcb0d810f9e@mail.gmail.com>

On Mon, Jan 12, 2009 at 9:04 AM, Brian Granger <ellisonbg.net at gmail.com> wrote:
>
> Ondrej,
>
> Very nice!  And thanks to Reobert Kern for figuring out the problem
> with pickling.  I will begin playing with this soon.

Indeed, you did a superb job Robert, thanks a lot!

Ondrej


From mabshoff at googlemail.com  Sat Jan 17 08:15:26 2009
From: mabshoff at googlemail.com (Michael Abshoff)
Date: Sat, 17 Jan 2009 05:15:26 -0800
Subject: [IPython-dev] running python+ipython under gdb on darwin
Message-ID: <c98f3e570901170515j20673e58k3dc4aae0715e3c81@mail.gmail.com>

Hi,

I am running into problems when attempting to run Sage under gdb on
Darwin. We are still using ipython 0.8.4, but the code in question is
identical in ipython 0.9.1:

>From rlineimpl.py:

# Test to see if libedit is being used instead of GNU readline.
# Thanks to Boyd Waters for this patch.
uses_libedit = False
if sys.platform == 'darwin' and have_readline:
    import commands
    (status, result) = commands.getstatusoutput( "otool -L %s | grep
libedit" % _rl.__file__ )
    if status == 0 and len(result) > 0:
        # we are bound to libedit - new in Leopard
        _rl.parse_and_bind("bind ^I rl_complete")
        print "Leopard libedit detected."
        uses_libedit = True


commands.getstatusoutput() causes the following exception to be thrown on OSX:

(gdb) r
Starting program:
/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/bin/python
/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/tmp/.doctest_ell_finite_field.py
warning: posix_spawn failed, trying execvp, error: 86
Traceback (most recent call last):
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/tmp/.doctest_ell_finite_field.py",
line 2, in <module>
    from sage.all_cmdline import *;
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/all_cmdline.py",
line 14, in <module>
    from sage.all import *
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/all.py",
line 64, in <module>
    from sage.misc.all       import *         # takes a while
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/misc/all.py",
line 16, in <module>
    from sage_timeit_class import timeit
  File "sage_timeit_class.pyx", line 3, in sage.misc.sage_timeit_class
(sage/misc/sage_timeit_class.c:603)
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/misc/sage_timeit.py",
line 12, in <module>
    import timeit as timeit_, time, math, preparser, interpreter
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/sage/misc/interpreter.py",
line 95, in <module>
    import IPython.ipapi
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/IPython/__init__.py",
line 57, in <module>
    __import__(name,glob,loc,[])
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/IPython/ipstruct.py",
line 22, in <module>
    from IPython.genutils import list2dict2
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/IPython/genutils.py",
line 118, in <module>
    import IPython.rlineimpl as readline
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/site-packages/IPython/rlineimpl.py",
line 37, in <module>
    (status, result) = commands.getstatusoutput( "otool -L %s | grep
libedit" % _rl.__file__ )
  File "/Users/michaelabshoff/Desktop/sage-3.2.3-64bit/local/lib/python2.5/commands.py",
line 54, in getstatusoutput
    text = pipe.read()
IOError: [Errno 4] Interrupted system call

Note that this is a 64 bit build of Sage, but the 32 bit build is also
affected. Getting rid of the libedit test fixes the issue for Sage (we
link against readline on all platforms anyway), but I wanted to pick
your brains if there was a cleaner fix. While googling for the problem
I found this:

   http://mail.python.org/pipermail/python-list/2007-February/427200.html

But I am not so sure this is even applicable here.

Cheers,

Michael


From jorgen.stenarson at bostream.nu  Wed Jan 21 15:07:19 2009
From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=)
Date: Wed, 21 Jan 2009 21:07:19 +0100
Subject: [IPython-dev] review request
Message-ID: <49778077.4080005@bostream.nu>

Hi,

The branch in lp:~jorgen-stenarson/ipython/ipython-py2exe-fix was 
reviewed by Fernando a while back. I have made changes according to his 
comments and have not gotten any more feedback after that. Is this 
because I did something wrong in the review workflow (not unlikely since 
this is my first try) or has it simply been forgotten?

Anyway I would appreciate another review so we can get this patch in soon.

/J?rgen


From robert.kern at gmail.com  Fri Jan 23 01:48:19 2009
From: robert.kern at gmail.com (Robert Kern)
Date: Fri, 23 Jan 2009 00:48:19 -0600
Subject: [IPython-dev] More %magics - numpy print options
Message-ID: <glbp7m$4r4$1@ger.gmane.org>

I've made a couple more %magics, this time to manage a stack of numpy's print options. If 
you've ever run into numpy's 1000-element threshold for summarization or the small number 
of digits and just wanted to change them temporarily, I think you'll appreciate this.

   http://www.enthought.com/~rkern/cgi-bin/hgwebdir.cgi/ipython-magics/

In [11]: %push_print?
Type:             Magic function
Base Class:       <type 'instancemethod'>
Namespace:        IPython internal
File:             /Users/rkern/.ipython/mymagics.py
Definition:       %push_print(self, arg)
Docstring:
     Set numpy array printing options by pushing onto a stack.

     %push_print [-p PRECISION] [-t THRESHOLD] [-e EDGEITEMS] [-l LINEWIDTH]
                       [-s] [-S] [-n NANSTR] [-i INFSTR] [-q]

     optional arguments:
       -p PRECISION, --precision PRECISION
                             Number of digits of precision for floating point
                             output.
       -t THRESHOLD, --threshold THRESHOLD
                             Total number of array elements which trigger
                             summarization rather than a full repr. 0 disables
                             thresholding.
       -e EDGEITEMS, --edgeitems EDGEITEMS
                             Number of array items in summary at beginning and end
                             of each dimension.
       -l LINEWIDTH, --linewidth LINEWIDTH
                             The number of characters per line for the purpose of
                             inserting line breaks.
       -s, --suppress        Suppress the printing of small floating point values.
       -S, --no-suppress     Do not suppress the printing of small floating point
                             values.
       -n NANSTR, --nanstr NANSTR
                             String representation of floating point not-a-number.
       -i INFSTR, --infstr INFSTR
                             String representation of floating point infinity.
       -q, --quiet           Do not print the new settings.

In [12]: from numpy import *

In [13]: x = linspace(0, 1, 10)

In [14]: x
Out[14]:
array([ 0.        ,  0.11111111,  0.22222222,  0.33333333,  0.44444444,
         0.55555556,  0.66666667,  0.77777778,  0.88888889,  1.        ])

In [15]: %push_print -p 16
Precision:  16
Threshold:  1000
Edge items: 3
Line width: 75
Suppress:   False
NaN:        NaN
Inf:        Inf

In [16]: x
Out[16]:
array([ 0.                ,  0.1111111111111111,  0.2222222222222222,
         0.3333333333333333,  0.4444444444444444,  0.5555555555555556,
         0.6666666666666666,  0.7777777777777777,  0.8888888888888888,  1.                ])

In [17]: %pop_print
Precision:  8
Threshold:  1000
Edge items: 3
Line width: 75
Suppress:   False
NaN:        NaN
Inf:        Inf

In [18]: x
Out[18]:
array([ 0.        ,  0.11111111,  0.22222222,  0.33333333,  0.44444444,
         0.55555556,  0.66666667,  0.77777778,  0.88888889,  1.        ])


-- 
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



From robert.kern at gmail.com  Fri Jan 23 02:06:33 2009
From: robert.kern at gmail.com (Robert Kern)
Date: Fri, 23 Jan 2009 01:06:33 -0600
Subject: [IPython-dev] An extensible pretty-printing system
Message-ID: <glbq9r$729$1@ger.gmane.org>

I ran into a project from the sandbox of the Pocoo team (particularly Armin Ronacher) for 
an extensible pretty-printing system.

   http://sandbox.pocoo.org/
   http://dev.pocoo.org/hg/sandbox/file/tip/pretty

The nice part is that you can add pretty-printers for new types. It has nice features like 
automatic wordwrapping and indentation (and unlike the standard pprint, will correctly 
indent custom __repr__s). I thought it would be good to integrate into IPython as the 
usual result_display. For example, I've implemented a pretty-printer to print dtypes with 
many fields:

def dtype_pprinter(obj, p, cycle):
     """ Pretty-printer for numpy dtypes.
     """
     if cycle:
         return p.text('dtype(...)')
     if obj.fields is None:
         p.text(repr(obj))
     else:
         p.begin_group(7, 'dtype([')
         for i, field in enumerate(obj.descr):
             if i > 0:
                 p.text(',')
                 p.breakable()
             p.pretty(field)
         p.end_group(7, '])')


In [3]: dtype([(x, float) for x in 'abcdefghijklm'])
Out[3]:
dtype([('a', '<f8'),
        ('b', '<f8'),
        ('c', '<f8'),
        ('d', '<f8'),
        ('e', '<f8'),
        ('f', '<f8'),
        ('g', '<f8'),
        ('h', '<f8'),
        ('i', '<f8'),
        ('j', '<f8'),
        ('k', '<f8'),
        ('l', '<f8'),
        ('m', '<f8')])


Is there any interest in integrating this as the default result_display?

-- 
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



From robert.kern at gmail.com  Fri Jan 23 02:34:51 2009
From: robert.kern at gmail.com (Robert Kern)
Date: Fri, 23 Jan 2009 01:34:51 -0600
Subject: [IPython-dev] More %magics - numpy print options
In-Reply-To: <49797183.7070205@astraw.com>
References: <glbp7m$4r4$1@ger.gmane.org> <49797183.7070205@astraw.com>
Message-ID: <3d375d730901222334q62a224acn47f1939837b080f5@mail.gmail.com>

On Fri, Jan 23, 2009 at 01:28, Andrew Straw <strawman at astraw.com> wrote:
> On this subject, sympy has a very nice autodetection-of-terminal-width
> feature that would be very cool to port into the numpy printing stuff
> and/or ipython. Being completely oblivious of where this should best
> live and being completely lacking in spare time, all I can do is mention
> that it would be a cool feature to port into ipython or numpy.

IPython does have a function for this, too, on UNIX systems with
curses (sympy also uses curses on UNIX but also has a Windows
implementation using ctypes and the Windows API). I also found another
UNIX implementation that only uses the fcntl and termios modules,
which may be more ubiquitous than curses.

http://mail.python.org/pipermail/python-list/2006-February/365594.html

-- 
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


From strawman at astraw.com  Fri Jan 23 04:26:18 2009
From: strawman at astraw.com (Andrew Straw)
Date: Fri, 23 Jan 2009 01:26:18 -0800
Subject: [IPython-dev] More %magics - numpy print options
In-Reply-To: <3d375d730901222334q62a224acn47f1939837b080f5@mail.gmail.com>
References: <glbp7m$4r4$1@ger.gmane.org> <49797183.7070205@astraw.com>
	<3d375d730901222334q62a224acn47f1939837b080f5@mail.gmail.com>
Message-ID: <49798D3A.8030601@astraw.com>

Robert Kern wrote:
> On Fri, Jan 23, 2009 at 01:28, Andrew Straw <strawman at astraw.com> wrote:
>> On this subject, sympy has a very nice autodetection-of-terminal-width
>> feature that would be very cool to port into the numpy printing stuff
>> and/or ipython. Being completely oblivious of where this should best
>> live and being completely lacking in spare time, all I can do is mention
>> that it would be a cool feature to port into ipython or numpy.
> 
> IPython does have a function for this, too, on UNIX systems with
> curses (sympy also uses curses on UNIX but also has a Windows
> implementation using ctypes and the Windows API). I also found another
> UNIX implementation that only uses the fcntl and termios modules,
> which may be more ubiquitous than curses.
> 
> http://mail.python.org/pipermail/python-list/2006-February/365594.html
> 

Hmm, sympy's is on by default and I've never seen the effect in
IPython... How to turn it on?


From vivainio at gmail.com  Fri Jan 23 08:11:20 2009
From: vivainio at gmail.com (Ville M. Vainio)
Date: Fri, 23 Jan 2009 15:11:20 +0200
Subject: [IPython-dev] An extensible pretty-printing system
In-Reply-To: <glbq9r$729$1@ger.gmane.org>
References: <glbq9r$729$1@ger.gmane.org>
Message-ID: <46cb515a0901230511g56cc3ebcjd15065e87d5ba479@mail.gmail.com>

On Fri, Jan 23, 2009 at 9:06 AM, Robert Kern <robert.kern at gmail.com> wrote:

> indent custom __repr__s). I thought it would be good to integrate into IPython as the
> usual result_display. For example, I've implemented a pretty-printer to print dtypes with

Sounds good. It should probably start its life as an extension though
- not least because it can be done :-). After some mileage in real
life use, we can switch to it as the default.

-- 
Ville M. Vainio
http://tinyurl.com/vainio


From mhansen at gmail.com  Fri Jan 23 08:15:12 2009
From: mhansen at gmail.com (Mike Hansen)
Date: Fri, 23 Jan 2009 05:15:12 -0800
Subject: [IPython-dev] Overzealous introspection
Message-ID: <f67335450901230515x4acc480fv79cfde5363115d6b@mail.gmail.com>

Hello all,

We noticed the following problem in IPython while defining a function
at the command-line:

In [1]: def foo(x):
   ...:     """
   ...:     Eh?
Object `Eh` not found.
   ...:     """
   ...:     return 4
   ...:

The function still gets defined.  I've verified that this is still an
issue in a vanilla (no Sage) installation of IPython 0.9.1.  Our
ticket for it can be found at
http://trac.sagemath.org/sage_trac/ticket/4413.

Thanks,
--Mike


From vivainio at gmail.com  Fri Jan 23 09:31:14 2009
From: vivainio at gmail.com (Ville M. Vainio)
Date: Fri, 23 Jan 2009 16:31:14 +0200
Subject: [IPython-dev] Overzealous introspection
In-Reply-To: <f67335450901230515x4acc480fv79cfde5363115d6b@mail.gmail.com>
References: <f67335450901230515x4acc480fv79cfde5363115d6b@mail.gmail.com>
Message-ID: <46cb515a0901230631n6d641880xb849fba14091b107@mail.gmail.com>

On Fri, Jan 23, 2009 at 3:15 PM, Mike Hansen <mhansen at gmail.com> wrote:

> In [1]: def foo(x):
>   ...:     """
>   ...:     Eh?
> Object `Eh` not found.
>   ...:     """
>   ...:     return 4
>   ...:
>
> The function still gets defined.  I've verified that this is still an

Eh? gets converted to valid python code, hence the function gets
defined. I don't think this is a bug.

-- 
Ville M. Vainio
http://tinyurl.com/vainio


From pav at iki.fi  Fri Jan 23 12:26:18 2009
From: pav at iki.fi (Pauli Virtanen)
Date: Fri, 23 Jan 2009 17:26:18 +0000 (UTC)
Subject: [IPython-dev] Overzealous introspection
References: <f67335450901230515x4acc480fv79cfde5363115d6b@mail.gmail.com>
	<46cb515a0901230631n6d641880xb849fba14091b107@mail.gmail.com>
Message-ID: <glcujq$ugt$1@ger.gmane.org>

Fri, 23 Jan 2009 16:31:14 +0200, Ville M. Vainio wrote:

> On Fri, Jan 23, 2009 at 3:15 PM, Mike Hansen <mhansen at gmail.com> wrote:
> 
>> In [1]: def foo(x):
>>   ...:     """
>>   ...:     Eh?
>> Object `Eh` not found.
>>   ...:     """
>>   ...:     return 4
>>   ...:
>>
>> The function still gets defined.  I've verified that this is still an
> 
> Eh? gets converted to valid python code, hence the function gets
> defined. I don't think this is a bug.

I think the bug is the "Object `Eh` not found." message. The string "Eh?" 
occurs as a string literal and IMHO IPython shouldn't try to look it up.

-- 
Pauli Virtanen



From robert.kern at gmail.com  Fri Jan 23 16:06:35 2009
From: robert.kern at gmail.com (Robert Kern)
Date: Fri, 23 Jan 2009 15:06:35 -0600
Subject: [IPython-dev] More %magics - numpy print options
In-Reply-To: <49798D3A.8030601@astraw.com>
References: <glbp7m$4r4$1@ger.gmane.org>
	<49797183.7070205@astraw.com>	<3d375d730901222334q62a224acn47f1939837b080f5@mail.gmail.com>
	<49798D3A.8030601@astraw.com>
Message-ID: <gldbgr$e4o$1@ger.gmane.org>

Andrew Straw wrote:
> Robert Kern wrote:
>> On Fri, Jan 23, 2009 at 01:28, Andrew Straw <strawman at astraw.com> wrote:
>>> On this subject, sympy has a very nice autodetection-of-terminal-width
>>> feature that would be very cool to port into the numpy printing stuff
>>> and/or ipython. Being completely oblivious of where this should best
>>> live and being completely lacking in spare time, all I can do is mention
>>> that it would be a cool feature to port into ipython or numpy.
>> IPython does have a function for this, too, on UNIX systems with
>> curses (sympy also uses curses on UNIX but also has a Windows
>> implementation using ctypes and the Windows API). I also found another
>> UNIX implementation that only uses the fcntl and termios modules,
>> which may be more ubiquitous than curses.
>>
>> http://mail.python.org/pipermail/python-list/2006-February/365594.html
>>
> 
> Hmm, sympy's is on by default and I've never seen the effect in
> IPython... How to turn it on?

It's actually not used for printing. It's used to determine whether or not to page in 
genutils.page().

-- 
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



From trshash84 at gmail.com  Tue Jan 27 06:54:20 2009
From: trshash84 at gmail.com (Shashwath T.R.)
Date: Tue, 27 Jan 2009 17:24:20 +0530
Subject: [IPython-dev] Overzealous introspection
In-Reply-To: <glcujq$ugt$1@ger.gmane.org>
References: <f67335450901230515x4acc480fv79cfde5363115d6b@mail.gmail.com>
	<46cb515a0901230631n6d641880xb849fba14091b107@mail.gmail.com>
	<glcujq$ugt$1@ger.gmane.org>
Message-ID: <a8427db00901270354l15d6aebcydfb827e049836918@mail.gmail.com>

On Fri, Jan 23, 2009 at 10:56 PM, Pauli Virtanen <pav at iki.fi> wrote:
> Fri, 23 Jan 2009 16:31:14 +0200, Ville M. Vainio wrote:
>
>> On Fri, Jan 23, 2009 at 3:15 PM, Mike Hansen <mhansen at gmail.com> wrote:
>>
>>> In [1]: def foo(x):
>>>   ...:     """
>>>   ...:     Eh?
>>> Object `Eh` not found.
>>>   ...:     """
>>>   ...:     return 4
>>>   ...:
>>>
>>> The function still gets defined.  I've verified that this is still an
>>
>> Eh? gets converted to valid python code, hence the function gets
>> defined. I don't think this is a bug.
>
> I think the bug is the "Object `Eh` not found." message. The string "Eh?"
> occurs as a string literal and IMHO IPython shouldn't try to look it up.
>
> --

Happens without declaring the function too:

In [2]: x="""
   ...: Eh?
Object `Eh` not found.
   ...: """

And now, the string is actually empty...

In [3]: x
Out[3]: '\n\n'

In [4]: print x



In [5]:

Definitely a bug, I think?

Shash


From fperez.net at gmail.com  Sat Jan 31 03:36:16 2009
From: fperez.net at gmail.com (Fernando Perez)
Date: Sat, 31 Jan 2009 00:36:16 -0800
Subject: [IPython-dev] review request
In-Reply-To: <49778077.4080005@bostream.nu>
References: <49778077.4080005@bostream.nu>
Message-ID: <db6b5ecc0901310036u58cb609k9af6cc8db5567186@mail.gmail.com>

On Wed, Jan 21, 2009 at 12:07 PM, J?rgen Stenarson
<jorgen.stenarson at bostream.nu> wrote:
> Hi,
>
> The branch in lp:~jorgen-stenarson/ipython/ipython-py2exe-fix was
> reviewed by Fernando a while back. I have made changes according to his
> comments and have not gotten any more feedback after that. Is this
> because I did something wrong in the review workflow (not unlikely since
> this is my first try) or has it simply been forgotten?
>
> Anyway I would appreciate another review so we can get this patch in soon.

Sorry, I've been MIA for a while.  I'm going to bed now, but I'll
finish this review tomorrow.  I'll try to knock out a few more reviews
as well if I can over the weekend.

Cheers,

f


From fperez.net at gmail.com  Sat Jan 31 12:34:15 2009
From: fperez.net at gmail.com (Fernando Perez)
Date: Sat, 31 Jan 2009 09:34:15 -0800
Subject: [IPython-dev] looking for advice on a custom dict-like completer
In-Reply-To: <a08e5f80901310637n39a6411ei63475c10a0b9a905@mail.gmail.com>
References: <a08e5f80901310637n39a6411ei63475c10a0b9a905@mail.gmail.com>
Message-ID: <db6b5ecc0901310934v3019728dt9590a1e8a9fd82f@mail.gmail.com>

Hey Darren,

On Sat, Jan 31, 2009 at 6:37 AM, Darren Dale <dsdale24 at gmail.com> wrote:
> Hi Fernando,
>
> I'm sorry to bother you. I posted not too long ago hoping to find some
> advice on how to implement a custom completer for __getitem__ access of
> dict-like objects in the h5py project, but I didnt get any responses. I
> looked through the changelogs and the commit logs, trying to identify when
> this type of completion was supported in IPython, but came up empty.

No worries, it's no bother at all.  It's my fault that I've been
mostly MIA recently on pretty much all public mailing lists,  I've
just been swamped with real life/work things.  But I'm trying to
recover a bit now :)  I've cc'd the user list so this reply is
actually archived.

> If (and only if) you have time, would you be able to provide some advice or
> direct me to some code in an old version of IPython so I could see how it
> was originally done?

I did a bit of archaeological digging, and found that 0.4 has what you want:

maqroll[scripts]> python2.4 ipython
Python 2.4.5 (#2, Aug  1 2008, 02:20:59)
Type "copyright", "credits" or "license" for more information.

IPython 0.4.0 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
@magic  -> Information about IPython's 'magic' @ functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: a={'key':'value'}

In [2]: a['key']
Out[2]: 'value'

In [3]: a['key'].r<<TAB HERE>>
a['key'].replace  a['key'].rindex   a['key'].rsplit
a['key'].rfind    a['key'].rjust    a['key'].rstrip

###
Note that you'll need to run it as I did above, with python2.4,
because at the time we didn't declare the encoding of the files and
python2.5 considers that an error (my name has an accent in unicode).
You can find ipython 0.4 here, along with a bunch of other old
versions in that directory:

http://ipython.scipy.org/dist/old/ipython-0.4.0.tgz

I'd start by looking at FlexCompleter.py in there, though there may be
a bit more elsewhere.  I hope this helps, do let me know if you need
anything else.

Cheers,

f


From dsdale24 at gmail.com  Sat Jan 31 19:13:12 2009
From: dsdale24 at gmail.com (Darren Dale)
Date: Sat, 31 Jan 2009 19:13:12 -0500
Subject: [IPython-dev] looking for advice on a custom dict-like completer
In-Reply-To: <db6b5ecc0901310934v3019728dt9590a1e8a9fd82f@mail.gmail.com>
References: <a08e5f80901310637n39a6411ei63475c10a0b9a905@mail.gmail.com>
	<db6b5ecc0901310934v3019728dt9590a1e8a9fd82f@mail.gmail.com>
Message-ID: <a08e5f80901311613k73453b6at95b9e3df51099cef@mail.gmail.com>

Hi Fernando,

Thank you for the advice. I've been looking at this most of the day, and I
think I'm stuck. I have an object I'm trying to navigate:

dict_object['level_1']['level_2']['leve<tab>

What I think needs to happen is to register a completer that matches
r'.*?\[', split the string at first '[', ofind the base (dict_object), check
if its an dict object. Then if the last '[' occurs later than the last ']',
I know I am looking for a list of keys, so I split the original string the
last ']' and run eval(extendedbase, self.shell.user_ns) to yield the object
up to level_2, ask it for its list of keys, and return those keys. Its not
very elegant, and I've only implemented up to dict_object['lev<tab>. Now
imagine the following situation:

dict_object['level_1']['level_2']['level_3'].<tab>

It's not clear to me how I would get the object at level_3 and then hook
into ipython's usual completion chain to filter attributes with leading
underscores, or the traits completer, for example. Is this possible?



On Sat, Jan 31, 2009 at 12:34 PM, Fernando Perez <fperez.net at gmail.com>wrote:

> Hey Darren,
>
> On Sat, Jan 31, 2009 at 6:37 AM, Darren Dale <dsdale24 at gmail.com> wrote:
> > Hi Fernando,
> >
> > I'm sorry to bother you. I posted not too long ago hoping to find some
> > advice on how to implement a custom completer for __getitem__ access of
> > dict-like objects in the h5py project, but I didnt get any responses. I
> > looked through the changelogs and the commit logs, trying to identify
> when
> > this type of completion was supported in IPython, but came up empty.
>
> No worries, it's no bother at all.  It's my fault that I've been
> mostly MIA recently on pretty much all public mailing lists,  I've
> just been swamped with real life/work things.  But I'm trying to
> recover a bit now :)  I've cc'd the user list so this reply is
> actually archived.
>
> > If (and only if) you have time, would you be able to provide some advice
> or
> > direct me to some code in an old version of IPython so I could see how it
> > was originally done?
>
> I did a bit of archaeological digging, and found that 0.4 has what you
> want:
>
> maqroll[scripts]> python2.4 ipython
> Python 2.4.5 (#2, Aug  1 2008, 02:20:59)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.4.0 -- An enhanced Interactive Python.
> ?       -> Introduction to IPython's features.
> @magic  -> Information about IPython's 'magic' @ functions.
> help    -> Python's own help system.
> object? -> Details about 'object'. ?object also works, ?? prints more.
>
> In [1]: a={'key':'value'}
>
> In [2]: a['key']
> Out[2]: 'value'
>
> In [3]: a['key'].r<<TAB HERE>>
> a['key'].replace  a['key'].rindex   a['key'].rsplit
> a['key'].rfind    a['key'].rjust    a['key'].rstrip
>
> ###
> Note that you'll need to run it as I did above, with python2.4,
> because at the time we didn't declare the encoding of the files and
> python2.5 considers that an error (my name has an accent in unicode).
> You can find ipython 0.4 here, along with a bunch of other old
> versions in that directory:
>
> http://ipython.scipy.org/dist/old/ipython-0.4.0.tgz
>
> I'd start by looking at FlexCompleter.py in there, though there may be
> a bit more elsewhere.  I hope this helps, do let me know if you need
> anything else.
>
> Cheers,
>
> f
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090131/0e4dcee9/attachment.html>