%doctest_mode broken in trunk

Bug #505404 reported by Fernando Perez on 2010-01-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IPython
Fix Committed
Medium
Fernando Perez

Bug Description

In [1]: %doctest_mode
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)

/home/fperez/ipython/repo/trunk-dev/<ipython console> in <module>()

/home/fperez/ipython/repo/trunk-dev/IPython/core/iplib.pyc in magic(self, arg_s)
   1621 with nested(self.builtin_trap,):
   1622 result = fn(magic_args)
-> 1623 return result
   1624
   1625 def define_magic(self, magicname, func):

/usr/lib/python2.6/contextlib.pyc in __exit__(self, type, value, traceback)
     32 value = type()
     33 try:
---> 34 self.gen.throw(type, value, traceback)
     35 raise RuntimeError("generator didn't stop after throw()")
     36 except StopIteration, exc:

/usr/lib/python2.6/contextlib.pyc in nested(*managers)
    111 vars.append(enter())
    112 exits.append(exit)
--> 113 yield vars
    114 except:
    115 exc = sys.exc_info()

/home/fperez/ipython/repo/trunk-dev/IPython/core/iplib.pyc in magic(self, arg_s)
   1620 magic_args = self.var_expand(magic_args,1)
   1621 with nested(self.builtin_trap,):
-> 1622 result = fn(magic_args)
   1623 return result
   1624

/home/fperez/ipython/repo/trunk-dev/IPython/core/magic.pyc in magic_doctest_mode(self, parameter_s)
   3397
   3398 # XXX - Fix this to have cleaner activate/deactivate calls.

-> 3399 from IPython.extensions import InterpreterPasteInput as ipaste
   3400 from IPython.utils.ipstruct import Struct
   3401

ImportError: cannot import name InterpreterPasteInput

Related branches

Changed in ipython:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Fernando Perez (fdo.perez)
milestone: none → 0.11
Fernando Perez (fdo.perez) wrote :

Fix in my trunk-dev, with sugar on top: now all >>> and IPython In[N] prompts are processed out of any input all the time, so one can paste from any interactive session, tutorial or doctest at any time.

%doctest itself was fixed, tests added.

Changed in ipython:
status: In Progress → Fix Committed

I see that the old InterpreterPasteInput was in extensions. Where did
the new stuff go?
As we fix things that were in extensions, I think we will have to
decide where these things
will go. Some possibilities:

* extensions
* core
* lib

We should decide these things now so things don't end up all over the place.

Cheers,

Brian

On Sun, Jan 10, 2010 at 1:34 AM, Fernando Perez <email address hidden> wrote:
> Fix in my trunk-dev, with sugar on top: now all >>> and IPython In[N]
> prompts are processed out of any input all the time, so one can paste
> from any interactive session, tutorial or doctest at any time.
>
> %doctest itself was fixed, tests added.
>
> ** Branch linked: lp:~fdo.perez/ipython/trunk-dev
>
> ** Changed in: ipython
>       Status: In Progress => Fix Committed
>
> --
> %doctest_mode broken in trunk
> https://bugs.launchpad.net/bugs/505404
> You received this bug notification because you are a member of IPython
> Developers, which is subscribed to IPython.
>
> Status in IPython - Enhanced Interactive Python: Fix Committed
>
> Bug description:
> In [1]: %doctest_mode
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call last)
>
> /home/fperez/ipython/repo/trunk-dev/<ipython console> in <module>()
>
> /home/fperez/ipython/repo/trunk-dev/IPython/core/iplib.pyc in magic(self, arg_s)
>   1621             with nested(self.builtin_trap,):
>   1622                 result = fn(magic_args)
> -> 1623                 return result
>   1624
>   1625     def define_magic(self, magicname, func):
>
> /usr/lib/python2.6/contextlib.pyc in __exit__(self, type, value, traceback)
>     32                 value = type()
>     33             try:
> ---> 34                 self.gen.throw(type, value, traceback)
>     35                 raise RuntimeError("generator didn't stop after throw()")
>     36             except StopIteration, exc:
>
> /usr/lib/python2.6/contextlib.pyc in nested(*managers)
>    111             vars.append(enter())
>    112             exits.append(exit)
> --> 113         yield vars
>    114     except:
>    115         exc = sys.exc_info()
>
> /home/fperez/ipython/repo/trunk-dev/IPython/core/iplib.pyc in magic(self, arg_s)
>   1620             magic_args = self.var_expand(magic_args,1)
>   1621             with nested(self.builtin_trap,):
> -> 1622                 result = fn(magic_args)
>   1623                 return result
>   1624
>
> /home/fperez/ipython/repo/trunk-dev/IPython/core/magic.pyc in magic_doctest_mode(self, parameter_s)
>   3397
>   3398         # XXX - Fix this to have cleaner activate/deactivate calls.
>
> -> 3399         from IPython.extensions import InterpreterPasteInput as ipaste
>   3400         from IPython.utils.ipstruct import Struct
>   3401
>
> ImportError: cannot import name InterpreterPasteInput
>
>
>

--
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
<email address hidden>
<email address hidden>

Fernando Perez (fdo.perez) wrote :

On Sun, Jan 10, 2010 at 4:52 PM, Brian Granger <email address hidden> wrote:
> I see that the old InterpreterPasteInput was in extensions.  Where did
> the new stuff go?

I integrated it right into core/prefilter itself. I liked a lot how
you laid it out, and it seemed the most natural place for this:

http://bazaar.launchpad.net/~fdo.perez/ipython/trunk-dev/revision/1281

Initially I thought of it as an 'extension', and then I realized it
would be really nice to have all the time, so I studied the new
prefiltermanager machinery, and it looked like a great fit.

> As we fix things that were in extensions, I think we will have to
> decide where these things
> will go.  Some possibilities:
>
> * extensions
> * core
> * lib
>
> We should decide these things now so things don't end up all over the
> place.

Yes, though I think it will need to be done on a case-by-case basis.
Like in this case, I basically 'upgraded' the extension to a real,
all-the-time-on new feature. There will be others that will make
sense as extensions, I'm sure. But I don't think we can have a
blanket policy, in each case we'll have to make a judgment call.

Cheers,

f

Brian Granger (ellisonbg) wrote :
Download full text (3.6 KiB)

On Sun, Jan 10, 2010 at 5:05 PM, Fernando Perez <email address hidden> wrote:
> On Sun, Jan 10, 2010 at 4:52 PM, Brian Granger <email address hidden> wrote:
>> I see that the old InterpreterPasteInput was in extensions.  Where did
>> the new stuff go?
>
> I integrated it right into core/prefilter itself.  I liked a lot how
> you laid it out, and it seemed the most natural place for this:
>
> http://bazaar.launchpad.net/~fdo.perez/ipython/trunk-dev/revision/1281
>
> Initially I thought of it as an 'extension', and then I realized it
> would be really nice to have all the time, so I studied the new
> prefiltermanager machinery, and it looked like a great fit.

Great, I will review...

>> As we fix things that were in extensions, I think we will have to
>> decide where these things
>> will go.  Some possibilities:
>>
>> * extensions
>> * core
>> * lib
>>
>> We should decide these things now so things don't end up all over the
>> place.
>
> Yes, though I think it will need to be done on a case-by-case basis.
> Like in this case, I basically 'upgraded' the extension to a real,
> all-the-time-on new feature.  There will be others that will make
> sense as extensions, I'm sure.  But I don't think we can have a
> blanket policy, in each case we'll have to make a judgment call.

Yes, ideally any old extensions that really belong in the core can be
moved there
as they are fixed and upgraded.

Sounds good.

Brian

> Cheers,
>
> f
>
> --
> %doctest_mode broken in trunk
> https://bugs.launchpad.net/bugs/505404
> You received this bug notification because you are a member of IPython
> Developers, which is subscribed to IPython.
>
> Status in IPython - Enhanced Interactive Python: Fix Committed
>
> Bug description:
> In [1]: %doctest_mode
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call last)
>
> /home/fperez/ipython/repo/trunk-dev/<ipython console> in <module>()
>
> /home/fperez/ipython/repo/trunk-dev/IPython/core/iplib.pyc in magic(self, arg_s)
>   1621             with nested(self.builtin_trap,):
>   1622                 result = fn(magic_args)
> -> 1623                 return result
>   1624
>   1625     def define_magic(self, magicname, func):
>
> /usr/lib/python2.6/contextlib.pyc in __exit__(self, type, value, traceback)
>     32                 value = type()
>     33             try:
> ---> 34                 self.gen.throw(type, value, traceback)
>     35                 raise RuntimeError("generator didn't stop after throw()")
>     36             except StopIteration, exc:
>
> /usr/lib/python2.6/contextlib.pyc in nested(*managers)
>    111             vars.append(enter())
>    112             exits.append(exit)
> --> 113         yield vars
>    114     except:
>    115         exc = sys.exc_info()
>
> /home/fperez/ipython/repo/trunk-dev/IPython/core/iplib.pyc in magic(self, arg_s)
>   1620             magic_args = self.var_expand(magic_args,1)
>   1621             with nested(self.builtin_trap,):
> -> 1622                 result = fn(magic_args)
>   1623                 return result
>   1624
>
> /home/fperez/ipython/repo/trunk-dev/IPython/core/mag...

Read more...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers