##// END OF EJS Templates
Quote aliases w/ spaces in target name...
vivainio -
Show More
@@ -1,102 +1,102 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """ IPython extension: add %rehashdir magic
2 """ IPython extension: add %rehashdir magic
3
3
4 Usage:
4 Usage:
5
5
6 %rehashdir c:/bin c:/tools
6 %rehashdir c:/bin c:/tools
7 - Add all executables under c:/bin and c:/tools to alias table, in
7 - Add all executables under c:/bin and c:/tools to alias table, in
8 order to make them directly executable from any directory.
8 order to make them directly executable from any directory.
9
9
10 This also serves as an example on how to extend ipython
10 This also serves as an example on how to extend ipython
11 with new magic functions.
11 with new magic functions.
12
12
13 Unlike rest of ipython, this requires Python 2.4 (optional
13 Unlike rest of ipython, this requires Python 2.4 (optional
14 extensions are allowed to do that).
14 extensions are allowed to do that).
15
15
16 To install, add
16 To install, add
17
17
18 "import_mod ext_rehashdir"
18 "import_mod ext_rehashdir"
19
19
20 To your ipythonrc or just execute "import rehash_dir" in ipython
20 To your ipythonrc or just execute "import rehash_dir" in ipython
21 prompt.
21 prompt.
22
22
23
23
24 $Id: InterpreterExec.py 994 2006-01-08 08:29:44Z fperez $
24 $Id: InterpreterExec.py 994 2006-01-08 08:29:44Z fperez $
25 """
25 """
26
26
27 import IPython.ipapi
27 import IPython.ipapi
28 ip = IPython.ipapi.get()
28 ip = IPython.ipapi.get()
29
29
30
30
31 import os,re,fnmatch
31 import os,re,fnmatch
32
32
33 def rehashdir_f(self,arg):
33 def rehashdir_f(self,arg):
34 """ Add executables in all specified dirs to alias table
34 """ Add executables in all specified dirs to alias table
35
35
36 Usage:
36 Usage:
37
37
38 %rehashdir c:/bin c:/tools
38 %rehashdir c:/bin;c:/tools
39 - Add all executables under c:/bin and c:/tools to alias table, in
39 - Add all executables under c:/bin and c:/tools to alias table, in
40 order to make them directly executable from any directory.
40 order to make them directly executable from any directory.
41
41
42 Without arguments, add all executables in current directory.
42 Without arguments, add all executables in current directory.
43
43
44 """
44 """
45
45
46 # most of the code copied from Magic.magic_rehashx
46 # most of the code copied from Magic.magic_rehashx
47
47
48 def isjunk(fname):
48 def isjunk(fname):
49 junk = ['*~']
49 junk = ['*~']
50 for j in junk:
50 for j in junk:
51 if fnmatch.fnmatch(fname, j):
51 if fnmatch.fnmatch(fname, j):
52 return True
52 return True
53 return False
53 return False
54
54
55 if not arg:
55 if not arg:
56 arg = '.'
56 arg = '.'
57 path = map(os.path.abspath,arg.split())
57 path = map(os.path.abspath,arg.split(';'))
58 alias_table = self.shell.alias_table
58 alias_table = self.shell.alias_table
59
59
60 if os.name == 'posix':
60 if os.name == 'posix':
61 isexec = lambda fname:os.path.isfile(fname) and \
61 isexec = lambda fname:os.path.isfile(fname) and \
62 os.access(fname,os.X_OK)
62 os.access(fname,os.X_OK)
63 else:
63 else:
64
64
65 try:
65 try:
66 winext = os.environ['pathext'].replace(';','|').replace('.','')
66 winext = os.environ['pathext'].replace(';','|').replace('.','')
67 except KeyError:
67 except KeyError:
68 winext = 'exe|com|bat|py'
68 winext = 'exe|com|bat|py'
69
69
70 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
70 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
71 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
71 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
72 savedir = os.getcwd()
72 savedir = os.getcwd()
73 try:
73 try:
74 # write the whole loop for posix/Windows so we don't have an if in
74 # write the whole loop for posix/Windows so we don't have an if in
75 # the innermost part
75 # the innermost part
76 if os.name == 'posix':
76 if os.name == 'posix':
77 for pdir in path:
77 for pdir in path:
78 os.chdir(pdir)
78 os.chdir(pdir)
79 for ff in os.listdir(pdir):
79 for ff in os.listdir(pdir):
80 if isexec(ff) and not isjunk(ff):
80 if isexec(ff) and not isjunk(ff):
81 # each entry in the alias table must be (N,name),
81 # each entry in the alias table must be (N,name),
82 # where N is the number of positional arguments of the
82 # where N is the number of positional arguments of the
83 # alias.
83 # alias.
84 src,tgt = os.path.splitext(ff)[0], os.path.abspath(ff)
84 src,tgt = os.path.splitext(ff)[0], os.path.abspath(ff)
85 print "Aliasing:",src,"->",tgt
85 print "Aliasing:",src,"->",tgt
86 alias_table[src] = (0,tgt)
86 alias_table[src] = (0,tgt)
87 else:
87 else:
88 for pdir in path:
88 for pdir in path:
89 os.chdir(pdir)
89 os.chdir(pdir)
90 for ff in os.listdir(pdir):
90 for ff in os.listdir(pdir):
91 if isexec(ff) and not isjunk(ff):
91 if isexec(ff) and not isjunk(ff):
92 src, tgt = execre.sub(r'\1',ff), os.path.abspath(ff)
92 src, tgt = execre.sub(r'\1',ff), os.path.abspath(ff)
93 print "Aliasing:",src,"->",tgt
93 print "Aliasing:",src,"->",tgt
94 alias_table[src] = (0,tgt)
94 alias_table[src] = (0,tgt)
95 # Make sure the alias table doesn't contain keywords or builtins
95 # Make sure the alias table doesn't contain keywords or builtins
96 self.shell.alias_table_validate()
96 self.shell.alias_table_validate()
97 # Call again init_auto_alias() so we get 'rm -i' and other
97 # Call again init_auto_alias() so we get 'rm -i' and other
98 # modified aliases since %rehashx will probably clobber them
98 # modified aliases since %rehashx will probably clobber them
99 self.shell.init_auto_alias()
99 self.shell.init_auto_alias()
100 finally:
100 finally:
101 os.chdir(savedir)
101 os.chdir(savedir)
102 ip.expose_magic("rehashdir",rehashdir_f)
102 ip.expose_magic("rehashdir",rehashdir_f)
@@ -1,2278 +1,2281 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.3 or newer.
5 Requires Python 2.3 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 1202 2006-03-12 06:37:52Z fperez $
9 $Id: iplib.py 1227 2006-03-28 13:20:14Z vivainio $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from __future__ import generators # for 2.2 backwards-compatibility
31 from __future__ import generators # for 2.2 backwards-compatibility
32
32
33 from IPython import Release
33 from IPython import Release
34 __author__ = '%s <%s>\n%s <%s>' % \
34 __author__ = '%s <%s>\n%s <%s>' % \
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
36 __license__ = Release.license
36 __license__ = Release.license
37 __version__ = Release.version
37 __version__ = Release.version
38
38
39 # Python standard modules
39 # Python standard modules
40 import __main__
40 import __main__
41 import __builtin__
41 import __builtin__
42 import StringIO
42 import StringIO
43 import bdb
43 import bdb
44 import cPickle as pickle
44 import cPickle as pickle
45 import codeop
45 import codeop
46 import exceptions
46 import exceptions
47 import glob
47 import glob
48 import inspect
48 import inspect
49 import keyword
49 import keyword
50 import new
50 import new
51 import os
51 import os
52 import pdb
52 import pdb
53 import pydoc
53 import pydoc
54 import re
54 import re
55 import shutil
55 import shutil
56 import string
56 import string
57 import sys
57 import sys
58 import tempfile
58 import tempfile
59 import traceback
59 import traceback
60 import types
60 import types
61 import pickleshare
61 import pickleshare
62
62
63 from pprint import pprint, pformat
63 from pprint import pprint, pformat
64
64
65 # IPython's own modules
65 # IPython's own modules
66 import IPython
66 import IPython
67 from IPython import OInspect,PyColorize,ultraTB
67 from IPython import OInspect,PyColorize,ultraTB
68 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
68 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
69 from IPython.FakeModule import FakeModule
69 from IPython.FakeModule import FakeModule
70 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
70 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
71 from IPython.Logger import Logger
71 from IPython.Logger import Logger
72 from IPython.Magic import Magic
72 from IPython.Magic import Magic
73 from IPython.Prompts import CachedOutput
73 from IPython.Prompts import CachedOutput
74 from IPython.ipstruct import Struct
74 from IPython.ipstruct import Struct
75 from IPython.background_jobs import BackgroundJobManager
75 from IPython.background_jobs import BackgroundJobManager
76 from IPython.usage import cmd_line_usage,interactive_usage
76 from IPython.usage import cmd_line_usage,interactive_usage
77 from IPython.genutils import *
77 from IPython.genutils import *
78 import IPython.ipapi
78 import IPython.ipapi
79
79
80 # Globals
80 # Globals
81
81
82 # store the builtin raw_input globally, and use this always, in case user code
82 # store the builtin raw_input globally, and use this always, in case user code
83 # overwrites it (like wx.py.PyShell does)
83 # overwrites it (like wx.py.PyShell does)
84 raw_input_original = raw_input
84 raw_input_original = raw_input
85
85
86 # compiled regexps for autoindent management
86 # compiled regexps for autoindent management
87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88
88
89
89
90 #****************************************************************************
90 #****************************************************************************
91 # Some utility function definitions
91 # Some utility function definitions
92
92
93 ini_spaces_re = re.compile(r'^(\s+)')
93 ini_spaces_re = re.compile(r'^(\s+)')
94
94
95 def num_ini_spaces(strng):
95 def num_ini_spaces(strng):
96 """Return the number of initial spaces in a string"""
96 """Return the number of initial spaces in a string"""
97
97
98 ini_spaces = ini_spaces_re.match(strng)
98 ini_spaces = ini_spaces_re.match(strng)
99 if ini_spaces:
99 if ini_spaces:
100 return ini_spaces.end()
100 return ini_spaces.end()
101 else:
101 else:
102 return 0
102 return 0
103
103
104 def softspace(file, newvalue):
104 def softspace(file, newvalue):
105 """Copied from code.py, to remove the dependency"""
105 """Copied from code.py, to remove the dependency"""
106
106
107 oldvalue = 0
107 oldvalue = 0
108 try:
108 try:
109 oldvalue = file.softspace
109 oldvalue = file.softspace
110 except AttributeError:
110 except AttributeError:
111 pass
111 pass
112 try:
112 try:
113 file.softspace = newvalue
113 file.softspace = newvalue
114 except (AttributeError, TypeError):
114 except (AttributeError, TypeError):
115 # "attribute-less object" or "read-only attributes"
115 # "attribute-less object" or "read-only attributes"
116 pass
116 pass
117 return oldvalue
117 return oldvalue
118
118
119
119
120 #****************************************************************************
120 #****************************************************************************
121 # Local use exceptions
121 # Local use exceptions
122 class SpaceInInput(exceptions.Exception): pass
122 class SpaceInInput(exceptions.Exception): pass
123
123
124
124
125 #****************************************************************************
125 #****************************************************************************
126 # Local use classes
126 # Local use classes
127 class Bunch: pass
127 class Bunch: pass
128
128
129 class Undefined: pass
129 class Undefined: pass
130
130
131 class InputList(list):
131 class InputList(list):
132 """Class to store user input.
132 """Class to store user input.
133
133
134 It's basically a list, but slices return a string instead of a list, thus
134 It's basically a list, but slices return a string instead of a list, thus
135 allowing things like (assuming 'In' is an instance):
135 allowing things like (assuming 'In' is an instance):
136
136
137 exec In[4:7]
137 exec In[4:7]
138
138
139 or
139 or
140
140
141 exec In[5:9] + In[14] + In[21:25]"""
141 exec In[5:9] + In[14] + In[21:25]"""
142
142
143 def __getslice__(self,i,j):
143 def __getslice__(self,i,j):
144 return ''.join(list.__getslice__(self,i,j))
144 return ''.join(list.__getslice__(self,i,j))
145
145
146 class SyntaxTB(ultraTB.ListTB):
146 class SyntaxTB(ultraTB.ListTB):
147 """Extension which holds some state: the last exception value"""
147 """Extension which holds some state: the last exception value"""
148
148
149 def __init__(self,color_scheme = 'NoColor'):
149 def __init__(self,color_scheme = 'NoColor'):
150 ultraTB.ListTB.__init__(self,color_scheme)
150 ultraTB.ListTB.__init__(self,color_scheme)
151 self.last_syntax_error = None
151 self.last_syntax_error = None
152
152
153 def __call__(self, etype, value, elist):
153 def __call__(self, etype, value, elist):
154 self.last_syntax_error = value
154 self.last_syntax_error = value
155 ultraTB.ListTB.__call__(self,etype,value,elist)
155 ultraTB.ListTB.__call__(self,etype,value,elist)
156
156
157 def clear_err_state(self):
157 def clear_err_state(self):
158 """Return the current error state and clear it"""
158 """Return the current error state and clear it"""
159 e = self.last_syntax_error
159 e = self.last_syntax_error
160 self.last_syntax_error = None
160 self.last_syntax_error = None
161 return e
161 return e
162
162
163 #****************************************************************************
163 #****************************************************************************
164 # Main IPython class
164 # Main IPython class
165
165
166 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
166 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
167 # until a full rewrite is made. I've cleaned all cross-class uses of
167 # until a full rewrite is made. I've cleaned all cross-class uses of
168 # attributes and methods, but too much user code out there relies on the
168 # attributes and methods, but too much user code out there relies on the
169 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
169 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
170 #
170 #
171 # But at least now, all the pieces have been separated and we could, in
171 # But at least now, all the pieces have been separated and we could, in
172 # principle, stop using the mixin. This will ease the transition to the
172 # principle, stop using the mixin. This will ease the transition to the
173 # chainsaw branch.
173 # chainsaw branch.
174
174
175 # For reference, the following is the list of 'self.foo' uses in the Magic
175 # For reference, the following is the list of 'self.foo' uses in the Magic
176 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
176 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
177 # class, to prevent clashes.
177 # class, to prevent clashes.
178
178
179 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
179 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
180 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
180 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
181 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
181 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
182 # 'self.value']
182 # 'self.value']
183
183
184 class InteractiveShell(object,Magic):
184 class InteractiveShell(object,Magic):
185 """An enhanced console for Python."""
185 """An enhanced console for Python."""
186
186
187 # class attribute to indicate whether the class supports threads or not.
187 # class attribute to indicate whether the class supports threads or not.
188 # Subclasses with thread support should override this as needed.
188 # Subclasses with thread support should override this as needed.
189 isthreaded = False
189 isthreaded = False
190
190
191 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
191 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
192 user_ns = None,user_global_ns=None,banner2='',
192 user_ns = None,user_global_ns=None,banner2='',
193 custom_exceptions=((),None),embedded=False):
193 custom_exceptions=((),None),embedded=False):
194
194
195
195
196 # log system
196 # log system
197 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
197 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
198
198
199 # Produce a public API instance
199 # Produce a public API instance
200
200
201 self.api = IPython.ipapi.IPApi(self)
201 self.api = IPython.ipapi.IPApi(self)
202
202
203 # some minimal strict typechecks. For some core data structures, I
203 # some minimal strict typechecks. For some core data structures, I
204 # want actual basic python types, not just anything that looks like
204 # want actual basic python types, not just anything that looks like
205 # one. This is especially true for namespaces.
205 # one. This is especially true for namespaces.
206 for ns in (user_ns,user_global_ns):
206 for ns in (user_ns,user_global_ns):
207 if ns is not None and type(ns) != types.DictType:
207 if ns is not None and type(ns) != types.DictType:
208 raise TypeError,'namespace must be a dictionary'
208 raise TypeError,'namespace must be a dictionary'
209
209
210 # Job manager (for jobs run as background threads)
210 # Job manager (for jobs run as background threads)
211 self.jobs = BackgroundJobManager()
211 self.jobs = BackgroundJobManager()
212
212
213 # track which builtins we add, so we can clean up later
213 # track which builtins we add, so we can clean up later
214 self.builtins_added = {}
214 self.builtins_added = {}
215 # This method will add the necessary builtins for operation, but
215 # This method will add the necessary builtins for operation, but
216 # tracking what it did via the builtins_added dict.
216 # tracking what it did via the builtins_added dict.
217 self.add_builtins()
217 self.add_builtins()
218
218
219 # Do the intuitively correct thing for quit/exit: we remove the
219 # Do the intuitively correct thing for quit/exit: we remove the
220 # builtins if they exist, and our own magics will deal with this
220 # builtins if they exist, and our own magics will deal with this
221 try:
221 try:
222 del __builtin__.exit, __builtin__.quit
222 del __builtin__.exit, __builtin__.quit
223 except AttributeError:
223 except AttributeError:
224 pass
224 pass
225
225
226 # Store the actual shell's name
226 # Store the actual shell's name
227 self.name = name
227 self.name = name
228
228
229 # We need to know whether the instance is meant for embedding, since
229 # We need to know whether the instance is meant for embedding, since
230 # global/local namespaces need to be handled differently in that case
230 # global/local namespaces need to be handled differently in that case
231 self.embedded = embedded
231 self.embedded = embedded
232
232
233 # command compiler
233 # command compiler
234 self.compile = codeop.CommandCompiler()
234 self.compile = codeop.CommandCompiler()
235
235
236 # User input buffer
236 # User input buffer
237 self.buffer = []
237 self.buffer = []
238
238
239 # Default name given in compilation of code
239 # Default name given in compilation of code
240 self.filename = '<ipython console>'
240 self.filename = '<ipython console>'
241
241
242 # Make an empty namespace, which extension writers can rely on both
242 # Make an empty namespace, which extension writers can rely on both
243 # existing and NEVER being used by ipython itself. This gives them a
243 # existing and NEVER being used by ipython itself. This gives them a
244 # convenient location for storing additional information and state
244 # convenient location for storing additional information and state
245 # their extensions may require, without fear of collisions with other
245 # their extensions may require, without fear of collisions with other
246 # ipython names that may develop later.
246 # ipython names that may develop later.
247 self.meta = Struct()
247 self.meta = Struct()
248
248
249 # Create the namespace where the user will operate. user_ns is
249 # Create the namespace where the user will operate. user_ns is
250 # normally the only one used, and it is passed to the exec calls as
250 # normally the only one used, and it is passed to the exec calls as
251 # the locals argument. But we do carry a user_global_ns namespace
251 # the locals argument. But we do carry a user_global_ns namespace
252 # given as the exec 'globals' argument, This is useful in embedding
252 # given as the exec 'globals' argument, This is useful in embedding
253 # situations where the ipython shell opens in a context where the
253 # situations where the ipython shell opens in a context where the
254 # distinction between locals and globals is meaningful.
254 # distinction between locals and globals is meaningful.
255
255
256 # FIXME. For some strange reason, __builtins__ is showing up at user
256 # FIXME. For some strange reason, __builtins__ is showing up at user
257 # level as a dict instead of a module. This is a manual fix, but I
257 # level as a dict instead of a module. This is a manual fix, but I
258 # should really track down where the problem is coming from. Alex
258 # should really track down where the problem is coming from. Alex
259 # Schmolck reported this problem first.
259 # Schmolck reported this problem first.
260
260
261 # A useful post by Alex Martelli on this topic:
261 # A useful post by Alex Martelli on this topic:
262 # Re: inconsistent value from __builtins__
262 # Re: inconsistent value from __builtins__
263 # Von: Alex Martelli <aleaxit@yahoo.com>
263 # Von: Alex Martelli <aleaxit@yahoo.com>
264 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
264 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
265 # Gruppen: comp.lang.python
265 # Gruppen: comp.lang.python
266
266
267 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
267 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
268 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
268 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
269 # > <type 'dict'>
269 # > <type 'dict'>
270 # > >>> print type(__builtins__)
270 # > >>> print type(__builtins__)
271 # > <type 'module'>
271 # > <type 'module'>
272 # > Is this difference in return value intentional?
272 # > Is this difference in return value intentional?
273
273
274 # Well, it's documented that '__builtins__' can be either a dictionary
274 # Well, it's documented that '__builtins__' can be either a dictionary
275 # or a module, and it's been that way for a long time. Whether it's
275 # or a module, and it's been that way for a long time. Whether it's
276 # intentional (or sensible), I don't know. In any case, the idea is
276 # intentional (or sensible), I don't know. In any case, the idea is
277 # that if you need to access the built-in namespace directly, you
277 # that if you need to access the built-in namespace directly, you
278 # should start with "import __builtin__" (note, no 's') which will
278 # should start with "import __builtin__" (note, no 's') which will
279 # definitely give you a module. Yeah, it's somewhat confusing:-(.
279 # definitely give you a module. Yeah, it's somewhat confusing:-(.
280
280
281 if user_ns is None:
281 if user_ns is None:
282 # Set __name__ to __main__ to better match the behavior of the
282 # Set __name__ to __main__ to better match the behavior of the
283 # normal interpreter.
283 # normal interpreter.
284 user_ns = {'__name__' :'__main__',
284 user_ns = {'__name__' :'__main__',
285 '__builtins__' : __builtin__,
285 '__builtins__' : __builtin__,
286 }
286 }
287
287
288 if user_global_ns is None:
288 if user_global_ns is None:
289 user_global_ns = {}
289 user_global_ns = {}
290
290
291 # Assign namespaces
291 # Assign namespaces
292 # This is the namespace where all normal user variables live
292 # This is the namespace where all normal user variables live
293 self.user_ns = user_ns
293 self.user_ns = user_ns
294 # Embedded instances require a separate namespace for globals.
294 # Embedded instances require a separate namespace for globals.
295 # Normally this one is unused by non-embedded instances.
295 # Normally this one is unused by non-embedded instances.
296 self.user_global_ns = user_global_ns
296 self.user_global_ns = user_global_ns
297 # A namespace to keep track of internal data structures to prevent
297 # A namespace to keep track of internal data structures to prevent
298 # them from cluttering user-visible stuff. Will be updated later
298 # them from cluttering user-visible stuff. Will be updated later
299 self.internal_ns = {}
299 self.internal_ns = {}
300
300
301 # Namespace of system aliases. Each entry in the alias
301 # Namespace of system aliases. Each entry in the alias
302 # table must be a 2-tuple of the form (N,name), where N is the number
302 # table must be a 2-tuple of the form (N,name), where N is the number
303 # of positional arguments of the alias.
303 # of positional arguments of the alias.
304 self.alias_table = {}
304 self.alias_table = {}
305
305
306 # A table holding all the namespaces IPython deals with, so that
306 # A table holding all the namespaces IPython deals with, so that
307 # introspection facilities can search easily.
307 # introspection facilities can search easily.
308 self.ns_table = {'user':user_ns,
308 self.ns_table = {'user':user_ns,
309 'user_global':user_global_ns,
309 'user_global':user_global_ns,
310 'alias':self.alias_table,
310 'alias':self.alias_table,
311 'internal':self.internal_ns,
311 'internal':self.internal_ns,
312 'builtin':__builtin__.__dict__
312 'builtin':__builtin__.__dict__
313 }
313 }
314
314
315 # The user namespace MUST have a pointer to the shell itself.
315 # The user namespace MUST have a pointer to the shell itself.
316 self.user_ns[name] = self
316 self.user_ns[name] = self
317
317
318 # We need to insert into sys.modules something that looks like a
318 # We need to insert into sys.modules something that looks like a
319 # module but which accesses the IPython namespace, for shelve and
319 # module but which accesses the IPython namespace, for shelve and
320 # pickle to work interactively. Normally they rely on getting
320 # pickle to work interactively. Normally they rely on getting
321 # everything out of __main__, but for embedding purposes each IPython
321 # everything out of __main__, but for embedding purposes each IPython
322 # instance has its own private namespace, so we can't go shoving
322 # instance has its own private namespace, so we can't go shoving
323 # everything into __main__.
323 # everything into __main__.
324
324
325 # note, however, that we should only do this for non-embedded
325 # note, however, that we should only do this for non-embedded
326 # ipythons, which really mimic the __main__.__dict__ with their own
326 # ipythons, which really mimic the __main__.__dict__ with their own
327 # namespace. Embedded instances, on the other hand, should not do
327 # namespace. Embedded instances, on the other hand, should not do
328 # this because they need to manage the user local/global namespaces
328 # this because they need to manage the user local/global namespaces
329 # only, but they live within a 'normal' __main__ (meaning, they
329 # only, but they live within a 'normal' __main__ (meaning, they
330 # shouldn't overtake the execution environment of the script they're
330 # shouldn't overtake the execution environment of the script they're
331 # embedded in).
331 # embedded in).
332
332
333 if not embedded:
333 if not embedded:
334 try:
334 try:
335 main_name = self.user_ns['__name__']
335 main_name = self.user_ns['__name__']
336 except KeyError:
336 except KeyError:
337 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
337 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
338 else:
338 else:
339 #print "pickle hack in place" # dbg
339 #print "pickle hack in place" # dbg
340 #print 'main_name:',main_name # dbg
340 #print 'main_name:',main_name # dbg
341 sys.modules[main_name] = FakeModule(self.user_ns)
341 sys.modules[main_name] = FakeModule(self.user_ns)
342
342
343 # List of input with multi-line handling.
343 # List of input with multi-line handling.
344 # Fill its zero entry, user counter starts at 1
344 # Fill its zero entry, user counter starts at 1
345 self.input_hist = InputList(['\n'])
345 self.input_hist = InputList(['\n'])
346 # This one will hold the 'raw' input history, without any
346 # This one will hold the 'raw' input history, without any
347 # pre-processing. This will allow users to retrieve the input just as
347 # pre-processing. This will allow users to retrieve the input just as
348 # it was exactly typed in by the user, with %hist -r.
348 # it was exactly typed in by the user, with %hist -r.
349 self.input_hist_raw = InputList(['\n'])
349 self.input_hist_raw = InputList(['\n'])
350
350
351 # list of visited directories
351 # list of visited directories
352 try:
352 try:
353 self.dir_hist = [os.getcwd()]
353 self.dir_hist = [os.getcwd()]
354 except IOError, e:
354 except IOError, e:
355 self.dir_hist = []
355 self.dir_hist = []
356
356
357 # dict of output history
357 # dict of output history
358 self.output_hist = {}
358 self.output_hist = {}
359
359
360 # dict of things NOT to alias (keywords, builtins and some magics)
360 # dict of things NOT to alias (keywords, builtins and some magics)
361 no_alias = {}
361 no_alias = {}
362 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
362 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
363 for key in keyword.kwlist + no_alias_magics:
363 for key in keyword.kwlist + no_alias_magics:
364 no_alias[key] = 1
364 no_alias[key] = 1
365 no_alias.update(__builtin__.__dict__)
365 no_alias.update(__builtin__.__dict__)
366 self.no_alias = no_alias
366 self.no_alias = no_alias
367
367
368 # make global variables for user access to these
368 # make global variables for user access to these
369 self.user_ns['_ih'] = self.input_hist
369 self.user_ns['_ih'] = self.input_hist
370 self.user_ns['_oh'] = self.output_hist
370 self.user_ns['_oh'] = self.output_hist
371 self.user_ns['_dh'] = self.dir_hist
371 self.user_ns['_dh'] = self.dir_hist
372
372
373 # user aliases to input and output histories
373 # user aliases to input and output histories
374 self.user_ns['In'] = self.input_hist
374 self.user_ns['In'] = self.input_hist
375 self.user_ns['Out'] = self.output_hist
375 self.user_ns['Out'] = self.output_hist
376
376
377 # Object variable to store code object waiting execution. This is
377 # Object variable to store code object waiting execution. This is
378 # used mainly by the multithreaded shells, but it can come in handy in
378 # used mainly by the multithreaded shells, but it can come in handy in
379 # other situations. No need to use a Queue here, since it's a single
379 # other situations. No need to use a Queue here, since it's a single
380 # item which gets cleared once run.
380 # item which gets cleared once run.
381 self.code_to_run = None
381 self.code_to_run = None
382
382
383 # escapes for automatic behavior on the command line
383 # escapes for automatic behavior on the command line
384 self.ESC_SHELL = '!'
384 self.ESC_SHELL = '!'
385 self.ESC_HELP = '?'
385 self.ESC_HELP = '?'
386 self.ESC_MAGIC = '%'
386 self.ESC_MAGIC = '%'
387 self.ESC_QUOTE = ','
387 self.ESC_QUOTE = ','
388 self.ESC_QUOTE2 = ';'
388 self.ESC_QUOTE2 = ';'
389 self.ESC_PAREN = '/'
389 self.ESC_PAREN = '/'
390
390
391 # And their associated handlers
391 # And their associated handlers
392 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
392 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
393 self.ESC_QUOTE : self.handle_auto,
393 self.ESC_QUOTE : self.handle_auto,
394 self.ESC_QUOTE2 : self.handle_auto,
394 self.ESC_QUOTE2 : self.handle_auto,
395 self.ESC_MAGIC : self.handle_magic,
395 self.ESC_MAGIC : self.handle_magic,
396 self.ESC_HELP : self.handle_help,
396 self.ESC_HELP : self.handle_help,
397 self.ESC_SHELL : self.handle_shell_escape,
397 self.ESC_SHELL : self.handle_shell_escape,
398 }
398 }
399
399
400 # class initializations
400 # class initializations
401 Magic.__init__(self,self)
401 Magic.__init__(self,self)
402
402
403 # Python source parser/formatter for syntax highlighting
403 # Python source parser/formatter for syntax highlighting
404 pyformat = PyColorize.Parser().format
404 pyformat = PyColorize.Parser().format
405 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
405 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
406
406
407 # hooks holds pointers used for user-side customizations
407 # hooks holds pointers used for user-side customizations
408 self.hooks = Struct()
408 self.hooks = Struct()
409
409
410 # Set all default hooks, defined in the IPython.hooks module.
410 # Set all default hooks, defined in the IPython.hooks module.
411 hooks = IPython.hooks
411 hooks = IPython.hooks
412 for hook_name in hooks.__all__:
412 for hook_name in hooks.__all__:
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 #print "bound hook",hook_name
415 #print "bound hook",hook_name
416
416
417 # Flag to mark unconditional exit
417 # Flag to mark unconditional exit
418 self.exit_now = False
418 self.exit_now = False
419
419
420 self.usage_min = """\
420 self.usage_min = """\
421 An enhanced console for Python.
421 An enhanced console for Python.
422 Some of its features are:
422 Some of its features are:
423 - Readline support if the readline library is present.
423 - Readline support if the readline library is present.
424 - Tab completion in the local namespace.
424 - Tab completion in the local namespace.
425 - Logging of input, see command-line options.
425 - Logging of input, see command-line options.
426 - System shell escape via ! , eg !ls.
426 - System shell escape via ! , eg !ls.
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 - Keeps track of locally defined variables via %who, %whos.
428 - Keeps track of locally defined variables via %who, %whos.
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
430 """
430 """
431 if usage: self.usage = usage
431 if usage: self.usage = usage
432 else: self.usage = self.usage_min
432 else: self.usage = self.usage_min
433
433
434 # Storage
434 # Storage
435 self.rc = rc # This will hold all configuration information
435 self.rc = rc # This will hold all configuration information
436 self.pager = 'less'
436 self.pager = 'less'
437 # temporary files used for various purposes. Deleted at exit.
437 # temporary files used for various purposes. Deleted at exit.
438 self.tempfiles = []
438 self.tempfiles = []
439
439
440 # Keep track of readline usage (later set by init_readline)
440 # Keep track of readline usage (later set by init_readline)
441 self.has_readline = False
441 self.has_readline = False
442
442
443 # template for logfile headers. It gets resolved at runtime by the
443 # template for logfile headers. It gets resolved at runtime by the
444 # logstart method.
444 # logstart method.
445 self.loghead_tpl = \
445 self.loghead_tpl = \
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 #log# opts = %s
448 #log# opts = %s
449 #log# args = %s
449 #log# args = %s
450 #log# It is safe to make manual edits below here.
450 #log# It is safe to make manual edits below here.
451 #log#-----------------------------------------------------------------------
451 #log#-----------------------------------------------------------------------
452 """
452 """
453 # for pushd/popd management
453 # for pushd/popd management
454 try:
454 try:
455 self.home_dir = get_home_dir()
455 self.home_dir = get_home_dir()
456 except HomeDirError,msg:
456 except HomeDirError,msg:
457 fatal(msg)
457 fatal(msg)
458
458
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460
460
461 # Functions to call the underlying shell.
461 # Functions to call the underlying shell.
462
462
463 # utility to expand user variables via Itpl
463 # utility to expand user variables via Itpl
464 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
464 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
465 self.user_ns))
465 self.user_ns))
466 # The first is similar to os.system, but it doesn't return a value,
466 # The first is similar to os.system, but it doesn't return a value,
467 # and it allows interpolation of variables in the user's namespace.
467 # and it allows interpolation of variables in the user's namespace.
468 self.system = lambda cmd: shell(self.var_expand(cmd),
468 self.system = lambda cmd: shell(self.var_expand(cmd),
469 header='IPython system call: ',
469 header='IPython system call: ',
470 verbose=self.rc.system_verbose)
470 verbose=self.rc.system_verbose)
471 # These are for getoutput and getoutputerror:
471 # These are for getoutput and getoutputerror:
472 self.getoutput = lambda cmd: \
472 self.getoutput = lambda cmd: \
473 getoutput(self.var_expand(cmd),
473 getoutput(self.var_expand(cmd),
474 header='IPython system call: ',
474 header='IPython system call: ',
475 verbose=self.rc.system_verbose)
475 verbose=self.rc.system_verbose)
476 self.getoutputerror = lambda cmd: \
476 self.getoutputerror = lambda cmd: \
477 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
477 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
478 self.user_ns)),
478 self.user_ns)),
479 header='IPython system call: ',
479 header='IPython system call: ',
480 verbose=self.rc.system_verbose)
480 verbose=self.rc.system_verbose)
481
481
482 # RegExp for splitting line contents into pre-char//first
482 # RegExp for splitting line contents into pre-char//first
483 # word-method//rest. For clarity, each group in on one line.
483 # word-method//rest. For clarity, each group in on one line.
484
484
485 # WARNING: update the regexp if the above escapes are changed, as they
485 # WARNING: update the regexp if the above escapes are changed, as they
486 # are hardwired in.
486 # are hardwired in.
487
487
488 # Don't get carried away with trying to make the autocalling catch too
488 # Don't get carried away with trying to make the autocalling catch too
489 # much: it's better to be conservative rather than to trigger hidden
489 # much: it's better to be conservative rather than to trigger hidden
490 # evals() somewhere and end up causing side effects.
490 # evals() somewhere and end up causing side effects.
491
491
492 self.line_split = re.compile(r'^([\s*,;/])'
492 self.line_split = re.compile(r'^([\s*,;/])'
493 r'([\?\w\.]+\w*\s*)'
493 r'([\?\w\.]+\w*\s*)'
494 r'(\(?.*$)')
494 r'(\(?.*$)')
495
495
496 # Original re, keep around for a while in case changes break something
496 # Original re, keep around for a while in case changes break something
497 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
497 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
498 # r'(\s*[\?\w\.]+\w*\s*)'
498 # r'(\s*[\?\w\.]+\w*\s*)'
499 # r'(\(?.*$)')
499 # r'(\(?.*$)')
500
500
501 # RegExp to identify potential function names
501 # RegExp to identify potential function names
502 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
502 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
503
503
504 # RegExp to exclude strings with this start from autocalling. In
504 # RegExp to exclude strings with this start from autocalling. In
505 # particular, all binary operators should be excluded, so that if foo
505 # particular, all binary operators should be excluded, so that if foo
506 # is callable, foo OP bar doesn't become foo(OP bar), which is
506 # is callable, foo OP bar doesn't become foo(OP bar), which is
507 # invalid. The characters '!=()' don't need to be checked for, as the
507 # invalid. The characters '!=()' don't need to be checked for, as the
508 # _prefilter routine explicitely does so, to catch direct calls and
508 # _prefilter routine explicitely does so, to catch direct calls and
509 # rebindings of existing names.
509 # rebindings of existing names.
510
510
511 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
511 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
512 # it affects the rest of the group in square brackets.
512 # it affects the rest of the group in square brackets.
513 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
513 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
514 '|^is |^not |^in |^and |^or ')
514 '|^is |^not |^in |^and |^or ')
515
515
516 # try to catch also methods for stuff in lists/tuples/dicts: off
516 # try to catch also methods for stuff in lists/tuples/dicts: off
517 # (experimental). For this to work, the line_split regexp would need
517 # (experimental). For this to work, the line_split regexp would need
518 # to be modified so it wouldn't break things at '['. That line is
518 # to be modified so it wouldn't break things at '['. That line is
519 # nasty enough that I shouldn't change it until I can test it _well_.
519 # nasty enough that I shouldn't change it until I can test it _well_.
520 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
520 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
521
521
522 # keep track of where we started running (mainly for crash post-mortem)
522 # keep track of where we started running (mainly for crash post-mortem)
523 self.starting_dir = os.getcwd()
523 self.starting_dir = os.getcwd()
524
524
525 # Various switches which can be set
525 # Various switches which can be set
526 self.CACHELENGTH = 5000 # this is cheap, it's just text
526 self.CACHELENGTH = 5000 # this is cheap, it's just text
527 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
527 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
528 self.banner2 = banner2
528 self.banner2 = banner2
529
529
530 # TraceBack handlers:
530 # TraceBack handlers:
531
531
532 # Syntax error handler.
532 # Syntax error handler.
533 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
533 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
534
534
535 # The interactive one is initialized with an offset, meaning we always
535 # The interactive one is initialized with an offset, meaning we always
536 # want to remove the topmost item in the traceback, which is our own
536 # want to remove the topmost item in the traceback, which is our own
537 # internal code. Valid modes: ['Plain','Context','Verbose']
537 # internal code. Valid modes: ['Plain','Context','Verbose']
538 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
538 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
539 color_scheme='NoColor',
539 color_scheme='NoColor',
540 tb_offset = 1)
540 tb_offset = 1)
541
541
542 # IPython itself shouldn't crash. This will produce a detailed
542 # IPython itself shouldn't crash. This will produce a detailed
543 # post-mortem if it does. But we only install the crash handler for
543 # post-mortem if it does. But we only install the crash handler for
544 # non-threaded shells, the threaded ones use a normal verbose reporter
544 # non-threaded shells, the threaded ones use a normal verbose reporter
545 # and lose the crash handler. This is because exceptions in the main
545 # and lose the crash handler. This is because exceptions in the main
546 # thread (such as in GUI code) propagate directly to sys.excepthook,
546 # thread (such as in GUI code) propagate directly to sys.excepthook,
547 # and there's no point in printing crash dumps for every user exception.
547 # and there's no point in printing crash dumps for every user exception.
548 if self.isthreaded:
548 if self.isthreaded:
549 sys.excepthook = ultraTB.FormattedTB()
549 sys.excepthook = ultraTB.FormattedTB()
550 else:
550 else:
551 from IPython import CrashHandler
551 from IPython import CrashHandler
552 sys.excepthook = CrashHandler.CrashHandler(self)
552 sys.excepthook = CrashHandler.CrashHandler(self)
553
553
554 # The instance will store a pointer to this, so that runtime code
554 # The instance will store a pointer to this, so that runtime code
555 # (such as magics) can access it. This is because during the
555 # (such as magics) can access it. This is because during the
556 # read-eval loop, it gets temporarily overwritten (to deal with GUI
556 # read-eval loop, it gets temporarily overwritten (to deal with GUI
557 # frameworks).
557 # frameworks).
558 self.sys_excepthook = sys.excepthook
558 self.sys_excepthook = sys.excepthook
559
559
560 # and add any custom exception handlers the user may have specified
560 # and add any custom exception handlers the user may have specified
561 self.set_custom_exc(*custom_exceptions)
561 self.set_custom_exc(*custom_exceptions)
562
562
563 # Object inspector
563 # Object inspector
564 self.inspector = OInspect.Inspector(OInspect.InspectColors,
564 self.inspector = OInspect.Inspector(OInspect.InspectColors,
565 PyColorize.ANSICodeColors,
565 PyColorize.ANSICodeColors,
566 'NoColor')
566 'NoColor')
567 # indentation management
567 # indentation management
568 self.autoindent = False
568 self.autoindent = False
569 self.indent_current_nsp = 0
569 self.indent_current_nsp = 0
570
570
571 # Make some aliases automatically
571 # Make some aliases automatically
572 # Prepare list of shell aliases to auto-define
572 # Prepare list of shell aliases to auto-define
573 if os.name == 'posix':
573 if os.name == 'posix':
574 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
574 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
575 'mv mv -i','rm rm -i','cp cp -i',
575 'mv mv -i','rm rm -i','cp cp -i',
576 'cat cat','less less','clear clear',
576 'cat cat','less less','clear clear',
577 # a better ls
577 # a better ls
578 'ls ls -F',
578 'ls ls -F',
579 # long ls
579 # long ls
580 'll ls -lF',
580 'll ls -lF',
581 # color ls
581 # color ls
582 'lc ls -F -o --color',
582 'lc ls -F -o --color',
583 # ls normal files only
583 # ls normal files only
584 'lf ls -F -o --color %l | grep ^-',
584 'lf ls -F -o --color %l | grep ^-',
585 # ls symbolic links
585 # ls symbolic links
586 'lk ls -F -o --color %l | grep ^l',
586 'lk ls -F -o --color %l | grep ^l',
587 # directories or links to directories,
587 # directories or links to directories,
588 'ldir ls -F -o --color %l | grep /$',
588 'ldir ls -F -o --color %l | grep /$',
589 # things which are executable
589 # things which are executable
590 'lx ls -F -o --color %l | grep ^-..x',
590 'lx ls -F -o --color %l | grep ^-..x',
591 )
591 )
592 elif os.name in ['nt','dos']:
592 elif os.name in ['nt','dos']:
593 auto_alias = ('dir dir /on', 'ls dir /on',
593 auto_alias = ('dir dir /on', 'ls dir /on',
594 'ddir dir /ad /on', 'ldir dir /ad /on',
594 'ddir dir /ad /on', 'ldir dir /ad /on',
595 'mkdir mkdir','rmdir rmdir','echo echo',
595 'mkdir mkdir','rmdir rmdir','echo echo',
596 'ren ren','cls cls','copy copy')
596 'ren ren','cls cls','copy copy')
597 else:
597 else:
598 auto_alias = ()
598 auto_alias = ()
599 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
599 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
600 # Call the actual (public) initializer
600 # Call the actual (public) initializer
601 self.init_auto_alias()
601 self.init_auto_alias()
602 # end __init__
602 # end __init__
603
603
604 def pre_config_initialization(self):
604 def pre_config_initialization(self):
605 """Pre-configuration init method
605 """Pre-configuration init method
606
606
607 This is called before the configuration files are processed to
607 This is called before the configuration files are processed to
608 prepare the services the config files might need.
608 prepare the services the config files might need.
609
609
610 self.rc already has reasonable default values at this point.
610 self.rc already has reasonable default values at this point.
611 """
611 """
612 rc = self.rc
612 rc = self.rc
613
613
614 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
614 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
615
615
616
616
617 def post_config_initialization(self):
617 def post_config_initialization(self):
618 """Post configuration init method
618 """Post configuration init method
619
619
620 This is called after the configuration files have been processed to
620 This is called after the configuration files have been processed to
621 'finalize' the initialization."""
621 'finalize' the initialization."""
622
622
623 rc = self.rc
623 rc = self.rc
624
624
625 # Load readline proper
625 # Load readline proper
626 if rc.readline:
626 if rc.readline:
627 self.init_readline()
627 self.init_readline()
628
628
629 # local shortcut, this is used a LOT
629 # local shortcut, this is used a LOT
630 self.log = self.logger.log
630 self.log = self.logger.log
631
631
632 # Initialize cache, set in/out prompts and printing system
632 # Initialize cache, set in/out prompts and printing system
633 self.outputcache = CachedOutput(self,
633 self.outputcache = CachedOutput(self,
634 rc.cache_size,
634 rc.cache_size,
635 rc.pprint,
635 rc.pprint,
636 input_sep = rc.separate_in,
636 input_sep = rc.separate_in,
637 output_sep = rc.separate_out,
637 output_sep = rc.separate_out,
638 output_sep2 = rc.separate_out2,
638 output_sep2 = rc.separate_out2,
639 ps1 = rc.prompt_in1,
639 ps1 = rc.prompt_in1,
640 ps2 = rc.prompt_in2,
640 ps2 = rc.prompt_in2,
641 ps_out = rc.prompt_out,
641 ps_out = rc.prompt_out,
642 pad_left = rc.prompts_pad_left)
642 pad_left = rc.prompts_pad_left)
643
643
644 # user may have over-ridden the default print hook:
644 # user may have over-ridden the default print hook:
645 try:
645 try:
646 self.outputcache.__class__.display = self.hooks.display
646 self.outputcache.__class__.display = self.hooks.display
647 except AttributeError:
647 except AttributeError:
648 pass
648 pass
649
649
650 # I don't like assigning globally to sys, because it means when embedding
650 # I don't like assigning globally to sys, because it means when embedding
651 # instances, each embedded instance overrides the previous choice. But
651 # instances, each embedded instance overrides the previous choice. But
652 # sys.displayhook seems to be called internally by exec, so I don't see a
652 # sys.displayhook seems to be called internally by exec, so I don't see a
653 # way around it.
653 # way around it.
654 sys.displayhook = self.outputcache
654 sys.displayhook = self.outputcache
655
655
656 # Set user colors (don't do it in the constructor above so that it
656 # Set user colors (don't do it in the constructor above so that it
657 # doesn't crash if colors option is invalid)
657 # doesn't crash if colors option is invalid)
658 self.magic_colors(rc.colors)
658 self.magic_colors(rc.colors)
659
659
660 # Set calling of pdb on exceptions
660 # Set calling of pdb on exceptions
661 self.call_pdb = rc.pdb
661 self.call_pdb = rc.pdb
662
662
663 # Load user aliases
663 # Load user aliases
664 for alias in rc.alias:
664 for alias in rc.alias:
665 self.magic_alias(alias)
665 self.magic_alias(alias)
666 self.hooks.late_startup_hook()
666 self.hooks.late_startup_hook()
667
667
668
668
669 def add_builtins(self):
669 def add_builtins(self):
670 """Store ipython references into the builtin namespace.
670 """Store ipython references into the builtin namespace.
671
671
672 Some parts of ipython operate via builtins injected here, which hold a
672 Some parts of ipython operate via builtins injected here, which hold a
673 reference to IPython itself."""
673 reference to IPython itself."""
674
674
675 # TODO: deprecate all except _ip; 'jobs' should be installed
675 # TODO: deprecate all except _ip; 'jobs' should be installed
676 # by an extension and the rest are under _ip, ipalias is redundant
676 # by an extension and the rest are under _ip, ipalias is redundant
677 builtins_new = dict(__IPYTHON__ = self,
677 builtins_new = dict(__IPYTHON__ = self,
678 ip_set_hook = self.set_hook,
678 ip_set_hook = self.set_hook,
679 jobs = self.jobs,
679 jobs = self.jobs,
680 ipmagic = self.ipmagic,
680 ipmagic = self.ipmagic,
681 ipalias = self.ipalias,
681 ipalias = self.ipalias,
682 ipsystem = self.ipsystem,
682 ipsystem = self.ipsystem,
683 _ip = self.api
683 _ip = self.api
684 )
684 )
685 for biname,bival in builtins_new.items():
685 for biname,bival in builtins_new.items():
686 try:
686 try:
687 # store the orignal value so we can restore it
687 # store the orignal value so we can restore it
688 self.builtins_added[biname] = __builtin__.__dict__[biname]
688 self.builtins_added[biname] = __builtin__.__dict__[biname]
689 except KeyError:
689 except KeyError:
690 # or mark that it wasn't defined, and we'll just delete it at
690 # or mark that it wasn't defined, and we'll just delete it at
691 # cleanup
691 # cleanup
692 self.builtins_added[biname] = Undefined
692 self.builtins_added[biname] = Undefined
693 __builtin__.__dict__[biname] = bival
693 __builtin__.__dict__[biname] = bival
694
694
695 # Keep in the builtins a flag for when IPython is active. We set it
695 # Keep in the builtins a flag for when IPython is active. We set it
696 # with setdefault so that multiple nested IPythons don't clobber one
696 # with setdefault so that multiple nested IPythons don't clobber one
697 # another. Each will increase its value by one upon being activated,
697 # another. Each will increase its value by one upon being activated,
698 # which also gives us a way to determine the nesting level.
698 # which also gives us a way to determine the nesting level.
699 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
699 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
700
700
701 def clean_builtins(self):
701 def clean_builtins(self):
702 """Remove any builtins which might have been added by add_builtins, or
702 """Remove any builtins which might have been added by add_builtins, or
703 restore overwritten ones to their previous values."""
703 restore overwritten ones to their previous values."""
704 for biname,bival in self.builtins_added.items():
704 for biname,bival in self.builtins_added.items():
705 if bival is Undefined:
705 if bival is Undefined:
706 del __builtin__.__dict__[biname]
706 del __builtin__.__dict__[biname]
707 else:
707 else:
708 __builtin__.__dict__[biname] = bival
708 __builtin__.__dict__[biname] = bival
709 self.builtins_added.clear()
709 self.builtins_added.clear()
710
710
711 def set_hook(self,name,hook, priority = 50):
711 def set_hook(self,name,hook, priority = 50):
712 """set_hook(name,hook) -> sets an internal IPython hook.
712 """set_hook(name,hook) -> sets an internal IPython hook.
713
713
714 IPython exposes some of its internal API as user-modifiable hooks. By
714 IPython exposes some of its internal API as user-modifiable hooks. By
715 adding your function to one of these hooks, you can modify IPython's
715 adding your function to one of these hooks, you can modify IPython's
716 behavior to call at runtime your own routines."""
716 behavior to call at runtime your own routines."""
717
717
718 # At some point in the future, this should validate the hook before it
718 # At some point in the future, this should validate the hook before it
719 # accepts it. Probably at least check that the hook takes the number
719 # accepts it. Probably at least check that the hook takes the number
720 # of args it's supposed to.
720 # of args it's supposed to.
721 dp = getattr(self.hooks, name, None)
721 dp = getattr(self.hooks, name, None)
722 if name not in IPython.hooks.__all__:
722 if name not in IPython.hooks.__all__:
723 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
723 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
724 if not dp:
724 if not dp:
725 dp = IPython.hooks.CommandChainDispatcher()
725 dp = IPython.hooks.CommandChainDispatcher()
726
726
727 f = new.instancemethod(hook,self,self.__class__)
727 f = new.instancemethod(hook,self,self.__class__)
728 try:
728 try:
729 dp.add(f,priority)
729 dp.add(f,priority)
730 except AttributeError:
730 except AttributeError:
731 # it was not commandchain, plain old func - replace
731 # it was not commandchain, plain old func - replace
732 dp = f
732 dp = f
733
733
734 setattr(self.hooks,name, dp)
734 setattr(self.hooks,name, dp)
735
735
736
736
737 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
737 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
738
738
739 def set_custom_exc(self,exc_tuple,handler):
739 def set_custom_exc(self,exc_tuple,handler):
740 """set_custom_exc(exc_tuple,handler)
740 """set_custom_exc(exc_tuple,handler)
741
741
742 Set a custom exception handler, which will be called if any of the
742 Set a custom exception handler, which will be called if any of the
743 exceptions in exc_tuple occur in the mainloop (specifically, in the
743 exceptions in exc_tuple occur in the mainloop (specifically, in the
744 runcode() method.
744 runcode() method.
745
745
746 Inputs:
746 Inputs:
747
747
748 - exc_tuple: a *tuple* of valid exceptions to call the defined
748 - exc_tuple: a *tuple* of valid exceptions to call the defined
749 handler for. It is very important that you use a tuple, and NOT A
749 handler for. It is very important that you use a tuple, and NOT A
750 LIST here, because of the way Python's except statement works. If
750 LIST here, because of the way Python's except statement works. If
751 you only want to trap a single exception, use a singleton tuple:
751 you only want to trap a single exception, use a singleton tuple:
752
752
753 exc_tuple == (MyCustomException,)
753 exc_tuple == (MyCustomException,)
754
754
755 - handler: this must be defined as a function with the following
755 - handler: this must be defined as a function with the following
756 basic interface: def my_handler(self,etype,value,tb).
756 basic interface: def my_handler(self,etype,value,tb).
757
757
758 This will be made into an instance method (via new.instancemethod)
758 This will be made into an instance method (via new.instancemethod)
759 of IPython itself, and it will be called if any of the exceptions
759 of IPython itself, and it will be called if any of the exceptions
760 listed in the exc_tuple are caught. If the handler is None, an
760 listed in the exc_tuple are caught. If the handler is None, an
761 internal basic one is used, which just prints basic info.
761 internal basic one is used, which just prints basic info.
762
762
763 WARNING: by putting in your own exception handler into IPython's main
763 WARNING: by putting in your own exception handler into IPython's main
764 execution loop, you run a very good chance of nasty crashes. This
764 execution loop, you run a very good chance of nasty crashes. This
765 facility should only be used if you really know what you are doing."""
765 facility should only be used if you really know what you are doing."""
766
766
767 assert type(exc_tuple)==type(()) , \
767 assert type(exc_tuple)==type(()) , \
768 "The custom exceptions must be given AS A TUPLE."
768 "The custom exceptions must be given AS A TUPLE."
769
769
770 def dummy_handler(self,etype,value,tb):
770 def dummy_handler(self,etype,value,tb):
771 print '*** Simple custom exception handler ***'
771 print '*** Simple custom exception handler ***'
772 print 'Exception type :',etype
772 print 'Exception type :',etype
773 print 'Exception value:',value
773 print 'Exception value:',value
774 print 'Traceback :',tb
774 print 'Traceback :',tb
775 print 'Source code :','\n'.join(self.buffer)
775 print 'Source code :','\n'.join(self.buffer)
776
776
777 if handler is None: handler = dummy_handler
777 if handler is None: handler = dummy_handler
778
778
779 self.CustomTB = new.instancemethod(handler,self,self.__class__)
779 self.CustomTB = new.instancemethod(handler,self,self.__class__)
780 self.custom_exceptions = exc_tuple
780 self.custom_exceptions = exc_tuple
781
781
782 def set_custom_completer(self,completer,pos=0):
782 def set_custom_completer(self,completer,pos=0):
783 """set_custom_completer(completer,pos=0)
783 """set_custom_completer(completer,pos=0)
784
784
785 Adds a new custom completer function.
785 Adds a new custom completer function.
786
786
787 The position argument (defaults to 0) is the index in the completers
787 The position argument (defaults to 0) is the index in the completers
788 list where you want the completer to be inserted."""
788 list where you want the completer to be inserted."""
789
789
790 newcomp = new.instancemethod(completer,self.Completer,
790 newcomp = new.instancemethod(completer,self.Completer,
791 self.Completer.__class__)
791 self.Completer.__class__)
792 self.Completer.matchers.insert(pos,newcomp)
792 self.Completer.matchers.insert(pos,newcomp)
793
793
794 def _get_call_pdb(self):
794 def _get_call_pdb(self):
795 return self._call_pdb
795 return self._call_pdb
796
796
797 def _set_call_pdb(self,val):
797 def _set_call_pdb(self,val):
798
798
799 if val not in (0,1,False,True):
799 if val not in (0,1,False,True):
800 raise ValueError,'new call_pdb value must be boolean'
800 raise ValueError,'new call_pdb value must be boolean'
801
801
802 # store value in instance
802 # store value in instance
803 self._call_pdb = val
803 self._call_pdb = val
804
804
805 # notify the actual exception handlers
805 # notify the actual exception handlers
806 self.InteractiveTB.call_pdb = val
806 self.InteractiveTB.call_pdb = val
807 if self.isthreaded:
807 if self.isthreaded:
808 try:
808 try:
809 self.sys_excepthook.call_pdb = val
809 self.sys_excepthook.call_pdb = val
810 except:
810 except:
811 warn('Failed to activate pdb for threaded exception handler')
811 warn('Failed to activate pdb for threaded exception handler')
812
812
813 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
813 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
814 'Control auto-activation of pdb at exceptions')
814 'Control auto-activation of pdb at exceptions')
815
815
816
816
817 # These special functions get installed in the builtin namespace, to
817 # These special functions get installed in the builtin namespace, to
818 # provide programmatic (pure python) access to magics, aliases and system
818 # provide programmatic (pure python) access to magics, aliases and system
819 # calls. This is important for logging, user scripting, and more.
819 # calls. This is important for logging, user scripting, and more.
820
820
821 # We are basically exposing, via normal python functions, the three
821 # We are basically exposing, via normal python functions, the three
822 # mechanisms in which ipython offers special call modes (magics for
822 # mechanisms in which ipython offers special call modes (magics for
823 # internal control, aliases for direct system access via pre-selected
823 # internal control, aliases for direct system access via pre-selected
824 # names, and !cmd for calling arbitrary system commands).
824 # names, and !cmd for calling arbitrary system commands).
825
825
826 def ipmagic(self,arg_s):
826 def ipmagic(self,arg_s):
827 """Call a magic function by name.
827 """Call a magic function by name.
828
828
829 Input: a string containing the name of the magic function to call and any
829 Input: a string containing the name of the magic function to call and any
830 additional arguments to be passed to the magic.
830 additional arguments to be passed to the magic.
831
831
832 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
832 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
833 prompt:
833 prompt:
834
834
835 In[1]: %name -opt foo bar
835 In[1]: %name -opt foo bar
836
836
837 To call a magic without arguments, simply use ipmagic('name').
837 To call a magic without arguments, simply use ipmagic('name').
838
838
839 This provides a proper Python function to call IPython's magics in any
839 This provides a proper Python function to call IPython's magics in any
840 valid Python code you can type at the interpreter, including loops and
840 valid Python code you can type at the interpreter, including loops and
841 compound statements. It is added by IPython to the Python builtin
841 compound statements. It is added by IPython to the Python builtin
842 namespace upon initialization."""
842 namespace upon initialization."""
843
843
844 args = arg_s.split(' ',1)
844 args = arg_s.split(' ',1)
845 magic_name = args[0]
845 magic_name = args[0]
846 magic_name = magic_name.lstrip(self.ESC_MAGIC)
846 magic_name = magic_name.lstrip(self.ESC_MAGIC)
847
847
848 try:
848 try:
849 magic_args = args[1]
849 magic_args = args[1]
850 except IndexError:
850 except IndexError:
851 magic_args = ''
851 magic_args = ''
852 fn = getattr(self,'magic_'+magic_name,None)
852 fn = getattr(self,'magic_'+magic_name,None)
853 if fn is None:
853 if fn is None:
854 error("Magic function `%s` not found." % magic_name)
854 error("Magic function `%s` not found." % magic_name)
855 else:
855 else:
856 magic_args = self.var_expand(magic_args)
856 magic_args = self.var_expand(magic_args)
857 return fn(magic_args)
857 return fn(magic_args)
858
858
859 def ipalias(self,arg_s):
859 def ipalias(self,arg_s):
860 """Call an alias by name.
860 """Call an alias by name.
861
861
862 Input: a string containing the name of the alias to call and any
862 Input: a string containing the name of the alias to call and any
863 additional arguments to be passed to the magic.
863 additional arguments to be passed to the magic.
864
864
865 ipalias('name -opt foo bar') is equivalent to typing at the ipython
865 ipalias('name -opt foo bar') is equivalent to typing at the ipython
866 prompt:
866 prompt:
867
867
868 In[1]: name -opt foo bar
868 In[1]: name -opt foo bar
869
869
870 To call an alias without arguments, simply use ipalias('name').
870 To call an alias without arguments, simply use ipalias('name').
871
871
872 This provides a proper Python function to call IPython's aliases in any
872 This provides a proper Python function to call IPython's aliases in any
873 valid Python code you can type at the interpreter, including loops and
873 valid Python code you can type at the interpreter, including loops and
874 compound statements. It is added by IPython to the Python builtin
874 compound statements. It is added by IPython to the Python builtin
875 namespace upon initialization."""
875 namespace upon initialization."""
876
876
877 args = arg_s.split(' ',1)
877 args = arg_s.split(' ',1)
878 alias_name = args[0]
878 alias_name = args[0]
879 try:
879 try:
880 alias_args = args[1]
880 alias_args = args[1]
881 except IndexError:
881 except IndexError:
882 alias_args = ''
882 alias_args = ''
883 if alias_name in self.alias_table:
883 if alias_name in self.alias_table:
884 self.call_alias(alias_name,alias_args)
884 self.call_alias(alias_name,alias_args)
885 else:
885 else:
886 error("Alias `%s` not found." % alias_name)
886 error("Alias `%s` not found." % alias_name)
887
887
888 def ipsystem(self,arg_s):
888 def ipsystem(self,arg_s):
889 """Make a system call, using IPython."""
889 """Make a system call, using IPython."""
890
890
891 self.system(arg_s)
891 self.system(arg_s)
892
892
893 def complete(self,text):
893 def complete(self,text):
894 """Return a sorted list of all possible completions on text.
894 """Return a sorted list of all possible completions on text.
895
895
896 Inputs:
896 Inputs:
897
897
898 - text: a string of text to be completed on.
898 - text: a string of text to be completed on.
899
899
900 This is a wrapper around the completion mechanism, similar to what
900 This is a wrapper around the completion mechanism, similar to what
901 readline does at the command line when the TAB key is hit. By
901 readline does at the command line when the TAB key is hit. By
902 exposing it as a method, it can be used by other non-readline
902 exposing it as a method, it can be used by other non-readline
903 environments (such as GUIs) for text completion.
903 environments (such as GUIs) for text completion.
904
904
905 Simple usage example:
905 Simple usage example:
906
906
907 In [1]: x = 'hello'
907 In [1]: x = 'hello'
908
908
909 In [2]: __IP.complete('x.l')
909 In [2]: __IP.complete('x.l')
910 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
910 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
911
911
912 complete = self.Completer.complete
912 complete = self.Completer.complete
913 state = 0
913 state = 0
914 # use a dict so we get unique keys, since ipyhton's multiple
914 # use a dict so we get unique keys, since ipyhton's multiple
915 # completers can return duplicates.
915 # completers can return duplicates.
916 comps = {}
916 comps = {}
917 while True:
917 while True:
918 newcomp = complete(text,state)
918 newcomp = complete(text,state)
919 if newcomp is None:
919 if newcomp is None:
920 break
920 break
921 comps[newcomp] = 1
921 comps[newcomp] = 1
922 state += 1
922 state += 1
923 outcomps = comps.keys()
923 outcomps = comps.keys()
924 outcomps.sort()
924 outcomps.sort()
925 return outcomps
925 return outcomps
926
926
927 def set_completer_frame(self, frame=None):
927 def set_completer_frame(self, frame=None):
928 if frame:
928 if frame:
929 self.Completer.namespace = frame.f_locals
929 self.Completer.namespace = frame.f_locals
930 self.Completer.global_namespace = frame.f_globals
930 self.Completer.global_namespace = frame.f_globals
931 else:
931 else:
932 self.Completer.namespace = self.user_ns
932 self.Completer.namespace = self.user_ns
933 self.Completer.global_namespace = self.user_global_ns
933 self.Completer.global_namespace = self.user_global_ns
934
934
935 def init_auto_alias(self):
935 def init_auto_alias(self):
936 """Define some aliases automatically.
936 """Define some aliases automatically.
937
937
938 These are ALL parameter-less aliases"""
938 These are ALL parameter-less aliases"""
939
939
940 for alias,cmd in self.auto_alias:
940 for alias,cmd in self.auto_alias:
941 self.alias_table[alias] = (0,cmd)
941 self.alias_table[alias] = (0,cmd)
942
942
943 def alias_table_validate(self,verbose=0):
943 def alias_table_validate(self,verbose=0):
944 """Update information about the alias table.
944 """Update information about the alias table.
945
945
946 In particular, make sure no Python keywords/builtins are in it."""
946 In particular, make sure no Python keywords/builtins are in it."""
947
947
948 no_alias = self.no_alias
948 no_alias = self.no_alias
949 for k in self.alias_table.keys():
949 for k in self.alias_table.keys():
950 if k in no_alias:
950 if k in no_alias:
951 del self.alias_table[k]
951 del self.alias_table[k]
952 if verbose:
952 if verbose:
953 print ("Deleting alias <%s>, it's a Python "
953 print ("Deleting alias <%s>, it's a Python "
954 "keyword or builtin." % k)
954 "keyword or builtin." % k)
955
955
956 def set_autoindent(self,value=None):
956 def set_autoindent(self,value=None):
957 """Set the autoindent flag, checking for readline support.
957 """Set the autoindent flag, checking for readline support.
958
958
959 If called with no arguments, it acts as a toggle."""
959 If called with no arguments, it acts as a toggle."""
960
960
961 if not self.has_readline:
961 if not self.has_readline:
962 if os.name == 'posix':
962 if os.name == 'posix':
963 warn("The auto-indent feature requires the readline library")
963 warn("The auto-indent feature requires the readline library")
964 self.autoindent = 0
964 self.autoindent = 0
965 return
965 return
966 if value is None:
966 if value is None:
967 self.autoindent = not self.autoindent
967 self.autoindent = not self.autoindent
968 else:
968 else:
969 self.autoindent = value
969 self.autoindent = value
970
970
971 def rc_set_toggle(self,rc_field,value=None):
971 def rc_set_toggle(self,rc_field,value=None):
972 """Set or toggle a field in IPython's rc config. structure.
972 """Set or toggle a field in IPython's rc config. structure.
973
973
974 If called with no arguments, it acts as a toggle.
974 If called with no arguments, it acts as a toggle.
975
975
976 If called with a non-existent field, the resulting AttributeError
976 If called with a non-existent field, the resulting AttributeError
977 exception will propagate out."""
977 exception will propagate out."""
978
978
979 rc_val = getattr(self.rc,rc_field)
979 rc_val = getattr(self.rc,rc_field)
980 if value is None:
980 if value is None:
981 value = not rc_val
981 value = not rc_val
982 setattr(self.rc,rc_field,value)
982 setattr(self.rc,rc_field,value)
983
983
984 def user_setup(self,ipythondir,rc_suffix,mode='install'):
984 def user_setup(self,ipythondir,rc_suffix,mode='install'):
985 """Install the user configuration directory.
985 """Install the user configuration directory.
986
986
987 Can be called when running for the first time or to upgrade the user's
987 Can be called when running for the first time or to upgrade the user's
988 .ipython/ directory with the mode parameter. Valid modes are 'install'
988 .ipython/ directory with the mode parameter. Valid modes are 'install'
989 and 'upgrade'."""
989 and 'upgrade'."""
990
990
991 def wait():
991 def wait():
992 try:
992 try:
993 raw_input("Please press <RETURN> to start IPython.")
993 raw_input("Please press <RETURN> to start IPython.")
994 except EOFError:
994 except EOFError:
995 print >> Term.cout
995 print >> Term.cout
996 print '*'*70
996 print '*'*70
997
997
998 cwd = os.getcwd() # remember where we started
998 cwd = os.getcwd() # remember where we started
999 glb = glob.glob
999 glb = glob.glob
1000 print '*'*70
1000 print '*'*70
1001 if mode == 'install':
1001 if mode == 'install':
1002 print \
1002 print \
1003 """Welcome to IPython. I will try to create a personal configuration directory
1003 """Welcome to IPython. I will try to create a personal configuration directory
1004 where you can customize many aspects of IPython's functionality in:\n"""
1004 where you can customize many aspects of IPython's functionality in:\n"""
1005 else:
1005 else:
1006 print 'I am going to upgrade your configuration in:'
1006 print 'I am going to upgrade your configuration in:'
1007
1007
1008 print ipythondir
1008 print ipythondir
1009
1009
1010 rcdirend = os.path.join('IPython','UserConfig')
1010 rcdirend = os.path.join('IPython','UserConfig')
1011 cfg = lambda d: os.path.join(d,rcdirend)
1011 cfg = lambda d: os.path.join(d,rcdirend)
1012 try:
1012 try:
1013 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1013 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1014 except IOError:
1014 except IOError:
1015 warning = """
1015 warning = """
1016 Installation error. IPython's directory was not found.
1016 Installation error. IPython's directory was not found.
1017
1017
1018 Check the following:
1018 Check the following:
1019
1019
1020 The ipython/IPython directory should be in a directory belonging to your
1020 The ipython/IPython directory should be in a directory belonging to your
1021 PYTHONPATH environment variable (that is, it should be in a directory
1021 PYTHONPATH environment variable (that is, it should be in a directory
1022 belonging to sys.path). You can copy it explicitly there or just link to it.
1022 belonging to sys.path). You can copy it explicitly there or just link to it.
1023
1023
1024 IPython will proceed with builtin defaults.
1024 IPython will proceed with builtin defaults.
1025 """
1025 """
1026 warn(warning)
1026 warn(warning)
1027 wait()
1027 wait()
1028 return
1028 return
1029
1029
1030 if mode == 'install':
1030 if mode == 'install':
1031 try:
1031 try:
1032 shutil.copytree(rcdir,ipythondir)
1032 shutil.copytree(rcdir,ipythondir)
1033 os.chdir(ipythondir)
1033 os.chdir(ipythondir)
1034 rc_files = glb("ipythonrc*")
1034 rc_files = glb("ipythonrc*")
1035 for rc_file in rc_files:
1035 for rc_file in rc_files:
1036 os.rename(rc_file,rc_file+rc_suffix)
1036 os.rename(rc_file,rc_file+rc_suffix)
1037 except:
1037 except:
1038 warning = """
1038 warning = """
1039
1039
1040 There was a problem with the installation:
1040 There was a problem with the installation:
1041 %s
1041 %s
1042 Try to correct it or contact the developers if you think it's a bug.
1042 Try to correct it or contact the developers if you think it's a bug.
1043 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1043 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1044 warn(warning)
1044 warn(warning)
1045 wait()
1045 wait()
1046 return
1046 return
1047
1047
1048 elif mode == 'upgrade':
1048 elif mode == 'upgrade':
1049 try:
1049 try:
1050 os.chdir(ipythondir)
1050 os.chdir(ipythondir)
1051 except:
1051 except:
1052 print """
1052 print """
1053 Can not upgrade: changing to directory %s failed. Details:
1053 Can not upgrade: changing to directory %s failed. Details:
1054 %s
1054 %s
1055 """ % (ipythondir,sys.exc_info()[1])
1055 """ % (ipythondir,sys.exc_info()[1])
1056 wait()
1056 wait()
1057 return
1057 return
1058 else:
1058 else:
1059 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1059 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1060 for new_full_path in sources:
1060 for new_full_path in sources:
1061 new_filename = os.path.basename(new_full_path)
1061 new_filename = os.path.basename(new_full_path)
1062 if new_filename.startswith('ipythonrc'):
1062 if new_filename.startswith('ipythonrc'):
1063 new_filename = new_filename + rc_suffix
1063 new_filename = new_filename + rc_suffix
1064 # The config directory should only contain files, skip any
1064 # The config directory should only contain files, skip any
1065 # directories which may be there (like CVS)
1065 # directories which may be there (like CVS)
1066 if os.path.isdir(new_full_path):
1066 if os.path.isdir(new_full_path):
1067 continue
1067 continue
1068 if os.path.exists(new_filename):
1068 if os.path.exists(new_filename):
1069 old_file = new_filename+'.old'
1069 old_file = new_filename+'.old'
1070 if os.path.exists(old_file):
1070 if os.path.exists(old_file):
1071 os.remove(old_file)
1071 os.remove(old_file)
1072 os.rename(new_filename,old_file)
1072 os.rename(new_filename,old_file)
1073 shutil.copy(new_full_path,new_filename)
1073 shutil.copy(new_full_path,new_filename)
1074 else:
1074 else:
1075 raise ValueError,'unrecognized mode for install:',`mode`
1075 raise ValueError,'unrecognized mode for install:',`mode`
1076
1076
1077 # Fix line-endings to those native to each platform in the config
1077 # Fix line-endings to those native to each platform in the config
1078 # directory.
1078 # directory.
1079 try:
1079 try:
1080 os.chdir(ipythondir)
1080 os.chdir(ipythondir)
1081 except:
1081 except:
1082 print """
1082 print """
1083 Problem: changing to directory %s failed.
1083 Problem: changing to directory %s failed.
1084 Details:
1084 Details:
1085 %s
1085 %s
1086
1086
1087 Some configuration files may have incorrect line endings. This should not
1087 Some configuration files may have incorrect line endings. This should not
1088 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1088 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1089 wait()
1089 wait()
1090 else:
1090 else:
1091 for fname in glb('ipythonrc*'):
1091 for fname in glb('ipythonrc*'):
1092 try:
1092 try:
1093 native_line_ends(fname,backup=0)
1093 native_line_ends(fname,backup=0)
1094 except IOError:
1094 except IOError:
1095 pass
1095 pass
1096
1096
1097 if mode == 'install':
1097 if mode == 'install':
1098 print """
1098 print """
1099 Successful installation!
1099 Successful installation!
1100
1100
1101 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1101 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1102 IPython manual (there are both HTML and PDF versions supplied with the
1102 IPython manual (there are both HTML and PDF versions supplied with the
1103 distribution) to make sure that your system environment is properly configured
1103 distribution) to make sure that your system environment is properly configured
1104 to take advantage of IPython's features.
1104 to take advantage of IPython's features.
1105
1105
1106 Important note: the configuration system has changed! The old system is
1106 Important note: the configuration system has changed! The old system is
1107 still in place, but its setting may be partly overridden by the settings in
1107 still in place, but its setting may be partly overridden by the settings in
1108 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1108 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1109 if some of the new settings bother you.
1109 if some of the new settings bother you.
1110
1110
1111 """
1111 """
1112 else:
1112 else:
1113 print """
1113 print """
1114 Successful upgrade!
1114 Successful upgrade!
1115
1115
1116 All files in your directory:
1116 All files in your directory:
1117 %(ipythondir)s
1117 %(ipythondir)s
1118 which would have been overwritten by the upgrade were backed up with a .old
1118 which would have been overwritten by the upgrade were backed up with a .old
1119 extension. If you had made particular customizations in those files you may
1119 extension. If you had made particular customizations in those files you may
1120 want to merge them back into the new files.""" % locals()
1120 want to merge them back into the new files.""" % locals()
1121 wait()
1121 wait()
1122 os.chdir(cwd)
1122 os.chdir(cwd)
1123 # end user_setup()
1123 # end user_setup()
1124
1124
1125 def atexit_operations(self):
1125 def atexit_operations(self):
1126 """This will be executed at the time of exit.
1126 """This will be executed at the time of exit.
1127
1127
1128 Saving of persistent data should be performed here. """
1128 Saving of persistent data should be performed here. """
1129
1129
1130 #print '*** IPython exit cleanup ***' # dbg
1130 #print '*** IPython exit cleanup ***' # dbg
1131 # input history
1131 # input history
1132 self.savehist()
1132 self.savehist()
1133
1133
1134 # Cleanup all tempfiles left around
1134 # Cleanup all tempfiles left around
1135 for tfile in self.tempfiles:
1135 for tfile in self.tempfiles:
1136 try:
1136 try:
1137 os.unlink(tfile)
1137 os.unlink(tfile)
1138 except OSError:
1138 except OSError:
1139 pass
1139 pass
1140
1140
1141 # save the "persistent data" catch-all dictionary
1141 # save the "persistent data" catch-all dictionary
1142 self.hooks.shutdown_hook()
1142 self.hooks.shutdown_hook()
1143
1143
1144 def savehist(self):
1144 def savehist(self):
1145 """Save input history to a file (via readline library)."""
1145 """Save input history to a file (via readline library)."""
1146 try:
1146 try:
1147 self.readline.write_history_file(self.histfile)
1147 self.readline.write_history_file(self.histfile)
1148 except:
1148 except:
1149 print 'Unable to save IPython command history to file: ' + \
1149 print 'Unable to save IPython command history to file: ' + \
1150 `self.histfile`
1150 `self.histfile`
1151
1151
1152 def pre_readline(self):
1152 def pre_readline(self):
1153 """readline hook to be used at the start of each line.
1153 """readline hook to be used at the start of each line.
1154
1154
1155 Currently it handles auto-indent only."""
1155 Currently it handles auto-indent only."""
1156
1156
1157 #debugx('self.indent_current_nsp','pre_readline:')
1157 #debugx('self.indent_current_nsp','pre_readline:')
1158 self.readline.insert_text(self.indent_current_str())
1158 self.readline.insert_text(self.indent_current_str())
1159
1159
1160 def init_readline(self):
1160 def init_readline(self):
1161 """Command history completion/saving/reloading."""
1161 """Command history completion/saving/reloading."""
1162
1162
1163 import IPython.rlineimpl as readline
1163 import IPython.rlineimpl as readline
1164 if not readline.have_readline:
1164 if not readline.have_readline:
1165 self.has_readline = 0
1165 self.has_readline = 0
1166 self.readline = None
1166 self.readline = None
1167 # no point in bugging windows users with this every time:
1167 # no point in bugging windows users with this every time:
1168 warn('Readline services not available on this platform.')
1168 warn('Readline services not available on this platform.')
1169 else:
1169 else:
1170 sys.modules['readline'] = readline
1170 sys.modules['readline'] = readline
1171 import atexit
1171 import atexit
1172 from IPython.completer import IPCompleter
1172 from IPython.completer import IPCompleter
1173 self.Completer = IPCompleter(self,
1173 self.Completer = IPCompleter(self,
1174 self.user_ns,
1174 self.user_ns,
1175 self.user_global_ns,
1175 self.user_global_ns,
1176 self.rc.readline_omit__names,
1176 self.rc.readline_omit__names,
1177 self.alias_table)
1177 self.alias_table)
1178
1178
1179 # Platform-specific configuration
1179 # Platform-specific configuration
1180 if os.name == 'nt':
1180 if os.name == 'nt':
1181 self.readline_startup_hook = readline.set_pre_input_hook
1181 self.readline_startup_hook = readline.set_pre_input_hook
1182 else:
1182 else:
1183 self.readline_startup_hook = readline.set_startup_hook
1183 self.readline_startup_hook = readline.set_startup_hook
1184
1184
1185 # Load user's initrc file (readline config)
1185 # Load user's initrc file (readline config)
1186 inputrc_name = os.environ.get('INPUTRC')
1186 inputrc_name = os.environ.get('INPUTRC')
1187 if inputrc_name is None:
1187 if inputrc_name is None:
1188 home_dir = get_home_dir()
1188 home_dir = get_home_dir()
1189 if home_dir is not None:
1189 if home_dir is not None:
1190 inputrc_name = os.path.join(home_dir,'.inputrc')
1190 inputrc_name = os.path.join(home_dir,'.inputrc')
1191 if os.path.isfile(inputrc_name):
1191 if os.path.isfile(inputrc_name):
1192 try:
1192 try:
1193 readline.read_init_file(inputrc_name)
1193 readline.read_init_file(inputrc_name)
1194 except:
1194 except:
1195 warn('Problems reading readline initialization file <%s>'
1195 warn('Problems reading readline initialization file <%s>'
1196 % inputrc_name)
1196 % inputrc_name)
1197
1197
1198 self.has_readline = 1
1198 self.has_readline = 1
1199 self.readline = readline
1199 self.readline = readline
1200 # save this in sys so embedded copies can restore it properly
1200 # save this in sys so embedded copies can restore it properly
1201 sys.ipcompleter = self.Completer.complete
1201 sys.ipcompleter = self.Completer.complete
1202 readline.set_completer(self.Completer.complete)
1202 readline.set_completer(self.Completer.complete)
1203
1203
1204 # Configure readline according to user's prefs
1204 # Configure readline according to user's prefs
1205 for rlcommand in self.rc.readline_parse_and_bind:
1205 for rlcommand in self.rc.readline_parse_and_bind:
1206 readline.parse_and_bind(rlcommand)
1206 readline.parse_and_bind(rlcommand)
1207
1207
1208 # remove some chars from the delimiters list
1208 # remove some chars from the delimiters list
1209 delims = readline.get_completer_delims()
1209 delims = readline.get_completer_delims()
1210 delims = delims.translate(string._idmap,
1210 delims = delims.translate(string._idmap,
1211 self.rc.readline_remove_delims)
1211 self.rc.readline_remove_delims)
1212 readline.set_completer_delims(delims)
1212 readline.set_completer_delims(delims)
1213 # otherwise we end up with a monster history after a while:
1213 # otherwise we end up with a monster history after a while:
1214 readline.set_history_length(1000)
1214 readline.set_history_length(1000)
1215 try:
1215 try:
1216 #print '*** Reading readline history' # dbg
1216 #print '*** Reading readline history' # dbg
1217 readline.read_history_file(self.histfile)
1217 readline.read_history_file(self.histfile)
1218 except IOError:
1218 except IOError:
1219 pass # It doesn't exist yet.
1219 pass # It doesn't exist yet.
1220
1220
1221 atexit.register(self.atexit_operations)
1221 atexit.register(self.atexit_operations)
1222 del atexit
1222 del atexit
1223
1223
1224 # Configure auto-indent for all platforms
1224 # Configure auto-indent for all platforms
1225 self.set_autoindent(self.rc.autoindent)
1225 self.set_autoindent(self.rc.autoindent)
1226
1226
1227 def _should_recompile(self,e):
1227 def _should_recompile(self,e):
1228 """Utility routine for edit_syntax_error"""
1228 """Utility routine for edit_syntax_error"""
1229
1229
1230 if e.filename in ('<ipython console>','<input>','<string>',
1230 if e.filename in ('<ipython console>','<input>','<string>',
1231 '<console>',None):
1231 '<console>',None):
1232
1232
1233 return False
1233 return False
1234 try:
1234 try:
1235 if (self.rc.autoedit_syntax and
1235 if (self.rc.autoedit_syntax and
1236 not ask_yes_no('Return to editor to correct syntax error? '
1236 not ask_yes_no('Return to editor to correct syntax error? '
1237 '[Y/n] ','y')):
1237 '[Y/n] ','y')):
1238 return False
1238 return False
1239 except EOFError:
1239 except EOFError:
1240 return False
1240 return False
1241
1241
1242 def int0(x):
1242 def int0(x):
1243 try:
1243 try:
1244 return int(x)
1244 return int(x)
1245 except TypeError:
1245 except TypeError:
1246 return 0
1246 return 0
1247 # always pass integer line and offset values to editor hook
1247 # always pass integer line and offset values to editor hook
1248 self.hooks.fix_error_editor(e.filename,
1248 self.hooks.fix_error_editor(e.filename,
1249 int0(e.lineno),int0(e.offset),e.msg)
1249 int0(e.lineno),int0(e.offset),e.msg)
1250 return True
1250 return True
1251
1251
1252 def edit_syntax_error(self):
1252 def edit_syntax_error(self):
1253 """The bottom half of the syntax error handler called in the main loop.
1253 """The bottom half of the syntax error handler called in the main loop.
1254
1254
1255 Loop until syntax error is fixed or user cancels.
1255 Loop until syntax error is fixed or user cancels.
1256 """
1256 """
1257
1257
1258 while self.SyntaxTB.last_syntax_error:
1258 while self.SyntaxTB.last_syntax_error:
1259 # copy and clear last_syntax_error
1259 # copy and clear last_syntax_error
1260 err = self.SyntaxTB.clear_err_state()
1260 err = self.SyntaxTB.clear_err_state()
1261 if not self._should_recompile(err):
1261 if not self._should_recompile(err):
1262 return
1262 return
1263 try:
1263 try:
1264 # may set last_syntax_error again if a SyntaxError is raised
1264 # may set last_syntax_error again if a SyntaxError is raised
1265 self.safe_execfile(err.filename,self.shell.user_ns)
1265 self.safe_execfile(err.filename,self.shell.user_ns)
1266 except:
1266 except:
1267 self.showtraceback()
1267 self.showtraceback()
1268 else:
1268 else:
1269 f = file(err.filename)
1269 f = file(err.filename)
1270 try:
1270 try:
1271 sys.displayhook(f.read())
1271 sys.displayhook(f.read())
1272 finally:
1272 finally:
1273 f.close()
1273 f.close()
1274
1274
1275 def showsyntaxerror(self, filename=None):
1275 def showsyntaxerror(self, filename=None):
1276 """Display the syntax error that just occurred.
1276 """Display the syntax error that just occurred.
1277
1277
1278 This doesn't display a stack trace because there isn't one.
1278 This doesn't display a stack trace because there isn't one.
1279
1279
1280 If a filename is given, it is stuffed in the exception instead
1280 If a filename is given, it is stuffed in the exception instead
1281 of what was there before (because Python's parser always uses
1281 of what was there before (because Python's parser always uses
1282 "<string>" when reading from a string).
1282 "<string>" when reading from a string).
1283 """
1283 """
1284 etype, value, last_traceback = sys.exc_info()
1284 etype, value, last_traceback = sys.exc_info()
1285
1285
1286 # See note about these variables in showtraceback() below
1286 # See note about these variables in showtraceback() below
1287 sys.last_type = etype
1287 sys.last_type = etype
1288 sys.last_value = value
1288 sys.last_value = value
1289 sys.last_traceback = last_traceback
1289 sys.last_traceback = last_traceback
1290
1290
1291 if filename and etype is SyntaxError:
1291 if filename and etype is SyntaxError:
1292 # Work hard to stuff the correct filename in the exception
1292 # Work hard to stuff the correct filename in the exception
1293 try:
1293 try:
1294 msg, (dummy_filename, lineno, offset, line) = value
1294 msg, (dummy_filename, lineno, offset, line) = value
1295 except:
1295 except:
1296 # Not the format we expect; leave it alone
1296 # Not the format we expect; leave it alone
1297 pass
1297 pass
1298 else:
1298 else:
1299 # Stuff in the right filename
1299 # Stuff in the right filename
1300 try:
1300 try:
1301 # Assume SyntaxError is a class exception
1301 # Assume SyntaxError is a class exception
1302 value = SyntaxError(msg, (filename, lineno, offset, line))
1302 value = SyntaxError(msg, (filename, lineno, offset, line))
1303 except:
1303 except:
1304 # If that failed, assume SyntaxError is a string
1304 # If that failed, assume SyntaxError is a string
1305 value = msg, (filename, lineno, offset, line)
1305 value = msg, (filename, lineno, offset, line)
1306 self.SyntaxTB(etype,value,[])
1306 self.SyntaxTB(etype,value,[])
1307
1307
1308 def debugger(self):
1308 def debugger(self):
1309 """Call the pdb debugger."""
1309 """Call the pdb debugger."""
1310
1310
1311 if not self.rc.pdb:
1311 if not self.rc.pdb:
1312 return
1312 return
1313 pdb.pm()
1313 pdb.pm()
1314
1314
1315 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1315 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1316 """Display the exception that just occurred."""
1316 """Display the exception that just occurred."""
1317
1317
1318 # Though this won't be called by syntax errors in the input line,
1318 # Though this won't be called by syntax errors in the input line,
1319 # there may be SyntaxError cases whith imported code.
1319 # there may be SyntaxError cases whith imported code.
1320 if exc_tuple is None:
1320 if exc_tuple is None:
1321 etype, value, tb = sys.exc_info()
1321 etype, value, tb = sys.exc_info()
1322 else:
1322 else:
1323 etype, value, tb = exc_tuple
1323 etype, value, tb = exc_tuple
1324 if etype is SyntaxError:
1324 if etype is SyntaxError:
1325 self.showsyntaxerror(filename)
1325 self.showsyntaxerror(filename)
1326 else:
1326 else:
1327 # WARNING: these variables are somewhat deprecated and not
1327 # WARNING: these variables are somewhat deprecated and not
1328 # necessarily safe to use in a threaded environment, but tools
1328 # necessarily safe to use in a threaded environment, but tools
1329 # like pdb depend on their existence, so let's set them. If we
1329 # like pdb depend on their existence, so let's set them. If we
1330 # find problems in the field, we'll need to revisit their use.
1330 # find problems in the field, we'll need to revisit their use.
1331 sys.last_type = etype
1331 sys.last_type = etype
1332 sys.last_value = value
1332 sys.last_value = value
1333 sys.last_traceback = tb
1333 sys.last_traceback = tb
1334
1334
1335 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1335 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1336 if self.InteractiveTB.call_pdb and self.has_readline:
1336 if self.InteractiveTB.call_pdb and self.has_readline:
1337 # pdb mucks up readline, fix it back
1337 # pdb mucks up readline, fix it back
1338 self.readline.set_completer(self.Completer.complete)
1338 self.readline.set_completer(self.Completer.complete)
1339
1339
1340 def mainloop(self,banner=None):
1340 def mainloop(self,banner=None):
1341 """Creates the local namespace and starts the mainloop.
1341 """Creates the local namespace and starts the mainloop.
1342
1342
1343 If an optional banner argument is given, it will override the
1343 If an optional banner argument is given, it will override the
1344 internally created default banner."""
1344 internally created default banner."""
1345
1345
1346 if self.rc.c: # Emulate Python's -c option
1346 if self.rc.c: # Emulate Python's -c option
1347 self.exec_init_cmd()
1347 self.exec_init_cmd()
1348 if banner is None:
1348 if banner is None:
1349 if not self.rc.banner:
1349 if not self.rc.banner:
1350 banner = ''
1350 banner = ''
1351 # banner is string? Use it directly!
1351 # banner is string? Use it directly!
1352 elif isinstance(self.rc.banner,basestring):
1352 elif isinstance(self.rc.banner,basestring):
1353 banner = self.rc.banner
1353 banner = self.rc.banner
1354 else:
1354 else:
1355 banner = self.BANNER+self.banner2
1355 banner = self.BANNER+self.banner2
1356
1356
1357 self.interact(banner)
1357 self.interact(banner)
1358
1358
1359 def exec_init_cmd(self):
1359 def exec_init_cmd(self):
1360 """Execute a command given at the command line.
1360 """Execute a command given at the command line.
1361
1361
1362 This emulates Python's -c option."""
1362 This emulates Python's -c option."""
1363
1363
1364 #sys.argv = ['-c']
1364 #sys.argv = ['-c']
1365 self.push(self.rc.c)
1365 self.push(self.rc.c)
1366
1366
1367 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1367 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1368 """Embeds IPython into a running python program.
1368 """Embeds IPython into a running python program.
1369
1369
1370 Input:
1370 Input:
1371
1371
1372 - header: An optional header message can be specified.
1372 - header: An optional header message can be specified.
1373
1373
1374 - local_ns, global_ns: working namespaces. If given as None, the
1374 - local_ns, global_ns: working namespaces. If given as None, the
1375 IPython-initialized one is updated with __main__.__dict__, so that
1375 IPython-initialized one is updated with __main__.__dict__, so that
1376 program variables become visible but user-specific configuration
1376 program variables become visible but user-specific configuration
1377 remains possible.
1377 remains possible.
1378
1378
1379 - stack_depth: specifies how many levels in the stack to go to
1379 - stack_depth: specifies how many levels in the stack to go to
1380 looking for namespaces (when local_ns and global_ns are None). This
1380 looking for namespaces (when local_ns and global_ns are None). This
1381 allows an intermediate caller to make sure that this function gets
1381 allows an intermediate caller to make sure that this function gets
1382 the namespace from the intended level in the stack. By default (0)
1382 the namespace from the intended level in the stack. By default (0)
1383 it will get its locals and globals from the immediate caller.
1383 it will get its locals and globals from the immediate caller.
1384
1384
1385 Warning: it's possible to use this in a program which is being run by
1385 Warning: it's possible to use this in a program which is being run by
1386 IPython itself (via %run), but some funny things will happen (a few
1386 IPython itself (via %run), but some funny things will happen (a few
1387 globals get overwritten). In the future this will be cleaned up, as
1387 globals get overwritten). In the future this will be cleaned up, as
1388 there is no fundamental reason why it can't work perfectly."""
1388 there is no fundamental reason why it can't work perfectly."""
1389
1389
1390 # Get locals and globals from caller
1390 # Get locals and globals from caller
1391 if local_ns is None or global_ns is None:
1391 if local_ns is None or global_ns is None:
1392 call_frame = sys._getframe(stack_depth).f_back
1392 call_frame = sys._getframe(stack_depth).f_back
1393
1393
1394 if local_ns is None:
1394 if local_ns is None:
1395 local_ns = call_frame.f_locals
1395 local_ns = call_frame.f_locals
1396 if global_ns is None:
1396 if global_ns is None:
1397 global_ns = call_frame.f_globals
1397 global_ns = call_frame.f_globals
1398
1398
1399 # Update namespaces and fire up interpreter
1399 # Update namespaces and fire up interpreter
1400
1400
1401 # The global one is easy, we can just throw it in
1401 # The global one is easy, we can just throw it in
1402 self.user_global_ns = global_ns
1402 self.user_global_ns = global_ns
1403
1403
1404 # but the user/local one is tricky: ipython needs it to store internal
1404 # but the user/local one is tricky: ipython needs it to store internal
1405 # data, but we also need the locals. We'll copy locals in the user
1405 # data, but we also need the locals. We'll copy locals in the user
1406 # one, but will track what got copied so we can delete them at exit.
1406 # one, but will track what got copied so we can delete them at exit.
1407 # This is so that a later embedded call doesn't see locals from a
1407 # This is so that a later embedded call doesn't see locals from a
1408 # previous call (which most likely existed in a separate scope).
1408 # previous call (which most likely existed in a separate scope).
1409 local_varnames = local_ns.keys()
1409 local_varnames = local_ns.keys()
1410 self.user_ns.update(local_ns)
1410 self.user_ns.update(local_ns)
1411
1411
1412 # Patch for global embedding to make sure that things don't overwrite
1412 # Patch for global embedding to make sure that things don't overwrite
1413 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1413 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1414 # FIXME. Test this a bit more carefully (the if.. is new)
1414 # FIXME. Test this a bit more carefully (the if.. is new)
1415 if local_ns is None and global_ns is None:
1415 if local_ns is None and global_ns is None:
1416 self.user_global_ns.update(__main__.__dict__)
1416 self.user_global_ns.update(__main__.__dict__)
1417
1417
1418 # make sure the tab-completer has the correct frame information, so it
1418 # make sure the tab-completer has the correct frame information, so it
1419 # actually completes using the frame's locals/globals
1419 # actually completes using the frame's locals/globals
1420 self.set_completer_frame()
1420 self.set_completer_frame()
1421
1421
1422 # before activating the interactive mode, we need to make sure that
1422 # before activating the interactive mode, we need to make sure that
1423 # all names in the builtin namespace needed by ipython point to
1423 # all names in the builtin namespace needed by ipython point to
1424 # ourselves, and not to other instances.
1424 # ourselves, and not to other instances.
1425 self.add_builtins()
1425 self.add_builtins()
1426
1426
1427 self.interact(header)
1427 self.interact(header)
1428
1428
1429 # now, purge out the user namespace from anything we might have added
1429 # now, purge out the user namespace from anything we might have added
1430 # from the caller's local namespace
1430 # from the caller's local namespace
1431 delvar = self.user_ns.pop
1431 delvar = self.user_ns.pop
1432 for var in local_varnames:
1432 for var in local_varnames:
1433 delvar(var,None)
1433 delvar(var,None)
1434 # and clean builtins we may have overridden
1434 # and clean builtins we may have overridden
1435 self.clean_builtins()
1435 self.clean_builtins()
1436
1436
1437 def interact(self, banner=None):
1437 def interact(self, banner=None):
1438 """Closely emulate the interactive Python console.
1438 """Closely emulate the interactive Python console.
1439
1439
1440 The optional banner argument specify the banner to print
1440 The optional banner argument specify the banner to print
1441 before the first interaction; by default it prints a banner
1441 before the first interaction; by default it prints a banner
1442 similar to the one printed by the real Python interpreter,
1442 similar to the one printed by the real Python interpreter,
1443 followed by the current class name in parentheses (so as not
1443 followed by the current class name in parentheses (so as not
1444 to confuse this with the real interpreter -- since it's so
1444 to confuse this with the real interpreter -- since it's so
1445 close!).
1445 close!).
1446
1446
1447 """
1447 """
1448 cprt = 'Type "copyright", "credits" or "license" for more information.'
1448 cprt = 'Type "copyright", "credits" or "license" for more information.'
1449 if banner is None:
1449 if banner is None:
1450 self.write("Python %s on %s\n%s\n(%s)\n" %
1450 self.write("Python %s on %s\n%s\n(%s)\n" %
1451 (sys.version, sys.platform, cprt,
1451 (sys.version, sys.platform, cprt,
1452 self.__class__.__name__))
1452 self.__class__.__name__))
1453 else:
1453 else:
1454 self.write(banner)
1454 self.write(banner)
1455
1455
1456 more = 0
1456 more = 0
1457
1457
1458 # Mark activity in the builtins
1458 # Mark activity in the builtins
1459 __builtin__.__dict__['__IPYTHON__active'] += 1
1459 __builtin__.__dict__['__IPYTHON__active'] += 1
1460
1460
1461 # exit_now is set by a call to %Exit or %Quit
1461 # exit_now is set by a call to %Exit or %Quit
1462 self.exit_now = False
1462 self.exit_now = False
1463 while not self.exit_now:
1463 while not self.exit_now:
1464 if more:
1464 if more:
1465 prompt = self.outputcache.prompt2
1465 prompt = self.outputcache.prompt2
1466 if self.autoindent:
1466 if self.autoindent:
1467 self.readline_startup_hook(self.pre_readline)
1467 self.readline_startup_hook(self.pre_readline)
1468 else:
1468 else:
1469 prompt = self.outputcache.prompt1
1469 prompt = self.outputcache.prompt1
1470 try:
1470 try:
1471 line = self.raw_input(prompt,more)
1471 line = self.raw_input(prompt,more)
1472 if self.autoindent:
1472 if self.autoindent:
1473 self.readline_startup_hook(None)
1473 self.readline_startup_hook(None)
1474 except KeyboardInterrupt:
1474 except KeyboardInterrupt:
1475 self.write('\nKeyboardInterrupt\n')
1475 self.write('\nKeyboardInterrupt\n')
1476 self.resetbuffer()
1476 self.resetbuffer()
1477 # keep cache in sync with the prompt counter:
1477 # keep cache in sync with the prompt counter:
1478 self.outputcache.prompt_count -= 1
1478 self.outputcache.prompt_count -= 1
1479
1479
1480 if self.autoindent:
1480 if self.autoindent:
1481 self.indent_current_nsp = 0
1481 self.indent_current_nsp = 0
1482 more = 0
1482 more = 0
1483 except EOFError:
1483 except EOFError:
1484 if self.autoindent:
1484 if self.autoindent:
1485 self.readline_startup_hook(None)
1485 self.readline_startup_hook(None)
1486 self.write('\n')
1486 self.write('\n')
1487 self.exit()
1487 self.exit()
1488 except bdb.BdbQuit:
1488 except bdb.BdbQuit:
1489 warn('The Python debugger has exited with a BdbQuit exception.\n'
1489 warn('The Python debugger has exited with a BdbQuit exception.\n'
1490 'Because of how pdb handles the stack, it is impossible\n'
1490 'Because of how pdb handles the stack, it is impossible\n'
1491 'for IPython to properly format this particular exception.\n'
1491 'for IPython to properly format this particular exception.\n'
1492 'IPython will resume normal operation.')
1492 'IPython will resume normal operation.')
1493 except:
1493 except:
1494 # exceptions here are VERY RARE, but they can be triggered
1494 # exceptions here are VERY RARE, but they can be triggered
1495 # asynchronously by signal handlers, for example.
1495 # asynchronously by signal handlers, for example.
1496 self.showtraceback()
1496 self.showtraceback()
1497 else:
1497 else:
1498 more = self.push(line)
1498 more = self.push(line)
1499 if (self.SyntaxTB.last_syntax_error and
1499 if (self.SyntaxTB.last_syntax_error and
1500 self.rc.autoedit_syntax):
1500 self.rc.autoedit_syntax):
1501 self.edit_syntax_error()
1501 self.edit_syntax_error()
1502
1502
1503 # We are off again...
1503 # We are off again...
1504 __builtin__.__dict__['__IPYTHON__active'] -= 1
1504 __builtin__.__dict__['__IPYTHON__active'] -= 1
1505
1505
1506 def excepthook(self, etype, value, tb):
1506 def excepthook(self, etype, value, tb):
1507 """One more defense for GUI apps that call sys.excepthook.
1507 """One more defense for GUI apps that call sys.excepthook.
1508
1508
1509 GUI frameworks like wxPython trap exceptions and call
1509 GUI frameworks like wxPython trap exceptions and call
1510 sys.excepthook themselves. I guess this is a feature that
1510 sys.excepthook themselves. I guess this is a feature that
1511 enables them to keep running after exceptions that would
1511 enables them to keep running after exceptions that would
1512 otherwise kill their mainloop. This is a bother for IPython
1512 otherwise kill their mainloop. This is a bother for IPython
1513 which excepts to catch all of the program exceptions with a try:
1513 which excepts to catch all of the program exceptions with a try:
1514 except: statement.
1514 except: statement.
1515
1515
1516 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1516 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1517 any app directly invokes sys.excepthook, it will look to the user like
1517 any app directly invokes sys.excepthook, it will look to the user like
1518 IPython crashed. In order to work around this, we can disable the
1518 IPython crashed. In order to work around this, we can disable the
1519 CrashHandler and replace it with this excepthook instead, which prints a
1519 CrashHandler and replace it with this excepthook instead, which prints a
1520 regular traceback using our InteractiveTB. In this fashion, apps which
1520 regular traceback using our InteractiveTB. In this fashion, apps which
1521 call sys.excepthook will generate a regular-looking exception from
1521 call sys.excepthook will generate a regular-looking exception from
1522 IPython, and the CrashHandler will only be triggered by real IPython
1522 IPython, and the CrashHandler will only be triggered by real IPython
1523 crashes.
1523 crashes.
1524
1524
1525 This hook should be used sparingly, only in places which are not likely
1525 This hook should be used sparingly, only in places which are not likely
1526 to be true IPython errors.
1526 to be true IPython errors.
1527 """
1527 """
1528 self.showtraceback((etype,value,tb),tb_offset=0)
1528 self.showtraceback((etype,value,tb),tb_offset=0)
1529
1529
1530 def transform_alias(self, alias,rest=''):
1530 def transform_alias(self, alias,rest=''):
1531 """ Transform alias to system command string
1531 """ Transform alias to system command string
1532
1532
1533 """
1533 """
1534 nargs,cmd = self.alias_table[alias]
1534 nargs,cmd = self.alias_table[alias]
1535 if ' ' in cmd:
1536 cmd = '"%s"' % cmd
1537
1535 # Expand the %l special to be the user's input line
1538 # Expand the %l special to be the user's input line
1536 if cmd.find('%l') >= 0:
1539 if cmd.find('%l') >= 0:
1537 cmd = cmd.replace('%l',rest)
1540 cmd = cmd.replace('%l',rest)
1538 rest = ''
1541 rest = ''
1539 if nargs==0:
1542 if nargs==0:
1540 # Simple, argument-less aliases
1543 # Simple, argument-less aliases
1541 cmd = '%s %s' % (cmd,rest)
1544 cmd = '%s %s' % (cmd,rest)
1542 else:
1545 else:
1543 # Handle aliases with positional arguments
1546 # Handle aliases with positional arguments
1544 args = rest.split(None,nargs)
1547 args = rest.split(None,nargs)
1545 if len(args)< nargs:
1548 if len(args)< nargs:
1546 error('Alias <%s> requires %s arguments, %s given.' %
1549 error('Alias <%s> requires %s arguments, %s given.' %
1547 (alias,nargs,len(args)))
1550 (alias,nargs,len(args)))
1548 return None
1551 return None
1549 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1552 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1550 # Now call the macro, evaluating in the user's namespace
1553 # Now call the macro, evaluating in the user's namespace
1551
1554
1552 return cmd
1555 return cmd
1553
1556
1554 def call_alias(self,alias,rest=''):
1557 def call_alias(self,alias,rest=''):
1555 """Call an alias given its name and the rest of the line.
1558 """Call an alias given its name and the rest of the line.
1556
1559
1557 This is only used to provide backwards compatibility for users of
1560 This is only used to provide backwards compatibility for users of
1558 ipalias(), use of which is not recommended for anymore."""
1561 ipalias(), use of which is not recommended for anymore."""
1559
1562
1560 # Now call the macro, evaluating in the user's namespace
1563 # Now call the macro, evaluating in the user's namespace
1561 cmd = self.transform_alias(alias, rest)
1564 cmd = self.transform_alias(alias, rest)
1562 try:
1565 try:
1563 self.system(cmd)
1566 self.system(cmd)
1564 except:
1567 except:
1565 self.showtraceback()
1568 self.showtraceback()
1566
1569
1567 def indent_current_str(self):
1570 def indent_current_str(self):
1568 """return the current level of indentation as a string"""
1571 """return the current level of indentation as a string"""
1569 return self.indent_current_nsp * ' '
1572 return self.indent_current_nsp * ' '
1570
1573
1571 def autoindent_update(self,line):
1574 def autoindent_update(self,line):
1572 """Keep track of the indent level."""
1575 """Keep track of the indent level."""
1573
1576
1574 #debugx('line')
1577 #debugx('line')
1575 #debugx('self.indent_current_nsp')
1578 #debugx('self.indent_current_nsp')
1576 if self.autoindent:
1579 if self.autoindent:
1577 if line:
1580 if line:
1578 inisp = num_ini_spaces(line)
1581 inisp = num_ini_spaces(line)
1579 if inisp < self.indent_current_nsp:
1582 if inisp < self.indent_current_nsp:
1580 self.indent_current_nsp = inisp
1583 self.indent_current_nsp = inisp
1581
1584
1582 if line[-1] == ':':
1585 if line[-1] == ':':
1583 self.indent_current_nsp += 4
1586 self.indent_current_nsp += 4
1584 elif dedent_re.match(line):
1587 elif dedent_re.match(line):
1585 self.indent_current_nsp -= 4
1588 self.indent_current_nsp -= 4
1586 else:
1589 else:
1587 self.indent_current_nsp = 0
1590 self.indent_current_nsp = 0
1588
1591
1589 def runlines(self,lines):
1592 def runlines(self,lines):
1590 """Run a string of one or more lines of source.
1593 """Run a string of one or more lines of source.
1591
1594
1592 This method is capable of running a string containing multiple source
1595 This method is capable of running a string containing multiple source
1593 lines, as if they had been entered at the IPython prompt. Since it
1596 lines, as if they had been entered at the IPython prompt. Since it
1594 exposes IPython's processing machinery, the given strings can contain
1597 exposes IPython's processing machinery, the given strings can contain
1595 magic calls (%magic), special shell access (!cmd), etc."""
1598 magic calls (%magic), special shell access (!cmd), etc."""
1596
1599
1597 # We must start with a clean buffer, in case this is run from an
1600 # We must start with a clean buffer, in case this is run from an
1598 # interactive IPython session (via a magic, for example).
1601 # interactive IPython session (via a magic, for example).
1599 self.resetbuffer()
1602 self.resetbuffer()
1600 lines = lines.split('\n')
1603 lines = lines.split('\n')
1601 more = 0
1604 more = 0
1602 for line in lines:
1605 for line in lines:
1603 # skip blank lines so we don't mess up the prompt counter, but do
1606 # skip blank lines so we don't mess up the prompt counter, but do
1604 # NOT skip even a blank line if we are in a code block (more is
1607 # NOT skip even a blank line if we are in a code block (more is
1605 # true)
1608 # true)
1606 if line or more:
1609 if line or more:
1607 more = self.push(self.prefilter(line,more))
1610 more = self.push(self.prefilter(line,more))
1608 # IPython's runsource returns None if there was an error
1611 # IPython's runsource returns None if there was an error
1609 # compiling the code. This allows us to stop processing right
1612 # compiling the code. This allows us to stop processing right
1610 # away, so the user gets the error message at the right place.
1613 # away, so the user gets the error message at the right place.
1611 if more is None:
1614 if more is None:
1612 break
1615 break
1613 # final newline in case the input didn't have it, so that the code
1616 # final newline in case the input didn't have it, so that the code
1614 # actually does get executed
1617 # actually does get executed
1615 if more:
1618 if more:
1616 self.push('\n')
1619 self.push('\n')
1617
1620
1618 def runsource(self, source, filename='<input>', symbol='single'):
1621 def runsource(self, source, filename='<input>', symbol='single'):
1619 """Compile and run some source in the interpreter.
1622 """Compile and run some source in the interpreter.
1620
1623
1621 Arguments are as for compile_command().
1624 Arguments are as for compile_command().
1622
1625
1623 One several things can happen:
1626 One several things can happen:
1624
1627
1625 1) The input is incorrect; compile_command() raised an
1628 1) The input is incorrect; compile_command() raised an
1626 exception (SyntaxError or OverflowError). A syntax traceback
1629 exception (SyntaxError or OverflowError). A syntax traceback
1627 will be printed by calling the showsyntaxerror() method.
1630 will be printed by calling the showsyntaxerror() method.
1628
1631
1629 2) The input is incomplete, and more input is required;
1632 2) The input is incomplete, and more input is required;
1630 compile_command() returned None. Nothing happens.
1633 compile_command() returned None. Nothing happens.
1631
1634
1632 3) The input is complete; compile_command() returned a code
1635 3) The input is complete; compile_command() returned a code
1633 object. The code is executed by calling self.runcode() (which
1636 object. The code is executed by calling self.runcode() (which
1634 also handles run-time exceptions, except for SystemExit).
1637 also handles run-time exceptions, except for SystemExit).
1635
1638
1636 The return value is:
1639 The return value is:
1637
1640
1638 - True in case 2
1641 - True in case 2
1639
1642
1640 - False in the other cases, unless an exception is raised, where
1643 - False in the other cases, unless an exception is raised, where
1641 None is returned instead. This can be used by external callers to
1644 None is returned instead. This can be used by external callers to
1642 know whether to continue feeding input or not.
1645 know whether to continue feeding input or not.
1643
1646
1644 The return value can be used to decide whether to use sys.ps1 or
1647 The return value can be used to decide whether to use sys.ps1 or
1645 sys.ps2 to prompt the next line."""
1648 sys.ps2 to prompt the next line."""
1646
1649
1647 try:
1650 try:
1648 code = self.compile(source,filename,symbol)
1651 code = self.compile(source,filename,symbol)
1649 except (OverflowError, SyntaxError, ValueError):
1652 except (OverflowError, SyntaxError, ValueError):
1650 # Case 1
1653 # Case 1
1651 self.showsyntaxerror(filename)
1654 self.showsyntaxerror(filename)
1652 return None
1655 return None
1653
1656
1654 if code is None:
1657 if code is None:
1655 # Case 2
1658 # Case 2
1656 return True
1659 return True
1657
1660
1658 # Case 3
1661 # Case 3
1659 # We store the code object so that threaded shells and
1662 # We store the code object so that threaded shells and
1660 # custom exception handlers can access all this info if needed.
1663 # custom exception handlers can access all this info if needed.
1661 # The source corresponding to this can be obtained from the
1664 # The source corresponding to this can be obtained from the
1662 # buffer attribute as '\n'.join(self.buffer).
1665 # buffer attribute as '\n'.join(self.buffer).
1663 self.code_to_run = code
1666 self.code_to_run = code
1664 # now actually execute the code object
1667 # now actually execute the code object
1665 if self.runcode(code) == 0:
1668 if self.runcode(code) == 0:
1666 return False
1669 return False
1667 else:
1670 else:
1668 return None
1671 return None
1669
1672
1670 def runcode(self,code_obj):
1673 def runcode(self,code_obj):
1671 """Execute a code object.
1674 """Execute a code object.
1672
1675
1673 When an exception occurs, self.showtraceback() is called to display a
1676 When an exception occurs, self.showtraceback() is called to display a
1674 traceback.
1677 traceback.
1675
1678
1676 Return value: a flag indicating whether the code to be run completed
1679 Return value: a flag indicating whether the code to be run completed
1677 successfully:
1680 successfully:
1678
1681
1679 - 0: successful execution.
1682 - 0: successful execution.
1680 - 1: an error occurred.
1683 - 1: an error occurred.
1681 """
1684 """
1682
1685
1683 # Set our own excepthook in case the user code tries to call it
1686 # Set our own excepthook in case the user code tries to call it
1684 # directly, so that the IPython crash handler doesn't get triggered
1687 # directly, so that the IPython crash handler doesn't get triggered
1685 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1688 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1686
1689
1687 # we save the original sys.excepthook in the instance, in case config
1690 # we save the original sys.excepthook in the instance, in case config
1688 # code (such as magics) needs access to it.
1691 # code (such as magics) needs access to it.
1689 self.sys_excepthook = old_excepthook
1692 self.sys_excepthook = old_excepthook
1690 outflag = 1 # happens in more places, so it's easier as default
1693 outflag = 1 # happens in more places, so it's easier as default
1691 try:
1694 try:
1692 try:
1695 try:
1693 # Embedded instances require separate global/local namespaces
1696 # Embedded instances require separate global/local namespaces
1694 # so they can see both the surrounding (local) namespace and
1697 # so they can see both the surrounding (local) namespace and
1695 # the module-level globals when called inside another function.
1698 # the module-level globals when called inside another function.
1696 if self.embedded:
1699 if self.embedded:
1697 exec code_obj in self.user_global_ns, self.user_ns
1700 exec code_obj in self.user_global_ns, self.user_ns
1698 # Normal (non-embedded) instances should only have a single
1701 # Normal (non-embedded) instances should only have a single
1699 # namespace for user code execution, otherwise functions won't
1702 # namespace for user code execution, otherwise functions won't
1700 # see interactive top-level globals.
1703 # see interactive top-level globals.
1701 else:
1704 else:
1702 exec code_obj in self.user_ns
1705 exec code_obj in self.user_ns
1703 finally:
1706 finally:
1704 # Reset our crash handler in place
1707 # Reset our crash handler in place
1705 sys.excepthook = old_excepthook
1708 sys.excepthook = old_excepthook
1706 except SystemExit:
1709 except SystemExit:
1707 self.resetbuffer()
1710 self.resetbuffer()
1708 self.showtraceback()
1711 self.showtraceback()
1709 warn("Type exit or quit to exit IPython "
1712 warn("Type exit or quit to exit IPython "
1710 "(%Exit or %Quit do so unconditionally).",level=1)
1713 "(%Exit or %Quit do so unconditionally).",level=1)
1711 except self.custom_exceptions:
1714 except self.custom_exceptions:
1712 etype,value,tb = sys.exc_info()
1715 etype,value,tb = sys.exc_info()
1713 self.CustomTB(etype,value,tb)
1716 self.CustomTB(etype,value,tb)
1714 except:
1717 except:
1715 self.showtraceback()
1718 self.showtraceback()
1716 else:
1719 else:
1717 outflag = 0
1720 outflag = 0
1718 if softspace(sys.stdout, 0):
1721 if softspace(sys.stdout, 0):
1719 print
1722 print
1720 # Flush out code object which has been run (and source)
1723 # Flush out code object which has been run (and source)
1721 self.code_to_run = None
1724 self.code_to_run = None
1722 return outflag
1725 return outflag
1723
1726
1724 def push(self, line):
1727 def push(self, line):
1725 """Push a line to the interpreter.
1728 """Push a line to the interpreter.
1726
1729
1727 The line should not have a trailing newline; it may have
1730 The line should not have a trailing newline; it may have
1728 internal newlines. The line is appended to a buffer and the
1731 internal newlines. The line is appended to a buffer and the
1729 interpreter's runsource() method is called with the
1732 interpreter's runsource() method is called with the
1730 concatenated contents of the buffer as source. If this
1733 concatenated contents of the buffer as source. If this
1731 indicates that the command was executed or invalid, the buffer
1734 indicates that the command was executed or invalid, the buffer
1732 is reset; otherwise, the command is incomplete, and the buffer
1735 is reset; otherwise, the command is incomplete, and the buffer
1733 is left as it was after the line was appended. The return
1736 is left as it was after the line was appended. The return
1734 value is 1 if more input is required, 0 if the line was dealt
1737 value is 1 if more input is required, 0 if the line was dealt
1735 with in some way (this is the same as runsource()).
1738 with in some way (this is the same as runsource()).
1736 """
1739 """
1737
1740
1738 # autoindent management should be done here, and not in the
1741 # autoindent management should be done here, and not in the
1739 # interactive loop, since that one is only seen by keyboard input. We
1742 # interactive loop, since that one is only seen by keyboard input. We
1740 # need this done correctly even for code run via runlines (which uses
1743 # need this done correctly even for code run via runlines (which uses
1741 # push).
1744 # push).
1742
1745
1743 #print 'push line: <%s>' % line # dbg
1746 #print 'push line: <%s>' % line # dbg
1744 self.autoindent_update(line)
1747 self.autoindent_update(line)
1745
1748
1746 self.buffer.append(line)
1749 self.buffer.append(line)
1747 more = self.runsource('\n'.join(self.buffer), self.filename)
1750 more = self.runsource('\n'.join(self.buffer), self.filename)
1748 if not more:
1751 if not more:
1749 self.resetbuffer()
1752 self.resetbuffer()
1750 return more
1753 return more
1751
1754
1752 def resetbuffer(self):
1755 def resetbuffer(self):
1753 """Reset the input buffer."""
1756 """Reset the input buffer."""
1754 self.buffer[:] = []
1757 self.buffer[:] = []
1755
1758
1756 def raw_input(self,prompt='',continue_prompt=False):
1759 def raw_input(self,prompt='',continue_prompt=False):
1757 """Write a prompt and read a line.
1760 """Write a prompt and read a line.
1758
1761
1759 The returned line does not include the trailing newline.
1762 The returned line does not include the trailing newline.
1760 When the user enters the EOF key sequence, EOFError is raised.
1763 When the user enters the EOF key sequence, EOFError is raised.
1761
1764
1762 Optional inputs:
1765 Optional inputs:
1763
1766
1764 - prompt(''): a string to be printed to prompt the user.
1767 - prompt(''): a string to be printed to prompt the user.
1765
1768
1766 - continue_prompt(False): whether this line is the first one or a
1769 - continue_prompt(False): whether this line is the first one or a
1767 continuation in a sequence of inputs.
1770 continuation in a sequence of inputs.
1768 """
1771 """
1769
1772
1770 line = raw_input_original(prompt)
1773 line = raw_input_original(prompt)
1771
1774
1772 # Try to be reasonably smart about not re-indenting pasted input more
1775 # Try to be reasonably smart about not re-indenting pasted input more
1773 # than necessary. We do this by trimming out the auto-indent initial
1776 # than necessary. We do this by trimming out the auto-indent initial
1774 # spaces, if the user's actual input started itself with whitespace.
1777 # spaces, if the user's actual input started itself with whitespace.
1775 #debugx('self.buffer[-1]')
1778 #debugx('self.buffer[-1]')
1776
1779
1777 if self.autoindent:
1780 if self.autoindent:
1778 if num_ini_spaces(line) > self.indent_current_nsp:
1781 if num_ini_spaces(line) > self.indent_current_nsp:
1779 line = line[self.indent_current_nsp:]
1782 line = line[self.indent_current_nsp:]
1780 self.indent_current_nsp = 0
1783 self.indent_current_nsp = 0
1781
1784
1782 # store the unfiltered input before the user has any chance to modify
1785 # store the unfiltered input before the user has any chance to modify
1783 # it.
1786 # it.
1784 if line.strip():
1787 if line.strip():
1785 if continue_prompt:
1788 if continue_prompt:
1786 self.input_hist_raw[-1] += '%s\n' % line
1789 self.input_hist_raw[-1] += '%s\n' % line
1787 else:
1790 else:
1788 self.input_hist_raw.append('%s\n' % line)
1791 self.input_hist_raw.append('%s\n' % line)
1789
1792
1790 lineout = self.prefilter(line,continue_prompt)
1793 lineout = self.prefilter(line,continue_prompt)
1791 return lineout
1794 return lineout
1792
1795
1793 def split_user_input(self,line):
1796 def split_user_input(self,line):
1794 """Split user input into pre-char, function part and rest."""
1797 """Split user input into pre-char, function part and rest."""
1795
1798
1796 lsplit = self.line_split.match(line)
1799 lsplit = self.line_split.match(line)
1797 if lsplit is None: # no regexp match returns None
1800 if lsplit is None: # no regexp match returns None
1798 try:
1801 try:
1799 iFun,theRest = line.split(None,1)
1802 iFun,theRest = line.split(None,1)
1800 except ValueError:
1803 except ValueError:
1801 iFun,theRest = line,''
1804 iFun,theRest = line,''
1802 pre = re.match('^(\s*)(.*)',line).groups()[0]
1805 pre = re.match('^(\s*)(.*)',line).groups()[0]
1803 else:
1806 else:
1804 pre,iFun,theRest = lsplit.groups()
1807 pre,iFun,theRest = lsplit.groups()
1805
1808
1806 #print 'line:<%s>' % line # dbg
1809 #print 'line:<%s>' % line # dbg
1807 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1810 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1808 return pre,iFun.strip(),theRest
1811 return pre,iFun.strip(),theRest
1809
1812
1810 def _prefilter(self, line, continue_prompt):
1813 def _prefilter(self, line, continue_prompt):
1811 """Calls different preprocessors, depending on the form of line."""
1814 """Calls different preprocessors, depending on the form of line."""
1812
1815
1813 # All handlers *must* return a value, even if it's blank ('').
1816 # All handlers *must* return a value, even if it's blank ('').
1814
1817
1815 # Lines are NOT logged here. Handlers should process the line as
1818 # Lines are NOT logged here. Handlers should process the line as
1816 # needed, update the cache AND log it (so that the input cache array
1819 # needed, update the cache AND log it (so that the input cache array
1817 # stays synced).
1820 # stays synced).
1818
1821
1819 # This function is _very_ delicate, and since it's also the one which
1822 # This function is _very_ delicate, and since it's also the one which
1820 # determines IPython's response to user input, it must be as efficient
1823 # determines IPython's response to user input, it must be as efficient
1821 # as possible. For this reason it has _many_ returns in it, trying
1824 # as possible. For this reason it has _many_ returns in it, trying
1822 # always to exit as quickly as it can figure out what it needs to do.
1825 # always to exit as quickly as it can figure out what it needs to do.
1823
1826
1824 # This function is the main responsible for maintaining IPython's
1827 # This function is the main responsible for maintaining IPython's
1825 # behavior respectful of Python's semantics. So be _very_ careful if
1828 # behavior respectful of Python's semantics. So be _very_ careful if
1826 # making changes to anything here.
1829 # making changes to anything here.
1827
1830
1828 #.....................................................................
1831 #.....................................................................
1829 # Code begins
1832 # Code begins
1830
1833
1831 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1834 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1832
1835
1833 # save the line away in case we crash, so the post-mortem handler can
1836 # save the line away in case we crash, so the post-mortem handler can
1834 # record it
1837 # record it
1835 self._last_input_line = line
1838 self._last_input_line = line
1836
1839
1837 #print '***line: <%s>' % line # dbg
1840 #print '***line: <%s>' % line # dbg
1838
1841
1839 # the input history needs to track even empty lines
1842 # the input history needs to track even empty lines
1840 stripped = line.strip()
1843 stripped = line.strip()
1841
1844
1842 if not stripped:
1845 if not stripped:
1843 if not continue_prompt:
1846 if not continue_prompt:
1844 self.outputcache.prompt_count -= 1
1847 self.outputcache.prompt_count -= 1
1845 return self.handle_normal(line,continue_prompt)
1848 return self.handle_normal(line,continue_prompt)
1846 #return self.handle_normal('',continue_prompt)
1849 #return self.handle_normal('',continue_prompt)
1847
1850
1848 # print '***cont',continue_prompt # dbg
1851 # print '***cont',continue_prompt # dbg
1849 # special handlers are only allowed for single line statements
1852 # special handlers are only allowed for single line statements
1850 if continue_prompt and not self.rc.multi_line_specials:
1853 if continue_prompt and not self.rc.multi_line_specials:
1851 return self.handle_normal(line,continue_prompt)
1854 return self.handle_normal(line,continue_prompt)
1852
1855
1853
1856
1854 # For the rest, we need the structure of the input
1857 # For the rest, we need the structure of the input
1855 pre,iFun,theRest = self.split_user_input(line)
1858 pre,iFun,theRest = self.split_user_input(line)
1856
1859
1857 # See whether any pre-existing handler can take care of it
1860 # See whether any pre-existing handler can take care of it
1858
1861
1859 rewritten = self.hooks.input_prefilter(stripped)
1862 rewritten = self.hooks.input_prefilter(stripped)
1860 if rewritten != stripped: # ok, some prefilter did something
1863 if rewritten != stripped: # ok, some prefilter did something
1861 rewritten = pre + rewritten # add indentation
1864 rewritten = pre + rewritten # add indentation
1862 return self.handle_normal(rewritten)
1865 return self.handle_normal(rewritten)
1863
1866
1864
1867
1865
1868
1866
1869
1867 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1870 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1868
1871
1869 # First check for explicit escapes in the last/first character
1872 # First check for explicit escapes in the last/first character
1870 handler = None
1873 handler = None
1871 if line[-1] == self.ESC_HELP:
1874 if line[-1] == self.ESC_HELP:
1872 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1875 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1873 if handler is None:
1876 if handler is None:
1874 # look at the first character of iFun, NOT of line, so we skip
1877 # look at the first character of iFun, NOT of line, so we skip
1875 # leading whitespace in multiline input
1878 # leading whitespace in multiline input
1876 handler = self.esc_handlers.get(iFun[0:1])
1879 handler = self.esc_handlers.get(iFun[0:1])
1877 if handler is not None:
1880 if handler is not None:
1878 return handler(line,continue_prompt,pre,iFun,theRest)
1881 return handler(line,continue_prompt,pre,iFun,theRest)
1879 # Emacs ipython-mode tags certain input lines
1882 # Emacs ipython-mode tags certain input lines
1880 if line.endswith('# PYTHON-MODE'):
1883 if line.endswith('# PYTHON-MODE'):
1881 return self.handle_emacs(line,continue_prompt)
1884 return self.handle_emacs(line,continue_prompt)
1882
1885
1883 # Next, check if we can automatically execute this thing
1886 # Next, check if we can automatically execute this thing
1884
1887
1885 # Allow ! in multi-line statements if multi_line_specials is on:
1888 # Allow ! in multi-line statements if multi_line_specials is on:
1886 if continue_prompt and self.rc.multi_line_specials and \
1889 if continue_prompt and self.rc.multi_line_specials and \
1887 iFun.startswith(self.ESC_SHELL):
1890 iFun.startswith(self.ESC_SHELL):
1888 return self.handle_shell_escape(line,continue_prompt,
1891 return self.handle_shell_escape(line,continue_prompt,
1889 pre=pre,iFun=iFun,
1892 pre=pre,iFun=iFun,
1890 theRest=theRest)
1893 theRest=theRest)
1891
1894
1892 # Let's try to find if the input line is a magic fn
1895 # Let's try to find if the input line is a magic fn
1893 oinfo = None
1896 oinfo = None
1894 if hasattr(self,'magic_'+iFun):
1897 if hasattr(self,'magic_'+iFun):
1895 # WARNING: _ofind uses getattr(), so it can consume generators and
1898 # WARNING: _ofind uses getattr(), so it can consume generators and
1896 # cause other side effects.
1899 # cause other side effects.
1897 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1900 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1898 if oinfo['ismagic']:
1901 if oinfo['ismagic']:
1899 # Be careful not to call magics when a variable assignment is
1902 # Be careful not to call magics when a variable assignment is
1900 # being made (ls='hi', for example)
1903 # being made (ls='hi', for example)
1901 if self.rc.automagic and \
1904 if self.rc.automagic and \
1902 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1905 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1903 (self.rc.multi_line_specials or not continue_prompt):
1906 (self.rc.multi_line_specials or not continue_prompt):
1904 return self.handle_magic(line,continue_prompt,
1907 return self.handle_magic(line,continue_prompt,
1905 pre,iFun,theRest)
1908 pre,iFun,theRest)
1906 else:
1909 else:
1907 return self.handle_normal(line,continue_prompt)
1910 return self.handle_normal(line,continue_prompt)
1908
1911
1909 # If the rest of the line begins with an (in)equality, assginment or
1912 # If the rest of the line begins with an (in)equality, assginment or
1910 # function call, we should not call _ofind but simply execute it.
1913 # function call, we should not call _ofind but simply execute it.
1911 # This avoids spurious geattr() accesses on objects upon assignment.
1914 # This avoids spurious geattr() accesses on objects upon assignment.
1912 #
1915 #
1913 # It also allows users to assign to either alias or magic names true
1916 # It also allows users to assign to either alias or magic names true
1914 # python variables (the magic/alias systems always take second seat to
1917 # python variables (the magic/alias systems always take second seat to
1915 # true python code).
1918 # true python code).
1916 if theRest and theRest[0] in '!=()':
1919 if theRest and theRest[0] in '!=()':
1917 return self.handle_normal(line,continue_prompt)
1920 return self.handle_normal(line,continue_prompt)
1918
1921
1919 if oinfo is None:
1922 if oinfo is None:
1920 # let's try to ensure that _oinfo is ONLY called when autocall is
1923 # let's try to ensure that _oinfo is ONLY called when autocall is
1921 # on. Since it has inevitable potential side effects, at least
1924 # on. Since it has inevitable potential side effects, at least
1922 # having autocall off should be a guarantee to the user that no
1925 # having autocall off should be a guarantee to the user that no
1923 # weird things will happen.
1926 # weird things will happen.
1924
1927
1925 if self.rc.autocall:
1928 if self.rc.autocall:
1926 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1929 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1927 else:
1930 else:
1928 # in this case, all that's left is either an alias or
1931 # in this case, all that's left is either an alias or
1929 # processing the line normally.
1932 # processing the line normally.
1930 if iFun in self.alias_table:
1933 if iFun in self.alias_table:
1931 return self.handle_alias(line,continue_prompt,
1934 return self.handle_alias(line,continue_prompt,
1932 pre,iFun,theRest)
1935 pre,iFun,theRest)
1933
1936
1934 else:
1937 else:
1935 return self.handle_normal(line,continue_prompt)
1938 return self.handle_normal(line,continue_prompt)
1936
1939
1937 if not oinfo['found']:
1940 if not oinfo['found']:
1938 return self.handle_normal(line,continue_prompt)
1941 return self.handle_normal(line,continue_prompt)
1939 else:
1942 else:
1940 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1943 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1941 if oinfo['isalias']:
1944 if oinfo['isalias']:
1942 return self.handle_alias(line,continue_prompt,
1945 return self.handle_alias(line,continue_prompt,
1943 pre,iFun,theRest)
1946 pre,iFun,theRest)
1944
1947
1945 if (self.rc.autocall
1948 if (self.rc.autocall
1946 and
1949 and
1947 (
1950 (
1948 #only consider exclusion re if not "," or ";" autoquoting
1951 #only consider exclusion re if not "," or ";" autoquoting
1949 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1952 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1950 or pre == self.ESC_PAREN) or
1953 or pre == self.ESC_PAREN) or
1951 (not self.re_exclude_auto.match(theRest)))
1954 (not self.re_exclude_auto.match(theRest)))
1952 and
1955 and
1953 self.re_fun_name.match(iFun) and
1956 self.re_fun_name.match(iFun) and
1954 callable(oinfo['obj'])) :
1957 callable(oinfo['obj'])) :
1955 #print 'going auto' # dbg
1958 #print 'going auto' # dbg
1956 return self.handle_auto(line,continue_prompt,
1959 return self.handle_auto(line,continue_prompt,
1957 pre,iFun,theRest,oinfo['obj'])
1960 pre,iFun,theRest,oinfo['obj'])
1958 else:
1961 else:
1959 #print 'was callable?', callable(oinfo['obj']) # dbg
1962 #print 'was callable?', callable(oinfo['obj']) # dbg
1960 return self.handle_normal(line,continue_prompt)
1963 return self.handle_normal(line,continue_prompt)
1961
1964
1962 # If we get here, we have a normal Python line. Log and return.
1965 # If we get here, we have a normal Python line. Log and return.
1963 return self.handle_normal(line,continue_prompt)
1966 return self.handle_normal(line,continue_prompt)
1964
1967
1965 def _prefilter_dumb(self, line, continue_prompt):
1968 def _prefilter_dumb(self, line, continue_prompt):
1966 """simple prefilter function, for debugging"""
1969 """simple prefilter function, for debugging"""
1967 return self.handle_normal(line,continue_prompt)
1970 return self.handle_normal(line,continue_prompt)
1968
1971
1969 # Set the default prefilter() function (this can be user-overridden)
1972 # Set the default prefilter() function (this can be user-overridden)
1970 prefilter = _prefilter
1973 prefilter = _prefilter
1971
1974
1972 def handle_normal(self,line,continue_prompt=None,
1975 def handle_normal(self,line,continue_prompt=None,
1973 pre=None,iFun=None,theRest=None):
1976 pre=None,iFun=None,theRest=None):
1974 """Handle normal input lines. Use as a template for handlers."""
1977 """Handle normal input lines. Use as a template for handlers."""
1975
1978
1976 # With autoindent on, we need some way to exit the input loop, and I
1979 # With autoindent on, we need some way to exit the input loop, and I
1977 # don't want to force the user to have to backspace all the way to
1980 # don't want to force the user to have to backspace all the way to
1978 # clear the line. The rule will be in this case, that either two
1981 # clear the line. The rule will be in this case, that either two
1979 # lines of pure whitespace in a row, or a line of pure whitespace but
1982 # lines of pure whitespace in a row, or a line of pure whitespace but
1980 # of a size different to the indent level, will exit the input loop.
1983 # of a size different to the indent level, will exit the input loop.
1981
1984
1982 if (continue_prompt and self.autoindent and line.isspace() and
1985 if (continue_prompt and self.autoindent and line.isspace() and
1983 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
1986 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
1984 (self.buffer[-1]).isspace() )):
1987 (self.buffer[-1]).isspace() )):
1985 line = ''
1988 line = ''
1986
1989
1987 self.log(line,continue_prompt)
1990 self.log(line,continue_prompt)
1988 return line
1991 return line
1989
1992
1990 def handle_alias(self,line,continue_prompt=None,
1993 def handle_alias(self,line,continue_prompt=None,
1991 pre=None,iFun=None,theRest=None):
1994 pre=None,iFun=None,theRest=None):
1992 """Handle alias input lines. """
1995 """Handle alias input lines. """
1993
1996
1994 # pre is needed, because it carries the leading whitespace. Otherwise
1997 # pre is needed, because it carries the leading whitespace. Otherwise
1995 # aliases won't work in indented sections.
1998 # aliases won't work in indented sections.
1996 transformed = self.transform_alias(iFun, theRest)
1999 transformed = self.transform_alias(iFun, theRest)
1997 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2000 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
1998 self.log(line_out,continue_prompt)
2001 self.log(line_out,continue_prompt)
1999 return line_out
2002 return line_out
2000
2003
2001 def handle_shell_escape(self, line, continue_prompt=None,
2004 def handle_shell_escape(self, line, continue_prompt=None,
2002 pre=None,iFun=None,theRest=None):
2005 pre=None,iFun=None,theRest=None):
2003 """Execute the line in a shell, empty return value"""
2006 """Execute the line in a shell, empty return value"""
2004
2007
2005 #print 'line in :', `line` # dbg
2008 #print 'line in :', `line` # dbg
2006 # Example of a special handler. Others follow a similar pattern.
2009 # Example of a special handler. Others follow a similar pattern.
2007 if line.lstrip().startswith('!!'):
2010 if line.lstrip().startswith('!!'):
2008 # rewrite iFun/theRest to properly hold the call to %sx and
2011 # rewrite iFun/theRest to properly hold the call to %sx and
2009 # the actual command to be executed, so handle_magic can work
2012 # the actual command to be executed, so handle_magic can work
2010 # correctly
2013 # correctly
2011 theRest = '%s %s' % (iFun[2:],theRest)
2014 theRest = '%s %s' % (iFun[2:],theRest)
2012 iFun = 'sx'
2015 iFun = 'sx'
2013 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2016 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2014 line.lstrip()[2:]),
2017 line.lstrip()[2:]),
2015 continue_prompt,pre,iFun,theRest)
2018 continue_prompt,pre,iFun,theRest)
2016 else:
2019 else:
2017 cmd=line.lstrip().lstrip('!')
2020 cmd=line.lstrip().lstrip('!')
2018 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2021 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2019 # update cache/log and return
2022 # update cache/log and return
2020 self.log(line_out,continue_prompt)
2023 self.log(line_out,continue_prompt)
2021 return line_out
2024 return line_out
2022
2025
2023 def handle_magic(self, line, continue_prompt=None,
2026 def handle_magic(self, line, continue_prompt=None,
2024 pre=None,iFun=None,theRest=None):
2027 pre=None,iFun=None,theRest=None):
2025 """Execute magic functions."""
2028 """Execute magic functions."""
2026
2029
2027
2030
2028 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2031 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2029 self.log(cmd,continue_prompt)
2032 self.log(cmd,continue_prompt)
2030 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2033 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2031 return cmd
2034 return cmd
2032
2035
2033 def handle_auto(self, line, continue_prompt=None,
2036 def handle_auto(self, line, continue_prompt=None,
2034 pre=None,iFun=None,theRest=None,obj=None):
2037 pre=None,iFun=None,theRest=None,obj=None):
2035 """Hande lines which can be auto-executed, quoting if requested."""
2038 """Hande lines which can be auto-executed, quoting if requested."""
2036
2039
2037 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2040 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2038
2041
2039 # This should only be active for single-line input!
2042 # This should only be active for single-line input!
2040 if continue_prompt:
2043 if continue_prompt:
2041 self.log(line,continue_prompt)
2044 self.log(line,continue_prompt)
2042 return line
2045 return line
2043
2046
2044 auto_rewrite = True
2047 auto_rewrite = True
2045
2048
2046 if pre == self.ESC_QUOTE:
2049 if pre == self.ESC_QUOTE:
2047 # Auto-quote splitting on whitespace
2050 # Auto-quote splitting on whitespace
2048 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2051 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2049 elif pre == self.ESC_QUOTE2:
2052 elif pre == self.ESC_QUOTE2:
2050 # Auto-quote whole string
2053 # Auto-quote whole string
2051 newcmd = '%s("%s")' % (iFun,theRest)
2054 newcmd = '%s("%s")' % (iFun,theRest)
2052 elif pre == self.ESC_PAREN:
2055 elif pre == self.ESC_PAREN:
2053 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2056 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2054 else:
2057 else:
2055 # Auto-paren.
2058 # Auto-paren.
2056 # We only apply it to argument-less calls if the autocall
2059 # We only apply it to argument-less calls if the autocall
2057 # parameter is set to 2. We only need to check that autocall is <
2060 # parameter is set to 2. We only need to check that autocall is <
2058 # 2, since this function isn't called unless it's at least 1.
2061 # 2, since this function isn't called unless it's at least 1.
2059 if not theRest and (self.rc.autocall < 2):
2062 if not theRest and (self.rc.autocall < 2):
2060 newcmd = '%s %s' % (iFun,theRest)
2063 newcmd = '%s %s' % (iFun,theRest)
2061 auto_rewrite = False
2064 auto_rewrite = False
2062 else:
2065 else:
2063 if theRest.startswith('['):
2066 if theRest.startswith('['):
2064 if hasattr(obj,'__getitem__'):
2067 if hasattr(obj,'__getitem__'):
2065 # Don't autocall in this case: item access for an object
2068 # Don't autocall in this case: item access for an object
2066 # which is BOTH callable and implements __getitem__.
2069 # which is BOTH callable and implements __getitem__.
2067 newcmd = '%s %s' % (iFun,theRest)
2070 newcmd = '%s %s' % (iFun,theRest)
2068 auto_rewrite = False
2071 auto_rewrite = False
2069 else:
2072 else:
2070 # if the object doesn't support [] access, go ahead and
2073 # if the object doesn't support [] access, go ahead and
2071 # autocall
2074 # autocall
2072 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2075 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2073 elif theRest.endswith(';'):
2076 elif theRest.endswith(';'):
2074 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2077 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2075 else:
2078 else:
2076 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2079 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2077
2080
2078 if auto_rewrite:
2081 if auto_rewrite:
2079 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2082 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2080 # log what is now valid Python, not the actual user input (without the
2083 # log what is now valid Python, not the actual user input (without the
2081 # final newline)
2084 # final newline)
2082 self.log(newcmd,continue_prompt)
2085 self.log(newcmd,continue_prompt)
2083 return newcmd
2086 return newcmd
2084
2087
2085 def handle_help(self, line, continue_prompt=None,
2088 def handle_help(self, line, continue_prompt=None,
2086 pre=None,iFun=None,theRest=None):
2089 pre=None,iFun=None,theRest=None):
2087 """Try to get some help for the object.
2090 """Try to get some help for the object.
2088
2091
2089 obj? or ?obj -> basic information.
2092 obj? or ?obj -> basic information.
2090 obj?? or ??obj -> more details.
2093 obj?? or ??obj -> more details.
2091 """
2094 """
2092
2095
2093 # We need to make sure that we don't process lines which would be
2096 # We need to make sure that we don't process lines which would be
2094 # otherwise valid python, such as "x=1 # what?"
2097 # otherwise valid python, such as "x=1 # what?"
2095 try:
2098 try:
2096 codeop.compile_command(line)
2099 codeop.compile_command(line)
2097 except SyntaxError:
2100 except SyntaxError:
2098 # We should only handle as help stuff which is NOT valid syntax
2101 # We should only handle as help stuff which is NOT valid syntax
2099 if line[0]==self.ESC_HELP:
2102 if line[0]==self.ESC_HELP:
2100 line = line[1:]
2103 line = line[1:]
2101 elif line[-1]==self.ESC_HELP:
2104 elif line[-1]==self.ESC_HELP:
2102 line = line[:-1]
2105 line = line[:-1]
2103 self.log('#?'+line)
2106 self.log('#?'+line)
2104 if line:
2107 if line:
2105 self.magic_pinfo(line)
2108 self.magic_pinfo(line)
2106 else:
2109 else:
2107 page(self.usage,screen_lines=self.rc.screen_length)
2110 page(self.usage,screen_lines=self.rc.screen_length)
2108 return '' # Empty string is needed here!
2111 return '' # Empty string is needed here!
2109 except:
2112 except:
2110 # Pass any other exceptions through to the normal handler
2113 # Pass any other exceptions through to the normal handler
2111 return self.handle_normal(line,continue_prompt)
2114 return self.handle_normal(line,continue_prompt)
2112 else:
2115 else:
2113 # If the code compiles ok, we should handle it normally
2116 # If the code compiles ok, we should handle it normally
2114 return self.handle_normal(line,continue_prompt)
2117 return self.handle_normal(line,continue_prompt)
2115
2118
2116 def getapi(self):
2119 def getapi(self):
2117 """ Get an IPApi object for this shell instance
2120 """ Get an IPApi object for this shell instance
2118
2121
2119 Getting an IPApi object is always preferable to accessing the shell
2122 Getting an IPApi object is always preferable to accessing the shell
2120 directly, but this holds true especially for extensions.
2123 directly, but this holds true especially for extensions.
2121
2124
2122 It should always be possible to implement an extension with IPApi
2125 It should always be possible to implement an extension with IPApi
2123 alone. If not, contact maintainer to request an addition.
2126 alone. If not, contact maintainer to request an addition.
2124
2127
2125 """
2128 """
2126 return self.api
2129 return self.api
2127
2130
2128 def handle_emacs(self,line,continue_prompt=None,
2131 def handle_emacs(self,line,continue_prompt=None,
2129 pre=None,iFun=None,theRest=None):
2132 pre=None,iFun=None,theRest=None):
2130 """Handle input lines marked by python-mode."""
2133 """Handle input lines marked by python-mode."""
2131
2134
2132 # Currently, nothing is done. Later more functionality can be added
2135 # Currently, nothing is done. Later more functionality can be added
2133 # here if needed.
2136 # here if needed.
2134
2137
2135 # The input cache shouldn't be updated
2138 # The input cache shouldn't be updated
2136
2139
2137 return line
2140 return line
2138
2141
2139 def mktempfile(self,data=None):
2142 def mktempfile(self,data=None):
2140 """Make a new tempfile and return its filename.
2143 """Make a new tempfile and return its filename.
2141
2144
2142 This makes a call to tempfile.mktemp, but it registers the created
2145 This makes a call to tempfile.mktemp, but it registers the created
2143 filename internally so ipython cleans it up at exit time.
2146 filename internally so ipython cleans it up at exit time.
2144
2147
2145 Optional inputs:
2148 Optional inputs:
2146
2149
2147 - data(None): if data is given, it gets written out to the temp file
2150 - data(None): if data is given, it gets written out to the temp file
2148 immediately, and the file is closed again."""
2151 immediately, and the file is closed again."""
2149
2152
2150 filename = tempfile.mktemp('.py','ipython_edit_')
2153 filename = tempfile.mktemp('.py','ipython_edit_')
2151 self.tempfiles.append(filename)
2154 self.tempfiles.append(filename)
2152
2155
2153 if data:
2156 if data:
2154 tmp_file = open(filename,'w')
2157 tmp_file = open(filename,'w')
2155 tmp_file.write(data)
2158 tmp_file.write(data)
2156 tmp_file.close()
2159 tmp_file.close()
2157 return filename
2160 return filename
2158
2161
2159 def write(self,data):
2162 def write(self,data):
2160 """Write a string to the default output"""
2163 """Write a string to the default output"""
2161 Term.cout.write(data)
2164 Term.cout.write(data)
2162
2165
2163 def write_err(self,data):
2166 def write_err(self,data):
2164 """Write a string to the default error output"""
2167 """Write a string to the default error output"""
2165 Term.cerr.write(data)
2168 Term.cerr.write(data)
2166
2169
2167 def exit(self):
2170 def exit(self):
2168 """Handle interactive exit.
2171 """Handle interactive exit.
2169
2172
2170 This method sets the exit_now attribute."""
2173 This method sets the exit_now attribute."""
2171
2174
2172 if self.rc.confirm_exit:
2175 if self.rc.confirm_exit:
2173 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2176 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2174 self.exit_now = True
2177 self.exit_now = True
2175 else:
2178 else:
2176 self.exit_now = True
2179 self.exit_now = True
2177 return self.exit_now
2180 return self.exit_now
2178
2181
2179 def safe_execfile(self,fname,*where,**kw):
2182 def safe_execfile(self,fname,*where,**kw):
2180 fname = os.path.expanduser(fname)
2183 fname = os.path.expanduser(fname)
2181
2184
2182 # find things also in current directory
2185 # find things also in current directory
2183 dname = os.path.dirname(fname)
2186 dname = os.path.dirname(fname)
2184 if not sys.path.count(dname):
2187 if not sys.path.count(dname):
2185 sys.path.append(dname)
2188 sys.path.append(dname)
2186
2189
2187 try:
2190 try:
2188 xfile = open(fname)
2191 xfile = open(fname)
2189 except:
2192 except:
2190 print >> Term.cerr, \
2193 print >> Term.cerr, \
2191 'Could not open file <%s> for safe execution.' % fname
2194 'Could not open file <%s> for safe execution.' % fname
2192 return None
2195 return None
2193
2196
2194 kw.setdefault('islog',0)
2197 kw.setdefault('islog',0)
2195 kw.setdefault('quiet',1)
2198 kw.setdefault('quiet',1)
2196 kw.setdefault('exit_ignore',0)
2199 kw.setdefault('exit_ignore',0)
2197 first = xfile.readline()
2200 first = xfile.readline()
2198 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2201 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2199 xfile.close()
2202 xfile.close()
2200 # line by line execution
2203 # line by line execution
2201 if first.startswith(loghead) or kw['islog']:
2204 if first.startswith(loghead) or kw['islog']:
2202 print 'Loading log file <%s> one line at a time...' % fname
2205 print 'Loading log file <%s> one line at a time...' % fname
2203 if kw['quiet']:
2206 if kw['quiet']:
2204 stdout_save = sys.stdout
2207 stdout_save = sys.stdout
2205 sys.stdout = StringIO.StringIO()
2208 sys.stdout = StringIO.StringIO()
2206 try:
2209 try:
2207 globs,locs = where[0:2]
2210 globs,locs = where[0:2]
2208 except:
2211 except:
2209 try:
2212 try:
2210 globs = locs = where[0]
2213 globs = locs = where[0]
2211 except:
2214 except:
2212 globs = locs = globals()
2215 globs = locs = globals()
2213 badblocks = []
2216 badblocks = []
2214
2217
2215 # we also need to identify indented blocks of code when replaying
2218 # we also need to identify indented blocks of code when replaying
2216 # logs and put them together before passing them to an exec
2219 # logs and put them together before passing them to an exec
2217 # statement. This takes a bit of regexp and look-ahead work in the
2220 # statement. This takes a bit of regexp and look-ahead work in the
2218 # file. It's easiest if we swallow the whole thing in memory
2221 # file. It's easiest if we swallow the whole thing in memory
2219 # first, and manually walk through the lines list moving the
2222 # first, and manually walk through the lines list moving the
2220 # counter ourselves.
2223 # counter ourselves.
2221 indent_re = re.compile('\s+\S')
2224 indent_re = re.compile('\s+\S')
2222 xfile = open(fname)
2225 xfile = open(fname)
2223 filelines = xfile.readlines()
2226 filelines = xfile.readlines()
2224 xfile.close()
2227 xfile.close()
2225 nlines = len(filelines)
2228 nlines = len(filelines)
2226 lnum = 0
2229 lnum = 0
2227 while lnum < nlines:
2230 while lnum < nlines:
2228 line = filelines[lnum]
2231 line = filelines[lnum]
2229 lnum += 1
2232 lnum += 1
2230 # don't re-insert logger status info into cache
2233 # don't re-insert logger status info into cache
2231 if line.startswith('#log#'):
2234 if line.startswith('#log#'):
2232 continue
2235 continue
2233 else:
2236 else:
2234 # build a block of code (maybe a single line) for execution
2237 # build a block of code (maybe a single line) for execution
2235 block = line
2238 block = line
2236 try:
2239 try:
2237 next = filelines[lnum] # lnum has already incremented
2240 next = filelines[lnum] # lnum has already incremented
2238 except:
2241 except:
2239 next = None
2242 next = None
2240 while next and indent_re.match(next):
2243 while next and indent_re.match(next):
2241 block += next
2244 block += next
2242 lnum += 1
2245 lnum += 1
2243 try:
2246 try:
2244 next = filelines[lnum]
2247 next = filelines[lnum]
2245 except:
2248 except:
2246 next = None
2249 next = None
2247 # now execute the block of one or more lines
2250 # now execute the block of one or more lines
2248 try:
2251 try:
2249 exec block in globs,locs
2252 exec block in globs,locs
2250 except SystemExit:
2253 except SystemExit:
2251 pass
2254 pass
2252 except:
2255 except:
2253 badblocks.append(block.rstrip())
2256 badblocks.append(block.rstrip())
2254 if kw['quiet']: # restore stdout
2257 if kw['quiet']: # restore stdout
2255 sys.stdout.close()
2258 sys.stdout.close()
2256 sys.stdout = stdout_save
2259 sys.stdout = stdout_save
2257 print 'Finished replaying log file <%s>' % fname
2260 print 'Finished replaying log file <%s>' % fname
2258 if badblocks:
2261 if badblocks:
2259 print >> sys.stderr, ('\nThe following lines/blocks in file '
2262 print >> sys.stderr, ('\nThe following lines/blocks in file '
2260 '<%s> reported errors:' % fname)
2263 '<%s> reported errors:' % fname)
2261
2264
2262 for badline in badblocks:
2265 for badline in badblocks:
2263 print >> sys.stderr, badline
2266 print >> sys.stderr, badline
2264 else: # regular file execution
2267 else: # regular file execution
2265 try:
2268 try:
2266 execfile(fname,*where)
2269 execfile(fname,*where)
2267 except SyntaxError:
2270 except SyntaxError:
2268 self.showsyntaxerror()
2271 self.showsyntaxerror()
2269 warn('Failure executing file: <%s>' % fname)
2272 warn('Failure executing file: <%s>' % fname)
2270 except SystemExit,status:
2273 except SystemExit,status:
2271 if not kw['exit_ignore']:
2274 if not kw['exit_ignore']:
2272 self.showtraceback()
2275 self.showtraceback()
2273 warn('Failure executing file: <%s>' % fname)
2276 warn('Failure executing file: <%s>' % fname)
2274 except:
2277 except:
2275 self.showtraceback()
2278 self.showtraceback()
2276 warn('Failure executing file: <%s>' % fname)
2279 warn('Failure executing file: <%s>' % fname)
2277
2280
2278 #************************* end of file <iplib.py> *****************************
2281 #************************* end of file <iplib.py> *****************************
@@ -1,5286 +1,5294 b''
1 2006-03-28 Ville Vainio <vivainio@gmail.com>
2
3 * iplib.py: Quote aliases with spaces in the name.
4 "c:\program files\blah\bin" is now legal alias target.
5
6 * ext_rehashdir.py: Space no longer allowed as arg
7 separator, since space is legal in path names.
8
1 2006-03-16 Ville Vainio <vivainio@gmail.com>
9 2006-03-16 Ville Vainio <vivainio@gmail.com>
2
10
3 * upgrade_dir.py: Take path.py from Extensions, correcting
11 * upgrade_dir.py: Take path.py from Extensions, correcting
4 %upgrade magic
12 %upgrade magic
5
13
6 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
14 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
7
15
8 * hooks.py: Only enclose editor binary in quotes if legal and
16 * hooks.py: Only enclose editor binary in quotes if legal and
9 necessary (space in the name, and is an existing file). Fixes a bug
17 necessary (space in the name, and is an existing file). Fixes a bug
10 reported by Zachary Pincus.
18 reported by Zachary Pincus.
11
19
12 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
20 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
13
21
14 * Manual: thanks to a tip on proper color handling for Emacs, by
22 * Manual: thanks to a tip on proper color handling for Emacs, by
15 Eric J Haywiser <ejh1-AT-MIT.EDU>.
23 Eric J Haywiser <ejh1-AT-MIT.EDU>.
16
24
17 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
25 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
18 by applying the provided patch. Thanks to Liu Jin
26 by applying the provided patch. Thanks to Liu Jin
19 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
27 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
20 XEmacs/Linux, I'm trusting the submitter that it actually helps
28 XEmacs/Linux, I'm trusting the submitter that it actually helps
21 under win32/GNU Emacs. Will revisit if any problems are reported.
29 under win32/GNU Emacs. Will revisit if any problems are reported.
22
30
23 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
31 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
24
32
25 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
33 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
26 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
34 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
27
35
28 2006-03-12 Ville Vainio <vivainio@gmail.com>
36 2006-03-12 Ville Vainio <vivainio@gmail.com>
29
37
30 * Magic.py (magic_timeit): Added %timeit magic, contributed by
38 * Magic.py (magic_timeit): Added %timeit magic, contributed by
31 Torsten Marek.
39 Torsten Marek.
32
40
33 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
41 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
34
42
35 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
43 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
36 line ranges works again.
44 line ranges works again.
37
45
38 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
46 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
39
47
40 * IPython/iplib.py (showtraceback): add back sys.last_traceback
48 * IPython/iplib.py (showtraceback): add back sys.last_traceback
41 and friends, after a discussion with Zach Pincus on ipython-user.
49 and friends, after a discussion with Zach Pincus on ipython-user.
42 I'm not 100% sure, but after thinking aobut it quite a bit, it may
50 I'm not 100% sure, but after thinking aobut it quite a bit, it may
43 be OK. Testing with the multithreaded shells didn't reveal any
51 be OK. Testing with the multithreaded shells didn't reveal any
44 problems, but let's keep an eye out.
52 problems, but let's keep an eye out.
45
53
46 In the process, I fixed a few things which were calling
54 In the process, I fixed a few things which were calling
47 self.InteractiveTB() directly (like safe_execfile), which is a
55 self.InteractiveTB() directly (like safe_execfile), which is a
48 mistake: ALL exception reporting should be done by calling
56 mistake: ALL exception reporting should be done by calling
49 self.showtraceback(), which handles state and tab-completion and
57 self.showtraceback(), which handles state and tab-completion and
50 more.
58 more.
51
59
52 2006-03-01 Ville Vainio <vivainio@gmail.com>
60 2006-03-01 Ville Vainio <vivainio@gmail.com>
53
61
54 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
62 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
55 To use, do "from ipipe import *".
63 To use, do "from ipipe import *".
56
64
57 2006-02-24 Ville Vainio <vivainio@gmail.com>
65 2006-02-24 Ville Vainio <vivainio@gmail.com>
58
66
59 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
67 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
60 "cleanly" and safely than the older upgrade mechanism.
68 "cleanly" and safely than the older upgrade mechanism.
61
69
62 2006-02-21 Ville Vainio <vivainio@gmail.com>
70 2006-02-21 Ville Vainio <vivainio@gmail.com>
63
71
64 * Magic.py: %save works again.
72 * Magic.py: %save works again.
65
73
66 2006-02-15 Ville Vainio <vivainio@gmail.com>
74 2006-02-15 Ville Vainio <vivainio@gmail.com>
67
75
68 * Magic.py: %Pprint works again
76 * Magic.py: %Pprint works again
69
77
70 * Extensions/ipy_sane_defaults.py: Provide everything provided
78 * Extensions/ipy_sane_defaults.py: Provide everything provided
71 in default ipythonrc, to make it possible to have a completely empty
79 in default ipythonrc, to make it possible to have a completely empty
72 ipythonrc (and thus completely rc-file free configuration)
80 ipythonrc (and thus completely rc-file free configuration)
73
81
74
82
75 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
83 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
76
84
77 * IPython/hooks.py (editor): quote the call to the editor command,
85 * IPython/hooks.py (editor): quote the call to the editor command,
78 to allow commands with spaces in them. Problem noted by watching
86 to allow commands with spaces in them. Problem noted by watching
79 Ian Oswald's video about textpad under win32 at
87 Ian Oswald's video about textpad under win32 at
80 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
88 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
81
89
82 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
90 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
83 describing magics (we haven't used @ for a loong time).
91 describing magics (we haven't used @ for a loong time).
84
92
85 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
93 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
86 contributed by marienz to close
94 contributed by marienz to close
87 http://www.scipy.net/roundup/ipython/issue53.
95 http://www.scipy.net/roundup/ipython/issue53.
88
96
89 2006-02-10 Ville Vainio <vivainio@gmail.com>
97 2006-02-10 Ville Vainio <vivainio@gmail.com>
90
98
91 * genutils.py: getoutput now works in win32 too
99 * genutils.py: getoutput now works in win32 too
92
100
93 * completer.py: alias and magic completion only invoked
101 * completer.py: alias and magic completion only invoked
94 at the first "item" in the line, to avoid "cd %store"
102 at the first "item" in the line, to avoid "cd %store"
95 nonsense.
103 nonsense.
96
104
97 2006-02-09 Ville Vainio <vivainio@gmail.com>
105 2006-02-09 Ville Vainio <vivainio@gmail.com>
98
106
99 * test/*: Added a unit testing framework (finally).
107 * test/*: Added a unit testing framework (finally).
100 '%run runtests.py' to run test_*.
108 '%run runtests.py' to run test_*.
101
109
102 * ipapi.py: Exposed runlines and set_custom_exc
110 * ipapi.py: Exposed runlines and set_custom_exc
103
111
104 2006-02-07 Ville Vainio <vivainio@gmail.com>
112 2006-02-07 Ville Vainio <vivainio@gmail.com>
105
113
106 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
114 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
107 instead use "f(1 2)" as before.
115 instead use "f(1 2)" as before.
108
116
109 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
117 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
110
118
111 * IPython/demo.py (IPythonDemo): Add new classes to the demo
119 * IPython/demo.py (IPythonDemo): Add new classes to the demo
112 facilities, for demos processed by the IPython input filter
120 facilities, for demos processed by the IPython input filter
113 (IPythonDemo), and for running a script one-line-at-a-time as a
121 (IPythonDemo), and for running a script one-line-at-a-time as a
114 demo, both for pure Python (LineDemo) and for IPython-processed
122 demo, both for pure Python (LineDemo) and for IPython-processed
115 input (IPythonLineDemo). After a request by Dave Kohel, from the
123 input (IPythonLineDemo). After a request by Dave Kohel, from the
116 SAGE team.
124 SAGE team.
117 (Demo.edit): added and edit() method to the demo objects, to edit
125 (Demo.edit): added and edit() method to the demo objects, to edit
118 the in-memory copy of the last executed block.
126 the in-memory copy of the last executed block.
119
127
120 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
128 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
121 processing to %edit, %macro and %save. These commands can now be
129 processing to %edit, %macro and %save. These commands can now be
122 invoked on the unprocessed input as it was typed by the user
130 invoked on the unprocessed input as it was typed by the user
123 (without any prefilters applied). After requests by the SAGE team
131 (without any prefilters applied). After requests by the SAGE team
124 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
132 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
125
133
126 2006-02-01 Ville Vainio <vivainio@gmail.com>
134 2006-02-01 Ville Vainio <vivainio@gmail.com>
127
135
128 * setup.py, eggsetup.py: easy_install ipython==dev works
136 * setup.py, eggsetup.py: easy_install ipython==dev works
129 correctly now (on Linux)
137 correctly now (on Linux)
130
138
131 * ipy_user_conf,ipmaker: user config changes, removed spurious
139 * ipy_user_conf,ipmaker: user config changes, removed spurious
132 warnings
140 warnings
133
141
134 * iplib: if rc.banner is string, use it as is.
142 * iplib: if rc.banner is string, use it as is.
135
143
136 * Magic: %pycat accepts a string argument and pages it's contents.
144 * Magic: %pycat accepts a string argument and pages it's contents.
137
145
138
146
139 2006-01-30 Ville Vainio <vivainio@gmail.com>
147 2006-01-30 Ville Vainio <vivainio@gmail.com>
140
148
141 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
149 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
142 Now %store and bookmarks work through PickleShare, meaning that
150 Now %store and bookmarks work through PickleShare, meaning that
143 concurrent access is possible and all ipython sessions see the
151 concurrent access is possible and all ipython sessions see the
144 same database situation all the time, instead of snapshot of
152 same database situation all the time, instead of snapshot of
145 the situation when the session was started. Hence, %bookmark
153 the situation when the session was started. Hence, %bookmark
146 results are immediately accessible from othes sessions. The database
154 results are immediately accessible from othes sessions. The database
147 is also available for use by user extensions. See:
155 is also available for use by user extensions. See:
148 http://www.python.org/pypi/pickleshare
156 http://www.python.org/pypi/pickleshare
149
157
150 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
158 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
151
159
152 * aliases can now be %store'd
160 * aliases can now be %store'd
153
161
154 * path.py move to Extensions so that pickleshare does not need
162 * path.py move to Extensions so that pickleshare does not need
155 IPython-specific import. Extensions added to pythonpath right
163 IPython-specific import. Extensions added to pythonpath right
156 at __init__.
164 at __init__.
157
165
158 * iplib.py: ipalias deprecated/redundant; aliases are converted and
166 * iplib.py: ipalias deprecated/redundant; aliases are converted and
159 called with _ip.system and the pre-transformed command string.
167 called with _ip.system and the pre-transformed command string.
160
168
161 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
169 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
162
170
163 * IPython/iplib.py (interact): Fix that we were not catching
171 * IPython/iplib.py (interact): Fix that we were not catching
164 KeyboardInterrupt exceptions properly. I'm not quite sure why the
172 KeyboardInterrupt exceptions properly. I'm not quite sure why the
165 logic here had to change, but it's fixed now.
173 logic here had to change, but it's fixed now.
166
174
167 2006-01-29 Ville Vainio <vivainio@gmail.com>
175 2006-01-29 Ville Vainio <vivainio@gmail.com>
168
176
169 * iplib.py: Try to import pyreadline on Windows.
177 * iplib.py: Try to import pyreadline on Windows.
170
178
171 2006-01-27 Ville Vainio <vivainio@gmail.com>
179 2006-01-27 Ville Vainio <vivainio@gmail.com>
172
180
173 * iplib.py: Expose ipapi as _ip in builtin namespace.
181 * iplib.py: Expose ipapi as _ip in builtin namespace.
174 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
182 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
175 and ip_set_hook (-> _ip.set_hook) redundant. % and !
183 and ip_set_hook (-> _ip.set_hook) redundant. % and !
176 syntax now produce _ip.* variant of the commands.
184 syntax now produce _ip.* variant of the commands.
177
185
178 * "_ip.options().autoedit_syntax = 2" automatically throws
186 * "_ip.options().autoedit_syntax = 2" automatically throws
179 user to editor for syntax error correction without prompting.
187 user to editor for syntax error correction without prompting.
180
188
181 2006-01-27 Ville Vainio <vivainio@gmail.com>
189 2006-01-27 Ville Vainio <vivainio@gmail.com>
182
190
183 * ipmaker.py: Give "realistic" sys.argv for scripts (without
191 * ipmaker.py: Give "realistic" sys.argv for scripts (without
184 'ipython' at argv[0]) executed through command line.
192 'ipython' at argv[0]) executed through command line.
185 NOTE: this DEPRECATES calling ipython with multiple scripts
193 NOTE: this DEPRECATES calling ipython with multiple scripts
186 ("ipython a.py b.py c.py")
194 ("ipython a.py b.py c.py")
187
195
188 * iplib.py, hooks.py: Added configurable input prefilter,
196 * iplib.py, hooks.py: Added configurable input prefilter,
189 named 'input_prefilter'. See ext_rescapture.py for example
197 named 'input_prefilter'. See ext_rescapture.py for example
190 usage.
198 usage.
191
199
192 * ext_rescapture.py, Magic.py: Better system command output capture
200 * ext_rescapture.py, Magic.py: Better system command output capture
193 through 'var = !ls' (deprecates user-visible %sc). Same notation
201 through 'var = !ls' (deprecates user-visible %sc). Same notation
194 applies for magics, 'var = %alias' assigns alias list to var.
202 applies for magics, 'var = %alias' assigns alias list to var.
195
203
196 * ipapi.py: added meta() for accessing extension-usable data store.
204 * ipapi.py: added meta() for accessing extension-usable data store.
197
205
198 * iplib.py: added InteractiveShell.getapi(). New magics should be
206 * iplib.py: added InteractiveShell.getapi(). New magics should be
199 written doing self.getapi() instead of using the shell directly.
207 written doing self.getapi() instead of using the shell directly.
200
208
201 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
209 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
202 %store foo >> ~/myfoo.txt to store variables to files (in clean
210 %store foo >> ~/myfoo.txt to store variables to files (in clean
203 textual form, not a restorable pickle).
211 textual form, not a restorable pickle).
204
212
205 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
213 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
206
214
207 * usage.py, Magic.py: added %quickref
215 * usage.py, Magic.py: added %quickref
208
216
209 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
217 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
210
218
211 * GetoptErrors when invoking magics etc. with wrong args
219 * GetoptErrors when invoking magics etc. with wrong args
212 are now more helpful:
220 are now more helpful:
213 GetoptError: option -l not recognized (allowed: "qb" )
221 GetoptError: option -l not recognized (allowed: "qb" )
214
222
215 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
223 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
216
224
217 * IPython/demo.py (Demo.show): Flush stdout after each block, so
225 * IPython/demo.py (Demo.show): Flush stdout after each block, so
218 computationally intensive blocks don't appear to stall the demo.
226 computationally intensive blocks don't appear to stall the demo.
219
227
220 2006-01-24 Ville Vainio <vivainio@gmail.com>
228 2006-01-24 Ville Vainio <vivainio@gmail.com>
221
229
222 * iplib.py, hooks.py: 'result_display' hook can return a non-None
230 * iplib.py, hooks.py: 'result_display' hook can return a non-None
223 value to manipulate resulting history entry.
231 value to manipulate resulting history entry.
224
232
225 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
233 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
226 to instance methods of IPApi class, to make extending an embedded
234 to instance methods of IPApi class, to make extending an embedded
227 IPython feasible. See ext_rehashdir.py for example usage.
235 IPython feasible. See ext_rehashdir.py for example usage.
228
236
229 * Merged 1071-1076 from banches/0.7.1
237 * Merged 1071-1076 from banches/0.7.1
230
238
231
239
232 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
240 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
233
241
234 * tools/release (daystamp): Fix build tools to use the new
242 * tools/release (daystamp): Fix build tools to use the new
235 eggsetup.py script to build lightweight eggs.
243 eggsetup.py script to build lightweight eggs.
236
244
237 * Applied changesets 1062 and 1064 before 0.7.1 release.
245 * Applied changesets 1062 and 1064 before 0.7.1 release.
238
246
239 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
247 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
240 see the raw input history (without conversions like %ls ->
248 see the raw input history (without conversions like %ls ->
241 ipmagic("ls")). After a request from W. Stein, SAGE
249 ipmagic("ls")). After a request from W. Stein, SAGE
242 (http://modular.ucsd.edu/sage) developer. This information is
250 (http://modular.ucsd.edu/sage) developer. This information is
243 stored in the input_hist_raw attribute of the IPython instance, so
251 stored in the input_hist_raw attribute of the IPython instance, so
244 developers can access it if needed (it's an InputList instance).
252 developers can access it if needed (it's an InputList instance).
245
253
246 * Versionstring = 0.7.2.svn
254 * Versionstring = 0.7.2.svn
247
255
248 * eggsetup.py: A separate script for constructing eggs, creates
256 * eggsetup.py: A separate script for constructing eggs, creates
249 proper launch scripts even on Windows (an .exe file in
257 proper launch scripts even on Windows (an .exe file in
250 \python24\scripts).
258 \python24\scripts).
251
259
252 * ipapi.py: launch_new_instance, launch entry point needed for the
260 * ipapi.py: launch_new_instance, launch entry point needed for the
253 egg.
261 egg.
254
262
255 2006-01-23 Ville Vainio <vivainio@gmail.com>
263 2006-01-23 Ville Vainio <vivainio@gmail.com>
256
264
257 * Added %cpaste magic for pasting python code
265 * Added %cpaste magic for pasting python code
258
266
259 2006-01-22 Ville Vainio <vivainio@gmail.com>
267 2006-01-22 Ville Vainio <vivainio@gmail.com>
260
268
261 * Merge from branches/0.7.1 into trunk, revs 1052-1057
269 * Merge from branches/0.7.1 into trunk, revs 1052-1057
262
270
263 * Versionstring = 0.7.2.svn
271 * Versionstring = 0.7.2.svn
264
272
265 * eggsetup.py: A separate script for constructing eggs, creates
273 * eggsetup.py: A separate script for constructing eggs, creates
266 proper launch scripts even on Windows (an .exe file in
274 proper launch scripts even on Windows (an .exe file in
267 \python24\scripts).
275 \python24\scripts).
268
276
269 * ipapi.py: launch_new_instance, launch entry point needed for the
277 * ipapi.py: launch_new_instance, launch entry point needed for the
270 egg.
278 egg.
271
279
272 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
280 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
273
281
274 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
282 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
275 %pfile foo would print the file for foo even if it was a binary.
283 %pfile foo would print the file for foo even if it was a binary.
276 Now, extensions '.so' and '.dll' are skipped.
284 Now, extensions '.so' and '.dll' are skipped.
277
285
278 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
286 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
279 bug, where macros would fail in all threaded modes. I'm not 100%
287 bug, where macros would fail in all threaded modes. I'm not 100%
280 sure, so I'm going to put out an rc instead of making a release
288 sure, so I'm going to put out an rc instead of making a release
281 today, and wait for feedback for at least a few days.
289 today, and wait for feedback for at least a few days.
282
290
283 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
291 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
284 it...) the handling of pasting external code with autoindent on.
292 it...) the handling of pasting external code with autoindent on.
285 To get out of a multiline input, the rule will appear for most
293 To get out of a multiline input, the rule will appear for most
286 users unchanged: two blank lines or change the indent level
294 users unchanged: two blank lines or change the indent level
287 proposed by IPython. But there is a twist now: you can
295 proposed by IPython. But there is a twist now: you can
288 add/subtract only *one or two spaces*. If you add/subtract three
296 add/subtract only *one or two spaces*. If you add/subtract three
289 or more (unless you completely delete the line), IPython will
297 or more (unless you completely delete the line), IPython will
290 accept that line, and you'll need to enter a second one of pure
298 accept that line, and you'll need to enter a second one of pure
291 whitespace. I know it sounds complicated, but I can't find a
299 whitespace. I know it sounds complicated, but I can't find a
292 different solution that covers all the cases, with the right
300 different solution that covers all the cases, with the right
293 heuristics. Hopefully in actual use, nobody will really notice
301 heuristics. Hopefully in actual use, nobody will really notice
294 all these strange rules and things will 'just work'.
302 all these strange rules and things will 'just work'.
295
303
296 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
304 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
297
305
298 * IPython/iplib.py (interact): catch exceptions which can be
306 * IPython/iplib.py (interact): catch exceptions which can be
299 triggered asynchronously by signal handlers. Thanks to an
307 triggered asynchronously by signal handlers. Thanks to an
300 automatic crash report, submitted by Colin Kingsley
308 automatic crash report, submitted by Colin Kingsley
301 <tercel-AT-gentoo.org>.
309 <tercel-AT-gentoo.org>.
302
310
303 2006-01-20 Ville Vainio <vivainio@gmail.com>
311 2006-01-20 Ville Vainio <vivainio@gmail.com>
304
312
305 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
313 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
306 (%rehashdir, very useful, try it out) of how to extend ipython
314 (%rehashdir, very useful, try it out) of how to extend ipython
307 with new magics. Also added Extensions dir to pythonpath to make
315 with new magics. Also added Extensions dir to pythonpath to make
308 importing extensions easy.
316 importing extensions easy.
309
317
310 * %store now complains when trying to store interactively declared
318 * %store now complains when trying to store interactively declared
311 classes / instances of those classes.
319 classes / instances of those classes.
312
320
313 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
321 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
314 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
322 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
315 if they exist, and ipy_user_conf.py with some defaults is created for
323 if they exist, and ipy_user_conf.py with some defaults is created for
316 the user.
324 the user.
317
325
318 * Startup rehashing done by the config file, not InterpreterExec.
326 * Startup rehashing done by the config file, not InterpreterExec.
319 This means system commands are available even without selecting the
327 This means system commands are available even without selecting the
320 pysh profile. It's the sensible default after all.
328 pysh profile. It's the sensible default after all.
321
329
322 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
330 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
323
331
324 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
332 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
325 multiline code with autoindent on working. But I am really not
333 multiline code with autoindent on working. But I am really not
326 sure, so this needs more testing. Will commit a debug-enabled
334 sure, so this needs more testing. Will commit a debug-enabled
327 version for now, while I test it some more, so that Ville and
335 version for now, while I test it some more, so that Ville and
328 others may also catch any problems. Also made
336 others may also catch any problems. Also made
329 self.indent_current_str() a method, to ensure that there's no
337 self.indent_current_str() a method, to ensure that there's no
330 chance of the indent space count and the corresponding string
338 chance of the indent space count and the corresponding string
331 falling out of sync. All code needing the string should just call
339 falling out of sync. All code needing the string should just call
332 the method.
340 the method.
333
341
334 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
342 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
335
343
336 * IPython/Magic.py (magic_edit): fix check for when users don't
344 * IPython/Magic.py (magic_edit): fix check for when users don't
337 save their output files, the try/except was in the wrong section.
345 save their output files, the try/except was in the wrong section.
338
346
339 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
347 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
340
348
341 * IPython/Magic.py (magic_run): fix __file__ global missing from
349 * IPython/Magic.py (magic_run): fix __file__ global missing from
342 script's namespace when executed via %run. After a report by
350 script's namespace when executed via %run. After a report by
343 Vivian.
351 Vivian.
344
352
345 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
353 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
346 when using python 2.4. The parent constructor changed in 2.4, and
354 when using python 2.4. The parent constructor changed in 2.4, and
347 we need to track it directly (we can't call it, as it messes up
355 we need to track it directly (we can't call it, as it messes up
348 readline and tab-completion inside our pdb would stop working).
356 readline and tab-completion inside our pdb would stop working).
349 After a bug report by R. Bernstein <rocky-AT-panix.com>.
357 After a bug report by R. Bernstein <rocky-AT-panix.com>.
350
358
351 2006-01-16 Ville Vainio <vivainio@gmail.com>
359 2006-01-16 Ville Vainio <vivainio@gmail.com>
352
360
353 * Ipython/magic.py:Reverted back to old %edit functionality
361 * Ipython/magic.py:Reverted back to old %edit functionality
354 that returns file contents on exit.
362 that returns file contents on exit.
355
363
356 * IPython/path.py: Added Jason Orendorff's "path" module to
364 * IPython/path.py: Added Jason Orendorff's "path" module to
357 IPython tree, http://www.jorendorff.com/articles/python/path/.
365 IPython tree, http://www.jorendorff.com/articles/python/path/.
358 You can get path objects conveniently through %sc, and !!, e.g.:
366 You can get path objects conveniently through %sc, and !!, e.g.:
359 sc files=ls
367 sc files=ls
360 for p in files.paths: # or files.p
368 for p in files.paths: # or files.p
361 print p,p.mtime
369 print p,p.mtime
362
370
363 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
371 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
364 now work again without considering the exclusion regexp -
372 now work again without considering the exclusion regexp -
365 hence, things like ',foo my/path' turn to 'foo("my/path")'
373 hence, things like ',foo my/path' turn to 'foo("my/path")'
366 instead of syntax error.
374 instead of syntax error.
367
375
368
376
369 2006-01-14 Ville Vainio <vivainio@gmail.com>
377 2006-01-14 Ville Vainio <vivainio@gmail.com>
370
378
371 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
379 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
372 ipapi decorators for python 2.4 users, options() provides access to rc
380 ipapi decorators for python 2.4 users, options() provides access to rc
373 data.
381 data.
374
382
375 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
383 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
376 as path separators (even on Linux ;-). Space character after
384 as path separators (even on Linux ;-). Space character after
377 backslash (as yielded by tab completer) is still space;
385 backslash (as yielded by tab completer) is still space;
378 "%cd long\ name" works as expected.
386 "%cd long\ name" works as expected.
379
387
380 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
388 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
381 as "chain of command", with priority. API stays the same,
389 as "chain of command", with priority. API stays the same,
382 TryNext exception raised by a hook function signals that
390 TryNext exception raised by a hook function signals that
383 current hook failed and next hook should try handling it, as
391 current hook failed and next hook should try handling it, as
384 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
392 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
385 requested configurable display hook, which is now implemented.
393 requested configurable display hook, which is now implemented.
386
394
387 2006-01-13 Ville Vainio <vivainio@gmail.com>
395 2006-01-13 Ville Vainio <vivainio@gmail.com>
388
396
389 * IPython/platutils*.py: platform specific utility functions,
397 * IPython/platutils*.py: platform specific utility functions,
390 so far only set_term_title is implemented (change terminal
398 so far only set_term_title is implemented (change terminal
391 label in windowing systems). %cd now changes the title to
399 label in windowing systems). %cd now changes the title to
392 current dir.
400 current dir.
393
401
394 * IPython/Release.py: Added myself to "authors" list,
402 * IPython/Release.py: Added myself to "authors" list,
395 had to create new files.
403 had to create new files.
396
404
397 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
405 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
398 shell escape; not a known bug but had potential to be one in the
406 shell escape; not a known bug but had potential to be one in the
399 future.
407 future.
400
408
401 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
409 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
402 extension API for IPython! See the module for usage example. Fix
410 extension API for IPython! See the module for usage example. Fix
403 OInspect for docstring-less magic functions.
411 OInspect for docstring-less magic functions.
404
412
405
413
406 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
414 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
407
415
408 * IPython/iplib.py (raw_input): temporarily deactivate all
416 * IPython/iplib.py (raw_input): temporarily deactivate all
409 attempts at allowing pasting of code with autoindent on. It
417 attempts at allowing pasting of code with autoindent on. It
410 introduced bugs (reported by Prabhu) and I can't seem to find a
418 introduced bugs (reported by Prabhu) and I can't seem to find a
411 robust combination which works in all cases. Will have to revisit
419 robust combination which works in all cases. Will have to revisit
412 later.
420 later.
413
421
414 * IPython/genutils.py: remove isspace() function. We've dropped
422 * IPython/genutils.py: remove isspace() function. We've dropped
415 2.2 compatibility, so it's OK to use the string method.
423 2.2 compatibility, so it's OK to use the string method.
416
424
417 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
425 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
418
426
419 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
427 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
420 matching what NOT to autocall on, to include all python binary
428 matching what NOT to autocall on, to include all python binary
421 operators (including things like 'and', 'or', 'is' and 'in').
429 operators (including things like 'and', 'or', 'is' and 'in').
422 Prompted by a bug report on 'foo & bar', but I realized we had
430 Prompted by a bug report on 'foo & bar', but I realized we had
423 many more potential bug cases with other operators. The regexp is
431 many more potential bug cases with other operators. The regexp is
424 self.re_exclude_auto, it's fairly commented.
432 self.re_exclude_auto, it's fairly commented.
425
433
426 2006-01-12 Ville Vainio <vivainio@gmail.com>
434 2006-01-12 Ville Vainio <vivainio@gmail.com>
427
435
428 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
436 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
429 Prettified and hardened string/backslash quoting with ipsystem(),
437 Prettified and hardened string/backslash quoting with ipsystem(),
430 ipalias() and ipmagic(). Now even \ characters are passed to
438 ipalias() and ipmagic(). Now even \ characters are passed to
431 %magics, !shell escapes and aliases exactly as they are in the
439 %magics, !shell escapes and aliases exactly as they are in the
432 ipython command line. Should improve backslash experience,
440 ipython command line. Should improve backslash experience,
433 particularly in Windows (path delimiter for some commands that
441 particularly in Windows (path delimiter for some commands that
434 won't understand '/'), but Unix benefits as well (regexps). %cd
442 won't understand '/'), but Unix benefits as well (regexps). %cd
435 magic still doesn't support backslash path delimiters, though. Also
443 magic still doesn't support backslash path delimiters, though. Also
436 deleted all pretense of supporting multiline command strings in
444 deleted all pretense of supporting multiline command strings in
437 !system or %magic commands. Thanks to Jerry McRae for suggestions.
445 !system or %magic commands. Thanks to Jerry McRae for suggestions.
438
446
439 * doc/build_doc_instructions.txt added. Documentation on how to
447 * doc/build_doc_instructions.txt added. Documentation on how to
440 use doc/update_manual.py, added yesterday. Both files contributed
448 use doc/update_manual.py, added yesterday. Both files contributed
441 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
449 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
442 doc/*.sh for deprecation at a later date.
450 doc/*.sh for deprecation at a later date.
443
451
444 * /ipython.py Added ipython.py to root directory for
452 * /ipython.py Added ipython.py to root directory for
445 zero-installation (tar xzvf ipython.tgz; cd ipython; python
453 zero-installation (tar xzvf ipython.tgz; cd ipython; python
446 ipython.py) and development convenience (no need to kee doing
454 ipython.py) and development convenience (no need to kee doing
447 "setup.py install" between changes).
455 "setup.py install" between changes).
448
456
449 * Made ! and !! shell escapes work (again) in multiline expressions:
457 * Made ! and !! shell escapes work (again) in multiline expressions:
450 if 1:
458 if 1:
451 !ls
459 !ls
452 !!ls
460 !!ls
453
461
454 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
462 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
455
463
456 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
464 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
457 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
465 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
458 module in case-insensitive installation. Was causing crashes
466 module in case-insensitive installation. Was causing crashes
459 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
467 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
460
468
461 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
469 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
462 <marienz-AT-gentoo.org>, closes
470 <marienz-AT-gentoo.org>, closes
463 http://www.scipy.net/roundup/ipython/issue51.
471 http://www.scipy.net/roundup/ipython/issue51.
464
472
465 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
473 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
466
474
467 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
475 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
468 problem of excessive CPU usage under *nix and keyboard lag under
476 problem of excessive CPU usage under *nix and keyboard lag under
469 win32.
477 win32.
470
478
471 2006-01-10 *** Released version 0.7.0
479 2006-01-10 *** Released version 0.7.0
472
480
473 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
481 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
474
482
475 * IPython/Release.py (revision): tag version number to 0.7.0,
483 * IPython/Release.py (revision): tag version number to 0.7.0,
476 ready for release.
484 ready for release.
477
485
478 * IPython/Magic.py (magic_edit): Add print statement to %edit so
486 * IPython/Magic.py (magic_edit): Add print statement to %edit so
479 it informs the user of the name of the temp. file used. This can
487 it informs the user of the name of the temp. file used. This can
480 help if you decide later to reuse that same file, so you know
488 help if you decide later to reuse that same file, so you know
481 where to copy the info from.
489 where to copy the info from.
482
490
483 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
491 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
484
492
485 * setup_bdist_egg.py: little script to build an egg. Added
493 * setup_bdist_egg.py: little script to build an egg. Added
486 support in the release tools as well.
494 support in the release tools as well.
487
495
488 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
496 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
489
497
490 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
498 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
491 version selection (new -wxversion command line and ipythonrc
499 version selection (new -wxversion command line and ipythonrc
492 parameter). Patch contributed by Arnd Baecker
500 parameter). Patch contributed by Arnd Baecker
493 <arnd.baecker-AT-web.de>.
501 <arnd.baecker-AT-web.de>.
494
502
495 * IPython/iplib.py (embed_mainloop): fix tab-completion in
503 * IPython/iplib.py (embed_mainloop): fix tab-completion in
496 embedded instances, for variables defined at the interactive
504 embedded instances, for variables defined at the interactive
497 prompt of the embedded ipython. Reported by Arnd.
505 prompt of the embedded ipython. Reported by Arnd.
498
506
499 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
507 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
500 it can be used as a (stateful) toggle, or with a direct parameter.
508 it can be used as a (stateful) toggle, or with a direct parameter.
501
509
502 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
510 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
503 could be triggered in certain cases and cause the traceback
511 could be triggered in certain cases and cause the traceback
504 printer not to work.
512 printer not to work.
505
513
506 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
514 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
507
515
508 * IPython/iplib.py (_should_recompile): Small fix, closes
516 * IPython/iplib.py (_should_recompile): Small fix, closes
509 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
517 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
510
518
511 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
519 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
512
520
513 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
521 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
514 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
522 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
515 Moad for help with tracking it down.
523 Moad for help with tracking it down.
516
524
517 * IPython/iplib.py (handle_auto): fix autocall handling for
525 * IPython/iplib.py (handle_auto): fix autocall handling for
518 objects which support BOTH __getitem__ and __call__ (so that f [x]
526 objects which support BOTH __getitem__ and __call__ (so that f [x]
519 is left alone, instead of becoming f([x]) automatically).
527 is left alone, instead of becoming f([x]) automatically).
520
528
521 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
529 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
522 Ville's patch.
530 Ville's patch.
523
531
524 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
532 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
525
533
526 * IPython/iplib.py (handle_auto): changed autocall semantics to
534 * IPython/iplib.py (handle_auto): changed autocall semantics to
527 include 'smart' mode, where the autocall transformation is NOT
535 include 'smart' mode, where the autocall transformation is NOT
528 applied if there are no arguments on the line. This allows you to
536 applied if there are no arguments on the line. This allows you to
529 just type 'foo' if foo is a callable to see its internal form,
537 just type 'foo' if foo is a callable to see its internal form,
530 instead of having it called with no arguments (typically a
538 instead of having it called with no arguments (typically a
531 mistake). The old 'full' autocall still exists: for that, you
539 mistake). The old 'full' autocall still exists: for that, you
532 need to set the 'autocall' parameter to 2 in your ipythonrc file.
540 need to set the 'autocall' parameter to 2 in your ipythonrc file.
533
541
534 * IPython/completer.py (Completer.attr_matches): add
542 * IPython/completer.py (Completer.attr_matches): add
535 tab-completion support for Enthoughts' traits. After a report by
543 tab-completion support for Enthoughts' traits. After a report by
536 Arnd and a patch by Prabhu.
544 Arnd and a patch by Prabhu.
537
545
538 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
546 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
539
547
540 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
548 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
541 Schmolck's patch to fix inspect.getinnerframes().
549 Schmolck's patch to fix inspect.getinnerframes().
542
550
543 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
551 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
544 for embedded instances, regarding handling of namespaces and items
552 for embedded instances, regarding handling of namespaces and items
545 added to the __builtin__ one. Multiple embedded instances and
553 added to the __builtin__ one. Multiple embedded instances and
546 recursive embeddings should work better now (though I'm not sure
554 recursive embeddings should work better now (though I'm not sure
547 I've got all the corner cases fixed, that code is a bit of a brain
555 I've got all the corner cases fixed, that code is a bit of a brain
548 twister).
556 twister).
549
557
550 * IPython/Magic.py (magic_edit): added support to edit in-memory
558 * IPython/Magic.py (magic_edit): added support to edit in-memory
551 macros (automatically creates the necessary temp files). %edit
559 macros (automatically creates the necessary temp files). %edit
552 also doesn't return the file contents anymore, it's just noise.
560 also doesn't return the file contents anymore, it's just noise.
553
561
554 * IPython/completer.py (Completer.attr_matches): revert change to
562 * IPython/completer.py (Completer.attr_matches): revert change to
555 complete only on attributes listed in __all__. I realized it
563 complete only on attributes listed in __all__. I realized it
556 cripples the tab-completion system as a tool for exploring the
564 cripples the tab-completion system as a tool for exploring the
557 internals of unknown libraries (it renders any non-__all__
565 internals of unknown libraries (it renders any non-__all__
558 attribute off-limits). I got bit by this when trying to see
566 attribute off-limits). I got bit by this when trying to see
559 something inside the dis module.
567 something inside the dis module.
560
568
561 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
569 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
562
570
563 * IPython/iplib.py (InteractiveShell.__init__): add .meta
571 * IPython/iplib.py (InteractiveShell.__init__): add .meta
564 namespace for users and extension writers to hold data in. This
572 namespace for users and extension writers to hold data in. This
565 follows the discussion in
573 follows the discussion in
566 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
574 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
567
575
568 * IPython/completer.py (IPCompleter.complete): small patch to help
576 * IPython/completer.py (IPCompleter.complete): small patch to help
569 tab-completion under Emacs, after a suggestion by John Barnard
577 tab-completion under Emacs, after a suggestion by John Barnard
570 <barnarj-AT-ccf.org>.
578 <barnarj-AT-ccf.org>.
571
579
572 * IPython/Magic.py (Magic.extract_input_slices): added support for
580 * IPython/Magic.py (Magic.extract_input_slices): added support for
573 the slice notation in magics to use N-M to represent numbers N...M
581 the slice notation in magics to use N-M to represent numbers N...M
574 (closed endpoints). This is used by %macro and %save.
582 (closed endpoints). This is used by %macro and %save.
575
583
576 * IPython/completer.py (Completer.attr_matches): for modules which
584 * IPython/completer.py (Completer.attr_matches): for modules which
577 define __all__, complete only on those. After a patch by Jeffrey
585 define __all__, complete only on those. After a patch by Jeffrey
578 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
586 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
579 speed up this routine.
587 speed up this routine.
580
588
581 * IPython/Logger.py (Logger.log): fix a history handling bug. I
589 * IPython/Logger.py (Logger.log): fix a history handling bug. I
582 don't know if this is the end of it, but the behavior now is
590 don't know if this is the end of it, but the behavior now is
583 certainly much more correct. Note that coupled with macros,
591 certainly much more correct. Note that coupled with macros,
584 slightly surprising (at first) behavior may occur: a macro will in
592 slightly surprising (at first) behavior may occur: a macro will in
585 general expand to multiple lines of input, so upon exiting, the
593 general expand to multiple lines of input, so upon exiting, the
586 in/out counters will both be bumped by the corresponding amount
594 in/out counters will both be bumped by the corresponding amount
587 (as if the macro's contents had been typed interactively). Typing
595 (as if the macro's contents had been typed interactively). Typing
588 %hist will reveal the intermediate (silently processed) lines.
596 %hist will reveal the intermediate (silently processed) lines.
589
597
590 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
598 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
591 pickle to fail (%run was overwriting __main__ and not restoring
599 pickle to fail (%run was overwriting __main__ and not restoring
592 it, but pickle relies on __main__ to operate).
600 it, but pickle relies on __main__ to operate).
593
601
594 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
602 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
595 using properties, but forgot to make the main InteractiveShell
603 using properties, but forgot to make the main InteractiveShell
596 class a new-style class. Properties fail silently, and
604 class a new-style class. Properties fail silently, and
597 misteriously, with old-style class (getters work, but
605 misteriously, with old-style class (getters work, but
598 setters don't do anything).
606 setters don't do anything).
599
607
600 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
608 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
601
609
602 * IPython/Magic.py (magic_history): fix history reporting bug (I
610 * IPython/Magic.py (magic_history): fix history reporting bug (I
603 know some nasties are still there, I just can't seem to find a
611 know some nasties are still there, I just can't seem to find a
604 reproducible test case to track them down; the input history is
612 reproducible test case to track them down; the input history is
605 falling out of sync...)
613 falling out of sync...)
606
614
607 * IPython/iplib.py (handle_shell_escape): fix bug where both
615 * IPython/iplib.py (handle_shell_escape): fix bug where both
608 aliases and system accesses where broken for indented code (such
616 aliases and system accesses where broken for indented code (such
609 as loops).
617 as loops).
610
618
611 * IPython/genutils.py (shell): fix small but critical bug for
619 * IPython/genutils.py (shell): fix small but critical bug for
612 win32 system access.
620 win32 system access.
613
621
614 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
622 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
615
623
616 * IPython/iplib.py (showtraceback): remove use of the
624 * IPython/iplib.py (showtraceback): remove use of the
617 sys.last_{type/value/traceback} structures, which are non
625 sys.last_{type/value/traceback} structures, which are non
618 thread-safe.
626 thread-safe.
619 (_prefilter): change control flow to ensure that we NEVER
627 (_prefilter): change control flow to ensure that we NEVER
620 introspect objects when autocall is off. This will guarantee that
628 introspect objects when autocall is off. This will guarantee that
621 having an input line of the form 'x.y', where access to attribute
629 having an input line of the form 'x.y', where access to attribute
622 'y' has side effects, doesn't trigger the side effect TWICE. It
630 'y' has side effects, doesn't trigger the side effect TWICE. It
623 is important to note that, with autocall on, these side effects
631 is important to note that, with autocall on, these side effects
624 can still happen.
632 can still happen.
625 (ipsystem): new builtin, to complete the ip{magic/alias/system}
633 (ipsystem): new builtin, to complete the ip{magic/alias/system}
626 trio. IPython offers these three kinds of special calls which are
634 trio. IPython offers these three kinds of special calls which are
627 not python code, and it's a good thing to have their call method
635 not python code, and it's a good thing to have their call method
628 be accessible as pure python functions (not just special syntax at
636 be accessible as pure python functions (not just special syntax at
629 the command line). It gives us a better internal implementation
637 the command line). It gives us a better internal implementation
630 structure, as well as exposing these for user scripting more
638 structure, as well as exposing these for user scripting more
631 cleanly.
639 cleanly.
632
640
633 * IPython/macro.py (Macro.__init__): moved macros to a standalone
641 * IPython/macro.py (Macro.__init__): moved macros to a standalone
634 file. Now that they'll be more likely to be used with the
642 file. Now that they'll be more likely to be used with the
635 persistance system (%store), I want to make sure their module path
643 persistance system (%store), I want to make sure their module path
636 doesn't change in the future, so that we don't break things for
644 doesn't change in the future, so that we don't break things for
637 users' persisted data.
645 users' persisted data.
638
646
639 * IPython/iplib.py (autoindent_update): move indentation
647 * IPython/iplib.py (autoindent_update): move indentation
640 management into the _text_ processing loop, not the keyboard
648 management into the _text_ processing loop, not the keyboard
641 interactive one. This is necessary to correctly process non-typed
649 interactive one. This is necessary to correctly process non-typed
642 multiline input (such as macros).
650 multiline input (such as macros).
643
651
644 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
652 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
645 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
653 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
646 which was producing problems in the resulting manual.
654 which was producing problems in the resulting manual.
647 (magic_whos): improve reporting of instances (show their class,
655 (magic_whos): improve reporting of instances (show their class,
648 instead of simply printing 'instance' which isn't terribly
656 instead of simply printing 'instance' which isn't terribly
649 informative).
657 informative).
650
658
651 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
659 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
652 (minor mods) to support network shares under win32.
660 (minor mods) to support network shares under win32.
653
661
654 * IPython/winconsole.py (get_console_size): add new winconsole
662 * IPython/winconsole.py (get_console_size): add new winconsole
655 module and fixes to page_dumb() to improve its behavior under
663 module and fixes to page_dumb() to improve its behavior under
656 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
664 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
657
665
658 * IPython/Magic.py (Macro): simplified Macro class to just
666 * IPython/Magic.py (Macro): simplified Macro class to just
659 subclass list. We've had only 2.2 compatibility for a very long
667 subclass list. We've had only 2.2 compatibility for a very long
660 time, yet I was still avoiding subclassing the builtin types. No
668 time, yet I was still avoiding subclassing the builtin types. No
661 more (I'm also starting to use properties, though I won't shift to
669 more (I'm also starting to use properties, though I won't shift to
662 2.3-specific features quite yet).
670 2.3-specific features quite yet).
663 (magic_store): added Ville's patch for lightweight variable
671 (magic_store): added Ville's patch for lightweight variable
664 persistence, after a request on the user list by Matt Wilkie
672 persistence, after a request on the user list by Matt Wilkie
665 <maphew-AT-gmail.com>. The new %store magic's docstring has full
673 <maphew-AT-gmail.com>. The new %store magic's docstring has full
666 details.
674 details.
667
675
668 * IPython/iplib.py (InteractiveShell.post_config_initialization):
676 * IPython/iplib.py (InteractiveShell.post_config_initialization):
669 changed the default logfile name from 'ipython.log' to
677 changed the default logfile name from 'ipython.log' to
670 'ipython_log.py'. These logs are real python files, and now that
678 'ipython_log.py'. These logs are real python files, and now that
671 we have much better multiline support, people are more likely to
679 we have much better multiline support, people are more likely to
672 want to use them as such. Might as well name them correctly.
680 want to use them as such. Might as well name them correctly.
673
681
674 * IPython/Magic.py: substantial cleanup. While we can't stop
682 * IPython/Magic.py: substantial cleanup. While we can't stop
675 using magics as mixins, due to the existing customizations 'out
683 using magics as mixins, due to the existing customizations 'out
676 there' which rely on the mixin naming conventions, at least I
684 there' which rely on the mixin naming conventions, at least I
677 cleaned out all cross-class name usage. So once we are OK with
685 cleaned out all cross-class name usage. So once we are OK with
678 breaking compatibility, the two systems can be separated.
686 breaking compatibility, the two systems can be separated.
679
687
680 * IPython/Logger.py: major cleanup. This one is NOT a mixin
688 * IPython/Logger.py: major cleanup. This one is NOT a mixin
681 anymore, and the class is a fair bit less hideous as well. New
689 anymore, and the class is a fair bit less hideous as well. New
682 features were also introduced: timestamping of input, and logging
690 features were also introduced: timestamping of input, and logging
683 of output results. These are user-visible with the -t and -o
691 of output results. These are user-visible with the -t and -o
684 options to %logstart. Closes
692 options to %logstart. Closes
685 http://www.scipy.net/roundup/ipython/issue11 and a request by
693 http://www.scipy.net/roundup/ipython/issue11 and a request by
686 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
694 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
687
695
688 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
696 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
689
697
690 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
698 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
691 better hadnle backslashes in paths. See the thread 'More Windows
699 better hadnle backslashes in paths. See the thread 'More Windows
692 questions part 2 - \/ characters revisited' on the iypthon user
700 questions part 2 - \/ characters revisited' on the iypthon user
693 list:
701 list:
694 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
702 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
695
703
696 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
704 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
697
705
698 (InteractiveShell.__init__): change threaded shells to not use the
706 (InteractiveShell.__init__): change threaded shells to not use the
699 ipython crash handler. This was causing more problems than not,
707 ipython crash handler. This was causing more problems than not,
700 as exceptions in the main thread (GUI code, typically) would
708 as exceptions in the main thread (GUI code, typically) would
701 always show up as a 'crash', when they really weren't.
709 always show up as a 'crash', when they really weren't.
702
710
703 The colors and exception mode commands (%colors/%xmode) have been
711 The colors and exception mode commands (%colors/%xmode) have been
704 synchronized to also take this into account, so users can get
712 synchronized to also take this into account, so users can get
705 verbose exceptions for their threaded code as well. I also added
713 verbose exceptions for their threaded code as well. I also added
706 support for activating pdb inside this exception handler as well,
714 support for activating pdb inside this exception handler as well,
707 so now GUI authors can use IPython's enhanced pdb at runtime.
715 so now GUI authors can use IPython's enhanced pdb at runtime.
708
716
709 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
717 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
710 true by default, and add it to the shipped ipythonrc file. Since
718 true by default, and add it to the shipped ipythonrc file. Since
711 this asks the user before proceeding, I think it's OK to make it
719 this asks the user before proceeding, I think it's OK to make it
712 true by default.
720 true by default.
713
721
714 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
722 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
715 of the previous special-casing of input in the eval loop. I think
723 of the previous special-casing of input in the eval loop. I think
716 this is cleaner, as they really are commands and shouldn't have
724 this is cleaner, as they really are commands and shouldn't have
717 a special role in the middle of the core code.
725 a special role in the middle of the core code.
718
726
719 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
727 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
720
728
721 * IPython/iplib.py (edit_syntax_error): added support for
729 * IPython/iplib.py (edit_syntax_error): added support for
722 automatically reopening the editor if the file had a syntax error
730 automatically reopening the editor if the file had a syntax error
723 in it. Thanks to scottt who provided the patch at:
731 in it. Thanks to scottt who provided the patch at:
724 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
732 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
725 version committed).
733 version committed).
726
734
727 * IPython/iplib.py (handle_normal): add suport for multi-line
735 * IPython/iplib.py (handle_normal): add suport for multi-line
728 input with emtpy lines. This fixes
736 input with emtpy lines. This fixes
729 http://www.scipy.net/roundup/ipython/issue43 and a similar
737 http://www.scipy.net/roundup/ipython/issue43 and a similar
730 discussion on the user list.
738 discussion on the user list.
731
739
732 WARNING: a behavior change is necessarily introduced to support
740 WARNING: a behavior change is necessarily introduced to support
733 blank lines: now a single blank line with whitespace does NOT
741 blank lines: now a single blank line with whitespace does NOT
734 break the input loop, which means that when autoindent is on, by
742 break the input loop, which means that when autoindent is on, by
735 default hitting return on the next (indented) line does NOT exit.
743 default hitting return on the next (indented) line does NOT exit.
736
744
737 Instead, to exit a multiline input you can either have:
745 Instead, to exit a multiline input you can either have:
738
746
739 - TWO whitespace lines (just hit return again), or
747 - TWO whitespace lines (just hit return again), or
740 - a single whitespace line of a different length than provided
748 - a single whitespace line of a different length than provided
741 by the autoindent (add or remove a space).
749 by the autoindent (add or remove a space).
742
750
743 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
751 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
744 module to better organize all readline-related functionality.
752 module to better organize all readline-related functionality.
745 I've deleted FlexCompleter and put all completion clases here.
753 I've deleted FlexCompleter and put all completion clases here.
746
754
747 * IPython/iplib.py (raw_input): improve indentation management.
755 * IPython/iplib.py (raw_input): improve indentation management.
748 It is now possible to paste indented code with autoindent on, and
756 It is now possible to paste indented code with autoindent on, and
749 the code is interpreted correctly (though it still looks bad on
757 the code is interpreted correctly (though it still looks bad on
750 screen, due to the line-oriented nature of ipython).
758 screen, due to the line-oriented nature of ipython).
751 (MagicCompleter.complete): change behavior so that a TAB key on an
759 (MagicCompleter.complete): change behavior so that a TAB key on an
752 otherwise empty line actually inserts a tab, instead of completing
760 otherwise empty line actually inserts a tab, instead of completing
753 on the entire global namespace. This makes it easier to use the
761 on the entire global namespace. This makes it easier to use the
754 TAB key for indentation. After a request by Hans Meine
762 TAB key for indentation. After a request by Hans Meine
755 <hans_meine-AT-gmx.net>
763 <hans_meine-AT-gmx.net>
756 (_prefilter): add support so that typing plain 'exit' or 'quit'
764 (_prefilter): add support so that typing plain 'exit' or 'quit'
757 does a sensible thing. Originally I tried to deviate as little as
765 does a sensible thing. Originally I tried to deviate as little as
758 possible from the default python behavior, but even that one may
766 possible from the default python behavior, but even that one may
759 change in this direction (thread on python-dev to that effect).
767 change in this direction (thread on python-dev to that effect).
760 Regardless, ipython should do the right thing even if CPython's
768 Regardless, ipython should do the right thing even if CPython's
761 '>>>' prompt doesn't.
769 '>>>' prompt doesn't.
762 (InteractiveShell): removed subclassing code.InteractiveConsole
770 (InteractiveShell): removed subclassing code.InteractiveConsole
763 class. By now we'd overridden just about all of its methods: I've
771 class. By now we'd overridden just about all of its methods: I've
764 copied the remaining two over, and now ipython is a standalone
772 copied the remaining two over, and now ipython is a standalone
765 class. This will provide a clearer picture for the chainsaw
773 class. This will provide a clearer picture for the chainsaw
766 branch refactoring.
774 branch refactoring.
767
775
768 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
776 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
769
777
770 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
778 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
771 failures for objects which break when dir() is called on them.
779 failures for objects which break when dir() is called on them.
772
780
773 * IPython/FlexCompleter.py (Completer.__init__): Added support for
781 * IPython/FlexCompleter.py (Completer.__init__): Added support for
774 distinct local and global namespaces in the completer API. This
782 distinct local and global namespaces in the completer API. This
775 change allows us top properly handle completion with distinct
783 change allows us top properly handle completion with distinct
776 scopes, including in embedded instances (this had never really
784 scopes, including in embedded instances (this had never really
777 worked correctly).
785 worked correctly).
778
786
779 Note: this introduces a change in the constructor for
787 Note: this introduces a change in the constructor for
780 MagicCompleter, as a new global_namespace parameter is now the
788 MagicCompleter, as a new global_namespace parameter is now the
781 second argument (the others were bumped one position).
789 second argument (the others were bumped one position).
782
790
783 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
791 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
784
792
785 * IPython/iplib.py (embed_mainloop): fix tab-completion in
793 * IPython/iplib.py (embed_mainloop): fix tab-completion in
786 embedded instances (which can be done now thanks to Vivian's
794 embedded instances (which can be done now thanks to Vivian's
787 frame-handling fixes for pdb).
795 frame-handling fixes for pdb).
788 (InteractiveShell.__init__): Fix namespace handling problem in
796 (InteractiveShell.__init__): Fix namespace handling problem in
789 embedded instances. We were overwriting __main__ unconditionally,
797 embedded instances. We were overwriting __main__ unconditionally,
790 and this should only be done for 'full' (non-embedded) IPython;
798 and this should only be done for 'full' (non-embedded) IPython;
791 embedded instances must respect the caller's __main__. Thanks to
799 embedded instances must respect the caller's __main__. Thanks to
792 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
800 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
793
801
794 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
802 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
795
803
796 * setup.py: added download_url to setup(). This registers the
804 * setup.py: added download_url to setup(). This registers the
797 download address at PyPI, which is not only useful to humans
805 download address at PyPI, which is not only useful to humans
798 browsing the site, but is also picked up by setuptools (the Eggs
806 browsing the site, but is also picked up by setuptools (the Eggs
799 machinery). Thanks to Ville and R. Kern for the info/discussion
807 machinery). Thanks to Ville and R. Kern for the info/discussion
800 on this.
808 on this.
801
809
802 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
810 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
803
811
804 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
812 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
805 This brings a lot of nice functionality to the pdb mode, which now
813 This brings a lot of nice functionality to the pdb mode, which now
806 has tab-completion, syntax highlighting, and better stack handling
814 has tab-completion, syntax highlighting, and better stack handling
807 than before. Many thanks to Vivian De Smedt
815 than before. Many thanks to Vivian De Smedt
808 <vivian-AT-vdesmedt.com> for the original patches.
816 <vivian-AT-vdesmedt.com> for the original patches.
809
817
810 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
818 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
811
819
812 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
820 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
813 sequence to consistently accept the banner argument. The
821 sequence to consistently accept the banner argument. The
814 inconsistency was tripping SAGE, thanks to Gary Zablackis
822 inconsistency was tripping SAGE, thanks to Gary Zablackis
815 <gzabl-AT-yahoo.com> for the report.
823 <gzabl-AT-yahoo.com> for the report.
816
824
817 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
825 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
818
826
819 * IPython/iplib.py (InteractiveShell.post_config_initialization):
827 * IPython/iplib.py (InteractiveShell.post_config_initialization):
820 Fix bug where a naked 'alias' call in the ipythonrc file would
828 Fix bug where a naked 'alias' call in the ipythonrc file would
821 cause a crash. Bug reported by Jorgen Stenarson.
829 cause a crash. Bug reported by Jorgen Stenarson.
822
830
823 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
831 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
824
832
825 * IPython/ipmaker.py (make_IPython): cleanups which should improve
833 * IPython/ipmaker.py (make_IPython): cleanups which should improve
826 startup time.
834 startup time.
827
835
828 * IPython/iplib.py (runcode): my globals 'fix' for embedded
836 * IPython/iplib.py (runcode): my globals 'fix' for embedded
829 instances had introduced a bug with globals in normal code. Now
837 instances had introduced a bug with globals in normal code. Now
830 it's working in all cases.
838 it's working in all cases.
831
839
832 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
840 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
833 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
841 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
834 has been introduced to set the default case sensitivity of the
842 has been introduced to set the default case sensitivity of the
835 searches. Users can still select either mode at runtime on a
843 searches. Users can still select either mode at runtime on a
836 per-search basis.
844 per-search basis.
837
845
838 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
846 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
839
847
840 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
848 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
841 attributes in wildcard searches for subclasses. Modified version
849 attributes in wildcard searches for subclasses. Modified version
842 of a patch by Jorgen.
850 of a patch by Jorgen.
843
851
844 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
852 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
845
853
846 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
854 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
847 embedded instances. I added a user_global_ns attribute to the
855 embedded instances. I added a user_global_ns attribute to the
848 InteractiveShell class to handle this.
856 InteractiveShell class to handle this.
849
857
850 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
858 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
851
859
852 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
860 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
853 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
861 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
854 (reported under win32, but may happen also in other platforms).
862 (reported under win32, but may happen also in other platforms).
855 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
863 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
856
864
857 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
865 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
858
866
859 * IPython/Magic.py (magic_psearch): new support for wildcard
867 * IPython/Magic.py (magic_psearch): new support for wildcard
860 patterns. Now, typing ?a*b will list all names which begin with a
868 patterns. Now, typing ?a*b will list all names which begin with a
861 and end in b, for example. The %psearch magic has full
869 and end in b, for example. The %psearch magic has full
862 docstrings. Many thanks to JΓΆrgen Stenarson
870 docstrings. Many thanks to JΓΆrgen Stenarson
863 <jorgen.stenarson-AT-bostream.nu>, author of the patches
871 <jorgen.stenarson-AT-bostream.nu>, author of the patches
864 implementing this functionality.
872 implementing this functionality.
865
873
866 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
874 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
867
875
868 * Manual: fixed long-standing annoyance of double-dashes (as in
876 * Manual: fixed long-standing annoyance of double-dashes (as in
869 --prefix=~, for example) being stripped in the HTML version. This
877 --prefix=~, for example) being stripped in the HTML version. This
870 is a latex2html bug, but a workaround was provided. Many thanks
878 is a latex2html bug, but a workaround was provided. Many thanks
871 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
879 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
872 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
880 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
873 rolling. This seemingly small issue had tripped a number of users
881 rolling. This seemingly small issue had tripped a number of users
874 when first installing, so I'm glad to see it gone.
882 when first installing, so I'm glad to see it gone.
875
883
876 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
884 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
877
885
878 * IPython/Extensions/numeric_formats.py: fix missing import,
886 * IPython/Extensions/numeric_formats.py: fix missing import,
879 reported by Stephen Walton.
887 reported by Stephen Walton.
880
888
881 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
889 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
882
890
883 * IPython/demo.py: finish demo module, fully documented now.
891 * IPython/demo.py: finish demo module, fully documented now.
884
892
885 * IPython/genutils.py (file_read): simple little utility to read a
893 * IPython/genutils.py (file_read): simple little utility to read a
886 file and ensure it's closed afterwards.
894 file and ensure it's closed afterwards.
887
895
888 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
896 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
889
897
890 * IPython/demo.py (Demo.__init__): added support for individually
898 * IPython/demo.py (Demo.__init__): added support for individually
891 tagging blocks for automatic execution.
899 tagging blocks for automatic execution.
892
900
893 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
901 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
894 syntax-highlighted python sources, requested by John.
902 syntax-highlighted python sources, requested by John.
895
903
896 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
904 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
897
905
898 * IPython/demo.py (Demo.again): fix bug where again() blocks after
906 * IPython/demo.py (Demo.again): fix bug where again() blocks after
899 finishing.
907 finishing.
900
908
901 * IPython/genutils.py (shlex_split): moved from Magic to here,
909 * IPython/genutils.py (shlex_split): moved from Magic to here,
902 where all 2.2 compatibility stuff lives. I needed it for demo.py.
910 where all 2.2 compatibility stuff lives. I needed it for demo.py.
903
911
904 * IPython/demo.py (Demo.__init__): added support for silent
912 * IPython/demo.py (Demo.__init__): added support for silent
905 blocks, improved marks as regexps, docstrings written.
913 blocks, improved marks as regexps, docstrings written.
906 (Demo.__init__): better docstring, added support for sys.argv.
914 (Demo.__init__): better docstring, added support for sys.argv.
907
915
908 * IPython/genutils.py (marquee): little utility used by the demo
916 * IPython/genutils.py (marquee): little utility used by the demo
909 code, handy in general.
917 code, handy in general.
910
918
911 * IPython/demo.py (Demo.__init__): new class for interactive
919 * IPython/demo.py (Demo.__init__): new class for interactive
912 demos. Not documented yet, I just wrote it in a hurry for
920 demos. Not documented yet, I just wrote it in a hurry for
913 scipy'05. Will docstring later.
921 scipy'05. Will docstring later.
914
922
915 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
923 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
916
924
917 * IPython/Shell.py (sigint_handler): Drastic simplification which
925 * IPython/Shell.py (sigint_handler): Drastic simplification which
918 also seems to make Ctrl-C work correctly across threads! This is
926 also seems to make Ctrl-C work correctly across threads! This is
919 so simple, that I can't beleive I'd missed it before. Needs more
927 so simple, that I can't beleive I'd missed it before. Needs more
920 testing, though.
928 testing, though.
921 (KBINT): Never mind, revert changes. I'm sure I'd tried something
929 (KBINT): Never mind, revert changes. I'm sure I'd tried something
922 like this before...
930 like this before...
923
931
924 * IPython/genutils.py (get_home_dir): add protection against
932 * IPython/genutils.py (get_home_dir): add protection against
925 non-dirs in win32 registry.
933 non-dirs in win32 registry.
926
934
927 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
935 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
928 bug where dict was mutated while iterating (pysh crash).
936 bug where dict was mutated while iterating (pysh crash).
929
937
930 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
938 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
931
939
932 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
940 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
933 spurious newlines added by this routine. After a report by
941 spurious newlines added by this routine. After a report by
934 F. Mantegazza.
942 F. Mantegazza.
935
943
936 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
944 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
937
945
938 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
946 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
939 calls. These were a leftover from the GTK 1.x days, and can cause
947 calls. These were a leftover from the GTK 1.x days, and can cause
940 problems in certain cases (after a report by John Hunter).
948 problems in certain cases (after a report by John Hunter).
941
949
942 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
950 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
943 os.getcwd() fails at init time. Thanks to patch from David Remahl
951 os.getcwd() fails at init time. Thanks to patch from David Remahl
944 <chmod007-AT-mac.com>.
952 <chmod007-AT-mac.com>.
945 (InteractiveShell.__init__): prevent certain special magics from
953 (InteractiveShell.__init__): prevent certain special magics from
946 being shadowed by aliases. Closes
954 being shadowed by aliases. Closes
947 http://www.scipy.net/roundup/ipython/issue41.
955 http://www.scipy.net/roundup/ipython/issue41.
948
956
949 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
957 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
950
958
951 * IPython/iplib.py (InteractiveShell.complete): Added new
959 * IPython/iplib.py (InteractiveShell.complete): Added new
952 top-level completion method to expose the completion mechanism
960 top-level completion method to expose the completion mechanism
953 beyond readline-based environments.
961 beyond readline-based environments.
954
962
955 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
963 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
956
964
957 * tools/ipsvnc (svnversion): fix svnversion capture.
965 * tools/ipsvnc (svnversion): fix svnversion capture.
958
966
959 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
967 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
960 attribute to self, which was missing. Before, it was set by a
968 attribute to self, which was missing. Before, it was set by a
961 routine which in certain cases wasn't being called, so the
969 routine which in certain cases wasn't being called, so the
962 instance could end up missing the attribute. This caused a crash.
970 instance could end up missing the attribute. This caused a crash.
963 Closes http://www.scipy.net/roundup/ipython/issue40.
971 Closes http://www.scipy.net/roundup/ipython/issue40.
964
972
965 2005-08-16 Fernando Perez <fperez@colorado.edu>
973 2005-08-16 Fernando Perez <fperez@colorado.edu>
966
974
967 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
975 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
968 contains non-string attribute. Closes
976 contains non-string attribute. Closes
969 http://www.scipy.net/roundup/ipython/issue38.
977 http://www.scipy.net/roundup/ipython/issue38.
970
978
971 2005-08-14 Fernando Perez <fperez@colorado.edu>
979 2005-08-14 Fernando Perez <fperez@colorado.edu>
972
980
973 * tools/ipsvnc: Minor improvements, to add changeset info.
981 * tools/ipsvnc: Minor improvements, to add changeset info.
974
982
975 2005-08-12 Fernando Perez <fperez@colorado.edu>
983 2005-08-12 Fernando Perez <fperez@colorado.edu>
976
984
977 * IPython/iplib.py (runsource): remove self.code_to_run_src
985 * IPython/iplib.py (runsource): remove self.code_to_run_src
978 attribute. I realized this is nothing more than
986 attribute. I realized this is nothing more than
979 '\n'.join(self.buffer), and having the same data in two different
987 '\n'.join(self.buffer), and having the same data in two different
980 places is just asking for synchronization bugs. This may impact
988 places is just asking for synchronization bugs. This may impact
981 people who have custom exception handlers, so I need to warn
989 people who have custom exception handlers, so I need to warn
982 ipython-dev about it (F. Mantegazza may use them).
990 ipython-dev about it (F. Mantegazza may use them).
983
991
984 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
992 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
985
993
986 * IPython/genutils.py: fix 2.2 compatibility (generators)
994 * IPython/genutils.py: fix 2.2 compatibility (generators)
987
995
988 2005-07-18 Fernando Perez <fperez@colorado.edu>
996 2005-07-18 Fernando Perez <fperez@colorado.edu>
989
997
990 * IPython/genutils.py (get_home_dir): fix to help users with
998 * IPython/genutils.py (get_home_dir): fix to help users with
991 invalid $HOME under win32.
999 invalid $HOME under win32.
992
1000
993 2005-07-17 Fernando Perez <fperez@colorado.edu>
1001 2005-07-17 Fernando Perez <fperez@colorado.edu>
994
1002
995 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1003 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
996 some old hacks and clean up a bit other routines; code should be
1004 some old hacks and clean up a bit other routines; code should be
997 simpler and a bit faster.
1005 simpler and a bit faster.
998
1006
999 * IPython/iplib.py (interact): removed some last-resort attempts
1007 * IPython/iplib.py (interact): removed some last-resort attempts
1000 to survive broken stdout/stderr. That code was only making it
1008 to survive broken stdout/stderr. That code was only making it
1001 harder to abstract out the i/o (necessary for gui integration),
1009 harder to abstract out the i/o (necessary for gui integration),
1002 and the crashes it could prevent were extremely rare in practice
1010 and the crashes it could prevent were extremely rare in practice
1003 (besides being fully user-induced in a pretty violent manner).
1011 (besides being fully user-induced in a pretty violent manner).
1004
1012
1005 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1013 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1006 Nothing major yet, but the code is simpler to read; this should
1014 Nothing major yet, but the code is simpler to read; this should
1007 make it easier to do more serious modifications in the future.
1015 make it easier to do more serious modifications in the future.
1008
1016
1009 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1017 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1010 which broke in .15 (thanks to a report by Ville).
1018 which broke in .15 (thanks to a report by Ville).
1011
1019
1012 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1020 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1013 be quite correct, I know next to nothing about unicode). This
1021 be quite correct, I know next to nothing about unicode). This
1014 will allow unicode strings to be used in prompts, amongst other
1022 will allow unicode strings to be used in prompts, amongst other
1015 cases. It also will prevent ipython from crashing when unicode
1023 cases. It also will prevent ipython from crashing when unicode
1016 shows up unexpectedly in many places. If ascii encoding fails, we
1024 shows up unexpectedly in many places. If ascii encoding fails, we
1017 assume utf_8. Currently the encoding is not a user-visible
1025 assume utf_8. Currently the encoding is not a user-visible
1018 setting, though it could be made so if there is demand for it.
1026 setting, though it could be made so if there is demand for it.
1019
1027
1020 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1028 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1021
1029
1022 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1030 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1023
1031
1024 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1032 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1025
1033
1026 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1034 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1027 code can work transparently for 2.2/2.3.
1035 code can work transparently for 2.2/2.3.
1028
1036
1029 2005-07-16 Fernando Perez <fperez@colorado.edu>
1037 2005-07-16 Fernando Perez <fperez@colorado.edu>
1030
1038
1031 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1039 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1032 out of the color scheme table used for coloring exception
1040 out of the color scheme table used for coloring exception
1033 tracebacks. This allows user code to add new schemes at runtime.
1041 tracebacks. This allows user code to add new schemes at runtime.
1034 This is a minimally modified version of the patch at
1042 This is a minimally modified version of the patch at
1035 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1043 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1036 for the contribution.
1044 for the contribution.
1037
1045
1038 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1046 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1039 slightly modified version of the patch in
1047 slightly modified version of the patch in
1040 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1048 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1041 to remove the previous try/except solution (which was costlier).
1049 to remove the previous try/except solution (which was costlier).
1042 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1050 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1043
1051
1044 2005-06-08 Fernando Perez <fperez@colorado.edu>
1052 2005-06-08 Fernando Perez <fperez@colorado.edu>
1045
1053
1046 * IPython/iplib.py (write/write_err): Add methods to abstract all
1054 * IPython/iplib.py (write/write_err): Add methods to abstract all
1047 I/O a bit more.
1055 I/O a bit more.
1048
1056
1049 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1057 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1050 warning, reported by Aric Hagberg, fix by JD Hunter.
1058 warning, reported by Aric Hagberg, fix by JD Hunter.
1051
1059
1052 2005-06-02 *** Released version 0.6.15
1060 2005-06-02 *** Released version 0.6.15
1053
1061
1054 2005-06-01 Fernando Perez <fperez@colorado.edu>
1062 2005-06-01 Fernando Perez <fperez@colorado.edu>
1055
1063
1056 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1064 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1057 tab-completion of filenames within open-quoted strings. Note that
1065 tab-completion of filenames within open-quoted strings. Note that
1058 this requires that in ~/.ipython/ipythonrc, users change the
1066 this requires that in ~/.ipython/ipythonrc, users change the
1059 readline delimiters configuration to read:
1067 readline delimiters configuration to read:
1060
1068
1061 readline_remove_delims -/~
1069 readline_remove_delims -/~
1062
1070
1063
1071
1064 2005-05-31 *** Released version 0.6.14
1072 2005-05-31 *** Released version 0.6.14
1065
1073
1066 2005-05-29 Fernando Perez <fperez@colorado.edu>
1074 2005-05-29 Fernando Perez <fperez@colorado.edu>
1067
1075
1068 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1076 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1069 with files not on the filesystem. Reported by Eliyahu Sandler
1077 with files not on the filesystem. Reported by Eliyahu Sandler
1070 <eli@gondolin.net>
1078 <eli@gondolin.net>
1071
1079
1072 2005-05-22 Fernando Perez <fperez@colorado.edu>
1080 2005-05-22 Fernando Perez <fperez@colorado.edu>
1073
1081
1074 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1082 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1075 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1083 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1076
1084
1077 2005-05-19 Fernando Perez <fperez@colorado.edu>
1085 2005-05-19 Fernando Perez <fperez@colorado.edu>
1078
1086
1079 * IPython/iplib.py (safe_execfile): close a file which could be
1087 * IPython/iplib.py (safe_execfile): close a file which could be
1080 left open (causing problems in win32, which locks open files).
1088 left open (causing problems in win32, which locks open files).
1081 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1089 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1082
1090
1083 2005-05-18 Fernando Perez <fperez@colorado.edu>
1091 2005-05-18 Fernando Perez <fperez@colorado.edu>
1084
1092
1085 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1093 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1086 keyword arguments correctly to safe_execfile().
1094 keyword arguments correctly to safe_execfile().
1087
1095
1088 2005-05-13 Fernando Perez <fperez@colorado.edu>
1096 2005-05-13 Fernando Perez <fperez@colorado.edu>
1089
1097
1090 * ipython.1: Added info about Qt to manpage, and threads warning
1098 * ipython.1: Added info about Qt to manpage, and threads warning
1091 to usage page (invoked with --help).
1099 to usage page (invoked with --help).
1092
1100
1093 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1101 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1094 new matcher (it goes at the end of the priority list) to do
1102 new matcher (it goes at the end of the priority list) to do
1095 tab-completion on named function arguments. Submitted by George
1103 tab-completion on named function arguments. Submitted by George
1096 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1104 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1097 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1105 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1098 for more details.
1106 for more details.
1099
1107
1100 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1108 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1101 SystemExit exceptions in the script being run. Thanks to a report
1109 SystemExit exceptions in the script being run. Thanks to a report
1102 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1110 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1103 producing very annoying behavior when running unit tests.
1111 producing very annoying behavior when running unit tests.
1104
1112
1105 2005-05-12 Fernando Perez <fperez@colorado.edu>
1113 2005-05-12 Fernando Perez <fperez@colorado.edu>
1106
1114
1107 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1115 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1108 which I'd broken (again) due to a changed regexp. In the process,
1116 which I'd broken (again) due to a changed regexp. In the process,
1109 added ';' as an escape to auto-quote the whole line without
1117 added ';' as an escape to auto-quote the whole line without
1110 splitting its arguments. Thanks to a report by Jerry McRae
1118 splitting its arguments. Thanks to a report by Jerry McRae
1111 <qrs0xyc02-AT-sneakemail.com>.
1119 <qrs0xyc02-AT-sneakemail.com>.
1112
1120
1113 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1121 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1114 possible crashes caused by a TokenError. Reported by Ed Schofield
1122 possible crashes caused by a TokenError. Reported by Ed Schofield
1115 <schofield-AT-ftw.at>.
1123 <schofield-AT-ftw.at>.
1116
1124
1117 2005-05-06 Fernando Perez <fperez@colorado.edu>
1125 2005-05-06 Fernando Perez <fperez@colorado.edu>
1118
1126
1119 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1127 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1120
1128
1121 2005-04-29 Fernando Perez <fperez@colorado.edu>
1129 2005-04-29 Fernando Perez <fperez@colorado.edu>
1122
1130
1123 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1131 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1124 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1132 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1125 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1133 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1126 which provides support for Qt interactive usage (similar to the
1134 which provides support for Qt interactive usage (similar to the
1127 existing one for WX and GTK). This had been often requested.
1135 existing one for WX and GTK). This had been often requested.
1128
1136
1129 2005-04-14 *** Released version 0.6.13
1137 2005-04-14 *** Released version 0.6.13
1130
1138
1131 2005-04-08 Fernando Perez <fperez@colorado.edu>
1139 2005-04-08 Fernando Perez <fperez@colorado.edu>
1132
1140
1133 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1141 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1134 from _ofind, which gets called on almost every input line. Now,
1142 from _ofind, which gets called on almost every input line. Now,
1135 we only try to get docstrings if they are actually going to be
1143 we only try to get docstrings if they are actually going to be
1136 used (the overhead of fetching unnecessary docstrings can be
1144 used (the overhead of fetching unnecessary docstrings can be
1137 noticeable for certain objects, such as Pyro proxies).
1145 noticeable for certain objects, such as Pyro proxies).
1138
1146
1139 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1147 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1140 for completers. For some reason I had been passing them the state
1148 for completers. For some reason I had been passing them the state
1141 variable, which completers never actually need, and was in
1149 variable, which completers never actually need, and was in
1142 conflict with the rlcompleter API. Custom completers ONLY need to
1150 conflict with the rlcompleter API. Custom completers ONLY need to
1143 take the text parameter.
1151 take the text parameter.
1144
1152
1145 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1153 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1146 work correctly in pysh. I've also moved all the logic which used
1154 work correctly in pysh. I've also moved all the logic which used
1147 to be in pysh.py here, which will prevent problems with future
1155 to be in pysh.py here, which will prevent problems with future
1148 upgrades. However, this time I must warn users to update their
1156 upgrades. However, this time I must warn users to update their
1149 pysh profile to include the line
1157 pysh profile to include the line
1150
1158
1151 import_all IPython.Extensions.InterpreterExec
1159 import_all IPython.Extensions.InterpreterExec
1152
1160
1153 because otherwise things won't work for them. They MUST also
1161 because otherwise things won't work for them. They MUST also
1154 delete pysh.py and the line
1162 delete pysh.py and the line
1155
1163
1156 execfile pysh.py
1164 execfile pysh.py
1157
1165
1158 from their ipythonrc-pysh.
1166 from their ipythonrc-pysh.
1159
1167
1160 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1168 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1161 robust in the face of objects whose dir() returns non-strings
1169 robust in the face of objects whose dir() returns non-strings
1162 (which it shouldn't, but some broken libs like ITK do). Thanks to
1170 (which it shouldn't, but some broken libs like ITK do). Thanks to
1163 a patch by John Hunter (implemented differently, though). Also
1171 a patch by John Hunter (implemented differently, though). Also
1164 minor improvements by using .extend instead of + on lists.
1172 minor improvements by using .extend instead of + on lists.
1165
1173
1166 * pysh.py:
1174 * pysh.py:
1167
1175
1168 2005-04-06 Fernando Perez <fperez@colorado.edu>
1176 2005-04-06 Fernando Perez <fperez@colorado.edu>
1169
1177
1170 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1178 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1171 by default, so that all users benefit from it. Those who don't
1179 by default, so that all users benefit from it. Those who don't
1172 want it can still turn it off.
1180 want it can still turn it off.
1173
1181
1174 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1182 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1175 config file, I'd forgotten about this, so users were getting it
1183 config file, I'd forgotten about this, so users were getting it
1176 off by default.
1184 off by default.
1177
1185
1178 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1186 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1179 consistency. Now magics can be called in multiline statements,
1187 consistency. Now magics can be called in multiline statements,
1180 and python variables can be expanded in magic calls via $var.
1188 and python variables can be expanded in magic calls via $var.
1181 This makes the magic system behave just like aliases or !system
1189 This makes the magic system behave just like aliases or !system
1182 calls.
1190 calls.
1183
1191
1184 2005-03-28 Fernando Perez <fperez@colorado.edu>
1192 2005-03-28 Fernando Perez <fperez@colorado.edu>
1185
1193
1186 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1194 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1187 expensive string additions for building command. Add support for
1195 expensive string additions for building command. Add support for
1188 trailing ';' when autocall is used.
1196 trailing ';' when autocall is used.
1189
1197
1190 2005-03-26 Fernando Perez <fperez@colorado.edu>
1198 2005-03-26 Fernando Perez <fperez@colorado.edu>
1191
1199
1192 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1200 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1193 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1201 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1194 ipython.el robust against prompts with any number of spaces
1202 ipython.el robust against prompts with any number of spaces
1195 (including 0) after the ':' character.
1203 (including 0) after the ':' character.
1196
1204
1197 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1205 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1198 continuation prompt, which misled users to think the line was
1206 continuation prompt, which misled users to think the line was
1199 already indented. Closes debian Bug#300847, reported to me by
1207 already indented. Closes debian Bug#300847, reported to me by
1200 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1208 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1201
1209
1202 2005-03-23 Fernando Perez <fperez@colorado.edu>
1210 2005-03-23 Fernando Perez <fperez@colorado.edu>
1203
1211
1204 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1212 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1205 properly aligned if they have embedded newlines.
1213 properly aligned if they have embedded newlines.
1206
1214
1207 * IPython/iplib.py (runlines): Add a public method to expose
1215 * IPython/iplib.py (runlines): Add a public method to expose
1208 IPython's code execution machinery, so that users can run strings
1216 IPython's code execution machinery, so that users can run strings
1209 as if they had been typed at the prompt interactively.
1217 as if they had been typed at the prompt interactively.
1210 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1218 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1211 methods which can call the system shell, but with python variable
1219 methods which can call the system shell, but with python variable
1212 expansion. The three such methods are: __IPYTHON__.system,
1220 expansion. The three such methods are: __IPYTHON__.system,
1213 .getoutput and .getoutputerror. These need to be documented in a
1221 .getoutput and .getoutputerror. These need to be documented in a
1214 'public API' section (to be written) of the manual.
1222 'public API' section (to be written) of the manual.
1215
1223
1216 2005-03-20 Fernando Perez <fperez@colorado.edu>
1224 2005-03-20 Fernando Perez <fperez@colorado.edu>
1217
1225
1218 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1226 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1219 for custom exception handling. This is quite powerful, and it
1227 for custom exception handling. This is quite powerful, and it
1220 allows for user-installable exception handlers which can trap
1228 allows for user-installable exception handlers which can trap
1221 custom exceptions at runtime and treat them separately from
1229 custom exceptions at runtime and treat them separately from
1222 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1230 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1223 Mantegazza <mantegazza-AT-ill.fr>.
1231 Mantegazza <mantegazza-AT-ill.fr>.
1224 (InteractiveShell.set_custom_completer): public API function to
1232 (InteractiveShell.set_custom_completer): public API function to
1225 add new completers at runtime.
1233 add new completers at runtime.
1226
1234
1227 2005-03-19 Fernando Perez <fperez@colorado.edu>
1235 2005-03-19 Fernando Perez <fperez@colorado.edu>
1228
1236
1229 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1237 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1230 allow objects which provide their docstrings via non-standard
1238 allow objects which provide their docstrings via non-standard
1231 mechanisms (like Pyro proxies) to still be inspected by ipython's
1239 mechanisms (like Pyro proxies) to still be inspected by ipython's
1232 ? system.
1240 ? system.
1233
1241
1234 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1242 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1235 automatic capture system. I tried quite hard to make it work
1243 automatic capture system. I tried quite hard to make it work
1236 reliably, and simply failed. I tried many combinations with the
1244 reliably, and simply failed. I tried many combinations with the
1237 subprocess module, but eventually nothing worked in all needed
1245 subprocess module, but eventually nothing worked in all needed
1238 cases (not blocking stdin for the child, duplicating stdout
1246 cases (not blocking stdin for the child, duplicating stdout
1239 without blocking, etc). The new %sc/%sx still do capture to these
1247 without blocking, etc). The new %sc/%sx still do capture to these
1240 magical list/string objects which make shell use much more
1248 magical list/string objects which make shell use much more
1241 conveninent, so not all is lost.
1249 conveninent, so not all is lost.
1242
1250
1243 XXX - FIX MANUAL for the change above!
1251 XXX - FIX MANUAL for the change above!
1244
1252
1245 (runsource): I copied code.py's runsource() into ipython to modify
1253 (runsource): I copied code.py's runsource() into ipython to modify
1246 it a bit. Now the code object and source to be executed are
1254 it a bit. Now the code object and source to be executed are
1247 stored in ipython. This makes this info accessible to third-party
1255 stored in ipython. This makes this info accessible to third-party
1248 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1256 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1249 Mantegazza <mantegazza-AT-ill.fr>.
1257 Mantegazza <mantegazza-AT-ill.fr>.
1250
1258
1251 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1259 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1252 history-search via readline (like C-p/C-n). I'd wanted this for a
1260 history-search via readline (like C-p/C-n). I'd wanted this for a
1253 long time, but only recently found out how to do it. For users
1261 long time, but only recently found out how to do it. For users
1254 who already have their ipythonrc files made and want this, just
1262 who already have their ipythonrc files made and want this, just
1255 add:
1263 add:
1256
1264
1257 readline_parse_and_bind "\e[A": history-search-backward
1265 readline_parse_and_bind "\e[A": history-search-backward
1258 readline_parse_and_bind "\e[B": history-search-forward
1266 readline_parse_and_bind "\e[B": history-search-forward
1259
1267
1260 2005-03-18 Fernando Perez <fperez@colorado.edu>
1268 2005-03-18 Fernando Perez <fperez@colorado.edu>
1261
1269
1262 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1270 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1263 LSString and SList classes which allow transparent conversions
1271 LSString and SList classes which allow transparent conversions
1264 between list mode and whitespace-separated string.
1272 between list mode and whitespace-separated string.
1265 (magic_r): Fix recursion problem in %r.
1273 (magic_r): Fix recursion problem in %r.
1266
1274
1267 * IPython/genutils.py (LSString): New class to be used for
1275 * IPython/genutils.py (LSString): New class to be used for
1268 automatic storage of the results of all alias/system calls in _o
1276 automatic storage of the results of all alias/system calls in _o
1269 and _e (stdout/err). These provide a .l/.list attribute which
1277 and _e (stdout/err). These provide a .l/.list attribute which
1270 does automatic splitting on newlines. This means that for most
1278 does automatic splitting on newlines. This means that for most
1271 uses, you'll never need to do capturing of output with %sc/%sx
1279 uses, you'll never need to do capturing of output with %sc/%sx
1272 anymore, since ipython keeps this always done for you. Note that
1280 anymore, since ipython keeps this always done for you. Note that
1273 only the LAST results are stored, the _o/e variables are
1281 only the LAST results are stored, the _o/e variables are
1274 overwritten on each call. If you need to save their contents
1282 overwritten on each call. If you need to save their contents
1275 further, simply bind them to any other name.
1283 further, simply bind them to any other name.
1276
1284
1277 2005-03-17 Fernando Perez <fperez@colorado.edu>
1285 2005-03-17 Fernando Perez <fperez@colorado.edu>
1278
1286
1279 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1287 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1280 prompt namespace handling.
1288 prompt namespace handling.
1281
1289
1282 2005-03-16 Fernando Perez <fperez@colorado.edu>
1290 2005-03-16 Fernando Perez <fperez@colorado.edu>
1283
1291
1284 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1292 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1285 classic prompts to be '>>> ' (final space was missing, and it
1293 classic prompts to be '>>> ' (final space was missing, and it
1286 trips the emacs python mode).
1294 trips the emacs python mode).
1287 (BasePrompt.__str__): Added safe support for dynamic prompt
1295 (BasePrompt.__str__): Added safe support for dynamic prompt
1288 strings. Now you can set your prompt string to be '$x', and the
1296 strings. Now you can set your prompt string to be '$x', and the
1289 value of x will be printed from your interactive namespace. The
1297 value of x will be printed from your interactive namespace. The
1290 interpolation syntax includes the full Itpl support, so
1298 interpolation syntax includes the full Itpl support, so
1291 ${foo()+x+bar()} is a valid prompt string now, and the function
1299 ${foo()+x+bar()} is a valid prompt string now, and the function
1292 calls will be made at runtime.
1300 calls will be made at runtime.
1293
1301
1294 2005-03-15 Fernando Perez <fperez@colorado.edu>
1302 2005-03-15 Fernando Perez <fperez@colorado.edu>
1295
1303
1296 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1304 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1297 avoid name clashes in pylab. %hist still works, it just forwards
1305 avoid name clashes in pylab. %hist still works, it just forwards
1298 the call to %history.
1306 the call to %history.
1299
1307
1300 2005-03-02 *** Released version 0.6.12
1308 2005-03-02 *** Released version 0.6.12
1301
1309
1302 2005-03-02 Fernando Perez <fperez@colorado.edu>
1310 2005-03-02 Fernando Perez <fperez@colorado.edu>
1303
1311
1304 * IPython/iplib.py (handle_magic): log magic calls properly as
1312 * IPython/iplib.py (handle_magic): log magic calls properly as
1305 ipmagic() function calls.
1313 ipmagic() function calls.
1306
1314
1307 * IPython/Magic.py (magic_time): Improved %time to support
1315 * IPython/Magic.py (magic_time): Improved %time to support
1308 statements and provide wall-clock as well as CPU time.
1316 statements and provide wall-clock as well as CPU time.
1309
1317
1310 2005-02-27 Fernando Perez <fperez@colorado.edu>
1318 2005-02-27 Fernando Perez <fperez@colorado.edu>
1311
1319
1312 * IPython/hooks.py: New hooks module, to expose user-modifiable
1320 * IPython/hooks.py: New hooks module, to expose user-modifiable
1313 IPython functionality in a clean manner. For now only the editor
1321 IPython functionality in a clean manner. For now only the editor
1314 hook is actually written, and other thigns which I intend to turn
1322 hook is actually written, and other thigns which I intend to turn
1315 into proper hooks aren't yet there. The display and prefilter
1323 into proper hooks aren't yet there. The display and prefilter
1316 stuff, for example, should be hooks. But at least now the
1324 stuff, for example, should be hooks. But at least now the
1317 framework is in place, and the rest can be moved here with more
1325 framework is in place, and the rest can be moved here with more
1318 time later. IPython had had a .hooks variable for a long time for
1326 time later. IPython had had a .hooks variable for a long time for
1319 this purpose, but I'd never actually used it for anything.
1327 this purpose, but I'd never actually used it for anything.
1320
1328
1321 2005-02-26 Fernando Perez <fperez@colorado.edu>
1329 2005-02-26 Fernando Perez <fperez@colorado.edu>
1322
1330
1323 * IPython/ipmaker.py (make_IPython): make the default ipython
1331 * IPython/ipmaker.py (make_IPython): make the default ipython
1324 directory be called _ipython under win32, to follow more the
1332 directory be called _ipython under win32, to follow more the
1325 naming peculiarities of that platform (where buggy software like
1333 naming peculiarities of that platform (where buggy software like
1326 Visual Sourcesafe breaks with .named directories). Reported by
1334 Visual Sourcesafe breaks with .named directories). Reported by
1327 Ville Vainio.
1335 Ville Vainio.
1328
1336
1329 2005-02-23 Fernando Perez <fperez@colorado.edu>
1337 2005-02-23 Fernando Perez <fperez@colorado.edu>
1330
1338
1331 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1339 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1332 auto_aliases for win32 which were causing problems. Users can
1340 auto_aliases for win32 which were causing problems. Users can
1333 define the ones they personally like.
1341 define the ones they personally like.
1334
1342
1335 2005-02-21 Fernando Perez <fperez@colorado.edu>
1343 2005-02-21 Fernando Perez <fperez@colorado.edu>
1336
1344
1337 * IPython/Magic.py (magic_time): new magic to time execution of
1345 * IPython/Magic.py (magic_time): new magic to time execution of
1338 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1346 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1339
1347
1340 2005-02-19 Fernando Perez <fperez@colorado.edu>
1348 2005-02-19 Fernando Perez <fperez@colorado.edu>
1341
1349
1342 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1350 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1343 into keys (for prompts, for example).
1351 into keys (for prompts, for example).
1344
1352
1345 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1353 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1346 prompts in case users want them. This introduces a small behavior
1354 prompts in case users want them. This introduces a small behavior
1347 change: ipython does not automatically add a space to all prompts
1355 change: ipython does not automatically add a space to all prompts
1348 anymore. To get the old prompts with a space, users should add it
1356 anymore. To get the old prompts with a space, users should add it
1349 manually to their ipythonrc file, so for example prompt_in1 should
1357 manually to their ipythonrc file, so for example prompt_in1 should
1350 now read 'In [\#]: ' instead of 'In [\#]:'.
1358 now read 'In [\#]: ' instead of 'In [\#]:'.
1351 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1359 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1352 file) to control left-padding of secondary prompts.
1360 file) to control left-padding of secondary prompts.
1353
1361
1354 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1362 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1355 the profiler can't be imported. Fix for Debian, which removed
1363 the profiler can't be imported. Fix for Debian, which removed
1356 profile.py because of License issues. I applied a slightly
1364 profile.py because of License issues. I applied a slightly
1357 modified version of the original Debian patch at
1365 modified version of the original Debian patch at
1358 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1366 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1359
1367
1360 2005-02-17 Fernando Perez <fperez@colorado.edu>
1368 2005-02-17 Fernando Perez <fperez@colorado.edu>
1361
1369
1362 * IPython/genutils.py (native_line_ends): Fix bug which would
1370 * IPython/genutils.py (native_line_ends): Fix bug which would
1363 cause improper line-ends under win32 b/c I was not opening files
1371 cause improper line-ends under win32 b/c I was not opening files
1364 in binary mode. Bug report and fix thanks to Ville.
1372 in binary mode. Bug report and fix thanks to Ville.
1365
1373
1366 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1374 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1367 trying to catch spurious foo[1] autocalls. My fix actually broke
1375 trying to catch spurious foo[1] autocalls. My fix actually broke
1368 ',/' autoquote/call with explicit escape (bad regexp).
1376 ',/' autoquote/call with explicit escape (bad regexp).
1369
1377
1370 2005-02-15 *** Released version 0.6.11
1378 2005-02-15 *** Released version 0.6.11
1371
1379
1372 2005-02-14 Fernando Perez <fperez@colorado.edu>
1380 2005-02-14 Fernando Perez <fperez@colorado.edu>
1373
1381
1374 * IPython/background_jobs.py: New background job management
1382 * IPython/background_jobs.py: New background job management
1375 subsystem. This is implemented via a new set of classes, and
1383 subsystem. This is implemented via a new set of classes, and
1376 IPython now provides a builtin 'jobs' object for background job
1384 IPython now provides a builtin 'jobs' object for background job
1377 execution. A convenience %bg magic serves as a lightweight
1385 execution. A convenience %bg magic serves as a lightweight
1378 frontend for starting the more common type of calls. This was
1386 frontend for starting the more common type of calls. This was
1379 inspired by discussions with B. Granger and the BackgroundCommand
1387 inspired by discussions with B. Granger and the BackgroundCommand
1380 class described in the book Python Scripting for Computational
1388 class described in the book Python Scripting for Computational
1381 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1389 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1382 (although ultimately no code from this text was used, as IPython's
1390 (although ultimately no code from this text was used, as IPython's
1383 system is a separate implementation).
1391 system is a separate implementation).
1384
1392
1385 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1393 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1386 to control the completion of single/double underscore names
1394 to control the completion of single/double underscore names
1387 separately. As documented in the example ipytonrc file, the
1395 separately. As documented in the example ipytonrc file, the
1388 readline_omit__names variable can now be set to 2, to omit even
1396 readline_omit__names variable can now be set to 2, to omit even
1389 single underscore names. Thanks to a patch by Brian Wong
1397 single underscore names. Thanks to a patch by Brian Wong
1390 <BrianWong-AT-AirgoNetworks.Com>.
1398 <BrianWong-AT-AirgoNetworks.Com>.
1391 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1399 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1392 be autocalled as foo([1]) if foo were callable. A problem for
1400 be autocalled as foo([1]) if foo were callable. A problem for
1393 things which are both callable and implement __getitem__.
1401 things which are both callable and implement __getitem__.
1394 (init_readline): Fix autoindentation for win32. Thanks to a patch
1402 (init_readline): Fix autoindentation for win32. Thanks to a patch
1395 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1403 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1396
1404
1397 2005-02-12 Fernando Perez <fperez@colorado.edu>
1405 2005-02-12 Fernando Perez <fperez@colorado.edu>
1398
1406
1399 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1407 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1400 which I had written long ago to sort out user error messages which
1408 which I had written long ago to sort out user error messages which
1401 may occur during startup. This seemed like a good idea initially,
1409 may occur during startup. This seemed like a good idea initially,
1402 but it has proven a disaster in retrospect. I don't want to
1410 but it has proven a disaster in retrospect. I don't want to
1403 change much code for now, so my fix is to set the internal 'debug'
1411 change much code for now, so my fix is to set the internal 'debug'
1404 flag to true everywhere, whose only job was precisely to control
1412 flag to true everywhere, whose only job was precisely to control
1405 this subsystem. This closes issue 28 (as well as avoiding all
1413 this subsystem. This closes issue 28 (as well as avoiding all
1406 sorts of strange hangups which occur from time to time).
1414 sorts of strange hangups which occur from time to time).
1407
1415
1408 2005-02-07 Fernando Perez <fperez@colorado.edu>
1416 2005-02-07 Fernando Perez <fperez@colorado.edu>
1409
1417
1410 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1418 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1411 previous call produced a syntax error.
1419 previous call produced a syntax error.
1412
1420
1413 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1421 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1414 classes without constructor.
1422 classes without constructor.
1415
1423
1416 2005-02-06 Fernando Perez <fperez@colorado.edu>
1424 2005-02-06 Fernando Perez <fperez@colorado.edu>
1417
1425
1418 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1426 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1419 completions with the results of each matcher, so we return results
1427 completions with the results of each matcher, so we return results
1420 to the user from all namespaces. This breaks with ipython
1428 to the user from all namespaces. This breaks with ipython
1421 tradition, but I think it's a nicer behavior. Now you get all
1429 tradition, but I think it's a nicer behavior. Now you get all
1422 possible completions listed, from all possible namespaces (python,
1430 possible completions listed, from all possible namespaces (python,
1423 filesystem, magics...) After a request by John Hunter
1431 filesystem, magics...) After a request by John Hunter
1424 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1432 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1425
1433
1426 2005-02-05 Fernando Perez <fperez@colorado.edu>
1434 2005-02-05 Fernando Perez <fperez@colorado.edu>
1427
1435
1428 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1436 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1429 the call had quote characters in it (the quotes were stripped).
1437 the call had quote characters in it (the quotes were stripped).
1430
1438
1431 2005-01-31 Fernando Perez <fperez@colorado.edu>
1439 2005-01-31 Fernando Perez <fperez@colorado.edu>
1432
1440
1433 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1441 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1434 Itpl.itpl() to make the code more robust against psyco
1442 Itpl.itpl() to make the code more robust against psyco
1435 optimizations.
1443 optimizations.
1436
1444
1437 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1445 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1438 of causing an exception. Quicker, cleaner.
1446 of causing an exception. Quicker, cleaner.
1439
1447
1440 2005-01-28 Fernando Perez <fperez@colorado.edu>
1448 2005-01-28 Fernando Perez <fperez@colorado.edu>
1441
1449
1442 * scripts/ipython_win_post_install.py (install): hardcode
1450 * scripts/ipython_win_post_install.py (install): hardcode
1443 sys.prefix+'python.exe' as the executable path. It turns out that
1451 sys.prefix+'python.exe' as the executable path. It turns out that
1444 during the post-installation run, sys.executable resolves to the
1452 during the post-installation run, sys.executable resolves to the
1445 name of the binary installer! I should report this as a distutils
1453 name of the binary installer! I should report this as a distutils
1446 bug, I think. I updated the .10 release with this tiny fix, to
1454 bug, I think. I updated the .10 release with this tiny fix, to
1447 avoid annoying the lists further.
1455 avoid annoying the lists further.
1448
1456
1449 2005-01-27 *** Released version 0.6.10
1457 2005-01-27 *** Released version 0.6.10
1450
1458
1451 2005-01-27 Fernando Perez <fperez@colorado.edu>
1459 2005-01-27 Fernando Perez <fperez@colorado.edu>
1452
1460
1453 * IPython/numutils.py (norm): Added 'inf' as optional name for
1461 * IPython/numutils.py (norm): Added 'inf' as optional name for
1454 L-infinity norm, included references to mathworld.com for vector
1462 L-infinity norm, included references to mathworld.com for vector
1455 norm definitions.
1463 norm definitions.
1456 (amin/amax): added amin/amax for array min/max. Similar to what
1464 (amin/amax): added amin/amax for array min/max. Similar to what
1457 pylab ships with after the recent reorganization of names.
1465 pylab ships with after the recent reorganization of names.
1458 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1466 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1459
1467
1460 * ipython.el: committed Alex's recent fixes and improvements.
1468 * ipython.el: committed Alex's recent fixes and improvements.
1461 Tested with python-mode from CVS, and it looks excellent. Since
1469 Tested with python-mode from CVS, and it looks excellent. Since
1462 python-mode hasn't released anything in a while, I'm temporarily
1470 python-mode hasn't released anything in a while, I'm temporarily
1463 putting a copy of today's CVS (v 4.70) of python-mode in:
1471 putting a copy of today's CVS (v 4.70) of python-mode in:
1464 http://ipython.scipy.org/tmp/python-mode.el
1472 http://ipython.scipy.org/tmp/python-mode.el
1465
1473
1466 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1474 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1467 sys.executable for the executable name, instead of assuming it's
1475 sys.executable for the executable name, instead of assuming it's
1468 called 'python.exe' (the post-installer would have produced broken
1476 called 'python.exe' (the post-installer would have produced broken
1469 setups on systems with a differently named python binary).
1477 setups on systems with a differently named python binary).
1470
1478
1471 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1479 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1472 references to os.linesep, to make the code more
1480 references to os.linesep, to make the code more
1473 platform-independent. This is also part of the win32 coloring
1481 platform-independent. This is also part of the win32 coloring
1474 fixes.
1482 fixes.
1475
1483
1476 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1484 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1477 lines, which actually cause coloring bugs because the length of
1485 lines, which actually cause coloring bugs because the length of
1478 the line is very difficult to correctly compute with embedded
1486 the line is very difficult to correctly compute with embedded
1479 escapes. This was the source of all the coloring problems under
1487 escapes. This was the source of all the coloring problems under
1480 Win32. I think that _finally_, Win32 users have a properly
1488 Win32. I think that _finally_, Win32 users have a properly
1481 working ipython in all respects. This would never have happened
1489 working ipython in all respects. This would never have happened
1482 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1490 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1483
1491
1484 2005-01-26 *** Released version 0.6.9
1492 2005-01-26 *** Released version 0.6.9
1485
1493
1486 2005-01-25 Fernando Perez <fperez@colorado.edu>
1494 2005-01-25 Fernando Perez <fperez@colorado.edu>
1487
1495
1488 * setup.py: finally, we have a true Windows installer, thanks to
1496 * setup.py: finally, we have a true Windows installer, thanks to
1489 the excellent work of Viktor Ransmayr
1497 the excellent work of Viktor Ransmayr
1490 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1498 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1491 Windows users. The setup routine is quite a bit cleaner thanks to
1499 Windows users. The setup routine is quite a bit cleaner thanks to
1492 this, and the post-install script uses the proper functions to
1500 this, and the post-install script uses the proper functions to
1493 allow a clean de-installation using the standard Windows Control
1501 allow a clean de-installation using the standard Windows Control
1494 Panel.
1502 Panel.
1495
1503
1496 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1504 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1497 environment variable under all OSes (including win32) if
1505 environment variable under all OSes (including win32) if
1498 available. This will give consistency to win32 users who have set
1506 available. This will give consistency to win32 users who have set
1499 this variable for any reason. If os.environ['HOME'] fails, the
1507 this variable for any reason. If os.environ['HOME'] fails, the
1500 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1508 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1501
1509
1502 2005-01-24 Fernando Perez <fperez@colorado.edu>
1510 2005-01-24 Fernando Perez <fperez@colorado.edu>
1503
1511
1504 * IPython/numutils.py (empty_like): add empty_like(), similar to
1512 * IPython/numutils.py (empty_like): add empty_like(), similar to
1505 zeros_like() but taking advantage of the new empty() Numeric routine.
1513 zeros_like() but taking advantage of the new empty() Numeric routine.
1506
1514
1507 2005-01-23 *** Released version 0.6.8
1515 2005-01-23 *** Released version 0.6.8
1508
1516
1509 2005-01-22 Fernando Perez <fperez@colorado.edu>
1517 2005-01-22 Fernando Perez <fperez@colorado.edu>
1510
1518
1511 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1519 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1512 automatic show() calls. After discussing things with JDH, it
1520 automatic show() calls. After discussing things with JDH, it
1513 turns out there are too many corner cases where this can go wrong.
1521 turns out there are too many corner cases where this can go wrong.
1514 It's best not to try to be 'too smart', and simply have ipython
1522 It's best not to try to be 'too smart', and simply have ipython
1515 reproduce as much as possible the default behavior of a normal
1523 reproduce as much as possible the default behavior of a normal
1516 python shell.
1524 python shell.
1517
1525
1518 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1526 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1519 line-splitting regexp and _prefilter() to avoid calling getattr()
1527 line-splitting regexp and _prefilter() to avoid calling getattr()
1520 on assignments. This closes
1528 on assignments. This closes
1521 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1529 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1522 readline uses getattr(), so a simple <TAB> keypress is still
1530 readline uses getattr(), so a simple <TAB> keypress is still
1523 enough to trigger getattr() calls on an object.
1531 enough to trigger getattr() calls on an object.
1524
1532
1525 2005-01-21 Fernando Perez <fperez@colorado.edu>
1533 2005-01-21 Fernando Perez <fperez@colorado.edu>
1526
1534
1527 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1535 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1528 docstring under pylab so it doesn't mask the original.
1536 docstring under pylab so it doesn't mask the original.
1529
1537
1530 2005-01-21 *** Released version 0.6.7
1538 2005-01-21 *** Released version 0.6.7
1531
1539
1532 2005-01-21 Fernando Perez <fperez@colorado.edu>
1540 2005-01-21 Fernando Perez <fperez@colorado.edu>
1533
1541
1534 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1542 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1535 signal handling for win32 users in multithreaded mode.
1543 signal handling for win32 users in multithreaded mode.
1536
1544
1537 2005-01-17 Fernando Perez <fperez@colorado.edu>
1545 2005-01-17 Fernando Perez <fperez@colorado.edu>
1538
1546
1539 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1547 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1540 instances with no __init__. After a crash report by Norbert Nemec
1548 instances with no __init__. After a crash report by Norbert Nemec
1541 <Norbert-AT-nemec-online.de>.
1549 <Norbert-AT-nemec-online.de>.
1542
1550
1543 2005-01-14 Fernando Perez <fperez@colorado.edu>
1551 2005-01-14 Fernando Perez <fperez@colorado.edu>
1544
1552
1545 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1553 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1546 names for verbose exceptions, when multiple dotted names and the
1554 names for verbose exceptions, when multiple dotted names and the
1547 'parent' object were present on the same line.
1555 'parent' object were present on the same line.
1548
1556
1549 2005-01-11 Fernando Perez <fperez@colorado.edu>
1557 2005-01-11 Fernando Perez <fperez@colorado.edu>
1550
1558
1551 * IPython/genutils.py (flag_calls): new utility to trap and flag
1559 * IPython/genutils.py (flag_calls): new utility to trap and flag
1552 calls in functions. I need it to clean up matplotlib support.
1560 calls in functions. I need it to clean up matplotlib support.
1553 Also removed some deprecated code in genutils.
1561 Also removed some deprecated code in genutils.
1554
1562
1555 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1563 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1556 that matplotlib scripts called with %run, which don't call show()
1564 that matplotlib scripts called with %run, which don't call show()
1557 themselves, still have their plotting windows open.
1565 themselves, still have their plotting windows open.
1558
1566
1559 2005-01-05 Fernando Perez <fperez@colorado.edu>
1567 2005-01-05 Fernando Perez <fperez@colorado.edu>
1560
1568
1561 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1569 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1562 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1570 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1563
1571
1564 2004-12-19 Fernando Perez <fperez@colorado.edu>
1572 2004-12-19 Fernando Perez <fperez@colorado.edu>
1565
1573
1566 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1574 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1567 parent_runcode, which was an eyesore. The same result can be
1575 parent_runcode, which was an eyesore. The same result can be
1568 obtained with Python's regular superclass mechanisms.
1576 obtained with Python's regular superclass mechanisms.
1569
1577
1570 2004-12-17 Fernando Perez <fperez@colorado.edu>
1578 2004-12-17 Fernando Perez <fperez@colorado.edu>
1571
1579
1572 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1580 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1573 reported by Prabhu.
1581 reported by Prabhu.
1574 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1582 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1575 sys.stderr) instead of explicitly calling sys.stderr. This helps
1583 sys.stderr) instead of explicitly calling sys.stderr. This helps
1576 maintain our I/O abstractions clean, for future GUI embeddings.
1584 maintain our I/O abstractions clean, for future GUI embeddings.
1577
1585
1578 * IPython/genutils.py (info): added new utility for sys.stderr
1586 * IPython/genutils.py (info): added new utility for sys.stderr
1579 unified info message handling (thin wrapper around warn()).
1587 unified info message handling (thin wrapper around warn()).
1580
1588
1581 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1589 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1582 composite (dotted) names on verbose exceptions.
1590 composite (dotted) names on verbose exceptions.
1583 (VerboseTB.nullrepr): harden against another kind of errors which
1591 (VerboseTB.nullrepr): harden against another kind of errors which
1584 Python's inspect module can trigger, and which were crashing
1592 Python's inspect module can trigger, and which were crashing
1585 IPython. Thanks to a report by Marco Lombardi
1593 IPython. Thanks to a report by Marco Lombardi
1586 <mlombard-AT-ma010192.hq.eso.org>.
1594 <mlombard-AT-ma010192.hq.eso.org>.
1587
1595
1588 2004-12-13 *** Released version 0.6.6
1596 2004-12-13 *** Released version 0.6.6
1589
1597
1590 2004-12-12 Fernando Perez <fperez@colorado.edu>
1598 2004-12-12 Fernando Perez <fperez@colorado.edu>
1591
1599
1592 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1600 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1593 generated by pygtk upon initialization if it was built without
1601 generated by pygtk upon initialization if it was built without
1594 threads (for matplotlib users). After a crash reported by
1602 threads (for matplotlib users). After a crash reported by
1595 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1603 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1596
1604
1597 * IPython/ipmaker.py (make_IPython): fix small bug in the
1605 * IPython/ipmaker.py (make_IPython): fix small bug in the
1598 import_some parameter for multiple imports.
1606 import_some parameter for multiple imports.
1599
1607
1600 * IPython/iplib.py (ipmagic): simplified the interface of
1608 * IPython/iplib.py (ipmagic): simplified the interface of
1601 ipmagic() to take a single string argument, just as it would be
1609 ipmagic() to take a single string argument, just as it would be
1602 typed at the IPython cmd line.
1610 typed at the IPython cmd line.
1603 (ipalias): Added new ipalias() with an interface identical to
1611 (ipalias): Added new ipalias() with an interface identical to
1604 ipmagic(). This completes exposing a pure python interface to the
1612 ipmagic(). This completes exposing a pure python interface to the
1605 alias and magic system, which can be used in loops or more complex
1613 alias and magic system, which can be used in loops or more complex
1606 code where IPython's automatic line mangling is not active.
1614 code where IPython's automatic line mangling is not active.
1607
1615
1608 * IPython/genutils.py (timing): changed interface of timing to
1616 * IPython/genutils.py (timing): changed interface of timing to
1609 simply run code once, which is the most common case. timings()
1617 simply run code once, which is the most common case. timings()
1610 remains unchanged, for the cases where you want multiple runs.
1618 remains unchanged, for the cases where you want multiple runs.
1611
1619
1612 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1620 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1613 bug where Python2.2 crashes with exec'ing code which does not end
1621 bug where Python2.2 crashes with exec'ing code which does not end
1614 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1622 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1615 before.
1623 before.
1616
1624
1617 2004-12-10 Fernando Perez <fperez@colorado.edu>
1625 2004-12-10 Fernando Perez <fperez@colorado.edu>
1618
1626
1619 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1627 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1620 -t to -T, to accomodate the new -t flag in %run (the %run and
1628 -t to -T, to accomodate the new -t flag in %run (the %run and
1621 %prun options are kind of intermixed, and it's not easy to change
1629 %prun options are kind of intermixed, and it's not easy to change
1622 this with the limitations of python's getopt).
1630 this with the limitations of python's getopt).
1623
1631
1624 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1632 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1625 the execution of scripts. It's not as fine-tuned as timeit.py,
1633 the execution of scripts. It's not as fine-tuned as timeit.py,
1626 but it works from inside ipython (and under 2.2, which lacks
1634 but it works from inside ipython (and under 2.2, which lacks
1627 timeit.py). Optionally a number of runs > 1 can be given for
1635 timeit.py). Optionally a number of runs > 1 can be given for
1628 timing very short-running code.
1636 timing very short-running code.
1629
1637
1630 * IPython/genutils.py (uniq_stable): new routine which returns a
1638 * IPython/genutils.py (uniq_stable): new routine which returns a
1631 list of unique elements in any iterable, but in stable order of
1639 list of unique elements in any iterable, but in stable order of
1632 appearance. I needed this for the ultraTB fixes, and it's a handy
1640 appearance. I needed this for the ultraTB fixes, and it's a handy
1633 utility.
1641 utility.
1634
1642
1635 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1643 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1636 dotted names in Verbose exceptions. This had been broken since
1644 dotted names in Verbose exceptions. This had been broken since
1637 the very start, now x.y will properly be printed in a Verbose
1645 the very start, now x.y will properly be printed in a Verbose
1638 traceback, instead of x being shown and y appearing always as an
1646 traceback, instead of x being shown and y appearing always as an
1639 'undefined global'. Getting this to work was a bit tricky,
1647 'undefined global'. Getting this to work was a bit tricky,
1640 because by default python tokenizers are stateless. Saved by
1648 because by default python tokenizers are stateless. Saved by
1641 python's ability to easily add a bit of state to an arbitrary
1649 python's ability to easily add a bit of state to an arbitrary
1642 function (without needing to build a full-blown callable object).
1650 function (without needing to build a full-blown callable object).
1643
1651
1644 Also big cleanup of this code, which had horrendous runtime
1652 Also big cleanup of this code, which had horrendous runtime
1645 lookups of zillions of attributes for colorization. Moved all
1653 lookups of zillions of attributes for colorization. Moved all
1646 this code into a few templates, which make it cleaner and quicker.
1654 this code into a few templates, which make it cleaner and quicker.
1647
1655
1648 Printout quality was also improved for Verbose exceptions: one
1656 Printout quality was also improved for Verbose exceptions: one
1649 variable per line, and memory addresses are printed (this can be
1657 variable per line, and memory addresses are printed (this can be
1650 quite handy in nasty debugging situations, which is what Verbose
1658 quite handy in nasty debugging situations, which is what Verbose
1651 is for).
1659 is for).
1652
1660
1653 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1661 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1654 the command line as scripts to be loaded by embedded instances.
1662 the command line as scripts to be loaded by embedded instances.
1655 Doing so has the potential for an infinite recursion if there are
1663 Doing so has the potential for an infinite recursion if there are
1656 exceptions thrown in the process. This fixes a strange crash
1664 exceptions thrown in the process. This fixes a strange crash
1657 reported by Philippe MULLER <muller-AT-irit.fr>.
1665 reported by Philippe MULLER <muller-AT-irit.fr>.
1658
1666
1659 2004-12-09 Fernando Perez <fperez@colorado.edu>
1667 2004-12-09 Fernando Perez <fperez@colorado.edu>
1660
1668
1661 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1669 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1662 to reflect new names in matplotlib, which now expose the
1670 to reflect new names in matplotlib, which now expose the
1663 matlab-compatible interface via a pylab module instead of the
1671 matlab-compatible interface via a pylab module instead of the
1664 'matlab' name. The new code is backwards compatible, so users of
1672 'matlab' name. The new code is backwards compatible, so users of
1665 all matplotlib versions are OK. Patch by J. Hunter.
1673 all matplotlib versions are OK. Patch by J. Hunter.
1666
1674
1667 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1675 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1668 of __init__ docstrings for instances (class docstrings are already
1676 of __init__ docstrings for instances (class docstrings are already
1669 automatically printed). Instances with customized docstrings
1677 automatically printed). Instances with customized docstrings
1670 (indep. of the class) are also recognized and all 3 separate
1678 (indep. of the class) are also recognized and all 3 separate
1671 docstrings are printed (instance, class, constructor). After some
1679 docstrings are printed (instance, class, constructor). After some
1672 comments/suggestions by J. Hunter.
1680 comments/suggestions by J. Hunter.
1673
1681
1674 2004-12-05 Fernando Perez <fperez@colorado.edu>
1682 2004-12-05 Fernando Perez <fperez@colorado.edu>
1675
1683
1676 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1684 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1677 warnings when tab-completion fails and triggers an exception.
1685 warnings when tab-completion fails and triggers an exception.
1678
1686
1679 2004-12-03 Fernando Perez <fperez@colorado.edu>
1687 2004-12-03 Fernando Perez <fperez@colorado.edu>
1680
1688
1681 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1689 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1682 be triggered when using 'run -p'. An incorrect option flag was
1690 be triggered when using 'run -p'. An incorrect option flag was
1683 being set ('d' instead of 'D').
1691 being set ('d' instead of 'D').
1684 (manpage): fix missing escaped \- sign.
1692 (manpage): fix missing escaped \- sign.
1685
1693
1686 2004-11-30 *** Released version 0.6.5
1694 2004-11-30 *** Released version 0.6.5
1687
1695
1688 2004-11-30 Fernando Perez <fperez@colorado.edu>
1696 2004-11-30 Fernando Perez <fperez@colorado.edu>
1689
1697
1690 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1698 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1691 setting with -d option.
1699 setting with -d option.
1692
1700
1693 * setup.py (docfiles): Fix problem where the doc glob I was using
1701 * setup.py (docfiles): Fix problem where the doc glob I was using
1694 was COMPLETELY BROKEN. It was giving the right files by pure
1702 was COMPLETELY BROKEN. It was giving the right files by pure
1695 accident, but failed once I tried to include ipython.el. Note:
1703 accident, but failed once I tried to include ipython.el. Note:
1696 glob() does NOT allow you to do exclusion on multiple endings!
1704 glob() does NOT allow you to do exclusion on multiple endings!
1697
1705
1698 2004-11-29 Fernando Perez <fperez@colorado.edu>
1706 2004-11-29 Fernando Perez <fperez@colorado.edu>
1699
1707
1700 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1708 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1701 the manpage as the source. Better formatting & consistency.
1709 the manpage as the source. Better formatting & consistency.
1702
1710
1703 * IPython/Magic.py (magic_run): Added new -d option, to run
1711 * IPython/Magic.py (magic_run): Added new -d option, to run
1704 scripts under the control of the python pdb debugger. Note that
1712 scripts under the control of the python pdb debugger. Note that
1705 this required changing the %prun option -d to -D, to avoid a clash
1713 this required changing the %prun option -d to -D, to avoid a clash
1706 (since %run must pass options to %prun, and getopt is too dumb to
1714 (since %run must pass options to %prun, and getopt is too dumb to
1707 handle options with string values with embedded spaces). Thanks
1715 handle options with string values with embedded spaces). Thanks
1708 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1716 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1709 (magic_who_ls): added type matching to %who and %whos, so that one
1717 (magic_who_ls): added type matching to %who and %whos, so that one
1710 can filter their output to only include variables of certain
1718 can filter their output to only include variables of certain
1711 types. Another suggestion by Matthew.
1719 types. Another suggestion by Matthew.
1712 (magic_whos): Added memory summaries in kb and Mb for arrays.
1720 (magic_whos): Added memory summaries in kb and Mb for arrays.
1713 (magic_who): Improve formatting (break lines every 9 vars).
1721 (magic_who): Improve formatting (break lines every 9 vars).
1714
1722
1715 2004-11-28 Fernando Perez <fperez@colorado.edu>
1723 2004-11-28 Fernando Perez <fperez@colorado.edu>
1716
1724
1717 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1725 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1718 cache when empty lines were present.
1726 cache when empty lines were present.
1719
1727
1720 2004-11-24 Fernando Perez <fperez@colorado.edu>
1728 2004-11-24 Fernando Perez <fperez@colorado.edu>
1721
1729
1722 * IPython/usage.py (__doc__): document the re-activated threading
1730 * IPython/usage.py (__doc__): document the re-activated threading
1723 options for WX and GTK.
1731 options for WX and GTK.
1724
1732
1725 2004-11-23 Fernando Perez <fperez@colorado.edu>
1733 2004-11-23 Fernando Perez <fperez@colorado.edu>
1726
1734
1727 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1735 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1728 the -wthread and -gthread options, along with a new -tk one to try
1736 the -wthread and -gthread options, along with a new -tk one to try
1729 and coordinate Tk threading with wx/gtk. The tk support is very
1737 and coordinate Tk threading with wx/gtk. The tk support is very
1730 platform dependent, since it seems to require Tcl and Tk to be
1738 platform dependent, since it seems to require Tcl and Tk to be
1731 built with threads (Fedora1/2 appears NOT to have it, but in
1739 built with threads (Fedora1/2 appears NOT to have it, but in
1732 Prabhu's Debian boxes it works OK). But even with some Tk
1740 Prabhu's Debian boxes it works OK). But even with some Tk
1733 limitations, this is a great improvement.
1741 limitations, this is a great improvement.
1734
1742
1735 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1743 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1736 info in user prompts. Patch by Prabhu.
1744 info in user prompts. Patch by Prabhu.
1737
1745
1738 2004-11-18 Fernando Perez <fperez@colorado.edu>
1746 2004-11-18 Fernando Perez <fperez@colorado.edu>
1739
1747
1740 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1748 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1741 EOFErrors and bail, to avoid infinite loops if a non-terminating
1749 EOFErrors and bail, to avoid infinite loops if a non-terminating
1742 file is fed into ipython. Patch submitted in issue 19 by user,
1750 file is fed into ipython. Patch submitted in issue 19 by user,
1743 many thanks.
1751 many thanks.
1744
1752
1745 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1753 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1746 autoquote/parens in continuation prompts, which can cause lots of
1754 autoquote/parens in continuation prompts, which can cause lots of
1747 problems. Closes roundup issue 20.
1755 problems. Closes roundup issue 20.
1748
1756
1749 2004-11-17 Fernando Perez <fperez@colorado.edu>
1757 2004-11-17 Fernando Perez <fperez@colorado.edu>
1750
1758
1751 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1759 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1752 reported as debian bug #280505. I'm not sure my local changelog
1760 reported as debian bug #280505. I'm not sure my local changelog
1753 entry has the proper debian format (Jack?).
1761 entry has the proper debian format (Jack?).
1754
1762
1755 2004-11-08 *** Released version 0.6.4
1763 2004-11-08 *** Released version 0.6.4
1756
1764
1757 2004-11-08 Fernando Perez <fperez@colorado.edu>
1765 2004-11-08 Fernando Perez <fperez@colorado.edu>
1758
1766
1759 * IPython/iplib.py (init_readline): Fix exit message for Windows
1767 * IPython/iplib.py (init_readline): Fix exit message for Windows
1760 when readline is active. Thanks to a report by Eric Jones
1768 when readline is active. Thanks to a report by Eric Jones
1761 <eric-AT-enthought.com>.
1769 <eric-AT-enthought.com>.
1762
1770
1763 2004-11-07 Fernando Perez <fperez@colorado.edu>
1771 2004-11-07 Fernando Perez <fperez@colorado.edu>
1764
1772
1765 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1773 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1766 sometimes seen by win2k/cygwin users.
1774 sometimes seen by win2k/cygwin users.
1767
1775
1768 2004-11-06 Fernando Perez <fperez@colorado.edu>
1776 2004-11-06 Fernando Perez <fperez@colorado.edu>
1769
1777
1770 * IPython/iplib.py (interact): Change the handling of %Exit from
1778 * IPython/iplib.py (interact): Change the handling of %Exit from
1771 trying to propagate a SystemExit to an internal ipython flag.
1779 trying to propagate a SystemExit to an internal ipython flag.
1772 This is less elegant than using Python's exception mechanism, but
1780 This is less elegant than using Python's exception mechanism, but
1773 I can't get that to work reliably with threads, so under -pylab
1781 I can't get that to work reliably with threads, so under -pylab
1774 %Exit was hanging IPython. Cross-thread exception handling is
1782 %Exit was hanging IPython. Cross-thread exception handling is
1775 really a bitch. Thaks to a bug report by Stephen Walton
1783 really a bitch. Thaks to a bug report by Stephen Walton
1776 <stephen.walton-AT-csun.edu>.
1784 <stephen.walton-AT-csun.edu>.
1777
1785
1778 2004-11-04 Fernando Perez <fperez@colorado.edu>
1786 2004-11-04 Fernando Perez <fperez@colorado.edu>
1779
1787
1780 * IPython/iplib.py (raw_input_original): store a pointer to the
1788 * IPython/iplib.py (raw_input_original): store a pointer to the
1781 true raw_input to harden against code which can modify it
1789 true raw_input to harden against code which can modify it
1782 (wx.py.PyShell does this and would otherwise crash ipython).
1790 (wx.py.PyShell does this and would otherwise crash ipython).
1783 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1791 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1784
1792
1785 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1793 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1786 Ctrl-C problem, which does not mess up the input line.
1794 Ctrl-C problem, which does not mess up the input line.
1787
1795
1788 2004-11-03 Fernando Perez <fperez@colorado.edu>
1796 2004-11-03 Fernando Perez <fperez@colorado.edu>
1789
1797
1790 * IPython/Release.py: Changed licensing to BSD, in all files.
1798 * IPython/Release.py: Changed licensing to BSD, in all files.
1791 (name): lowercase name for tarball/RPM release.
1799 (name): lowercase name for tarball/RPM release.
1792
1800
1793 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1801 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1794 use throughout ipython.
1802 use throughout ipython.
1795
1803
1796 * IPython/Magic.py (Magic._ofind): Switch to using the new
1804 * IPython/Magic.py (Magic._ofind): Switch to using the new
1797 OInspect.getdoc() function.
1805 OInspect.getdoc() function.
1798
1806
1799 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1807 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1800 of the line currently being canceled via Ctrl-C. It's extremely
1808 of the line currently being canceled via Ctrl-C. It's extremely
1801 ugly, but I don't know how to do it better (the problem is one of
1809 ugly, but I don't know how to do it better (the problem is one of
1802 handling cross-thread exceptions).
1810 handling cross-thread exceptions).
1803
1811
1804 2004-10-28 Fernando Perez <fperez@colorado.edu>
1812 2004-10-28 Fernando Perez <fperez@colorado.edu>
1805
1813
1806 * IPython/Shell.py (signal_handler): add signal handlers to trap
1814 * IPython/Shell.py (signal_handler): add signal handlers to trap
1807 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1815 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1808 report by Francesc Alted.
1816 report by Francesc Alted.
1809
1817
1810 2004-10-21 Fernando Perez <fperez@colorado.edu>
1818 2004-10-21 Fernando Perez <fperez@colorado.edu>
1811
1819
1812 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1820 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1813 to % for pysh syntax extensions.
1821 to % for pysh syntax extensions.
1814
1822
1815 2004-10-09 Fernando Perez <fperez@colorado.edu>
1823 2004-10-09 Fernando Perez <fperez@colorado.edu>
1816
1824
1817 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1825 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1818 arrays to print a more useful summary, without calling str(arr).
1826 arrays to print a more useful summary, without calling str(arr).
1819 This avoids the problem of extremely lengthy computations which
1827 This avoids the problem of extremely lengthy computations which
1820 occur if arr is large, and appear to the user as a system lockup
1828 occur if arr is large, and appear to the user as a system lockup
1821 with 100% cpu activity. After a suggestion by Kristian Sandberg
1829 with 100% cpu activity. After a suggestion by Kristian Sandberg
1822 <Kristian.Sandberg@colorado.edu>.
1830 <Kristian.Sandberg@colorado.edu>.
1823 (Magic.__init__): fix bug in global magic escapes not being
1831 (Magic.__init__): fix bug in global magic escapes not being
1824 correctly set.
1832 correctly set.
1825
1833
1826 2004-10-08 Fernando Perez <fperez@colorado.edu>
1834 2004-10-08 Fernando Perez <fperez@colorado.edu>
1827
1835
1828 * IPython/Magic.py (__license__): change to absolute imports of
1836 * IPython/Magic.py (__license__): change to absolute imports of
1829 ipython's own internal packages, to start adapting to the absolute
1837 ipython's own internal packages, to start adapting to the absolute
1830 import requirement of PEP-328.
1838 import requirement of PEP-328.
1831
1839
1832 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1840 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1833 files, and standardize author/license marks through the Release
1841 files, and standardize author/license marks through the Release
1834 module instead of having per/file stuff (except for files with
1842 module instead of having per/file stuff (except for files with
1835 particular licenses, like the MIT/PSF-licensed codes).
1843 particular licenses, like the MIT/PSF-licensed codes).
1836
1844
1837 * IPython/Debugger.py: remove dead code for python 2.1
1845 * IPython/Debugger.py: remove dead code for python 2.1
1838
1846
1839 2004-10-04 Fernando Perez <fperez@colorado.edu>
1847 2004-10-04 Fernando Perez <fperez@colorado.edu>
1840
1848
1841 * IPython/iplib.py (ipmagic): New function for accessing magics
1849 * IPython/iplib.py (ipmagic): New function for accessing magics
1842 via a normal python function call.
1850 via a normal python function call.
1843
1851
1844 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1852 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1845 from '@' to '%', to accomodate the new @decorator syntax of python
1853 from '@' to '%', to accomodate the new @decorator syntax of python
1846 2.4.
1854 2.4.
1847
1855
1848 2004-09-29 Fernando Perez <fperez@colorado.edu>
1856 2004-09-29 Fernando Perez <fperez@colorado.edu>
1849
1857
1850 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1858 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1851 matplotlib.use to prevent running scripts which try to switch
1859 matplotlib.use to prevent running scripts which try to switch
1852 interactive backends from within ipython. This will just crash
1860 interactive backends from within ipython. This will just crash
1853 the python interpreter, so we can't allow it (but a detailed error
1861 the python interpreter, so we can't allow it (but a detailed error
1854 is given to the user).
1862 is given to the user).
1855
1863
1856 2004-09-28 Fernando Perez <fperez@colorado.edu>
1864 2004-09-28 Fernando Perez <fperez@colorado.edu>
1857
1865
1858 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1866 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1859 matplotlib-related fixes so that using @run with non-matplotlib
1867 matplotlib-related fixes so that using @run with non-matplotlib
1860 scripts doesn't pop up spurious plot windows. This requires
1868 scripts doesn't pop up spurious plot windows. This requires
1861 matplotlib >= 0.63, where I had to make some changes as well.
1869 matplotlib >= 0.63, where I had to make some changes as well.
1862
1870
1863 * IPython/ipmaker.py (make_IPython): update version requirement to
1871 * IPython/ipmaker.py (make_IPython): update version requirement to
1864 python 2.2.
1872 python 2.2.
1865
1873
1866 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1874 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1867 banner arg for embedded customization.
1875 banner arg for embedded customization.
1868
1876
1869 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1877 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1870 explicit uses of __IP as the IPython's instance name. Now things
1878 explicit uses of __IP as the IPython's instance name. Now things
1871 are properly handled via the shell.name value. The actual code
1879 are properly handled via the shell.name value. The actual code
1872 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1880 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1873 is much better than before. I'll clean things completely when the
1881 is much better than before. I'll clean things completely when the
1874 magic stuff gets a real overhaul.
1882 magic stuff gets a real overhaul.
1875
1883
1876 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1884 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1877 minor changes to debian dir.
1885 minor changes to debian dir.
1878
1886
1879 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1887 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1880 pointer to the shell itself in the interactive namespace even when
1888 pointer to the shell itself in the interactive namespace even when
1881 a user-supplied dict is provided. This is needed for embedding
1889 a user-supplied dict is provided. This is needed for embedding
1882 purposes (found by tests with Michel Sanner).
1890 purposes (found by tests with Michel Sanner).
1883
1891
1884 2004-09-27 Fernando Perez <fperez@colorado.edu>
1892 2004-09-27 Fernando Perez <fperez@colorado.edu>
1885
1893
1886 * IPython/UserConfig/ipythonrc: remove []{} from
1894 * IPython/UserConfig/ipythonrc: remove []{} from
1887 readline_remove_delims, so that things like [modname.<TAB> do
1895 readline_remove_delims, so that things like [modname.<TAB> do
1888 proper completion. This disables [].TAB, but that's a less common
1896 proper completion. This disables [].TAB, but that's a less common
1889 case than module names in list comprehensions, for example.
1897 case than module names in list comprehensions, for example.
1890 Thanks to a report by Andrea Riciputi.
1898 Thanks to a report by Andrea Riciputi.
1891
1899
1892 2004-09-09 Fernando Perez <fperez@colorado.edu>
1900 2004-09-09 Fernando Perez <fperez@colorado.edu>
1893
1901
1894 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1902 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1895 blocking problems in win32 and osx. Fix by John.
1903 blocking problems in win32 and osx. Fix by John.
1896
1904
1897 2004-09-08 Fernando Perez <fperez@colorado.edu>
1905 2004-09-08 Fernando Perez <fperez@colorado.edu>
1898
1906
1899 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1907 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1900 for Win32 and OSX. Fix by John Hunter.
1908 for Win32 and OSX. Fix by John Hunter.
1901
1909
1902 2004-08-30 *** Released version 0.6.3
1910 2004-08-30 *** Released version 0.6.3
1903
1911
1904 2004-08-30 Fernando Perez <fperez@colorado.edu>
1912 2004-08-30 Fernando Perez <fperez@colorado.edu>
1905
1913
1906 * setup.py (isfile): Add manpages to list of dependent files to be
1914 * setup.py (isfile): Add manpages to list of dependent files to be
1907 updated.
1915 updated.
1908
1916
1909 2004-08-27 Fernando Perez <fperez@colorado.edu>
1917 2004-08-27 Fernando Perez <fperez@colorado.edu>
1910
1918
1911 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1919 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1912 for now. They don't really work with standalone WX/GTK code
1920 for now. They don't really work with standalone WX/GTK code
1913 (though matplotlib IS working fine with both of those backends).
1921 (though matplotlib IS working fine with both of those backends).
1914 This will neeed much more testing. I disabled most things with
1922 This will neeed much more testing. I disabled most things with
1915 comments, so turning it back on later should be pretty easy.
1923 comments, so turning it back on later should be pretty easy.
1916
1924
1917 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1925 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1918 autocalling of expressions like r'foo', by modifying the line
1926 autocalling of expressions like r'foo', by modifying the line
1919 split regexp. Closes
1927 split regexp. Closes
1920 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1928 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1921 Riley <ipythonbugs-AT-sabi.net>.
1929 Riley <ipythonbugs-AT-sabi.net>.
1922 (InteractiveShell.mainloop): honor --nobanner with banner
1930 (InteractiveShell.mainloop): honor --nobanner with banner
1923 extensions.
1931 extensions.
1924
1932
1925 * IPython/Shell.py: Significant refactoring of all classes, so
1933 * IPython/Shell.py: Significant refactoring of all classes, so
1926 that we can really support ALL matplotlib backends and threading
1934 that we can really support ALL matplotlib backends and threading
1927 models (John spotted a bug with Tk which required this). Now we
1935 models (John spotted a bug with Tk which required this). Now we
1928 should support single-threaded, WX-threads and GTK-threads, both
1936 should support single-threaded, WX-threads and GTK-threads, both
1929 for generic code and for matplotlib.
1937 for generic code and for matplotlib.
1930
1938
1931 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1939 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1932 -pylab, to simplify things for users. Will also remove the pylab
1940 -pylab, to simplify things for users. Will also remove the pylab
1933 profile, since now all of matplotlib configuration is directly
1941 profile, since now all of matplotlib configuration is directly
1934 handled here. This also reduces startup time.
1942 handled here. This also reduces startup time.
1935
1943
1936 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1944 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1937 shell wasn't being correctly called. Also in IPShellWX.
1945 shell wasn't being correctly called. Also in IPShellWX.
1938
1946
1939 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1947 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1940 fine-tune banner.
1948 fine-tune banner.
1941
1949
1942 * IPython/numutils.py (spike): Deprecate these spike functions,
1950 * IPython/numutils.py (spike): Deprecate these spike functions,
1943 delete (long deprecated) gnuplot_exec handler.
1951 delete (long deprecated) gnuplot_exec handler.
1944
1952
1945 2004-08-26 Fernando Perez <fperez@colorado.edu>
1953 2004-08-26 Fernando Perez <fperez@colorado.edu>
1946
1954
1947 * ipython.1: Update for threading options, plus some others which
1955 * ipython.1: Update for threading options, plus some others which
1948 were missing.
1956 were missing.
1949
1957
1950 * IPython/ipmaker.py (__call__): Added -wthread option for
1958 * IPython/ipmaker.py (__call__): Added -wthread option for
1951 wxpython thread handling. Make sure threading options are only
1959 wxpython thread handling. Make sure threading options are only
1952 valid at the command line.
1960 valid at the command line.
1953
1961
1954 * scripts/ipython: moved shell selection into a factory function
1962 * scripts/ipython: moved shell selection into a factory function
1955 in Shell.py, to keep the starter script to a minimum.
1963 in Shell.py, to keep the starter script to a minimum.
1956
1964
1957 2004-08-25 Fernando Perez <fperez@colorado.edu>
1965 2004-08-25 Fernando Perez <fperez@colorado.edu>
1958
1966
1959 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1967 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1960 John. Along with some recent changes he made to matplotlib, the
1968 John. Along with some recent changes he made to matplotlib, the
1961 next versions of both systems should work very well together.
1969 next versions of both systems should work very well together.
1962
1970
1963 2004-08-24 Fernando Perez <fperez@colorado.edu>
1971 2004-08-24 Fernando Perez <fperez@colorado.edu>
1964
1972
1965 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1973 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1966 tried to switch the profiling to using hotshot, but I'm getting
1974 tried to switch the profiling to using hotshot, but I'm getting
1967 strange errors from prof.runctx() there. I may be misreading the
1975 strange errors from prof.runctx() there. I may be misreading the
1968 docs, but it looks weird. For now the profiling code will
1976 docs, but it looks weird. For now the profiling code will
1969 continue to use the standard profiler.
1977 continue to use the standard profiler.
1970
1978
1971 2004-08-23 Fernando Perez <fperez@colorado.edu>
1979 2004-08-23 Fernando Perez <fperez@colorado.edu>
1972
1980
1973 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1981 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1974 threaded shell, by John Hunter. It's not quite ready yet, but
1982 threaded shell, by John Hunter. It's not quite ready yet, but
1975 close.
1983 close.
1976
1984
1977 2004-08-22 Fernando Perez <fperez@colorado.edu>
1985 2004-08-22 Fernando Perez <fperez@colorado.edu>
1978
1986
1979 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1987 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1980 in Magic and ultraTB.
1988 in Magic and ultraTB.
1981
1989
1982 * ipython.1: document threading options in manpage.
1990 * ipython.1: document threading options in manpage.
1983
1991
1984 * scripts/ipython: Changed name of -thread option to -gthread,
1992 * scripts/ipython: Changed name of -thread option to -gthread,
1985 since this is GTK specific. I want to leave the door open for a
1993 since this is GTK specific. I want to leave the door open for a
1986 -wthread option for WX, which will most likely be necessary. This
1994 -wthread option for WX, which will most likely be necessary. This
1987 change affects usage and ipmaker as well.
1995 change affects usage and ipmaker as well.
1988
1996
1989 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1997 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1990 handle the matplotlib shell issues. Code by John Hunter
1998 handle the matplotlib shell issues. Code by John Hunter
1991 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1999 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1992 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2000 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1993 broken (and disabled for end users) for now, but it puts the
2001 broken (and disabled for end users) for now, but it puts the
1994 infrastructure in place.
2002 infrastructure in place.
1995
2003
1996 2004-08-21 Fernando Perez <fperez@colorado.edu>
2004 2004-08-21 Fernando Perez <fperez@colorado.edu>
1997
2005
1998 * ipythonrc-pylab: Add matplotlib support.
2006 * ipythonrc-pylab: Add matplotlib support.
1999
2007
2000 * matplotlib_config.py: new files for matplotlib support, part of
2008 * matplotlib_config.py: new files for matplotlib support, part of
2001 the pylab profile.
2009 the pylab profile.
2002
2010
2003 * IPython/usage.py (__doc__): documented the threading options.
2011 * IPython/usage.py (__doc__): documented the threading options.
2004
2012
2005 2004-08-20 Fernando Perez <fperez@colorado.edu>
2013 2004-08-20 Fernando Perez <fperez@colorado.edu>
2006
2014
2007 * ipython: Modified the main calling routine to handle the -thread
2015 * ipython: Modified the main calling routine to handle the -thread
2008 and -mpthread options. This needs to be done as a top-level hack,
2016 and -mpthread options. This needs to be done as a top-level hack,
2009 because it determines which class to instantiate for IPython
2017 because it determines which class to instantiate for IPython
2010 itself.
2018 itself.
2011
2019
2012 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2020 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2013 classes to support multithreaded GTK operation without blocking,
2021 classes to support multithreaded GTK operation without blocking,
2014 and matplotlib with all backends. This is a lot of still very
2022 and matplotlib with all backends. This is a lot of still very
2015 experimental code, and threads are tricky. So it may still have a
2023 experimental code, and threads are tricky. So it may still have a
2016 few rough edges... This code owes a lot to
2024 few rough edges... This code owes a lot to
2017 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2025 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2018 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2026 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2019 to John Hunter for all the matplotlib work.
2027 to John Hunter for all the matplotlib work.
2020
2028
2021 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2029 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2022 options for gtk thread and matplotlib support.
2030 options for gtk thread and matplotlib support.
2023
2031
2024 2004-08-16 Fernando Perez <fperez@colorado.edu>
2032 2004-08-16 Fernando Perez <fperez@colorado.edu>
2025
2033
2026 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2034 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2027 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2035 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2028 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2036 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2029
2037
2030 2004-08-11 Fernando Perez <fperez@colorado.edu>
2038 2004-08-11 Fernando Perez <fperez@colorado.edu>
2031
2039
2032 * setup.py (isfile): Fix build so documentation gets updated for
2040 * setup.py (isfile): Fix build so documentation gets updated for
2033 rpms (it was only done for .tgz builds).
2041 rpms (it was only done for .tgz builds).
2034
2042
2035 2004-08-10 Fernando Perez <fperez@colorado.edu>
2043 2004-08-10 Fernando Perez <fperez@colorado.edu>
2036
2044
2037 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2045 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2038
2046
2039 * iplib.py : Silence syntax error exceptions in tab-completion.
2047 * iplib.py : Silence syntax error exceptions in tab-completion.
2040
2048
2041 2004-08-05 Fernando Perez <fperez@colorado.edu>
2049 2004-08-05 Fernando Perez <fperez@colorado.edu>
2042
2050
2043 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2051 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2044 'color off' mark for continuation prompts. This was causing long
2052 'color off' mark for continuation prompts. This was causing long
2045 continuation lines to mis-wrap.
2053 continuation lines to mis-wrap.
2046
2054
2047 2004-08-01 Fernando Perez <fperez@colorado.edu>
2055 2004-08-01 Fernando Perez <fperez@colorado.edu>
2048
2056
2049 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2057 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2050 for building ipython to be a parameter. All this is necessary
2058 for building ipython to be a parameter. All this is necessary
2051 right now to have a multithreaded version, but this insane
2059 right now to have a multithreaded version, but this insane
2052 non-design will be cleaned up soon. For now, it's a hack that
2060 non-design will be cleaned up soon. For now, it's a hack that
2053 works.
2061 works.
2054
2062
2055 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2063 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2056 args in various places. No bugs so far, but it's a dangerous
2064 args in various places. No bugs so far, but it's a dangerous
2057 practice.
2065 practice.
2058
2066
2059 2004-07-31 Fernando Perez <fperez@colorado.edu>
2067 2004-07-31 Fernando Perez <fperez@colorado.edu>
2060
2068
2061 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2069 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2062 fix completion of files with dots in their names under most
2070 fix completion of files with dots in their names under most
2063 profiles (pysh was OK because the completion order is different).
2071 profiles (pysh was OK because the completion order is different).
2064
2072
2065 2004-07-27 Fernando Perez <fperez@colorado.edu>
2073 2004-07-27 Fernando Perez <fperez@colorado.edu>
2066
2074
2067 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2075 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2068 keywords manually, b/c the one in keyword.py was removed in python
2076 keywords manually, b/c the one in keyword.py was removed in python
2069 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2077 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2070 This is NOT a bug under python 2.3 and earlier.
2078 This is NOT a bug under python 2.3 and earlier.
2071
2079
2072 2004-07-26 Fernando Perez <fperez@colorado.edu>
2080 2004-07-26 Fernando Perez <fperez@colorado.edu>
2073
2081
2074 * IPython/ultraTB.py (VerboseTB.text): Add another
2082 * IPython/ultraTB.py (VerboseTB.text): Add another
2075 linecache.checkcache() call to try to prevent inspect.py from
2083 linecache.checkcache() call to try to prevent inspect.py from
2076 crashing under python 2.3. I think this fixes
2084 crashing under python 2.3. I think this fixes
2077 http://www.scipy.net/roundup/ipython/issue17.
2085 http://www.scipy.net/roundup/ipython/issue17.
2078
2086
2079 2004-07-26 *** Released version 0.6.2
2087 2004-07-26 *** Released version 0.6.2
2080
2088
2081 2004-07-26 Fernando Perez <fperez@colorado.edu>
2089 2004-07-26 Fernando Perez <fperez@colorado.edu>
2082
2090
2083 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2091 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2084 fail for any number.
2092 fail for any number.
2085 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2093 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2086 empty bookmarks.
2094 empty bookmarks.
2087
2095
2088 2004-07-26 *** Released version 0.6.1
2096 2004-07-26 *** Released version 0.6.1
2089
2097
2090 2004-07-26 Fernando Perez <fperez@colorado.edu>
2098 2004-07-26 Fernando Perez <fperez@colorado.edu>
2091
2099
2092 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2100 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2093
2101
2094 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2102 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2095 escaping '()[]{}' in filenames.
2103 escaping '()[]{}' in filenames.
2096
2104
2097 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2105 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2098 Python 2.2 users who lack a proper shlex.split.
2106 Python 2.2 users who lack a proper shlex.split.
2099
2107
2100 2004-07-19 Fernando Perez <fperez@colorado.edu>
2108 2004-07-19 Fernando Perez <fperez@colorado.edu>
2101
2109
2102 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2110 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2103 for reading readline's init file. I follow the normal chain:
2111 for reading readline's init file. I follow the normal chain:
2104 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2112 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2105 report by Mike Heeter. This closes
2113 report by Mike Heeter. This closes
2106 http://www.scipy.net/roundup/ipython/issue16.
2114 http://www.scipy.net/roundup/ipython/issue16.
2107
2115
2108 2004-07-18 Fernando Perez <fperez@colorado.edu>
2116 2004-07-18 Fernando Perez <fperez@colorado.edu>
2109
2117
2110 * IPython/iplib.py (__init__): Add better handling of '\' under
2118 * IPython/iplib.py (__init__): Add better handling of '\' under
2111 Win32 for filenames. After a patch by Ville.
2119 Win32 for filenames. After a patch by Ville.
2112
2120
2113 2004-07-17 Fernando Perez <fperez@colorado.edu>
2121 2004-07-17 Fernando Perez <fperez@colorado.edu>
2114
2122
2115 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2123 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2116 autocalling would be triggered for 'foo is bar' if foo is
2124 autocalling would be triggered for 'foo is bar' if foo is
2117 callable. I also cleaned up the autocall detection code to use a
2125 callable. I also cleaned up the autocall detection code to use a
2118 regexp, which is faster. Bug reported by Alexander Schmolck.
2126 regexp, which is faster. Bug reported by Alexander Schmolck.
2119
2127
2120 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2128 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2121 '?' in them would confuse the help system. Reported by Alex
2129 '?' in them would confuse the help system. Reported by Alex
2122 Schmolck.
2130 Schmolck.
2123
2131
2124 2004-07-16 Fernando Perez <fperez@colorado.edu>
2132 2004-07-16 Fernando Perez <fperez@colorado.edu>
2125
2133
2126 * IPython/GnuplotInteractive.py (__all__): added plot2.
2134 * IPython/GnuplotInteractive.py (__all__): added plot2.
2127
2135
2128 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2136 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2129 plotting dictionaries, lists or tuples of 1d arrays.
2137 plotting dictionaries, lists or tuples of 1d arrays.
2130
2138
2131 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2139 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2132 optimizations.
2140 optimizations.
2133
2141
2134 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2142 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2135 the information which was there from Janko's original IPP code:
2143 the information which was there from Janko's original IPP code:
2136
2144
2137 03.05.99 20:53 porto.ifm.uni-kiel.de
2145 03.05.99 20:53 porto.ifm.uni-kiel.de
2138 --Started changelog.
2146 --Started changelog.
2139 --make clear do what it say it does
2147 --make clear do what it say it does
2140 --added pretty output of lines from inputcache
2148 --added pretty output of lines from inputcache
2141 --Made Logger a mixin class, simplifies handling of switches
2149 --Made Logger a mixin class, simplifies handling of switches
2142 --Added own completer class. .string<TAB> expands to last history
2150 --Added own completer class. .string<TAB> expands to last history
2143 line which starts with string. The new expansion is also present
2151 line which starts with string. The new expansion is also present
2144 with Ctrl-r from the readline library. But this shows, who this
2152 with Ctrl-r from the readline library. But this shows, who this
2145 can be done for other cases.
2153 can be done for other cases.
2146 --Added convention that all shell functions should accept a
2154 --Added convention that all shell functions should accept a
2147 parameter_string This opens the door for different behaviour for
2155 parameter_string This opens the door for different behaviour for
2148 each function. @cd is a good example of this.
2156 each function. @cd is a good example of this.
2149
2157
2150 04.05.99 12:12 porto.ifm.uni-kiel.de
2158 04.05.99 12:12 porto.ifm.uni-kiel.de
2151 --added logfile rotation
2159 --added logfile rotation
2152 --added new mainloop method which freezes first the namespace
2160 --added new mainloop method which freezes first the namespace
2153
2161
2154 07.05.99 21:24 porto.ifm.uni-kiel.de
2162 07.05.99 21:24 porto.ifm.uni-kiel.de
2155 --added the docreader classes. Now there is a help system.
2163 --added the docreader classes. Now there is a help system.
2156 -This is only a first try. Currently it's not easy to put new
2164 -This is only a first try. Currently it's not easy to put new
2157 stuff in the indices. But this is the way to go. Info would be
2165 stuff in the indices. But this is the way to go. Info would be
2158 better, but HTML is every where and not everybody has an info
2166 better, but HTML is every where and not everybody has an info
2159 system installed and it's not so easy to change html-docs to info.
2167 system installed and it's not so easy to change html-docs to info.
2160 --added global logfile option
2168 --added global logfile option
2161 --there is now a hook for object inspection method pinfo needs to
2169 --there is now a hook for object inspection method pinfo needs to
2162 be provided for this. Can be reached by two '??'.
2170 be provided for this. Can be reached by two '??'.
2163
2171
2164 08.05.99 20:51 porto.ifm.uni-kiel.de
2172 08.05.99 20:51 porto.ifm.uni-kiel.de
2165 --added a README
2173 --added a README
2166 --bug in rc file. Something has changed so functions in the rc
2174 --bug in rc file. Something has changed so functions in the rc
2167 file need to reference the shell and not self. Not clear if it's a
2175 file need to reference the shell and not self. Not clear if it's a
2168 bug or feature.
2176 bug or feature.
2169 --changed rc file for new behavior
2177 --changed rc file for new behavior
2170
2178
2171 2004-07-15 Fernando Perez <fperez@colorado.edu>
2179 2004-07-15 Fernando Perez <fperez@colorado.edu>
2172
2180
2173 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2181 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2174 cache was falling out of sync in bizarre manners when multi-line
2182 cache was falling out of sync in bizarre manners when multi-line
2175 input was present. Minor optimizations and cleanup.
2183 input was present. Minor optimizations and cleanup.
2176
2184
2177 (Logger): Remove old Changelog info for cleanup. This is the
2185 (Logger): Remove old Changelog info for cleanup. This is the
2178 information which was there from Janko's original code:
2186 information which was there from Janko's original code:
2179
2187
2180 Changes to Logger: - made the default log filename a parameter
2188 Changes to Logger: - made the default log filename a parameter
2181
2189
2182 - put a check for lines beginning with !@? in log(). Needed
2190 - put a check for lines beginning with !@? in log(). Needed
2183 (even if the handlers properly log their lines) for mid-session
2191 (even if the handlers properly log their lines) for mid-session
2184 logging activation to work properly. Without this, lines logged
2192 logging activation to work properly. Without this, lines logged
2185 in mid session, which get read from the cache, would end up
2193 in mid session, which get read from the cache, would end up
2186 'bare' (with !@? in the open) in the log. Now they are caught
2194 'bare' (with !@? in the open) in the log. Now they are caught
2187 and prepended with a #.
2195 and prepended with a #.
2188
2196
2189 * IPython/iplib.py (InteractiveShell.init_readline): added check
2197 * IPython/iplib.py (InteractiveShell.init_readline): added check
2190 in case MagicCompleter fails to be defined, so we don't crash.
2198 in case MagicCompleter fails to be defined, so we don't crash.
2191
2199
2192 2004-07-13 Fernando Perez <fperez@colorado.edu>
2200 2004-07-13 Fernando Perez <fperez@colorado.edu>
2193
2201
2194 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2202 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2195 of EPS if the requested filename ends in '.eps'.
2203 of EPS if the requested filename ends in '.eps'.
2196
2204
2197 2004-07-04 Fernando Perez <fperez@colorado.edu>
2205 2004-07-04 Fernando Perez <fperez@colorado.edu>
2198
2206
2199 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2207 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2200 escaping of quotes when calling the shell.
2208 escaping of quotes when calling the shell.
2201
2209
2202 2004-07-02 Fernando Perez <fperez@colorado.edu>
2210 2004-07-02 Fernando Perez <fperez@colorado.edu>
2203
2211
2204 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2212 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2205 gettext not working because we were clobbering '_'. Fixes
2213 gettext not working because we were clobbering '_'. Fixes
2206 http://www.scipy.net/roundup/ipython/issue6.
2214 http://www.scipy.net/roundup/ipython/issue6.
2207
2215
2208 2004-07-01 Fernando Perez <fperez@colorado.edu>
2216 2004-07-01 Fernando Perez <fperez@colorado.edu>
2209
2217
2210 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2218 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2211 into @cd. Patch by Ville.
2219 into @cd. Patch by Ville.
2212
2220
2213 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2221 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2214 new function to store things after ipmaker runs. Patch by Ville.
2222 new function to store things after ipmaker runs. Patch by Ville.
2215 Eventually this will go away once ipmaker is removed and the class
2223 Eventually this will go away once ipmaker is removed and the class
2216 gets cleaned up, but for now it's ok. Key functionality here is
2224 gets cleaned up, but for now it's ok. Key functionality here is
2217 the addition of the persistent storage mechanism, a dict for
2225 the addition of the persistent storage mechanism, a dict for
2218 keeping data across sessions (for now just bookmarks, but more can
2226 keeping data across sessions (for now just bookmarks, but more can
2219 be implemented later).
2227 be implemented later).
2220
2228
2221 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2229 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2222 persistent across sections. Patch by Ville, I modified it
2230 persistent across sections. Patch by Ville, I modified it
2223 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2231 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2224 added a '-l' option to list all bookmarks.
2232 added a '-l' option to list all bookmarks.
2225
2233
2226 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2234 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2227 center for cleanup. Registered with atexit.register(). I moved
2235 center for cleanup. Registered with atexit.register(). I moved
2228 here the old exit_cleanup(). After a patch by Ville.
2236 here the old exit_cleanup(). After a patch by Ville.
2229
2237
2230 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2238 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2231 characters in the hacked shlex_split for python 2.2.
2239 characters in the hacked shlex_split for python 2.2.
2232
2240
2233 * IPython/iplib.py (file_matches): more fixes to filenames with
2241 * IPython/iplib.py (file_matches): more fixes to filenames with
2234 whitespace in them. It's not perfect, but limitations in python's
2242 whitespace in them. It's not perfect, but limitations in python's
2235 readline make it impossible to go further.
2243 readline make it impossible to go further.
2236
2244
2237 2004-06-29 Fernando Perez <fperez@colorado.edu>
2245 2004-06-29 Fernando Perez <fperez@colorado.edu>
2238
2246
2239 * IPython/iplib.py (file_matches): escape whitespace correctly in
2247 * IPython/iplib.py (file_matches): escape whitespace correctly in
2240 filename completions. Bug reported by Ville.
2248 filename completions. Bug reported by Ville.
2241
2249
2242 2004-06-28 Fernando Perez <fperez@colorado.edu>
2250 2004-06-28 Fernando Perez <fperez@colorado.edu>
2243
2251
2244 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2252 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2245 the history file will be called 'history-PROFNAME' (or just
2253 the history file will be called 'history-PROFNAME' (or just
2246 'history' if no profile is loaded). I was getting annoyed at
2254 'history' if no profile is loaded). I was getting annoyed at
2247 getting my Numerical work history clobbered by pysh sessions.
2255 getting my Numerical work history clobbered by pysh sessions.
2248
2256
2249 * IPython/iplib.py (InteractiveShell.__init__): Internal
2257 * IPython/iplib.py (InteractiveShell.__init__): Internal
2250 getoutputerror() function so that we can honor the system_verbose
2258 getoutputerror() function so that we can honor the system_verbose
2251 flag for _all_ system calls. I also added escaping of #
2259 flag for _all_ system calls. I also added escaping of #
2252 characters here to avoid confusing Itpl.
2260 characters here to avoid confusing Itpl.
2253
2261
2254 * IPython/Magic.py (shlex_split): removed call to shell in
2262 * IPython/Magic.py (shlex_split): removed call to shell in
2255 parse_options and replaced it with shlex.split(). The annoying
2263 parse_options and replaced it with shlex.split(). The annoying
2256 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2264 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2257 to backport it from 2.3, with several frail hacks (the shlex
2265 to backport it from 2.3, with several frail hacks (the shlex
2258 module is rather limited in 2.2). Thanks to a suggestion by Ville
2266 module is rather limited in 2.2). Thanks to a suggestion by Ville
2259 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2267 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2260 problem.
2268 problem.
2261
2269
2262 (Magic.magic_system_verbose): new toggle to print the actual
2270 (Magic.magic_system_verbose): new toggle to print the actual
2263 system calls made by ipython. Mainly for debugging purposes.
2271 system calls made by ipython. Mainly for debugging purposes.
2264
2272
2265 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2273 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2266 doesn't support persistence. Reported (and fix suggested) by
2274 doesn't support persistence. Reported (and fix suggested) by
2267 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2275 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2268
2276
2269 2004-06-26 Fernando Perez <fperez@colorado.edu>
2277 2004-06-26 Fernando Perez <fperez@colorado.edu>
2270
2278
2271 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2279 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2272 continue prompts.
2280 continue prompts.
2273
2281
2274 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2282 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2275 function (basically a big docstring) and a few more things here to
2283 function (basically a big docstring) and a few more things here to
2276 speedup startup. pysh.py is now very lightweight. We want because
2284 speedup startup. pysh.py is now very lightweight. We want because
2277 it gets execfile'd, while InterpreterExec gets imported, so
2285 it gets execfile'd, while InterpreterExec gets imported, so
2278 byte-compilation saves time.
2286 byte-compilation saves time.
2279
2287
2280 2004-06-25 Fernando Perez <fperez@colorado.edu>
2288 2004-06-25 Fernando Perez <fperez@colorado.edu>
2281
2289
2282 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2290 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2283 -NUM', which was recently broken.
2291 -NUM', which was recently broken.
2284
2292
2285 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2293 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2286 in multi-line input (but not !!, which doesn't make sense there).
2294 in multi-line input (but not !!, which doesn't make sense there).
2287
2295
2288 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2296 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2289 It's just too useful, and people can turn it off in the less
2297 It's just too useful, and people can turn it off in the less
2290 common cases where it's a problem.
2298 common cases where it's a problem.
2291
2299
2292 2004-06-24 Fernando Perez <fperez@colorado.edu>
2300 2004-06-24 Fernando Perez <fperez@colorado.edu>
2293
2301
2294 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2302 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2295 special syntaxes (like alias calling) is now allied in multi-line
2303 special syntaxes (like alias calling) is now allied in multi-line
2296 input. This is still _very_ experimental, but it's necessary for
2304 input. This is still _very_ experimental, but it's necessary for
2297 efficient shell usage combining python looping syntax with system
2305 efficient shell usage combining python looping syntax with system
2298 calls. For now it's restricted to aliases, I don't think it
2306 calls. For now it's restricted to aliases, I don't think it
2299 really even makes sense to have this for magics.
2307 really even makes sense to have this for magics.
2300
2308
2301 2004-06-23 Fernando Perez <fperez@colorado.edu>
2309 2004-06-23 Fernando Perez <fperez@colorado.edu>
2302
2310
2303 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2311 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2304 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2312 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2305
2313
2306 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2314 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2307 extensions under Windows (after code sent by Gary Bishop). The
2315 extensions under Windows (after code sent by Gary Bishop). The
2308 extensions considered 'executable' are stored in IPython's rc
2316 extensions considered 'executable' are stored in IPython's rc
2309 structure as win_exec_ext.
2317 structure as win_exec_ext.
2310
2318
2311 * IPython/genutils.py (shell): new function, like system() but
2319 * IPython/genutils.py (shell): new function, like system() but
2312 without return value. Very useful for interactive shell work.
2320 without return value. Very useful for interactive shell work.
2313
2321
2314 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2322 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2315 delete aliases.
2323 delete aliases.
2316
2324
2317 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2325 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2318 sure that the alias table doesn't contain python keywords.
2326 sure that the alias table doesn't contain python keywords.
2319
2327
2320 2004-06-21 Fernando Perez <fperez@colorado.edu>
2328 2004-06-21 Fernando Perez <fperez@colorado.edu>
2321
2329
2322 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2330 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2323 non-existent items are found in $PATH. Reported by Thorsten.
2331 non-existent items are found in $PATH. Reported by Thorsten.
2324
2332
2325 2004-06-20 Fernando Perez <fperez@colorado.edu>
2333 2004-06-20 Fernando Perez <fperez@colorado.edu>
2326
2334
2327 * IPython/iplib.py (complete): modified the completer so that the
2335 * IPython/iplib.py (complete): modified the completer so that the
2328 order of priorities can be easily changed at runtime.
2336 order of priorities can be easily changed at runtime.
2329
2337
2330 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2338 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2331 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2339 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2332
2340
2333 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2341 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2334 expand Python variables prepended with $ in all system calls. The
2342 expand Python variables prepended with $ in all system calls. The
2335 same was done to InteractiveShell.handle_shell_escape. Now all
2343 same was done to InteractiveShell.handle_shell_escape. Now all
2336 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2344 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2337 expansion of python variables and expressions according to the
2345 expansion of python variables and expressions according to the
2338 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2346 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2339
2347
2340 Though PEP-215 has been rejected, a similar (but simpler) one
2348 Though PEP-215 has been rejected, a similar (but simpler) one
2341 seems like it will go into Python 2.4, PEP-292 -
2349 seems like it will go into Python 2.4, PEP-292 -
2342 http://www.python.org/peps/pep-0292.html.
2350 http://www.python.org/peps/pep-0292.html.
2343
2351
2344 I'll keep the full syntax of PEP-215, since IPython has since the
2352 I'll keep the full syntax of PEP-215, since IPython has since the
2345 start used Ka-Ping Yee's reference implementation discussed there
2353 start used Ka-Ping Yee's reference implementation discussed there
2346 (Itpl), and I actually like the powerful semantics it offers.
2354 (Itpl), and I actually like the powerful semantics it offers.
2347
2355
2348 In order to access normal shell variables, the $ has to be escaped
2356 In order to access normal shell variables, the $ has to be escaped
2349 via an extra $. For example:
2357 via an extra $. For example:
2350
2358
2351 In [7]: PATH='a python variable'
2359 In [7]: PATH='a python variable'
2352
2360
2353 In [8]: !echo $PATH
2361 In [8]: !echo $PATH
2354 a python variable
2362 a python variable
2355
2363
2356 In [9]: !echo $$PATH
2364 In [9]: !echo $$PATH
2357 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2365 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2358
2366
2359 (Magic.parse_options): escape $ so the shell doesn't evaluate
2367 (Magic.parse_options): escape $ so the shell doesn't evaluate
2360 things prematurely.
2368 things prematurely.
2361
2369
2362 * IPython/iplib.py (InteractiveShell.call_alias): added the
2370 * IPython/iplib.py (InteractiveShell.call_alias): added the
2363 ability for aliases to expand python variables via $.
2371 ability for aliases to expand python variables via $.
2364
2372
2365 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2373 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2366 system, now there's a @rehash/@rehashx pair of magics. These work
2374 system, now there's a @rehash/@rehashx pair of magics. These work
2367 like the csh rehash command, and can be invoked at any time. They
2375 like the csh rehash command, and can be invoked at any time. They
2368 build a table of aliases to everything in the user's $PATH
2376 build a table of aliases to everything in the user's $PATH
2369 (@rehash uses everything, @rehashx is slower but only adds
2377 (@rehash uses everything, @rehashx is slower but only adds
2370 executable files). With this, the pysh.py-based shell profile can
2378 executable files). With this, the pysh.py-based shell profile can
2371 now simply call rehash upon startup, and full access to all
2379 now simply call rehash upon startup, and full access to all
2372 programs in the user's path is obtained.
2380 programs in the user's path is obtained.
2373
2381
2374 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2382 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2375 functionality is now fully in place. I removed the old dynamic
2383 functionality is now fully in place. I removed the old dynamic
2376 code generation based approach, in favor of a much lighter one
2384 code generation based approach, in favor of a much lighter one
2377 based on a simple dict. The advantage is that this allows me to
2385 based on a simple dict. The advantage is that this allows me to
2378 now have thousands of aliases with negligible cost (unthinkable
2386 now have thousands of aliases with negligible cost (unthinkable
2379 with the old system).
2387 with the old system).
2380
2388
2381 2004-06-19 Fernando Perez <fperez@colorado.edu>
2389 2004-06-19 Fernando Perez <fperez@colorado.edu>
2382
2390
2383 * IPython/iplib.py (__init__): extended MagicCompleter class to
2391 * IPython/iplib.py (__init__): extended MagicCompleter class to
2384 also complete (last in priority) on user aliases.
2392 also complete (last in priority) on user aliases.
2385
2393
2386 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2394 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2387 call to eval.
2395 call to eval.
2388 (ItplNS.__init__): Added a new class which functions like Itpl,
2396 (ItplNS.__init__): Added a new class which functions like Itpl,
2389 but allows configuring the namespace for the evaluation to occur
2397 but allows configuring the namespace for the evaluation to occur
2390 in.
2398 in.
2391
2399
2392 2004-06-18 Fernando Perez <fperez@colorado.edu>
2400 2004-06-18 Fernando Perez <fperez@colorado.edu>
2393
2401
2394 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2402 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2395 better message when 'exit' or 'quit' are typed (a common newbie
2403 better message when 'exit' or 'quit' are typed (a common newbie
2396 confusion).
2404 confusion).
2397
2405
2398 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2406 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2399 check for Windows users.
2407 check for Windows users.
2400
2408
2401 * IPython/iplib.py (InteractiveShell.user_setup): removed
2409 * IPython/iplib.py (InteractiveShell.user_setup): removed
2402 disabling of colors for Windows. I'll test at runtime and issue a
2410 disabling of colors for Windows. I'll test at runtime and issue a
2403 warning if Gary's readline isn't found, as to nudge users to
2411 warning if Gary's readline isn't found, as to nudge users to
2404 download it.
2412 download it.
2405
2413
2406 2004-06-16 Fernando Perez <fperez@colorado.edu>
2414 2004-06-16 Fernando Perez <fperez@colorado.edu>
2407
2415
2408 * IPython/genutils.py (Stream.__init__): changed to print errors
2416 * IPython/genutils.py (Stream.__init__): changed to print errors
2409 to sys.stderr. I had a circular dependency here. Now it's
2417 to sys.stderr. I had a circular dependency here. Now it's
2410 possible to run ipython as IDLE's shell (consider this pre-alpha,
2418 possible to run ipython as IDLE's shell (consider this pre-alpha,
2411 since true stdout things end up in the starting terminal instead
2419 since true stdout things end up in the starting terminal instead
2412 of IDLE's out).
2420 of IDLE's out).
2413
2421
2414 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2422 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2415 users who haven't # updated their prompt_in2 definitions. Remove
2423 users who haven't # updated their prompt_in2 definitions. Remove
2416 eventually.
2424 eventually.
2417 (multiple_replace): added credit to original ASPN recipe.
2425 (multiple_replace): added credit to original ASPN recipe.
2418
2426
2419 2004-06-15 Fernando Perez <fperez@colorado.edu>
2427 2004-06-15 Fernando Perez <fperez@colorado.edu>
2420
2428
2421 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2429 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2422 list of auto-defined aliases.
2430 list of auto-defined aliases.
2423
2431
2424 2004-06-13 Fernando Perez <fperez@colorado.edu>
2432 2004-06-13 Fernando Perez <fperez@colorado.edu>
2425
2433
2426 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2434 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2427 install was really requested (so setup.py can be used for other
2435 install was really requested (so setup.py can be used for other
2428 things under Windows).
2436 things under Windows).
2429
2437
2430 2004-06-10 Fernando Perez <fperez@colorado.edu>
2438 2004-06-10 Fernando Perez <fperez@colorado.edu>
2431
2439
2432 * IPython/Logger.py (Logger.create_log): Manually remove any old
2440 * IPython/Logger.py (Logger.create_log): Manually remove any old
2433 backup, since os.remove may fail under Windows. Fixes bug
2441 backup, since os.remove may fail under Windows. Fixes bug
2434 reported by Thorsten.
2442 reported by Thorsten.
2435
2443
2436 2004-06-09 Fernando Perez <fperez@colorado.edu>
2444 2004-06-09 Fernando Perez <fperez@colorado.edu>
2437
2445
2438 * examples/example-embed.py: fixed all references to %n (replaced
2446 * examples/example-embed.py: fixed all references to %n (replaced
2439 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2447 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2440 for all examples and the manual as well.
2448 for all examples and the manual as well.
2441
2449
2442 2004-06-08 Fernando Perez <fperez@colorado.edu>
2450 2004-06-08 Fernando Perez <fperez@colorado.edu>
2443
2451
2444 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2452 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2445 alignment and color management. All 3 prompt subsystems now
2453 alignment and color management. All 3 prompt subsystems now
2446 inherit from BasePrompt.
2454 inherit from BasePrompt.
2447
2455
2448 * tools/release: updates for windows installer build and tag rpms
2456 * tools/release: updates for windows installer build and tag rpms
2449 with python version (since paths are fixed).
2457 with python version (since paths are fixed).
2450
2458
2451 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2459 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2452 which will become eventually obsolete. Also fixed the default
2460 which will become eventually obsolete. Also fixed the default
2453 prompt_in2 to use \D, so at least new users start with the correct
2461 prompt_in2 to use \D, so at least new users start with the correct
2454 defaults.
2462 defaults.
2455 WARNING: Users with existing ipythonrc files will need to apply
2463 WARNING: Users with existing ipythonrc files will need to apply
2456 this fix manually!
2464 this fix manually!
2457
2465
2458 * setup.py: make windows installer (.exe). This is finally the
2466 * setup.py: make windows installer (.exe). This is finally the
2459 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2467 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2460 which I hadn't included because it required Python 2.3 (or recent
2468 which I hadn't included because it required Python 2.3 (or recent
2461 distutils).
2469 distutils).
2462
2470
2463 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2471 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2464 usage of new '\D' escape.
2472 usage of new '\D' escape.
2465
2473
2466 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2474 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2467 lacks os.getuid())
2475 lacks os.getuid())
2468 (CachedOutput.set_colors): Added the ability to turn coloring
2476 (CachedOutput.set_colors): Added the ability to turn coloring
2469 on/off with @colors even for manually defined prompt colors. It
2477 on/off with @colors even for manually defined prompt colors. It
2470 uses a nasty global, but it works safely and via the generic color
2478 uses a nasty global, but it works safely and via the generic color
2471 handling mechanism.
2479 handling mechanism.
2472 (Prompt2.__init__): Introduced new escape '\D' for continuation
2480 (Prompt2.__init__): Introduced new escape '\D' for continuation
2473 prompts. It represents the counter ('\#') as dots.
2481 prompts. It represents the counter ('\#') as dots.
2474 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2482 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2475 need to update their ipythonrc files and replace '%n' with '\D' in
2483 need to update their ipythonrc files and replace '%n' with '\D' in
2476 their prompt_in2 settings everywhere. Sorry, but there's
2484 their prompt_in2 settings everywhere. Sorry, but there's
2477 otherwise no clean way to get all prompts to properly align. The
2485 otherwise no clean way to get all prompts to properly align. The
2478 ipythonrc shipped with IPython has been updated.
2486 ipythonrc shipped with IPython has been updated.
2479
2487
2480 2004-06-07 Fernando Perez <fperez@colorado.edu>
2488 2004-06-07 Fernando Perez <fperez@colorado.edu>
2481
2489
2482 * setup.py (isfile): Pass local_icons option to latex2html, so the
2490 * setup.py (isfile): Pass local_icons option to latex2html, so the
2483 resulting HTML file is self-contained. Thanks to
2491 resulting HTML file is self-contained. Thanks to
2484 dryice-AT-liu.com.cn for the tip.
2492 dryice-AT-liu.com.cn for the tip.
2485
2493
2486 * pysh.py: I created a new profile 'shell', which implements a
2494 * pysh.py: I created a new profile 'shell', which implements a
2487 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2495 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2488 system shell, nor will it become one anytime soon. It's mainly
2496 system shell, nor will it become one anytime soon. It's mainly
2489 meant to illustrate the use of the new flexible bash-like prompts.
2497 meant to illustrate the use of the new flexible bash-like prompts.
2490 I guess it could be used by hardy souls for true shell management,
2498 I guess it could be used by hardy souls for true shell management,
2491 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2499 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2492 profile. This uses the InterpreterExec extension provided by
2500 profile. This uses the InterpreterExec extension provided by
2493 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2501 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2494
2502
2495 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2503 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2496 auto-align itself with the length of the previous input prompt
2504 auto-align itself with the length of the previous input prompt
2497 (taking into account the invisible color escapes).
2505 (taking into account the invisible color escapes).
2498 (CachedOutput.__init__): Large restructuring of this class. Now
2506 (CachedOutput.__init__): Large restructuring of this class. Now
2499 all three prompts (primary1, primary2, output) are proper objects,
2507 all three prompts (primary1, primary2, output) are proper objects,
2500 managed by the 'parent' CachedOutput class. The code is still a
2508 managed by the 'parent' CachedOutput class. The code is still a
2501 bit hackish (all prompts share state via a pointer to the cache),
2509 bit hackish (all prompts share state via a pointer to the cache),
2502 but it's overall far cleaner than before.
2510 but it's overall far cleaner than before.
2503
2511
2504 * IPython/genutils.py (getoutputerror): modified to add verbose,
2512 * IPython/genutils.py (getoutputerror): modified to add verbose,
2505 debug and header options. This makes the interface of all getout*
2513 debug and header options. This makes the interface of all getout*
2506 functions uniform.
2514 functions uniform.
2507 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2515 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2508
2516
2509 * IPython/Magic.py (Magic.default_option): added a function to
2517 * IPython/Magic.py (Magic.default_option): added a function to
2510 allow registering default options for any magic command. This
2518 allow registering default options for any magic command. This
2511 makes it easy to have profiles which customize the magics globally
2519 makes it easy to have profiles which customize the magics globally
2512 for a certain use. The values set through this function are
2520 for a certain use. The values set through this function are
2513 picked up by the parse_options() method, which all magics should
2521 picked up by the parse_options() method, which all magics should
2514 use to parse their options.
2522 use to parse their options.
2515
2523
2516 * IPython/genutils.py (warn): modified the warnings framework to
2524 * IPython/genutils.py (warn): modified the warnings framework to
2517 use the Term I/O class. I'm trying to slowly unify all of
2525 use the Term I/O class. I'm trying to slowly unify all of
2518 IPython's I/O operations to pass through Term.
2526 IPython's I/O operations to pass through Term.
2519
2527
2520 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2528 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2521 the secondary prompt to correctly match the length of the primary
2529 the secondary prompt to correctly match the length of the primary
2522 one for any prompt. Now multi-line code will properly line up
2530 one for any prompt. Now multi-line code will properly line up
2523 even for path dependent prompts, such as the new ones available
2531 even for path dependent prompts, such as the new ones available
2524 via the prompt_specials.
2532 via the prompt_specials.
2525
2533
2526 2004-06-06 Fernando Perez <fperez@colorado.edu>
2534 2004-06-06 Fernando Perez <fperez@colorado.edu>
2527
2535
2528 * IPython/Prompts.py (prompt_specials): Added the ability to have
2536 * IPython/Prompts.py (prompt_specials): Added the ability to have
2529 bash-like special sequences in the prompts, which get
2537 bash-like special sequences in the prompts, which get
2530 automatically expanded. Things like hostname, current working
2538 automatically expanded. Things like hostname, current working
2531 directory and username are implemented already, but it's easy to
2539 directory and username are implemented already, but it's easy to
2532 add more in the future. Thanks to a patch by W.J. van der Laan
2540 add more in the future. Thanks to a patch by W.J. van der Laan
2533 <gnufnork-AT-hetdigitalegat.nl>
2541 <gnufnork-AT-hetdigitalegat.nl>
2534 (prompt_specials): Added color support for prompt strings, so
2542 (prompt_specials): Added color support for prompt strings, so
2535 users can define arbitrary color setups for their prompts.
2543 users can define arbitrary color setups for their prompts.
2536
2544
2537 2004-06-05 Fernando Perez <fperez@colorado.edu>
2545 2004-06-05 Fernando Perez <fperez@colorado.edu>
2538
2546
2539 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2547 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2540 code to load Gary Bishop's readline and configure it
2548 code to load Gary Bishop's readline and configure it
2541 automatically. Thanks to Gary for help on this.
2549 automatically. Thanks to Gary for help on this.
2542
2550
2543 2004-06-01 Fernando Perez <fperez@colorado.edu>
2551 2004-06-01 Fernando Perez <fperez@colorado.edu>
2544
2552
2545 * IPython/Logger.py (Logger.create_log): fix bug for logging
2553 * IPython/Logger.py (Logger.create_log): fix bug for logging
2546 with no filename (previous fix was incomplete).
2554 with no filename (previous fix was incomplete).
2547
2555
2548 2004-05-25 Fernando Perez <fperez@colorado.edu>
2556 2004-05-25 Fernando Perez <fperez@colorado.edu>
2549
2557
2550 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2558 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2551 parens would get passed to the shell.
2559 parens would get passed to the shell.
2552
2560
2553 2004-05-20 Fernando Perez <fperez@colorado.edu>
2561 2004-05-20 Fernando Perez <fperez@colorado.edu>
2554
2562
2555 * IPython/Magic.py (Magic.magic_prun): changed default profile
2563 * IPython/Magic.py (Magic.magic_prun): changed default profile
2556 sort order to 'time' (the more common profiling need).
2564 sort order to 'time' (the more common profiling need).
2557
2565
2558 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2566 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2559 so that source code shown is guaranteed in sync with the file on
2567 so that source code shown is guaranteed in sync with the file on
2560 disk (also changed in psource). Similar fix to the one for
2568 disk (also changed in psource). Similar fix to the one for
2561 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2569 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2562 <yann.ledu-AT-noos.fr>.
2570 <yann.ledu-AT-noos.fr>.
2563
2571
2564 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2572 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2565 with a single option would not be correctly parsed. Closes
2573 with a single option would not be correctly parsed. Closes
2566 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2574 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2567 introduced in 0.6.0 (on 2004-05-06).
2575 introduced in 0.6.0 (on 2004-05-06).
2568
2576
2569 2004-05-13 *** Released version 0.6.0
2577 2004-05-13 *** Released version 0.6.0
2570
2578
2571 2004-05-13 Fernando Perez <fperez@colorado.edu>
2579 2004-05-13 Fernando Perez <fperez@colorado.edu>
2572
2580
2573 * debian/: Added debian/ directory to CVS, so that debian support
2581 * debian/: Added debian/ directory to CVS, so that debian support
2574 is publicly accessible. The debian package is maintained by Jack
2582 is publicly accessible. The debian package is maintained by Jack
2575 Moffit <jack-AT-xiph.org>.
2583 Moffit <jack-AT-xiph.org>.
2576
2584
2577 * Documentation: included the notes about an ipython-based system
2585 * Documentation: included the notes about an ipython-based system
2578 shell (the hypothetical 'pysh') into the new_design.pdf document,
2586 shell (the hypothetical 'pysh') into the new_design.pdf document,
2579 so that these ideas get distributed to users along with the
2587 so that these ideas get distributed to users along with the
2580 official documentation.
2588 official documentation.
2581
2589
2582 2004-05-10 Fernando Perez <fperez@colorado.edu>
2590 2004-05-10 Fernando Perez <fperez@colorado.edu>
2583
2591
2584 * IPython/Logger.py (Logger.create_log): fix recently introduced
2592 * IPython/Logger.py (Logger.create_log): fix recently introduced
2585 bug (misindented line) where logstart would fail when not given an
2593 bug (misindented line) where logstart would fail when not given an
2586 explicit filename.
2594 explicit filename.
2587
2595
2588 2004-05-09 Fernando Perez <fperez@colorado.edu>
2596 2004-05-09 Fernando Perez <fperez@colorado.edu>
2589
2597
2590 * IPython/Magic.py (Magic.parse_options): skip system call when
2598 * IPython/Magic.py (Magic.parse_options): skip system call when
2591 there are no options to look for. Faster, cleaner for the common
2599 there are no options to look for. Faster, cleaner for the common
2592 case.
2600 case.
2593
2601
2594 * Documentation: many updates to the manual: describing Windows
2602 * Documentation: many updates to the manual: describing Windows
2595 support better, Gnuplot updates, credits, misc small stuff. Also
2603 support better, Gnuplot updates, credits, misc small stuff. Also
2596 updated the new_design doc a bit.
2604 updated the new_design doc a bit.
2597
2605
2598 2004-05-06 *** Released version 0.6.0.rc1
2606 2004-05-06 *** Released version 0.6.0.rc1
2599
2607
2600 2004-05-06 Fernando Perez <fperez@colorado.edu>
2608 2004-05-06 Fernando Perez <fperez@colorado.edu>
2601
2609
2602 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2610 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2603 operations to use the vastly more efficient list/''.join() method.
2611 operations to use the vastly more efficient list/''.join() method.
2604 (FormattedTB.text): Fix
2612 (FormattedTB.text): Fix
2605 http://www.scipy.net/roundup/ipython/issue12 - exception source
2613 http://www.scipy.net/roundup/ipython/issue12 - exception source
2606 extract not updated after reload. Thanks to Mike Salib
2614 extract not updated after reload. Thanks to Mike Salib
2607 <msalib-AT-mit.edu> for pinning the source of the problem.
2615 <msalib-AT-mit.edu> for pinning the source of the problem.
2608 Fortunately, the solution works inside ipython and doesn't require
2616 Fortunately, the solution works inside ipython and doesn't require
2609 any changes to python proper.
2617 any changes to python proper.
2610
2618
2611 * IPython/Magic.py (Magic.parse_options): Improved to process the
2619 * IPython/Magic.py (Magic.parse_options): Improved to process the
2612 argument list as a true shell would (by actually using the
2620 argument list as a true shell would (by actually using the
2613 underlying system shell). This way, all @magics automatically get
2621 underlying system shell). This way, all @magics automatically get
2614 shell expansion for variables. Thanks to a comment by Alex
2622 shell expansion for variables. Thanks to a comment by Alex
2615 Schmolck.
2623 Schmolck.
2616
2624
2617 2004-04-04 Fernando Perez <fperez@colorado.edu>
2625 2004-04-04 Fernando Perez <fperez@colorado.edu>
2618
2626
2619 * IPython/iplib.py (InteractiveShell.interact): Added a special
2627 * IPython/iplib.py (InteractiveShell.interact): Added a special
2620 trap for a debugger quit exception, which is basically impossible
2628 trap for a debugger quit exception, which is basically impossible
2621 to handle by normal mechanisms, given what pdb does to the stack.
2629 to handle by normal mechanisms, given what pdb does to the stack.
2622 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2630 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2623
2631
2624 2004-04-03 Fernando Perez <fperez@colorado.edu>
2632 2004-04-03 Fernando Perez <fperez@colorado.edu>
2625
2633
2626 * IPython/genutils.py (Term): Standardized the names of the Term
2634 * IPython/genutils.py (Term): Standardized the names of the Term
2627 class streams to cin/cout/cerr, following C++ naming conventions
2635 class streams to cin/cout/cerr, following C++ naming conventions
2628 (I can't use in/out/err because 'in' is not a valid attribute
2636 (I can't use in/out/err because 'in' is not a valid attribute
2629 name).
2637 name).
2630
2638
2631 * IPython/iplib.py (InteractiveShell.interact): don't increment
2639 * IPython/iplib.py (InteractiveShell.interact): don't increment
2632 the prompt if there's no user input. By Daniel 'Dang' Griffith
2640 the prompt if there's no user input. By Daniel 'Dang' Griffith
2633 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2641 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2634 Francois Pinard.
2642 Francois Pinard.
2635
2643
2636 2004-04-02 Fernando Perez <fperez@colorado.edu>
2644 2004-04-02 Fernando Perez <fperez@colorado.edu>
2637
2645
2638 * IPython/genutils.py (Stream.__init__): Modified to survive at
2646 * IPython/genutils.py (Stream.__init__): Modified to survive at
2639 least importing in contexts where stdin/out/err aren't true file
2647 least importing in contexts where stdin/out/err aren't true file
2640 objects, such as PyCrust (they lack fileno() and mode). However,
2648 objects, such as PyCrust (they lack fileno() and mode). However,
2641 the recovery facilities which rely on these things existing will
2649 the recovery facilities which rely on these things existing will
2642 not work.
2650 not work.
2643
2651
2644 2004-04-01 Fernando Perez <fperez@colorado.edu>
2652 2004-04-01 Fernando Perez <fperez@colorado.edu>
2645
2653
2646 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2654 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2647 use the new getoutputerror() function, so it properly
2655 use the new getoutputerror() function, so it properly
2648 distinguishes stdout/err.
2656 distinguishes stdout/err.
2649
2657
2650 * IPython/genutils.py (getoutputerror): added a function to
2658 * IPython/genutils.py (getoutputerror): added a function to
2651 capture separately the standard output and error of a command.
2659 capture separately the standard output and error of a command.
2652 After a comment from dang on the mailing lists. This code is
2660 After a comment from dang on the mailing lists. This code is
2653 basically a modified version of commands.getstatusoutput(), from
2661 basically a modified version of commands.getstatusoutput(), from
2654 the standard library.
2662 the standard library.
2655
2663
2656 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2664 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2657 '!!' as a special syntax (shorthand) to access @sx.
2665 '!!' as a special syntax (shorthand) to access @sx.
2658
2666
2659 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2667 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2660 command and return its output as a list split on '\n'.
2668 command and return its output as a list split on '\n'.
2661
2669
2662 2004-03-31 Fernando Perez <fperez@colorado.edu>
2670 2004-03-31 Fernando Perez <fperez@colorado.edu>
2663
2671
2664 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2672 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2665 method to dictionaries used as FakeModule instances if they lack
2673 method to dictionaries used as FakeModule instances if they lack
2666 it. At least pydoc in python2.3 breaks for runtime-defined
2674 it. At least pydoc in python2.3 breaks for runtime-defined
2667 functions without this hack. At some point I need to _really_
2675 functions without this hack. At some point I need to _really_
2668 understand what FakeModule is doing, because it's a gross hack.
2676 understand what FakeModule is doing, because it's a gross hack.
2669 But it solves Arnd's problem for now...
2677 But it solves Arnd's problem for now...
2670
2678
2671 2004-02-27 Fernando Perez <fperez@colorado.edu>
2679 2004-02-27 Fernando Perez <fperez@colorado.edu>
2672
2680
2673 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2681 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2674 mode would behave erratically. Also increased the number of
2682 mode would behave erratically. Also increased the number of
2675 possible logs in rotate mod to 999. Thanks to Rod Holland
2683 possible logs in rotate mod to 999. Thanks to Rod Holland
2676 <rhh@StructureLABS.com> for the report and fixes.
2684 <rhh@StructureLABS.com> for the report and fixes.
2677
2685
2678 2004-02-26 Fernando Perez <fperez@colorado.edu>
2686 2004-02-26 Fernando Perez <fperez@colorado.edu>
2679
2687
2680 * IPython/genutils.py (page): Check that the curses module really
2688 * IPython/genutils.py (page): Check that the curses module really
2681 has the initscr attribute before trying to use it. For some
2689 has the initscr attribute before trying to use it. For some
2682 reason, the Solaris curses module is missing this. I think this
2690 reason, the Solaris curses module is missing this. I think this
2683 should be considered a Solaris python bug, but I'm not sure.
2691 should be considered a Solaris python bug, but I'm not sure.
2684
2692
2685 2004-01-17 Fernando Perez <fperez@colorado.edu>
2693 2004-01-17 Fernando Perez <fperez@colorado.edu>
2686
2694
2687 * IPython/genutils.py (Stream.__init__): Changes to try to make
2695 * IPython/genutils.py (Stream.__init__): Changes to try to make
2688 ipython robust against stdin/out/err being closed by the user.
2696 ipython robust against stdin/out/err being closed by the user.
2689 This is 'user error' (and blocks a normal python session, at least
2697 This is 'user error' (and blocks a normal python session, at least
2690 the stdout case). However, Ipython should be able to survive such
2698 the stdout case). However, Ipython should be able to survive such
2691 instances of abuse as gracefully as possible. To simplify the
2699 instances of abuse as gracefully as possible. To simplify the
2692 coding and maintain compatibility with Gary Bishop's Term
2700 coding and maintain compatibility with Gary Bishop's Term
2693 contributions, I've made use of classmethods for this. I think
2701 contributions, I've made use of classmethods for this. I think
2694 this introduces a dependency on python 2.2.
2702 this introduces a dependency on python 2.2.
2695
2703
2696 2004-01-13 Fernando Perez <fperez@colorado.edu>
2704 2004-01-13 Fernando Perez <fperez@colorado.edu>
2697
2705
2698 * IPython/numutils.py (exp_safe): simplified the code a bit and
2706 * IPython/numutils.py (exp_safe): simplified the code a bit and
2699 removed the need for importing the kinds module altogether.
2707 removed the need for importing the kinds module altogether.
2700
2708
2701 2004-01-06 Fernando Perez <fperez@colorado.edu>
2709 2004-01-06 Fernando Perez <fperez@colorado.edu>
2702
2710
2703 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2711 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2704 a magic function instead, after some community feedback. No
2712 a magic function instead, after some community feedback. No
2705 special syntax will exist for it, but its name is deliberately
2713 special syntax will exist for it, but its name is deliberately
2706 very short.
2714 very short.
2707
2715
2708 2003-12-20 Fernando Perez <fperez@colorado.edu>
2716 2003-12-20 Fernando Perez <fperez@colorado.edu>
2709
2717
2710 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2718 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2711 new functionality, to automagically assign the result of a shell
2719 new functionality, to automagically assign the result of a shell
2712 command to a variable. I'll solicit some community feedback on
2720 command to a variable. I'll solicit some community feedback on
2713 this before making it permanent.
2721 this before making it permanent.
2714
2722
2715 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2723 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2716 requested about callables for which inspect couldn't obtain a
2724 requested about callables for which inspect couldn't obtain a
2717 proper argspec. Thanks to a crash report sent by Etienne
2725 proper argspec. Thanks to a crash report sent by Etienne
2718 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2726 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2719
2727
2720 2003-12-09 Fernando Perez <fperez@colorado.edu>
2728 2003-12-09 Fernando Perez <fperez@colorado.edu>
2721
2729
2722 * IPython/genutils.py (page): patch for the pager to work across
2730 * IPython/genutils.py (page): patch for the pager to work across
2723 various versions of Windows. By Gary Bishop.
2731 various versions of Windows. By Gary Bishop.
2724
2732
2725 2003-12-04 Fernando Perez <fperez@colorado.edu>
2733 2003-12-04 Fernando Perez <fperez@colorado.edu>
2726
2734
2727 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2735 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2728 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2736 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2729 While I tested this and it looks ok, there may still be corner
2737 While I tested this and it looks ok, there may still be corner
2730 cases I've missed.
2738 cases I've missed.
2731
2739
2732 2003-12-01 Fernando Perez <fperez@colorado.edu>
2740 2003-12-01 Fernando Perez <fperez@colorado.edu>
2733
2741
2734 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2742 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2735 where a line like 'p,q=1,2' would fail because the automagic
2743 where a line like 'p,q=1,2' would fail because the automagic
2736 system would be triggered for @p.
2744 system would be triggered for @p.
2737
2745
2738 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2746 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2739 cleanups, code unmodified.
2747 cleanups, code unmodified.
2740
2748
2741 * IPython/genutils.py (Term): added a class for IPython to handle
2749 * IPython/genutils.py (Term): added a class for IPython to handle
2742 output. In most cases it will just be a proxy for stdout/err, but
2750 output. In most cases it will just be a proxy for stdout/err, but
2743 having this allows modifications to be made for some platforms,
2751 having this allows modifications to be made for some platforms,
2744 such as handling color escapes under Windows. All of this code
2752 such as handling color escapes under Windows. All of this code
2745 was contributed by Gary Bishop, with minor modifications by me.
2753 was contributed by Gary Bishop, with minor modifications by me.
2746 The actual changes affect many files.
2754 The actual changes affect many files.
2747
2755
2748 2003-11-30 Fernando Perez <fperez@colorado.edu>
2756 2003-11-30 Fernando Perez <fperez@colorado.edu>
2749
2757
2750 * IPython/iplib.py (file_matches): new completion code, courtesy
2758 * IPython/iplib.py (file_matches): new completion code, courtesy
2751 of Jeff Collins. This enables filename completion again under
2759 of Jeff Collins. This enables filename completion again under
2752 python 2.3, which disabled it at the C level.
2760 python 2.3, which disabled it at the C level.
2753
2761
2754 2003-11-11 Fernando Perez <fperez@colorado.edu>
2762 2003-11-11 Fernando Perez <fperez@colorado.edu>
2755
2763
2756 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2764 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2757 for Numeric.array(map(...)), but often convenient.
2765 for Numeric.array(map(...)), but often convenient.
2758
2766
2759 2003-11-05 Fernando Perez <fperez@colorado.edu>
2767 2003-11-05 Fernando Perez <fperez@colorado.edu>
2760
2768
2761 * IPython/numutils.py (frange): Changed a call from int() to
2769 * IPython/numutils.py (frange): Changed a call from int() to
2762 int(round()) to prevent a problem reported with arange() in the
2770 int(round()) to prevent a problem reported with arange() in the
2763 numpy list.
2771 numpy list.
2764
2772
2765 2003-10-06 Fernando Perez <fperez@colorado.edu>
2773 2003-10-06 Fernando Perez <fperez@colorado.edu>
2766
2774
2767 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2775 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2768 prevent crashes if sys lacks an argv attribute (it happens with
2776 prevent crashes if sys lacks an argv attribute (it happens with
2769 embedded interpreters which build a bare-bones sys module).
2777 embedded interpreters which build a bare-bones sys module).
2770 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2778 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2771
2779
2772 2003-09-24 Fernando Perez <fperez@colorado.edu>
2780 2003-09-24 Fernando Perez <fperez@colorado.edu>
2773
2781
2774 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2782 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2775 to protect against poorly written user objects where __getattr__
2783 to protect against poorly written user objects where __getattr__
2776 raises exceptions other than AttributeError. Thanks to a bug
2784 raises exceptions other than AttributeError. Thanks to a bug
2777 report by Oliver Sander <osander-AT-gmx.de>.
2785 report by Oliver Sander <osander-AT-gmx.de>.
2778
2786
2779 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2787 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2780 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2788 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2781
2789
2782 2003-09-09 Fernando Perez <fperez@colorado.edu>
2790 2003-09-09 Fernando Perez <fperez@colorado.edu>
2783
2791
2784 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2792 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2785 unpacking a list whith a callable as first element would
2793 unpacking a list whith a callable as first element would
2786 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2794 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2787 Collins.
2795 Collins.
2788
2796
2789 2003-08-25 *** Released version 0.5.0
2797 2003-08-25 *** Released version 0.5.0
2790
2798
2791 2003-08-22 Fernando Perez <fperez@colorado.edu>
2799 2003-08-22 Fernando Perez <fperez@colorado.edu>
2792
2800
2793 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2801 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2794 improperly defined user exceptions. Thanks to feedback from Mark
2802 improperly defined user exceptions. Thanks to feedback from Mark
2795 Russell <mrussell-AT-verio.net>.
2803 Russell <mrussell-AT-verio.net>.
2796
2804
2797 2003-08-20 Fernando Perez <fperez@colorado.edu>
2805 2003-08-20 Fernando Perez <fperez@colorado.edu>
2798
2806
2799 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2807 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2800 printing so that it would print multi-line string forms starting
2808 printing so that it would print multi-line string forms starting
2801 with a new line. This way the formatting is better respected for
2809 with a new line. This way the formatting is better respected for
2802 objects which work hard to make nice string forms.
2810 objects which work hard to make nice string forms.
2803
2811
2804 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2812 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2805 autocall would overtake data access for objects with both
2813 autocall would overtake data access for objects with both
2806 __getitem__ and __call__.
2814 __getitem__ and __call__.
2807
2815
2808 2003-08-19 *** Released version 0.5.0-rc1
2816 2003-08-19 *** Released version 0.5.0-rc1
2809
2817
2810 2003-08-19 Fernando Perez <fperez@colorado.edu>
2818 2003-08-19 Fernando Perez <fperez@colorado.edu>
2811
2819
2812 * IPython/deep_reload.py (load_tail): single tiny change here
2820 * IPython/deep_reload.py (load_tail): single tiny change here
2813 seems to fix the long-standing bug of dreload() failing to work
2821 seems to fix the long-standing bug of dreload() failing to work
2814 for dotted names. But this module is pretty tricky, so I may have
2822 for dotted names. But this module is pretty tricky, so I may have
2815 missed some subtlety. Needs more testing!.
2823 missed some subtlety. Needs more testing!.
2816
2824
2817 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2825 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2818 exceptions which have badly implemented __str__ methods.
2826 exceptions which have badly implemented __str__ methods.
2819 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2827 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2820 which I've been getting reports about from Python 2.3 users. I
2828 which I've been getting reports about from Python 2.3 users. I
2821 wish I had a simple test case to reproduce the problem, so I could
2829 wish I had a simple test case to reproduce the problem, so I could
2822 either write a cleaner workaround or file a bug report if
2830 either write a cleaner workaround or file a bug report if
2823 necessary.
2831 necessary.
2824
2832
2825 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2833 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2826 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2834 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2827 a bug report by Tjabo Kloppenburg.
2835 a bug report by Tjabo Kloppenburg.
2828
2836
2829 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2837 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2830 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2838 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2831 seems rather unstable. Thanks to a bug report by Tjabo
2839 seems rather unstable. Thanks to a bug report by Tjabo
2832 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2840 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2833
2841
2834 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2842 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2835 this out soon because of the critical fixes in the inner loop for
2843 this out soon because of the critical fixes in the inner loop for
2836 generators.
2844 generators.
2837
2845
2838 * IPython/Magic.py (Magic.getargspec): removed. This (and
2846 * IPython/Magic.py (Magic.getargspec): removed. This (and
2839 _get_def) have been obsoleted by OInspect for a long time, I
2847 _get_def) have been obsoleted by OInspect for a long time, I
2840 hadn't noticed that they were dead code.
2848 hadn't noticed that they were dead code.
2841 (Magic._ofind): restored _ofind functionality for a few literals
2849 (Magic._ofind): restored _ofind functionality for a few literals
2842 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2850 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2843 for things like "hello".capitalize?, since that would require a
2851 for things like "hello".capitalize?, since that would require a
2844 potentially dangerous eval() again.
2852 potentially dangerous eval() again.
2845
2853
2846 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2854 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2847 logic a bit more to clean up the escapes handling and minimize the
2855 logic a bit more to clean up the escapes handling and minimize the
2848 use of _ofind to only necessary cases. The interactive 'feel' of
2856 use of _ofind to only necessary cases. The interactive 'feel' of
2849 IPython should have improved quite a bit with the changes in
2857 IPython should have improved quite a bit with the changes in
2850 _prefilter and _ofind (besides being far safer than before).
2858 _prefilter and _ofind (besides being far safer than before).
2851
2859
2852 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2860 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2853 obscure, never reported). Edit would fail to find the object to
2861 obscure, never reported). Edit would fail to find the object to
2854 edit under some circumstances.
2862 edit under some circumstances.
2855 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2863 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2856 which were causing double-calling of generators. Those eval calls
2864 which were causing double-calling of generators. Those eval calls
2857 were _very_ dangerous, since code with side effects could be
2865 were _very_ dangerous, since code with side effects could be
2858 triggered. As they say, 'eval is evil'... These were the
2866 triggered. As they say, 'eval is evil'... These were the
2859 nastiest evals in IPython. Besides, _ofind is now far simpler,
2867 nastiest evals in IPython. Besides, _ofind is now far simpler,
2860 and it should also be quite a bit faster. Its use of inspect is
2868 and it should also be quite a bit faster. Its use of inspect is
2861 also safer, so perhaps some of the inspect-related crashes I've
2869 also safer, so perhaps some of the inspect-related crashes I've
2862 seen lately with Python 2.3 might be taken care of. That will
2870 seen lately with Python 2.3 might be taken care of. That will
2863 need more testing.
2871 need more testing.
2864
2872
2865 2003-08-17 Fernando Perez <fperez@colorado.edu>
2873 2003-08-17 Fernando Perez <fperez@colorado.edu>
2866
2874
2867 * IPython/iplib.py (InteractiveShell._prefilter): significant
2875 * IPython/iplib.py (InteractiveShell._prefilter): significant
2868 simplifications to the logic for handling user escapes. Faster
2876 simplifications to the logic for handling user escapes. Faster
2869 and simpler code.
2877 and simpler code.
2870
2878
2871 2003-08-14 Fernando Perez <fperez@colorado.edu>
2879 2003-08-14 Fernando Perez <fperez@colorado.edu>
2872
2880
2873 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2881 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2874 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2882 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2875 but it should be quite a bit faster. And the recursive version
2883 but it should be quite a bit faster. And the recursive version
2876 generated O(log N) intermediate storage for all rank>1 arrays,
2884 generated O(log N) intermediate storage for all rank>1 arrays,
2877 even if they were contiguous.
2885 even if they were contiguous.
2878 (l1norm): Added this function.
2886 (l1norm): Added this function.
2879 (norm): Added this function for arbitrary norms (including
2887 (norm): Added this function for arbitrary norms (including
2880 l-infinity). l1 and l2 are still special cases for convenience
2888 l-infinity). l1 and l2 are still special cases for convenience
2881 and speed.
2889 and speed.
2882
2890
2883 2003-08-03 Fernando Perez <fperez@colorado.edu>
2891 2003-08-03 Fernando Perez <fperez@colorado.edu>
2884
2892
2885 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2893 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2886 exceptions, which now raise PendingDeprecationWarnings in Python
2894 exceptions, which now raise PendingDeprecationWarnings in Python
2887 2.3. There were some in Magic and some in Gnuplot2.
2895 2.3. There were some in Magic and some in Gnuplot2.
2888
2896
2889 2003-06-30 Fernando Perez <fperez@colorado.edu>
2897 2003-06-30 Fernando Perez <fperez@colorado.edu>
2890
2898
2891 * IPython/genutils.py (page): modified to call curses only for
2899 * IPython/genutils.py (page): modified to call curses only for
2892 terminals where TERM=='xterm'. After problems under many other
2900 terminals where TERM=='xterm'. After problems under many other
2893 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2901 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2894
2902
2895 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2903 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2896 would be triggered when readline was absent. This was just an old
2904 would be triggered when readline was absent. This was just an old
2897 debugging statement I'd forgotten to take out.
2905 debugging statement I'd forgotten to take out.
2898
2906
2899 2003-06-20 Fernando Perez <fperez@colorado.edu>
2907 2003-06-20 Fernando Perez <fperez@colorado.edu>
2900
2908
2901 * IPython/genutils.py (clock): modified to return only user time
2909 * IPython/genutils.py (clock): modified to return only user time
2902 (not counting system time), after a discussion on scipy. While
2910 (not counting system time), after a discussion on scipy. While
2903 system time may be a useful quantity occasionally, it may much
2911 system time may be a useful quantity occasionally, it may much
2904 more easily be skewed by occasional swapping or other similar
2912 more easily be skewed by occasional swapping or other similar
2905 activity.
2913 activity.
2906
2914
2907 2003-06-05 Fernando Perez <fperez@colorado.edu>
2915 2003-06-05 Fernando Perez <fperez@colorado.edu>
2908
2916
2909 * IPython/numutils.py (identity): new function, for building
2917 * IPython/numutils.py (identity): new function, for building
2910 arbitrary rank Kronecker deltas (mostly backwards compatible with
2918 arbitrary rank Kronecker deltas (mostly backwards compatible with
2911 Numeric.identity)
2919 Numeric.identity)
2912
2920
2913 2003-06-03 Fernando Perez <fperez@colorado.edu>
2921 2003-06-03 Fernando Perez <fperez@colorado.edu>
2914
2922
2915 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2923 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2916 arguments passed to magics with spaces, to allow trailing '\' to
2924 arguments passed to magics with spaces, to allow trailing '\' to
2917 work normally (mainly for Windows users).
2925 work normally (mainly for Windows users).
2918
2926
2919 2003-05-29 Fernando Perez <fperez@colorado.edu>
2927 2003-05-29 Fernando Perez <fperez@colorado.edu>
2920
2928
2921 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2929 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2922 instead of pydoc.help. This fixes a bizarre behavior where
2930 instead of pydoc.help. This fixes a bizarre behavior where
2923 printing '%s' % locals() would trigger the help system. Now
2931 printing '%s' % locals() would trigger the help system. Now
2924 ipython behaves like normal python does.
2932 ipython behaves like normal python does.
2925
2933
2926 Note that if one does 'from pydoc import help', the bizarre
2934 Note that if one does 'from pydoc import help', the bizarre
2927 behavior returns, but this will also happen in normal python, so
2935 behavior returns, but this will also happen in normal python, so
2928 it's not an ipython bug anymore (it has to do with how pydoc.help
2936 it's not an ipython bug anymore (it has to do with how pydoc.help
2929 is implemented).
2937 is implemented).
2930
2938
2931 2003-05-22 Fernando Perez <fperez@colorado.edu>
2939 2003-05-22 Fernando Perez <fperez@colorado.edu>
2932
2940
2933 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2941 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2934 return [] instead of None when nothing matches, also match to end
2942 return [] instead of None when nothing matches, also match to end
2935 of line. Patch by Gary Bishop.
2943 of line. Patch by Gary Bishop.
2936
2944
2937 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2945 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2938 protection as before, for files passed on the command line. This
2946 protection as before, for files passed on the command line. This
2939 prevents the CrashHandler from kicking in if user files call into
2947 prevents the CrashHandler from kicking in if user files call into
2940 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2948 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2941 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2949 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2942
2950
2943 2003-05-20 *** Released version 0.4.0
2951 2003-05-20 *** Released version 0.4.0
2944
2952
2945 2003-05-20 Fernando Perez <fperez@colorado.edu>
2953 2003-05-20 Fernando Perez <fperez@colorado.edu>
2946
2954
2947 * setup.py: added support for manpages. It's a bit hackish b/c of
2955 * setup.py: added support for manpages. It's a bit hackish b/c of
2948 a bug in the way the bdist_rpm distutils target handles gzipped
2956 a bug in the way the bdist_rpm distutils target handles gzipped
2949 manpages, but it works. After a patch by Jack.
2957 manpages, but it works. After a patch by Jack.
2950
2958
2951 2003-05-19 Fernando Perez <fperez@colorado.edu>
2959 2003-05-19 Fernando Perez <fperez@colorado.edu>
2952
2960
2953 * IPython/numutils.py: added a mockup of the kinds module, since
2961 * IPython/numutils.py: added a mockup of the kinds module, since
2954 it was recently removed from Numeric. This way, numutils will
2962 it was recently removed from Numeric. This way, numutils will
2955 work for all users even if they are missing kinds.
2963 work for all users even if they are missing kinds.
2956
2964
2957 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2965 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2958 failure, which can occur with SWIG-wrapped extensions. After a
2966 failure, which can occur with SWIG-wrapped extensions. After a
2959 crash report from Prabhu.
2967 crash report from Prabhu.
2960
2968
2961 2003-05-16 Fernando Perez <fperez@colorado.edu>
2969 2003-05-16 Fernando Perez <fperez@colorado.edu>
2962
2970
2963 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2971 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2964 protect ipython from user code which may call directly
2972 protect ipython from user code which may call directly
2965 sys.excepthook (this looks like an ipython crash to the user, even
2973 sys.excepthook (this looks like an ipython crash to the user, even
2966 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2974 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2967 This is especially important to help users of WxWindows, but may
2975 This is especially important to help users of WxWindows, but may
2968 also be useful in other cases.
2976 also be useful in other cases.
2969
2977
2970 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2978 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2971 an optional tb_offset to be specified, and to preserve exception
2979 an optional tb_offset to be specified, and to preserve exception
2972 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2980 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2973
2981
2974 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2982 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2975
2983
2976 2003-05-15 Fernando Perez <fperez@colorado.edu>
2984 2003-05-15 Fernando Perez <fperez@colorado.edu>
2977
2985
2978 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2986 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2979 installing for a new user under Windows.
2987 installing for a new user under Windows.
2980
2988
2981 2003-05-12 Fernando Perez <fperez@colorado.edu>
2989 2003-05-12 Fernando Perez <fperez@colorado.edu>
2982
2990
2983 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2991 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2984 handler for Emacs comint-based lines. Currently it doesn't do
2992 handler for Emacs comint-based lines. Currently it doesn't do
2985 much (but importantly, it doesn't update the history cache). In
2993 much (but importantly, it doesn't update the history cache). In
2986 the future it may be expanded if Alex needs more functionality
2994 the future it may be expanded if Alex needs more functionality
2987 there.
2995 there.
2988
2996
2989 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2997 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2990 info to crash reports.
2998 info to crash reports.
2991
2999
2992 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3000 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2993 just like Python's -c. Also fixed crash with invalid -color
3001 just like Python's -c. Also fixed crash with invalid -color
2994 option value at startup. Thanks to Will French
3002 option value at startup. Thanks to Will French
2995 <wfrench-AT-bestweb.net> for the bug report.
3003 <wfrench-AT-bestweb.net> for the bug report.
2996
3004
2997 2003-05-09 Fernando Perez <fperez@colorado.edu>
3005 2003-05-09 Fernando Perez <fperez@colorado.edu>
2998
3006
2999 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3007 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3000 to EvalDict (it's a mapping, after all) and simplified its code
3008 to EvalDict (it's a mapping, after all) and simplified its code
3001 quite a bit, after a nice discussion on c.l.py where Gustavo
3009 quite a bit, after a nice discussion on c.l.py where Gustavo
3002 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3010 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3003
3011
3004 2003-04-30 Fernando Perez <fperez@colorado.edu>
3012 2003-04-30 Fernando Perez <fperez@colorado.edu>
3005
3013
3006 * IPython/genutils.py (timings_out): modified it to reduce its
3014 * IPython/genutils.py (timings_out): modified it to reduce its
3007 overhead in the common reps==1 case.
3015 overhead in the common reps==1 case.
3008
3016
3009 2003-04-29 Fernando Perez <fperez@colorado.edu>
3017 2003-04-29 Fernando Perez <fperez@colorado.edu>
3010
3018
3011 * IPython/genutils.py (timings_out): Modified to use the resource
3019 * IPython/genutils.py (timings_out): Modified to use the resource
3012 module, which avoids the wraparound problems of time.clock().
3020 module, which avoids the wraparound problems of time.clock().
3013
3021
3014 2003-04-17 *** Released version 0.2.15pre4
3022 2003-04-17 *** Released version 0.2.15pre4
3015
3023
3016 2003-04-17 Fernando Perez <fperez@colorado.edu>
3024 2003-04-17 Fernando Perez <fperez@colorado.edu>
3017
3025
3018 * setup.py (scriptfiles): Split windows-specific stuff over to a
3026 * setup.py (scriptfiles): Split windows-specific stuff over to a
3019 separate file, in an attempt to have a Windows GUI installer.
3027 separate file, in an attempt to have a Windows GUI installer.
3020 That didn't work, but part of the groundwork is done.
3028 That didn't work, but part of the groundwork is done.
3021
3029
3022 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3030 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3023 indent/unindent with 4 spaces. Particularly useful in combination
3031 indent/unindent with 4 spaces. Particularly useful in combination
3024 with the new auto-indent option.
3032 with the new auto-indent option.
3025
3033
3026 2003-04-16 Fernando Perez <fperez@colorado.edu>
3034 2003-04-16 Fernando Perez <fperez@colorado.edu>
3027
3035
3028 * IPython/Magic.py: various replacements of self.rc for
3036 * IPython/Magic.py: various replacements of self.rc for
3029 self.shell.rc. A lot more remains to be done to fully disentangle
3037 self.shell.rc. A lot more remains to be done to fully disentangle
3030 this class from the main Shell class.
3038 this class from the main Shell class.
3031
3039
3032 * IPython/GnuplotRuntime.py: added checks for mouse support so
3040 * IPython/GnuplotRuntime.py: added checks for mouse support so
3033 that we don't try to enable it if the current gnuplot doesn't
3041 that we don't try to enable it if the current gnuplot doesn't
3034 really support it. Also added checks so that we don't try to
3042 really support it. Also added checks so that we don't try to
3035 enable persist under Windows (where Gnuplot doesn't recognize the
3043 enable persist under Windows (where Gnuplot doesn't recognize the
3036 option).
3044 option).
3037
3045
3038 * IPython/iplib.py (InteractiveShell.interact): Added optional
3046 * IPython/iplib.py (InteractiveShell.interact): Added optional
3039 auto-indenting code, after a patch by King C. Shu
3047 auto-indenting code, after a patch by King C. Shu
3040 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3048 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3041 get along well with pasting indented code. If I ever figure out
3049 get along well with pasting indented code. If I ever figure out
3042 how to make that part go well, it will become on by default.
3050 how to make that part go well, it will become on by default.
3043
3051
3044 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3052 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3045 crash ipython if there was an unmatched '%' in the user's prompt
3053 crash ipython if there was an unmatched '%' in the user's prompt
3046 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3054 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3047
3055
3048 * IPython/iplib.py (InteractiveShell.interact): removed the
3056 * IPython/iplib.py (InteractiveShell.interact): removed the
3049 ability to ask the user whether he wants to crash or not at the
3057 ability to ask the user whether he wants to crash or not at the
3050 'last line' exception handler. Calling functions at that point
3058 'last line' exception handler. Calling functions at that point
3051 changes the stack, and the error reports would have incorrect
3059 changes the stack, and the error reports would have incorrect
3052 tracebacks.
3060 tracebacks.
3053
3061
3054 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3062 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3055 pass through a peger a pretty-printed form of any object. After a
3063 pass through a peger a pretty-printed form of any object. After a
3056 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3064 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3057
3065
3058 2003-04-14 Fernando Perez <fperez@colorado.edu>
3066 2003-04-14 Fernando Perez <fperez@colorado.edu>
3059
3067
3060 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3068 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3061 all files in ~ would be modified at first install (instead of
3069 all files in ~ would be modified at first install (instead of
3062 ~/.ipython). This could be potentially disastrous, as the
3070 ~/.ipython). This could be potentially disastrous, as the
3063 modification (make line-endings native) could damage binary files.
3071 modification (make line-endings native) could damage binary files.
3064
3072
3065 2003-04-10 Fernando Perez <fperez@colorado.edu>
3073 2003-04-10 Fernando Perez <fperez@colorado.edu>
3066
3074
3067 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3075 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3068 handle only lines which are invalid python. This now means that
3076 handle only lines which are invalid python. This now means that
3069 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3077 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3070 for the bug report.
3078 for the bug report.
3071
3079
3072 2003-04-01 Fernando Perez <fperez@colorado.edu>
3080 2003-04-01 Fernando Perez <fperez@colorado.edu>
3073
3081
3074 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3082 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3075 where failing to set sys.last_traceback would crash pdb.pm().
3083 where failing to set sys.last_traceback would crash pdb.pm().
3076 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3084 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3077 report.
3085 report.
3078
3086
3079 2003-03-25 Fernando Perez <fperez@colorado.edu>
3087 2003-03-25 Fernando Perez <fperez@colorado.edu>
3080
3088
3081 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3089 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3082 before printing it (it had a lot of spurious blank lines at the
3090 before printing it (it had a lot of spurious blank lines at the
3083 end).
3091 end).
3084
3092
3085 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3093 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3086 output would be sent 21 times! Obviously people don't use this
3094 output would be sent 21 times! Obviously people don't use this
3087 too often, or I would have heard about it.
3095 too often, or I would have heard about it.
3088
3096
3089 2003-03-24 Fernando Perez <fperez@colorado.edu>
3097 2003-03-24 Fernando Perez <fperez@colorado.edu>
3090
3098
3091 * setup.py (scriptfiles): renamed the data_files parameter from
3099 * setup.py (scriptfiles): renamed the data_files parameter from
3092 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3100 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3093 for the patch.
3101 for the patch.
3094
3102
3095 2003-03-20 Fernando Perez <fperez@colorado.edu>
3103 2003-03-20 Fernando Perez <fperez@colorado.edu>
3096
3104
3097 * IPython/genutils.py (error): added error() and fatal()
3105 * IPython/genutils.py (error): added error() and fatal()
3098 functions.
3106 functions.
3099
3107
3100 2003-03-18 *** Released version 0.2.15pre3
3108 2003-03-18 *** Released version 0.2.15pre3
3101
3109
3102 2003-03-18 Fernando Perez <fperez@colorado.edu>
3110 2003-03-18 Fernando Perez <fperez@colorado.edu>
3103
3111
3104 * setupext/install_data_ext.py
3112 * setupext/install_data_ext.py
3105 (install_data_ext.initialize_options): Class contributed by Jack
3113 (install_data_ext.initialize_options): Class contributed by Jack
3106 Moffit for fixing the old distutils hack. He is sending this to
3114 Moffit for fixing the old distutils hack. He is sending this to
3107 the distutils folks so in the future we may not need it as a
3115 the distutils folks so in the future we may not need it as a
3108 private fix.
3116 private fix.
3109
3117
3110 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3118 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3111 changes for Debian packaging. See his patch for full details.
3119 changes for Debian packaging. See his patch for full details.
3112 The old distutils hack of making the ipythonrc* files carry a
3120 The old distutils hack of making the ipythonrc* files carry a
3113 bogus .py extension is gone, at last. Examples were moved to a
3121 bogus .py extension is gone, at last. Examples were moved to a
3114 separate subdir under doc/, and the separate executable scripts
3122 separate subdir under doc/, and the separate executable scripts
3115 now live in their own directory. Overall a great cleanup. The
3123 now live in their own directory. Overall a great cleanup. The
3116 manual was updated to use the new files, and setup.py has been
3124 manual was updated to use the new files, and setup.py has been
3117 fixed for this setup.
3125 fixed for this setup.
3118
3126
3119 * IPython/PyColorize.py (Parser.usage): made non-executable and
3127 * IPython/PyColorize.py (Parser.usage): made non-executable and
3120 created a pycolor wrapper around it to be included as a script.
3128 created a pycolor wrapper around it to be included as a script.
3121
3129
3122 2003-03-12 *** Released version 0.2.15pre2
3130 2003-03-12 *** Released version 0.2.15pre2
3123
3131
3124 2003-03-12 Fernando Perez <fperez@colorado.edu>
3132 2003-03-12 Fernando Perez <fperez@colorado.edu>
3125
3133
3126 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3134 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3127 long-standing problem with garbage characters in some terminals.
3135 long-standing problem with garbage characters in some terminals.
3128 The issue was really that the \001 and \002 escapes must _only_ be
3136 The issue was really that the \001 and \002 escapes must _only_ be
3129 passed to input prompts (which call readline), but _never_ to
3137 passed to input prompts (which call readline), but _never_ to
3130 normal text to be printed on screen. I changed ColorANSI to have
3138 normal text to be printed on screen. I changed ColorANSI to have
3131 two classes: TermColors and InputTermColors, each with the
3139 two classes: TermColors and InputTermColors, each with the
3132 appropriate escapes for input prompts or normal text. The code in
3140 appropriate escapes for input prompts or normal text. The code in
3133 Prompts.py got slightly more complicated, but this very old and
3141 Prompts.py got slightly more complicated, but this very old and
3134 annoying bug is finally fixed.
3142 annoying bug is finally fixed.
3135
3143
3136 All the credit for nailing down the real origin of this problem
3144 All the credit for nailing down the real origin of this problem
3137 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3145 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3138 *Many* thanks to him for spending quite a bit of effort on this.
3146 *Many* thanks to him for spending quite a bit of effort on this.
3139
3147
3140 2003-03-05 *** Released version 0.2.15pre1
3148 2003-03-05 *** Released version 0.2.15pre1
3141
3149
3142 2003-03-03 Fernando Perez <fperez@colorado.edu>
3150 2003-03-03 Fernando Perez <fperez@colorado.edu>
3143
3151
3144 * IPython/FakeModule.py: Moved the former _FakeModule to a
3152 * IPython/FakeModule.py: Moved the former _FakeModule to a
3145 separate file, because it's also needed by Magic (to fix a similar
3153 separate file, because it's also needed by Magic (to fix a similar
3146 pickle-related issue in @run).
3154 pickle-related issue in @run).
3147
3155
3148 2003-03-02 Fernando Perez <fperez@colorado.edu>
3156 2003-03-02 Fernando Perez <fperez@colorado.edu>
3149
3157
3150 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3158 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3151 the autocall option at runtime.
3159 the autocall option at runtime.
3152 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3160 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3153 across Magic.py to start separating Magic from InteractiveShell.
3161 across Magic.py to start separating Magic from InteractiveShell.
3154 (Magic._ofind): Fixed to return proper namespace for dotted
3162 (Magic._ofind): Fixed to return proper namespace for dotted
3155 names. Before, a dotted name would always return 'not currently
3163 names. Before, a dotted name would always return 'not currently
3156 defined', because it would find the 'parent'. s.x would be found,
3164 defined', because it would find the 'parent'. s.x would be found,
3157 but since 'x' isn't defined by itself, it would get confused.
3165 but since 'x' isn't defined by itself, it would get confused.
3158 (Magic.magic_run): Fixed pickling problems reported by Ralf
3166 (Magic.magic_run): Fixed pickling problems reported by Ralf
3159 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3167 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3160 that I'd used when Mike Heeter reported similar issues at the
3168 that I'd used when Mike Heeter reported similar issues at the
3161 top-level, but now for @run. It boils down to injecting the
3169 top-level, but now for @run. It boils down to injecting the
3162 namespace where code is being executed with something that looks
3170 namespace where code is being executed with something that looks
3163 enough like a module to fool pickle.dump(). Since a pickle stores
3171 enough like a module to fool pickle.dump(). Since a pickle stores
3164 a named reference to the importing module, we need this for
3172 a named reference to the importing module, we need this for
3165 pickles to save something sensible.
3173 pickles to save something sensible.
3166
3174
3167 * IPython/ipmaker.py (make_IPython): added an autocall option.
3175 * IPython/ipmaker.py (make_IPython): added an autocall option.
3168
3176
3169 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3177 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3170 the auto-eval code. Now autocalling is an option, and the code is
3178 the auto-eval code. Now autocalling is an option, and the code is
3171 also vastly safer. There is no more eval() involved at all.
3179 also vastly safer. There is no more eval() involved at all.
3172
3180
3173 2003-03-01 Fernando Perez <fperez@colorado.edu>
3181 2003-03-01 Fernando Perez <fperez@colorado.edu>
3174
3182
3175 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3183 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3176 dict with named keys instead of a tuple.
3184 dict with named keys instead of a tuple.
3177
3185
3178 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3186 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3179
3187
3180 * setup.py (make_shortcut): Fixed message about directories
3188 * setup.py (make_shortcut): Fixed message about directories
3181 created during Windows installation (the directories were ok, just
3189 created during Windows installation (the directories were ok, just
3182 the printed message was misleading). Thanks to Chris Liechti
3190 the printed message was misleading). Thanks to Chris Liechti
3183 <cliechti-AT-gmx.net> for the heads up.
3191 <cliechti-AT-gmx.net> for the heads up.
3184
3192
3185 2003-02-21 Fernando Perez <fperez@colorado.edu>
3193 2003-02-21 Fernando Perez <fperez@colorado.edu>
3186
3194
3187 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3195 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3188 of ValueError exception when checking for auto-execution. This
3196 of ValueError exception when checking for auto-execution. This
3189 one is raised by things like Numeric arrays arr.flat when the
3197 one is raised by things like Numeric arrays arr.flat when the
3190 array is non-contiguous.
3198 array is non-contiguous.
3191
3199
3192 2003-01-31 Fernando Perez <fperez@colorado.edu>
3200 2003-01-31 Fernando Perez <fperez@colorado.edu>
3193
3201
3194 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3202 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3195 not return any value at all (even though the command would get
3203 not return any value at all (even though the command would get
3196 executed).
3204 executed).
3197 (xsys): Flush stdout right after printing the command to ensure
3205 (xsys): Flush stdout right after printing the command to ensure
3198 proper ordering of commands and command output in the total
3206 proper ordering of commands and command output in the total
3199 output.
3207 output.
3200 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3208 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3201 system/getoutput as defaults. The old ones are kept for
3209 system/getoutput as defaults. The old ones are kept for
3202 compatibility reasons, so no code which uses this library needs
3210 compatibility reasons, so no code which uses this library needs
3203 changing.
3211 changing.
3204
3212
3205 2003-01-27 *** Released version 0.2.14
3213 2003-01-27 *** Released version 0.2.14
3206
3214
3207 2003-01-25 Fernando Perez <fperez@colorado.edu>
3215 2003-01-25 Fernando Perez <fperez@colorado.edu>
3208
3216
3209 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3217 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3210 functions defined in previous edit sessions could not be re-edited
3218 functions defined in previous edit sessions could not be re-edited
3211 (because the temp files were immediately removed). Now temp files
3219 (because the temp files were immediately removed). Now temp files
3212 are removed only at IPython's exit.
3220 are removed only at IPython's exit.
3213 (Magic.magic_run): Improved @run to perform shell-like expansions
3221 (Magic.magic_run): Improved @run to perform shell-like expansions
3214 on its arguments (~users and $VARS). With this, @run becomes more
3222 on its arguments (~users and $VARS). With this, @run becomes more
3215 like a normal command-line.
3223 like a normal command-line.
3216
3224
3217 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3225 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3218 bugs related to embedding and cleaned up that code. A fairly
3226 bugs related to embedding and cleaned up that code. A fairly
3219 important one was the impossibility to access the global namespace
3227 important one was the impossibility to access the global namespace
3220 through the embedded IPython (only local variables were visible).
3228 through the embedded IPython (only local variables were visible).
3221
3229
3222 2003-01-14 Fernando Perez <fperez@colorado.edu>
3230 2003-01-14 Fernando Perez <fperez@colorado.edu>
3223
3231
3224 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3232 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3225 auto-calling to be a bit more conservative. Now it doesn't get
3233 auto-calling to be a bit more conservative. Now it doesn't get
3226 triggered if any of '!=()<>' are in the rest of the input line, to
3234 triggered if any of '!=()<>' are in the rest of the input line, to
3227 allow comparing callables. Thanks to Alex for the heads up.
3235 allow comparing callables. Thanks to Alex for the heads up.
3228
3236
3229 2003-01-07 Fernando Perez <fperez@colorado.edu>
3237 2003-01-07 Fernando Perez <fperez@colorado.edu>
3230
3238
3231 * IPython/genutils.py (page): fixed estimation of the number of
3239 * IPython/genutils.py (page): fixed estimation of the number of
3232 lines in a string to be paged to simply count newlines. This
3240 lines in a string to be paged to simply count newlines. This
3233 prevents over-guessing due to embedded escape sequences. A better
3241 prevents over-guessing due to embedded escape sequences. A better
3234 long-term solution would involve stripping out the control chars
3242 long-term solution would involve stripping out the control chars
3235 for the count, but it's potentially so expensive I just don't
3243 for the count, but it's potentially so expensive I just don't
3236 think it's worth doing.
3244 think it's worth doing.
3237
3245
3238 2002-12-19 *** Released version 0.2.14pre50
3246 2002-12-19 *** Released version 0.2.14pre50
3239
3247
3240 2002-12-19 Fernando Perez <fperez@colorado.edu>
3248 2002-12-19 Fernando Perez <fperez@colorado.edu>
3241
3249
3242 * tools/release (version): Changed release scripts to inform
3250 * tools/release (version): Changed release scripts to inform
3243 Andrea and build a NEWS file with a list of recent changes.
3251 Andrea and build a NEWS file with a list of recent changes.
3244
3252
3245 * IPython/ColorANSI.py (__all__): changed terminal detection
3253 * IPython/ColorANSI.py (__all__): changed terminal detection
3246 code. Seems to work better for xterms without breaking
3254 code. Seems to work better for xterms without breaking
3247 konsole. Will need more testing to determine if WinXP and Mac OSX
3255 konsole. Will need more testing to determine if WinXP and Mac OSX
3248 also work ok.
3256 also work ok.
3249
3257
3250 2002-12-18 *** Released version 0.2.14pre49
3258 2002-12-18 *** Released version 0.2.14pre49
3251
3259
3252 2002-12-18 Fernando Perez <fperez@colorado.edu>
3260 2002-12-18 Fernando Perez <fperez@colorado.edu>
3253
3261
3254 * Docs: added new info about Mac OSX, from Andrea.
3262 * Docs: added new info about Mac OSX, from Andrea.
3255
3263
3256 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3264 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3257 allow direct plotting of python strings whose format is the same
3265 allow direct plotting of python strings whose format is the same
3258 of gnuplot data files.
3266 of gnuplot data files.
3259
3267
3260 2002-12-16 Fernando Perez <fperez@colorado.edu>
3268 2002-12-16 Fernando Perez <fperez@colorado.edu>
3261
3269
3262 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3270 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3263 value of exit question to be acknowledged.
3271 value of exit question to be acknowledged.
3264
3272
3265 2002-12-03 Fernando Perez <fperez@colorado.edu>
3273 2002-12-03 Fernando Perez <fperez@colorado.edu>
3266
3274
3267 * IPython/ipmaker.py: removed generators, which had been added
3275 * IPython/ipmaker.py: removed generators, which had been added
3268 by mistake in an earlier debugging run. This was causing trouble
3276 by mistake in an earlier debugging run. This was causing trouble
3269 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3277 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3270 for pointing this out.
3278 for pointing this out.
3271
3279
3272 2002-11-17 Fernando Perez <fperez@colorado.edu>
3280 2002-11-17 Fernando Perez <fperez@colorado.edu>
3273
3281
3274 * Manual: updated the Gnuplot section.
3282 * Manual: updated the Gnuplot section.
3275
3283
3276 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3284 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3277 a much better split of what goes in Runtime and what goes in
3285 a much better split of what goes in Runtime and what goes in
3278 Interactive.
3286 Interactive.
3279
3287
3280 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3288 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3281 being imported from iplib.
3289 being imported from iplib.
3282
3290
3283 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3291 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3284 for command-passing. Now the global Gnuplot instance is called
3292 for command-passing. Now the global Gnuplot instance is called
3285 'gp' instead of 'g', which was really a far too fragile and
3293 'gp' instead of 'g', which was really a far too fragile and
3286 common name.
3294 common name.
3287
3295
3288 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3296 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3289 bounding boxes generated by Gnuplot for square plots.
3297 bounding boxes generated by Gnuplot for square plots.
3290
3298
3291 * IPython/genutils.py (popkey): new function added. I should
3299 * IPython/genutils.py (popkey): new function added. I should
3292 suggest this on c.l.py as a dict method, it seems useful.
3300 suggest this on c.l.py as a dict method, it seems useful.
3293
3301
3294 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3302 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3295 to transparently handle PostScript generation. MUCH better than
3303 to transparently handle PostScript generation. MUCH better than
3296 the previous plot_eps/replot_eps (which I removed now). The code
3304 the previous plot_eps/replot_eps (which I removed now). The code
3297 is also fairly clean and well documented now (including
3305 is also fairly clean and well documented now (including
3298 docstrings).
3306 docstrings).
3299
3307
3300 2002-11-13 Fernando Perez <fperez@colorado.edu>
3308 2002-11-13 Fernando Perez <fperez@colorado.edu>
3301
3309
3302 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3310 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3303 (inconsistent with options).
3311 (inconsistent with options).
3304
3312
3305 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3313 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3306 manually disabled, I don't know why. Fixed it.
3314 manually disabled, I don't know why. Fixed it.
3307 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3315 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3308 eps output.
3316 eps output.
3309
3317
3310 2002-11-12 Fernando Perez <fperez@colorado.edu>
3318 2002-11-12 Fernando Perez <fperez@colorado.edu>
3311
3319
3312 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3320 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3313 don't propagate up to caller. Fixes crash reported by François
3321 don't propagate up to caller. Fixes crash reported by François
3314 Pinard.
3322 Pinard.
3315
3323
3316 2002-11-09 Fernando Perez <fperez@colorado.edu>
3324 2002-11-09 Fernando Perez <fperez@colorado.edu>
3317
3325
3318 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3326 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3319 history file for new users.
3327 history file for new users.
3320 (make_IPython): fixed bug where initial install would leave the
3328 (make_IPython): fixed bug where initial install would leave the
3321 user running in the .ipython dir.
3329 user running in the .ipython dir.
3322 (make_IPython): fixed bug where config dir .ipython would be
3330 (make_IPython): fixed bug where config dir .ipython would be
3323 created regardless of the given -ipythondir option. Thanks to Cory
3331 created regardless of the given -ipythondir option. Thanks to Cory
3324 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3332 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3325
3333
3326 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3334 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3327 type confirmations. Will need to use it in all of IPython's code
3335 type confirmations. Will need to use it in all of IPython's code
3328 consistently.
3336 consistently.
3329
3337
3330 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3338 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3331 context to print 31 lines instead of the default 5. This will make
3339 context to print 31 lines instead of the default 5. This will make
3332 the crash reports extremely detailed in case the problem is in
3340 the crash reports extremely detailed in case the problem is in
3333 libraries I don't have access to.
3341 libraries I don't have access to.
3334
3342
3335 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3343 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3336 line of defense' code to still crash, but giving users fair
3344 line of defense' code to still crash, but giving users fair
3337 warning. I don't want internal errors to go unreported: if there's
3345 warning. I don't want internal errors to go unreported: if there's
3338 an internal problem, IPython should crash and generate a full
3346 an internal problem, IPython should crash and generate a full
3339 report.
3347 report.
3340
3348
3341 2002-11-08 Fernando Perez <fperez@colorado.edu>
3349 2002-11-08 Fernando Perez <fperez@colorado.edu>
3342
3350
3343 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3351 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3344 otherwise uncaught exceptions which can appear if people set
3352 otherwise uncaught exceptions which can appear if people set
3345 sys.stdout to something badly broken. Thanks to a crash report
3353 sys.stdout to something badly broken. Thanks to a crash report
3346 from henni-AT-mail.brainbot.com.
3354 from henni-AT-mail.brainbot.com.
3347
3355
3348 2002-11-04 Fernando Perez <fperez@colorado.edu>
3356 2002-11-04 Fernando Perez <fperez@colorado.edu>
3349
3357
3350 * IPython/iplib.py (InteractiveShell.interact): added
3358 * IPython/iplib.py (InteractiveShell.interact): added
3351 __IPYTHON__active to the builtins. It's a flag which goes on when
3359 __IPYTHON__active to the builtins. It's a flag which goes on when
3352 the interaction starts and goes off again when it stops. This
3360 the interaction starts and goes off again when it stops. This
3353 allows embedding code to detect being inside IPython. Before this
3361 allows embedding code to detect being inside IPython. Before this
3354 was done via __IPYTHON__, but that only shows that an IPython
3362 was done via __IPYTHON__, but that only shows that an IPython
3355 instance has been created.
3363 instance has been created.
3356
3364
3357 * IPython/Magic.py (Magic.magic_env): I realized that in a
3365 * IPython/Magic.py (Magic.magic_env): I realized that in a
3358 UserDict, instance.data holds the data as a normal dict. So I
3366 UserDict, instance.data holds the data as a normal dict. So I
3359 modified @env to return os.environ.data instead of rebuilding a
3367 modified @env to return os.environ.data instead of rebuilding a
3360 dict by hand.
3368 dict by hand.
3361
3369
3362 2002-11-02 Fernando Perez <fperez@colorado.edu>
3370 2002-11-02 Fernando Perez <fperez@colorado.edu>
3363
3371
3364 * IPython/genutils.py (warn): changed so that level 1 prints no
3372 * IPython/genutils.py (warn): changed so that level 1 prints no
3365 header. Level 2 is now the default (with 'WARNING' header, as
3373 header. Level 2 is now the default (with 'WARNING' header, as
3366 before). I think I tracked all places where changes were needed in
3374 before). I think I tracked all places where changes were needed in
3367 IPython, but outside code using the old level numbering may have
3375 IPython, but outside code using the old level numbering may have
3368 broken.
3376 broken.
3369
3377
3370 * IPython/iplib.py (InteractiveShell.runcode): added this to
3378 * IPython/iplib.py (InteractiveShell.runcode): added this to
3371 handle the tracebacks in SystemExit traps correctly. The previous
3379 handle the tracebacks in SystemExit traps correctly. The previous
3372 code (through interact) was printing more of the stack than
3380 code (through interact) was printing more of the stack than
3373 necessary, showing IPython internal code to the user.
3381 necessary, showing IPython internal code to the user.
3374
3382
3375 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3383 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3376 default. Now that the default at the confirmation prompt is yes,
3384 default. Now that the default at the confirmation prompt is yes,
3377 it's not so intrusive. François' argument that ipython sessions
3385 it's not so intrusive. François' argument that ipython sessions
3378 tend to be complex enough not to lose them from an accidental C-d,
3386 tend to be complex enough not to lose them from an accidental C-d,
3379 is a valid one.
3387 is a valid one.
3380
3388
3381 * IPython/iplib.py (InteractiveShell.interact): added a
3389 * IPython/iplib.py (InteractiveShell.interact): added a
3382 showtraceback() call to the SystemExit trap, and modified the exit
3390 showtraceback() call to the SystemExit trap, and modified the exit
3383 confirmation to have yes as the default.
3391 confirmation to have yes as the default.
3384
3392
3385 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3393 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3386 this file. It's been gone from the code for a long time, this was
3394 this file. It's been gone from the code for a long time, this was
3387 simply leftover junk.
3395 simply leftover junk.
3388
3396
3389 2002-11-01 Fernando Perez <fperez@colorado.edu>
3397 2002-11-01 Fernando Perez <fperez@colorado.edu>
3390
3398
3391 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3399 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3392 added. If set, IPython now traps EOF and asks for
3400 added. If set, IPython now traps EOF and asks for
3393 confirmation. After a request by François Pinard.
3401 confirmation. After a request by François Pinard.
3394
3402
3395 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3403 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3396 of @abort, and with a new (better) mechanism for handling the
3404 of @abort, and with a new (better) mechanism for handling the
3397 exceptions.
3405 exceptions.
3398
3406
3399 2002-10-27 Fernando Perez <fperez@colorado.edu>
3407 2002-10-27 Fernando Perez <fperez@colorado.edu>
3400
3408
3401 * IPython/usage.py (__doc__): updated the --help information and
3409 * IPython/usage.py (__doc__): updated the --help information and
3402 the ipythonrc file to indicate that -log generates
3410 the ipythonrc file to indicate that -log generates
3403 ./ipython.log. Also fixed the corresponding info in @logstart.
3411 ./ipython.log. Also fixed the corresponding info in @logstart.
3404 This and several other fixes in the manuals thanks to reports by
3412 This and several other fixes in the manuals thanks to reports by
3405 François Pinard <pinard-AT-iro.umontreal.ca>.
3413 François Pinard <pinard-AT-iro.umontreal.ca>.
3406
3414
3407 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3415 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3408 refer to @logstart (instead of @log, which doesn't exist).
3416 refer to @logstart (instead of @log, which doesn't exist).
3409
3417
3410 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3418 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3411 AttributeError crash. Thanks to Christopher Armstrong
3419 AttributeError crash. Thanks to Christopher Armstrong
3412 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3420 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3413 introduced recently (in 0.2.14pre37) with the fix to the eval
3421 introduced recently (in 0.2.14pre37) with the fix to the eval
3414 problem mentioned below.
3422 problem mentioned below.
3415
3423
3416 2002-10-17 Fernando Perez <fperez@colorado.edu>
3424 2002-10-17 Fernando Perez <fperez@colorado.edu>
3417
3425
3418 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3426 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3419 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3427 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3420
3428
3421 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3429 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3422 this function to fix a problem reported by Alex Schmolck. He saw
3430 this function to fix a problem reported by Alex Schmolck. He saw
3423 it with list comprehensions and generators, which were getting
3431 it with list comprehensions and generators, which were getting
3424 called twice. The real problem was an 'eval' call in testing for
3432 called twice. The real problem was an 'eval' call in testing for
3425 automagic which was evaluating the input line silently.
3433 automagic which was evaluating the input line silently.
3426
3434
3427 This is a potentially very nasty bug, if the input has side
3435 This is a potentially very nasty bug, if the input has side
3428 effects which must not be repeated. The code is much cleaner now,
3436 effects which must not be repeated. The code is much cleaner now,
3429 without any blanket 'except' left and with a regexp test for
3437 without any blanket 'except' left and with a regexp test for
3430 actual function names.
3438 actual function names.
3431
3439
3432 But an eval remains, which I'm not fully comfortable with. I just
3440 But an eval remains, which I'm not fully comfortable with. I just
3433 don't know how to find out if an expression could be a callable in
3441 don't know how to find out if an expression could be a callable in
3434 the user's namespace without doing an eval on the string. However
3442 the user's namespace without doing an eval on the string. However
3435 that string is now much more strictly checked so that no code
3443 that string is now much more strictly checked so that no code
3436 slips by, so the eval should only happen for things that can
3444 slips by, so the eval should only happen for things that can
3437 really be only function/method names.
3445 really be only function/method names.
3438
3446
3439 2002-10-15 Fernando Perez <fperez@colorado.edu>
3447 2002-10-15 Fernando Perez <fperez@colorado.edu>
3440
3448
3441 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3449 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3442 OSX information to main manual, removed README_Mac_OSX file from
3450 OSX information to main manual, removed README_Mac_OSX file from
3443 distribution. Also updated credits for recent additions.
3451 distribution. Also updated credits for recent additions.
3444
3452
3445 2002-10-10 Fernando Perez <fperez@colorado.edu>
3453 2002-10-10 Fernando Perez <fperez@colorado.edu>
3446
3454
3447 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3455 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3448 terminal-related issues. Many thanks to Andrea Riciputi
3456 terminal-related issues. Many thanks to Andrea Riciputi
3449 <andrea.riciputi-AT-libero.it> for writing it.
3457 <andrea.riciputi-AT-libero.it> for writing it.
3450
3458
3451 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3459 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3452 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3460 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3453
3461
3454 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3462 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3455 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3463 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3456 <syver-en-AT-online.no> who both submitted patches for this problem.
3464 <syver-en-AT-online.no> who both submitted patches for this problem.
3457
3465
3458 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3466 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3459 global embedding to make sure that things don't overwrite user
3467 global embedding to make sure that things don't overwrite user
3460 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3468 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3461
3469
3462 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3470 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3463 compatibility. Thanks to Hayden Callow
3471 compatibility. Thanks to Hayden Callow
3464 <h.callow-AT-elec.canterbury.ac.nz>
3472 <h.callow-AT-elec.canterbury.ac.nz>
3465
3473
3466 2002-10-04 Fernando Perez <fperez@colorado.edu>
3474 2002-10-04 Fernando Perez <fperez@colorado.edu>
3467
3475
3468 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3476 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3469 Gnuplot.File objects.
3477 Gnuplot.File objects.
3470
3478
3471 2002-07-23 Fernando Perez <fperez@colorado.edu>
3479 2002-07-23 Fernando Perez <fperez@colorado.edu>
3472
3480
3473 * IPython/genutils.py (timing): Added timings() and timing() for
3481 * IPython/genutils.py (timing): Added timings() and timing() for
3474 quick access to the most commonly needed data, the execution
3482 quick access to the most commonly needed data, the execution
3475 times. Old timing() renamed to timings_out().
3483 times. Old timing() renamed to timings_out().
3476
3484
3477 2002-07-18 Fernando Perez <fperez@colorado.edu>
3485 2002-07-18 Fernando Perez <fperez@colorado.edu>
3478
3486
3479 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3487 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3480 bug with nested instances disrupting the parent's tab completion.
3488 bug with nested instances disrupting the parent's tab completion.
3481
3489
3482 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3490 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3483 all_completions code to begin the emacs integration.
3491 all_completions code to begin the emacs integration.
3484
3492
3485 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3493 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3486 argument to allow titling individual arrays when plotting.
3494 argument to allow titling individual arrays when plotting.
3487
3495
3488 2002-07-15 Fernando Perez <fperez@colorado.edu>
3496 2002-07-15 Fernando Perez <fperez@colorado.edu>
3489
3497
3490 * setup.py (make_shortcut): changed to retrieve the value of
3498 * setup.py (make_shortcut): changed to retrieve the value of
3491 'Program Files' directory from the registry (this value changes in
3499 'Program Files' directory from the registry (this value changes in
3492 non-english versions of Windows). Thanks to Thomas Fanslau
3500 non-english versions of Windows). Thanks to Thomas Fanslau
3493 <tfanslau-AT-gmx.de> for the report.
3501 <tfanslau-AT-gmx.de> for the report.
3494
3502
3495 2002-07-10 Fernando Perez <fperez@colorado.edu>
3503 2002-07-10 Fernando Perez <fperez@colorado.edu>
3496
3504
3497 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3505 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3498 a bug in pdb, which crashes if a line with only whitespace is
3506 a bug in pdb, which crashes if a line with only whitespace is
3499 entered. Bug report submitted to sourceforge.
3507 entered. Bug report submitted to sourceforge.
3500
3508
3501 2002-07-09 Fernando Perez <fperez@colorado.edu>
3509 2002-07-09 Fernando Perez <fperez@colorado.edu>
3502
3510
3503 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3511 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3504 reporting exceptions (it's a bug in inspect.py, I just set a
3512 reporting exceptions (it's a bug in inspect.py, I just set a
3505 workaround).
3513 workaround).
3506
3514
3507 2002-07-08 Fernando Perez <fperez@colorado.edu>
3515 2002-07-08 Fernando Perez <fperez@colorado.edu>
3508
3516
3509 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3517 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3510 __IPYTHON__ in __builtins__ to show up in user_ns.
3518 __IPYTHON__ in __builtins__ to show up in user_ns.
3511
3519
3512 2002-07-03 Fernando Perez <fperez@colorado.edu>
3520 2002-07-03 Fernando Perez <fperez@colorado.edu>
3513
3521
3514 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3522 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3515 name from @gp_set_instance to @gp_set_default.
3523 name from @gp_set_instance to @gp_set_default.
3516
3524
3517 * IPython/ipmaker.py (make_IPython): default editor value set to
3525 * IPython/ipmaker.py (make_IPython): default editor value set to
3518 '0' (a string), to match the rc file. Otherwise will crash when
3526 '0' (a string), to match the rc file. Otherwise will crash when
3519 .strip() is called on it.
3527 .strip() is called on it.
3520
3528
3521
3529
3522 2002-06-28 Fernando Perez <fperez@colorado.edu>
3530 2002-06-28 Fernando Perez <fperez@colorado.edu>
3523
3531
3524 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3532 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3525 of files in current directory when a file is executed via
3533 of files in current directory when a file is executed via
3526 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3534 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3527
3535
3528 * setup.py (manfiles): fix for rpm builds, submitted by RA
3536 * setup.py (manfiles): fix for rpm builds, submitted by RA
3529 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3537 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3530
3538
3531 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3539 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3532 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3540 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3533 string!). A. Schmolck caught this one.
3541 string!). A. Schmolck caught this one.
3534
3542
3535 2002-06-27 Fernando Perez <fperez@colorado.edu>
3543 2002-06-27 Fernando Perez <fperez@colorado.edu>
3536
3544
3537 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3545 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3538 defined files at the cmd line. __name__ wasn't being set to
3546 defined files at the cmd line. __name__ wasn't being set to
3539 __main__.
3547 __main__.
3540
3548
3541 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3549 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3542 regular lists and tuples besides Numeric arrays.
3550 regular lists and tuples besides Numeric arrays.
3543
3551
3544 * IPython/Prompts.py (CachedOutput.__call__): Added output
3552 * IPython/Prompts.py (CachedOutput.__call__): Added output
3545 supression for input ending with ';'. Similar to Mathematica and
3553 supression for input ending with ';'. Similar to Mathematica and
3546 Matlab. The _* vars and Out[] list are still updated, just like
3554 Matlab. The _* vars and Out[] list are still updated, just like
3547 Mathematica behaves.
3555 Mathematica behaves.
3548
3556
3549 2002-06-25 Fernando Perez <fperez@colorado.edu>
3557 2002-06-25 Fernando Perez <fperez@colorado.edu>
3550
3558
3551 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3559 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3552 .ini extensions for profiels under Windows.
3560 .ini extensions for profiels under Windows.
3553
3561
3554 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3562 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3555 string form. Fix contributed by Alexander Schmolck
3563 string form. Fix contributed by Alexander Schmolck
3556 <a.schmolck-AT-gmx.net>
3564 <a.schmolck-AT-gmx.net>
3557
3565
3558 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3566 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3559 pre-configured Gnuplot instance.
3567 pre-configured Gnuplot instance.
3560
3568
3561 2002-06-21 Fernando Perez <fperez@colorado.edu>
3569 2002-06-21 Fernando Perez <fperez@colorado.edu>
3562
3570
3563 * IPython/numutils.py (exp_safe): new function, works around the
3571 * IPython/numutils.py (exp_safe): new function, works around the
3564 underflow problems in Numeric.
3572 underflow problems in Numeric.
3565 (log2): New fn. Safe log in base 2: returns exact integer answer
3573 (log2): New fn. Safe log in base 2: returns exact integer answer
3566 for exact integer powers of 2.
3574 for exact integer powers of 2.
3567
3575
3568 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3576 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3569 properly.
3577 properly.
3570
3578
3571 2002-06-20 Fernando Perez <fperez@colorado.edu>
3579 2002-06-20 Fernando Perez <fperez@colorado.edu>
3572
3580
3573 * IPython/genutils.py (timing): new function like
3581 * IPython/genutils.py (timing): new function like
3574 Mathematica's. Similar to time_test, but returns more info.
3582 Mathematica's. Similar to time_test, but returns more info.
3575
3583
3576 2002-06-18 Fernando Perez <fperez@colorado.edu>
3584 2002-06-18 Fernando Perez <fperez@colorado.edu>
3577
3585
3578 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3586 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3579 according to Mike Heeter's suggestions.
3587 according to Mike Heeter's suggestions.
3580
3588
3581 2002-06-16 Fernando Perez <fperez@colorado.edu>
3589 2002-06-16 Fernando Perez <fperez@colorado.edu>
3582
3590
3583 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3591 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3584 system. GnuplotMagic is gone as a user-directory option. New files
3592 system. GnuplotMagic is gone as a user-directory option. New files
3585 make it easier to use all the gnuplot stuff both from external
3593 make it easier to use all the gnuplot stuff both from external
3586 programs as well as from IPython. Had to rewrite part of
3594 programs as well as from IPython. Had to rewrite part of
3587 hardcopy() b/c of a strange bug: often the ps files simply don't
3595 hardcopy() b/c of a strange bug: often the ps files simply don't
3588 get created, and require a repeat of the command (often several
3596 get created, and require a repeat of the command (often several
3589 times).
3597 times).
3590
3598
3591 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3599 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3592 resolve output channel at call time, so that if sys.stderr has
3600 resolve output channel at call time, so that if sys.stderr has
3593 been redirected by user this gets honored.
3601 been redirected by user this gets honored.
3594
3602
3595 2002-06-13 Fernando Perez <fperez@colorado.edu>
3603 2002-06-13 Fernando Perez <fperez@colorado.edu>
3596
3604
3597 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3605 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3598 IPShell. Kept a copy with the old names to avoid breaking people's
3606 IPShell. Kept a copy with the old names to avoid breaking people's
3599 embedded code.
3607 embedded code.
3600
3608
3601 * IPython/ipython: simplified it to the bare minimum after
3609 * IPython/ipython: simplified it to the bare minimum after
3602 Holger's suggestions. Added info about how to use it in
3610 Holger's suggestions. Added info about how to use it in
3603 PYTHONSTARTUP.
3611 PYTHONSTARTUP.
3604
3612
3605 * IPython/Shell.py (IPythonShell): changed the options passing
3613 * IPython/Shell.py (IPythonShell): changed the options passing
3606 from a string with funky %s replacements to a straight list. Maybe
3614 from a string with funky %s replacements to a straight list. Maybe
3607 a bit more typing, but it follows sys.argv conventions, so there's
3615 a bit more typing, but it follows sys.argv conventions, so there's
3608 less special-casing to remember.
3616 less special-casing to remember.
3609
3617
3610 2002-06-12 Fernando Perez <fperez@colorado.edu>
3618 2002-06-12 Fernando Perez <fperez@colorado.edu>
3611
3619
3612 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3620 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3613 command. Thanks to a suggestion by Mike Heeter.
3621 command. Thanks to a suggestion by Mike Heeter.
3614 (Magic.magic_pfile): added behavior to look at filenames if given
3622 (Magic.magic_pfile): added behavior to look at filenames if given
3615 arg is not a defined object.
3623 arg is not a defined object.
3616 (Magic.magic_save): New @save function to save code snippets. Also
3624 (Magic.magic_save): New @save function to save code snippets. Also
3617 a Mike Heeter idea.
3625 a Mike Heeter idea.
3618
3626
3619 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3627 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3620 plot() and replot(). Much more convenient now, especially for
3628 plot() and replot(). Much more convenient now, especially for
3621 interactive use.
3629 interactive use.
3622
3630
3623 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3631 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3624 filenames.
3632 filenames.
3625
3633
3626 2002-06-02 Fernando Perez <fperez@colorado.edu>
3634 2002-06-02 Fernando Perez <fperez@colorado.edu>
3627
3635
3628 * IPython/Struct.py (Struct.__init__): modified to admit
3636 * IPython/Struct.py (Struct.__init__): modified to admit
3629 initialization via another struct.
3637 initialization via another struct.
3630
3638
3631 * IPython/genutils.py (SystemExec.__init__): New stateful
3639 * IPython/genutils.py (SystemExec.__init__): New stateful
3632 interface to xsys and bq. Useful for writing system scripts.
3640 interface to xsys and bq. Useful for writing system scripts.
3633
3641
3634 2002-05-30 Fernando Perez <fperez@colorado.edu>
3642 2002-05-30 Fernando Perez <fperez@colorado.edu>
3635
3643
3636 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3644 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3637 documents. This will make the user download smaller (it's getting
3645 documents. This will make the user download smaller (it's getting
3638 too big).
3646 too big).
3639
3647
3640 2002-05-29 Fernando Perez <fperez@colorado.edu>
3648 2002-05-29 Fernando Perez <fperez@colorado.edu>
3641
3649
3642 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3650 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3643 fix problems with shelve and pickle. Seems to work, but I don't
3651 fix problems with shelve and pickle. Seems to work, but I don't
3644 know if corner cases break it. Thanks to Mike Heeter
3652 know if corner cases break it. Thanks to Mike Heeter
3645 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3653 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3646
3654
3647 2002-05-24 Fernando Perez <fperez@colorado.edu>
3655 2002-05-24 Fernando Perez <fperez@colorado.edu>
3648
3656
3649 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3657 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3650 macros having broken.
3658 macros having broken.
3651
3659
3652 2002-05-21 Fernando Perez <fperez@colorado.edu>
3660 2002-05-21 Fernando Perez <fperez@colorado.edu>
3653
3661
3654 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3662 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3655 introduced logging bug: all history before logging started was
3663 introduced logging bug: all history before logging started was
3656 being written one character per line! This came from the redesign
3664 being written one character per line! This came from the redesign
3657 of the input history as a special list which slices to strings,
3665 of the input history as a special list which slices to strings,
3658 not to lists.
3666 not to lists.
3659
3667
3660 2002-05-20 Fernando Perez <fperez@colorado.edu>
3668 2002-05-20 Fernando Perez <fperez@colorado.edu>
3661
3669
3662 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3670 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3663 be an attribute of all classes in this module. The design of these
3671 be an attribute of all classes in this module. The design of these
3664 classes needs some serious overhauling.
3672 classes needs some serious overhauling.
3665
3673
3666 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3674 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3667 which was ignoring '_' in option names.
3675 which was ignoring '_' in option names.
3668
3676
3669 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3677 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3670 'Verbose_novars' to 'Context' and made it the new default. It's a
3678 'Verbose_novars' to 'Context' and made it the new default. It's a
3671 bit more readable and also safer than verbose.
3679 bit more readable and also safer than verbose.
3672
3680
3673 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3681 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3674 triple-quoted strings.
3682 triple-quoted strings.
3675
3683
3676 * IPython/OInspect.py (__all__): new module exposing the object
3684 * IPython/OInspect.py (__all__): new module exposing the object
3677 introspection facilities. Now the corresponding magics are dummy
3685 introspection facilities. Now the corresponding magics are dummy
3678 wrappers around this. Having this module will make it much easier
3686 wrappers around this. Having this module will make it much easier
3679 to put these functions into our modified pdb.
3687 to put these functions into our modified pdb.
3680 This new object inspector system uses the new colorizing module,
3688 This new object inspector system uses the new colorizing module,
3681 so source code and other things are nicely syntax highlighted.
3689 so source code and other things are nicely syntax highlighted.
3682
3690
3683 2002-05-18 Fernando Perez <fperez@colorado.edu>
3691 2002-05-18 Fernando Perez <fperez@colorado.edu>
3684
3692
3685 * IPython/ColorANSI.py: Split the coloring tools into a separate
3693 * IPython/ColorANSI.py: Split the coloring tools into a separate
3686 module so I can use them in other code easier (they were part of
3694 module so I can use them in other code easier (they were part of
3687 ultraTB).
3695 ultraTB).
3688
3696
3689 2002-05-17 Fernando Perez <fperez@colorado.edu>
3697 2002-05-17 Fernando Perez <fperez@colorado.edu>
3690
3698
3691 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3699 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3692 fixed it to set the global 'g' also to the called instance, as
3700 fixed it to set the global 'g' also to the called instance, as
3693 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3701 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3694 user's 'g' variables).
3702 user's 'g' variables).
3695
3703
3696 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3704 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3697 global variables (aliases to _ih,_oh) so that users which expect
3705 global variables (aliases to _ih,_oh) so that users which expect
3698 In[5] or Out[7] to work aren't unpleasantly surprised.
3706 In[5] or Out[7] to work aren't unpleasantly surprised.
3699 (InputList.__getslice__): new class to allow executing slices of
3707 (InputList.__getslice__): new class to allow executing slices of
3700 input history directly. Very simple class, complements the use of
3708 input history directly. Very simple class, complements the use of
3701 macros.
3709 macros.
3702
3710
3703 2002-05-16 Fernando Perez <fperez@colorado.edu>
3711 2002-05-16 Fernando Perez <fperez@colorado.edu>
3704
3712
3705 * setup.py (docdirbase): make doc directory be just doc/IPython
3713 * setup.py (docdirbase): make doc directory be just doc/IPython
3706 without version numbers, it will reduce clutter for users.
3714 without version numbers, it will reduce clutter for users.
3707
3715
3708 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3716 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3709 execfile call to prevent possible memory leak. See for details:
3717 execfile call to prevent possible memory leak. See for details:
3710 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3718 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3711
3719
3712 2002-05-15 Fernando Perez <fperez@colorado.edu>
3720 2002-05-15 Fernando Perez <fperez@colorado.edu>
3713
3721
3714 * IPython/Magic.py (Magic.magic_psource): made the object
3722 * IPython/Magic.py (Magic.magic_psource): made the object
3715 introspection names be more standard: pdoc, pdef, pfile and
3723 introspection names be more standard: pdoc, pdef, pfile and
3716 psource. They all print/page their output, and it makes
3724 psource. They all print/page their output, and it makes
3717 remembering them easier. Kept old names for compatibility as
3725 remembering them easier. Kept old names for compatibility as
3718 aliases.
3726 aliases.
3719
3727
3720 2002-05-14 Fernando Perez <fperez@colorado.edu>
3728 2002-05-14 Fernando Perez <fperez@colorado.edu>
3721
3729
3722 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3730 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3723 what the mouse problem was. The trick is to use gnuplot with temp
3731 what the mouse problem was. The trick is to use gnuplot with temp
3724 files and NOT with pipes (for data communication), because having
3732 files and NOT with pipes (for data communication), because having
3725 both pipes and the mouse on is bad news.
3733 both pipes and the mouse on is bad news.
3726
3734
3727 2002-05-13 Fernando Perez <fperez@colorado.edu>
3735 2002-05-13 Fernando Perez <fperez@colorado.edu>
3728
3736
3729 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3737 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3730 bug. Information would be reported about builtins even when
3738 bug. Information would be reported about builtins even when
3731 user-defined functions overrode them.
3739 user-defined functions overrode them.
3732
3740
3733 2002-05-11 Fernando Perez <fperez@colorado.edu>
3741 2002-05-11 Fernando Perez <fperez@colorado.edu>
3734
3742
3735 * IPython/__init__.py (__all__): removed FlexCompleter from
3743 * IPython/__init__.py (__all__): removed FlexCompleter from
3736 __all__ so that things don't fail in platforms without readline.
3744 __all__ so that things don't fail in platforms without readline.
3737
3745
3738 2002-05-10 Fernando Perez <fperez@colorado.edu>
3746 2002-05-10 Fernando Perez <fperez@colorado.edu>
3739
3747
3740 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3748 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3741 it requires Numeric, effectively making Numeric a dependency for
3749 it requires Numeric, effectively making Numeric a dependency for
3742 IPython.
3750 IPython.
3743
3751
3744 * Released 0.2.13
3752 * Released 0.2.13
3745
3753
3746 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3754 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3747 profiler interface. Now all the major options from the profiler
3755 profiler interface. Now all the major options from the profiler
3748 module are directly supported in IPython, both for single
3756 module are directly supported in IPython, both for single
3749 expressions (@prun) and for full programs (@run -p).
3757 expressions (@prun) and for full programs (@run -p).
3750
3758
3751 2002-05-09 Fernando Perez <fperez@colorado.edu>
3759 2002-05-09 Fernando Perez <fperez@colorado.edu>
3752
3760
3753 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3761 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3754 magic properly formatted for screen.
3762 magic properly formatted for screen.
3755
3763
3756 * setup.py (make_shortcut): Changed things to put pdf version in
3764 * setup.py (make_shortcut): Changed things to put pdf version in
3757 doc/ instead of doc/manual (had to change lyxport a bit).
3765 doc/ instead of doc/manual (had to change lyxport a bit).
3758
3766
3759 * IPython/Magic.py (Profile.string_stats): made profile runs go
3767 * IPython/Magic.py (Profile.string_stats): made profile runs go
3760 through pager (they are long and a pager allows searching, saving,
3768 through pager (they are long and a pager allows searching, saving,
3761 etc.)
3769 etc.)
3762
3770
3763 2002-05-08 Fernando Perez <fperez@colorado.edu>
3771 2002-05-08 Fernando Perez <fperez@colorado.edu>
3764
3772
3765 * Released 0.2.12
3773 * Released 0.2.12
3766
3774
3767 2002-05-06 Fernando Perez <fperez@colorado.edu>
3775 2002-05-06 Fernando Perez <fperez@colorado.edu>
3768
3776
3769 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3777 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3770 introduced); 'hist n1 n2' was broken.
3778 introduced); 'hist n1 n2' was broken.
3771 (Magic.magic_pdb): added optional on/off arguments to @pdb
3779 (Magic.magic_pdb): added optional on/off arguments to @pdb
3772 (Magic.magic_run): added option -i to @run, which executes code in
3780 (Magic.magic_run): added option -i to @run, which executes code in
3773 the IPython namespace instead of a clean one. Also added @irun as
3781 the IPython namespace instead of a clean one. Also added @irun as
3774 an alias to @run -i.
3782 an alias to @run -i.
3775
3783
3776 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3784 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3777 fixed (it didn't really do anything, the namespaces were wrong).
3785 fixed (it didn't really do anything, the namespaces were wrong).
3778
3786
3779 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3787 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3780
3788
3781 * IPython/__init__.py (__all__): Fixed package namespace, now
3789 * IPython/__init__.py (__all__): Fixed package namespace, now
3782 'import IPython' does give access to IPython.<all> as
3790 'import IPython' does give access to IPython.<all> as
3783 expected. Also renamed __release__ to Release.
3791 expected. Also renamed __release__ to Release.
3784
3792
3785 * IPython/Debugger.py (__license__): created new Pdb class which
3793 * IPython/Debugger.py (__license__): created new Pdb class which
3786 functions like a drop-in for the normal pdb.Pdb but does NOT
3794 functions like a drop-in for the normal pdb.Pdb but does NOT
3787 import readline by default. This way it doesn't muck up IPython's
3795 import readline by default. This way it doesn't muck up IPython's
3788 readline handling, and now tab-completion finally works in the
3796 readline handling, and now tab-completion finally works in the
3789 debugger -- sort of. It completes things globally visible, but the
3797 debugger -- sort of. It completes things globally visible, but the
3790 completer doesn't track the stack as pdb walks it. That's a bit
3798 completer doesn't track the stack as pdb walks it. That's a bit
3791 tricky, and I'll have to implement it later.
3799 tricky, and I'll have to implement it later.
3792
3800
3793 2002-05-05 Fernando Perez <fperez@colorado.edu>
3801 2002-05-05 Fernando Perez <fperez@colorado.edu>
3794
3802
3795 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3803 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3796 magic docstrings when printed via ? (explicit \'s were being
3804 magic docstrings when printed via ? (explicit \'s were being
3797 printed).
3805 printed).
3798
3806
3799 * IPython/ipmaker.py (make_IPython): fixed namespace
3807 * IPython/ipmaker.py (make_IPython): fixed namespace
3800 identification bug. Now variables loaded via logs or command-line
3808 identification bug. Now variables loaded via logs or command-line
3801 files are recognized in the interactive namespace by @who.
3809 files are recognized in the interactive namespace by @who.
3802
3810
3803 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3811 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3804 log replay system stemming from the string form of Structs.
3812 log replay system stemming from the string form of Structs.
3805
3813
3806 * IPython/Magic.py (Macro.__init__): improved macros to properly
3814 * IPython/Magic.py (Macro.__init__): improved macros to properly
3807 handle magic commands in them.
3815 handle magic commands in them.
3808 (Magic.magic_logstart): usernames are now expanded so 'logstart
3816 (Magic.magic_logstart): usernames are now expanded so 'logstart
3809 ~/mylog' now works.
3817 ~/mylog' now works.
3810
3818
3811 * IPython/iplib.py (complete): fixed bug where paths starting with
3819 * IPython/iplib.py (complete): fixed bug where paths starting with
3812 '/' would be completed as magic names.
3820 '/' would be completed as magic names.
3813
3821
3814 2002-05-04 Fernando Perez <fperez@colorado.edu>
3822 2002-05-04 Fernando Perez <fperez@colorado.edu>
3815
3823
3816 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3824 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3817 allow running full programs under the profiler's control.
3825 allow running full programs under the profiler's control.
3818
3826
3819 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3827 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3820 mode to report exceptions verbosely but without formatting
3828 mode to report exceptions verbosely but without formatting
3821 variables. This addresses the issue of ipython 'freezing' (it's
3829 variables. This addresses the issue of ipython 'freezing' (it's
3822 not frozen, but caught in an expensive formatting loop) when huge
3830 not frozen, but caught in an expensive formatting loop) when huge
3823 variables are in the context of an exception.
3831 variables are in the context of an exception.
3824 (VerboseTB.text): Added '--->' markers at line where exception was
3832 (VerboseTB.text): Added '--->' markers at line where exception was
3825 triggered. Much clearer to read, especially in NoColor modes.
3833 triggered. Much clearer to read, especially in NoColor modes.
3826
3834
3827 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3835 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3828 implemented in reverse when changing to the new parse_options().
3836 implemented in reverse when changing to the new parse_options().
3829
3837
3830 2002-05-03 Fernando Perez <fperez@colorado.edu>
3838 2002-05-03 Fernando Perez <fperez@colorado.edu>
3831
3839
3832 * IPython/Magic.py (Magic.parse_options): new function so that
3840 * IPython/Magic.py (Magic.parse_options): new function so that
3833 magics can parse options easier.
3841 magics can parse options easier.
3834 (Magic.magic_prun): new function similar to profile.run(),
3842 (Magic.magic_prun): new function similar to profile.run(),
3835 suggested by Chris Hart.
3843 suggested by Chris Hart.
3836 (Magic.magic_cd): fixed behavior so that it only changes if
3844 (Magic.magic_cd): fixed behavior so that it only changes if
3837 directory actually is in history.
3845 directory actually is in history.
3838
3846
3839 * IPython/usage.py (__doc__): added information about potential
3847 * IPython/usage.py (__doc__): added information about potential
3840 slowness of Verbose exception mode when there are huge data
3848 slowness of Verbose exception mode when there are huge data
3841 structures to be formatted (thanks to Archie Paulson).
3849 structures to be formatted (thanks to Archie Paulson).
3842
3850
3843 * IPython/ipmaker.py (make_IPython): Changed default logging
3851 * IPython/ipmaker.py (make_IPython): Changed default logging
3844 (when simply called with -log) to use curr_dir/ipython.log in
3852 (when simply called with -log) to use curr_dir/ipython.log in
3845 rotate mode. Fixed crash which was occuring with -log before
3853 rotate mode. Fixed crash which was occuring with -log before
3846 (thanks to Jim Boyle).
3854 (thanks to Jim Boyle).
3847
3855
3848 2002-05-01 Fernando Perez <fperez@colorado.edu>
3856 2002-05-01 Fernando Perez <fperez@colorado.edu>
3849
3857
3850 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3858 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3851 was nasty -- though somewhat of a corner case).
3859 was nasty -- though somewhat of a corner case).
3852
3860
3853 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3861 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3854 text (was a bug).
3862 text (was a bug).
3855
3863
3856 2002-04-30 Fernando Perez <fperez@colorado.edu>
3864 2002-04-30 Fernando Perez <fperez@colorado.edu>
3857
3865
3858 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3866 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3859 a print after ^D or ^C from the user so that the In[] prompt
3867 a print after ^D or ^C from the user so that the In[] prompt
3860 doesn't over-run the gnuplot one.
3868 doesn't over-run the gnuplot one.
3861
3869
3862 2002-04-29 Fernando Perez <fperez@colorado.edu>
3870 2002-04-29 Fernando Perez <fperez@colorado.edu>
3863
3871
3864 * Released 0.2.10
3872 * Released 0.2.10
3865
3873
3866 * IPython/__release__.py (version): get date dynamically.
3874 * IPython/__release__.py (version): get date dynamically.
3867
3875
3868 * Misc. documentation updates thanks to Arnd's comments. Also ran
3876 * Misc. documentation updates thanks to Arnd's comments. Also ran
3869 a full spellcheck on the manual (hadn't been done in a while).
3877 a full spellcheck on the manual (hadn't been done in a while).
3870
3878
3871 2002-04-27 Fernando Perez <fperez@colorado.edu>
3879 2002-04-27 Fernando Perez <fperez@colorado.edu>
3872
3880
3873 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3881 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3874 starting a log in mid-session would reset the input history list.
3882 starting a log in mid-session would reset the input history list.
3875
3883
3876 2002-04-26 Fernando Perez <fperez@colorado.edu>
3884 2002-04-26 Fernando Perez <fperez@colorado.edu>
3877
3885
3878 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3886 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3879 all files were being included in an update. Now anything in
3887 all files were being included in an update. Now anything in
3880 UserConfig that matches [A-Za-z]*.py will go (this excludes
3888 UserConfig that matches [A-Za-z]*.py will go (this excludes
3881 __init__.py)
3889 __init__.py)
3882
3890
3883 2002-04-25 Fernando Perez <fperez@colorado.edu>
3891 2002-04-25 Fernando Perez <fperez@colorado.edu>
3884
3892
3885 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3893 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3886 to __builtins__ so that any form of embedded or imported code can
3894 to __builtins__ so that any form of embedded or imported code can
3887 test for being inside IPython.
3895 test for being inside IPython.
3888
3896
3889 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3897 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3890 changed to GnuplotMagic because it's now an importable module,
3898 changed to GnuplotMagic because it's now an importable module,
3891 this makes the name follow that of the standard Gnuplot module.
3899 this makes the name follow that of the standard Gnuplot module.
3892 GnuplotMagic can now be loaded at any time in mid-session.
3900 GnuplotMagic can now be loaded at any time in mid-session.
3893
3901
3894 2002-04-24 Fernando Perez <fperez@colorado.edu>
3902 2002-04-24 Fernando Perez <fperez@colorado.edu>
3895
3903
3896 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3904 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3897 the globals (IPython has its own namespace) and the
3905 the globals (IPython has its own namespace) and the
3898 PhysicalQuantity stuff is much better anyway.
3906 PhysicalQuantity stuff is much better anyway.
3899
3907
3900 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3908 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3901 embedding example to standard user directory for
3909 embedding example to standard user directory for
3902 distribution. Also put it in the manual.
3910 distribution. Also put it in the manual.
3903
3911
3904 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3912 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3905 instance as first argument (so it doesn't rely on some obscure
3913 instance as first argument (so it doesn't rely on some obscure
3906 hidden global).
3914 hidden global).
3907
3915
3908 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3916 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3909 delimiters. While it prevents ().TAB from working, it allows
3917 delimiters. While it prevents ().TAB from working, it allows
3910 completions in open (... expressions. This is by far a more common
3918 completions in open (... expressions. This is by far a more common
3911 case.
3919 case.
3912
3920
3913 2002-04-23 Fernando Perez <fperez@colorado.edu>
3921 2002-04-23 Fernando Perez <fperez@colorado.edu>
3914
3922
3915 * IPython/Extensions/InterpreterPasteInput.py: new
3923 * IPython/Extensions/InterpreterPasteInput.py: new
3916 syntax-processing module for pasting lines with >>> or ... at the
3924 syntax-processing module for pasting lines with >>> or ... at the
3917 start.
3925 start.
3918
3926
3919 * IPython/Extensions/PhysicalQ_Interactive.py
3927 * IPython/Extensions/PhysicalQ_Interactive.py
3920 (PhysicalQuantityInteractive.__int__): fixed to work with either
3928 (PhysicalQuantityInteractive.__int__): fixed to work with either
3921 Numeric or math.
3929 Numeric or math.
3922
3930
3923 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3931 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3924 provided profiles. Now we have:
3932 provided profiles. Now we have:
3925 -math -> math module as * and cmath with its own namespace.
3933 -math -> math module as * and cmath with its own namespace.
3926 -numeric -> Numeric as *, plus gnuplot & grace
3934 -numeric -> Numeric as *, plus gnuplot & grace
3927 -physics -> same as before
3935 -physics -> same as before
3928
3936
3929 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3937 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3930 user-defined magics wouldn't be found by @magic if they were
3938 user-defined magics wouldn't be found by @magic if they were
3931 defined as class methods. Also cleaned up the namespace search
3939 defined as class methods. Also cleaned up the namespace search
3932 logic and the string building (to use %s instead of many repeated
3940 logic and the string building (to use %s instead of many repeated
3933 string adds).
3941 string adds).
3934
3942
3935 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3943 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3936 of user-defined magics to operate with class methods (cleaner, in
3944 of user-defined magics to operate with class methods (cleaner, in
3937 line with the gnuplot code).
3945 line with the gnuplot code).
3938
3946
3939 2002-04-22 Fernando Perez <fperez@colorado.edu>
3947 2002-04-22 Fernando Perez <fperez@colorado.edu>
3940
3948
3941 * setup.py: updated dependency list so that manual is updated when
3949 * setup.py: updated dependency list so that manual is updated when
3942 all included files change.
3950 all included files change.
3943
3951
3944 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3952 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3945 the delimiter removal option (the fix is ugly right now).
3953 the delimiter removal option (the fix is ugly right now).
3946
3954
3947 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3955 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3948 all of the math profile (quicker loading, no conflict between
3956 all of the math profile (quicker loading, no conflict between
3949 g-9.8 and g-gnuplot).
3957 g-9.8 and g-gnuplot).
3950
3958
3951 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3959 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3952 name of post-mortem files to IPython_crash_report.txt.
3960 name of post-mortem files to IPython_crash_report.txt.
3953
3961
3954 * Cleanup/update of the docs. Added all the new readline info and
3962 * Cleanup/update of the docs. Added all the new readline info and
3955 formatted all lists as 'real lists'.
3963 formatted all lists as 'real lists'.
3956
3964
3957 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3965 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3958 tab-completion options, since the full readline parse_and_bind is
3966 tab-completion options, since the full readline parse_and_bind is
3959 now accessible.
3967 now accessible.
3960
3968
3961 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3969 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3962 handling of readline options. Now users can specify any string to
3970 handling of readline options. Now users can specify any string to
3963 be passed to parse_and_bind(), as well as the delimiters to be
3971 be passed to parse_and_bind(), as well as the delimiters to be
3964 removed.
3972 removed.
3965 (InteractiveShell.__init__): Added __name__ to the global
3973 (InteractiveShell.__init__): Added __name__ to the global
3966 namespace so that things like Itpl which rely on its existence
3974 namespace so that things like Itpl which rely on its existence
3967 don't crash.
3975 don't crash.
3968 (InteractiveShell._prefilter): Defined the default with a _ so
3976 (InteractiveShell._prefilter): Defined the default with a _ so
3969 that prefilter() is easier to override, while the default one
3977 that prefilter() is easier to override, while the default one
3970 remains available.
3978 remains available.
3971
3979
3972 2002-04-18 Fernando Perez <fperez@colorado.edu>
3980 2002-04-18 Fernando Perez <fperez@colorado.edu>
3973
3981
3974 * Added information about pdb in the docs.
3982 * Added information about pdb in the docs.
3975
3983
3976 2002-04-17 Fernando Perez <fperez@colorado.edu>
3984 2002-04-17 Fernando Perez <fperez@colorado.edu>
3977
3985
3978 * IPython/ipmaker.py (make_IPython): added rc_override option to
3986 * IPython/ipmaker.py (make_IPython): added rc_override option to
3979 allow passing config options at creation time which may override
3987 allow passing config options at creation time which may override
3980 anything set in the config files or command line. This is
3988 anything set in the config files or command line. This is
3981 particularly useful for configuring embedded instances.
3989 particularly useful for configuring embedded instances.
3982
3990
3983 2002-04-15 Fernando Perez <fperez@colorado.edu>
3991 2002-04-15 Fernando Perez <fperez@colorado.edu>
3984
3992
3985 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3993 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3986 crash embedded instances because of the input cache falling out of
3994 crash embedded instances because of the input cache falling out of
3987 sync with the output counter.
3995 sync with the output counter.
3988
3996
3989 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3997 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3990 mode which calls pdb after an uncaught exception in IPython itself.
3998 mode which calls pdb after an uncaught exception in IPython itself.
3991
3999
3992 2002-04-14 Fernando Perez <fperez@colorado.edu>
4000 2002-04-14 Fernando Perez <fperez@colorado.edu>
3993
4001
3994 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4002 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3995 readline, fix it back after each call.
4003 readline, fix it back after each call.
3996
4004
3997 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4005 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3998 method to force all access via __call__(), which guarantees that
4006 method to force all access via __call__(), which guarantees that
3999 traceback references are properly deleted.
4007 traceback references are properly deleted.
4000
4008
4001 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4009 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4002 improve printing when pprint is in use.
4010 improve printing when pprint is in use.
4003
4011
4004 2002-04-13 Fernando Perez <fperez@colorado.edu>
4012 2002-04-13 Fernando Perez <fperez@colorado.edu>
4005
4013
4006 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4014 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4007 exceptions aren't caught anymore. If the user triggers one, he
4015 exceptions aren't caught anymore. If the user triggers one, he
4008 should know why he's doing it and it should go all the way up,
4016 should know why he's doing it and it should go all the way up,
4009 just like any other exception. So now @abort will fully kill the
4017 just like any other exception. So now @abort will fully kill the
4010 embedded interpreter and the embedding code (unless that happens
4018 embedded interpreter and the embedding code (unless that happens
4011 to catch SystemExit).
4019 to catch SystemExit).
4012
4020
4013 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4021 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4014 and a debugger() method to invoke the interactive pdb debugger
4022 and a debugger() method to invoke the interactive pdb debugger
4015 after printing exception information. Also added the corresponding
4023 after printing exception information. Also added the corresponding
4016 -pdb option and @pdb magic to control this feature, and updated
4024 -pdb option and @pdb magic to control this feature, and updated
4017 the docs. After a suggestion from Christopher Hart
4025 the docs. After a suggestion from Christopher Hart
4018 (hart-AT-caltech.edu).
4026 (hart-AT-caltech.edu).
4019
4027
4020 2002-04-12 Fernando Perez <fperez@colorado.edu>
4028 2002-04-12 Fernando Perez <fperez@colorado.edu>
4021
4029
4022 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4030 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4023 the exception handlers defined by the user (not the CrashHandler)
4031 the exception handlers defined by the user (not the CrashHandler)
4024 so that user exceptions don't trigger an ipython bug report.
4032 so that user exceptions don't trigger an ipython bug report.
4025
4033
4026 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4034 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4027 configurable (it should have always been so).
4035 configurable (it should have always been so).
4028
4036
4029 2002-03-26 Fernando Perez <fperez@colorado.edu>
4037 2002-03-26 Fernando Perez <fperez@colorado.edu>
4030
4038
4031 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4039 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4032 and there to fix embedding namespace issues. This should all be
4040 and there to fix embedding namespace issues. This should all be
4033 done in a more elegant way.
4041 done in a more elegant way.
4034
4042
4035 2002-03-25 Fernando Perez <fperez@colorado.edu>
4043 2002-03-25 Fernando Perez <fperez@colorado.edu>
4036
4044
4037 * IPython/genutils.py (get_home_dir): Try to make it work under
4045 * IPython/genutils.py (get_home_dir): Try to make it work under
4038 win9x also.
4046 win9x also.
4039
4047
4040 2002-03-20 Fernando Perez <fperez@colorado.edu>
4048 2002-03-20 Fernando Perez <fperez@colorado.edu>
4041
4049
4042 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4050 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4043 sys.displayhook untouched upon __init__.
4051 sys.displayhook untouched upon __init__.
4044
4052
4045 2002-03-19 Fernando Perez <fperez@colorado.edu>
4053 2002-03-19 Fernando Perez <fperez@colorado.edu>
4046
4054
4047 * Released 0.2.9 (for embedding bug, basically).
4055 * Released 0.2.9 (for embedding bug, basically).
4048
4056
4049 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4057 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4050 exceptions so that enclosing shell's state can be restored.
4058 exceptions so that enclosing shell's state can be restored.
4051
4059
4052 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4060 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4053 naming conventions in the .ipython/ dir.
4061 naming conventions in the .ipython/ dir.
4054
4062
4055 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4063 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4056 from delimiters list so filenames with - in them get expanded.
4064 from delimiters list so filenames with - in them get expanded.
4057
4065
4058 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4066 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4059 sys.displayhook not being properly restored after an embedded call.
4067 sys.displayhook not being properly restored after an embedded call.
4060
4068
4061 2002-03-18 Fernando Perez <fperez@colorado.edu>
4069 2002-03-18 Fernando Perez <fperez@colorado.edu>
4062
4070
4063 * Released 0.2.8
4071 * Released 0.2.8
4064
4072
4065 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4073 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4066 some files weren't being included in a -upgrade.
4074 some files weren't being included in a -upgrade.
4067 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4075 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4068 on' so that the first tab completes.
4076 on' so that the first tab completes.
4069 (InteractiveShell.handle_magic): fixed bug with spaces around
4077 (InteractiveShell.handle_magic): fixed bug with spaces around
4070 quotes breaking many magic commands.
4078 quotes breaking many magic commands.
4071
4079
4072 * setup.py: added note about ignoring the syntax error messages at
4080 * setup.py: added note about ignoring the syntax error messages at
4073 installation.
4081 installation.
4074
4082
4075 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4083 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4076 streamlining the gnuplot interface, now there's only one magic @gp.
4084 streamlining the gnuplot interface, now there's only one magic @gp.
4077
4085
4078 2002-03-17 Fernando Perez <fperez@colorado.edu>
4086 2002-03-17 Fernando Perez <fperez@colorado.edu>
4079
4087
4080 * IPython/UserConfig/magic_gnuplot.py: new name for the
4088 * IPython/UserConfig/magic_gnuplot.py: new name for the
4081 example-magic_pm.py file. Much enhanced system, now with a shell
4089 example-magic_pm.py file. Much enhanced system, now with a shell
4082 for communicating directly with gnuplot, one command at a time.
4090 for communicating directly with gnuplot, one command at a time.
4083
4091
4084 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4092 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4085 setting __name__=='__main__'.
4093 setting __name__=='__main__'.
4086
4094
4087 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4095 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4088 mini-shell for accessing gnuplot from inside ipython. Should
4096 mini-shell for accessing gnuplot from inside ipython. Should
4089 extend it later for grace access too. Inspired by Arnd's
4097 extend it later for grace access too. Inspired by Arnd's
4090 suggestion.
4098 suggestion.
4091
4099
4092 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4100 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4093 calling magic functions with () in their arguments. Thanks to Arnd
4101 calling magic functions with () in their arguments. Thanks to Arnd
4094 Baecker for pointing this to me.
4102 Baecker for pointing this to me.
4095
4103
4096 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4104 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4097 infinitely for integer or complex arrays (only worked with floats).
4105 infinitely for integer or complex arrays (only worked with floats).
4098
4106
4099 2002-03-16 Fernando Perez <fperez@colorado.edu>
4107 2002-03-16 Fernando Perez <fperez@colorado.edu>
4100
4108
4101 * setup.py: Merged setup and setup_windows into a single script
4109 * setup.py: Merged setup and setup_windows into a single script
4102 which properly handles things for windows users.
4110 which properly handles things for windows users.
4103
4111
4104 2002-03-15 Fernando Perez <fperez@colorado.edu>
4112 2002-03-15 Fernando Perez <fperez@colorado.edu>
4105
4113
4106 * Big change to the manual: now the magics are all automatically
4114 * Big change to the manual: now the magics are all automatically
4107 documented. This information is generated from their docstrings
4115 documented. This information is generated from their docstrings
4108 and put in a latex file included by the manual lyx file. This way
4116 and put in a latex file included by the manual lyx file. This way
4109 we get always up to date information for the magics. The manual
4117 we get always up to date information for the magics. The manual
4110 now also has proper version information, also auto-synced.
4118 now also has proper version information, also auto-synced.
4111
4119
4112 For this to work, an undocumented --magic_docstrings option was added.
4120 For this to work, an undocumented --magic_docstrings option was added.
4113
4121
4114 2002-03-13 Fernando Perez <fperez@colorado.edu>
4122 2002-03-13 Fernando Perez <fperez@colorado.edu>
4115
4123
4116 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4124 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4117 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4125 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4118
4126
4119 2002-03-12 Fernando Perez <fperez@colorado.edu>
4127 2002-03-12 Fernando Perez <fperez@colorado.edu>
4120
4128
4121 * IPython/ultraTB.py (TermColors): changed color escapes again to
4129 * IPython/ultraTB.py (TermColors): changed color escapes again to
4122 fix the (old, reintroduced) line-wrapping bug. Basically, if
4130 fix the (old, reintroduced) line-wrapping bug. Basically, if
4123 \001..\002 aren't given in the color escapes, lines get wrapped
4131 \001..\002 aren't given in the color escapes, lines get wrapped
4124 weirdly. But giving those screws up old xterms and emacs terms. So
4132 weirdly. But giving those screws up old xterms and emacs terms. So
4125 I added some logic for emacs terms to be ok, but I can't identify old
4133 I added some logic for emacs terms to be ok, but I can't identify old
4126 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4134 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4127
4135
4128 2002-03-10 Fernando Perez <fperez@colorado.edu>
4136 2002-03-10 Fernando Perez <fperez@colorado.edu>
4129
4137
4130 * IPython/usage.py (__doc__): Various documentation cleanups and
4138 * IPython/usage.py (__doc__): Various documentation cleanups and
4131 updates, both in usage docstrings and in the manual.
4139 updates, both in usage docstrings and in the manual.
4132
4140
4133 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4141 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4134 handling of caching. Set minimum acceptabe value for having a
4142 handling of caching. Set minimum acceptabe value for having a
4135 cache at 20 values.
4143 cache at 20 values.
4136
4144
4137 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4145 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4138 install_first_time function to a method, renamed it and added an
4146 install_first_time function to a method, renamed it and added an
4139 'upgrade' mode. Now people can update their config directory with
4147 'upgrade' mode. Now people can update their config directory with
4140 a simple command line switch (-upgrade, also new).
4148 a simple command line switch (-upgrade, also new).
4141
4149
4142 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4150 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4143 @file (convenient for automagic users under Python >= 2.2).
4151 @file (convenient for automagic users under Python >= 2.2).
4144 Removed @files (it seemed more like a plural than an abbrev. of
4152 Removed @files (it seemed more like a plural than an abbrev. of
4145 'file show').
4153 'file show').
4146
4154
4147 * IPython/iplib.py (install_first_time): Fixed crash if there were
4155 * IPython/iplib.py (install_first_time): Fixed crash if there were
4148 backup files ('~') in .ipython/ install directory.
4156 backup files ('~') in .ipython/ install directory.
4149
4157
4150 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4158 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4151 system. Things look fine, but these changes are fairly
4159 system. Things look fine, but these changes are fairly
4152 intrusive. Test them for a few days.
4160 intrusive. Test them for a few days.
4153
4161
4154 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4162 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4155 the prompts system. Now all in/out prompt strings are user
4163 the prompts system. Now all in/out prompt strings are user
4156 controllable. This is particularly useful for embedding, as one
4164 controllable. This is particularly useful for embedding, as one
4157 can tag embedded instances with particular prompts.
4165 can tag embedded instances with particular prompts.
4158
4166
4159 Also removed global use of sys.ps1/2, which now allows nested
4167 Also removed global use of sys.ps1/2, which now allows nested
4160 embeddings without any problems. Added command-line options for
4168 embeddings without any problems. Added command-line options for
4161 the prompt strings.
4169 the prompt strings.
4162
4170
4163 2002-03-08 Fernando Perez <fperez@colorado.edu>
4171 2002-03-08 Fernando Perez <fperez@colorado.edu>
4164
4172
4165 * IPython/UserConfig/example-embed-short.py (ipshell): added
4173 * IPython/UserConfig/example-embed-short.py (ipshell): added
4166 example file with the bare minimum code for embedding.
4174 example file with the bare minimum code for embedding.
4167
4175
4168 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4176 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4169 functionality for the embeddable shell to be activated/deactivated
4177 functionality for the embeddable shell to be activated/deactivated
4170 either globally or at each call.
4178 either globally or at each call.
4171
4179
4172 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4180 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4173 rewriting the prompt with '--->' for auto-inputs with proper
4181 rewriting the prompt with '--->' for auto-inputs with proper
4174 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4182 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4175 this is handled by the prompts class itself, as it should.
4183 this is handled by the prompts class itself, as it should.
4176
4184
4177 2002-03-05 Fernando Perez <fperez@colorado.edu>
4185 2002-03-05 Fernando Perez <fperez@colorado.edu>
4178
4186
4179 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4187 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4180 @logstart to avoid name clashes with the math log function.
4188 @logstart to avoid name clashes with the math log function.
4181
4189
4182 * Big updates to X/Emacs section of the manual.
4190 * Big updates to X/Emacs section of the manual.
4183
4191
4184 * Removed ipython_emacs. Milan explained to me how to pass
4192 * Removed ipython_emacs. Milan explained to me how to pass
4185 arguments to ipython through Emacs. Some day I'm going to end up
4193 arguments to ipython through Emacs. Some day I'm going to end up
4186 learning some lisp...
4194 learning some lisp...
4187
4195
4188 2002-03-04 Fernando Perez <fperez@colorado.edu>
4196 2002-03-04 Fernando Perez <fperez@colorado.edu>
4189
4197
4190 * IPython/ipython_emacs: Created script to be used as the
4198 * IPython/ipython_emacs: Created script to be used as the
4191 py-python-command Emacs variable so we can pass IPython
4199 py-python-command Emacs variable so we can pass IPython
4192 parameters. I can't figure out how to tell Emacs directly to pass
4200 parameters. I can't figure out how to tell Emacs directly to pass
4193 parameters to IPython, so a dummy shell script will do it.
4201 parameters to IPython, so a dummy shell script will do it.
4194
4202
4195 Other enhancements made for things to work better under Emacs'
4203 Other enhancements made for things to work better under Emacs'
4196 various types of terminals. Many thanks to Milan Zamazal
4204 various types of terminals. Many thanks to Milan Zamazal
4197 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4205 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4198
4206
4199 2002-03-01 Fernando Perez <fperez@colorado.edu>
4207 2002-03-01 Fernando Perez <fperez@colorado.edu>
4200
4208
4201 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4209 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4202 that loading of readline is now optional. This gives better
4210 that loading of readline is now optional. This gives better
4203 control to emacs users.
4211 control to emacs users.
4204
4212
4205 * IPython/ultraTB.py (__date__): Modified color escape sequences
4213 * IPython/ultraTB.py (__date__): Modified color escape sequences
4206 and now things work fine under xterm and in Emacs' term buffers
4214 and now things work fine under xterm and in Emacs' term buffers
4207 (though not shell ones). Well, in emacs you get colors, but all
4215 (though not shell ones). Well, in emacs you get colors, but all
4208 seem to be 'light' colors (no difference between dark and light
4216 seem to be 'light' colors (no difference between dark and light
4209 ones). But the garbage chars are gone, and also in xterms. It
4217 ones). But the garbage chars are gone, and also in xterms. It
4210 seems that now I'm using 'cleaner' ansi sequences.
4218 seems that now I'm using 'cleaner' ansi sequences.
4211
4219
4212 2002-02-21 Fernando Perez <fperez@colorado.edu>
4220 2002-02-21 Fernando Perez <fperez@colorado.edu>
4213
4221
4214 * Released 0.2.7 (mainly to publish the scoping fix).
4222 * Released 0.2.7 (mainly to publish the scoping fix).
4215
4223
4216 * IPython/Logger.py (Logger.logstate): added. A corresponding
4224 * IPython/Logger.py (Logger.logstate): added. A corresponding
4217 @logstate magic was created.
4225 @logstate magic was created.
4218
4226
4219 * IPython/Magic.py: fixed nested scoping problem under Python
4227 * IPython/Magic.py: fixed nested scoping problem under Python
4220 2.1.x (automagic wasn't working).
4228 2.1.x (automagic wasn't working).
4221
4229
4222 2002-02-20 Fernando Perez <fperez@colorado.edu>
4230 2002-02-20 Fernando Perez <fperez@colorado.edu>
4223
4231
4224 * Released 0.2.6.
4232 * Released 0.2.6.
4225
4233
4226 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4234 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4227 option so that logs can come out without any headers at all.
4235 option so that logs can come out without any headers at all.
4228
4236
4229 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4237 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4230 SciPy.
4238 SciPy.
4231
4239
4232 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4240 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4233 that embedded IPython calls don't require vars() to be explicitly
4241 that embedded IPython calls don't require vars() to be explicitly
4234 passed. Now they are extracted from the caller's frame (code
4242 passed. Now they are extracted from the caller's frame (code
4235 snatched from Eric Jones' weave). Added better documentation to
4243 snatched from Eric Jones' weave). Added better documentation to
4236 the section on embedding and the example file.
4244 the section on embedding and the example file.
4237
4245
4238 * IPython/genutils.py (page): Changed so that under emacs, it just
4246 * IPython/genutils.py (page): Changed so that under emacs, it just
4239 prints the string. You can then page up and down in the emacs
4247 prints the string. You can then page up and down in the emacs
4240 buffer itself. This is how the builtin help() works.
4248 buffer itself. This is how the builtin help() works.
4241
4249
4242 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4250 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4243 macro scoping: macros need to be executed in the user's namespace
4251 macro scoping: macros need to be executed in the user's namespace
4244 to work as if they had been typed by the user.
4252 to work as if they had been typed by the user.
4245
4253
4246 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4254 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4247 execute automatically (no need to type 'exec...'). They then
4255 execute automatically (no need to type 'exec...'). They then
4248 behave like 'true macros'. The printing system was also modified
4256 behave like 'true macros'. The printing system was also modified
4249 for this to work.
4257 for this to work.
4250
4258
4251 2002-02-19 Fernando Perez <fperez@colorado.edu>
4259 2002-02-19 Fernando Perez <fperez@colorado.edu>
4252
4260
4253 * IPython/genutils.py (page_file): new function for paging files
4261 * IPython/genutils.py (page_file): new function for paging files
4254 in an OS-independent way. Also necessary for file viewing to work
4262 in an OS-independent way. Also necessary for file viewing to work
4255 well inside Emacs buffers.
4263 well inside Emacs buffers.
4256 (page): Added checks for being in an emacs buffer.
4264 (page): Added checks for being in an emacs buffer.
4257 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4265 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4258 same bug in iplib.
4266 same bug in iplib.
4259
4267
4260 2002-02-18 Fernando Perez <fperez@colorado.edu>
4268 2002-02-18 Fernando Perez <fperez@colorado.edu>
4261
4269
4262 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4270 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4263 of readline so that IPython can work inside an Emacs buffer.
4271 of readline so that IPython can work inside an Emacs buffer.
4264
4272
4265 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4273 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4266 method signatures (they weren't really bugs, but it looks cleaner
4274 method signatures (they weren't really bugs, but it looks cleaner
4267 and keeps PyChecker happy).
4275 and keeps PyChecker happy).
4268
4276
4269 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4277 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4270 for implementing various user-defined hooks. Currently only
4278 for implementing various user-defined hooks. Currently only
4271 display is done.
4279 display is done.
4272
4280
4273 * IPython/Prompts.py (CachedOutput._display): changed display
4281 * IPython/Prompts.py (CachedOutput._display): changed display
4274 functions so that they can be dynamically changed by users easily.
4282 functions so that they can be dynamically changed by users easily.
4275
4283
4276 * IPython/Extensions/numeric_formats.py (num_display): added an
4284 * IPython/Extensions/numeric_formats.py (num_display): added an
4277 extension for printing NumPy arrays in flexible manners. It
4285 extension for printing NumPy arrays in flexible manners. It
4278 doesn't do anything yet, but all the structure is in
4286 doesn't do anything yet, but all the structure is in
4279 place. Ultimately the plan is to implement output format control
4287 place. Ultimately the plan is to implement output format control
4280 like in Octave.
4288 like in Octave.
4281
4289
4282 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4290 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4283 methods are found at run-time by all the automatic machinery.
4291 methods are found at run-time by all the automatic machinery.
4284
4292
4285 2002-02-17 Fernando Perez <fperez@colorado.edu>
4293 2002-02-17 Fernando Perez <fperez@colorado.edu>
4286
4294
4287 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4295 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4288 whole file a little.
4296 whole file a little.
4289
4297
4290 * ToDo: closed this document. Now there's a new_design.lyx
4298 * ToDo: closed this document. Now there's a new_design.lyx
4291 document for all new ideas. Added making a pdf of it for the
4299 document for all new ideas. Added making a pdf of it for the
4292 end-user distro.
4300 end-user distro.
4293
4301
4294 * IPython/Logger.py (Logger.switch_log): Created this to replace
4302 * IPython/Logger.py (Logger.switch_log): Created this to replace
4295 logon() and logoff(). It also fixes a nasty crash reported by
4303 logon() and logoff(). It also fixes a nasty crash reported by
4296 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4304 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4297
4305
4298 * IPython/iplib.py (complete): got auto-completion to work with
4306 * IPython/iplib.py (complete): got auto-completion to work with
4299 automagic (I had wanted this for a long time).
4307 automagic (I had wanted this for a long time).
4300
4308
4301 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4309 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4302 to @file, since file() is now a builtin and clashes with automagic
4310 to @file, since file() is now a builtin and clashes with automagic
4303 for @file.
4311 for @file.
4304
4312
4305 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4313 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4306 of this was previously in iplib, which had grown to more than 2000
4314 of this was previously in iplib, which had grown to more than 2000
4307 lines, way too long. No new functionality, but it makes managing
4315 lines, way too long. No new functionality, but it makes managing
4308 the code a bit easier.
4316 the code a bit easier.
4309
4317
4310 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4318 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4311 information to crash reports.
4319 information to crash reports.
4312
4320
4313 2002-02-12 Fernando Perez <fperez@colorado.edu>
4321 2002-02-12 Fernando Perez <fperez@colorado.edu>
4314
4322
4315 * Released 0.2.5.
4323 * Released 0.2.5.
4316
4324
4317 2002-02-11 Fernando Perez <fperez@colorado.edu>
4325 2002-02-11 Fernando Perez <fperez@colorado.edu>
4318
4326
4319 * Wrote a relatively complete Windows installer. It puts
4327 * Wrote a relatively complete Windows installer. It puts
4320 everything in place, creates Start Menu entries and fixes the
4328 everything in place, creates Start Menu entries and fixes the
4321 color issues. Nothing fancy, but it works.
4329 color issues. Nothing fancy, but it works.
4322
4330
4323 2002-02-10 Fernando Perez <fperez@colorado.edu>
4331 2002-02-10 Fernando Perez <fperez@colorado.edu>
4324
4332
4325 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4333 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4326 os.path.expanduser() call so that we can type @run ~/myfile.py and
4334 os.path.expanduser() call so that we can type @run ~/myfile.py and
4327 have thigs work as expected.
4335 have thigs work as expected.
4328
4336
4329 * IPython/genutils.py (page): fixed exception handling so things
4337 * IPython/genutils.py (page): fixed exception handling so things
4330 work both in Unix and Windows correctly. Quitting a pager triggers
4338 work both in Unix and Windows correctly. Quitting a pager triggers
4331 an IOError/broken pipe in Unix, and in windows not finding a pager
4339 an IOError/broken pipe in Unix, and in windows not finding a pager
4332 is also an IOError, so I had to actually look at the return value
4340 is also an IOError, so I had to actually look at the return value
4333 of the exception, not just the exception itself. Should be ok now.
4341 of the exception, not just the exception itself. Should be ok now.
4334
4342
4335 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4343 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4336 modified to allow case-insensitive color scheme changes.
4344 modified to allow case-insensitive color scheme changes.
4337
4345
4338 2002-02-09 Fernando Perez <fperez@colorado.edu>
4346 2002-02-09 Fernando Perez <fperez@colorado.edu>
4339
4347
4340 * IPython/genutils.py (native_line_ends): new function to leave
4348 * IPython/genutils.py (native_line_ends): new function to leave
4341 user config files with os-native line-endings.
4349 user config files with os-native line-endings.
4342
4350
4343 * README and manual updates.
4351 * README and manual updates.
4344
4352
4345 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4353 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4346 instead of StringType to catch Unicode strings.
4354 instead of StringType to catch Unicode strings.
4347
4355
4348 * IPython/genutils.py (filefind): fixed bug for paths with
4356 * IPython/genutils.py (filefind): fixed bug for paths with
4349 embedded spaces (very common in Windows).
4357 embedded spaces (very common in Windows).
4350
4358
4351 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4359 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4352 files under Windows, so that they get automatically associated
4360 files under Windows, so that they get automatically associated
4353 with a text editor. Windows makes it a pain to handle
4361 with a text editor. Windows makes it a pain to handle
4354 extension-less files.
4362 extension-less files.
4355
4363
4356 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4364 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4357 warning about readline only occur for Posix. In Windows there's no
4365 warning about readline only occur for Posix. In Windows there's no
4358 way to get readline, so why bother with the warning.
4366 way to get readline, so why bother with the warning.
4359
4367
4360 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4368 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4361 for __str__ instead of dir(self), since dir() changed in 2.2.
4369 for __str__ instead of dir(self), since dir() changed in 2.2.
4362
4370
4363 * Ported to Windows! Tested on XP, I suspect it should work fine
4371 * Ported to Windows! Tested on XP, I suspect it should work fine
4364 on NT/2000, but I don't think it will work on 98 et al. That
4372 on NT/2000, but I don't think it will work on 98 et al. That
4365 series of Windows is such a piece of junk anyway that I won't try
4373 series of Windows is such a piece of junk anyway that I won't try
4366 porting it there. The XP port was straightforward, showed a few
4374 porting it there. The XP port was straightforward, showed a few
4367 bugs here and there (fixed all), in particular some string
4375 bugs here and there (fixed all), in particular some string
4368 handling stuff which required considering Unicode strings (which
4376 handling stuff which required considering Unicode strings (which
4369 Windows uses). This is good, but hasn't been too tested :) No
4377 Windows uses). This is good, but hasn't been too tested :) No
4370 fancy installer yet, I'll put a note in the manual so people at
4378 fancy installer yet, I'll put a note in the manual so people at
4371 least make manually a shortcut.
4379 least make manually a shortcut.
4372
4380
4373 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4381 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4374 into a single one, "colors". This now controls both prompt and
4382 into a single one, "colors". This now controls both prompt and
4375 exception color schemes, and can be changed both at startup
4383 exception color schemes, and can be changed both at startup
4376 (either via command-line switches or via ipythonrc files) and at
4384 (either via command-line switches or via ipythonrc files) and at
4377 runtime, with @colors.
4385 runtime, with @colors.
4378 (Magic.magic_run): renamed @prun to @run and removed the old
4386 (Magic.magic_run): renamed @prun to @run and removed the old
4379 @run. The two were too similar to warrant keeping both.
4387 @run. The two were too similar to warrant keeping both.
4380
4388
4381 2002-02-03 Fernando Perez <fperez@colorado.edu>
4389 2002-02-03 Fernando Perez <fperez@colorado.edu>
4382
4390
4383 * IPython/iplib.py (install_first_time): Added comment on how to
4391 * IPython/iplib.py (install_first_time): Added comment on how to
4384 configure the color options for first-time users. Put a <return>
4392 configure the color options for first-time users. Put a <return>
4385 request at the end so that small-terminal users get a chance to
4393 request at the end so that small-terminal users get a chance to
4386 read the startup info.
4394 read the startup info.
4387
4395
4388 2002-01-23 Fernando Perez <fperez@colorado.edu>
4396 2002-01-23 Fernando Perez <fperez@colorado.edu>
4389
4397
4390 * IPython/iplib.py (CachedOutput.update): Changed output memory
4398 * IPython/iplib.py (CachedOutput.update): Changed output memory
4391 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4399 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4392 input history we still use _i. Did this b/c these variable are
4400 input history we still use _i. Did this b/c these variable are
4393 very commonly used in interactive work, so the less we need to
4401 very commonly used in interactive work, so the less we need to
4394 type the better off we are.
4402 type the better off we are.
4395 (Magic.magic_prun): updated @prun to better handle the namespaces
4403 (Magic.magic_prun): updated @prun to better handle the namespaces
4396 the file will run in, including a fix for __name__ not being set
4404 the file will run in, including a fix for __name__ not being set
4397 before.
4405 before.
4398
4406
4399 2002-01-20 Fernando Perez <fperez@colorado.edu>
4407 2002-01-20 Fernando Perez <fperez@colorado.edu>
4400
4408
4401 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4409 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4402 extra garbage for Python 2.2. Need to look more carefully into
4410 extra garbage for Python 2.2. Need to look more carefully into
4403 this later.
4411 this later.
4404
4412
4405 2002-01-19 Fernando Perez <fperez@colorado.edu>
4413 2002-01-19 Fernando Perez <fperez@colorado.edu>
4406
4414
4407 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4415 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4408 display SyntaxError exceptions properly formatted when they occur
4416 display SyntaxError exceptions properly formatted when they occur
4409 (they can be triggered by imported code).
4417 (they can be triggered by imported code).
4410
4418
4411 2002-01-18 Fernando Perez <fperez@colorado.edu>
4419 2002-01-18 Fernando Perez <fperez@colorado.edu>
4412
4420
4413 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4421 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4414 SyntaxError exceptions are reported nicely formatted, instead of
4422 SyntaxError exceptions are reported nicely formatted, instead of
4415 spitting out only offset information as before.
4423 spitting out only offset information as before.
4416 (Magic.magic_prun): Added the @prun function for executing
4424 (Magic.magic_prun): Added the @prun function for executing
4417 programs with command line args inside IPython.
4425 programs with command line args inside IPython.
4418
4426
4419 2002-01-16 Fernando Perez <fperez@colorado.edu>
4427 2002-01-16 Fernando Perez <fperez@colorado.edu>
4420
4428
4421 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4429 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4422 to *not* include the last item given in a range. This brings their
4430 to *not* include the last item given in a range. This brings their
4423 behavior in line with Python's slicing:
4431 behavior in line with Python's slicing:
4424 a[n1:n2] -> a[n1]...a[n2-1]
4432 a[n1:n2] -> a[n1]...a[n2-1]
4425 It may be a bit less convenient, but I prefer to stick to Python's
4433 It may be a bit less convenient, but I prefer to stick to Python's
4426 conventions *everywhere*, so users never have to wonder.
4434 conventions *everywhere*, so users never have to wonder.
4427 (Magic.magic_macro): Added @macro function to ease the creation of
4435 (Magic.magic_macro): Added @macro function to ease the creation of
4428 macros.
4436 macros.
4429
4437
4430 2002-01-05 Fernando Perez <fperez@colorado.edu>
4438 2002-01-05 Fernando Perez <fperez@colorado.edu>
4431
4439
4432 * Released 0.2.4.
4440 * Released 0.2.4.
4433
4441
4434 * IPython/iplib.py (Magic.magic_pdef):
4442 * IPython/iplib.py (Magic.magic_pdef):
4435 (InteractiveShell.safe_execfile): report magic lines and error
4443 (InteractiveShell.safe_execfile): report magic lines and error
4436 lines without line numbers so one can easily copy/paste them for
4444 lines without line numbers so one can easily copy/paste them for
4437 re-execution.
4445 re-execution.
4438
4446
4439 * Updated manual with recent changes.
4447 * Updated manual with recent changes.
4440
4448
4441 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4449 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4442 docstring printing when class? is called. Very handy for knowing
4450 docstring printing when class? is called. Very handy for knowing
4443 how to create class instances (as long as __init__ is well
4451 how to create class instances (as long as __init__ is well
4444 documented, of course :)
4452 documented, of course :)
4445 (Magic.magic_doc): print both class and constructor docstrings.
4453 (Magic.magic_doc): print both class and constructor docstrings.
4446 (Magic.magic_pdef): give constructor info if passed a class and
4454 (Magic.magic_pdef): give constructor info if passed a class and
4447 __call__ info for callable object instances.
4455 __call__ info for callable object instances.
4448
4456
4449 2002-01-04 Fernando Perez <fperez@colorado.edu>
4457 2002-01-04 Fernando Perez <fperez@colorado.edu>
4450
4458
4451 * Made deep_reload() off by default. It doesn't always work
4459 * Made deep_reload() off by default. It doesn't always work
4452 exactly as intended, so it's probably safer to have it off. It's
4460 exactly as intended, so it's probably safer to have it off. It's
4453 still available as dreload() anyway, so nothing is lost.
4461 still available as dreload() anyway, so nothing is lost.
4454
4462
4455 2002-01-02 Fernando Perez <fperez@colorado.edu>
4463 2002-01-02 Fernando Perez <fperez@colorado.edu>
4456
4464
4457 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4465 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4458 so I wanted an updated release).
4466 so I wanted an updated release).
4459
4467
4460 2001-12-27 Fernando Perez <fperez@colorado.edu>
4468 2001-12-27 Fernando Perez <fperez@colorado.edu>
4461
4469
4462 * IPython/iplib.py (InteractiveShell.interact): Added the original
4470 * IPython/iplib.py (InteractiveShell.interact): Added the original
4463 code from 'code.py' for this module in order to change the
4471 code from 'code.py' for this module in order to change the
4464 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4472 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4465 the history cache would break when the user hit Ctrl-C, and
4473 the history cache would break when the user hit Ctrl-C, and
4466 interact() offers no way to add any hooks to it.
4474 interact() offers no way to add any hooks to it.
4467
4475
4468 2001-12-23 Fernando Perez <fperez@colorado.edu>
4476 2001-12-23 Fernando Perez <fperez@colorado.edu>
4469
4477
4470 * setup.py: added check for 'MANIFEST' before trying to remove
4478 * setup.py: added check for 'MANIFEST' before trying to remove
4471 it. Thanks to Sean Reifschneider.
4479 it. Thanks to Sean Reifschneider.
4472
4480
4473 2001-12-22 Fernando Perez <fperez@colorado.edu>
4481 2001-12-22 Fernando Perez <fperez@colorado.edu>
4474
4482
4475 * Released 0.2.2.
4483 * Released 0.2.2.
4476
4484
4477 * Finished (reasonably) writing the manual. Later will add the
4485 * Finished (reasonably) writing the manual. Later will add the
4478 python-standard navigation stylesheets, but for the time being
4486 python-standard navigation stylesheets, but for the time being
4479 it's fairly complete. Distribution will include html and pdf
4487 it's fairly complete. Distribution will include html and pdf
4480 versions.
4488 versions.
4481
4489
4482 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4490 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4483 (MayaVi author).
4491 (MayaVi author).
4484
4492
4485 2001-12-21 Fernando Perez <fperez@colorado.edu>
4493 2001-12-21 Fernando Perez <fperez@colorado.edu>
4486
4494
4487 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4495 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4488 good public release, I think (with the manual and the distutils
4496 good public release, I think (with the manual and the distutils
4489 installer). The manual can use some work, but that can go
4497 installer). The manual can use some work, but that can go
4490 slowly. Otherwise I think it's quite nice for end users. Next
4498 slowly. Otherwise I think it's quite nice for end users. Next
4491 summer, rewrite the guts of it...
4499 summer, rewrite the guts of it...
4492
4500
4493 * Changed format of ipythonrc files to use whitespace as the
4501 * Changed format of ipythonrc files to use whitespace as the
4494 separator instead of an explicit '='. Cleaner.
4502 separator instead of an explicit '='. Cleaner.
4495
4503
4496 2001-12-20 Fernando Perez <fperez@colorado.edu>
4504 2001-12-20 Fernando Perez <fperez@colorado.edu>
4497
4505
4498 * Started a manual in LyX. For now it's just a quick merge of the
4506 * Started a manual in LyX. For now it's just a quick merge of the
4499 various internal docstrings and READMEs. Later it may grow into a
4507 various internal docstrings and READMEs. Later it may grow into a
4500 nice, full-blown manual.
4508 nice, full-blown manual.
4501
4509
4502 * Set up a distutils based installer. Installation should now be
4510 * Set up a distutils based installer. Installation should now be
4503 trivially simple for end-users.
4511 trivially simple for end-users.
4504
4512
4505 2001-12-11 Fernando Perez <fperez@colorado.edu>
4513 2001-12-11 Fernando Perez <fperez@colorado.edu>
4506
4514
4507 * Released 0.2.0. First public release, announced it at
4515 * Released 0.2.0. First public release, announced it at
4508 comp.lang.python. From now on, just bugfixes...
4516 comp.lang.python. From now on, just bugfixes...
4509
4517
4510 * Went through all the files, set copyright/license notices and
4518 * Went through all the files, set copyright/license notices and
4511 cleaned up things. Ready for release.
4519 cleaned up things. Ready for release.
4512
4520
4513 2001-12-10 Fernando Perez <fperez@colorado.edu>
4521 2001-12-10 Fernando Perez <fperez@colorado.edu>
4514
4522
4515 * Changed the first-time installer not to use tarfiles. It's more
4523 * Changed the first-time installer not to use tarfiles. It's more
4516 robust now and less unix-dependent. Also makes it easier for
4524 robust now and less unix-dependent. Also makes it easier for
4517 people to later upgrade versions.
4525 people to later upgrade versions.
4518
4526
4519 * Changed @exit to @abort to reflect the fact that it's pretty
4527 * Changed @exit to @abort to reflect the fact that it's pretty
4520 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4528 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4521 becomes significant only when IPyhton is embedded: in that case,
4529 becomes significant only when IPyhton is embedded: in that case,
4522 C-D closes IPython only, but @abort kills the enclosing program
4530 C-D closes IPython only, but @abort kills the enclosing program
4523 too (unless it had called IPython inside a try catching
4531 too (unless it had called IPython inside a try catching
4524 SystemExit).
4532 SystemExit).
4525
4533
4526 * Created Shell module which exposes the actuall IPython Shell
4534 * Created Shell module which exposes the actuall IPython Shell
4527 classes, currently the normal and the embeddable one. This at
4535 classes, currently the normal and the embeddable one. This at
4528 least offers a stable interface we won't need to change when
4536 least offers a stable interface we won't need to change when
4529 (later) the internals are rewritten. That rewrite will be confined
4537 (later) the internals are rewritten. That rewrite will be confined
4530 to iplib and ipmaker, but the Shell interface should remain as is.
4538 to iplib and ipmaker, but the Shell interface should remain as is.
4531
4539
4532 * Added embed module which offers an embeddable IPShell object,
4540 * Added embed module which offers an embeddable IPShell object,
4533 useful to fire up IPython *inside* a running program. Great for
4541 useful to fire up IPython *inside* a running program. Great for
4534 debugging or dynamical data analysis.
4542 debugging or dynamical data analysis.
4535
4543
4536 2001-12-08 Fernando Perez <fperez@colorado.edu>
4544 2001-12-08 Fernando Perez <fperez@colorado.edu>
4537
4545
4538 * Fixed small bug preventing seeing info from methods of defined
4546 * Fixed small bug preventing seeing info from methods of defined
4539 objects (incorrect namespace in _ofind()).
4547 objects (incorrect namespace in _ofind()).
4540
4548
4541 * Documentation cleanup. Moved the main usage docstrings to a
4549 * Documentation cleanup. Moved the main usage docstrings to a
4542 separate file, usage.py (cleaner to maintain, and hopefully in the
4550 separate file, usage.py (cleaner to maintain, and hopefully in the
4543 future some perlpod-like way of producing interactive, man and
4551 future some perlpod-like way of producing interactive, man and
4544 html docs out of it will be found).
4552 html docs out of it will be found).
4545
4553
4546 * Added @profile to see your profile at any time.
4554 * Added @profile to see your profile at any time.
4547
4555
4548 * Added @p as an alias for 'print'. It's especially convenient if
4556 * Added @p as an alias for 'print'. It's especially convenient if
4549 using automagic ('p x' prints x).
4557 using automagic ('p x' prints x).
4550
4558
4551 * Small cleanups and fixes after a pychecker run.
4559 * Small cleanups and fixes after a pychecker run.
4552
4560
4553 * Changed the @cd command to handle @cd - and @cd -<n> for
4561 * Changed the @cd command to handle @cd - and @cd -<n> for
4554 visiting any directory in _dh.
4562 visiting any directory in _dh.
4555
4563
4556 * Introduced _dh, a history of visited directories. @dhist prints
4564 * Introduced _dh, a history of visited directories. @dhist prints
4557 it out with numbers.
4565 it out with numbers.
4558
4566
4559 2001-12-07 Fernando Perez <fperez@colorado.edu>
4567 2001-12-07 Fernando Perez <fperez@colorado.edu>
4560
4568
4561 * Released 0.1.22
4569 * Released 0.1.22
4562
4570
4563 * Made initialization a bit more robust against invalid color
4571 * Made initialization a bit more robust against invalid color
4564 options in user input (exit, not traceback-crash).
4572 options in user input (exit, not traceback-crash).
4565
4573
4566 * Changed the bug crash reporter to write the report only in the
4574 * Changed the bug crash reporter to write the report only in the
4567 user's .ipython directory. That way IPython won't litter people's
4575 user's .ipython directory. That way IPython won't litter people's
4568 hard disks with crash files all over the place. Also print on
4576 hard disks with crash files all over the place. Also print on
4569 screen the necessary mail command.
4577 screen the necessary mail command.
4570
4578
4571 * With the new ultraTB, implemented LightBG color scheme for light
4579 * With the new ultraTB, implemented LightBG color scheme for light
4572 background terminals. A lot of people like white backgrounds, so I
4580 background terminals. A lot of people like white backgrounds, so I
4573 guess we should at least give them something readable.
4581 guess we should at least give them something readable.
4574
4582
4575 2001-12-06 Fernando Perez <fperez@colorado.edu>
4583 2001-12-06 Fernando Perez <fperez@colorado.edu>
4576
4584
4577 * Modified the structure of ultraTB. Now there's a proper class
4585 * Modified the structure of ultraTB. Now there's a proper class
4578 for tables of color schemes which allow adding schemes easily and
4586 for tables of color schemes which allow adding schemes easily and
4579 switching the active scheme without creating a new instance every
4587 switching the active scheme without creating a new instance every
4580 time (which was ridiculous). The syntax for creating new schemes
4588 time (which was ridiculous). The syntax for creating new schemes
4581 is also cleaner. I think ultraTB is finally done, with a clean
4589 is also cleaner. I think ultraTB is finally done, with a clean
4582 class structure. Names are also much cleaner (now there's proper
4590 class structure. Names are also much cleaner (now there's proper
4583 color tables, no need for every variable to also have 'color' in
4591 color tables, no need for every variable to also have 'color' in
4584 its name).
4592 its name).
4585
4593
4586 * Broke down genutils into separate files. Now genutils only
4594 * Broke down genutils into separate files. Now genutils only
4587 contains utility functions, and classes have been moved to their
4595 contains utility functions, and classes have been moved to their
4588 own files (they had enough independent functionality to warrant
4596 own files (they had enough independent functionality to warrant
4589 it): ConfigLoader, OutputTrap, Struct.
4597 it): ConfigLoader, OutputTrap, Struct.
4590
4598
4591 2001-12-05 Fernando Perez <fperez@colorado.edu>
4599 2001-12-05 Fernando Perez <fperez@colorado.edu>
4592
4600
4593 * IPython turns 21! Released version 0.1.21, as a candidate for
4601 * IPython turns 21! Released version 0.1.21, as a candidate for
4594 public consumption. If all goes well, release in a few days.
4602 public consumption. If all goes well, release in a few days.
4595
4603
4596 * Fixed path bug (files in Extensions/ directory wouldn't be found
4604 * Fixed path bug (files in Extensions/ directory wouldn't be found
4597 unless IPython/ was explicitly in sys.path).
4605 unless IPython/ was explicitly in sys.path).
4598
4606
4599 * Extended the FlexCompleter class as MagicCompleter to allow
4607 * Extended the FlexCompleter class as MagicCompleter to allow
4600 completion of @-starting lines.
4608 completion of @-starting lines.
4601
4609
4602 * Created __release__.py file as a central repository for release
4610 * Created __release__.py file as a central repository for release
4603 info that other files can read from.
4611 info that other files can read from.
4604
4612
4605 * Fixed small bug in logging: when logging was turned on in
4613 * Fixed small bug in logging: when logging was turned on in
4606 mid-session, old lines with special meanings (!@?) were being
4614 mid-session, old lines with special meanings (!@?) were being
4607 logged without the prepended comment, which is necessary since
4615 logged without the prepended comment, which is necessary since
4608 they are not truly valid python syntax. This should make session
4616 they are not truly valid python syntax. This should make session
4609 restores produce less errors.
4617 restores produce less errors.
4610
4618
4611 * The namespace cleanup forced me to make a FlexCompleter class
4619 * The namespace cleanup forced me to make a FlexCompleter class
4612 which is nothing but a ripoff of rlcompleter, but with selectable
4620 which is nothing but a ripoff of rlcompleter, but with selectable
4613 namespace (rlcompleter only works in __main__.__dict__). I'll try
4621 namespace (rlcompleter only works in __main__.__dict__). I'll try
4614 to submit a note to the authors to see if this change can be
4622 to submit a note to the authors to see if this change can be
4615 incorporated in future rlcompleter releases (Dec.6: done)
4623 incorporated in future rlcompleter releases (Dec.6: done)
4616
4624
4617 * More fixes to namespace handling. It was a mess! Now all
4625 * More fixes to namespace handling. It was a mess! Now all
4618 explicit references to __main__.__dict__ are gone (except when
4626 explicit references to __main__.__dict__ are gone (except when
4619 really needed) and everything is handled through the namespace
4627 really needed) and everything is handled through the namespace
4620 dicts in the IPython instance. We seem to be getting somewhere
4628 dicts in the IPython instance. We seem to be getting somewhere
4621 with this, finally...
4629 with this, finally...
4622
4630
4623 * Small documentation updates.
4631 * Small documentation updates.
4624
4632
4625 * Created the Extensions directory under IPython (with an
4633 * Created the Extensions directory under IPython (with an
4626 __init__.py). Put the PhysicalQ stuff there. This directory should
4634 __init__.py). Put the PhysicalQ stuff there. This directory should
4627 be used for all special-purpose extensions.
4635 be used for all special-purpose extensions.
4628
4636
4629 * File renaming:
4637 * File renaming:
4630 ipythonlib --> ipmaker
4638 ipythonlib --> ipmaker
4631 ipplib --> iplib
4639 ipplib --> iplib
4632 This makes a bit more sense in terms of what these files actually do.
4640 This makes a bit more sense in terms of what these files actually do.
4633
4641
4634 * Moved all the classes and functions in ipythonlib to ipplib, so
4642 * Moved all the classes and functions in ipythonlib to ipplib, so
4635 now ipythonlib only has make_IPython(). This will ease up its
4643 now ipythonlib only has make_IPython(). This will ease up its
4636 splitting in smaller functional chunks later.
4644 splitting in smaller functional chunks later.
4637
4645
4638 * Cleaned up (done, I think) output of @whos. Better column
4646 * Cleaned up (done, I think) output of @whos. Better column
4639 formatting, and now shows str(var) for as much as it can, which is
4647 formatting, and now shows str(var) for as much as it can, which is
4640 typically what one gets with a 'print var'.
4648 typically what one gets with a 'print var'.
4641
4649
4642 2001-12-04 Fernando Perez <fperez@colorado.edu>
4650 2001-12-04 Fernando Perez <fperez@colorado.edu>
4643
4651
4644 * Fixed namespace problems. Now builtin/IPyhton/user names get
4652 * Fixed namespace problems. Now builtin/IPyhton/user names get
4645 properly reported in their namespace. Internal namespace handling
4653 properly reported in their namespace. Internal namespace handling
4646 is finally getting decent (not perfect yet, but much better than
4654 is finally getting decent (not perfect yet, but much better than
4647 the ad-hoc mess we had).
4655 the ad-hoc mess we had).
4648
4656
4649 * Removed -exit option. If people just want to run a python
4657 * Removed -exit option. If people just want to run a python
4650 script, that's what the normal interpreter is for. Less
4658 script, that's what the normal interpreter is for. Less
4651 unnecessary options, less chances for bugs.
4659 unnecessary options, less chances for bugs.
4652
4660
4653 * Added a crash handler which generates a complete post-mortem if
4661 * Added a crash handler which generates a complete post-mortem if
4654 IPython crashes. This will help a lot in tracking bugs down the
4662 IPython crashes. This will help a lot in tracking bugs down the
4655 road.
4663 road.
4656
4664
4657 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4665 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4658 which were boud to functions being reassigned would bypass the
4666 which were boud to functions being reassigned would bypass the
4659 logger, breaking the sync of _il with the prompt counter. This
4667 logger, breaking the sync of _il with the prompt counter. This
4660 would then crash IPython later when a new line was logged.
4668 would then crash IPython later when a new line was logged.
4661
4669
4662 2001-12-02 Fernando Perez <fperez@colorado.edu>
4670 2001-12-02 Fernando Perez <fperez@colorado.edu>
4663
4671
4664 * Made IPython a package. This means people don't have to clutter
4672 * Made IPython a package. This means people don't have to clutter
4665 their sys.path with yet another directory. Changed the INSTALL
4673 their sys.path with yet another directory. Changed the INSTALL
4666 file accordingly.
4674 file accordingly.
4667
4675
4668 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4676 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4669 sorts its output (so @who shows it sorted) and @whos formats the
4677 sorts its output (so @who shows it sorted) and @whos formats the
4670 table according to the width of the first column. Nicer, easier to
4678 table according to the width of the first column. Nicer, easier to
4671 read. Todo: write a generic table_format() which takes a list of
4679 read. Todo: write a generic table_format() which takes a list of
4672 lists and prints it nicely formatted, with optional row/column
4680 lists and prints it nicely formatted, with optional row/column
4673 separators and proper padding and justification.
4681 separators and proper padding and justification.
4674
4682
4675 * Released 0.1.20
4683 * Released 0.1.20
4676
4684
4677 * Fixed bug in @log which would reverse the inputcache list (a
4685 * Fixed bug in @log which would reverse the inputcache list (a
4678 copy operation was missing).
4686 copy operation was missing).
4679
4687
4680 * Code cleanup. @config was changed to use page(). Better, since
4688 * Code cleanup. @config was changed to use page(). Better, since
4681 its output is always quite long.
4689 its output is always quite long.
4682
4690
4683 * Itpl is back as a dependency. I was having too many problems
4691 * Itpl is back as a dependency. I was having too many problems
4684 getting the parametric aliases to work reliably, and it's just
4692 getting the parametric aliases to work reliably, and it's just
4685 easier to code weird string operations with it than playing %()s
4693 easier to code weird string operations with it than playing %()s
4686 games. It's only ~6k, so I don't think it's too big a deal.
4694 games. It's only ~6k, so I don't think it's too big a deal.
4687
4695
4688 * Found (and fixed) a very nasty bug with history. !lines weren't
4696 * Found (and fixed) a very nasty bug with history. !lines weren't
4689 getting cached, and the out of sync caches would crash
4697 getting cached, and the out of sync caches would crash
4690 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4698 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4691 division of labor a bit better. Bug fixed, cleaner structure.
4699 division of labor a bit better. Bug fixed, cleaner structure.
4692
4700
4693 2001-12-01 Fernando Perez <fperez@colorado.edu>
4701 2001-12-01 Fernando Perez <fperez@colorado.edu>
4694
4702
4695 * Released 0.1.19
4703 * Released 0.1.19
4696
4704
4697 * Added option -n to @hist to prevent line number printing. Much
4705 * Added option -n to @hist to prevent line number printing. Much
4698 easier to copy/paste code this way.
4706 easier to copy/paste code this way.
4699
4707
4700 * Created global _il to hold the input list. Allows easy
4708 * Created global _il to hold the input list. Allows easy
4701 re-execution of blocks of code by slicing it (inspired by Janko's
4709 re-execution of blocks of code by slicing it (inspired by Janko's
4702 comment on 'macros').
4710 comment on 'macros').
4703
4711
4704 * Small fixes and doc updates.
4712 * Small fixes and doc updates.
4705
4713
4706 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4714 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4707 much too fragile with automagic. Handles properly multi-line
4715 much too fragile with automagic. Handles properly multi-line
4708 statements and takes parameters.
4716 statements and takes parameters.
4709
4717
4710 2001-11-30 Fernando Perez <fperez@colorado.edu>
4718 2001-11-30 Fernando Perez <fperez@colorado.edu>
4711
4719
4712 * Version 0.1.18 released.
4720 * Version 0.1.18 released.
4713
4721
4714 * Fixed nasty namespace bug in initial module imports.
4722 * Fixed nasty namespace bug in initial module imports.
4715
4723
4716 * Added copyright/license notes to all code files (except
4724 * Added copyright/license notes to all code files (except
4717 DPyGetOpt). For the time being, LGPL. That could change.
4725 DPyGetOpt). For the time being, LGPL. That could change.
4718
4726
4719 * Rewrote a much nicer README, updated INSTALL, cleaned up
4727 * Rewrote a much nicer README, updated INSTALL, cleaned up
4720 ipythonrc-* samples.
4728 ipythonrc-* samples.
4721
4729
4722 * Overall code/documentation cleanup. Basically ready for
4730 * Overall code/documentation cleanup. Basically ready for
4723 release. Only remaining thing: licence decision (LGPL?).
4731 release. Only remaining thing: licence decision (LGPL?).
4724
4732
4725 * Converted load_config to a class, ConfigLoader. Now recursion
4733 * Converted load_config to a class, ConfigLoader. Now recursion
4726 control is better organized. Doesn't include the same file twice.
4734 control is better organized. Doesn't include the same file twice.
4727
4735
4728 2001-11-29 Fernando Perez <fperez@colorado.edu>
4736 2001-11-29 Fernando Perez <fperez@colorado.edu>
4729
4737
4730 * Got input history working. Changed output history variables from
4738 * Got input history working. Changed output history variables from
4731 _p to _o so that _i is for input and _o for output. Just cleaner
4739 _p to _o so that _i is for input and _o for output. Just cleaner
4732 convention.
4740 convention.
4733
4741
4734 * Implemented parametric aliases. This pretty much allows the
4742 * Implemented parametric aliases. This pretty much allows the
4735 alias system to offer full-blown shell convenience, I think.
4743 alias system to offer full-blown shell convenience, I think.
4736
4744
4737 * Version 0.1.17 released, 0.1.18 opened.
4745 * Version 0.1.17 released, 0.1.18 opened.
4738
4746
4739 * dot_ipython/ipythonrc (alias): added documentation.
4747 * dot_ipython/ipythonrc (alias): added documentation.
4740 (xcolor): Fixed small bug (xcolors -> xcolor)
4748 (xcolor): Fixed small bug (xcolors -> xcolor)
4741
4749
4742 * Changed the alias system. Now alias is a magic command to define
4750 * Changed the alias system. Now alias is a magic command to define
4743 aliases just like the shell. Rationale: the builtin magics should
4751 aliases just like the shell. Rationale: the builtin magics should
4744 be there for things deeply connected to IPython's
4752 be there for things deeply connected to IPython's
4745 architecture. And this is a much lighter system for what I think
4753 architecture. And this is a much lighter system for what I think
4746 is the really important feature: allowing users to define quickly
4754 is the really important feature: allowing users to define quickly
4747 magics that will do shell things for them, so they can customize
4755 magics that will do shell things for them, so they can customize
4748 IPython easily to match their work habits. If someone is really
4756 IPython easily to match their work habits. If someone is really
4749 desperate to have another name for a builtin alias, they can
4757 desperate to have another name for a builtin alias, they can
4750 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4758 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4751 works.
4759 works.
4752
4760
4753 2001-11-28 Fernando Perez <fperez@colorado.edu>
4761 2001-11-28 Fernando Perez <fperez@colorado.edu>
4754
4762
4755 * Changed @file so that it opens the source file at the proper
4763 * Changed @file so that it opens the source file at the proper
4756 line. Since it uses less, if your EDITOR environment is
4764 line. Since it uses less, if your EDITOR environment is
4757 configured, typing v will immediately open your editor of choice
4765 configured, typing v will immediately open your editor of choice
4758 right at the line where the object is defined. Not as quick as
4766 right at the line where the object is defined. Not as quick as
4759 having a direct @edit command, but for all intents and purposes it
4767 having a direct @edit command, but for all intents and purposes it
4760 works. And I don't have to worry about writing @edit to deal with
4768 works. And I don't have to worry about writing @edit to deal with
4761 all the editors, less does that.
4769 all the editors, less does that.
4762
4770
4763 * Version 0.1.16 released, 0.1.17 opened.
4771 * Version 0.1.16 released, 0.1.17 opened.
4764
4772
4765 * Fixed some nasty bugs in the page/page_dumb combo that could
4773 * Fixed some nasty bugs in the page/page_dumb combo that could
4766 crash IPython.
4774 crash IPython.
4767
4775
4768 2001-11-27 Fernando Perez <fperez@colorado.edu>
4776 2001-11-27 Fernando Perez <fperez@colorado.edu>
4769
4777
4770 * Version 0.1.15 released, 0.1.16 opened.
4778 * Version 0.1.15 released, 0.1.16 opened.
4771
4779
4772 * Finally got ? and ?? to work for undefined things: now it's
4780 * Finally got ? and ?? to work for undefined things: now it's
4773 possible to type {}.get? and get information about the get method
4781 possible to type {}.get? and get information about the get method
4774 of dicts, or os.path? even if only os is defined (so technically
4782 of dicts, or os.path? even if only os is defined (so technically
4775 os.path isn't). Works at any level. For example, after import os,
4783 os.path isn't). Works at any level. For example, after import os,
4776 os?, os.path?, os.path.abspath? all work. This is great, took some
4784 os?, os.path?, os.path.abspath? all work. This is great, took some
4777 work in _ofind.
4785 work in _ofind.
4778
4786
4779 * Fixed more bugs with logging. The sanest way to do it was to add
4787 * Fixed more bugs with logging. The sanest way to do it was to add
4780 to @log a 'mode' parameter. Killed two in one shot (this mode
4788 to @log a 'mode' parameter. Killed two in one shot (this mode
4781 option was a request of Janko's). I think it's finally clean
4789 option was a request of Janko's). I think it's finally clean
4782 (famous last words).
4790 (famous last words).
4783
4791
4784 * Added a page_dumb() pager which does a decent job of paging on
4792 * Added a page_dumb() pager which does a decent job of paging on
4785 screen, if better things (like less) aren't available. One less
4793 screen, if better things (like less) aren't available. One less
4786 unix dependency (someday maybe somebody will port this to
4794 unix dependency (someday maybe somebody will port this to
4787 windows).
4795 windows).
4788
4796
4789 * Fixed problem in magic_log: would lock of logging out if log
4797 * Fixed problem in magic_log: would lock of logging out if log
4790 creation failed (because it would still think it had succeeded).
4798 creation failed (because it would still think it had succeeded).
4791
4799
4792 * Improved the page() function using curses to auto-detect screen
4800 * Improved the page() function using curses to auto-detect screen
4793 size. Now it can make a much better decision on whether to print
4801 size. Now it can make a much better decision on whether to print
4794 or page a string. Option screen_length was modified: a value 0
4802 or page a string. Option screen_length was modified: a value 0
4795 means auto-detect, and that's the default now.
4803 means auto-detect, and that's the default now.
4796
4804
4797 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4805 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4798 go out. I'll test it for a few days, then talk to Janko about
4806 go out. I'll test it for a few days, then talk to Janko about
4799 licences and announce it.
4807 licences and announce it.
4800
4808
4801 * Fixed the length of the auto-generated ---> prompt which appears
4809 * Fixed the length of the auto-generated ---> prompt which appears
4802 for auto-parens and auto-quotes. Getting this right isn't trivial,
4810 for auto-parens and auto-quotes. Getting this right isn't trivial,
4803 with all the color escapes, different prompt types and optional
4811 with all the color escapes, different prompt types and optional
4804 separators. But it seems to be working in all the combinations.
4812 separators. But it seems to be working in all the combinations.
4805
4813
4806 2001-11-26 Fernando Perez <fperez@colorado.edu>
4814 2001-11-26 Fernando Perez <fperez@colorado.edu>
4807
4815
4808 * Wrote a regexp filter to get option types from the option names
4816 * Wrote a regexp filter to get option types from the option names
4809 string. This eliminates the need to manually keep two duplicate
4817 string. This eliminates the need to manually keep two duplicate
4810 lists.
4818 lists.
4811
4819
4812 * Removed the unneeded check_option_names. Now options are handled
4820 * Removed the unneeded check_option_names. Now options are handled
4813 in a much saner manner and it's easy to visually check that things
4821 in a much saner manner and it's easy to visually check that things
4814 are ok.
4822 are ok.
4815
4823
4816 * Updated version numbers on all files I modified to carry a
4824 * Updated version numbers on all files I modified to carry a
4817 notice so Janko and Nathan have clear version markers.
4825 notice so Janko and Nathan have clear version markers.
4818
4826
4819 * Updated docstring for ultraTB with my changes. I should send
4827 * Updated docstring for ultraTB with my changes. I should send
4820 this to Nathan.
4828 this to Nathan.
4821
4829
4822 * Lots of small fixes. Ran everything through pychecker again.
4830 * Lots of small fixes. Ran everything through pychecker again.
4823
4831
4824 * Made loading of deep_reload an cmd line option. If it's not too
4832 * Made loading of deep_reload an cmd line option. If it's not too
4825 kosher, now people can just disable it. With -nodeep_reload it's
4833 kosher, now people can just disable it. With -nodeep_reload it's
4826 still available as dreload(), it just won't overwrite reload().
4834 still available as dreload(), it just won't overwrite reload().
4827
4835
4828 * Moved many options to the no| form (-opt and -noopt
4836 * Moved many options to the no| form (-opt and -noopt
4829 accepted). Cleaner.
4837 accepted). Cleaner.
4830
4838
4831 * Changed magic_log so that if called with no parameters, it uses
4839 * Changed magic_log so that if called with no parameters, it uses
4832 'rotate' mode. That way auto-generated logs aren't automatically
4840 'rotate' mode. That way auto-generated logs aren't automatically
4833 over-written. For normal logs, now a backup is made if it exists
4841 over-written. For normal logs, now a backup is made if it exists
4834 (only 1 level of backups). A new 'backup' mode was added to the
4842 (only 1 level of backups). A new 'backup' mode was added to the
4835 Logger class to support this. This was a request by Janko.
4843 Logger class to support this. This was a request by Janko.
4836
4844
4837 * Added @logoff/@logon to stop/restart an active log.
4845 * Added @logoff/@logon to stop/restart an active log.
4838
4846
4839 * Fixed a lot of bugs in log saving/replay. It was pretty
4847 * Fixed a lot of bugs in log saving/replay. It was pretty
4840 broken. Now special lines (!@,/) appear properly in the command
4848 broken. Now special lines (!@,/) appear properly in the command
4841 history after a log replay.
4849 history after a log replay.
4842
4850
4843 * Tried and failed to implement full session saving via pickle. My
4851 * Tried and failed to implement full session saving via pickle. My
4844 idea was to pickle __main__.__dict__, but modules can't be
4852 idea was to pickle __main__.__dict__, but modules can't be
4845 pickled. This would be a better alternative to replaying logs, but
4853 pickled. This would be a better alternative to replaying logs, but
4846 seems quite tricky to get to work. Changed -session to be called
4854 seems quite tricky to get to work. Changed -session to be called
4847 -logplay, which more accurately reflects what it does. And if we
4855 -logplay, which more accurately reflects what it does. And if we
4848 ever get real session saving working, -session is now available.
4856 ever get real session saving working, -session is now available.
4849
4857
4850 * Implemented color schemes for prompts also. As for tracebacks,
4858 * Implemented color schemes for prompts also. As for tracebacks,
4851 currently only NoColor and Linux are supported. But now the
4859 currently only NoColor and Linux are supported. But now the
4852 infrastructure is in place, based on a generic ColorScheme
4860 infrastructure is in place, based on a generic ColorScheme
4853 class. So writing and activating new schemes both for the prompts
4861 class. So writing and activating new schemes both for the prompts
4854 and the tracebacks should be straightforward.
4862 and the tracebacks should be straightforward.
4855
4863
4856 * Version 0.1.13 released, 0.1.14 opened.
4864 * Version 0.1.13 released, 0.1.14 opened.
4857
4865
4858 * Changed handling of options for output cache. Now counter is
4866 * Changed handling of options for output cache. Now counter is
4859 hardwired starting at 1 and one specifies the maximum number of
4867 hardwired starting at 1 and one specifies the maximum number of
4860 entries *in the outcache* (not the max prompt counter). This is
4868 entries *in the outcache* (not the max prompt counter). This is
4861 much better, since many statements won't increase the cache
4869 much better, since many statements won't increase the cache
4862 count. It also eliminated some confusing options, now there's only
4870 count. It also eliminated some confusing options, now there's only
4863 one: cache_size.
4871 one: cache_size.
4864
4872
4865 * Added 'alias' magic function and magic_alias option in the
4873 * Added 'alias' magic function and magic_alias option in the
4866 ipythonrc file. Now the user can easily define whatever names he
4874 ipythonrc file. Now the user can easily define whatever names he
4867 wants for the magic functions without having to play weird
4875 wants for the magic functions without having to play weird
4868 namespace games. This gives IPython a real shell-like feel.
4876 namespace games. This gives IPython a real shell-like feel.
4869
4877
4870 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4878 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4871 @ or not).
4879 @ or not).
4872
4880
4873 This was one of the last remaining 'visible' bugs (that I know
4881 This was one of the last remaining 'visible' bugs (that I know
4874 of). I think if I can clean up the session loading so it works
4882 of). I think if I can clean up the session loading so it works
4875 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4883 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4876 about licensing).
4884 about licensing).
4877
4885
4878 2001-11-25 Fernando Perez <fperez@colorado.edu>
4886 2001-11-25 Fernando Perez <fperez@colorado.edu>
4879
4887
4880 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4888 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4881 there's a cleaner distinction between what ? and ?? show.
4889 there's a cleaner distinction between what ? and ?? show.
4882
4890
4883 * Added screen_length option. Now the user can define his own
4891 * Added screen_length option. Now the user can define his own
4884 screen size for page() operations.
4892 screen size for page() operations.
4885
4893
4886 * Implemented magic shell-like functions with automatic code
4894 * Implemented magic shell-like functions with automatic code
4887 generation. Now adding another function is just a matter of adding
4895 generation. Now adding another function is just a matter of adding
4888 an entry to a dict, and the function is dynamically generated at
4896 an entry to a dict, and the function is dynamically generated at
4889 run-time. Python has some really cool features!
4897 run-time. Python has some really cool features!
4890
4898
4891 * Renamed many options to cleanup conventions a little. Now all
4899 * Renamed many options to cleanup conventions a little. Now all
4892 are lowercase, and only underscores where needed. Also in the code
4900 are lowercase, and only underscores where needed. Also in the code
4893 option name tables are clearer.
4901 option name tables are clearer.
4894
4902
4895 * Changed prompts a little. Now input is 'In [n]:' instead of
4903 * Changed prompts a little. Now input is 'In [n]:' instead of
4896 'In[n]:='. This allows it the numbers to be aligned with the
4904 'In[n]:='. This allows it the numbers to be aligned with the
4897 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4905 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4898 Python (it was a Mathematica thing). The '...' continuation prompt
4906 Python (it was a Mathematica thing). The '...' continuation prompt
4899 was also changed a little to align better.
4907 was also changed a little to align better.
4900
4908
4901 * Fixed bug when flushing output cache. Not all _p<n> variables
4909 * Fixed bug when flushing output cache. Not all _p<n> variables
4902 exist, so their deletion needs to be wrapped in a try:
4910 exist, so their deletion needs to be wrapped in a try:
4903
4911
4904 * Figured out how to properly use inspect.formatargspec() (it
4912 * Figured out how to properly use inspect.formatargspec() (it
4905 requires the args preceded by *). So I removed all the code from
4913 requires the args preceded by *). So I removed all the code from
4906 _get_pdef in Magic, which was just replicating that.
4914 _get_pdef in Magic, which was just replicating that.
4907
4915
4908 * Added test to prefilter to allow redefining magic function names
4916 * Added test to prefilter to allow redefining magic function names
4909 as variables. This is ok, since the @ form is always available,
4917 as variables. This is ok, since the @ form is always available,
4910 but whe should allow the user to define a variable called 'ls' if
4918 but whe should allow the user to define a variable called 'ls' if
4911 he needs it.
4919 he needs it.
4912
4920
4913 * Moved the ToDo information from README into a separate ToDo.
4921 * Moved the ToDo information from README into a separate ToDo.
4914
4922
4915 * General code cleanup and small bugfixes. I think it's close to a
4923 * General code cleanup and small bugfixes. I think it's close to a
4916 state where it can be released, obviously with a big 'beta'
4924 state where it can be released, obviously with a big 'beta'
4917 warning on it.
4925 warning on it.
4918
4926
4919 * Got the magic function split to work. Now all magics are defined
4927 * Got the magic function split to work. Now all magics are defined
4920 in a separate class. It just organizes things a bit, and now
4928 in a separate class. It just organizes things a bit, and now
4921 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4929 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4922 was too long).
4930 was too long).
4923
4931
4924 * Changed @clear to @reset to avoid potential confusions with
4932 * Changed @clear to @reset to avoid potential confusions with
4925 the shell command clear. Also renamed @cl to @clear, which does
4933 the shell command clear. Also renamed @cl to @clear, which does
4926 exactly what people expect it to from their shell experience.
4934 exactly what people expect it to from their shell experience.
4927
4935
4928 Added a check to the @reset command (since it's so
4936 Added a check to the @reset command (since it's so
4929 destructive, it's probably a good idea to ask for confirmation).
4937 destructive, it's probably a good idea to ask for confirmation).
4930 But now reset only works for full namespace resetting. Since the
4938 But now reset only works for full namespace resetting. Since the
4931 del keyword is already there for deleting a few specific
4939 del keyword is already there for deleting a few specific
4932 variables, I don't see the point of having a redundant magic
4940 variables, I don't see the point of having a redundant magic
4933 function for the same task.
4941 function for the same task.
4934
4942
4935 2001-11-24 Fernando Perez <fperez@colorado.edu>
4943 2001-11-24 Fernando Perez <fperez@colorado.edu>
4936
4944
4937 * Updated the builtin docs (esp. the ? ones).
4945 * Updated the builtin docs (esp. the ? ones).
4938
4946
4939 * Ran all the code through pychecker. Not terribly impressed with
4947 * Ran all the code through pychecker. Not terribly impressed with
4940 it: lots of spurious warnings and didn't really find anything of
4948 it: lots of spurious warnings and didn't really find anything of
4941 substance (just a few modules being imported and not used).
4949 substance (just a few modules being imported and not used).
4942
4950
4943 * Implemented the new ultraTB functionality into IPython. New
4951 * Implemented the new ultraTB functionality into IPython. New
4944 option: xcolors. This chooses color scheme. xmode now only selects
4952 option: xcolors. This chooses color scheme. xmode now only selects
4945 between Plain and Verbose. Better orthogonality.
4953 between Plain and Verbose. Better orthogonality.
4946
4954
4947 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4955 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4948 mode and color scheme for the exception handlers. Now it's
4956 mode and color scheme for the exception handlers. Now it's
4949 possible to have the verbose traceback with no coloring.
4957 possible to have the verbose traceback with no coloring.
4950
4958
4951 2001-11-23 Fernando Perez <fperez@colorado.edu>
4959 2001-11-23 Fernando Perez <fperez@colorado.edu>
4952
4960
4953 * Version 0.1.12 released, 0.1.13 opened.
4961 * Version 0.1.12 released, 0.1.13 opened.
4954
4962
4955 * Removed option to set auto-quote and auto-paren escapes by
4963 * Removed option to set auto-quote and auto-paren escapes by
4956 user. The chances of breaking valid syntax are just too high. If
4964 user. The chances of breaking valid syntax are just too high. If
4957 someone *really* wants, they can always dig into the code.
4965 someone *really* wants, they can always dig into the code.
4958
4966
4959 * Made prompt separators configurable.
4967 * Made prompt separators configurable.
4960
4968
4961 2001-11-22 Fernando Perez <fperez@colorado.edu>
4969 2001-11-22 Fernando Perez <fperez@colorado.edu>
4962
4970
4963 * Small bugfixes in many places.
4971 * Small bugfixes in many places.
4964
4972
4965 * Removed the MyCompleter class from ipplib. It seemed redundant
4973 * Removed the MyCompleter class from ipplib. It seemed redundant
4966 with the C-p,C-n history search functionality. Less code to
4974 with the C-p,C-n history search functionality. Less code to
4967 maintain.
4975 maintain.
4968
4976
4969 * Moved all the original ipython.py code into ipythonlib.py. Right
4977 * Moved all the original ipython.py code into ipythonlib.py. Right
4970 now it's just one big dump into a function called make_IPython, so
4978 now it's just one big dump into a function called make_IPython, so
4971 no real modularity has been gained. But at least it makes the
4979 no real modularity has been gained. But at least it makes the
4972 wrapper script tiny, and since ipythonlib is a module, it gets
4980 wrapper script tiny, and since ipythonlib is a module, it gets
4973 compiled and startup is much faster.
4981 compiled and startup is much faster.
4974
4982
4975 This is a reasobably 'deep' change, so we should test it for a
4983 This is a reasobably 'deep' change, so we should test it for a
4976 while without messing too much more with the code.
4984 while without messing too much more with the code.
4977
4985
4978 2001-11-21 Fernando Perez <fperez@colorado.edu>
4986 2001-11-21 Fernando Perez <fperez@colorado.edu>
4979
4987
4980 * Version 0.1.11 released, 0.1.12 opened for further work.
4988 * Version 0.1.11 released, 0.1.12 opened for further work.
4981
4989
4982 * Removed dependency on Itpl. It was only needed in one place. It
4990 * Removed dependency on Itpl. It was only needed in one place. It
4983 would be nice if this became part of python, though. It makes life
4991 would be nice if this became part of python, though. It makes life
4984 *a lot* easier in some cases.
4992 *a lot* easier in some cases.
4985
4993
4986 * Simplified the prefilter code a bit. Now all handlers are
4994 * Simplified the prefilter code a bit. Now all handlers are
4987 expected to explicitly return a value (at least a blank string).
4995 expected to explicitly return a value (at least a blank string).
4988
4996
4989 * Heavy edits in ipplib. Removed the help system altogether. Now
4997 * Heavy edits in ipplib. Removed the help system altogether. Now
4990 obj?/?? is used for inspecting objects, a magic @doc prints
4998 obj?/?? is used for inspecting objects, a magic @doc prints
4991 docstrings, and full-blown Python help is accessed via the 'help'
4999 docstrings, and full-blown Python help is accessed via the 'help'
4992 keyword. This cleans up a lot of code (less to maintain) and does
5000 keyword. This cleans up a lot of code (less to maintain) and does
4993 the job. Since 'help' is now a standard Python component, might as
5001 the job. Since 'help' is now a standard Python component, might as
4994 well use it and remove duplicate functionality.
5002 well use it and remove duplicate functionality.
4995
5003
4996 Also removed the option to use ipplib as a standalone program. By
5004 Also removed the option to use ipplib as a standalone program. By
4997 now it's too dependent on other parts of IPython to function alone.
5005 now it's too dependent on other parts of IPython to function alone.
4998
5006
4999 * Fixed bug in genutils.pager. It would crash if the pager was
5007 * Fixed bug in genutils.pager. It would crash if the pager was
5000 exited immediately after opening (broken pipe).
5008 exited immediately after opening (broken pipe).
5001
5009
5002 * Trimmed down the VerboseTB reporting a little. The header is
5010 * Trimmed down the VerboseTB reporting a little. The header is
5003 much shorter now and the repeated exception arguments at the end
5011 much shorter now and the repeated exception arguments at the end
5004 have been removed. For interactive use the old header seemed a bit
5012 have been removed. For interactive use the old header seemed a bit
5005 excessive.
5013 excessive.
5006
5014
5007 * Fixed small bug in output of @whos for variables with multi-word
5015 * Fixed small bug in output of @whos for variables with multi-word
5008 types (only first word was displayed).
5016 types (only first word was displayed).
5009
5017
5010 2001-11-17 Fernando Perez <fperez@colorado.edu>
5018 2001-11-17 Fernando Perez <fperez@colorado.edu>
5011
5019
5012 * Version 0.1.10 released, 0.1.11 opened for further work.
5020 * Version 0.1.10 released, 0.1.11 opened for further work.
5013
5021
5014 * Modified dirs and friends. dirs now *returns* the stack (not
5022 * Modified dirs and friends. dirs now *returns* the stack (not
5015 prints), so one can manipulate it as a variable. Convenient to
5023 prints), so one can manipulate it as a variable. Convenient to
5016 travel along many directories.
5024 travel along many directories.
5017
5025
5018 * Fixed bug in magic_pdef: would only work with functions with
5026 * Fixed bug in magic_pdef: would only work with functions with
5019 arguments with default values.
5027 arguments with default values.
5020
5028
5021 2001-11-14 Fernando Perez <fperez@colorado.edu>
5029 2001-11-14 Fernando Perez <fperez@colorado.edu>
5022
5030
5023 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5031 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5024 example with IPython. Various other minor fixes and cleanups.
5032 example with IPython. Various other minor fixes and cleanups.
5025
5033
5026 * Version 0.1.9 released, 0.1.10 opened for further work.
5034 * Version 0.1.9 released, 0.1.10 opened for further work.
5027
5035
5028 * Added sys.path to the list of directories searched in the
5036 * Added sys.path to the list of directories searched in the
5029 execfile= option. It used to be the current directory and the
5037 execfile= option. It used to be the current directory and the
5030 user's IPYTHONDIR only.
5038 user's IPYTHONDIR only.
5031
5039
5032 2001-11-13 Fernando Perez <fperez@colorado.edu>
5040 2001-11-13 Fernando Perez <fperez@colorado.edu>
5033
5041
5034 * Reinstated the raw_input/prefilter separation that Janko had
5042 * Reinstated the raw_input/prefilter separation that Janko had
5035 initially. This gives a more convenient setup for extending the
5043 initially. This gives a more convenient setup for extending the
5036 pre-processor from the outside: raw_input always gets a string,
5044 pre-processor from the outside: raw_input always gets a string,
5037 and prefilter has to process it. We can then redefine prefilter
5045 and prefilter has to process it. We can then redefine prefilter
5038 from the outside and implement extensions for special
5046 from the outside and implement extensions for special
5039 purposes.
5047 purposes.
5040
5048
5041 Today I got one for inputting PhysicalQuantity objects
5049 Today I got one for inputting PhysicalQuantity objects
5042 (from Scientific) without needing any function calls at
5050 (from Scientific) without needing any function calls at
5043 all. Extremely convenient, and it's all done as a user-level
5051 all. Extremely convenient, and it's all done as a user-level
5044 extension (no IPython code was touched). Now instead of:
5052 extension (no IPython code was touched). Now instead of:
5045 a = PhysicalQuantity(4.2,'m/s**2')
5053 a = PhysicalQuantity(4.2,'m/s**2')
5046 one can simply say
5054 one can simply say
5047 a = 4.2 m/s**2
5055 a = 4.2 m/s**2
5048 or even
5056 or even
5049 a = 4.2 m/s^2
5057 a = 4.2 m/s^2
5050
5058
5051 I use this, but it's also a proof of concept: IPython really is
5059 I use this, but it's also a proof of concept: IPython really is
5052 fully user-extensible, even at the level of the parsing of the
5060 fully user-extensible, even at the level of the parsing of the
5053 command line. It's not trivial, but it's perfectly doable.
5061 command line. It's not trivial, but it's perfectly doable.
5054
5062
5055 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5063 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5056 the problem of modules being loaded in the inverse order in which
5064 the problem of modules being loaded in the inverse order in which
5057 they were defined in
5065 they were defined in
5058
5066
5059 * Version 0.1.8 released, 0.1.9 opened for further work.
5067 * Version 0.1.8 released, 0.1.9 opened for further work.
5060
5068
5061 * Added magics pdef, source and file. They respectively show the
5069 * Added magics pdef, source and file. They respectively show the
5062 definition line ('prototype' in C), source code and full python
5070 definition line ('prototype' in C), source code and full python
5063 file for any callable object. The object inspector oinfo uses
5071 file for any callable object. The object inspector oinfo uses
5064 these to show the same information.
5072 these to show the same information.
5065
5073
5066 * Version 0.1.7 released, 0.1.8 opened for further work.
5074 * Version 0.1.7 released, 0.1.8 opened for further work.
5067
5075
5068 * Separated all the magic functions into a class called Magic. The
5076 * Separated all the magic functions into a class called Magic. The
5069 InteractiveShell class was becoming too big for Xemacs to handle
5077 InteractiveShell class was becoming too big for Xemacs to handle
5070 (de-indenting a line would lock it up for 10 seconds while it
5078 (de-indenting a line would lock it up for 10 seconds while it
5071 backtracked on the whole class!)
5079 backtracked on the whole class!)
5072
5080
5073 FIXME: didn't work. It can be done, but right now namespaces are
5081 FIXME: didn't work. It can be done, but right now namespaces are
5074 all messed up. Do it later (reverted it for now, so at least
5082 all messed up. Do it later (reverted it for now, so at least
5075 everything works as before).
5083 everything works as before).
5076
5084
5077 * Got the object introspection system (magic_oinfo) working! I
5085 * Got the object introspection system (magic_oinfo) working! I
5078 think this is pretty much ready for release to Janko, so he can
5086 think this is pretty much ready for release to Janko, so he can
5079 test it for a while and then announce it. Pretty much 100% of what
5087 test it for a while and then announce it. Pretty much 100% of what
5080 I wanted for the 'phase 1' release is ready. Happy, tired.
5088 I wanted for the 'phase 1' release is ready. Happy, tired.
5081
5089
5082 2001-11-12 Fernando Perez <fperez@colorado.edu>
5090 2001-11-12 Fernando Perez <fperez@colorado.edu>
5083
5091
5084 * Version 0.1.6 released, 0.1.7 opened for further work.
5092 * Version 0.1.6 released, 0.1.7 opened for further work.
5085
5093
5086 * Fixed bug in printing: it used to test for truth before
5094 * Fixed bug in printing: it used to test for truth before
5087 printing, so 0 wouldn't print. Now checks for None.
5095 printing, so 0 wouldn't print. Now checks for None.
5088
5096
5089 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5097 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5090 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5098 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5091 reaches by hand into the outputcache. Think of a better way to do
5099 reaches by hand into the outputcache. Think of a better way to do
5092 this later.
5100 this later.
5093
5101
5094 * Various small fixes thanks to Nathan's comments.
5102 * Various small fixes thanks to Nathan's comments.
5095
5103
5096 * Changed magic_pprint to magic_Pprint. This way it doesn't
5104 * Changed magic_pprint to magic_Pprint. This way it doesn't
5097 collide with pprint() and the name is consistent with the command
5105 collide with pprint() and the name is consistent with the command
5098 line option.
5106 line option.
5099
5107
5100 * Changed prompt counter behavior to be fully like
5108 * Changed prompt counter behavior to be fully like
5101 Mathematica's. That is, even input that doesn't return a result
5109 Mathematica's. That is, even input that doesn't return a result
5102 raises the prompt counter. The old behavior was kind of confusing
5110 raises the prompt counter. The old behavior was kind of confusing
5103 (getting the same prompt number several times if the operation
5111 (getting the same prompt number several times if the operation
5104 didn't return a result).
5112 didn't return a result).
5105
5113
5106 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5114 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5107
5115
5108 * Fixed -Classic mode (wasn't working anymore).
5116 * Fixed -Classic mode (wasn't working anymore).
5109
5117
5110 * Added colored prompts using Nathan's new code. Colors are
5118 * Added colored prompts using Nathan's new code. Colors are
5111 currently hardwired, they can be user-configurable. For
5119 currently hardwired, they can be user-configurable. For
5112 developers, they can be chosen in file ipythonlib.py, at the
5120 developers, they can be chosen in file ipythonlib.py, at the
5113 beginning of the CachedOutput class def.
5121 beginning of the CachedOutput class def.
5114
5122
5115 2001-11-11 Fernando Perez <fperez@colorado.edu>
5123 2001-11-11 Fernando Perez <fperez@colorado.edu>
5116
5124
5117 * Version 0.1.5 released, 0.1.6 opened for further work.
5125 * Version 0.1.5 released, 0.1.6 opened for further work.
5118
5126
5119 * Changed magic_env to *return* the environment as a dict (not to
5127 * Changed magic_env to *return* the environment as a dict (not to
5120 print it). This way it prints, but it can also be processed.
5128 print it). This way it prints, but it can also be processed.
5121
5129
5122 * Added Verbose exception reporting to interactive
5130 * Added Verbose exception reporting to interactive
5123 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5131 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5124 traceback. Had to make some changes to the ultraTB file. This is
5132 traceback. Had to make some changes to the ultraTB file. This is
5125 probably the last 'big' thing in my mental todo list. This ties
5133 probably the last 'big' thing in my mental todo list. This ties
5126 in with the next entry:
5134 in with the next entry:
5127
5135
5128 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5136 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5129 has to specify is Plain, Color or Verbose for all exception
5137 has to specify is Plain, Color or Verbose for all exception
5130 handling.
5138 handling.
5131
5139
5132 * Removed ShellServices option. All this can really be done via
5140 * Removed ShellServices option. All this can really be done via
5133 the magic system. It's easier to extend, cleaner and has automatic
5141 the magic system. It's easier to extend, cleaner and has automatic
5134 namespace protection and documentation.
5142 namespace protection and documentation.
5135
5143
5136 2001-11-09 Fernando Perez <fperez@colorado.edu>
5144 2001-11-09 Fernando Perez <fperez@colorado.edu>
5137
5145
5138 * Fixed bug in output cache flushing (missing parameter to
5146 * Fixed bug in output cache flushing (missing parameter to
5139 __init__). Other small bugs fixed (found using pychecker).
5147 __init__). Other small bugs fixed (found using pychecker).
5140
5148
5141 * Version 0.1.4 opened for bugfixing.
5149 * Version 0.1.4 opened for bugfixing.
5142
5150
5143 2001-11-07 Fernando Perez <fperez@colorado.edu>
5151 2001-11-07 Fernando Perez <fperez@colorado.edu>
5144
5152
5145 * Version 0.1.3 released, mainly because of the raw_input bug.
5153 * Version 0.1.3 released, mainly because of the raw_input bug.
5146
5154
5147 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5155 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5148 and when testing for whether things were callable, a call could
5156 and when testing for whether things were callable, a call could
5149 actually be made to certain functions. They would get called again
5157 actually be made to certain functions. They would get called again
5150 once 'really' executed, with a resulting double call. A disaster
5158 once 'really' executed, with a resulting double call. A disaster
5151 in many cases (list.reverse() would never work!).
5159 in many cases (list.reverse() would never work!).
5152
5160
5153 * Removed prefilter() function, moved its code to raw_input (which
5161 * Removed prefilter() function, moved its code to raw_input (which
5154 after all was just a near-empty caller for prefilter). This saves
5162 after all was just a near-empty caller for prefilter). This saves
5155 a function call on every prompt, and simplifies the class a tiny bit.
5163 a function call on every prompt, and simplifies the class a tiny bit.
5156
5164
5157 * Fix _ip to __ip name in magic example file.
5165 * Fix _ip to __ip name in magic example file.
5158
5166
5159 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5167 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5160 work with non-gnu versions of tar.
5168 work with non-gnu versions of tar.
5161
5169
5162 2001-11-06 Fernando Perez <fperez@colorado.edu>
5170 2001-11-06 Fernando Perez <fperez@colorado.edu>
5163
5171
5164 * Version 0.1.2. Just to keep track of the recent changes.
5172 * Version 0.1.2. Just to keep track of the recent changes.
5165
5173
5166 * Fixed nasty bug in output prompt routine. It used to check 'if
5174 * Fixed nasty bug in output prompt routine. It used to check 'if
5167 arg != None...'. Problem is, this fails if arg implements a
5175 arg != None...'. Problem is, this fails if arg implements a
5168 special comparison (__cmp__) which disallows comparing to
5176 special comparison (__cmp__) which disallows comparing to
5169 None. Found it when trying to use the PhysicalQuantity module from
5177 None. Found it when trying to use the PhysicalQuantity module from
5170 ScientificPython.
5178 ScientificPython.
5171
5179
5172 2001-11-05 Fernando Perez <fperez@colorado.edu>
5180 2001-11-05 Fernando Perez <fperez@colorado.edu>
5173
5181
5174 * Also added dirs. Now the pushd/popd/dirs family functions
5182 * Also added dirs. Now the pushd/popd/dirs family functions
5175 basically like the shell, with the added convenience of going home
5183 basically like the shell, with the added convenience of going home
5176 when called with no args.
5184 when called with no args.
5177
5185
5178 * pushd/popd slightly modified to mimic shell behavior more
5186 * pushd/popd slightly modified to mimic shell behavior more
5179 closely.
5187 closely.
5180
5188
5181 * Added env,pushd,popd from ShellServices as magic functions. I
5189 * Added env,pushd,popd from ShellServices as magic functions. I
5182 think the cleanest will be to port all desired functions from
5190 think the cleanest will be to port all desired functions from
5183 ShellServices as magics and remove ShellServices altogether. This
5191 ShellServices as magics and remove ShellServices altogether. This
5184 will provide a single, clean way of adding functionality
5192 will provide a single, clean way of adding functionality
5185 (shell-type or otherwise) to IP.
5193 (shell-type or otherwise) to IP.
5186
5194
5187 2001-11-04 Fernando Perez <fperez@colorado.edu>
5195 2001-11-04 Fernando Perez <fperez@colorado.edu>
5188
5196
5189 * Added .ipython/ directory to sys.path. This way users can keep
5197 * Added .ipython/ directory to sys.path. This way users can keep
5190 customizations there and access them via import.
5198 customizations there and access them via import.
5191
5199
5192 2001-11-03 Fernando Perez <fperez@colorado.edu>
5200 2001-11-03 Fernando Perez <fperez@colorado.edu>
5193
5201
5194 * Opened version 0.1.1 for new changes.
5202 * Opened version 0.1.1 for new changes.
5195
5203
5196 * Changed version number to 0.1.0: first 'public' release, sent to
5204 * Changed version number to 0.1.0: first 'public' release, sent to
5197 Nathan and Janko.
5205 Nathan and Janko.
5198
5206
5199 * Lots of small fixes and tweaks.
5207 * Lots of small fixes and tweaks.
5200
5208
5201 * Minor changes to whos format. Now strings are shown, snipped if
5209 * Minor changes to whos format. Now strings are shown, snipped if
5202 too long.
5210 too long.
5203
5211
5204 * Changed ShellServices to work on __main__ so they show up in @who
5212 * Changed ShellServices to work on __main__ so they show up in @who
5205
5213
5206 * Help also works with ? at the end of a line:
5214 * Help also works with ? at the end of a line:
5207 ?sin and sin?
5215 ?sin and sin?
5208 both produce the same effect. This is nice, as often I use the
5216 both produce the same effect. This is nice, as often I use the
5209 tab-complete to find the name of a method, but I used to then have
5217 tab-complete to find the name of a method, but I used to then have
5210 to go to the beginning of the line to put a ? if I wanted more
5218 to go to the beginning of the line to put a ? if I wanted more
5211 info. Now I can just add the ? and hit return. Convenient.
5219 info. Now I can just add the ? and hit return. Convenient.
5212
5220
5213 2001-11-02 Fernando Perez <fperez@colorado.edu>
5221 2001-11-02 Fernando Perez <fperez@colorado.edu>
5214
5222
5215 * Python version check (>=2.1) added.
5223 * Python version check (>=2.1) added.
5216
5224
5217 * Added LazyPython documentation. At this point the docs are quite
5225 * Added LazyPython documentation. At this point the docs are quite
5218 a mess. A cleanup is in order.
5226 a mess. A cleanup is in order.
5219
5227
5220 * Auto-installer created. For some bizarre reason, the zipfiles
5228 * Auto-installer created. For some bizarre reason, the zipfiles
5221 module isn't working on my system. So I made a tar version
5229 module isn't working on my system. So I made a tar version
5222 (hopefully the command line options in various systems won't kill
5230 (hopefully the command line options in various systems won't kill
5223 me).
5231 me).
5224
5232
5225 * Fixes to Struct in genutils. Now all dictionary-like methods are
5233 * Fixes to Struct in genutils. Now all dictionary-like methods are
5226 protected (reasonably).
5234 protected (reasonably).
5227
5235
5228 * Added pager function to genutils and changed ? to print usage
5236 * Added pager function to genutils and changed ? to print usage
5229 note through it (it was too long).
5237 note through it (it was too long).
5230
5238
5231 * Added the LazyPython functionality. Works great! I changed the
5239 * Added the LazyPython functionality. Works great! I changed the
5232 auto-quote escape to ';', it's on home row and next to '. But
5240 auto-quote escape to ';', it's on home row and next to '. But
5233 both auto-quote and auto-paren (still /) escapes are command-line
5241 both auto-quote and auto-paren (still /) escapes are command-line
5234 parameters.
5242 parameters.
5235
5243
5236
5244
5237 2001-11-01 Fernando Perez <fperez@colorado.edu>
5245 2001-11-01 Fernando Perez <fperez@colorado.edu>
5238
5246
5239 * Version changed to 0.0.7. Fairly large change: configuration now
5247 * Version changed to 0.0.7. Fairly large change: configuration now
5240 is all stored in a directory, by default .ipython. There, all
5248 is all stored in a directory, by default .ipython. There, all
5241 config files have normal looking names (not .names)
5249 config files have normal looking names (not .names)
5242
5250
5243 * Version 0.0.6 Released first to Lucas and Archie as a test
5251 * Version 0.0.6 Released first to Lucas and Archie as a test
5244 run. Since it's the first 'semi-public' release, change version to
5252 run. Since it's the first 'semi-public' release, change version to
5245 > 0.0.6 for any changes now.
5253 > 0.0.6 for any changes now.
5246
5254
5247 * Stuff I had put in the ipplib.py changelog:
5255 * Stuff I had put in the ipplib.py changelog:
5248
5256
5249 Changes to InteractiveShell:
5257 Changes to InteractiveShell:
5250
5258
5251 - Made the usage message a parameter.
5259 - Made the usage message a parameter.
5252
5260
5253 - Require the name of the shell variable to be given. It's a bit
5261 - Require the name of the shell variable to be given. It's a bit
5254 of a hack, but allows the name 'shell' not to be hardwire in the
5262 of a hack, but allows the name 'shell' not to be hardwire in the
5255 magic (@) handler, which is problematic b/c it requires
5263 magic (@) handler, which is problematic b/c it requires
5256 polluting the global namespace with 'shell'. This in turn is
5264 polluting the global namespace with 'shell'. This in turn is
5257 fragile: if a user redefines a variable called shell, things
5265 fragile: if a user redefines a variable called shell, things
5258 break.
5266 break.
5259
5267
5260 - magic @: all functions available through @ need to be defined
5268 - magic @: all functions available through @ need to be defined
5261 as magic_<name>, even though they can be called simply as
5269 as magic_<name>, even though they can be called simply as
5262 @<name>. This allows the special command @magic to gather
5270 @<name>. This allows the special command @magic to gather
5263 information automatically about all existing magic functions,
5271 information automatically about all existing magic functions,
5264 even if they are run-time user extensions, by parsing the shell
5272 even if they are run-time user extensions, by parsing the shell
5265 instance __dict__ looking for special magic_ names.
5273 instance __dict__ looking for special magic_ names.
5266
5274
5267 - mainloop: added *two* local namespace parameters. This allows
5275 - mainloop: added *two* local namespace parameters. This allows
5268 the class to differentiate between parameters which were there
5276 the class to differentiate between parameters which were there
5269 before and after command line initialization was processed. This
5277 before and after command line initialization was processed. This
5270 way, later @who can show things loaded at startup by the
5278 way, later @who can show things loaded at startup by the
5271 user. This trick was necessary to make session saving/reloading
5279 user. This trick was necessary to make session saving/reloading
5272 really work: ideally after saving/exiting/reloading a session,
5280 really work: ideally after saving/exiting/reloading a session,
5273 *everythin* should look the same, including the output of @who. I
5281 *everythin* should look the same, including the output of @who. I
5274 was only able to make this work with this double namespace
5282 was only able to make this work with this double namespace
5275 trick.
5283 trick.
5276
5284
5277 - added a header to the logfile which allows (almost) full
5285 - added a header to the logfile which allows (almost) full
5278 session restoring.
5286 session restoring.
5279
5287
5280 - prepend lines beginning with @ or !, with a and log
5288 - prepend lines beginning with @ or !, with a and log
5281 them. Why? !lines: may be useful to know what you did @lines:
5289 them. Why? !lines: may be useful to know what you did @lines:
5282 they may affect session state. So when restoring a session, at
5290 they may affect session state. So when restoring a session, at
5283 least inform the user of their presence. I couldn't quite get
5291 least inform the user of their presence. I couldn't quite get
5284 them to properly re-execute, but at least the user is warned.
5292 them to properly re-execute, but at least the user is warned.
5285
5293
5286 * Started ChangeLog.
5294 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now