##// END OF EJS Templates
New %pycat magic.
fperez -
Show More
@@ -1,2454 +1,2473 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3
3
4 $Id: Magic.py 897 2005-09-22 09:32:46Z fperez $"""
4 $Id: Magic.py 906 2005-09-24 00:26:14Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
8 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
12 #*****************************************************************************
12 #*****************************************************************************
13
13
14 #****************************************************************************
14 #****************************************************************************
15 # Modules and globals
15 # Modules and globals
16
16
17 from IPython import Release
17 from IPython import Release
18 __author__ = '%s <%s>\n%s <%s>' % \
18 __author__ = '%s <%s>\n%s <%s>' % \
19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
20 __license__ = Release.license
20 __license__ = Release.license
21
21
22 # Python standard modules
22 # Python standard modules
23 import __builtin__
23 import __builtin__
24 import os,sys,inspect,pydoc,re,tempfile,pdb,bdb,time
24 import os,sys,inspect,pydoc,re,tempfile,pdb,bdb,time
25 try:
25 try:
26 import profile,pstats
26 import profile,pstats
27 except ImportError:
27 except ImportError:
28 profile = pstats = None
28 profile = pstats = None
29 from getopt import getopt
29 from getopt import getopt
30 from pprint import pprint, pformat
30 from pprint import pprint, pformat
31 from cStringIO import StringIO
31 from cStringIO import StringIO
32
32
33 # Homebrewed
33 # Homebrewed
34 from IPython.Struct import Struct
34 from IPython.Struct import Struct
35 from IPython.Itpl import Itpl, itpl, printpl,itplns
35 from IPython.Itpl import Itpl, itpl, printpl,itplns
36 from IPython.FakeModule import FakeModule
36 from IPython.FakeModule import FakeModule
37 from IPython import OInspect
37 from IPython import OInspect
38 from IPython.PyColorize import Parser
38 from IPython.genutils import *
39 from IPython.genutils import *
39
40
40 # Globals to be set later by Magic constructor
41 # Globals to be set later by Magic constructor
41 MAGIC_PREFIX = ''
42 MAGIC_PREFIX = ''
42 MAGIC_ESCAPE = ''
43 MAGIC_ESCAPE = ''
43
44
44 #***************************************************************************
45 #***************************************************************************
45 # Utility functions
46 # Utility functions
46 def magic2python(cmd):
47 def magic2python(cmd):
47 """Convert a command string of magic syntax to valid Python code."""
48 """Convert a command string of magic syntax to valid Python code."""
48
49
49 if cmd.startswith('#'+MAGIC_ESCAPE) or \
50 if cmd.startswith('#'+MAGIC_ESCAPE) or \
50 cmd.startswith(MAGIC_ESCAPE):
51 cmd.startswith(MAGIC_ESCAPE):
51 if cmd[0]=='#':
52 if cmd[0]=='#':
52 cmd = cmd[1:]
53 cmd = cmd[1:]
53 # we need to return the proper line end later
54 # we need to return the proper line end later
54 if cmd[-1] == '\n':
55 if cmd[-1] == '\n':
55 endl = '\n'
56 endl = '\n'
56 else:
57 else:
57 endl = ''
58 endl = ''
58 try:
59 try:
59 func,args = cmd[1:].split(' ',1)
60 func,args = cmd[1:].split(' ',1)
60 except:
61 except:
61 func,args = cmd[1:].rstrip(),''
62 func,args = cmd[1:].rstrip(),''
62 args = args.replace('"','\\"').replace("'","\\'").rstrip()
63 args = args.replace('"','\\"').replace("'","\\'").rstrip()
63 return '%s%s ("%s")%s' % (MAGIC_PREFIX,func,args,endl)
64 return '%s%s ("%s")%s' % (MAGIC_PREFIX,func,args,endl)
64 else:
65 else:
65 return cmd
66 return cmd
66
67
67 def on_off(tag):
68 def on_off(tag):
68 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
69 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
69 return ['OFF','ON'][tag]
70 return ['OFF','ON'][tag]
70
71
71 def get_py_filename(name):
72 def get_py_filename(name):
72 """Return a valid python filename in the current directory.
73 """Return a valid python filename in the current directory.
73
74
74 If the given name is not a file, it adds '.py' and searches again.
75 If the given name is not a file, it adds '.py' and searches again.
75 Raises IOError with an informative message if the file isn't found."""
76 Raises IOError with an informative message if the file isn't found."""
76
77
77 name = os.path.expanduser(name)
78 name = os.path.expanduser(name)
78 if not os.path.isfile(name) and not name.endswith('.py'):
79 if not os.path.isfile(name) and not name.endswith('.py'):
79 name += '.py'
80 name += '.py'
80 if os.path.isfile(name):
81 if os.path.isfile(name):
81 return name
82 return name
82 else:
83 else:
83 raise IOError,'File `%s` not found.' % name
84 raise IOError,'File `%s` not found.' % name
84
85
85
86
86 #****************************************************************************
87 #****************************************************************************
87 # Utility classes
88 # Utility classes
88 class Macro:
89 class Macro:
89 """Simple class to store the value of macros as strings.
90 """Simple class to store the value of macros as strings.
90
91
91 This allows us to later exec them by checking when something is an
92 This allows us to later exec them by checking when something is an
92 instance of this class."""
93 instance of this class."""
93
94
94 def __init__(self,cmds):
95 def __init__(self,cmds):
95 """Build a macro from a list of commands."""
96 """Build a macro from a list of commands."""
96
97
97 # Since the list may include multi-line entries, first make sure that
98 # Since the list may include multi-line entries, first make sure that
98 # they've been all broken up before passing it to magic2python
99 # they've been all broken up before passing it to magic2python
99 cmdlist = map(magic2python,''.join(cmds).split('\n'))
100 cmdlist = map(magic2python,''.join(cmds).split('\n'))
100 self.value = '\n'.join(cmdlist)
101 self.value = '\n'.join(cmdlist)
101
102
102 def __str__(self):
103 def __str__(self):
103 return self.value
104 return self.value
104
105
105 #***************************************************************************
106 #***************************************************************************
106 # Main class implementing Magic functionality
107 # Main class implementing Magic functionality
107 class Magic:
108 class Magic:
108 """Magic functions for InteractiveShell.
109 """Magic functions for InteractiveShell.
109
110
110 Shell functions which can be reached as %function_name. All magic
111 Shell functions which can be reached as %function_name. All magic
111 functions should accept a string, which they can parse for their own
112 functions should accept a string, which they can parse for their own
112 needs. This can make some functions easier to type, eg `%cd ../`
113 needs. This can make some functions easier to type, eg `%cd ../`
113 vs. `%cd("../")`
114 vs. `%cd("../")`
114
115
115 ALL definitions MUST begin with the prefix magic_. The user won't need it
116 ALL definitions MUST begin with the prefix magic_. The user won't need it
116 at the command line, but it is is needed in the definition. """
117 at the command line, but it is is needed in the definition. """
117
118
118 # class globals
119 # class globals
119 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
120 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
120 'Automagic is ON, % prefix NOT needed for magic functions.']
121 'Automagic is ON, % prefix NOT needed for magic functions.']
121
122
122 #......................................................................
123 #......................................................................
123 # some utility functions
124 # some utility functions
124
125
125 def __init__(self,shell):
126 def __init__(self,shell):
126 # XXX This is hackish, clean up later to avoid these messy globals
127 # XXX This is hackish, clean up later to avoid these messy globals
127 global MAGIC_PREFIX, MAGIC_ESCAPE
128 global MAGIC_PREFIX, MAGIC_ESCAPE
128
129
129 self.options_table = {}
130 self.options_table = {}
130 MAGIC_PREFIX = shell.name+'.magic_'
131 MAGIC_PREFIX = shell.name+'.magic_'
131 MAGIC_ESCAPE = shell.ESC_MAGIC
132 MAGIC_ESCAPE = shell.ESC_MAGIC
132 if profile is None:
133 if profile is None:
133 self.magic_prun = self.profile_missing_notice
134 self.magic_prun = self.profile_missing_notice
134
135
135 def profile_missing_notice(self, *args, **kwargs):
136 def profile_missing_notice(self, *args, **kwargs):
136 error("""\
137 error("""\
137 The profile module could not be found. If you are a Debian user,
138 The profile module could not be found. If you are a Debian user,
138 it has been removed from the standard Debian package because of its non-free
139 it has been removed from the standard Debian package because of its non-free
139 license. To use profiling, please install"python2.3-profiler" from non-free.""")
140 license. To use profiling, please install"python2.3-profiler" from non-free.""")
140
141
141 def default_option(self,fn,optstr):
142 def default_option(self,fn,optstr):
142 """Make an entry in the options_table for fn, with value optstr"""
143 """Make an entry in the options_table for fn, with value optstr"""
143
144
144 if fn not in self.lsmagic():
145 if fn not in self.lsmagic():
145 error("%s is not a magic function" % fn)
146 error("%s is not a magic function" % fn)
146 self.options_table[fn] = optstr
147 self.options_table[fn] = optstr
147
148
148 def lsmagic(self):
149 def lsmagic(self):
149 """Return a list of currently available magic functions.
150 """Return a list of currently available magic functions.
150
151
151 Gives a list of the bare names after mangling (['ls','cd', ...], not
152 Gives a list of the bare names after mangling (['ls','cd', ...], not
152 ['magic_ls','magic_cd',...]"""
153 ['magic_ls','magic_cd',...]"""
153
154
154 # FIXME. This needs a cleanup, in the way the magics list is built.
155 # FIXME. This needs a cleanup, in the way the magics list is built.
155
156
156 # magics in class definition
157 # magics in class definition
157 class_magic = lambda fn: fn.startswith('magic_') and \
158 class_magic = lambda fn: fn.startswith('magic_') and \
158 callable(Magic.__dict__[fn])
159 callable(Magic.__dict__[fn])
159 # in instance namespace (run-time user additions)
160 # in instance namespace (run-time user additions)
160 inst_magic = lambda fn: fn.startswith('magic_') and \
161 inst_magic = lambda fn: fn.startswith('magic_') and \
161 callable(self.__dict__[fn])
162 callable(self.__dict__[fn])
162 # and bound magics by user (so they can access self):
163 # and bound magics by user (so they can access self):
163 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
164 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
164 callable(self.__class__.__dict__[fn])
165 callable(self.__class__.__dict__[fn])
165 magics = filter(class_magic,Magic.__dict__.keys()) + \
166 magics = filter(class_magic,Magic.__dict__.keys()) + \
166 filter(inst_magic,self.__dict__.keys()) + \
167 filter(inst_magic,self.__dict__.keys()) + \
167 filter(inst_bound_magic,self.__class__.__dict__.keys())
168 filter(inst_bound_magic,self.__class__.__dict__.keys())
168 out = []
169 out = []
169 for fn in magics:
170 for fn in magics:
170 out.append(fn.replace('magic_','',1))
171 out.append(fn.replace('magic_','',1))
171 out.sort()
172 out.sort()
172 return out
173 return out
173
174
174 def set_shell(self,shell):
175 def set_shell(self,shell):
175 self.shell = shell
176 self.shell = shell
176 self.alias_table = shell.alias_table
177 self.alias_table = shell.alias_table
177
178
178 def extract_input_slices(self,slices):
179 def extract_input_slices(self,slices):
179 """Return as a string a set of input history slices.
180 """Return as a string a set of input history slices.
180
181
181 The set of slices is given as a list of strings (like ['1','4:8','9'],
182 The set of slices is given as a list of strings (like ['1','4:8','9'],
182 since this function is for use by magic functions which get their
183 since this function is for use by magic functions which get their
183 arguments as strings."""
184 arguments as strings."""
184
185
185 cmds = []
186 cmds = []
186 for chunk in slices:
187 for chunk in slices:
187 if ':' in chunk:
188 if ':' in chunk:
188 ini,fin = map(int,chunk.split(':'))
189 ini,fin = map(int,chunk.split(':'))
189 else:
190 else:
190 ini = int(chunk)
191 ini = int(chunk)
191 fin = ini+1
192 fin = ini+1
192 cmds.append(self.shell.input_hist[ini:fin])
193 cmds.append(self.shell.input_hist[ini:fin])
193 return cmds
194 return cmds
194
195
195 def _ofind(self,oname):
196 def _ofind(self,oname):
196 """Find an object in the available namespaces.
197 """Find an object in the available namespaces.
197
198
198 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
199 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
199
200
200 Has special code to detect magic functions.
201 Has special code to detect magic functions.
201 """
202 """
202
203
203 oname = oname.strip()
204 oname = oname.strip()
204
205
205 # Namespaces to search in:
206 # Namespaces to search in:
206 user_ns = self.shell.user_ns
207 user_ns = self.shell.user_ns
207 internal_ns = self.shell.internal_ns
208 internal_ns = self.shell.internal_ns
208 builtin_ns = __builtin__.__dict__
209 builtin_ns = __builtin__.__dict__
209 alias_ns = self.shell.alias_table
210 alias_ns = self.shell.alias_table
210
211
211 # Put them in a list. The order is important so that we find things in
212 # Put them in a list. The order is important so that we find things in
212 # the same order that Python finds them.
213 # the same order that Python finds them.
213 namespaces = [ ('Interactive',user_ns),
214 namespaces = [ ('Interactive',user_ns),
214 ('IPython internal',internal_ns),
215 ('IPython internal',internal_ns),
215 ('Python builtin',builtin_ns),
216 ('Python builtin',builtin_ns),
216 ('Alias',alias_ns),
217 ('Alias',alias_ns),
217 ]
218 ]
218
219
219 # initialize results to 'null'
220 # initialize results to 'null'
220 found = 0; obj = None; ospace = None; ds = None;
221 found = 0; obj = None; ospace = None; ds = None;
221 ismagic = 0; isalias = 0
222 ismagic = 0; isalias = 0
222
223
223 # Look for the given name by splitting it in parts. If the head is
224 # Look for the given name by splitting it in parts. If the head is
224 # found, then we look for all the remaining parts as members, and only
225 # found, then we look for all the remaining parts as members, and only
225 # declare success if we can find them all.
226 # declare success if we can find them all.
226 oname_parts = oname.split('.')
227 oname_parts = oname.split('.')
227 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
228 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
228 for nsname,ns in namespaces:
229 for nsname,ns in namespaces:
229 try:
230 try:
230 obj = ns[oname_head]
231 obj = ns[oname_head]
231 except KeyError:
232 except KeyError:
232 continue
233 continue
233 else:
234 else:
234 for part in oname_rest:
235 for part in oname_rest:
235 try:
236 try:
236 obj = getattr(obj,part)
237 obj = getattr(obj,part)
237 except:
238 except:
238 # Blanket except b/c some badly implemented objects
239 # Blanket except b/c some badly implemented objects
239 # allow __getattr__ to raise exceptions other than
240 # allow __getattr__ to raise exceptions other than
240 # AttributeError, which then crashes IPython.
241 # AttributeError, which then crashes IPython.
241 break
242 break
242 else:
243 else:
243 # If we finish the for loop (no break), we got all members
244 # If we finish the for loop (no break), we got all members
244 found = 1
245 found = 1
245 ospace = nsname
246 ospace = nsname
246 if ns == alias_ns:
247 if ns == alias_ns:
247 isalias = 1
248 isalias = 1
248 break # namespace loop
249 break # namespace loop
249
250
250 # Try to see if it's magic
251 # Try to see if it's magic
251 if not found:
252 if not found:
252 if oname.startswith(self.shell.ESC_MAGIC):
253 if oname.startswith(self.shell.ESC_MAGIC):
253 oname = oname[1:]
254 oname = oname[1:]
254 obj = getattr(self,'magic_'+oname,None)
255 obj = getattr(self,'magic_'+oname,None)
255 if obj is not None:
256 if obj is not None:
256 found = 1
257 found = 1
257 ospace = 'IPython internal'
258 ospace = 'IPython internal'
258 ismagic = 1
259 ismagic = 1
259
260
260 # Last try: special-case some literals like '', [], {}, etc:
261 # Last try: special-case some literals like '', [], {}, etc:
261 if not found and oname_head in ["''",'""','[]','{}','()']:
262 if not found and oname_head in ["''",'""','[]','{}','()']:
262 obj = eval(oname_head)
263 obj = eval(oname_head)
263 found = 1
264 found = 1
264 ospace = 'Interactive'
265 ospace = 'Interactive'
265
266
266 return {'found':found, 'obj':obj, 'namespace':ospace,
267 return {'found':found, 'obj':obj, 'namespace':ospace,
267 'ismagic':ismagic, 'isalias':isalias}
268 'ismagic':ismagic, 'isalias':isalias}
268
269
269 def arg_err(self,func):
270 def arg_err(self,func):
270 """Print docstring if incorrect arguments were passed"""
271 """Print docstring if incorrect arguments were passed"""
271 print 'Error in arguments:'
272 print 'Error in arguments:'
272 print OInspect.getdoc(func)
273 print OInspect.getdoc(func)
273
274
274
275
275 def format_latex(self,str):
276 def format_latex(self,str):
276 """Format a string for latex inclusion."""
277 """Format a string for latex inclusion."""
277
278
278 # Characters that need to be escaped for latex:
279 # Characters that need to be escaped for latex:
279 escape_re = re.compile(r'(%|_|\$)',re.MULTILINE)
280 escape_re = re.compile(r'(%|_|\$)',re.MULTILINE)
280 # Magic command names as headers:
281 # Magic command names as headers:
281 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
282 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
282 re.MULTILINE)
283 re.MULTILINE)
283 # Magic commands
284 # Magic commands
284 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
285 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
285 re.MULTILINE)
286 re.MULTILINE)
286 # Paragraph continue
287 # Paragraph continue
287 par_re = re.compile(r'\\$',re.MULTILINE)
288 par_re = re.compile(r'\\$',re.MULTILINE)
288
289
289 str = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',str)
290 str = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',str)
290 str = cmd_re.sub(r'\\texttt{\g<cmd>}',str)
291 str = cmd_re.sub(r'\\texttt{\g<cmd>}',str)
291 str = par_re.sub(r'\\\\',str)
292 str = par_re.sub(r'\\\\',str)
292 str = escape_re.sub(r'\\\1',str)
293 str = escape_re.sub(r'\\\1',str)
293 return str
294 return str
294
295
295 def format_screen(self,str):
296 def format_screen(self,str):
296 """Format a string for screen printing.
297 """Format a string for screen printing.
297
298
298 This removes some latex-type format codes."""
299 This removes some latex-type format codes."""
299 # Paragraph continue
300 # Paragraph continue
300 par_re = re.compile(r'\\$',re.MULTILINE)
301 par_re = re.compile(r'\\$',re.MULTILINE)
301 str = par_re.sub('',str)
302 str = par_re.sub('',str)
302 return str
303 return str
303
304
304 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
305 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
305 """Parse options passed to an argument string.
306 """Parse options passed to an argument string.
306
307
307 The interface is similar to that of getopt(), but it returns back a
308 The interface is similar to that of getopt(), but it returns back a
308 Struct with the options as keys and the stripped argument string still
309 Struct with the options as keys and the stripped argument string still
309 as a string.
310 as a string.
310
311
311 arg_str is quoted as a true sys.argv vector by calling on the fly a
312 arg_str is quoted as a true sys.argv vector by calling on the fly a
312 python process in a subshell. This allows us to easily expand
313 python process in a subshell. This allows us to easily expand
313 variables, glob files, quote arguments, etc, with all the power and
314 variables, glob files, quote arguments, etc, with all the power and
314 correctness of the underlying system shell.
315 correctness of the underlying system shell.
315
316
316 Options:
317 Options:
317 -mode: default 'string'. If given as 'list', the argument string is
318 -mode: default 'string'. If given as 'list', the argument string is
318 returned as a list (split on whitespace) instead of a string.
319 returned as a list (split on whitespace) instead of a string.
319
320
320 -list_all: put all option values in lists. Normally only options
321 -list_all: put all option values in lists. Normally only options
321 appearing more than once are put in a list."""
322 appearing more than once are put in a list."""
322
323
323 # inject default options at the beginning of the input line
324 # inject default options at the beginning of the input line
324 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
325 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
325 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
326 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
326
327
327 mode = kw.get('mode','string')
328 mode = kw.get('mode','string')
328 if mode not in ['string','list']:
329 if mode not in ['string','list']:
329 raise ValueError,'incorrect mode given: %s' % mode
330 raise ValueError,'incorrect mode given: %s' % mode
330 # Get options
331 # Get options
331 list_all = kw.get('list_all',0)
332 list_all = kw.get('list_all',0)
332
333
333 # Check if we have more than one argument to warrant extra processing:
334 # Check if we have more than one argument to warrant extra processing:
334 odict = {} # Dictionary with options
335 odict = {} # Dictionary with options
335 args = arg_str.split()
336 args = arg_str.split()
336 if len(args) >= 1:
337 if len(args) >= 1:
337 # If the list of inputs only has 0 or 1 thing in it, there's no
338 # If the list of inputs only has 0 or 1 thing in it, there's no
338 # need to look for options
339 # need to look for options
339 argv = shlex_split(arg_str)
340 argv = shlex_split(arg_str)
340 # Do regular option processing
341 # Do regular option processing
341 opts,args = getopt(argv,opt_str,*long_opts)
342 opts,args = getopt(argv,opt_str,*long_opts)
342 for o,a in opts:
343 for o,a in opts:
343 if o.startswith('--'):
344 if o.startswith('--'):
344 o = o[2:]
345 o = o[2:]
345 else:
346 else:
346 o = o[1:]
347 o = o[1:]
347 try:
348 try:
348 odict[o].append(a)
349 odict[o].append(a)
349 except AttributeError:
350 except AttributeError:
350 odict[o] = [odict[o],a]
351 odict[o] = [odict[o],a]
351 except KeyError:
352 except KeyError:
352 if list_all:
353 if list_all:
353 odict[o] = [a]
354 odict[o] = [a]
354 else:
355 else:
355 odict[o] = a
356 odict[o] = a
356
357
357 # Prepare opts,args for return
358 # Prepare opts,args for return
358 opts = Struct(odict)
359 opts = Struct(odict)
359 if mode == 'string':
360 if mode == 'string':
360 args = ' '.join(args)
361 args = ' '.join(args)
361
362
362 return opts,args
363 return opts,args
363
364
364 #......................................................................
365 #......................................................................
365 # And now the actual magic functions
366 # And now the actual magic functions
366
367
367 # Functions for IPython shell work (vars,funcs, config, etc)
368 # Functions for IPython shell work (vars,funcs, config, etc)
368 def magic_lsmagic(self, parameter_s = ''):
369 def magic_lsmagic(self, parameter_s = ''):
369 """List currently available magic functions."""
370 """List currently available magic functions."""
370 mesc = self.shell.ESC_MAGIC
371 mesc = self.shell.ESC_MAGIC
371 print 'Available magic functions:\n'+mesc+\
372 print 'Available magic functions:\n'+mesc+\
372 (' '+mesc).join(self.lsmagic())
373 (' '+mesc).join(self.lsmagic())
373 print '\n' + Magic.auto_status[self.shell.rc.automagic]
374 print '\n' + Magic.auto_status[self.shell.rc.automagic]
374 return None
375 return None
375
376
376 def magic_magic(self, parameter_s = ''):
377 def magic_magic(self, parameter_s = ''):
377 """Print information about the magic function system."""
378 """Print information about the magic function system."""
378
379
379 mode = ''
380 mode = ''
380 try:
381 try:
381 if parameter_s.split()[0] == '-latex':
382 if parameter_s.split()[0] == '-latex':
382 mode = 'latex'
383 mode = 'latex'
383 except:
384 except:
384 pass
385 pass
385
386
386 magic_docs = []
387 magic_docs = []
387 for fname in self.lsmagic():
388 for fname in self.lsmagic():
388 mname = 'magic_' + fname
389 mname = 'magic_' + fname
389 for space in (Magic,self,self.__class__):
390 for space in (Magic,self,self.__class__):
390 try:
391 try:
391 fn = space.__dict__[mname]
392 fn = space.__dict__[mname]
392 except KeyError:
393 except KeyError:
393 pass
394 pass
394 else:
395 else:
395 break
396 break
396 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
397 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
397 fname,fn.__doc__))
398 fname,fn.__doc__))
398 magic_docs = ''.join(magic_docs)
399 magic_docs = ''.join(magic_docs)
399
400
400 if mode == 'latex':
401 if mode == 'latex':
401 print self.format_latex(magic_docs)
402 print self.format_latex(magic_docs)
402 return
403 return
403 else:
404 else:
404 magic_docs = self.format_screen(magic_docs)
405 magic_docs = self.format_screen(magic_docs)
405
406
406 outmsg = """
407 outmsg = """
407 IPython's 'magic' functions
408 IPython's 'magic' functions
408 ===========================
409 ===========================
409
410
410 The magic function system provides a series of functions which allow you to
411 The magic function system provides a series of functions which allow you to
411 control the behavior of IPython itself, plus a lot of system-type
412 control the behavior of IPython itself, plus a lot of system-type
412 features. All these functions are prefixed with a % character, but parameters
413 features. All these functions are prefixed with a % character, but parameters
413 are given without parentheses or quotes.
414 are given without parentheses or quotes.
414
415
415 NOTE: If you have 'automagic' enabled (via the command line option or with the
416 NOTE: If you have 'automagic' enabled (via the command line option or with the
416 %automagic function), you don't need to type in the % explicitly. By default,
417 %automagic function), you don't need to type in the % explicitly. By default,
417 IPython ships with automagic on, so you should only rarely need the % escape.
418 IPython ships with automagic on, so you should only rarely need the % escape.
418
419
419 Example: typing '%cd mydir' (without the quotes) changes you working directory
420 Example: typing '%cd mydir' (without the quotes) changes you working directory
420 to 'mydir', if it exists.
421 to 'mydir', if it exists.
421
422
422 You can define your own magic functions to extend the system. See the supplied
423 You can define your own magic functions to extend the system. See the supplied
423 ipythonrc and example-magic.py files for details (in your ipython
424 ipythonrc and example-magic.py files for details (in your ipython
424 configuration directory, typically $HOME/.ipython/).
425 configuration directory, typically $HOME/.ipython/).
425
426
426 You can also define your own aliased names for magic functions. In your
427 You can also define your own aliased names for magic functions. In your
427 ipythonrc file, placing a line like:
428 ipythonrc file, placing a line like:
428
429
429 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
430 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
430
431
431 will define %pf as a new name for %profile.
432 will define %pf as a new name for %profile.
432
433
433 You can also call magics in code using the ipmagic() function, which IPython
434 You can also call magics in code using the ipmagic() function, which IPython
434 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
435 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
435
436
436 For a list of the available magic functions, use %lsmagic. For a description
437 For a list of the available magic functions, use %lsmagic. For a description
437 of any of them, type %magic_name?, e.g. '%cd?'.
438 of any of them, type %magic_name?, e.g. '%cd?'.
438
439
439 Currently the magic system has the following functions:\n"""
440 Currently the magic system has the following functions:\n"""
440
441
441 mesc = self.shell.ESC_MAGIC
442 mesc = self.shell.ESC_MAGIC
442 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
443 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
443 "\n\n%s%s\n\n%s" % (outmsg,
444 "\n\n%s%s\n\n%s" % (outmsg,
444 magic_docs,mesc,mesc,
445 magic_docs,mesc,mesc,
445 (' '+mesc).join(self.lsmagic()),
446 (' '+mesc).join(self.lsmagic()),
446 Magic.auto_status[self.shell.rc.automagic] ) )
447 Magic.auto_status[self.shell.rc.automagic] ) )
447
448
448 page(outmsg,screen_lines=self.shell.rc.screen_length)
449 page(outmsg,screen_lines=self.shell.rc.screen_length)
449
450
450 def magic_automagic(self, parameter_s = ''):
451 def magic_automagic(self, parameter_s = ''):
451 """Make magic functions callable without having to type the initial %.
452 """Make magic functions callable without having to type the initial %.
452
453
453 Toggles on/off (when off, you must call it as %automagic, of
454 Toggles on/off (when off, you must call it as %automagic, of
454 course). Note that magic functions have lowest priority, so if there's
455 course). Note that magic functions have lowest priority, so if there's
455 a variable whose name collides with that of a magic fn, automagic
456 a variable whose name collides with that of a magic fn, automagic
456 won't work for that function (you get the variable instead). However,
457 won't work for that function (you get the variable instead). However,
457 if you delete the variable (del var), the previously shadowed magic
458 if you delete the variable (del var), the previously shadowed magic
458 function becomes visible to automagic again."""
459 function becomes visible to automagic again."""
459
460
460 rc = self.shell.rc
461 rc = self.shell.rc
461 rc.automagic = not rc.automagic
462 rc.automagic = not rc.automagic
462 print '\n' + Magic.auto_status[rc.automagic]
463 print '\n' + Magic.auto_status[rc.automagic]
463
464
464 def magic_autocall(self, parameter_s = ''):
465 def magic_autocall(self, parameter_s = ''):
465 """Make functions callable without having to type parentheses.
466 """Make functions callable without having to type parentheses.
466
467
467 This toggles the autocall command line option on and off."""
468 This toggles the autocall command line option on and off."""
468
469
469 rc = self.shell.rc
470 rc = self.shell.rc
470 rc.autocall = not rc.autocall
471 rc.autocall = not rc.autocall
471 print "Automatic calling is:",['OFF','ON'][rc.autocall]
472 print "Automatic calling is:",['OFF','ON'][rc.autocall]
472
473
473 def magic_autoindent(self, parameter_s = ''):
474 def magic_autoindent(self, parameter_s = ''):
474 """Toggle autoindent on/off (if available)."""
475 """Toggle autoindent on/off (if available)."""
475
476
476 self.shell.set_autoindent()
477 self.shell.set_autoindent()
477 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
478 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
478
479
479 def magic_system_verbose(self, parameter_s = ''):
480 def magic_system_verbose(self, parameter_s = ''):
480 """Toggle verbose printing of system calls on/off."""
481 """Toggle verbose printing of system calls on/off."""
481
482
482 self.shell.rc_set_toggle('system_verbose')
483 self.shell.rc_set_toggle('system_verbose')
483 print "System verbose printing is:",\
484 print "System verbose printing is:",\
484 ['OFF','ON'][self.shell.rc.system_verbose]
485 ['OFF','ON'][self.shell.rc.system_verbose]
485
486
486 def magic_history(self, parameter_s = ''):
487 def magic_history(self, parameter_s = ''):
487 """Print input history (_i<n> variables), with most recent last.
488 """Print input history (_i<n> variables), with most recent last.
488
489
489 %history [-n] -> print at most 40 inputs (some may be multi-line)\\
490 %history [-n] -> print at most 40 inputs (some may be multi-line)\\
490 %history [-n] n -> print at most n inputs\\
491 %history [-n] n -> print at most n inputs\\
491 %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
492 %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
492
493
493 Each input's number <n> is shown, and is accessible as the
494 Each input's number <n> is shown, and is accessible as the
494 automatically generated variable _i<n>. Multi-line statements are
495 automatically generated variable _i<n>. Multi-line statements are
495 printed starting at a new line for easy copy/paste.
496 printed starting at a new line for easy copy/paste.
496
497
497 If option -n is used, input numbers are not printed. This is useful if
498 If option -n is used, input numbers are not printed. This is useful if
498 you want to get a printout of many lines which can be directly pasted
499 you want to get a printout of many lines which can be directly pasted
499 into a text editor.
500 into a text editor.
500
501
501 This feature is only available if numbered prompts are in use."""
502 This feature is only available if numbered prompts are in use."""
502
503
503 if not self.do_full_cache:
504 if not self.do_full_cache:
504 print 'This feature is only available if numbered prompts are in use.'
505 print 'This feature is only available if numbered prompts are in use.'
505 return
506 return
506 opts,args = self.parse_options(parameter_s,'n',mode='list')
507 opts,args = self.parse_options(parameter_s,'n',mode='list')
507
508
508 default_length = 40
509 default_length = 40
509 if len(args) == 0:
510 if len(args) == 0:
510 final = self.outputcache.prompt_count
511 final = self.outputcache.prompt_count
511 init = max(1,final-default_length)
512 init = max(1,final-default_length)
512 elif len(args) == 1:
513 elif len(args) == 1:
513 final = self.outputcache.prompt_count
514 final = self.outputcache.prompt_count
514 init = max(1,final-int(args[0]))
515 init = max(1,final-int(args[0]))
515 elif len(args) == 2:
516 elif len(args) == 2:
516 init,final = map(int,args)
517 init,final = map(int,args)
517 else:
518 else:
518 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
519 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
519 print self.magic_hist.__doc__
520 print self.magic_hist.__doc__
520 return
521 return
521 width = len(str(final))
522 width = len(str(final))
522 line_sep = ['','\n']
523 line_sep = ['','\n']
523 input_hist = self.shell.input_hist
524 input_hist = self.shell.input_hist
524 print_nums = not opts.has_key('n')
525 print_nums = not opts.has_key('n')
525 for in_num in range(init,final):
526 for in_num in range(init,final):
526 inline = input_hist[in_num]
527 inline = input_hist[in_num]
527 multiline = inline.count('\n') > 1
528 multiline = inline.count('\n') > 1
528 if print_nums:
529 if print_nums:
529 print str(in_num).ljust(width)+':'+ line_sep[multiline],
530 print str(in_num).ljust(width)+':'+ line_sep[multiline],
530 if inline.startswith('#'+self.shell.ESC_MAGIC) or \
531 if inline.startswith('#'+self.shell.ESC_MAGIC) or \
531 inline.startswith('#!'):
532 inline.startswith('#!'):
532 print inline[1:],
533 print inline[1:],
533 else:
534 else:
534 print inline,
535 print inline,
535
536
536 def magic_hist(self, parameter_s=''):
537 def magic_hist(self, parameter_s=''):
537 """Alternate name for %history."""
538 """Alternate name for %history."""
538 return self.magic_history(parameter_s)
539 return self.magic_history(parameter_s)
539
540
540 def magic_p(self, parameter_s=''):
541 def magic_p(self, parameter_s=''):
541 """Just a short alias for Python's 'print'."""
542 """Just a short alias for Python's 'print'."""
542 exec 'print ' + parameter_s in self.shell.user_ns
543 exec 'print ' + parameter_s in self.shell.user_ns
543
544
544 def magic_r(self, parameter_s=''):
545 def magic_r(self, parameter_s=''):
545 """Repeat previous input.
546 """Repeat previous input.
546
547
547 If given an argument, repeats the previous command which starts with
548 If given an argument, repeats the previous command which starts with
548 the same string, otherwise it just repeats the previous input.
549 the same string, otherwise it just repeats the previous input.
549
550
550 Shell escaped commands (with ! as first character) are not recognized
551 Shell escaped commands (with ! as first character) are not recognized
551 by this system, only pure python code and magic commands.
552 by this system, only pure python code and magic commands.
552 """
553 """
553
554
554 start = parameter_s.strip()
555 start = parameter_s.strip()
555 esc_magic = self.shell.ESC_MAGIC
556 esc_magic = self.shell.ESC_MAGIC
556 # Identify magic commands even if automagic is on (which means
557 # Identify magic commands even if automagic is on (which means
557 # the in-memory version is different from that typed by the user).
558 # the in-memory version is different from that typed by the user).
558 if self.shell.rc.automagic:
559 if self.shell.rc.automagic:
559 start_magic = esc_magic+start
560 start_magic = esc_magic+start
560 else:
561 else:
561 start_magic = start
562 start_magic = start
562 # Look through the input history in reverse
563 # Look through the input history in reverse
563 for n in range(len(self.shell.input_hist)-2,0,-1):
564 for n in range(len(self.shell.input_hist)-2,0,-1):
564 input = self.shell.input_hist[n]
565 input = self.shell.input_hist[n]
565 # skip plain 'r' lines so we don't recurse to infinity
566 # skip plain 'r' lines so we don't recurse to infinity
566 if input != 'ipmagic("r")\n' and \
567 if input != 'ipmagic("r")\n' and \
567 (input.startswith(start) or input.startswith(start_magic)):
568 (input.startswith(start) or input.startswith(start_magic)):
568 #print 'match',`input` # dbg
569 #print 'match',`input` # dbg
569 if input.startswith(esc_magic):
570 if input.startswith(esc_magic):
570 input = magic2python(input)
571 input = magic2python(input)
571 #print 'modified',`input` # dbg
572 #print 'modified',`input` # dbg
572 print 'Executing:',input,
573 print 'Executing:',input,
573 exec input in self.shell.user_ns
574 exec input in self.shell.user_ns
574 return
575 return
575 print 'No previous input matching `%s` found.' % start
576 print 'No previous input matching `%s` found.' % start
576
577
577 def magic_page(self, parameter_s=''):
578 def magic_page(self, parameter_s=''):
578 """Pretty print the object and display it through a pager.
579 """Pretty print the object and display it through a pager.
579
580
580 If no parameter is given, use _ (last output)."""
581 If no parameter is given, use _ (last output)."""
581 # After a function contributed by Olivier Aubert, slightly modified.
582 # After a function contributed by Olivier Aubert, slightly modified.
582
583
583 oname = parameter_s and parameter_s or '_'
584 oname = parameter_s and parameter_s or '_'
584 info = self._ofind(oname)
585 info = self._ofind(oname)
585 if info['found']:
586 if info['found']:
586 page(pformat(info['obj']))
587 page(pformat(info['obj']))
587 else:
588 else:
588 print 'Object `%s` not found' % oname
589 print 'Object `%s` not found' % oname
589
590
590 def magic_profile(self, parameter_s=''):
591 def magic_profile(self, parameter_s=''):
591 """Print your currently active IPyhton profile."""
592 """Print your currently active IPyhton profile."""
592 if self.shell.rc.profile:
593 if self.shell.rc.profile:
593 printpl('Current IPython profile: $self.shell.rc.profile.')
594 printpl('Current IPython profile: $self.shell.rc.profile.')
594 else:
595 else:
595 print 'No profile active.'
596 print 'No profile active.'
596
597
597 def _inspect(self,meth,oname,**kw):
598 def _inspect(self,meth,oname,**kw):
598 """Generic interface to the inspector system.
599 """Generic interface to the inspector system.
599
600
600 This function is meant to be called by pdef, pdoc & friends."""
601 This function is meant to be called by pdef, pdoc & friends."""
601
602
602 oname = oname.strip()
603 oname = oname.strip()
603 info = Struct(self._ofind(oname))
604 info = Struct(self._ofind(oname))
604 if info.found:
605 if info.found:
605 pmethod = getattr(self.shell.inspector,meth)
606 pmethod = getattr(self.shell.inspector,meth)
606 formatter = info.ismagic and self.format_screen or None
607 formatter = info.ismagic and self.format_screen or None
607 if meth == 'pdoc':
608 if meth == 'pdoc':
608 pmethod(info.obj,oname,formatter)
609 pmethod(info.obj,oname,formatter)
609 elif meth == 'pinfo':
610 elif meth == 'pinfo':
610 pmethod(info.obj,oname,formatter,info,**kw)
611 pmethod(info.obj,oname,formatter,info,**kw)
611 else:
612 else:
612 pmethod(info.obj,oname)
613 pmethod(info.obj,oname)
613 else:
614 else:
614 print 'Object `%s` not found.' % oname
615 print 'Object `%s` not found.' % oname
615 return 'not found' # so callers can take other action
616 return 'not found' # so callers can take other action
616
617
617 def magic_pdef(self, parameter_s=''):
618 def magic_pdef(self, parameter_s=''):
618 """Print the definition header for any callable object.
619 """Print the definition header for any callable object.
619
620
620 If the object is a class, print the constructor information."""
621 If the object is a class, print the constructor information."""
621 self._inspect('pdef',parameter_s)
622 self._inspect('pdef',parameter_s)
622
623
623 def magic_pdoc(self, parameter_s=''):
624 def magic_pdoc(self, parameter_s=''):
624 """Print the docstring for an object.
625 """Print the docstring for an object.
625
626
626 If the given object is a class, it will print both the class and the
627 If the given object is a class, it will print both the class and the
627 constructor docstrings."""
628 constructor docstrings."""
628 self._inspect('pdoc',parameter_s)
629 self._inspect('pdoc',parameter_s)
629
630
630 def magic_psource(self, parameter_s=''):
631 def magic_psource(self, parameter_s=''):
631 """Print (or run through pager) the source code for an object."""
632 """Print (or run through pager) the source code for an object."""
632 self._inspect('psource',parameter_s)
633 self._inspect('psource',parameter_s)
633
634
634 def magic_pfile(self, parameter_s=''):
635 def magic_pfile(self, parameter_s=''):
635 """Print (or run through pager) the file where an object is defined.
636 """Print (or run through pager) the file where an object is defined.
636
637
637 The file opens at the line where the object definition begins. IPython
638 The file opens at the line where the object definition begins. IPython
638 will honor the environment variable PAGER if set, and otherwise will
639 will honor the environment variable PAGER if set, and otherwise will
639 do its best to print the file in a convenient form.
640 do its best to print the file in a convenient form.
640
641
641 If the given argument is not an object currently defined, IPython will
642 If the given argument is not an object currently defined, IPython will
642 try to interpret it as a filename (automatically adding a .py extension
643 try to interpret it as a filename (automatically adding a .py extension
643 if needed). You can thus use %pfile as a syntax highlighting code
644 if needed). You can thus use %pfile as a syntax highlighting code
644 viewer."""
645 viewer."""
645
646
646 # first interpret argument as an object name
647 # first interpret argument as an object name
647 out = self._inspect('pfile',parameter_s)
648 out = self._inspect('pfile',parameter_s)
648 # if not, try the input as a filename
649 # if not, try the input as a filename
649 if out == 'not found':
650 if out == 'not found':
650 try:
651 try:
651 filename = get_py_filename(parameter_s)
652 filename = get_py_filename(parameter_s)
652 except IOError,msg:
653 except IOError,msg:
653 print msg
654 print msg
654 return
655 return
655 page(self.shell.inspector.format(file(filename).read()))
656 page(self.shell.inspector.format(file(filename).read()))
656
657
657 def magic_pinfo(self, parameter_s=''):
658 def magic_pinfo(self, parameter_s=''):
658 """Provide detailed information about an object.
659 """Provide detailed information about an object.
659
660
660 '%pinfo object' is just a synonym for object? or ?object."""
661 '%pinfo object' is just a synonym for object? or ?object."""
661
662
662 #print 'pinfo par: <%s>' % parameter_s # dbg
663 #print 'pinfo par: <%s>' % parameter_s # dbg
663
664
664 # detail_level: 0 -> obj? , 1 -> obj??
665 # detail_level: 0 -> obj? , 1 -> obj??
665 detail_level = 0
666 detail_level = 0
666 # We need to detect if we got called as 'pinfo pinfo foo', which can
667 # We need to detect if we got called as 'pinfo pinfo foo', which can
667 # happen if the user types 'pinfo foo?' at the cmd line.
668 # happen if the user types 'pinfo foo?' at the cmd line.
668 pinfo,qmark1,oname,qmark2 = \
669 pinfo,qmark1,oname,qmark2 = \
669 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
670 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
670 if pinfo or qmark1 or qmark2:
671 if pinfo or qmark1 or qmark2:
671 detail_level = 1
672 detail_level = 1
672 self._inspect('pinfo',oname,detail_level=detail_level)
673 self._inspect('pinfo',oname,detail_level=detail_level)
673
674
674 def magic_who_ls(self, parameter_s=''):
675 def magic_who_ls(self, parameter_s=''):
675 """Return a sorted list of all interactive variables.
676 """Return a sorted list of all interactive variables.
676
677
677 If arguments are given, only variables of types matching these
678 If arguments are given, only variables of types matching these
678 arguments are returned."""
679 arguments are returned."""
679
680
680 user_ns = self.shell.user_ns
681 user_ns = self.shell.user_ns
681 out = []
682 out = []
682 typelist = parameter_s.split()
683 typelist = parameter_s.split()
683 for i in self.shell.user_ns.keys():
684 for i in self.shell.user_ns.keys():
684 if not (i.startswith('_') or i.startswith('_i')) \
685 if not (i.startswith('_') or i.startswith('_i')) \
685 and not (self.internal_ns.has_key(i) or
686 and not (self.internal_ns.has_key(i) or
686 self.user_config_ns.has_key(i)):
687 self.user_config_ns.has_key(i)):
687 if typelist:
688 if typelist:
688 if type(user_ns[i]).__name__ in typelist:
689 if type(user_ns[i]).__name__ in typelist:
689 out.append(i)
690 out.append(i)
690 else:
691 else:
691 out.append(i)
692 out.append(i)
692 out.sort()
693 out.sort()
693 return out
694 return out
694
695
695 def magic_who(self, parameter_s=''):
696 def magic_who(self, parameter_s=''):
696 """Print all interactive variables, with some minimal formatting.
697 """Print all interactive variables, with some minimal formatting.
697
698
698 If any arguments are given, only variables whose type matches one of
699 If any arguments are given, only variables whose type matches one of
699 these are printed. For example:
700 these are printed. For example:
700
701
701 %who function str
702 %who function str
702
703
703 will only list functions and strings, excluding all other types of
704 will only list functions and strings, excluding all other types of
704 variables. To find the proper type names, simply use type(var) at a
705 variables. To find the proper type names, simply use type(var) at a
705 command line to see how python prints type names. For example:
706 command line to see how python prints type names. For example:
706
707
707 In [1]: type('hello')\\
708 In [1]: type('hello')\\
708 Out[1]: <type 'str'>
709 Out[1]: <type 'str'>
709
710
710 indicates that the type name for strings is 'str'.
711 indicates that the type name for strings is 'str'.
711
712
712 %who always excludes executed names loaded through your configuration
713 %who always excludes executed names loaded through your configuration
713 file and things which are internal to IPython.
714 file and things which are internal to IPython.
714
715
715 This is deliberate, as typically you may load many modules and the
716 This is deliberate, as typically you may load many modules and the
716 purpose of %who is to show you only what you've manually defined."""
717 purpose of %who is to show you only what you've manually defined."""
717
718
718 varlist = self.magic_who_ls(parameter_s)
719 varlist = self.magic_who_ls(parameter_s)
719 if not varlist:
720 if not varlist:
720 print 'Interactive namespace is empty.'
721 print 'Interactive namespace is empty.'
721 return
722 return
722
723
723 # if we have variables, move on...
724 # if we have variables, move on...
724
725
725 # stupid flushing problem: when prompts have no separators, stdout is
726 # stupid flushing problem: when prompts have no separators, stdout is
726 # getting lost. I'm starting to think this is a python bug. I'm having
727 # getting lost. I'm starting to think this is a python bug. I'm having
727 # to force a flush with a print because even a sys.stdout.flush
728 # to force a flush with a print because even a sys.stdout.flush
728 # doesn't seem to do anything!
729 # doesn't seem to do anything!
729
730
730 count = 0
731 count = 0
731 for i in varlist:
732 for i in varlist:
732 print i+'\t',
733 print i+'\t',
733 count += 1
734 count += 1
734 if count > 8:
735 if count > 8:
735 count = 0
736 count = 0
736 print
737 print
737 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
738 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
738
739
739 print # well, this does force a flush at the expense of an extra \n
740 print # well, this does force a flush at the expense of an extra \n
740
741
741 def magic_whos(self, parameter_s=''):
742 def magic_whos(self, parameter_s=''):
742 """Like %who, but gives some extra information about each variable.
743 """Like %who, but gives some extra information about each variable.
743
744
744 The same type filtering of %who can be applied here.
745 The same type filtering of %who can be applied here.
745
746
746 For all variables, the type is printed. Additionally it prints:
747 For all variables, the type is printed. Additionally it prints:
747
748
748 - For {},[],(): their length.
749 - For {},[],(): their length.
749
750
750 - For Numeric arrays, a summary with shape, number of elements,
751 - For Numeric arrays, a summary with shape, number of elements,
751 typecode and size in memory.
752 typecode and size in memory.
752
753
753 - Everything else: a string representation, snipping their middle if
754 - Everything else: a string representation, snipping their middle if
754 too long."""
755 too long."""
755
756
756 varnames = self.magic_who_ls(parameter_s)
757 varnames = self.magic_who_ls(parameter_s)
757 if not varnames:
758 if not varnames:
758 print 'Interactive namespace is empty.'
759 print 'Interactive namespace is empty.'
759 return
760 return
760
761
761 # if we have variables, move on...
762 # if we have variables, move on...
762
763
763 # for these types, show len() instead of data:
764 # for these types, show len() instead of data:
764 seq_types = [types.DictType,types.ListType,types.TupleType]
765 seq_types = [types.DictType,types.ListType,types.TupleType]
765
766
766 # for Numeric arrays, display summary info
767 # for Numeric arrays, display summary info
767 try:
768 try:
768 import Numeric
769 import Numeric
769 except ImportError:
770 except ImportError:
770 array_type = None
771 array_type = None
771 else:
772 else:
772 array_type = Numeric.ArrayType.__name__
773 array_type = Numeric.ArrayType.__name__
773
774
774 # Find all variable names and types so we can figure out column sizes
775 # Find all variable names and types so we can figure out column sizes
775 get_vars = lambda i: self.locals[i]
776 get_vars = lambda i: self.locals[i]
776 type_name = lambda v: type(v).__name__
777 type_name = lambda v: type(v).__name__
777 varlist = map(get_vars,varnames)
778 varlist = map(get_vars,varnames)
778 typelist = map(type_name,varlist)
779 typelist = map(type_name,varlist)
779 # column labels and # of spaces as separator
780 # column labels and # of spaces as separator
780 varlabel = 'Variable'
781 varlabel = 'Variable'
781 typelabel = 'Type'
782 typelabel = 'Type'
782 datalabel = 'Data/Info'
783 datalabel = 'Data/Info'
783 colsep = 3
784 colsep = 3
784 # variable format strings
785 # variable format strings
785 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
786 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
786 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
787 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
787 aformat = "%s: %s elems, type `%s`, %s bytes"
788 aformat = "%s: %s elems, type `%s`, %s bytes"
788 # find the size of the columns to format the output nicely
789 # find the size of the columns to format the output nicely
789 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
790 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
790 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
791 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
791 # table header
792 # table header
792 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
793 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
793 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
794 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
794 # and the table itself
795 # and the table itself
795 kb = 1024
796 kb = 1024
796 Mb = 1048576 # kb**2
797 Mb = 1048576 # kb**2
797 for vname,var,vtype in zip(varnames,varlist,typelist):
798 for vname,var,vtype in zip(varnames,varlist,typelist):
798 print itpl(vformat),
799 print itpl(vformat),
799 if vtype in seq_types:
800 if vtype in seq_types:
800 print len(var)
801 print len(var)
801 elif vtype==array_type:
802 elif vtype==array_type:
802 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
803 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
803 vsize = Numeric.size(var)
804 vsize = Numeric.size(var)
804 vbytes = vsize*var.itemsize()
805 vbytes = vsize*var.itemsize()
805 if vbytes < 100000:
806 if vbytes < 100000:
806 print aformat % (vshape,vsize,var.typecode(),vbytes)
807 print aformat % (vshape,vsize,var.typecode(),vbytes)
807 else:
808 else:
808 print aformat % (vshape,vsize,var.typecode(),vbytes),
809 print aformat % (vshape,vsize,var.typecode(),vbytes),
809 if vbytes < Mb:
810 if vbytes < Mb:
810 print '(%s kb)' % (vbytes/kb,)
811 print '(%s kb)' % (vbytes/kb,)
811 else:
812 else:
812 print '(%s Mb)' % (vbytes/Mb,)
813 print '(%s Mb)' % (vbytes/Mb,)
813 else:
814 else:
814 vstr = str(var)
815 vstr = str(var)
815 if len(vstr) < 50:
816 if len(vstr) < 50:
816 print vstr
817 print vstr
817 else:
818 else:
818 printpl(vfmt_short)
819 printpl(vfmt_short)
819
820
820 def magic_reset(self, parameter_s=''):
821 def magic_reset(self, parameter_s=''):
821 """Resets the namespace by removing all names defined by the user.
822 """Resets the namespace by removing all names defined by the user.
822
823
823 Input/Output history are left around in case you need them."""
824 Input/Output history are left around in case you need them."""
824
825
825 ans = raw_input(
826 ans = raw_input(
826 "Once deleted, variables cannot be recovered. Proceed (y/n)? ")
827 "Once deleted, variables cannot be recovered. Proceed (y/n)? ")
827 if not ans.lower() == 'y':
828 if not ans.lower() == 'y':
828 print 'Nothing done.'
829 print 'Nothing done.'
829 return
830 return
830 for i in self.magic_who_ls():
831 for i in self.magic_who_ls():
831 del(self.locals[i])
832 del(self.locals[i])
832
833
833 def magic_config(self,parameter_s=''):
834 def magic_config(self,parameter_s=''):
834 """Show IPython's internal configuration."""
835 """Show IPython's internal configuration."""
835
836
836 page('Current configuration structure:\n'+
837 page('Current configuration structure:\n'+
837 pformat(self.shell.rc.dict()))
838 pformat(self.shell.rc.dict()))
838
839
839 def magic_logstart(self,parameter_s=''):
840 def magic_logstart(self,parameter_s=''):
840 """Start logging anywhere in a session.
841 """Start logging anywhere in a session.
841
842
842 %logstart [log_name [log_mode]]
843 %logstart [log_name [log_mode]]
843
844
844 If no name is given, it defaults to a file named 'ipython.log' in your
845 If no name is given, it defaults to a file named 'ipython.log' in your
845 current directory, in 'rotate' mode (see below).
846 current directory, in 'rotate' mode (see below).
846
847
847 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
848 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
848 history up to that point and then continues logging.
849 history up to that point and then continues logging.
849
850
850 %logstart takes a second optional parameter: logging mode. This can be one
851 %logstart takes a second optional parameter: logging mode. This can be one
851 of (note that the modes are given unquoted):\\
852 of (note that the modes are given unquoted):\\
852 over: overwrite existing log.\\
853 over: overwrite existing log.\\
853 backup: rename (if exists) to name~ and start name.\\
854 backup: rename (if exists) to name~ and start name.\\
854 append: well, that says it.\\
855 append: well, that says it.\\
855 rotate: create rotating logs name.1~, name.2~, etc.
856 rotate: create rotating logs name.1~, name.2~, etc.
856 """
857 """
857
858
858 #FIXME. This function should all be moved to the Logger class.
859 #FIXME. This function should all be moved to the Logger class.
859
860
860 valid_modes = qw('over backup append rotate')
861 valid_modes = qw('over backup append rotate')
861 if self.LOG:
862 if self.LOG:
862 print 'Logging is already in place. Logfile:',self.LOG
863 print 'Logging is already in place. Logfile:',self.LOG
863 return
864 return
864
865
865 par = parameter_s.strip()
866 par = parameter_s.strip()
866 if not par:
867 if not par:
867 logname = self.LOGDEF
868 logname = self.LOGDEF
868 logmode = 'rotate' # use rotate for the auto-generated logs
869 logmode = 'rotate' # use rotate for the auto-generated logs
869 else:
870 else:
870 try:
871 try:
871 logname,logmode = par.split()
872 logname,logmode = par.split()
872 except:
873 except:
873 try:
874 try:
874 logname = par
875 logname = par
875 logmode = 'backup'
876 logmode = 'backup'
876 except:
877 except:
877 warn('Usage: %log [log_name [log_mode]]')
878 warn('Usage: %log [log_name [log_mode]]')
878 return
879 return
879 if not logmode in valid_modes:
880 if not logmode in valid_modes:
880 warn('Logging NOT activated.\n'
881 warn('Logging NOT activated.\n'
881 'Usage: %log [log_name [log_mode]]\n'
882 'Usage: %log [log_name [log_mode]]\n'
882 'Valid modes: '+str(valid_modes))
883 'Valid modes: '+str(valid_modes))
883 return
884 return
884
885
885 # If we made it this far, I think we're ok:
886 # If we made it this far, I think we're ok:
886 print 'Activating auto-logging.'
887 print 'Activating auto-logging.'
887 print 'Current session state plus future input saved to:',logname
888 print 'Current session state plus future input saved to:',logname
888 print 'Logging mode: ',logmode
889 print 'Logging mode: ',logmode
889 # put logname into rc struct as if it had been called on the command line,
890 # put logname into rc struct as if it had been called on the command line,
890 # so it ends up saved in the log header
891 # so it ends up saved in the log header
891 # Save it in case we need to restore it...
892 # Save it in case we need to restore it...
892 old_logfile = self.shell.rc.opts.get('logfile','')
893 old_logfile = self.shell.rc.opts.get('logfile','')
893 logname = os.path.expanduser(logname)
894 logname = os.path.expanduser(logname)
894 self.shell.rc.opts.logfile = logname
895 self.shell.rc.opts.logfile = logname
895 self.LOGMODE = logmode # FIXME: this should be set through a function.
896 self.LOGMODE = logmode # FIXME: this should be set through a function.
896 try:
897 try:
897 header = str(self.LOGHEAD)
898 header = str(self.LOGHEAD)
898 self.create_log(header,logname)
899 self.create_log(header,logname)
899 self.logstart(header,logname)
900 self.logstart(header,logname)
900 except:
901 except:
901 self.LOG = '' # we are NOT logging, something went wrong
902 self.LOG = '' # we are NOT logging, something went wrong
902 self.shell.rc.opts.logfile = old_logfile
903 self.shell.rc.opts.logfile = old_logfile
903 warn("Couldn't start log: "+str(sys.exc_info()[1]))
904 warn("Couldn't start log: "+str(sys.exc_info()[1]))
904 else: # log input history up to this point
905 else: # log input history up to this point
905 self.logfile.write(self.shell.user_ns['_ih'][1:])
906 self.logfile.write(self.shell.user_ns['_ih'][1:])
906 self.logfile.flush()
907 self.logfile.flush()
907
908
908 def magic_logoff(self,parameter_s=''):
909 def magic_logoff(self,parameter_s=''):
909 """Temporarily stop logging.
910 """Temporarily stop logging.
910
911
911 You must have previously started logging."""
912 You must have previously started logging."""
912 self.switch_log(0)
913 self.switch_log(0)
913
914
914 def magic_logon(self,parameter_s=''):
915 def magic_logon(self,parameter_s=''):
915 """Restart logging.
916 """Restart logging.
916
917
917 This function is for restarting logging which you've temporarily
918 This function is for restarting logging which you've temporarily
918 stopped with %logoff. For starting logging for the first time, you
919 stopped with %logoff. For starting logging for the first time, you
919 must use the %logstart function, which allows you to specify an
920 must use the %logstart function, which allows you to specify an
920 optional log filename."""
921 optional log filename."""
921
922
922 self.switch_log(1)
923 self.switch_log(1)
923
924
924 def magic_logstate(self,parameter_s=''):
925 def magic_logstate(self,parameter_s=''):
925 """Print the status of the logging system."""
926 """Print the status of the logging system."""
926
927
927 self.logstate()
928 self.logstate()
928
929
929 def magic_pdb(self, parameter_s=''):
930 def magic_pdb(self, parameter_s=''):
930 """Control the calling of the pdb interactive debugger.
931 """Control the calling of the pdb interactive debugger.
931
932
932 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
933 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
933 argument it works as a toggle.
934 argument it works as a toggle.
934
935
935 When an exception is triggered, IPython can optionally call the
936 When an exception is triggered, IPython can optionally call the
936 interactive pdb debugger after the traceback printout. %pdb toggles
937 interactive pdb debugger after the traceback printout. %pdb toggles
937 this feature on and off."""
938 this feature on and off."""
938
939
939 par = parameter_s.strip().lower()
940 par = parameter_s.strip().lower()
940
941
941 if par:
942 if par:
942 try:
943 try:
943 pdb = {'off':0,'0':0,'on':1,'1':1}[par]
944 pdb = {'off':0,'0':0,'on':1,'1':1}[par]
944 except KeyError:
945 except KeyError:
945 print 'Incorrect argument. Use on/1, off/0 or nothing for a toggle.'
946 print 'Incorrect argument. Use on/1, off/0 or nothing for a toggle.'
946 return
947 return
947 else:
948 else:
948 self.shell.InteractiveTB.call_pdb = pdb
949 self.shell.InteractiveTB.call_pdb = pdb
949 else:
950 else:
950 self.shell.InteractiveTB.call_pdb = 1 - self.shell.InteractiveTB.call_pdb
951 self.shell.InteractiveTB.call_pdb = 1 - self.shell.InteractiveTB.call_pdb
951 print 'Automatic pdb calling has been turned',\
952 print 'Automatic pdb calling has been turned',\
952 on_off(self.shell.InteractiveTB.call_pdb)
953 on_off(self.shell.InteractiveTB.call_pdb)
953
954
954
955
955 def magic_prun(self, parameter_s ='',user_mode=1,
956 def magic_prun(self, parameter_s ='',user_mode=1,
956 opts=None,arg_lst=None,prog_ns=None):
957 opts=None,arg_lst=None,prog_ns=None):
957
958
958 """Run a statement through the python code profiler.
959 """Run a statement through the python code profiler.
959
960
960 Usage:\\
961 Usage:\\
961 %prun [options] statement
962 %prun [options] statement
962
963
963 The given statement (which doesn't require quote marks) is run via the
964 The given statement (which doesn't require quote marks) is run via the
964 python profiler in a manner similar to the profile.run() function.
965 python profiler in a manner similar to the profile.run() function.
965 Namespaces are internally managed to work correctly; profile.run
966 Namespaces are internally managed to work correctly; profile.run
966 cannot be used in IPython because it makes certain assumptions about
967 cannot be used in IPython because it makes certain assumptions about
967 namespaces which do not hold under IPython.
968 namespaces which do not hold under IPython.
968
969
969 Options:
970 Options:
970
971
971 -l <limit>: you can place restrictions on what or how much of the
972 -l <limit>: you can place restrictions on what or how much of the
972 profile gets printed. The limit value can be:
973 profile gets printed. The limit value can be:
973
974
974 * A string: only information for function names containing this string
975 * A string: only information for function names containing this string
975 is printed.
976 is printed.
976
977
977 * An integer: only these many lines are printed.
978 * An integer: only these many lines are printed.
978
979
979 * A float (between 0 and 1): this fraction of the report is printed
980 * A float (between 0 and 1): this fraction of the report is printed
980 (for example, use a limit of 0.4 to see the topmost 40% only).
981 (for example, use a limit of 0.4 to see the topmost 40% only).
981
982
982 You can combine several limits with repeated use of the option. For
983 You can combine several limits with repeated use of the option. For
983 example, '-l __init__ -l 5' will print only the topmost 5 lines of
984 example, '-l __init__ -l 5' will print only the topmost 5 lines of
984 information about class constructors.
985 information about class constructors.
985
986
986 -r: return the pstats.Stats object generated by the profiling. This
987 -r: return the pstats.Stats object generated by the profiling. This
987 object has all the information about the profile in it, and you can
988 object has all the information about the profile in it, and you can
988 later use it for further analysis or in other functions.
989 later use it for further analysis or in other functions.
989
990
990 Since magic functions have a particular form of calling which prevents
991 Since magic functions have a particular form of calling which prevents
991 you from writing something like:\\
992 you from writing something like:\\
992 In [1]: p = %prun -r print 4 # invalid!\\
993 In [1]: p = %prun -r print 4 # invalid!\\
993 you must instead use IPython's automatic variables to assign this:\\
994 you must instead use IPython's automatic variables to assign this:\\
994 In [1]: %prun -r print 4 \\
995 In [1]: %prun -r print 4 \\
995 Out[1]: <pstats.Stats instance at 0x8222cec>\\
996 Out[1]: <pstats.Stats instance at 0x8222cec>\\
996 In [2]: stats = _
997 In [2]: stats = _
997
998
998 If you really need to assign this value via an explicit function call,
999 If you really need to assign this value via an explicit function call,
999 you can always tap directly into the true name of the magic function
1000 you can always tap directly into the true name of the magic function
1000 by using the ipmagic function (which IPython automatically adds to the
1001 by using the ipmagic function (which IPython automatically adds to the
1001 builtins):\\
1002 builtins):\\
1002 In [3]: stats = ipmagic('prun','-r print 4')
1003 In [3]: stats = ipmagic('prun','-r print 4')
1003
1004
1004 You can type ipmagic? for more details on ipmagic.
1005 You can type ipmagic? for more details on ipmagic.
1005
1006
1006 -s <key>: sort profile by given key. You can provide more than one key
1007 -s <key>: sort profile by given key. You can provide more than one key
1007 by using the option several times: '-s key1 -s key2 -s key3...'. The
1008 by using the option several times: '-s key1 -s key2 -s key3...'. The
1008 default sorting key is 'time'.
1009 default sorting key is 'time'.
1009
1010
1010 The following is copied verbatim from the profile documentation
1011 The following is copied verbatim from the profile documentation
1011 referenced below:
1012 referenced below:
1012
1013
1013 When more than one key is provided, additional keys are used as
1014 When more than one key is provided, additional keys are used as
1014 secondary criteria when the there is equality in all keys selected
1015 secondary criteria when the there is equality in all keys selected
1015 before them.
1016 before them.
1016
1017
1017 Abbreviations can be used for any key names, as long as the
1018 Abbreviations can be used for any key names, as long as the
1018 abbreviation is unambiguous. The following are the keys currently
1019 abbreviation is unambiguous. The following are the keys currently
1019 defined:
1020 defined:
1020
1021
1021 Valid Arg Meaning\\
1022 Valid Arg Meaning\\
1022 "calls" call count\\
1023 "calls" call count\\
1023 "cumulative" cumulative time\\
1024 "cumulative" cumulative time\\
1024 "file" file name\\
1025 "file" file name\\
1025 "module" file name\\
1026 "module" file name\\
1026 "pcalls" primitive call count\\
1027 "pcalls" primitive call count\\
1027 "line" line number\\
1028 "line" line number\\
1028 "name" function name\\
1029 "name" function name\\
1029 "nfl" name/file/line\\
1030 "nfl" name/file/line\\
1030 "stdname" standard name\\
1031 "stdname" standard name\\
1031 "time" internal time
1032 "time" internal time
1032
1033
1033 Note that all sorts on statistics are in descending order (placing
1034 Note that all sorts on statistics are in descending order (placing
1034 most time consuming items first), where as name, file, and line number
1035 most time consuming items first), where as name, file, and line number
1035 searches are in ascending order (i.e., alphabetical). The subtle
1036 searches are in ascending order (i.e., alphabetical). The subtle
1036 distinction between "nfl" and "stdname" is that the standard name is a
1037 distinction between "nfl" and "stdname" is that the standard name is a
1037 sort of the name as printed, which means that the embedded line
1038 sort of the name as printed, which means that the embedded line
1038 numbers get compared in an odd way. For example, lines 3, 20, and 40
1039 numbers get compared in an odd way. For example, lines 3, 20, and 40
1039 would (if the file names were the same) appear in the string order
1040 would (if the file names were the same) appear in the string order
1040 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1041 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1041 line numbers. In fact, sort_stats("nfl") is the same as
1042 line numbers. In fact, sort_stats("nfl") is the same as
1042 sort_stats("name", "file", "line").
1043 sort_stats("name", "file", "line").
1043
1044
1044 -T <filename>: save profile results as shown on screen to a text
1045 -T <filename>: save profile results as shown on screen to a text
1045 file. The profile is still shown on screen.
1046 file. The profile is still shown on screen.
1046
1047
1047 -D <filename>: save (via dump_stats) profile statistics to given
1048 -D <filename>: save (via dump_stats) profile statistics to given
1048 filename. This data is in a format understod by the pstats module, and
1049 filename. This data is in a format understod by the pstats module, and
1049 is generated by a call to the dump_stats() method of profile
1050 is generated by a call to the dump_stats() method of profile
1050 objects. The profile is still shown on screen.
1051 objects. The profile is still shown on screen.
1051
1052
1052 If you want to run complete programs under the profiler's control, use
1053 If you want to run complete programs under the profiler's control, use
1053 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1054 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1054 contains profiler specific options as described here.
1055 contains profiler specific options as described here.
1055
1056
1056 You can read the complete documentation for the profile module with:\\
1057 You can read the complete documentation for the profile module with:\\
1057 In [1]: import profile; profile.help() """
1058 In [1]: import profile; profile.help() """
1058
1059
1059 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1060 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1060 # protect user quote marks
1061 # protect user quote marks
1061 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1062 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1062
1063
1063 if user_mode: # regular user call
1064 if user_mode: # regular user call
1064 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1065 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1065 list_all=1)
1066 list_all=1)
1066 namespace = self.shell.user_ns
1067 namespace = self.shell.user_ns
1067 else: # called to run a program by %run -p
1068 else: # called to run a program by %run -p
1068 try:
1069 try:
1069 filename = get_py_filename(arg_lst[0])
1070 filename = get_py_filename(arg_lst[0])
1070 except IOError,msg:
1071 except IOError,msg:
1071 error(msg)
1072 error(msg)
1072 return
1073 return
1073
1074
1074 arg_str = 'execfile(filename,prog_ns)'
1075 arg_str = 'execfile(filename,prog_ns)'
1075 namespace = locals()
1076 namespace = locals()
1076
1077
1077 opts.merge(opts_def)
1078 opts.merge(opts_def)
1078
1079
1079 prof = profile.Profile()
1080 prof = profile.Profile()
1080 try:
1081 try:
1081 prof = prof.runctx(arg_str,namespace,namespace)
1082 prof = prof.runctx(arg_str,namespace,namespace)
1082 sys_exit = ''
1083 sys_exit = ''
1083 except SystemExit:
1084 except SystemExit:
1084 sys_exit = """*** SystemExit exception caught in code being profiled."""
1085 sys_exit = """*** SystemExit exception caught in code being profiled."""
1085
1086
1086 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1087 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1087
1088
1088 lims = opts.l
1089 lims = opts.l
1089 if lims:
1090 if lims:
1090 lims = [] # rebuild lims with ints/floats/strings
1091 lims = [] # rebuild lims with ints/floats/strings
1091 for lim in opts.l:
1092 for lim in opts.l:
1092 try:
1093 try:
1093 lims.append(int(lim))
1094 lims.append(int(lim))
1094 except ValueError:
1095 except ValueError:
1095 try:
1096 try:
1096 lims.append(float(lim))
1097 lims.append(float(lim))
1097 except ValueError:
1098 except ValueError:
1098 lims.append(lim)
1099 lims.append(lim)
1099
1100
1100 # trap output
1101 # trap output
1101 sys_stdout = sys.stdout
1102 sys_stdout = sys.stdout
1102 stdout_trap = StringIO()
1103 stdout_trap = StringIO()
1103 try:
1104 try:
1104 sys.stdout = stdout_trap
1105 sys.stdout = stdout_trap
1105 stats.print_stats(*lims)
1106 stats.print_stats(*lims)
1106 finally:
1107 finally:
1107 sys.stdout = sys_stdout
1108 sys.stdout = sys_stdout
1108 output = stdout_trap.getvalue()
1109 output = stdout_trap.getvalue()
1109 output = output.rstrip()
1110 output = output.rstrip()
1110
1111
1111 page(output,screen_lines=self.shell.rc.screen_length)
1112 page(output,screen_lines=self.shell.rc.screen_length)
1112 print sys_exit,
1113 print sys_exit,
1113
1114
1114 dump_file = opts.D[0]
1115 dump_file = opts.D[0]
1115 text_file = opts.T[0]
1116 text_file = opts.T[0]
1116 if dump_file:
1117 if dump_file:
1117 prof.dump_stats(dump_file)
1118 prof.dump_stats(dump_file)
1118 print '\n*** Profile stats marshalled to file',\
1119 print '\n*** Profile stats marshalled to file',\
1119 `dump_file`+'.',sys_exit
1120 `dump_file`+'.',sys_exit
1120 if text_file:
1121 if text_file:
1121 file(text_file,'w').write(output)
1122 file(text_file,'w').write(output)
1122 print '\n*** Profile printout saved to text file',\
1123 print '\n*** Profile printout saved to text file',\
1123 `text_file`+'.',sys_exit
1124 `text_file`+'.',sys_exit
1124
1125
1125 if opts.has_key('r'):
1126 if opts.has_key('r'):
1126 return stats
1127 return stats
1127 else:
1128 else:
1128 return None
1129 return None
1129
1130
1130 def magic_run(self, parameter_s ='',runner=None):
1131 def magic_run(self, parameter_s ='',runner=None):
1131 """Run the named file inside IPython as a program.
1132 """Run the named file inside IPython as a program.
1132
1133
1133 Usage:\\
1134 Usage:\\
1134 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1135 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1135
1136
1136 Parameters after the filename are passed as command-line arguments to
1137 Parameters after the filename are passed as command-line arguments to
1137 the program (put in sys.argv). Then, control returns to IPython's
1138 the program (put in sys.argv). Then, control returns to IPython's
1138 prompt.
1139 prompt.
1139
1140
1140 This is similar to running at a system prompt:\\
1141 This is similar to running at a system prompt:\\
1141 $ python file args\\
1142 $ python file args\\
1142 but with the advantage of giving you IPython's tracebacks, and of
1143 but with the advantage of giving you IPython's tracebacks, and of
1143 loading all variables into your interactive namespace for further use
1144 loading all variables into your interactive namespace for further use
1144 (unless -p is used, see below).
1145 (unless -p is used, see below).
1145
1146
1146 The file is executed in a namespace initially consisting only of
1147 The file is executed in a namespace initially consisting only of
1147 __name__=='__main__' and sys.argv constructed as indicated. It thus
1148 __name__=='__main__' and sys.argv constructed as indicated. It thus
1148 sees its environment as if it were being run as a stand-alone
1149 sees its environment as if it were being run as a stand-alone
1149 program. But after execution, the IPython interactive namespace gets
1150 program. But after execution, the IPython interactive namespace gets
1150 updated with all variables defined in the program (except for __name__
1151 updated with all variables defined in the program (except for __name__
1151 and sys.argv). This allows for very convenient loading of code for
1152 and sys.argv). This allows for very convenient loading of code for
1152 interactive work, while giving each program a 'clean sheet' to run in.
1153 interactive work, while giving each program a 'clean sheet' to run in.
1153
1154
1154 Options:
1155 Options:
1155
1156
1156 -n: __name__ is NOT set to '__main__', but to the running file's name
1157 -n: __name__ is NOT set to '__main__', but to the running file's name
1157 without extension (as python does under import). This allows running
1158 without extension (as python does under import). This allows running
1158 scripts and reloading the definitions in them without calling code
1159 scripts and reloading the definitions in them without calling code
1159 protected by an ' if __name__ == "__main__" ' clause.
1160 protected by an ' if __name__ == "__main__" ' clause.
1160
1161
1161 -i: run the file in IPython's namespace instead of an empty one. This
1162 -i: run the file in IPython's namespace instead of an empty one. This
1162 is useful if you are experimenting with code written in a text editor
1163 is useful if you are experimenting with code written in a text editor
1163 which depends on variables defined interactively.
1164 which depends on variables defined interactively.
1164
1165
1165 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1166 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1166 being run. This is particularly useful if IPython is being used to
1167 being run. This is particularly useful if IPython is being used to
1167 run unittests, which always exit with a sys.exit() call. In such
1168 run unittests, which always exit with a sys.exit() call. In such
1168 cases you are interested in the output of the test results, not in
1169 cases you are interested in the output of the test results, not in
1169 seeing a traceback of the unittest module.
1170 seeing a traceback of the unittest module.
1170
1171
1171 -t: print timing information at the end of the run. IPython will give
1172 -t: print timing information at the end of the run. IPython will give
1172 you an estimated CPU time consumption for your script, which under
1173 you an estimated CPU time consumption for your script, which under
1173 Unix uses the resource module to avoid the wraparound problems of
1174 Unix uses the resource module to avoid the wraparound problems of
1174 time.clock(). Under Unix, an estimate of time spent on system tasks
1175 time.clock(). Under Unix, an estimate of time spent on system tasks
1175 is also given (for Windows platforms this is reported as 0.0).
1176 is also given (for Windows platforms this is reported as 0.0).
1176
1177
1177 If -t is given, an additional -N<N> option can be given, where <N>
1178 If -t is given, an additional -N<N> option can be given, where <N>
1178 must be an integer indicating how many times you want the script to
1179 must be an integer indicating how many times you want the script to
1179 run. The final timing report will include total and per run results.
1180 run. The final timing report will include total and per run results.
1180
1181
1181 For example (testing the script uniq_stable.py):
1182 For example (testing the script uniq_stable.py):
1182
1183
1183 In [1]: run -t uniq_stable
1184 In [1]: run -t uniq_stable
1184
1185
1185 IPython CPU timings (estimated):\\
1186 IPython CPU timings (estimated):\\
1186 User : 0.19597 s.\\
1187 User : 0.19597 s.\\
1187 System: 0.0 s.\\
1188 System: 0.0 s.\\
1188
1189
1189 In [2]: run -t -N5 uniq_stable
1190 In [2]: run -t -N5 uniq_stable
1190
1191
1191 IPython CPU timings (estimated):\\
1192 IPython CPU timings (estimated):\\
1192 Total runs performed: 5\\
1193 Total runs performed: 5\\
1193 Times : Total Per run\\
1194 Times : Total Per run\\
1194 User : 0.910862 s, 0.1821724 s.\\
1195 User : 0.910862 s, 0.1821724 s.\\
1195 System: 0.0 s, 0.0 s.
1196 System: 0.0 s, 0.0 s.
1196
1197
1197 -d: run your program under the control of pdb, the Python debugger.
1198 -d: run your program under the control of pdb, the Python debugger.
1198 This allows you to execute your program step by step, watch variables,
1199 This allows you to execute your program step by step, watch variables,
1199 etc. Internally, what IPython does is similar to calling:
1200 etc. Internally, what IPython does is similar to calling:
1200
1201
1201 pdb.run('execfile("YOURFILENAME")')
1202 pdb.run('execfile("YOURFILENAME")')
1202
1203
1203 with a breakpoint set on line 1 of your file. You can change the line
1204 with a breakpoint set on line 1 of your file. You can change the line
1204 number for this automatic breakpoint to be <N> by using the -bN option
1205 number for this automatic breakpoint to be <N> by using the -bN option
1205 (where N must be an integer). For example:
1206 (where N must be an integer). For example:
1206
1207
1207 %run -d -b40 myscript
1208 %run -d -b40 myscript
1208
1209
1209 will set the first breakpoint at line 40 in myscript.py. Note that
1210 will set the first breakpoint at line 40 in myscript.py. Note that
1210 the first breakpoint must be set on a line which actually does
1211 the first breakpoint must be set on a line which actually does
1211 something (not a comment or docstring) for it to stop execution.
1212 something (not a comment or docstring) for it to stop execution.
1212
1213
1213 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1214 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1214 first enter 'c' (without qoutes) to start execution up to the first
1215 first enter 'c' (without qoutes) to start execution up to the first
1215 breakpoint.
1216 breakpoint.
1216
1217
1217 Entering 'help' gives information about the use of the debugger. You
1218 Entering 'help' gives information about the use of the debugger. You
1218 can easily see pdb's full documentation with "import pdb;pdb.help()"
1219 can easily see pdb's full documentation with "import pdb;pdb.help()"
1219 at a prompt.
1220 at a prompt.
1220
1221
1221 -p: run program under the control of the Python profiler module (which
1222 -p: run program under the control of the Python profiler module (which
1222 prints a detailed report of execution times, function calls, etc).
1223 prints a detailed report of execution times, function calls, etc).
1223
1224
1224 You can pass other options after -p which affect the behavior of the
1225 You can pass other options after -p which affect the behavior of the
1225 profiler itself. See the docs for %prun for details.
1226 profiler itself. See the docs for %prun for details.
1226
1227
1227 In this mode, the program's variables do NOT propagate back to the
1228 In this mode, the program's variables do NOT propagate back to the
1228 IPython interactive namespace (because they remain in the namespace
1229 IPython interactive namespace (because they remain in the namespace
1229 where the profiler executes them).
1230 where the profiler executes them).
1230
1231
1231 Internally this triggers a call to %prun, see its documentation for
1232 Internally this triggers a call to %prun, see its documentation for
1232 details on the options available specifically for profiling."""
1233 details on the options available specifically for profiling."""
1233
1234
1234 # get arguments and set sys.argv for program to be run.
1235 # get arguments and set sys.argv for program to be run.
1235 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1236 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1236 mode='list',list_all=1)
1237 mode='list',list_all=1)
1237
1238
1238 try:
1239 try:
1239 filename = get_py_filename(arg_lst[0])
1240 filename = get_py_filename(arg_lst[0])
1240 except IndexError:
1241 except IndexError:
1241 warn('you must provide at least a filename.')
1242 warn('you must provide at least a filename.')
1242 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1243 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1243 return
1244 return
1244 except IOError,msg:
1245 except IOError,msg:
1245 error(msg)
1246 error(msg)
1246 return
1247 return
1247
1248
1248 # Control the response to exit() calls made by the script being run
1249 # Control the response to exit() calls made by the script being run
1249 exit_ignore = opts.has_key('e')
1250 exit_ignore = opts.has_key('e')
1250
1251
1251 # Make sure that the running script gets a proper sys.argv as if it
1252 # Make sure that the running script gets a proper sys.argv as if it
1252 # were run from a system shell.
1253 # were run from a system shell.
1253 save_argv = sys.argv # save it for later restoring
1254 save_argv = sys.argv # save it for later restoring
1254 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1255 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1255
1256
1256 if opts.has_key('i'):
1257 if opts.has_key('i'):
1257 prog_ns = self.shell.user_ns
1258 prog_ns = self.shell.user_ns
1258 __name__save = self.shell.user_ns['__name__']
1259 __name__save = self.shell.user_ns['__name__']
1259 prog_ns['__name__'] = '__main__'
1260 prog_ns['__name__'] = '__main__'
1260 else:
1261 else:
1261 if opts.has_key('n'):
1262 if opts.has_key('n'):
1262 name = os.path.splitext(os.path.basename(filename))[0]
1263 name = os.path.splitext(os.path.basename(filename))[0]
1263 else:
1264 else:
1264 name = '__main__'
1265 name = '__main__'
1265 prog_ns = {'__name__':name}
1266 prog_ns = {'__name__':name}
1266
1267
1267 # pickle fix. See iplib for an explanation
1268 # pickle fix. See iplib for an explanation
1268 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1269 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1269
1270
1270 stats = None
1271 stats = None
1271 try:
1272 try:
1272 if opts.has_key('p'):
1273 if opts.has_key('p'):
1273 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1274 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1274 else:
1275 else:
1275 if opts.has_key('d'):
1276 if opts.has_key('d'):
1276 deb = pdb.Pdb()
1277 deb = pdb.Pdb()
1277 # reset Breakpoint state, which is moronically kept
1278 # reset Breakpoint state, which is moronically kept
1278 # in a class
1279 # in a class
1279 bdb.Breakpoint.next = 1
1280 bdb.Breakpoint.next = 1
1280 bdb.Breakpoint.bplist = {}
1281 bdb.Breakpoint.bplist = {}
1281 bdb.Breakpoint.bpbynumber = [None]
1282 bdb.Breakpoint.bpbynumber = [None]
1282 # Set an initial breakpoint to stop execution
1283 # Set an initial breakpoint to stop execution
1283 maxtries = 10
1284 maxtries = 10
1284 bp = int(opts.get('b',[1])[0])
1285 bp = int(opts.get('b',[1])[0])
1285 checkline = deb.checkline(filename,bp)
1286 checkline = deb.checkline(filename,bp)
1286 if not checkline:
1287 if not checkline:
1287 for bp in range(bp+1,bp+maxtries+1):
1288 for bp in range(bp+1,bp+maxtries+1):
1288 if deb.checkline(filename,bp):
1289 if deb.checkline(filename,bp):
1289 break
1290 break
1290 else:
1291 else:
1291 msg = ("\nI failed to find a valid line to set "
1292 msg = ("\nI failed to find a valid line to set "
1292 "a breakpoint\n"
1293 "a breakpoint\n"
1293 "after trying up to line: %s.\n"
1294 "after trying up to line: %s.\n"
1294 "Please set a valid breakpoint manually "
1295 "Please set a valid breakpoint manually "
1295 "with the -b option." % bp)
1296 "with the -b option." % bp)
1296 error(msg)
1297 error(msg)
1297 return
1298 return
1298 # if we find a good linenumber, set the breakpoint
1299 # if we find a good linenumber, set the breakpoint
1299 deb.do_break('%s:%s' % (filename,bp))
1300 deb.do_break('%s:%s' % (filename,bp))
1300 # Start file run
1301 # Start file run
1301 print "NOTE: Enter 'c' at the",
1302 print "NOTE: Enter 'c' at the",
1302 print "(Pdb) prompt to start your script."
1303 print "(Pdb) prompt to start your script."
1303 deb.run('execfile("%s")' % filename,prog_ns)
1304 deb.run('execfile("%s")' % filename,prog_ns)
1304 else:
1305 else:
1305 if runner is None:
1306 if runner is None:
1306 runner = self.shell.safe_execfile
1307 runner = self.shell.safe_execfile
1307 if opts.has_key('t'):
1308 if opts.has_key('t'):
1308 try:
1309 try:
1309 nruns = int(opts['N'][0])
1310 nruns = int(opts['N'][0])
1310 if nruns < 1:
1311 if nruns < 1:
1311 error('Number of runs must be >=1')
1312 error('Number of runs must be >=1')
1312 return
1313 return
1313 except (KeyError):
1314 except (KeyError):
1314 nruns = 1
1315 nruns = 1
1315 if nruns == 1:
1316 if nruns == 1:
1316 t0 = clock2()
1317 t0 = clock2()
1317 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1318 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1318 t1 = clock2()
1319 t1 = clock2()
1319 t_usr = t1[0]-t0[0]
1320 t_usr = t1[0]-t0[0]
1320 t_sys = t1[1]-t1[1]
1321 t_sys = t1[1]-t1[1]
1321 print "\nIPython CPU timings (estimated):"
1322 print "\nIPython CPU timings (estimated):"
1322 print " User : %10s s." % t_usr
1323 print " User : %10s s." % t_usr
1323 print " System: %10s s." % t_sys
1324 print " System: %10s s." % t_sys
1324 else:
1325 else:
1325 runs = range(nruns)
1326 runs = range(nruns)
1326 t0 = clock2()
1327 t0 = clock2()
1327 for nr in runs:
1328 for nr in runs:
1328 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1329 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1329 t1 = clock2()
1330 t1 = clock2()
1330 t_usr = t1[0]-t0[0]
1331 t_usr = t1[0]-t0[0]
1331 t_sys = t1[1]-t1[1]
1332 t_sys = t1[1]-t1[1]
1332 print "\nIPython CPU timings (estimated):"
1333 print "\nIPython CPU timings (estimated):"
1333 print "Total runs performed:",nruns
1334 print "Total runs performed:",nruns
1334 print " Times : %10s %10s" % ('Total','Per run')
1335 print " Times : %10s %10s" % ('Total','Per run')
1335 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1336 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1336 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1337 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1337
1338
1338 else:
1339 else:
1339 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1340 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1340 if opts.has_key('i'):
1341 if opts.has_key('i'):
1341 self.shell.user_ns['__name__'] = __name__save
1342 self.shell.user_ns['__name__'] = __name__save
1342 else:
1343 else:
1343 # update IPython interactive namespace
1344 # update IPython interactive namespace
1344 del prog_ns['__name__']
1345 del prog_ns['__name__']
1345 self.shell.user_ns.update(prog_ns)
1346 self.shell.user_ns.update(prog_ns)
1346 finally:
1347 finally:
1347 sys.argv = save_argv
1348 sys.argv = save_argv
1348 return stats
1349 return stats
1349
1350
1350 def magic_runlog(self, parameter_s =''):
1351 def magic_runlog(self, parameter_s =''):
1351 """Run files as logs.
1352 """Run files as logs.
1352
1353
1353 Usage:\\
1354 Usage:\\
1354 %runlog file1 file2 ...
1355 %runlog file1 file2 ...
1355
1356
1356 Run the named files (treating them as log files) in sequence inside
1357 Run the named files (treating them as log files) in sequence inside
1357 the interpreter, and return to the prompt. This is much slower than
1358 the interpreter, and return to the prompt. This is much slower than
1358 %run because each line is executed in a try/except block, but it
1359 %run because each line is executed in a try/except block, but it
1359 allows running files with syntax errors in them.
1360 allows running files with syntax errors in them.
1360
1361
1361 Normally IPython will guess when a file is one of its own logfiles, so
1362 Normally IPython will guess when a file is one of its own logfiles, so
1362 you can typically use %run even for logs. This shorthand allows you to
1363 you can typically use %run even for logs. This shorthand allows you to
1363 force any file to be treated as a log file."""
1364 force any file to be treated as a log file."""
1364
1365
1365 for f in parameter_s.split():
1366 for f in parameter_s.split():
1366 self.shell.safe_execfile(f,self.shell.user_ns,
1367 self.shell.safe_execfile(f,self.shell.user_ns,
1367 self.shell.user_ns,islog=1)
1368 self.shell.user_ns,islog=1)
1368
1369
1369 def magic_time(self,parameter_s = ''):
1370 def magic_time(self,parameter_s = ''):
1370 """Time execution of a Python statement or expression.
1371 """Time execution of a Python statement or expression.
1371
1372
1372 The CPU and wall clock times are printed, and the value of the
1373 The CPU and wall clock times are printed, and the value of the
1373 expression (if any) is returned. Note that under Win32, system time
1374 expression (if any) is returned. Note that under Win32, system time
1374 is always reported as 0, since it can not be measured.
1375 is always reported as 0, since it can not be measured.
1375
1376
1376 This function provides very basic timing functionality. In Python
1377 This function provides very basic timing functionality. In Python
1377 2.3, the timeit module offers more control and sophistication, but for
1378 2.3, the timeit module offers more control and sophistication, but for
1378 now IPython supports Python 2.2, so we can not rely on timeit being
1379 now IPython supports Python 2.2, so we can not rely on timeit being
1379 present.
1380 present.
1380
1381
1381 Some examples:
1382 Some examples:
1382
1383
1383 In [1]: time 2**128
1384 In [1]: time 2**128
1384 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1385 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1385 Wall time: 0.00
1386 Wall time: 0.00
1386 Out[1]: 340282366920938463463374607431768211456L
1387 Out[1]: 340282366920938463463374607431768211456L
1387
1388
1388 In [2]: n = 1000000
1389 In [2]: n = 1000000
1389
1390
1390 In [3]: time sum(range(n))
1391 In [3]: time sum(range(n))
1391 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1392 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1392 Wall time: 1.37
1393 Wall time: 1.37
1393 Out[3]: 499999500000L
1394 Out[3]: 499999500000L
1394
1395
1395 In [4]: time print 'hello world'
1396 In [4]: time print 'hello world'
1396 hello world
1397 hello world
1397 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1398 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1398 Wall time: 0.00
1399 Wall time: 0.00
1399 """
1400 """
1400
1401
1401 # fail immediately if the given expression can't be compiled
1402 # fail immediately if the given expression can't be compiled
1402 try:
1403 try:
1403 mode = 'eval'
1404 mode = 'eval'
1404 code = compile(parameter_s,'<timed eval>',mode)
1405 code = compile(parameter_s,'<timed eval>',mode)
1405 except SyntaxError:
1406 except SyntaxError:
1406 mode = 'exec'
1407 mode = 'exec'
1407 code = compile(parameter_s,'<timed exec>',mode)
1408 code = compile(parameter_s,'<timed exec>',mode)
1408 # skew measurement as little as possible
1409 # skew measurement as little as possible
1409 glob = self.shell.user_ns
1410 glob = self.shell.user_ns
1410 clk = clock2
1411 clk = clock2
1411 wtime = time.time
1412 wtime = time.time
1412 # time execution
1413 # time execution
1413 wall_st = wtime()
1414 wall_st = wtime()
1414 if mode=='eval':
1415 if mode=='eval':
1415 st = clk()
1416 st = clk()
1416 out = eval(code,glob)
1417 out = eval(code,glob)
1417 end = clk()
1418 end = clk()
1418 else:
1419 else:
1419 st = clk()
1420 st = clk()
1420 exec code in glob
1421 exec code in glob
1421 end = clk()
1422 end = clk()
1422 out = None
1423 out = None
1423 wall_end = wtime()
1424 wall_end = wtime()
1424 # Compute actual times and report
1425 # Compute actual times and report
1425 wall_time = wall_end-wall_st
1426 wall_time = wall_end-wall_st
1426 cpu_user = end[0]-st[0]
1427 cpu_user = end[0]-st[0]
1427 cpu_sys = end[1]-st[1]
1428 cpu_sys = end[1]-st[1]
1428 cpu_tot = cpu_user+cpu_sys
1429 cpu_tot = cpu_user+cpu_sys
1429 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1430 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1430 (cpu_user,cpu_sys,cpu_tot)
1431 (cpu_user,cpu_sys,cpu_tot)
1431 print "Wall time: %.2f" % wall_time
1432 print "Wall time: %.2f" % wall_time
1432 return out
1433 return out
1433
1434
1434 def magic_macro(self,parameter_s = ''):
1435 def magic_macro(self,parameter_s = ''):
1435 """Define a set of input lines as a macro for future re-execution.
1436 """Define a set of input lines as a macro for future re-execution.
1436
1437
1437 Usage:\\
1438 Usage:\\
1438 %macro name n1:n2 n3:n4 ... n5 .. n6 ...
1439 %macro name n1:n2 n3:n4 ... n5 .. n6 ...
1439
1440
1440 This will define a global variable called `name` which is a string
1441 This will define a global variable called `name` which is a string
1441 made of joining the slices and lines you specify (n1,n2,... numbers
1442 made of joining the slices and lines you specify (n1,n2,... numbers
1442 above) from your input history into a single string. This variable
1443 above) from your input history into a single string. This variable
1443 acts like an automatic function which re-executes those lines as if
1444 acts like an automatic function which re-executes those lines as if
1444 you had typed them. You just type 'name' at the prompt and the code
1445 you had typed them. You just type 'name' at the prompt and the code
1445 executes.
1446 executes.
1446
1447
1447 Note that the slices use the standard Python slicing notation (5:8
1448 Note that the slices use the standard Python slicing notation (5:8
1448 means include lines numbered 5,6,7).
1449 means include lines numbered 5,6,7).
1449
1450
1450 For example, if your history contains (%hist prints it):
1451 For example, if your history contains (%hist prints it):
1451
1452
1452 44: x=1\\
1453 44: x=1\\
1453 45: y=3\\
1454 45: y=3\\
1454 46: z=x+y\\
1455 46: z=x+y\\
1455 47: print x\\
1456 47: print x\\
1456 48: a=5\\
1457 48: a=5\\
1457 49: print 'x',x,'y',y\\
1458 49: print 'x',x,'y',y\\
1458
1459
1459 you can create a macro with lines 44 through 47 (included) and line 49
1460 you can create a macro with lines 44 through 47 (included) and line 49
1460 called my_macro with:
1461 called my_macro with:
1461
1462
1462 In [51]: %macro my_macro 44:48 49
1463 In [51]: %macro my_macro 44:48 49
1463
1464
1464 Now, typing `my_macro` (without quotes) will re-execute all this code
1465 Now, typing `my_macro` (without quotes) will re-execute all this code
1465 in one pass.
1466 in one pass.
1466
1467
1467 You don't need to give the line-numbers in order, and any given line
1468 You don't need to give the line-numbers in order, and any given line
1468 number can appear multiple times. You can assemble macros with any
1469 number can appear multiple times. You can assemble macros with any
1469 lines from your input history in any order.
1470 lines from your input history in any order.
1470
1471
1471 The macro is a simple object which holds its value in an attribute,
1472 The macro is a simple object which holds its value in an attribute,
1472 but IPython's display system checks for macros and executes them as
1473 but IPython's display system checks for macros and executes them as
1473 code instead of printing them when you type their name.
1474 code instead of printing them when you type their name.
1474
1475
1475 You can view a macro's contents by explicitly printing it with:
1476 You can view a macro's contents by explicitly printing it with:
1476
1477
1477 'print macro_name'.
1478 'print macro_name'.
1478
1479
1479 For one-off cases which DON'T contain magic function calls in them you
1480 For one-off cases which DON'T contain magic function calls in them you
1480 can obtain similar results by explicitly executing slices from your
1481 can obtain similar results by explicitly executing slices from your
1481 input history with:
1482 input history with:
1482
1483
1483 In [60]: exec In[44:48]+In[49]"""
1484 In [60]: exec In[44:48]+In[49]"""
1484
1485
1485 args = parameter_s.split()
1486 args = parameter_s.split()
1486 name,ranges = args[0], args[1:]
1487 name,ranges = args[0], args[1:]
1487 #print 'rng',ranges # dbg
1488 #print 'rng',ranges # dbg
1488 cmds = self.extract_input_slices(ranges)
1489 cmds = self.extract_input_slices(ranges)
1489 macro = Macro(cmds)
1490 macro = Macro(cmds)
1490 self.shell.user_ns.update({name:macro})
1491 self.shell.user_ns.update({name:macro})
1491 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1492 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1492 print 'Macro contents:'
1493 print 'Macro contents:'
1493 print str(macro).rstrip(),
1494 print str(macro).rstrip(),
1494
1495
1495 def magic_save(self,parameter_s = ''):
1496 def magic_save(self,parameter_s = ''):
1496 """Save a set of lines to a given filename.
1497 """Save a set of lines to a given filename.
1497
1498
1498 Usage:\\
1499 Usage:\\
1499 %save filename n1:n2 n3:n4 ... n5 .. n6 ...
1500 %save filename n1:n2 n3:n4 ... n5 .. n6 ...
1500
1501
1501 This function uses the same syntax as %macro for line extraction, but
1502 This function uses the same syntax as %macro for line extraction, but
1502 instead of creating a macro it saves the resulting string to the
1503 instead of creating a macro it saves the resulting string to the
1503 filename you specify.
1504 filename you specify.
1504
1505
1505 It adds a '.py' extension to the file if you don't do so yourself, and
1506 It adds a '.py' extension to the file if you don't do so yourself, and
1506 it asks for confirmation before overwriting existing files."""
1507 it asks for confirmation before overwriting existing files."""
1507
1508
1508 args = parameter_s.split()
1509 args = parameter_s.split()
1509 fname,ranges = args[0], args[1:]
1510 fname,ranges = args[0], args[1:]
1510 if not fname.endswith('.py'):
1511 if not fname.endswith('.py'):
1511 fname += '.py'
1512 fname += '.py'
1512 if os.path.isfile(fname):
1513 if os.path.isfile(fname):
1513 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1514 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1514 if ans.lower() not in ['y','yes']:
1515 if ans.lower() not in ['y','yes']:
1515 print 'Operation cancelled.'
1516 print 'Operation cancelled.'
1516 return
1517 return
1517 cmds = ''.join(self.extract_input_slices(ranges))
1518 cmds = ''.join(self.extract_input_slices(ranges))
1518 f = file(fname,'w')
1519 f = file(fname,'w')
1519 f.write(cmds)
1520 f.write(cmds)
1520 f.close()
1521 f.close()
1521 print 'The following commands were written to file `%s`:' % fname
1522 print 'The following commands were written to file `%s`:' % fname
1522 print cmds
1523 print cmds
1523
1524
1524 def magic_ed(self,parameter_s = ''):
1525 def magic_ed(self,parameter_s = ''):
1525 """Alias to %edit."""
1526 """Alias to %edit."""
1526 return self.magic_edit(parameter_s)
1527 return self.magic_edit(parameter_s)
1527
1528
1528 def magic_edit(self,parameter_s = '',last_call=['','']):
1529 def magic_edit(self,parameter_s = '',last_call=['','']):
1529 """Bring up an editor and execute the resulting code.
1530 """Bring up an editor and execute the resulting code.
1530
1531
1531 Usage:
1532 Usage:
1532 %edit [options] [args]
1533 %edit [options] [args]
1533
1534
1534 %edit runs IPython's editor hook. The default version of this hook is
1535 %edit runs IPython's editor hook. The default version of this hook is
1535 set to call the __IPYTHON__.rc.editor command. This is read from your
1536 set to call the __IPYTHON__.rc.editor command. This is read from your
1536 environment variable $EDITOR. If this isn't found, it will default to
1537 environment variable $EDITOR. If this isn't found, it will default to
1537 vi under Linux/Unix and to notepad under Windows. See the end of this
1538 vi under Linux/Unix and to notepad under Windows. See the end of this
1538 docstring for how to change the editor hook.
1539 docstring for how to change the editor hook.
1539
1540
1540 You can also set the value of this editor via the command line option
1541 You can also set the value of this editor via the command line option
1541 '-editor' or in your ipythonrc file. This is useful if you wish to use
1542 '-editor' or in your ipythonrc file. This is useful if you wish to use
1542 specifically for IPython an editor different from your typical default
1543 specifically for IPython an editor different from your typical default
1543 (and for Windows users who typically don't set environment variables).
1544 (and for Windows users who typically don't set environment variables).
1544
1545
1545 This command allows you to conveniently edit multi-line code right in
1546 This command allows you to conveniently edit multi-line code right in
1546 your IPython session.
1547 your IPython session.
1547
1548
1548 If called without arguments, %edit opens up an empty editor with a
1549 If called without arguments, %edit opens up an empty editor with a
1549 temporary file and will execute the contents of this file when you
1550 temporary file and will execute the contents of this file when you
1550 close it (don't forget to save it!).
1551 close it (don't forget to save it!).
1551
1552
1552 Options:
1553 Options:
1553
1554
1554 -p: this will call the editor with the same data as the previous time
1555 -p: this will call the editor with the same data as the previous time
1555 it was used, regardless of how long ago (in your current session) it
1556 it was used, regardless of how long ago (in your current session) it
1556 was.
1557 was.
1557
1558
1558 -x: do not execute the edited code immediately upon exit. This is
1559 -x: do not execute the edited code immediately upon exit. This is
1559 mainly useful if you are editing programs which need to be called with
1560 mainly useful if you are editing programs which need to be called with
1560 command line arguments, which you can then do using %run.
1561 command line arguments, which you can then do using %run.
1561
1562
1562 Arguments:
1563 Arguments:
1563
1564
1564 If arguments are given, the following possibilites exist:
1565 If arguments are given, the following possibilites exist:
1565
1566
1566 - The arguments are numbers or pairs of colon-separated numbers (like
1567 - The arguments are numbers or pairs of colon-separated numbers (like
1567 1 4:8 9). These are interpreted as lines of previous input to be
1568 1 4:8 9). These are interpreted as lines of previous input to be
1568 loaded into the editor. The syntax is the same of the %macro command.
1569 loaded into the editor. The syntax is the same of the %macro command.
1569
1570
1570 - If the argument doesn't start with a number, it is evaluated as a
1571 - If the argument doesn't start with a number, it is evaluated as a
1571 variable and its contents loaded into the editor. You can thus edit
1572 variable and its contents loaded into the editor. You can thus edit
1572 any string which contains python code (including the result of
1573 any string which contains python code (including the result of
1573 previous edits).
1574 previous edits).
1574
1575
1575 - If the argument is the name of an object (other than a string),
1576 - If the argument is the name of an object (other than a string),
1576 IPython will try to locate the file where it was defined and open the
1577 IPython will try to locate the file where it was defined and open the
1577 editor at the point where it is defined. You can use `%edit function`
1578 editor at the point where it is defined. You can use `%edit function`
1578 to load an editor exactly at the point where 'function' is defined,
1579 to load an editor exactly at the point where 'function' is defined,
1579 edit it and have the file be executed automatically.
1580 edit it and have the file be executed automatically.
1580
1581
1581 Note: opening at an exact line is only supported under Unix, and some
1582 Note: opening at an exact line is only supported under Unix, and some
1582 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1583 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1583 '+NUMBER' parameter necessary for this feature. Good editors like
1584 '+NUMBER' parameter necessary for this feature. Good editors like
1584 (X)Emacs, vi, jed, pico and joe all do.
1585 (X)Emacs, vi, jed, pico and joe all do.
1585
1586
1586 - If the argument is not found as a variable, IPython will look for a
1587 - If the argument is not found as a variable, IPython will look for a
1587 file with that name (adding .py if necessary) and load it into the
1588 file with that name (adding .py if necessary) and load it into the
1588 editor. It will execute its contents with execfile() when you exit,
1589 editor. It will execute its contents with execfile() when you exit,
1589 loading any code in the file into your interactive namespace.
1590 loading any code in the file into your interactive namespace.
1590
1591
1591 After executing your code, %edit will return as output the code you
1592 After executing your code, %edit will return as output the code you
1592 typed in the editor (except when it was an existing file). This way
1593 typed in the editor (except when it was an existing file). This way
1593 you can reload the code in further invocations of %edit as a variable,
1594 you can reload the code in further invocations of %edit as a variable,
1594 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1595 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1595 the output.
1596 the output.
1596
1597
1597 Note that %edit is also available through the alias %ed.
1598 Note that %edit is also available through the alias %ed.
1598
1599
1599 This is an example of creating a simple function inside the editor and
1600 This is an example of creating a simple function inside the editor and
1600 then modifying it. First, start up the editor:
1601 then modifying it. First, start up the editor:
1601
1602
1602 In [1]: ed\\
1603 In [1]: ed\\
1603 Editing... done. Executing edited code...\\
1604 Editing... done. Executing edited code...\\
1604 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1605 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1605
1606
1606 We can then call the function foo():
1607 We can then call the function foo():
1607
1608
1608 In [2]: foo()\\
1609 In [2]: foo()\\
1609 foo() was defined in an editing session
1610 foo() was defined in an editing session
1610
1611
1611 Now we edit foo. IPython automatically loads the editor with the
1612 Now we edit foo. IPython automatically loads the editor with the
1612 (temporary) file where foo() was previously defined:
1613 (temporary) file where foo() was previously defined:
1613
1614
1614 In [3]: ed foo\\
1615 In [3]: ed foo\\
1615 Editing... done. Executing edited code...
1616 Editing... done. Executing edited code...
1616
1617
1617 And if we call foo() again we get the modified version:
1618 And if we call foo() again we get the modified version:
1618
1619
1619 In [4]: foo()\\
1620 In [4]: foo()\\
1620 foo() has now been changed!
1621 foo() has now been changed!
1621
1622
1622 Here is an example of how to edit a code snippet successive
1623 Here is an example of how to edit a code snippet successive
1623 times. First we call the editor:
1624 times. First we call the editor:
1624
1625
1625 In [8]: ed\\
1626 In [8]: ed\\
1626 Editing... done. Executing edited code...\\
1627 Editing... done. Executing edited code...\\
1627 hello\\
1628 hello\\
1628 Out[8]: "print 'hello'\\n"
1629 Out[8]: "print 'hello'\\n"
1629
1630
1630 Now we call it again with the previous output (stored in _):
1631 Now we call it again with the previous output (stored in _):
1631
1632
1632 In [9]: ed _\\
1633 In [9]: ed _\\
1633 Editing... done. Executing edited code...\\
1634 Editing... done. Executing edited code...\\
1634 hello world\\
1635 hello world\\
1635 Out[9]: "print 'hello world'\\n"
1636 Out[9]: "print 'hello world'\\n"
1636
1637
1637 Now we call it with the output #8 (stored in _8, also as Out[8]):
1638 Now we call it with the output #8 (stored in _8, also as Out[8]):
1638
1639
1639 In [10]: ed _8\\
1640 In [10]: ed _8\\
1640 Editing... done. Executing edited code...\\
1641 Editing... done. Executing edited code...\\
1641 hello again\\
1642 hello again\\
1642 Out[10]: "print 'hello again'\\n"
1643 Out[10]: "print 'hello again'\\n"
1643
1644
1644
1645
1645 Changing the default editor hook:
1646 Changing the default editor hook:
1646
1647
1647 If you wish to write your own editor hook, you can put it in a
1648 If you wish to write your own editor hook, you can put it in a
1648 configuration file which you load at startup time. The default hook
1649 configuration file which you load at startup time. The default hook
1649 is defined in the IPython.hooks module, and you can use that as a
1650 is defined in the IPython.hooks module, and you can use that as a
1650 starting example for further modifications. That file also has
1651 starting example for further modifications. That file also has
1651 general instructions on how to set a new hook for use once you've
1652 general instructions on how to set a new hook for use once you've
1652 defined it."""
1653 defined it."""
1653
1654
1654 # FIXME: This function has become a convoluted mess. It needs a
1655 # FIXME: This function has become a convoluted mess. It needs a
1655 # ground-up rewrite with clean, simple logic.
1656 # ground-up rewrite with clean, simple logic.
1656
1657
1657 def make_filename(arg):
1658 def make_filename(arg):
1658 "Make a filename from the given args"
1659 "Make a filename from the given args"
1659 try:
1660 try:
1660 filename = get_py_filename(arg)
1661 filename = get_py_filename(arg)
1661 except IOError:
1662 except IOError:
1662 if args.endswith('.py'):
1663 if args.endswith('.py'):
1663 filename = arg
1664 filename = arg
1664 else:
1665 else:
1665 filename = None
1666 filename = None
1666 return filename
1667 return filename
1667
1668
1668 # custom exceptions
1669 # custom exceptions
1669 class DataIsObject(Exception): pass
1670 class DataIsObject(Exception): pass
1670
1671
1671 opts,args = self.parse_options(parameter_s,'px')
1672 opts,args = self.parse_options(parameter_s,'px')
1672
1673
1673 # Default line number value
1674 # Default line number value
1674 lineno = None
1675 lineno = None
1675 if opts.has_key('p'):
1676 if opts.has_key('p'):
1676 args = '_%s' % last_call[0]
1677 args = '_%s' % last_call[0]
1677 if not self.shell.user_ns.has_key(args):
1678 if not self.shell.user_ns.has_key(args):
1678 args = last_call[1]
1679 args = last_call[1]
1679
1680
1680 # use last_call to remember the state of the previous call, but don't
1681 # use last_call to remember the state of the previous call, but don't
1681 # let it be clobbered by successive '-p' calls.
1682 # let it be clobbered by successive '-p' calls.
1682 try:
1683 try:
1683 last_call[0] = self.shell.outputcache.prompt_count
1684 last_call[0] = self.shell.outputcache.prompt_count
1684 if not opts.has_key('p'):
1685 if not opts.has_key('p'):
1685 last_call[1] = parameter_s
1686 last_call[1] = parameter_s
1686 except:
1687 except:
1687 pass
1688 pass
1688
1689
1689 # by default this is done with temp files, except when the given
1690 # by default this is done with temp files, except when the given
1690 # arg is a filename
1691 # arg is a filename
1691 use_temp = 1
1692 use_temp = 1
1692
1693
1693 if re.match(r'\d',args):
1694 if re.match(r'\d',args):
1694 # Mode where user specifies ranges of lines, like in %macro.
1695 # Mode where user specifies ranges of lines, like in %macro.
1695 # This means that you can't edit files whose names begin with
1696 # This means that you can't edit files whose names begin with
1696 # numbers this way. Tough.
1697 # numbers this way. Tough.
1697 ranges = args.split()
1698 ranges = args.split()
1698 data = ''.join(self.extract_input_slices(ranges))
1699 data = ''.join(self.extract_input_slices(ranges))
1699 elif args.endswith('.py'):
1700 elif args.endswith('.py'):
1700 filename = make_filename(args)
1701 filename = make_filename(args)
1701 data = ''
1702 data = ''
1702 use_temp = 0
1703 use_temp = 0
1703 elif args:
1704 elif args:
1704 try:
1705 try:
1705 # Load the parameter given as a variable. If not a string,
1706 # Load the parameter given as a variable. If not a string,
1706 # process it as an object instead (below)
1707 # process it as an object instead (below)
1707
1708
1708 #print '*** args',args,'type',type(args) # dbg
1709 #print '*** args',args,'type',type(args) # dbg
1709 data = eval(args,self.shell.user_ns)
1710 data = eval(args,self.shell.user_ns)
1710 if not type(data) in StringTypes:
1711 if not type(data) in StringTypes:
1711 raise DataIsObject
1712 raise DataIsObject
1712 except (NameError,SyntaxError):
1713 except (NameError,SyntaxError):
1713 # given argument is not a variable, try as a filename
1714 # given argument is not a variable, try as a filename
1714 filename = make_filename(args)
1715 filename = make_filename(args)
1715 if filename is None:
1716 if filename is None:
1716 warn("Argument given (%s) can't be found as a variable "
1717 warn("Argument given (%s) can't be found as a variable "
1717 "or as a filename." % args)
1718 "or as a filename." % args)
1718 return
1719 return
1719 data = ''
1720 data = ''
1720 use_temp = 0
1721 use_temp = 0
1721 except DataIsObject:
1722 except DataIsObject:
1722 # For objects, try to edit the file where they are defined
1723 # For objects, try to edit the file where they are defined
1723 try:
1724 try:
1724 filename = inspect.getabsfile(data)
1725 filename = inspect.getabsfile(data)
1725 datafile = 1
1726 datafile = 1
1726 except TypeError:
1727 except TypeError:
1727 filename = make_filename(args)
1728 filename = make_filename(args)
1728 datafile = 1
1729 datafile = 1
1729 warn('Could not find file where `%s` is defined.\n'
1730 warn('Could not find file where `%s` is defined.\n'
1730 'Opening a file named `%s`' % (args,filename))
1731 'Opening a file named `%s`' % (args,filename))
1731 # Now, make sure we can actually read the source (if it was in
1732 # Now, make sure we can actually read the source (if it was in
1732 # a temp file it's gone by now).
1733 # a temp file it's gone by now).
1733 if datafile:
1734 if datafile:
1734 try:
1735 try:
1735 lineno = inspect.getsourcelines(data)[1]
1736 lineno = inspect.getsourcelines(data)[1]
1736 except IOError:
1737 except IOError:
1737 filename = make_filename(args)
1738 filename = make_filename(args)
1738 if filename is None:
1739 if filename is None:
1739 warn('The file `%s` where `%s` was defined cannot '
1740 warn('The file `%s` where `%s` was defined cannot '
1740 'be read.' % (filename,data))
1741 'be read.' % (filename,data))
1741 return
1742 return
1742 use_temp = 0
1743 use_temp = 0
1743 else:
1744 else:
1744 data = ''
1745 data = ''
1745
1746
1746 if use_temp:
1747 if use_temp:
1747 filename = tempfile.mktemp('.py')
1748 filename = tempfile.mktemp('.py')
1748 self.shell.tempfiles.append(filename)
1749 self.shell.tempfiles.append(filename)
1749
1750
1750 if data and use_temp:
1751 if data and use_temp:
1751 tmp_file = open(filename,'w')
1752 tmp_file = open(filename,'w')
1752 tmp_file.write(data)
1753 tmp_file.write(data)
1753 tmp_file.close()
1754 tmp_file.close()
1754
1755
1755 # do actual editing here
1756 # do actual editing here
1756 print 'Editing...',
1757 print 'Editing...',
1757 sys.stdout.flush()
1758 sys.stdout.flush()
1758 self.shell.hooks.editor(filename,lineno)
1759 self.shell.hooks.editor(filename,lineno)
1759 if opts.has_key('x'): # -x prevents actual execution
1760 if opts.has_key('x'): # -x prevents actual execution
1760 print
1761 print
1761 else:
1762 else:
1762 print 'done. Executing edited code...'
1763 print 'done. Executing edited code...'
1763 try:
1764 try:
1764 execfile(filename,self.shell.user_ns)
1765 execfile(filename,self.shell.user_ns)
1765 except IOError,msg:
1766 except IOError,msg:
1766 if msg.filename == filename:
1767 if msg.filename == filename:
1767 warn('File not found. Did you forget to save?')
1768 warn('File not found. Did you forget to save?')
1768 return
1769 return
1769 else:
1770 else:
1770 self.shell.showtraceback()
1771 self.shell.showtraceback()
1771 except:
1772 except:
1772 self.shell.showtraceback()
1773 self.shell.showtraceback()
1773 if use_temp:
1774 if use_temp:
1774 contents = open(filename).read()
1775 contents = open(filename).read()
1775 return contents
1776 return contents
1776
1777
1777 def magic_xmode(self,parameter_s = ''):
1778 def magic_xmode(self,parameter_s = ''):
1778 """Switch modes for the exception handlers.
1779 """Switch modes for the exception handlers.
1779
1780
1780 Valid modes: Plain, Context and Verbose.
1781 Valid modes: Plain, Context and Verbose.
1781
1782
1782 If called without arguments, acts as a toggle."""
1783 If called without arguments, acts as a toggle."""
1783
1784
1784 new_mode = parameter_s.strip().capitalize()
1785 new_mode = parameter_s.strip().capitalize()
1785 try:
1786 try:
1786 self.InteractiveTB.set_mode(mode = new_mode)
1787 self.InteractiveTB.set_mode(mode = new_mode)
1787 print 'Exception reporting mode:',self.InteractiveTB.mode
1788 print 'Exception reporting mode:',self.InteractiveTB.mode
1788 except:
1789 except:
1789 warn('Error changing exception modes.\n' + str(sys.exc_info()[1]))
1790 warn('Error changing exception modes.\n' + str(sys.exc_info()[1]))
1790
1791
1791 def magic_colors(self,parameter_s = ''):
1792 def magic_colors(self,parameter_s = ''):
1792 """Switch color scheme for prompts, info system and exception handlers.
1793 """Switch color scheme for prompts, info system and exception handlers.
1793
1794
1794 Currently implemented schemes: NoColor, Linux, LightBG.
1795 Currently implemented schemes: NoColor, Linux, LightBG.
1795
1796
1796 Color scheme names are not case-sensitive."""
1797 Color scheme names are not case-sensitive."""
1797
1798
1798 new_scheme = parameter_s.strip()
1799 new_scheme = parameter_s.strip()
1799 if not new_scheme:
1800 if not new_scheme:
1800 print 'You must specify a color scheme.'
1801 print 'You must specify a color scheme.'
1801 return
1802 return
1802 # Under Windows, check for Gary Bishop's readline, which is necessary
1803 # Under Windows, check for Gary Bishop's readline, which is necessary
1803 # for ANSI coloring
1804 # for ANSI coloring
1804 if os.name in ['nt','dos']:
1805 if os.name in ['nt','dos']:
1805 try:
1806 try:
1806 import readline
1807 import readline
1807 except ImportError:
1808 except ImportError:
1808 has_readline = 0
1809 has_readline = 0
1809 else:
1810 else:
1810 try:
1811 try:
1811 readline.GetOutputFile()
1812 readline.GetOutputFile()
1812 except AttributeError:
1813 except AttributeError:
1813 has_readline = 0
1814 has_readline = 0
1814 else:
1815 else:
1815 has_readline = 1
1816 has_readline = 1
1816 if not has_readline:
1817 if not has_readline:
1817 msg = """\
1818 msg = """\
1818 Proper color support under MS Windows requires Gary Bishop's readline library.
1819 Proper color support under MS Windows requires Gary Bishop's readline library.
1819 You can find it at:
1820 You can find it at:
1820 http://sourceforge.net/projects/uncpythontools
1821 http://sourceforge.net/projects/uncpythontools
1821 Gary's readline needs the ctypes module, from:
1822 Gary's readline needs the ctypes module, from:
1822 http://starship.python.net/crew/theller/ctypes
1823 http://starship.python.net/crew/theller/ctypes
1823
1824
1824 Defaulting color scheme to 'NoColor'"""
1825 Defaulting color scheme to 'NoColor'"""
1825 new_scheme = 'NoColor'
1826 new_scheme = 'NoColor'
1826 warn(msg)
1827 warn(msg)
1827
1828
1828 # Set prompt colors
1829 # Set prompt colors
1829 try:
1830 try:
1830 self.shell.outputcache.set_colors(new_scheme)
1831 self.shell.outputcache.set_colors(new_scheme)
1831 except:
1832 except:
1832 warn('Error changing prompt color schemes.\n'
1833 warn('Error changing prompt color schemes.\n'
1833 + str(sys.exc_info()[1]))
1834 + str(sys.exc_info()[1]))
1834 else:
1835 else:
1835 self.shell.rc.colors = \
1836 self.shell.rc.colors = \
1836 self.shell.outputcache.color_table.active_scheme_name
1837 self.shell.outputcache.color_table.active_scheme_name
1837 # Set exception colors
1838 # Set exception colors
1838 try:
1839 try:
1839 self.shell.InteractiveTB.set_colors(scheme = new_scheme)
1840 self.shell.InteractiveTB.set_colors(scheme = new_scheme)
1840 self.shell.SyntaxTB.set_colors(scheme = new_scheme)
1841 self.shell.SyntaxTB.set_colors(scheme = new_scheme)
1841 except:
1842 except:
1842 warn('Error changing exception color schemes.\n'
1843 warn('Error changing exception color schemes.\n'
1843 + str(sys.exc_info()[1]))
1844 + str(sys.exc_info()[1]))
1844 # Set info (for 'object?') colors
1845 # Set info (for 'object?') colors
1845 if self.shell.rc.color_info:
1846 if self.shell.rc.color_info:
1846 try:
1847 try:
1847 self.shell.inspector.set_active_scheme(new_scheme)
1848 self.shell.inspector.set_active_scheme(new_scheme)
1848 except:
1849 except:
1849 warn('Error changing object inspector color schemes.\n'
1850 warn('Error changing object inspector color schemes.\n'
1850 + str(sys.exc_info()[1]))
1851 + str(sys.exc_info()[1]))
1851 else:
1852 else:
1852 self.shell.inspector.set_active_scheme('NoColor')
1853 self.shell.inspector.set_active_scheme('NoColor')
1853
1854
1854 def magic_color_info(self,parameter_s = ''):
1855 def magic_color_info(self,parameter_s = ''):
1855 """Toggle color_info.
1856 """Toggle color_info.
1856
1857
1857 The color_info configuration parameter controls whether colors are
1858 The color_info configuration parameter controls whether colors are
1858 used for displaying object details (by things like %psource, %pfile or
1859 used for displaying object details (by things like %psource, %pfile or
1859 the '?' system). This function toggles this value with each call.
1860 the '?' system). This function toggles this value with each call.
1860
1861
1861 Note that unless you have a fairly recent pager (less works better
1862 Note that unless you have a fairly recent pager (less works better
1862 than more) in your system, using colored object information displays
1863 than more) in your system, using colored object information displays
1863 will not work properly. Test it and see."""
1864 will not work properly. Test it and see."""
1864
1865
1865 self.shell.rc.color_info = 1 - self.shell.rc.color_info
1866 self.shell.rc.color_info = 1 - self.shell.rc.color_info
1866 self.magic_colors(self.shell.rc.colors)
1867 self.magic_colors(self.shell.rc.colors)
1867 print 'Object introspection functions have now coloring:',
1868 print 'Object introspection functions have now coloring:',
1868 print ['OFF','ON'][self.shell.rc.color_info]
1869 print ['OFF','ON'][self.shell.rc.color_info]
1869
1870
1870 def magic_Pprint(self, parameter_s=''):
1871 def magic_Pprint(self, parameter_s=''):
1871 """Toggle pretty printing on/off."""
1872 """Toggle pretty printing on/off."""
1872
1873
1873 self.shell.outputcache.Pprint = 1 - self.shell.outputcache.Pprint
1874 self.shell.outputcache.Pprint = 1 - self.shell.outputcache.Pprint
1874 print 'Pretty printing has been turned', \
1875 print 'Pretty printing has been turned', \
1875 ['OFF','ON'][self.shell.outputcache.Pprint]
1876 ['OFF','ON'][self.shell.outputcache.Pprint]
1876
1877
1877 def magic_Exit(self, parameter_s=''):
1878 def magic_Exit(self, parameter_s=''):
1878 """Exit IPython without confirmation."""
1879 """Exit IPython without confirmation."""
1879
1880
1880 self.shell.exit_now = True
1881 self.shell.exit_now = True
1881
1882
1882 def magic_Quit(self, parameter_s=''):
1883 def magic_Quit(self, parameter_s=''):
1883 """Exit IPython without confirmation (like %Exit)."""
1884 """Exit IPython without confirmation (like %Exit)."""
1884
1885
1885 self.shell.exit_now = True
1886 self.shell.exit_now = True
1886
1887
1887 #......................................................................
1888 #......................................................................
1888 # Functions to implement unix shell-type things
1889 # Functions to implement unix shell-type things
1889
1890
1890 def magic_alias(self, parameter_s = ''):
1891 def magic_alias(self, parameter_s = ''):
1891 """Define an alias for a system command.
1892 """Define an alias for a system command.
1892
1893
1893 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
1894 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
1894
1895
1895 Then, typing 'alias_name params' will execute the system command 'cmd
1896 Then, typing 'alias_name params' will execute the system command 'cmd
1896 params' (from your underlying operating system).
1897 params' (from your underlying operating system).
1897
1898
1898 Aliases have lower precedence than magic functions and Python normal
1899 Aliases have lower precedence than magic functions and Python normal
1899 variables, so if 'foo' is both a Python variable and an alias, the
1900 variables, so if 'foo' is both a Python variable and an alias, the
1900 alias can not be executed until 'del foo' removes the Python variable.
1901 alias can not be executed until 'del foo' removes the Python variable.
1901
1902
1902 You can use the %l specifier in an alias definition to represent the
1903 You can use the %l specifier in an alias definition to represent the
1903 whole line when the alias is called. For example:
1904 whole line when the alias is called. For example:
1904
1905
1905 In [2]: alias all echo "Input in brackets: <%l>"\\
1906 In [2]: alias all echo "Input in brackets: <%l>"\\
1906 In [3]: all hello world\\
1907 In [3]: all hello world\\
1907 Input in brackets: <hello world>
1908 Input in brackets: <hello world>
1908
1909
1909 You can also define aliases with parameters using %s specifiers (one
1910 You can also define aliases with parameters using %s specifiers (one
1910 per parameter):
1911 per parameter):
1911
1912
1912 In [1]: alias parts echo first %s second %s\\
1913 In [1]: alias parts echo first %s second %s\\
1913 In [2]: %parts A B\\
1914 In [2]: %parts A B\\
1914 first A second B\\
1915 first A second B\\
1915 In [3]: %parts A\\
1916 In [3]: %parts A\\
1916 Incorrect number of arguments: 2 expected.\\
1917 Incorrect number of arguments: 2 expected.\\
1917 parts is an alias to: 'echo first %s second %s'
1918 parts is an alias to: 'echo first %s second %s'
1918
1919
1919 Note that %l and %s are mutually exclusive. You can only use one or
1920 Note that %l and %s are mutually exclusive. You can only use one or
1920 the other in your aliases.
1921 the other in your aliases.
1921
1922
1922 Aliases expand Python variables just like system calls using ! or !!
1923 Aliases expand Python variables just like system calls using ! or !!
1923 do: all expressions prefixed with '$' get expanded. For details of
1924 do: all expressions prefixed with '$' get expanded. For details of
1924 the semantic rules, see PEP-215:
1925 the semantic rules, see PEP-215:
1925 http://www.python.org/peps/pep-0215.html. This is the library used by
1926 http://www.python.org/peps/pep-0215.html. This is the library used by
1926 IPython for variable expansion. If you want to access a true shell
1927 IPython for variable expansion. If you want to access a true shell
1927 variable, an extra $ is necessary to prevent its expansion by IPython:
1928 variable, an extra $ is necessary to prevent its expansion by IPython:
1928
1929
1929 In [6]: alias show echo\\
1930 In [6]: alias show echo\\
1930 In [7]: PATH='A Python string'\\
1931 In [7]: PATH='A Python string'\\
1931 In [8]: show $PATH\\
1932 In [8]: show $PATH\\
1932 A Python string\\
1933 A Python string\\
1933 In [9]: show $$PATH\\
1934 In [9]: show $$PATH\\
1934 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1935 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1935
1936
1936 You can use the alias facility to acess all of $PATH. See the %rehash
1937 You can use the alias facility to acess all of $PATH. See the %rehash
1937 and %rehashx functions, which automatically create aliases for the
1938 and %rehashx functions, which automatically create aliases for the
1938 contents of your $PATH.
1939 contents of your $PATH.
1939
1940
1940 If called with no parameters, %alias prints the current alias table."""
1941 If called with no parameters, %alias prints the current alias table."""
1941
1942
1942 par = parameter_s.strip()
1943 par = parameter_s.strip()
1943 if not par:
1944 if not par:
1944 if self.shell.rc.automagic:
1945 if self.shell.rc.automagic:
1945 prechar = ''
1946 prechar = ''
1946 else:
1947 else:
1947 prechar = self.shell.ESC_MAGIC
1948 prechar = self.shell.ESC_MAGIC
1948 print 'Alias\t\tSystem Command\n'+'-'*30
1949 print 'Alias\t\tSystem Command\n'+'-'*30
1949 atab = self.shell.alias_table
1950 atab = self.shell.alias_table
1950 aliases = atab.keys()
1951 aliases = atab.keys()
1951 aliases.sort()
1952 aliases.sort()
1952 for alias in aliases:
1953 for alias in aliases:
1953 print prechar+alias+'\t\t'+atab[alias][1]
1954 print prechar+alias+'\t\t'+atab[alias][1]
1954 print '-'*30+'\nTotal number of aliases:',len(aliases)
1955 print '-'*30+'\nTotal number of aliases:',len(aliases)
1955 return
1956 return
1956 try:
1957 try:
1957 alias,cmd = par.split(None,1)
1958 alias,cmd = par.split(None,1)
1958 except:
1959 except:
1959 print OInspect.getdoc(self.magic_alias)
1960 print OInspect.getdoc(self.magic_alias)
1960 else:
1961 else:
1961 nargs = cmd.count('%s')
1962 nargs = cmd.count('%s')
1962 if nargs>0 and cmd.find('%l')>=0:
1963 if nargs>0 and cmd.find('%l')>=0:
1963 error('The %s and %l specifiers are mutually exclusive '
1964 error('The %s and %l specifiers are mutually exclusive '
1964 'in alias definitions.')
1965 'in alias definitions.')
1965 else: # all looks OK
1966 else: # all looks OK
1966 self.shell.alias_table[alias] = (nargs,cmd)
1967 self.shell.alias_table[alias] = (nargs,cmd)
1967 self.shell.alias_table_validate(verbose=1)
1968 self.shell.alias_table_validate(verbose=1)
1968 # end magic_alias
1969 # end magic_alias
1969
1970
1970 def magic_unalias(self, parameter_s = ''):
1971 def magic_unalias(self, parameter_s = ''):
1971 """Remove an alias"""
1972 """Remove an alias"""
1972
1973
1973 aname = parameter_s.strip()
1974 aname = parameter_s.strip()
1974 if aname in self.shell.alias_table:
1975 if aname in self.shell.alias_table:
1975 del self.shell.alias_table[aname]
1976 del self.shell.alias_table[aname]
1976
1977
1977 def magic_rehash(self, parameter_s = ''):
1978 def magic_rehash(self, parameter_s = ''):
1978 """Update the alias table with all entries in $PATH.
1979 """Update the alias table with all entries in $PATH.
1979
1980
1980 This version does no checks on execute permissions or whether the
1981 This version does no checks on execute permissions or whether the
1981 contents of $PATH are truly files (instead of directories or something
1982 contents of $PATH are truly files (instead of directories or something
1982 else). For such a safer (but slower) version, use %rehashx."""
1983 else). For such a safer (but slower) version, use %rehashx."""
1983
1984
1984 # This function (and rehashx) manipulate the alias_table directly
1985 # This function (and rehashx) manipulate the alias_table directly
1985 # rather than calling magic_alias, for speed reasons. A rehash on a
1986 # rather than calling magic_alias, for speed reasons. A rehash on a
1986 # typical Linux box involves several thousand entries, so efficiency
1987 # typical Linux box involves several thousand entries, so efficiency
1987 # here is a top concern.
1988 # here is a top concern.
1988
1989
1989 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
1990 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
1990 alias_table = self.shell.alias_table
1991 alias_table = self.shell.alias_table
1991 for pdir in path:
1992 for pdir in path:
1992 for ff in os.listdir(pdir):
1993 for ff in os.listdir(pdir):
1993 # each entry in the alias table must be (N,name), where
1994 # each entry in the alias table must be (N,name), where
1994 # N is the number of positional arguments of the alias.
1995 # N is the number of positional arguments of the alias.
1995 alias_table[ff] = (0,ff)
1996 alias_table[ff] = (0,ff)
1996 # Make sure the alias table doesn't contain keywords or builtins
1997 # Make sure the alias table doesn't contain keywords or builtins
1997 self.shell.alias_table_validate()
1998 self.shell.alias_table_validate()
1998 # Call again init_auto_alias() so we get 'rm -i' and other modified
1999 # Call again init_auto_alias() so we get 'rm -i' and other modified
1999 # aliases since %rehash will probably clobber them
2000 # aliases since %rehash will probably clobber them
2000 self.shell.init_auto_alias()
2001 self.shell.init_auto_alias()
2001
2002
2002 def magic_rehashx(self, parameter_s = ''):
2003 def magic_rehashx(self, parameter_s = ''):
2003 """Update the alias table with all executable files in $PATH.
2004 """Update the alias table with all executable files in $PATH.
2004
2005
2005 This version explicitly checks that every entry in $PATH is a file
2006 This version explicitly checks that every entry in $PATH is a file
2006 with execute access (os.X_OK), so it is much slower than %rehash.
2007 with execute access (os.X_OK), so it is much slower than %rehash.
2007
2008
2008 Under Windows, it checks executability as a match agains a
2009 Under Windows, it checks executability as a match agains a
2009 '|'-separated string of extensions, stored in the IPython config
2010 '|'-separated string of extensions, stored in the IPython config
2010 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2011 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2011
2012
2012 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2013 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2013 alias_table = self.shell.alias_table
2014 alias_table = self.shell.alias_table
2014
2015
2015 if os.name == 'posix':
2016 if os.name == 'posix':
2016 isexec = lambda fname:os.path.isfile(fname) and \
2017 isexec = lambda fname:os.path.isfile(fname) and \
2017 os.access(fname,os.X_OK)
2018 os.access(fname,os.X_OK)
2018 else:
2019 else:
2019
2020
2020 try:
2021 try:
2021 winext = os.environ['pathext'].replace(';','|').replace('.','')
2022 winext = os.environ['pathext'].replace(';','|').replace('.','')
2022 except KeyError:
2023 except KeyError:
2023 winext = 'exe|com|bat'
2024 winext = 'exe|com|bat'
2024
2025
2025 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2026 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2026 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2027 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2027 savedir = os.getcwd()
2028 savedir = os.getcwd()
2028 try:
2029 try:
2029 # write the whole loop for posix/Windows so we don't have an if in
2030 # write the whole loop for posix/Windows so we don't have an if in
2030 # the innermost part
2031 # the innermost part
2031 if os.name == 'posix':
2032 if os.name == 'posix':
2032 for pdir in path:
2033 for pdir in path:
2033 os.chdir(pdir)
2034 os.chdir(pdir)
2034 for ff in os.listdir(pdir):
2035 for ff in os.listdir(pdir):
2035 if isexec(ff):
2036 if isexec(ff):
2036 # each entry in the alias table must be (N,name),
2037 # each entry in the alias table must be (N,name),
2037 # where N is the number of positional arguments of the
2038 # where N is the number of positional arguments of the
2038 # alias.
2039 # alias.
2039 alias_table[ff] = (0,ff)
2040 alias_table[ff] = (0,ff)
2040 else:
2041 else:
2041 for pdir in path:
2042 for pdir in path:
2042 os.chdir(pdir)
2043 os.chdir(pdir)
2043 for ff in os.listdir(pdir):
2044 for ff in os.listdir(pdir):
2044 if isexec(ff):
2045 if isexec(ff):
2045 alias_table[execre.sub(r'\1',ff)] = (0,ff)
2046 alias_table[execre.sub(r'\1',ff)] = (0,ff)
2046 # Make sure the alias table doesn't contain keywords or builtins
2047 # Make sure the alias table doesn't contain keywords or builtins
2047 self.shell.alias_table_validate()
2048 self.shell.alias_table_validate()
2048 # Call again init_auto_alias() so we get 'rm -i' and other
2049 # Call again init_auto_alias() so we get 'rm -i' and other
2049 # modified aliases since %rehashx will probably clobber them
2050 # modified aliases since %rehashx will probably clobber them
2050 self.shell.init_auto_alias()
2051 self.shell.init_auto_alias()
2051 finally:
2052 finally:
2052 os.chdir(savedir)
2053 os.chdir(savedir)
2053
2054
2054 def magic_pwd(self, parameter_s = ''):
2055 def magic_pwd(self, parameter_s = ''):
2055 """Return the current working directory path."""
2056 """Return the current working directory path."""
2056 return os.getcwd()
2057 return os.getcwd()
2057
2058
2058 def magic_cd(self, parameter_s=''):
2059 def magic_cd(self, parameter_s=''):
2059 """Change the current working directory.
2060 """Change the current working directory.
2060
2061
2061 This command automatically maintains an internal list of directories
2062 This command automatically maintains an internal list of directories
2062 you visit during your IPython session, in the variable _dh. The
2063 you visit during your IPython session, in the variable _dh. The
2063 command %dhist shows this history nicely formatted.
2064 command %dhist shows this history nicely formatted.
2064
2065
2065 Usage:
2066 Usage:
2066
2067
2067 cd 'dir': changes to directory 'dir'.
2068 cd 'dir': changes to directory 'dir'.
2068
2069
2069 cd -: changes to the last visited directory.
2070 cd -: changes to the last visited directory.
2070
2071
2071 cd -<n>: changes to the n-th directory in the directory history.
2072 cd -<n>: changes to the n-th directory in the directory history.
2072
2073
2073 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2074 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2074 (note: cd <bookmark_name> is enough if there is no
2075 (note: cd <bookmark_name> is enough if there is no
2075 directory <bookmark_name>, but a bookmark with the name exists.)
2076 directory <bookmark_name>, but a bookmark with the name exists.)
2076
2077
2077 Options:
2078 Options:
2078
2079
2079 -q: quiet. Do not print the working directory after the cd command is
2080 -q: quiet. Do not print the working directory after the cd command is
2080 executed. By default IPython's cd command does print this directory,
2081 executed. By default IPython's cd command does print this directory,
2081 since the default prompts do not display path information.
2082 since the default prompts do not display path information.
2082
2083
2083 Note that !cd doesn't work for this purpose because the shell where
2084 Note that !cd doesn't work for this purpose because the shell where
2084 !command runs is immediately discarded after executing 'command'."""
2085 !command runs is immediately discarded after executing 'command'."""
2085
2086
2086 parameter_s = parameter_s.strip()
2087 parameter_s = parameter_s.strip()
2087 bkms = self.shell.persist.get("bookmarks",{})
2088 bkms = self.shell.persist.get("bookmarks",{})
2088
2089
2089 numcd = re.match(r'(-)(\d+)$',parameter_s)
2090 numcd = re.match(r'(-)(\d+)$',parameter_s)
2090 # jump in directory history by number
2091 # jump in directory history by number
2091 if numcd:
2092 if numcd:
2092 nn = int(numcd.group(2))
2093 nn = int(numcd.group(2))
2093 try:
2094 try:
2094 ps = self.shell.user_ns['_dh'][nn]
2095 ps = self.shell.user_ns['_dh'][nn]
2095 except IndexError:
2096 except IndexError:
2096 print 'The requested directory does not exist in history.'
2097 print 'The requested directory does not exist in history.'
2097 return
2098 return
2098 else:
2099 else:
2099 opts = {}
2100 opts = {}
2100 else:
2101 else:
2101 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2102 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2102 # jump to previous
2103 # jump to previous
2103 if ps == '-':
2104 if ps == '-':
2104 try:
2105 try:
2105 ps = self.shell.user_ns['_dh'][-2]
2106 ps = self.shell.user_ns['_dh'][-2]
2106 except IndexError:
2107 except IndexError:
2107 print 'No previous directory to change to.'
2108 print 'No previous directory to change to.'
2108 return
2109 return
2109 # jump to bookmark
2110 # jump to bookmark
2110 elif opts.has_key('b') or (bkms.has_key(ps) and not os.path.isdir(ps)):
2111 elif opts.has_key('b') or (bkms.has_key(ps) and not os.path.isdir(ps)):
2111 if bkms.has_key(ps):
2112 if bkms.has_key(ps):
2112 target = bkms[ps]
2113 target = bkms[ps]
2113 print '(bookmark:%s) -> %s' % (ps,target)
2114 print '(bookmark:%s) -> %s' % (ps,target)
2114 ps = target
2115 ps = target
2115 else:
2116 else:
2116 if bkms:
2117 if bkms:
2117 error("Bookmark '%s' not found. "
2118 error("Bookmark '%s' not found. "
2118 "Use '%bookmark -l' to see your bookmarks." % ps)
2119 "Use '%bookmark -l' to see your bookmarks." % ps)
2119 else:
2120 else:
2120 print "Bookmarks not set - use %bookmark <bookmarkname>"
2121 print "Bookmarks not set - use %bookmark <bookmarkname>"
2121 return
2122 return
2122
2123
2123 # at this point ps should point to the target dir
2124 # at this point ps should point to the target dir
2124 if ps:
2125 if ps:
2125 try:
2126 try:
2126 os.chdir(os.path.expanduser(ps))
2127 os.chdir(os.path.expanduser(ps))
2127 except OSError:
2128 except OSError:
2128 print sys.exc_info()[1]
2129 print sys.exc_info()[1]
2129 else:
2130 else:
2130 self.shell.user_ns['_dh'].append(os.getcwd())
2131 self.shell.user_ns['_dh'].append(os.getcwd())
2131 else:
2132 else:
2132 os.chdir(self.home_dir)
2133 os.chdir(self.home_dir)
2133 self.shell.user_ns['_dh'].append(os.getcwd())
2134 self.shell.user_ns['_dh'].append(os.getcwd())
2134 if not 'q' in opts:
2135 if not 'q' in opts:
2135 print self.shell.user_ns['_dh'][-1]
2136 print self.shell.user_ns['_dh'][-1]
2136
2137
2137 def magic_dhist(self, parameter_s=''):
2138 def magic_dhist(self, parameter_s=''):
2138 """Print your history of visited directories.
2139 """Print your history of visited directories.
2139
2140
2140 %dhist -> print full history\\
2141 %dhist -> print full history\\
2141 %dhist n -> print last n entries only\\
2142 %dhist n -> print last n entries only\\
2142 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2143 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2143
2144
2144 This history is automatically maintained by the %cd command, and
2145 This history is automatically maintained by the %cd command, and
2145 always available as the global list variable _dh. You can use %cd -<n>
2146 always available as the global list variable _dh. You can use %cd -<n>
2146 to go to directory number <n>."""
2147 to go to directory number <n>."""
2147
2148
2148 dh = self.shell.user_ns['_dh']
2149 dh = self.shell.user_ns['_dh']
2149 if parameter_s:
2150 if parameter_s:
2150 try:
2151 try:
2151 args = map(int,parameter_s.split())
2152 args = map(int,parameter_s.split())
2152 except:
2153 except:
2153 self.arg_err(Magic.magic_dhist)
2154 self.arg_err(Magic.magic_dhist)
2154 return
2155 return
2155 if len(args) == 1:
2156 if len(args) == 1:
2156 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2157 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2157 elif len(args) == 2:
2158 elif len(args) == 2:
2158 ini,fin = args
2159 ini,fin = args
2159 else:
2160 else:
2160 self.arg_err(Magic.magic_dhist)
2161 self.arg_err(Magic.magic_dhist)
2161 return
2162 return
2162 else:
2163 else:
2163 ini,fin = 0,len(dh)
2164 ini,fin = 0,len(dh)
2164 nlprint(dh,
2165 nlprint(dh,
2165 header = 'Directory history (kept in _dh)',
2166 header = 'Directory history (kept in _dh)',
2166 start=ini,stop=fin)
2167 start=ini,stop=fin)
2167
2168
2168 def magic_env(self, parameter_s=''):
2169 def magic_env(self, parameter_s=''):
2169 """List environment variables."""
2170 """List environment variables."""
2170
2171
2171 # environ is an instance of UserDict
2172 # environ is an instance of UserDict
2172 return os.environ.data
2173 return os.environ.data
2173
2174
2174 def magic_pushd(self, parameter_s=''):
2175 def magic_pushd(self, parameter_s=''):
2175 """Place the current dir on stack and change directory.
2176 """Place the current dir on stack and change directory.
2176
2177
2177 Usage:\\
2178 Usage:\\
2178 %pushd ['dirname']
2179 %pushd ['dirname']
2179
2180
2180 %pushd with no arguments does a %pushd to your home directory.
2181 %pushd with no arguments does a %pushd to your home directory.
2181 """
2182 """
2182 if parameter_s == '': parameter_s = '~'
2183 if parameter_s == '': parameter_s = '~'
2183 if len(self.dir_stack)>0 and os.path.expanduser(parameter_s) != \
2184 if len(self.dir_stack)>0 and os.path.expanduser(parameter_s) != \
2184 os.path.expanduser(self.dir_stack[0]):
2185 os.path.expanduser(self.dir_stack[0]):
2185 try:
2186 try:
2186 self.magic_cd(parameter_s)
2187 self.magic_cd(parameter_s)
2187 self.dir_stack.insert(0,os.getcwd().replace(self.home_dir,'~'))
2188 self.dir_stack.insert(0,os.getcwd().replace(self.home_dir,'~'))
2188 self.magic_dirs()
2189 self.magic_dirs()
2189 except:
2190 except:
2190 print 'Invalid directory'
2191 print 'Invalid directory'
2191 else:
2192 else:
2192 print 'You are already there!'
2193 print 'You are already there!'
2193
2194
2194 def magic_popd(self, parameter_s=''):
2195 def magic_popd(self, parameter_s=''):
2195 """Change to directory popped off the top of the stack.
2196 """Change to directory popped off the top of the stack.
2196 """
2197 """
2197 if len (self.dir_stack) > 1:
2198 if len (self.dir_stack) > 1:
2198 self.dir_stack.pop(0)
2199 self.dir_stack.pop(0)
2199 self.magic_cd(self.dir_stack[0])
2200 self.magic_cd(self.dir_stack[0])
2200 print self.dir_stack[0]
2201 print self.dir_stack[0]
2201 else:
2202 else:
2202 print "You can't remove the starting directory from the stack:",\
2203 print "You can't remove the starting directory from the stack:",\
2203 self.dir_stack
2204 self.dir_stack
2204
2205
2205 def magic_dirs(self, parameter_s=''):
2206 def magic_dirs(self, parameter_s=''):
2206 """Return the current directory stack."""
2207 """Return the current directory stack."""
2207
2208
2208 return self.dir_stack[:]
2209 return self.dir_stack[:]
2209
2210
2210 def magic_sc(self, parameter_s=''):
2211 def magic_sc(self, parameter_s=''):
2211 """Shell capture - execute a shell command and capture its output.
2212 """Shell capture - execute a shell command and capture its output.
2212
2213
2213 %sc [options] varname=command
2214 %sc [options] varname=command
2214
2215
2215 IPython will run the given command using commands.getoutput(), and
2216 IPython will run the given command using commands.getoutput(), and
2216 will then update the user's interactive namespace with a variable
2217 will then update the user's interactive namespace with a variable
2217 called varname, containing the value of the call. Your command can
2218 called varname, containing the value of the call. Your command can
2218 contain shell wildcards, pipes, etc.
2219 contain shell wildcards, pipes, etc.
2219
2220
2220 The '=' sign in the syntax is mandatory, and the variable name you
2221 The '=' sign in the syntax is mandatory, and the variable name you
2221 supply must follow Python's standard conventions for valid names.
2222 supply must follow Python's standard conventions for valid names.
2222
2223
2223 Options:
2224 Options:
2224
2225
2225 -l: list output. Split the output on newlines into a list before
2226 -l: list output. Split the output on newlines into a list before
2226 assigning it to the given variable. By default the output is stored
2227 assigning it to the given variable. By default the output is stored
2227 as a single string.
2228 as a single string.
2228
2229
2229 -v: verbose. Print the contents of the variable.
2230 -v: verbose. Print the contents of the variable.
2230
2231
2231 In most cases you should not need to split as a list, because the
2232 In most cases you should not need to split as a list, because the
2232 returned value is a special type of string which can automatically
2233 returned value is a special type of string which can automatically
2233 provide its contents either as a list (split on newlines) or as a
2234 provide its contents either as a list (split on newlines) or as a
2234 space-separated string. These are convenient, respectively, either
2235 space-separated string. These are convenient, respectively, either
2235 for sequential processing or to be passed to a shell command.
2236 for sequential processing or to be passed to a shell command.
2236
2237
2237 For example:
2238 For example:
2238
2239
2239 # Capture into variable a
2240 # Capture into variable a
2240 In [9]: sc a=ls *py
2241 In [9]: sc a=ls *py
2241
2242
2242 # a is a string with embedded newlines
2243 # a is a string with embedded newlines
2243 In [10]: a
2244 In [10]: a
2244 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2245 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2245
2246
2246 # which can be seen as a list:
2247 # which can be seen as a list:
2247 In [11]: a.l
2248 In [11]: a.l
2248 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2249 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2249
2250
2250 # or as a whitespace-separated string:
2251 # or as a whitespace-separated string:
2251 In [12]: a.s
2252 In [12]: a.s
2252 Out[12]: 'setup.py win32_manual_post_install.py'
2253 Out[12]: 'setup.py win32_manual_post_install.py'
2253
2254
2254 # a.s is useful to pass as a single command line:
2255 # a.s is useful to pass as a single command line:
2255 In [13]: !wc -l $a.s
2256 In [13]: !wc -l $a.s
2256 146 setup.py
2257 146 setup.py
2257 130 win32_manual_post_install.py
2258 130 win32_manual_post_install.py
2258 276 total
2259 276 total
2259
2260
2260 # while the list form is useful to loop over:
2261 # while the list form is useful to loop over:
2261 In [14]: for f in a.l:
2262 In [14]: for f in a.l:
2262 ....: !wc -l $f
2263 ....: !wc -l $f
2263 ....:
2264 ....:
2264 146 setup.py
2265 146 setup.py
2265 130 win32_manual_post_install.py
2266 130 win32_manual_post_install.py
2266
2267
2267 Similiarly, the lists returned by the -l option are also special, in
2268 Similiarly, the lists returned by the -l option are also special, in
2268 the sense that you can equally invoke the .s attribute on them to
2269 the sense that you can equally invoke the .s attribute on them to
2269 automatically get a whitespace-separated string from their contents:
2270 automatically get a whitespace-separated string from their contents:
2270
2271
2271 In [1]: sc -l b=ls *py
2272 In [1]: sc -l b=ls *py
2272
2273
2273 In [2]: b
2274 In [2]: b
2274 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2275 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2275
2276
2276 In [3]: b.s
2277 In [3]: b.s
2277 Out[3]: 'setup.py win32_manual_post_install.py'
2278 Out[3]: 'setup.py win32_manual_post_install.py'
2278
2279
2279 In summary, both the lists and strings used for ouptut capture have
2280 In summary, both the lists and strings used for ouptut capture have
2280 the following special attributes:
2281 the following special attributes:
2281
2282
2282 .l (or .list) : value as list.
2283 .l (or .list) : value as list.
2283 .n (or .nlstr): value as newline-separated string.
2284 .n (or .nlstr): value as newline-separated string.
2284 .s (or .spstr): value as space-separated string.
2285 .s (or .spstr): value as space-separated string.
2285 """
2286 """
2286
2287
2287 opts,args = self.parse_options(parameter_s,'lv')
2288 opts,args = self.parse_options(parameter_s,'lv')
2288 # Try to get a variable name and command to run
2289 # Try to get a variable name and command to run
2289 try:
2290 try:
2290 # the variable name must be obtained from the parse_options
2291 # the variable name must be obtained from the parse_options
2291 # output, which uses shlex.split to strip options out.
2292 # output, which uses shlex.split to strip options out.
2292 var,_ = args.split('=',1)
2293 var,_ = args.split('=',1)
2293 var = var.strip()
2294 var = var.strip()
2294 # But the the command has to be extracted from the original input
2295 # But the the command has to be extracted from the original input
2295 # parameter_s, not on what parse_options returns, to avoid the
2296 # parameter_s, not on what parse_options returns, to avoid the
2296 # quote stripping which shlex.split performs on it.
2297 # quote stripping which shlex.split performs on it.
2297 _,cmd = parameter_s.split('=',1)
2298 _,cmd = parameter_s.split('=',1)
2298 except ValueError:
2299 except ValueError:
2299 var,cmd = '',''
2300 var,cmd = '',''
2300 if not var:
2301 if not var:
2301 error('you must specify a variable to assign the command to.')
2302 error('you must specify a variable to assign the command to.')
2302 return
2303 return
2303 # If all looks ok, proceed
2304 # If all looks ok, proceed
2304 out,err = self.shell.getoutputerror(cmd)
2305 out,err = self.shell.getoutputerror(cmd)
2305 if err:
2306 if err:
2306 print >> Term.cerr,err
2307 print >> Term.cerr,err
2307 if opts.has_key('l'):
2308 if opts.has_key('l'):
2308 out = SList(out.split('\n'))
2309 out = SList(out.split('\n'))
2309 else:
2310 else:
2310 out = LSString(out)
2311 out = LSString(out)
2311 if opts.has_key('v'):
2312 if opts.has_key('v'):
2312 print '%s ==\n%s' % (var,pformat(out))
2313 print '%s ==\n%s' % (var,pformat(out))
2313 self.shell.user_ns.update({var:out})
2314 self.shell.user_ns.update({var:out})
2314
2315
2315 def magic_sx(self, parameter_s=''):
2316 def magic_sx(self, parameter_s=''):
2316 """Shell execute - run a shell command and capture its output.
2317 """Shell execute - run a shell command and capture its output.
2317
2318
2318 %sx command
2319 %sx command
2319
2320
2320 IPython will run the given command using commands.getoutput(), and
2321 IPython will run the given command using commands.getoutput(), and
2321 return the result formatted as a list (split on '\\n'). Since the
2322 return the result formatted as a list (split on '\\n'). Since the
2322 output is _returned_, it will be stored in ipython's regular output
2323 output is _returned_, it will be stored in ipython's regular output
2323 cache Out[N] and in the '_N' automatic variables.
2324 cache Out[N] and in the '_N' automatic variables.
2324
2325
2325 Notes:
2326 Notes:
2326
2327
2327 1) If an input line begins with '!!', then %sx is automatically
2328 1) If an input line begins with '!!', then %sx is automatically
2328 invoked. That is, while:
2329 invoked. That is, while:
2329 !ls
2330 !ls
2330 causes ipython to simply issue system('ls'), typing
2331 causes ipython to simply issue system('ls'), typing
2331 !!ls
2332 !!ls
2332 is a shorthand equivalent to:
2333 is a shorthand equivalent to:
2333 %sx ls
2334 %sx ls
2334
2335
2335 2) %sx differs from %sc in that %sx automatically splits into a list,
2336 2) %sx differs from %sc in that %sx automatically splits into a list,
2336 like '%sc -l'. The reason for this is to make it as easy as possible
2337 like '%sc -l'. The reason for this is to make it as easy as possible
2337 to process line-oriented shell output via further python commands.
2338 to process line-oriented shell output via further python commands.
2338 %sc is meant to provide much finer control, but requires more
2339 %sc is meant to provide much finer control, but requires more
2339 typing.
2340 typing.
2340
2341
2341 3) Just like %sc -l, this is a list with special attributes:
2342 3) Just like %sc -l, this is a list with special attributes:
2342
2343
2343 .l (or .list) : value as list.
2344 .l (or .list) : value as list.
2344 .n (or .nlstr): value as newline-separated string.
2345 .n (or .nlstr): value as newline-separated string.
2345 .s (or .spstr): value as whitespace-separated string.
2346 .s (or .spstr): value as whitespace-separated string.
2346
2347
2347 This is very useful when trying to use such lists as arguments to
2348 This is very useful when trying to use such lists as arguments to
2348 system commands."""
2349 system commands."""
2349
2350
2350 if parameter_s:
2351 if parameter_s:
2351 out,err = self.shell.getoutputerror(parameter_s)
2352 out,err = self.shell.getoutputerror(parameter_s)
2352 if err:
2353 if err:
2353 print >> Term.cerr,err
2354 print >> Term.cerr,err
2354 return SList(out.split('\n'))
2355 return SList(out.split('\n'))
2355
2356
2356 def magic_bg(self, parameter_s=''):
2357 def magic_bg(self, parameter_s=''):
2357 """Run a job in the background, in a separate thread.
2358 """Run a job in the background, in a separate thread.
2358
2359
2359 For example,
2360 For example,
2360
2361
2361 %bg myfunc(x,y,z=1)
2362 %bg myfunc(x,y,z=1)
2362
2363
2363 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2364 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2364 execution starts, a message will be printed indicating the job
2365 execution starts, a message will be printed indicating the job
2365 number. If your job number is 5, you can use
2366 number. If your job number is 5, you can use
2366
2367
2367 myvar = jobs.result(5) or myvar = jobs[5].result
2368 myvar = jobs.result(5) or myvar = jobs[5].result
2368
2369
2369 to assign this result to variable 'myvar'.
2370 to assign this result to variable 'myvar'.
2370
2371
2371 IPython has a job manager, accessible via the 'jobs' object. You can
2372 IPython has a job manager, accessible via the 'jobs' object. You can
2372 type jobs? to get more information about it, and use jobs.<TAB> to see
2373 type jobs? to get more information about it, and use jobs.<TAB> to see
2373 its attributes. All attributes not starting with an underscore are
2374 its attributes. All attributes not starting with an underscore are
2374 meant for public use.
2375 meant for public use.
2375
2376
2376 In particular, look at the jobs.new() method, which is used to create
2377 In particular, look at the jobs.new() method, which is used to create
2377 new jobs. This magic %bg function is just a convenience wrapper
2378 new jobs. This magic %bg function is just a convenience wrapper
2378 around jobs.new(), for expression-based jobs. If you want to create a
2379 around jobs.new(), for expression-based jobs. If you want to create a
2379 new job with an explicit function object and arguments, you must call
2380 new job with an explicit function object and arguments, you must call
2380 jobs.new() directly.
2381 jobs.new() directly.
2381
2382
2382 The jobs.new docstring also describes in detail several important
2383 The jobs.new docstring also describes in detail several important
2383 caveats associated with a thread-based model for background job
2384 caveats associated with a thread-based model for background job
2384 execution. Type jobs.new? for details.
2385 execution. Type jobs.new? for details.
2385
2386
2386 You can check the status of all jobs with jobs.status().
2387 You can check the status of all jobs with jobs.status().
2387
2388
2388 The jobs variable is set by IPython into the Python builtin namespace.
2389 The jobs variable is set by IPython into the Python builtin namespace.
2389 If you ever declare a variable named 'jobs', you will shadow this
2390 If you ever declare a variable named 'jobs', you will shadow this
2390 name. You can either delete your global jobs variable to regain
2391 name. You can either delete your global jobs variable to regain
2391 access to the job manager, or make a new name and assign it manually
2392 access to the job manager, or make a new name and assign it manually
2392 to the manager (stored in IPython's namespace). For example, to
2393 to the manager (stored in IPython's namespace). For example, to
2393 assign the job manager to the Jobs name, use:
2394 assign the job manager to the Jobs name, use:
2394
2395
2395 Jobs = __builtins__.jobs"""
2396 Jobs = __builtins__.jobs"""
2396
2397
2397 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2398 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2398
2399
2399 def magic_bookmark(self, parameter_s=''):
2400 def magic_bookmark(self, parameter_s=''):
2400 """Manage IPython's bookmark system.
2401 """Manage IPython's bookmark system.
2401
2402
2402 %bookmark <name> - set bookmark to current dir
2403 %bookmark <name> - set bookmark to current dir
2403 %bookmark <name> <dir> - set bookmark to <dir>
2404 %bookmark <name> <dir> - set bookmark to <dir>
2404 %bookmark -l - list all bookmarks
2405 %bookmark -l - list all bookmarks
2405 %bookmark -d <name> - remove bookmark
2406 %bookmark -d <name> - remove bookmark
2406 %bookmark -r - remove all bookmarks
2407 %bookmark -r - remove all bookmarks
2407
2408
2408 You can later on access a bookmarked folder with:
2409 You can later on access a bookmarked folder with:
2409 %cd -b <name>
2410 %cd -b <name>
2410 or simply '%cd <name>' if there is no directory called <name> AND
2411 or simply '%cd <name>' if there is no directory called <name> AND
2411 there is such a bookmark defined.
2412 there is such a bookmark defined.
2412
2413
2413 Your bookmarks persist through IPython sessions, but they are
2414 Your bookmarks persist through IPython sessions, but they are
2414 associated with each profile."""
2415 associated with each profile."""
2415
2416
2416 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2417 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2417 if len(args) > 2:
2418 if len(args) > 2:
2418 error('You can only give at most two arguments')
2419 error('You can only give at most two arguments')
2419 return
2420 return
2420
2421
2421 bkms = self.shell.persist.get('bookmarks',{})
2422 bkms = self.shell.persist.get('bookmarks',{})
2422
2423
2423 if opts.has_key('d'):
2424 if opts.has_key('d'):
2424 try:
2425 try:
2425 todel = args[0]
2426 todel = args[0]
2426 except IndexError:
2427 except IndexError:
2427 error('You must provide a bookmark to delete')
2428 error('You must provide a bookmark to delete')
2428 else:
2429 else:
2429 try:
2430 try:
2430 del bkms[todel]
2431 del bkms[todel]
2431 except:
2432 except:
2432 error("Can't delete bookmark '%s'" % todel)
2433 error("Can't delete bookmark '%s'" % todel)
2433 elif opts.has_key('r'):
2434 elif opts.has_key('r'):
2434 bkms = {}
2435 bkms = {}
2435 elif opts.has_key('l'):
2436 elif opts.has_key('l'):
2436 bks = bkms.keys()
2437 bks = bkms.keys()
2437 bks.sort()
2438 bks.sort()
2438 if bks:
2439 if bks:
2439 size = max(map(len,bks))
2440 size = max(map(len,bks))
2440 else:
2441 else:
2441 size = 0
2442 size = 0
2442 fmt = '%-'+str(size)+'s -> %s'
2443 fmt = '%-'+str(size)+'s -> %s'
2443 print 'Current bookmarks:'
2444 print 'Current bookmarks:'
2444 for bk in bks:
2445 for bk in bks:
2445 print fmt % (bk,bkms[bk])
2446 print fmt % (bk,bkms[bk])
2446 else:
2447 else:
2447 if not args:
2448 if not args:
2448 error("You must specify the bookmark name")
2449 error("You must specify the bookmark name")
2449 elif len(args)==1:
2450 elif len(args)==1:
2450 bkms[args[0]] = os.getcwd()
2451 bkms[args[0]] = os.getcwd()
2451 elif len(args)==2:
2452 elif len(args)==2:
2452 bkms[args[0]] = args[1]
2453 bkms[args[0]] = args[1]
2453 self.persist['bookmarks'] = bkms
2454 self.persist['bookmarks'] = bkms
2455
2456 def magic_pycat(self, parameter_s=''):
2457 """Show a syntax-highlighted file through a pager.
2458
2459 This magic is similar to the cat utility, but it will assume the file
2460 to be Python source and will show it with syntax highlighting. """
2461
2462 try:
2463 filename = get_py_filename(parameter_s)
2464 except IndexError:
2465 warn('you must provide at least a filename.')
2466 fobj=open(filename,'r')
2467 source = fobj.read()
2468 fobj.close()
2469 colorize = Parser().format
2470 colorized_src = colorize(source,'str',self.shell.rc['colors'])
2471 page(colorized_src,screen_lines=self.shell.rc.screen_length)
2472
2454 # end Magic
2473 # end Magic
@@ -1,4391 +1,4396 b''
1 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
4 syntax-highlighted python sources, requested by John.
5
1 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
6 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2
7
3 * IPython/demo.py (Demo.again): fix bug where again() blocks after
8 * IPython/demo.py (Demo.again): fix bug where again() blocks after
4 finishing.
9 finishing.
5
10
6 * IPython/genutils.py (shlex_split): moved from Magic to here,
11 * IPython/genutils.py (shlex_split): moved from Magic to here,
7 where all 2.2 compatibility stuff lives. I needed it for demo.py.
12 where all 2.2 compatibility stuff lives. I needed it for demo.py.
8
13
9 * IPython/demo.py (Demo.__init__): added support for silent
14 * IPython/demo.py (Demo.__init__): added support for silent
10 blocks, improved marks as regexps, docstrings written.
15 blocks, improved marks as regexps, docstrings written.
11 (Demo.__init__): better docstring, added support for sys.argv.
16 (Demo.__init__): better docstring, added support for sys.argv.
12
17
13 * IPython/genutils.py (marquee): little utility used by the demo
18 * IPython/genutils.py (marquee): little utility used by the demo
14 code, handy in general.
19 code, handy in general.
15
20
16 * IPython/demo.py (Demo.__init__): new class for interactive
21 * IPython/demo.py (Demo.__init__): new class for interactive
17 demos. Not documented yet, I just wrote it in a hurry for
22 demos. Not documented yet, I just wrote it in a hurry for
18 scipy'05. Will docstring later.
23 scipy'05. Will docstring later.
19
24
20 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
25 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
21
26
22 * IPython/Shell.py (sigint_handler): Drastic simplification which
27 * IPython/Shell.py (sigint_handler): Drastic simplification which
23 also seems to make Ctrl-C work correctly across threads! This is
28 also seems to make Ctrl-C work correctly across threads! This is
24 so simple, that I can't beleive I'd missed it before. Needs more
29 so simple, that I can't beleive I'd missed it before. Needs more
25 testing, though.
30 testing, though.
26 (KBINT): Never mind, revert changes. I'm sure I'd tried something
31 (KBINT): Never mind, revert changes. I'm sure I'd tried something
27 like this before...
32 like this before...
28
33
29 * IPython/genutils.py (get_home_dir): add protection against
34 * IPython/genutils.py (get_home_dir): add protection against
30 non-dirs in win32 registry.
35 non-dirs in win32 registry.
31
36
32 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
37 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
33 bug where dict was mutated while iterating (pysh crash).
38 bug where dict was mutated while iterating (pysh crash).
34
39
35 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
40 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
36
41
37 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
42 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
38 spurious newlines added by this routine. After a report by
43 spurious newlines added by this routine. After a report by
39 F. Mantegazza.
44 F. Mantegazza.
40
45
41 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
46 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
42
47
43 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
48 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
44 calls. These were a leftover from the GTK 1.x days, and can cause
49 calls. These were a leftover from the GTK 1.x days, and can cause
45 problems in certain cases (after a report by John Hunter).
50 problems in certain cases (after a report by John Hunter).
46
51
47 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
52 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
48 os.getcwd() fails at init time. Thanks to patch from David Remahl
53 os.getcwd() fails at init time. Thanks to patch from David Remahl
49 <chmod007 AT mac.com>.
54 <chmod007 AT mac.com>.
50 (InteractiveShell.__init__): prevent certain special magics from
55 (InteractiveShell.__init__): prevent certain special magics from
51 being shadowed by aliases. Closes
56 being shadowed by aliases. Closes
52 http://www.scipy.net/roundup/ipython/issue41.
57 http://www.scipy.net/roundup/ipython/issue41.
53
58
54 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
59 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
55
60
56 * IPython/iplib.py (InteractiveShell.complete): Added new
61 * IPython/iplib.py (InteractiveShell.complete): Added new
57 top-level completion method to expose the completion mechanism
62 top-level completion method to expose the completion mechanism
58 beyond readline-based environments.
63 beyond readline-based environments.
59
64
60 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
65 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
61
66
62 * tools/ipsvnc (svnversion): fix svnversion capture.
67 * tools/ipsvnc (svnversion): fix svnversion capture.
63
68
64 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
69 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
65 attribute to self, which was missing. Before, it was set by a
70 attribute to self, which was missing. Before, it was set by a
66 routine which in certain cases wasn't being called, so the
71 routine which in certain cases wasn't being called, so the
67 instance could end up missing the attribute. This caused a crash.
72 instance could end up missing the attribute. This caused a crash.
68 Closes http://www.scipy.net/roundup/ipython/issue40.
73 Closes http://www.scipy.net/roundup/ipython/issue40.
69
74
70 2005-08-16 Fernando Perez <fperez@colorado.edu>
75 2005-08-16 Fernando Perez <fperez@colorado.edu>
71
76
72 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
77 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
73 contains non-string attribute. Closes
78 contains non-string attribute. Closes
74 http://www.scipy.net/roundup/ipython/issue38.
79 http://www.scipy.net/roundup/ipython/issue38.
75
80
76 2005-08-14 Fernando Perez <fperez@colorado.edu>
81 2005-08-14 Fernando Perez <fperez@colorado.edu>
77
82
78 * tools/ipsvnc: Minor improvements, to add changeset info.
83 * tools/ipsvnc: Minor improvements, to add changeset info.
79
84
80 2005-08-12 Fernando Perez <fperez@colorado.edu>
85 2005-08-12 Fernando Perez <fperez@colorado.edu>
81
86
82 * IPython/iplib.py (runsource): remove self.code_to_run_src
87 * IPython/iplib.py (runsource): remove self.code_to_run_src
83 attribute. I realized this is nothing more than
88 attribute. I realized this is nothing more than
84 '\n'.join(self.buffer), and having the same data in two different
89 '\n'.join(self.buffer), and having the same data in two different
85 places is just asking for synchronization bugs. This may impact
90 places is just asking for synchronization bugs. This may impact
86 people who have custom exception handlers, so I need to warn
91 people who have custom exception handlers, so I need to warn
87 ipython-dev about it (F. Mantegazza may use them).
92 ipython-dev about it (F. Mantegazza may use them).
88
93
89 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
94 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
90
95
91 * IPython/genutils.py: fix 2.2 compatibility (generators)
96 * IPython/genutils.py: fix 2.2 compatibility (generators)
92
97
93 2005-07-18 Fernando Perez <fperez@colorado.edu>
98 2005-07-18 Fernando Perez <fperez@colorado.edu>
94
99
95 * IPython/genutils.py (get_home_dir): fix to help users with
100 * IPython/genutils.py (get_home_dir): fix to help users with
96 invalid $HOME under win32.
101 invalid $HOME under win32.
97
102
98 2005-07-17 Fernando Perez <fperez@colorado.edu>
103 2005-07-17 Fernando Perez <fperez@colorado.edu>
99
104
100 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
105 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
101 some old hacks and clean up a bit other routines; code should be
106 some old hacks and clean up a bit other routines; code should be
102 simpler and a bit faster.
107 simpler and a bit faster.
103
108
104 * IPython/iplib.py (interact): removed some last-resort attempts
109 * IPython/iplib.py (interact): removed some last-resort attempts
105 to survive broken stdout/stderr. That code was only making it
110 to survive broken stdout/stderr. That code was only making it
106 harder to abstract out the i/o (necessary for gui integration),
111 harder to abstract out the i/o (necessary for gui integration),
107 and the crashes it could prevent were extremely rare in practice
112 and the crashes it could prevent were extremely rare in practice
108 (besides being fully user-induced in a pretty violent manner).
113 (besides being fully user-induced in a pretty violent manner).
109
114
110 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
115 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
111 Nothing major yet, but the code is simpler to read; this should
116 Nothing major yet, but the code is simpler to read; this should
112 make it easier to do more serious modifications in the future.
117 make it easier to do more serious modifications in the future.
113
118
114 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
119 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
115 which broke in .15 (thanks to a report by Ville).
120 which broke in .15 (thanks to a report by Ville).
116
121
117 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
122 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
118 be quite correct, I know next to nothing about unicode). This
123 be quite correct, I know next to nothing about unicode). This
119 will allow unicode strings to be used in prompts, amongst other
124 will allow unicode strings to be used in prompts, amongst other
120 cases. It also will prevent ipython from crashing when unicode
125 cases. It also will prevent ipython from crashing when unicode
121 shows up unexpectedly in many places. If ascii encoding fails, we
126 shows up unexpectedly in many places. If ascii encoding fails, we
122 assume utf_8. Currently the encoding is not a user-visible
127 assume utf_8. Currently the encoding is not a user-visible
123 setting, though it could be made so if there is demand for it.
128 setting, though it could be made so if there is demand for it.
124
129
125 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
130 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
126
131
127 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
132 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
128
133
129 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
134 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
130
135
131 * IPython/genutils.py: Add 2.2 compatibility here, so all other
136 * IPython/genutils.py: Add 2.2 compatibility here, so all other
132 code can work transparently for 2.2/2.3.
137 code can work transparently for 2.2/2.3.
133
138
134 2005-07-16 Fernando Perez <fperez@colorado.edu>
139 2005-07-16 Fernando Perez <fperez@colorado.edu>
135
140
136 * IPython/ultraTB.py (ExceptionColors): Make a global variable
141 * IPython/ultraTB.py (ExceptionColors): Make a global variable
137 out of the color scheme table used for coloring exception
142 out of the color scheme table used for coloring exception
138 tracebacks. This allows user code to add new schemes at runtime.
143 tracebacks. This allows user code to add new schemes at runtime.
139 This is a minimally modified version of the patch at
144 This is a minimally modified version of the patch at
140 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
145 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
141 for the contribution.
146 for the contribution.
142
147
143 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
148 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
144 slightly modified version of the patch in
149 slightly modified version of the patch in
145 http://www.scipy.net/roundup/ipython/issue34, which also allows me
150 http://www.scipy.net/roundup/ipython/issue34, which also allows me
146 to remove the previous try/except solution (which was costlier).
151 to remove the previous try/except solution (which was costlier).
147 Thanks to Gaetan Lehmann <gaetan.lehmann AT jouy.inra.fr> for the fix.
152 Thanks to Gaetan Lehmann <gaetan.lehmann AT jouy.inra.fr> for the fix.
148
153
149 2005-06-08 Fernando Perez <fperez@colorado.edu>
154 2005-06-08 Fernando Perez <fperez@colorado.edu>
150
155
151 * IPython/iplib.py (write/write_err): Add methods to abstract all
156 * IPython/iplib.py (write/write_err): Add methods to abstract all
152 I/O a bit more.
157 I/O a bit more.
153
158
154 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
159 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
155 warning, reported by Aric Hagberg, fix by JD Hunter.
160 warning, reported by Aric Hagberg, fix by JD Hunter.
156
161
157 2005-06-02 *** Released version 0.6.15
162 2005-06-02 *** Released version 0.6.15
158
163
159 2005-06-01 Fernando Perez <fperez@colorado.edu>
164 2005-06-01 Fernando Perez <fperez@colorado.edu>
160
165
161 * IPython/iplib.py (MagicCompleter.file_matches): Fix
166 * IPython/iplib.py (MagicCompleter.file_matches): Fix
162 tab-completion of filenames within open-quoted strings. Note that
167 tab-completion of filenames within open-quoted strings. Note that
163 this requires that in ~/.ipython/ipythonrc, users change the
168 this requires that in ~/.ipython/ipythonrc, users change the
164 readline delimiters configuration to read:
169 readline delimiters configuration to read:
165
170
166 readline_remove_delims -/~
171 readline_remove_delims -/~
167
172
168
173
169 2005-05-31 *** Released version 0.6.14
174 2005-05-31 *** Released version 0.6.14
170
175
171 2005-05-29 Fernando Perez <fperez@colorado.edu>
176 2005-05-29 Fernando Perez <fperez@colorado.edu>
172
177
173 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
178 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
174 with files not on the filesystem. Reported by Eliyahu Sandler
179 with files not on the filesystem. Reported by Eliyahu Sandler
175 <eli@gondolin.net>
180 <eli@gondolin.net>
176
181
177 2005-05-22 Fernando Perez <fperez@colorado.edu>
182 2005-05-22 Fernando Perez <fperez@colorado.edu>
178
183
179 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
184 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
180 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
185 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
181
186
182 2005-05-19 Fernando Perez <fperez@colorado.edu>
187 2005-05-19 Fernando Perez <fperez@colorado.edu>
183
188
184 * IPython/iplib.py (safe_execfile): close a file which could be
189 * IPython/iplib.py (safe_execfile): close a file which could be
185 left open (causing problems in win32, which locks open files).
190 left open (causing problems in win32, which locks open files).
186 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
191 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
187
192
188 2005-05-18 Fernando Perez <fperez@colorado.edu>
193 2005-05-18 Fernando Perez <fperez@colorado.edu>
189
194
190 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
195 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
191 keyword arguments correctly to safe_execfile().
196 keyword arguments correctly to safe_execfile().
192
197
193 2005-05-13 Fernando Perez <fperez@colorado.edu>
198 2005-05-13 Fernando Perez <fperez@colorado.edu>
194
199
195 * ipython.1: Added info about Qt to manpage, and threads warning
200 * ipython.1: Added info about Qt to manpage, and threads warning
196 to usage page (invoked with --help).
201 to usage page (invoked with --help).
197
202
198 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
203 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
199 new matcher (it goes at the end of the priority list) to do
204 new matcher (it goes at the end of the priority list) to do
200 tab-completion on named function arguments. Submitted by George
205 tab-completion on named function arguments. Submitted by George
201 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
206 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
202 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
207 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
203 for more details.
208 for more details.
204
209
205 * IPython/Magic.py (magic_run): Added new -e flag to ignore
210 * IPython/Magic.py (magic_run): Added new -e flag to ignore
206 SystemExit exceptions in the script being run. Thanks to a report
211 SystemExit exceptions in the script being run. Thanks to a report
207 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
212 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
208 producing very annoying behavior when running unit tests.
213 producing very annoying behavior when running unit tests.
209
214
210 2005-05-12 Fernando Perez <fperez@colorado.edu>
215 2005-05-12 Fernando Perez <fperez@colorado.edu>
211
216
212 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
217 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
213 which I'd broken (again) due to a changed regexp. In the process,
218 which I'd broken (again) due to a changed regexp. In the process,
214 added ';' as an escape to auto-quote the whole line without
219 added ';' as an escape to auto-quote the whole line without
215 splitting its arguments. Thanks to a report by Jerry McRae
220 splitting its arguments. Thanks to a report by Jerry McRae
216 <qrs0xyc02-AT-sneakemail.com>.
221 <qrs0xyc02-AT-sneakemail.com>.
217
222
218 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
223 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
219 possible crashes caused by a TokenError. Reported by Ed Schofield
224 possible crashes caused by a TokenError. Reported by Ed Schofield
220 <schofield-AT-ftw.at>.
225 <schofield-AT-ftw.at>.
221
226
222 2005-05-06 Fernando Perez <fperez@colorado.edu>
227 2005-05-06 Fernando Perez <fperez@colorado.edu>
223
228
224 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
229 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
225
230
226 2005-04-29 Fernando Perez <fperez@colorado.edu>
231 2005-04-29 Fernando Perez <fperez@colorado.edu>
227
232
228 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
233 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
229 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
234 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
230 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
235 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
231 which provides support for Qt interactive usage (similar to the
236 which provides support for Qt interactive usage (similar to the
232 existing one for WX and GTK). This had been often requested.
237 existing one for WX and GTK). This had been often requested.
233
238
234 2005-04-14 *** Released version 0.6.13
239 2005-04-14 *** Released version 0.6.13
235
240
236 2005-04-08 Fernando Perez <fperez@colorado.edu>
241 2005-04-08 Fernando Perez <fperez@colorado.edu>
237
242
238 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
243 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
239 from _ofind, which gets called on almost every input line. Now,
244 from _ofind, which gets called on almost every input line. Now,
240 we only try to get docstrings if they are actually going to be
245 we only try to get docstrings if they are actually going to be
241 used (the overhead of fetching unnecessary docstrings can be
246 used (the overhead of fetching unnecessary docstrings can be
242 noticeable for certain objects, such as Pyro proxies).
247 noticeable for certain objects, such as Pyro proxies).
243
248
244 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
249 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
245 for completers. For some reason I had been passing them the state
250 for completers. For some reason I had been passing them the state
246 variable, which completers never actually need, and was in
251 variable, which completers never actually need, and was in
247 conflict with the rlcompleter API. Custom completers ONLY need to
252 conflict with the rlcompleter API. Custom completers ONLY need to
248 take the text parameter.
253 take the text parameter.
249
254
250 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
255 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
251 work correctly in pysh. I've also moved all the logic which used
256 work correctly in pysh. I've also moved all the logic which used
252 to be in pysh.py here, which will prevent problems with future
257 to be in pysh.py here, which will prevent problems with future
253 upgrades. However, this time I must warn users to update their
258 upgrades. However, this time I must warn users to update their
254 pysh profile to include the line
259 pysh profile to include the line
255
260
256 import_all IPython.Extensions.InterpreterExec
261 import_all IPython.Extensions.InterpreterExec
257
262
258 because otherwise things won't work for them. They MUST also
263 because otherwise things won't work for them. They MUST also
259 delete pysh.py and the line
264 delete pysh.py and the line
260
265
261 execfile pysh.py
266 execfile pysh.py
262
267
263 from their ipythonrc-pysh.
268 from their ipythonrc-pysh.
264
269
265 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
270 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
266 robust in the face of objects whose dir() returns non-strings
271 robust in the face of objects whose dir() returns non-strings
267 (which it shouldn't, but some broken libs like ITK do). Thanks to
272 (which it shouldn't, but some broken libs like ITK do). Thanks to
268 a patch by John Hunter (implemented differently, though). Also
273 a patch by John Hunter (implemented differently, though). Also
269 minor improvements by using .extend instead of + on lists.
274 minor improvements by using .extend instead of + on lists.
270
275
271 * pysh.py:
276 * pysh.py:
272
277
273 2005-04-06 Fernando Perez <fperez@colorado.edu>
278 2005-04-06 Fernando Perez <fperez@colorado.edu>
274
279
275 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
280 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
276 by default, so that all users benefit from it. Those who don't
281 by default, so that all users benefit from it. Those who don't
277 want it can still turn it off.
282 want it can still turn it off.
278
283
279 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
284 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
280 config file, I'd forgotten about this, so users were getting it
285 config file, I'd forgotten about this, so users were getting it
281 off by default.
286 off by default.
282
287
283 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
288 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
284 consistency. Now magics can be called in multiline statements,
289 consistency. Now magics can be called in multiline statements,
285 and python variables can be expanded in magic calls via $var.
290 and python variables can be expanded in magic calls via $var.
286 This makes the magic system behave just like aliases or !system
291 This makes the magic system behave just like aliases or !system
287 calls.
292 calls.
288
293
289 2005-03-28 Fernando Perez <fperez@colorado.edu>
294 2005-03-28 Fernando Perez <fperez@colorado.edu>
290
295
291 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
296 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
292 expensive string additions for building command. Add support for
297 expensive string additions for building command. Add support for
293 trailing ';' when autocall is used.
298 trailing ';' when autocall is used.
294
299
295 2005-03-26 Fernando Perez <fperez@colorado.edu>
300 2005-03-26 Fernando Perez <fperez@colorado.edu>
296
301
297 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
302 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
298 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
303 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
299 ipython.el robust against prompts with any number of spaces
304 ipython.el robust against prompts with any number of spaces
300 (including 0) after the ':' character.
305 (including 0) after the ':' character.
301
306
302 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
307 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
303 continuation prompt, which misled users to think the line was
308 continuation prompt, which misled users to think the line was
304 already indented. Closes debian Bug#300847, reported to me by
309 already indented. Closes debian Bug#300847, reported to me by
305 Norbert Tretkowski <tretkowski-AT-inittab.de>.
310 Norbert Tretkowski <tretkowski-AT-inittab.de>.
306
311
307 2005-03-23 Fernando Perez <fperez@colorado.edu>
312 2005-03-23 Fernando Perez <fperez@colorado.edu>
308
313
309 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
314 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
310 properly aligned if they have embedded newlines.
315 properly aligned if they have embedded newlines.
311
316
312 * IPython/iplib.py (runlines): Add a public method to expose
317 * IPython/iplib.py (runlines): Add a public method to expose
313 IPython's code execution machinery, so that users can run strings
318 IPython's code execution machinery, so that users can run strings
314 as if they had been typed at the prompt interactively.
319 as if they had been typed at the prompt interactively.
315 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
320 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
316 methods which can call the system shell, but with python variable
321 methods which can call the system shell, but with python variable
317 expansion. The three such methods are: __IPYTHON__.system,
322 expansion. The three such methods are: __IPYTHON__.system,
318 .getoutput and .getoutputerror. These need to be documented in a
323 .getoutput and .getoutputerror. These need to be documented in a
319 'public API' section (to be written) of the manual.
324 'public API' section (to be written) of the manual.
320
325
321 2005-03-20 Fernando Perez <fperez@colorado.edu>
326 2005-03-20 Fernando Perez <fperez@colorado.edu>
322
327
323 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
328 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
324 for custom exception handling. This is quite powerful, and it
329 for custom exception handling. This is quite powerful, and it
325 allows for user-installable exception handlers which can trap
330 allows for user-installable exception handlers which can trap
326 custom exceptions at runtime and treat them separately from
331 custom exceptions at runtime and treat them separately from
327 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
332 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
328 Mantegazza <mantegazza-AT-ill.fr>.
333 Mantegazza <mantegazza-AT-ill.fr>.
329 (InteractiveShell.set_custom_completer): public API function to
334 (InteractiveShell.set_custom_completer): public API function to
330 add new completers at runtime.
335 add new completers at runtime.
331
336
332 2005-03-19 Fernando Perez <fperez@colorado.edu>
337 2005-03-19 Fernando Perez <fperez@colorado.edu>
333
338
334 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
339 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
335 allow objects which provide their docstrings via non-standard
340 allow objects which provide their docstrings via non-standard
336 mechanisms (like Pyro proxies) to still be inspected by ipython's
341 mechanisms (like Pyro proxies) to still be inspected by ipython's
337 ? system.
342 ? system.
338
343
339 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
344 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
340 automatic capture system. I tried quite hard to make it work
345 automatic capture system. I tried quite hard to make it work
341 reliably, and simply failed. I tried many combinations with the
346 reliably, and simply failed. I tried many combinations with the
342 subprocess module, but eventually nothing worked in all needed
347 subprocess module, but eventually nothing worked in all needed
343 cases (not blocking stdin for the child, duplicating stdout
348 cases (not blocking stdin for the child, duplicating stdout
344 without blocking, etc). The new %sc/%sx still do capture to these
349 without blocking, etc). The new %sc/%sx still do capture to these
345 magical list/string objects which make shell use much more
350 magical list/string objects which make shell use much more
346 conveninent, so not all is lost.
351 conveninent, so not all is lost.
347
352
348 XXX - FIX MANUAL for the change above!
353 XXX - FIX MANUAL for the change above!
349
354
350 (runsource): I copied code.py's runsource() into ipython to modify
355 (runsource): I copied code.py's runsource() into ipython to modify
351 it a bit. Now the code object and source to be executed are
356 it a bit. Now the code object and source to be executed are
352 stored in ipython. This makes this info accessible to third-party
357 stored in ipython. This makes this info accessible to third-party
353 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
358 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
354 Mantegazza <mantegazza-AT-ill.fr>.
359 Mantegazza <mantegazza-AT-ill.fr>.
355
360
356 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
361 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
357 history-search via readline (like C-p/C-n). I'd wanted this for a
362 history-search via readline (like C-p/C-n). I'd wanted this for a
358 long time, but only recently found out how to do it. For users
363 long time, but only recently found out how to do it. For users
359 who already have their ipythonrc files made and want this, just
364 who already have their ipythonrc files made and want this, just
360 add:
365 add:
361
366
362 readline_parse_and_bind "\e[A": history-search-backward
367 readline_parse_and_bind "\e[A": history-search-backward
363 readline_parse_and_bind "\e[B": history-search-forward
368 readline_parse_and_bind "\e[B": history-search-forward
364
369
365 2005-03-18 Fernando Perez <fperez@colorado.edu>
370 2005-03-18 Fernando Perez <fperez@colorado.edu>
366
371
367 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
372 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
368 LSString and SList classes which allow transparent conversions
373 LSString and SList classes which allow transparent conversions
369 between list mode and whitespace-separated string.
374 between list mode and whitespace-separated string.
370 (magic_r): Fix recursion problem in %r.
375 (magic_r): Fix recursion problem in %r.
371
376
372 * IPython/genutils.py (LSString): New class to be used for
377 * IPython/genutils.py (LSString): New class to be used for
373 automatic storage of the results of all alias/system calls in _o
378 automatic storage of the results of all alias/system calls in _o
374 and _e (stdout/err). These provide a .l/.list attribute which
379 and _e (stdout/err). These provide a .l/.list attribute which
375 does automatic splitting on newlines. This means that for most
380 does automatic splitting on newlines. This means that for most
376 uses, you'll never need to do capturing of output with %sc/%sx
381 uses, you'll never need to do capturing of output with %sc/%sx
377 anymore, since ipython keeps this always done for you. Note that
382 anymore, since ipython keeps this always done for you. Note that
378 only the LAST results are stored, the _o/e variables are
383 only the LAST results are stored, the _o/e variables are
379 overwritten on each call. If you need to save their contents
384 overwritten on each call. If you need to save their contents
380 further, simply bind them to any other name.
385 further, simply bind them to any other name.
381
386
382 2005-03-17 Fernando Perez <fperez@colorado.edu>
387 2005-03-17 Fernando Perez <fperez@colorado.edu>
383
388
384 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
389 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
385 prompt namespace handling.
390 prompt namespace handling.
386
391
387 2005-03-16 Fernando Perez <fperez@colorado.edu>
392 2005-03-16 Fernando Perez <fperez@colorado.edu>
388
393
389 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
394 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
390 classic prompts to be '>>> ' (final space was missing, and it
395 classic prompts to be '>>> ' (final space was missing, and it
391 trips the emacs python mode).
396 trips the emacs python mode).
392 (BasePrompt.__str__): Added safe support for dynamic prompt
397 (BasePrompt.__str__): Added safe support for dynamic prompt
393 strings. Now you can set your prompt string to be '$x', and the
398 strings. Now you can set your prompt string to be '$x', and the
394 value of x will be printed from your interactive namespace. The
399 value of x will be printed from your interactive namespace. The
395 interpolation syntax includes the full Itpl support, so
400 interpolation syntax includes the full Itpl support, so
396 ${foo()+x+bar()} is a valid prompt string now, and the function
401 ${foo()+x+bar()} is a valid prompt string now, and the function
397 calls will be made at runtime.
402 calls will be made at runtime.
398
403
399 2005-03-15 Fernando Perez <fperez@colorado.edu>
404 2005-03-15 Fernando Perez <fperez@colorado.edu>
400
405
401 * IPython/Magic.py (magic_history): renamed %hist to %history, to
406 * IPython/Magic.py (magic_history): renamed %hist to %history, to
402 avoid name clashes in pylab. %hist still works, it just forwards
407 avoid name clashes in pylab. %hist still works, it just forwards
403 the call to %history.
408 the call to %history.
404
409
405 2005-03-02 *** Released version 0.6.12
410 2005-03-02 *** Released version 0.6.12
406
411
407 2005-03-02 Fernando Perez <fperez@colorado.edu>
412 2005-03-02 Fernando Perez <fperez@colorado.edu>
408
413
409 * IPython/iplib.py (handle_magic): log magic calls properly as
414 * IPython/iplib.py (handle_magic): log magic calls properly as
410 ipmagic() function calls.
415 ipmagic() function calls.
411
416
412 * IPython/Magic.py (magic_time): Improved %time to support
417 * IPython/Magic.py (magic_time): Improved %time to support
413 statements and provide wall-clock as well as CPU time.
418 statements and provide wall-clock as well as CPU time.
414
419
415 2005-02-27 Fernando Perez <fperez@colorado.edu>
420 2005-02-27 Fernando Perez <fperez@colorado.edu>
416
421
417 * IPython/hooks.py: New hooks module, to expose user-modifiable
422 * IPython/hooks.py: New hooks module, to expose user-modifiable
418 IPython functionality in a clean manner. For now only the editor
423 IPython functionality in a clean manner. For now only the editor
419 hook is actually written, and other thigns which I intend to turn
424 hook is actually written, and other thigns which I intend to turn
420 into proper hooks aren't yet there. The display and prefilter
425 into proper hooks aren't yet there. The display and prefilter
421 stuff, for example, should be hooks. But at least now the
426 stuff, for example, should be hooks. But at least now the
422 framework is in place, and the rest can be moved here with more
427 framework is in place, and the rest can be moved here with more
423 time later. IPython had had a .hooks variable for a long time for
428 time later. IPython had had a .hooks variable for a long time for
424 this purpose, but I'd never actually used it for anything.
429 this purpose, but I'd never actually used it for anything.
425
430
426 2005-02-26 Fernando Perez <fperez@colorado.edu>
431 2005-02-26 Fernando Perez <fperez@colorado.edu>
427
432
428 * IPython/ipmaker.py (make_IPython): make the default ipython
433 * IPython/ipmaker.py (make_IPython): make the default ipython
429 directory be called _ipython under win32, to follow more the
434 directory be called _ipython under win32, to follow more the
430 naming peculiarities of that platform (where buggy software like
435 naming peculiarities of that platform (where buggy software like
431 Visual Sourcesafe breaks with .named directories). Reported by
436 Visual Sourcesafe breaks with .named directories). Reported by
432 Ville Vainio.
437 Ville Vainio.
433
438
434 2005-02-23 Fernando Perez <fperez@colorado.edu>
439 2005-02-23 Fernando Perez <fperez@colorado.edu>
435
440
436 * IPython/iplib.py (InteractiveShell.__init__): removed a few
441 * IPython/iplib.py (InteractiveShell.__init__): removed a few
437 auto_aliases for win32 which were causing problems. Users can
442 auto_aliases for win32 which were causing problems. Users can
438 define the ones they personally like.
443 define the ones they personally like.
439
444
440 2005-02-21 Fernando Perez <fperez@colorado.edu>
445 2005-02-21 Fernando Perez <fperez@colorado.edu>
441
446
442 * IPython/Magic.py (magic_time): new magic to time execution of
447 * IPython/Magic.py (magic_time): new magic to time execution of
443 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
448 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
444
449
445 2005-02-19 Fernando Perez <fperez@colorado.edu>
450 2005-02-19 Fernando Perez <fperez@colorado.edu>
446
451
447 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
452 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
448 into keys (for prompts, for example).
453 into keys (for prompts, for example).
449
454
450 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
455 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
451 prompts in case users want them. This introduces a small behavior
456 prompts in case users want them. This introduces a small behavior
452 change: ipython does not automatically add a space to all prompts
457 change: ipython does not automatically add a space to all prompts
453 anymore. To get the old prompts with a space, users should add it
458 anymore. To get the old prompts with a space, users should add it
454 manually to their ipythonrc file, so for example prompt_in1 should
459 manually to their ipythonrc file, so for example prompt_in1 should
455 now read 'In [\#]: ' instead of 'In [\#]:'.
460 now read 'In [\#]: ' instead of 'In [\#]:'.
456 (BasePrompt.__init__): New option prompts_pad_left (only in rc
461 (BasePrompt.__init__): New option prompts_pad_left (only in rc
457 file) to control left-padding of secondary prompts.
462 file) to control left-padding of secondary prompts.
458
463
459 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
464 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
460 the profiler can't be imported. Fix for Debian, which removed
465 the profiler can't be imported. Fix for Debian, which removed
461 profile.py because of License issues. I applied a slightly
466 profile.py because of License issues. I applied a slightly
462 modified version of the original Debian patch at
467 modified version of the original Debian patch at
463 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
468 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
464
469
465 2005-02-17 Fernando Perez <fperez@colorado.edu>
470 2005-02-17 Fernando Perez <fperez@colorado.edu>
466
471
467 * IPython/genutils.py (native_line_ends): Fix bug which would
472 * IPython/genutils.py (native_line_ends): Fix bug which would
468 cause improper line-ends under win32 b/c I was not opening files
473 cause improper line-ends under win32 b/c I was not opening files
469 in binary mode. Bug report and fix thanks to Ville.
474 in binary mode. Bug report and fix thanks to Ville.
470
475
471 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
476 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
472 trying to catch spurious foo[1] autocalls. My fix actually broke
477 trying to catch spurious foo[1] autocalls. My fix actually broke
473 ',/' autoquote/call with explicit escape (bad regexp).
478 ',/' autoquote/call with explicit escape (bad regexp).
474
479
475 2005-02-15 *** Released version 0.6.11
480 2005-02-15 *** Released version 0.6.11
476
481
477 2005-02-14 Fernando Perez <fperez@colorado.edu>
482 2005-02-14 Fernando Perez <fperez@colorado.edu>
478
483
479 * IPython/background_jobs.py: New background job management
484 * IPython/background_jobs.py: New background job management
480 subsystem. This is implemented via a new set of classes, and
485 subsystem. This is implemented via a new set of classes, and
481 IPython now provides a builtin 'jobs' object for background job
486 IPython now provides a builtin 'jobs' object for background job
482 execution. A convenience %bg magic serves as a lightweight
487 execution. A convenience %bg magic serves as a lightweight
483 frontend for starting the more common type of calls. This was
488 frontend for starting the more common type of calls. This was
484 inspired by discussions with B. Granger and the BackgroundCommand
489 inspired by discussions with B. Granger and the BackgroundCommand
485 class described in the book Python Scripting for Computational
490 class described in the book Python Scripting for Computational
486 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
491 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
487 (although ultimately no code from this text was used, as IPython's
492 (although ultimately no code from this text was used, as IPython's
488 system is a separate implementation).
493 system is a separate implementation).
489
494
490 * IPython/iplib.py (MagicCompleter.python_matches): add new option
495 * IPython/iplib.py (MagicCompleter.python_matches): add new option
491 to control the completion of single/double underscore names
496 to control the completion of single/double underscore names
492 separately. As documented in the example ipytonrc file, the
497 separately. As documented in the example ipytonrc file, the
493 readline_omit__names variable can now be set to 2, to omit even
498 readline_omit__names variable can now be set to 2, to omit even
494 single underscore names. Thanks to a patch by Brian Wong
499 single underscore names. Thanks to a patch by Brian Wong
495 <BrianWong-AT-AirgoNetworks.Com>.
500 <BrianWong-AT-AirgoNetworks.Com>.
496 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
501 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
497 be autocalled as foo([1]) if foo were callable. A problem for
502 be autocalled as foo([1]) if foo were callable. A problem for
498 things which are both callable and implement __getitem__.
503 things which are both callable and implement __getitem__.
499 (init_readline): Fix autoindentation for win32. Thanks to a patch
504 (init_readline): Fix autoindentation for win32. Thanks to a patch
500 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
505 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
501
506
502 2005-02-12 Fernando Perez <fperez@colorado.edu>
507 2005-02-12 Fernando Perez <fperez@colorado.edu>
503
508
504 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
509 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
505 which I had written long ago to sort out user error messages which
510 which I had written long ago to sort out user error messages which
506 may occur during startup. This seemed like a good idea initially,
511 may occur during startup. This seemed like a good idea initially,
507 but it has proven a disaster in retrospect. I don't want to
512 but it has proven a disaster in retrospect. I don't want to
508 change much code for now, so my fix is to set the internal 'debug'
513 change much code for now, so my fix is to set the internal 'debug'
509 flag to true everywhere, whose only job was precisely to control
514 flag to true everywhere, whose only job was precisely to control
510 this subsystem. This closes issue 28 (as well as avoiding all
515 this subsystem. This closes issue 28 (as well as avoiding all
511 sorts of strange hangups which occur from time to time).
516 sorts of strange hangups which occur from time to time).
512
517
513 2005-02-07 Fernando Perez <fperez@colorado.edu>
518 2005-02-07 Fernando Perez <fperez@colorado.edu>
514
519
515 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
520 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
516 previous call produced a syntax error.
521 previous call produced a syntax error.
517
522
518 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
523 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
519 classes without constructor.
524 classes without constructor.
520
525
521 2005-02-06 Fernando Perez <fperez@colorado.edu>
526 2005-02-06 Fernando Perez <fperez@colorado.edu>
522
527
523 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
528 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
524 completions with the results of each matcher, so we return results
529 completions with the results of each matcher, so we return results
525 to the user from all namespaces. This breaks with ipython
530 to the user from all namespaces. This breaks with ipython
526 tradition, but I think it's a nicer behavior. Now you get all
531 tradition, but I think it's a nicer behavior. Now you get all
527 possible completions listed, from all possible namespaces (python,
532 possible completions listed, from all possible namespaces (python,
528 filesystem, magics...) After a request by John Hunter
533 filesystem, magics...) After a request by John Hunter
529 <jdhunter-AT-nitace.bsd.uchicago.edu>.
534 <jdhunter-AT-nitace.bsd.uchicago.edu>.
530
535
531 2005-02-05 Fernando Perez <fperez@colorado.edu>
536 2005-02-05 Fernando Perez <fperez@colorado.edu>
532
537
533 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
538 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
534 the call had quote characters in it (the quotes were stripped).
539 the call had quote characters in it (the quotes were stripped).
535
540
536 2005-01-31 Fernando Perez <fperez@colorado.edu>
541 2005-01-31 Fernando Perez <fperez@colorado.edu>
537
542
538 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
543 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
539 Itpl.itpl() to make the code more robust against psyco
544 Itpl.itpl() to make the code more robust against psyco
540 optimizations.
545 optimizations.
541
546
542 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
547 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
543 of causing an exception. Quicker, cleaner.
548 of causing an exception. Quicker, cleaner.
544
549
545 2005-01-28 Fernando Perez <fperez@colorado.edu>
550 2005-01-28 Fernando Perez <fperez@colorado.edu>
546
551
547 * scripts/ipython_win_post_install.py (install): hardcode
552 * scripts/ipython_win_post_install.py (install): hardcode
548 sys.prefix+'python.exe' as the executable path. It turns out that
553 sys.prefix+'python.exe' as the executable path. It turns out that
549 during the post-installation run, sys.executable resolves to the
554 during the post-installation run, sys.executable resolves to the
550 name of the binary installer! I should report this as a distutils
555 name of the binary installer! I should report this as a distutils
551 bug, I think. I updated the .10 release with this tiny fix, to
556 bug, I think. I updated the .10 release with this tiny fix, to
552 avoid annoying the lists further.
557 avoid annoying the lists further.
553
558
554 2005-01-27 *** Released version 0.6.10
559 2005-01-27 *** Released version 0.6.10
555
560
556 2005-01-27 Fernando Perez <fperez@colorado.edu>
561 2005-01-27 Fernando Perez <fperez@colorado.edu>
557
562
558 * IPython/numutils.py (norm): Added 'inf' as optional name for
563 * IPython/numutils.py (norm): Added 'inf' as optional name for
559 L-infinity norm, included references to mathworld.com for vector
564 L-infinity norm, included references to mathworld.com for vector
560 norm definitions.
565 norm definitions.
561 (amin/amax): added amin/amax for array min/max. Similar to what
566 (amin/amax): added amin/amax for array min/max. Similar to what
562 pylab ships with after the recent reorganization of names.
567 pylab ships with after the recent reorganization of names.
563 (spike/spike_odd): removed deprecated spike/spike_odd functions.
568 (spike/spike_odd): removed deprecated spike/spike_odd functions.
564
569
565 * ipython.el: committed Alex's recent fixes and improvements.
570 * ipython.el: committed Alex's recent fixes and improvements.
566 Tested with python-mode from CVS, and it looks excellent. Since
571 Tested with python-mode from CVS, and it looks excellent. Since
567 python-mode hasn't released anything in a while, I'm temporarily
572 python-mode hasn't released anything in a while, I'm temporarily
568 putting a copy of today's CVS (v 4.70) of python-mode in:
573 putting a copy of today's CVS (v 4.70) of python-mode in:
569 http://ipython.scipy.org/tmp/python-mode.el
574 http://ipython.scipy.org/tmp/python-mode.el
570
575
571 * scripts/ipython_win_post_install.py (install): Win32 fix to use
576 * scripts/ipython_win_post_install.py (install): Win32 fix to use
572 sys.executable for the executable name, instead of assuming it's
577 sys.executable for the executable name, instead of assuming it's
573 called 'python.exe' (the post-installer would have produced broken
578 called 'python.exe' (the post-installer would have produced broken
574 setups on systems with a differently named python binary).
579 setups on systems with a differently named python binary).
575
580
576 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
581 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
577 references to os.linesep, to make the code more
582 references to os.linesep, to make the code more
578 platform-independent. This is also part of the win32 coloring
583 platform-independent. This is also part of the win32 coloring
579 fixes.
584 fixes.
580
585
581 * IPython/genutils.py (page_dumb): Remove attempts to chop long
586 * IPython/genutils.py (page_dumb): Remove attempts to chop long
582 lines, which actually cause coloring bugs because the length of
587 lines, which actually cause coloring bugs because the length of
583 the line is very difficult to correctly compute with embedded
588 the line is very difficult to correctly compute with embedded
584 escapes. This was the source of all the coloring problems under
589 escapes. This was the source of all the coloring problems under
585 Win32. I think that _finally_, Win32 users have a properly
590 Win32. I think that _finally_, Win32 users have a properly
586 working ipython in all respects. This would never have happened
591 working ipython in all respects. This would never have happened
587 if not for Gary Bishop and Viktor Ransmayr's great help and work.
592 if not for Gary Bishop and Viktor Ransmayr's great help and work.
588
593
589 2005-01-26 *** Released version 0.6.9
594 2005-01-26 *** Released version 0.6.9
590
595
591 2005-01-25 Fernando Perez <fperez@colorado.edu>
596 2005-01-25 Fernando Perez <fperez@colorado.edu>
592
597
593 * setup.py: finally, we have a true Windows installer, thanks to
598 * setup.py: finally, we have a true Windows installer, thanks to
594 the excellent work of Viktor Ransmayr
599 the excellent work of Viktor Ransmayr
595 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
600 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
596 Windows users. The setup routine is quite a bit cleaner thanks to
601 Windows users. The setup routine is quite a bit cleaner thanks to
597 this, and the post-install script uses the proper functions to
602 this, and the post-install script uses the proper functions to
598 allow a clean de-installation using the standard Windows Control
603 allow a clean de-installation using the standard Windows Control
599 Panel.
604 Panel.
600
605
601 * IPython/genutils.py (get_home_dir): changed to use the $HOME
606 * IPython/genutils.py (get_home_dir): changed to use the $HOME
602 environment variable under all OSes (including win32) if
607 environment variable under all OSes (including win32) if
603 available. This will give consistency to win32 users who have set
608 available. This will give consistency to win32 users who have set
604 this variable for any reason. If os.environ['HOME'] fails, the
609 this variable for any reason. If os.environ['HOME'] fails, the
605 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
610 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
606
611
607 2005-01-24 Fernando Perez <fperez@colorado.edu>
612 2005-01-24 Fernando Perez <fperez@colorado.edu>
608
613
609 * IPython/numutils.py (empty_like): add empty_like(), similar to
614 * IPython/numutils.py (empty_like): add empty_like(), similar to
610 zeros_like() but taking advantage of the new empty() Numeric routine.
615 zeros_like() but taking advantage of the new empty() Numeric routine.
611
616
612 2005-01-23 *** Released version 0.6.8
617 2005-01-23 *** Released version 0.6.8
613
618
614 2005-01-22 Fernando Perez <fperez@colorado.edu>
619 2005-01-22 Fernando Perez <fperez@colorado.edu>
615
620
616 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
621 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
617 automatic show() calls. After discussing things with JDH, it
622 automatic show() calls. After discussing things with JDH, it
618 turns out there are too many corner cases where this can go wrong.
623 turns out there are too many corner cases where this can go wrong.
619 It's best not to try to be 'too smart', and simply have ipython
624 It's best not to try to be 'too smart', and simply have ipython
620 reproduce as much as possible the default behavior of a normal
625 reproduce as much as possible the default behavior of a normal
621 python shell.
626 python shell.
622
627
623 * IPython/iplib.py (InteractiveShell.__init__): Modified the
628 * IPython/iplib.py (InteractiveShell.__init__): Modified the
624 line-splitting regexp and _prefilter() to avoid calling getattr()
629 line-splitting regexp and _prefilter() to avoid calling getattr()
625 on assignments. This closes
630 on assignments. This closes
626 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
631 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
627 readline uses getattr(), so a simple <TAB> keypress is still
632 readline uses getattr(), so a simple <TAB> keypress is still
628 enough to trigger getattr() calls on an object.
633 enough to trigger getattr() calls on an object.
629
634
630 2005-01-21 Fernando Perez <fperez@colorado.edu>
635 2005-01-21 Fernando Perez <fperez@colorado.edu>
631
636
632 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
637 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
633 docstring under pylab so it doesn't mask the original.
638 docstring under pylab so it doesn't mask the original.
634
639
635 2005-01-21 *** Released version 0.6.7
640 2005-01-21 *** Released version 0.6.7
636
641
637 2005-01-21 Fernando Perez <fperez@colorado.edu>
642 2005-01-21 Fernando Perez <fperez@colorado.edu>
638
643
639 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
644 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
640 signal handling for win32 users in multithreaded mode.
645 signal handling for win32 users in multithreaded mode.
641
646
642 2005-01-17 Fernando Perez <fperez@colorado.edu>
647 2005-01-17 Fernando Perez <fperez@colorado.edu>
643
648
644 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
649 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
645 instances with no __init__. After a crash report by Norbert Nemec
650 instances with no __init__. After a crash report by Norbert Nemec
646 <Norbert-AT-nemec-online.de>.
651 <Norbert-AT-nemec-online.de>.
647
652
648 2005-01-14 Fernando Perez <fperez@colorado.edu>
653 2005-01-14 Fernando Perez <fperez@colorado.edu>
649
654
650 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
655 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
651 names for verbose exceptions, when multiple dotted names and the
656 names for verbose exceptions, when multiple dotted names and the
652 'parent' object were present on the same line.
657 'parent' object were present on the same line.
653
658
654 2005-01-11 Fernando Perez <fperez@colorado.edu>
659 2005-01-11 Fernando Perez <fperez@colorado.edu>
655
660
656 * IPython/genutils.py (flag_calls): new utility to trap and flag
661 * IPython/genutils.py (flag_calls): new utility to trap and flag
657 calls in functions. I need it to clean up matplotlib support.
662 calls in functions. I need it to clean up matplotlib support.
658 Also removed some deprecated code in genutils.
663 Also removed some deprecated code in genutils.
659
664
660 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
665 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
661 that matplotlib scripts called with %run, which don't call show()
666 that matplotlib scripts called with %run, which don't call show()
662 themselves, still have their plotting windows open.
667 themselves, still have their plotting windows open.
663
668
664 2005-01-05 Fernando Perez <fperez@colorado.edu>
669 2005-01-05 Fernando Perez <fperez@colorado.edu>
665
670
666 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
671 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
667 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
672 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
668
673
669 2004-12-19 Fernando Perez <fperez@colorado.edu>
674 2004-12-19 Fernando Perez <fperez@colorado.edu>
670
675
671 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
676 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
672 parent_runcode, which was an eyesore. The same result can be
677 parent_runcode, which was an eyesore. The same result can be
673 obtained with Python's regular superclass mechanisms.
678 obtained with Python's regular superclass mechanisms.
674
679
675 2004-12-17 Fernando Perez <fperez@colorado.edu>
680 2004-12-17 Fernando Perez <fperez@colorado.edu>
676
681
677 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
682 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
678 reported by Prabhu.
683 reported by Prabhu.
679 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
684 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
680 sys.stderr) instead of explicitly calling sys.stderr. This helps
685 sys.stderr) instead of explicitly calling sys.stderr. This helps
681 maintain our I/O abstractions clean, for future GUI embeddings.
686 maintain our I/O abstractions clean, for future GUI embeddings.
682
687
683 * IPython/genutils.py (info): added new utility for sys.stderr
688 * IPython/genutils.py (info): added new utility for sys.stderr
684 unified info message handling (thin wrapper around warn()).
689 unified info message handling (thin wrapper around warn()).
685
690
686 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
691 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
687 composite (dotted) names on verbose exceptions.
692 composite (dotted) names on verbose exceptions.
688 (VerboseTB.nullrepr): harden against another kind of errors which
693 (VerboseTB.nullrepr): harden against another kind of errors which
689 Python's inspect module can trigger, and which were crashing
694 Python's inspect module can trigger, and which were crashing
690 IPython. Thanks to a report by Marco Lombardi
695 IPython. Thanks to a report by Marco Lombardi
691 <mlombard-AT-ma010192.hq.eso.org>.
696 <mlombard-AT-ma010192.hq.eso.org>.
692
697
693 2004-12-13 *** Released version 0.6.6
698 2004-12-13 *** Released version 0.6.6
694
699
695 2004-12-12 Fernando Perez <fperez@colorado.edu>
700 2004-12-12 Fernando Perez <fperez@colorado.edu>
696
701
697 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
702 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
698 generated by pygtk upon initialization if it was built without
703 generated by pygtk upon initialization if it was built without
699 threads (for matplotlib users). After a crash reported by
704 threads (for matplotlib users). After a crash reported by
700 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
705 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
701
706
702 * IPython/ipmaker.py (make_IPython): fix small bug in the
707 * IPython/ipmaker.py (make_IPython): fix small bug in the
703 import_some parameter for multiple imports.
708 import_some parameter for multiple imports.
704
709
705 * IPython/iplib.py (ipmagic): simplified the interface of
710 * IPython/iplib.py (ipmagic): simplified the interface of
706 ipmagic() to take a single string argument, just as it would be
711 ipmagic() to take a single string argument, just as it would be
707 typed at the IPython cmd line.
712 typed at the IPython cmd line.
708 (ipalias): Added new ipalias() with an interface identical to
713 (ipalias): Added new ipalias() with an interface identical to
709 ipmagic(). This completes exposing a pure python interface to the
714 ipmagic(). This completes exposing a pure python interface to the
710 alias and magic system, which can be used in loops or more complex
715 alias and magic system, which can be used in loops or more complex
711 code where IPython's automatic line mangling is not active.
716 code where IPython's automatic line mangling is not active.
712
717
713 * IPython/genutils.py (timing): changed interface of timing to
718 * IPython/genutils.py (timing): changed interface of timing to
714 simply run code once, which is the most common case. timings()
719 simply run code once, which is the most common case. timings()
715 remains unchanged, for the cases where you want multiple runs.
720 remains unchanged, for the cases where you want multiple runs.
716
721
717 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
722 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
718 bug where Python2.2 crashes with exec'ing code which does not end
723 bug where Python2.2 crashes with exec'ing code which does not end
719 in a single newline. Python 2.3 is OK, so I hadn't noticed this
724 in a single newline. Python 2.3 is OK, so I hadn't noticed this
720 before.
725 before.
721
726
722 2004-12-10 Fernando Perez <fperez@colorado.edu>
727 2004-12-10 Fernando Perez <fperez@colorado.edu>
723
728
724 * IPython/Magic.py (Magic.magic_prun): changed name of option from
729 * IPython/Magic.py (Magic.magic_prun): changed name of option from
725 -t to -T, to accomodate the new -t flag in %run (the %run and
730 -t to -T, to accomodate the new -t flag in %run (the %run and
726 %prun options are kind of intermixed, and it's not easy to change
731 %prun options are kind of intermixed, and it's not easy to change
727 this with the limitations of python's getopt).
732 this with the limitations of python's getopt).
728
733
729 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
734 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
730 the execution of scripts. It's not as fine-tuned as timeit.py,
735 the execution of scripts. It's not as fine-tuned as timeit.py,
731 but it works from inside ipython (and under 2.2, which lacks
736 but it works from inside ipython (and under 2.2, which lacks
732 timeit.py). Optionally a number of runs > 1 can be given for
737 timeit.py). Optionally a number of runs > 1 can be given for
733 timing very short-running code.
738 timing very short-running code.
734
739
735 * IPython/genutils.py (uniq_stable): new routine which returns a
740 * IPython/genutils.py (uniq_stable): new routine which returns a
736 list of unique elements in any iterable, but in stable order of
741 list of unique elements in any iterable, but in stable order of
737 appearance. I needed this for the ultraTB fixes, and it's a handy
742 appearance. I needed this for the ultraTB fixes, and it's a handy
738 utility.
743 utility.
739
744
740 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
745 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
741 dotted names in Verbose exceptions. This had been broken since
746 dotted names in Verbose exceptions. This had been broken since
742 the very start, now x.y will properly be printed in a Verbose
747 the very start, now x.y will properly be printed in a Verbose
743 traceback, instead of x being shown and y appearing always as an
748 traceback, instead of x being shown and y appearing always as an
744 'undefined global'. Getting this to work was a bit tricky,
749 'undefined global'. Getting this to work was a bit tricky,
745 because by default python tokenizers are stateless. Saved by
750 because by default python tokenizers are stateless. Saved by
746 python's ability to easily add a bit of state to an arbitrary
751 python's ability to easily add a bit of state to an arbitrary
747 function (without needing to build a full-blown callable object).
752 function (without needing to build a full-blown callable object).
748
753
749 Also big cleanup of this code, which had horrendous runtime
754 Also big cleanup of this code, which had horrendous runtime
750 lookups of zillions of attributes for colorization. Moved all
755 lookups of zillions of attributes for colorization. Moved all
751 this code into a few templates, which make it cleaner and quicker.
756 this code into a few templates, which make it cleaner and quicker.
752
757
753 Printout quality was also improved for Verbose exceptions: one
758 Printout quality was also improved for Verbose exceptions: one
754 variable per line, and memory addresses are printed (this can be
759 variable per line, and memory addresses are printed (this can be
755 quite handy in nasty debugging situations, which is what Verbose
760 quite handy in nasty debugging situations, which is what Verbose
756 is for).
761 is for).
757
762
758 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
763 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
759 the command line as scripts to be loaded by embedded instances.
764 the command line as scripts to be loaded by embedded instances.
760 Doing so has the potential for an infinite recursion if there are
765 Doing so has the potential for an infinite recursion if there are
761 exceptions thrown in the process. This fixes a strange crash
766 exceptions thrown in the process. This fixes a strange crash
762 reported by Philippe MULLER <muller-AT-irit.fr>.
767 reported by Philippe MULLER <muller-AT-irit.fr>.
763
768
764 2004-12-09 Fernando Perez <fperez@colorado.edu>
769 2004-12-09 Fernando Perez <fperez@colorado.edu>
765
770
766 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
771 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
767 to reflect new names in matplotlib, which now expose the
772 to reflect new names in matplotlib, which now expose the
768 matlab-compatible interface via a pylab module instead of the
773 matlab-compatible interface via a pylab module instead of the
769 'matlab' name. The new code is backwards compatible, so users of
774 'matlab' name. The new code is backwards compatible, so users of
770 all matplotlib versions are OK. Patch by J. Hunter.
775 all matplotlib versions are OK. Patch by J. Hunter.
771
776
772 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
777 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
773 of __init__ docstrings for instances (class docstrings are already
778 of __init__ docstrings for instances (class docstrings are already
774 automatically printed). Instances with customized docstrings
779 automatically printed). Instances with customized docstrings
775 (indep. of the class) are also recognized and all 3 separate
780 (indep. of the class) are also recognized and all 3 separate
776 docstrings are printed (instance, class, constructor). After some
781 docstrings are printed (instance, class, constructor). After some
777 comments/suggestions by J. Hunter.
782 comments/suggestions by J. Hunter.
778
783
779 2004-12-05 Fernando Perez <fperez@colorado.edu>
784 2004-12-05 Fernando Perez <fperez@colorado.edu>
780
785
781 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
786 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
782 warnings when tab-completion fails and triggers an exception.
787 warnings when tab-completion fails and triggers an exception.
783
788
784 2004-12-03 Fernando Perez <fperez@colorado.edu>
789 2004-12-03 Fernando Perez <fperez@colorado.edu>
785
790
786 * IPython/Magic.py (magic_prun): Fix bug where an exception would
791 * IPython/Magic.py (magic_prun): Fix bug where an exception would
787 be triggered when using 'run -p'. An incorrect option flag was
792 be triggered when using 'run -p'. An incorrect option flag was
788 being set ('d' instead of 'D').
793 being set ('d' instead of 'D').
789 (manpage): fix missing escaped \- sign.
794 (manpage): fix missing escaped \- sign.
790
795
791 2004-11-30 *** Released version 0.6.5
796 2004-11-30 *** Released version 0.6.5
792
797
793 2004-11-30 Fernando Perez <fperez@colorado.edu>
798 2004-11-30 Fernando Perez <fperez@colorado.edu>
794
799
795 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
800 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
796 setting with -d option.
801 setting with -d option.
797
802
798 * setup.py (docfiles): Fix problem where the doc glob I was using
803 * setup.py (docfiles): Fix problem where the doc glob I was using
799 was COMPLETELY BROKEN. It was giving the right files by pure
804 was COMPLETELY BROKEN. It was giving the right files by pure
800 accident, but failed once I tried to include ipython.el. Note:
805 accident, but failed once I tried to include ipython.el. Note:
801 glob() does NOT allow you to do exclusion on multiple endings!
806 glob() does NOT allow you to do exclusion on multiple endings!
802
807
803 2004-11-29 Fernando Perez <fperez@colorado.edu>
808 2004-11-29 Fernando Perez <fperez@colorado.edu>
804
809
805 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
810 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
806 the manpage as the source. Better formatting & consistency.
811 the manpage as the source. Better formatting & consistency.
807
812
808 * IPython/Magic.py (magic_run): Added new -d option, to run
813 * IPython/Magic.py (magic_run): Added new -d option, to run
809 scripts under the control of the python pdb debugger. Note that
814 scripts under the control of the python pdb debugger. Note that
810 this required changing the %prun option -d to -D, to avoid a clash
815 this required changing the %prun option -d to -D, to avoid a clash
811 (since %run must pass options to %prun, and getopt is too dumb to
816 (since %run must pass options to %prun, and getopt is too dumb to
812 handle options with string values with embedded spaces). Thanks
817 handle options with string values with embedded spaces). Thanks
813 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
818 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
814 (magic_who_ls): added type matching to %who and %whos, so that one
819 (magic_who_ls): added type matching to %who and %whos, so that one
815 can filter their output to only include variables of certain
820 can filter their output to only include variables of certain
816 types. Another suggestion by Matthew.
821 types. Another suggestion by Matthew.
817 (magic_whos): Added memory summaries in kb and Mb for arrays.
822 (magic_whos): Added memory summaries in kb and Mb for arrays.
818 (magic_who): Improve formatting (break lines every 9 vars).
823 (magic_who): Improve formatting (break lines every 9 vars).
819
824
820 2004-11-28 Fernando Perez <fperez@colorado.edu>
825 2004-11-28 Fernando Perez <fperez@colorado.edu>
821
826
822 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
827 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
823 cache when empty lines were present.
828 cache when empty lines were present.
824
829
825 2004-11-24 Fernando Perez <fperez@colorado.edu>
830 2004-11-24 Fernando Perez <fperez@colorado.edu>
826
831
827 * IPython/usage.py (__doc__): document the re-activated threading
832 * IPython/usage.py (__doc__): document the re-activated threading
828 options for WX and GTK.
833 options for WX and GTK.
829
834
830 2004-11-23 Fernando Perez <fperez@colorado.edu>
835 2004-11-23 Fernando Perez <fperez@colorado.edu>
831
836
832 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
837 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
833 the -wthread and -gthread options, along with a new -tk one to try
838 the -wthread and -gthread options, along with a new -tk one to try
834 and coordinate Tk threading with wx/gtk. The tk support is very
839 and coordinate Tk threading with wx/gtk. The tk support is very
835 platform dependent, since it seems to require Tcl and Tk to be
840 platform dependent, since it seems to require Tcl and Tk to be
836 built with threads (Fedora1/2 appears NOT to have it, but in
841 built with threads (Fedora1/2 appears NOT to have it, but in
837 Prabhu's Debian boxes it works OK). But even with some Tk
842 Prabhu's Debian boxes it works OK). But even with some Tk
838 limitations, this is a great improvement.
843 limitations, this is a great improvement.
839
844
840 * IPython/Prompts.py (prompt_specials_color): Added \t for time
845 * IPython/Prompts.py (prompt_specials_color): Added \t for time
841 info in user prompts. Patch by Prabhu.
846 info in user prompts. Patch by Prabhu.
842
847
843 2004-11-18 Fernando Perez <fperez@colorado.edu>
848 2004-11-18 Fernando Perez <fperez@colorado.edu>
844
849
845 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
850 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
846 EOFErrors and bail, to avoid infinite loops if a non-terminating
851 EOFErrors and bail, to avoid infinite loops if a non-terminating
847 file is fed into ipython. Patch submitted in issue 19 by user,
852 file is fed into ipython. Patch submitted in issue 19 by user,
848 many thanks.
853 many thanks.
849
854
850 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
855 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
851 autoquote/parens in continuation prompts, which can cause lots of
856 autoquote/parens in continuation prompts, which can cause lots of
852 problems. Closes roundup issue 20.
857 problems. Closes roundup issue 20.
853
858
854 2004-11-17 Fernando Perez <fperez@colorado.edu>
859 2004-11-17 Fernando Perez <fperez@colorado.edu>
855
860
856 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
861 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
857 reported as debian bug #280505. I'm not sure my local changelog
862 reported as debian bug #280505. I'm not sure my local changelog
858 entry has the proper debian format (Jack?).
863 entry has the proper debian format (Jack?).
859
864
860 2004-11-08 *** Released version 0.6.4
865 2004-11-08 *** Released version 0.6.4
861
866
862 2004-11-08 Fernando Perez <fperez@colorado.edu>
867 2004-11-08 Fernando Perez <fperez@colorado.edu>
863
868
864 * IPython/iplib.py (init_readline): Fix exit message for Windows
869 * IPython/iplib.py (init_readline): Fix exit message for Windows
865 when readline is active. Thanks to a report by Eric Jones
870 when readline is active. Thanks to a report by Eric Jones
866 <eric-AT-enthought.com>.
871 <eric-AT-enthought.com>.
867
872
868 2004-11-07 Fernando Perez <fperez@colorado.edu>
873 2004-11-07 Fernando Perez <fperez@colorado.edu>
869
874
870 * IPython/genutils.py (page): Add a trap for OSError exceptions,
875 * IPython/genutils.py (page): Add a trap for OSError exceptions,
871 sometimes seen by win2k/cygwin users.
876 sometimes seen by win2k/cygwin users.
872
877
873 2004-11-06 Fernando Perez <fperez@colorado.edu>
878 2004-11-06 Fernando Perez <fperez@colorado.edu>
874
879
875 * IPython/iplib.py (interact): Change the handling of %Exit from
880 * IPython/iplib.py (interact): Change the handling of %Exit from
876 trying to propagate a SystemExit to an internal ipython flag.
881 trying to propagate a SystemExit to an internal ipython flag.
877 This is less elegant than using Python's exception mechanism, but
882 This is less elegant than using Python's exception mechanism, but
878 I can't get that to work reliably with threads, so under -pylab
883 I can't get that to work reliably with threads, so under -pylab
879 %Exit was hanging IPython. Cross-thread exception handling is
884 %Exit was hanging IPython. Cross-thread exception handling is
880 really a bitch. Thaks to a bug report by Stephen Walton
885 really a bitch. Thaks to a bug report by Stephen Walton
881 <stephen.walton-AT-csun.edu>.
886 <stephen.walton-AT-csun.edu>.
882
887
883 2004-11-04 Fernando Perez <fperez@colorado.edu>
888 2004-11-04 Fernando Perez <fperez@colorado.edu>
884
889
885 * IPython/iplib.py (raw_input_original): store a pointer to the
890 * IPython/iplib.py (raw_input_original): store a pointer to the
886 true raw_input to harden against code which can modify it
891 true raw_input to harden against code which can modify it
887 (wx.py.PyShell does this and would otherwise crash ipython).
892 (wx.py.PyShell does this and would otherwise crash ipython).
888 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
893 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
889
894
890 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
895 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
891 Ctrl-C problem, which does not mess up the input line.
896 Ctrl-C problem, which does not mess up the input line.
892
897
893 2004-11-03 Fernando Perez <fperez@colorado.edu>
898 2004-11-03 Fernando Perez <fperez@colorado.edu>
894
899
895 * IPython/Release.py: Changed licensing to BSD, in all files.
900 * IPython/Release.py: Changed licensing to BSD, in all files.
896 (name): lowercase name for tarball/RPM release.
901 (name): lowercase name for tarball/RPM release.
897
902
898 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
903 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
899 use throughout ipython.
904 use throughout ipython.
900
905
901 * IPython/Magic.py (Magic._ofind): Switch to using the new
906 * IPython/Magic.py (Magic._ofind): Switch to using the new
902 OInspect.getdoc() function.
907 OInspect.getdoc() function.
903
908
904 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
909 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
905 of the line currently being canceled via Ctrl-C. It's extremely
910 of the line currently being canceled via Ctrl-C. It's extremely
906 ugly, but I don't know how to do it better (the problem is one of
911 ugly, but I don't know how to do it better (the problem is one of
907 handling cross-thread exceptions).
912 handling cross-thread exceptions).
908
913
909 2004-10-28 Fernando Perez <fperez@colorado.edu>
914 2004-10-28 Fernando Perez <fperez@colorado.edu>
910
915
911 * IPython/Shell.py (signal_handler): add signal handlers to trap
916 * IPython/Shell.py (signal_handler): add signal handlers to trap
912 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
917 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
913 report by Francesc Alted.
918 report by Francesc Alted.
914
919
915 2004-10-21 Fernando Perez <fperez@colorado.edu>
920 2004-10-21 Fernando Perez <fperez@colorado.edu>
916
921
917 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
922 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
918 to % for pysh syntax extensions.
923 to % for pysh syntax extensions.
919
924
920 2004-10-09 Fernando Perez <fperez@colorado.edu>
925 2004-10-09 Fernando Perez <fperez@colorado.edu>
921
926
922 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
927 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
923 arrays to print a more useful summary, without calling str(arr).
928 arrays to print a more useful summary, without calling str(arr).
924 This avoids the problem of extremely lengthy computations which
929 This avoids the problem of extremely lengthy computations which
925 occur if arr is large, and appear to the user as a system lockup
930 occur if arr is large, and appear to the user as a system lockup
926 with 100% cpu activity. After a suggestion by Kristian Sandberg
931 with 100% cpu activity. After a suggestion by Kristian Sandberg
927 <Kristian.Sandberg@colorado.edu>.
932 <Kristian.Sandberg@colorado.edu>.
928 (Magic.__init__): fix bug in global magic escapes not being
933 (Magic.__init__): fix bug in global magic escapes not being
929 correctly set.
934 correctly set.
930
935
931 2004-10-08 Fernando Perez <fperez@colorado.edu>
936 2004-10-08 Fernando Perez <fperez@colorado.edu>
932
937
933 * IPython/Magic.py (__license__): change to absolute imports of
938 * IPython/Magic.py (__license__): change to absolute imports of
934 ipython's own internal packages, to start adapting to the absolute
939 ipython's own internal packages, to start adapting to the absolute
935 import requirement of PEP-328.
940 import requirement of PEP-328.
936
941
937 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
942 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
938 files, and standardize author/license marks through the Release
943 files, and standardize author/license marks through the Release
939 module instead of having per/file stuff (except for files with
944 module instead of having per/file stuff (except for files with
940 particular licenses, like the MIT/PSF-licensed codes).
945 particular licenses, like the MIT/PSF-licensed codes).
941
946
942 * IPython/Debugger.py: remove dead code for python 2.1
947 * IPython/Debugger.py: remove dead code for python 2.1
943
948
944 2004-10-04 Fernando Perez <fperez@colorado.edu>
949 2004-10-04 Fernando Perez <fperez@colorado.edu>
945
950
946 * IPython/iplib.py (ipmagic): New function for accessing magics
951 * IPython/iplib.py (ipmagic): New function for accessing magics
947 via a normal python function call.
952 via a normal python function call.
948
953
949 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
954 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
950 from '@' to '%', to accomodate the new @decorator syntax of python
955 from '@' to '%', to accomodate the new @decorator syntax of python
951 2.4.
956 2.4.
952
957
953 2004-09-29 Fernando Perez <fperez@colorado.edu>
958 2004-09-29 Fernando Perez <fperez@colorado.edu>
954
959
955 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
960 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
956 matplotlib.use to prevent running scripts which try to switch
961 matplotlib.use to prevent running scripts which try to switch
957 interactive backends from within ipython. This will just crash
962 interactive backends from within ipython. This will just crash
958 the python interpreter, so we can't allow it (but a detailed error
963 the python interpreter, so we can't allow it (but a detailed error
959 is given to the user).
964 is given to the user).
960
965
961 2004-09-28 Fernando Perez <fperez@colorado.edu>
966 2004-09-28 Fernando Perez <fperez@colorado.edu>
962
967
963 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
968 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
964 matplotlib-related fixes so that using @run with non-matplotlib
969 matplotlib-related fixes so that using @run with non-matplotlib
965 scripts doesn't pop up spurious plot windows. This requires
970 scripts doesn't pop up spurious plot windows. This requires
966 matplotlib >= 0.63, where I had to make some changes as well.
971 matplotlib >= 0.63, where I had to make some changes as well.
967
972
968 * IPython/ipmaker.py (make_IPython): update version requirement to
973 * IPython/ipmaker.py (make_IPython): update version requirement to
969 python 2.2.
974 python 2.2.
970
975
971 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
976 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
972 banner arg for embedded customization.
977 banner arg for embedded customization.
973
978
974 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
979 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
975 explicit uses of __IP as the IPython's instance name. Now things
980 explicit uses of __IP as the IPython's instance name. Now things
976 are properly handled via the shell.name value. The actual code
981 are properly handled via the shell.name value. The actual code
977 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
982 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
978 is much better than before. I'll clean things completely when the
983 is much better than before. I'll clean things completely when the
979 magic stuff gets a real overhaul.
984 magic stuff gets a real overhaul.
980
985
981 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
986 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
982 minor changes to debian dir.
987 minor changes to debian dir.
983
988
984 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
989 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
985 pointer to the shell itself in the interactive namespace even when
990 pointer to the shell itself in the interactive namespace even when
986 a user-supplied dict is provided. This is needed for embedding
991 a user-supplied dict is provided. This is needed for embedding
987 purposes (found by tests with Michel Sanner).
992 purposes (found by tests with Michel Sanner).
988
993
989 2004-09-27 Fernando Perez <fperez@colorado.edu>
994 2004-09-27 Fernando Perez <fperez@colorado.edu>
990
995
991 * IPython/UserConfig/ipythonrc: remove []{} from
996 * IPython/UserConfig/ipythonrc: remove []{} from
992 readline_remove_delims, so that things like [modname.<TAB> do
997 readline_remove_delims, so that things like [modname.<TAB> do
993 proper completion. This disables [].TAB, but that's a less common
998 proper completion. This disables [].TAB, but that's a less common
994 case than module names in list comprehensions, for example.
999 case than module names in list comprehensions, for example.
995 Thanks to a report by Andrea Riciputi.
1000 Thanks to a report by Andrea Riciputi.
996
1001
997 2004-09-09 Fernando Perez <fperez@colorado.edu>
1002 2004-09-09 Fernando Perez <fperez@colorado.edu>
998
1003
999 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1004 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1000 blocking problems in win32 and osx. Fix by John.
1005 blocking problems in win32 and osx. Fix by John.
1001
1006
1002 2004-09-08 Fernando Perez <fperez@colorado.edu>
1007 2004-09-08 Fernando Perez <fperez@colorado.edu>
1003
1008
1004 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1009 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1005 for Win32 and OSX. Fix by John Hunter.
1010 for Win32 and OSX. Fix by John Hunter.
1006
1011
1007 2004-08-30 *** Released version 0.6.3
1012 2004-08-30 *** Released version 0.6.3
1008
1013
1009 2004-08-30 Fernando Perez <fperez@colorado.edu>
1014 2004-08-30 Fernando Perez <fperez@colorado.edu>
1010
1015
1011 * setup.py (isfile): Add manpages to list of dependent files to be
1016 * setup.py (isfile): Add manpages to list of dependent files to be
1012 updated.
1017 updated.
1013
1018
1014 2004-08-27 Fernando Perez <fperez@colorado.edu>
1019 2004-08-27 Fernando Perez <fperez@colorado.edu>
1015
1020
1016 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1021 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1017 for now. They don't really work with standalone WX/GTK code
1022 for now. They don't really work with standalone WX/GTK code
1018 (though matplotlib IS working fine with both of those backends).
1023 (though matplotlib IS working fine with both of those backends).
1019 This will neeed much more testing. I disabled most things with
1024 This will neeed much more testing. I disabled most things with
1020 comments, so turning it back on later should be pretty easy.
1025 comments, so turning it back on later should be pretty easy.
1021
1026
1022 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1027 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1023 autocalling of expressions like r'foo', by modifying the line
1028 autocalling of expressions like r'foo', by modifying the line
1024 split regexp. Closes
1029 split regexp. Closes
1025 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1030 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1026 Riley <ipythonbugs-AT-sabi.net>.
1031 Riley <ipythonbugs-AT-sabi.net>.
1027 (InteractiveShell.mainloop): honor --nobanner with banner
1032 (InteractiveShell.mainloop): honor --nobanner with banner
1028 extensions.
1033 extensions.
1029
1034
1030 * IPython/Shell.py: Significant refactoring of all classes, so
1035 * IPython/Shell.py: Significant refactoring of all classes, so
1031 that we can really support ALL matplotlib backends and threading
1036 that we can really support ALL matplotlib backends and threading
1032 models (John spotted a bug with Tk which required this). Now we
1037 models (John spotted a bug with Tk which required this). Now we
1033 should support single-threaded, WX-threads and GTK-threads, both
1038 should support single-threaded, WX-threads and GTK-threads, both
1034 for generic code and for matplotlib.
1039 for generic code and for matplotlib.
1035
1040
1036 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1041 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1037 -pylab, to simplify things for users. Will also remove the pylab
1042 -pylab, to simplify things for users. Will also remove the pylab
1038 profile, since now all of matplotlib configuration is directly
1043 profile, since now all of matplotlib configuration is directly
1039 handled here. This also reduces startup time.
1044 handled here. This also reduces startup time.
1040
1045
1041 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1046 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1042 shell wasn't being correctly called. Also in IPShellWX.
1047 shell wasn't being correctly called. Also in IPShellWX.
1043
1048
1044 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1049 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1045 fine-tune banner.
1050 fine-tune banner.
1046
1051
1047 * IPython/numutils.py (spike): Deprecate these spike functions,
1052 * IPython/numutils.py (spike): Deprecate these spike functions,
1048 delete (long deprecated) gnuplot_exec handler.
1053 delete (long deprecated) gnuplot_exec handler.
1049
1054
1050 2004-08-26 Fernando Perez <fperez@colorado.edu>
1055 2004-08-26 Fernando Perez <fperez@colorado.edu>
1051
1056
1052 * ipython.1: Update for threading options, plus some others which
1057 * ipython.1: Update for threading options, plus some others which
1053 were missing.
1058 were missing.
1054
1059
1055 * IPython/ipmaker.py (__call__): Added -wthread option for
1060 * IPython/ipmaker.py (__call__): Added -wthread option for
1056 wxpython thread handling. Make sure threading options are only
1061 wxpython thread handling. Make sure threading options are only
1057 valid at the command line.
1062 valid at the command line.
1058
1063
1059 * scripts/ipython: moved shell selection into a factory function
1064 * scripts/ipython: moved shell selection into a factory function
1060 in Shell.py, to keep the starter script to a minimum.
1065 in Shell.py, to keep the starter script to a minimum.
1061
1066
1062 2004-08-25 Fernando Perez <fperez@colorado.edu>
1067 2004-08-25 Fernando Perez <fperez@colorado.edu>
1063
1068
1064 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1069 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1065 John. Along with some recent changes he made to matplotlib, the
1070 John. Along with some recent changes he made to matplotlib, the
1066 next versions of both systems should work very well together.
1071 next versions of both systems should work very well together.
1067
1072
1068 2004-08-24 Fernando Perez <fperez@colorado.edu>
1073 2004-08-24 Fernando Perez <fperez@colorado.edu>
1069
1074
1070 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1075 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1071 tried to switch the profiling to using hotshot, but I'm getting
1076 tried to switch the profiling to using hotshot, but I'm getting
1072 strange errors from prof.runctx() there. I may be misreading the
1077 strange errors from prof.runctx() there. I may be misreading the
1073 docs, but it looks weird. For now the profiling code will
1078 docs, but it looks weird. For now the profiling code will
1074 continue to use the standard profiler.
1079 continue to use the standard profiler.
1075
1080
1076 2004-08-23 Fernando Perez <fperez@colorado.edu>
1081 2004-08-23 Fernando Perez <fperez@colorado.edu>
1077
1082
1078 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1083 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1079 threaded shell, by John Hunter. It's not quite ready yet, but
1084 threaded shell, by John Hunter. It's not quite ready yet, but
1080 close.
1085 close.
1081
1086
1082 2004-08-22 Fernando Perez <fperez@colorado.edu>
1087 2004-08-22 Fernando Perez <fperez@colorado.edu>
1083
1088
1084 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1089 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1085 in Magic and ultraTB.
1090 in Magic and ultraTB.
1086
1091
1087 * ipython.1: document threading options in manpage.
1092 * ipython.1: document threading options in manpage.
1088
1093
1089 * scripts/ipython: Changed name of -thread option to -gthread,
1094 * scripts/ipython: Changed name of -thread option to -gthread,
1090 since this is GTK specific. I want to leave the door open for a
1095 since this is GTK specific. I want to leave the door open for a
1091 -wthread option for WX, which will most likely be necessary. This
1096 -wthread option for WX, which will most likely be necessary. This
1092 change affects usage and ipmaker as well.
1097 change affects usage and ipmaker as well.
1093
1098
1094 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1099 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1095 handle the matplotlib shell issues. Code by John Hunter
1100 handle the matplotlib shell issues. Code by John Hunter
1096 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1101 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1097 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1102 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1098 broken (and disabled for end users) for now, but it puts the
1103 broken (and disabled for end users) for now, but it puts the
1099 infrastructure in place.
1104 infrastructure in place.
1100
1105
1101 2004-08-21 Fernando Perez <fperez@colorado.edu>
1106 2004-08-21 Fernando Perez <fperez@colorado.edu>
1102
1107
1103 * ipythonrc-pylab: Add matplotlib support.
1108 * ipythonrc-pylab: Add matplotlib support.
1104
1109
1105 * matplotlib_config.py: new files for matplotlib support, part of
1110 * matplotlib_config.py: new files for matplotlib support, part of
1106 the pylab profile.
1111 the pylab profile.
1107
1112
1108 * IPython/usage.py (__doc__): documented the threading options.
1113 * IPython/usage.py (__doc__): documented the threading options.
1109
1114
1110 2004-08-20 Fernando Perez <fperez@colorado.edu>
1115 2004-08-20 Fernando Perez <fperez@colorado.edu>
1111
1116
1112 * ipython: Modified the main calling routine to handle the -thread
1117 * ipython: Modified the main calling routine to handle the -thread
1113 and -mpthread options. This needs to be done as a top-level hack,
1118 and -mpthread options. This needs to be done as a top-level hack,
1114 because it determines which class to instantiate for IPython
1119 because it determines which class to instantiate for IPython
1115 itself.
1120 itself.
1116
1121
1117 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1122 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1118 classes to support multithreaded GTK operation without blocking,
1123 classes to support multithreaded GTK operation without blocking,
1119 and matplotlib with all backends. This is a lot of still very
1124 and matplotlib with all backends. This is a lot of still very
1120 experimental code, and threads are tricky. So it may still have a
1125 experimental code, and threads are tricky. So it may still have a
1121 few rough edges... This code owes a lot to
1126 few rough edges... This code owes a lot to
1122 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1127 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1123 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1128 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1124 to John Hunter for all the matplotlib work.
1129 to John Hunter for all the matplotlib work.
1125
1130
1126 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1131 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1127 options for gtk thread and matplotlib support.
1132 options for gtk thread and matplotlib support.
1128
1133
1129 2004-08-16 Fernando Perez <fperez@colorado.edu>
1134 2004-08-16 Fernando Perez <fperez@colorado.edu>
1130
1135
1131 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1136 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1132 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1137 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1133 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1138 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1134
1139
1135 2004-08-11 Fernando Perez <fperez@colorado.edu>
1140 2004-08-11 Fernando Perez <fperez@colorado.edu>
1136
1141
1137 * setup.py (isfile): Fix build so documentation gets updated for
1142 * setup.py (isfile): Fix build so documentation gets updated for
1138 rpms (it was only done for .tgz builds).
1143 rpms (it was only done for .tgz builds).
1139
1144
1140 2004-08-10 Fernando Perez <fperez@colorado.edu>
1145 2004-08-10 Fernando Perez <fperez@colorado.edu>
1141
1146
1142 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1147 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1143
1148
1144 * iplib.py : Silence syntax error exceptions in tab-completion.
1149 * iplib.py : Silence syntax error exceptions in tab-completion.
1145
1150
1146 2004-08-05 Fernando Perez <fperez@colorado.edu>
1151 2004-08-05 Fernando Perez <fperez@colorado.edu>
1147
1152
1148 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1153 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1149 'color off' mark for continuation prompts. This was causing long
1154 'color off' mark for continuation prompts. This was causing long
1150 continuation lines to mis-wrap.
1155 continuation lines to mis-wrap.
1151
1156
1152 2004-08-01 Fernando Perez <fperez@colorado.edu>
1157 2004-08-01 Fernando Perez <fperez@colorado.edu>
1153
1158
1154 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1159 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1155 for building ipython to be a parameter. All this is necessary
1160 for building ipython to be a parameter. All this is necessary
1156 right now to have a multithreaded version, but this insane
1161 right now to have a multithreaded version, but this insane
1157 non-design will be cleaned up soon. For now, it's a hack that
1162 non-design will be cleaned up soon. For now, it's a hack that
1158 works.
1163 works.
1159
1164
1160 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1165 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1161 args in various places. No bugs so far, but it's a dangerous
1166 args in various places. No bugs so far, but it's a dangerous
1162 practice.
1167 practice.
1163
1168
1164 2004-07-31 Fernando Perez <fperez@colorado.edu>
1169 2004-07-31 Fernando Perez <fperez@colorado.edu>
1165
1170
1166 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1171 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1167 fix completion of files with dots in their names under most
1172 fix completion of files with dots in their names under most
1168 profiles (pysh was OK because the completion order is different).
1173 profiles (pysh was OK because the completion order is different).
1169
1174
1170 2004-07-27 Fernando Perez <fperez@colorado.edu>
1175 2004-07-27 Fernando Perez <fperez@colorado.edu>
1171
1176
1172 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1177 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1173 keywords manually, b/c the one in keyword.py was removed in python
1178 keywords manually, b/c the one in keyword.py was removed in python
1174 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1179 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1175 This is NOT a bug under python 2.3 and earlier.
1180 This is NOT a bug under python 2.3 and earlier.
1176
1181
1177 2004-07-26 Fernando Perez <fperez@colorado.edu>
1182 2004-07-26 Fernando Perez <fperez@colorado.edu>
1178
1183
1179 * IPython/ultraTB.py (VerboseTB.text): Add another
1184 * IPython/ultraTB.py (VerboseTB.text): Add another
1180 linecache.checkcache() call to try to prevent inspect.py from
1185 linecache.checkcache() call to try to prevent inspect.py from
1181 crashing under python 2.3. I think this fixes
1186 crashing under python 2.3. I think this fixes
1182 http://www.scipy.net/roundup/ipython/issue17.
1187 http://www.scipy.net/roundup/ipython/issue17.
1183
1188
1184 2004-07-26 *** Released version 0.6.2
1189 2004-07-26 *** Released version 0.6.2
1185
1190
1186 2004-07-26 Fernando Perez <fperez@colorado.edu>
1191 2004-07-26 Fernando Perez <fperez@colorado.edu>
1187
1192
1188 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1193 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1189 fail for any number.
1194 fail for any number.
1190 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1195 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1191 empty bookmarks.
1196 empty bookmarks.
1192
1197
1193 2004-07-26 *** Released version 0.6.1
1198 2004-07-26 *** Released version 0.6.1
1194
1199
1195 2004-07-26 Fernando Perez <fperez@colorado.edu>
1200 2004-07-26 Fernando Perez <fperez@colorado.edu>
1196
1201
1197 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1202 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1198
1203
1199 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1204 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1200 escaping '()[]{}' in filenames.
1205 escaping '()[]{}' in filenames.
1201
1206
1202 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1207 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1203 Python 2.2 users who lack a proper shlex.split.
1208 Python 2.2 users who lack a proper shlex.split.
1204
1209
1205 2004-07-19 Fernando Perez <fperez@colorado.edu>
1210 2004-07-19 Fernando Perez <fperez@colorado.edu>
1206
1211
1207 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1212 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1208 for reading readline's init file. I follow the normal chain:
1213 for reading readline's init file. I follow the normal chain:
1209 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1214 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1210 report by Mike Heeter. This closes
1215 report by Mike Heeter. This closes
1211 http://www.scipy.net/roundup/ipython/issue16.
1216 http://www.scipy.net/roundup/ipython/issue16.
1212
1217
1213 2004-07-18 Fernando Perez <fperez@colorado.edu>
1218 2004-07-18 Fernando Perez <fperez@colorado.edu>
1214
1219
1215 * IPython/iplib.py (__init__): Add better handling of '\' under
1220 * IPython/iplib.py (__init__): Add better handling of '\' under
1216 Win32 for filenames. After a patch by Ville.
1221 Win32 for filenames. After a patch by Ville.
1217
1222
1218 2004-07-17 Fernando Perez <fperez@colorado.edu>
1223 2004-07-17 Fernando Perez <fperez@colorado.edu>
1219
1224
1220 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1225 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1221 autocalling would be triggered for 'foo is bar' if foo is
1226 autocalling would be triggered for 'foo is bar' if foo is
1222 callable. I also cleaned up the autocall detection code to use a
1227 callable. I also cleaned up the autocall detection code to use a
1223 regexp, which is faster. Bug reported by Alexander Schmolck.
1228 regexp, which is faster. Bug reported by Alexander Schmolck.
1224
1229
1225 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1230 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1226 '?' in them would confuse the help system. Reported by Alex
1231 '?' in them would confuse the help system. Reported by Alex
1227 Schmolck.
1232 Schmolck.
1228
1233
1229 2004-07-16 Fernando Perez <fperez@colorado.edu>
1234 2004-07-16 Fernando Perez <fperez@colorado.edu>
1230
1235
1231 * IPython/GnuplotInteractive.py (__all__): added plot2.
1236 * IPython/GnuplotInteractive.py (__all__): added plot2.
1232
1237
1233 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1238 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1234 plotting dictionaries, lists or tuples of 1d arrays.
1239 plotting dictionaries, lists or tuples of 1d arrays.
1235
1240
1236 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1241 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1237 optimizations.
1242 optimizations.
1238
1243
1239 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1244 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1240 the information which was there from Janko's original IPP code:
1245 the information which was there from Janko's original IPP code:
1241
1246
1242 03.05.99 20:53 porto.ifm.uni-kiel.de
1247 03.05.99 20:53 porto.ifm.uni-kiel.de
1243 --Started changelog.
1248 --Started changelog.
1244 --make clear do what it say it does
1249 --make clear do what it say it does
1245 --added pretty output of lines from inputcache
1250 --added pretty output of lines from inputcache
1246 --Made Logger a mixin class, simplifies handling of switches
1251 --Made Logger a mixin class, simplifies handling of switches
1247 --Added own completer class. .string<TAB> expands to last history
1252 --Added own completer class. .string<TAB> expands to last history
1248 line which starts with string. The new expansion is also present
1253 line which starts with string. The new expansion is also present
1249 with Ctrl-r from the readline library. But this shows, who this
1254 with Ctrl-r from the readline library. But this shows, who this
1250 can be done for other cases.
1255 can be done for other cases.
1251 --Added convention that all shell functions should accept a
1256 --Added convention that all shell functions should accept a
1252 parameter_string This opens the door for different behaviour for
1257 parameter_string This opens the door for different behaviour for
1253 each function. @cd is a good example of this.
1258 each function. @cd is a good example of this.
1254
1259
1255 04.05.99 12:12 porto.ifm.uni-kiel.de
1260 04.05.99 12:12 porto.ifm.uni-kiel.de
1256 --added logfile rotation
1261 --added logfile rotation
1257 --added new mainloop method which freezes first the namespace
1262 --added new mainloop method which freezes first the namespace
1258
1263
1259 07.05.99 21:24 porto.ifm.uni-kiel.de
1264 07.05.99 21:24 porto.ifm.uni-kiel.de
1260 --added the docreader classes. Now there is a help system.
1265 --added the docreader classes. Now there is a help system.
1261 -This is only a first try. Currently it's not easy to put new
1266 -This is only a first try. Currently it's not easy to put new
1262 stuff in the indices. But this is the way to go. Info would be
1267 stuff in the indices. But this is the way to go. Info would be
1263 better, but HTML is every where and not everybody has an info
1268 better, but HTML is every where and not everybody has an info
1264 system installed and it's not so easy to change html-docs to info.
1269 system installed and it's not so easy to change html-docs to info.
1265 --added global logfile option
1270 --added global logfile option
1266 --there is now a hook for object inspection method pinfo needs to
1271 --there is now a hook for object inspection method pinfo needs to
1267 be provided for this. Can be reached by two '??'.
1272 be provided for this. Can be reached by two '??'.
1268
1273
1269 08.05.99 20:51 porto.ifm.uni-kiel.de
1274 08.05.99 20:51 porto.ifm.uni-kiel.de
1270 --added a README
1275 --added a README
1271 --bug in rc file. Something has changed so functions in the rc
1276 --bug in rc file. Something has changed so functions in the rc
1272 file need to reference the shell and not self. Not clear if it's a
1277 file need to reference the shell and not self. Not clear if it's a
1273 bug or feature.
1278 bug or feature.
1274 --changed rc file for new behavior
1279 --changed rc file for new behavior
1275
1280
1276 2004-07-15 Fernando Perez <fperez@colorado.edu>
1281 2004-07-15 Fernando Perez <fperez@colorado.edu>
1277
1282
1278 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1283 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1279 cache was falling out of sync in bizarre manners when multi-line
1284 cache was falling out of sync in bizarre manners when multi-line
1280 input was present. Minor optimizations and cleanup.
1285 input was present. Minor optimizations and cleanup.
1281
1286
1282 (Logger): Remove old Changelog info for cleanup. This is the
1287 (Logger): Remove old Changelog info for cleanup. This is the
1283 information which was there from Janko's original code:
1288 information which was there from Janko's original code:
1284
1289
1285 Changes to Logger: - made the default log filename a parameter
1290 Changes to Logger: - made the default log filename a parameter
1286
1291
1287 - put a check for lines beginning with !@? in log(). Needed
1292 - put a check for lines beginning with !@? in log(). Needed
1288 (even if the handlers properly log their lines) for mid-session
1293 (even if the handlers properly log their lines) for mid-session
1289 logging activation to work properly. Without this, lines logged
1294 logging activation to work properly. Without this, lines logged
1290 in mid session, which get read from the cache, would end up
1295 in mid session, which get read from the cache, would end up
1291 'bare' (with !@? in the open) in the log. Now they are caught
1296 'bare' (with !@? in the open) in the log. Now they are caught
1292 and prepended with a #.
1297 and prepended with a #.
1293
1298
1294 * IPython/iplib.py (InteractiveShell.init_readline): added check
1299 * IPython/iplib.py (InteractiveShell.init_readline): added check
1295 in case MagicCompleter fails to be defined, so we don't crash.
1300 in case MagicCompleter fails to be defined, so we don't crash.
1296
1301
1297 2004-07-13 Fernando Perez <fperez@colorado.edu>
1302 2004-07-13 Fernando Perez <fperez@colorado.edu>
1298
1303
1299 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1304 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1300 of EPS if the requested filename ends in '.eps'.
1305 of EPS if the requested filename ends in '.eps'.
1301
1306
1302 2004-07-04 Fernando Perez <fperez@colorado.edu>
1307 2004-07-04 Fernando Perez <fperez@colorado.edu>
1303
1308
1304 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1309 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1305 escaping of quotes when calling the shell.
1310 escaping of quotes when calling the shell.
1306
1311
1307 2004-07-02 Fernando Perez <fperez@colorado.edu>
1312 2004-07-02 Fernando Perez <fperez@colorado.edu>
1308
1313
1309 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1314 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1310 gettext not working because we were clobbering '_'. Fixes
1315 gettext not working because we were clobbering '_'. Fixes
1311 http://www.scipy.net/roundup/ipython/issue6.
1316 http://www.scipy.net/roundup/ipython/issue6.
1312
1317
1313 2004-07-01 Fernando Perez <fperez@colorado.edu>
1318 2004-07-01 Fernando Perez <fperez@colorado.edu>
1314
1319
1315 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1320 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1316 into @cd. Patch by Ville.
1321 into @cd. Patch by Ville.
1317
1322
1318 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1323 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1319 new function to store things after ipmaker runs. Patch by Ville.
1324 new function to store things after ipmaker runs. Patch by Ville.
1320 Eventually this will go away once ipmaker is removed and the class
1325 Eventually this will go away once ipmaker is removed and the class
1321 gets cleaned up, but for now it's ok. Key functionality here is
1326 gets cleaned up, but for now it's ok. Key functionality here is
1322 the addition of the persistent storage mechanism, a dict for
1327 the addition of the persistent storage mechanism, a dict for
1323 keeping data across sessions (for now just bookmarks, but more can
1328 keeping data across sessions (for now just bookmarks, but more can
1324 be implemented later).
1329 be implemented later).
1325
1330
1326 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1331 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1327 persistent across sections. Patch by Ville, I modified it
1332 persistent across sections. Patch by Ville, I modified it
1328 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1333 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1329 added a '-l' option to list all bookmarks.
1334 added a '-l' option to list all bookmarks.
1330
1335
1331 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1336 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1332 center for cleanup. Registered with atexit.register(). I moved
1337 center for cleanup. Registered with atexit.register(). I moved
1333 here the old exit_cleanup(). After a patch by Ville.
1338 here the old exit_cleanup(). After a patch by Ville.
1334
1339
1335 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1340 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1336 characters in the hacked shlex_split for python 2.2.
1341 characters in the hacked shlex_split for python 2.2.
1337
1342
1338 * IPython/iplib.py (file_matches): more fixes to filenames with
1343 * IPython/iplib.py (file_matches): more fixes to filenames with
1339 whitespace in them. It's not perfect, but limitations in python's
1344 whitespace in them. It's not perfect, but limitations in python's
1340 readline make it impossible to go further.
1345 readline make it impossible to go further.
1341
1346
1342 2004-06-29 Fernando Perez <fperez@colorado.edu>
1347 2004-06-29 Fernando Perez <fperez@colorado.edu>
1343
1348
1344 * IPython/iplib.py (file_matches): escape whitespace correctly in
1349 * IPython/iplib.py (file_matches): escape whitespace correctly in
1345 filename completions. Bug reported by Ville.
1350 filename completions. Bug reported by Ville.
1346
1351
1347 2004-06-28 Fernando Perez <fperez@colorado.edu>
1352 2004-06-28 Fernando Perez <fperez@colorado.edu>
1348
1353
1349 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1354 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1350 the history file will be called 'history-PROFNAME' (or just
1355 the history file will be called 'history-PROFNAME' (or just
1351 'history' if no profile is loaded). I was getting annoyed at
1356 'history' if no profile is loaded). I was getting annoyed at
1352 getting my Numerical work history clobbered by pysh sessions.
1357 getting my Numerical work history clobbered by pysh sessions.
1353
1358
1354 * IPython/iplib.py (InteractiveShell.__init__): Internal
1359 * IPython/iplib.py (InteractiveShell.__init__): Internal
1355 getoutputerror() function so that we can honor the system_verbose
1360 getoutputerror() function so that we can honor the system_verbose
1356 flag for _all_ system calls. I also added escaping of #
1361 flag for _all_ system calls. I also added escaping of #
1357 characters here to avoid confusing Itpl.
1362 characters here to avoid confusing Itpl.
1358
1363
1359 * IPython/Magic.py (shlex_split): removed call to shell in
1364 * IPython/Magic.py (shlex_split): removed call to shell in
1360 parse_options and replaced it with shlex.split(). The annoying
1365 parse_options and replaced it with shlex.split(). The annoying
1361 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1366 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1362 to backport it from 2.3, with several frail hacks (the shlex
1367 to backport it from 2.3, with several frail hacks (the shlex
1363 module is rather limited in 2.2). Thanks to a suggestion by Ville
1368 module is rather limited in 2.2). Thanks to a suggestion by Ville
1364 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1369 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1365 problem.
1370 problem.
1366
1371
1367 (Magic.magic_system_verbose): new toggle to print the actual
1372 (Magic.magic_system_verbose): new toggle to print the actual
1368 system calls made by ipython. Mainly for debugging purposes.
1373 system calls made by ipython. Mainly for debugging purposes.
1369
1374
1370 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1375 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1371 doesn't support persistence. Reported (and fix suggested) by
1376 doesn't support persistence. Reported (and fix suggested) by
1372 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1377 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1373
1378
1374 2004-06-26 Fernando Perez <fperez@colorado.edu>
1379 2004-06-26 Fernando Perez <fperez@colorado.edu>
1375
1380
1376 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1381 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1377 continue prompts.
1382 continue prompts.
1378
1383
1379 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1384 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1380 function (basically a big docstring) and a few more things here to
1385 function (basically a big docstring) and a few more things here to
1381 speedup startup. pysh.py is now very lightweight. We want because
1386 speedup startup. pysh.py is now very lightweight. We want because
1382 it gets execfile'd, while InterpreterExec gets imported, so
1387 it gets execfile'd, while InterpreterExec gets imported, so
1383 byte-compilation saves time.
1388 byte-compilation saves time.
1384
1389
1385 2004-06-25 Fernando Perez <fperez@colorado.edu>
1390 2004-06-25 Fernando Perez <fperez@colorado.edu>
1386
1391
1387 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1392 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1388 -NUM', which was recently broken.
1393 -NUM', which was recently broken.
1389
1394
1390 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1395 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1391 in multi-line input (but not !!, which doesn't make sense there).
1396 in multi-line input (but not !!, which doesn't make sense there).
1392
1397
1393 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1398 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1394 It's just too useful, and people can turn it off in the less
1399 It's just too useful, and people can turn it off in the less
1395 common cases where it's a problem.
1400 common cases where it's a problem.
1396
1401
1397 2004-06-24 Fernando Perez <fperez@colorado.edu>
1402 2004-06-24 Fernando Perez <fperez@colorado.edu>
1398
1403
1399 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1404 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1400 special syntaxes (like alias calling) is now allied in multi-line
1405 special syntaxes (like alias calling) is now allied in multi-line
1401 input. This is still _very_ experimental, but it's necessary for
1406 input. This is still _very_ experimental, but it's necessary for
1402 efficient shell usage combining python looping syntax with system
1407 efficient shell usage combining python looping syntax with system
1403 calls. For now it's restricted to aliases, I don't think it
1408 calls. For now it's restricted to aliases, I don't think it
1404 really even makes sense to have this for magics.
1409 really even makes sense to have this for magics.
1405
1410
1406 2004-06-23 Fernando Perez <fperez@colorado.edu>
1411 2004-06-23 Fernando Perez <fperez@colorado.edu>
1407
1412
1408 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1413 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1409 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1414 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1410
1415
1411 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1416 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1412 extensions under Windows (after code sent by Gary Bishop). The
1417 extensions under Windows (after code sent by Gary Bishop). The
1413 extensions considered 'executable' are stored in IPython's rc
1418 extensions considered 'executable' are stored in IPython's rc
1414 structure as win_exec_ext.
1419 structure as win_exec_ext.
1415
1420
1416 * IPython/genutils.py (shell): new function, like system() but
1421 * IPython/genutils.py (shell): new function, like system() but
1417 without return value. Very useful for interactive shell work.
1422 without return value. Very useful for interactive shell work.
1418
1423
1419 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1424 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1420 delete aliases.
1425 delete aliases.
1421
1426
1422 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1427 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1423 sure that the alias table doesn't contain python keywords.
1428 sure that the alias table doesn't contain python keywords.
1424
1429
1425 2004-06-21 Fernando Perez <fperez@colorado.edu>
1430 2004-06-21 Fernando Perez <fperez@colorado.edu>
1426
1431
1427 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1432 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1428 non-existent items are found in $PATH. Reported by Thorsten.
1433 non-existent items are found in $PATH. Reported by Thorsten.
1429
1434
1430 2004-06-20 Fernando Perez <fperez@colorado.edu>
1435 2004-06-20 Fernando Perez <fperez@colorado.edu>
1431
1436
1432 * IPython/iplib.py (complete): modified the completer so that the
1437 * IPython/iplib.py (complete): modified the completer so that the
1433 order of priorities can be easily changed at runtime.
1438 order of priorities can be easily changed at runtime.
1434
1439
1435 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1440 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1436 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1441 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1437
1442
1438 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1443 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1439 expand Python variables prepended with $ in all system calls. The
1444 expand Python variables prepended with $ in all system calls. The
1440 same was done to InteractiveShell.handle_shell_escape. Now all
1445 same was done to InteractiveShell.handle_shell_escape. Now all
1441 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1446 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1442 expansion of python variables and expressions according to the
1447 expansion of python variables and expressions according to the
1443 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1448 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1444
1449
1445 Though PEP-215 has been rejected, a similar (but simpler) one
1450 Though PEP-215 has been rejected, a similar (but simpler) one
1446 seems like it will go into Python 2.4, PEP-292 -
1451 seems like it will go into Python 2.4, PEP-292 -
1447 http://www.python.org/peps/pep-0292.html.
1452 http://www.python.org/peps/pep-0292.html.
1448
1453
1449 I'll keep the full syntax of PEP-215, since IPython has since the
1454 I'll keep the full syntax of PEP-215, since IPython has since the
1450 start used Ka-Ping Yee's reference implementation discussed there
1455 start used Ka-Ping Yee's reference implementation discussed there
1451 (Itpl), and I actually like the powerful semantics it offers.
1456 (Itpl), and I actually like the powerful semantics it offers.
1452
1457
1453 In order to access normal shell variables, the $ has to be escaped
1458 In order to access normal shell variables, the $ has to be escaped
1454 via an extra $. For example:
1459 via an extra $. For example:
1455
1460
1456 In [7]: PATH='a python variable'
1461 In [7]: PATH='a python variable'
1457
1462
1458 In [8]: !echo $PATH
1463 In [8]: !echo $PATH
1459 a python variable
1464 a python variable
1460
1465
1461 In [9]: !echo $$PATH
1466 In [9]: !echo $$PATH
1462 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1467 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1463
1468
1464 (Magic.parse_options): escape $ so the shell doesn't evaluate
1469 (Magic.parse_options): escape $ so the shell doesn't evaluate
1465 things prematurely.
1470 things prematurely.
1466
1471
1467 * IPython/iplib.py (InteractiveShell.call_alias): added the
1472 * IPython/iplib.py (InteractiveShell.call_alias): added the
1468 ability for aliases to expand python variables via $.
1473 ability for aliases to expand python variables via $.
1469
1474
1470 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1475 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1471 system, now there's a @rehash/@rehashx pair of magics. These work
1476 system, now there's a @rehash/@rehashx pair of magics. These work
1472 like the csh rehash command, and can be invoked at any time. They
1477 like the csh rehash command, and can be invoked at any time. They
1473 build a table of aliases to everything in the user's $PATH
1478 build a table of aliases to everything in the user's $PATH
1474 (@rehash uses everything, @rehashx is slower but only adds
1479 (@rehash uses everything, @rehashx is slower but only adds
1475 executable files). With this, the pysh.py-based shell profile can
1480 executable files). With this, the pysh.py-based shell profile can
1476 now simply call rehash upon startup, and full access to all
1481 now simply call rehash upon startup, and full access to all
1477 programs in the user's path is obtained.
1482 programs in the user's path is obtained.
1478
1483
1479 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1484 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1480 functionality is now fully in place. I removed the old dynamic
1485 functionality is now fully in place. I removed the old dynamic
1481 code generation based approach, in favor of a much lighter one
1486 code generation based approach, in favor of a much lighter one
1482 based on a simple dict. The advantage is that this allows me to
1487 based on a simple dict. The advantage is that this allows me to
1483 now have thousands of aliases with negligible cost (unthinkable
1488 now have thousands of aliases with negligible cost (unthinkable
1484 with the old system).
1489 with the old system).
1485
1490
1486 2004-06-19 Fernando Perez <fperez@colorado.edu>
1491 2004-06-19 Fernando Perez <fperez@colorado.edu>
1487
1492
1488 * IPython/iplib.py (__init__): extended MagicCompleter class to
1493 * IPython/iplib.py (__init__): extended MagicCompleter class to
1489 also complete (last in priority) on user aliases.
1494 also complete (last in priority) on user aliases.
1490
1495
1491 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1496 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1492 call to eval.
1497 call to eval.
1493 (ItplNS.__init__): Added a new class which functions like Itpl,
1498 (ItplNS.__init__): Added a new class which functions like Itpl,
1494 but allows configuring the namespace for the evaluation to occur
1499 but allows configuring the namespace for the evaluation to occur
1495 in.
1500 in.
1496
1501
1497 2004-06-18 Fernando Perez <fperez@colorado.edu>
1502 2004-06-18 Fernando Perez <fperez@colorado.edu>
1498
1503
1499 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1504 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1500 better message when 'exit' or 'quit' are typed (a common newbie
1505 better message when 'exit' or 'quit' are typed (a common newbie
1501 confusion).
1506 confusion).
1502
1507
1503 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1508 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1504 check for Windows users.
1509 check for Windows users.
1505
1510
1506 * IPython/iplib.py (InteractiveShell.user_setup): removed
1511 * IPython/iplib.py (InteractiveShell.user_setup): removed
1507 disabling of colors for Windows. I'll test at runtime and issue a
1512 disabling of colors for Windows. I'll test at runtime and issue a
1508 warning if Gary's readline isn't found, as to nudge users to
1513 warning if Gary's readline isn't found, as to nudge users to
1509 download it.
1514 download it.
1510
1515
1511 2004-06-16 Fernando Perez <fperez@colorado.edu>
1516 2004-06-16 Fernando Perez <fperez@colorado.edu>
1512
1517
1513 * IPython/genutils.py (Stream.__init__): changed to print errors
1518 * IPython/genutils.py (Stream.__init__): changed to print errors
1514 to sys.stderr. I had a circular dependency here. Now it's
1519 to sys.stderr. I had a circular dependency here. Now it's
1515 possible to run ipython as IDLE's shell (consider this pre-alpha,
1520 possible to run ipython as IDLE's shell (consider this pre-alpha,
1516 since true stdout things end up in the starting terminal instead
1521 since true stdout things end up in the starting terminal instead
1517 of IDLE's out).
1522 of IDLE's out).
1518
1523
1519 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1524 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1520 users who haven't # updated their prompt_in2 definitions. Remove
1525 users who haven't # updated their prompt_in2 definitions. Remove
1521 eventually.
1526 eventually.
1522 (multiple_replace): added credit to original ASPN recipe.
1527 (multiple_replace): added credit to original ASPN recipe.
1523
1528
1524 2004-06-15 Fernando Perez <fperez@colorado.edu>
1529 2004-06-15 Fernando Perez <fperez@colorado.edu>
1525
1530
1526 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1531 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1527 list of auto-defined aliases.
1532 list of auto-defined aliases.
1528
1533
1529 2004-06-13 Fernando Perez <fperez@colorado.edu>
1534 2004-06-13 Fernando Perez <fperez@colorado.edu>
1530
1535
1531 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1536 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1532 install was really requested (so setup.py can be used for other
1537 install was really requested (so setup.py can be used for other
1533 things under Windows).
1538 things under Windows).
1534
1539
1535 2004-06-10 Fernando Perez <fperez@colorado.edu>
1540 2004-06-10 Fernando Perez <fperez@colorado.edu>
1536
1541
1537 * IPython/Logger.py (Logger.create_log): Manually remove any old
1542 * IPython/Logger.py (Logger.create_log): Manually remove any old
1538 backup, since os.remove may fail under Windows. Fixes bug
1543 backup, since os.remove may fail under Windows. Fixes bug
1539 reported by Thorsten.
1544 reported by Thorsten.
1540
1545
1541 2004-06-09 Fernando Perez <fperez@colorado.edu>
1546 2004-06-09 Fernando Perez <fperez@colorado.edu>
1542
1547
1543 * examples/example-embed.py: fixed all references to %n (replaced
1548 * examples/example-embed.py: fixed all references to %n (replaced
1544 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1549 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1545 for all examples and the manual as well.
1550 for all examples and the manual as well.
1546
1551
1547 2004-06-08 Fernando Perez <fperez@colorado.edu>
1552 2004-06-08 Fernando Perez <fperez@colorado.edu>
1548
1553
1549 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1554 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1550 alignment and color management. All 3 prompt subsystems now
1555 alignment and color management. All 3 prompt subsystems now
1551 inherit from BasePrompt.
1556 inherit from BasePrompt.
1552
1557
1553 * tools/release: updates for windows installer build and tag rpms
1558 * tools/release: updates for windows installer build and tag rpms
1554 with python version (since paths are fixed).
1559 with python version (since paths are fixed).
1555
1560
1556 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1561 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1557 which will become eventually obsolete. Also fixed the default
1562 which will become eventually obsolete. Also fixed the default
1558 prompt_in2 to use \D, so at least new users start with the correct
1563 prompt_in2 to use \D, so at least new users start with the correct
1559 defaults.
1564 defaults.
1560 WARNING: Users with existing ipythonrc files will need to apply
1565 WARNING: Users with existing ipythonrc files will need to apply
1561 this fix manually!
1566 this fix manually!
1562
1567
1563 * setup.py: make windows installer (.exe). This is finally the
1568 * setup.py: make windows installer (.exe). This is finally the
1564 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1569 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1565 which I hadn't included because it required Python 2.3 (or recent
1570 which I hadn't included because it required Python 2.3 (or recent
1566 distutils).
1571 distutils).
1567
1572
1568 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1573 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1569 usage of new '\D' escape.
1574 usage of new '\D' escape.
1570
1575
1571 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1576 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1572 lacks os.getuid())
1577 lacks os.getuid())
1573 (CachedOutput.set_colors): Added the ability to turn coloring
1578 (CachedOutput.set_colors): Added the ability to turn coloring
1574 on/off with @colors even for manually defined prompt colors. It
1579 on/off with @colors even for manually defined prompt colors. It
1575 uses a nasty global, but it works safely and via the generic color
1580 uses a nasty global, but it works safely and via the generic color
1576 handling mechanism.
1581 handling mechanism.
1577 (Prompt2.__init__): Introduced new escape '\D' for continuation
1582 (Prompt2.__init__): Introduced new escape '\D' for continuation
1578 prompts. It represents the counter ('\#') as dots.
1583 prompts. It represents the counter ('\#') as dots.
1579 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1584 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1580 need to update their ipythonrc files and replace '%n' with '\D' in
1585 need to update their ipythonrc files and replace '%n' with '\D' in
1581 their prompt_in2 settings everywhere. Sorry, but there's
1586 their prompt_in2 settings everywhere. Sorry, but there's
1582 otherwise no clean way to get all prompts to properly align. The
1587 otherwise no clean way to get all prompts to properly align. The
1583 ipythonrc shipped with IPython has been updated.
1588 ipythonrc shipped with IPython has been updated.
1584
1589
1585 2004-06-07 Fernando Perez <fperez@colorado.edu>
1590 2004-06-07 Fernando Perez <fperez@colorado.edu>
1586
1591
1587 * setup.py (isfile): Pass local_icons option to latex2html, so the
1592 * setup.py (isfile): Pass local_icons option to latex2html, so the
1588 resulting HTML file is self-contained. Thanks to
1593 resulting HTML file is self-contained. Thanks to
1589 dryice-AT-liu.com.cn for the tip.
1594 dryice-AT-liu.com.cn for the tip.
1590
1595
1591 * pysh.py: I created a new profile 'shell', which implements a
1596 * pysh.py: I created a new profile 'shell', which implements a
1592 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1597 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1593 system shell, nor will it become one anytime soon. It's mainly
1598 system shell, nor will it become one anytime soon. It's mainly
1594 meant to illustrate the use of the new flexible bash-like prompts.
1599 meant to illustrate the use of the new flexible bash-like prompts.
1595 I guess it could be used by hardy souls for true shell management,
1600 I guess it could be used by hardy souls for true shell management,
1596 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1601 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1597 profile. This uses the InterpreterExec extension provided by
1602 profile. This uses the InterpreterExec extension provided by
1598 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1603 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1599
1604
1600 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1605 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1601 auto-align itself with the length of the previous input prompt
1606 auto-align itself with the length of the previous input prompt
1602 (taking into account the invisible color escapes).
1607 (taking into account the invisible color escapes).
1603 (CachedOutput.__init__): Large restructuring of this class. Now
1608 (CachedOutput.__init__): Large restructuring of this class. Now
1604 all three prompts (primary1, primary2, output) are proper objects,
1609 all three prompts (primary1, primary2, output) are proper objects,
1605 managed by the 'parent' CachedOutput class. The code is still a
1610 managed by the 'parent' CachedOutput class. The code is still a
1606 bit hackish (all prompts share state via a pointer to the cache),
1611 bit hackish (all prompts share state via a pointer to the cache),
1607 but it's overall far cleaner than before.
1612 but it's overall far cleaner than before.
1608
1613
1609 * IPython/genutils.py (getoutputerror): modified to add verbose,
1614 * IPython/genutils.py (getoutputerror): modified to add verbose,
1610 debug and header options. This makes the interface of all getout*
1615 debug and header options. This makes the interface of all getout*
1611 functions uniform.
1616 functions uniform.
1612 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1617 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1613
1618
1614 * IPython/Magic.py (Magic.default_option): added a function to
1619 * IPython/Magic.py (Magic.default_option): added a function to
1615 allow registering default options for any magic command. This
1620 allow registering default options for any magic command. This
1616 makes it easy to have profiles which customize the magics globally
1621 makes it easy to have profiles which customize the magics globally
1617 for a certain use. The values set through this function are
1622 for a certain use. The values set through this function are
1618 picked up by the parse_options() method, which all magics should
1623 picked up by the parse_options() method, which all magics should
1619 use to parse their options.
1624 use to parse their options.
1620
1625
1621 * IPython/genutils.py (warn): modified the warnings framework to
1626 * IPython/genutils.py (warn): modified the warnings framework to
1622 use the Term I/O class. I'm trying to slowly unify all of
1627 use the Term I/O class. I'm trying to slowly unify all of
1623 IPython's I/O operations to pass through Term.
1628 IPython's I/O operations to pass through Term.
1624
1629
1625 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1630 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1626 the secondary prompt to correctly match the length of the primary
1631 the secondary prompt to correctly match the length of the primary
1627 one for any prompt. Now multi-line code will properly line up
1632 one for any prompt. Now multi-line code will properly line up
1628 even for path dependent prompts, such as the new ones available
1633 even for path dependent prompts, such as the new ones available
1629 via the prompt_specials.
1634 via the prompt_specials.
1630
1635
1631 2004-06-06 Fernando Perez <fperez@colorado.edu>
1636 2004-06-06 Fernando Perez <fperez@colorado.edu>
1632
1637
1633 * IPython/Prompts.py (prompt_specials): Added the ability to have
1638 * IPython/Prompts.py (prompt_specials): Added the ability to have
1634 bash-like special sequences in the prompts, which get
1639 bash-like special sequences in the prompts, which get
1635 automatically expanded. Things like hostname, current working
1640 automatically expanded. Things like hostname, current working
1636 directory and username are implemented already, but it's easy to
1641 directory and username are implemented already, but it's easy to
1637 add more in the future. Thanks to a patch by W.J. van der Laan
1642 add more in the future. Thanks to a patch by W.J. van der Laan
1638 <gnufnork-AT-hetdigitalegat.nl>
1643 <gnufnork-AT-hetdigitalegat.nl>
1639 (prompt_specials): Added color support for prompt strings, so
1644 (prompt_specials): Added color support for prompt strings, so
1640 users can define arbitrary color setups for their prompts.
1645 users can define arbitrary color setups for their prompts.
1641
1646
1642 2004-06-05 Fernando Perez <fperez@colorado.edu>
1647 2004-06-05 Fernando Perez <fperez@colorado.edu>
1643
1648
1644 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1649 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1645 code to load Gary Bishop's readline and configure it
1650 code to load Gary Bishop's readline and configure it
1646 automatically. Thanks to Gary for help on this.
1651 automatically. Thanks to Gary for help on this.
1647
1652
1648 2004-06-01 Fernando Perez <fperez@colorado.edu>
1653 2004-06-01 Fernando Perez <fperez@colorado.edu>
1649
1654
1650 * IPython/Logger.py (Logger.create_log): fix bug for logging
1655 * IPython/Logger.py (Logger.create_log): fix bug for logging
1651 with no filename (previous fix was incomplete).
1656 with no filename (previous fix was incomplete).
1652
1657
1653 2004-05-25 Fernando Perez <fperez@colorado.edu>
1658 2004-05-25 Fernando Perez <fperez@colorado.edu>
1654
1659
1655 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1660 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1656 parens would get passed to the shell.
1661 parens would get passed to the shell.
1657
1662
1658 2004-05-20 Fernando Perez <fperez@colorado.edu>
1663 2004-05-20 Fernando Perez <fperez@colorado.edu>
1659
1664
1660 * IPython/Magic.py (Magic.magic_prun): changed default profile
1665 * IPython/Magic.py (Magic.magic_prun): changed default profile
1661 sort order to 'time' (the more common profiling need).
1666 sort order to 'time' (the more common profiling need).
1662
1667
1663 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1668 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1664 so that source code shown is guaranteed in sync with the file on
1669 so that source code shown is guaranteed in sync with the file on
1665 disk (also changed in psource). Similar fix to the one for
1670 disk (also changed in psource). Similar fix to the one for
1666 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1671 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1667 <yann.ledu-AT-noos.fr>.
1672 <yann.ledu-AT-noos.fr>.
1668
1673
1669 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1674 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1670 with a single option would not be correctly parsed. Closes
1675 with a single option would not be correctly parsed. Closes
1671 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1676 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1672 introduced in 0.6.0 (on 2004-05-06).
1677 introduced in 0.6.0 (on 2004-05-06).
1673
1678
1674 2004-05-13 *** Released version 0.6.0
1679 2004-05-13 *** Released version 0.6.0
1675
1680
1676 2004-05-13 Fernando Perez <fperez@colorado.edu>
1681 2004-05-13 Fernando Perez <fperez@colorado.edu>
1677
1682
1678 * debian/: Added debian/ directory to CVS, so that debian support
1683 * debian/: Added debian/ directory to CVS, so that debian support
1679 is publicly accessible. The debian package is maintained by Jack
1684 is publicly accessible. The debian package is maintained by Jack
1680 Moffit <jack-AT-xiph.org>.
1685 Moffit <jack-AT-xiph.org>.
1681
1686
1682 * Documentation: included the notes about an ipython-based system
1687 * Documentation: included the notes about an ipython-based system
1683 shell (the hypothetical 'pysh') into the new_design.pdf document,
1688 shell (the hypothetical 'pysh') into the new_design.pdf document,
1684 so that these ideas get distributed to users along with the
1689 so that these ideas get distributed to users along with the
1685 official documentation.
1690 official documentation.
1686
1691
1687 2004-05-10 Fernando Perez <fperez@colorado.edu>
1692 2004-05-10 Fernando Perez <fperez@colorado.edu>
1688
1693
1689 * IPython/Logger.py (Logger.create_log): fix recently introduced
1694 * IPython/Logger.py (Logger.create_log): fix recently introduced
1690 bug (misindented line) where logstart would fail when not given an
1695 bug (misindented line) where logstart would fail when not given an
1691 explicit filename.
1696 explicit filename.
1692
1697
1693 2004-05-09 Fernando Perez <fperez@colorado.edu>
1698 2004-05-09 Fernando Perez <fperez@colorado.edu>
1694
1699
1695 * IPython/Magic.py (Magic.parse_options): skip system call when
1700 * IPython/Magic.py (Magic.parse_options): skip system call when
1696 there are no options to look for. Faster, cleaner for the common
1701 there are no options to look for. Faster, cleaner for the common
1697 case.
1702 case.
1698
1703
1699 * Documentation: many updates to the manual: describing Windows
1704 * Documentation: many updates to the manual: describing Windows
1700 support better, Gnuplot updates, credits, misc small stuff. Also
1705 support better, Gnuplot updates, credits, misc small stuff. Also
1701 updated the new_design doc a bit.
1706 updated the new_design doc a bit.
1702
1707
1703 2004-05-06 *** Released version 0.6.0.rc1
1708 2004-05-06 *** Released version 0.6.0.rc1
1704
1709
1705 2004-05-06 Fernando Perez <fperez@colorado.edu>
1710 2004-05-06 Fernando Perez <fperez@colorado.edu>
1706
1711
1707 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1712 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1708 operations to use the vastly more efficient list/''.join() method.
1713 operations to use the vastly more efficient list/''.join() method.
1709 (FormattedTB.text): Fix
1714 (FormattedTB.text): Fix
1710 http://www.scipy.net/roundup/ipython/issue12 - exception source
1715 http://www.scipy.net/roundup/ipython/issue12 - exception source
1711 extract not updated after reload. Thanks to Mike Salib
1716 extract not updated after reload. Thanks to Mike Salib
1712 <msalib-AT-mit.edu> for pinning the source of the problem.
1717 <msalib-AT-mit.edu> for pinning the source of the problem.
1713 Fortunately, the solution works inside ipython and doesn't require
1718 Fortunately, the solution works inside ipython and doesn't require
1714 any changes to python proper.
1719 any changes to python proper.
1715
1720
1716 * IPython/Magic.py (Magic.parse_options): Improved to process the
1721 * IPython/Magic.py (Magic.parse_options): Improved to process the
1717 argument list as a true shell would (by actually using the
1722 argument list as a true shell would (by actually using the
1718 underlying system shell). This way, all @magics automatically get
1723 underlying system shell). This way, all @magics automatically get
1719 shell expansion for variables. Thanks to a comment by Alex
1724 shell expansion for variables. Thanks to a comment by Alex
1720 Schmolck.
1725 Schmolck.
1721
1726
1722 2004-04-04 Fernando Perez <fperez@colorado.edu>
1727 2004-04-04 Fernando Perez <fperez@colorado.edu>
1723
1728
1724 * IPython/iplib.py (InteractiveShell.interact): Added a special
1729 * IPython/iplib.py (InteractiveShell.interact): Added a special
1725 trap for a debugger quit exception, which is basically impossible
1730 trap for a debugger quit exception, which is basically impossible
1726 to handle by normal mechanisms, given what pdb does to the stack.
1731 to handle by normal mechanisms, given what pdb does to the stack.
1727 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1732 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1728
1733
1729 2004-04-03 Fernando Perez <fperez@colorado.edu>
1734 2004-04-03 Fernando Perez <fperez@colorado.edu>
1730
1735
1731 * IPython/genutils.py (Term): Standardized the names of the Term
1736 * IPython/genutils.py (Term): Standardized the names of the Term
1732 class streams to cin/cout/cerr, following C++ naming conventions
1737 class streams to cin/cout/cerr, following C++ naming conventions
1733 (I can't use in/out/err because 'in' is not a valid attribute
1738 (I can't use in/out/err because 'in' is not a valid attribute
1734 name).
1739 name).
1735
1740
1736 * IPython/iplib.py (InteractiveShell.interact): don't increment
1741 * IPython/iplib.py (InteractiveShell.interact): don't increment
1737 the prompt if there's no user input. By Daniel 'Dang' Griffith
1742 the prompt if there's no user input. By Daniel 'Dang' Griffith
1738 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1743 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1739 Francois Pinard.
1744 Francois Pinard.
1740
1745
1741 2004-04-02 Fernando Perez <fperez@colorado.edu>
1746 2004-04-02 Fernando Perez <fperez@colorado.edu>
1742
1747
1743 * IPython/genutils.py (Stream.__init__): Modified to survive at
1748 * IPython/genutils.py (Stream.__init__): Modified to survive at
1744 least importing in contexts where stdin/out/err aren't true file
1749 least importing in contexts where stdin/out/err aren't true file
1745 objects, such as PyCrust (they lack fileno() and mode). However,
1750 objects, such as PyCrust (they lack fileno() and mode). However,
1746 the recovery facilities which rely on these things existing will
1751 the recovery facilities which rely on these things existing will
1747 not work.
1752 not work.
1748
1753
1749 2004-04-01 Fernando Perez <fperez@colorado.edu>
1754 2004-04-01 Fernando Perez <fperez@colorado.edu>
1750
1755
1751 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1756 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1752 use the new getoutputerror() function, so it properly
1757 use the new getoutputerror() function, so it properly
1753 distinguishes stdout/err.
1758 distinguishes stdout/err.
1754
1759
1755 * IPython/genutils.py (getoutputerror): added a function to
1760 * IPython/genutils.py (getoutputerror): added a function to
1756 capture separately the standard output and error of a command.
1761 capture separately the standard output and error of a command.
1757 After a comment from dang on the mailing lists. This code is
1762 After a comment from dang on the mailing lists. This code is
1758 basically a modified version of commands.getstatusoutput(), from
1763 basically a modified version of commands.getstatusoutput(), from
1759 the standard library.
1764 the standard library.
1760
1765
1761 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1766 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1762 '!!' as a special syntax (shorthand) to access @sx.
1767 '!!' as a special syntax (shorthand) to access @sx.
1763
1768
1764 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1769 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1765 command and return its output as a list split on '\n'.
1770 command and return its output as a list split on '\n'.
1766
1771
1767 2004-03-31 Fernando Perez <fperez@colorado.edu>
1772 2004-03-31 Fernando Perez <fperez@colorado.edu>
1768
1773
1769 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1774 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1770 method to dictionaries used as FakeModule instances if they lack
1775 method to dictionaries used as FakeModule instances if they lack
1771 it. At least pydoc in python2.3 breaks for runtime-defined
1776 it. At least pydoc in python2.3 breaks for runtime-defined
1772 functions without this hack. At some point I need to _really_
1777 functions without this hack. At some point I need to _really_
1773 understand what FakeModule is doing, because it's a gross hack.
1778 understand what FakeModule is doing, because it's a gross hack.
1774 But it solves Arnd's problem for now...
1779 But it solves Arnd's problem for now...
1775
1780
1776 2004-02-27 Fernando Perez <fperez@colorado.edu>
1781 2004-02-27 Fernando Perez <fperez@colorado.edu>
1777
1782
1778 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1783 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1779 mode would behave erratically. Also increased the number of
1784 mode would behave erratically. Also increased the number of
1780 possible logs in rotate mod to 999. Thanks to Rod Holland
1785 possible logs in rotate mod to 999. Thanks to Rod Holland
1781 <rhh@StructureLABS.com> for the report and fixes.
1786 <rhh@StructureLABS.com> for the report and fixes.
1782
1787
1783 2004-02-26 Fernando Perez <fperez@colorado.edu>
1788 2004-02-26 Fernando Perez <fperez@colorado.edu>
1784
1789
1785 * IPython/genutils.py (page): Check that the curses module really
1790 * IPython/genutils.py (page): Check that the curses module really
1786 has the initscr attribute before trying to use it. For some
1791 has the initscr attribute before trying to use it. For some
1787 reason, the Solaris curses module is missing this. I think this
1792 reason, the Solaris curses module is missing this. I think this
1788 should be considered a Solaris python bug, but I'm not sure.
1793 should be considered a Solaris python bug, but I'm not sure.
1789
1794
1790 2004-01-17 Fernando Perez <fperez@colorado.edu>
1795 2004-01-17 Fernando Perez <fperez@colorado.edu>
1791
1796
1792 * IPython/genutils.py (Stream.__init__): Changes to try to make
1797 * IPython/genutils.py (Stream.__init__): Changes to try to make
1793 ipython robust against stdin/out/err being closed by the user.
1798 ipython robust against stdin/out/err being closed by the user.
1794 This is 'user error' (and blocks a normal python session, at least
1799 This is 'user error' (and blocks a normal python session, at least
1795 the stdout case). However, Ipython should be able to survive such
1800 the stdout case). However, Ipython should be able to survive such
1796 instances of abuse as gracefully as possible. To simplify the
1801 instances of abuse as gracefully as possible. To simplify the
1797 coding and maintain compatibility with Gary Bishop's Term
1802 coding and maintain compatibility with Gary Bishop's Term
1798 contributions, I've made use of classmethods for this. I think
1803 contributions, I've made use of classmethods for this. I think
1799 this introduces a dependency on python 2.2.
1804 this introduces a dependency on python 2.2.
1800
1805
1801 2004-01-13 Fernando Perez <fperez@colorado.edu>
1806 2004-01-13 Fernando Perez <fperez@colorado.edu>
1802
1807
1803 * IPython/numutils.py (exp_safe): simplified the code a bit and
1808 * IPython/numutils.py (exp_safe): simplified the code a bit and
1804 removed the need for importing the kinds module altogether.
1809 removed the need for importing the kinds module altogether.
1805
1810
1806 2004-01-06 Fernando Perez <fperez@colorado.edu>
1811 2004-01-06 Fernando Perez <fperez@colorado.edu>
1807
1812
1808 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1813 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1809 a magic function instead, after some community feedback. No
1814 a magic function instead, after some community feedback. No
1810 special syntax will exist for it, but its name is deliberately
1815 special syntax will exist for it, but its name is deliberately
1811 very short.
1816 very short.
1812
1817
1813 2003-12-20 Fernando Perez <fperez@colorado.edu>
1818 2003-12-20 Fernando Perez <fperez@colorado.edu>
1814
1819
1815 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1820 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1816 new functionality, to automagically assign the result of a shell
1821 new functionality, to automagically assign the result of a shell
1817 command to a variable. I'll solicit some community feedback on
1822 command to a variable. I'll solicit some community feedback on
1818 this before making it permanent.
1823 this before making it permanent.
1819
1824
1820 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1825 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1821 requested about callables for which inspect couldn't obtain a
1826 requested about callables for which inspect couldn't obtain a
1822 proper argspec. Thanks to a crash report sent by Etienne
1827 proper argspec. Thanks to a crash report sent by Etienne
1823 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1828 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1824
1829
1825 2003-12-09 Fernando Perez <fperez@colorado.edu>
1830 2003-12-09 Fernando Perez <fperez@colorado.edu>
1826
1831
1827 * IPython/genutils.py (page): patch for the pager to work across
1832 * IPython/genutils.py (page): patch for the pager to work across
1828 various versions of Windows. By Gary Bishop.
1833 various versions of Windows. By Gary Bishop.
1829
1834
1830 2003-12-04 Fernando Perez <fperez@colorado.edu>
1835 2003-12-04 Fernando Perez <fperez@colorado.edu>
1831
1836
1832 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1837 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1833 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1838 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1834 While I tested this and it looks ok, there may still be corner
1839 While I tested this and it looks ok, there may still be corner
1835 cases I've missed.
1840 cases I've missed.
1836
1841
1837 2003-12-01 Fernando Perez <fperez@colorado.edu>
1842 2003-12-01 Fernando Perez <fperez@colorado.edu>
1838
1843
1839 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1844 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1840 where a line like 'p,q=1,2' would fail because the automagic
1845 where a line like 'p,q=1,2' would fail because the automagic
1841 system would be triggered for @p.
1846 system would be triggered for @p.
1842
1847
1843 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1848 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1844 cleanups, code unmodified.
1849 cleanups, code unmodified.
1845
1850
1846 * IPython/genutils.py (Term): added a class for IPython to handle
1851 * IPython/genutils.py (Term): added a class for IPython to handle
1847 output. In most cases it will just be a proxy for stdout/err, but
1852 output. In most cases it will just be a proxy for stdout/err, but
1848 having this allows modifications to be made for some platforms,
1853 having this allows modifications to be made for some platforms,
1849 such as handling color escapes under Windows. All of this code
1854 such as handling color escapes under Windows. All of this code
1850 was contributed by Gary Bishop, with minor modifications by me.
1855 was contributed by Gary Bishop, with minor modifications by me.
1851 The actual changes affect many files.
1856 The actual changes affect many files.
1852
1857
1853 2003-11-30 Fernando Perez <fperez@colorado.edu>
1858 2003-11-30 Fernando Perez <fperez@colorado.edu>
1854
1859
1855 * IPython/iplib.py (file_matches): new completion code, courtesy
1860 * IPython/iplib.py (file_matches): new completion code, courtesy
1856 of Jeff Collins. This enables filename completion again under
1861 of Jeff Collins. This enables filename completion again under
1857 python 2.3, which disabled it at the C level.
1862 python 2.3, which disabled it at the C level.
1858
1863
1859 2003-11-11 Fernando Perez <fperez@colorado.edu>
1864 2003-11-11 Fernando Perez <fperez@colorado.edu>
1860
1865
1861 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1866 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1862 for Numeric.array(map(...)), but often convenient.
1867 for Numeric.array(map(...)), but often convenient.
1863
1868
1864 2003-11-05 Fernando Perez <fperez@colorado.edu>
1869 2003-11-05 Fernando Perez <fperez@colorado.edu>
1865
1870
1866 * IPython/numutils.py (frange): Changed a call from int() to
1871 * IPython/numutils.py (frange): Changed a call from int() to
1867 int(round()) to prevent a problem reported with arange() in the
1872 int(round()) to prevent a problem reported with arange() in the
1868 numpy list.
1873 numpy list.
1869
1874
1870 2003-10-06 Fernando Perez <fperez@colorado.edu>
1875 2003-10-06 Fernando Perez <fperez@colorado.edu>
1871
1876
1872 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1877 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1873 prevent crashes if sys lacks an argv attribute (it happens with
1878 prevent crashes if sys lacks an argv attribute (it happens with
1874 embedded interpreters which build a bare-bones sys module).
1879 embedded interpreters which build a bare-bones sys module).
1875 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1880 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1876
1881
1877 2003-09-24 Fernando Perez <fperez@colorado.edu>
1882 2003-09-24 Fernando Perez <fperez@colorado.edu>
1878
1883
1879 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1884 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1880 to protect against poorly written user objects where __getattr__
1885 to protect against poorly written user objects where __getattr__
1881 raises exceptions other than AttributeError. Thanks to a bug
1886 raises exceptions other than AttributeError. Thanks to a bug
1882 report by Oliver Sander <osander-AT-gmx.de>.
1887 report by Oliver Sander <osander-AT-gmx.de>.
1883
1888
1884 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1889 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1885 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1890 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1886
1891
1887 2003-09-09 Fernando Perez <fperez@colorado.edu>
1892 2003-09-09 Fernando Perez <fperez@colorado.edu>
1888
1893
1889 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1894 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1890 unpacking a list whith a callable as first element would
1895 unpacking a list whith a callable as first element would
1891 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1896 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1892 Collins.
1897 Collins.
1893
1898
1894 2003-08-25 *** Released version 0.5.0
1899 2003-08-25 *** Released version 0.5.0
1895
1900
1896 2003-08-22 Fernando Perez <fperez@colorado.edu>
1901 2003-08-22 Fernando Perez <fperez@colorado.edu>
1897
1902
1898 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1903 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1899 improperly defined user exceptions. Thanks to feedback from Mark
1904 improperly defined user exceptions. Thanks to feedback from Mark
1900 Russell <mrussell-AT-verio.net>.
1905 Russell <mrussell-AT-verio.net>.
1901
1906
1902 2003-08-20 Fernando Perez <fperez@colorado.edu>
1907 2003-08-20 Fernando Perez <fperez@colorado.edu>
1903
1908
1904 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1909 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1905 printing so that it would print multi-line string forms starting
1910 printing so that it would print multi-line string forms starting
1906 with a new line. This way the formatting is better respected for
1911 with a new line. This way the formatting is better respected for
1907 objects which work hard to make nice string forms.
1912 objects which work hard to make nice string forms.
1908
1913
1909 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1914 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1910 autocall would overtake data access for objects with both
1915 autocall would overtake data access for objects with both
1911 __getitem__ and __call__.
1916 __getitem__ and __call__.
1912
1917
1913 2003-08-19 *** Released version 0.5.0-rc1
1918 2003-08-19 *** Released version 0.5.0-rc1
1914
1919
1915 2003-08-19 Fernando Perez <fperez@colorado.edu>
1920 2003-08-19 Fernando Perez <fperez@colorado.edu>
1916
1921
1917 * IPython/deep_reload.py (load_tail): single tiny change here
1922 * IPython/deep_reload.py (load_tail): single tiny change here
1918 seems to fix the long-standing bug of dreload() failing to work
1923 seems to fix the long-standing bug of dreload() failing to work
1919 for dotted names. But this module is pretty tricky, so I may have
1924 for dotted names. But this module is pretty tricky, so I may have
1920 missed some subtlety. Needs more testing!.
1925 missed some subtlety. Needs more testing!.
1921
1926
1922 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1927 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1923 exceptions which have badly implemented __str__ methods.
1928 exceptions which have badly implemented __str__ methods.
1924 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1929 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1925 which I've been getting reports about from Python 2.3 users. I
1930 which I've been getting reports about from Python 2.3 users. I
1926 wish I had a simple test case to reproduce the problem, so I could
1931 wish I had a simple test case to reproduce the problem, so I could
1927 either write a cleaner workaround or file a bug report if
1932 either write a cleaner workaround or file a bug report if
1928 necessary.
1933 necessary.
1929
1934
1930 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1935 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1931 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1936 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1932 a bug report by Tjabo Kloppenburg.
1937 a bug report by Tjabo Kloppenburg.
1933
1938
1934 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1939 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1935 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1940 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1936 seems rather unstable. Thanks to a bug report by Tjabo
1941 seems rather unstable. Thanks to a bug report by Tjabo
1937 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1942 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1938
1943
1939 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1944 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1940 this out soon because of the critical fixes in the inner loop for
1945 this out soon because of the critical fixes in the inner loop for
1941 generators.
1946 generators.
1942
1947
1943 * IPython/Magic.py (Magic.getargspec): removed. This (and
1948 * IPython/Magic.py (Magic.getargspec): removed. This (and
1944 _get_def) have been obsoleted by OInspect for a long time, I
1949 _get_def) have been obsoleted by OInspect for a long time, I
1945 hadn't noticed that they were dead code.
1950 hadn't noticed that they were dead code.
1946 (Magic._ofind): restored _ofind functionality for a few literals
1951 (Magic._ofind): restored _ofind functionality for a few literals
1947 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1952 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1948 for things like "hello".capitalize?, since that would require a
1953 for things like "hello".capitalize?, since that would require a
1949 potentially dangerous eval() again.
1954 potentially dangerous eval() again.
1950
1955
1951 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1956 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1952 logic a bit more to clean up the escapes handling and minimize the
1957 logic a bit more to clean up the escapes handling and minimize the
1953 use of _ofind to only necessary cases. The interactive 'feel' of
1958 use of _ofind to only necessary cases. The interactive 'feel' of
1954 IPython should have improved quite a bit with the changes in
1959 IPython should have improved quite a bit with the changes in
1955 _prefilter and _ofind (besides being far safer than before).
1960 _prefilter and _ofind (besides being far safer than before).
1956
1961
1957 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1962 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1958 obscure, never reported). Edit would fail to find the object to
1963 obscure, never reported). Edit would fail to find the object to
1959 edit under some circumstances.
1964 edit under some circumstances.
1960 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1965 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1961 which were causing double-calling of generators. Those eval calls
1966 which were causing double-calling of generators. Those eval calls
1962 were _very_ dangerous, since code with side effects could be
1967 were _very_ dangerous, since code with side effects could be
1963 triggered. As they say, 'eval is evil'... These were the
1968 triggered. As they say, 'eval is evil'... These were the
1964 nastiest evals in IPython. Besides, _ofind is now far simpler,
1969 nastiest evals in IPython. Besides, _ofind is now far simpler,
1965 and it should also be quite a bit faster. Its use of inspect is
1970 and it should also be quite a bit faster. Its use of inspect is
1966 also safer, so perhaps some of the inspect-related crashes I've
1971 also safer, so perhaps some of the inspect-related crashes I've
1967 seen lately with Python 2.3 might be taken care of. That will
1972 seen lately with Python 2.3 might be taken care of. That will
1968 need more testing.
1973 need more testing.
1969
1974
1970 2003-08-17 Fernando Perez <fperez@colorado.edu>
1975 2003-08-17 Fernando Perez <fperez@colorado.edu>
1971
1976
1972 * IPython/iplib.py (InteractiveShell._prefilter): significant
1977 * IPython/iplib.py (InteractiveShell._prefilter): significant
1973 simplifications to the logic for handling user escapes. Faster
1978 simplifications to the logic for handling user escapes. Faster
1974 and simpler code.
1979 and simpler code.
1975
1980
1976 2003-08-14 Fernando Perez <fperez@colorado.edu>
1981 2003-08-14 Fernando Perez <fperez@colorado.edu>
1977
1982
1978 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
1983 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
1979 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
1984 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
1980 but it should be quite a bit faster. And the recursive version
1985 but it should be quite a bit faster. And the recursive version
1981 generated O(log N) intermediate storage for all rank>1 arrays,
1986 generated O(log N) intermediate storage for all rank>1 arrays,
1982 even if they were contiguous.
1987 even if they were contiguous.
1983 (l1norm): Added this function.
1988 (l1norm): Added this function.
1984 (norm): Added this function for arbitrary norms (including
1989 (norm): Added this function for arbitrary norms (including
1985 l-infinity). l1 and l2 are still special cases for convenience
1990 l-infinity). l1 and l2 are still special cases for convenience
1986 and speed.
1991 and speed.
1987
1992
1988 2003-08-03 Fernando Perez <fperez@colorado.edu>
1993 2003-08-03 Fernando Perez <fperez@colorado.edu>
1989
1994
1990 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
1995 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
1991 exceptions, which now raise PendingDeprecationWarnings in Python
1996 exceptions, which now raise PendingDeprecationWarnings in Python
1992 2.3. There were some in Magic and some in Gnuplot2.
1997 2.3. There were some in Magic and some in Gnuplot2.
1993
1998
1994 2003-06-30 Fernando Perez <fperez@colorado.edu>
1999 2003-06-30 Fernando Perez <fperez@colorado.edu>
1995
2000
1996 * IPython/genutils.py (page): modified to call curses only for
2001 * IPython/genutils.py (page): modified to call curses only for
1997 terminals where TERM=='xterm'. After problems under many other
2002 terminals where TERM=='xterm'. After problems under many other
1998 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2003 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
1999
2004
2000 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2005 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2001 would be triggered when readline was absent. This was just an old
2006 would be triggered when readline was absent. This was just an old
2002 debugging statement I'd forgotten to take out.
2007 debugging statement I'd forgotten to take out.
2003
2008
2004 2003-06-20 Fernando Perez <fperez@colorado.edu>
2009 2003-06-20 Fernando Perez <fperez@colorado.edu>
2005
2010
2006 * IPython/genutils.py (clock): modified to return only user time
2011 * IPython/genutils.py (clock): modified to return only user time
2007 (not counting system time), after a discussion on scipy. While
2012 (not counting system time), after a discussion on scipy. While
2008 system time may be a useful quantity occasionally, it may much
2013 system time may be a useful quantity occasionally, it may much
2009 more easily be skewed by occasional swapping or other similar
2014 more easily be skewed by occasional swapping or other similar
2010 activity.
2015 activity.
2011
2016
2012 2003-06-05 Fernando Perez <fperez@colorado.edu>
2017 2003-06-05 Fernando Perez <fperez@colorado.edu>
2013
2018
2014 * IPython/numutils.py (identity): new function, for building
2019 * IPython/numutils.py (identity): new function, for building
2015 arbitrary rank Kronecker deltas (mostly backwards compatible with
2020 arbitrary rank Kronecker deltas (mostly backwards compatible with
2016 Numeric.identity)
2021 Numeric.identity)
2017
2022
2018 2003-06-03 Fernando Perez <fperez@colorado.edu>
2023 2003-06-03 Fernando Perez <fperez@colorado.edu>
2019
2024
2020 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2025 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2021 arguments passed to magics with spaces, to allow trailing '\' to
2026 arguments passed to magics with spaces, to allow trailing '\' to
2022 work normally (mainly for Windows users).
2027 work normally (mainly for Windows users).
2023
2028
2024 2003-05-29 Fernando Perez <fperez@colorado.edu>
2029 2003-05-29 Fernando Perez <fperez@colorado.edu>
2025
2030
2026 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2031 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2027 instead of pydoc.help. This fixes a bizarre behavior where
2032 instead of pydoc.help. This fixes a bizarre behavior where
2028 printing '%s' % locals() would trigger the help system. Now
2033 printing '%s' % locals() would trigger the help system. Now
2029 ipython behaves like normal python does.
2034 ipython behaves like normal python does.
2030
2035
2031 Note that if one does 'from pydoc import help', the bizarre
2036 Note that if one does 'from pydoc import help', the bizarre
2032 behavior returns, but this will also happen in normal python, so
2037 behavior returns, but this will also happen in normal python, so
2033 it's not an ipython bug anymore (it has to do with how pydoc.help
2038 it's not an ipython bug anymore (it has to do with how pydoc.help
2034 is implemented).
2039 is implemented).
2035
2040
2036 2003-05-22 Fernando Perez <fperez@colorado.edu>
2041 2003-05-22 Fernando Perez <fperez@colorado.edu>
2037
2042
2038 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2043 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2039 return [] instead of None when nothing matches, also match to end
2044 return [] instead of None when nothing matches, also match to end
2040 of line. Patch by Gary Bishop.
2045 of line. Patch by Gary Bishop.
2041
2046
2042 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2047 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2043 protection as before, for files passed on the command line. This
2048 protection as before, for files passed on the command line. This
2044 prevents the CrashHandler from kicking in if user files call into
2049 prevents the CrashHandler from kicking in if user files call into
2045 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2050 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2046 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2051 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2047
2052
2048 2003-05-20 *** Released version 0.4.0
2053 2003-05-20 *** Released version 0.4.0
2049
2054
2050 2003-05-20 Fernando Perez <fperez@colorado.edu>
2055 2003-05-20 Fernando Perez <fperez@colorado.edu>
2051
2056
2052 * setup.py: added support for manpages. It's a bit hackish b/c of
2057 * setup.py: added support for manpages. It's a bit hackish b/c of
2053 a bug in the way the bdist_rpm distutils target handles gzipped
2058 a bug in the way the bdist_rpm distutils target handles gzipped
2054 manpages, but it works. After a patch by Jack.
2059 manpages, but it works. After a patch by Jack.
2055
2060
2056 2003-05-19 Fernando Perez <fperez@colorado.edu>
2061 2003-05-19 Fernando Perez <fperez@colorado.edu>
2057
2062
2058 * IPython/numutils.py: added a mockup of the kinds module, since
2063 * IPython/numutils.py: added a mockup of the kinds module, since
2059 it was recently removed from Numeric. This way, numutils will
2064 it was recently removed from Numeric. This way, numutils will
2060 work for all users even if they are missing kinds.
2065 work for all users even if they are missing kinds.
2061
2066
2062 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2067 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2063 failure, which can occur with SWIG-wrapped extensions. After a
2068 failure, which can occur with SWIG-wrapped extensions. After a
2064 crash report from Prabhu.
2069 crash report from Prabhu.
2065
2070
2066 2003-05-16 Fernando Perez <fperez@colorado.edu>
2071 2003-05-16 Fernando Perez <fperez@colorado.edu>
2067
2072
2068 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2073 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2069 protect ipython from user code which may call directly
2074 protect ipython from user code which may call directly
2070 sys.excepthook (this looks like an ipython crash to the user, even
2075 sys.excepthook (this looks like an ipython crash to the user, even
2071 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2076 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2072 This is especially important to help users of WxWindows, but may
2077 This is especially important to help users of WxWindows, but may
2073 also be useful in other cases.
2078 also be useful in other cases.
2074
2079
2075 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2080 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2076 an optional tb_offset to be specified, and to preserve exception
2081 an optional tb_offset to be specified, and to preserve exception
2077 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2082 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2078
2083
2079 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2084 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2080
2085
2081 2003-05-15 Fernando Perez <fperez@colorado.edu>
2086 2003-05-15 Fernando Perez <fperez@colorado.edu>
2082
2087
2083 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2088 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2084 installing for a new user under Windows.
2089 installing for a new user under Windows.
2085
2090
2086 2003-05-12 Fernando Perez <fperez@colorado.edu>
2091 2003-05-12 Fernando Perez <fperez@colorado.edu>
2087
2092
2088 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2093 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2089 handler for Emacs comint-based lines. Currently it doesn't do
2094 handler for Emacs comint-based lines. Currently it doesn't do
2090 much (but importantly, it doesn't update the history cache). In
2095 much (but importantly, it doesn't update the history cache). In
2091 the future it may be expanded if Alex needs more functionality
2096 the future it may be expanded if Alex needs more functionality
2092 there.
2097 there.
2093
2098
2094 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2099 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2095 info to crash reports.
2100 info to crash reports.
2096
2101
2097 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2102 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2098 just like Python's -c. Also fixed crash with invalid -color
2103 just like Python's -c. Also fixed crash with invalid -color
2099 option value at startup. Thanks to Will French
2104 option value at startup. Thanks to Will French
2100 <wfrench-AT-bestweb.net> for the bug report.
2105 <wfrench-AT-bestweb.net> for the bug report.
2101
2106
2102 2003-05-09 Fernando Perez <fperez@colorado.edu>
2107 2003-05-09 Fernando Perez <fperez@colorado.edu>
2103
2108
2104 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2109 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2105 to EvalDict (it's a mapping, after all) and simplified its code
2110 to EvalDict (it's a mapping, after all) and simplified its code
2106 quite a bit, after a nice discussion on c.l.py where Gustavo
2111 quite a bit, after a nice discussion on c.l.py where Gustavo
2107 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2112 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2108
2113
2109 2003-04-30 Fernando Perez <fperez@colorado.edu>
2114 2003-04-30 Fernando Perez <fperez@colorado.edu>
2110
2115
2111 * IPython/genutils.py (timings_out): modified it to reduce its
2116 * IPython/genutils.py (timings_out): modified it to reduce its
2112 overhead in the common reps==1 case.
2117 overhead in the common reps==1 case.
2113
2118
2114 2003-04-29 Fernando Perez <fperez@colorado.edu>
2119 2003-04-29 Fernando Perez <fperez@colorado.edu>
2115
2120
2116 * IPython/genutils.py (timings_out): Modified to use the resource
2121 * IPython/genutils.py (timings_out): Modified to use the resource
2117 module, which avoids the wraparound problems of time.clock().
2122 module, which avoids the wraparound problems of time.clock().
2118
2123
2119 2003-04-17 *** Released version 0.2.15pre4
2124 2003-04-17 *** Released version 0.2.15pre4
2120
2125
2121 2003-04-17 Fernando Perez <fperez@colorado.edu>
2126 2003-04-17 Fernando Perez <fperez@colorado.edu>
2122
2127
2123 * setup.py (scriptfiles): Split windows-specific stuff over to a
2128 * setup.py (scriptfiles): Split windows-specific stuff over to a
2124 separate file, in an attempt to have a Windows GUI installer.
2129 separate file, in an attempt to have a Windows GUI installer.
2125 That didn't work, but part of the groundwork is done.
2130 That didn't work, but part of the groundwork is done.
2126
2131
2127 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2132 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2128 indent/unindent with 4 spaces. Particularly useful in combination
2133 indent/unindent with 4 spaces. Particularly useful in combination
2129 with the new auto-indent option.
2134 with the new auto-indent option.
2130
2135
2131 2003-04-16 Fernando Perez <fperez@colorado.edu>
2136 2003-04-16 Fernando Perez <fperez@colorado.edu>
2132
2137
2133 * IPython/Magic.py: various replacements of self.rc for
2138 * IPython/Magic.py: various replacements of self.rc for
2134 self.shell.rc. A lot more remains to be done to fully disentangle
2139 self.shell.rc. A lot more remains to be done to fully disentangle
2135 this class from the main Shell class.
2140 this class from the main Shell class.
2136
2141
2137 * IPython/GnuplotRuntime.py: added checks for mouse support so
2142 * IPython/GnuplotRuntime.py: added checks for mouse support so
2138 that we don't try to enable it if the current gnuplot doesn't
2143 that we don't try to enable it if the current gnuplot doesn't
2139 really support it. Also added checks so that we don't try to
2144 really support it. Also added checks so that we don't try to
2140 enable persist under Windows (where Gnuplot doesn't recognize the
2145 enable persist under Windows (where Gnuplot doesn't recognize the
2141 option).
2146 option).
2142
2147
2143 * IPython/iplib.py (InteractiveShell.interact): Added optional
2148 * IPython/iplib.py (InteractiveShell.interact): Added optional
2144 auto-indenting code, after a patch by King C. Shu
2149 auto-indenting code, after a patch by King C. Shu
2145 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2150 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2146 get along well with pasting indented code. If I ever figure out
2151 get along well with pasting indented code. If I ever figure out
2147 how to make that part go well, it will become on by default.
2152 how to make that part go well, it will become on by default.
2148
2153
2149 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2154 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2150 crash ipython if there was an unmatched '%' in the user's prompt
2155 crash ipython if there was an unmatched '%' in the user's prompt
2151 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2156 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2152
2157
2153 * IPython/iplib.py (InteractiveShell.interact): removed the
2158 * IPython/iplib.py (InteractiveShell.interact): removed the
2154 ability to ask the user whether he wants to crash or not at the
2159 ability to ask the user whether he wants to crash or not at the
2155 'last line' exception handler. Calling functions at that point
2160 'last line' exception handler. Calling functions at that point
2156 changes the stack, and the error reports would have incorrect
2161 changes the stack, and the error reports would have incorrect
2157 tracebacks.
2162 tracebacks.
2158
2163
2159 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2164 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2160 pass through a peger a pretty-printed form of any object. After a
2165 pass through a peger a pretty-printed form of any object. After a
2161 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2166 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2162
2167
2163 2003-04-14 Fernando Perez <fperez@colorado.edu>
2168 2003-04-14 Fernando Perez <fperez@colorado.edu>
2164
2169
2165 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2170 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2166 all files in ~ would be modified at first install (instead of
2171 all files in ~ would be modified at first install (instead of
2167 ~/.ipython). This could be potentially disastrous, as the
2172 ~/.ipython). This could be potentially disastrous, as the
2168 modification (make line-endings native) could damage binary files.
2173 modification (make line-endings native) could damage binary files.
2169
2174
2170 2003-04-10 Fernando Perez <fperez@colorado.edu>
2175 2003-04-10 Fernando Perez <fperez@colorado.edu>
2171
2176
2172 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2177 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2173 handle only lines which are invalid python. This now means that
2178 handle only lines which are invalid python. This now means that
2174 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2179 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2175 for the bug report.
2180 for the bug report.
2176
2181
2177 2003-04-01 Fernando Perez <fperez@colorado.edu>
2182 2003-04-01 Fernando Perez <fperez@colorado.edu>
2178
2183
2179 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2184 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2180 where failing to set sys.last_traceback would crash pdb.pm().
2185 where failing to set sys.last_traceback would crash pdb.pm().
2181 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2186 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2182 report.
2187 report.
2183
2188
2184 2003-03-25 Fernando Perez <fperez@colorado.edu>
2189 2003-03-25 Fernando Perez <fperez@colorado.edu>
2185
2190
2186 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2191 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2187 before printing it (it had a lot of spurious blank lines at the
2192 before printing it (it had a lot of spurious blank lines at the
2188 end).
2193 end).
2189
2194
2190 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2195 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2191 output would be sent 21 times! Obviously people don't use this
2196 output would be sent 21 times! Obviously people don't use this
2192 too often, or I would have heard about it.
2197 too often, or I would have heard about it.
2193
2198
2194 2003-03-24 Fernando Perez <fperez@colorado.edu>
2199 2003-03-24 Fernando Perez <fperez@colorado.edu>
2195
2200
2196 * setup.py (scriptfiles): renamed the data_files parameter from
2201 * setup.py (scriptfiles): renamed the data_files parameter from
2197 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2202 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2198 for the patch.
2203 for the patch.
2199
2204
2200 2003-03-20 Fernando Perez <fperez@colorado.edu>
2205 2003-03-20 Fernando Perez <fperez@colorado.edu>
2201
2206
2202 * IPython/genutils.py (error): added error() and fatal()
2207 * IPython/genutils.py (error): added error() and fatal()
2203 functions.
2208 functions.
2204
2209
2205 2003-03-18 *** Released version 0.2.15pre3
2210 2003-03-18 *** Released version 0.2.15pre3
2206
2211
2207 2003-03-18 Fernando Perez <fperez@colorado.edu>
2212 2003-03-18 Fernando Perez <fperez@colorado.edu>
2208
2213
2209 * setupext/install_data_ext.py
2214 * setupext/install_data_ext.py
2210 (install_data_ext.initialize_options): Class contributed by Jack
2215 (install_data_ext.initialize_options): Class contributed by Jack
2211 Moffit for fixing the old distutils hack. He is sending this to
2216 Moffit for fixing the old distutils hack. He is sending this to
2212 the distutils folks so in the future we may not need it as a
2217 the distutils folks so in the future we may not need it as a
2213 private fix.
2218 private fix.
2214
2219
2215 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2220 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2216 changes for Debian packaging. See his patch for full details.
2221 changes for Debian packaging. See his patch for full details.
2217 The old distutils hack of making the ipythonrc* files carry a
2222 The old distutils hack of making the ipythonrc* files carry a
2218 bogus .py extension is gone, at last. Examples were moved to a
2223 bogus .py extension is gone, at last. Examples were moved to a
2219 separate subdir under doc/, and the separate executable scripts
2224 separate subdir under doc/, and the separate executable scripts
2220 now live in their own directory. Overall a great cleanup. The
2225 now live in their own directory. Overall a great cleanup. The
2221 manual was updated to use the new files, and setup.py has been
2226 manual was updated to use the new files, and setup.py has been
2222 fixed for this setup.
2227 fixed for this setup.
2223
2228
2224 * IPython/PyColorize.py (Parser.usage): made non-executable and
2229 * IPython/PyColorize.py (Parser.usage): made non-executable and
2225 created a pycolor wrapper around it to be included as a script.
2230 created a pycolor wrapper around it to be included as a script.
2226
2231
2227 2003-03-12 *** Released version 0.2.15pre2
2232 2003-03-12 *** Released version 0.2.15pre2
2228
2233
2229 2003-03-12 Fernando Perez <fperez@colorado.edu>
2234 2003-03-12 Fernando Perez <fperez@colorado.edu>
2230
2235
2231 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2236 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2232 long-standing problem with garbage characters in some terminals.
2237 long-standing problem with garbage characters in some terminals.
2233 The issue was really that the \001 and \002 escapes must _only_ be
2238 The issue was really that the \001 and \002 escapes must _only_ be
2234 passed to input prompts (which call readline), but _never_ to
2239 passed to input prompts (which call readline), but _never_ to
2235 normal text to be printed on screen. I changed ColorANSI to have
2240 normal text to be printed on screen. I changed ColorANSI to have
2236 two classes: TermColors and InputTermColors, each with the
2241 two classes: TermColors and InputTermColors, each with the
2237 appropriate escapes for input prompts or normal text. The code in
2242 appropriate escapes for input prompts or normal text. The code in
2238 Prompts.py got slightly more complicated, but this very old and
2243 Prompts.py got slightly more complicated, but this very old and
2239 annoying bug is finally fixed.
2244 annoying bug is finally fixed.
2240
2245
2241 All the credit for nailing down the real origin of this problem
2246 All the credit for nailing down the real origin of this problem
2242 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2247 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2243 *Many* thanks to him for spending quite a bit of effort on this.
2248 *Many* thanks to him for spending quite a bit of effort on this.
2244
2249
2245 2003-03-05 *** Released version 0.2.15pre1
2250 2003-03-05 *** Released version 0.2.15pre1
2246
2251
2247 2003-03-03 Fernando Perez <fperez@colorado.edu>
2252 2003-03-03 Fernando Perez <fperez@colorado.edu>
2248
2253
2249 * IPython/FakeModule.py: Moved the former _FakeModule to a
2254 * IPython/FakeModule.py: Moved the former _FakeModule to a
2250 separate file, because it's also needed by Magic (to fix a similar
2255 separate file, because it's also needed by Magic (to fix a similar
2251 pickle-related issue in @run).
2256 pickle-related issue in @run).
2252
2257
2253 2003-03-02 Fernando Perez <fperez@colorado.edu>
2258 2003-03-02 Fernando Perez <fperez@colorado.edu>
2254
2259
2255 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2260 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2256 the autocall option at runtime.
2261 the autocall option at runtime.
2257 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2262 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2258 across Magic.py to start separating Magic from InteractiveShell.
2263 across Magic.py to start separating Magic from InteractiveShell.
2259 (Magic._ofind): Fixed to return proper namespace for dotted
2264 (Magic._ofind): Fixed to return proper namespace for dotted
2260 names. Before, a dotted name would always return 'not currently
2265 names. Before, a dotted name would always return 'not currently
2261 defined', because it would find the 'parent'. s.x would be found,
2266 defined', because it would find the 'parent'. s.x would be found,
2262 but since 'x' isn't defined by itself, it would get confused.
2267 but since 'x' isn't defined by itself, it would get confused.
2263 (Magic.magic_run): Fixed pickling problems reported by Ralf
2268 (Magic.magic_run): Fixed pickling problems reported by Ralf
2264 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2269 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2265 that I'd used when Mike Heeter reported similar issues at the
2270 that I'd used when Mike Heeter reported similar issues at the
2266 top-level, but now for @run. It boils down to injecting the
2271 top-level, but now for @run. It boils down to injecting the
2267 namespace where code is being executed with something that looks
2272 namespace where code is being executed with something that looks
2268 enough like a module to fool pickle.dump(). Since a pickle stores
2273 enough like a module to fool pickle.dump(). Since a pickle stores
2269 a named reference to the importing module, we need this for
2274 a named reference to the importing module, we need this for
2270 pickles to save something sensible.
2275 pickles to save something sensible.
2271
2276
2272 * IPython/ipmaker.py (make_IPython): added an autocall option.
2277 * IPython/ipmaker.py (make_IPython): added an autocall option.
2273
2278
2274 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2279 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2275 the auto-eval code. Now autocalling is an option, and the code is
2280 the auto-eval code. Now autocalling is an option, and the code is
2276 also vastly safer. There is no more eval() involved at all.
2281 also vastly safer. There is no more eval() involved at all.
2277
2282
2278 2003-03-01 Fernando Perez <fperez@colorado.edu>
2283 2003-03-01 Fernando Perez <fperez@colorado.edu>
2279
2284
2280 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2285 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2281 dict with named keys instead of a tuple.
2286 dict with named keys instead of a tuple.
2282
2287
2283 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2288 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2284
2289
2285 * setup.py (make_shortcut): Fixed message about directories
2290 * setup.py (make_shortcut): Fixed message about directories
2286 created during Windows installation (the directories were ok, just
2291 created during Windows installation (the directories were ok, just
2287 the printed message was misleading). Thanks to Chris Liechti
2292 the printed message was misleading). Thanks to Chris Liechti
2288 <cliechti-AT-gmx.net> for the heads up.
2293 <cliechti-AT-gmx.net> for the heads up.
2289
2294
2290 2003-02-21 Fernando Perez <fperez@colorado.edu>
2295 2003-02-21 Fernando Perez <fperez@colorado.edu>
2291
2296
2292 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2297 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2293 of ValueError exception when checking for auto-execution. This
2298 of ValueError exception when checking for auto-execution. This
2294 one is raised by things like Numeric arrays arr.flat when the
2299 one is raised by things like Numeric arrays arr.flat when the
2295 array is non-contiguous.
2300 array is non-contiguous.
2296
2301
2297 2003-01-31 Fernando Perez <fperez@colorado.edu>
2302 2003-01-31 Fernando Perez <fperez@colorado.edu>
2298
2303
2299 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2304 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2300 not return any value at all (even though the command would get
2305 not return any value at all (even though the command would get
2301 executed).
2306 executed).
2302 (xsys): Flush stdout right after printing the command to ensure
2307 (xsys): Flush stdout right after printing the command to ensure
2303 proper ordering of commands and command output in the total
2308 proper ordering of commands and command output in the total
2304 output.
2309 output.
2305 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2310 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2306 system/getoutput as defaults. The old ones are kept for
2311 system/getoutput as defaults. The old ones are kept for
2307 compatibility reasons, so no code which uses this library needs
2312 compatibility reasons, so no code which uses this library needs
2308 changing.
2313 changing.
2309
2314
2310 2003-01-27 *** Released version 0.2.14
2315 2003-01-27 *** Released version 0.2.14
2311
2316
2312 2003-01-25 Fernando Perez <fperez@colorado.edu>
2317 2003-01-25 Fernando Perez <fperez@colorado.edu>
2313
2318
2314 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2319 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2315 functions defined in previous edit sessions could not be re-edited
2320 functions defined in previous edit sessions could not be re-edited
2316 (because the temp files were immediately removed). Now temp files
2321 (because the temp files were immediately removed). Now temp files
2317 are removed only at IPython's exit.
2322 are removed only at IPython's exit.
2318 (Magic.magic_run): Improved @run to perform shell-like expansions
2323 (Magic.magic_run): Improved @run to perform shell-like expansions
2319 on its arguments (~users and $VARS). With this, @run becomes more
2324 on its arguments (~users and $VARS). With this, @run becomes more
2320 like a normal command-line.
2325 like a normal command-line.
2321
2326
2322 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2327 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2323 bugs related to embedding and cleaned up that code. A fairly
2328 bugs related to embedding and cleaned up that code. A fairly
2324 important one was the impossibility to access the global namespace
2329 important one was the impossibility to access the global namespace
2325 through the embedded IPython (only local variables were visible).
2330 through the embedded IPython (only local variables were visible).
2326
2331
2327 2003-01-14 Fernando Perez <fperez@colorado.edu>
2332 2003-01-14 Fernando Perez <fperez@colorado.edu>
2328
2333
2329 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2334 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2330 auto-calling to be a bit more conservative. Now it doesn't get
2335 auto-calling to be a bit more conservative. Now it doesn't get
2331 triggered if any of '!=()<>' are in the rest of the input line, to
2336 triggered if any of '!=()<>' are in the rest of the input line, to
2332 allow comparing callables. Thanks to Alex for the heads up.
2337 allow comparing callables. Thanks to Alex for the heads up.
2333
2338
2334 2003-01-07 Fernando Perez <fperez@colorado.edu>
2339 2003-01-07 Fernando Perez <fperez@colorado.edu>
2335
2340
2336 * IPython/genutils.py (page): fixed estimation of the number of
2341 * IPython/genutils.py (page): fixed estimation of the number of
2337 lines in a string to be paged to simply count newlines. This
2342 lines in a string to be paged to simply count newlines. This
2338 prevents over-guessing due to embedded escape sequences. A better
2343 prevents over-guessing due to embedded escape sequences. A better
2339 long-term solution would involve stripping out the control chars
2344 long-term solution would involve stripping out the control chars
2340 for the count, but it's potentially so expensive I just don't
2345 for the count, but it's potentially so expensive I just don't
2341 think it's worth doing.
2346 think it's worth doing.
2342
2347
2343 2002-12-19 *** Released version 0.2.14pre50
2348 2002-12-19 *** Released version 0.2.14pre50
2344
2349
2345 2002-12-19 Fernando Perez <fperez@colorado.edu>
2350 2002-12-19 Fernando Perez <fperez@colorado.edu>
2346
2351
2347 * tools/release (version): Changed release scripts to inform
2352 * tools/release (version): Changed release scripts to inform
2348 Andrea and build a NEWS file with a list of recent changes.
2353 Andrea and build a NEWS file with a list of recent changes.
2349
2354
2350 * IPython/ColorANSI.py (__all__): changed terminal detection
2355 * IPython/ColorANSI.py (__all__): changed terminal detection
2351 code. Seems to work better for xterms without breaking
2356 code. Seems to work better for xterms without breaking
2352 konsole. Will need more testing to determine if WinXP and Mac OSX
2357 konsole. Will need more testing to determine if WinXP and Mac OSX
2353 also work ok.
2358 also work ok.
2354
2359
2355 2002-12-18 *** Released version 0.2.14pre49
2360 2002-12-18 *** Released version 0.2.14pre49
2356
2361
2357 2002-12-18 Fernando Perez <fperez@colorado.edu>
2362 2002-12-18 Fernando Perez <fperez@colorado.edu>
2358
2363
2359 * Docs: added new info about Mac OSX, from Andrea.
2364 * Docs: added new info about Mac OSX, from Andrea.
2360
2365
2361 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2366 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2362 allow direct plotting of python strings whose format is the same
2367 allow direct plotting of python strings whose format is the same
2363 of gnuplot data files.
2368 of gnuplot data files.
2364
2369
2365 2002-12-16 Fernando Perez <fperez@colorado.edu>
2370 2002-12-16 Fernando Perez <fperez@colorado.edu>
2366
2371
2367 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2372 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2368 value of exit question to be acknowledged.
2373 value of exit question to be acknowledged.
2369
2374
2370 2002-12-03 Fernando Perez <fperez@colorado.edu>
2375 2002-12-03 Fernando Perez <fperez@colorado.edu>
2371
2376
2372 * IPython/ipmaker.py: removed generators, which had been added
2377 * IPython/ipmaker.py: removed generators, which had been added
2373 by mistake in an earlier debugging run. This was causing trouble
2378 by mistake in an earlier debugging run. This was causing trouble
2374 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2379 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2375 for pointing this out.
2380 for pointing this out.
2376
2381
2377 2002-11-17 Fernando Perez <fperez@colorado.edu>
2382 2002-11-17 Fernando Perez <fperez@colorado.edu>
2378
2383
2379 * Manual: updated the Gnuplot section.
2384 * Manual: updated the Gnuplot section.
2380
2385
2381 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2386 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2382 a much better split of what goes in Runtime and what goes in
2387 a much better split of what goes in Runtime and what goes in
2383 Interactive.
2388 Interactive.
2384
2389
2385 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2390 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2386 being imported from iplib.
2391 being imported from iplib.
2387
2392
2388 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2393 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2389 for command-passing. Now the global Gnuplot instance is called
2394 for command-passing. Now the global Gnuplot instance is called
2390 'gp' instead of 'g', which was really a far too fragile and
2395 'gp' instead of 'g', which was really a far too fragile and
2391 common name.
2396 common name.
2392
2397
2393 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2398 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2394 bounding boxes generated by Gnuplot for square plots.
2399 bounding boxes generated by Gnuplot for square plots.
2395
2400
2396 * IPython/genutils.py (popkey): new function added. I should
2401 * IPython/genutils.py (popkey): new function added. I should
2397 suggest this on c.l.py as a dict method, it seems useful.
2402 suggest this on c.l.py as a dict method, it seems useful.
2398
2403
2399 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2404 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2400 to transparently handle PostScript generation. MUCH better than
2405 to transparently handle PostScript generation. MUCH better than
2401 the previous plot_eps/replot_eps (which I removed now). The code
2406 the previous plot_eps/replot_eps (which I removed now). The code
2402 is also fairly clean and well documented now (including
2407 is also fairly clean and well documented now (including
2403 docstrings).
2408 docstrings).
2404
2409
2405 2002-11-13 Fernando Perez <fperez@colorado.edu>
2410 2002-11-13 Fernando Perez <fperez@colorado.edu>
2406
2411
2407 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2412 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2408 (inconsistent with options).
2413 (inconsistent with options).
2409
2414
2410 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2415 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2411 manually disabled, I don't know why. Fixed it.
2416 manually disabled, I don't know why. Fixed it.
2412 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2417 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2413 eps output.
2418 eps output.
2414
2419
2415 2002-11-12 Fernando Perez <fperez@colorado.edu>
2420 2002-11-12 Fernando Perez <fperez@colorado.edu>
2416
2421
2417 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2422 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2418 don't propagate up to caller. Fixes crash reported by François
2423 don't propagate up to caller. Fixes crash reported by François
2419 Pinard.
2424 Pinard.
2420
2425
2421 2002-11-09 Fernando Perez <fperez@colorado.edu>
2426 2002-11-09 Fernando Perez <fperez@colorado.edu>
2422
2427
2423 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2428 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2424 history file for new users.
2429 history file for new users.
2425 (make_IPython): fixed bug where initial install would leave the
2430 (make_IPython): fixed bug where initial install would leave the
2426 user running in the .ipython dir.
2431 user running in the .ipython dir.
2427 (make_IPython): fixed bug where config dir .ipython would be
2432 (make_IPython): fixed bug where config dir .ipython would be
2428 created regardless of the given -ipythondir option. Thanks to Cory
2433 created regardless of the given -ipythondir option. Thanks to Cory
2429 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2434 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2430
2435
2431 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2436 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2432 type confirmations. Will need to use it in all of IPython's code
2437 type confirmations. Will need to use it in all of IPython's code
2433 consistently.
2438 consistently.
2434
2439
2435 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2440 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2436 context to print 31 lines instead of the default 5. This will make
2441 context to print 31 lines instead of the default 5. This will make
2437 the crash reports extremely detailed in case the problem is in
2442 the crash reports extremely detailed in case the problem is in
2438 libraries I don't have access to.
2443 libraries I don't have access to.
2439
2444
2440 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2445 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2441 line of defense' code to still crash, but giving users fair
2446 line of defense' code to still crash, but giving users fair
2442 warning. I don't want internal errors to go unreported: if there's
2447 warning. I don't want internal errors to go unreported: if there's
2443 an internal problem, IPython should crash and generate a full
2448 an internal problem, IPython should crash and generate a full
2444 report.
2449 report.
2445
2450
2446 2002-11-08 Fernando Perez <fperez@colorado.edu>
2451 2002-11-08 Fernando Perez <fperez@colorado.edu>
2447
2452
2448 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2453 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2449 otherwise uncaught exceptions which can appear if people set
2454 otherwise uncaught exceptions which can appear if people set
2450 sys.stdout to something badly broken. Thanks to a crash report
2455 sys.stdout to something badly broken. Thanks to a crash report
2451 from henni-AT-mail.brainbot.com.
2456 from henni-AT-mail.brainbot.com.
2452
2457
2453 2002-11-04 Fernando Perez <fperez@colorado.edu>
2458 2002-11-04 Fernando Perez <fperez@colorado.edu>
2454
2459
2455 * IPython/iplib.py (InteractiveShell.interact): added
2460 * IPython/iplib.py (InteractiveShell.interact): added
2456 __IPYTHON__active to the builtins. It's a flag which goes on when
2461 __IPYTHON__active to the builtins. It's a flag which goes on when
2457 the interaction starts and goes off again when it stops. This
2462 the interaction starts and goes off again when it stops. This
2458 allows embedding code to detect being inside IPython. Before this
2463 allows embedding code to detect being inside IPython. Before this
2459 was done via __IPYTHON__, but that only shows that an IPython
2464 was done via __IPYTHON__, but that only shows that an IPython
2460 instance has been created.
2465 instance has been created.
2461
2466
2462 * IPython/Magic.py (Magic.magic_env): I realized that in a
2467 * IPython/Magic.py (Magic.magic_env): I realized that in a
2463 UserDict, instance.data holds the data as a normal dict. So I
2468 UserDict, instance.data holds the data as a normal dict. So I
2464 modified @env to return os.environ.data instead of rebuilding a
2469 modified @env to return os.environ.data instead of rebuilding a
2465 dict by hand.
2470 dict by hand.
2466
2471
2467 2002-11-02 Fernando Perez <fperez@colorado.edu>
2472 2002-11-02 Fernando Perez <fperez@colorado.edu>
2468
2473
2469 * IPython/genutils.py (warn): changed so that level 1 prints no
2474 * IPython/genutils.py (warn): changed so that level 1 prints no
2470 header. Level 2 is now the default (with 'WARNING' header, as
2475 header. Level 2 is now the default (with 'WARNING' header, as
2471 before). I think I tracked all places where changes were needed in
2476 before). I think I tracked all places where changes were needed in
2472 IPython, but outside code using the old level numbering may have
2477 IPython, but outside code using the old level numbering may have
2473 broken.
2478 broken.
2474
2479
2475 * IPython/iplib.py (InteractiveShell.runcode): added this to
2480 * IPython/iplib.py (InteractiveShell.runcode): added this to
2476 handle the tracebacks in SystemExit traps correctly. The previous
2481 handle the tracebacks in SystemExit traps correctly. The previous
2477 code (through interact) was printing more of the stack than
2482 code (through interact) was printing more of the stack than
2478 necessary, showing IPython internal code to the user.
2483 necessary, showing IPython internal code to the user.
2479
2484
2480 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2485 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2481 default. Now that the default at the confirmation prompt is yes,
2486 default. Now that the default at the confirmation prompt is yes,
2482 it's not so intrusive. François' argument that ipython sessions
2487 it's not so intrusive. François' argument that ipython sessions
2483 tend to be complex enough not to lose them from an accidental C-d,
2488 tend to be complex enough not to lose them from an accidental C-d,
2484 is a valid one.
2489 is a valid one.
2485
2490
2486 * IPython/iplib.py (InteractiveShell.interact): added a
2491 * IPython/iplib.py (InteractiveShell.interact): added a
2487 showtraceback() call to the SystemExit trap, and modified the exit
2492 showtraceback() call to the SystemExit trap, and modified the exit
2488 confirmation to have yes as the default.
2493 confirmation to have yes as the default.
2489
2494
2490 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2495 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2491 this file. It's been gone from the code for a long time, this was
2496 this file. It's been gone from the code for a long time, this was
2492 simply leftover junk.
2497 simply leftover junk.
2493
2498
2494 2002-11-01 Fernando Perez <fperez@colorado.edu>
2499 2002-11-01 Fernando Perez <fperez@colorado.edu>
2495
2500
2496 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2501 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2497 added. If set, IPython now traps EOF and asks for
2502 added. If set, IPython now traps EOF and asks for
2498 confirmation. After a request by François Pinard.
2503 confirmation. After a request by François Pinard.
2499
2504
2500 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2505 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2501 of @abort, and with a new (better) mechanism for handling the
2506 of @abort, and with a new (better) mechanism for handling the
2502 exceptions.
2507 exceptions.
2503
2508
2504 2002-10-27 Fernando Perez <fperez@colorado.edu>
2509 2002-10-27 Fernando Perez <fperez@colorado.edu>
2505
2510
2506 * IPython/usage.py (__doc__): updated the --help information and
2511 * IPython/usage.py (__doc__): updated the --help information and
2507 the ipythonrc file to indicate that -log generates
2512 the ipythonrc file to indicate that -log generates
2508 ./ipython.log. Also fixed the corresponding info in @logstart.
2513 ./ipython.log. Also fixed the corresponding info in @logstart.
2509 This and several other fixes in the manuals thanks to reports by
2514 This and several other fixes in the manuals thanks to reports by
2510 François Pinard <pinard-AT-iro.umontreal.ca>.
2515 François Pinard <pinard-AT-iro.umontreal.ca>.
2511
2516
2512 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2517 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2513 refer to @logstart (instead of @log, which doesn't exist).
2518 refer to @logstart (instead of @log, which doesn't exist).
2514
2519
2515 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2520 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2516 AttributeError crash. Thanks to Christopher Armstrong
2521 AttributeError crash. Thanks to Christopher Armstrong
2517 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2522 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2518 introduced recently (in 0.2.14pre37) with the fix to the eval
2523 introduced recently (in 0.2.14pre37) with the fix to the eval
2519 problem mentioned below.
2524 problem mentioned below.
2520
2525
2521 2002-10-17 Fernando Perez <fperez@colorado.edu>
2526 2002-10-17 Fernando Perez <fperez@colorado.edu>
2522
2527
2523 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2528 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2524 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2529 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2525
2530
2526 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2531 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2527 this function to fix a problem reported by Alex Schmolck. He saw
2532 this function to fix a problem reported by Alex Schmolck. He saw
2528 it with list comprehensions and generators, which were getting
2533 it with list comprehensions and generators, which were getting
2529 called twice. The real problem was an 'eval' call in testing for
2534 called twice. The real problem was an 'eval' call in testing for
2530 automagic which was evaluating the input line silently.
2535 automagic which was evaluating the input line silently.
2531
2536
2532 This is a potentially very nasty bug, if the input has side
2537 This is a potentially very nasty bug, if the input has side
2533 effects which must not be repeated. The code is much cleaner now,
2538 effects which must not be repeated. The code is much cleaner now,
2534 without any blanket 'except' left and with a regexp test for
2539 without any blanket 'except' left and with a regexp test for
2535 actual function names.
2540 actual function names.
2536
2541
2537 But an eval remains, which I'm not fully comfortable with. I just
2542 But an eval remains, which I'm not fully comfortable with. I just
2538 don't know how to find out if an expression could be a callable in
2543 don't know how to find out if an expression could be a callable in
2539 the user's namespace without doing an eval on the string. However
2544 the user's namespace without doing an eval on the string. However
2540 that string is now much more strictly checked so that no code
2545 that string is now much more strictly checked so that no code
2541 slips by, so the eval should only happen for things that can
2546 slips by, so the eval should only happen for things that can
2542 really be only function/method names.
2547 really be only function/method names.
2543
2548
2544 2002-10-15 Fernando Perez <fperez@colorado.edu>
2549 2002-10-15 Fernando Perez <fperez@colorado.edu>
2545
2550
2546 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2551 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2547 OSX information to main manual, removed README_Mac_OSX file from
2552 OSX information to main manual, removed README_Mac_OSX file from
2548 distribution. Also updated credits for recent additions.
2553 distribution. Also updated credits for recent additions.
2549
2554
2550 2002-10-10 Fernando Perez <fperez@colorado.edu>
2555 2002-10-10 Fernando Perez <fperez@colorado.edu>
2551
2556
2552 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2557 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2553 terminal-related issues. Many thanks to Andrea Riciputi
2558 terminal-related issues. Many thanks to Andrea Riciputi
2554 <andrea.riciputi-AT-libero.it> for writing it.
2559 <andrea.riciputi-AT-libero.it> for writing it.
2555
2560
2556 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2561 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2557 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2562 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2558
2563
2559 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2564 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2560 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2565 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2561 <syver-en-AT-online.no> who both submitted patches for this problem.
2566 <syver-en-AT-online.no> who both submitted patches for this problem.
2562
2567
2563 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2568 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2564 global embedding to make sure that things don't overwrite user
2569 global embedding to make sure that things don't overwrite user
2565 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2570 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2566
2571
2567 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2572 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2568 compatibility. Thanks to Hayden Callow
2573 compatibility. Thanks to Hayden Callow
2569 <h.callow-AT-elec.canterbury.ac.nz>
2574 <h.callow-AT-elec.canterbury.ac.nz>
2570
2575
2571 2002-10-04 Fernando Perez <fperez@colorado.edu>
2576 2002-10-04 Fernando Perez <fperez@colorado.edu>
2572
2577
2573 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2578 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2574 Gnuplot.File objects.
2579 Gnuplot.File objects.
2575
2580
2576 2002-07-23 Fernando Perez <fperez@colorado.edu>
2581 2002-07-23 Fernando Perez <fperez@colorado.edu>
2577
2582
2578 * IPython/genutils.py (timing): Added timings() and timing() for
2583 * IPython/genutils.py (timing): Added timings() and timing() for
2579 quick access to the most commonly needed data, the execution
2584 quick access to the most commonly needed data, the execution
2580 times. Old timing() renamed to timings_out().
2585 times. Old timing() renamed to timings_out().
2581
2586
2582 2002-07-18 Fernando Perez <fperez@colorado.edu>
2587 2002-07-18 Fernando Perez <fperez@colorado.edu>
2583
2588
2584 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2589 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2585 bug with nested instances disrupting the parent's tab completion.
2590 bug with nested instances disrupting the parent's tab completion.
2586
2591
2587 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2592 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2588 all_completions code to begin the emacs integration.
2593 all_completions code to begin the emacs integration.
2589
2594
2590 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2595 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2591 argument to allow titling individual arrays when plotting.
2596 argument to allow titling individual arrays when plotting.
2592
2597
2593 2002-07-15 Fernando Perez <fperez@colorado.edu>
2598 2002-07-15 Fernando Perez <fperez@colorado.edu>
2594
2599
2595 * setup.py (make_shortcut): changed to retrieve the value of
2600 * setup.py (make_shortcut): changed to retrieve the value of
2596 'Program Files' directory from the registry (this value changes in
2601 'Program Files' directory from the registry (this value changes in
2597 non-english versions of Windows). Thanks to Thomas Fanslau
2602 non-english versions of Windows). Thanks to Thomas Fanslau
2598 <tfanslau-AT-gmx.de> for the report.
2603 <tfanslau-AT-gmx.de> for the report.
2599
2604
2600 2002-07-10 Fernando Perez <fperez@colorado.edu>
2605 2002-07-10 Fernando Perez <fperez@colorado.edu>
2601
2606
2602 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2607 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2603 a bug in pdb, which crashes if a line with only whitespace is
2608 a bug in pdb, which crashes if a line with only whitespace is
2604 entered. Bug report submitted to sourceforge.
2609 entered. Bug report submitted to sourceforge.
2605
2610
2606 2002-07-09 Fernando Perez <fperez@colorado.edu>
2611 2002-07-09 Fernando Perez <fperez@colorado.edu>
2607
2612
2608 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2613 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2609 reporting exceptions (it's a bug in inspect.py, I just set a
2614 reporting exceptions (it's a bug in inspect.py, I just set a
2610 workaround).
2615 workaround).
2611
2616
2612 2002-07-08 Fernando Perez <fperez@colorado.edu>
2617 2002-07-08 Fernando Perez <fperez@colorado.edu>
2613
2618
2614 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2619 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2615 __IPYTHON__ in __builtins__ to show up in user_ns.
2620 __IPYTHON__ in __builtins__ to show up in user_ns.
2616
2621
2617 2002-07-03 Fernando Perez <fperez@colorado.edu>
2622 2002-07-03 Fernando Perez <fperez@colorado.edu>
2618
2623
2619 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2624 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2620 name from @gp_set_instance to @gp_set_default.
2625 name from @gp_set_instance to @gp_set_default.
2621
2626
2622 * IPython/ipmaker.py (make_IPython): default editor value set to
2627 * IPython/ipmaker.py (make_IPython): default editor value set to
2623 '0' (a string), to match the rc file. Otherwise will crash when
2628 '0' (a string), to match the rc file. Otherwise will crash when
2624 .strip() is called on it.
2629 .strip() is called on it.
2625
2630
2626
2631
2627 2002-06-28 Fernando Perez <fperez@colorado.edu>
2632 2002-06-28 Fernando Perez <fperez@colorado.edu>
2628
2633
2629 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2634 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2630 of files in current directory when a file is executed via
2635 of files in current directory when a file is executed via
2631 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2636 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2632
2637
2633 * setup.py (manfiles): fix for rpm builds, submitted by RA
2638 * setup.py (manfiles): fix for rpm builds, submitted by RA
2634 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2639 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2635
2640
2636 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2641 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2637 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2642 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2638 string!). A. Schmolck caught this one.
2643 string!). A. Schmolck caught this one.
2639
2644
2640 2002-06-27 Fernando Perez <fperez@colorado.edu>
2645 2002-06-27 Fernando Perez <fperez@colorado.edu>
2641
2646
2642 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2647 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2643 defined files at the cmd line. __name__ wasn't being set to
2648 defined files at the cmd line. __name__ wasn't being set to
2644 __main__.
2649 __main__.
2645
2650
2646 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2651 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2647 regular lists and tuples besides Numeric arrays.
2652 regular lists and tuples besides Numeric arrays.
2648
2653
2649 * IPython/Prompts.py (CachedOutput.__call__): Added output
2654 * IPython/Prompts.py (CachedOutput.__call__): Added output
2650 supression for input ending with ';'. Similar to Mathematica and
2655 supression for input ending with ';'. Similar to Mathematica and
2651 Matlab. The _* vars and Out[] list are still updated, just like
2656 Matlab. The _* vars and Out[] list are still updated, just like
2652 Mathematica behaves.
2657 Mathematica behaves.
2653
2658
2654 2002-06-25 Fernando Perez <fperez@colorado.edu>
2659 2002-06-25 Fernando Perez <fperez@colorado.edu>
2655
2660
2656 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2661 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2657 .ini extensions for profiels under Windows.
2662 .ini extensions for profiels under Windows.
2658
2663
2659 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2664 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2660 string form. Fix contributed by Alexander Schmolck
2665 string form. Fix contributed by Alexander Schmolck
2661 <a.schmolck-AT-gmx.net>
2666 <a.schmolck-AT-gmx.net>
2662
2667
2663 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2668 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2664 pre-configured Gnuplot instance.
2669 pre-configured Gnuplot instance.
2665
2670
2666 2002-06-21 Fernando Perez <fperez@colorado.edu>
2671 2002-06-21 Fernando Perez <fperez@colorado.edu>
2667
2672
2668 * IPython/numutils.py (exp_safe): new function, works around the
2673 * IPython/numutils.py (exp_safe): new function, works around the
2669 underflow problems in Numeric.
2674 underflow problems in Numeric.
2670 (log2): New fn. Safe log in base 2: returns exact integer answer
2675 (log2): New fn. Safe log in base 2: returns exact integer answer
2671 for exact integer powers of 2.
2676 for exact integer powers of 2.
2672
2677
2673 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2678 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2674 properly.
2679 properly.
2675
2680
2676 2002-06-20 Fernando Perez <fperez@colorado.edu>
2681 2002-06-20 Fernando Perez <fperez@colorado.edu>
2677
2682
2678 * IPython/genutils.py (timing): new function like
2683 * IPython/genutils.py (timing): new function like
2679 Mathematica's. Similar to time_test, but returns more info.
2684 Mathematica's. Similar to time_test, but returns more info.
2680
2685
2681 2002-06-18 Fernando Perez <fperez@colorado.edu>
2686 2002-06-18 Fernando Perez <fperez@colorado.edu>
2682
2687
2683 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2688 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2684 according to Mike Heeter's suggestions.
2689 according to Mike Heeter's suggestions.
2685
2690
2686 2002-06-16 Fernando Perez <fperez@colorado.edu>
2691 2002-06-16 Fernando Perez <fperez@colorado.edu>
2687
2692
2688 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2693 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2689 system. GnuplotMagic is gone as a user-directory option. New files
2694 system. GnuplotMagic is gone as a user-directory option. New files
2690 make it easier to use all the gnuplot stuff both from external
2695 make it easier to use all the gnuplot stuff both from external
2691 programs as well as from IPython. Had to rewrite part of
2696 programs as well as from IPython. Had to rewrite part of
2692 hardcopy() b/c of a strange bug: often the ps files simply don't
2697 hardcopy() b/c of a strange bug: often the ps files simply don't
2693 get created, and require a repeat of the command (often several
2698 get created, and require a repeat of the command (often several
2694 times).
2699 times).
2695
2700
2696 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2701 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2697 resolve output channel at call time, so that if sys.stderr has
2702 resolve output channel at call time, so that if sys.stderr has
2698 been redirected by user this gets honored.
2703 been redirected by user this gets honored.
2699
2704
2700 2002-06-13 Fernando Perez <fperez@colorado.edu>
2705 2002-06-13 Fernando Perez <fperez@colorado.edu>
2701
2706
2702 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2707 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2703 IPShell. Kept a copy with the old names to avoid breaking people's
2708 IPShell. Kept a copy with the old names to avoid breaking people's
2704 embedded code.
2709 embedded code.
2705
2710
2706 * IPython/ipython: simplified it to the bare minimum after
2711 * IPython/ipython: simplified it to the bare minimum after
2707 Holger's suggestions. Added info about how to use it in
2712 Holger's suggestions. Added info about how to use it in
2708 PYTHONSTARTUP.
2713 PYTHONSTARTUP.
2709
2714
2710 * IPython/Shell.py (IPythonShell): changed the options passing
2715 * IPython/Shell.py (IPythonShell): changed the options passing
2711 from a string with funky %s replacements to a straight list. Maybe
2716 from a string with funky %s replacements to a straight list. Maybe
2712 a bit more typing, but it follows sys.argv conventions, so there's
2717 a bit more typing, but it follows sys.argv conventions, so there's
2713 less special-casing to remember.
2718 less special-casing to remember.
2714
2719
2715 2002-06-12 Fernando Perez <fperez@colorado.edu>
2720 2002-06-12 Fernando Perez <fperez@colorado.edu>
2716
2721
2717 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2722 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2718 command. Thanks to a suggestion by Mike Heeter.
2723 command. Thanks to a suggestion by Mike Heeter.
2719 (Magic.magic_pfile): added behavior to look at filenames if given
2724 (Magic.magic_pfile): added behavior to look at filenames if given
2720 arg is not a defined object.
2725 arg is not a defined object.
2721 (Magic.magic_save): New @save function to save code snippets. Also
2726 (Magic.magic_save): New @save function to save code snippets. Also
2722 a Mike Heeter idea.
2727 a Mike Heeter idea.
2723
2728
2724 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2729 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2725 plot() and replot(). Much more convenient now, especially for
2730 plot() and replot(). Much more convenient now, especially for
2726 interactive use.
2731 interactive use.
2727
2732
2728 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2733 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2729 filenames.
2734 filenames.
2730
2735
2731 2002-06-02 Fernando Perez <fperez@colorado.edu>
2736 2002-06-02 Fernando Perez <fperez@colorado.edu>
2732
2737
2733 * IPython/Struct.py (Struct.__init__): modified to admit
2738 * IPython/Struct.py (Struct.__init__): modified to admit
2734 initialization via another struct.
2739 initialization via another struct.
2735
2740
2736 * IPython/genutils.py (SystemExec.__init__): New stateful
2741 * IPython/genutils.py (SystemExec.__init__): New stateful
2737 interface to xsys and bq. Useful for writing system scripts.
2742 interface to xsys and bq. Useful for writing system scripts.
2738
2743
2739 2002-05-30 Fernando Perez <fperez@colorado.edu>
2744 2002-05-30 Fernando Perez <fperez@colorado.edu>
2740
2745
2741 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2746 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2742 documents. This will make the user download smaller (it's getting
2747 documents. This will make the user download smaller (it's getting
2743 too big).
2748 too big).
2744
2749
2745 2002-05-29 Fernando Perez <fperez@colorado.edu>
2750 2002-05-29 Fernando Perez <fperez@colorado.edu>
2746
2751
2747 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2752 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2748 fix problems with shelve and pickle. Seems to work, but I don't
2753 fix problems with shelve and pickle. Seems to work, but I don't
2749 know if corner cases break it. Thanks to Mike Heeter
2754 know if corner cases break it. Thanks to Mike Heeter
2750 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2755 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2751
2756
2752 2002-05-24 Fernando Perez <fperez@colorado.edu>
2757 2002-05-24 Fernando Perez <fperez@colorado.edu>
2753
2758
2754 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2759 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2755 macros having broken.
2760 macros having broken.
2756
2761
2757 2002-05-21 Fernando Perez <fperez@colorado.edu>
2762 2002-05-21 Fernando Perez <fperez@colorado.edu>
2758
2763
2759 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2764 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2760 introduced logging bug: all history before logging started was
2765 introduced logging bug: all history before logging started was
2761 being written one character per line! This came from the redesign
2766 being written one character per line! This came from the redesign
2762 of the input history as a special list which slices to strings,
2767 of the input history as a special list which slices to strings,
2763 not to lists.
2768 not to lists.
2764
2769
2765 2002-05-20 Fernando Perez <fperez@colorado.edu>
2770 2002-05-20 Fernando Perez <fperez@colorado.edu>
2766
2771
2767 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2772 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2768 be an attribute of all classes in this module. The design of these
2773 be an attribute of all classes in this module. The design of these
2769 classes needs some serious overhauling.
2774 classes needs some serious overhauling.
2770
2775
2771 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2776 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2772 which was ignoring '_' in option names.
2777 which was ignoring '_' in option names.
2773
2778
2774 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2779 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2775 'Verbose_novars' to 'Context' and made it the new default. It's a
2780 'Verbose_novars' to 'Context' and made it the new default. It's a
2776 bit more readable and also safer than verbose.
2781 bit more readable and also safer than verbose.
2777
2782
2778 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2783 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2779 triple-quoted strings.
2784 triple-quoted strings.
2780
2785
2781 * IPython/OInspect.py (__all__): new module exposing the object
2786 * IPython/OInspect.py (__all__): new module exposing the object
2782 introspection facilities. Now the corresponding magics are dummy
2787 introspection facilities. Now the corresponding magics are dummy
2783 wrappers around this. Having this module will make it much easier
2788 wrappers around this. Having this module will make it much easier
2784 to put these functions into our modified pdb.
2789 to put these functions into our modified pdb.
2785 This new object inspector system uses the new colorizing module,
2790 This new object inspector system uses the new colorizing module,
2786 so source code and other things are nicely syntax highlighted.
2791 so source code and other things are nicely syntax highlighted.
2787
2792
2788 2002-05-18 Fernando Perez <fperez@colorado.edu>
2793 2002-05-18 Fernando Perez <fperez@colorado.edu>
2789
2794
2790 * IPython/ColorANSI.py: Split the coloring tools into a separate
2795 * IPython/ColorANSI.py: Split the coloring tools into a separate
2791 module so I can use them in other code easier (they were part of
2796 module so I can use them in other code easier (they were part of
2792 ultraTB).
2797 ultraTB).
2793
2798
2794 2002-05-17 Fernando Perez <fperez@colorado.edu>
2799 2002-05-17 Fernando Perez <fperez@colorado.edu>
2795
2800
2796 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2801 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2797 fixed it to set the global 'g' also to the called instance, as
2802 fixed it to set the global 'g' also to the called instance, as
2798 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2803 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2799 user's 'g' variables).
2804 user's 'g' variables).
2800
2805
2801 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2806 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2802 global variables (aliases to _ih,_oh) so that users which expect
2807 global variables (aliases to _ih,_oh) so that users which expect
2803 In[5] or Out[7] to work aren't unpleasantly surprised.
2808 In[5] or Out[7] to work aren't unpleasantly surprised.
2804 (InputList.__getslice__): new class to allow executing slices of
2809 (InputList.__getslice__): new class to allow executing slices of
2805 input history directly. Very simple class, complements the use of
2810 input history directly. Very simple class, complements the use of
2806 macros.
2811 macros.
2807
2812
2808 2002-05-16 Fernando Perez <fperez@colorado.edu>
2813 2002-05-16 Fernando Perez <fperez@colorado.edu>
2809
2814
2810 * setup.py (docdirbase): make doc directory be just doc/IPython
2815 * setup.py (docdirbase): make doc directory be just doc/IPython
2811 without version numbers, it will reduce clutter for users.
2816 without version numbers, it will reduce clutter for users.
2812
2817
2813 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2818 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2814 execfile call to prevent possible memory leak. See for details:
2819 execfile call to prevent possible memory leak. See for details:
2815 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2820 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2816
2821
2817 2002-05-15 Fernando Perez <fperez@colorado.edu>
2822 2002-05-15 Fernando Perez <fperez@colorado.edu>
2818
2823
2819 * IPython/Magic.py (Magic.magic_psource): made the object
2824 * IPython/Magic.py (Magic.magic_psource): made the object
2820 introspection names be more standard: pdoc, pdef, pfile and
2825 introspection names be more standard: pdoc, pdef, pfile and
2821 psource. They all print/page their output, and it makes
2826 psource. They all print/page their output, and it makes
2822 remembering them easier. Kept old names for compatibility as
2827 remembering them easier. Kept old names for compatibility as
2823 aliases.
2828 aliases.
2824
2829
2825 2002-05-14 Fernando Perez <fperez@colorado.edu>
2830 2002-05-14 Fernando Perez <fperez@colorado.edu>
2826
2831
2827 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2832 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2828 what the mouse problem was. The trick is to use gnuplot with temp
2833 what the mouse problem was. The trick is to use gnuplot with temp
2829 files and NOT with pipes (for data communication), because having
2834 files and NOT with pipes (for data communication), because having
2830 both pipes and the mouse on is bad news.
2835 both pipes and the mouse on is bad news.
2831
2836
2832 2002-05-13 Fernando Perez <fperez@colorado.edu>
2837 2002-05-13 Fernando Perez <fperez@colorado.edu>
2833
2838
2834 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2839 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2835 bug. Information would be reported about builtins even when
2840 bug. Information would be reported about builtins even when
2836 user-defined functions overrode them.
2841 user-defined functions overrode them.
2837
2842
2838 2002-05-11 Fernando Perez <fperez@colorado.edu>
2843 2002-05-11 Fernando Perez <fperez@colorado.edu>
2839
2844
2840 * IPython/__init__.py (__all__): removed FlexCompleter from
2845 * IPython/__init__.py (__all__): removed FlexCompleter from
2841 __all__ so that things don't fail in platforms without readline.
2846 __all__ so that things don't fail in platforms without readline.
2842
2847
2843 2002-05-10 Fernando Perez <fperez@colorado.edu>
2848 2002-05-10 Fernando Perez <fperez@colorado.edu>
2844
2849
2845 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2850 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2846 it requires Numeric, effectively making Numeric a dependency for
2851 it requires Numeric, effectively making Numeric a dependency for
2847 IPython.
2852 IPython.
2848
2853
2849 * Released 0.2.13
2854 * Released 0.2.13
2850
2855
2851 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2856 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2852 profiler interface. Now all the major options from the profiler
2857 profiler interface. Now all the major options from the profiler
2853 module are directly supported in IPython, both for single
2858 module are directly supported in IPython, both for single
2854 expressions (@prun) and for full programs (@run -p).
2859 expressions (@prun) and for full programs (@run -p).
2855
2860
2856 2002-05-09 Fernando Perez <fperez@colorado.edu>
2861 2002-05-09 Fernando Perez <fperez@colorado.edu>
2857
2862
2858 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2863 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2859 magic properly formatted for screen.
2864 magic properly formatted for screen.
2860
2865
2861 * setup.py (make_shortcut): Changed things to put pdf version in
2866 * setup.py (make_shortcut): Changed things to put pdf version in
2862 doc/ instead of doc/manual (had to change lyxport a bit).
2867 doc/ instead of doc/manual (had to change lyxport a bit).
2863
2868
2864 * IPython/Magic.py (Profile.string_stats): made profile runs go
2869 * IPython/Magic.py (Profile.string_stats): made profile runs go
2865 through pager (they are long and a pager allows searching, saving,
2870 through pager (they are long and a pager allows searching, saving,
2866 etc.)
2871 etc.)
2867
2872
2868 2002-05-08 Fernando Perez <fperez@colorado.edu>
2873 2002-05-08 Fernando Perez <fperez@colorado.edu>
2869
2874
2870 * Released 0.2.12
2875 * Released 0.2.12
2871
2876
2872 2002-05-06 Fernando Perez <fperez@colorado.edu>
2877 2002-05-06 Fernando Perez <fperez@colorado.edu>
2873
2878
2874 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2879 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2875 introduced); 'hist n1 n2' was broken.
2880 introduced); 'hist n1 n2' was broken.
2876 (Magic.magic_pdb): added optional on/off arguments to @pdb
2881 (Magic.magic_pdb): added optional on/off arguments to @pdb
2877 (Magic.magic_run): added option -i to @run, which executes code in
2882 (Magic.magic_run): added option -i to @run, which executes code in
2878 the IPython namespace instead of a clean one. Also added @irun as
2883 the IPython namespace instead of a clean one. Also added @irun as
2879 an alias to @run -i.
2884 an alias to @run -i.
2880
2885
2881 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2886 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2882 fixed (it didn't really do anything, the namespaces were wrong).
2887 fixed (it didn't really do anything, the namespaces were wrong).
2883
2888
2884 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2889 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2885
2890
2886 * IPython/__init__.py (__all__): Fixed package namespace, now
2891 * IPython/__init__.py (__all__): Fixed package namespace, now
2887 'import IPython' does give access to IPython.<all> as
2892 'import IPython' does give access to IPython.<all> as
2888 expected. Also renamed __release__ to Release.
2893 expected. Also renamed __release__ to Release.
2889
2894
2890 * IPython/Debugger.py (__license__): created new Pdb class which
2895 * IPython/Debugger.py (__license__): created new Pdb class which
2891 functions like a drop-in for the normal pdb.Pdb but does NOT
2896 functions like a drop-in for the normal pdb.Pdb but does NOT
2892 import readline by default. This way it doesn't muck up IPython's
2897 import readline by default. This way it doesn't muck up IPython's
2893 readline handling, and now tab-completion finally works in the
2898 readline handling, and now tab-completion finally works in the
2894 debugger -- sort of. It completes things globally visible, but the
2899 debugger -- sort of. It completes things globally visible, but the
2895 completer doesn't track the stack as pdb walks it. That's a bit
2900 completer doesn't track the stack as pdb walks it. That's a bit
2896 tricky, and I'll have to implement it later.
2901 tricky, and I'll have to implement it later.
2897
2902
2898 2002-05-05 Fernando Perez <fperez@colorado.edu>
2903 2002-05-05 Fernando Perez <fperez@colorado.edu>
2899
2904
2900 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2905 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2901 magic docstrings when printed via ? (explicit \'s were being
2906 magic docstrings when printed via ? (explicit \'s were being
2902 printed).
2907 printed).
2903
2908
2904 * IPython/ipmaker.py (make_IPython): fixed namespace
2909 * IPython/ipmaker.py (make_IPython): fixed namespace
2905 identification bug. Now variables loaded via logs or command-line
2910 identification bug. Now variables loaded via logs or command-line
2906 files are recognized in the interactive namespace by @who.
2911 files are recognized in the interactive namespace by @who.
2907
2912
2908 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2913 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2909 log replay system stemming from the string form of Structs.
2914 log replay system stemming from the string form of Structs.
2910
2915
2911 * IPython/Magic.py (Macro.__init__): improved macros to properly
2916 * IPython/Magic.py (Macro.__init__): improved macros to properly
2912 handle magic commands in them.
2917 handle magic commands in them.
2913 (Magic.magic_logstart): usernames are now expanded so 'logstart
2918 (Magic.magic_logstart): usernames are now expanded so 'logstart
2914 ~/mylog' now works.
2919 ~/mylog' now works.
2915
2920
2916 * IPython/iplib.py (complete): fixed bug where paths starting with
2921 * IPython/iplib.py (complete): fixed bug where paths starting with
2917 '/' would be completed as magic names.
2922 '/' would be completed as magic names.
2918
2923
2919 2002-05-04 Fernando Perez <fperez@colorado.edu>
2924 2002-05-04 Fernando Perez <fperez@colorado.edu>
2920
2925
2921 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2926 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2922 allow running full programs under the profiler's control.
2927 allow running full programs under the profiler's control.
2923
2928
2924 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2929 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2925 mode to report exceptions verbosely but without formatting
2930 mode to report exceptions verbosely but without formatting
2926 variables. This addresses the issue of ipython 'freezing' (it's
2931 variables. This addresses the issue of ipython 'freezing' (it's
2927 not frozen, but caught in an expensive formatting loop) when huge
2932 not frozen, but caught in an expensive formatting loop) when huge
2928 variables are in the context of an exception.
2933 variables are in the context of an exception.
2929 (VerboseTB.text): Added '--->' markers at line where exception was
2934 (VerboseTB.text): Added '--->' markers at line where exception was
2930 triggered. Much clearer to read, especially in NoColor modes.
2935 triggered. Much clearer to read, especially in NoColor modes.
2931
2936
2932 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2937 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2933 implemented in reverse when changing to the new parse_options().
2938 implemented in reverse when changing to the new parse_options().
2934
2939
2935 2002-05-03 Fernando Perez <fperez@colorado.edu>
2940 2002-05-03 Fernando Perez <fperez@colorado.edu>
2936
2941
2937 * IPython/Magic.py (Magic.parse_options): new function so that
2942 * IPython/Magic.py (Magic.parse_options): new function so that
2938 magics can parse options easier.
2943 magics can parse options easier.
2939 (Magic.magic_prun): new function similar to profile.run(),
2944 (Magic.magic_prun): new function similar to profile.run(),
2940 suggested by Chris Hart.
2945 suggested by Chris Hart.
2941 (Magic.magic_cd): fixed behavior so that it only changes if
2946 (Magic.magic_cd): fixed behavior so that it only changes if
2942 directory actually is in history.
2947 directory actually is in history.
2943
2948
2944 * IPython/usage.py (__doc__): added information about potential
2949 * IPython/usage.py (__doc__): added information about potential
2945 slowness of Verbose exception mode when there are huge data
2950 slowness of Verbose exception mode when there are huge data
2946 structures to be formatted (thanks to Archie Paulson).
2951 structures to be formatted (thanks to Archie Paulson).
2947
2952
2948 * IPython/ipmaker.py (make_IPython): Changed default logging
2953 * IPython/ipmaker.py (make_IPython): Changed default logging
2949 (when simply called with -log) to use curr_dir/ipython.log in
2954 (when simply called with -log) to use curr_dir/ipython.log in
2950 rotate mode. Fixed crash which was occuring with -log before
2955 rotate mode. Fixed crash which was occuring with -log before
2951 (thanks to Jim Boyle).
2956 (thanks to Jim Boyle).
2952
2957
2953 2002-05-01 Fernando Perez <fperez@colorado.edu>
2958 2002-05-01 Fernando Perez <fperez@colorado.edu>
2954
2959
2955 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2960 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2956 was nasty -- though somewhat of a corner case).
2961 was nasty -- though somewhat of a corner case).
2957
2962
2958 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2963 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2959 text (was a bug).
2964 text (was a bug).
2960
2965
2961 2002-04-30 Fernando Perez <fperez@colorado.edu>
2966 2002-04-30 Fernando Perez <fperez@colorado.edu>
2962
2967
2963 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
2968 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
2964 a print after ^D or ^C from the user so that the In[] prompt
2969 a print after ^D or ^C from the user so that the In[] prompt
2965 doesn't over-run the gnuplot one.
2970 doesn't over-run the gnuplot one.
2966
2971
2967 2002-04-29 Fernando Perez <fperez@colorado.edu>
2972 2002-04-29 Fernando Perez <fperez@colorado.edu>
2968
2973
2969 * Released 0.2.10
2974 * Released 0.2.10
2970
2975
2971 * IPython/__release__.py (version): get date dynamically.
2976 * IPython/__release__.py (version): get date dynamically.
2972
2977
2973 * Misc. documentation updates thanks to Arnd's comments. Also ran
2978 * Misc. documentation updates thanks to Arnd's comments. Also ran
2974 a full spellcheck on the manual (hadn't been done in a while).
2979 a full spellcheck on the manual (hadn't been done in a while).
2975
2980
2976 2002-04-27 Fernando Perez <fperez@colorado.edu>
2981 2002-04-27 Fernando Perez <fperez@colorado.edu>
2977
2982
2978 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
2983 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
2979 starting a log in mid-session would reset the input history list.
2984 starting a log in mid-session would reset the input history list.
2980
2985
2981 2002-04-26 Fernando Perez <fperez@colorado.edu>
2986 2002-04-26 Fernando Perez <fperez@colorado.edu>
2982
2987
2983 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
2988 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
2984 all files were being included in an update. Now anything in
2989 all files were being included in an update. Now anything in
2985 UserConfig that matches [A-Za-z]*.py will go (this excludes
2990 UserConfig that matches [A-Za-z]*.py will go (this excludes
2986 __init__.py)
2991 __init__.py)
2987
2992
2988 2002-04-25 Fernando Perez <fperez@colorado.edu>
2993 2002-04-25 Fernando Perez <fperez@colorado.edu>
2989
2994
2990 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
2995 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
2991 to __builtins__ so that any form of embedded or imported code can
2996 to __builtins__ so that any form of embedded or imported code can
2992 test for being inside IPython.
2997 test for being inside IPython.
2993
2998
2994 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
2999 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
2995 changed to GnuplotMagic because it's now an importable module,
3000 changed to GnuplotMagic because it's now an importable module,
2996 this makes the name follow that of the standard Gnuplot module.
3001 this makes the name follow that of the standard Gnuplot module.
2997 GnuplotMagic can now be loaded at any time in mid-session.
3002 GnuplotMagic can now be loaded at any time in mid-session.
2998
3003
2999 2002-04-24 Fernando Perez <fperez@colorado.edu>
3004 2002-04-24 Fernando Perez <fperez@colorado.edu>
3000
3005
3001 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3006 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3002 the globals (IPython has its own namespace) and the
3007 the globals (IPython has its own namespace) and the
3003 PhysicalQuantity stuff is much better anyway.
3008 PhysicalQuantity stuff is much better anyway.
3004
3009
3005 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3010 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3006 embedding example to standard user directory for
3011 embedding example to standard user directory for
3007 distribution. Also put it in the manual.
3012 distribution. Also put it in the manual.
3008
3013
3009 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3014 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3010 instance as first argument (so it doesn't rely on some obscure
3015 instance as first argument (so it doesn't rely on some obscure
3011 hidden global).
3016 hidden global).
3012
3017
3013 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3018 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3014 delimiters. While it prevents ().TAB from working, it allows
3019 delimiters. While it prevents ().TAB from working, it allows
3015 completions in open (... expressions. This is by far a more common
3020 completions in open (... expressions. This is by far a more common
3016 case.
3021 case.
3017
3022
3018 2002-04-23 Fernando Perez <fperez@colorado.edu>
3023 2002-04-23 Fernando Perez <fperez@colorado.edu>
3019
3024
3020 * IPython/Extensions/InterpreterPasteInput.py: new
3025 * IPython/Extensions/InterpreterPasteInput.py: new
3021 syntax-processing module for pasting lines with >>> or ... at the
3026 syntax-processing module for pasting lines with >>> or ... at the
3022 start.
3027 start.
3023
3028
3024 * IPython/Extensions/PhysicalQ_Interactive.py
3029 * IPython/Extensions/PhysicalQ_Interactive.py
3025 (PhysicalQuantityInteractive.__int__): fixed to work with either
3030 (PhysicalQuantityInteractive.__int__): fixed to work with either
3026 Numeric or math.
3031 Numeric or math.
3027
3032
3028 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3033 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3029 provided profiles. Now we have:
3034 provided profiles. Now we have:
3030 -math -> math module as * and cmath with its own namespace.
3035 -math -> math module as * and cmath with its own namespace.
3031 -numeric -> Numeric as *, plus gnuplot & grace
3036 -numeric -> Numeric as *, plus gnuplot & grace
3032 -physics -> same as before
3037 -physics -> same as before
3033
3038
3034 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3039 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3035 user-defined magics wouldn't be found by @magic if they were
3040 user-defined magics wouldn't be found by @magic if they were
3036 defined as class methods. Also cleaned up the namespace search
3041 defined as class methods. Also cleaned up the namespace search
3037 logic and the string building (to use %s instead of many repeated
3042 logic and the string building (to use %s instead of many repeated
3038 string adds).
3043 string adds).
3039
3044
3040 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3045 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3041 of user-defined magics to operate with class methods (cleaner, in
3046 of user-defined magics to operate with class methods (cleaner, in
3042 line with the gnuplot code).
3047 line with the gnuplot code).
3043
3048
3044 2002-04-22 Fernando Perez <fperez@colorado.edu>
3049 2002-04-22 Fernando Perez <fperez@colorado.edu>
3045
3050
3046 * setup.py: updated dependency list so that manual is updated when
3051 * setup.py: updated dependency list so that manual is updated when
3047 all included files change.
3052 all included files change.
3048
3053
3049 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3054 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3050 the delimiter removal option (the fix is ugly right now).
3055 the delimiter removal option (the fix is ugly right now).
3051
3056
3052 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3057 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3053 all of the math profile (quicker loading, no conflict between
3058 all of the math profile (quicker loading, no conflict between
3054 g-9.8 and g-gnuplot).
3059 g-9.8 and g-gnuplot).
3055
3060
3056 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3061 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3057 name of post-mortem files to IPython_crash_report.txt.
3062 name of post-mortem files to IPython_crash_report.txt.
3058
3063
3059 * Cleanup/update of the docs. Added all the new readline info and
3064 * Cleanup/update of the docs. Added all the new readline info and
3060 formatted all lists as 'real lists'.
3065 formatted all lists as 'real lists'.
3061
3066
3062 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3067 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3063 tab-completion options, since the full readline parse_and_bind is
3068 tab-completion options, since the full readline parse_and_bind is
3064 now accessible.
3069 now accessible.
3065
3070
3066 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3071 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3067 handling of readline options. Now users can specify any string to
3072 handling of readline options. Now users can specify any string to
3068 be passed to parse_and_bind(), as well as the delimiters to be
3073 be passed to parse_and_bind(), as well as the delimiters to be
3069 removed.
3074 removed.
3070 (InteractiveShell.__init__): Added __name__ to the global
3075 (InteractiveShell.__init__): Added __name__ to the global
3071 namespace so that things like Itpl which rely on its existence
3076 namespace so that things like Itpl which rely on its existence
3072 don't crash.
3077 don't crash.
3073 (InteractiveShell._prefilter): Defined the default with a _ so
3078 (InteractiveShell._prefilter): Defined the default with a _ so
3074 that prefilter() is easier to override, while the default one
3079 that prefilter() is easier to override, while the default one
3075 remains available.
3080 remains available.
3076
3081
3077 2002-04-18 Fernando Perez <fperez@colorado.edu>
3082 2002-04-18 Fernando Perez <fperez@colorado.edu>
3078
3083
3079 * Added information about pdb in the docs.
3084 * Added information about pdb in the docs.
3080
3085
3081 2002-04-17 Fernando Perez <fperez@colorado.edu>
3086 2002-04-17 Fernando Perez <fperez@colorado.edu>
3082
3087
3083 * IPython/ipmaker.py (make_IPython): added rc_override option to
3088 * IPython/ipmaker.py (make_IPython): added rc_override option to
3084 allow passing config options at creation time which may override
3089 allow passing config options at creation time which may override
3085 anything set in the config files or command line. This is
3090 anything set in the config files or command line. This is
3086 particularly useful for configuring embedded instances.
3091 particularly useful for configuring embedded instances.
3087
3092
3088 2002-04-15 Fernando Perez <fperez@colorado.edu>
3093 2002-04-15 Fernando Perez <fperez@colorado.edu>
3089
3094
3090 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3095 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3091 crash embedded instances because of the input cache falling out of
3096 crash embedded instances because of the input cache falling out of
3092 sync with the output counter.
3097 sync with the output counter.
3093
3098
3094 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3099 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3095 mode which calls pdb after an uncaught exception in IPython itself.
3100 mode which calls pdb after an uncaught exception in IPython itself.
3096
3101
3097 2002-04-14 Fernando Perez <fperez@colorado.edu>
3102 2002-04-14 Fernando Perez <fperez@colorado.edu>
3098
3103
3099 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3104 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3100 readline, fix it back after each call.
3105 readline, fix it back after each call.
3101
3106
3102 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3107 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3103 method to force all access via __call__(), which guarantees that
3108 method to force all access via __call__(), which guarantees that
3104 traceback references are properly deleted.
3109 traceback references are properly deleted.
3105
3110
3106 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3111 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3107 improve printing when pprint is in use.
3112 improve printing when pprint is in use.
3108
3113
3109 2002-04-13 Fernando Perez <fperez@colorado.edu>
3114 2002-04-13 Fernando Perez <fperez@colorado.edu>
3110
3115
3111 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3116 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3112 exceptions aren't caught anymore. If the user triggers one, he
3117 exceptions aren't caught anymore. If the user triggers one, he
3113 should know why he's doing it and it should go all the way up,
3118 should know why he's doing it and it should go all the way up,
3114 just like any other exception. So now @abort will fully kill the
3119 just like any other exception. So now @abort will fully kill the
3115 embedded interpreter and the embedding code (unless that happens
3120 embedded interpreter and the embedding code (unless that happens
3116 to catch SystemExit).
3121 to catch SystemExit).
3117
3122
3118 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3123 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3119 and a debugger() method to invoke the interactive pdb debugger
3124 and a debugger() method to invoke the interactive pdb debugger
3120 after printing exception information. Also added the corresponding
3125 after printing exception information. Also added the corresponding
3121 -pdb option and @pdb magic to control this feature, and updated
3126 -pdb option and @pdb magic to control this feature, and updated
3122 the docs. After a suggestion from Christopher Hart
3127 the docs. After a suggestion from Christopher Hart
3123 (hart-AT-caltech.edu).
3128 (hart-AT-caltech.edu).
3124
3129
3125 2002-04-12 Fernando Perez <fperez@colorado.edu>
3130 2002-04-12 Fernando Perez <fperez@colorado.edu>
3126
3131
3127 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3132 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3128 the exception handlers defined by the user (not the CrashHandler)
3133 the exception handlers defined by the user (not the CrashHandler)
3129 so that user exceptions don't trigger an ipython bug report.
3134 so that user exceptions don't trigger an ipython bug report.
3130
3135
3131 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3136 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3132 configurable (it should have always been so).
3137 configurable (it should have always been so).
3133
3138
3134 2002-03-26 Fernando Perez <fperez@colorado.edu>
3139 2002-03-26 Fernando Perez <fperez@colorado.edu>
3135
3140
3136 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3141 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3137 and there to fix embedding namespace issues. This should all be
3142 and there to fix embedding namespace issues. This should all be
3138 done in a more elegant way.
3143 done in a more elegant way.
3139
3144
3140 2002-03-25 Fernando Perez <fperez@colorado.edu>
3145 2002-03-25 Fernando Perez <fperez@colorado.edu>
3141
3146
3142 * IPython/genutils.py (get_home_dir): Try to make it work under
3147 * IPython/genutils.py (get_home_dir): Try to make it work under
3143 win9x also.
3148 win9x also.
3144
3149
3145 2002-03-20 Fernando Perez <fperez@colorado.edu>
3150 2002-03-20 Fernando Perez <fperez@colorado.edu>
3146
3151
3147 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3152 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3148 sys.displayhook untouched upon __init__.
3153 sys.displayhook untouched upon __init__.
3149
3154
3150 2002-03-19 Fernando Perez <fperez@colorado.edu>
3155 2002-03-19 Fernando Perez <fperez@colorado.edu>
3151
3156
3152 * Released 0.2.9 (for embedding bug, basically).
3157 * Released 0.2.9 (for embedding bug, basically).
3153
3158
3154 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3159 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3155 exceptions so that enclosing shell's state can be restored.
3160 exceptions so that enclosing shell's state can be restored.
3156
3161
3157 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3162 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3158 naming conventions in the .ipython/ dir.
3163 naming conventions in the .ipython/ dir.
3159
3164
3160 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3165 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3161 from delimiters list so filenames with - in them get expanded.
3166 from delimiters list so filenames with - in them get expanded.
3162
3167
3163 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3168 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3164 sys.displayhook not being properly restored after an embedded call.
3169 sys.displayhook not being properly restored after an embedded call.
3165
3170
3166 2002-03-18 Fernando Perez <fperez@colorado.edu>
3171 2002-03-18 Fernando Perez <fperez@colorado.edu>
3167
3172
3168 * Released 0.2.8
3173 * Released 0.2.8
3169
3174
3170 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3175 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3171 some files weren't being included in a -upgrade.
3176 some files weren't being included in a -upgrade.
3172 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3177 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3173 on' so that the first tab completes.
3178 on' so that the first tab completes.
3174 (InteractiveShell.handle_magic): fixed bug with spaces around
3179 (InteractiveShell.handle_magic): fixed bug with spaces around
3175 quotes breaking many magic commands.
3180 quotes breaking many magic commands.
3176
3181
3177 * setup.py: added note about ignoring the syntax error messages at
3182 * setup.py: added note about ignoring the syntax error messages at
3178 installation.
3183 installation.
3179
3184
3180 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3185 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3181 streamlining the gnuplot interface, now there's only one magic @gp.
3186 streamlining the gnuplot interface, now there's only one magic @gp.
3182
3187
3183 2002-03-17 Fernando Perez <fperez@colorado.edu>
3188 2002-03-17 Fernando Perez <fperez@colorado.edu>
3184
3189
3185 * IPython/UserConfig/magic_gnuplot.py: new name for the
3190 * IPython/UserConfig/magic_gnuplot.py: new name for the
3186 example-magic_pm.py file. Much enhanced system, now with a shell
3191 example-magic_pm.py file. Much enhanced system, now with a shell
3187 for communicating directly with gnuplot, one command at a time.
3192 for communicating directly with gnuplot, one command at a time.
3188
3193
3189 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3194 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3190 setting __name__=='__main__'.
3195 setting __name__=='__main__'.
3191
3196
3192 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3197 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3193 mini-shell for accessing gnuplot from inside ipython. Should
3198 mini-shell for accessing gnuplot from inside ipython. Should
3194 extend it later for grace access too. Inspired by Arnd's
3199 extend it later for grace access too. Inspired by Arnd's
3195 suggestion.
3200 suggestion.
3196
3201
3197 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3202 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3198 calling magic functions with () in their arguments. Thanks to Arnd
3203 calling magic functions with () in their arguments. Thanks to Arnd
3199 Baecker for pointing this to me.
3204 Baecker for pointing this to me.
3200
3205
3201 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3206 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3202 infinitely for integer or complex arrays (only worked with floats).
3207 infinitely for integer or complex arrays (only worked with floats).
3203
3208
3204 2002-03-16 Fernando Perez <fperez@colorado.edu>
3209 2002-03-16 Fernando Perez <fperez@colorado.edu>
3205
3210
3206 * setup.py: Merged setup and setup_windows into a single script
3211 * setup.py: Merged setup and setup_windows into a single script
3207 which properly handles things for windows users.
3212 which properly handles things for windows users.
3208
3213
3209 2002-03-15 Fernando Perez <fperez@colorado.edu>
3214 2002-03-15 Fernando Perez <fperez@colorado.edu>
3210
3215
3211 * Big change to the manual: now the magics are all automatically
3216 * Big change to the manual: now the magics are all automatically
3212 documented. This information is generated from their docstrings
3217 documented. This information is generated from their docstrings
3213 and put in a latex file included by the manual lyx file. This way
3218 and put in a latex file included by the manual lyx file. This way
3214 we get always up to date information for the magics. The manual
3219 we get always up to date information for the magics. The manual
3215 now also has proper version information, also auto-synced.
3220 now also has proper version information, also auto-synced.
3216
3221
3217 For this to work, an undocumented --magic_docstrings option was added.
3222 For this to work, an undocumented --magic_docstrings option was added.
3218
3223
3219 2002-03-13 Fernando Perez <fperez@colorado.edu>
3224 2002-03-13 Fernando Perez <fperez@colorado.edu>
3220
3225
3221 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3226 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3222 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3227 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3223
3228
3224 2002-03-12 Fernando Perez <fperez@colorado.edu>
3229 2002-03-12 Fernando Perez <fperez@colorado.edu>
3225
3230
3226 * IPython/ultraTB.py (TermColors): changed color escapes again to
3231 * IPython/ultraTB.py (TermColors): changed color escapes again to
3227 fix the (old, reintroduced) line-wrapping bug. Basically, if
3232 fix the (old, reintroduced) line-wrapping bug. Basically, if
3228 \001..\002 aren't given in the color escapes, lines get wrapped
3233 \001..\002 aren't given in the color escapes, lines get wrapped
3229 weirdly. But giving those screws up old xterms and emacs terms. So
3234 weirdly. But giving those screws up old xterms and emacs terms. So
3230 I added some logic for emacs terms to be ok, but I can't identify old
3235 I added some logic for emacs terms to be ok, but I can't identify old
3231 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3236 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3232
3237
3233 2002-03-10 Fernando Perez <fperez@colorado.edu>
3238 2002-03-10 Fernando Perez <fperez@colorado.edu>
3234
3239
3235 * IPython/usage.py (__doc__): Various documentation cleanups and
3240 * IPython/usage.py (__doc__): Various documentation cleanups and
3236 updates, both in usage docstrings and in the manual.
3241 updates, both in usage docstrings and in the manual.
3237
3242
3238 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3243 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3239 handling of caching. Set minimum acceptabe value for having a
3244 handling of caching. Set minimum acceptabe value for having a
3240 cache at 20 values.
3245 cache at 20 values.
3241
3246
3242 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3247 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3243 install_first_time function to a method, renamed it and added an
3248 install_first_time function to a method, renamed it and added an
3244 'upgrade' mode. Now people can update their config directory with
3249 'upgrade' mode. Now people can update their config directory with
3245 a simple command line switch (-upgrade, also new).
3250 a simple command line switch (-upgrade, also new).
3246
3251
3247 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3252 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3248 @file (convenient for automagic users under Python >= 2.2).
3253 @file (convenient for automagic users under Python >= 2.2).
3249 Removed @files (it seemed more like a plural than an abbrev. of
3254 Removed @files (it seemed more like a plural than an abbrev. of
3250 'file show').
3255 'file show').
3251
3256
3252 * IPython/iplib.py (install_first_time): Fixed crash if there were
3257 * IPython/iplib.py (install_first_time): Fixed crash if there were
3253 backup files ('~') in .ipython/ install directory.
3258 backup files ('~') in .ipython/ install directory.
3254
3259
3255 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3260 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3256 system. Things look fine, but these changes are fairly
3261 system. Things look fine, but these changes are fairly
3257 intrusive. Test them for a few days.
3262 intrusive. Test them for a few days.
3258
3263
3259 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3264 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3260 the prompts system. Now all in/out prompt strings are user
3265 the prompts system. Now all in/out prompt strings are user
3261 controllable. This is particularly useful for embedding, as one
3266 controllable. This is particularly useful for embedding, as one
3262 can tag embedded instances with particular prompts.
3267 can tag embedded instances with particular prompts.
3263
3268
3264 Also removed global use of sys.ps1/2, which now allows nested
3269 Also removed global use of sys.ps1/2, which now allows nested
3265 embeddings without any problems. Added command-line options for
3270 embeddings without any problems. Added command-line options for
3266 the prompt strings.
3271 the prompt strings.
3267
3272
3268 2002-03-08 Fernando Perez <fperez@colorado.edu>
3273 2002-03-08 Fernando Perez <fperez@colorado.edu>
3269
3274
3270 * IPython/UserConfig/example-embed-short.py (ipshell): added
3275 * IPython/UserConfig/example-embed-short.py (ipshell): added
3271 example file with the bare minimum code for embedding.
3276 example file with the bare minimum code for embedding.
3272
3277
3273 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3278 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3274 functionality for the embeddable shell to be activated/deactivated
3279 functionality for the embeddable shell to be activated/deactivated
3275 either globally or at each call.
3280 either globally or at each call.
3276
3281
3277 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3282 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3278 rewriting the prompt with '--->' for auto-inputs with proper
3283 rewriting the prompt with '--->' for auto-inputs with proper
3279 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3284 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3280 this is handled by the prompts class itself, as it should.
3285 this is handled by the prompts class itself, as it should.
3281
3286
3282 2002-03-05 Fernando Perez <fperez@colorado.edu>
3287 2002-03-05 Fernando Perez <fperez@colorado.edu>
3283
3288
3284 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3289 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3285 @logstart to avoid name clashes with the math log function.
3290 @logstart to avoid name clashes with the math log function.
3286
3291
3287 * Big updates to X/Emacs section of the manual.
3292 * Big updates to X/Emacs section of the manual.
3288
3293
3289 * Removed ipython_emacs. Milan explained to me how to pass
3294 * Removed ipython_emacs. Milan explained to me how to pass
3290 arguments to ipython through Emacs. Some day I'm going to end up
3295 arguments to ipython through Emacs. Some day I'm going to end up
3291 learning some lisp...
3296 learning some lisp...
3292
3297
3293 2002-03-04 Fernando Perez <fperez@colorado.edu>
3298 2002-03-04 Fernando Perez <fperez@colorado.edu>
3294
3299
3295 * IPython/ipython_emacs: Created script to be used as the
3300 * IPython/ipython_emacs: Created script to be used as the
3296 py-python-command Emacs variable so we can pass IPython
3301 py-python-command Emacs variable so we can pass IPython
3297 parameters. I can't figure out how to tell Emacs directly to pass
3302 parameters. I can't figure out how to tell Emacs directly to pass
3298 parameters to IPython, so a dummy shell script will do it.
3303 parameters to IPython, so a dummy shell script will do it.
3299
3304
3300 Other enhancements made for things to work better under Emacs'
3305 Other enhancements made for things to work better under Emacs'
3301 various types of terminals. Many thanks to Milan Zamazal
3306 various types of terminals. Many thanks to Milan Zamazal
3302 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3307 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3303
3308
3304 2002-03-01 Fernando Perez <fperez@colorado.edu>
3309 2002-03-01 Fernando Perez <fperez@colorado.edu>
3305
3310
3306 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3311 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3307 that loading of readline is now optional. This gives better
3312 that loading of readline is now optional. This gives better
3308 control to emacs users.
3313 control to emacs users.
3309
3314
3310 * IPython/ultraTB.py (__date__): Modified color escape sequences
3315 * IPython/ultraTB.py (__date__): Modified color escape sequences
3311 and now things work fine under xterm and in Emacs' term buffers
3316 and now things work fine under xterm and in Emacs' term buffers
3312 (though not shell ones). Well, in emacs you get colors, but all
3317 (though not shell ones). Well, in emacs you get colors, but all
3313 seem to be 'light' colors (no difference between dark and light
3318 seem to be 'light' colors (no difference between dark and light
3314 ones). But the garbage chars are gone, and also in xterms. It
3319 ones). But the garbage chars are gone, and also in xterms. It
3315 seems that now I'm using 'cleaner' ansi sequences.
3320 seems that now I'm using 'cleaner' ansi sequences.
3316
3321
3317 2002-02-21 Fernando Perez <fperez@colorado.edu>
3322 2002-02-21 Fernando Perez <fperez@colorado.edu>
3318
3323
3319 * Released 0.2.7 (mainly to publish the scoping fix).
3324 * Released 0.2.7 (mainly to publish the scoping fix).
3320
3325
3321 * IPython/Logger.py (Logger.logstate): added. A corresponding
3326 * IPython/Logger.py (Logger.logstate): added. A corresponding
3322 @logstate magic was created.
3327 @logstate magic was created.
3323
3328
3324 * IPython/Magic.py: fixed nested scoping problem under Python
3329 * IPython/Magic.py: fixed nested scoping problem under Python
3325 2.1.x (automagic wasn't working).
3330 2.1.x (automagic wasn't working).
3326
3331
3327 2002-02-20 Fernando Perez <fperez@colorado.edu>
3332 2002-02-20 Fernando Perez <fperez@colorado.edu>
3328
3333
3329 * Released 0.2.6.
3334 * Released 0.2.6.
3330
3335
3331 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3336 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3332 option so that logs can come out without any headers at all.
3337 option so that logs can come out without any headers at all.
3333
3338
3334 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3339 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3335 SciPy.
3340 SciPy.
3336
3341
3337 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3342 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3338 that embedded IPython calls don't require vars() to be explicitly
3343 that embedded IPython calls don't require vars() to be explicitly
3339 passed. Now they are extracted from the caller's frame (code
3344 passed. Now they are extracted from the caller's frame (code
3340 snatched from Eric Jones' weave). Added better documentation to
3345 snatched from Eric Jones' weave). Added better documentation to
3341 the section on embedding and the example file.
3346 the section on embedding and the example file.
3342
3347
3343 * IPython/genutils.py (page): Changed so that under emacs, it just
3348 * IPython/genutils.py (page): Changed so that under emacs, it just
3344 prints the string. You can then page up and down in the emacs
3349 prints the string. You can then page up and down in the emacs
3345 buffer itself. This is how the builtin help() works.
3350 buffer itself. This is how the builtin help() works.
3346
3351
3347 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3352 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3348 macro scoping: macros need to be executed in the user's namespace
3353 macro scoping: macros need to be executed in the user's namespace
3349 to work as if they had been typed by the user.
3354 to work as if they had been typed by the user.
3350
3355
3351 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3356 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3352 execute automatically (no need to type 'exec...'). They then
3357 execute automatically (no need to type 'exec...'). They then
3353 behave like 'true macros'. The printing system was also modified
3358 behave like 'true macros'. The printing system was also modified
3354 for this to work.
3359 for this to work.
3355
3360
3356 2002-02-19 Fernando Perez <fperez@colorado.edu>
3361 2002-02-19 Fernando Perez <fperez@colorado.edu>
3357
3362
3358 * IPython/genutils.py (page_file): new function for paging files
3363 * IPython/genutils.py (page_file): new function for paging files
3359 in an OS-independent way. Also necessary for file viewing to work
3364 in an OS-independent way. Also necessary for file viewing to work
3360 well inside Emacs buffers.
3365 well inside Emacs buffers.
3361 (page): Added checks for being in an emacs buffer.
3366 (page): Added checks for being in an emacs buffer.
3362 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3367 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3363 same bug in iplib.
3368 same bug in iplib.
3364
3369
3365 2002-02-18 Fernando Perez <fperez@colorado.edu>
3370 2002-02-18 Fernando Perez <fperez@colorado.edu>
3366
3371
3367 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3372 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3368 of readline so that IPython can work inside an Emacs buffer.
3373 of readline so that IPython can work inside an Emacs buffer.
3369
3374
3370 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3375 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3371 method signatures (they weren't really bugs, but it looks cleaner
3376 method signatures (they weren't really bugs, but it looks cleaner
3372 and keeps PyChecker happy).
3377 and keeps PyChecker happy).
3373
3378
3374 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3379 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3375 for implementing various user-defined hooks. Currently only
3380 for implementing various user-defined hooks. Currently only
3376 display is done.
3381 display is done.
3377
3382
3378 * IPython/Prompts.py (CachedOutput._display): changed display
3383 * IPython/Prompts.py (CachedOutput._display): changed display
3379 functions so that they can be dynamically changed by users easily.
3384 functions so that they can be dynamically changed by users easily.
3380
3385
3381 * IPython/Extensions/numeric_formats.py (num_display): added an
3386 * IPython/Extensions/numeric_formats.py (num_display): added an
3382 extension for printing NumPy arrays in flexible manners. It
3387 extension for printing NumPy arrays in flexible manners. It
3383 doesn't do anything yet, but all the structure is in
3388 doesn't do anything yet, but all the structure is in
3384 place. Ultimately the plan is to implement output format control
3389 place. Ultimately the plan is to implement output format control
3385 like in Octave.
3390 like in Octave.
3386
3391
3387 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3392 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3388 methods are found at run-time by all the automatic machinery.
3393 methods are found at run-time by all the automatic machinery.
3389
3394
3390 2002-02-17 Fernando Perez <fperez@colorado.edu>
3395 2002-02-17 Fernando Perez <fperez@colorado.edu>
3391
3396
3392 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3397 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3393 whole file a little.
3398 whole file a little.
3394
3399
3395 * ToDo: closed this document. Now there's a new_design.lyx
3400 * ToDo: closed this document. Now there's a new_design.lyx
3396 document for all new ideas. Added making a pdf of it for the
3401 document for all new ideas. Added making a pdf of it for the
3397 end-user distro.
3402 end-user distro.
3398
3403
3399 * IPython/Logger.py (Logger.switch_log): Created this to replace
3404 * IPython/Logger.py (Logger.switch_log): Created this to replace
3400 logon() and logoff(). It also fixes a nasty crash reported by
3405 logon() and logoff(). It also fixes a nasty crash reported by
3401 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3406 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3402
3407
3403 * IPython/iplib.py (complete): got auto-completion to work with
3408 * IPython/iplib.py (complete): got auto-completion to work with
3404 automagic (I had wanted this for a long time).
3409 automagic (I had wanted this for a long time).
3405
3410
3406 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3411 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3407 to @file, since file() is now a builtin and clashes with automagic
3412 to @file, since file() is now a builtin and clashes with automagic
3408 for @file.
3413 for @file.
3409
3414
3410 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3415 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3411 of this was previously in iplib, which had grown to more than 2000
3416 of this was previously in iplib, which had grown to more than 2000
3412 lines, way too long. No new functionality, but it makes managing
3417 lines, way too long. No new functionality, but it makes managing
3413 the code a bit easier.
3418 the code a bit easier.
3414
3419
3415 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3420 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3416 information to crash reports.
3421 information to crash reports.
3417
3422
3418 2002-02-12 Fernando Perez <fperez@colorado.edu>
3423 2002-02-12 Fernando Perez <fperez@colorado.edu>
3419
3424
3420 * Released 0.2.5.
3425 * Released 0.2.5.
3421
3426
3422 2002-02-11 Fernando Perez <fperez@colorado.edu>
3427 2002-02-11 Fernando Perez <fperez@colorado.edu>
3423
3428
3424 * Wrote a relatively complete Windows installer. It puts
3429 * Wrote a relatively complete Windows installer. It puts
3425 everything in place, creates Start Menu entries and fixes the
3430 everything in place, creates Start Menu entries and fixes the
3426 color issues. Nothing fancy, but it works.
3431 color issues. Nothing fancy, but it works.
3427
3432
3428 2002-02-10 Fernando Perez <fperez@colorado.edu>
3433 2002-02-10 Fernando Perez <fperez@colorado.edu>
3429
3434
3430 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3435 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3431 os.path.expanduser() call so that we can type @run ~/myfile.py and
3436 os.path.expanduser() call so that we can type @run ~/myfile.py and
3432 have thigs work as expected.
3437 have thigs work as expected.
3433
3438
3434 * IPython/genutils.py (page): fixed exception handling so things
3439 * IPython/genutils.py (page): fixed exception handling so things
3435 work both in Unix and Windows correctly. Quitting a pager triggers
3440 work both in Unix and Windows correctly. Quitting a pager triggers
3436 an IOError/broken pipe in Unix, and in windows not finding a pager
3441 an IOError/broken pipe in Unix, and in windows not finding a pager
3437 is also an IOError, so I had to actually look at the return value
3442 is also an IOError, so I had to actually look at the return value
3438 of the exception, not just the exception itself. Should be ok now.
3443 of the exception, not just the exception itself. Should be ok now.
3439
3444
3440 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3445 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3441 modified to allow case-insensitive color scheme changes.
3446 modified to allow case-insensitive color scheme changes.
3442
3447
3443 2002-02-09 Fernando Perez <fperez@colorado.edu>
3448 2002-02-09 Fernando Perez <fperez@colorado.edu>
3444
3449
3445 * IPython/genutils.py (native_line_ends): new function to leave
3450 * IPython/genutils.py (native_line_ends): new function to leave
3446 user config files with os-native line-endings.
3451 user config files with os-native line-endings.
3447
3452
3448 * README and manual updates.
3453 * README and manual updates.
3449
3454
3450 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3455 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3451 instead of StringType to catch Unicode strings.
3456 instead of StringType to catch Unicode strings.
3452
3457
3453 * IPython/genutils.py (filefind): fixed bug for paths with
3458 * IPython/genutils.py (filefind): fixed bug for paths with
3454 embedded spaces (very common in Windows).
3459 embedded spaces (very common in Windows).
3455
3460
3456 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3461 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3457 files under Windows, so that they get automatically associated
3462 files under Windows, so that they get automatically associated
3458 with a text editor. Windows makes it a pain to handle
3463 with a text editor. Windows makes it a pain to handle
3459 extension-less files.
3464 extension-less files.
3460
3465
3461 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3466 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3462 warning about readline only occur for Posix. In Windows there's no
3467 warning about readline only occur for Posix. In Windows there's no
3463 way to get readline, so why bother with the warning.
3468 way to get readline, so why bother with the warning.
3464
3469
3465 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3470 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3466 for __str__ instead of dir(self), since dir() changed in 2.2.
3471 for __str__ instead of dir(self), since dir() changed in 2.2.
3467
3472
3468 * Ported to Windows! Tested on XP, I suspect it should work fine
3473 * Ported to Windows! Tested on XP, I suspect it should work fine
3469 on NT/2000, but I don't think it will work on 98 et al. That
3474 on NT/2000, but I don't think it will work on 98 et al. That
3470 series of Windows is such a piece of junk anyway that I won't try
3475 series of Windows is such a piece of junk anyway that I won't try
3471 porting it there. The XP port was straightforward, showed a few
3476 porting it there. The XP port was straightforward, showed a few
3472 bugs here and there (fixed all), in particular some string
3477 bugs here and there (fixed all), in particular some string
3473 handling stuff which required considering Unicode strings (which
3478 handling stuff which required considering Unicode strings (which
3474 Windows uses). This is good, but hasn't been too tested :) No
3479 Windows uses). This is good, but hasn't been too tested :) No
3475 fancy installer yet, I'll put a note in the manual so people at
3480 fancy installer yet, I'll put a note in the manual so people at
3476 least make manually a shortcut.
3481 least make manually a shortcut.
3477
3482
3478 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3483 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3479 into a single one, "colors". This now controls both prompt and
3484 into a single one, "colors". This now controls both prompt and
3480 exception color schemes, and can be changed both at startup
3485 exception color schemes, and can be changed both at startup
3481 (either via command-line switches or via ipythonrc files) and at
3486 (either via command-line switches or via ipythonrc files) and at
3482 runtime, with @colors.
3487 runtime, with @colors.
3483 (Magic.magic_run): renamed @prun to @run and removed the old
3488 (Magic.magic_run): renamed @prun to @run and removed the old
3484 @run. The two were too similar to warrant keeping both.
3489 @run. The two were too similar to warrant keeping both.
3485
3490
3486 2002-02-03 Fernando Perez <fperez@colorado.edu>
3491 2002-02-03 Fernando Perez <fperez@colorado.edu>
3487
3492
3488 * IPython/iplib.py (install_first_time): Added comment on how to
3493 * IPython/iplib.py (install_first_time): Added comment on how to
3489 configure the color options for first-time users. Put a <return>
3494 configure the color options for first-time users. Put a <return>
3490 request at the end so that small-terminal users get a chance to
3495 request at the end so that small-terminal users get a chance to
3491 read the startup info.
3496 read the startup info.
3492
3497
3493 2002-01-23 Fernando Perez <fperez@colorado.edu>
3498 2002-01-23 Fernando Perez <fperez@colorado.edu>
3494
3499
3495 * IPython/iplib.py (CachedOutput.update): Changed output memory
3500 * IPython/iplib.py (CachedOutput.update): Changed output memory
3496 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3501 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3497 input history we still use _i. Did this b/c these variable are
3502 input history we still use _i. Did this b/c these variable are
3498 very commonly used in interactive work, so the less we need to
3503 very commonly used in interactive work, so the less we need to
3499 type the better off we are.
3504 type the better off we are.
3500 (Magic.magic_prun): updated @prun to better handle the namespaces
3505 (Magic.magic_prun): updated @prun to better handle the namespaces
3501 the file will run in, including a fix for __name__ not being set
3506 the file will run in, including a fix for __name__ not being set
3502 before.
3507 before.
3503
3508
3504 2002-01-20 Fernando Perez <fperez@colorado.edu>
3509 2002-01-20 Fernando Perez <fperez@colorado.edu>
3505
3510
3506 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3511 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3507 extra garbage for Python 2.2. Need to look more carefully into
3512 extra garbage for Python 2.2. Need to look more carefully into
3508 this later.
3513 this later.
3509
3514
3510 2002-01-19 Fernando Perez <fperez@colorado.edu>
3515 2002-01-19 Fernando Perez <fperez@colorado.edu>
3511
3516
3512 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3517 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3513 display SyntaxError exceptions properly formatted when they occur
3518 display SyntaxError exceptions properly formatted when they occur
3514 (they can be triggered by imported code).
3519 (they can be triggered by imported code).
3515
3520
3516 2002-01-18 Fernando Perez <fperez@colorado.edu>
3521 2002-01-18 Fernando Perez <fperez@colorado.edu>
3517
3522
3518 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3523 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3519 SyntaxError exceptions are reported nicely formatted, instead of
3524 SyntaxError exceptions are reported nicely formatted, instead of
3520 spitting out only offset information as before.
3525 spitting out only offset information as before.
3521 (Magic.magic_prun): Added the @prun function for executing
3526 (Magic.magic_prun): Added the @prun function for executing
3522 programs with command line args inside IPython.
3527 programs with command line args inside IPython.
3523
3528
3524 2002-01-16 Fernando Perez <fperez@colorado.edu>
3529 2002-01-16 Fernando Perez <fperez@colorado.edu>
3525
3530
3526 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3531 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3527 to *not* include the last item given in a range. This brings their
3532 to *not* include the last item given in a range. This brings their
3528 behavior in line with Python's slicing:
3533 behavior in line with Python's slicing:
3529 a[n1:n2] -> a[n1]...a[n2-1]
3534 a[n1:n2] -> a[n1]...a[n2-1]
3530 It may be a bit less convenient, but I prefer to stick to Python's
3535 It may be a bit less convenient, but I prefer to stick to Python's
3531 conventions *everywhere*, so users never have to wonder.
3536 conventions *everywhere*, so users never have to wonder.
3532 (Magic.magic_macro): Added @macro function to ease the creation of
3537 (Magic.magic_macro): Added @macro function to ease the creation of
3533 macros.
3538 macros.
3534
3539
3535 2002-01-05 Fernando Perez <fperez@colorado.edu>
3540 2002-01-05 Fernando Perez <fperez@colorado.edu>
3536
3541
3537 * Released 0.2.4.
3542 * Released 0.2.4.
3538
3543
3539 * IPython/iplib.py (Magic.magic_pdef):
3544 * IPython/iplib.py (Magic.magic_pdef):
3540 (InteractiveShell.safe_execfile): report magic lines and error
3545 (InteractiveShell.safe_execfile): report magic lines and error
3541 lines without line numbers so one can easily copy/paste them for
3546 lines without line numbers so one can easily copy/paste them for
3542 re-execution.
3547 re-execution.
3543
3548
3544 * Updated manual with recent changes.
3549 * Updated manual with recent changes.
3545
3550
3546 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3551 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3547 docstring printing when class? is called. Very handy for knowing
3552 docstring printing when class? is called. Very handy for knowing
3548 how to create class instances (as long as __init__ is well
3553 how to create class instances (as long as __init__ is well
3549 documented, of course :)
3554 documented, of course :)
3550 (Magic.magic_doc): print both class and constructor docstrings.
3555 (Magic.magic_doc): print both class and constructor docstrings.
3551 (Magic.magic_pdef): give constructor info if passed a class and
3556 (Magic.magic_pdef): give constructor info if passed a class and
3552 __call__ info for callable object instances.
3557 __call__ info for callable object instances.
3553
3558
3554 2002-01-04 Fernando Perez <fperez@colorado.edu>
3559 2002-01-04 Fernando Perez <fperez@colorado.edu>
3555
3560
3556 * Made deep_reload() off by default. It doesn't always work
3561 * Made deep_reload() off by default. It doesn't always work
3557 exactly as intended, so it's probably safer to have it off. It's
3562 exactly as intended, so it's probably safer to have it off. It's
3558 still available as dreload() anyway, so nothing is lost.
3563 still available as dreload() anyway, so nothing is lost.
3559
3564
3560 2002-01-02 Fernando Perez <fperez@colorado.edu>
3565 2002-01-02 Fernando Perez <fperez@colorado.edu>
3561
3566
3562 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3567 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3563 so I wanted an updated release).
3568 so I wanted an updated release).
3564
3569
3565 2001-12-27 Fernando Perez <fperez@colorado.edu>
3570 2001-12-27 Fernando Perez <fperez@colorado.edu>
3566
3571
3567 * IPython/iplib.py (InteractiveShell.interact): Added the original
3572 * IPython/iplib.py (InteractiveShell.interact): Added the original
3568 code from 'code.py' for this module in order to change the
3573 code from 'code.py' for this module in order to change the
3569 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3574 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3570 the history cache would break when the user hit Ctrl-C, and
3575 the history cache would break when the user hit Ctrl-C, and
3571 interact() offers no way to add any hooks to it.
3576 interact() offers no way to add any hooks to it.
3572
3577
3573 2001-12-23 Fernando Perez <fperez@colorado.edu>
3578 2001-12-23 Fernando Perez <fperez@colorado.edu>
3574
3579
3575 * setup.py: added check for 'MANIFEST' before trying to remove
3580 * setup.py: added check for 'MANIFEST' before trying to remove
3576 it. Thanks to Sean Reifschneider.
3581 it. Thanks to Sean Reifschneider.
3577
3582
3578 2001-12-22 Fernando Perez <fperez@colorado.edu>
3583 2001-12-22 Fernando Perez <fperez@colorado.edu>
3579
3584
3580 * Released 0.2.2.
3585 * Released 0.2.2.
3581
3586
3582 * Finished (reasonably) writing the manual. Later will add the
3587 * Finished (reasonably) writing the manual. Later will add the
3583 python-standard navigation stylesheets, but for the time being
3588 python-standard navigation stylesheets, but for the time being
3584 it's fairly complete. Distribution will include html and pdf
3589 it's fairly complete. Distribution will include html and pdf
3585 versions.
3590 versions.
3586
3591
3587 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3592 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3588 (MayaVi author).
3593 (MayaVi author).
3589
3594
3590 2001-12-21 Fernando Perez <fperez@colorado.edu>
3595 2001-12-21 Fernando Perez <fperez@colorado.edu>
3591
3596
3592 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3597 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3593 good public release, I think (with the manual and the distutils
3598 good public release, I think (with the manual and the distutils
3594 installer). The manual can use some work, but that can go
3599 installer). The manual can use some work, but that can go
3595 slowly. Otherwise I think it's quite nice for end users. Next
3600 slowly. Otherwise I think it's quite nice for end users. Next
3596 summer, rewrite the guts of it...
3601 summer, rewrite the guts of it...
3597
3602
3598 * Changed format of ipythonrc files to use whitespace as the
3603 * Changed format of ipythonrc files to use whitespace as the
3599 separator instead of an explicit '='. Cleaner.
3604 separator instead of an explicit '='. Cleaner.
3600
3605
3601 2001-12-20 Fernando Perez <fperez@colorado.edu>
3606 2001-12-20 Fernando Perez <fperez@colorado.edu>
3602
3607
3603 * Started a manual in LyX. For now it's just a quick merge of the
3608 * Started a manual in LyX. For now it's just a quick merge of the
3604 various internal docstrings and READMEs. Later it may grow into a
3609 various internal docstrings and READMEs. Later it may grow into a
3605 nice, full-blown manual.
3610 nice, full-blown manual.
3606
3611
3607 * Set up a distutils based installer. Installation should now be
3612 * Set up a distutils based installer. Installation should now be
3608 trivially simple for end-users.
3613 trivially simple for end-users.
3609
3614
3610 2001-12-11 Fernando Perez <fperez@colorado.edu>
3615 2001-12-11 Fernando Perez <fperez@colorado.edu>
3611
3616
3612 * Released 0.2.0. First public release, announced it at
3617 * Released 0.2.0. First public release, announced it at
3613 comp.lang.python. From now on, just bugfixes...
3618 comp.lang.python. From now on, just bugfixes...
3614
3619
3615 * Went through all the files, set copyright/license notices and
3620 * Went through all the files, set copyright/license notices and
3616 cleaned up things. Ready for release.
3621 cleaned up things. Ready for release.
3617
3622
3618 2001-12-10 Fernando Perez <fperez@colorado.edu>
3623 2001-12-10 Fernando Perez <fperez@colorado.edu>
3619
3624
3620 * Changed the first-time installer not to use tarfiles. It's more
3625 * Changed the first-time installer not to use tarfiles. It's more
3621 robust now and less unix-dependent. Also makes it easier for
3626 robust now and less unix-dependent. Also makes it easier for
3622 people to later upgrade versions.
3627 people to later upgrade versions.
3623
3628
3624 * Changed @exit to @abort to reflect the fact that it's pretty
3629 * Changed @exit to @abort to reflect the fact that it's pretty
3625 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3630 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3626 becomes significant only when IPyhton is embedded: in that case,
3631 becomes significant only when IPyhton is embedded: in that case,
3627 C-D closes IPython only, but @abort kills the enclosing program
3632 C-D closes IPython only, but @abort kills the enclosing program
3628 too (unless it had called IPython inside a try catching
3633 too (unless it had called IPython inside a try catching
3629 SystemExit).
3634 SystemExit).
3630
3635
3631 * Created Shell module which exposes the actuall IPython Shell
3636 * Created Shell module which exposes the actuall IPython Shell
3632 classes, currently the normal and the embeddable one. This at
3637 classes, currently the normal and the embeddable one. This at
3633 least offers a stable interface we won't need to change when
3638 least offers a stable interface we won't need to change when
3634 (later) the internals are rewritten. That rewrite will be confined
3639 (later) the internals are rewritten. That rewrite will be confined
3635 to iplib and ipmaker, but the Shell interface should remain as is.
3640 to iplib and ipmaker, but the Shell interface should remain as is.
3636
3641
3637 * Added embed module which offers an embeddable IPShell object,
3642 * Added embed module which offers an embeddable IPShell object,
3638 useful to fire up IPython *inside* a running program. Great for
3643 useful to fire up IPython *inside* a running program. Great for
3639 debugging or dynamical data analysis.
3644 debugging or dynamical data analysis.
3640
3645
3641 2001-12-08 Fernando Perez <fperez@colorado.edu>
3646 2001-12-08 Fernando Perez <fperez@colorado.edu>
3642
3647
3643 * Fixed small bug preventing seeing info from methods of defined
3648 * Fixed small bug preventing seeing info from methods of defined
3644 objects (incorrect namespace in _ofind()).
3649 objects (incorrect namespace in _ofind()).
3645
3650
3646 * Documentation cleanup. Moved the main usage docstrings to a
3651 * Documentation cleanup. Moved the main usage docstrings to a
3647 separate file, usage.py (cleaner to maintain, and hopefully in the
3652 separate file, usage.py (cleaner to maintain, and hopefully in the
3648 future some perlpod-like way of producing interactive, man and
3653 future some perlpod-like way of producing interactive, man and
3649 html docs out of it will be found).
3654 html docs out of it will be found).
3650
3655
3651 * Added @profile to see your profile at any time.
3656 * Added @profile to see your profile at any time.
3652
3657
3653 * Added @p as an alias for 'print'. It's especially convenient if
3658 * Added @p as an alias for 'print'. It's especially convenient if
3654 using automagic ('p x' prints x).
3659 using automagic ('p x' prints x).
3655
3660
3656 * Small cleanups and fixes after a pychecker run.
3661 * Small cleanups and fixes after a pychecker run.
3657
3662
3658 * Changed the @cd command to handle @cd - and @cd -<n> for
3663 * Changed the @cd command to handle @cd - and @cd -<n> for
3659 visiting any directory in _dh.
3664 visiting any directory in _dh.
3660
3665
3661 * Introduced _dh, a history of visited directories. @dhist prints
3666 * Introduced _dh, a history of visited directories. @dhist prints
3662 it out with numbers.
3667 it out with numbers.
3663
3668
3664 2001-12-07 Fernando Perez <fperez@colorado.edu>
3669 2001-12-07 Fernando Perez <fperez@colorado.edu>
3665
3670
3666 * Released 0.1.22
3671 * Released 0.1.22
3667
3672
3668 * Made initialization a bit more robust against invalid color
3673 * Made initialization a bit more robust against invalid color
3669 options in user input (exit, not traceback-crash).
3674 options in user input (exit, not traceback-crash).
3670
3675
3671 * Changed the bug crash reporter to write the report only in the
3676 * Changed the bug crash reporter to write the report only in the
3672 user's .ipython directory. That way IPython won't litter people's
3677 user's .ipython directory. That way IPython won't litter people's
3673 hard disks with crash files all over the place. Also print on
3678 hard disks with crash files all over the place. Also print on
3674 screen the necessary mail command.
3679 screen the necessary mail command.
3675
3680
3676 * With the new ultraTB, implemented LightBG color scheme for light
3681 * With the new ultraTB, implemented LightBG color scheme for light
3677 background terminals. A lot of people like white backgrounds, so I
3682 background terminals. A lot of people like white backgrounds, so I
3678 guess we should at least give them something readable.
3683 guess we should at least give them something readable.
3679
3684
3680 2001-12-06 Fernando Perez <fperez@colorado.edu>
3685 2001-12-06 Fernando Perez <fperez@colorado.edu>
3681
3686
3682 * Modified the structure of ultraTB. Now there's a proper class
3687 * Modified the structure of ultraTB. Now there's a proper class
3683 for tables of color schemes which allow adding schemes easily and
3688 for tables of color schemes which allow adding schemes easily and
3684 switching the active scheme without creating a new instance every
3689 switching the active scheme without creating a new instance every
3685 time (which was ridiculous). The syntax for creating new schemes
3690 time (which was ridiculous). The syntax for creating new schemes
3686 is also cleaner. I think ultraTB is finally done, with a clean
3691 is also cleaner. I think ultraTB is finally done, with a clean
3687 class structure. Names are also much cleaner (now there's proper
3692 class structure. Names are also much cleaner (now there's proper
3688 color tables, no need for every variable to also have 'color' in
3693 color tables, no need for every variable to also have 'color' in
3689 its name).
3694 its name).
3690
3695
3691 * Broke down genutils into separate files. Now genutils only
3696 * Broke down genutils into separate files. Now genutils only
3692 contains utility functions, and classes have been moved to their
3697 contains utility functions, and classes have been moved to their
3693 own files (they had enough independent functionality to warrant
3698 own files (they had enough independent functionality to warrant
3694 it): ConfigLoader, OutputTrap, Struct.
3699 it): ConfigLoader, OutputTrap, Struct.
3695
3700
3696 2001-12-05 Fernando Perez <fperez@colorado.edu>
3701 2001-12-05 Fernando Perez <fperez@colorado.edu>
3697
3702
3698 * IPython turns 21! Released version 0.1.21, as a candidate for
3703 * IPython turns 21! Released version 0.1.21, as a candidate for
3699 public consumption. If all goes well, release in a few days.
3704 public consumption. If all goes well, release in a few days.
3700
3705
3701 * Fixed path bug (files in Extensions/ directory wouldn't be found
3706 * Fixed path bug (files in Extensions/ directory wouldn't be found
3702 unless IPython/ was explicitly in sys.path).
3707 unless IPython/ was explicitly in sys.path).
3703
3708
3704 * Extended the FlexCompleter class as MagicCompleter to allow
3709 * Extended the FlexCompleter class as MagicCompleter to allow
3705 completion of @-starting lines.
3710 completion of @-starting lines.
3706
3711
3707 * Created __release__.py file as a central repository for release
3712 * Created __release__.py file as a central repository for release
3708 info that other files can read from.
3713 info that other files can read from.
3709
3714
3710 * Fixed small bug in logging: when logging was turned on in
3715 * Fixed small bug in logging: when logging was turned on in
3711 mid-session, old lines with special meanings (!@?) were being
3716 mid-session, old lines with special meanings (!@?) were being
3712 logged without the prepended comment, which is necessary since
3717 logged without the prepended comment, which is necessary since
3713 they are not truly valid python syntax. This should make session
3718 they are not truly valid python syntax. This should make session
3714 restores produce less errors.
3719 restores produce less errors.
3715
3720
3716 * The namespace cleanup forced me to make a FlexCompleter class
3721 * The namespace cleanup forced me to make a FlexCompleter class
3717 which is nothing but a ripoff of rlcompleter, but with selectable
3722 which is nothing but a ripoff of rlcompleter, but with selectable
3718 namespace (rlcompleter only works in __main__.__dict__). I'll try
3723 namespace (rlcompleter only works in __main__.__dict__). I'll try
3719 to submit a note to the authors to see if this change can be
3724 to submit a note to the authors to see if this change can be
3720 incorporated in future rlcompleter releases (Dec.6: done)
3725 incorporated in future rlcompleter releases (Dec.6: done)
3721
3726
3722 * More fixes to namespace handling. It was a mess! Now all
3727 * More fixes to namespace handling. It was a mess! Now all
3723 explicit references to __main__.__dict__ are gone (except when
3728 explicit references to __main__.__dict__ are gone (except when
3724 really needed) and everything is handled through the namespace
3729 really needed) and everything is handled through the namespace
3725 dicts in the IPython instance. We seem to be getting somewhere
3730 dicts in the IPython instance. We seem to be getting somewhere
3726 with this, finally...
3731 with this, finally...
3727
3732
3728 * Small documentation updates.
3733 * Small documentation updates.
3729
3734
3730 * Created the Extensions directory under IPython (with an
3735 * Created the Extensions directory under IPython (with an
3731 __init__.py). Put the PhysicalQ stuff there. This directory should
3736 __init__.py). Put the PhysicalQ stuff there. This directory should
3732 be used for all special-purpose extensions.
3737 be used for all special-purpose extensions.
3733
3738
3734 * File renaming:
3739 * File renaming:
3735 ipythonlib --> ipmaker
3740 ipythonlib --> ipmaker
3736 ipplib --> iplib
3741 ipplib --> iplib
3737 This makes a bit more sense in terms of what these files actually do.
3742 This makes a bit more sense in terms of what these files actually do.
3738
3743
3739 * Moved all the classes and functions in ipythonlib to ipplib, so
3744 * Moved all the classes and functions in ipythonlib to ipplib, so
3740 now ipythonlib only has make_IPython(). This will ease up its
3745 now ipythonlib only has make_IPython(). This will ease up its
3741 splitting in smaller functional chunks later.
3746 splitting in smaller functional chunks later.
3742
3747
3743 * Cleaned up (done, I think) output of @whos. Better column
3748 * Cleaned up (done, I think) output of @whos. Better column
3744 formatting, and now shows str(var) for as much as it can, which is
3749 formatting, and now shows str(var) for as much as it can, which is
3745 typically what one gets with a 'print var'.
3750 typically what one gets with a 'print var'.
3746
3751
3747 2001-12-04 Fernando Perez <fperez@colorado.edu>
3752 2001-12-04 Fernando Perez <fperez@colorado.edu>
3748
3753
3749 * Fixed namespace problems. Now builtin/IPyhton/user names get
3754 * Fixed namespace problems. Now builtin/IPyhton/user names get
3750 properly reported in their namespace. Internal namespace handling
3755 properly reported in their namespace. Internal namespace handling
3751 is finally getting decent (not perfect yet, but much better than
3756 is finally getting decent (not perfect yet, but much better than
3752 the ad-hoc mess we had).
3757 the ad-hoc mess we had).
3753
3758
3754 * Removed -exit option. If people just want to run a python
3759 * Removed -exit option. If people just want to run a python
3755 script, that's what the normal interpreter is for. Less
3760 script, that's what the normal interpreter is for. Less
3756 unnecessary options, less chances for bugs.
3761 unnecessary options, less chances for bugs.
3757
3762
3758 * Added a crash handler which generates a complete post-mortem if
3763 * Added a crash handler which generates a complete post-mortem if
3759 IPython crashes. This will help a lot in tracking bugs down the
3764 IPython crashes. This will help a lot in tracking bugs down the
3760 road.
3765 road.
3761
3766
3762 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3767 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3763 which were boud to functions being reassigned would bypass the
3768 which were boud to functions being reassigned would bypass the
3764 logger, breaking the sync of _il with the prompt counter. This
3769 logger, breaking the sync of _il with the prompt counter. This
3765 would then crash IPython later when a new line was logged.
3770 would then crash IPython later when a new line was logged.
3766
3771
3767 2001-12-02 Fernando Perez <fperez@colorado.edu>
3772 2001-12-02 Fernando Perez <fperez@colorado.edu>
3768
3773
3769 * Made IPython a package. This means people don't have to clutter
3774 * Made IPython a package. This means people don't have to clutter
3770 their sys.path with yet another directory. Changed the INSTALL
3775 their sys.path with yet another directory. Changed the INSTALL
3771 file accordingly.
3776 file accordingly.
3772
3777
3773 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3778 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3774 sorts its output (so @who shows it sorted) and @whos formats the
3779 sorts its output (so @who shows it sorted) and @whos formats the
3775 table according to the width of the first column. Nicer, easier to
3780 table according to the width of the first column. Nicer, easier to
3776 read. Todo: write a generic table_format() which takes a list of
3781 read. Todo: write a generic table_format() which takes a list of
3777 lists and prints it nicely formatted, with optional row/column
3782 lists and prints it nicely formatted, with optional row/column
3778 separators and proper padding and justification.
3783 separators and proper padding and justification.
3779
3784
3780 * Released 0.1.20
3785 * Released 0.1.20
3781
3786
3782 * Fixed bug in @log which would reverse the inputcache list (a
3787 * Fixed bug in @log which would reverse the inputcache list (a
3783 copy operation was missing).
3788 copy operation was missing).
3784
3789
3785 * Code cleanup. @config was changed to use page(). Better, since
3790 * Code cleanup. @config was changed to use page(). Better, since
3786 its output is always quite long.
3791 its output is always quite long.
3787
3792
3788 * Itpl is back as a dependency. I was having too many problems
3793 * Itpl is back as a dependency. I was having too many problems
3789 getting the parametric aliases to work reliably, and it's just
3794 getting the parametric aliases to work reliably, and it's just
3790 easier to code weird string operations with it than playing %()s
3795 easier to code weird string operations with it than playing %()s
3791 games. It's only ~6k, so I don't think it's too big a deal.
3796 games. It's only ~6k, so I don't think it's too big a deal.
3792
3797
3793 * Found (and fixed) a very nasty bug with history. !lines weren't
3798 * Found (and fixed) a very nasty bug with history. !lines weren't
3794 getting cached, and the out of sync caches would crash
3799 getting cached, and the out of sync caches would crash
3795 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3800 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3796 division of labor a bit better. Bug fixed, cleaner structure.
3801 division of labor a bit better. Bug fixed, cleaner structure.
3797
3802
3798 2001-12-01 Fernando Perez <fperez@colorado.edu>
3803 2001-12-01 Fernando Perez <fperez@colorado.edu>
3799
3804
3800 * Released 0.1.19
3805 * Released 0.1.19
3801
3806
3802 * Added option -n to @hist to prevent line number printing. Much
3807 * Added option -n to @hist to prevent line number printing. Much
3803 easier to copy/paste code this way.
3808 easier to copy/paste code this way.
3804
3809
3805 * Created global _il to hold the input list. Allows easy
3810 * Created global _il to hold the input list. Allows easy
3806 re-execution of blocks of code by slicing it (inspired by Janko's
3811 re-execution of blocks of code by slicing it (inspired by Janko's
3807 comment on 'macros').
3812 comment on 'macros').
3808
3813
3809 * Small fixes and doc updates.
3814 * Small fixes and doc updates.
3810
3815
3811 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3816 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3812 much too fragile with automagic. Handles properly multi-line
3817 much too fragile with automagic. Handles properly multi-line
3813 statements and takes parameters.
3818 statements and takes parameters.
3814
3819
3815 2001-11-30 Fernando Perez <fperez@colorado.edu>
3820 2001-11-30 Fernando Perez <fperez@colorado.edu>
3816
3821
3817 * Version 0.1.18 released.
3822 * Version 0.1.18 released.
3818
3823
3819 * Fixed nasty namespace bug in initial module imports.
3824 * Fixed nasty namespace bug in initial module imports.
3820
3825
3821 * Added copyright/license notes to all code files (except
3826 * Added copyright/license notes to all code files (except
3822 DPyGetOpt). For the time being, LGPL. That could change.
3827 DPyGetOpt). For the time being, LGPL. That could change.
3823
3828
3824 * Rewrote a much nicer README, updated INSTALL, cleaned up
3829 * Rewrote a much nicer README, updated INSTALL, cleaned up
3825 ipythonrc-* samples.
3830 ipythonrc-* samples.
3826
3831
3827 * Overall code/documentation cleanup. Basically ready for
3832 * Overall code/documentation cleanup. Basically ready for
3828 release. Only remaining thing: licence decision (LGPL?).
3833 release. Only remaining thing: licence decision (LGPL?).
3829
3834
3830 * Converted load_config to a class, ConfigLoader. Now recursion
3835 * Converted load_config to a class, ConfigLoader. Now recursion
3831 control is better organized. Doesn't include the same file twice.
3836 control is better organized. Doesn't include the same file twice.
3832
3837
3833 2001-11-29 Fernando Perez <fperez@colorado.edu>
3838 2001-11-29 Fernando Perez <fperez@colorado.edu>
3834
3839
3835 * Got input history working. Changed output history variables from
3840 * Got input history working. Changed output history variables from
3836 _p to _o so that _i is for input and _o for output. Just cleaner
3841 _p to _o so that _i is for input and _o for output. Just cleaner
3837 convention.
3842 convention.
3838
3843
3839 * Implemented parametric aliases. This pretty much allows the
3844 * Implemented parametric aliases. This pretty much allows the
3840 alias system to offer full-blown shell convenience, I think.
3845 alias system to offer full-blown shell convenience, I think.
3841
3846
3842 * Version 0.1.17 released, 0.1.18 opened.
3847 * Version 0.1.17 released, 0.1.18 opened.
3843
3848
3844 * dot_ipython/ipythonrc (alias): added documentation.
3849 * dot_ipython/ipythonrc (alias): added documentation.
3845 (xcolor): Fixed small bug (xcolors -> xcolor)
3850 (xcolor): Fixed small bug (xcolors -> xcolor)
3846
3851
3847 * Changed the alias system. Now alias is a magic command to define
3852 * Changed the alias system. Now alias is a magic command to define
3848 aliases just like the shell. Rationale: the builtin magics should
3853 aliases just like the shell. Rationale: the builtin magics should
3849 be there for things deeply connected to IPython's
3854 be there for things deeply connected to IPython's
3850 architecture. And this is a much lighter system for what I think
3855 architecture. And this is a much lighter system for what I think
3851 is the really important feature: allowing users to define quickly
3856 is the really important feature: allowing users to define quickly
3852 magics that will do shell things for them, so they can customize
3857 magics that will do shell things for them, so they can customize
3853 IPython easily to match their work habits. If someone is really
3858 IPython easily to match their work habits. If someone is really
3854 desperate to have another name for a builtin alias, they can
3859 desperate to have another name for a builtin alias, they can
3855 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3860 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3856 works.
3861 works.
3857
3862
3858 2001-11-28 Fernando Perez <fperez@colorado.edu>
3863 2001-11-28 Fernando Perez <fperez@colorado.edu>
3859
3864
3860 * Changed @file so that it opens the source file at the proper
3865 * Changed @file so that it opens the source file at the proper
3861 line. Since it uses less, if your EDITOR environment is
3866 line. Since it uses less, if your EDITOR environment is
3862 configured, typing v will immediately open your editor of choice
3867 configured, typing v will immediately open your editor of choice
3863 right at the line where the object is defined. Not as quick as
3868 right at the line where the object is defined. Not as quick as
3864 having a direct @edit command, but for all intents and purposes it
3869 having a direct @edit command, but for all intents and purposes it
3865 works. And I don't have to worry about writing @edit to deal with
3870 works. And I don't have to worry about writing @edit to deal with
3866 all the editors, less does that.
3871 all the editors, less does that.
3867
3872
3868 * Version 0.1.16 released, 0.1.17 opened.
3873 * Version 0.1.16 released, 0.1.17 opened.
3869
3874
3870 * Fixed some nasty bugs in the page/page_dumb combo that could
3875 * Fixed some nasty bugs in the page/page_dumb combo that could
3871 crash IPython.
3876 crash IPython.
3872
3877
3873 2001-11-27 Fernando Perez <fperez@colorado.edu>
3878 2001-11-27 Fernando Perez <fperez@colorado.edu>
3874
3879
3875 * Version 0.1.15 released, 0.1.16 opened.
3880 * Version 0.1.15 released, 0.1.16 opened.
3876
3881
3877 * Finally got ? and ?? to work for undefined things: now it's
3882 * Finally got ? and ?? to work for undefined things: now it's
3878 possible to type {}.get? and get information about the get method
3883 possible to type {}.get? and get information about the get method
3879 of dicts, or os.path? even if only os is defined (so technically
3884 of dicts, or os.path? even if only os is defined (so technically
3880 os.path isn't). Works at any level. For example, after import os,
3885 os.path isn't). Works at any level. For example, after import os,
3881 os?, os.path?, os.path.abspath? all work. This is great, took some
3886 os?, os.path?, os.path.abspath? all work. This is great, took some
3882 work in _ofind.
3887 work in _ofind.
3883
3888
3884 * Fixed more bugs with logging. The sanest way to do it was to add
3889 * Fixed more bugs with logging. The sanest way to do it was to add
3885 to @log a 'mode' parameter. Killed two in one shot (this mode
3890 to @log a 'mode' parameter. Killed two in one shot (this mode
3886 option was a request of Janko's). I think it's finally clean
3891 option was a request of Janko's). I think it's finally clean
3887 (famous last words).
3892 (famous last words).
3888
3893
3889 * Added a page_dumb() pager which does a decent job of paging on
3894 * Added a page_dumb() pager which does a decent job of paging on
3890 screen, if better things (like less) aren't available. One less
3895 screen, if better things (like less) aren't available. One less
3891 unix dependency (someday maybe somebody will port this to
3896 unix dependency (someday maybe somebody will port this to
3892 windows).
3897 windows).
3893
3898
3894 * Fixed problem in magic_log: would lock of logging out if log
3899 * Fixed problem in magic_log: would lock of logging out if log
3895 creation failed (because it would still think it had succeeded).
3900 creation failed (because it would still think it had succeeded).
3896
3901
3897 * Improved the page() function using curses to auto-detect screen
3902 * Improved the page() function using curses to auto-detect screen
3898 size. Now it can make a much better decision on whether to print
3903 size. Now it can make a much better decision on whether to print
3899 or page a string. Option screen_length was modified: a value 0
3904 or page a string. Option screen_length was modified: a value 0
3900 means auto-detect, and that's the default now.
3905 means auto-detect, and that's the default now.
3901
3906
3902 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3907 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3903 go out. I'll test it for a few days, then talk to Janko about
3908 go out. I'll test it for a few days, then talk to Janko about
3904 licences and announce it.
3909 licences and announce it.
3905
3910
3906 * Fixed the length of the auto-generated ---> prompt which appears
3911 * Fixed the length of the auto-generated ---> prompt which appears
3907 for auto-parens and auto-quotes. Getting this right isn't trivial,
3912 for auto-parens and auto-quotes. Getting this right isn't trivial,
3908 with all the color escapes, different prompt types and optional
3913 with all the color escapes, different prompt types and optional
3909 separators. But it seems to be working in all the combinations.
3914 separators. But it seems to be working in all the combinations.
3910
3915
3911 2001-11-26 Fernando Perez <fperez@colorado.edu>
3916 2001-11-26 Fernando Perez <fperez@colorado.edu>
3912
3917
3913 * Wrote a regexp filter to get option types from the option names
3918 * Wrote a regexp filter to get option types from the option names
3914 string. This eliminates the need to manually keep two duplicate
3919 string. This eliminates the need to manually keep two duplicate
3915 lists.
3920 lists.
3916
3921
3917 * Removed the unneeded check_option_names. Now options are handled
3922 * Removed the unneeded check_option_names. Now options are handled
3918 in a much saner manner and it's easy to visually check that things
3923 in a much saner manner and it's easy to visually check that things
3919 are ok.
3924 are ok.
3920
3925
3921 * Updated version numbers on all files I modified to carry a
3926 * Updated version numbers on all files I modified to carry a
3922 notice so Janko and Nathan have clear version markers.
3927 notice so Janko and Nathan have clear version markers.
3923
3928
3924 * Updated docstring for ultraTB with my changes. I should send
3929 * Updated docstring for ultraTB with my changes. I should send
3925 this to Nathan.
3930 this to Nathan.
3926
3931
3927 * Lots of small fixes. Ran everything through pychecker again.
3932 * Lots of small fixes. Ran everything through pychecker again.
3928
3933
3929 * Made loading of deep_reload an cmd line option. If it's not too
3934 * Made loading of deep_reload an cmd line option. If it's not too
3930 kosher, now people can just disable it. With -nodeep_reload it's
3935 kosher, now people can just disable it. With -nodeep_reload it's
3931 still available as dreload(), it just won't overwrite reload().
3936 still available as dreload(), it just won't overwrite reload().
3932
3937
3933 * Moved many options to the no| form (-opt and -noopt
3938 * Moved many options to the no| form (-opt and -noopt
3934 accepted). Cleaner.
3939 accepted). Cleaner.
3935
3940
3936 * Changed magic_log so that if called with no parameters, it uses
3941 * Changed magic_log so that if called with no parameters, it uses
3937 'rotate' mode. That way auto-generated logs aren't automatically
3942 'rotate' mode. That way auto-generated logs aren't automatically
3938 over-written. For normal logs, now a backup is made if it exists
3943 over-written. For normal logs, now a backup is made if it exists
3939 (only 1 level of backups). A new 'backup' mode was added to the
3944 (only 1 level of backups). A new 'backup' mode was added to the
3940 Logger class to support this. This was a request by Janko.
3945 Logger class to support this. This was a request by Janko.
3941
3946
3942 * Added @logoff/@logon to stop/restart an active log.
3947 * Added @logoff/@logon to stop/restart an active log.
3943
3948
3944 * Fixed a lot of bugs in log saving/replay. It was pretty
3949 * Fixed a lot of bugs in log saving/replay. It was pretty
3945 broken. Now special lines (!@,/) appear properly in the command
3950 broken. Now special lines (!@,/) appear properly in the command
3946 history after a log replay.
3951 history after a log replay.
3947
3952
3948 * Tried and failed to implement full session saving via pickle. My
3953 * Tried and failed to implement full session saving via pickle. My
3949 idea was to pickle __main__.__dict__, but modules can't be
3954 idea was to pickle __main__.__dict__, but modules can't be
3950 pickled. This would be a better alternative to replaying logs, but
3955 pickled. This would be a better alternative to replaying logs, but
3951 seems quite tricky to get to work. Changed -session to be called
3956 seems quite tricky to get to work. Changed -session to be called
3952 -logplay, which more accurately reflects what it does. And if we
3957 -logplay, which more accurately reflects what it does. And if we
3953 ever get real session saving working, -session is now available.
3958 ever get real session saving working, -session is now available.
3954
3959
3955 * Implemented color schemes for prompts also. As for tracebacks,
3960 * Implemented color schemes for prompts also. As for tracebacks,
3956 currently only NoColor and Linux are supported. But now the
3961 currently only NoColor and Linux are supported. But now the
3957 infrastructure is in place, based on a generic ColorScheme
3962 infrastructure is in place, based on a generic ColorScheme
3958 class. So writing and activating new schemes both for the prompts
3963 class. So writing and activating new schemes both for the prompts
3959 and the tracebacks should be straightforward.
3964 and the tracebacks should be straightforward.
3960
3965
3961 * Version 0.1.13 released, 0.1.14 opened.
3966 * Version 0.1.13 released, 0.1.14 opened.
3962
3967
3963 * Changed handling of options for output cache. Now counter is
3968 * Changed handling of options for output cache. Now counter is
3964 hardwired starting at 1 and one specifies the maximum number of
3969 hardwired starting at 1 and one specifies the maximum number of
3965 entries *in the outcache* (not the max prompt counter). This is
3970 entries *in the outcache* (not the max prompt counter). This is
3966 much better, since many statements won't increase the cache
3971 much better, since many statements won't increase the cache
3967 count. It also eliminated some confusing options, now there's only
3972 count. It also eliminated some confusing options, now there's only
3968 one: cache_size.
3973 one: cache_size.
3969
3974
3970 * Added 'alias' magic function and magic_alias option in the
3975 * Added 'alias' magic function and magic_alias option in the
3971 ipythonrc file. Now the user can easily define whatever names he
3976 ipythonrc file. Now the user can easily define whatever names he
3972 wants for the magic functions without having to play weird
3977 wants for the magic functions without having to play weird
3973 namespace games. This gives IPython a real shell-like feel.
3978 namespace games. This gives IPython a real shell-like feel.
3974
3979
3975 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
3980 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
3976 @ or not).
3981 @ or not).
3977
3982
3978 This was one of the last remaining 'visible' bugs (that I know
3983 This was one of the last remaining 'visible' bugs (that I know
3979 of). I think if I can clean up the session loading so it works
3984 of). I think if I can clean up the session loading so it works
3980 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
3985 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
3981 about licensing).
3986 about licensing).
3982
3987
3983 2001-11-25 Fernando Perez <fperez@colorado.edu>
3988 2001-11-25 Fernando Perez <fperez@colorado.edu>
3984
3989
3985 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
3990 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
3986 there's a cleaner distinction between what ? and ?? show.
3991 there's a cleaner distinction between what ? and ?? show.
3987
3992
3988 * Added screen_length option. Now the user can define his own
3993 * Added screen_length option. Now the user can define his own
3989 screen size for page() operations.
3994 screen size for page() operations.
3990
3995
3991 * Implemented magic shell-like functions with automatic code
3996 * Implemented magic shell-like functions with automatic code
3992 generation. Now adding another function is just a matter of adding
3997 generation. Now adding another function is just a matter of adding
3993 an entry to a dict, and the function is dynamically generated at
3998 an entry to a dict, and the function is dynamically generated at
3994 run-time. Python has some really cool features!
3999 run-time. Python has some really cool features!
3995
4000
3996 * Renamed many options to cleanup conventions a little. Now all
4001 * Renamed many options to cleanup conventions a little. Now all
3997 are lowercase, and only underscores where needed. Also in the code
4002 are lowercase, and only underscores where needed. Also in the code
3998 option name tables are clearer.
4003 option name tables are clearer.
3999
4004
4000 * Changed prompts a little. Now input is 'In [n]:' instead of
4005 * Changed prompts a little. Now input is 'In [n]:' instead of
4001 'In[n]:='. This allows it the numbers to be aligned with the
4006 'In[n]:='. This allows it the numbers to be aligned with the
4002 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4007 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4003 Python (it was a Mathematica thing). The '...' continuation prompt
4008 Python (it was a Mathematica thing). The '...' continuation prompt
4004 was also changed a little to align better.
4009 was also changed a little to align better.
4005
4010
4006 * Fixed bug when flushing output cache. Not all _p<n> variables
4011 * Fixed bug when flushing output cache. Not all _p<n> variables
4007 exist, so their deletion needs to be wrapped in a try:
4012 exist, so their deletion needs to be wrapped in a try:
4008
4013
4009 * Figured out how to properly use inspect.formatargspec() (it
4014 * Figured out how to properly use inspect.formatargspec() (it
4010 requires the args preceded by *). So I removed all the code from
4015 requires the args preceded by *). So I removed all the code from
4011 _get_pdef in Magic, which was just replicating that.
4016 _get_pdef in Magic, which was just replicating that.
4012
4017
4013 * Added test to prefilter to allow redefining magic function names
4018 * Added test to prefilter to allow redefining magic function names
4014 as variables. This is ok, since the @ form is always available,
4019 as variables. This is ok, since the @ form is always available,
4015 but whe should allow the user to define a variable called 'ls' if
4020 but whe should allow the user to define a variable called 'ls' if
4016 he needs it.
4021 he needs it.
4017
4022
4018 * Moved the ToDo information from README into a separate ToDo.
4023 * Moved the ToDo information from README into a separate ToDo.
4019
4024
4020 * General code cleanup and small bugfixes. I think it's close to a
4025 * General code cleanup and small bugfixes. I think it's close to a
4021 state where it can be released, obviously with a big 'beta'
4026 state where it can be released, obviously with a big 'beta'
4022 warning on it.
4027 warning on it.
4023
4028
4024 * Got the magic function split to work. Now all magics are defined
4029 * Got the magic function split to work. Now all magics are defined
4025 in a separate class. It just organizes things a bit, and now
4030 in a separate class. It just organizes things a bit, and now
4026 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4031 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4027 was too long).
4032 was too long).
4028
4033
4029 * Changed @clear to @reset to avoid potential confusions with
4034 * Changed @clear to @reset to avoid potential confusions with
4030 the shell command clear. Also renamed @cl to @clear, which does
4035 the shell command clear. Also renamed @cl to @clear, which does
4031 exactly what people expect it to from their shell experience.
4036 exactly what people expect it to from their shell experience.
4032
4037
4033 Added a check to the @reset command (since it's so
4038 Added a check to the @reset command (since it's so
4034 destructive, it's probably a good idea to ask for confirmation).
4039 destructive, it's probably a good idea to ask for confirmation).
4035 But now reset only works for full namespace resetting. Since the
4040 But now reset only works for full namespace resetting. Since the
4036 del keyword is already there for deleting a few specific
4041 del keyword is already there for deleting a few specific
4037 variables, I don't see the point of having a redundant magic
4042 variables, I don't see the point of having a redundant magic
4038 function for the same task.
4043 function for the same task.
4039
4044
4040 2001-11-24 Fernando Perez <fperez@colorado.edu>
4045 2001-11-24 Fernando Perez <fperez@colorado.edu>
4041
4046
4042 * Updated the builtin docs (esp. the ? ones).
4047 * Updated the builtin docs (esp. the ? ones).
4043
4048
4044 * Ran all the code through pychecker. Not terribly impressed with
4049 * Ran all the code through pychecker. Not terribly impressed with
4045 it: lots of spurious warnings and didn't really find anything of
4050 it: lots of spurious warnings and didn't really find anything of
4046 substance (just a few modules being imported and not used).
4051 substance (just a few modules being imported and not used).
4047
4052
4048 * Implemented the new ultraTB functionality into IPython. New
4053 * Implemented the new ultraTB functionality into IPython. New
4049 option: xcolors. This chooses color scheme. xmode now only selects
4054 option: xcolors. This chooses color scheme. xmode now only selects
4050 between Plain and Verbose. Better orthogonality.
4055 between Plain and Verbose. Better orthogonality.
4051
4056
4052 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4057 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4053 mode and color scheme for the exception handlers. Now it's
4058 mode and color scheme for the exception handlers. Now it's
4054 possible to have the verbose traceback with no coloring.
4059 possible to have the verbose traceback with no coloring.
4055
4060
4056 2001-11-23 Fernando Perez <fperez@colorado.edu>
4061 2001-11-23 Fernando Perez <fperez@colorado.edu>
4057
4062
4058 * Version 0.1.12 released, 0.1.13 opened.
4063 * Version 0.1.12 released, 0.1.13 opened.
4059
4064
4060 * Removed option to set auto-quote and auto-paren escapes by
4065 * Removed option to set auto-quote and auto-paren escapes by
4061 user. The chances of breaking valid syntax are just too high. If
4066 user. The chances of breaking valid syntax are just too high. If
4062 someone *really* wants, they can always dig into the code.
4067 someone *really* wants, they can always dig into the code.
4063
4068
4064 * Made prompt separators configurable.
4069 * Made prompt separators configurable.
4065
4070
4066 2001-11-22 Fernando Perez <fperez@colorado.edu>
4071 2001-11-22 Fernando Perez <fperez@colorado.edu>
4067
4072
4068 * Small bugfixes in many places.
4073 * Small bugfixes in many places.
4069
4074
4070 * Removed the MyCompleter class from ipplib. It seemed redundant
4075 * Removed the MyCompleter class from ipplib. It seemed redundant
4071 with the C-p,C-n history search functionality. Less code to
4076 with the C-p,C-n history search functionality. Less code to
4072 maintain.
4077 maintain.
4073
4078
4074 * Moved all the original ipython.py code into ipythonlib.py. Right
4079 * Moved all the original ipython.py code into ipythonlib.py. Right
4075 now it's just one big dump into a function called make_IPython, so
4080 now it's just one big dump into a function called make_IPython, so
4076 no real modularity has been gained. But at least it makes the
4081 no real modularity has been gained. But at least it makes the
4077 wrapper script tiny, and since ipythonlib is a module, it gets
4082 wrapper script tiny, and since ipythonlib is a module, it gets
4078 compiled and startup is much faster.
4083 compiled and startup is much faster.
4079
4084
4080 This is a reasobably 'deep' change, so we should test it for a
4085 This is a reasobably 'deep' change, so we should test it for a
4081 while without messing too much more with the code.
4086 while without messing too much more with the code.
4082
4087
4083 2001-11-21 Fernando Perez <fperez@colorado.edu>
4088 2001-11-21 Fernando Perez <fperez@colorado.edu>
4084
4089
4085 * Version 0.1.11 released, 0.1.12 opened for further work.
4090 * Version 0.1.11 released, 0.1.12 opened for further work.
4086
4091
4087 * Removed dependency on Itpl. It was only needed in one place. It
4092 * Removed dependency on Itpl. It was only needed in one place. It
4088 would be nice if this became part of python, though. It makes life
4093 would be nice if this became part of python, though. It makes life
4089 *a lot* easier in some cases.
4094 *a lot* easier in some cases.
4090
4095
4091 * Simplified the prefilter code a bit. Now all handlers are
4096 * Simplified the prefilter code a bit. Now all handlers are
4092 expected to explicitly return a value (at least a blank string).
4097 expected to explicitly return a value (at least a blank string).
4093
4098
4094 * Heavy edits in ipplib. Removed the help system altogether. Now
4099 * Heavy edits in ipplib. Removed the help system altogether. Now
4095 obj?/?? is used for inspecting objects, a magic @doc prints
4100 obj?/?? is used for inspecting objects, a magic @doc prints
4096 docstrings, and full-blown Python help is accessed via the 'help'
4101 docstrings, and full-blown Python help is accessed via the 'help'
4097 keyword. This cleans up a lot of code (less to maintain) and does
4102 keyword. This cleans up a lot of code (less to maintain) and does
4098 the job. Since 'help' is now a standard Python component, might as
4103 the job. Since 'help' is now a standard Python component, might as
4099 well use it and remove duplicate functionality.
4104 well use it and remove duplicate functionality.
4100
4105
4101 Also removed the option to use ipplib as a standalone program. By
4106 Also removed the option to use ipplib as a standalone program. By
4102 now it's too dependent on other parts of IPython to function alone.
4107 now it's too dependent on other parts of IPython to function alone.
4103
4108
4104 * Fixed bug in genutils.pager. It would crash if the pager was
4109 * Fixed bug in genutils.pager. It would crash if the pager was
4105 exited immediately after opening (broken pipe).
4110 exited immediately after opening (broken pipe).
4106
4111
4107 * Trimmed down the VerboseTB reporting a little. The header is
4112 * Trimmed down the VerboseTB reporting a little. The header is
4108 much shorter now and the repeated exception arguments at the end
4113 much shorter now and the repeated exception arguments at the end
4109 have been removed. For interactive use the old header seemed a bit
4114 have been removed. For interactive use the old header seemed a bit
4110 excessive.
4115 excessive.
4111
4116
4112 * Fixed small bug in output of @whos for variables with multi-word
4117 * Fixed small bug in output of @whos for variables with multi-word
4113 types (only first word was displayed).
4118 types (only first word was displayed).
4114
4119
4115 2001-11-17 Fernando Perez <fperez@colorado.edu>
4120 2001-11-17 Fernando Perez <fperez@colorado.edu>
4116
4121
4117 * Version 0.1.10 released, 0.1.11 opened for further work.
4122 * Version 0.1.10 released, 0.1.11 opened for further work.
4118
4123
4119 * Modified dirs and friends. dirs now *returns* the stack (not
4124 * Modified dirs and friends. dirs now *returns* the stack (not
4120 prints), so one can manipulate it as a variable. Convenient to
4125 prints), so one can manipulate it as a variable. Convenient to
4121 travel along many directories.
4126 travel along many directories.
4122
4127
4123 * Fixed bug in magic_pdef: would only work with functions with
4128 * Fixed bug in magic_pdef: would only work with functions with
4124 arguments with default values.
4129 arguments with default values.
4125
4130
4126 2001-11-14 Fernando Perez <fperez@colorado.edu>
4131 2001-11-14 Fernando Perez <fperez@colorado.edu>
4127
4132
4128 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4133 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4129 example with IPython. Various other minor fixes and cleanups.
4134 example with IPython. Various other minor fixes and cleanups.
4130
4135
4131 * Version 0.1.9 released, 0.1.10 opened for further work.
4136 * Version 0.1.9 released, 0.1.10 opened for further work.
4132
4137
4133 * Added sys.path to the list of directories searched in the
4138 * Added sys.path to the list of directories searched in the
4134 execfile= option. It used to be the current directory and the
4139 execfile= option. It used to be the current directory and the
4135 user's IPYTHONDIR only.
4140 user's IPYTHONDIR only.
4136
4141
4137 2001-11-13 Fernando Perez <fperez@colorado.edu>
4142 2001-11-13 Fernando Perez <fperez@colorado.edu>
4138
4143
4139 * Reinstated the raw_input/prefilter separation that Janko had
4144 * Reinstated the raw_input/prefilter separation that Janko had
4140 initially. This gives a more convenient setup for extending the
4145 initially. This gives a more convenient setup for extending the
4141 pre-processor from the outside: raw_input always gets a string,
4146 pre-processor from the outside: raw_input always gets a string,
4142 and prefilter has to process it. We can then redefine prefilter
4147 and prefilter has to process it. We can then redefine prefilter
4143 from the outside and implement extensions for special
4148 from the outside and implement extensions for special
4144 purposes.
4149 purposes.
4145
4150
4146 Today I got one for inputting PhysicalQuantity objects
4151 Today I got one for inputting PhysicalQuantity objects
4147 (from Scientific) without needing any function calls at
4152 (from Scientific) without needing any function calls at
4148 all. Extremely convenient, and it's all done as a user-level
4153 all. Extremely convenient, and it's all done as a user-level
4149 extension (no IPython code was touched). Now instead of:
4154 extension (no IPython code was touched). Now instead of:
4150 a = PhysicalQuantity(4.2,'m/s**2')
4155 a = PhysicalQuantity(4.2,'m/s**2')
4151 one can simply say
4156 one can simply say
4152 a = 4.2 m/s**2
4157 a = 4.2 m/s**2
4153 or even
4158 or even
4154 a = 4.2 m/s^2
4159 a = 4.2 m/s^2
4155
4160
4156 I use this, but it's also a proof of concept: IPython really is
4161 I use this, but it's also a proof of concept: IPython really is
4157 fully user-extensible, even at the level of the parsing of the
4162 fully user-extensible, even at the level of the parsing of the
4158 command line. It's not trivial, but it's perfectly doable.
4163 command line. It's not trivial, but it's perfectly doable.
4159
4164
4160 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4165 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4161 the problem of modules being loaded in the inverse order in which
4166 the problem of modules being loaded in the inverse order in which
4162 they were defined in
4167 they were defined in
4163
4168
4164 * Version 0.1.8 released, 0.1.9 opened for further work.
4169 * Version 0.1.8 released, 0.1.9 opened for further work.
4165
4170
4166 * Added magics pdef, source and file. They respectively show the
4171 * Added magics pdef, source and file. They respectively show the
4167 definition line ('prototype' in C), source code and full python
4172 definition line ('prototype' in C), source code and full python
4168 file for any callable object. The object inspector oinfo uses
4173 file for any callable object. The object inspector oinfo uses
4169 these to show the same information.
4174 these to show the same information.
4170
4175
4171 * Version 0.1.7 released, 0.1.8 opened for further work.
4176 * Version 0.1.7 released, 0.1.8 opened for further work.
4172
4177
4173 * Separated all the magic functions into a class called Magic. The
4178 * Separated all the magic functions into a class called Magic. The
4174 InteractiveShell class was becoming too big for Xemacs to handle
4179 InteractiveShell class was becoming too big for Xemacs to handle
4175 (de-indenting a line would lock it up for 10 seconds while it
4180 (de-indenting a line would lock it up for 10 seconds while it
4176 backtracked on the whole class!)
4181 backtracked on the whole class!)
4177
4182
4178 FIXME: didn't work. It can be done, but right now namespaces are
4183 FIXME: didn't work. It can be done, but right now namespaces are
4179 all messed up. Do it later (reverted it for now, so at least
4184 all messed up. Do it later (reverted it for now, so at least
4180 everything works as before).
4185 everything works as before).
4181
4186
4182 * Got the object introspection system (magic_oinfo) working! I
4187 * Got the object introspection system (magic_oinfo) working! I
4183 think this is pretty much ready for release to Janko, so he can
4188 think this is pretty much ready for release to Janko, so he can
4184 test it for a while and then announce it. Pretty much 100% of what
4189 test it for a while and then announce it. Pretty much 100% of what
4185 I wanted for the 'phase 1' release is ready. Happy, tired.
4190 I wanted for the 'phase 1' release is ready. Happy, tired.
4186
4191
4187 2001-11-12 Fernando Perez <fperez@colorado.edu>
4192 2001-11-12 Fernando Perez <fperez@colorado.edu>
4188
4193
4189 * Version 0.1.6 released, 0.1.7 opened for further work.
4194 * Version 0.1.6 released, 0.1.7 opened for further work.
4190
4195
4191 * Fixed bug in printing: it used to test for truth before
4196 * Fixed bug in printing: it used to test for truth before
4192 printing, so 0 wouldn't print. Now checks for None.
4197 printing, so 0 wouldn't print. Now checks for None.
4193
4198
4194 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4199 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4195 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4200 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4196 reaches by hand into the outputcache. Think of a better way to do
4201 reaches by hand into the outputcache. Think of a better way to do
4197 this later.
4202 this later.
4198
4203
4199 * Various small fixes thanks to Nathan's comments.
4204 * Various small fixes thanks to Nathan's comments.
4200
4205
4201 * Changed magic_pprint to magic_Pprint. This way it doesn't
4206 * Changed magic_pprint to magic_Pprint. This way it doesn't
4202 collide with pprint() and the name is consistent with the command
4207 collide with pprint() and the name is consistent with the command
4203 line option.
4208 line option.
4204
4209
4205 * Changed prompt counter behavior to be fully like
4210 * Changed prompt counter behavior to be fully like
4206 Mathematica's. That is, even input that doesn't return a result
4211 Mathematica's. That is, even input that doesn't return a result
4207 raises the prompt counter. The old behavior was kind of confusing
4212 raises the prompt counter. The old behavior was kind of confusing
4208 (getting the same prompt number several times if the operation
4213 (getting the same prompt number several times if the operation
4209 didn't return a result).
4214 didn't return a result).
4210
4215
4211 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4216 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4212
4217
4213 * Fixed -Classic mode (wasn't working anymore).
4218 * Fixed -Classic mode (wasn't working anymore).
4214
4219
4215 * Added colored prompts using Nathan's new code. Colors are
4220 * Added colored prompts using Nathan's new code. Colors are
4216 currently hardwired, they can be user-configurable. For
4221 currently hardwired, they can be user-configurable. For
4217 developers, they can be chosen in file ipythonlib.py, at the
4222 developers, they can be chosen in file ipythonlib.py, at the
4218 beginning of the CachedOutput class def.
4223 beginning of the CachedOutput class def.
4219
4224
4220 2001-11-11 Fernando Perez <fperez@colorado.edu>
4225 2001-11-11 Fernando Perez <fperez@colorado.edu>
4221
4226
4222 * Version 0.1.5 released, 0.1.6 opened for further work.
4227 * Version 0.1.5 released, 0.1.6 opened for further work.
4223
4228
4224 * Changed magic_env to *return* the environment as a dict (not to
4229 * Changed magic_env to *return* the environment as a dict (not to
4225 print it). This way it prints, but it can also be processed.
4230 print it). This way it prints, but it can also be processed.
4226
4231
4227 * Added Verbose exception reporting to interactive
4232 * Added Verbose exception reporting to interactive
4228 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4233 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4229 traceback. Had to make some changes to the ultraTB file. This is
4234 traceback. Had to make some changes to the ultraTB file. This is
4230 probably the last 'big' thing in my mental todo list. This ties
4235 probably the last 'big' thing in my mental todo list. This ties
4231 in with the next entry:
4236 in with the next entry:
4232
4237
4233 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4238 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4234 has to specify is Plain, Color or Verbose for all exception
4239 has to specify is Plain, Color or Verbose for all exception
4235 handling.
4240 handling.
4236
4241
4237 * Removed ShellServices option. All this can really be done via
4242 * Removed ShellServices option. All this can really be done via
4238 the magic system. It's easier to extend, cleaner and has automatic
4243 the magic system. It's easier to extend, cleaner and has automatic
4239 namespace protection and documentation.
4244 namespace protection and documentation.
4240
4245
4241 2001-11-09 Fernando Perez <fperez@colorado.edu>
4246 2001-11-09 Fernando Perez <fperez@colorado.edu>
4242
4247
4243 * Fixed bug in output cache flushing (missing parameter to
4248 * Fixed bug in output cache flushing (missing parameter to
4244 __init__). Other small bugs fixed (found using pychecker).
4249 __init__). Other small bugs fixed (found using pychecker).
4245
4250
4246 * Version 0.1.4 opened for bugfixing.
4251 * Version 0.1.4 opened for bugfixing.
4247
4252
4248 2001-11-07 Fernando Perez <fperez@colorado.edu>
4253 2001-11-07 Fernando Perez <fperez@colorado.edu>
4249
4254
4250 * Version 0.1.3 released, mainly because of the raw_input bug.
4255 * Version 0.1.3 released, mainly because of the raw_input bug.
4251
4256
4252 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4257 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4253 and when testing for whether things were callable, a call could
4258 and when testing for whether things were callable, a call could
4254 actually be made to certain functions. They would get called again
4259 actually be made to certain functions. They would get called again
4255 once 'really' executed, with a resulting double call. A disaster
4260 once 'really' executed, with a resulting double call. A disaster
4256 in many cases (list.reverse() would never work!).
4261 in many cases (list.reverse() would never work!).
4257
4262
4258 * Removed prefilter() function, moved its code to raw_input (which
4263 * Removed prefilter() function, moved its code to raw_input (which
4259 after all was just a near-empty caller for prefilter). This saves
4264 after all was just a near-empty caller for prefilter). This saves
4260 a function call on every prompt, and simplifies the class a tiny bit.
4265 a function call on every prompt, and simplifies the class a tiny bit.
4261
4266
4262 * Fix _ip to __ip name in magic example file.
4267 * Fix _ip to __ip name in magic example file.
4263
4268
4264 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4269 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4265 work with non-gnu versions of tar.
4270 work with non-gnu versions of tar.
4266
4271
4267 2001-11-06 Fernando Perez <fperez@colorado.edu>
4272 2001-11-06 Fernando Perez <fperez@colorado.edu>
4268
4273
4269 * Version 0.1.2. Just to keep track of the recent changes.
4274 * Version 0.1.2. Just to keep track of the recent changes.
4270
4275
4271 * Fixed nasty bug in output prompt routine. It used to check 'if
4276 * Fixed nasty bug in output prompt routine. It used to check 'if
4272 arg != None...'. Problem is, this fails if arg implements a
4277 arg != None...'. Problem is, this fails if arg implements a
4273 special comparison (__cmp__) which disallows comparing to
4278 special comparison (__cmp__) which disallows comparing to
4274 None. Found it when trying to use the PhysicalQuantity module from
4279 None. Found it when trying to use the PhysicalQuantity module from
4275 ScientificPython.
4280 ScientificPython.
4276
4281
4277 2001-11-05 Fernando Perez <fperez@colorado.edu>
4282 2001-11-05 Fernando Perez <fperez@colorado.edu>
4278
4283
4279 * Also added dirs. Now the pushd/popd/dirs family functions
4284 * Also added dirs. Now the pushd/popd/dirs family functions
4280 basically like the shell, with the added convenience of going home
4285 basically like the shell, with the added convenience of going home
4281 when called with no args.
4286 when called with no args.
4282
4287
4283 * pushd/popd slightly modified to mimic shell behavior more
4288 * pushd/popd slightly modified to mimic shell behavior more
4284 closely.
4289 closely.
4285
4290
4286 * Added env,pushd,popd from ShellServices as magic functions. I
4291 * Added env,pushd,popd from ShellServices as magic functions. I
4287 think the cleanest will be to port all desired functions from
4292 think the cleanest will be to port all desired functions from
4288 ShellServices as magics and remove ShellServices altogether. This
4293 ShellServices as magics and remove ShellServices altogether. This
4289 will provide a single, clean way of adding functionality
4294 will provide a single, clean way of adding functionality
4290 (shell-type or otherwise) to IP.
4295 (shell-type or otherwise) to IP.
4291
4296
4292 2001-11-04 Fernando Perez <fperez@colorado.edu>
4297 2001-11-04 Fernando Perez <fperez@colorado.edu>
4293
4298
4294 * Added .ipython/ directory to sys.path. This way users can keep
4299 * Added .ipython/ directory to sys.path. This way users can keep
4295 customizations there and access them via import.
4300 customizations there and access them via import.
4296
4301
4297 2001-11-03 Fernando Perez <fperez@colorado.edu>
4302 2001-11-03 Fernando Perez <fperez@colorado.edu>
4298
4303
4299 * Opened version 0.1.1 for new changes.
4304 * Opened version 0.1.1 for new changes.
4300
4305
4301 * Changed version number to 0.1.0: first 'public' release, sent to
4306 * Changed version number to 0.1.0: first 'public' release, sent to
4302 Nathan and Janko.
4307 Nathan and Janko.
4303
4308
4304 * Lots of small fixes and tweaks.
4309 * Lots of small fixes and tweaks.
4305
4310
4306 * Minor changes to whos format. Now strings are shown, snipped if
4311 * Minor changes to whos format. Now strings are shown, snipped if
4307 too long.
4312 too long.
4308
4313
4309 * Changed ShellServices to work on __main__ so they show up in @who
4314 * Changed ShellServices to work on __main__ so they show up in @who
4310
4315
4311 * Help also works with ? at the end of a line:
4316 * Help also works with ? at the end of a line:
4312 ?sin and sin?
4317 ?sin and sin?
4313 both produce the same effect. This is nice, as often I use the
4318 both produce the same effect. This is nice, as often I use the
4314 tab-complete to find the name of a method, but I used to then have
4319 tab-complete to find the name of a method, but I used to then have
4315 to go to the beginning of the line to put a ? if I wanted more
4320 to go to the beginning of the line to put a ? if I wanted more
4316 info. Now I can just add the ? and hit return. Convenient.
4321 info. Now I can just add the ? and hit return. Convenient.
4317
4322
4318 2001-11-02 Fernando Perez <fperez@colorado.edu>
4323 2001-11-02 Fernando Perez <fperez@colorado.edu>
4319
4324
4320 * Python version check (>=2.1) added.
4325 * Python version check (>=2.1) added.
4321
4326
4322 * Added LazyPython documentation. At this point the docs are quite
4327 * Added LazyPython documentation. At this point the docs are quite
4323 a mess. A cleanup is in order.
4328 a mess. A cleanup is in order.
4324
4329
4325 * Auto-installer created. For some bizarre reason, the zipfiles
4330 * Auto-installer created. For some bizarre reason, the zipfiles
4326 module isn't working on my system. So I made a tar version
4331 module isn't working on my system. So I made a tar version
4327 (hopefully the command line options in various systems won't kill
4332 (hopefully the command line options in various systems won't kill
4328 me).
4333 me).
4329
4334
4330 * Fixes to Struct in genutils. Now all dictionary-like methods are
4335 * Fixes to Struct in genutils. Now all dictionary-like methods are
4331 protected (reasonably).
4336 protected (reasonably).
4332
4337
4333 * Added pager function to genutils and changed ? to print usage
4338 * Added pager function to genutils and changed ? to print usage
4334 note through it (it was too long).
4339 note through it (it was too long).
4335
4340
4336 * Added the LazyPython functionality. Works great! I changed the
4341 * Added the LazyPython functionality. Works great! I changed the
4337 auto-quote escape to ';', it's on home row and next to '. But
4342 auto-quote escape to ';', it's on home row and next to '. But
4338 both auto-quote and auto-paren (still /) escapes are command-line
4343 both auto-quote and auto-paren (still /) escapes are command-line
4339 parameters.
4344 parameters.
4340
4345
4341
4346
4342 2001-11-01 Fernando Perez <fperez@colorado.edu>
4347 2001-11-01 Fernando Perez <fperez@colorado.edu>
4343
4348
4344 * Version changed to 0.0.7. Fairly large change: configuration now
4349 * Version changed to 0.0.7. Fairly large change: configuration now
4345 is all stored in a directory, by default .ipython. There, all
4350 is all stored in a directory, by default .ipython. There, all
4346 config files have normal looking names (not .names)
4351 config files have normal looking names (not .names)
4347
4352
4348 * Version 0.0.6 Released first to Lucas and Archie as a test
4353 * Version 0.0.6 Released first to Lucas and Archie as a test
4349 run. Since it's the first 'semi-public' release, change version to
4354 run. Since it's the first 'semi-public' release, change version to
4350 > 0.0.6 for any changes now.
4355 > 0.0.6 for any changes now.
4351
4356
4352 * Stuff I had put in the ipplib.py changelog:
4357 * Stuff I had put in the ipplib.py changelog:
4353
4358
4354 Changes to InteractiveShell:
4359 Changes to InteractiveShell:
4355
4360
4356 - Made the usage message a parameter.
4361 - Made the usage message a parameter.
4357
4362
4358 - Require the name of the shell variable to be given. It's a bit
4363 - Require the name of the shell variable to be given. It's a bit
4359 of a hack, but allows the name 'shell' not to be hardwire in the
4364 of a hack, but allows the name 'shell' not to be hardwire in the
4360 magic (@) handler, which is problematic b/c it requires
4365 magic (@) handler, which is problematic b/c it requires
4361 polluting the global namespace with 'shell'. This in turn is
4366 polluting the global namespace with 'shell'. This in turn is
4362 fragile: if a user redefines a variable called shell, things
4367 fragile: if a user redefines a variable called shell, things
4363 break.
4368 break.
4364
4369
4365 - magic @: all functions available through @ need to be defined
4370 - magic @: all functions available through @ need to be defined
4366 as magic_<name>, even though they can be called simply as
4371 as magic_<name>, even though they can be called simply as
4367 @<name>. This allows the special command @magic to gather
4372 @<name>. This allows the special command @magic to gather
4368 information automatically about all existing magic functions,
4373 information automatically about all existing magic functions,
4369 even if they are run-time user extensions, by parsing the shell
4374 even if they are run-time user extensions, by parsing the shell
4370 instance __dict__ looking for special magic_ names.
4375 instance __dict__ looking for special magic_ names.
4371
4376
4372 - mainloop: added *two* local namespace parameters. This allows
4377 - mainloop: added *two* local namespace parameters. This allows
4373 the class to differentiate between parameters which were there
4378 the class to differentiate between parameters which were there
4374 before and after command line initialization was processed. This
4379 before and after command line initialization was processed. This
4375 way, later @who can show things loaded at startup by the
4380 way, later @who can show things loaded at startup by the
4376 user. This trick was necessary to make session saving/reloading
4381 user. This trick was necessary to make session saving/reloading
4377 really work: ideally after saving/exiting/reloading a session,
4382 really work: ideally after saving/exiting/reloading a session,
4378 *everythin* should look the same, including the output of @who. I
4383 *everythin* should look the same, including the output of @who. I
4379 was only able to make this work with this double namespace
4384 was only able to make this work with this double namespace
4380 trick.
4385 trick.
4381
4386
4382 - added a header to the logfile which allows (almost) full
4387 - added a header to the logfile which allows (almost) full
4383 session restoring.
4388 session restoring.
4384
4389
4385 - prepend lines beginning with @ or !, with a and log
4390 - prepend lines beginning with @ or !, with a and log
4386 them. Why? !lines: may be useful to know what you did @lines:
4391 them. Why? !lines: may be useful to know what you did @lines:
4387 they may affect session state. So when restoring a session, at
4392 they may affect session state. So when restoring a session, at
4388 least inform the user of their presence. I couldn't quite get
4393 least inform the user of their presence. I couldn't quite get
4389 them to properly re-execute, but at least the user is warned.
4394 them to properly re-execute, but at least the user is warned.
4390
4395
4391 * Started ChangeLog.
4396 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now