From jorgen.stenarson at bostream.nu Fri Jun 1 15:19:25 2007 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Fri, 01 Jun 2007 21:19:25 +0200 Subject: [IPython-dev] Bug in input filtering Message-ID: <4660713D.7030909@bostream.nu> Hi I think I have found two bugs in the input filtering. 1. wildcard search is broken In [8]: import os In [9]: ?os.p* ------------------------------------------------------------ File "", line 1 ?os.p* ^ SyntaxError: invalid syntax 2. extended help with ?? doesn't work at all. In [11]: ??os.path ------------------------------------------------------------ File "", line 1 ??os.path ^ SyntaxError: invalid syntax /J?rgen From jorgen.stenarson at bostream.nu Fri Jun 1 15:23:33 2007 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Fri, 01 Jun 2007 21:23:33 +0200 Subject: [IPython-dev] Bug in help Message-ID: <46607235.8080002@bostream.nu> I can't get any help at the prompt on the magic commands In [23]: help %run --------------------------------------------------------------------------- NameError Traceback (most recent call last) /Users/jorgenstenarson/programming/python/ipython/ NameError: name 'run' is not defined I don't find them with search either. However I don't remember if they used to show up. In [26]: %psearch %run In [27]: %psearch %* I don't have any time to look into this myself now but I thought I should at least report the problems. /J?rgen From steve at shrogers.com Sun Jun 3 16:37:34 2007 From: steve at shrogers.com (Steven H. Rogers) Date: Sun, 03 Jun 2007 14:37:34 -0600 Subject: [IPython-dev] Bug in help In-Reply-To: <46607235.8080002@bostream.nu> References: <46607235.8080002@bostream.nu> Message-ID: <4663268E.4070004@shrogers.com> J?rgen Stenarson wrote: > I can't get any help at the prompt on the magic commands > > In [23]: help %run Not sure this is a bug as 'help' is standard Python help() which doesn't know about IPython magic. Try: ?%run # Steve From vivainio at gmail.com Mon Jun 4 08:13:30 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Mon, 4 Jun 2007 14:13:30 +0200 Subject: [IPython-dev] Bug in input filtering In-Reply-To: <4660713D.7030909@bostream.nu> References: <4660713D.7030909@bostream.nu> Message-ID: <46cb515a0706040513p9f56834ie5dadf8c57c256ed@mail.gmail.com> On 6/1/07, J?rgen Stenarson wrote: > Hi I think I have found two bugs in the input filtering. > > 1. wildcard search is broken > > In [8]: import os > > In [9]: ?os.p* This works correctly for me. > 2. extended help with ?? doesn't work at all. > > In [11]: ??os.path > ------------------------------------------------------------ > File "", line 1 > ??os.path > ^ > SyntaxError: invalid syntax Now that's true, fails for me as well. Incidentally, do you have some particular reason to use '??os.path' instead of 'os.path??' ? -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Mon Jun 4 11:55:53 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Mon, 4 Jun 2007 17:55:53 +0200 Subject: [IPython-dev] Plan for empowering aliases Message-ID: <46cb515a0706040855i58027fb3ob86871d997e925ce@mail.gmail.com> A while age I posted about getting rid of the aliases, and the "shadow namespace". Now here's a simple, concrete plan I have for empowering aliases - putting callables in the 'alias table', and having a way to call them with simple syntax. This will allow us to get over the 'alias == system command' limitation, without polluting the user namespace. So, if the alias 'foo' maps to a callable in the alias_table, 'foo 1, 2' will be translated to: _sh.foo(1,2) (where args are translated via normal autocall stuff). _sh stands for "shadow namespace" here. Current aliases will *not* be available in the _sh namespace, but the translatable callables will be both in _sh and alias_table. I think the shadow namespace will be an (initially empty) module named 'shadowns', referred to by '_sh' shorthand in the user_ns. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From thorsten at thorstenkampe.de Wed Jun 13 12:08:56 2007 From: thorsten at thorstenkampe.de (Thorsten Kampe) Date: Wed, 13 Jun 2007 17:08:56 +0100 Subject: [IPython-dev] Follow-up to prompt bug Message-ID: Hi, this is a follow-up to the yet unsolved "prompt bug"[1]. A short summary: a coloured prompt (like [2]) shows strange characters in the output prompt when Cygwin Ipython is run in a Windows console. It doesn't show with Windows IPython/pyreadline and with Cygwin IPython/readline and rxvt. I found today another issue that might solve this problem, too: I installed web.py[3] - Alex Martelli's favourite web framework. When I run "import web" on a Windows console the input and continuation prompt get severely mangled: Cygwin Ipython: ????[2]??>>> ?? Windows Ipython: ??[0;32m???[1;37m?[4]??[1;36m?>>> ??[0m? As always Cygwin Ipython/rxvt are unaffected. I don't know whether Ipython has a bug in this regard or web.py /but/ I think that if the cause of this error is found then we also have the root cause why Cygwin Ipython's output prompt is mangled and solved bug #145. Thorsten [1] http://projects.scipy.org/ipython/ipython/ticket/145 [2] prompt_in1 '\C_White[\N]\C_LightCyan>>> ' prompt_in2 '\C_LightCyan\D..... ' prompt_out '\C_White[\N] ' [3] http://webpy.org/ From vivainio at gmail.com Thu Jun 14 11:35:38 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 14 Jun 2007 18:35:38 +0300 Subject: [IPython-dev] pyreadline: getting callbacks for keypresses from pyreadline Message-ID: <46cb515a0706140835w501dab79s7cab6e55331150fb@mail.gmail.com> Is it possible to register certain keys to certain functions that are called when that key is pressed? I'm thinking of something like: def my_translator(line, curpos): return (line +"appended", curpos) readline.bind_translator("Alt-e", my_translator) where my_translator returns the new content for corrent line, along with cursor position. This could be used e.g. to launch external editor for current command line, something that seems to exist in Vi mode. We should rig the IPython default editor for something like this. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' T From vivainio at gmail.com Thu Jun 14 14:14:52 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 14 Jun 2007 21:14:52 +0300 Subject: [IPython-dev] New approach to loading extensions - _ip.load() Message-ID: <46cb515a0706141114n5e1a5a60i73cc518b05d6badb@mail.gmail.com> At this point just importing the extensions didn't scale anymore, so I moved from the bare ip = IPython.ipapi.get() to introducing 'init_ipython(ip)' function that gets run when you run _ip.load. What _ip.load is: - It imports the module - It runs init_ipython(ip) if the module has one. 'ip' is an ipapi instance. IPython.ipapi.get() approach still works, of course, but some modules/extensions *need* to be imported with _ip.load. IPython.history is a first such extension. Basically, modules that need to be 'load':ed are the ones that can be imported w/o also outside IPython contex (general purpose modules), or the ones that are imported by IPython itself before the 'configuration' phase (e.g. the ones imported ipapi.py, as opposed ipy_system_conf.py). New modules are recommended to be implemented using the init_ipython approach. The following changeset should give you the idea: http://projects.scipy.org/ipython/ipython/changeset/2434 -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Thu Jun 14 17:39:05 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 14 Jun 2007 15:39:05 -0600 Subject: [IPython-dev] pyreadline: getting callbacks for keypresses from pyreadline In-Reply-To: <46cb515a0706140835w501dab79s7cab6e55331150fb@mail.gmail.com> References: <46cb515a0706140835w501dab79s7cab6e55331150fb@mail.gmail.com> Message-ID: On 6/14/07, Ville M. Vainio wrote: > Is it possible to register certain keys to certain functions that are > called when that key is pressed? I'm thinking of something like: > > def my_translator(line, curpos): > return (line +"appended", curpos) > > readline.bind_translator("Alt-e", my_translator) > > where my_translator returns the new content for corrent line, along > with cursor position. > > This could be used e.g. to launch external editor for current command > line, something that seems to exist in Vi mode. We should rig the > IPython default editor for something like this. I think that GNU readline does allow this, but I'm not 100% sure. Then, there's the question of whether it will be available to ipython itself. You can check the GNU readline docs and see if it's possible via a call to readline.parse_and_bind(" some syntax here to bind key->cmd ") but I honestly don't really know (and can't check right now) if it works. Cheers, f From vivainio at gmail.com Thu Jun 14 17:51:58 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Fri, 15 Jun 2007 00:51:58 +0300 Subject: [IPython-dev] pyreadline: getting callbacks for keypresses from pyreadline In-Reply-To: References: <46cb515a0706140835w501dab79s7cab6e55331150fb@mail.gmail.com> Message-ID: <46cb515a0706141451p78588d50vdf3c6caba35bd446@mail.gmail.com> On 6/15/07, Fernando Perez wrote: > I think that GNU readline does allow this, but I'm not 100% sure. > Then, there's the question of whether it will be available to ipython > itself. You can check the GNU readline docs and see if it's possible > via a call to > > readline.parse_and_bind(" some syntax here to bind key->cmd ") This does not allow binding an arbitrary callable. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From ellisonbg.net at gmail.com Sat Jun 16 12:53:23 2007 From: ellisonbg.net at gmail.com (Brian Granger) Date: Sat, 16 Jun 2007 10:53:23 -0600 Subject: [IPython-dev] Significant improvements to ipython1 saw Message-ID: <6ce0ac130706160953q2fe38538p86c6f2a072254ed3@mail.gmail.com> Hi, I have just committed a set of improvements to the saw branch. These include: * The IPython engine now handles multi-line input properly. This is done by using the compiler module to compile entire blocks of code at once. This is a huge change from our older approach which relied on the line-by-line approach that is in code.py. This affects how both execute and run work. * Improved remote tracebacks. When there are exceptions on an engine due a problem with user code, the user now gets very nice tracebacks that details exactly what was going on on the engine. This makes debugging much more pleasant. * The task submission algorithm has been improved to make sure that any errors are handled and that the task submission process is stopped if there is a problem. The new tracebacks also appear in this context. * We are now using a prototype of the new ipython core in saw. The ipython core represents the next generation of IPython. Basically it is a fully redesigned IPython that is represents ipython's capabilities as a single top-level class, called the Interpreter. The important thing is that this class makes no assumptions about the GUI that will be used, so for instance, it is not welded to readline. Currently the core being used is functional, but does not yet have any of the ipython features like tab-completion, magics, etc., etc. These will gradually begin to appear over the next few months. Please do an svn up and try out the new changes. Let us know if you run into problems. Cheers, Brian From ellisonbg.net at gmail.com Mon Jun 18 12:53:14 2007 From: ellisonbg.net at gmail.com (Brian Granger) Date: Mon, 18 Jun 2007 10:53:14 -0600 Subject: [IPython-dev] New TaskResult object in ipython1's task farming interface Message-ID: <6ce0ac130706180953t114f4164re07eb69f67ee1183@mail.gmail.com> Hi, Over the weekend, I did some work to improve the task farming interface. The main change is that the getResult method now returns a new TaskResult object. This object provides a much simpler and intuitive way of accessing task results. If you are using the task system, please do an svn up (of saw) and try this out. Let us know if you find problems or if there are further improvements/changes that you would like to see. Here is a brief description of the TaskResult object: A TaskResult instance is returned when getTaskResult is called. It has the following attributes: engineID - the id of the engine that did the task taskID - the integer task id that the task is tracked by failure - a twisted failure object if the task failed otherwise None keys - a list of variable names that were pulled back (the resultNames). The values of these keys are also available as attributes of the instance: if resultNames = ['a','b'] and tr =getTaskResult(taskID) then tr.a tr.b Has the values of a and b. The TaskResult object also has a raiseException method that will re-raise any remote exceptions that occurred in the running of the task. Cheers, Brian From ellisonbg.net at gmail.com Thu Jun 21 18:29:10 2007 From: ellisonbg.net at gmail.com (Brian Granger) Date: Thu, 21 Jun 2007 16:29:10 -0600 Subject: [IPython-dev] Critical bug fix in ipython1 Message-ID: <6ce0ac130706211529v67098ed5o6d6bf9efed0a81bd@mail.gmail.com> Hi all, The recent changes we made to ipython1/saw broke the execution of multiline input that didn't end with a newline. We have fixed this in svn. Please do an svn up and make sure all of your stuff works. Cheers, Brian From ellisonbg.net at gmail.com Fri Jun 22 15:36:45 2007 From: ellisonbg.net at gmail.com (Brian Granger) Date: Fri, 22 Jun 2007 13:36:45 -0600 Subject: [IPython-dev] Testing help needed with IPython1 Message-ID: <6ce0ac130706221236o24881a4ai64b7d4fa63e56a34@mail.gmail.com> Hello all, We have been chasing down some extremely subtle edge cases in the IPython1 interpreter (branches/saw) over the last few days. We think we have this solved, but we are running into some undocumented dark corners of the compiler module. For those of you using ipython1 saw, could you do an svn up and run some of your code and see if it works. Thanks. We are hoping to get these things worked out ASAP - hopefully we are already there. Brian From fperez.net at gmail.com Fri Jun 22 16:08:00 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 22 Jun 2007 14:08:00 -0600 Subject: [IPython-dev] Testing help needed with IPython1 In-Reply-To: <6ce0ac130706221236o24881a4ai64b7d4fa63e56a34@mail.gmail.com> References: <6ce0ac130706221236o24881a4ai64b7d4fa63e56a34@mail.gmail.com> Message-ID: On 6/22/07, Brian Granger wrote: > Hello all, > > We have been chasing down some extremely subtle edge cases in the > IPython1 interpreter (branches/saw) over the last few days. We think > we have this solved, but we are running into some undocumented dark > corners of the compiler module. For those of you using ipython1 saw, > could you do an svn up and run some of your code and see if it works. > Thanks. We are hoping to get these things worked out ASAP - hopefully > we are already there. And if anyone on the list happens to be an expert on the internals of how Python's AST code is supposed to work (this stuff is more or less undocumented, except for the AST construction code itself), please let us know. It might come handy to know we have an expert on this topic 'on call', since the debugging for this stuff has been, ahem, 'fun'. Cheers, f From stefan at sun.ac.za Fri Jun 22 17:34:43 2007 From: stefan at sun.ac.za (Stefan van der Walt) Date: Fri, 22 Jun 2007 23:34:43 +0200 Subject: [IPython-dev] Testing help needed with IPython1 In-Reply-To: References: <6ce0ac130706221236o24881a4ai64b7d4fa63e56a34@mail.gmail.com> Message-ID: <20070622213442.GL20362@mentat.za.net> On Fri, Jun 22, 2007 at 02:08:00PM -0600, Fernando Perez wrote: > And if anyone on the list happens to be an expert on the internals of > how Python's AST code is supposed to work (this stuff is more or less > undocumented, except for the AST construction code itself), please let > us know. It might come handy to know we have an expert on this topic > 'on call', since the debugging for this stuff has been, ahem, 'fun'. I am curious -- how are you guys planning to use the AST? Creating an AST tree from source code is one thing, but can a person reconstruct code from an AST tree for execution? Cheers St?fan From robert.kern at gmail.com Fri Jun 22 16:37:13 2007 From: robert.kern at gmail.com (Robert Kern) Date: Fri, 22 Jun 2007 15:37:13 -0500 Subject: [IPython-dev] Testing help needed with IPython1 In-Reply-To: References: <6ce0ac130706221236o24881a4ai64b7d4fa63e56a34@mail.gmail.com> Message-ID: Fernando Perez wrote: > And if anyone on the list happens to be an expert on the internals of > how Python's AST code is supposed to work (this stuff is more or less > undocumented, except for the AST construction code itself), please let > us know. It might come handy to know we have an expert on this topic > 'on call', since the debugging for this stuff has been, ahem, 'fun'. Aren't you so glad I dropped that piece of code on you? :-) -- 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 fperez.net at gmail.com Fri Jun 22 17:48:21 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 22 Jun 2007 15:48:21 -0600 Subject: [IPython-dev] Testing help needed with IPython1 In-Reply-To: <20070622213442.GL20362@mentat.za.net> References: <6ce0ac130706221236o24881a4ai64b7d4fa63e56a34@mail.gmail.com> <20070622213442.GL20362@mentat.za.net> Message-ID: On 6/22/07, Stefan van der Walt wrote: > On Fri, Jun 22, 2007 at 02:08:00PM -0600, Fernando Perez wrote: > > And if anyone on the list happens to be an expert on the internals of > > how Python's AST code is supposed to work (this stuff is more or less > > undocumented, except for the AST construction code itself), please let > > us know. It might come handy to know we have an expert on this topic > > 'on call', since the debugging for this stuff has been, ahem, 'fun'. > > I am curious -- how are you guys planning to use the AST? Creating an > AST tree from source code is one thing, but can a person reconstruct > code from an AST tree for execution? We're not planning, we're using it :) This comes from code contributed by R. Kern recently, and it allows us to properly compute from source input what multiline input blocks should be considered 'units' for execution. Today's ipython has the limitations inherited from code.py, which tries to guess when an input sequence is finished via some finicky conventions on trailing blank lines. By building the AST, we can properly identify the split points, so that multiline input can be fed with arbitrary whitespace just like in a normal file, and IPython won't choke. After using the AST for splitting, we feed each chunk of original source to the compiler for real compilation and execution. All of this is in saw, in the core/interpreter.py file, if you're curious. Cheers, f From fperez.net at gmail.com Fri Jun 22 17:49:32 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 22 Jun 2007 15:49:32 -0600 Subject: [IPython-dev] Testing help needed with IPython1 In-Reply-To: References: <6ce0ac130706221236o24881a4ai64b7d4fa63e56a34@mail.gmail.com> Message-ID: On 6/22/07, Robert Kern wrote: > Fernando Perez wrote: > > > And if anyone on the list happens to be an expert on the internals of > > how Python's AST code is supposed to work (this stuff is more or less > > undocumented, except for the AST construction code itself), please let > > us know. It might come handy to know we have an expert on this topic > > 'on call', since the debugging for this stuff has been, ahem, 'fun'. > > Aren't you so glad I dropped that piece of code on you? :-) Actually, we are :) While that stuff is a bit painful to debug sometimes, it is ultimately the right way to tackle the problem (FAR better than that messy stateful approach that code.py uses). So yes, thanks for the pain, it's good for us ;) Cheers, f From ellisonbg.net at gmail.com Fri Jun 22 17:57:34 2007 From: ellisonbg.net at gmail.com (Brian Granger) Date: Fri, 22 Jun 2007 15:57:34 -0600 Subject: [IPython-dev] Testing help needed with IPython1 In-Reply-To: References: <6ce0ac130706221236o24881a4ai64b7d4fa63e56a34@mail.gmail.com> Message-ID: <6ce0ac130706221457t3bbe7117wc34e3db7642e6d47@mail.gmail.com> > > And if anyone on the list happens to be an expert on the internals of > > how Python's AST code is supposed to work (this stuff is more or less > > undocumented, except for the AST construction code itself), please let > > us know. It might come handy to know we have an expert on this topic > > 'on call', since the debugging for this stuff has been, ahem, 'fun'. > Aren't you so glad I dropped that piece of code on you? :-) In the global picture, yes...now that more of the funny business is out of the way. But now it works and it is _much_ better than the hack that is code.py. > -- > 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 > > _______________________________________________ > IPython-dev mailing list > IPython-dev at scipy.org > http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev > From sfamix at users.sourceforge.net Tue Jun 26 16:39:26 2007 From: sfamix at users.sourceforge.net (Andreas M.) Date: Tue, 26 Jun 2007 22:39:26 +0200 Subject: [IPython-dev] Problems with external commands and help() Message-ID: <4681797E.7060307@users.sourceforge.net> Hello, I use Py 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] IPy 0.8.1 on WindowsXP Pro/SP2. I have defined the %HOME% env-var. I also have the %EDITOR% set. None of the !commands work. When trying to invoke the external editor I get this: [amix]|9> %edit IPython will make a temporary file named: h:\amix\temp\ipython_edit_ofs9wj.py Editing... done. Executing edited code... Could not open file for safe execution. WARNING: File not found. Did you forget to save? No editor popped up! When I open the help utility it goes like this (example): In [2]: import datetime help> modules datetime Here is a list of matching modules. Enter any module name to get more help. datetime - Fast implementation of the datetime type. test.test_datetime - Test date/time type. zope.interface.common.idatetime - Datetime interfaces. zope.interface.common.tests.test_idatetime - Test for datetime interfaces help> datetime help> Also, doing help('datetime') or help(datetime) does not yield any results, nor does it with any other module. My %PYTHONPATH% is set and so is %PYTHONDOCS%. I tried it both with CMD.EXE as backend-shell as well as Powershell 1.0 Any ideas ? -- Andreas M. From vivainio at gmail.com Wed Jun 27 19:09:24 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 28 Jun 2007 02:09:24 +0300 Subject: [IPython-dev] New generic inspect_object Message-ID: <46cb515a0706271609v529bd326od081c50e51d617e1@mail.gmail.com> I just checked in a new generic function "inspect_object". Basically, you can use it to customize how your objects are displayed when you do obj? or obj?? Hypothetical examples: a "path" object could launch an explorer window in the directory if the path points to a directory, an image object could launch a window displaying the image etc. etc. Modern syntax would be: @IPython.generics.inspect_object.when_type(path) def my_display(obj): print "Inspecting",obj -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'