##// END OF EJS Templates
Fix latex formatting of docstrings, patch by Stefan van der Walt...
fperez -
Show More
@@ -1,2666 +1,2671 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 970 2005-12-29 18:22:53Z fperez $"""
4 $Id: Magic.py 973 2005-12-29 18:51:56Z 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 bdb
24 import bdb
25 import inspect
25 import inspect
26 import os
26 import os
27 import pdb
27 import pdb
28 import pydoc
28 import pydoc
29 import sys
29 import sys
30 import re
30 import re
31 import tempfile
31 import tempfile
32 import time
32 import time
33 import cPickle as pickle
33 import cPickle as pickle
34 from cStringIO import StringIO
34 from cStringIO import StringIO
35 from getopt import getopt
35 from getopt import getopt
36 from pprint import pprint, pformat
36 from pprint import pprint, pformat
37
37
38 # profile isn't bundled by default in Debian for license reasons
38 # profile isn't bundled by default in Debian for license reasons
39 try:
39 try:
40 import profile,pstats
40 import profile,pstats
41 except ImportError:
41 except ImportError:
42 profile = pstats = None
42 profile = pstats = None
43
43
44 # Homebrewed
44 # Homebrewed
45 from IPython import Debugger, OInspect, wildcard
45 from IPython import Debugger, OInspect, wildcard
46 from IPython.FakeModule import FakeModule
46 from IPython.FakeModule import FakeModule
47 from IPython.Itpl import Itpl, itpl, printpl,itplns
47 from IPython.Itpl import Itpl, itpl, printpl,itplns
48 from IPython.PyColorize import Parser
48 from IPython.PyColorize import Parser
49 from IPython.Struct import Struct
49 from IPython.Struct import Struct
50 from IPython.genutils import *
50 from IPython.genutils import *
51
51
52 #***************************************************************************
52 #***************************************************************************
53 # Utility functions
53 # Utility functions
54 def on_off(tag):
54 def on_off(tag):
55 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
55 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
56 return ['OFF','ON'][tag]
56 return ['OFF','ON'][tag]
57
57
58
58
59 #****************************************************************************
59 #****************************************************************************
60 # Utility classes
60 # Utility classes
61 class Macro(list):
61 class Macro(list):
62 """Simple class to store the value of macros as strings.
62 """Simple class to store the value of macros as strings.
63
63
64 This allows us to later exec them by checking when something is an
64 This allows us to later exec them by checking when something is an
65 instance of this class."""
65 instance of this class."""
66
66
67 def __init__(self,data):
67 def __init__(self,data):
68 list.__init__(self,data)
68 list.__init__(self,data)
69 self.value = ''.join(data)
69 self.value = ''.join(data)
70
70
71 #***************************************************************************
71 #***************************************************************************
72 # Main class implementing Magic functionality
72 # Main class implementing Magic functionality
73 class Magic:
73 class Magic:
74 """Magic functions for InteractiveShell.
74 """Magic functions for InteractiveShell.
75
75
76 Shell functions which can be reached as %function_name. All magic
76 Shell functions which can be reached as %function_name. All magic
77 functions should accept a string, which they can parse for their own
77 functions should accept a string, which they can parse for their own
78 needs. This can make some functions easier to type, eg `%cd ../`
78 needs. This can make some functions easier to type, eg `%cd ../`
79 vs. `%cd("../")`
79 vs. `%cd("../")`
80
80
81 ALL definitions MUST begin with the prefix magic_. The user won't need it
81 ALL definitions MUST begin with the prefix magic_. The user won't need it
82 at the command line, but it is is needed in the definition. """
82 at the command line, but it is is needed in the definition. """
83
83
84 # class globals
84 # class globals
85 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
85 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
86 'Automagic is ON, % prefix NOT needed for magic functions.']
86 'Automagic is ON, % prefix NOT needed for magic functions.']
87
87
88 #......................................................................
88 #......................................................................
89 # some utility functions
89 # some utility functions
90
90
91 def __init__(self,shell):
91 def __init__(self,shell):
92
92
93 self.options_table = {}
93 self.options_table = {}
94 if profile is None:
94 if profile is None:
95 self.magic_prun = self.profile_missing_notice
95 self.magic_prun = self.profile_missing_notice
96 self.shell = shell
96 self.shell = shell
97
97
98 def profile_missing_notice(self, *args, **kwargs):
98 def profile_missing_notice(self, *args, **kwargs):
99 error("""\
99 error("""\
100 The profile module could not be found. If you are a Debian user,
100 The profile module could not be found. If you are a Debian user,
101 it has been removed from the standard Debian package because of its non-free
101 it has been removed from the standard Debian package because of its non-free
102 license. To use profiling, please install"python2.3-profiler" from non-free.""")
102 license. To use profiling, please install"python2.3-profiler" from non-free.""")
103
103
104 def default_option(self,fn,optstr):
104 def default_option(self,fn,optstr):
105 """Make an entry in the options_table for fn, with value optstr"""
105 """Make an entry in the options_table for fn, with value optstr"""
106
106
107 if fn not in self.lsmagic():
107 if fn not in self.lsmagic():
108 error("%s is not a magic function" % fn)
108 error("%s is not a magic function" % fn)
109 self.options_table[fn] = optstr
109 self.options_table[fn] = optstr
110
110
111 def lsmagic(self):
111 def lsmagic(self):
112 """Return a list of currently available magic functions.
112 """Return a list of currently available magic functions.
113
113
114 Gives a list of the bare names after mangling (['ls','cd', ...], not
114 Gives a list of the bare names after mangling (['ls','cd', ...], not
115 ['magic_ls','magic_cd',...]"""
115 ['magic_ls','magic_cd',...]"""
116
116
117 # FIXME. This needs a cleanup, in the way the magics list is built.
117 # FIXME. This needs a cleanup, in the way the magics list is built.
118
118
119 # magics in class definition
119 # magics in class definition
120 class_magic = lambda fn: fn.startswith('magic_') and \
120 class_magic = lambda fn: fn.startswith('magic_') and \
121 callable(Magic.__dict__[fn])
121 callable(Magic.__dict__[fn])
122 # in instance namespace (run-time user additions)
122 # in instance namespace (run-time user additions)
123 inst_magic = lambda fn: fn.startswith('magic_') and \
123 inst_magic = lambda fn: fn.startswith('magic_') and \
124 callable(self.__dict__[fn])
124 callable(self.__dict__[fn])
125 # and bound magics by user (so they can access self):
125 # and bound magics by user (so they can access self):
126 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
126 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
127 callable(self.__class__.__dict__[fn])
127 callable(self.__class__.__dict__[fn])
128 magics = filter(class_magic,Magic.__dict__.keys()) + \
128 magics = filter(class_magic,Magic.__dict__.keys()) + \
129 filter(inst_magic,self.__dict__.keys()) + \
129 filter(inst_magic,self.__dict__.keys()) + \
130 filter(inst_bound_magic,self.__class__.__dict__.keys())
130 filter(inst_bound_magic,self.__class__.__dict__.keys())
131 out = []
131 out = []
132 for fn in magics:
132 for fn in magics:
133 out.append(fn.replace('magic_','',1))
133 out.append(fn.replace('magic_','',1))
134 out.sort()
134 out.sort()
135 return out
135 return out
136
136
137 def extract_input_slices(self,slices):
137 def extract_input_slices(self,slices):
138 """Return as a string a set of input history slices.
138 """Return as a string a set of input history slices.
139
139
140 The set of slices is given as a list of strings (like ['1','4:8','9'],
140 The set of slices is given as a list of strings (like ['1','4:8','9'],
141 since this function is for use by magic functions which get their
141 since this function is for use by magic functions which get their
142 arguments as strings."""
142 arguments as strings."""
143
143
144 cmds = []
144 cmds = []
145 for chunk in slices:
145 for chunk in slices:
146 if ':' in chunk:
146 if ':' in chunk:
147 ini,fin = map(int,chunk.split(':'))
147 ini,fin = map(int,chunk.split(':'))
148 else:
148 else:
149 ini = int(chunk)
149 ini = int(chunk)
150 fin = ini+1
150 fin = ini+1
151 cmds.append(self.shell.input_hist[ini:fin])
151 cmds.append(self.shell.input_hist[ini:fin])
152 return cmds
152 return cmds
153
153
154 def _ofind(self,oname):
154 def _ofind(self,oname):
155 """Find an object in the available namespaces.
155 """Find an object in the available namespaces.
156
156
157 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
157 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
158
158
159 Has special code to detect magic functions.
159 Has special code to detect magic functions.
160 """
160 """
161
161
162 oname = oname.strip()
162 oname = oname.strip()
163
163
164 # Namespaces to search in:
164 # Namespaces to search in:
165 user_ns = self.shell.user_ns
165 user_ns = self.shell.user_ns
166 internal_ns = self.shell.internal_ns
166 internal_ns = self.shell.internal_ns
167 builtin_ns = __builtin__.__dict__
167 builtin_ns = __builtin__.__dict__
168 alias_ns = self.shell.alias_table
168 alias_ns = self.shell.alias_table
169
169
170 # Put them in a list. The order is important so that we find things in
170 # Put them in a list. The order is important so that we find things in
171 # the same order that Python finds them.
171 # the same order that Python finds them.
172 namespaces = [ ('Interactive',user_ns),
172 namespaces = [ ('Interactive',user_ns),
173 ('IPython internal',internal_ns),
173 ('IPython internal',internal_ns),
174 ('Python builtin',builtin_ns),
174 ('Python builtin',builtin_ns),
175 ('Alias',alias_ns),
175 ('Alias',alias_ns),
176 ]
176 ]
177
177
178 # initialize results to 'null'
178 # initialize results to 'null'
179 found = 0; obj = None; ospace = None; ds = None;
179 found = 0; obj = None; ospace = None; ds = None;
180 ismagic = 0; isalias = 0
180 ismagic = 0; isalias = 0
181
181
182 # Look for the given name by splitting it in parts. If the head is
182 # Look for the given name by splitting it in parts. If the head is
183 # found, then we look for all the remaining parts as members, and only
183 # found, then we look for all the remaining parts as members, and only
184 # declare success if we can find them all.
184 # declare success if we can find them all.
185 oname_parts = oname.split('.')
185 oname_parts = oname.split('.')
186 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
186 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
187 for nsname,ns in namespaces:
187 for nsname,ns in namespaces:
188 try:
188 try:
189 obj = ns[oname_head]
189 obj = ns[oname_head]
190 except KeyError:
190 except KeyError:
191 continue
191 continue
192 else:
192 else:
193 for part in oname_rest:
193 for part in oname_rest:
194 try:
194 try:
195 obj = getattr(obj,part)
195 obj = getattr(obj,part)
196 except:
196 except:
197 # Blanket except b/c some badly implemented objects
197 # Blanket except b/c some badly implemented objects
198 # allow __getattr__ to raise exceptions other than
198 # allow __getattr__ to raise exceptions other than
199 # AttributeError, which then crashes IPython.
199 # AttributeError, which then crashes IPython.
200 break
200 break
201 else:
201 else:
202 # If we finish the for loop (no break), we got all members
202 # If we finish the for loop (no break), we got all members
203 found = 1
203 found = 1
204 ospace = nsname
204 ospace = nsname
205 if ns == alias_ns:
205 if ns == alias_ns:
206 isalias = 1
206 isalias = 1
207 break # namespace loop
207 break # namespace loop
208
208
209 # Try to see if it's magic
209 # Try to see if it's magic
210 if not found:
210 if not found:
211 if oname.startswith(self.shell.ESC_MAGIC):
211 if oname.startswith(self.shell.ESC_MAGIC):
212 oname = oname[1:]
212 oname = oname[1:]
213 obj = getattr(self,'magic_'+oname,None)
213 obj = getattr(self,'magic_'+oname,None)
214 if obj is not None:
214 if obj is not None:
215 found = 1
215 found = 1
216 ospace = 'IPython internal'
216 ospace = 'IPython internal'
217 ismagic = 1
217 ismagic = 1
218
218
219 # Last try: special-case some literals like '', [], {}, etc:
219 # Last try: special-case some literals like '', [], {}, etc:
220 if not found and oname_head in ["''",'""','[]','{}','()']:
220 if not found and oname_head in ["''",'""','[]','{}','()']:
221 obj = eval(oname_head)
221 obj = eval(oname_head)
222 found = 1
222 found = 1
223 ospace = 'Interactive'
223 ospace = 'Interactive'
224
224
225 return {'found':found, 'obj':obj, 'namespace':ospace,
225 return {'found':found, 'obj':obj, 'namespace':ospace,
226 'ismagic':ismagic, 'isalias':isalias}
226 'ismagic':ismagic, 'isalias':isalias}
227
227
228 def arg_err(self,func):
228 def arg_err(self,func):
229 """Print docstring if incorrect arguments were passed"""
229 """Print docstring if incorrect arguments were passed"""
230 print 'Error in arguments:'
230 print 'Error in arguments:'
231 print OInspect.getdoc(func)
231 print OInspect.getdoc(func)
232
232
233
233
234 def format_latex(self,str):
234 def format_latex(self,strng):
235 """Format a string for latex inclusion."""
235 """Format a string for latex inclusion."""
236
236
237 # Characters that need to be escaped for latex:
237 # Characters that need to be escaped for latex:
238 escape_re = re.compile(r'(%|_|\$)',re.MULTILINE)
238 escape_re = re.compile(r'(%|_|\$|#)',re.MULTILINE)
239 # Magic command names as headers:
239 # Magic command names as headers:
240 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
240 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
241 re.MULTILINE)
241 re.MULTILINE)
242 # Magic commands
242 # Magic commands
243 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
243 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
244 re.MULTILINE)
244 re.MULTILINE)
245 # Paragraph continue
245 # Paragraph continue
246 par_re = re.compile(r'\\$',re.MULTILINE)
246 par_re = re.compile(r'\\$',re.MULTILINE)
247
247
248 str = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',str)
248 # The "\n" symbol
249 str = cmd_re.sub(r'\\texttt{\g<cmd>}',str)
249 newline_re = re.compile(r'\\n')
250 str = par_re.sub(r'\\\\',str)
251 str = escape_re.sub(r'\\\1',str)
252 return str
253
250
254 def format_screen(self,str):
251 # Now build the string for output:
252 strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
253 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
254 strng = par_re.sub(r'\\\\',strng)
255 strng = escape_re.sub(r'\\\1',strng)
256 strng = newline_re.sub(r'\\textbackslash{}n',strng)
257 return strng
258
259 def format_screen(self,strng):
255 """Format a string for screen printing.
260 """Format a string for screen printing.
256
261
257 This removes some latex-type format codes."""
262 This removes some latex-type format codes."""
258 # Paragraph continue
263 # Paragraph continue
259 par_re = re.compile(r'\\$',re.MULTILINE)
264 par_re = re.compile(r'\\$',re.MULTILINE)
260 str = par_re.sub('',str)
265 strng = par_re.sub('',strng)
261 return str
266 return strng
262
267
263 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
268 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
264 """Parse options passed to an argument string.
269 """Parse options passed to an argument string.
265
270
266 The interface is similar to that of getopt(), but it returns back a
271 The interface is similar to that of getopt(), but it returns back a
267 Struct with the options as keys and the stripped argument string still
272 Struct with the options as keys and the stripped argument string still
268 as a string.
273 as a string.
269
274
270 arg_str is quoted as a true sys.argv vector by using shlex.split.
275 arg_str is quoted as a true sys.argv vector by using shlex.split.
271 This allows us to easily expand variables, glob files, quote
276 This allows us to easily expand variables, glob files, quote
272 arguments, etc.
277 arguments, etc.
273
278
274 Options:
279 Options:
275 -mode: default 'string'. If given as 'list', the argument string is
280 -mode: default 'string'. If given as 'list', the argument string is
276 returned as a list (split on whitespace) instead of a string.
281 returned as a list (split on whitespace) instead of a string.
277
282
278 -list_all: put all option values in lists. Normally only options
283 -list_all: put all option values in lists. Normally only options
279 appearing more than once are put in a list."""
284 appearing more than once are put in a list."""
280
285
281 # inject default options at the beginning of the input line
286 # inject default options at the beginning of the input line
282 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
287 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
283 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
288 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
284
289
285 mode = kw.get('mode','string')
290 mode = kw.get('mode','string')
286 if mode not in ['string','list']:
291 if mode not in ['string','list']:
287 raise ValueError,'incorrect mode given: %s' % mode
292 raise ValueError,'incorrect mode given: %s' % mode
288 # Get options
293 # Get options
289 list_all = kw.get('list_all',0)
294 list_all = kw.get('list_all',0)
290
295
291 # Check if we have more than one argument to warrant extra processing:
296 # Check if we have more than one argument to warrant extra processing:
292 odict = {} # Dictionary with options
297 odict = {} # Dictionary with options
293 args = arg_str.split()
298 args = arg_str.split()
294 if len(args) >= 1:
299 if len(args) >= 1:
295 # If the list of inputs only has 0 or 1 thing in it, there's no
300 # If the list of inputs only has 0 or 1 thing in it, there's no
296 # need to look for options
301 # need to look for options
297 argv = shlex_split(arg_str)
302 argv = shlex_split(arg_str)
298 # Do regular option processing
303 # Do regular option processing
299 opts,args = getopt(argv,opt_str,*long_opts)
304 opts,args = getopt(argv,opt_str,*long_opts)
300 for o,a in opts:
305 for o,a in opts:
301 if o.startswith('--'):
306 if o.startswith('--'):
302 o = o[2:]
307 o = o[2:]
303 else:
308 else:
304 o = o[1:]
309 o = o[1:]
305 try:
310 try:
306 odict[o].append(a)
311 odict[o].append(a)
307 except AttributeError:
312 except AttributeError:
308 odict[o] = [odict[o],a]
313 odict[o] = [odict[o],a]
309 except KeyError:
314 except KeyError:
310 if list_all:
315 if list_all:
311 odict[o] = [a]
316 odict[o] = [a]
312 else:
317 else:
313 odict[o] = a
318 odict[o] = a
314
319
315 # Prepare opts,args for return
320 # Prepare opts,args for return
316 opts = Struct(odict)
321 opts = Struct(odict)
317 if mode == 'string':
322 if mode == 'string':
318 args = ' '.join(args)
323 args = ' '.join(args)
319
324
320 return opts,args
325 return opts,args
321
326
322 #......................................................................
327 #......................................................................
323 # And now the actual magic functions
328 # And now the actual magic functions
324
329
325 # Functions for IPython shell work (vars,funcs, config, etc)
330 # Functions for IPython shell work (vars,funcs, config, etc)
326 def magic_lsmagic(self, parameter_s = ''):
331 def magic_lsmagic(self, parameter_s = ''):
327 """List currently available magic functions."""
332 """List currently available magic functions."""
328 mesc = self.shell.ESC_MAGIC
333 mesc = self.shell.ESC_MAGIC
329 print 'Available magic functions:\n'+mesc+\
334 print 'Available magic functions:\n'+mesc+\
330 (' '+mesc).join(self.lsmagic())
335 (' '+mesc).join(self.lsmagic())
331 print '\n' + Magic.auto_status[self.shell.rc.automagic]
336 print '\n' + Magic.auto_status[self.shell.rc.automagic]
332 return None
337 return None
333
338
334 def magic_magic(self, parameter_s = ''):
339 def magic_magic(self, parameter_s = ''):
335 """Print information about the magic function system."""
340 """Print information about the magic function system."""
336
341
337 mode = ''
342 mode = ''
338 try:
343 try:
339 if parameter_s.split()[0] == '-latex':
344 if parameter_s.split()[0] == '-latex':
340 mode = 'latex'
345 mode = 'latex'
341 except:
346 except:
342 pass
347 pass
343
348
344 magic_docs = []
349 magic_docs = []
345 for fname in self.lsmagic():
350 for fname in self.lsmagic():
346 mname = 'magic_' + fname
351 mname = 'magic_' + fname
347 for space in (Magic,self,self.__class__):
352 for space in (Magic,self,self.__class__):
348 try:
353 try:
349 fn = space.__dict__[mname]
354 fn = space.__dict__[mname]
350 except KeyError:
355 except KeyError:
351 pass
356 pass
352 else:
357 else:
353 break
358 break
354 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
359 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
355 fname,fn.__doc__))
360 fname,fn.__doc__))
356 magic_docs = ''.join(magic_docs)
361 magic_docs = ''.join(magic_docs)
357
362
358 if mode == 'latex':
363 if mode == 'latex':
359 print self.format_latex(magic_docs)
364 print self.format_latex(magic_docs)
360 return
365 return
361 else:
366 else:
362 magic_docs = self.format_screen(magic_docs)
367 magic_docs = self.format_screen(magic_docs)
363
368
364 outmsg = """
369 outmsg = """
365 IPython's 'magic' functions
370 IPython's 'magic' functions
366 ===========================
371 ===========================
367
372
368 The magic function system provides a series of functions which allow you to
373 The magic function system provides a series of functions which allow you to
369 control the behavior of IPython itself, plus a lot of system-type
374 control the behavior of IPython itself, plus a lot of system-type
370 features. All these functions are prefixed with a % character, but parameters
375 features. All these functions are prefixed with a % character, but parameters
371 are given without parentheses or quotes.
376 are given without parentheses or quotes.
372
377
373 NOTE: If you have 'automagic' enabled (via the command line option or with the
378 NOTE: If you have 'automagic' enabled (via the command line option or with the
374 %automagic function), you don't need to type in the % explicitly. By default,
379 %automagic function), you don't need to type in the % explicitly. By default,
375 IPython ships with automagic on, so you should only rarely need the % escape.
380 IPython ships with automagic on, so you should only rarely need the % escape.
376
381
377 Example: typing '%cd mydir' (without the quotes) changes you working directory
382 Example: typing '%cd mydir' (without the quotes) changes you working directory
378 to 'mydir', if it exists.
383 to 'mydir', if it exists.
379
384
380 You can define your own magic functions to extend the system. See the supplied
385 You can define your own magic functions to extend the system. See the supplied
381 ipythonrc and example-magic.py files for details (in your ipython
386 ipythonrc and example-magic.py files for details (in your ipython
382 configuration directory, typically $HOME/.ipython/).
387 configuration directory, typically $HOME/.ipython/).
383
388
384 You can also define your own aliased names for magic functions. In your
389 You can also define your own aliased names for magic functions. In your
385 ipythonrc file, placing a line like:
390 ipythonrc file, placing a line like:
386
391
387 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
392 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
388
393
389 will define %pf as a new name for %profile.
394 will define %pf as a new name for %profile.
390
395
391 You can also call magics in code using the ipmagic() function, which IPython
396 You can also call magics in code using the ipmagic() function, which IPython
392 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
397 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
393
398
394 For a list of the available magic functions, use %lsmagic. For a description
399 For a list of the available magic functions, use %lsmagic. For a description
395 of any of them, type %magic_name?, e.g. '%cd?'.
400 of any of them, type %magic_name?, e.g. '%cd?'.
396
401
397 Currently the magic system has the following functions:\n"""
402 Currently the magic system has the following functions:\n"""
398
403
399 mesc = self.shell.ESC_MAGIC
404 mesc = self.shell.ESC_MAGIC
400 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
405 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
401 "\n\n%s%s\n\n%s" % (outmsg,
406 "\n\n%s%s\n\n%s" % (outmsg,
402 magic_docs,mesc,mesc,
407 magic_docs,mesc,mesc,
403 (' '+mesc).join(self.lsmagic()),
408 (' '+mesc).join(self.lsmagic()),
404 Magic.auto_status[self.shell.rc.automagic] ) )
409 Magic.auto_status[self.shell.rc.automagic] ) )
405
410
406 page(outmsg,screen_lines=self.shell.rc.screen_length)
411 page(outmsg,screen_lines=self.shell.rc.screen_length)
407
412
408 def magic_automagic(self, parameter_s = ''):
413 def magic_automagic(self, parameter_s = ''):
409 """Make magic functions callable without having to type the initial %.
414 """Make magic functions callable without having to type the initial %.
410
415
411 Toggles on/off (when off, you must call it as %automagic, of
416 Toggles on/off (when off, you must call it as %automagic, of
412 course). Note that magic functions have lowest priority, so if there's
417 course). Note that magic functions have lowest priority, so if there's
413 a variable whose name collides with that of a magic fn, automagic
418 a variable whose name collides with that of a magic fn, automagic
414 won't work for that function (you get the variable instead). However,
419 won't work for that function (you get the variable instead). However,
415 if you delete the variable (del var), the previously shadowed magic
420 if you delete the variable (del var), the previously shadowed magic
416 function becomes visible to automagic again."""
421 function becomes visible to automagic again."""
417
422
418 rc = self.shell.rc
423 rc = self.shell.rc
419 rc.automagic = not rc.automagic
424 rc.automagic = not rc.automagic
420 print '\n' + Magic.auto_status[rc.automagic]
425 print '\n' + Magic.auto_status[rc.automagic]
421
426
422 def magic_autocall(self, parameter_s = ''):
427 def magic_autocall(self, parameter_s = ''):
423 """Make functions callable without having to type parentheses.
428 """Make functions callable without having to type parentheses.
424
429
425 This toggles the autocall command line option on and off."""
430 This toggles the autocall command line option on and off."""
426
431
427 rc = self.shell.rc
432 rc = self.shell.rc
428 rc.autocall = not rc.autocall
433 rc.autocall = not rc.autocall
429 print "Automatic calling is:",['OFF','ON'][rc.autocall]
434 print "Automatic calling is:",['OFF','ON'][rc.autocall]
430
435
431 def magic_autoindent(self, parameter_s = ''):
436 def magic_autoindent(self, parameter_s = ''):
432 """Toggle autoindent on/off (if available)."""
437 """Toggle autoindent on/off (if available)."""
433
438
434 self.shell.set_autoindent()
439 self.shell.set_autoindent()
435 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
440 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
436
441
437 def magic_system_verbose(self, parameter_s = ''):
442 def magic_system_verbose(self, parameter_s = ''):
438 """Toggle verbose printing of system calls on/off."""
443 """Toggle verbose printing of system calls on/off."""
439
444
440 self.shell.rc_set_toggle('system_verbose')
445 self.shell.rc_set_toggle('system_verbose')
441 print "System verbose printing is:",\
446 print "System verbose printing is:",\
442 ['OFF','ON'][self.shell.rc.system_verbose]
447 ['OFF','ON'][self.shell.rc.system_verbose]
443
448
444 def magic_history(self, parameter_s = ''):
449 def magic_history(self, parameter_s = ''):
445 """Print input history (_i<n> variables), with most recent last.
450 """Print input history (_i<n> variables), with most recent last.
446
451
447 %history [-n] -> print at most 40 inputs (some may be multi-line)\\
452 %history [-n] -> print at most 40 inputs (some may be multi-line)\\
448 %history [-n] n -> print at most n inputs\\
453 %history [-n] n -> print at most n inputs\\
449 %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
454 %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
450
455
451 Each input's number <n> is shown, and is accessible as the
456 Each input's number <n> is shown, and is accessible as the
452 automatically generated variable _i<n>. Multi-line statements are
457 automatically generated variable _i<n>. Multi-line statements are
453 printed starting at a new line for easy copy/paste.
458 printed starting at a new line for easy copy/paste.
454
459
455 If option -n is used, input numbers are not printed. This is useful if
460 If option -n is used, input numbers are not printed. This is useful if
456 you want to get a printout of many lines which can be directly pasted
461 you want to get a printout of many lines which can be directly pasted
457 into a text editor.
462 into a text editor.
458
463
459 This feature is only available if numbered prompts are in use."""
464 This feature is only available if numbered prompts are in use."""
460
465
461 if not self.shell.outputcache.do_full_cache:
466 if not self.shell.outputcache.do_full_cache:
462 print 'This feature is only available if numbered prompts are in use.'
467 print 'This feature is only available if numbered prompts are in use.'
463 return
468 return
464 opts,args = self.parse_options(parameter_s,'n',mode='list')
469 opts,args = self.parse_options(parameter_s,'n',mode='list')
465
470
466 default_length = 40
471 default_length = 40
467 if len(args) == 0:
472 if len(args) == 0:
468 final = self.shell.outputcache.prompt_count
473 final = self.shell.outputcache.prompt_count
469 init = max(1,final-default_length)
474 init = max(1,final-default_length)
470 elif len(args) == 1:
475 elif len(args) == 1:
471 final = self.shell.outputcache.prompt_count
476 final = self.shell.outputcache.prompt_count
472 init = max(1,final-int(args[0]))
477 init = max(1,final-int(args[0]))
473 elif len(args) == 2:
478 elif len(args) == 2:
474 init,final = map(int,args)
479 init,final = map(int,args)
475 else:
480 else:
476 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
481 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
477 print self.magic_hist.__doc__
482 print self.magic_hist.__doc__
478 return
483 return
479 width = len(str(final))
484 width = len(str(final))
480 line_sep = ['','\n']
485 line_sep = ['','\n']
481 input_hist = self.shell.input_hist
486 input_hist = self.shell.input_hist
482 print_nums = not opts.has_key('n')
487 print_nums = not opts.has_key('n')
483 for in_num in range(init,final):
488 for in_num in range(init,final):
484 inline = input_hist[in_num]
489 inline = input_hist[in_num]
485 multiline = inline.count('\n') > 1
490 multiline = inline.count('\n') > 1
486 if print_nums:
491 if print_nums:
487 print str(in_num).ljust(width)+':'+ line_sep[multiline],
492 print str(in_num).ljust(width)+':'+ line_sep[multiline],
488 if inline.startswith('#'+self.shell.ESC_MAGIC) or \
493 if inline.startswith('#'+self.shell.ESC_MAGIC) or \
489 inline.startswith('#!'):
494 inline.startswith('#!'):
490 print inline[1:],
495 print inline[1:],
491 else:
496 else:
492 print inline,
497 print inline,
493
498
494 def magic_hist(self, parameter_s=''):
499 def magic_hist(self, parameter_s=''):
495 """Alternate name for %history."""
500 """Alternate name for %history."""
496 return self.magic_history(parameter_s)
501 return self.magic_history(parameter_s)
497
502
498 def magic_p(self, parameter_s=''):
503 def magic_p(self, parameter_s=''):
499 """Just a short alias for Python's 'print'."""
504 """Just a short alias for Python's 'print'."""
500 exec 'print ' + parameter_s in self.shell.user_ns
505 exec 'print ' + parameter_s in self.shell.user_ns
501
506
502 def magic_r(self, parameter_s=''):
507 def magic_r(self, parameter_s=''):
503 """Repeat previous input.
508 """Repeat previous input.
504
509
505 If given an argument, repeats the previous command which starts with
510 If given an argument, repeats the previous command which starts with
506 the same string, otherwise it just repeats the previous input.
511 the same string, otherwise it just repeats the previous input.
507
512
508 Shell escaped commands (with ! as first character) are not recognized
513 Shell escaped commands (with ! as first character) are not recognized
509 by this system, only pure python code and magic commands.
514 by this system, only pure python code and magic commands.
510 """
515 """
511
516
512 start = parameter_s.strip()
517 start = parameter_s.strip()
513 esc_magic = self.shell.ESC_MAGIC
518 esc_magic = self.shell.ESC_MAGIC
514 # Identify magic commands even if automagic is on (which means
519 # Identify magic commands even if automagic is on (which means
515 # the in-memory version is different from that typed by the user).
520 # the in-memory version is different from that typed by the user).
516 if self.shell.rc.automagic:
521 if self.shell.rc.automagic:
517 start_magic = esc_magic+start
522 start_magic = esc_magic+start
518 else:
523 else:
519 start_magic = start
524 start_magic = start
520 # Look through the input history in reverse
525 # Look through the input history in reverse
521 for n in range(len(self.shell.input_hist)-2,0,-1):
526 for n in range(len(self.shell.input_hist)-2,0,-1):
522 input = self.shell.input_hist[n]
527 input = self.shell.input_hist[n]
523 # skip plain 'r' lines so we don't recurse to infinity
528 # skip plain 'r' lines so we don't recurse to infinity
524 if input != 'ipmagic("r")\n' and \
529 if input != 'ipmagic("r")\n' and \
525 (input.startswith(start) or input.startswith(start_magic)):
530 (input.startswith(start) or input.startswith(start_magic)):
526 #print 'match',`input` # dbg
531 #print 'match',`input` # dbg
527 print 'Executing:',input,
532 print 'Executing:',input,
528 self.shell.runlines(input)
533 self.shell.runlines(input)
529 return
534 return
530 print 'No previous input matching `%s` found.' % start
535 print 'No previous input matching `%s` found.' % start
531
536
532 def magic_page(self, parameter_s=''):
537 def magic_page(self, parameter_s=''):
533 """Pretty print the object and display it through a pager.
538 """Pretty print the object and display it through a pager.
534
539
535 If no parameter is given, use _ (last output)."""
540 If no parameter is given, use _ (last output)."""
536 # After a function contributed by Olivier Aubert, slightly modified.
541 # After a function contributed by Olivier Aubert, slightly modified.
537
542
538 oname = parameter_s and parameter_s or '_'
543 oname = parameter_s and parameter_s or '_'
539 info = self._ofind(oname)
544 info = self._ofind(oname)
540 if info['found']:
545 if info['found']:
541 page(pformat(info['obj']))
546 page(pformat(info['obj']))
542 else:
547 else:
543 print 'Object `%s` not found' % oname
548 print 'Object `%s` not found' % oname
544
549
545 def magic_profile(self, parameter_s=''):
550 def magic_profile(self, parameter_s=''):
546 """Print your currently active IPyhton profile."""
551 """Print your currently active IPyhton profile."""
547 if self.shell.rc.profile:
552 if self.shell.rc.profile:
548 printpl('Current IPython profile: $self.shell.rc.profile.')
553 printpl('Current IPython profile: $self.shell.rc.profile.')
549 else:
554 else:
550 print 'No profile active.'
555 print 'No profile active.'
551
556
552 def _inspect(self,meth,oname,**kw):
557 def _inspect(self,meth,oname,**kw):
553 """Generic interface to the inspector system.
558 """Generic interface to the inspector system.
554
559
555 This function is meant to be called by pdef, pdoc & friends."""
560 This function is meant to be called by pdef, pdoc & friends."""
556
561
557 oname = oname.strip()
562 oname = oname.strip()
558 info = Struct(self._ofind(oname))
563 info = Struct(self._ofind(oname))
559 if info.found:
564 if info.found:
560 pmethod = getattr(self.shell.inspector,meth)
565 pmethod = getattr(self.shell.inspector,meth)
561 formatter = info.ismagic and self.format_screen or None
566 formatter = info.ismagic and self.format_screen or None
562 if meth == 'pdoc':
567 if meth == 'pdoc':
563 pmethod(info.obj,oname,formatter)
568 pmethod(info.obj,oname,formatter)
564 elif meth == 'pinfo':
569 elif meth == 'pinfo':
565 pmethod(info.obj,oname,formatter,info,**kw)
570 pmethod(info.obj,oname,formatter,info,**kw)
566 else:
571 else:
567 pmethod(info.obj,oname)
572 pmethod(info.obj,oname)
568 else:
573 else:
569 print 'Object `%s` not found.' % oname
574 print 'Object `%s` not found.' % oname
570 return 'not found' # so callers can take other action
575 return 'not found' # so callers can take other action
571
576
572 def magic_pdef(self, parameter_s=''):
577 def magic_pdef(self, parameter_s=''):
573 """Print the definition header for any callable object.
578 """Print the definition header for any callable object.
574
579
575 If the object is a class, print the constructor information."""
580 If the object is a class, print the constructor information."""
576 self._inspect('pdef',parameter_s)
581 self._inspect('pdef',parameter_s)
577
582
578 def magic_pdoc(self, parameter_s=''):
583 def magic_pdoc(self, parameter_s=''):
579 """Print the docstring for an object.
584 """Print the docstring for an object.
580
585
581 If the given object is a class, it will print both the class and the
586 If the given object is a class, it will print both the class and the
582 constructor docstrings."""
587 constructor docstrings."""
583 self._inspect('pdoc',parameter_s)
588 self._inspect('pdoc',parameter_s)
584
589
585 def magic_psource(self, parameter_s=''):
590 def magic_psource(self, parameter_s=''):
586 """Print (or run through pager) the source code for an object."""
591 """Print (or run through pager) the source code for an object."""
587 self._inspect('psource',parameter_s)
592 self._inspect('psource',parameter_s)
588
593
589 def magic_pfile(self, parameter_s=''):
594 def magic_pfile(self, parameter_s=''):
590 """Print (or run through pager) the file where an object is defined.
595 """Print (or run through pager) the file where an object is defined.
591
596
592 The file opens at the line where the object definition begins. IPython
597 The file opens at the line where the object definition begins. IPython
593 will honor the environment variable PAGER if set, and otherwise will
598 will honor the environment variable PAGER if set, and otherwise will
594 do its best to print the file in a convenient form.
599 do its best to print the file in a convenient form.
595
600
596 If the given argument is not an object currently defined, IPython will
601 If the given argument is not an object currently defined, IPython will
597 try to interpret it as a filename (automatically adding a .py extension
602 try to interpret it as a filename (automatically adding a .py extension
598 if needed). You can thus use %pfile as a syntax highlighting code
603 if needed). You can thus use %pfile as a syntax highlighting code
599 viewer."""
604 viewer."""
600
605
601 # first interpret argument as an object name
606 # first interpret argument as an object name
602 out = self._inspect('pfile',parameter_s)
607 out = self._inspect('pfile',parameter_s)
603 # if not, try the input as a filename
608 # if not, try the input as a filename
604 if out == 'not found':
609 if out == 'not found':
605 try:
610 try:
606 filename = get_py_filename(parameter_s)
611 filename = get_py_filename(parameter_s)
607 except IOError,msg:
612 except IOError,msg:
608 print msg
613 print msg
609 return
614 return
610 page(self.shell.inspector.format(file(filename).read()))
615 page(self.shell.inspector.format(file(filename).read()))
611
616
612 def magic_pinfo(self, parameter_s=''):
617 def magic_pinfo(self, parameter_s=''):
613 """Provide detailed information about an object.
618 """Provide detailed information about an object.
614
619
615 '%pinfo object' is just a synonym for object? or ?object."""
620 '%pinfo object' is just a synonym for object? or ?object."""
616
621
617 #print 'pinfo par: <%s>' % parameter_s # dbg
622 #print 'pinfo par: <%s>' % parameter_s # dbg
618
623
619 # detail_level: 0 -> obj? , 1 -> obj??
624 # detail_level: 0 -> obj? , 1 -> obj??
620 detail_level = 0
625 detail_level = 0
621 # We need to detect if we got called as 'pinfo pinfo foo', which can
626 # We need to detect if we got called as 'pinfo pinfo foo', which can
622 # happen if the user types 'pinfo foo?' at the cmd line.
627 # happen if the user types 'pinfo foo?' at the cmd line.
623 pinfo,qmark1,oname,qmark2 = \
628 pinfo,qmark1,oname,qmark2 = \
624 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
629 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
625 if pinfo or qmark1 or qmark2:
630 if pinfo or qmark1 or qmark2:
626 detail_level = 1
631 detail_level = 1
627 if "*" in oname:
632 if "*" in oname:
628 self.magic_psearch(oname)
633 self.magic_psearch(oname)
629 else:
634 else:
630 self._inspect('pinfo',oname,detail_level=detail_level)
635 self._inspect('pinfo',oname,detail_level=detail_level)
631
636
632 def magic_psearch(self, parameter_s=''):
637 def magic_psearch(self, parameter_s=''):
633 """Search for object in namespaces by wildcard.
638 """Search for object in namespaces by wildcard.
634
639
635 %psearch [options] PATTERN [OBJECT TYPE]
640 %psearch [options] PATTERN [OBJECT TYPE]
636
641
637 Note: ? can be used as a synonym for %psearch, at the beginning or at
642 Note: ? can be used as a synonym for %psearch, at the beginning or at
638 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
643 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
639 rest of the command line must be unchanged (options come first), so
644 rest of the command line must be unchanged (options come first), so
640 for example the following forms are equivalent
645 for example the following forms are equivalent
641
646
642 %psearch -i a* function
647 %psearch -i a* function
643 -i a* function?
648 -i a* function?
644 ?-i a* function
649 ?-i a* function
645
650
646 Arguments:
651 Arguments:
647
652
648 PATTERN
653 PATTERN
649
654
650 where PATTERN is a string containing * as a wildcard similar to its
655 where PATTERN is a string containing * as a wildcard similar to its
651 use in a shell. The pattern is matched in all namespaces on the
656 use in a shell. The pattern is matched in all namespaces on the
652 search path. By default objects starting with a single _ are not
657 search path. By default objects starting with a single _ are not
653 matched, many IPython generated objects have a single
658 matched, many IPython generated objects have a single
654 underscore. The default is case insensitive matching. Matching is
659 underscore. The default is case insensitive matching. Matching is
655 also done on the attributes of objects and not only on the objects
660 also done on the attributes of objects and not only on the objects
656 in a module.
661 in a module.
657
662
658 [OBJECT TYPE]
663 [OBJECT TYPE]
659
664
660 Is the name of a python type from the types module. The name is
665 Is the name of a python type from the types module. The name is
661 given in lowercase without the ending type, ex. StringType is
666 given in lowercase without the ending type, ex. StringType is
662 written string. By adding a type here only objects matching the
667 written string. By adding a type here only objects matching the
663 given type are matched. Using all here makes the pattern match all
668 given type are matched. Using all here makes the pattern match all
664 types (this is the default).
669 types (this is the default).
665
670
666 Options:
671 Options:
667
672
668 -a: makes the pattern match even objects whose names start with a
673 -a: makes the pattern match even objects whose names start with a
669 single underscore. These names are normally ommitted from the
674 single underscore. These names are normally ommitted from the
670 search.
675 search.
671
676
672 -i/-c: make the pattern case insensitive/sensitive. If neither of
677 -i/-c: make the pattern case insensitive/sensitive. If neither of
673 these options is given, the default is read from your ipythonrc
678 these options is given, the default is read from your ipythonrc
674 file. The option name which sets this value is
679 file. The option name which sets this value is
675 'wildcards_case_sensitive'. If this option is not specified in your
680 'wildcards_case_sensitive'. If this option is not specified in your
676 ipythonrc file, IPython's internal default is to do a case sensitive
681 ipythonrc file, IPython's internal default is to do a case sensitive
677 search.
682 search.
678
683
679 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
684 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
680 specifiy can be searched in any of the following namespaces:
685 specifiy can be searched in any of the following namespaces:
681 'builtin', 'user', 'user_global','internal', 'alias', where
686 'builtin', 'user', 'user_global','internal', 'alias', where
682 'builtin' and 'user' are the search defaults. Note that you should
687 'builtin' and 'user' are the search defaults. Note that you should
683 not use quotes when specifying namespaces.
688 not use quotes when specifying namespaces.
684
689
685 'Builtin' contains the python module builtin, 'user' contains all
690 'Builtin' contains the python module builtin, 'user' contains all
686 user data, 'alias' only contain the shell aliases and no python
691 user data, 'alias' only contain the shell aliases and no python
687 objects, 'internal' contains objects used by IPython. The
692 objects, 'internal' contains objects used by IPython. The
688 'user_global' namespace is only used by embedded IPython instances,
693 'user_global' namespace is only used by embedded IPython instances,
689 and it contains module-level globals. You can add namespaces to the
694 and it contains module-level globals. You can add namespaces to the
690 search with -s or exclude them with -e (these options can be given
695 search with -s or exclude them with -e (these options can be given
691 more than once).
696 more than once).
692
697
693 Examples:
698 Examples:
694
699
695 %psearch a* -> objects beginning with an a
700 %psearch a* -> objects beginning with an a
696 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
701 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
697 %psearch a* function -> all functions beginning with an a
702 %psearch a* function -> all functions beginning with an a
698 %psearch re.e* -> objects beginning with an e in module re
703 %psearch re.e* -> objects beginning with an e in module re
699 %psearch r*.e* -> objects that start with e in modules starting in r
704 %psearch r*.e* -> objects that start with e in modules starting in r
700 %psearch r*.* string -> all strings in modules beginning with r
705 %psearch r*.* string -> all strings in modules beginning with r
701
706
702 Case sensitve search:
707 Case sensitve search:
703
708
704 %psearch -c a* list all object beginning with lower case a
709 %psearch -c a* list all object beginning with lower case a
705
710
706 Show objects beginning with a single _:
711 Show objects beginning with a single _:
707
712
708 %psearch -a _* list objects beginning with a single underscore"""
713 %psearch -a _* list objects beginning with a single underscore"""
709
714
710 # default namespaces to be searched
715 # default namespaces to be searched
711 def_search = ['user','builtin']
716 def_search = ['user','builtin']
712
717
713 # Process options/args
718 # Process options/args
714 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
719 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
715 opt = opts.get
720 opt = opts.get
716 shell = self.shell
721 shell = self.shell
717 psearch = shell.inspector.psearch
722 psearch = shell.inspector.psearch
718
723
719 # select case options
724 # select case options
720 if opts.has_key('i'):
725 if opts.has_key('i'):
721 ignore_case = True
726 ignore_case = True
722 elif opts.has_key('c'):
727 elif opts.has_key('c'):
723 ignore_case = False
728 ignore_case = False
724 else:
729 else:
725 ignore_case = not shell.rc.wildcards_case_sensitive
730 ignore_case = not shell.rc.wildcards_case_sensitive
726
731
727 # Build list of namespaces to search from user options
732 # Build list of namespaces to search from user options
728 def_search.extend(opt('s',[]))
733 def_search.extend(opt('s',[]))
729 ns_exclude = ns_exclude=opt('e',[])
734 ns_exclude = ns_exclude=opt('e',[])
730 ns_search = [nm for nm in def_search if nm not in ns_exclude]
735 ns_search = [nm for nm in def_search if nm not in ns_exclude]
731
736
732 # Call the actual search
737 # Call the actual search
733 try:
738 try:
734 psearch(args,shell.ns_table,ns_search,
739 psearch(args,shell.ns_table,ns_search,
735 show_all=opt('a'),ignore_case=ignore_case)
740 show_all=opt('a'),ignore_case=ignore_case)
736 except:
741 except:
737 shell.showtraceback()
742 shell.showtraceback()
738
743
739 def magic_who_ls(self, parameter_s=''):
744 def magic_who_ls(self, parameter_s=''):
740 """Return a sorted list of all interactive variables.
745 """Return a sorted list of all interactive variables.
741
746
742 If arguments are given, only variables of types matching these
747 If arguments are given, only variables of types matching these
743 arguments are returned."""
748 arguments are returned."""
744
749
745 user_ns = self.shell.user_ns
750 user_ns = self.shell.user_ns
746 out = []
751 out = []
747 typelist = parameter_s.split()
752 typelist = parameter_s.split()
748 for i in self.shell.user_ns.keys():
753 for i in self.shell.user_ns.keys():
749 if not (i.startswith('_') or i.startswith('_i')) \
754 if not (i.startswith('_') or i.startswith('_i')) \
750 and not (self.shell.internal_ns.has_key(i) or
755 and not (self.shell.internal_ns.has_key(i) or
751 self.shell.user_config_ns.has_key(i)):
756 self.shell.user_config_ns.has_key(i)):
752 if typelist:
757 if typelist:
753 if type(user_ns[i]).__name__ in typelist:
758 if type(user_ns[i]).__name__ in typelist:
754 out.append(i)
759 out.append(i)
755 else:
760 else:
756 out.append(i)
761 out.append(i)
757 out.sort()
762 out.sort()
758 return out
763 return out
759
764
760 def magic_who(self, parameter_s=''):
765 def magic_who(self, parameter_s=''):
761 """Print all interactive variables, with some minimal formatting.
766 """Print all interactive variables, with some minimal formatting.
762
767
763 If any arguments are given, only variables whose type matches one of
768 If any arguments are given, only variables whose type matches one of
764 these are printed. For example:
769 these are printed. For example:
765
770
766 %who function str
771 %who function str
767
772
768 will only list functions and strings, excluding all other types of
773 will only list functions and strings, excluding all other types of
769 variables. To find the proper type names, simply use type(var) at a
774 variables. To find the proper type names, simply use type(var) at a
770 command line to see how python prints type names. For example:
775 command line to see how python prints type names. For example:
771
776
772 In [1]: type('hello')\\
777 In [1]: type('hello')\\
773 Out[1]: <type 'str'>
778 Out[1]: <type 'str'>
774
779
775 indicates that the type name for strings is 'str'.
780 indicates that the type name for strings is 'str'.
776
781
777 %who always excludes executed names loaded through your configuration
782 %who always excludes executed names loaded through your configuration
778 file and things which are internal to IPython.
783 file and things which are internal to IPython.
779
784
780 This is deliberate, as typically you may load many modules and the
785 This is deliberate, as typically you may load many modules and the
781 purpose of %who is to show you only what you've manually defined."""
786 purpose of %who is to show you only what you've manually defined."""
782
787
783 varlist = self.magic_who_ls(parameter_s)
788 varlist = self.magic_who_ls(parameter_s)
784 if not varlist:
789 if not varlist:
785 print 'Interactive namespace is empty.'
790 print 'Interactive namespace is empty.'
786 return
791 return
787
792
788 # if we have variables, move on...
793 # if we have variables, move on...
789
794
790 # stupid flushing problem: when prompts have no separators, stdout is
795 # stupid flushing problem: when prompts have no separators, stdout is
791 # getting lost. I'm starting to think this is a python bug. I'm having
796 # getting lost. I'm starting to think this is a python bug. I'm having
792 # to force a flush with a print because even a sys.stdout.flush
797 # to force a flush with a print because even a sys.stdout.flush
793 # doesn't seem to do anything!
798 # doesn't seem to do anything!
794
799
795 count = 0
800 count = 0
796 for i in varlist:
801 for i in varlist:
797 print i+'\t',
802 print i+'\t',
798 count += 1
803 count += 1
799 if count > 8:
804 if count > 8:
800 count = 0
805 count = 0
801 print
806 print
802 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
807 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
803
808
804 print # well, this does force a flush at the expense of an extra \n
809 print # well, this does force a flush at the expense of an extra \n
805
810
806 def magic_whos(self, parameter_s=''):
811 def magic_whos(self, parameter_s=''):
807 """Like %who, but gives some extra information about each variable.
812 """Like %who, but gives some extra information about each variable.
808
813
809 The same type filtering of %who can be applied here.
814 The same type filtering of %who can be applied here.
810
815
811 For all variables, the type is printed. Additionally it prints:
816 For all variables, the type is printed. Additionally it prints:
812
817
813 - For {},[],(): their length.
818 - For {},[],(): their length.
814
819
815 - For Numeric arrays, a summary with shape, number of elements,
820 - For Numeric arrays, a summary with shape, number of elements,
816 typecode and size in memory.
821 typecode and size in memory.
817
822
818 - Everything else: a string representation, snipping their middle if
823 - Everything else: a string representation, snipping their middle if
819 too long."""
824 too long."""
820
825
821 varnames = self.magic_who_ls(parameter_s)
826 varnames = self.magic_who_ls(parameter_s)
822 if not varnames:
827 if not varnames:
823 print 'Interactive namespace is empty.'
828 print 'Interactive namespace is empty.'
824 return
829 return
825
830
826 # if we have variables, move on...
831 # if we have variables, move on...
827
832
828 # for these types, show len() instead of data:
833 # for these types, show len() instead of data:
829 seq_types = [types.DictType,types.ListType,types.TupleType]
834 seq_types = [types.DictType,types.ListType,types.TupleType]
830
835
831 # for Numeric arrays, display summary info
836 # for Numeric arrays, display summary info
832 try:
837 try:
833 import Numeric
838 import Numeric
834 except ImportError:
839 except ImportError:
835 array_type = None
840 array_type = None
836 else:
841 else:
837 array_type = Numeric.ArrayType.__name__
842 array_type = Numeric.ArrayType.__name__
838
843
839 # Find all variable names and types so we can figure out column sizes
844 # Find all variable names and types so we can figure out column sizes
840 get_vars = lambda i: self.shell.user_ns[i]
845 get_vars = lambda i: self.shell.user_ns[i]
841 type_name = lambda v: type(v).__name__
846 type_name = lambda v: type(v).__name__
842 varlist = map(get_vars,varnames)
847 varlist = map(get_vars,varnames)
843 typelist = map(type_name,varlist)
848 typelist = map(type_name,varlist)
844 # column labels and # of spaces as separator
849 # column labels and # of spaces as separator
845 varlabel = 'Variable'
850 varlabel = 'Variable'
846 typelabel = 'Type'
851 typelabel = 'Type'
847 datalabel = 'Data/Info'
852 datalabel = 'Data/Info'
848 colsep = 3
853 colsep = 3
849 # variable format strings
854 # variable format strings
850 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
855 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
851 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
856 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
852 aformat = "%s: %s elems, type `%s`, %s bytes"
857 aformat = "%s: %s elems, type `%s`, %s bytes"
853 # find the size of the columns to format the output nicely
858 # find the size of the columns to format the output nicely
854 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
859 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
855 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
860 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
856 # table header
861 # table header
857 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
862 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
858 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
863 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
859 # and the table itself
864 # and the table itself
860 kb = 1024
865 kb = 1024
861 Mb = 1048576 # kb**2
866 Mb = 1048576 # kb**2
862 for vname,var,vtype in zip(varnames,varlist,typelist):
867 for vname,var,vtype in zip(varnames,varlist,typelist):
863 print itpl(vformat),
868 print itpl(vformat),
864 if vtype in seq_types:
869 if vtype in seq_types:
865 print len(var)
870 print len(var)
866 elif vtype==array_type:
871 elif vtype==array_type:
867 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
872 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
868 vsize = Numeric.size(var)
873 vsize = Numeric.size(var)
869 vbytes = vsize*var.itemsize()
874 vbytes = vsize*var.itemsize()
870 if vbytes < 100000:
875 if vbytes < 100000:
871 print aformat % (vshape,vsize,var.typecode(),vbytes)
876 print aformat % (vshape,vsize,var.typecode(),vbytes)
872 else:
877 else:
873 print aformat % (vshape,vsize,var.typecode(),vbytes),
878 print aformat % (vshape,vsize,var.typecode(),vbytes),
874 if vbytes < Mb:
879 if vbytes < Mb:
875 print '(%s kb)' % (vbytes/kb,)
880 print '(%s kb)' % (vbytes/kb,)
876 else:
881 else:
877 print '(%s Mb)' % (vbytes/Mb,)
882 print '(%s Mb)' % (vbytes/Mb,)
878 else:
883 else:
879 vstr = str(var)
884 vstr = str(var)
880 if len(vstr) < 50:
885 if len(vstr) < 50:
881 print vstr
886 print vstr
882 else:
887 else:
883 printpl(vfmt_short)
888 printpl(vfmt_short)
884
889
885 def magic_reset(self, parameter_s=''):
890 def magic_reset(self, parameter_s=''):
886 """Resets the namespace by removing all names defined by the user.
891 """Resets the namespace by removing all names defined by the user.
887
892
888 Input/Output history are left around in case you need them."""
893 Input/Output history are left around in case you need them."""
889
894
890 ans = raw_input(
895 ans = raw_input(
891 "Once deleted, variables cannot be recovered. Proceed (y/n)? ")
896 "Once deleted, variables cannot be recovered. Proceed (y/n)? ")
892 if not ans.lower() == 'y':
897 if not ans.lower() == 'y':
893 print 'Nothing done.'
898 print 'Nothing done.'
894 return
899 return
895 user_ns = self.shell.user_ns
900 user_ns = self.shell.user_ns
896 for i in self.magic_who_ls():
901 for i in self.magic_who_ls():
897 del(user_ns[i])
902 del(user_ns[i])
898
903
899 def magic_config(self,parameter_s=''):
904 def magic_config(self,parameter_s=''):
900 """Show IPython's internal configuration."""
905 """Show IPython's internal configuration."""
901
906
902 page('Current configuration structure:\n'+
907 page('Current configuration structure:\n'+
903 pformat(self.shell.rc.dict()))
908 pformat(self.shell.rc.dict()))
904
909
905 def magic_logstart(self,parameter_s=''):
910 def magic_logstart(self,parameter_s=''):
906 """Start logging anywhere in a session.
911 """Start logging anywhere in a session.
907
912
908 %logstart [-o|-t] [log_name [log_mode]]
913 %logstart [-o|-t] [log_name [log_mode]]
909
914
910 If no name is given, it defaults to a file named 'ipython_log.py' in your
915 If no name is given, it defaults to a file named 'ipython_log.py' in your
911 current directory, in 'rotate' mode (see below).
916 current directory, in 'rotate' mode (see below).
912
917
913 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
918 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
914 history up to that point and then continues logging.
919 history up to that point and then continues logging.
915
920
916 %logstart takes a second optional parameter: logging mode. This can be one
921 %logstart takes a second optional parameter: logging mode. This can be one
917 of (note that the modes are given unquoted):\\
922 of (note that the modes are given unquoted):\\
918 append: well, that says it.\\
923 append: well, that says it.\\
919 backup: rename (if exists) to name~ and start name.\\
924 backup: rename (if exists) to name~ and start name.\\
920 global: single logfile in your home dir, appended to.\\
925 global: single logfile in your home dir, appended to.\\
921 over : overwrite existing log.\\
926 over : overwrite existing log.\\
922 rotate: create rotating logs name.1~, name.2~, etc.
927 rotate: create rotating logs name.1~, name.2~, etc.
923
928
924 Options:
929 Options:
925
930
926 -o: log also IPython's output. In this mode, all commands which
931 -o: log also IPython's output. In this mode, all commands which
927 generate an Out[NN] prompt are recorded to the logfile, right after
932 generate an Out[NN] prompt are recorded to the logfile, right after
928 their corresponding input line. The output lines are always
933 their corresponding input line. The output lines are always
929 prepended with a #[Out]# marker, so that the log remains valid
934 prepended with a #[Out]# marker, so that the log remains valid
930 Python code.
935 Python code.
931
936
932 -t: put timestamps before each input line logged (these are put in
937 -t: put timestamps before each input line logged (these are put in
933 comments)."""
938 comments)."""
934
939
935 opts,par = self.parse_options(parameter_s,'ot')
940 opts,par = self.parse_options(parameter_s,'ot')
936 log_output = 'o' in opts
941 log_output = 'o' in opts
937 timestamp = 't' in opts
942 timestamp = 't' in opts
938
943
939 rc = self.shell.rc
944 rc = self.shell.rc
940 logger = self.shell.logger
945 logger = self.shell.logger
941
946
942 # if no args are given, the defaults set in the logger constructor by
947 # if no args are given, the defaults set in the logger constructor by
943 # ipytohn remain valid
948 # ipytohn remain valid
944 if par:
949 if par:
945 try:
950 try:
946 logfname,logmode = par.split()
951 logfname,logmode = par.split()
947 except:
952 except:
948 logfname = par
953 logfname = par
949 logmode = 'backup'
954 logmode = 'backup'
950 else:
955 else:
951 logfname = logger.logfname
956 logfname = logger.logfname
952 logmode = logger.logmode
957 logmode = logger.logmode
953 # put logfname into rc struct as if it had been called on the command
958 # put logfname into rc struct as if it had been called on the command
954 # line, so it ends up saved in the log header Save it in case we need
959 # line, so it ends up saved in the log header Save it in case we need
955 # to restore it...
960 # to restore it...
956 old_logfile = rc.opts.get('logfile','')
961 old_logfile = rc.opts.get('logfile','')
957 if logfname:
962 if logfname:
958 logfname = os.path.expanduser(logfname)
963 logfname = os.path.expanduser(logfname)
959 rc.opts.logfile = logfname
964 rc.opts.logfile = logfname
960 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
965 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
961 try:
966 try:
962 started = logger.logstart(logfname,loghead,logmode,
967 started = logger.logstart(logfname,loghead,logmode,
963 log_output,timestamp)
968 log_output,timestamp)
964 except:
969 except:
965 rc.opts.logfile = old_logfile
970 rc.opts.logfile = old_logfile
966 warn("Couldn't start log: %s" % sys.exc_info()[1])
971 warn("Couldn't start log: %s" % sys.exc_info()[1])
967 else:
972 else:
968 # log input history up to this point, optionally interleaving
973 # log input history up to this point, optionally interleaving
969 # output if requested
974 # output if requested
970
975
971 if timestamp:
976 if timestamp:
972 # disable timestamping for the previous history, since we've
977 # disable timestamping for the previous history, since we've
973 # lost those already (no time machine here).
978 # lost those already (no time machine here).
974 logger.timestamp = False
979 logger.timestamp = False
975 if log_output:
980 if log_output:
976 log_write = logger.log_write
981 log_write = logger.log_write
977 input_hist = self.shell.input_hist
982 input_hist = self.shell.input_hist
978 output_hist = self.shell.output_hist
983 output_hist = self.shell.output_hist
979 for n in range(1,len(input_hist)-1):
984 for n in range(1,len(input_hist)-1):
980 log_write(input_hist[n].rstrip())
985 log_write(input_hist[n].rstrip())
981 if n in output_hist:
986 if n in output_hist:
982 log_write(repr(output_hist[n]),'output')
987 log_write(repr(output_hist[n]),'output')
983 else:
988 else:
984 logger.log_write(self.shell.input_hist[1:])
989 logger.log_write(self.shell.input_hist[1:])
985 if timestamp:
990 if timestamp:
986 # re-enable timestamping
991 # re-enable timestamping
987 logger.timestamp = True
992 logger.timestamp = True
988
993
989 print ('Activating auto-logging. '
994 print ('Activating auto-logging. '
990 'Current session state plus future input saved.')
995 'Current session state plus future input saved.')
991 logger.logstate()
996 logger.logstate()
992
997
993 def magic_logoff(self,parameter_s=''):
998 def magic_logoff(self,parameter_s=''):
994 """Temporarily stop logging.
999 """Temporarily stop logging.
995
1000
996 You must have previously started logging."""
1001 You must have previously started logging."""
997 self.shell.logger.switch_log(0)
1002 self.shell.logger.switch_log(0)
998
1003
999 def magic_logon(self,parameter_s=''):
1004 def magic_logon(self,parameter_s=''):
1000 """Restart logging.
1005 """Restart logging.
1001
1006
1002 This function is for restarting logging which you've temporarily
1007 This function is for restarting logging which you've temporarily
1003 stopped with %logoff. For starting logging for the first time, you
1008 stopped with %logoff. For starting logging for the first time, you
1004 must use the %logstart function, which allows you to specify an
1009 must use the %logstart function, which allows you to specify an
1005 optional log filename."""
1010 optional log filename."""
1006
1011
1007 self.shell.logger.switch_log(1)
1012 self.shell.logger.switch_log(1)
1008
1013
1009 def magic_logstate(self,parameter_s=''):
1014 def magic_logstate(self,parameter_s=''):
1010 """Print the status of the logging system."""
1015 """Print the status of the logging system."""
1011
1016
1012 self.shell.logger.logstate()
1017 self.shell.logger.logstate()
1013
1018
1014 def magic_pdb(self, parameter_s=''):
1019 def magic_pdb(self, parameter_s=''):
1015 """Control the calling of the pdb interactive debugger.
1020 """Control the calling of the pdb interactive debugger.
1016
1021
1017 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1022 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1018 argument it works as a toggle.
1023 argument it works as a toggle.
1019
1024
1020 When an exception is triggered, IPython can optionally call the
1025 When an exception is triggered, IPython can optionally call the
1021 interactive pdb debugger after the traceback printout. %pdb toggles
1026 interactive pdb debugger after the traceback printout. %pdb toggles
1022 this feature on and off."""
1027 this feature on and off."""
1023
1028
1024 par = parameter_s.strip().lower()
1029 par = parameter_s.strip().lower()
1025
1030
1026 if par:
1031 if par:
1027 try:
1032 try:
1028 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1033 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1029 except KeyError:
1034 except KeyError:
1030 print ('Incorrect argument. Use on/1, off/0, '
1035 print ('Incorrect argument. Use on/1, off/0, '
1031 'or nothing for a toggle.')
1036 'or nothing for a toggle.')
1032 return
1037 return
1033 else:
1038 else:
1034 # toggle
1039 # toggle
1035 new_pdb = not self.shell.InteractiveTB.call_pdb
1040 new_pdb = not self.shell.InteractiveTB.call_pdb
1036
1041
1037 # set on the shell
1042 # set on the shell
1038 self.shell.call_pdb = new_pdb
1043 self.shell.call_pdb = new_pdb
1039 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1044 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1040
1045
1041 def magic_prun(self, parameter_s ='',user_mode=1,
1046 def magic_prun(self, parameter_s ='',user_mode=1,
1042 opts=None,arg_lst=None,prog_ns=None):
1047 opts=None,arg_lst=None,prog_ns=None):
1043
1048
1044 """Run a statement through the python code profiler.
1049 """Run a statement through the python code profiler.
1045
1050
1046 Usage:\\
1051 Usage:\\
1047 %prun [options] statement
1052 %prun [options] statement
1048
1053
1049 The given statement (which doesn't require quote marks) is run via the
1054 The given statement (which doesn't require quote marks) is run via the
1050 python profiler in a manner similar to the profile.run() function.
1055 python profiler in a manner similar to the profile.run() function.
1051 Namespaces are internally managed to work correctly; profile.run
1056 Namespaces are internally managed to work correctly; profile.run
1052 cannot be used in IPython because it makes certain assumptions about
1057 cannot be used in IPython because it makes certain assumptions about
1053 namespaces which do not hold under IPython.
1058 namespaces which do not hold under IPython.
1054
1059
1055 Options:
1060 Options:
1056
1061
1057 -l <limit>: you can place restrictions on what or how much of the
1062 -l <limit>: you can place restrictions on what or how much of the
1058 profile gets printed. The limit value can be:
1063 profile gets printed. The limit value can be:
1059
1064
1060 * A string: only information for function names containing this string
1065 * A string: only information for function names containing this string
1061 is printed.
1066 is printed.
1062
1067
1063 * An integer: only these many lines are printed.
1068 * An integer: only these many lines are printed.
1064
1069
1065 * A float (between 0 and 1): this fraction of the report is printed
1070 * A float (between 0 and 1): this fraction of the report is printed
1066 (for example, use a limit of 0.4 to see the topmost 40% only).
1071 (for example, use a limit of 0.4 to see the topmost 40% only).
1067
1072
1068 You can combine several limits with repeated use of the option. For
1073 You can combine several limits with repeated use of the option. For
1069 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1074 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1070 information about class constructors.
1075 information about class constructors.
1071
1076
1072 -r: return the pstats.Stats object generated by the profiling. This
1077 -r: return the pstats.Stats object generated by the profiling. This
1073 object has all the information about the profile in it, and you can
1078 object has all the information about the profile in it, and you can
1074 later use it for further analysis or in other functions.
1079 later use it for further analysis or in other functions.
1075
1080
1076 Since magic functions have a particular form of calling which prevents
1081 Since magic functions have a particular form of calling which prevents
1077 you from writing something like:\\
1082 you from writing something like:\\
1078 In [1]: p = %prun -r print 4 # invalid!\\
1083 In [1]: p = %prun -r print 4 # invalid!\\
1079 you must instead use IPython's automatic variables to assign this:\\
1084 you must instead use IPython's automatic variables to assign this:\\
1080 In [1]: %prun -r print 4 \\
1085 In [1]: %prun -r print 4 \\
1081 Out[1]: <pstats.Stats instance at 0x8222cec>\\
1086 Out[1]: <pstats.Stats instance at 0x8222cec>\\
1082 In [2]: stats = _
1087 In [2]: stats = _
1083
1088
1084 If you really need to assign this value via an explicit function call,
1089 If you really need to assign this value via an explicit function call,
1085 you can always tap directly into the true name of the magic function
1090 you can always tap directly into the true name of the magic function
1086 by using the ipmagic function (which IPython automatically adds to the
1091 by using the ipmagic function (which IPython automatically adds to the
1087 builtins):\\
1092 builtins):\\
1088 In [3]: stats = ipmagic('prun','-r print 4')
1093 In [3]: stats = ipmagic('prun','-r print 4')
1089
1094
1090 You can type ipmagic? for more details on ipmagic.
1095 You can type ipmagic? for more details on ipmagic.
1091
1096
1092 -s <key>: sort profile by given key. You can provide more than one key
1097 -s <key>: sort profile by given key. You can provide more than one key
1093 by using the option several times: '-s key1 -s key2 -s key3...'. The
1098 by using the option several times: '-s key1 -s key2 -s key3...'. The
1094 default sorting key is 'time'.
1099 default sorting key is 'time'.
1095
1100
1096 The following is copied verbatim from the profile documentation
1101 The following is copied verbatim from the profile documentation
1097 referenced below:
1102 referenced below:
1098
1103
1099 When more than one key is provided, additional keys are used as
1104 When more than one key is provided, additional keys are used as
1100 secondary criteria when the there is equality in all keys selected
1105 secondary criteria when the there is equality in all keys selected
1101 before them.
1106 before them.
1102
1107
1103 Abbreviations can be used for any key names, as long as the
1108 Abbreviations can be used for any key names, as long as the
1104 abbreviation is unambiguous. The following are the keys currently
1109 abbreviation is unambiguous. The following are the keys currently
1105 defined:
1110 defined:
1106
1111
1107 Valid Arg Meaning\\
1112 Valid Arg Meaning\\
1108 "calls" call count\\
1113 "calls" call count\\
1109 "cumulative" cumulative time\\
1114 "cumulative" cumulative time\\
1110 "file" file name\\
1115 "file" file name\\
1111 "module" file name\\
1116 "module" file name\\
1112 "pcalls" primitive call count\\
1117 "pcalls" primitive call count\\
1113 "line" line number\\
1118 "line" line number\\
1114 "name" function name\\
1119 "name" function name\\
1115 "nfl" name/file/line\\
1120 "nfl" name/file/line\\
1116 "stdname" standard name\\
1121 "stdname" standard name\\
1117 "time" internal time
1122 "time" internal time
1118
1123
1119 Note that all sorts on statistics are in descending order (placing
1124 Note that all sorts on statistics are in descending order (placing
1120 most time consuming items first), where as name, file, and line number
1125 most time consuming items first), where as name, file, and line number
1121 searches are in ascending order (i.e., alphabetical). The subtle
1126 searches are in ascending order (i.e., alphabetical). The subtle
1122 distinction between "nfl" and "stdname" is that the standard name is a
1127 distinction between "nfl" and "stdname" is that the standard name is a
1123 sort of the name as printed, which means that the embedded line
1128 sort of the name as printed, which means that the embedded line
1124 numbers get compared in an odd way. For example, lines 3, 20, and 40
1129 numbers get compared in an odd way. For example, lines 3, 20, and 40
1125 would (if the file names were the same) appear in the string order
1130 would (if the file names were the same) appear in the string order
1126 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1131 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1127 line numbers. In fact, sort_stats("nfl") is the same as
1132 line numbers. In fact, sort_stats("nfl") is the same as
1128 sort_stats("name", "file", "line").
1133 sort_stats("name", "file", "line").
1129
1134
1130 -T <filename>: save profile results as shown on screen to a text
1135 -T <filename>: save profile results as shown on screen to a text
1131 file. The profile is still shown on screen.
1136 file. The profile is still shown on screen.
1132
1137
1133 -D <filename>: save (via dump_stats) profile statistics to given
1138 -D <filename>: save (via dump_stats) profile statistics to given
1134 filename. This data is in a format understod by the pstats module, and
1139 filename. This data is in a format understod by the pstats module, and
1135 is generated by a call to the dump_stats() method of profile
1140 is generated by a call to the dump_stats() method of profile
1136 objects. The profile is still shown on screen.
1141 objects. The profile is still shown on screen.
1137
1142
1138 If you want to run complete programs under the profiler's control, use
1143 If you want to run complete programs under the profiler's control, use
1139 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1144 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1140 contains profiler specific options as described here.
1145 contains profiler specific options as described here.
1141
1146
1142 You can read the complete documentation for the profile module with:\\
1147 You can read the complete documentation for the profile module with:\\
1143 In [1]: import profile; profile.help() """
1148 In [1]: import profile; profile.help() """
1144
1149
1145 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1150 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1146 # protect user quote marks
1151 # protect user quote marks
1147 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1152 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1148
1153
1149 if user_mode: # regular user call
1154 if user_mode: # regular user call
1150 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1155 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1151 list_all=1)
1156 list_all=1)
1152 namespace = self.shell.user_ns
1157 namespace = self.shell.user_ns
1153 else: # called to run a program by %run -p
1158 else: # called to run a program by %run -p
1154 try:
1159 try:
1155 filename = get_py_filename(arg_lst[0])
1160 filename = get_py_filename(arg_lst[0])
1156 except IOError,msg:
1161 except IOError,msg:
1157 error(msg)
1162 error(msg)
1158 return
1163 return
1159
1164
1160 arg_str = 'execfile(filename,prog_ns)'
1165 arg_str = 'execfile(filename,prog_ns)'
1161 namespace = locals()
1166 namespace = locals()
1162
1167
1163 opts.merge(opts_def)
1168 opts.merge(opts_def)
1164
1169
1165 prof = profile.Profile()
1170 prof = profile.Profile()
1166 try:
1171 try:
1167 prof = prof.runctx(arg_str,namespace,namespace)
1172 prof = prof.runctx(arg_str,namespace,namespace)
1168 sys_exit = ''
1173 sys_exit = ''
1169 except SystemExit:
1174 except SystemExit:
1170 sys_exit = """*** SystemExit exception caught in code being profiled."""
1175 sys_exit = """*** SystemExit exception caught in code being profiled."""
1171
1176
1172 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1177 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1173
1178
1174 lims = opts.l
1179 lims = opts.l
1175 if lims:
1180 if lims:
1176 lims = [] # rebuild lims with ints/floats/strings
1181 lims = [] # rebuild lims with ints/floats/strings
1177 for lim in opts.l:
1182 for lim in opts.l:
1178 try:
1183 try:
1179 lims.append(int(lim))
1184 lims.append(int(lim))
1180 except ValueError:
1185 except ValueError:
1181 try:
1186 try:
1182 lims.append(float(lim))
1187 lims.append(float(lim))
1183 except ValueError:
1188 except ValueError:
1184 lims.append(lim)
1189 lims.append(lim)
1185
1190
1186 # trap output
1191 # trap output
1187 sys_stdout = sys.stdout
1192 sys_stdout = sys.stdout
1188 stdout_trap = StringIO()
1193 stdout_trap = StringIO()
1189 try:
1194 try:
1190 sys.stdout = stdout_trap
1195 sys.stdout = stdout_trap
1191 stats.print_stats(*lims)
1196 stats.print_stats(*lims)
1192 finally:
1197 finally:
1193 sys.stdout = sys_stdout
1198 sys.stdout = sys_stdout
1194 output = stdout_trap.getvalue()
1199 output = stdout_trap.getvalue()
1195 output = output.rstrip()
1200 output = output.rstrip()
1196
1201
1197 page(output,screen_lines=self.shell.rc.screen_length)
1202 page(output,screen_lines=self.shell.rc.screen_length)
1198 print sys_exit,
1203 print sys_exit,
1199
1204
1200 dump_file = opts.D[0]
1205 dump_file = opts.D[0]
1201 text_file = opts.T[0]
1206 text_file = opts.T[0]
1202 if dump_file:
1207 if dump_file:
1203 prof.dump_stats(dump_file)
1208 prof.dump_stats(dump_file)
1204 print '\n*** Profile stats marshalled to file',\
1209 print '\n*** Profile stats marshalled to file',\
1205 `dump_file`+'.',sys_exit
1210 `dump_file`+'.',sys_exit
1206 if text_file:
1211 if text_file:
1207 file(text_file,'w').write(output)
1212 file(text_file,'w').write(output)
1208 print '\n*** Profile printout saved to text file',\
1213 print '\n*** Profile printout saved to text file',\
1209 `text_file`+'.',sys_exit
1214 `text_file`+'.',sys_exit
1210
1215
1211 if opts.has_key('r'):
1216 if opts.has_key('r'):
1212 return stats
1217 return stats
1213 else:
1218 else:
1214 return None
1219 return None
1215
1220
1216 def magic_run(self, parameter_s ='',runner=None):
1221 def magic_run(self, parameter_s ='',runner=None):
1217 """Run the named file inside IPython as a program.
1222 """Run the named file inside IPython as a program.
1218
1223
1219 Usage:\\
1224 Usage:\\
1220 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1225 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1221
1226
1222 Parameters after the filename are passed as command-line arguments to
1227 Parameters after the filename are passed as command-line arguments to
1223 the program (put in sys.argv). Then, control returns to IPython's
1228 the program (put in sys.argv). Then, control returns to IPython's
1224 prompt.
1229 prompt.
1225
1230
1226 This is similar to running at a system prompt:\\
1231 This is similar to running at a system prompt:\\
1227 $ python file args\\
1232 $ python file args\\
1228 but with the advantage of giving you IPython's tracebacks, and of
1233 but with the advantage of giving you IPython's tracebacks, and of
1229 loading all variables into your interactive namespace for further use
1234 loading all variables into your interactive namespace for further use
1230 (unless -p is used, see below).
1235 (unless -p is used, see below).
1231
1236
1232 The file is executed in a namespace initially consisting only of
1237 The file is executed in a namespace initially consisting only of
1233 __name__=='__main__' and sys.argv constructed as indicated. It thus
1238 __name__=='__main__' and sys.argv constructed as indicated. It thus
1234 sees its environment as if it were being run as a stand-alone
1239 sees its environment as if it were being run as a stand-alone
1235 program. But after execution, the IPython interactive namespace gets
1240 program. But after execution, the IPython interactive namespace gets
1236 updated with all variables defined in the program (except for __name__
1241 updated with all variables defined in the program (except for __name__
1237 and sys.argv). This allows for very convenient loading of code for
1242 and sys.argv). This allows for very convenient loading of code for
1238 interactive work, while giving each program a 'clean sheet' to run in.
1243 interactive work, while giving each program a 'clean sheet' to run in.
1239
1244
1240 Options:
1245 Options:
1241
1246
1242 -n: __name__ is NOT set to '__main__', but to the running file's name
1247 -n: __name__ is NOT set to '__main__', but to the running file's name
1243 without extension (as python does under import). This allows running
1248 without extension (as python does under import). This allows running
1244 scripts and reloading the definitions in them without calling code
1249 scripts and reloading the definitions in them without calling code
1245 protected by an ' if __name__ == "__main__" ' clause.
1250 protected by an ' if __name__ == "__main__" ' clause.
1246
1251
1247 -i: run the file in IPython's namespace instead of an empty one. This
1252 -i: run the file in IPython's namespace instead of an empty one. This
1248 is useful if you are experimenting with code written in a text editor
1253 is useful if you are experimenting with code written in a text editor
1249 which depends on variables defined interactively.
1254 which depends on variables defined interactively.
1250
1255
1251 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1256 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1252 being run. This is particularly useful if IPython is being used to
1257 being run. This is particularly useful if IPython is being used to
1253 run unittests, which always exit with a sys.exit() call. In such
1258 run unittests, which always exit with a sys.exit() call. In such
1254 cases you are interested in the output of the test results, not in
1259 cases you are interested in the output of the test results, not in
1255 seeing a traceback of the unittest module.
1260 seeing a traceback of the unittest module.
1256
1261
1257 -t: print timing information at the end of the run. IPython will give
1262 -t: print timing information at the end of the run. IPython will give
1258 you an estimated CPU time consumption for your script, which under
1263 you an estimated CPU time consumption for your script, which under
1259 Unix uses the resource module to avoid the wraparound problems of
1264 Unix uses the resource module to avoid the wraparound problems of
1260 time.clock(). Under Unix, an estimate of time spent on system tasks
1265 time.clock(). Under Unix, an estimate of time spent on system tasks
1261 is also given (for Windows platforms this is reported as 0.0).
1266 is also given (for Windows platforms this is reported as 0.0).
1262
1267
1263 If -t is given, an additional -N<N> option can be given, where <N>
1268 If -t is given, an additional -N<N> option can be given, where <N>
1264 must be an integer indicating how many times you want the script to
1269 must be an integer indicating how many times you want the script to
1265 run. The final timing report will include total and per run results.
1270 run. The final timing report will include total and per run results.
1266
1271
1267 For example (testing the script uniq_stable.py):
1272 For example (testing the script uniq_stable.py):
1268
1273
1269 In [1]: run -t uniq_stable
1274 In [1]: run -t uniq_stable
1270
1275
1271 IPython CPU timings (estimated):\\
1276 IPython CPU timings (estimated):\\
1272 User : 0.19597 s.\\
1277 User : 0.19597 s.\\
1273 System: 0.0 s.\\
1278 System: 0.0 s.\\
1274
1279
1275 In [2]: run -t -N5 uniq_stable
1280 In [2]: run -t -N5 uniq_stable
1276
1281
1277 IPython CPU timings (estimated):\\
1282 IPython CPU timings (estimated):\\
1278 Total runs performed: 5\\
1283 Total runs performed: 5\\
1279 Times : Total Per run\\
1284 Times : Total Per run\\
1280 User : 0.910862 s, 0.1821724 s.\\
1285 User : 0.910862 s, 0.1821724 s.\\
1281 System: 0.0 s, 0.0 s.
1286 System: 0.0 s, 0.0 s.
1282
1287
1283 -d: run your program under the control of pdb, the Python debugger.
1288 -d: run your program under the control of pdb, the Python debugger.
1284 This allows you to execute your program step by step, watch variables,
1289 This allows you to execute your program step by step, watch variables,
1285 etc. Internally, what IPython does is similar to calling:
1290 etc. Internally, what IPython does is similar to calling:
1286
1291
1287 pdb.run('execfile("YOURFILENAME")')
1292 pdb.run('execfile("YOURFILENAME")')
1288
1293
1289 with a breakpoint set on line 1 of your file. You can change the line
1294 with a breakpoint set on line 1 of your file. You can change the line
1290 number for this automatic breakpoint to be <N> by using the -bN option
1295 number for this automatic breakpoint to be <N> by using the -bN option
1291 (where N must be an integer). For example:
1296 (where N must be an integer). For example:
1292
1297
1293 %run -d -b40 myscript
1298 %run -d -b40 myscript
1294
1299
1295 will set the first breakpoint at line 40 in myscript.py. Note that
1300 will set the first breakpoint at line 40 in myscript.py. Note that
1296 the first breakpoint must be set on a line which actually does
1301 the first breakpoint must be set on a line which actually does
1297 something (not a comment or docstring) for it to stop execution.
1302 something (not a comment or docstring) for it to stop execution.
1298
1303
1299 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1304 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1300 first enter 'c' (without qoutes) to start execution up to the first
1305 first enter 'c' (without qoutes) to start execution up to the first
1301 breakpoint.
1306 breakpoint.
1302
1307
1303 Entering 'help' gives information about the use of the debugger. You
1308 Entering 'help' gives information about the use of the debugger. You
1304 can easily see pdb's full documentation with "import pdb;pdb.help()"
1309 can easily see pdb's full documentation with "import pdb;pdb.help()"
1305 at a prompt.
1310 at a prompt.
1306
1311
1307 -p: run program under the control of the Python profiler module (which
1312 -p: run program under the control of the Python profiler module (which
1308 prints a detailed report of execution times, function calls, etc).
1313 prints a detailed report of execution times, function calls, etc).
1309
1314
1310 You can pass other options after -p which affect the behavior of the
1315 You can pass other options after -p which affect the behavior of the
1311 profiler itself. See the docs for %prun for details.
1316 profiler itself. See the docs for %prun for details.
1312
1317
1313 In this mode, the program's variables do NOT propagate back to the
1318 In this mode, the program's variables do NOT propagate back to the
1314 IPython interactive namespace (because they remain in the namespace
1319 IPython interactive namespace (because they remain in the namespace
1315 where the profiler executes them).
1320 where the profiler executes them).
1316
1321
1317 Internally this triggers a call to %prun, see its documentation for
1322 Internally this triggers a call to %prun, see its documentation for
1318 details on the options available specifically for profiling."""
1323 details on the options available specifically for profiling."""
1319
1324
1320 # get arguments and set sys.argv for program to be run.
1325 # get arguments and set sys.argv for program to be run.
1321 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1326 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1322 mode='list',list_all=1)
1327 mode='list',list_all=1)
1323
1328
1324 try:
1329 try:
1325 filename = get_py_filename(arg_lst[0])
1330 filename = get_py_filename(arg_lst[0])
1326 except IndexError:
1331 except IndexError:
1327 warn('you must provide at least a filename.')
1332 warn('you must provide at least a filename.')
1328 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1333 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1329 return
1334 return
1330 except IOError,msg:
1335 except IOError,msg:
1331 error(msg)
1336 error(msg)
1332 return
1337 return
1333
1338
1334 # Control the response to exit() calls made by the script being run
1339 # Control the response to exit() calls made by the script being run
1335 exit_ignore = opts.has_key('e')
1340 exit_ignore = opts.has_key('e')
1336
1341
1337 # Make sure that the running script gets a proper sys.argv as if it
1342 # Make sure that the running script gets a proper sys.argv as if it
1338 # were run from a system shell.
1343 # were run from a system shell.
1339 save_argv = sys.argv # save it for later restoring
1344 save_argv = sys.argv # save it for later restoring
1340 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1345 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1341
1346
1342 if opts.has_key('i'):
1347 if opts.has_key('i'):
1343 prog_ns = self.shell.user_ns
1348 prog_ns = self.shell.user_ns
1344 __name__save = self.shell.user_ns['__name__']
1349 __name__save = self.shell.user_ns['__name__']
1345 prog_ns['__name__'] = '__main__'
1350 prog_ns['__name__'] = '__main__'
1346 else:
1351 else:
1347 if opts.has_key('n'):
1352 if opts.has_key('n'):
1348 name = os.path.splitext(os.path.basename(filename))[0]
1353 name = os.path.splitext(os.path.basename(filename))[0]
1349 else:
1354 else:
1350 name = '__main__'
1355 name = '__main__'
1351 prog_ns = {'__name__':name}
1356 prog_ns = {'__name__':name}
1352
1357
1353 # pickle fix. See iplib for an explanation
1358 # pickle fix. See iplib for an explanation
1354 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1359 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1355
1360
1356 stats = None
1361 stats = None
1357 try:
1362 try:
1358 if opts.has_key('p'):
1363 if opts.has_key('p'):
1359 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1364 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1360 else:
1365 else:
1361 if opts.has_key('d'):
1366 if opts.has_key('d'):
1362 deb = Debugger.Pdb(self.shell.rc.colors)
1367 deb = Debugger.Pdb(self.shell.rc.colors)
1363 # reset Breakpoint state, which is moronically kept
1368 # reset Breakpoint state, which is moronically kept
1364 # in a class
1369 # in a class
1365 bdb.Breakpoint.next = 1
1370 bdb.Breakpoint.next = 1
1366 bdb.Breakpoint.bplist = {}
1371 bdb.Breakpoint.bplist = {}
1367 bdb.Breakpoint.bpbynumber = [None]
1372 bdb.Breakpoint.bpbynumber = [None]
1368 # Set an initial breakpoint to stop execution
1373 # Set an initial breakpoint to stop execution
1369 maxtries = 10
1374 maxtries = 10
1370 bp = int(opts.get('b',[1])[0])
1375 bp = int(opts.get('b',[1])[0])
1371 checkline = deb.checkline(filename,bp)
1376 checkline = deb.checkline(filename,bp)
1372 if not checkline:
1377 if not checkline:
1373 for bp in range(bp+1,bp+maxtries+1):
1378 for bp in range(bp+1,bp+maxtries+1):
1374 if deb.checkline(filename,bp):
1379 if deb.checkline(filename,bp):
1375 break
1380 break
1376 else:
1381 else:
1377 msg = ("\nI failed to find a valid line to set "
1382 msg = ("\nI failed to find a valid line to set "
1378 "a breakpoint\n"
1383 "a breakpoint\n"
1379 "after trying up to line: %s.\n"
1384 "after trying up to line: %s.\n"
1380 "Please set a valid breakpoint manually "
1385 "Please set a valid breakpoint manually "
1381 "with the -b option." % bp)
1386 "with the -b option." % bp)
1382 error(msg)
1387 error(msg)
1383 return
1388 return
1384 # if we find a good linenumber, set the breakpoint
1389 # if we find a good linenumber, set the breakpoint
1385 deb.do_break('%s:%s' % (filename,bp))
1390 deb.do_break('%s:%s' % (filename,bp))
1386 # Start file run
1391 # Start file run
1387 print "NOTE: Enter 'c' at the",
1392 print "NOTE: Enter 'c' at the",
1388 print "ipdb> prompt to start your script."
1393 print "ipdb> prompt to start your script."
1389 try:
1394 try:
1390 deb.run('execfile("%s")' % filename,prog_ns)
1395 deb.run('execfile("%s")' % filename,prog_ns)
1391 except:
1396 except:
1392 etype, value, tb = sys.exc_info()
1397 etype, value, tb = sys.exc_info()
1393 # Skip three frames in the traceback: the %run one,
1398 # Skip three frames in the traceback: the %run one,
1394 # one inside bdb.py, and the command-line typed by the
1399 # one inside bdb.py, and the command-line typed by the
1395 # user (run by exec in pdb itself).
1400 # user (run by exec in pdb itself).
1396 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1401 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1397 else:
1402 else:
1398 if runner is None:
1403 if runner is None:
1399 runner = self.shell.safe_execfile
1404 runner = self.shell.safe_execfile
1400 if opts.has_key('t'):
1405 if opts.has_key('t'):
1401 try:
1406 try:
1402 nruns = int(opts['N'][0])
1407 nruns = int(opts['N'][0])
1403 if nruns < 1:
1408 if nruns < 1:
1404 error('Number of runs must be >=1')
1409 error('Number of runs must be >=1')
1405 return
1410 return
1406 except (KeyError):
1411 except (KeyError):
1407 nruns = 1
1412 nruns = 1
1408 if nruns == 1:
1413 if nruns == 1:
1409 t0 = clock2()
1414 t0 = clock2()
1410 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1415 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1411 t1 = clock2()
1416 t1 = clock2()
1412 t_usr = t1[0]-t0[0]
1417 t_usr = t1[0]-t0[0]
1413 t_sys = t1[1]-t1[1]
1418 t_sys = t1[1]-t1[1]
1414 print "\nIPython CPU timings (estimated):"
1419 print "\nIPython CPU timings (estimated):"
1415 print " User : %10s s." % t_usr
1420 print " User : %10s s." % t_usr
1416 print " System: %10s s." % t_sys
1421 print " System: %10s s." % t_sys
1417 else:
1422 else:
1418 runs = range(nruns)
1423 runs = range(nruns)
1419 t0 = clock2()
1424 t0 = clock2()
1420 for nr in runs:
1425 for nr in runs:
1421 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1426 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1422 t1 = clock2()
1427 t1 = clock2()
1423 t_usr = t1[0]-t0[0]
1428 t_usr = t1[0]-t0[0]
1424 t_sys = t1[1]-t1[1]
1429 t_sys = t1[1]-t1[1]
1425 print "\nIPython CPU timings (estimated):"
1430 print "\nIPython CPU timings (estimated):"
1426 print "Total runs performed:",nruns
1431 print "Total runs performed:",nruns
1427 print " Times : %10s %10s" % ('Total','Per run')
1432 print " Times : %10s %10s" % ('Total','Per run')
1428 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1433 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1429 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1434 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1430
1435
1431 else:
1436 else:
1432 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1437 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1433 if opts.has_key('i'):
1438 if opts.has_key('i'):
1434 self.shell.user_ns['__name__'] = __name__save
1439 self.shell.user_ns['__name__'] = __name__save
1435 else:
1440 else:
1436 # update IPython interactive namespace
1441 # update IPython interactive namespace
1437 del prog_ns['__name__']
1442 del prog_ns['__name__']
1438 self.shell.user_ns.update(prog_ns)
1443 self.shell.user_ns.update(prog_ns)
1439 finally:
1444 finally:
1440 sys.argv = save_argv
1445 sys.argv = save_argv
1441 return stats
1446 return stats
1442
1447
1443 def magic_runlog(self, parameter_s =''):
1448 def magic_runlog(self, parameter_s =''):
1444 """Run files as logs.
1449 """Run files as logs.
1445
1450
1446 Usage:\\
1451 Usage:\\
1447 %runlog file1 file2 ...
1452 %runlog file1 file2 ...
1448
1453
1449 Run the named files (treating them as log files) in sequence inside
1454 Run the named files (treating them as log files) in sequence inside
1450 the interpreter, and return to the prompt. This is much slower than
1455 the interpreter, and return to the prompt. This is much slower than
1451 %run because each line is executed in a try/except block, but it
1456 %run because each line is executed in a try/except block, but it
1452 allows running files with syntax errors in them.
1457 allows running files with syntax errors in them.
1453
1458
1454 Normally IPython will guess when a file is one of its own logfiles, so
1459 Normally IPython will guess when a file is one of its own logfiles, so
1455 you can typically use %run even for logs. This shorthand allows you to
1460 you can typically use %run even for logs. This shorthand allows you to
1456 force any file to be treated as a log file."""
1461 force any file to be treated as a log file."""
1457
1462
1458 for f in parameter_s.split():
1463 for f in parameter_s.split():
1459 self.shell.safe_execfile(f,self.shell.user_ns,
1464 self.shell.safe_execfile(f,self.shell.user_ns,
1460 self.shell.user_ns,islog=1)
1465 self.shell.user_ns,islog=1)
1461
1466
1462 def magic_time(self,parameter_s = ''):
1467 def magic_time(self,parameter_s = ''):
1463 """Time execution of a Python statement or expression.
1468 """Time execution of a Python statement or expression.
1464
1469
1465 The CPU and wall clock times are printed, and the value of the
1470 The CPU and wall clock times are printed, and the value of the
1466 expression (if any) is returned. Note that under Win32, system time
1471 expression (if any) is returned. Note that under Win32, system time
1467 is always reported as 0, since it can not be measured.
1472 is always reported as 0, since it can not be measured.
1468
1473
1469 This function provides very basic timing functionality. In Python
1474 This function provides very basic timing functionality. In Python
1470 2.3, the timeit module offers more control and sophistication, but for
1475 2.3, the timeit module offers more control and sophistication, but for
1471 now IPython supports Python 2.2, so we can not rely on timeit being
1476 now IPython supports Python 2.2, so we can not rely on timeit being
1472 present.
1477 present.
1473
1478
1474 Some examples:
1479 Some examples:
1475
1480
1476 In [1]: time 2**128
1481 In [1]: time 2**128
1477 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1482 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1478 Wall time: 0.00
1483 Wall time: 0.00
1479 Out[1]: 340282366920938463463374607431768211456L
1484 Out[1]: 340282366920938463463374607431768211456L
1480
1485
1481 In [2]: n = 1000000
1486 In [2]: n = 1000000
1482
1487
1483 In [3]: time sum(range(n))
1488 In [3]: time sum(range(n))
1484 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1489 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1485 Wall time: 1.37
1490 Wall time: 1.37
1486 Out[3]: 499999500000L
1491 Out[3]: 499999500000L
1487
1492
1488 In [4]: time print 'hello world'
1493 In [4]: time print 'hello world'
1489 hello world
1494 hello world
1490 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1495 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1491 Wall time: 0.00
1496 Wall time: 0.00
1492 """
1497 """
1493
1498
1494 # fail immediately if the given expression can't be compiled
1499 # fail immediately if the given expression can't be compiled
1495 try:
1500 try:
1496 mode = 'eval'
1501 mode = 'eval'
1497 code = compile(parameter_s,'<timed eval>',mode)
1502 code = compile(parameter_s,'<timed eval>',mode)
1498 except SyntaxError:
1503 except SyntaxError:
1499 mode = 'exec'
1504 mode = 'exec'
1500 code = compile(parameter_s,'<timed exec>',mode)
1505 code = compile(parameter_s,'<timed exec>',mode)
1501 # skew measurement as little as possible
1506 # skew measurement as little as possible
1502 glob = self.shell.user_ns
1507 glob = self.shell.user_ns
1503 clk = clock2
1508 clk = clock2
1504 wtime = time.time
1509 wtime = time.time
1505 # time execution
1510 # time execution
1506 wall_st = wtime()
1511 wall_st = wtime()
1507 if mode=='eval':
1512 if mode=='eval':
1508 st = clk()
1513 st = clk()
1509 out = eval(code,glob)
1514 out = eval(code,glob)
1510 end = clk()
1515 end = clk()
1511 else:
1516 else:
1512 st = clk()
1517 st = clk()
1513 exec code in glob
1518 exec code in glob
1514 end = clk()
1519 end = clk()
1515 out = None
1520 out = None
1516 wall_end = wtime()
1521 wall_end = wtime()
1517 # Compute actual times and report
1522 # Compute actual times and report
1518 wall_time = wall_end-wall_st
1523 wall_time = wall_end-wall_st
1519 cpu_user = end[0]-st[0]
1524 cpu_user = end[0]-st[0]
1520 cpu_sys = end[1]-st[1]
1525 cpu_sys = end[1]-st[1]
1521 cpu_tot = cpu_user+cpu_sys
1526 cpu_tot = cpu_user+cpu_sys
1522 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1527 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1523 (cpu_user,cpu_sys,cpu_tot)
1528 (cpu_user,cpu_sys,cpu_tot)
1524 print "Wall time: %.2f" % wall_time
1529 print "Wall time: %.2f" % wall_time
1525 return out
1530 return out
1526
1531
1527 def magic_macro(self,parameter_s = ''):
1532 def magic_macro(self,parameter_s = ''):
1528 """Define a set of input lines as a macro for future re-execution.
1533 """Define a set of input lines as a macro for future re-execution.
1529
1534
1530 Usage:\\
1535 Usage:\\
1531 %macro name n1:n2 n3:n4 ... n5 .. n6 ...
1536 %macro name n1:n2 n3:n4 ... n5 .. n6 ...
1532
1537
1533 This will define a global variable called `name` which is a string
1538 This will define a global variable called `name` which is a string
1534 made of joining the slices and lines you specify (n1,n2,... numbers
1539 made of joining the slices and lines you specify (n1,n2,... numbers
1535 above) from your input history into a single string. This variable
1540 above) from your input history into a single string. This variable
1536 acts like an automatic function which re-executes those lines as if
1541 acts like an automatic function which re-executes those lines as if
1537 you had typed them. You just type 'name' at the prompt and the code
1542 you had typed them. You just type 'name' at the prompt and the code
1538 executes.
1543 executes.
1539
1544
1540 Note that the slices use the standard Python slicing notation (5:8
1545 Note that the slices use the standard Python slicing notation (5:8
1541 means include lines numbered 5,6,7).
1546 means include lines numbered 5,6,7).
1542
1547
1543 For example, if your history contains (%hist prints it):
1548 For example, if your history contains (%hist prints it):
1544
1549
1545 44: x=1\\
1550 44: x=1\\
1546 45: y=3\\
1551 45: y=3\\
1547 46: z=x+y\\
1552 46: z=x+y\\
1548 47: print x\\
1553 47: print x\\
1549 48: a=5\\
1554 48: a=5\\
1550 49: print 'x',x,'y',y\\
1555 49: print 'x',x,'y',y\\
1551
1556
1552 you can create a macro with lines 44 through 47 (included) and line 49
1557 you can create a macro with lines 44 through 47 (included) and line 49
1553 called my_macro with:
1558 called my_macro with:
1554
1559
1555 In [51]: %macro my_macro 44:48 49
1560 In [51]: %macro my_macro 44:48 49
1556
1561
1557 Now, typing `my_macro` (without quotes) will re-execute all this code
1562 Now, typing `my_macro` (without quotes) will re-execute all this code
1558 in one pass.
1563 in one pass.
1559
1564
1560 You don't need to give the line-numbers in order, and any given line
1565 You don't need to give the line-numbers in order, and any given line
1561 number can appear multiple times. You can assemble macros with any
1566 number can appear multiple times. You can assemble macros with any
1562 lines from your input history in any order.
1567 lines from your input history in any order.
1563
1568
1564 The macro is a simple object which holds its value in an attribute,
1569 The macro is a simple object which holds its value in an attribute,
1565 but IPython's display system checks for macros and executes them as
1570 but IPython's display system checks for macros and executes them as
1566 code instead of printing them when you type their name.
1571 code instead of printing them when you type their name.
1567
1572
1568 You can view a macro's contents by explicitly printing it with:
1573 You can view a macro's contents by explicitly printing it with:
1569
1574
1570 'print macro_name'.
1575 'print macro_name'.
1571
1576
1572 For one-off cases which DON'T contain magic function calls in them you
1577 For one-off cases which DON'T contain magic function calls in them you
1573 can obtain similar results by explicitly executing slices from your
1578 can obtain similar results by explicitly executing slices from your
1574 input history with:
1579 input history with:
1575
1580
1576 In [60]: exec In[44:48]+In[49]"""
1581 In [60]: exec In[44:48]+In[49]"""
1577
1582
1578 args = parameter_s.split()
1583 args = parameter_s.split()
1579 name,ranges = args[0], args[1:]
1584 name,ranges = args[0], args[1:]
1580 #print 'rng',ranges # dbg
1585 #print 'rng',ranges # dbg
1581 lines = self.extract_input_slices(ranges)
1586 lines = self.extract_input_slices(ranges)
1582 macro = Macro(lines)
1587 macro = Macro(lines)
1583 self.shell.user_ns.update({name:macro})
1588 self.shell.user_ns.update({name:macro})
1584 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1589 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1585 print 'Macro contents:'
1590 print 'Macro contents:'
1586 print macro
1591 print macro
1587
1592
1588 def magic_save(self,parameter_s = ''):
1593 def magic_save(self,parameter_s = ''):
1589 """Save a set of lines to a given filename.
1594 """Save a set of lines to a given filename.
1590
1595
1591 Usage:\\
1596 Usage:\\
1592 %save filename n1:n2 n3:n4 ... n5 .. n6 ...
1597 %save filename n1:n2 n3:n4 ... n5 .. n6 ...
1593
1598
1594 This function uses the same syntax as %macro for line extraction, but
1599 This function uses the same syntax as %macro for line extraction, but
1595 instead of creating a macro it saves the resulting string to the
1600 instead of creating a macro it saves the resulting string to the
1596 filename you specify.
1601 filename you specify.
1597
1602
1598 It adds a '.py' extension to the file if you don't do so yourself, and
1603 It adds a '.py' extension to the file if you don't do so yourself, and
1599 it asks for confirmation before overwriting existing files."""
1604 it asks for confirmation before overwriting existing files."""
1600
1605
1601 args = parameter_s.split()
1606 args = parameter_s.split()
1602 fname,ranges = args[0], args[1:]
1607 fname,ranges = args[0], args[1:]
1603 if not fname.endswith('.py'):
1608 if not fname.endswith('.py'):
1604 fname += '.py'
1609 fname += '.py'
1605 if os.path.isfile(fname):
1610 if os.path.isfile(fname):
1606 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1611 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1607 if ans.lower() not in ['y','yes']:
1612 if ans.lower() not in ['y','yes']:
1608 print 'Operation cancelled.'
1613 print 'Operation cancelled.'
1609 return
1614 return
1610 cmds = ''.join(self.extract_input_slices(ranges))
1615 cmds = ''.join(self.extract_input_slices(ranges))
1611 f = file(fname,'w')
1616 f = file(fname,'w')
1612 f.write(cmds)
1617 f.write(cmds)
1613 f.close()
1618 f.close()
1614 print 'The following commands were written to file `%s`:' % fname
1619 print 'The following commands were written to file `%s`:' % fname
1615 print cmds
1620 print cmds
1616
1621
1617 def magic_ed(self,parameter_s = ''):
1622 def magic_ed(self,parameter_s = ''):
1618 """Alias to %edit."""
1623 """Alias to %edit."""
1619 return self.magic_edit(parameter_s)
1624 return self.magic_edit(parameter_s)
1620
1625
1621 def magic_edit(self,parameter_s = '',last_call=['','']):
1626 def magic_edit(self,parameter_s = '',last_call=['','']):
1622 """Bring up an editor and execute the resulting code.
1627 """Bring up an editor and execute the resulting code.
1623
1628
1624 Usage:
1629 Usage:
1625 %edit [options] [args]
1630 %edit [options] [args]
1626
1631
1627 %edit runs IPython's editor hook. The default version of this hook is
1632 %edit runs IPython's editor hook. The default version of this hook is
1628 set to call the __IPYTHON__.rc.editor command. This is read from your
1633 set to call the __IPYTHON__.rc.editor command. This is read from your
1629 environment variable $EDITOR. If this isn't found, it will default to
1634 environment variable $EDITOR. If this isn't found, it will default to
1630 vi under Linux/Unix and to notepad under Windows. See the end of this
1635 vi under Linux/Unix and to notepad under Windows. See the end of this
1631 docstring for how to change the editor hook.
1636 docstring for how to change the editor hook.
1632
1637
1633 You can also set the value of this editor via the command line option
1638 You can also set the value of this editor via the command line option
1634 '-editor' or in your ipythonrc file. This is useful if you wish to use
1639 '-editor' or in your ipythonrc file. This is useful if you wish to use
1635 specifically for IPython an editor different from your typical default
1640 specifically for IPython an editor different from your typical default
1636 (and for Windows users who typically don't set environment variables).
1641 (and for Windows users who typically don't set environment variables).
1637
1642
1638 This command allows you to conveniently edit multi-line code right in
1643 This command allows you to conveniently edit multi-line code right in
1639 your IPython session.
1644 your IPython session.
1640
1645
1641 If called without arguments, %edit opens up an empty editor with a
1646 If called without arguments, %edit opens up an empty editor with a
1642 temporary file and will execute the contents of this file when you
1647 temporary file and will execute the contents of this file when you
1643 close it (don't forget to save it!).
1648 close it (don't forget to save it!).
1644
1649
1645 Options:
1650 Options:
1646
1651
1647 -p: this will call the editor with the same data as the previous time
1652 -p: this will call the editor with the same data as the previous time
1648 it was used, regardless of how long ago (in your current session) it
1653 it was used, regardless of how long ago (in your current session) it
1649 was.
1654 was.
1650
1655
1651 -x: do not execute the edited code immediately upon exit. This is
1656 -x: do not execute the edited code immediately upon exit. This is
1652 mainly useful if you are editing programs which need to be called with
1657 mainly useful if you are editing programs which need to be called with
1653 command line arguments, which you can then do using %run.
1658 command line arguments, which you can then do using %run.
1654
1659
1655 Arguments:
1660 Arguments:
1656
1661
1657 If arguments are given, the following possibilites exist:
1662 If arguments are given, the following possibilites exist:
1658
1663
1659 - The arguments are numbers or pairs of colon-separated numbers (like
1664 - The arguments are numbers or pairs of colon-separated numbers (like
1660 1 4:8 9). These are interpreted as lines of previous input to be
1665 1 4:8 9). These are interpreted as lines of previous input to be
1661 loaded into the editor. The syntax is the same of the %macro command.
1666 loaded into the editor. The syntax is the same of the %macro command.
1662
1667
1663 - If the argument doesn't start with a number, it is evaluated as a
1668 - If the argument doesn't start with a number, it is evaluated as a
1664 variable and its contents loaded into the editor. You can thus edit
1669 variable and its contents loaded into the editor. You can thus edit
1665 any string which contains python code (including the result of
1670 any string which contains python code (including the result of
1666 previous edits).
1671 previous edits).
1667
1672
1668 - If the argument is the name of an object (other than a string),
1673 - If the argument is the name of an object (other than a string),
1669 IPython will try to locate the file where it was defined and open the
1674 IPython will try to locate the file where it was defined and open the
1670 editor at the point where it is defined. You can use `%edit function`
1675 editor at the point where it is defined. You can use `%edit function`
1671 to load an editor exactly at the point where 'function' is defined,
1676 to load an editor exactly at the point where 'function' is defined,
1672 edit it and have the file be executed automatically.
1677 edit it and have the file be executed automatically.
1673
1678
1674 Note: opening at an exact line is only supported under Unix, and some
1679 Note: opening at an exact line is only supported under Unix, and some
1675 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1680 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1676 '+NUMBER' parameter necessary for this feature. Good editors like
1681 '+NUMBER' parameter necessary for this feature. Good editors like
1677 (X)Emacs, vi, jed, pico and joe all do.
1682 (X)Emacs, vi, jed, pico and joe all do.
1678
1683
1679 - If the argument is not found as a variable, IPython will look for a
1684 - If the argument is not found as a variable, IPython will look for a
1680 file with that name (adding .py if necessary) and load it into the
1685 file with that name (adding .py if necessary) and load it into the
1681 editor. It will execute its contents with execfile() when you exit,
1686 editor. It will execute its contents with execfile() when you exit,
1682 loading any code in the file into your interactive namespace.
1687 loading any code in the file into your interactive namespace.
1683
1688
1684 After executing your code, %edit will return as output the code you
1689 After executing your code, %edit will return as output the code you
1685 typed in the editor (except when it was an existing file). This way
1690 typed in the editor (except when it was an existing file). This way
1686 you can reload the code in further invocations of %edit as a variable,
1691 you can reload the code in further invocations of %edit as a variable,
1687 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1692 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1688 the output.
1693 the output.
1689
1694
1690 Note that %edit is also available through the alias %ed.
1695 Note that %edit is also available through the alias %ed.
1691
1696
1692 This is an example of creating a simple function inside the editor and
1697 This is an example of creating a simple function inside the editor and
1693 then modifying it. First, start up the editor:
1698 then modifying it. First, start up the editor:
1694
1699
1695 In [1]: ed\\
1700 In [1]: ed\\
1696 Editing... done. Executing edited code...\\
1701 Editing... done. Executing edited code...\\
1697 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1702 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1698
1703
1699 We can then call the function foo():
1704 We can then call the function foo():
1700
1705
1701 In [2]: foo()\\
1706 In [2]: foo()\\
1702 foo() was defined in an editing session
1707 foo() was defined in an editing session
1703
1708
1704 Now we edit foo. IPython automatically loads the editor with the
1709 Now we edit foo. IPython automatically loads the editor with the
1705 (temporary) file where foo() was previously defined:
1710 (temporary) file where foo() was previously defined:
1706
1711
1707 In [3]: ed foo\\
1712 In [3]: ed foo\\
1708 Editing... done. Executing edited code...
1713 Editing... done. Executing edited code...
1709
1714
1710 And if we call foo() again we get the modified version:
1715 And if we call foo() again we get the modified version:
1711
1716
1712 In [4]: foo()\\
1717 In [4]: foo()\\
1713 foo() has now been changed!
1718 foo() has now been changed!
1714
1719
1715 Here is an example of how to edit a code snippet successive
1720 Here is an example of how to edit a code snippet successive
1716 times. First we call the editor:
1721 times. First we call the editor:
1717
1722
1718 In [8]: ed\\
1723 In [8]: ed\\
1719 Editing... done. Executing edited code...\\
1724 Editing... done. Executing edited code...\\
1720 hello\\
1725 hello\\
1721 Out[8]: "print 'hello'\\n"
1726 Out[8]: "print 'hello'\\n"
1722
1727
1723 Now we call it again with the previous output (stored in _):
1728 Now we call it again with the previous output (stored in _):
1724
1729
1725 In [9]: ed _\\
1730 In [9]: ed _\\
1726 Editing... done. Executing edited code...\\
1731 Editing... done. Executing edited code...\\
1727 hello world\\
1732 hello world\\
1728 Out[9]: "print 'hello world'\\n"
1733 Out[9]: "print 'hello world'\\n"
1729
1734
1730 Now we call it with the output #8 (stored in _8, also as Out[8]):
1735 Now we call it with the output #8 (stored in _8, also as Out[8]):
1731
1736
1732 In [10]: ed _8\\
1737 In [10]: ed _8\\
1733 Editing... done. Executing edited code...\\
1738 Editing... done. Executing edited code...\\
1734 hello again\\
1739 hello again\\
1735 Out[10]: "print 'hello again'\\n"
1740 Out[10]: "print 'hello again'\\n"
1736
1741
1737
1742
1738 Changing the default editor hook:
1743 Changing the default editor hook:
1739
1744
1740 If you wish to write your own editor hook, you can put it in a
1745 If you wish to write your own editor hook, you can put it in a
1741 configuration file which you load at startup time. The default hook
1746 configuration file which you load at startup time. The default hook
1742 is defined in the IPython.hooks module, and you can use that as a
1747 is defined in the IPython.hooks module, and you can use that as a
1743 starting example for further modifications. That file also has
1748 starting example for further modifications. That file also has
1744 general instructions on how to set a new hook for use once you've
1749 general instructions on how to set a new hook for use once you've
1745 defined it."""
1750 defined it."""
1746
1751
1747 # FIXME: This function has become a convoluted mess. It needs a
1752 # FIXME: This function has become a convoluted mess. It needs a
1748 # ground-up rewrite with clean, simple logic.
1753 # ground-up rewrite with clean, simple logic.
1749
1754
1750 def make_filename(arg):
1755 def make_filename(arg):
1751 "Make a filename from the given args"
1756 "Make a filename from the given args"
1752 try:
1757 try:
1753 filename = get_py_filename(arg)
1758 filename = get_py_filename(arg)
1754 except IOError:
1759 except IOError:
1755 if args.endswith('.py'):
1760 if args.endswith('.py'):
1756 filename = arg
1761 filename = arg
1757 else:
1762 else:
1758 filename = None
1763 filename = None
1759 return filename
1764 return filename
1760
1765
1761 # custom exceptions
1766 # custom exceptions
1762 class DataIsObject(Exception): pass
1767 class DataIsObject(Exception): pass
1763
1768
1764 opts,args = self.parse_options(parameter_s,'px')
1769 opts,args = self.parse_options(parameter_s,'px')
1765
1770
1766 # Default line number value
1771 # Default line number value
1767 lineno = None
1772 lineno = None
1768 if opts.has_key('p'):
1773 if opts.has_key('p'):
1769 args = '_%s' % last_call[0]
1774 args = '_%s' % last_call[0]
1770 if not self.shell.user_ns.has_key(args):
1775 if not self.shell.user_ns.has_key(args):
1771 args = last_call[1]
1776 args = last_call[1]
1772
1777
1773 # use last_call to remember the state of the previous call, but don't
1778 # use last_call to remember the state of the previous call, but don't
1774 # let it be clobbered by successive '-p' calls.
1779 # let it be clobbered by successive '-p' calls.
1775 try:
1780 try:
1776 last_call[0] = self.shell.outputcache.prompt_count
1781 last_call[0] = self.shell.outputcache.prompt_count
1777 if not opts.has_key('p'):
1782 if not opts.has_key('p'):
1778 last_call[1] = parameter_s
1783 last_call[1] = parameter_s
1779 except:
1784 except:
1780 pass
1785 pass
1781
1786
1782 # by default this is done with temp files, except when the given
1787 # by default this is done with temp files, except when the given
1783 # arg is a filename
1788 # arg is a filename
1784 use_temp = 1
1789 use_temp = 1
1785
1790
1786 if re.match(r'\d',args):
1791 if re.match(r'\d',args):
1787 # Mode where user specifies ranges of lines, like in %macro.
1792 # Mode where user specifies ranges of lines, like in %macro.
1788 # This means that you can't edit files whose names begin with
1793 # This means that you can't edit files whose names begin with
1789 # numbers this way. Tough.
1794 # numbers this way. Tough.
1790 ranges = args.split()
1795 ranges = args.split()
1791 data = ''.join(self.extract_input_slices(ranges))
1796 data = ''.join(self.extract_input_slices(ranges))
1792 elif args.endswith('.py'):
1797 elif args.endswith('.py'):
1793 filename = make_filename(args)
1798 filename = make_filename(args)
1794 data = ''
1799 data = ''
1795 use_temp = 0
1800 use_temp = 0
1796 elif args:
1801 elif args:
1797 try:
1802 try:
1798 # Load the parameter given as a variable. If not a string,
1803 # Load the parameter given as a variable. If not a string,
1799 # process it as an object instead (below)
1804 # process it as an object instead (below)
1800
1805
1801 #print '*** args',args,'type',type(args) # dbg
1806 #print '*** args',args,'type',type(args) # dbg
1802 data = eval(args,self.shell.user_ns)
1807 data = eval(args,self.shell.user_ns)
1803 if not type(data) in StringTypes:
1808 if not type(data) in StringTypes:
1804 raise DataIsObject
1809 raise DataIsObject
1805 except (NameError,SyntaxError):
1810 except (NameError,SyntaxError):
1806 # given argument is not a variable, try as a filename
1811 # given argument is not a variable, try as a filename
1807 filename = make_filename(args)
1812 filename = make_filename(args)
1808 if filename is None:
1813 if filename is None:
1809 warn("Argument given (%s) can't be found as a variable "
1814 warn("Argument given (%s) can't be found as a variable "
1810 "or as a filename." % args)
1815 "or as a filename." % args)
1811 return
1816 return
1812 data = ''
1817 data = ''
1813 use_temp = 0
1818 use_temp = 0
1814 except DataIsObject:
1819 except DataIsObject:
1815 # For objects, try to edit the file where they are defined
1820 # For objects, try to edit the file where they are defined
1816 try:
1821 try:
1817 filename = inspect.getabsfile(data)
1822 filename = inspect.getabsfile(data)
1818 datafile = 1
1823 datafile = 1
1819 except TypeError:
1824 except TypeError:
1820 filename = make_filename(args)
1825 filename = make_filename(args)
1821 datafile = 1
1826 datafile = 1
1822 warn('Could not find file where `%s` is defined.\n'
1827 warn('Could not find file where `%s` is defined.\n'
1823 'Opening a file named `%s`' % (args,filename))
1828 'Opening a file named `%s`' % (args,filename))
1824 # Now, make sure we can actually read the source (if it was in
1829 # Now, make sure we can actually read the source (if it was in
1825 # a temp file it's gone by now).
1830 # a temp file it's gone by now).
1826 if datafile:
1831 if datafile:
1827 try:
1832 try:
1828 lineno = inspect.getsourcelines(data)[1]
1833 lineno = inspect.getsourcelines(data)[1]
1829 except IOError:
1834 except IOError:
1830 filename = make_filename(args)
1835 filename = make_filename(args)
1831 if filename is None:
1836 if filename is None:
1832 warn('The file `%s` where `%s` was defined cannot '
1837 warn('The file `%s` where `%s` was defined cannot '
1833 'be read.' % (filename,data))
1838 'be read.' % (filename,data))
1834 return
1839 return
1835 use_temp = 0
1840 use_temp = 0
1836 else:
1841 else:
1837 data = ''
1842 data = ''
1838
1843
1839 if use_temp:
1844 if use_temp:
1840 filename = tempfile.mktemp('.py')
1845 filename = tempfile.mktemp('.py')
1841 self.shell.tempfiles.append(filename)
1846 self.shell.tempfiles.append(filename)
1842
1847
1843 if data and use_temp:
1848 if data and use_temp:
1844 tmp_file = open(filename,'w')
1849 tmp_file = open(filename,'w')
1845 tmp_file.write(data)
1850 tmp_file.write(data)
1846 tmp_file.close()
1851 tmp_file.close()
1847
1852
1848 # do actual editing here
1853 # do actual editing here
1849 print 'Editing...',
1854 print 'Editing...',
1850 sys.stdout.flush()
1855 sys.stdout.flush()
1851 self.shell.hooks.editor(filename,lineno)
1856 self.shell.hooks.editor(filename,lineno)
1852 if opts.has_key('x'): # -x prevents actual execution
1857 if opts.has_key('x'): # -x prevents actual execution
1853 print
1858 print
1854 else:
1859 else:
1855 print 'done. Executing edited code...'
1860 print 'done. Executing edited code...'
1856 try:
1861 try:
1857 self.shell.safe_execfile(filename,self.shell.user_ns)
1862 self.shell.safe_execfile(filename,self.shell.user_ns)
1858 except IOError,msg:
1863 except IOError,msg:
1859 if msg.filename == filename:
1864 if msg.filename == filename:
1860 warn('File not found. Did you forget to save?')
1865 warn('File not found. Did you forget to save?')
1861 return
1866 return
1862 else:
1867 else:
1863 self.shell.showtraceback()
1868 self.shell.showtraceback()
1864 except:
1869 except:
1865 self.shell.showtraceback()
1870 self.shell.showtraceback()
1866 if use_temp:
1871 if use_temp:
1867 contents = open(filename).read()
1872 contents = open(filename).read()
1868 return contents
1873 return contents
1869
1874
1870 def magic_xmode(self,parameter_s = ''):
1875 def magic_xmode(self,parameter_s = ''):
1871 """Switch modes for the exception handlers.
1876 """Switch modes for the exception handlers.
1872
1877
1873 Valid modes: Plain, Context and Verbose.
1878 Valid modes: Plain, Context and Verbose.
1874
1879
1875 If called without arguments, acts as a toggle."""
1880 If called without arguments, acts as a toggle."""
1876
1881
1877 def xmode_switch_err(name):
1882 def xmode_switch_err(name):
1878 warn('Error changing %s exception modes.\n%s' %
1883 warn('Error changing %s exception modes.\n%s' %
1879 (name,sys.exc_info()[1]))
1884 (name,sys.exc_info()[1]))
1880
1885
1881 shell = self.shell
1886 shell = self.shell
1882 new_mode = parameter_s.strip().capitalize()
1887 new_mode = parameter_s.strip().capitalize()
1883 try:
1888 try:
1884 shell.InteractiveTB.set_mode(mode=new_mode)
1889 shell.InteractiveTB.set_mode(mode=new_mode)
1885 print 'Exception reporting mode:',shell.InteractiveTB.mode
1890 print 'Exception reporting mode:',shell.InteractiveTB.mode
1886 except:
1891 except:
1887 xmode_switch_err('user')
1892 xmode_switch_err('user')
1888
1893
1889 # threaded shells use a special handler in sys.excepthook
1894 # threaded shells use a special handler in sys.excepthook
1890 if shell.isthreaded:
1895 if shell.isthreaded:
1891 try:
1896 try:
1892 shell.sys_excepthook.set_mode(mode=new_mode)
1897 shell.sys_excepthook.set_mode(mode=new_mode)
1893 except:
1898 except:
1894 xmode_switch_err('threaded')
1899 xmode_switch_err('threaded')
1895
1900
1896 def magic_colors(self,parameter_s = ''):
1901 def magic_colors(self,parameter_s = ''):
1897 """Switch color scheme for prompts, info system and exception handlers.
1902 """Switch color scheme for prompts, info system and exception handlers.
1898
1903
1899 Currently implemented schemes: NoColor, Linux, LightBG.
1904 Currently implemented schemes: NoColor, Linux, LightBG.
1900
1905
1901 Color scheme names are not case-sensitive."""
1906 Color scheme names are not case-sensitive."""
1902
1907
1903 def color_switch_err(name):
1908 def color_switch_err(name):
1904 warn('Error changing %s color schemes.\n%s' %
1909 warn('Error changing %s color schemes.\n%s' %
1905 (name,sys.exc_info()[1]))
1910 (name,sys.exc_info()[1]))
1906
1911
1907
1912
1908 new_scheme = parameter_s.strip()
1913 new_scheme = parameter_s.strip()
1909 if not new_scheme:
1914 if not new_scheme:
1910 print 'You must specify a color scheme.'
1915 print 'You must specify a color scheme.'
1911 return
1916 return
1912 # Under Windows, check for Gary Bishop's readline, which is necessary
1917 # Under Windows, check for Gary Bishop's readline, which is necessary
1913 # for ANSI coloring
1918 # for ANSI coloring
1914 if os.name in ['nt','dos']:
1919 if os.name in ['nt','dos']:
1915 try:
1920 try:
1916 import readline
1921 import readline
1917 except ImportError:
1922 except ImportError:
1918 has_readline = 0
1923 has_readline = 0
1919 else:
1924 else:
1920 try:
1925 try:
1921 readline.GetOutputFile()
1926 readline.GetOutputFile()
1922 except AttributeError:
1927 except AttributeError:
1923 has_readline = 0
1928 has_readline = 0
1924 else:
1929 else:
1925 has_readline = 1
1930 has_readline = 1
1926 if not has_readline:
1931 if not has_readline:
1927 msg = """\
1932 msg = """\
1928 Proper color support under MS Windows requires Gary Bishop's readline library.
1933 Proper color support under MS Windows requires Gary Bishop's readline library.
1929 You can find it at:
1934 You can find it at:
1930 http://sourceforge.net/projects/uncpythontools
1935 http://sourceforge.net/projects/uncpythontools
1931 Gary's readline needs the ctypes module, from:
1936 Gary's readline needs the ctypes module, from:
1932 http://starship.python.net/crew/theller/ctypes
1937 http://starship.python.net/crew/theller/ctypes
1933
1938
1934 Defaulting color scheme to 'NoColor'"""
1939 Defaulting color scheme to 'NoColor'"""
1935 new_scheme = 'NoColor'
1940 new_scheme = 'NoColor'
1936 warn(msg)
1941 warn(msg)
1937 # local shortcut
1942 # local shortcut
1938 shell = self.shell
1943 shell = self.shell
1939
1944
1940 # Set prompt colors
1945 # Set prompt colors
1941 try:
1946 try:
1942 shell.outputcache.set_colors(new_scheme)
1947 shell.outputcache.set_colors(new_scheme)
1943 except:
1948 except:
1944 color_switch_err('prompt')
1949 color_switch_err('prompt')
1945 else:
1950 else:
1946 shell.rc.colors = \
1951 shell.rc.colors = \
1947 shell.outputcache.color_table.active_scheme_name
1952 shell.outputcache.color_table.active_scheme_name
1948 # Set exception colors
1953 # Set exception colors
1949 try:
1954 try:
1950 shell.InteractiveTB.set_colors(scheme = new_scheme)
1955 shell.InteractiveTB.set_colors(scheme = new_scheme)
1951 shell.SyntaxTB.set_colors(scheme = new_scheme)
1956 shell.SyntaxTB.set_colors(scheme = new_scheme)
1952 except:
1957 except:
1953 color_switch_err('exception')
1958 color_switch_err('exception')
1954
1959
1955 # threaded shells use a verbose traceback in sys.excepthook
1960 # threaded shells use a verbose traceback in sys.excepthook
1956 if shell.isthreaded:
1961 if shell.isthreaded:
1957 try:
1962 try:
1958 shell.sys_excepthook.set_colors(scheme=new_scheme)
1963 shell.sys_excepthook.set_colors(scheme=new_scheme)
1959 except:
1964 except:
1960 color_switch_err('system exception handler')
1965 color_switch_err('system exception handler')
1961
1966
1962 # Set info (for 'object?') colors
1967 # Set info (for 'object?') colors
1963 if shell.rc.color_info:
1968 if shell.rc.color_info:
1964 try:
1969 try:
1965 shell.inspector.set_active_scheme(new_scheme)
1970 shell.inspector.set_active_scheme(new_scheme)
1966 except:
1971 except:
1967 color_switch_err('object inspector')
1972 color_switch_err('object inspector')
1968 else:
1973 else:
1969 shell.inspector.set_active_scheme('NoColor')
1974 shell.inspector.set_active_scheme('NoColor')
1970
1975
1971 def magic_color_info(self,parameter_s = ''):
1976 def magic_color_info(self,parameter_s = ''):
1972 """Toggle color_info.
1977 """Toggle color_info.
1973
1978
1974 The color_info configuration parameter controls whether colors are
1979 The color_info configuration parameter controls whether colors are
1975 used for displaying object details (by things like %psource, %pfile or
1980 used for displaying object details (by things like %psource, %pfile or
1976 the '?' system). This function toggles this value with each call.
1981 the '?' system). This function toggles this value with each call.
1977
1982
1978 Note that unless you have a fairly recent pager (less works better
1983 Note that unless you have a fairly recent pager (less works better
1979 than more) in your system, using colored object information displays
1984 than more) in your system, using colored object information displays
1980 will not work properly. Test it and see."""
1985 will not work properly. Test it and see."""
1981
1986
1982 self.shell.rc.color_info = 1 - self.shell.rc.color_info
1987 self.shell.rc.color_info = 1 - self.shell.rc.color_info
1983 self.magic_colors(self.shell.rc.colors)
1988 self.magic_colors(self.shell.rc.colors)
1984 print 'Object introspection functions have now coloring:',
1989 print 'Object introspection functions have now coloring:',
1985 print ['OFF','ON'][self.shell.rc.color_info]
1990 print ['OFF','ON'][self.shell.rc.color_info]
1986
1991
1987 def magic_Pprint(self, parameter_s=''):
1992 def magic_Pprint(self, parameter_s=''):
1988 """Toggle pretty printing on/off."""
1993 """Toggle pretty printing on/off."""
1989
1994
1990 self.shell.outputcache.Pprint = 1 - self.shell.outputcache.Pprint
1995 self.shell.outputcache.Pprint = 1 - self.shell.outputcache.Pprint
1991 print 'Pretty printing has been turned', \
1996 print 'Pretty printing has been turned', \
1992 ['OFF','ON'][self.shell.outputcache.Pprint]
1997 ['OFF','ON'][self.shell.outputcache.Pprint]
1993
1998
1994 def magic_exit(self, parameter_s=''):
1999 def magic_exit(self, parameter_s=''):
1995 """Exit IPython, confirming if configured to do so.
2000 """Exit IPython, confirming if configured to do so.
1996
2001
1997 You can configure whether IPython asks for confirmation upon exit by
2002 You can configure whether IPython asks for confirmation upon exit by
1998 setting the confirm_exit flag in the ipythonrc file."""
2003 setting the confirm_exit flag in the ipythonrc file."""
1999
2004
2000 self.shell.exit()
2005 self.shell.exit()
2001
2006
2002 def magic_quit(self, parameter_s=''):
2007 def magic_quit(self, parameter_s=''):
2003 """Exit IPython, confirming if configured to do so (like %exit)"""
2008 """Exit IPython, confirming if configured to do so (like %exit)"""
2004
2009
2005 self.shell.exit()
2010 self.shell.exit()
2006
2011
2007 def magic_Exit(self, parameter_s=''):
2012 def magic_Exit(self, parameter_s=''):
2008 """Exit IPython without confirmation."""
2013 """Exit IPython without confirmation."""
2009
2014
2010 self.shell.exit_now = True
2015 self.shell.exit_now = True
2011
2016
2012 def magic_Quit(self, parameter_s=''):
2017 def magic_Quit(self, parameter_s=''):
2013 """Exit IPython without confirmation (like %Exit)."""
2018 """Exit IPython without confirmation (like %Exit)."""
2014
2019
2015 self.shell.exit_now = True
2020 self.shell.exit_now = True
2016
2021
2017 #......................................................................
2022 #......................................................................
2018 # Functions to implement unix shell-type things
2023 # Functions to implement unix shell-type things
2019
2024
2020 def magic_alias(self, parameter_s = ''):
2025 def magic_alias(self, parameter_s = ''):
2021 """Define an alias for a system command.
2026 """Define an alias for a system command.
2022
2027
2023 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2028 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2024
2029
2025 Then, typing 'alias_name params' will execute the system command 'cmd
2030 Then, typing 'alias_name params' will execute the system command 'cmd
2026 params' (from your underlying operating system).
2031 params' (from your underlying operating system).
2027
2032
2028 Aliases have lower precedence than magic functions and Python normal
2033 Aliases have lower precedence than magic functions and Python normal
2029 variables, so if 'foo' is both a Python variable and an alias, the
2034 variables, so if 'foo' is both a Python variable and an alias, the
2030 alias can not be executed until 'del foo' removes the Python variable.
2035 alias can not be executed until 'del foo' removes the Python variable.
2031
2036
2032 You can use the %l specifier in an alias definition to represent the
2037 You can use the %l specifier in an alias definition to represent the
2033 whole line when the alias is called. For example:
2038 whole line when the alias is called. For example:
2034
2039
2035 In [2]: alias all echo "Input in brackets: <%l>"\\
2040 In [2]: alias all echo "Input in brackets: <%l>"\\
2036 In [3]: all hello world\\
2041 In [3]: all hello world\\
2037 Input in brackets: <hello world>
2042 Input in brackets: <hello world>
2038
2043
2039 You can also define aliases with parameters using %s specifiers (one
2044 You can also define aliases with parameters using %s specifiers (one
2040 per parameter):
2045 per parameter):
2041
2046
2042 In [1]: alias parts echo first %s second %s\\
2047 In [1]: alias parts echo first %s second %s\\
2043 In [2]: %parts A B\\
2048 In [2]: %parts A B\\
2044 first A second B\\
2049 first A second B\\
2045 In [3]: %parts A\\
2050 In [3]: %parts A\\
2046 Incorrect number of arguments: 2 expected.\\
2051 Incorrect number of arguments: 2 expected.\\
2047 parts is an alias to: 'echo first %s second %s'
2052 parts is an alias to: 'echo first %s second %s'
2048
2053
2049 Note that %l and %s are mutually exclusive. You can only use one or
2054 Note that %l and %s are mutually exclusive. You can only use one or
2050 the other in your aliases.
2055 the other in your aliases.
2051
2056
2052 Aliases expand Python variables just like system calls using ! or !!
2057 Aliases expand Python variables just like system calls using ! or !!
2053 do: all expressions prefixed with '$' get expanded. For details of
2058 do: all expressions prefixed with '$' get expanded. For details of
2054 the semantic rules, see PEP-215:
2059 the semantic rules, see PEP-215:
2055 http://www.python.org/peps/pep-0215.html. This is the library used by
2060 http://www.python.org/peps/pep-0215.html. This is the library used by
2056 IPython for variable expansion. If you want to access a true shell
2061 IPython for variable expansion. If you want to access a true shell
2057 variable, an extra $ is necessary to prevent its expansion by IPython:
2062 variable, an extra $ is necessary to prevent its expansion by IPython:
2058
2063
2059 In [6]: alias show echo\\
2064 In [6]: alias show echo\\
2060 In [7]: PATH='A Python string'\\
2065 In [7]: PATH='A Python string'\\
2061 In [8]: show $PATH\\
2066 In [8]: show $PATH\\
2062 A Python string\\
2067 A Python string\\
2063 In [9]: show $$PATH\\
2068 In [9]: show $$PATH\\
2064 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2069 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2065
2070
2066 You can use the alias facility to acess all of $PATH. See the %rehash
2071 You can use the alias facility to acess all of $PATH. See the %rehash
2067 and %rehashx functions, which automatically create aliases for the
2072 and %rehashx functions, which automatically create aliases for the
2068 contents of your $PATH.
2073 contents of your $PATH.
2069
2074
2070 If called with no parameters, %alias prints the current alias table."""
2075 If called with no parameters, %alias prints the current alias table."""
2071
2076
2072 par = parameter_s.strip()
2077 par = parameter_s.strip()
2073 if not par:
2078 if not par:
2074 if self.shell.rc.automagic:
2079 if self.shell.rc.automagic:
2075 prechar = ''
2080 prechar = ''
2076 else:
2081 else:
2077 prechar = self.shell.ESC_MAGIC
2082 prechar = self.shell.ESC_MAGIC
2078 print 'Alias\t\tSystem Command\n'+'-'*30
2083 print 'Alias\t\tSystem Command\n'+'-'*30
2079 atab = self.shell.alias_table
2084 atab = self.shell.alias_table
2080 aliases = atab.keys()
2085 aliases = atab.keys()
2081 aliases.sort()
2086 aliases.sort()
2082 for alias in aliases:
2087 for alias in aliases:
2083 print prechar+alias+'\t\t'+atab[alias][1]
2088 print prechar+alias+'\t\t'+atab[alias][1]
2084 print '-'*30+'\nTotal number of aliases:',len(aliases)
2089 print '-'*30+'\nTotal number of aliases:',len(aliases)
2085 return
2090 return
2086 try:
2091 try:
2087 alias,cmd = par.split(None,1)
2092 alias,cmd = par.split(None,1)
2088 except:
2093 except:
2089 print OInspect.getdoc(self.magic_alias)
2094 print OInspect.getdoc(self.magic_alias)
2090 else:
2095 else:
2091 nargs = cmd.count('%s')
2096 nargs = cmd.count('%s')
2092 if nargs>0 and cmd.find('%l')>=0:
2097 if nargs>0 and cmd.find('%l')>=0:
2093 error('The %s and %l specifiers are mutually exclusive '
2098 error('The %s and %l specifiers are mutually exclusive '
2094 'in alias definitions.')
2099 'in alias definitions.')
2095 else: # all looks OK
2100 else: # all looks OK
2096 self.shell.alias_table[alias] = (nargs,cmd)
2101 self.shell.alias_table[alias] = (nargs,cmd)
2097 self.shell.alias_table_validate(verbose=1)
2102 self.shell.alias_table_validate(verbose=1)
2098 # end magic_alias
2103 # end magic_alias
2099
2104
2100 def magic_unalias(self, parameter_s = ''):
2105 def magic_unalias(self, parameter_s = ''):
2101 """Remove an alias"""
2106 """Remove an alias"""
2102
2107
2103 aname = parameter_s.strip()
2108 aname = parameter_s.strip()
2104 if aname in self.shell.alias_table:
2109 if aname in self.shell.alias_table:
2105 del self.shell.alias_table[aname]
2110 del self.shell.alias_table[aname]
2106
2111
2107 def magic_rehash(self, parameter_s = ''):
2112 def magic_rehash(self, parameter_s = ''):
2108 """Update the alias table with all entries in $PATH.
2113 """Update the alias table with all entries in $PATH.
2109
2114
2110 This version does no checks on execute permissions or whether the
2115 This version does no checks on execute permissions or whether the
2111 contents of $PATH are truly files (instead of directories or something
2116 contents of $PATH are truly files (instead of directories or something
2112 else). For such a safer (but slower) version, use %rehashx."""
2117 else). For such a safer (but slower) version, use %rehashx."""
2113
2118
2114 # This function (and rehashx) manipulate the alias_table directly
2119 # This function (and rehashx) manipulate the alias_table directly
2115 # rather than calling magic_alias, for speed reasons. A rehash on a
2120 # rather than calling magic_alias, for speed reasons. A rehash on a
2116 # typical Linux box involves several thousand entries, so efficiency
2121 # typical Linux box involves several thousand entries, so efficiency
2117 # here is a top concern.
2122 # here is a top concern.
2118
2123
2119 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2124 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2120 alias_table = self.shell.alias_table
2125 alias_table = self.shell.alias_table
2121 for pdir in path:
2126 for pdir in path:
2122 for ff in os.listdir(pdir):
2127 for ff in os.listdir(pdir):
2123 # each entry in the alias table must be (N,name), where
2128 # each entry in the alias table must be (N,name), where
2124 # N is the number of positional arguments of the alias.
2129 # N is the number of positional arguments of the alias.
2125 alias_table[ff] = (0,ff)
2130 alias_table[ff] = (0,ff)
2126 # Make sure the alias table doesn't contain keywords or builtins
2131 # Make sure the alias table doesn't contain keywords or builtins
2127 self.shell.alias_table_validate()
2132 self.shell.alias_table_validate()
2128 # Call again init_auto_alias() so we get 'rm -i' and other modified
2133 # Call again init_auto_alias() so we get 'rm -i' and other modified
2129 # aliases since %rehash will probably clobber them
2134 # aliases since %rehash will probably clobber them
2130 self.shell.init_auto_alias()
2135 self.shell.init_auto_alias()
2131
2136
2132 def magic_rehashx(self, parameter_s = ''):
2137 def magic_rehashx(self, parameter_s = ''):
2133 """Update the alias table with all executable files in $PATH.
2138 """Update the alias table with all executable files in $PATH.
2134
2139
2135 This version explicitly checks that every entry in $PATH is a file
2140 This version explicitly checks that every entry in $PATH is a file
2136 with execute access (os.X_OK), so it is much slower than %rehash.
2141 with execute access (os.X_OK), so it is much slower than %rehash.
2137
2142
2138 Under Windows, it checks executability as a match agains a
2143 Under Windows, it checks executability as a match agains a
2139 '|'-separated string of extensions, stored in the IPython config
2144 '|'-separated string of extensions, stored in the IPython config
2140 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2145 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2141
2146
2142 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2147 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2143 alias_table = self.shell.alias_table
2148 alias_table = self.shell.alias_table
2144
2149
2145 if os.name == 'posix':
2150 if os.name == 'posix':
2146 isexec = lambda fname:os.path.isfile(fname) and \
2151 isexec = lambda fname:os.path.isfile(fname) and \
2147 os.access(fname,os.X_OK)
2152 os.access(fname,os.X_OK)
2148 else:
2153 else:
2149
2154
2150 try:
2155 try:
2151 winext = os.environ['pathext'].replace(';','|').replace('.','')
2156 winext = os.environ['pathext'].replace(';','|').replace('.','')
2152 except KeyError:
2157 except KeyError:
2153 winext = 'exe|com|bat'
2158 winext = 'exe|com|bat'
2154
2159
2155 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2160 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2156 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2161 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2157 savedir = os.getcwd()
2162 savedir = os.getcwd()
2158 try:
2163 try:
2159 # write the whole loop for posix/Windows so we don't have an if in
2164 # write the whole loop for posix/Windows so we don't have an if in
2160 # the innermost part
2165 # the innermost part
2161 if os.name == 'posix':
2166 if os.name == 'posix':
2162 for pdir in path:
2167 for pdir in path:
2163 os.chdir(pdir)
2168 os.chdir(pdir)
2164 for ff in os.listdir(pdir):
2169 for ff in os.listdir(pdir):
2165 if isexec(ff):
2170 if isexec(ff):
2166 # each entry in the alias table must be (N,name),
2171 # each entry in the alias table must be (N,name),
2167 # where N is the number of positional arguments of the
2172 # where N is the number of positional arguments of the
2168 # alias.
2173 # alias.
2169 alias_table[ff] = (0,ff)
2174 alias_table[ff] = (0,ff)
2170 else:
2175 else:
2171 for pdir in path:
2176 for pdir in path:
2172 os.chdir(pdir)
2177 os.chdir(pdir)
2173 for ff in os.listdir(pdir):
2178 for ff in os.listdir(pdir):
2174 if isexec(ff):
2179 if isexec(ff):
2175 alias_table[execre.sub(r'\1',ff)] = (0,ff)
2180 alias_table[execre.sub(r'\1',ff)] = (0,ff)
2176 # Make sure the alias table doesn't contain keywords or builtins
2181 # Make sure the alias table doesn't contain keywords or builtins
2177 self.shell.alias_table_validate()
2182 self.shell.alias_table_validate()
2178 # Call again init_auto_alias() so we get 'rm -i' and other
2183 # Call again init_auto_alias() so we get 'rm -i' and other
2179 # modified aliases since %rehashx will probably clobber them
2184 # modified aliases since %rehashx will probably clobber them
2180 self.shell.init_auto_alias()
2185 self.shell.init_auto_alias()
2181 finally:
2186 finally:
2182 os.chdir(savedir)
2187 os.chdir(savedir)
2183
2188
2184 def magic_pwd(self, parameter_s = ''):
2189 def magic_pwd(self, parameter_s = ''):
2185 """Return the current working directory path."""
2190 """Return the current working directory path."""
2186 return os.getcwd()
2191 return os.getcwd()
2187
2192
2188 def magic_cd(self, parameter_s=''):
2193 def magic_cd(self, parameter_s=''):
2189 """Change the current working directory.
2194 """Change the current working directory.
2190
2195
2191 This command automatically maintains an internal list of directories
2196 This command automatically maintains an internal list of directories
2192 you visit during your IPython session, in the variable _dh. The
2197 you visit during your IPython session, in the variable _dh. The
2193 command %dhist shows this history nicely formatted.
2198 command %dhist shows this history nicely formatted.
2194
2199
2195 Usage:
2200 Usage:
2196
2201
2197 cd 'dir': changes to directory 'dir'.
2202 cd 'dir': changes to directory 'dir'.
2198
2203
2199 cd -: changes to the last visited directory.
2204 cd -: changes to the last visited directory.
2200
2205
2201 cd -<n>: changes to the n-th directory in the directory history.
2206 cd -<n>: changes to the n-th directory in the directory history.
2202
2207
2203 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2208 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2204 (note: cd <bookmark_name> is enough if there is no
2209 (note: cd <bookmark_name> is enough if there is no
2205 directory <bookmark_name>, but a bookmark with the name exists.)
2210 directory <bookmark_name>, but a bookmark with the name exists.)
2206
2211
2207 Options:
2212 Options:
2208
2213
2209 -q: quiet. Do not print the working directory after the cd command is
2214 -q: quiet. Do not print the working directory after the cd command is
2210 executed. By default IPython's cd command does print this directory,
2215 executed. By default IPython's cd command does print this directory,
2211 since the default prompts do not display path information.
2216 since the default prompts do not display path information.
2212
2217
2213 Note that !cd doesn't work for this purpose because the shell where
2218 Note that !cd doesn't work for this purpose because the shell where
2214 !command runs is immediately discarded after executing 'command'."""
2219 !command runs is immediately discarded after executing 'command'."""
2215
2220
2216 parameter_s = parameter_s.strip()
2221 parameter_s = parameter_s.strip()
2217 bkms = self.shell.persist.get("bookmarks",{})
2222 bkms = self.shell.persist.get("bookmarks",{})
2218
2223
2219 numcd = re.match(r'(-)(\d+)$',parameter_s)
2224 numcd = re.match(r'(-)(\d+)$',parameter_s)
2220 # jump in directory history by number
2225 # jump in directory history by number
2221 if numcd:
2226 if numcd:
2222 nn = int(numcd.group(2))
2227 nn = int(numcd.group(2))
2223 try:
2228 try:
2224 ps = self.shell.user_ns['_dh'][nn]
2229 ps = self.shell.user_ns['_dh'][nn]
2225 except IndexError:
2230 except IndexError:
2226 print 'The requested directory does not exist in history.'
2231 print 'The requested directory does not exist in history.'
2227 return
2232 return
2228 else:
2233 else:
2229 opts = {}
2234 opts = {}
2230 else:
2235 else:
2231 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2236 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2232 # jump to previous
2237 # jump to previous
2233 if ps == '-':
2238 if ps == '-':
2234 try:
2239 try:
2235 ps = self.shell.user_ns['_dh'][-2]
2240 ps = self.shell.user_ns['_dh'][-2]
2236 except IndexError:
2241 except IndexError:
2237 print 'No previous directory to change to.'
2242 print 'No previous directory to change to.'
2238 return
2243 return
2239 # jump to bookmark
2244 # jump to bookmark
2240 elif opts.has_key('b') or (bkms.has_key(ps) and not os.path.isdir(ps)):
2245 elif opts.has_key('b') or (bkms.has_key(ps) and not os.path.isdir(ps)):
2241 if bkms.has_key(ps):
2246 if bkms.has_key(ps):
2242 target = bkms[ps]
2247 target = bkms[ps]
2243 print '(bookmark:%s) -> %s' % (ps,target)
2248 print '(bookmark:%s) -> %s' % (ps,target)
2244 ps = target
2249 ps = target
2245 else:
2250 else:
2246 if bkms:
2251 if bkms:
2247 error("Bookmark '%s' not found. "
2252 error("Bookmark '%s' not found. "
2248 "Use '%bookmark -l' to see your bookmarks." % ps)
2253 "Use '%bookmark -l' to see your bookmarks." % ps)
2249 else:
2254 else:
2250 print "Bookmarks not set - use %bookmark <bookmarkname>"
2255 print "Bookmarks not set - use %bookmark <bookmarkname>"
2251 return
2256 return
2252
2257
2253 # at this point ps should point to the target dir
2258 # at this point ps should point to the target dir
2254 if ps:
2259 if ps:
2255 try:
2260 try:
2256 os.chdir(os.path.expanduser(ps))
2261 os.chdir(os.path.expanduser(ps))
2257 except OSError:
2262 except OSError:
2258 print sys.exc_info()[1]
2263 print sys.exc_info()[1]
2259 else:
2264 else:
2260 self.shell.user_ns['_dh'].append(os.getcwd())
2265 self.shell.user_ns['_dh'].append(os.getcwd())
2261 else:
2266 else:
2262 os.chdir(self.shell.home_dir)
2267 os.chdir(self.shell.home_dir)
2263 self.shell.user_ns['_dh'].append(os.getcwd())
2268 self.shell.user_ns['_dh'].append(os.getcwd())
2264 if not 'q' in opts:
2269 if not 'q' in opts:
2265 print self.shell.user_ns['_dh'][-1]
2270 print self.shell.user_ns['_dh'][-1]
2266
2271
2267 def magic_dhist(self, parameter_s=''):
2272 def magic_dhist(self, parameter_s=''):
2268 """Print your history of visited directories.
2273 """Print your history of visited directories.
2269
2274
2270 %dhist -> print full history\\
2275 %dhist -> print full history\\
2271 %dhist n -> print last n entries only\\
2276 %dhist n -> print last n entries only\\
2272 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2277 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2273
2278
2274 This history is automatically maintained by the %cd command, and
2279 This history is automatically maintained by the %cd command, and
2275 always available as the global list variable _dh. You can use %cd -<n>
2280 always available as the global list variable _dh. You can use %cd -<n>
2276 to go to directory number <n>."""
2281 to go to directory number <n>."""
2277
2282
2278 dh = self.shell.user_ns['_dh']
2283 dh = self.shell.user_ns['_dh']
2279 if parameter_s:
2284 if parameter_s:
2280 try:
2285 try:
2281 args = map(int,parameter_s.split())
2286 args = map(int,parameter_s.split())
2282 except:
2287 except:
2283 self.arg_err(Magic.magic_dhist)
2288 self.arg_err(Magic.magic_dhist)
2284 return
2289 return
2285 if len(args) == 1:
2290 if len(args) == 1:
2286 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2291 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2287 elif len(args) == 2:
2292 elif len(args) == 2:
2288 ini,fin = args
2293 ini,fin = args
2289 else:
2294 else:
2290 self.arg_err(Magic.magic_dhist)
2295 self.arg_err(Magic.magic_dhist)
2291 return
2296 return
2292 else:
2297 else:
2293 ini,fin = 0,len(dh)
2298 ini,fin = 0,len(dh)
2294 nlprint(dh,
2299 nlprint(dh,
2295 header = 'Directory history (kept in _dh)',
2300 header = 'Directory history (kept in _dh)',
2296 start=ini,stop=fin)
2301 start=ini,stop=fin)
2297
2302
2298 def magic_env(self, parameter_s=''):
2303 def magic_env(self, parameter_s=''):
2299 """List environment variables."""
2304 """List environment variables."""
2300
2305
2301 return os.environ.data
2306 return os.environ.data
2302
2307
2303 def magic_pushd(self, parameter_s=''):
2308 def magic_pushd(self, parameter_s=''):
2304 """Place the current dir on stack and change directory.
2309 """Place the current dir on stack and change directory.
2305
2310
2306 Usage:\\
2311 Usage:\\
2307 %pushd ['dirname']
2312 %pushd ['dirname']
2308
2313
2309 %pushd with no arguments does a %pushd to your home directory.
2314 %pushd with no arguments does a %pushd to your home directory.
2310 """
2315 """
2311 if parameter_s == '': parameter_s = '~'
2316 if parameter_s == '': parameter_s = '~'
2312 dir_s = self.shell.dir_stack
2317 dir_s = self.shell.dir_stack
2313 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2318 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2314 os.path.expanduser(self.shell.dir_stack[0]):
2319 os.path.expanduser(self.shell.dir_stack[0]):
2315 try:
2320 try:
2316 self.magic_cd(parameter_s)
2321 self.magic_cd(parameter_s)
2317 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2322 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2318 self.magic_dirs()
2323 self.magic_dirs()
2319 except:
2324 except:
2320 print 'Invalid directory'
2325 print 'Invalid directory'
2321 else:
2326 else:
2322 print 'You are already there!'
2327 print 'You are already there!'
2323
2328
2324 def magic_popd(self, parameter_s=''):
2329 def magic_popd(self, parameter_s=''):
2325 """Change to directory popped off the top of the stack.
2330 """Change to directory popped off the top of the stack.
2326 """
2331 """
2327 if len (self.shell.dir_stack) > 1:
2332 if len (self.shell.dir_stack) > 1:
2328 self.shell.dir_stack.pop(0)
2333 self.shell.dir_stack.pop(0)
2329 self.magic_cd(self.shell.dir_stack[0])
2334 self.magic_cd(self.shell.dir_stack[0])
2330 print self.shell.dir_stack[0]
2335 print self.shell.dir_stack[0]
2331 else:
2336 else:
2332 print "You can't remove the starting directory from the stack:",\
2337 print "You can't remove the starting directory from the stack:",\
2333 self.shell.dir_stack
2338 self.shell.dir_stack
2334
2339
2335 def magic_dirs(self, parameter_s=''):
2340 def magic_dirs(self, parameter_s=''):
2336 """Return the current directory stack."""
2341 """Return the current directory stack."""
2337
2342
2338 return self.shell.dir_stack[:]
2343 return self.shell.dir_stack[:]
2339
2344
2340 def magic_sc(self, parameter_s=''):
2345 def magic_sc(self, parameter_s=''):
2341 """Shell capture - execute a shell command and capture its output.
2346 """Shell capture - execute a shell command and capture its output.
2342
2347
2343 %sc [options] varname=command
2348 %sc [options] varname=command
2344
2349
2345 IPython will run the given command using commands.getoutput(), and
2350 IPython will run the given command using commands.getoutput(), and
2346 will then update the user's interactive namespace with a variable
2351 will then update the user's interactive namespace with a variable
2347 called varname, containing the value of the call. Your command can
2352 called varname, containing the value of the call. Your command can
2348 contain shell wildcards, pipes, etc.
2353 contain shell wildcards, pipes, etc.
2349
2354
2350 The '=' sign in the syntax is mandatory, and the variable name you
2355 The '=' sign in the syntax is mandatory, and the variable name you
2351 supply must follow Python's standard conventions for valid names.
2356 supply must follow Python's standard conventions for valid names.
2352
2357
2353 Options:
2358 Options:
2354
2359
2355 -l: list output. Split the output on newlines into a list before
2360 -l: list output. Split the output on newlines into a list before
2356 assigning it to the given variable. By default the output is stored
2361 assigning it to the given variable. By default the output is stored
2357 as a single string.
2362 as a single string.
2358
2363
2359 -v: verbose. Print the contents of the variable.
2364 -v: verbose. Print the contents of the variable.
2360
2365
2361 In most cases you should not need to split as a list, because the
2366 In most cases you should not need to split as a list, because the
2362 returned value is a special type of string which can automatically
2367 returned value is a special type of string which can automatically
2363 provide its contents either as a list (split on newlines) or as a
2368 provide its contents either as a list (split on newlines) or as a
2364 space-separated string. These are convenient, respectively, either
2369 space-separated string. These are convenient, respectively, either
2365 for sequential processing or to be passed to a shell command.
2370 for sequential processing or to be passed to a shell command.
2366
2371
2367 For example:
2372 For example:
2368
2373
2369 # Capture into variable a
2374 # Capture into variable a
2370 In [9]: sc a=ls *py
2375 In [9]: sc a=ls *py
2371
2376
2372 # a is a string with embedded newlines
2377 # a is a string with embedded newlines
2373 In [10]: a
2378 In [10]: a
2374 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2379 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2375
2380
2376 # which can be seen as a list:
2381 # which can be seen as a list:
2377 In [11]: a.l
2382 In [11]: a.l
2378 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2383 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2379
2384
2380 # or as a whitespace-separated string:
2385 # or as a whitespace-separated string:
2381 In [12]: a.s
2386 In [12]: a.s
2382 Out[12]: 'setup.py win32_manual_post_install.py'
2387 Out[12]: 'setup.py win32_manual_post_install.py'
2383
2388
2384 # a.s is useful to pass as a single command line:
2389 # a.s is useful to pass as a single command line:
2385 In [13]: !wc -l $a.s
2390 In [13]: !wc -l $a.s
2386 146 setup.py
2391 146 setup.py
2387 130 win32_manual_post_install.py
2392 130 win32_manual_post_install.py
2388 276 total
2393 276 total
2389
2394
2390 # while the list form is useful to loop over:
2395 # while the list form is useful to loop over:
2391 In [14]: for f in a.l:
2396 In [14]: for f in a.l:
2392 ....: !wc -l $f
2397 ....: !wc -l $f
2393 ....:
2398 ....:
2394 146 setup.py
2399 146 setup.py
2395 130 win32_manual_post_install.py
2400 130 win32_manual_post_install.py
2396
2401
2397 Similiarly, the lists returned by the -l option are also special, in
2402 Similiarly, the lists returned by the -l option are also special, in
2398 the sense that you can equally invoke the .s attribute on them to
2403 the sense that you can equally invoke the .s attribute on them to
2399 automatically get a whitespace-separated string from their contents:
2404 automatically get a whitespace-separated string from their contents:
2400
2405
2401 In [1]: sc -l b=ls *py
2406 In [1]: sc -l b=ls *py
2402
2407
2403 In [2]: b
2408 In [2]: b
2404 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2409 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2405
2410
2406 In [3]: b.s
2411 In [3]: b.s
2407 Out[3]: 'setup.py win32_manual_post_install.py'
2412 Out[3]: 'setup.py win32_manual_post_install.py'
2408
2413
2409 In summary, both the lists and strings used for ouptut capture have
2414 In summary, both the lists and strings used for ouptut capture have
2410 the following special attributes:
2415 the following special attributes:
2411
2416
2412 .l (or .list) : value as list.
2417 .l (or .list) : value as list.
2413 .n (or .nlstr): value as newline-separated string.
2418 .n (or .nlstr): value as newline-separated string.
2414 .s (or .spstr): value as space-separated string.
2419 .s (or .spstr): value as space-separated string.
2415 """
2420 """
2416
2421
2417 opts,args = self.parse_options(parameter_s,'lv')
2422 opts,args = self.parse_options(parameter_s,'lv')
2418 # Try to get a variable name and command to run
2423 # Try to get a variable name and command to run
2419 try:
2424 try:
2420 # the variable name must be obtained from the parse_options
2425 # the variable name must be obtained from the parse_options
2421 # output, which uses shlex.split to strip options out.
2426 # output, which uses shlex.split to strip options out.
2422 var,_ = args.split('=',1)
2427 var,_ = args.split('=',1)
2423 var = var.strip()
2428 var = var.strip()
2424 # But the the command has to be extracted from the original input
2429 # But the the command has to be extracted from the original input
2425 # parameter_s, not on what parse_options returns, to avoid the
2430 # parameter_s, not on what parse_options returns, to avoid the
2426 # quote stripping which shlex.split performs on it.
2431 # quote stripping which shlex.split performs on it.
2427 _,cmd = parameter_s.split('=',1)
2432 _,cmd = parameter_s.split('=',1)
2428 except ValueError:
2433 except ValueError:
2429 var,cmd = '',''
2434 var,cmd = '',''
2430 if not var:
2435 if not var:
2431 error('you must specify a variable to assign the command to.')
2436 error('you must specify a variable to assign the command to.')
2432 return
2437 return
2433 # If all looks ok, proceed
2438 # If all looks ok, proceed
2434 out,err = self.shell.getoutputerror(cmd)
2439 out,err = self.shell.getoutputerror(cmd)
2435 if err:
2440 if err:
2436 print >> Term.cerr,err
2441 print >> Term.cerr,err
2437 if opts.has_key('l'):
2442 if opts.has_key('l'):
2438 out = SList(out.split('\n'))
2443 out = SList(out.split('\n'))
2439 else:
2444 else:
2440 out = LSString(out)
2445 out = LSString(out)
2441 if opts.has_key('v'):
2446 if opts.has_key('v'):
2442 print '%s ==\n%s' % (var,pformat(out))
2447 print '%s ==\n%s' % (var,pformat(out))
2443 self.shell.user_ns.update({var:out})
2448 self.shell.user_ns.update({var:out})
2444
2449
2445 def magic_sx(self, parameter_s=''):
2450 def magic_sx(self, parameter_s=''):
2446 """Shell execute - run a shell command and capture its output.
2451 """Shell execute - run a shell command and capture its output.
2447
2452
2448 %sx command
2453 %sx command
2449
2454
2450 IPython will run the given command using commands.getoutput(), and
2455 IPython will run the given command using commands.getoutput(), and
2451 return the result formatted as a list (split on '\\n'). Since the
2456 return the result formatted as a list (split on '\\n'). Since the
2452 output is _returned_, it will be stored in ipython's regular output
2457 output is _returned_, it will be stored in ipython's regular output
2453 cache Out[N] and in the '_N' automatic variables.
2458 cache Out[N] and in the '_N' automatic variables.
2454
2459
2455 Notes:
2460 Notes:
2456
2461
2457 1) If an input line begins with '!!', then %sx is automatically
2462 1) If an input line begins with '!!', then %sx is automatically
2458 invoked. That is, while:
2463 invoked. That is, while:
2459 !ls
2464 !ls
2460 causes ipython to simply issue system('ls'), typing
2465 causes ipython to simply issue system('ls'), typing
2461 !!ls
2466 !!ls
2462 is a shorthand equivalent to:
2467 is a shorthand equivalent to:
2463 %sx ls
2468 %sx ls
2464
2469
2465 2) %sx differs from %sc in that %sx automatically splits into a list,
2470 2) %sx differs from %sc in that %sx automatically splits into a list,
2466 like '%sc -l'. The reason for this is to make it as easy as possible
2471 like '%sc -l'. The reason for this is to make it as easy as possible
2467 to process line-oriented shell output via further python commands.
2472 to process line-oriented shell output via further python commands.
2468 %sc is meant to provide much finer control, but requires more
2473 %sc is meant to provide much finer control, but requires more
2469 typing.
2474 typing.
2470
2475
2471 3) Just like %sc -l, this is a list with special attributes:
2476 3) Just like %sc -l, this is a list with special attributes:
2472
2477
2473 .l (or .list) : value as list.
2478 .l (or .list) : value as list.
2474 .n (or .nlstr): value as newline-separated string.
2479 .n (or .nlstr): value as newline-separated string.
2475 .s (or .spstr): value as whitespace-separated string.
2480 .s (or .spstr): value as whitespace-separated string.
2476
2481
2477 This is very useful when trying to use such lists as arguments to
2482 This is very useful when trying to use such lists as arguments to
2478 system commands."""
2483 system commands."""
2479
2484
2480 if parameter_s:
2485 if parameter_s:
2481 out,err = self.shell.getoutputerror(parameter_s)
2486 out,err = self.shell.getoutputerror(parameter_s)
2482 if err:
2487 if err:
2483 print >> Term.cerr,err
2488 print >> Term.cerr,err
2484 return SList(out.split('\n'))
2489 return SList(out.split('\n'))
2485
2490
2486 def magic_bg(self, parameter_s=''):
2491 def magic_bg(self, parameter_s=''):
2487 """Run a job in the background, in a separate thread.
2492 """Run a job in the background, in a separate thread.
2488
2493
2489 For example,
2494 For example,
2490
2495
2491 %bg myfunc(x,y,z=1)
2496 %bg myfunc(x,y,z=1)
2492
2497
2493 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2498 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2494 execution starts, a message will be printed indicating the job
2499 execution starts, a message will be printed indicating the job
2495 number. If your job number is 5, you can use
2500 number. If your job number is 5, you can use
2496
2501
2497 myvar = jobs.result(5) or myvar = jobs[5].result
2502 myvar = jobs.result(5) or myvar = jobs[5].result
2498
2503
2499 to assign this result to variable 'myvar'.
2504 to assign this result to variable 'myvar'.
2500
2505
2501 IPython has a job manager, accessible via the 'jobs' object. You can
2506 IPython has a job manager, accessible via the 'jobs' object. You can
2502 type jobs? to get more information about it, and use jobs.<TAB> to see
2507 type jobs? to get more information about it, and use jobs.<TAB> to see
2503 its attributes. All attributes not starting with an underscore are
2508 its attributes. All attributes not starting with an underscore are
2504 meant for public use.
2509 meant for public use.
2505
2510
2506 In particular, look at the jobs.new() method, which is used to create
2511 In particular, look at the jobs.new() method, which is used to create
2507 new jobs. This magic %bg function is just a convenience wrapper
2512 new jobs. This magic %bg function is just a convenience wrapper
2508 around jobs.new(), for expression-based jobs. If you want to create a
2513 around jobs.new(), for expression-based jobs. If you want to create a
2509 new job with an explicit function object and arguments, you must call
2514 new job with an explicit function object and arguments, you must call
2510 jobs.new() directly.
2515 jobs.new() directly.
2511
2516
2512 The jobs.new docstring also describes in detail several important
2517 The jobs.new docstring also describes in detail several important
2513 caveats associated with a thread-based model for background job
2518 caveats associated with a thread-based model for background job
2514 execution. Type jobs.new? for details.
2519 execution. Type jobs.new? for details.
2515
2520
2516 You can check the status of all jobs with jobs.status().
2521 You can check the status of all jobs with jobs.status().
2517
2522
2518 The jobs variable is set by IPython into the Python builtin namespace.
2523 The jobs variable is set by IPython into the Python builtin namespace.
2519 If you ever declare a variable named 'jobs', you will shadow this
2524 If you ever declare a variable named 'jobs', you will shadow this
2520 name. You can either delete your global jobs variable to regain
2525 name. You can either delete your global jobs variable to regain
2521 access to the job manager, or make a new name and assign it manually
2526 access to the job manager, or make a new name and assign it manually
2522 to the manager (stored in IPython's namespace). For example, to
2527 to the manager (stored in IPython's namespace). For example, to
2523 assign the job manager to the Jobs name, use:
2528 assign the job manager to the Jobs name, use:
2524
2529
2525 Jobs = __builtins__.jobs"""
2530 Jobs = __builtins__.jobs"""
2526
2531
2527 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2532 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2528
2533
2529 def magic_store(self, parameter_s=''):
2534 def magic_store(self, parameter_s=''):
2530 """Lightweight persistence for python variables.
2535 """Lightweight persistence for python variables.
2531
2536
2532 Example:
2537 Example:
2533
2538
2534 ville@badger[~]|1> A = ['hello',10,'world']\\
2539 ville@badger[~]|1> A = ['hello',10,'world']\\
2535 ville@badger[~]|2> %store A\\
2540 ville@badger[~]|2> %store A\\
2536 ville@badger[~]|3> Exit
2541 ville@badger[~]|3> Exit
2537
2542
2538 (IPython session is closed and started again...)
2543 (IPython session is closed and started again...)
2539
2544
2540 ville@badger:~$ ipython -p pysh\\
2545 ville@badger:~$ ipython -p pysh\\
2541 ville@badger[~]|1> print A
2546 ville@badger[~]|1> print A
2542
2547
2543 ['hello', 10, 'world']
2548 ['hello', 10, 'world']
2544
2549
2545 Usage:
2550 Usage:
2546
2551
2547 %store - Show list of all variables and their current values\\
2552 %store - Show list of all variables and their current values\\
2548 %store <var> - Store the *current* value of the variable to disk\\
2553 %store <var> - Store the *current* value of the variable to disk\\
2549 %store -d - Remove the variable and its value from storage\\
2554 %store -d - Remove the variable and its value from storage\\
2550 %store -r - Remove all variables from storage
2555 %store -r - Remove all variables from storage
2551
2556
2552 It should be noted that if you change the value of a variable, you
2557 It should be noted that if you change the value of a variable, you
2553 need to %store it again if you want to persist the new value.
2558 need to %store it again if you want to persist the new value.
2554
2559
2555 Note also that the variables will need to be pickleable; most basic
2560 Note also that the variables will need to be pickleable; most basic
2556 python types can be safely %stored.
2561 python types can be safely %stored.
2557 """
2562 """
2558
2563
2559 opts,args = self.parse_options(parameter_s,'dr',mode='list')
2564 opts,args = self.parse_options(parameter_s,'dr',mode='list')
2560 # delete
2565 # delete
2561 if opts.has_key('d'):
2566 if opts.has_key('d'):
2562 try:
2567 try:
2563 todel = args[0]
2568 todel = args[0]
2564 except IndexError:
2569 except IndexError:
2565 error('You must provide the variable to forget')
2570 error('You must provide the variable to forget')
2566 else:
2571 else:
2567 try:
2572 try:
2568 del self.shell.persist['S:' + todel]
2573 del self.shell.persist['S:' + todel]
2569 except:
2574 except:
2570 error("Can't delete variable '%s'" % todel)
2575 error("Can't delete variable '%s'" % todel)
2571 # reset
2576 # reset
2572 elif opts.has_key('r'):
2577 elif opts.has_key('r'):
2573 for k in self.shell.persist.keys():
2578 for k in self.shell.persist.keys():
2574 if k.startswith('S:'):
2579 if k.startswith('S:'):
2575 del self.shell.persist[k]
2580 del self.shell.persist[k]
2576
2581
2577 # run without arguments -> list variables & values
2582 # run without arguments -> list variables & values
2578 elif not args:
2583 elif not args:
2579 vars = [v[2:] for v in self.shell.persist.keys()
2584 vars = [v[2:] for v in self.shell.persist.keys()
2580 if v.startswith('S:')]
2585 if v.startswith('S:')]
2581 vars.sort()
2586 vars.sort()
2582 if vars:
2587 if vars:
2583 size = max(map(len,vars))
2588 size = max(map(len,vars))
2584 else:
2589 else:
2585 size = 0
2590 size = 0
2586
2591
2587 print 'Stored variables and their in-memory values:'
2592 print 'Stored variables and their in-memory values:'
2588 fmt = '%-'+str(size)+'s -> %s'
2593 fmt = '%-'+str(size)+'s -> %s'
2589 get = self.shell.user_ns.get
2594 get = self.shell.user_ns.get
2590 for var in vars:
2595 for var in vars:
2591 # print 30 first characters from every var
2596 # print 30 first characters from every var
2592 print fmt % (var,repr(get(var,'<unavailable>'))[:50])
2597 print fmt % (var,repr(get(var,'<unavailable>'))[:50])
2593
2598
2594 # default action - store the variable
2599 # default action - store the variable
2595 else:
2600 else:
2596 pickled = pickle.dumps(self.shell.user_ns[args[0] ])
2601 pickled = pickle.dumps(self.shell.user_ns[args[0] ])
2597 self.shell.persist[ 'S:' + args[0] ] = pickled
2602 self.shell.persist[ 'S:' + args[0] ] = pickled
2598 print "Stored '%s' (%d bytes)" % (args[0], len(pickled))
2603 print "Stored '%s' (%d bytes)" % (args[0], len(pickled))
2599
2604
2600 def magic_bookmark(self, parameter_s=''):
2605 def magic_bookmark(self, parameter_s=''):
2601 """Manage IPython's bookmark system.
2606 """Manage IPython's bookmark system.
2602
2607
2603 %bookmark <name> - set bookmark to current dir
2608 %bookmark <name> - set bookmark to current dir
2604 %bookmark <name> <dir> - set bookmark to <dir>
2609 %bookmark <name> <dir> - set bookmark to <dir>
2605 %bookmark -l - list all bookmarks
2610 %bookmark -l - list all bookmarks
2606 %bookmark -d <name> - remove bookmark
2611 %bookmark -d <name> - remove bookmark
2607 %bookmark -r - remove all bookmarks
2612 %bookmark -r - remove all bookmarks
2608
2613
2609 You can later on access a bookmarked folder with:
2614 You can later on access a bookmarked folder with:
2610 %cd -b <name>
2615 %cd -b <name>
2611 or simply '%cd <name>' if there is no directory called <name> AND
2616 or simply '%cd <name>' if there is no directory called <name> AND
2612 there is such a bookmark defined.
2617 there is such a bookmark defined.
2613
2618
2614 Your bookmarks persist through IPython sessions, but they are
2619 Your bookmarks persist through IPython sessions, but they are
2615 associated with each profile."""
2620 associated with each profile."""
2616
2621
2617 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2622 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2618 if len(args) > 2:
2623 if len(args) > 2:
2619 error('You can only give at most two arguments')
2624 error('You can only give at most two arguments')
2620 return
2625 return
2621
2626
2622 bkms = self.shell.persist.get('bookmarks',{})
2627 bkms = self.shell.persist.get('bookmarks',{})
2623
2628
2624 if opts.has_key('d'):
2629 if opts.has_key('d'):
2625 try:
2630 try:
2626 todel = args[0]
2631 todel = args[0]
2627 except IndexError:
2632 except IndexError:
2628 error('You must provide a bookmark to delete')
2633 error('You must provide a bookmark to delete')
2629 else:
2634 else:
2630 try:
2635 try:
2631 del bkms[todel]
2636 del bkms[todel]
2632 except:
2637 except:
2633 error("Can't delete bookmark '%s'" % todel)
2638 error("Can't delete bookmark '%s'" % todel)
2634 elif opts.has_key('r'):
2639 elif opts.has_key('r'):
2635 bkms = {}
2640 bkms = {}
2636 elif opts.has_key('l'):
2641 elif opts.has_key('l'):
2637 bks = bkms.keys()
2642 bks = bkms.keys()
2638 bks.sort()
2643 bks.sort()
2639 if bks:
2644 if bks:
2640 size = max(map(len,bks))
2645 size = max(map(len,bks))
2641 else:
2646 else:
2642 size = 0
2647 size = 0
2643 fmt = '%-'+str(size)+'s -> %s'
2648 fmt = '%-'+str(size)+'s -> %s'
2644 print 'Current bookmarks:'
2649 print 'Current bookmarks:'
2645 for bk in bks:
2650 for bk in bks:
2646 print fmt % (bk,bkms[bk])
2651 print fmt % (bk,bkms[bk])
2647 else:
2652 else:
2648 if not args:
2653 if not args:
2649 error("You must specify the bookmark name")
2654 error("You must specify the bookmark name")
2650 elif len(args)==1:
2655 elif len(args)==1:
2651 bkms[args[0]] = os.getcwd()
2656 bkms[args[0]] = os.getcwd()
2652 elif len(args)==2:
2657 elif len(args)==2:
2653 bkms[args[0]] = args[1]
2658 bkms[args[0]] = args[1]
2654 self.shell.persist['bookmarks'] = bkms
2659 self.shell.persist['bookmarks'] = bkms
2655
2660
2656 def magic_pycat(self, parameter_s=''):
2661 def magic_pycat(self, parameter_s=''):
2657 """Show a syntax-highlighted file through a pager.
2662 """Show a syntax-highlighted file through a pager.
2658
2663
2659 This magic is similar to the cat utility, but it will assume the file
2664 This magic is similar to the cat utility, but it will assume the file
2660 to be Python source and will show it with syntax highlighting. """
2665 to be Python source and will show it with syntax highlighting. """
2661
2666
2662 filename = get_py_filename(parameter_s)
2667 filename = get_py_filename(parameter_s)
2663 page(self.shell.colorize(file_read(filename)),
2668 page(self.shell.colorize(file_read(filename)),
2664 screen_lines=self.shell.rc.screen_length)
2669 screen_lines=self.shell.rc.screen_length)
2665
2670
2666 # end Magic
2671 # end Magic
@@ -1,4638 +1,4642 b''
1 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
4 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
5 which was producing problems in the resulting manual.
6
3 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
7 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
4 (minor mods) to support network shares under win32.
8 (minor mods) to support network shares under win32.
5
9
6 * IPython/winconsole.py (get_console_size): add new winconsole
10 * IPython/winconsole.py (get_console_size): add new winconsole
7 module and fixes to page_dumb() to improve its behavior under
11 module and fixes to page_dumb() to improve its behavior under
8 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
12 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
9
13
10 * IPython/Magic.py (Macro): simplified Macro class to just
14 * IPython/Magic.py (Macro): simplified Macro class to just
11 subclass list. We've had only 2.2 compatibility for a very long
15 subclass list. We've had only 2.2 compatibility for a very long
12 time, yet I was still avoiding subclassing the builtin types. No
16 time, yet I was still avoiding subclassing the builtin types. No
13 more (I'm also starting to use properties, though I won't shift to
17 more (I'm also starting to use properties, though I won't shift to
14 2.3-specific features quite yet).
18 2.3-specific features quite yet).
15 (magic_store): added Ville's patch for lightweight variable
19 (magic_store): added Ville's patch for lightweight variable
16 persistence, after a request on the user list by Matt Wilkie
20 persistence, after a request on the user list by Matt Wilkie
17 <maphew-AT-gmail.com>. The new %store magic's docstring has full
21 <maphew-AT-gmail.com>. The new %store magic's docstring has full
18 details.
22 details.
19
23
20 * IPython/iplib.py (InteractiveShell.post_config_initialization):
24 * IPython/iplib.py (InteractiveShell.post_config_initialization):
21 changed the default logfile name from 'ipython.log' to
25 changed the default logfile name from 'ipython.log' to
22 'ipython_log.py'. These logs are real python files, and now that
26 'ipython_log.py'. These logs are real python files, and now that
23 we have much better multiline support, people are more likely to
27 we have much better multiline support, people are more likely to
24 want to use them as such. Might as well name them correctly.
28 want to use them as such. Might as well name them correctly.
25
29
26 * IPython/Magic.py: substantial cleanup. While we can't stop
30 * IPython/Magic.py: substantial cleanup. While we can't stop
27 using magics as mixins, due to the existing customizations 'out
31 using magics as mixins, due to the existing customizations 'out
28 there' which rely on the mixin naming conventions, at least I
32 there' which rely on the mixin naming conventions, at least I
29 cleaned out all cross-class name usage. So once we are OK with
33 cleaned out all cross-class name usage. So once we are OK with
30 breaking compatibility, the two systems can be separated.
34 breaking compatibility, the two systems can be separated.
31
35
32 * IPython/Logger.py: major cleanup. This one is NOT a mixin
36 * IPython/Logger.py: major cleanup. This one is NOT a mixin
33 anymore, and the class is a fair bit less hideous as well. New
37 anymore, and the class is a fair bit less hideous as well. New
34 features were also introduced: timestamping of input, and logging
38 features were also introduced: timestamping of input, and logging
35 of output results. These are user-visible with the -t and -o
39 of output results. These are user-visible with the -t and -o
36 options to %logstart. Closes
40 options to %logstart. Closes
37 http://www.scipy.net/roundup/ipython/issue11 and a request by
41 http://www.scipy.net/roundup/ipython/issue11 and a request by
38 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
42 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
39
43
40 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
44 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
41
45
42 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
46 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
43 better hadnle backslashes in paths. See the thread 'More Windows
47 better hadnle backslashes in paths. See the thread 'More Windows
44 questions part 2 - \/ characters revisited' on the iypthon user
48 questions part 2 - \/ characters revisited' on the iypthon user
45 list:
49 list:
46 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
50 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
47
51
48 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
52 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
49
53
50 (InteractiveShell.__init__): change threaded shells to not use the
54 (InteractiveShell.__init__): change threaded shells to not use the
51 ipython crash handler. This was causing more problems than not,
55 ipython crash handler. This was causing more problems than not,
52 as exceptions in the main thread (GUI code, typically) would
56 as exceptions in the main thread (GUI code, typically) would
53 always show up as a 'crash', when they really weren't.
57 always show up as a 'crash', when they really weren't.
54
58
55 The colors and exception mode commands (%colors/%xmode) have been
59 The colors and exception mode commands (%colors/%xmode) have been
56 synchronized to also take this into account, so users can get
60 synchronized to also take this into account, so users can get
57 verbose exceptions for their threaded code as well. I also added
61 verbose exceptions for their threaded code as well. I also added
58 support for activating pdb inside this exception handler as well,
62 support for activating pdb inside this exception handler as well,
59 so now GUI authors can use IPython's enhanced pdb at runtime.
63 so now GUI authors can use IPython's enhanced pdb at runtime.
60
64
61 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
65 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
62 true by default, and add it to the shipped ipythonrc file. Since
66 true by default, and add it to the shipped ipythonrc file. Since
63 this asks the user before proceeding, I think it's OK to make it
67 this asks the user before proceeding, I think it's OK to make it
64 true by default.
68 true by default.
65
69
66 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
70 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
67 of the previous special-casing of input in the eval loop. I think
71 of the previous special-casing of input in the eval loop. I think
68 this is cleaner, as they really are commands and shouldn't have
72 this is cleaner, as they really are commands and shouldn't have
69 a special role in the middle of the core code.
73 a special role in the middle of the core code.
70
74
71 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
75 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
72
76
73 * IPython/iplib.py (edit_syntax_error): added support for
77 * IPython/iplib.py (edit_syntax_error): added support for
74 automatically reopening the editor if the file had a syntax error
78 automatically reopening the editor if the file had a syntax error
75 in it. Thanks to scottt who provided the patch at:
79 in it. Thanks to scottt who provided the patch at:
76 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
80 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
77 version committed).
81 version committed).
78
82
79 * IPython/iplib.py (handle_normal): add suport for multi-line
83 * IPython/iplib.py (handle_normal): add suport for multi-line
80 input with emtpy lines. This fixes
84 input with emtpy lines. This fixes
81 http://www.scipy.net/roundup/ipython/issue43 and a similar
85 http://www.scipy.net/roundup/ipython/issue43 and a similar
82 discussion on the user list.
86 discussion on the user list.
83
87
84 WARNING: a behavior change is necessarily introduced to support
88 WARNING: a behavior change is necessarily introduced to support
85 blank lines: now a single blank line with whitespace does NOT
89 blank lines: now a single blank line with whitespace does NOT
86 break the input loop, which means that when autoindent is on, by
90 break the input loop, which means that when autoindent is on, by
87 default hitting return on the next (indented) line does NOT exit.
91 default hitting return on the next (indented) line does NOT exit.
88
92
89 Instead, to exit a multiline input you can either have:
93 Instead, to exit a multiline input you can either have:
90
94
91 - TWO whitespace lines (just hit return again), or
95 - TWO whitespace lines (just hit return again), or
92 - a single whitespace line of a different length than provided
96 - a single whitespace line of a different length than provided
93 by the autoindent (add or remove a space).
97 by the autoindent (add or remove a space).
94
98
95 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
99 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
96 module to better organize all readline-related functionality.
100 module to better organize all readline-related functionality.
97 I've deleted FlexCompleter and put all completion clases here.
101 I've deleted FlexCompleter and put all completion clases here.
98
102
99 * IPython/iplib.py (raw_input): improve indentation management.
103 * IPython/iplib.py (raw_input): improve indentation management.
100 It is now possible to paste indented code with autoindent on, and
104 It is now possible to paste indented code with autoindent on, and
101 the code is interpreted correctly (though it still looks bad on
105 the code is interpreted correctly (though it still looks bad on
102 screen, due to the line-oriented nature of ipython).
106 screen, due to the line-oriented nature of ipython).
103 (MagicCompleter.complete): change behavior so that a TAB key on an
107 (MagicCompleter.complete): change behavior so that a TAB key on an
104 otherwise empty line actually inserts a tab, instead of completing
108 otherwise empty line actually inserts a tab, instead of completing
105 on the entire global namespace. This makes it easier to use the
109 on the entire global namespace. This makes it easier to use the
106 TAB key for indentation. After a request by Hans Meine
110 TAB key for indentation. After a request by Hans Meine
107 <hans_meine-AT-gmx.net>
111 <hans_meine-AT-gmx.net>
108 (_prefilter): add support so that typing plain 'exit' or 'quit'
112 (_prefilter): add support so that typing plain 'exit' or 'quit'
109 does a sensible thing. Originally I tried to deviate as little as
113 does a sensible thing. Originally I tried to deviate as little as
110 possible from the default python behavior, but even that one may
114 possible from the default python behavior, but even that one may
111 change in this direction (thread on python-dev to that effect).
115 change in this direction (thread on python-dev to that effect).
112 Regardless, ipython should do the right thing even if CPython's
116 Regardless, ipython should do the right thing even if CPython's
113 '>>>' prompt doesn't.
117 '>>>' prompt doesn't.
114 (InteractiveShell): removed subclassing code.InteractiveConsole
118 (InteractiveShell): removed subclassing code.InteractiveConsole
115 class. By now we'd overridden just about all of its methods: I've
119 class. By now we'd overridden just about all of its methods: I've
116 copied the remaining two over, and now ipython is a standalone
120 copied the remaining two over, and now ipython is a standalone
117 class. This will provide a clearer picture for the chainsaw
121 class. This will provide a clearer picture for the chainsaw
118 branch refactoring.
122 branch refactoring.
119
123
120 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
124 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
121
125
122 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
126 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
123 failures for objects which break when dir() is called on them.
127 failures for objects which break when dir() is called on them.
124
128
125 * IPython/FlexCompleter.py (Completer.__init__): Added support for
129 * IPython/FlexCompleter.py (Completer.__init__): Added support for
126 distinct local and global namespaces in the completer API. This
130 distinct local and global namespaces in the completer API. This
127 change allows us top properly handle completion with distinct
131 change allows us top properly handle completion with distinct
128 scopes, including in embedded instances (this had never really
132 scopes, including in embedded instances (this had never really
129 worked correctly).
133 worked correctly).
130
134
131 Note: this introduces a change in the constructor for
135 Note: this introduces a change in the constructor for
132 MagicCompleter, as a new global_namespace parameter is now the
136 MagicCompleter, as a new global_namespace parameter is now the
133 second argument (the others were bumped one position).
137 second argument (the others were bumped one position).
134
138
135 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
139 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
136
140
137 * IPython/iplib.py (embed_mainloop): fix tab-completion in
141 * IPython/iplib.py (embed_mainloop): fix tab-completion in
138 embedded instances (which can be done now thanks to Vivian's
142 embedded instances (which can be done now thanks to Vivian's
139 frame-handling fixes for pdb).
143 frame-handling fixes for pdb).
140 (InteractiveShell.__init__): Fix namespace handling problem in
144 (InteractiveShell.__init__): Fix namespace handling problem in
141 embedded instances. We were overwriting __main__ unconditionally,
145 embedded instances. We were overwriting __main__ unconditionally,
142 and this should only be done for 'full' (non-embedded) IPython;
146 and this should only be done for 'full' (non-embedded) IPython;
143 embedded instances must respect the caller's __main__. Thanks to
147 embedded instances must respect the caller's __main__. Thanks to
144 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
148 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
145
149
146 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
150 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
147
151
148 * setup.py: added download_url to setup(). This registers the
152 * setup.py: added download_url to setup(). This registers the
149 download address at PyPI, which is not only useful to humans
153 download address at PyPI, which is not only useful to humans
150 browsing the site, but is also picked up by setuptools (the Eggs
154 browsing the site, but is also picked up by setuptools (the Eggs
151 machinery). Thanks to Ville and R. Kern for the info/discussion
155 machinery). Thanks to Ville and R. Kern for the info/discussion
152 on this.
156 on this.
153
157
154 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
158 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
155
159
156 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
160 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
157 This brings a lot of nice functionality to the pdb mode, which now
161 This brings a lot of nice functionality to the pdb mode, which now
158 has tab-completion, syntax highlighting, and better stack handling
162 has tab-completion, syntax highlighting, and better stack handling
159 than before. Many thanks to Vivian De Smedt
163 than before. Many thanks to Vivian De Smedt
160 <vivian-AT-vdesmedt.com> for the original patches.
164 <vivian-AT-vdesmedt.com> for the original patches.
161
165
162 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
166 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
163
167
164 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
168 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
165 sequence to consistently accept the banner argument. The
169 sequence to consistently accept the banner argument. The
166 inconsistency was tripping SAGE, thanks to Gary Zablackis
170 inconsistency was tripping SAGE, thanks to Gary Zablackis
167 <gzabl-AT-yahoo.com> for the report.
171 <gzabl-AT-yahoo.com> for the report.
168
172
169 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
173 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
170
174
171 * IPython/iplib.py (InteractiveShell.post_config_initialization):
175 * IPython/iplib.py (InteractiveShell.post_config_initialization):
172 Fix bug where a naked 'alias' call in the ipythonrc file would
176 Fix bug where a naked 'alias' call in the ipythonrc file would
173 cause a crash. Bug reported by Jorgen Stenarson.
177 cause a crash. Bug reported by Jorgen Stenarson.
174
178
175 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
179 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
176
180
177 * IPython/ipmaker.py (make_IPython): cleanups which should improve
181 * IPython/ipmaker.py (make_IPython): cleanups which should improve
178 startup time.
182 startup time.
179
183
180 * IPython/iplib.py (runcode): my globals 'fix' for embedded
184 * IPython/iplib.py (runcode): my globals 'fix' for embedded
181 instances had introduced a bug with globals in normal code. Now
185 instances had introduced a bug with globals in normal code. Now
182 it's working in all cases.
186 it's working in all cases.
183
187
184 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
188 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
185 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
189 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
186 has been introduced to set the default case sensitivity of the
190 has been introduced to set the default case sensitivity of the
187 searches. Users can still select either mode at runtime on a
191 searches. Users can still select either mode at runtime on a
188 per-search basis.
192 per-search basis.
189
193
190 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
194 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
191
195
192 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
196 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
193 attributes in wildcard searches for subclasses. Modified version
197 attributes in wildcard searches for subclasses. Modified version
194 of a patch by Jorgen.
198 of a patch by Jorgen.
195
199
196 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
200 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
197
201
198 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
202 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
199 embedded instances. I added a user_global_ns attribute to the
203 embedded instances. I added a user_global_ns attribute to the
200 InteractiveShell class to handle this.
204 InteractiveShell class to handle this.
201
205
202 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
206 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
203
207
204 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
208 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
205 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
209 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
206 (reported under win32, but may happen also in other platforms).
210 (reported under win32, but may happen also in other platforms).
207 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
211 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
208
212
209 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
213 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
210
214
211 * IPython/Magic.py (magic_psearch): new support for wildcard
215 * IPython/Magic.py (magic_psearch): new support for wildcard
212 patterns. Now, typing ?a*b will list all names which begin with a
216 patterns. Now, typing ?a*b will list all names which begin with a
213 and end in b, for example. The %psearch magic has full
217 and end in b, for example. The %psearch magic has full
214 docstrings. Many thanks to JΓΆrgen Stenarson
218 docstrings. Many thanks to JΓΆrgen Stenarson
215 <jorgen.stenarson-AT-bostream.nu>, author of the patches
219 <jorgen.stenarson-AT-bostream.nu>, author of the patches
216 implementing this functionality.
220 implementing this functionality.
217
221
218 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
222 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
219
223
220 * Manual: fixed long-standing annoyance of double-dashes (as in
224 * Manual: fixed long-standing annoyance of double-dashes (as in
221 --prefix=~, for example) being stripped in the HTML version. This
225 --prefix=~, for example) being stripped in the HTML version. This
222 is a latex2html bug, but a workaround was provided. Many thanks
226 is a latex2html bug, but a workaround was provided. Many thanks
223 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
227 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
224 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
228 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
225 rolling. This seemingly small issue had tripped a number of users
229 rolling. This seemingly small issue had tripped a number of users
226 when first installing, so I'm glad to see it gone.
230 when first installing, so I'm glad to see it gone.
227
231
228 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
232 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
229
233
230 * IPython/Extensions/numeric_formats.py: fix missing import,
234 * IPython/Extensions/numeric_formats.py: fix missing import,
231 reported by Stephen Walton.
235 reported by Stephen Walton.
232
236
233 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
237 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
234
238
235 * IPython/demo.py: finish demo module, fully documented now.
239 * IPython/demo.py: finish demo module, fully documented now.
236
240
237 * IPython/genutils.py (file_read): simple little utility to read a
241 * IPython/genutils.py (file_read): simple little utility to read a
238 file and ensure it's closed afterwards.
242 file and ensure it's closed afterwards.
239
243
240 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
244 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
241
245
242 * IPython/demo.py (Demo.__init__): added support for individually
246 * IPython/demo.py (Demo.__init__): added support for individually
243 tagging blocks for automatic execution.
247 tagging blocks for automatic execution.
244
248
245 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
249 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
246 syntax-highlighted python sources, requested by John.
250 syntax-highlighted python sources, requested by John.
247
251
248 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
252 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
249
253
250 * IPython/demo.py (Demo.again): fix bug where again() blocks after
254 * IPython/demo.py (Demo.again): fix bug where again() blocks after
251 finishing.
255 finishing.
252
256
253 * IPython/genutils.py (shlex_split): moved from Magic to here,
257 * IPython/genutils.py (shlex_split): moved from Magic to here,
254 where all 2.2 compatibility stuff lives. I needed it for demo.py.
258 where all 2.2 compatibility stuff lives. I needed it for demo.py.
255
259
256 * IPython/demo.py (Demo.__init__): added support for silent
260 * IPython/demo.py (Demo.__init__): added support for silent
257 blocks, improved marks as regexps, docstrings written.
261 blocks, improved marks as regexps, docstrings written.
258 (Demo.__init__): better docstring, added support for sys.argv.
262 (Demo.__init__): better docstring, added support for sys.argv.
259
263
260 * IPython/genutils.py (marquee): little utility used by the demo
264 * IPython/genutils.py (marquee): little utility used by the demo
261 code, handy in general.
265 code, handy in general.
262
266
263 * IPython/demo.py (Demo.__init__): new class for interactive
267 * IPython/demo.py (Demo.__init__): new class for interactive
264 demos. Not documented yet, I just wrote it in a hurry for
268 demos. Not documented yet, I just wrote it in a hurry for
265 scipy'05. Will docstring later.
269 scipy'05. Will docstring later.
266
270
267 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
271 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
268
272
269 * IPython/Shell.py (sigint_handler): Drastic simplification which
273 * IPython/Shell.py (sigint_handler): Drastic simplification which
270 also seems to make Ctrl-C work correctly across threads! This is
274 also seems to make Ctrl-C work correctly across threads! This is
271 so simple, that I can't beleive I'd missed it before. Needs more
275 so simple, that I can't beleive I'd missed it before. Needs more
272 testing, though.
276 testing, though.
273 (KBINT): Never mind, revert changes. I'm sure I'd tried something
277 (KBINT): Never mind, revert changes. I'm sure I'd tried something
274 like this before...
278 like this before...
275
279
276 * IPython/genutils.py (get_home_dir): add protection against
280 * IPython/genutils.py (get_home_dir): add protection against
277 non-dirs in win32 registry.
281 non-dirs in win32 registry.
278
282
279 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
283 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
280 bug where dict was mutated while iterating (pysh crash).
284 bug where dict was mutated while iterating (pysh crash).
281
285
282 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
286 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
283
287
284 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
288 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
285 spurious newlines added by this routine. After a report by
289 spurious newlines added by this routine. After a report by
286 F. Mantegazza.
290 F. Mantegazza.
287
291
288 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
292 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
289
293
290 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
294 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
291 calls. These were a leftover from the GTK 1.x days, and can cause
295 calls. These were a leftover from the GTK 1.x days, and can cause
292 problems in certain cases (after a report by John Hunter).
296 problems in certain cases (after a report by John Hunter).
293
297
294 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
298 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
295 os.getcwd() fails at init time. Thanks to patch from David Remahl
299 os.getcwd() fails at init time. Thanks to patch from David Remahl
296 <chmod007-AT-mac.com>.
300 <chmod007-AT-mac.com>.
297 (InteractiveShell.__init__): prevent certain special magics from
301 (InteractiveShell.__init__): prevent certain special magics from
298 being shadowed by aliases. Closes
302 being shadowed by aliases. Closes
299 http://www.scipy.net/roundup/ipython/issue41.
303 http://www.scipy.net/roundup/ipython/issue41.
300
304
301 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
305 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
302
306
303 * IPython/iplib.py (InteractiveShell.complete): Added new
307 * IPython/iplib.py (InteractiveShell.complete): Added new
304 top-level completion method to expose the completion mechanism
308 top-level completion method to expose the completion mechanism
305 beyond readline-based environments.
309 beyond readline-based environments.
306
310
307 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
311 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
308
312
309 * tools/ipsvnc (svnversion): fix svnversion capture.
313 * tools/ipsvnc (svnversion): fix svnversion capture.
310
314
311 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
315 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
312 attribute to self, which was missing. Before, it was set by a
316 attribute to self, which was missing. Before, it was set by a
313 routine which in certain cases wasn't being called, so the
317 routine which in certain cases wasn't being called, so the
314 instance could end up missing the attribute. This caused a crash.
318 instance could end up missing the attribute. This caused a crash.
315 Closes http://www.scipy.net/roundup/ipython/issue40.
319 Closes http://www.scipy.net/roundup/ipython/issue40.
316
320
317 2005-08-16 Fernando Perez <fperez@colorado.edu>
321 2005-08-16 Fernando Perez <fperez@colorado.edu>
318
322
319 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
323 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
320 contains non-string attribute. Closes
324 contains non-string attribute. Closes
321 http://www.scipy.net/roundup/ipython/issue38.
325 http://www.scipy.net/roundup/ipython/issue38.
322
326
323 2005-08-14 Fernando Perez <fperez@colorado.edu>
327 2005-08-14 Fernando Perez <fperez@colorado.edu>
324
328
325 * tools/ipsvnc: Minor improvements, to add changeset info.
329 * tools/ipsvnc: Minor improvements, to add changeset info.
326
330
327 2005-08-12 Fernando Perez <fperez@colorado.edu>
331 2005-08-12 Fernando Perez <fperez@colorado.edu>
328
332
329 * IPython/iplib.py (runsource): remove self.code_to_run_src
333 * IPython/iplib.py (runsource): remove self.code_to_run_src
330 attribute. I realized this is nothing more than
334 attribute. I realized this is nothing more than
331 '\n'.join(self.buffer), and having the same data in two different
335 '\n'.join(self.buffer), and having the same data in two different
332 places is just asking for synchronization bugs. This may impact
336 places is just asking for synchronization bugs. This may impact
333 people who have custom exception handlers, so I need to warn
337 people who have custom exception handlers, so I need to warn
334 ipython-dev about it (F. Mantegazza may use them).
338 ipython-dev about it (F. Mantegazza may use them).
335
339
336 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
340 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
337
341
338 * IPython/genutils.py: fix 2.2 compatibility (generators)
342 * IPython/genutils.py: fix 2.2 compatibility (generators)
339
343
340 2005-07-18 Fernando Perez <fperez@colorado.edu>
344 2005-07-18 Fernando Perez <fperez@colorado.edu>
341
345
342 * IPython/genutils.py (get_home_dir): fix to help users with
346 * IPython/genutils.py (get_home_dir): fix to help users with
343 invalid $HOME under win32.
347 invalid $HOME under win32.
344
348
345 2005-07-17 Fernando Perez <fperez@colorado.edu>
349 2005-07-17 Fernando Perez <fperez@colorado.edu>
346
350
347 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
351 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
348 some old hacks and clean up a bit other routines; code should be
352 some old hacks and clean up a bit other routines; code should be
349 simpler and a bit faster.
353 simpler and a bit faster.
350
354
351 * IPython/iplib.py (interact): removed some last-resort attempts
355 * IPython/iplib.py (interact): removed some last-resort attempts
352 to survive broken stdout/stderr. That code was only making it
356 to survive broken stdout/stderr. That code was only making it
353 harder to abstract out the i/o (necessary for gui integration),
357 harder to abstract out the i/o (necessary for gui integration),
354 and the crashes it could prevent were extremely rare in practice
358 and the crashes it could prevent were extremely rare in practice
355 (besides being fully user-induced in a pretty violent manner).
359 (besides being fully user-induced in a pretty violent manner).
356
360
357 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
361 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
358 Nothing major yet, but the code is simpler to read; this should
362 Nothing major yet, but the code is simpler to read; this should
359 make it easier to do more serious modifications in the future.
363 make it easier to do more serious modifications in the future.
360
364
361 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
365 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
362 which broke in .15 (thanks to a report by Ville).
366 which broke in .15 (thanks to a report by Ville).
363
367
364 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
368 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
365 be quite correct, I know next to nothing about unicode). This
369 be quite correct, I know next to nothing about unicode). This
366 will allow unicode strings to be used in prompts, amongst other
370 will allow unicode strings to be used in prompts, amongst other
367 cases. It also will prevent ipython from crashing when unicode
371 cases. It also will prevent ipython from crashing when unicode
368 shows up unexpectedly in many places. If ascii encoding fails, we
372 shows up unexpectedly in many places. If ascii encoding fails, we
369 assume utf_8. Currently the encoding is not a user-visible
373 assume utf_8. Currently the encoding is not a user-visible
370 setting, though it could be made so if there is demand for it.
374 setting, though it could be made so if there is demand for it.
371
375
372 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
376 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
373
377
374 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
378 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
375
379
376 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
380 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
377
381
378 * IPython/genutils.py: Add 2.2 compatibility here, so all other
382 * IPython/genutils.py: Add 2.2 compatibility here, so all other
379 code can work transparently for 2.2/2.3.
383 code can work transparently for 2.2/2.3.
380
384
381 2005-07-16 Fernando Perez <fperez@colorado.edu>
385 2005-07-16 Fernando Perez <fperez@colorado.edu>
382
386
383 * IPython/ultraTB.py (ExceptionColors): Make a global variable
387 * IPython/ultraTB.py (ExceptionColors): Make a global variable
384 out of the color scheme table used for coloring exception
388 out of the color scheme table used for coloring exception
385 tracebacks. This allows user code to add new schemes at runtime.
389 tracebacks. This allows user code to add new schemes at runtime.
386 This is a minimally modified version of the patch at
390 This is a minimally modified version of the patch at
387 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
391 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
388 for the contribution.
392 for the contribution.
389
393
390 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
394 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
391 slightly modified version of the patch in
395 slightly modified version of the patch in
392 http://www.scipy.net/roundup/ipython/issue34, which also allows me
396 http://www.scipy.net/roundup/ipython/issue34, which also allows me
393 to remove the previous try/except solution (which was costlier).
397 to remove the previous try/except solution (which was costlier).
394 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
398 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
395
399
396 2005-06-08 Fernando Perez <fperez@colorado.edu>
400 2005-06-08 Fernando Perez <fperez@colorado.edu>
397
401
398 * IPython/iplib.py (write/write_err): Add methods to abstract all
402 * IPython/iplib.py (write/write_err): Add methods to abstract all
399 I/O a bit more.
403 I/O a bit more.
400
404
401 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
405 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
402 warning, reported by Aric Hagberg, fix by JD Hunter.
406 warning, reported by Aric Hagberg, fix by JD Hunter.
403
407
404 2005-06-02 *** Released version 0.6.15
408 2005-06-02 *** Released version 0.6.15
405
409
406 2005-06-01 Fernando Perez <fperez@colorado.edu>
410 2005-06-01 Fernando Perez <fperez@colorado.edu>
407
411
408 * IPython/iplib.py (MagicCompleter.file_matches): Fix
412 * IPython/iplib.py (MagicCompleter.file_matches): Fix
409 tab-completion of filenames within open-quoted strings. Note that
413 tab-completion of filenames within open-quoted strings. Note that
410 this requires that in ~/.ipython/ipythonrc, users change the
414 this requires that in ~/.ipython/ipythonrc, users change the
411 readline delimiters configuration to read:
415 readline delimiters configuration to read:
412
416
413 readline_remove_delims -/~
417 readline_remove_delims -/~
414
418
415
419
416 2005-05-31 *** Released version 0.6.14
420 2005-05-31 *** Released version 0.6.14
417
421
418 2005-05-29 Fernando Perez <fperez@colorado.edu>
422 2005-05-29 Fernando Perez <fperez@colorado.edu>
419
423
420 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
424 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
421 with files not on the filesystem. Reported by Eliyahu Sandler
425 with files not on the filesystem. Reported by Eliyahu Sandler
422 <eli@gondolin.net>
426 <eli@gondolin.net>
423
427
424 2005-05-22 Fernando Perez <fperez@colorado.edu>
428 2005-05-22 Fernando Perez <fperez@colorado.edu>
425
429
426 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
430 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
427 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
431 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
428
432
429 2005-05-19 Fernando Perez <fperez@colorado.edu>
433 2005-05-19 Fernando Perez <fperez@colorado.edu>
430
434
431 * IPython/iplib.py (safe_execfile): close a file which could be
435 * IPython/iplib.py (safe_execfile): close a file which could be
432 left open (causing problems in win32, which locks open files).
436 left open (causing problems in win32, which locks open files).
433 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
437 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
434
438
435 2005-05-18 Fernando Perez <fperez@colorado.edu>
439 2005-05-18 Fernando Perez <fperez@colorado.edu>
436
440
437 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
441 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
438 keyword arguments correctly to safe_execfile().
442 keyword arguments correctly to safe_execfile().
439
443
440 2005-05-13 Fernando Perez <fperez@colorado.edu>
444 2005-05-13 Fernando Perez <fperez@colorado.edu>
441
445
442 * ipython.1: Added info about Qt to manpage, and threads warning
446 * ipython.1: Added info about Qt to manpage, and threads warning
443 to usage page (invoked with --help).
447 to usage page (invoked with --help).
444
448
445 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
449 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
446 new matcher (it goes at the end of the priority list) to do
450 new matcher (it goes at the end of the priority list) to do
447 tab-completion on named function arguments. Submitted by George
451 tab-completion on named function arguments. Submitted by George
448 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
452 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
449 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
453 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
450 for more details.
454 for more details.
451
455
452 * IPython/Magic.py (magic_run): Added new -e flag to ignore
456 * IPython/Magic.py (magic_run): Added new -e flag to ignore
453 SystemExit exceptions in the script being run. Thanks to a report
457 SystemExit exceptions in the script being run. Thanks to a report
454 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
458 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
455 producing very annoying behavior when running unit tests.
459 producing very annoying behavior when running unit tests.
456
460
457 2005-05-12 Fernando Perez <fperez@colorado.edu>
461 2005-05-12 Fernando Perez <fperez@colorado.edu>
458
462
459 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
463 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
460 which I'd broken (again) due to a changed regexp. In the process,
464 which I'd broken (again) due to a changed regexp. In the process,
461 added ';' as an escape to auto-quote the whole line without
465 added ';' as an escape to auto-quote the whole line without
462 splitting its arguments. Thanks to a report by Jerry McRae
466 splitting its arguments. Thanks to a report by Jerry McRae
463 <qrs0xyc02-AT-sneakemail.com>.
467 <qrs0xyc02-AT-sneakemail.com>.
464
468
465 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
469 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
466 possible crashes caused by a TokenError. Reported by Ed Schofield
470 possible crashes caused by a TokenError. Reported by Ed Schofield
467 <schofield-AT-ftw.at>.
471 <schofield-AT-ftw.at>.
468
472
469 2005-05-06 Fernando Perez <fperez@colorado.edu>
473 2005-05-06 Fernando Perez <fperez@colorado.edu>
470
474
471 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
475 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
472
476
473 2005-04-29 Fernando Perez <fperez@colorado.edu>
477 2005-04-29 Fernando Perez <fperez@colorado.edu>
474
478
475 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
479 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
476 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
480 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
477 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
481 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
478 which provides support for Qt interactive usage (similar to the
482 which provides support for Qt interactive usage (similar to the
479 existing one for WX and GTK). This had been often requested.
483 existing one for WX and GTK). This had been often requested.
480
484
481 2005-04-14 *** Released version 0.6.13
485 2005-04-14 *** Released version 0.6.13
482
486
483 2005-04-08 Fernando Perez <fperez@colorado.edu>
487 2005-04-08 Fernando Perez <fperez@colorado.edu>
484
488
485 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
489 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
486 from _ofind, which gets called on almost every input line. Now,
490 from _ofind, which gets called on almost every input line. Now,
487 we only try to get docstrings if they are actually going to be
491 we only try to get docstrings if they are actually going to be
488 used (the overhead of fetching unnecessary docstrings can be
492 used (the overhead of fetching unnecessary docstrings can be
489 noticeable for certain objects, such as Pyro proxies).
493 noticeable for certain objects, such as Pyro proxies).
490
494
491 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
495 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
492 for completers. For some reason I had been passing them the state
496 for completers. For some reason I had been passing them the state
493 variable, which completers never actually need, and was in
497 variable, which completers never actually need, and was in
494 conflict with the rlcompleter API. Custom completers ONLY need to
498 conflict with the rlcompleter API. Custom completers ONLY need to
495 take the text parameter.
499 take the text parameter.
496
500
497 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
501 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
498 work correctly in pysh. I've also moved all the logic which used
502 work correctly in pysh. I've also moved all the logic which used
499 to be in pysh.py here, which will prevent problems with future
503 to be in pysh.py here, which will prevent problems with future
500 upgrades. However, this time I must warn users to update their
504 upgrades. However, this time I must warn users to update their
501 pysh profile to include the line
505 pysh profile to include the line
502
506
503 import_all IPython.Extensions.InterpreterExec
507 import_all IPython.Extensions.InterpreterExec
504
508
505 because otherwise things won't work for them. They MUST also
509 because otherwise things won't work for them. They MUST also
506 delete pysh.py and the line
510 delete pysh.py and the line
507
511
508 execfile pysh.py
512 execfile pysh.py
509
513
510 from their ipythonrc-pysh.
514 from their ipythonrc-pysh.
511
515
512 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
516 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
513 robust in the face of objects whose dir() returns non-strings
517 robust in the face of objects whose dir() returns non-strings
514 (which it shouldn't, but some broken libs like ITK do). Thanks to
518 (which it shouldn't, but some broken libs like ITK do). Thanks to
515 a patch by John Hunter (implemented differently, though). Also
519 a patch by John Hunter (implemented differently, though). Also
516 minor improvements by using .extend instead of + on lists.
520 minor improvements by using .extend instead of + on lists.
517
521
518 * pysh.py:
522 * pysh.py:
519
523
520 2005-04-06 Fernando Perez <fperez@colorado.edu>
524 2005-04-06 Fernando Perez <fperez@colorado.edu>
521
525
522 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
526 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
523 by default, so that all users benefit from it. Those who don't
527 by default, so that all users benefit from it. Those who don't
524 want it can still turn it off.
528 want it can still turn it off.
525
529
526 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
530 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
527 config file, I'd forgotten about this, so users were getting it
531 config file, I'd forgotten about this, so users were getting it
528 off by default.
532 off by default.
529
533
530 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
534 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
531 consistency. Now magics can be called in multiline statements,
535 consistency. Now magics can be called in multiline statements,
532 and python variables can be expanded in magic calls via $var.
536 and python variables can be expanded in magic calls via $var.
533 This makes the magic system behave just like aliases or !system
537 This makes the magic system behave just like aliases or !system
534 calls.
538 calls.
535
539
536 2005-03-28 Fernando Perez <fperez@colorado.edu>
540 2005-03-28 Fernando Perez <fperez@colorado.edu>
537
541
538 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
542 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
539 expensive string additions for building command. Add support for
543 expensive string additions for building command. Add support for
540 trailing ';' when autocall is used.
544 trailing ';' when autocall is used.
541
545
542 2005-03-26 Fernando Perez <fperez@colorado.edu>
546 2005-03-26 Fernando Perez <fperez@colorado.edu>
543
547
544 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
548 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
545 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
549 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
546 ipython.el robust against prompts with any number of spaces
550 ipython.el robust against prompts with any number of spaces
547 (including 0) after the ':' character.
551 (including 0) after the ':' character.
548
552
549 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
553 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
550 continuation prompt, which misled users to think the line was
554 continuation prompt, which misled users to think the line was
551 already indented. Closes debian Bug#300847, reported to me by
555 already indented. Closes debian Bug#300847, reported to me by
552 Norbert Tretkowski <tretkowski-AT-inittab.de>.
556 Norbert Tretkowski <tretkowski-AT-inittab.de>.
553
557
554 2005-03-23 Fernando Perez <fperez@colorado.edu>
558 2005-03-23 Fernando Perez <fperez@colorado.edu>
555
559
556 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
560 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
557 properly aligned if they have embedded newlines.
561 properly aligned if they have embedded newlines.
558
562
559 * IPython/iplib.py (runlines): Add a public method to expose
563 * IPython/iplib.py (runlines): Add a public method to expose
560 IPython's code execution machinery, so that users can run strings
564 IPython's code execution machinery, so that users can run strings
561 as if they had been typed at the prompt interactively.
565 as if they had been typed at the prompt interactively.
562 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
566 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
563 methods which can call the system shell, but with python variable
567 methods which can call the system shell, but with python variable
564 expansion. The three such methods are: __IPYTHON__.system,
568 expansion. The three such methods are: __IPYTHON__.system,
565 .getoutput and .getoutputerror. These need to be documented in a
569 .getoutput and .getoutputerror. These need to be documented in a
566 'public API' section (to be written) of the manual.
570 'public API' section (to be written) of the manual.
567
571
568 2005-03-20 Fernando Perez <fperez@colorado.edu>
572 2005-03-20 Fernando Perez <fperez@colorado.edu>
569
573
570 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
574 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
571 for custom exception handling. This is quite powerful, and it
575 for custom exception handling. This is quite powerful, and it
572 allows for user-installable exception handlers which can trap
576 allows for user-installable exception handlers which can trap
573 custom exceptions at runtime and treat them separately from
577 custom exceptions at runtime and treat them separately from
574 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
578 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
575 Mantegazza <mantegazza-AT-ill.fr>.
579 Mantegazza <mantegazza-AT-ill.fr>.
576 (InteractiveShell.set_custom_completer): public API function to
580 (InteractiveShell.set_custom_completer): public API function to
577 add new completers at runtime.
581 add new completers at runtime.
578
582
579 2005-03-19 Fernando Perez <fperez@colorado.edu>
583 2005-03-19 Fernando Perez <fperez@colorado.edu>
580
584
581 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
585 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
582 allow objects which provide their docstrings via non-standard
586 allow objects which provide their docstrings via non-standard
583 mechanisms (like Pyro proxies) to still be inspected by ipython's
587 mechanisms (like Pyro proxies) to still be inspected by ipython's
584 ? system.
588 ? system.
585
589
586 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
590 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
587 automatic capture system. I tried quite hard to make it work
591 automatic capture system. I tried quite hard to make it work
588 reliably, and simply failed. I tried many combinations with the
592 reliably, and simply failed. I tried many combinations with the
589 subprocess module, but eventually nothing worked in all needed
593 subprocess module, but eventually nothing worked in all needed
590 cases (not blocking stdin for the child, duplicating stdout
594 cases (not blocking stdin for the child, duplicating stdout
591 without blocking, etc). The new %sc/%sx still do capture to these
595 without blocking, etc). The new %sc/%sx still do capture to these
592 magical list/string objects which make shell use much more
596 magical list/string objects which make shell use much more
593 conveninent, so not all is lost.
597 conveninent, so not all is lost.
594
598
595 XXX - FIX MANUAL for the change above!
599 XXX - FIX MANUAL for the change above!
596
600
597 (runsource): I copied code.py's runsource() into ipython to modify
601 (runsource): I copied code.py's runsource() into ipython to modify
598 it a bit. Now the code object and source to be executed are
602 it a bit. Now the code object and source to be executed are
599 stored in ipython. This makes this info accessible to third-party
603 stored in ipython. This makes this info accessible to third-party
600 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
604 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
601 Mantegazza <mantegazza-AT-ill.fr>.
605 Mantegazza <mantegazza-AT-ill.fr>.
602
606
603 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
607 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
604 history-search via readline (like C-p/C-n). I'd wanted this for a
608 history-search via readline (like C-p/C-n). I'd wanted this for a
605 long time, but only recently found out how to do it. For users
609 long time, but only recently found out how to do it. For users
606 who already have their ipythonrc files made and want this, just
610 who already have their ipythonrc files made and want this, just
607 add:
611 add:
608
612
609 readline_parse_and_bind "\e[A": history-search-backward
613 readline_parse_and_bind "\e[A": history-search-backward
610 readline_parse_and_bind "\e[B": history-search-forward
614 readline_parse_and_bind "\e[B": history-search-forward
611
615
612 2005-03-18 Fernando Perez <fperez@colorado.edu>
616 2005-03-18 Fernando Perez <fperez@colorado.edu>
613
617
614 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
618 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
615 LSString and SList classes which allow transparent conversions
619 LSString and SList classes which allow transparent conversions
616 between list mode and whitespace-separated string.
620 between list mode and whitespace-separated string.
617 (magic_r): Fix recursion problem in %r.
621 (magic_r): Fix recursion problem in %r.
618
622
619 * IPython/genutils.py (LSString): New class to be used for
623 * IPython/genutils.py (LSString): New class to be used for
620 automatic storage of the results of all alias/system calls in _o
624 automatic storage of the results of all alias/system calls in _o
621 and _e (stdout/err). These provide a .l/.list attribute which
625 and _e (stdout/err). These provide a .l/.list attribute which
622 does automatic splitting on newlines. This means that for most
626 does automatic splitting on newlines. This means that for most
623 uses, you'll never need to do capturing of output with %sc/%sx
627 uses, you'll never need to do capturing of output with %sc/%sx
624 anymore, since ipython keeps this always done for you. Note that
628 anymore, since ipython keeps this always done for you. Note that
625 only the LAST results are stored, the _o/e variables are
629 only the LAST results are stored, the _o/e variables are
626 overwritten on each call. If you need to save their contents
630 overwritten on each call. If you need to save their contents
627 further, simply bind them to any other name.
631 further, simply bind them to any other name.
628
632
629 2005-03-17 Fernando Perez <fperez@colorado.edu>
633 2005-03-17 Fernando Perez <fperez@colorado.edu>
630
634
631 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
635 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
632 prompt namespace handling.
636 prompt namespace handling.
633
637
634 2005-03-16 Fernando Perez <fperez@colorado.edu>
638 2005-03-16 Fernando Perez <fperez@colorado.edu>
635
639
636 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
640 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
637 classic prompts to be '>>> ' (final space was missing, and it
641 classic prompts to be '>>> ' (final space was missing, and it
638 trips the emacs python mode).
642 trips the emacs python mode).
639 (BasePrompt.__str__): Added safe support for dynamic prompt
643 (BasePrompt.__str__): Added safe support for dynamic prompt
640 strings. Now you can set your prompt string to be '$x', and the
644 strings. Now you can set your prompt string to be '$x', and the
641 value of x will be printed from your interactive namespace. The
645 value of x will be printed from your interactive namespace. The
642 interpolation syntax includes the full Itpl support, so
646 interpolation syntax includes the full Itpl support, so
643 ${foo()+x+bar()} is a valid prompt string now, and the function
647 ${foo()+x+bar()} is a valid prompt string now, and the function
644 calls will be made at runtime.
648 calls will be made at runtime.
645
649
646 2005-03-15 Fernando Perez <fperez@colorado.edu>
650 2005-03-15 Fernando Perez <fperez@colorado.edu>
647
651
648 * IPython/Magic.py (magic_history): renamed %hist to %history, to
652 * IPython/Magic.py (magic_history): renamed %hist to %history, to
649 avoid name clashes in pylab. %hist still works, it just forwards
653 avoid name clashes in pylab. %hist still works, it just forwards
650 the call to %history.
654 the call to %history.
651
655
652 2005-03-02 *** Released version 0.6.12
656 2005-03-02 *** Released version 0.6.12
653
657
654 2005-03-02 Fernando Perez <fperez@colorado.edu>
658 2005-03-02 Fernando Perez <fperez@colorado.edu>
655
659
656 * IPython/iplib.py (handle_magic): log magic calls properly as
660 * IPython/iplib.py (handle_magic): log magic calls properly as
657 ipmagic() function calls.
661 ipmagic() function calls.
658
662
659 * IPython/Magic.py (magic_time): Improved %time to support
663 * IPython/Magic.py (magic_time): Improved %time to support
660 statements and provide wall-clock as well as CPU time.
664 statements and provide wall-clock as well as CPU time.
661
665
662 2005-02-27 Fernando Perez <fperez@colorado.edu>
666 2005-02-27 Fernando Perez <fperez@colorado.edu>
663
667
664 * IPython/hooks.py: New hooks module, to expose user-modifiable
668 * IPython/hooks.py: New hooks module, to expose user-modifiable
665 IPython functionality in a clean manner. For now only the editor
669 IPython functionality in a clean manner. For now only the editor
666 hook is actually written, and other thigns which I intend to turn
670 hook is actually written, and other thigns which I intend to turn
667 into proper hooks aren't yet there. The display and prefilter
671 into proper hooks aren't yet there. The display and prefilter
668 stuff, for example, should be hooks. But at least now the
672 stuff, for example, should be hooks. But at least now the
669 framework is in place, and the rest can be moved here with more
673 framework is in place, and the rest can be moved here with more
670 time later. IPython had had a .hooks variable for a long time for
674 time later. IPython had had a .hooks variable for a long time for
671 this purpose, but I'd never actually used it for anything.
675 this purpose, but I'd never actually used it for anything.
672
676
673 2005-02-26 Fernando Perez <fperez@colorado.edu>
677 2005-02-26 Fernando Perez <fperez@colorado.edu>
674
678
675 * IPython/ipmaker.py (make_IPython): make the default ipython
679 * IPython/ipmaker.py (make_IPython): make the default ipython
676 directory be called _ipython under win32, to follow more the
680 directory be called _ipython under win32, to follow more the
677 naming peculiarities of that platform (where buggy software like
681 naming peculiarities of that platform (where buggy software like
678 Visual Sourcesafe breaks with .named directories). Reported by
682 Visual Sourcesafe breaks with .named directories). Reported by
679 Ville Vainio.
683 Ville Vainio.
680
684
681 2005-02-23 Fernando Perez <fperez@colorado.edu>
685 2005-02-23 Fernando Perez <fperez@colorado.edu>
682
686
683 * IPython/iplib.py (InteractiveShell.__init__): removed a few
687 * IPython/iplib.py (InteractiveShell.__init__): removed a few
684 auto_aliases for win32 which were causing problems. Users can
688 auto_aliases for win32 which were causing problems. Users can
685 define the ones they personally like.
689 define the ones they personally like.
686
690
687 2005-02-21 Fernando Perez <fperez@colorado.edu>
691 2005-02-21 Fernando Perez <fperez@colorado.edu>
688
692
689 * IPython/Magic.py (magic_time): new magic to time execution of
693 * IPython/Magic.py (magic_time): new magic to time execution of
690 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
694 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
691
695
692 2005-02-19 Fernando Perez <fperez@colorado.edu>
696 2005-02-19 Fernando Perez <fperez@colorado.edu>
693
697
694 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
698 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
695 into keys (for prompts, for example).
699 into keys (for prompts, for example).
696
700
697 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
701 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
698 prompts in case users want them. This introduces a small behavior
702 prompts in case users want them. This introduces a small behavior
699 change: ipython does not automatically add a space to all prompts
703 change: ipython does not automatically add a space to all prompts
700 anymore. To get the old prompts with a space, users should add it
704 anymore. To get the old prompts with a space, users should add it
701 manually to their ipythonrc file, so for example prompt_in1 should
705 manually to their ipythonrc file, so for example prompt_in1 should
702 now read 'In [\#]: ' instead of 'In [\#]:'.
706 now read 'In [\#]: ' instead of 'In [\#]:'.
703 (BasePrompt.__init__): New option prompts_pad_left (only in rc
707 (BasePrompt.__init__): New option prompts_pad_left (only in rc
704 file) to control left-padding of secondary prompts.
708 file) to control left-padding of secondary prompts.
705
709
706 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
710 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
707 the profiler can't be imported. Fix for Debian, which removed
711 the profiler can't be imported. Fix for Debian, which removed
708 profile.py because of License issues. I applied a slightly
712 profile.py because of License issues. I applied a slightly
709 modified version of the original Debian patch at
713 modified version of the original Debian patch at
710 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
714 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
711
715
712 2005-02-17 Fernando Perez <fperez@colorado.edu>
716 2005-02-17 Fernando Perez <fperez@colorado.edu>
713
717
714 * IPython/genutils.py (native_line_ends): Fix bug which would
718 * IPython/genutils.py (native_line_ends): Fix bug which would
715 cause improper line-ends under win32 b/c I was not opening files
719 cause improper line-ends under win32 b/c I was not opening files
716 in binary mode. Bug report and fix thanks to Ville.
720 in binary mode. Bug report and fix thanks to Ville.
717
721
718 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
722 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
719 trying to catch spurious foo[1] autocalls. My fix actually broke
723 trying to catch spurious foo[1] autocalls. My fix actually broke
720 ',/' autoquote/call with explicit escape (bad regexp).
724 ',/' autoquote/call with explicit escape (bad regexp).
721
725
722 2005-02-15 *** Released version 0.6.11
726 2005-02-15 *** Released version 0.6.11
723
727
724 2005-02-14 Fernando Perez <fperez@colorado.edu>
728 2005-02-14 Fernando Perez <fperez@colorado.edu>
725
729
726 * IPython/background_jobs.py: New background job management
730 * IPython/background_jobs.py: New background job management
727 subsystem. This is implemented via a new set of classes, and
731 subsystem. This is implemented via a new set of classes, and
728 IPython now provides a builtin 'jobs' object for background job
732 IPython now provides a builtin 'jobs' object for background job
729 execution. A convenience %bg magic serves as a lightweight
733 execution. A convenience %bg magic serves as a lightweight
730 frontend for starting the more common type of calls. This was
734 frontend for starting the more common type of calls. This was
731 inspired by discussions with B. Granger and the BackgroundCommand
735 inspired by discussions with B. Granger and the BackgroundCommand
732 class described in the book Python Scripting for Computational
736 class described in the book Python Scripting for Computational
733 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
737 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
734 (although ultimately no code from this text was used, as IPython's
738 (although ultimately no code from this text was used, as IPython's
735 system is a separate implementation).
739 system is a separate implementation).
736
740
737 * IPython/iplib.py (MagicCompleter.python_matches): add new option
741 * IPython/iplib.py (MagicCompleter.python_matches): add new option
738 to control the completion of single/double underscore names
742 to control the completion of single/double underscore names
739 separately. As documented in the example ipytonrc file, the
743 separately. As documented in the example ipytonrc file, the
740 readline_omit__names variable can now be set to 2, to omit even
744 readline_omit__names variable can now be set to 2, to omit even
741 single underscore names. Thanks to a patch by Brian Wong
745 single underscore names. Thanks to a patch by Brian Wong
742 <BrianWong-AT-AirgoNetworks.Com>.
746 <BrianWong-AT-AirgoNetworks.Com>.
743 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
747 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
744 be autocalled as foo([1]) if foo were callable. A problem for
748 be autocalled as foo([1]) if foo were callable. A problem for
745 things which are both callable and implement __getitem__.
749 things which are both callable and implement __getitem__.
746 (init_readline): Fix autoindentation for win32. Thanks to a patch
750 (init_readline): Fix autoindentation for win32. Thanks to a patch
747 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
751 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
748
752
749 2005-02-12 Fernando Perez <fperez@colorado.edu>
753 2005-02-12 Fernando Perez <fperez@colorado.edu>
750
754
751 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
755 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
752 which I had written long ago to sort out user error messages which
756 which I had written long ago to sort out user error messages which
753 may occur during startup. This seemed like a good idea initially,
757 may occur during startup. This seemed like a good idea initially,
754 but it has proven a disaster in retrospect. I don't want to
758 but it has proven a disaster in retrospect. I don't want to
755 change much code for now, so my fix is to set the internal 'debug'
759 change much code for now, so my fix is to set the internal 'debug'
756 flag to true everywhere, whose only job was precisely to control
760 flag to true everywhere, whose only job was precisely to control
757 this subsystem. This closes issue 28 (as well as avoiding all
761 this subsystem. This closes issue 28 (as well as avoiding all
758 sorts of strange hangups which occur from time to time).
762 sorts of strange hangups which occur from time to time).
759
763
760 2005-02-07 Fernando Perez <fperez@colorado.edu>
764 2005-02-07 Fernando Perez <fperez@colorado.edu>
761
765
762 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
766 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
763 previous call produced a syntax error.
767 previous call produced a syntax error.
764
768
765 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
769 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
766 classes without constructor.
770 classes without constructor.
767
771
768 2005-02-06 Fernando Perez <fperez@colorado.edu>
772 2005-02-06 Fernando Perez <fperez@colorado.edu>
769
773
770 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
774 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
771 completions with the results of each matcher, so we return results
775 completions with the results of each matcher, so we return results
772 to the user from all namespaces. This breaks with ipython
776 to the user from all namespaces. This breaks with ipython
773 tradition, but I think it's a nicer behavior. Now you get all
777 tradition, but I think it's a nicer behavior. Now you get all
774 possible completions listed, from all possible namespaces (python,
778 possible completions listed, from all possible namespaces (python,
775 filesystem, magics...) After a request by John Hunter
779 filesystem, magics...) After a request by John Hunter
776 <jdhunter-AT-nitace.bsd.uchicago.edu>.
780 <jdhunter-AT-nitace.bsd.uchicago.edu>.
777
781
778 2005-02-05 Fernando Perez <fperez@colorado.edu>
782 2005-02-05 Fernando Perez <fperez@colorado.edu>
779
783
780 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
784 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
781 the call had quote characters in it (the quotes were stripped).
785 the call had quote characters in it (the quotes were stripped).
782
786
783 2005-01-31 Fernando Perez <fperez@colorado.edu>
787 2005-01-31 Fernando Perez <fperez@colorado.edu>
784
788
785 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
789 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
786 Itpl.itpl() to make the code more robust against psyco
790 Itpl.itpl() to make the code more robust against psyco
787 optimizations.
791 optimizations.
788
792
789 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
793 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
790 of causing an exception. Quicker, cleaner.
794 of causing an exception. Quicker, cleaner.
791
795
792 2005-01-28 Fernando Perez <fperez@colorado.edu>
796 2005-01-28 Fernando Perez <fperez@colorado.edu>
793
797
794 * scripts/ipython_win_post_install.py (install): hardcode
798 * scripts/ipython_win_post_install.py (install): hardcode
795 sys.prefix+'python.exe' as the executable path. It turns out that
799 sys.prefix+'python.exe' as the executable path. It turns out that
796 during the post-installation run, sys.executable resolves to the
800 during the post-installation run, sys.executable resolves to the
797 name of the binary installer! I should report this as a distutils
801 name of the binary installer! I should report this as a distutils
798 bug, I think. I updated the .10 release with this tiny fix, to
802 bug, I think. I updated the .10 release with this tiny fix, to
799 avoid annoying the lists further.
803 avoid annoying the lists further.
800
804
801 2005-01-27 *** Released version 0.6.10
805 2005-01-27 *** Released version 0.6.10
802
806
803 2005-01-27 Fernando Perez <fperez@colorado.edu>
807 2005-01-27 Fernando Perez <fperez@colorado.edu>
804
808
805 * IPython/numutils.py (norm): Added 'inf' as optional name for
809 * IPython/numutils.py (norm): Added 'inf' as optional name for
806 L-infinity norm, included references to mathworld.com for vector
810 L-infinity norm, included references to mathworld.com for vector
807 norm definitions.
811 norm definitions.
808 (amin/amax): added amin/amax for array min/max. Similar to what
812 (amin/amax): added amin/amax for array min/max. Similar to what
809 pylab ships with after the recent reorganization of names.
813 pylab ships with after the recent reorganization of names.
810 (spike/spike_odd): removed deprecated spike/spike_odd functions.
814 (spike/spike_odd): removed deprecated spike/spike_odd functions.
811
815
812 * ipython.el: committed Alex's recent fixes and improvements.
816 * ipython.el: committed Alex's recent fixes and improvements.
813 Tested with python-mode from CVS, and it looks excellent. Since
817 Tested with python-mode from CVS, and it looks excellent. Since
814 python-mode hasn't released anything in a while, I'm temporarily
818 python-mode hasn't released anything in a while, I'm temporarily
815 putting a copy of today's CVS (v 4.70) of python-mode in:
819 putting a copy of today's CVS (v 4.70) of python-mode in:
816 http://ipython.scipy.org/tmp/python-mode.el
820 http://ipython.scipy.org/tmp/python-mode.el
817
821
818 * scripts/ipython_win_post_install.py (install): Win32 fix to use
822 * scripts/ipython_win_post_install.py (install): Win32 fix to use
819 sys.executable for the executable name, instead of assuming it's
823 sys.executable for the executable name, instead of assuming it's
820 called 'python.exe' (the post-installer would have produced broken
824 called 'python.exe' (the post-installer would have produced broken
821 setups on systems with a differently named python binary).
825 setups on systems with a differently named python binary).
822
826
823 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
827 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
824 references to os.linesep, to make the code more
828 references to os.linesep, to make the code more
825 platform-independent. This is also part of the win32 coloring
829 platform-independent. This is also part of the win32 coloring
826 fixes.
830 fixes.
827
831
828 * IPython/genutils.py (page_dumb): Remove attempts to chop long
832 * IPython/genutils.py (page_dumb): Remove attempts to chop long
829 lines, which actually cause coloring bugs because the length of
833 lines, which actually cause coloring bugs because the length of
830 the line is very difficult to correctly compute with embedded
834 the line is very difficult to correctly compute with embedded
831 escapes. This was the source of all the coloring problems under
835 escapes. This was the source of all the coloring problems under
832 Win32. I think that _finally_, Win32 users have a properly
836 Win32. I think that _finally_, Win32 users have a properly
833 working ipython in all respects. This would never have happened
837 working ipython in all respects. This would never have happened
834 if not for Gary Bishop and Viktor Ransmayr's great help and work.
838 if not for Gary Bishop and Viktor Ransmayr's great help and work.
835
839
836 2005-01-26 *** Released version 0.6.9
840 2005-01-26 *** Released version 0.6.9
837
841
838 2005-01-25 Fernando Perez <fperez@colorado.edu>
842 2005-01-25 Fernando Perez <fperez@colorado.edu>
839
843
840 * setup.py: finally, we have a true Windows installer, thanks to
844 * setup.py: finally, we have a true Windows installer, thanks to
841 the excellent work of Viktor Ransmayr
845 the excellent work of Viktor Ransmayr
842 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
846 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
843 Windows users. The setup routine is quite a bit cleaner thanks to
847 Windows users. The setup routine is quite a bit cleaner thanks to
844 this, and the post-install script uses the proper functions to
848 this, and the post-install script uses the proper functions to
845 allow a clean de-installation using the standard Windows Control
849 allow a clean de-installation using the standard Windows Control
846 Panel.
850 Panel.
847
851
848 * IPython/genutils.py (get_home_dir): changed to use the $HOME
852 * IPython/genutils.py (get_home_dir): changed to use the $HOME
849 environment variable under all OSes (including win32) if
853 environment variable under all OSes (including win32) if
850 available. This will give consistency to win32 users who have set
854 available. This will give consistency to win32 users who have set
851 this variable for any reason. If os.environ['HOME'] fails, the
855 this variable for any reason. If os.environ['HOME'] fails, the
852 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
856 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
853
857
854 2005-01-24 Fernando Perez <fperez@colorado.edu>
858 2005-01-24 Fernando Perez <fperez@colorado.edu>
855
859
856 * IPython/numutils.py (empty_like): add empty_like(), similar to
860 * IPython/numutils.py (empty_like): add empty_like(), similar to
857 zeros_like() but taking advantage of the new empty() Numeric routine.
861 zeros_like() but taking advantage of the new empty() Numeric routine.
858
862
859 2005-01-23 *** Released version 0.6.8
863 2005-01-23 *** Released version 0.6.8
860
864
861 2005-01-22 Fernando Perez <fperez@colorado.edu>
865 2005-01-22 Fernando Perez <fperez@colorado.edu>
862
866
863 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
867 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
864 automatic show() calls. After discussing things with JDH, it
868 automatic show() calls. After discussing things with JDH, it
865 turns out there are too many corner cases where this can go wrong.
869 turns out there are too many corner cases where this can go wrong.
866 It's best not to try to be 'too smart', and simply have ipython
870 It's best not to try to be 'too smart', and simply have ipython
867 reproduce as much as possible the default behavior of a normal
871 reproduce as much as possible the default behavior of a normal
868 python shell.
872 python shell.
869
873
870 * IPython/iplib.py (InteractiveShell.__init__): Modified the
874 * IPython/iplib.py (InteractiveShell.__init__): Modified the
871 line-splitting regexp and _prefilter() to avoid calling getattr()
875 line-splitting regexp and _prefilter() to avoid calling getattr()
872 on assignments. This closes
876 on assignments. This closes
873 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
877 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
874 readline uses getattr(), so a simple <TAB> keypress is still
878 readline uses getattr(), so a simple <TAB> keypress is still
875 enough to trigger getattr() calls on an object.
879 enough to trigger getattr() calls on an object.
876
880
877 2005-01-21 Fernando Perez <fperez@colorado.edu>
881 2005-01-21 Fernando Perez <fperez@colorado.edu>
878
882
879 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
883 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
880 docstring under pylab so it doesn't mask the original.
884 docstring under pylab so it doesn't mask the original.
881
885
882 2005-01-21 *** Released version 0.6.7
886 2005-01-21 *** Released version 0.6.7
883
887
884 2005-01-21 Fernando Perez <fperez@colorado.edu>
888 2005-01-21 Fernando Perez <fperez@colorado.edu>
885
889
886 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
890 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
887 signal handling for win32 users in multithreaded mode.
891 signal handling for win32 users in multithreaded mode.
888
892
889 2005-01-17 Fernando Perez <fperez@colorado.edu>
893 2005-01-17 Fernando Perez <fperez@colorado.edu>
890
894
891 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
895 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
892 instances with no __init__. After a crash report by Norbert Nemec
896 instances with no __init__. After a crash report by Norbert Nemec
893 <Norbert-AT-nemec-online.de>.
897 <Norbert-AT-nemec-online.de>.
894
898
895 2005-01-14 Fernando Perez <fperez@colorado.edu>
899 2005-01-14 Fernando Perez <fperez@colorado.edu>
896
900
897 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
901 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
898 names for verbose exceptions, when multiple dotted names and the
902 names for verbose exceptions, when multiple dotted names and the
899 'parent' object were present on the same line.
903 'parent' object were present on the same line.
900
904
901 2005-01-11 Fernando Perez <fperez@colorado.edu>
905 2005-01-11 Fernando Perez <fperez@colorado.edu>
902
906
903 * IPython/genutils.py (flag_calls): new utility to trap and flag
907 * IPython/genutils.py (flag_calls): new utility to trap and flag
904 calls in functions. I need it to clean up matplotlib support.
908 calls in functions. I need it to clean up matplotlib support.
905 Also removed some deprecated code in genutils.
909 Also removed some deprecated code in genutils.
906
910
907 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
911 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
908 that matplotlib scripts called with %run, which don't call show()
912 that matplotlib scripts called with %run, which don't call show()
909 themselves, still have their plotting windows open.
913 themselves, still have their plotting windows open.
910
914
911 2005-01-05 Fernando Perez <fperez@colorado.edu>
915 2005-01-05 Fernando Perez <fperez@colorado.edu>
912
916
913 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
917 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
914 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
918 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
915
919
916 2004-12-19 Fernando Perez <fperez@colorado.edu>
920 2004-12-19 Fernando Perez <fperez@colorado.edu>
917
921
918 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
922 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
919 parent_runcode, which was an eyesore. The same result can be
923 parent_runcode, which was an eyesore. The same result can be
920 obtained with Python's regular superclass mechanisms.
924 obtained with Python's regular superclass mechanisms.
921
925
922 2004-12-17 Fernando Perez <fperez@colorado.edu>
926 2004-12-17 Fernando Perez <fperez@colorado.edu>
923
927
924 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
928 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
925 reported by Prabhu.
929 reported by Prabhu.
926 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
930 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
927 sys.stderr) instead of explicitly calling sys.stderr. This helps
931 sys.stderr) instead of explicitly calling sys.stderr. This helps
928 maintain our I/O abstractions clean, for future GUI embeddings.
932 maintain our I/O abstractions clean, for future GUI embeddings.
929
933
930 * IPython/genutils.py (info): added new utility for sys.stderr
934 * IPython/genutils.py (info): added new utility for sys.stderr
931 unified info message handling (thin wrapper around warn()).
935 unified info message handling (thin wrapper around warn()).
932
936
933 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
937 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
934 composite (dotted) names on verbose exceptions.
938 composite (dotted) names on verbose exceptions.
935 (VerboseTB.nullrepr): harden against another kind of errors which
939 (VerboseTB.nullrepr): harden against another kind of errors which
936 Python's inspect module can trigger, and which were crashing
940 Python's inspect module can trigger, and which were crashing
937 IPython. Thanks to a report by Marco Lombardi
941 IPython. Thanks to a report by Marco Lombardi
938 <mlombard-AT-ma010192.hq.eso.org>.
942 <mlombard-AT-ma010192.hq.eso.org>.
939
943
940 2004-12-13 *** Released version 0.6.6
944 2004-12-13 *** Released version 0.6.6
941
945
942 2004-12-12 Fernando Perez <fperez@colorado.edu>
946 2004-12-12 Fernando Perez <fperez@colorado.edu>
943
947
944 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
948 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
945 generated by pygtk upon initialization if it was built without
949 generated by pygtk upon initialization if it was built without
946 threads (for matplotlib users). After a crash reported by
950 threads (for matplotlib users). After a crash reported by
947 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
951 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
948
952
949 * IPython/ipmaker.py (make_IPython): fix small bug in the
953 * IPython/ipmaker.py (make_IPython): fix small bug in the
950 import_some parameter for multiple imports.
954 import_some parameter for multiple imports.
951
955
952 * IPython/iplib.py (ipmagic): simplified the interface of
956 * IPython/iplib.py (ipmagic): simplified the interface of
953 ipmagic() to take a single string argument, just as it would be
957 ipmagic() to take a single string argument, just as it would be
954 typed at the IPython cmd line.
958 typed at the IPython cmd line.
955 (ipalias): Added new ipalias() with an interface identical to
959 (ipalias): Added new ipalias() with an interface identical to
956 ipmagic(). This completes exposing a pure python interface to the
960 ipmagic(). This completes exposing a pure python interface to the
957 alias and magic system, which can be used in loops or more complex
961 alias and magic system, which can be used in loops or more complex
958 code where IPython's automatic line mangling is not active.
962 code where IPython's automatic line mangling is not active.
959
963
960 * IPython/genutils.py (timing): changed interface of timing to
964 * IPython/genutils.py (timing): changed interface of timing to
961 simply run code once, which is the most common case. timings()
965 simply run code once, which is the most common case. timings()
962 remains unchanged, for the cases where you want multiple runs.
966 remains unchanged, for the cases where you want multiple runs.
963
967
964 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
968 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
965 bug where Python2.2 crashes with exec'ing code which does not end
969 bug where Python2.2 crashes with exec'ing code which does not end
966 in a single newline. Python 2.3 is OK, so I hadn't noticed this
970 in a single newline. Python 2.3 is OK, so I hadn't noticed this
967 before.
971 before.
968
972
969 2004-12-10 Fernando Perez <fperez@colorado.edu>
973 2004-12-10 Fernando Perez <fperez@colorado.edu>
970
974
971 * IPython/Magic.py (Magic.magic_prun): changed name of option from
975 * IPython/Magic.py (Magic.magic_prun): changed name of option from
972 -t to -T, to accomodate the new -t flag in %run (the %run and
976 -t to -T, to accomodate the new -t flag in %run (the %run and
973 %prun options are kind of intermixed, and it's not easy to change
977 %prun options are kind of intermixed, and it's not easy to change
974 this with the limitations of python's getopt).
978 this with the limitations of python's getopt).
975
979
976 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
980 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
977 the execution of scripts. It's not as fine-tuned as timeit.py,
981 the execution of scripts. It's not as fine-tuned as timeit.py,
978 but it works from inside ipython (and under 2.2, which lacks
982 but it works from inside ipython (and under 2.2, which lacks
979 timeit.py). Optionally a number of runs > 1 can be given for
983 timeit.py). Optionally a number of runs > 1 can be given for
980 timing very short-running code.
984 timing very short-running code.
981
985
982 * IPython/genutils.py (uniq_stable): new routine which returns a
986 * IPython/genutils.py (uniq_stable): new routine which returns a
983 list of unique elements in any iterable, but in stable order of
987 list of unique elements in any iterable, but in stable order of
984 appearance. I needed this for the ultraTB fixes, and it's a handy
988 appearance. I needed this for the ultraTB fixes, and it's a handy
985 utility.
989 utility.
986
990
987 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
991 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
988 dotted names in Verbose exceptions. This had been broken since
992 dotted names in Verbose exceptions. This had been broken since
989 the very start, now x.y will properly be printed in a Verbose
993 the very start, now x.y will properly be printed in a Verbose
990 traceback, instead of x being shown and y appearing always as an
994 traceback, instead of x being shown and y appearing always as an
991 'undefined global'. Getting this to work was a bit tricky,
995 'undefined global'. Getting this to work was a bit tricky,
992 because by default python tokenizers are stateless. Saved by
996 because by default python tokenizers are stateless. Saved by
993 python's ability to easily add a bit of state to an arbitrary
997 python's ability to easily add a bit of state to an arbitrary
994 function (without needing to build a full-blown callable object).
998 function (without needing to build a full-blown callable object).
995
999
996 Also big cleanup of this code, which had horrendous runtime
1000 Also big cleanup of this code, which had horrendous runtime
997 lookups of zillions of attributes for colorization. Moved all
1001 lookups of zillions of attributes for colorization. Moved all
998 this code into a few templates, which make it cleaner and quicker.
1002 this code into a few templates, which make it cleaner and quicker.
999
1003
1000 Printout quality was also improved for Verbose exceptions: one
1004 Printout quality was also improved for Verbose exceptions: one
1001 variable per line, and memory addresses are printed (this can be
1005 variable per line, and memory addresses are printed (this can be
1002 quite handy in nasty debugging situations, which is what Verbose
1006 quite handy in nasty debugging situations, which is what Verbose
1003 is for).
1007 is for).
1004
1008
1005 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1009 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1006 the command line as scripts to be loaded by embedded instances.
1010 the command line as scripts to be loaded by embedded instances.
1007 Doing so has the potential for an infinite recursion if there are
1011 Doing so has the potential for an infinite recursion if there are
1008 exceptions thrown in the process. This fixes a strange crash
1012 exceptions thrown in the process. This fixes a strange crash
1009 reported by Philippe MULLER <muller-AT-irit.fr>.
1013 reported by Philippe MULLER <muller-AT-irit.fr>.
1010
1014
1011 2004-12-09 Fernando Perez <fperez@colorado.edu>
1015 2004-12-09 Fernando Perez <fperez@colorado.edu>
1012
1016
1013 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1017 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1014 to reflect new names in matplotlib, which now expose the
1018 to reflect new names in matplotlib, which now expose the
1015 matlab-compatible interface via a pylab module instead of the
1019 matlab-compatible interface via a pylab module instead of the
1016 'matlab' name. The new code is backwards compatible, so users of
1020 'matlab' name. The new code is backwards compatible, so users of
1017 all matplotlib versions are OK. Patch by J. Hunter.
1021 all matplotlib versions are OK. Patch by J. Hunter.
1018
1022
1019 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1023 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1020 of __init__ docstrings for instances (class docstrings are already
1024 of __init__ docstrings for instances (class docstrings are already
1021 automatically printed). Instances with customized docstrings
1025 automatically printed). Instances with customized docstrings
1022 (indep. of the class) are also recognized and all 3 separate
1026 (indep. of the class) are also recognized and all 3 separate
1023 docstrings are printed (instance, class, constructor). After some
1027 docstrings are printed (instance, class, constructor). After some
1024 comments/suggestions by J. Hunter.
1028 comments/suggestions by J. Hunter.
1025
1029
1026 2004-12-05 Fernando Perez <fperez@colorado.edu>
1030 2004-12-05 Fernando Perez <fperez@colorado.edu>
1027
1031
1028 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1032 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1029 warnings when tab-completion fails and triggers an exception.
1033 warnings when tab-completion fails and triggers an exception.
1030
1034
1031 2004-12-03 Fernando Perez <fperez@colorado.edu>
1035 2004-12-03 Fernando Perez <fperez@colorado.edu>
1032
1036
1033 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1037 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1034 be triggered when using 'run -p'. An incorrect option flag was
1038 be triggered when using 'run -p'. An incorrect option flag was
1035 being set ('d' instead of 'D').
1039 being set ('d' instead of 'D').
1036 (manpage): fix missing escaped \- sign.
1040 (manpage): fix missing escaped \- sign.
1037
1041
1038 2004-11-30 *** Released version 0.6.5
1042 2004-11-30 *** Released version 0.6.5
1039
1043
1040 2004-11-30 Fernando Perez <fperez@colorado.edu>
1044 2004-11-30 Fernando Perez <fperez@colorado.edu>
1041
1045
1042 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1046 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1043 setting with -d option.
1047 setting with -d option.
1044
1048
1045 * setup.py (docfiles): Fix problem where the doc glob I was using
1049 * setup.py (docfiles): Fix problem where the doc glob I was using
1046 was COMPLETELY BROKEN. It was giving the right files by pure
1050 was COMPLETELY BROKEN. It was giving the right files by pure
1047 accident, but failed once I tried to include ipython.el. Note:
1051 accident, but failed once I tried to include ipython.el. Note:
1048 glob() does NOT allow you to do exclusion on multiple endings!
1052 glob() does NOT allow you to do exclusion on multiple endings!
1049
1053
1050 2004-11-29 Fernando Perez <fperez@colorado.edu>
1054 2004-11-29 Fernando Perez <fperez@colorado.edu>
1051
1055
1052 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1056 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1053 the manpage as the source. Better formatting & consistency.
1057 the manpage as the source. Better formatting & consistency.
1054
1058
1055 * IPython/Magic.py (magic_run): Added new -d option, to run
1059 * IPython/Magic.py (magic_run): Added new -d option, to run
1056 scripts under the control of the python pdb debugger. Note that
1060 scripts under the control of the python pdb debugger. Note that
1057 this required changing the %prun option -d to -D, to avoid a clash
1061 this required changing the %prun option -d to -D, to avoid a clash
1058 (since %run must pass options to %prun, and getopt is too dumb to
1062 (since %run must pass options to %prun, and getopt is too dumb to
1059 handle options with string values with embedded spaces). Thanks
1063 handle options with string values with embedded spaces). Thanks
1060 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1064 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1061 (magic_who_ls): added type matching to %who and %whos, so that one
1065 (magic_who_ls): added type matching to %who and %whos, so that one
1062 can filter their output to only include variables of certain
1066 can filter their output to only include variables of certain
1063 types. Another suggestion by Matthew.
1067 types. Another suggestion by Matthew.
1064 (magic_whos): Added memory summaries in kb and Mb for arrays.
1068 (magic_whos): Added memory summaries in kb and Mb for arrays.
1065 (magic_who): Improve formatting (break lines every 9 vars).
1069 (magic_who): Improve formatting (break lines every 9 vars).
1066
1070
1067 2004-11-28 Fernando Perez <fperez@colorado.edu>
1071 2004-11-28 Fernando Perez <fperez@colorado.edu>
1068
1072
1069 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1073 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1070 cache when empty lines were present.
1074 cache when empty lines were present.
1071
1075
1072 2004-11-24 Fernando Perez <fperez@colorado.edu>
1076 2004-11-24 Fernando Perez <fperez@colorado.edu>
1073
1077
1074 * IPython/usage.py (__doc__): document the re-activated threading
1078 * IPython/usage.py (__doc__): document the re-activated threading
1075 options for WX and GTK.
1079 options for WX and GTK.
1076
1080
1077 2004-11-23 Fernando Perez <fperez@colorado.edu>
1081 2004-11-23 Fernando Perez <fperez@colorado.edu>
1078
1082
1079 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1083 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1080 the -wthread and -gthread options, along with a new -tk one to try
1084 the -wthread and -gthread options, along with a new -tk one to try
1081 and coordinate Tk threading with wx/gtk. The tk support is very
1085 and coordinate Tk threading with wx/gtk. The tk support is very
1082 platform dependent, since it seems to require Tcl and Tk to be
1086 platform dependent, since it seems to require Tcl and Tk to be
1083 built with threads (Fedora1/2 appears NOT to have it, but in
1087 built with threads (Fedora1/2 appears NOT to have it, but in
1084 Prabhu's Debian boxes it works OK). But even with some Tk
1088 Prabhu's Debian boxes it works OK). But even with some Tk
1085 limitations, this is a great improvement.
1089 limitations, this is a great improvement.
1086
1090
1087 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1091 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1088 info in user prompts. Patch by Prabhu.
1092 info in user prompts. Patch by Prabhu.
1089
1093
1090 2004-11-18 Fernando Perez <fperez@colorado.edu>
1094 2004-11-18 Fernando Perez <fperez@colorado.edu>
1091
1095
1092 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1096 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1093 EOFErrors and bail, to avoid infinite loops if a non-terminating
1097 EOFErrors and bail, to avoid infinite loops if a non-terminating
1094 file is fed into ipython. Patch submitted in issue 19 by user,
1098 file is fed into ipython. Patch submitted in issue 19 by user,
1095 many thanks.
1099 many thanks.
1096
1100
1097 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1101 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1098 autoquote/parens in continuation prompts, which can cause lots of
1102 autoquote/parens in continuation prompts, which can cause lots of
1099 problems. Closes roundup issue 20.
1103 problems. Closes roundup issue 20.
1100
1104
1101 2004-11-17 Fernando Perez <fperez@colorado.edu>
1105 2004-11-17 Fernando Perez <fperez@colorado.edu>
1102
1106
1103 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1107 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1104 reported as debian bug #280505. I'm not sure my local changelog
1108 reported as debian bug #280505. I'm not sure my local changelog
1105 entry has the proper debian format (Jack?).
1109 entry has the proper debian format (Jack?).
1106
1110
1107 2004-11-08 *** Released version 0.6.4
1111 2004-11-08 *** Released version 0.6.4
1108
1112
1109 2004-11-08 Fernando Perez <fperez@colorado.edu>
1113 2004-11-08 Fernando Perez <fperez@colorado.edu>
1110
1114
1111 * IPython/iplib.py (init_readline): Fix exit message for Windows
1115 * IPython/iplib.py (init_readline): Fix exit message for Windows
1112 when readline is active. Thanks to a report by Eric Jones
1116 when readline is active. Thanks to a report by Eric Jones
1113 <eric-AT-enthought.com>.
1117 <eric-AT-enthought.com>.
1114
1118
1115 2004-11-07 Fernando Perez <fperez@colorado.edu>
1119 2004-11-07 Fernando Perez <fperez@colorado.edu>
1116
1120
1117 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1121 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1118 sometimes seen by win2k/cygwin users.
1122 sometimes seen by win2k/cygwin users.
1119
1123
1120 2004-11-06 Fernando Perez <fperez@colorado.edu>
1124 2004-11-06 Fernando Perez <fperez@colorado.edu>
1121
1125
1122 * IPython/iplib.py (interact): Change the handling of %Exit from
1126 * IPython/iplib.py (interact): Change the handling of %Exit from
1123 trying to propagate a SystemExit to an internal ipython flag.
1127 trying to propagate a SystemExit to an internal ipython flag.
1124 This is less elegant than using Python's exception mechanism, but
1128 This is less elegant than using Python's exception mechanism, but
1125 I can't get that to work reliably with threads, so under -pylab
1129 I can't get that to work reliably with threads, so under -pylab
1126 %Exit was hanging IPython. Cross-thread exception handling is
1130 %Exit was hanging IPython. Cross-thread exception handling is
1127 really a bitch. Thaks to a bug report by Stephen Walton
1131 really a bitch. Thaks to a bug report by Stephen Walton
1128 <stephen.walton-AT-csun.edu>.
1132 <stephen.walton-AT-csun.edu>.
1129
1133
1130 2004-11-04 Fernando Perez <fperez@colorado.edu>
1134 2004-11-04 Fernando Perez <fperez@colorado.edu>
1131
1135
1132 * IPython/iplib.py (raw_input_original): store a pointer to the
1136 * IPython/iplib.py (raw_input_original): store a pointer to the
1133 true raw_input to harden against code which can modify it
1137 true raw_input to harden against code which can modify it
1134 (wx.py.PyShell does this and would otherwise crash ipython).
1138 (wx.py.PyShell does this and would otherwise crash ipython).
1135 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1139 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1136
1140
1137 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1141 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1138 Ctrl-C problem, which does not mess up the input line.
1142 Ctrl-C problem, which does not mess up the input line.
1139
1143
1140 2004-11-03 Fernando Perez <fperez@colorado.edu>
1144 2004-11-03 Fernando Perez <fperez@colorado.edu>
1141
1145
1142 * IPython/Release.py: Changed licensing to BSD, in all files.
1146 * IPython/Release.py: Changed licensing to BSD, in all files.
1143 (name): lowercase name for tarball/RPM release.
1147 (name): lowercase name for tarball/RPM release.
1144
1148
1145 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1149 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1146 use throughout ipython.
1150 use throughout ipython.
1147
1151
1148 * IPython/Magic.py (Magic._ofind): Switch to using the new
1152 * IPython/Magic.py (Magic._ofind): Switch to using the new
1149 OInspect.getdoc() function.
1153 OInspect.getdoc() function.
1150
1154
1151 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1155 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1152 of the line currently being canceled via Ctrl-C. It's extremely
1156 of the line currently being canceled via Ctrl-C. It's extremely
1153 ugly, but I don't know how to do it better (the problem is one of
1157 ugly, but I don't know how to do it better (the problem is one of
1154 handling cross-thread exceptions).
1158 handling cross-thread exceptions).
1155
1159
1156 2004-10-28 Fernando Perez <fperez@colorado.edu>
1160 2004-10-28 Fernando Perez <fperez@colorado.edu>
1157
1161
1158 * IPython/Shell.py (signal_handler): add signal handlers to trap
1162 * IPython/Shell.py (signal_handler): add signal handlers to trap
1159 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1163 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1160 report by Francesc Alted.
1164 report by Francesc Alted.
1161
1165
1162 2004-10-21 Fernando Perez <fperez@colorado.edu>
1166 2004-10-21 Fernando Perez <fperez@colorado.edu>
1163
1167
1164 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1168 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1165 to % for pysh syntax extensions.
1169 to % for pysh syntax extensions.
1166
1170
1167 2004-10-09 Fernando Perez <fperez@colorado.edu>
1171 2004-10-09 Fernando Perez <fperez@colorado.edu>
1168
1172
1169 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1173 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1170 arrays to print a more useful summary, without calling str(arr).
1174 arrays to print a more useful summary, without calling str(arr).
1171 This avoids the problem of extremely lengthy computations which
1175 This avoids the problem of extremely lengthy computations which
1172 occur if arr is large, and appear to the user as a system lockup
1176 occur if arr is large, and appear to the user as a system lockup
1173 with 100% cpu activity. After a suggestion by Kristian Sandberg
1177 with 100% cpu activity. After a suggestion by Kristian Sandberg
1174 <Kristian.Sandberg@colorado.edu>.
1178 <Kristian.Sandberg@colorado.edu>.
1175 (Magic.__init__): fix bug in global magic escapes not being
1179 (Magic.__init__): fix bug in global magic escapes not being
1176 correctly set.
1180 correctly set.
1177
1181
1178 2004-10-08 Fernando Perez <fperez@colorado.edu>
1182 2004-10-08 Fernando Perez <fperez@colorado.edu>
1179
1183
1180 * IPython/Magic.py (__license__): change to absolute imports of
1184 * IPython/Magic.py (__license__): change to absolute imports of
1181 ipython's own internal packages, to start adapting to the absolute
1185 ipython's own internal packages, to start adapting to the absolute
1182 import requirement of PEP-328.
1186 import requirement of PEP-328.
1183
1187
1184 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1188 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1185 files, and standardize author/license marks through the Release
1189 files, and standardize author/license marks through the Release
1186 module instead of having per/file stuff (except for files with
1190 module instead of having per/file stuff (except for files with
1187 particular licenses, like the MIT/PSF-licensed codes).
1191 particular licenses, like the MIT/PSF-licensed codes).
1188
1192
1189 * IPython/Debugger.py: remove dead code for python 2.1
1193 * IPython/Debugger.py: remove dead code for python 2.1
1190
1194
1191 2004-10-04 Fernando Perez <fperez@colorado.edu>
1195 2004-10-04 Fernando Perez <fperez@colorado.edu>
1192
1196
1193 * IPython/iplib.py (ipmagic): New function for accessing magics
1197 * IPython/iplib.py (ipmagic): New function for accessing magics
1194 via a normal python function call.
1198 via a normal python function call.
1195
1199
1196 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1200 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1197 from '@' to '%', to accomodate the new @decorator syntax of python
1201 from '@' to '%', to accomodate the new @decorator syntax of python
1198 2.4.
1202 2.4.
1199
1203
1200 2004-09-29 Fernando Perez <fperez@colorado.edu>
1204 2004-09-29 Fernando Perez <fperez@colorado.edu>
1201
1205
1202 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1206 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1203 matplotlib.use to prevent running scripts which try to switch
1207 matplotlib.use to prevent running scripts which try to switch
1204 interactive backends from within ipython. This will just crash
1208 interactive backends from within ipython. This will just crash
1205 the python interpreter, so we can't allow it (but a detailed error
1209 the python interpreter, so we can't allow it (but a detailed error
1206 is given to the user).
1210 is given to the user).
1207
1211
1208 2004-09-28 Fernando Perez <fperez@colorado.edu>
1212 2004-09-28 Fernando Perez <fperez@colorado.edu>
1209
1213
1210 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1214 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1211 matplotlib-related fixes so that using @run with non-matplotlib
1215 matplotlib-related fixes so that using @run with non-matplotlib
1212 scripts doesn't pop up spurious plot windows. This requires
1216 scripts doesn't pop up spurious plot windows. This requires
1213 matplotlib >= 0.63, where I had to make some changes as well.
1217 matplotlib >= 0.63, where I had to make some changes as well.
1214
1218
1215 * IPython/ipmaker.py (make_IPython): update version requirement to
1219 * IPython/ipmaker.py (make_IPython): update version requirement to
1216 python 2.2.
1220 python 2.2.
1217
1221
1218 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1222 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1219 banner arg for embedded customization.
1223 banner arg for embedded customization.
1220
1224
1221 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1225 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1222 explicit uses of __IP as the IPython's instance name. Now things
1226 explicit uses of __IP as the IPython's instance name. Now things
1223 are properly handled via the shell.name value. The actual code
1227 are properly handled via the shell.name value. The actual code
1224 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1228 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1225 is much better than before. I'll clean things completely when the
1229 is much better than before. I'll clean things completely when the
1226 magic stuff gets a real overhaul.
1230 magic stuff gets a real overhaul.
1227
1231
1228 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1232 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1229 minor changes to debian dir.
1233 minor changes to debian dir.
1230
1234
1231 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1235 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1232 pointer to the shell itself in the interactive namespace even when
1236 pointer to the shell itself in the interactive namespace even when
1233 a user-supplied dict is provided. This is needed for embedding
1237 a user-supplied dict is provided. This is needed for embedding
1234 purposes (found by tests with Michel Sanner).
1238 purposes (found by tests with Michel Sanner).
1235
1239
1236 2004-09-27 Fernando Perez <fperez@colorado.edu>
1240 2004-09-27 Fernando Perez <fperez@colorado.edu>
1237
1241
1238 * IPython/UserConfig/ipythonrc: remove []{} from
1242 * IPython/UserConfig/ipythonrc: remove []{} from
1239 readline_remove_delims, so that things like [modname.<TAB> do
1243 readline_remove_delims, so that things like [modname.<TAB> do
1240 proper completion. This disables [].TAB, but that's a less common
1244 proper completion. This disables [].TAB, but that's a less common
1241 case than module names in list comprehensions, for example.
1245 case than module names in list comprehensions, for example.
1242 Thanks to a report by Andrea Riciputi.
1246 Thanks to a report by Andrea Riciputi.
1243
1247
1244 2004-09-09 Fernando Perez <fperez@colorado.edu>
1248 2004-09-09 Fernando Perez <fperez@colorado.edu>
1245
1249
1246 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1250 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1247 blocking problems in win32 and osx. Fix by John.
1251 blocking problems in win32 and osx. Fix by John.
1248
1252
1249 2004-09-08 Fernando Perez <fperez@colorado.edu>
1253 2004-09-08 Fernando Perez <fperez@colorado.edu>
1250
1254
1251 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1255 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1252 for Win32 and OSX. Fix by John Hunter.
1256 for Win32 and OSX. Fix by John Hunter.
1253
1257
1254 2004-08-30 *** Released version 0.6.3
1258 2004-08-30 *** Released version 0.6.3
1255
1259
1256 2004-08-30 Fernando Perez <fperez@colorado.edu>
1260 2004-08-30 Fernando Perez <fperez@colorado.edu>
1257
1261
1258 * setup.py (isfile): Add manpages to list of dependent files to be
1262 * setup.py (isfile): Add manpages to list of dependent files to be
1259 updated.
1263 updated.
1260
1264
1261 2004-08-27 Fernando Perez <fperez@colorado.edu>
1265 2004-08-27 Fernando Perez <fperez@colorado.edu>
1262
1266
1263 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1267 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1264 for now. They don't really work with standalone WX/GTK code
1268 for now. They don't really work with standalone WX/GTK code
1265 (though matplotlib IS working fine with both of those backends).
1269 (though matplotlib IS working fine with both of those backends).
1266 This will neeed much more testing. I disabled most things with
1270 This will neeed much more testing. I disabled most things with
1267 comments, so turning it back on later should be pretty easy.
1271 comments, so turning it back on later should be pretty easy.
1268
1272
1269 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1273 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1270 autocalling of expressions like r'foo', by modifying the line
1274 autocalling of expressions like r'foo', by modifying the line
1271 split regexp. Closes
1275 split regexp. Closes
1272 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1276 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1273 Riley <ipythonbugs-AT-sabi.net>.
1277 Riley <ipythonbugs-AT-sabi.net>.
1274 (InteractiveShell.mainloop): honor --nobanner with banner
1278 (InteractiveShell.mainloop): honor --nobanner with banner
1275 extensions.
1279 extensions.
1276
1280
1277 * IPython/Shell.py: Significant refactoring of all classes, so
1281 * IPython/Shell.py: Significant refactoring of all classes, so
1278 that we can really support ALL matplotlib backends and threading
1282 that we can really support ALL matplotlib backends and threading
1279 models (John spotted a bug with Tk which required this). Now we
1283 models (John spotted a bug with Tk which required this). Now we
1280 should support single-threaded, WX-threads and GTK-threads, both
1284 should support single-threaded, WX-threads and GTK-threads, both
1281 for generic code and for matplotlib.
1285 for generic code and for matplotlib.
1282
1286
1283 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1287 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1284 -pylab, to simplify things for users. Will also remove the pylab
1288 -pylab, to simplify things for users. Will also remove the pylab
1285 profile, since now all of matplotlib configuration is directly
1289 profile, since now all of matplotlib configuration is directly
1286 handled here. This also reduces startup time.
1290 handled here. This also reduces startup time.
1287
1291
1288 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1292 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1289 shell wasn't being correctly called. Also in IPShellWX.
1293 shell wasn't being correctly called. Also in IPShellWX.
1290
1294
1291 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1295 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1292 fine-tune banner.
1296 fine-tune banner.
1293
1297
1294 * IPython/numutils.py (spike): Deprecate these spike functions,
1298 * IPython/numutils.py (spike): Deprecate these spike functions,
1295 delete (long deprecated) gnuplot_exec handler.
1299 delete (long deprecated) gnuplot_exec handler.
1296
1300
1297 2004-08-26 Fernando Perez <fperez@colorado.edu>
1301 2004-08-26 Fernando Perez <fperez@colorado.edu>
1298
1302
1299 * ipython.1: Update for threading options, plus some others which
1303 * ipython.1: Update for threading options, plus some others which
1300 were missing.
1304 were missing.
1301
1305
1302 * IPython/ipmaker.py (__call__): Added -wthread option for
1306 * IPython/ipmaker.py (__call__): Added -wthread option for
1303 wxpython thread handling. Make sure threading options are only
1307 wxpython thread handling. Make sure threading options are only
1304 valid at the command line.
1308 valid at the command line.
1305
1309
1306 * scripts/ipython: moved shell selection into a factory function
1310 * scripts/ipython: moved shell selection into a factory function
1307 in Shell.py, to keep the starter script to a minimum.
1311 in Shell.py, to keep the starter script to a minimum.
1308
1312
1309 2004-08-25 Fernando Perez <fperez@colorado.edu>
1313 2004-08-25 Fernando Perez <fperez@colorado.edu>
1310
1314
1311 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1315 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1312 John. Along with some recent changes he made to matplotlib, the
1316 John. Along with some recent changes he made to matplotlib, the
1313 next versions of both systems should work very well together.
1317 next versions of both systems should work very well together.
1314
1318
1315 2004-08-24 Fernando Perez <fperez@colorado.edu>
1319 2004-08-24 Fernando Perez <fperez@colorado.edu>
1316
1320
1317 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1321 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1318 tried to switch the profiling to using hotshot, but I'm getting
1322 tried to switch the profiling to using hotshot, but I'm getting
1319 strange errors from prof.runctx() there. I may be misreading the
1323 strange errors from prof.runctx() there. I may be misreading the
1320 docs, but it looks weird. For now the profiling code will
1324 docs, but it looks weird. For now the profiling code will
1321 continue to use the standard profiler.
1325 continue to use the standard profiler.
1322
1326
1323 2004-08-23 Fernando Perez <fperez@colorado.edu>
1327 2004-08-23 Fernando Perez <fperez@colorado.edu>
1324
1328
1325 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1329 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1326 threaded shell, by John Hunter. It's not quite ready yet, but
1330 threaded shell, by John Hunter. It's not quite ready yet, but
1327 close.
1331 close.
1328
1332
1329 2004-08-22 Fernando Perez <fperez@colorado.edu>
1333 2004-08-22 Fernando Perez <fperez@colorado.edu>
1330
1334
1331 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1335 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1332 in Magic and ultraTB.
1336 in Magic and ultraTB.
1333
1337
1334 * ipython.1: document threading options in manpage.
1338 * ipython.1: document threading options in manpage.
1335
1339
1336 * scripts/ipython: Changed name of -thread option to -gthread,
1340 * scripts/ipython: Changed name of -thread option to -gthread,
1337 since this is GTK specific. I want to leave the door open for a
1341 since this is GTK specific. I want to leave the door open for a
1338 -wthread option for WX, which will most likely be necessary. This
1342 -wthread option for WX, which will most likely be necessary. This
1339 change affects usage and ipmaker as well.
1343 change affects usage and ipmaker as well.
1340
1344
1341 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1345 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1342 handle the matplotlib shell issues. Code by John Hunter
1346 handle the matplotlib shell issues. Code by John Hunter
1343 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1347 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1344 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1348 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1345 broken (and disabled for end users) for now, but it puts the
1349 broken (and disabled for end users) for now, but it puts the
1346 infrastructure in place.
1350 infrastructure in place.
1347
1351
1348 2004-08-21 Fernando Perez <fperez@colorado.edu>
1352 2004-08-21 Fernando Perez <fperez@colorado.edu>
1349
1353
1350 * ipythonrc-pylab: Add matplotlib support.
1354 * ipythonrc-pylab: Add matplotlib support.
1351
1355
1352 * matplotlib_config.py: new files for matplotlib support, part of
1356 * matplotlib_config.py: new files for matplotlib support, part of
1353 the pylab profile.
1357 the pylab profile.
1354
1358
1355 * IPython/usage.py (__doc__): documented the threading options.
1359 * IPython/usage.py (__doc__): documented the threading options.
1356
1360
1357 2004-08-20 Fernando Perez <fperez@colorado.edu>
1361 2004-08-20 Fernando Perez <fperez@colorado.edu>
1358
1362
1359 * ipython: Modified the main calling routine to handle the -thread
1363 * ipython: Modified the main calling routine to handle the -thread
1360 and -mpthread options. This needs to be done as a top-level hack,
1364 and -mpthread options. This needs to be done as a top-level hack,
1361 because it determines which class to instantiate for IPython
1365 because it determines which class to instantiate for IPython
1362 itself.
1366 itself.
1363
1367
1364 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1368 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1365 classes to support multithreaded GTK operation without blocking,
1369 classes to support multithreaded GTK operation without blocking,
1366 and matplotlib with all backends. This is a lot of still very
1370 and matplotlib with all backends. This is a lot of still very
1367 experimental code, and threads are tricky. So it may still have a
1371 experimental code, and threads are tricky. So it may still have a
1368 few rough edges... This code owes a lot to
1372 few rough edges... This code owes a lot to
1369 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1373 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1370 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1374 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1371 to John Hunter for all the matplotlib work.
1375 to John Hunter for all the matplotlib work.
1372
1376
1373 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1377 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1374 options for gtk thread and matplotlib support.
1378 options for gtk thread and matplotlib support.
1375
1379
1376 2004-08-16 Fernando Perez <fperez@colorado.edu>
1380 2004-08-16 Fernando Perez <fperez@colorado.edu>
1377
1381
1378 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1382 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1379 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1383 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1380 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1384 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1381
1385
1382 2004-08-11 Fernando Perez <fperez@colorado.edu>
1386 2004-08-11 Fernando Perez <fperez@colorado.edu>
1383
1387
1384 * setup.py (isfile): Fix build so documentation gets updated for
1388 * setup.py (isfile): Fix build so documentation gets updated for
1385 rpms (it was only done for .tgz builds).
1389 rpms (it was only done for .tgz builds).
1386
1390
1387 2004-08-10 Fernando Perez <fperez@colorado.edu>
1391 2004-08-10 Fernando Perez <fperez@colorado.edu>
1388
1392
1389 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1393 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1390
1394
1391 * iplib.py : Silence syntax error exceptions in tab-completion.
1395 * iplib.py : Silence syntax error exceptions in tab-completion.
1392
1396
1393 2004-08-05 Fernando Perez <fperez@colorado.edu>
1397 2004-08-05 Fernando Perez <fperez@colorado.edu>
1394
1398
1395 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1399 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1396 'color off' mark for continuation prompts. This was causing long
1400 'color off' mark for continuation prompts. This was causing long
1397 continuation lines to mis-wrap.
1401 continuation lines to mis-wrap.
1398
1402
1399 2004-08-01 Fernando Perez <fperez@colorado.edu>
1403 2004-08-01 Fernando Perez <fperez@colorado.edu>
1400
1404
1401 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1405 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1402 for building ipython to be a parameter. All this is necessary
1406 for building ipython to be a parameter. All this is necessary
1403 right now to have a multithreaded version, but this insane
1407 right now to have a multithreaded version, but this insane
1404 non-design will be cleaned up soon. For now, it's a hack that
1408 non-design will be cleaned up soon. For now, it's a hack that
1405 works.
1409 works.
1406
1410
1407 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1411 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1408 args in various places. No bugs so far, but it's a dangerous
1412 args in various places. No bugs so far, but it's a dangerous
1409 practice.
1413 practice.
1410
1414
1411 2004-07-31 Fernando Perez <fperez@colorado.edu>
1415 2004-07-31 Fernando Perez <fperez@colorado.edu>
1412
1416
1413 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1417 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1414 fix completion of files with dots in their names under most
1418 fix completion of files with dots in their names under most
1415 profiles (pysh was OK because the completion order is different).
1419 profiles (pysh was OK because the completion order is different).
1416
1420
1417 2004-07-27 Fernando Perez <fperez@colorado.edu>
1421 2004-07-27 Fernando Perez <fperez@colorado.edu>
1418
1422
1419 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1423 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1420 keywords manually, b/c the one in keyword.py was removed in python
1424 keywords manually, b/c the one in keyword.py was removed in python
1421 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1425 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1422 This is NOT a bug under python 2.3 and earlier.
1426 This is NOT a bug under python 2.3 and earlier.
1423
1427
1424 2004-07-26 Fernando Perez <fperez@colorado.edu>
1428 2004-07-26 Fernando Perez <fperez@colorado.edu>
1425
1429
1426 * IPython/ultraTB.py (VerboseTB.text): Add another
1430 * IPython/ultraTB.py (VerboseTB.text): Add another
1427 linecache.checkcache() call to try to prevent inspect.py from
1431 linecache.checkcache() call to try to prevent inspect.py from
1428 crashing under python 2.3. I think this fixes
1432 crashing under python 2.3. I think this fixes
1429 http://www.scipy.net/roundup/ipython/issue17.
1433 http://www.scipy.net/roundup/ipython/issue17.
1430
1434
1431 2004-07-26 *** Released version 0.6.2
1435 2004-07-26 *** Released version 0.6.2
1432
1436
1433 2004-07-26 Fernando Perez <fperez@colorado.edu>
1437 2004-07-26 Fernando Perez <fperez@colorado.edu>
1434
1438
1435 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1439 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1436 fail for any number.
1440 fail for any number.
1437 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1441 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1438 empty bookmarks.
1442 empty bookmarks.
1439
1443
1440 2004-07-26 *** Released version 0.6.1
1444 2004-07-26 *** Released version 0.6.1
1441
1445
1442 2004-07-26 Fernando Perez <fperez@colorado.edu>
1446 2004-07-26 Fernando Perez <fperez@colorado.edu>
1443
1447
1444 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1448 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1445
1449
1446 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1450 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1447 escaping '()[]{}' in filenames.
1451 escaping '()[]{}' in filenames.
1448
1452
1449 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1453 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1450 Python 2.2 users who lack a proper shlex.split.
1454 Python 2.2 users who lack a proper shlex.split.
1451
1455
1452 2004-07-19 Fernando Perez <fperez@colorado.edu>
1456 2004-07-19 Fernando Perez <fperez@colorado.edu>
1453
1457
1454 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1458 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1455 for reading readline's init file. I follow the normal chain:
1459 for reading readline's init file. I follow the normal chain:
1456 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1460 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1457 report by Mike Heeter. This closes
1461 report by Mike Heeter. This closes
1458 http://www.scipy.net/roundup/ipython/issue16.
1462 http://www.scipy.net/roundup/ipython/issue16.
1459
1463
1460 2004-07-18 Fernando Perez <fperez@colorado.edu>
1464 2004-07-18 Fernando Perez <fperez@colorado.edu>
1461
1465
1462 * IPython/iplib.py (__init__): Add better handling of '\' under
1466 * IPython/iplib.py (__init__): Add better handling of '\' under
1463 Win32 for filenames. After a patch by Ville.
1467 Win32 for filenames. After a patch by Ville.
1464
1468
1465 2004-07-17 Fernando Perez <fperez@colorado.edu>
1469 2004-07-17 Fernando Perez <fperez@colorado.edu>
1466
1470
1467 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1471 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1468 autocalling would be triggered for 'foo is bar' if foo is
1472 autocalling would be triggered for 'foo is bar' if foo is
1469 callable. I also cleaned up the autocall detection code to use a
1473 callable. I also cleaned up the autocall detection code to use a
1470 regexp, which is faster. Bug reported by Alexander Schmolck.
1474 regexp, which is faster. Bug reported by Alexander Schmolck.
1471
1475
1472 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1476 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1473 '?' in them would confuse the help system. Reported by Alex
1477 '?' in them would confuse the help system. Reported by Alex
1474 Schmolck.
1478 Schmolck.
1475
1479
1476 2004-07-16 Fernando Perez <fperez@colorado.edu>
1480 2004-07-16 Fernando Perez <fperez@colorado.edu>
1477
1481
1478 * IPython/GnuplotInteractive.py (__all__): added plot2.
1482 * IPython/GnuplotInteractive.py (__all__): added plot2.
1479
1483
1480 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1484 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1481 plotting dictionaries, lists or tuples of 1d arrays.
1485 plotting dictionaries, lists or tuples of 1d arrays.
1482
1486
1483 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1487 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1484 optimizations.
1488 optimizations.
1485
1489
1486 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1490 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1487 the information which was there from Janko's original IPP code:
1491 the information which was there from Janko's original IPP code:
1488
1492
1489 03.05.99 20:53 porto.ifm.uni-kiel.de
1493 03.05.99 20:53 porto.ifm.uni-kiel.de
1490 --Started changelog.
1494 --Started changelog.
1491 --make clear do what it say it does
1495 --make clear do what it say it does
1492 --added pretty output of lines from inputcache
1496 --added pretty output of lines from inputcache
1493 --Made Logger a mixin class, simplifies handling of switches
1497 --Made Logger a mixin class, simplifies handling of switches
1494 --Added own completer class. .string<TAB> expands to last history
1498 --Added own completer class. .string<TAB> expands to last history
1495 line which starts with string. The new expansion is also present
1499 line which starts with string. The new expansion is also present
1496 with Ctrl-r from the readline library. But this shows, who this
1500 with Ctrl-r from the readline library. But this shows, who this
1497 can be done for other cases.
1501 can be done for other cases.
1498 --Added convention that all shell functions should accept a
1502 --Added convention that all shell functions should accept a
1499 parameter_string This opens the door for different behaviour for
1503 parameter_string This opens the door for different behaviour for
1500 each function. @cd is a good example of this.
1504 each function. @cd is a good example of this.
1501
1505
1502 04.05.99 12:12 porto.ifm.uni-kiel.de
1506 04.05.99 12:12 porto.ifm.uni-kiel.de
1503 --added logfile rotation
1507 --added logfile rotation
1504 --added new mainloop method which freezes first the namespace
1508 --added new mainloop method which freezes first the namespace
1505
1509
1506 07.05.99 21:24 porto.ifm.uni-kiel.de
1510 07.05.99 21:24 porto.ifm.uni-kiel.de
1507 --added the docreader classes. Now there is a help system.
1511 --added the docreader classes. Now there is a help system.
1508 -This is only a first try. Currently it's not easy to put new
1512 -This is only a first try. Currently it's not easy to put new
1509 stuff in the indices. But this is the way to go. Info would be
1513 stuff in the indices. But this is the way to go. Info would be
1510 better, but HTML is every where and not everybody has an info
1514 better, but HTML is every where and not everybody has an info
1511 system installed and it's not so easy to change html-docs to info.
1515 system installed and it's not so easy to change html-docs to info.
1512 --added global logfile option
1516 --added global logfile option
1513 --there is now a hook for object inspection method pinfo needs to
1517 --there is now a hook for object inspection method pinfo needs to
1514 be provided for this. Can be reached by two '??'.
1518 be provided for this. Can be reached by two '??'.
1515
1519
1516 08.05.99 20:51 porto.ifm.uni-kiel.de
1520 08.05.99 20:51 porto.ifm.uni-kiel.de
1517 --added a README
1521 --added a README
1518 --bug in rc file. Something has changed so functions in the rc
1522 --bug in rc file. Something has changed so functions in the rc
1519 file need to reference the shell and not self. Not clear if it's a
1523 file need to reference the shell and not self. Not clear if it's a
1520 bug or feature.
1524 bug or feature.
1521 --changed rc file for new behavior
1525 --changed rc file for new behavior
1522
1526
1523 2004-07-15 Fernando Perez <fperez@colorado.edu>
1527 2004-07-15 Fernando Perez <fperez@colorado.edu>
1524
1528
1525 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1529 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1526 cache was falling out of sync in bizarre manners when multi-line
1530 cache was falling out of sync in bizarre manners when multi-line
1527 input was present. Minor optimizations and cleanup.
1531 input was present. Minor optimizations and cleanup.
1528
1532
1529 (Logger): Remove old Changelog info for cleanup. This is the
1533 (Logger): Remove old Changelog info for cleanup. This is the
1530 information which was there from Janko's original code:
1534 information which was there from Janko's original code:
1531
1535
1532 Changes to Logger: - made the default log filename a parameter
1536 Changes to Logger: - made the default log filename a parameter
1533
1537
1534 - put a check for lines beginning with !@? in log(). Needed
1538 - put a check for lines beginning with !@? in log(). Needed
1535 (even if the handlers properly log their lines) for mid-session
1539 (even if the handlers properly log their lines) for mid-session
1536 logging activation to work properly. Without this, lines logged
1540 logging activation to work properly. Without this, lines logged
1537 in mid session, which get read from the cache, would end up
1541 in mid session, which get read from the cache, would end up
1538 'bare' (with !@? in the open) in the log. Now they are caught
1542 'bare' (with !@? in the open) in the log. Now they are caught
1539 and prepended with a #.
1543 and prepended with a #.
1540
1544
1541 * IPython/iplib.py (InteractiveShell.init_readline): added check
1545 * IPython/iplib.py (InteractiveShell.init_readline): added check
1542 in case MagicCompleter fails to be defined, so we don't crash.
1546 in case MagicCompleter fails to be defined, so we don't crash.
1543
1547
1544 2004-07-13 Fernando Perez <fperez@colorado.edu>
1548 2004-07-13 Fernando Perez <fperez@colorado.edu>
1545
1549
1546 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1550 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1547 of EPS if the requested filename ends in '.eps'.
1551 of EPS if the requested filename ends in '.eps'.
1548
1552
1549 2004-07-04 Fernando Perez <fperez@colorado.edu>
1553 2004-07-04 Fernando Perez <fperez@colorado.edu>
1550
1554
1551 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1555 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1552 escaping of quotes when calling the shell.
1556 escaping of quotes when calling the shell.
1553
1557
1554 2004-07-02 Fernando Perez <fperez@colorado.edu>
1558 2004-07-02 Fernando Perez <fperez@colorado.edu>
1555
1559
1556 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1560 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1557 gettext not working because we were clobbering '_'. Fixes
1561 gettext not working because we were clobbering '_'. Fixes
1558 http://www.scipy.net/roundup/ipython/issue6.
1562 http://www.scipy.net/roundup/ipython/issue6.
1559
1563
1560 2004-07-01 Fernando Perez <fperez@colorado.edu>
1564 2004-07-01 Fernando Perez <fperez@colorado.edu>
1561
1565
1562 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1566 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1563 into @cd. Patch by Ville.
1567 into @cd. Patch by Ville.
1564
1568
1565 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1569 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1566 new function to store things after ipmaker runs. Patch by Ville.
1570 new function to store things after ipmaker runs. Patch by Ville.
1567 Eventually this will go away once ipmaker is removed and the class
1571 Eventually this will go away once ipmaker is removed and the class
1568 gets cleaned up, but for now it's ok. Key functionality here is
1572 gets cleaned up, but for now it's ok. Key functionality here is
1569 the addition of the persistent storage mechanism, a dict for
1573 the addition of the persistent storage mechanism, a dict for
1570 keeping data across sessions (for now just bookmarks, but more can
1574 keeping data across sessions (for now just bookmarks, but more can
1571 be implemented later).
1575 be implemented later).
1572
1576
1573 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1577 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1574 persistent across sections. Patch by Ville, I modified it
1578 persistent across sections. Patch by Ville, I modified it
1575 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1579 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1576 added a '-l' option to list all bookmarks.
1580 added a '-l' option to list all bookmarks.
1577
1581
1578 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1582 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1579 center for cleanup. Registered with atexit.register(). I moved
1583 center for cleanup. Registered with atexit.register(). I moved
1580 here the old exit_cleanup(). After a patch by Ville.
1584 here the old exit_cleanup(). After a patch by Ville.
1581
1585
1582 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1586 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1583 characters in the hacked shlex_split for python 2.2.
1587 characters in the hacked shlex_split for python 2.2.
1584
1588
1585 * IPython/iplib.py (file_matches): more fixes to filenames with
1589 * IPython/iplib.py (file_matches): more fixes to filenames with
1586 whitespace in them. It's not perfect, but limitations in python's
1590 whitespace in them. It's not perfect, but limitations in python's
1587 readline make it impossible to go further.
1591 readline make it impossible to go further.
1588
1592
1589 2004-06-29 Fernando Perez <fperez@colorado.edu>
1593 2004-06-29 Fernando Perez <fperez@colorado.edu>
1590
1594
1591 * IPython/iplib.py (file_matches): escape whitespace correctly in
1595 * IPython/iplib.py (file_matches): escape whitespace correctly in
1592 filename completions. Bug reported by Ville.
1596 filename completions. Bug reported by Ville.
1593
1597
1594 2004-06-28 Fernando Perez <fperez@colorado.edu>
1598 2004-06-28 Fernando Perez <fperez@colorado.edu>
1595
1599
1596 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1600 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1597 the history file will be called 'history-PROFNAME' (or just
1601 the history file will be called 'history-PROFNAME' (or just
1598 'history' if no profile is loaded). I was getting annoyed at
1602 'history' if no profile is loaded). I was getting annoyed at
1599 getting my Numerical work history clobbered by pysh sessions.
1603 getting my Numerical work history clobbered by pysh sessions.
1600
1604
1601 * IPython/iplib.py (InteractiveShell.__init__): Internal
1605 * IPython/iplib.py (InteractiveShell.__init__): Internal
1602 getoutputerror() function so that we can honor the system_verbose
1606 getoutputerror() function so that we can honor the system_verbose
1603 flag for _all_ system calls. I also added escaping of #
1607 flag for _all_ system calls. I also added escaping of #
1604 characters here to avoid confusing Itpl.
1608 characters here to avoid confusing Itpl.
1605
1609
1606 * IPython/Magic.py (shlex_split): removed call to shell in
1610 * IPython/Magic.py (shlex_split): removed call to shell in
1607 parse_options and replaced it with shlex.split(). The annoying
1611 parse_options and replaced it with shlex.split(). The annoying
1608 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1612 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1609 to backport it from 2.3, with several frail hacks (the shlex
1613 to backport it from 2.3, with several frail hacks (the shlex
1610 module is rather limited in 2.2). Thanks to a suggestion by Ville
1614 module is rather limited in 2.2). Thanks to a suggestion by Ville
1611 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1615 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1612 problem.
1616 problem.
1613
1617
1614 (Magic.magic_system_verbose): new toggle to print the actual
1618 (Magic.magic_system_verbose): new toggle to print the actual
1615 system calls made by ipython. Mainly for debugging purposes.
1619 system calls made by ipython. Mainly for debugging purposes.
1616
1620
1617 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1621 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1618 doesn't support persistence. Reported (and fix suggested) by
1622 doesn't support persistence. Reported (and fix suggested) by
1619 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1623 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1620
1624
1621 2004-06-26 Fernando Perez <fperez@colorado.edu>
1625 2004-06-26 Fernando Perez <fperez@colorado.edu>
1622
1626
1623 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1627 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1624 continue prompts.
1628 continue prompts.
1625
1629
1626 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1630 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1627 function (basically a big docstring) and a few more things here to
1631 function (basically a big docstring) and a few more things here to
1628 speedup startup. pysh.py is now very lightweight. We want because
1632 speedup startup. pysh.py is now very lightweight. We want because
1629 it gets execfile'd, while InterpreterExec gets imported, so
1633 it gets execfile'd, while InterpreterExec gets imported, so
1630 byte-compilation saves time.
1634 byte-compilation saves time.
1631
1635
1632 2004-06-25 Fernando Perez <fperez@colorado.edu>
1636 2004-06-25 Fernando Perez <fperez@colorado.edu>
1633
1637
1634 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1638 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1635 -NUM', which was recently broken.
1639 -NUM', which was recently broken.
1636
1640
1637 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1641 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1638 in multi-line input (but not !!, which doesn't make sense there).
1642 in multi-line input (but not !!, which doesn't make sense there).
1639
1643
1640 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1644 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1641 It's just too useful, and people can turn it off in the less
1645 It's just too useful, and people can turn it off in the less
1642 common cases where it's a problem.
1646 common cases where it's a problem.
1643
1647
1644 2004-06-24 Fernando Perez <fperez@colorado.edu>
1648 2004-06-24 Fernando Perez <fperez@colorado.edu>
1645
1649
1646 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1650 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1647 special syntaxes (like alias calling) is now allied in multi-line
1651 special syntaxes (like alias calling) is now allied in multi-line
1648 input. This is still _very_ experimental, but it's necessary for
1652 input. This is still _very_ experimental, but it's necessary for
1649 efficient shell usage combining python looping syntax with system
1653 efficient shell usage combining python looping syntax with system
1650 calls. For now it's restricted to aliases, I don't think it
1654 calls. For now it's restricted to aliases, I don't think it
1651 really even makes sense to have this for magics.
1655 really even makes sense to have this for magics.
1652
1656
1653 2004-06-23 Fernando Perez <fperez@colorado.edu>
1657 2004-06-23 Fernando Perez <fperez@colorado.edu>
1654
1658
1655 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1659 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1656 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1660 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1657
1661
1658 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1662 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1659 extensions under Windows (after code sent by Gary Bishop). The
1663 extensions under Windows (after code sent by Gary Bishop). The
1660 extensions considered 'executable' are stored in IPython's rc
1664 extensions considered 'executable' are stored in IPython's rc
1661 structure as win_exec_ext.
1665 structure as win_exec_ext.
1662
1666
1663 * IPython/genutils.py (shell): new function, like system() but
1667 * IPython/genutils.py (shell): new function, like system() but
1664 without return value. Very useful for interactive shell work.
1668 without return value. Very useful for interactive shell work.
1665
1669
1666 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1670 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1667 delete aliases.
1671 delete aliases.
1668
1672
1669 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1673 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1670 sure that the alias table doesn't contain python keywords.
1674 sure that the alias table doesn't contain python keywords.
1671
1675
1672 2004-06-21 Fernando Perez <fperez@colorado.edu>
1676 2004-06-21 Fernando Perez <fperez@colorado.edu>
1673
1677
1674 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1678 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1675 non-existent items are found in $PATH. Reported by Thorsten.
1679 non-existent items are found in $PATH. Reported by Thorsten.
1676
1680
1677 2004-06-20 Fernando Perez <fperez@colorado.edu>
1681 2004-06-20 Fernando Perez <fperez@colorado.edu>
1678
1682
1679 * IPython/iplib.py (complete): modified the completer so that the
1683 * IPython/iplib.py (complete): modified the completer so that the
1680 order of priorities can be easily changed at runtime.
1684 order of priorities can be easily changed at runtime.
1681
1685
1682 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1686 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1683 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1687 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1684
1688
1685 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1689 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1686 expand Python variables prepended with $ in all system calls. The
1690 expand Python variables prepended with $ in all system calls. The
1687 same was done to InteractiveShell.handle_shell_escape. Now all
1691 same was done to InteractiveShell.handle_shell_escape. Now all
1688 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1692 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1689 expansion of python variables and expressions according to the
1693 expansion of python variables and expressions according to the
1690 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1694 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1691
1695
1692 Though PEP-215 has been rejected, a similar (but simpler) one
1696 Though PEP-215 has been rejected, a similar (but simpler) one
1693 seems like it will go into Python 2.4, PEP-292 -
1697 seems like it will go into Python 2.4, PEP-292 -
1694 http://www.python.org/peps/pep-0292.html.
1698 http://www.python.org/peps/pep-0292.html.
1695
1699
1696 I'll keep the full syntax of PEP-215, since IPython has since the
1700 I'll keep the full syntax of PEP-215, since IPython has since the
1697 start used Ka-Ping Yee's reference implementation discussed there
1701 start used Ka-Ping Yee's reference implementation discussed there
1698 (Itpl), and I actually like the powerful semantics it offers.
1702 (Itpl), and I actually like the powerful semantics it offers.
1699
1703
1700 In order to access normal shell variables, the $ has to be escaped
1704 In order to access normal shell variables, the $ has to be escaped
1701 via an extra $. For example:
1705 via an extra $. For example:
1702
1706
1703 In [7]: PATH='a python variable'
1707 In [7]: PATH='a python variable'
1704
1708
1705 In [8]: !echo $PATH
1709 In [8]: !echo $PATH
1706 a python variable
1710 a python variable
1707
1711
1708 In [9]: !echo $$PATH
1712 In [9]: !echo $$PATH
1709 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1713 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1710
1714
1711 (Magic.parse_options): escape $ so the shell doesn't evaluate
1715 (Magic.parse_options): escape $ so the shell doesn't evaluate
1712 things prematurely.
1716 things prematurely.
1713
1717
1714 * IPython/iplib.py (InteractiveShell.call_alias): added the
1718 * IPython/iplib.py (InteractiveShell.call_alias): added the
1715 ability for aliases to expand python variables via $.
1719 ability for aliases to expand python variables via $.
1716
1720
1717 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1721 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1718 system, now there's a @rehash/@rehashx pair of magics. These work
1722 system, now there's a @rehash/@rehashx pair of magics. These work
1719 like the csh rehash command, and can be invoked at any time. They
1723 like the csh rehash command, and can be invoked at any time. They
1720 build a table of aliases to everything in the user's $PATH
1724 build a table of aliases to everything in the user's $PATH
1721 (@rehash uses everything, @rehashx is slower but only adds
1725 (@rehash uses everything, @rehashx is slower but only adds
1722 executable files). With this, the pysh.py-based shell profile can
1726 executable files). With this, the pysh.py-based shell profile can
1723 now simply call rehash upon startup, and full access to all
1727 now simply call rehash upon startup, and full access to all
1724 programs in the user's path is obtained.
1728 programs in the user's path is obtained.
1725
1729
1726 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1730 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1727 functionality is now fully in place. I removed the old dynamic
1731 functionality is now fully in place. I removed the old dynamic
1728 code generation based approach, in favor of a much lighter one
1732 code generation based approach, in favor of a much lighter one
1729 based on a simple dict. The advantage is that this allows me to
1733 based on a simple dict. The advantage is that this allows me to
1730 now have thousands of aliases with negligible cost (unthinkable
1734 now have thousands of aliases with negligible cost (unthinkable
1731 with the old system).
1735 with the old system).
1732
1736
1733 2004-06-19 Fernando Perez <fperez@colorado.edu>
1737 2004-06-19 Fernando Perez <fperez@colorado.edu>
1734
1738
1735 * IPython/iplib.py (__init__): extended MagicCompleter class to
1739 * IPython/iplib.py (__init__): extended MagicCompleter class to
1736 also complete (last in priority) on user aliases.
1740 also complete (last in priority) on user aliases.
1737
1741
1738 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1742 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1739 call to eval.
1743 call to eval.
1740 (ItplNS.__init__): Added a new class which functions like Itpl,
1744 (ItplNS.__init__): Added a new class which functions like Itpl,
1741 but allows configuring the namespace for the evaluation to occur
1745 but allows configuring the namespace for the evaluation to occur
1742 in.
1746 in.
1743
1747
1744 2004-06-18 Fernando Perez <fperez@colorado.edu>
1748 2004-06-18 Fernando Perez <fperez@colorado.edu>
1745
1749
1746 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1750 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1747 better message when 'exit' or 'quit' are typed (a common newbie
1751 better message when 'exit' or 'quit' are typed (a common newbie
1748 confusion).
1752 confusion).
1749
1753
1750 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1754 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1751 check for Windows users.
1755 check for Windows users.
1752
1756
1753 * IPython/iplib.py (InteractiveShell.user_setup): removed
1757 * IPython/iplib.py (InteractiveShell.user_setup): removed
1754 disabling of colors for Windows. I'll test at runtime and issue a
1758 disabling of colors for Windows. I'll test at runtime and issue a
1755 warning if Gary's readline isn't found, as to nudge users to
1759 warning if Gary's readline isn't found, as to nudge users to
1756 download it.
1760 download it.
1757
1761
1758 2004-06-16 Fernando Perez <fperez@colorado.edu>
1762 2004-06-16 Fernando Perez <fperez@colorado.edu>
1759
1763
1760 * IPython/genutils.py (Stream.__init__): changed to print errors
1764 * IPython/genutils.py (Stream.__init__): changed to print errors
1761 to sys.stderr. I had a circular dependency here. Now it's
1765 to sys.stderr. I had a circular dependency here. Now it's
1762 possible to run ipython as IDLE's shell (consider this pre-alpha,
1766 possible to run ipython as IDLE's shell (consider this pre-alpha,
1763 since true stdout things end up in the starting terminal instead
1767 since true stdout things end up in the starting terminal instead
1764 of IDLE's out).
1768 of IDLE's out).
1765
1769
1766 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1770 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1767 users who haven't # updated their prompt_in2 definitions. Remove
1771 users who haven't # updated their prompt_in2 definitions. Remove
1768 eventually.
1772 eventually.
1769 (multiple_replace): added credit to original ASPN recipe.
1773 (multiple_replace): added credit to original ASPN recipe.
1770
1774
1771 2004-06-15 Fernando Perez <fperez@colorado.edu>
1775 2004-06-15 Fernando Perez <fperez@colorado.edu>
1772
1776
1773 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1777 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1774 list of auto-defined aliases.
1778 list of auto-defined aliases.
1775
1779
1776 2004-06-13 Fernando Perez <fperez@colorado.edu>
1780 2004-06-13 Fernando Perez <fperez@colorado.edu>
1777
1781
1778 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1782 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1779 install was really requested (so setup.py can be used for other
1783 install was really requested (so setup.py can be used for other
1780 things under Windows).
1784 things under Windows).
1781
1785
1782 2004-06-10 Fernando Perez <fperez@colorado.edu>
1786 2004-06-10 Fernando Perez <fperez@colorado.edu>
1783
1787
1784 * IPython/Logger.py (Logger.create_log): Manually remove any old
1788 * IPython/Logger.py (Logger.create_log): Manually remove any old
1785 backup, since os.remove may fail under Windows. Fixes bug
1789 backup, since os.remove may fail under Windows. Fixes bug
1786 reported by Thorsten.
1790 reported by Thorsten.
1787
1791
1788 2004-06-09 Fernando Perez <fperez@colorado.edu>
1792 2004-06-09 Fernando Perez <fperez@colorado.edu>
1789
1793
1790 * examples/example-embed.py: fixed all references to %n (replaced
1794 * examples/example-embed.py: fixed all references to %n (replaced
1791 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1795 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1792 for all examples and the manual as well.
1796 for all examples and the manual as well.
1793
1797
1794 2004-06-08 Fernando Perez <fperez@colorado.edu>
1798 2004-06-08 Fernando Perez <fperez@colorado.edu>
1795
1799
1796 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1800 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1797 alignment and color management. All 3 prompt subsystems now
1801 alignment and color management. All 3 prompt subsystems now
1798 inherit from BasePrompt.
1802 inherit from BasePrompt.
1799
1803
1800 * tools/release: updates for windows installer build and tag rpms
1804 * tools/release: updates for windows installer build and tag rpms
1801 with python version (since paths are fixed).
1805 with python version (since paths are fixed).
1802
1806
1803 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1807 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1804 which will become eventually obsolete. Also fixed the default
1808 which will become eventually obsolete. Also fixed the default
1805 prompt_in2 to use \D, so at least new users start with the correct
1809 prompt_in2 to use \D, so at least new users start with the correct
1806 defaults.
1810 defaults.
1807 WARNING: Users with existing ipythonrc files will need to apply
1811 WARNING: Users with existing ipythonrc files will need to apply
1808 this fix manually!
1812 this fix manually!
1809
1813
1810 * setup.py: make windows installer (.exe). This is finally the
1814 * setup.py: make windows installer (.exe). This is finally the
1811 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1815 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1812 which I hadn't included because it required Python 2.3 (or recent
1816 which I hadn't included because it required Python 2.3 (or recent
1813 distutils).
1817 distutils).
1814
1818
1815 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1819 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1816 usage of new '\D' escape.
1820 usage of new '\D' escape.
1817
1821
1818 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1822 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1819 lacks os.getuid())
1823 lacks os.getuid())
1820 (CachedOutput.set_colors): Added the ability to turn coloring
1824 (CachedOutput.set_colors): Added the ability to turn coloring
1821 on/off with @colors even for manually defined prompt colors. It
1825 on/off with @colors even for manually defined prompt colors. It
1822 uses a nasty global, but it works safely and via the generic color
1826 uses a nasty global, but it works safely and via the generic color
1823 handling mechanism.
1827 handling mechanism.
1824 (Prompt2.__init__): Introduced new escape '\D' for continuation
1828 (Prompt2.__init__): Introduced new escape '\D' for continuation
1825 prompts. It represents the counter ('\#') as dots.
1829 prompts. It represents the counter ('\#') as dots.
1826 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1830 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1827 need to update their ipythonrc files and replace '%n' with '\D' in
1831 need to update their ipythonrc files and replace '%n' with '\D' in
1828 their prompt_in2 settings everywhere. Sorry, but there's
1832 their prompt_in2 settings everywhere. Sorry, but there's
1829 otherwise no clean way to get all prompts to properly align. The
1833 otherwise no clean way to get all prompts to properly align. The
1830 ipythonrc shipped with IPython has been updated.
1834 ipythonrc shipped with IPython has been updated.
1831
1835
1832 2004-06-07 Fernando Perez <fperez@colorado.edu>
1836 2004-06-07 Fernando Perez <fperez@colorado.edu>
1833
1837
1834 * setup.py (isfile): Pass local_icons option to latex2html, so the
1838 * setup.py (isfile): Pass local_icons option to latex2html, so the
1835 resulting HTML file is self-contained. Thanks to
1839 resulting HTML file is self-contained. Thanks to
1836 dryice-AT-liu.com.cn for the tip.
1840 dryice-AT-liu.com.cn for the tip.
1837
1841
1838 * pysh.py: I created a new profile 'shell', which implements a
1842 * pysh.py: I created a new profile 'shell', which implements a
1839 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1843 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1840 system shell, nor will it become one anytime soon. It's mainly
1844 system shell, nor will it become one anytime soon. It's mainly
1841 meant to illustrate the use of the new flexible bash-like prompts.
1845 meant to illustrate the use of the new flexible bash-like prompts.
1842 I guess it could be used by hardy souls for true shell management,
1846 I guess it could be used by hardy souls for true shell management,
1843 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1847 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1844 profile. This uses the InterpreterExec extension provided by
1848 profile. This uses the InterpreterExec extension provided by
1845 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1849 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1846
1850
1847 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1851 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1848 auto-align itself with the length of the previous input prompt
1852 auto-align itself with the length of the previous input prompt
1849 (taking into account the invisible color escapes).
1853 (taking into account the invisible color escapes).
1850 (CachedOutput.__init__): Large restructuring of this class. Now
1854 (CachedOutput.__init__): Large restructuring of this class. Now
1851 all three prompts (primary1, primary2, output) are proper objects,
1855 all three prompts (primary1, primary2, output) are proper objects,
1852 managed by the 'parent' CachedOutput class. The code is still a
1856 managed by the 'parent' CachedOutput class. The code is still a
1853 bit hackish (all prompts share state via a pointer to the cache),
1857 bit hackish (all prompts share state via a pointer to the cache),
1854 but it's overall far cleaner than before.
1858 but it's overall far cleaner than before.
1855
1859
1856 * IPython/genutils.py (getoutputerror): modified to add verbose,
1860 * IPython/genutils.py (getoutputerror): modified to add verbose,
1857 debug and header options. This makes the interface of all getout*
1861 debug and header options. This makes the interface of all getout*
1858 functions uniform.
1862 functions uniform.
1859 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1863 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1860
1864
1861 * IPython/Magic.py (Magic.default_option): added a function to
1865 * IPython/Magic.py (Magic.default_option): added a function to
1862 allow registering default options for any magic command. This
1866 allow registering default options for any magic command. This
1863 makes it easy to have profiles which customize the magics globally
1867 makes it easy to have profiles which customize the magics globally
1864 for a certain use. The values set through this function are
1868 for a certain use. The values set through this function are
1865 picked up by the parse_options() method, which all magics should
1869 picked up by the parse_options() method, which all magics should
1866 use to parse their options.
1870 use to parse their options.
1867
1871
1868 * IPython/genutils.py (warn): modified the warnings framework to
1872 * IPython/genutils.py (warn): modified the warnings framework to
1869 use the Term I/O class. I'm trying to slowly unify all of
1873 use the Term I/O class. I'm trying to slowly unify all of
1870 IPython's I/O operations to pass through Term.
1874 IPython's I/O operations to pass through Term.
1871
1875
1872 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1876 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1873 the secondary prompt to correctly match the length of the primary
1877 the secondary prompt to correctly match the length of the primary
1874 one for any prompt. Now multi-line code will properly line up
1878 one for any prompt. Now multi-line code will properly line up
1875 even for path dependent prompts, such as the new ones available
1879 even for path dependent prompts, such as the new ones available
1876 via the prompt_specials.
1880 via the prompt_specials.
1877
1881
1878 2004-06-06 Fernando Perez <fperez@colorado.edu>
1882 2004-06-06 Fernando Perez <fperez@colorado.edu>
1879
1883
1880 * IPython/Prompts.py (prompt_specials): Added the ability to have
1884 * IPython/Prompts.py (prompt_specials): Added the ability to have
1881 bash-like special sequences in the prompts, which get
1885 bash-like special sequences in the prompts, which get
1882 automatically expanded. Things like hostname, current working
1886 automatically expanded. Things like hostname, current working
1883 directory and username are implemented already, but it's easy to
1887 directory and username are implemented already, but it's easy to
1884 add more in the future. Thanks to a patch by W.J. van der Laan
1888 add more in the future. Thanks to a patch by W.J. van der Laan
1885 <gnufnork-AT-hetdigitalegat.nl>
1889 <gnufnork-AT-hetdigitalegat.nl>
1886 (prompt_specials): Added color support for prompt strings, so
1890 (prompt_specials): Added color support for prompt strings, so
1887 users can define arbitrary color setups for their prompts.
1891 users can define arbitrary color setups for their prompts.
1888
1892
1889 2004-06-05 Fernando Perez <fperez@colorado.edu>
1893 2004-06-05 Fernando Perez <fperez@colorado.edu>
1890
1894
1891 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1895 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1892 code to load Gary Bishop's readline and configure it
1896 code to load Gary Bishop's readline and configure it
1893 automatically. Thanks to Gary for help on this.
1897 automatically. Thanks to Gary for help on this.
1894
1898
1895 2004-06-01 Fernando Perez <fperez@colorado.edu>
1899 2004-06-01 Fernando Perez <fperez@colorado.edu>
1896
1900
1897 * IPython/Logger.py (Logger.create_log): fix bug for logging
1901 * IPython/Logger.py (Logger.create_log): fix bug for logging
1898 with no filename (previous fix was incomplete).
1902 with no filename (previous fix was incomplete).
1899
1903
1900 2004-05-25 Fernando Perez <fperez@colorado.edu>
1904 2004-05-25 Fernando Perez <fperez@colorado.edu>
1901
1905
1902 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1906 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1903 parens would get passed to the shell.
1907 parens would get passed to the shell.
1904
1908
1905 2004-05-20 Fernando Perez <fperez@colorado.edu>
1909 2004-05-20 Fernando Perez <fperez@colorado.edu>
1906
1910
1907 * IPython/Magic.py (Magic.magic_prun): changed default profile
1911 * IPython/Magic.py (Magic.magic_prun): changed default profile
1908 sort order to 'time' (the more common profiling need).
1912 sort order to 'time' (the more common profiling need).
1909
1913
1910 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1914 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1911 so that source code shown is guaranteed in sync with the file on
1915 so that source code shown is guaranteed in sync with the file on
1912 disk (also changed in psource). Similar fix to the one for
1916 disk (also changed in psource). Similar fix to the one for
1913 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1917 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1914 <yann.ledu-AT-noos.fr>.
1918 <yann.ledu-AT-noos.fr>.
1915
1919
1916 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1920 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1917 with a single option would not be correctly parsed. Closes
1921 with a single option would not be correctly parsed. Closes
1918 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1922 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1919 introduced in 0.6.0 (on 2004-05-06).
1923 introduced in 0.6.0 (on 2004-05-06).
1920
1924
1921 2004-05-13 *** Released version 0.6.0
1925 2004-05-13 *** Released version 0.6.0
1922
1926
1923 2004-05-13 Fernando Perez <fperez@colorado.edu>
1927 2004-05-13 Fernando Perez <fperez@colorado.edu>
1924
1928
1925 * debian/: Added debian/ directory to CVS, so that debian support
1929 * debian/: Added debian/ directory to CVS, so that debian support
1926 is publicly accessible. The debian package is maintained by Jack
1930 is publicly accessible. The debian package is maintained by Jack
1927 Moffit <jack-AT-xiph.org>.
1931 Moffit <jack-AT-xiph.org>.
1928
1932
1929 * Documentation: included the notes about an ipython-based system
1933 * Documentation: included the notes about an ipython-based system
1930 shell (the hypothetical 'pysh') into the new_design.pdf document,
1934 shell (the hypothetical 'pysh') into the new_design.pdf document,
1931 so that these ideas get distributed to users along with the
1935 so that these ideas get distributed to users along with the
1932 official documentation.
1936 official documentation.
1933
1937
1934 2004-05-10 Fernando Perez <fperez@colorado.edu>
1938 2004-05-10 Fernando Perez <fperez@colorado.edu>
1935
1939
1936 * IPython/Logger.py (Logger.create_log): fix recently introduced
1940 * IPython/Logger.py (Logger.create_log): fix recently introduced
1937 bug (misindented line) where logstart would fail when not given an
1941 bug (misindented line) where logstart would fail when not given an
1938 explicit filename.
1942 explicit filename.
1939
1943
1940 2004-05-09 Fernando Perez <fperez@colorado.edu>
1944 2004-05-09 Fernando Perez <fperez@colorado.edu>
1941
1945
1942 * IPython/Magic.py (Magic.parse_options): skip system call when
1946 * IPython/Magic.py (Magic.parse_options): skip system call when
1943 there are no options to look for. Faster, cleaner for the common
1947 there are no options to look for. Faster, cleaner for the common
1944 case.
1948 case.
1945
1949
1946 * Documentation: many updates to the manual: describing Windows
1950 * Documentation: many updates to the manual: describing Windows
1947 support better, Gnuplot updates, credits, misc small stuff. Also
1951 support better, Gnuplot updates, credits, misc small stuff. Also
1948 updated the new_design doc a bit.
1952 updated the new_design doc a bit.
1949
1953
1950 2004-05-06 *** Released version 0.6.0.rc1
1954 2004-05-06 *** Released version 0.6.0.rc1
1951
1955
1952 2004-05-06 Fernando Perez <fperez@colorado.edu>
1956 2004-05-06 Fernando Perez <fperez@colorado.edu>
1953
1957
1954 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1958 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1955 operations to use the vastly more efficient list/''.join() method.
1959 operations to use the vastly more efficient list/''.join() method.
1956 (FormattedTB.text): Fix
1960 (FormattedTB.text): Fix
1957 http://www.scipy.net/roundup/ipython/issue12 - exception source
1961 http://www.scipy.net/roundup/ipython/issue12 - exception source
1958 extract not updated after reload. Thanks to Mike Salib
1962 extract not updated after reload. Thanks to Mike Salib
1959 <msalib-AT-mit.edu> for pinning the source of the problem.
1963 <msalib-AT-mit.edu> for pinning the source of the problem.
1960 Fortunately, the solution works inside ipython and doesn't require
1964 Fortunately, the solution works inside ipython and doesn't require
1961 any changes to python proper.
1965 any changes to python proper.
1962
1966
1963 * IPython/Magic.py (Magic.parse_options): Improved to process the
1967 * IPython/Magic.py (Magic.parse_options): Improved to process the
1964 argument list as a true shell would (by actually using the
1968 argument list as a true shell would (by actually using the
1965 underlying system shell). This way, all @magics automatically get
1969 underlying system shell). This way, all @magics automatically get
1966 shell expansion for variables. Thanks to a comment by Alex
1970 shell expansion for variables. Thanks to a comment by Alex
1967 Schmolck.
1971 Schmolck.
1968
1972
1969 2004-04-04 Fernando Perez <fperez@colorado.edu>
1973 2004-04-04 Fernando Perez <fperez@colorado.edu>
1970
1974
1971 * IPython/iplib.py (InteractiveShell.interact): Added a special
1975 * IPython/iplib.py (InteractiveShell.interact): Added a special
1972 trap for a debugger quit exception, which is basically impossible
1976 trap for a debugger quit exception, which is basically impossible
1973 to handle by normal mechanisms, given what pdb does to the stack.
1977 to handle by normal mechanisms, given what pdb does to the stack.
1974 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1978 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1975
1979
1976 2004-04-03 Fernando Perez <fperez@colorado.edu>
1980 2004-04-03 Fernando Perez <fperez@colorado.edu>
1977
1981
1978 * IPython/genutils.py (Term): Standardized the names of the Term
1982 * IPython/genutils.py (Term): Standardized the names of the Term
1979 class streams to cin/cout/cerr, following C++ naming conventions
1983 class streams to cin/cout/cerr, following C++ naming conventions
1980 (I can't use in/out/err because 'in' is not a valid attribute
1984 (I can't use in/out/err because 'in' is not a valid attribute
1981 name).
1985 name).
1982
1986
1983 * IPython/iplib.py (InteractiveShell.interact): don't increment
1987 * IPython/iplib.py (InteractiveShell.interact): don't increment
1984 the prompt if there's no user input. By Daniel 'Dang' Griffith
1988 the prompt if there's no user input. By Daniel 'Dang' Griffith
1985 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1989 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1986 Francois Pinard.
1990 Francois Pinard.
1987
1991
1988 2004-04-02 Fernando Perez <fperez@colorado.edu>
1992 2004-04-02 Fernando Perez <fperez@colorado.edu>
1989
1993
1990 * IPython/genutils.py (Stream.__init__): Modified to survive at
1994 * IPython/genutils.py (Stream.__init__): Modified to survive at
1991 least importing in contexts where stdin/out/err aren't true file
1995 least importing in contexts where stdin/out/err aren't true file
1992 objects, such as PyCrust (they lack fileno() and mode). However,
1996 objects, such as PyCrust (they lack fileno() and mode). However,
1993 the recovery facilities which rely on these things existing will
1997 the recovery facilities which rely on these things existing will
1994 not work.
1998 not work.
1995
1999
1996 2004-04-01 Fernando Perez <fperez@colorado.edu>
2000 2004-04-01 Fernando Perez <fperez@colorado.edu>
1997
2001
1998 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2002 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1999 use the new getoutputerror() function, so it properly
2003 use the new getoutputerror() function, so it properly
2000 distinguishes stdout/err.
2004 distinguishes stdout/err.
2001
2005
2002 * IPython/genutils.py (getoutputerror): added a function to
2006 * IPython/genutils.py (getoutputerror): added a function to
2003 capture separately the standard output and error of a command.
2007 capture separately the standard output and error of a command.
2004 After a comment from dang on the mailing lists. This code is
2008 After a comment from dang on the mailing lists. This code is
2005 basically a modified version of commands.getstatusoutput(), from
2009 basically a modified version of commands.getstatusoutput(), from
2006 the standard library.
2010 the standard library.
2007
2011
2008 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2012 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2009 '!!' as a special syntax (shorthand) to access @sx.
2013 '!!' as a special syntax (shorthand) to access @sx.
2010
2014
2011 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2015 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2012 command and return its output as a list split on '\n'.
2016 command and return its output as a list split on '\n'.
2013
2017
2014 2004-03-31 Fernando Perez <fperez@colorado.edu>
2018 2004-03-31 Fernando Perez <fperez@colorado.edu>
2015
2019
2016 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2020 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2017 method to dictionaries used as FakeModule instances if they lack
2021 method to dictionaries used as FakeModule instances if they lack
2018 it. At least pydoc in python2.3 breaks for runtime-defined
2022 it. At least pydoc in python2.3 breaks for runtime-defined
2019 functions without this hack. At some point I need to _really_
2023 functions without this hack. At some point I need to _really_
2020 understand what FakeModule is doing, because it's a gross hack.
2024 understand what FakeModule is doing, because it's a gross hack.
2021 But it solves Arnd's problem for now...
2025 But it solves Arnd's problem for now...
2022
2026
2023 2004-02-27 Fernando Perez <fperez@colorado.edu>
2027 2004-02-27 Fernando Perez <fperez@colorado.edu>
2024
2028
2025 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2029 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2026 mode would behave erratically. Also increased the number of
2030 mode would behave erratically. Also increased the number of
2027 possible logs in rotate mod to 999. Thanks to Rod Holland
2031 possible logs in rotate mod to 999. Thanks to Rod Holland
2028 <rhh@StructureLABS.com> for the report and fixes.
2032 <rhh@StructureLABS.com> for the report and fixes.
2029
2033
2030 2004-02-26 Fernando Perez <fperez@colorado.edu>
2034 2004-02-26 Fernando Perez <fperez@colorado.edu>
2031
2035
2032 * IPython/genutils.py (page): Check that the curses module really
2036 * IPython/genutils.py (page): Check that the curses module really
2033 has the initscr attribute before trying to use it. For some
2037 has the initscr attribute before trying to use it. For some
2034 reason, the Solaris curses module is missing this. I think this
2038 reason, the Solaris curses module is missing this. I think this
2035 should be considered a Solaris python bug, but I'm not sure.
2039 should be considered a Solaris python bug, but I'm not sure.
2036
2040
2037 2004-01-17 Fernando Perez <fperez@colorado.edu>
2041 2004-01-17 Fernando Perez <fperez@colorado.edu>
2038
2042
2039 * IPython/genutils.py (Stream.__init__): Changes to try to make
2043 * IPython/genutils.py (Stream.__init__): Changes to try to make
2040 ipython robust against stdin/out/err being closed by the user.
2044 ipython robust against stdin/out/err being closed by the user.
2041 This is 'user error' (and blocks a normal python session, at least
2045 This is 'user error' (and blocks a normal python session, at least
2042 the stdout case). However, Ipython should be able to survive such
2046 the stdout case). However, Ipython should be able to survive such
2043 instances of abuse as gracefully as possible. To simplify the
2047 instances of abuse as gracefully as possible. To simplify the
2044 coding and maintain compatibility with Gary Bishop's Term
2048 coding and maintain compatibility with Gary Bishop's Term
2045 contributions, I've made use of classmethods for this. I think
2049 contributions, I've made use of classmethods for this. I think
2046 this introduces a dependency on python 2.2.
2050 this introduces a dependency on python 2.2.
2047
2051
2048 2004-01-13 Fernando Perez <fperez@colorado.edu>
2052 2004-01-13 Fernando Perez <fperez@colorado.edu>
2049
2053
2050 * IPython/numutils.py (exp_safe): simplified the code a bit and
2054 * IPython/numutils.py (exp_safe): simplified the code a bit and
2051 removed the need for importing the kinds module altogether.
2055 removed the need for importing the kinds module altogether.
2052
2056
2053 2004-01-06 Fernando Perez <fperez@colorado.edu>
2057 2004-01-06 Fernando Perez <fperez@colorado.edu>
2054
2058
2055 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2059 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2056 a magic function instead, after some community feedback. No
2060 a magic function instead, after some community feedback. No
2057 special syntax will exist for it, but its name is deliberately
2061 special syntax will exist for it, but its name is deliberately
2058 very short.
2062 very short.
2059
2063
2060 2003-12-20 Fernando Perez <fperez@colorado.edu>
2064 2003-12-20 Fernando Perez <fperez@colorado.edu>
2061
2065
2062 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2066 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2063 new functionality, to automagically assign the result of a shell
2067 new functionality, to automagically assign the result of a shell
2064 command to a variable. I'll solicit some community feedback on
2068 command to a variable. I'll solicit some community feedback on
2065 this before making it permanent.
2069 this before making it permanent.
2066
2070
2067 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2071 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2068 requested about callables for which inspect couldn't obtain a
2072 requested about callables for which inspect couldn't obtain a
2069 proper argspec. Thanks to a crash report sent by Etienne
2073 proper argspec. Thanks to a crash report sent by Etienne
2070 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2074 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2071
2075
2072 2003-12-09 Fernando Perez <fperez@colorado.edu>
2076 2003-12-09 Fernando Perez <fperez@colorado.edu>
2073
2077
2074 * IPython/genutils.py (page): patch for the pager to work across
2078 * IPython/genutils.py (page): patch for the pager to work across
2075 various versions of Windows. By Gary Bishop.
2079 various versions of Windows. By Gary Bishop.
2076
2080
2077 2003-12-04 Fernando Perez <fperez@colorado.edu>
2081 2003-12-04 Fernando Perez <fperez@colorado.edu>
2078
2082
2079 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2083 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2080 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2084 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2081 While I tested this and it looks ok, there may still be corner
2085 While I tested this and it looks ok, there may still be corner
2082 cases I've missed.
2086 cases I've missed.
2083
2087
2084 2003-12-01 Fernando Perez <fperez@colorado.edu>
2088 2003-12-01 Fernando Perez <fperez@colorado.edu>
2085
2089
2086 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2090 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2087 where a line like 'p,q=1,2' would fail because the automagic
2091 where a line like 'p,q=1,2' would fail because the automagic
2088 system would be triggered for @p.
2092 system would be triggered for @p.
2089
2093
2090 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2094 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2091 cleanups, code unmodified.
2095 cleanups, code unmodified.
2092
2096
2093 * IPython/genutils.py (Term): added a class for IPython to handle
2097 * IPython/genutils.py (Term): added a class for IPython to handle
2094 output. In most cases it will just be a proxy for stdout/err, but
2098 output. In most cases it will just be a proxy for stdout/err, but
2095 having this allows modifications to be made for some platforms,
2099 having this allows modifications to be made for some platforms,
2096 such as handling color escapes under Windows. All of this code
2100 such as handling color escapes under Windows. All of this code
2097 was contributed by Gary Bishop, with minor modifications by me.
2101 was contributed by Gary Bishop, with minor modifications by me.
2098 The actual changes affect many files.
2102 The actual changes affect many files.
2099
2103
2100 2003-11-30 Fernando Perez <fperez@colorado.edu>
2104 2003-11-30 Fernando Perez <fperez@colorado.edu>
2101
2105
2102 * IPython/iplib.py (file_matches): new completion code, courtesy
2106 * IPython/iplib.py (file_matches): new completion code, courtesy
2103 of Jeff Collins. This enables filename completion again under
2107 of Jeff Collins. This enables filename completion again under
2104 python 2.3, which disabled it at the C level.
2108 python 2.3, which disabled it at the C level.
2105
2109
2106 2003-11-11 Fernando Perez <fperez@colorado.edu>
2110 2003-11-11 Fernando Perez <fperez@colorado.edu>
2107
2111
2108 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2112 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2109 for Numeric.array(map(...)), but often convenient.
2113 for Numeric.array(map(...)), but often convenient.
2110
2114
2111 2003-11-05 Fernando Perez <fperez@colorado.edu>
2115 2003-11-05 Fernando Perez <fperez@colorado.edu>
2112
2116
2113 * IPython/numutils.py (frange): Changed a call from int() to
2117 * IPython/numutils.py (frange): Changed a call from int() to
2114 int(round()) to prevent a problem reported with arange() in the
2118 int(round()) to prevent a problem reported with arange() in the
2115 numpy list.
2119 numpy list.
2116
2120
2117 2003-10-06 Fernando Perez <fperez@colorado.edu>
2121 2003-10-06 Fernando Perez <fperez@colorado.edu>
2118
2122
2119 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2123 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2120 prevent crashes if sys lacks an argv attribute (it happens with
2124 prevent crashes if sys lacks an argv attribute (it happens with
2121 embedded interpreters which build a bare-bones sys module).
2125 embedded interpreters which build a bare-bones sys module).
2122 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2126 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2123
2127
2124 2003-09-24 Fernando Perez <fperez@colorado.edu>
2128 2003-09-24 Fernando Perez <fperez@colorado.edu>
2125
2129
2126 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2130 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2127 to protect against poorly written user objects where __getattr__
2131 to protect against poorly written user objects where __getattr__
2128 raises exceptions other than AttributeError. Thanks to a bug
2132 raises exceptions other than AttributeError. Thanks to a bug
2129 report by Oliver Sander <osander-AT-gmx.de>.
2133 report by Oliver Sander <osander-AT-gmx.de>.
2130
2134
2131 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2135 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2132 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2136 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2133
2137
2134 2003-09-09 Fernando Perez <fperez@colorado.edu>
2138 2003-09-09 Fernando Perez <fperez@colorado.edu>
2135
2139
2136 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2140 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2137 unpacking a list whith a callable as first element would
2141 unpacking a list whith a callable as first element would
2138 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2142 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2139 Collins.
2143 Collins.
2140
2144
2141 2003-08-25 *** Released version 0.5.0
2145 2003-08-25 *** Released version 0.5.0
2142
2146
2143 2003-08-22 Fernando Perez <fperez@colorado.edu>
2147 2003-08-22 Fernando Perez <fperez@colorado.edu>
2144
2148
2145 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2149 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2146 improperly defined user exceptions. Thanks to feedback from Mark
2150 improperly defined user exceptions. Thanks to feedback from Mark
2147 Russell <mrussell-AT-verio.net>.
2151 Russell <mrussell-AT-verio.net>.
2148
2152
2149 2003-08-20 Fernando Perez <fperez@colorado.edu>
2153 2003-08-20 Fernando Perez <fperez@colorado.edu>
2150
2154
2151 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2155 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2152 printing so that it would print multi-line string forms starting
2156 printing so that it would print multi-line string forms starting
2153 with a new line. This way the formatting is better respected for
2157 with a new line. This way the formatting is better respected for
2154 objects which work hard to make nice string forms.
2158 objects which work hard to make nice string forms.
2155
2159
2156 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2160 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2157 autocall would overtake data access for objects with both
2161 autocall would overtake data access for objects with both
2158 __getitem__ and __call__.
2162 __getitem__ and __call__.
2159
2163
2160 2003-08-19 *** Released version 0.5.0-rc1
2164 2003-08-19 *** Released version 0.5.0-rc1
2161
2165
2162 2003-08-19 Fernando Perez <fperez@colorado.edu>
2166 2003-08-19 Fernando Perez <fperez@colorado.edu>
2163
2167
2164 * IPython/deep_reload.py (load_tail): single tiny change here
2168 * IPython/deep_reload.py (load_tail): single tiny change here
2165 seems to fix the long-standing bug of dreload() failing to work
2169 seems to fix the long-standing bug of dreload() failing to work
2166 for dotted names. But this module is pretty tricky, so I may have
2170 for dotted names. But this module is pretty tricky, so I may have
2167 missed some subtlety. Needs more testing!.
2171 missed some subtlety. Needs more testing!.
2168
2172
2169 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2173 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2170 exceptions which have badly implemented __str__ methods.
2174 exceptions which have badly implemented __str__ methods.
2171 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2175 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2172 which I've been getting reports about from Python 2.3 users. I
2176 which I've been getting reports about from Python 2.3 users. I
2173 wish I had a simple test case to reproduce the problem, so I could
2177 wish I had a simple test case to reproduce the problem, so I could
2174 either write a cleaner workaround or file a bug report if
2178 either write a cleaner workaround or file a bug report if
2175 necessary.
2179 necessary.
2176
2180
2177 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2181 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2178 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2182 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2179 a bug report by Tjabo Kloppenburg.
2183 a bug report by Tjabo Kloppenburg.
2180
2184
2181 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2185 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2182 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2186 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2183 seems rather unstable. Thanks to a bug report by Tjabo
2187 seems rather unstable. Thanks to a bug report by Tjabo
2184 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2188 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2185
2189
2186 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2190 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2187 this out soon because of the critical fixes in the inner loop for
2191 this out soon because of the critical fixes in the inner loop for
2188 generators.
2192 generators.
2189
2193
2190 * IPython/Magic.py (Magic.getargspec): removed. This (and
2194 * IPython/Magic.py (Magic.getargspec): removed. This (and
2191 _get_def) have been obsoleted by OInspect for a long time, I
2195 _get_def) have been obsoleted by OInspect for a long time, I
2192 hadn't noticed that they were dead code.
2196 hadn't noticed that they were dead code.
2193 (Magic._ofind): restored _ofind functionality for a few literals
2197 (Magic._ofind): restored _ofind functionality for a few literals
2194 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2198 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2195 for things like "hello".capitalize?, since that would require a
2199 for things like "hello".capitalize?, since that would require a
2196 potentially dangerous eval() again.
2200 potentially dangerous eval() again.
2197
2201
2198 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2202 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2199 logic a bit more to clean up the escapes handling and minimize the
2203 logic a bit more to clean up the escapes handling and minimize the
2200 use of _ofind to only necessary cases. The interactive 'feel' of
2204 use of _ofind to only necessary cases. The interactive 'feel' of
2201 IPython should have improved quite a bit with the changes in
2205 IPython should have improved quite a bit with the changes in
2202 _prefilter and _ofind (besides being far safer than before).
2206 _prefilter and _ofind (besides being far safer than before).
2203
2207
2204 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2208 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2205 obscure, never reported). Edit would fail to find the object to
2209 obscure, never reported). Edit would fail to find the object to
2206 edit under some circumstances.
2210 edit under some circumstances.
2207 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2211 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2208 which were causing double-calling of generators. Those eval calls
2212 which were causing double-calling of generators. Those eval calls
2209 were _very_ dangerous, since code with side effects could be
2213 were _very_ dangerous, since code with side effects could be
2210 triggered. As they say, 'eval is evil'... These were the
2214 triggered. As they say, 'eval is evil'... These were the
2211 nastiest evals in IPython. Besides, _ofind is now far simpler,
2215 nastiest evals in IPython. Besides, _ofind is now far simpler,
2212 and it should also be quite a bit faster. Its use of inspect is
2216 and it should also be quite a bit faster. Its use of inspect is
2213 also safer, so perhaps some of the inspect-related crashes I've
2217 also safer, so perhaps some of the inspect-related crashes I've
2214 seen lately with Python 2.3 might be taken care of. That will
2218 seen lately with Python 2.3 might be taken care of. That will
2215 need more testing.
2219 need more testing.
2216
2220
2217 2003-08-17 Fernando Perez <fperez@colorado.edu>
2221 2003-08-17 Fernando Perez <fperez@colorado.edu>
2218
2222
2219 * IPython/iplib.py (InteractiveShell._prefilter): significant
2223 * IPython/iplib.py (InteractiveShell._prefilter): significant
2220 simplifications to the logic for handling user escapes. Faster
2224 simplifications to the logic for handling user escapes. Faster
2221 and simpler code.
2225 and simpler code.
2222
2226
2223 2003-08-14 Fernando Perez <fperez@colorado.edu>
2227 2003-08-14 Fernando Perez <fperez@colorado.edu>
2224
2228
2225 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2229 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2226 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2230 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2227 but it should be quite a bit faster. And the recursive version
2231 but it should be quite a bit faster. And the recursive version
2228 generated O(log N) intermediate storage for all rank>1 arrays,
2232 generated O(log N) intermediate storage for all rank>1 arrays,
2229 even if they were contiguous.
2233 even if they were contiguous.
2230 (l1norm): Added this function.
2234 (l1norm): Added this function.
2231 (norm): Added this function for arbitrary norms (including
2235 (norm): Added this function for arbitrary norms (including
2232 l-infinity). l1 and l2 are still special cases for convenience
2236 l-infinity). l1 and l2 are still special cases for convenience
2233 and speed.
2237 and speed.
2234
2238
2235 2003-08-03 Fernando Perez <fperez@colorado.edu>
2239 2003-08-03 Fernando Perez <fperez@colorado.edu>
2236
2240
2237 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2241 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2238 exceptions, which now raise PendingDeprecationWarnings in Python
2242 exceptions, which now raise PendingDeprecationWarnings in Python
2239 2.3. There were some in Magic and some in Gnuplot2.
2243 2.3. There were some in Magic and some in Gnuplot2.
2240
2244
2241 2003-06-30 Fernando Perez <fperez@colorado.edu>
2245 2003-06-30 Fernando Perez <fperez@colorado.edu>
2242
2246
2243 * IPython/genutils.py (page): modified to call curses only for
2247 * IPython/genutils.py (page): modified to call curses only for
2244 terminals where TERM=='xterm'. After problems under many other
2248 terminals where TERM=='xterm'. After problems under many other
2245 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2249 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2246
2250
2247 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2251 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2248 would be triggered when readline was absent. This was just an old
2252 would be triggered when readline was absent. This was just an old
2249 debugging statement I'd forgotten to take out.
2253 debugging statement I'd forgotten to take out.
2250
2254
2251 2003-06-20 Fernando Perez <fperez@colorado.edu>
2255 2003-06-20 Fernando Perez <fperez@colorado.edu>
2252
2256
2253 * IPython/genutils.py (clock): modified to return only user time
2257 * IPython/genutils.py (clock): modified to return only user time
2254 (not counting system time), after a discussion on scipy. While
2258 (not counting system time), after a discussion on scipy. While
2255 system time may be a useful quantity occasionally, it may much
2259 system time may be a useful quantity occasionally, it may much
2256 more easily be skewed by occasional swapping or other similar
2260 more easily be skewed by occasional swapping or other similar
2257 activity.
2261 activity.
2258
2262
2259 2003-06-05 Fernando Perez <fperez@colorado.edu>
2263 2003-06-05 Fernando Perez <fperez@colorado.edu>
2260
2264
2261 * IPython/numutils.py (identity): new function, for building
2265 * IPython/numutils.py (identity): new function, for building
2262 arbitrary rank Kronecker deltas (mostly backwards compatible with
2266 arbitrary rank Kronecker deltas (mostly backwards compatible with
2263 Numeric.identity)
2267 Numeric.identity)
2264
2268
2265 2003-06-03 Fernando Perez <fperez@colorado.edu>
2269 2003-06-03 Fernando Perez <fperez@colorado.edu>
2266
2270
2267 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2271 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2268 arguments passed to magics with spaces, to allow trailing '\' to
2272 arguments passed to magics with spaces, to allow trailing '\' to
2269 work normally (mainly for Windows users).
2273 work normally (mainly for Windows users).
2270
2274
2271 2003-05-29 Fernando Perez <fperez@colorado.edu>
2275 2003-05-29 Fernando Perez <fperez@colorado.edu>
2272
2276
2273 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2277 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2274 instead of pydoc.help. This fixes a bizarre behavior where
2278 instead of pydoc.help. This fixes a bizarre behavior where
2275 printing '%s' % locals() would trigger the help system. Now
2279 printing '%s' % locals() would trigger the help system. Now
2276 ipython behaves like normal python does.
2280 ipython behaves like normal python does.
2277
2281
2278 Note that if one does 'from pydoc import help', the bizarre
2282 Note that if one does 'from pydoc import help', the bizarre
2279 behavior returns, but this will also happen in normal python, so
2283 behavior returns, but this will also happen in normal python, so
2280 it's not an ipython bug anymore (it has to do with how pydoc.help
2284 it's not an ipython bug anymore (it has to do with how pydoc.help
2281 is implemented).
2285 is implemented).
2282
2286
2283 2003-05-22 Fernando Perez <fperez@colorado.edu>
2287 2003-05-22 Fernando Perez <fperez@colorado.edu>
2284
2288
2285 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2289 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2286 return [] instead of None when nothing matches, also match to end
2290 return [] instead of None when nothing matches, also match to end
2287 of line. Patch by Gary Bishop.
2291 of line. Patch by Gary Bishop.
2288
2292
2289 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2293 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2290 protection as before, for files passed on the command line. This
2294 protection as before, for files passed on the command line. This
2291 prevents the CrashHandler from kicking in if user files call into
2295 prevents the CrashHandler from kicking in if user files call into
2292 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2296 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2293 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2297 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2294
2298
2295 2003-05-20 *** Released version 0.4.0
2299 2003-05-20 *** Released version 0.4.0
2296
2300
2297 2003-05-20 Fernando Perez <fperez@colorado.edu>
2301 2003-05-20 Fernando Perez <fperez@colorado.edu>
2298
2302
2299 * setup.py: added support for manpages. It's a bit hackish b/c of
2303 * setup.py: added support for manpages. It's a bit hackish b/c of
2300 a bug in the way the bdist_rpm distutils target handles gzipped
2304 a bug in the way the bdist_rpm distutils target handles gzipped
2301 manpages, but it works. After a patch by Jack.
2305 manpages, but it works. After a patch by Jack.
2302
2306
2303 2003-05-19 Fernando Perez <fperez@colorado.edu>
2307 2003-05-19 Fernando Perez <fperez@colorado.edu>
2304
2308
2305 * IPython/numutils.py: added a mockup of the kinds module, since
2309 * IPython/numutils.py: added a mockup of the kinds module, since
2306 it was recently removed from Numeric. This way, numutils will
2310 it was recently removed from Numeric. This way, numutils will
2307 work for all users even if they are missing kinds.
2311 work for all users even if they are missing kinds.
2308
2312
2309 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2313 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2310 failure, which can occur with SWIG-wrapped extensions. After a
2314 failure, which can occur with SWIG-wrapped extensions. After a
2311 crash report from Prabhu.
2315 crash report from Prabhu.
2312
2316
2313 2003-05-16 Fernando Perez <fperez@colorado.edu>
2317 2003-05-16 Fernando Perez <fperez@colorado.edu>
2314
2318
2315 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2319 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2316 protect ipython from user code which may call directly
2320 protect ipython from user code which may call directly
2317 sys.excepthook (this looks like an ipython crash to the user, even
2321 sys.excepthook (this looks like an ipython crash to the user, even
2318 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2322 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2319 This is especially important to help users of WxWindows, but may
2323 This is especially important to help users of WxWindows, but may
2320 also be useful in other cases.
2324 also be useful in other cases.
2321
2325
2322 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2326 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2323 an optional tb_offset to be specified, and to preserve exception
2327 an optional tb_offset to be specified, and to preserve exception
2324 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2328 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2325
2329
2326 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2330 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2327
2331
2328 2003-05-15 Fernando Perez <fperez@colorado.edu>
2332 2003-05-15 Fernando Perez <fperez@colorado.edu>
2329
2333
2330 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2334 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2331 installing for a new user under Windows.
2335 installing for a new user under Windows.
2332
2336
2333 2003-05-12 Fernando Perez <fperez@colorado.edu>
2337 2003-05-12 Fernando Perez <fperez@colorado.edu>
2334
2338
2335 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2339 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2336 handler for Emacs comint-based lines. Currently it doesn't do
2340 handler for Emacs comint-based lines. Currently it doesn't do
2337 much (but importantly, it doesn't update the history cache). In
2341 much (but importantly, it doesn't update the history cache). In
2338 the future it may be expanded if Alex needs more functionality
2342 the future it may be expanded if Alex needs more functionality
2339 there.
2343 there.
2340
2344
2341 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2345 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2342 info to crash reports.
2346 info to crash reports.
2343
2347
2344 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2348 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2345 just like Python's -c. Also fixed crash with invalid -color
2349 just like Python's -c. Also fixed crash with invalid -color
2346 option value at startup. Thanks to Will French
2350 option value at startup. Thanks to Will French
2347 <wfrench-AT-bestweb.net> for the bug report.
2351 <wfrench-AT-bestweb.net> for the bug report.
2348
2352
2349 2003-05-09 Fernando Perez <fperez@colorado.edu>
2353 2003-05-09 Fernando Perez <fperez@colorado.edu>
2350
2354
2351 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2355 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2352 to EvalDict (it's a mapping, after all) and simplified its code
2356 to EvalDict (it's a mapping, after all) and simplified its code
2353 quite a bit, after a nice discussion on c.l.py where Gustavo
2357 quite a bit, after a nice discussion on c.l.py where Gustavo
2354 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2358 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2355
2359
2356 2003-04-30 Fernando Perez <fperez@colorado.edu>
2360 2003-04-30 Fernando Perez <fperez@colorado.edu>
2357
2361
2358 * IPython/genutils.py (timings_out): modified it to reduce its
2362 * IPython/genutils.py (timings_out): modified it to reduce its
2359 overhead in the common reps==1 case.
2363 overhead in the common reps==1 case.
2360
2364
2361 2003-04-29 Fernando Perez <fperez@colorado.edu>
2365 2003-04-29 Fernando Perez <fperez@colorado.edu>
2362
2366
2363 * IPython/genutils.py (timings_out): Modified to use the resource
2367 * IPython/genutils.py (timings_out): Modified to use the resource
2364 module, which avoids the wraparound problems of time.clock().
2368 module, which avoids the wraparound problems of time.clock().
2365
2369
2366 2003-04-17 *** Released version 0.2.15pre4
2370 2003-04-17 *** Released version 0.2.15pre4
2367
2371
2368 2003-04-17 Fernando Perez <fperez@colorado.edu>
2372 2003-04-17 Fernando Perez <fperez@colorado.edu>
2369
2373
2370 * setup.py (scriptfiles): Split windows-specific stuff over to a
2374 * setup.py (scriptfiles): Split windows-specific stuff over to a
2371 separate file, in an attempt to have a Windows GUI installer.
2375 separate file, in an attempt to have a Windows GUI installer.
2372 That didn't work, but part of the groundwork is done.
2376 That didn't work, but part of the groundwork is done.
2373
2377
2374 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2378 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2375 indent/unindent with 4 spaces. Particularly useful in combination
2379 indent/unindent with 4 spaces. Particularly useful in combination
2376 with the new auto-indent option.
2380 with the new auto-indent option.
2377
2381
2378 2003-04-16 Fernando Perez <fperez@colorado.edu>
2382 2003-04-16 Fernando Perez <fperez@colorado.edu>
2379
2383
2380 * IPython/Magic.py: various replacements of self.rc for
2384 * IPython/Magic.py: various replacements of self.rc for
2381 self.shell.rc. A lot more remains to be done to fully disentangle
2385 self.shell.rc. A lot more remains to be done to fully disentangle
2382 this class from the main Shell class.
2386 this class from the main Shell class.
2383
2387
2384 * IPython/GnuplotRuntime.py: added checks for mouse support so
2388 * IPython/GnuplotRuntime.py: added checks for mouse support so
2385 that we don't try to enable it if the current gnuplot doesn't
2389 that we don't try to enable it if the current gnuplot doesn't
2386 really support it. Also added checks so that we don't try to
2390 really support it. Also added checks so that we don't try to
2387 enable persist under Windows (where Gnuplot doesn't recognize the
2391 enable persist under Windows (where Gnuplot doesn't recognize the
2388 option).
2392 option).
2389
2393
2390 * IPython/iplib.py (InteractiveShell.interact): Added optional
2394 * IPython/iplib.py (InteractiveShell.interact): Added optional
2391 auto-indenting code, after a patch by King C. Shu
2395 auto-indenting code, after a patch by King C. Shu
2392 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2396 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2393 get along well with pasting indented code. If I ever figure out
2397 get along well with pasting indented code. If I ever figure out
2394 how to make that part go well, it will become on by default.
2398 how to make that part go well, it will become on by default.
2395
2399
2396 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2400 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2397 crash ipython if there was an unmatched '%' in the user's prompt
2401 crash ipython if there was an unmatched '%' in the user's prompt
2398 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2402 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2399
2403
2400 * IPython/iplib.py (InteractiveShell.interact): removed the
2404 * IPython/iplib.py (InteractiveShell.interact): removed the
2401 ability to ask the user whether he wants to crash or not at the
2405 ability to ask the user whether he wants to crash or not at the
2402 'last line' exception handler. Calling functions at that point
2406 'last line' exception handler. Calling functions at that point
2403 changes the stack, and the error reports would have incorrect
2407 changes the stack, and the error reports would have incorrect
2404 tracebacks.
2408 tracebacks.
2405
2409
2406 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2410 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2407 pass through a peger a pretty-printed form of any object. After a
2411 pass through a peger a pretty-printed form of any object. After a
2408 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2412 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2409
2413
2410 2003-04-14 Fernando Perez <fperez@colorado.edu>
2414 2003-04-14 Fernando Perez <fperez@colorado.edu>
2411
2415
2412 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2416 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2413 all files in ~ would be modified at first install (instead of
2417 all files in ~ would be modified at first install (instead of
2414 ~/.ipython). This could be potentially disastrous, as the
2418 ~/.ipython). This could be potentially disastrous, as the
2415 modification (make line-endings native) could damage binary files.
2419 modification (make line-endings native) could damage binary files.
2416
2420
2417 2003-04-10 Fernando Perez <fperez@colorado.edu>
2421 2003-04-10 Fernando Perez <fperez@colorado.edu>
2418
2422
2419 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2423 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2420 handle only lines which are invalid python. This now means that
2424 handle only lines which are invalid python. This now means that
2421 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2425 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2422 for the bug report.
2426 for the bug report.
2423
2427
2424 2003-04-01 Fernando Perez <fperez@colorado.edu>
2428 2003-04-01 Fernando Perez <fperez@colorado.edu>
2425
2429
2426 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2430 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2427 where failing to set sys.last_traceback would crash pdb.pm().
2431 where failing to set sys.last_traceback would crash pdb.pm().
2428 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2432 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2429 report.
2433 report.
2430
2434
2431 2003-03-25 Fernando Perez <fperez@colorado.edu>
2435 2003-03-25 Fernando Perez <fperez@colorado.edu>
2432
2436
2433 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2437 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2434 before printing it (it had a lot of spurious blank lines at the
2438 before printing it (it had a lot of spurious blank lines at the
2435 end).
2439 end).
2436
2440
2437 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2441 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2438 output would be sent 21 times! Obviously people don't use this
2442 output would be sent 21 times! Obviously people don't use this
2439 too often, or I would have heard about it.
2443 too often, or I would have heard about it.
2440
2444
2441 2003-03-24 Fernando Perez <fperez@colorado.edu>
2445 2003-03-24 Fernando Perez <fperez@colorado.edu>
2442
2446
2443 * setup.py (scriptfiles): renamed the data_files parameter from
2447 * setup.py (scriptfiles): renamed the data_files parameter from
2444 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2448 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2445 for the patch.
2449 for the patch.
2446
2450
2447 2003-03-20 Fernando Perez <fperez@colorado.edu>
2451 2003-03-20 Fernando Perez <fperez@colorado.edu>
2448
2452
2449 * IPython/genutils.py (error): added error() and fatal()
2453 * IPython/genutils.py (error): added error() and fatal()
2450 functions.
2454 functions.
2451
2455
2452 2003-03-18 *** Released version 0.2.15pre3
2456 2003-03-18 *** Released version 0.2.15pre3
2453
2457
2454 2003-03-18 Fernando Perez <fperez@colorado.edu>
2458 2003-03-18 Fernando Perez <fperez@colorado.edu>
2455
2459
2456 * setupext/install_data_ext.py
2460 * setupext/install_data_ext.py
2457 (install_data_ext.initialize_options): Class contributed by Jack
2461 (install_data_ext.initialize_options): Class contributed by Jack
2458 Moffit for fixing the old distutils hack. He is sending this to
2462 Moffit for fixing the old distutils hack. He is sending this to
2459 the distutils folks so in the future we may not need it as a
2463 the distutils folks so in the future we may not need it as a
2460 private fix.
2464 private fix.
2461
2465
2462 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2466 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2463 changes for Debian packaging. See his patch for full details.
2467 changes for Debian packaging. See his patch for full details.
2464 The old distutils hack of making the ipythonrc* files carry a
2468 The old distutils hack of making the ipythonrc* files carry a
2465 bogus .py extension is gone, at last. Examples were moved to a
2469 bogus .py extension is gone, at last. Examples were moved to a
2466 separate subdir under doc/, and the separate executable scripts
2470 separate subdir under doc/, and the separate executable scripts
2467 now live in their own directory. Overall a great cleanup. The
2471 now live in their own directory. Overall a great cleanup. The
2468 manual was updated to use the new files, and setup.py has been
2472 manual was updated to use the new files, and setup.py has been
2469 fixed for this setup.
2473 fixed for this setup.
2470
2474
2471 * IPython/PyColorize.py (Parser.usage): made non-executable and
2475 * IPython/PyColorize.py (Parser.usage): made non-executable and
2472 created a pycolor wrapper around it to be included as a script.
2476 created a pycolor wrapper around it to be included as a script.
2473
2477
2474 2003-03-12 *** Released version 0.2.15pre2
2478 2003-03-12 *** Released version 0.2.15pre2
2475
2479
2476 2003-03-12 Fernando Perez <fperez@colorado.edu>
2480 2003-03-12 Fernando Perez <fperez@colorado.edu>
2477
2481
2478 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2482 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2479 long-standing problem with garbage characters in some terminals.
2483 long-standing problem with garbage characters in some terminals.
2480 The issue was really that the \001 and \002 escapes must _only_ be
2484 The issue was really that the \001 and \002 escapes must _only_ be
2481 passed to input prompts (which call readline), but _never_ to
2485 passed to input prompts (which call readline), but _never_ to
2482 normal text to be printed on screen. I changed ColorANSI to have
2486 normal text to be printed on screen. I changed ColorANSI to have
2483 two classes: TermColors and InputTermColors, each with the
2487 two classes: TermColors and InputTermColors, each with the
2484 appropriate escapes for input prompts or normal text. The code in
2488 appropriate escapes for input prompts or normal text. The code in
2485 Prompts.py got slightly more complicated, but this very old and
2489 Prompts.py got slightly more complicated, but this very old and
2486 annoying bug is finally fixed.
2490 annoying bug is finally fixed.
2487
2491
2488 All the credit for nailing down the real origin of this problem
2492 All the credit for nailing down the real origin of this problem
2489 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2493 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2490 *Many* thanks to him for spending quite a bit of effort on this.
2494 *Many* thanks to him for spending quite a bit of effort on this.
2491
2495
2492 2003-03-05 *** Released version 0.2.15pre1
2496 2003-03-05 *** Released version 0.2.15pre1
2493
2497
2494 2003-03-03 Fernando Perez <fperez@colorado.edu>
2498 2003-03-03 Fernando Perez <fperez@colorado.edu>
2495
2499
2496 * IPython/FakeModule.py: Moved the former _FakeModule to a
2500 * IPython/FakeModule.py: Moved the former _FakeModule to a
2497 separate file, because it's also needed by Magic (to fix a similar
2501 separate file, because it's also needed by Magic (to fix a similar
2498 pickle-related issue in @run).
2502 pickle-related issue in @run).
2499
2503
2500 2003-03-02 Fernando Perez <fperez@colorado.edu>
2504 2003-03-02 Fernando Perez <fperez@colorado.edu>
2501
2505
2502 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2506 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2503 the autocall option at runtime.
2507 the autocall option at runtime.
2504 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2508 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2505 across Magic.py to start separating Magic from InteractiveShell.
2509 across Magic.py to start separating Magic from InteractiveShell.
2506 (Magic._ofind): Fixed to return proper namespace for dotted
2510 (Magic._ofind): Fixed to return proper namespace for dotted
2507 names. Before, a dotted name would always return 'not currently
2511 names. Before, a dotted name would always return 'not currently
2508 defined', because it would find the 'parent'. s.x would be found,
2512 defined', because it would find the 'parent'. s.x would be found,
2509 but since 'x' isn't defined by itself, it would get confused.
2513 but since 'x' isn't defined by itself, it would get confused.
2510 (Magic.magic_run): Fixed pickling problems reported by Ralf
2514 (Magic.magic_run): Fixed pickling problems reported by Ralf
2511 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2515 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2512 that I'd used when Mike Heeter reported similar issues at the
2516 that I'd used when Mike Heeter reported similar issues at the
2513 top-level, but now for @run. It boils down to injecting the
2517 top-level, but now for @run. It boils down to injecting the
2514 namespace where code is being executed with something that looks
2518 namespace where code is being executed with something that looks
2515 enough like a module to fool pickle.dump(). Since a pickle stores
2519 enough like a module to fool pickle.dump(). Since a pickle stores
2516 a named reference to the importing module, we need this for
2520 a named reference to the importing module, we need this for
2517 pickles to save something sensible.
2521 pickles to save something sensible.
2518
2522
2519 * IPython/ipmaker.py (make_IPython): added an autocall option.
2523 * IPython/ipmaker.py (make_IPython): added an autocall option.
2520
2524
2521 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2525 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2522 the auto-eval code. Now autocalling is an option, and the code is
2526 the auto-eval code. Now autocalling is an option, and the code is
2523 also vastly safer. There is no more eval() involved at all.
2527 also vastly safer. There is no more eval() involved at all.
2524
2528
2525 2003-03-01 Fernando Perez <fperez@colorado.edu>
2529 2003-03-01 Fernando Perez <fperez@colorado.edu>
2526
2530
2527 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2531 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2528 dict with named keys instead of a tuple.
2532 dict with named keys instead of a tuple.
2529
2533
2530 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2534 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2531
2535
2532 * setup.py (make_shortcut): Fixed message about directories
2536 * setup.py (make_shortcut): Fixed message about directories
2533 created during Windows installation (the directories were ok, just
2537 created during Windows installation (the directories were ok, just
2534 the printed message was misleading). Thanks to Chris Liechti
2538 the printed message was misleading). Thanks to Chris Liechti
2535 <cliechti-AT-gmx.net> for the heads up.
2539 <cliechti-AT-gmx.net> for the heads up.
2536
2540
2537 2003-02-21 Fernando Perez <fperez@colorado.edu>
2541 2003-02-21 Fernando Perez <fperez@colorado.edu>
2538
2542
2539 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2543 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2540 of ValueError exception when checking for auto-execution. This
2544 of ValueError exception when checking for auto-execution. This
2541 one is raised by things like Numeric arrays arr.flat when the
2545 one is raised by things like Numeric arrays arr.flat when the
2542 array is non-contiguous.
2546 array is non-contiguous.
2543
2547
2544 2003-01-31 Fernando Perez <fperez@colorado.edu>
2548 2003-01-31 Fernando Perez <fperez@colorado.edu>
2545
2549
2546 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2550 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2547 not return any value at all (even though the command would get
2551 not return any value at all (even though the command would get
2548 executed).
2552 executed).
2549 (xsys): Flush stdout right after printing the command to ensure
2553 (xsys): Flush stdout right after printing the command to ensure
2550 proper ordering of commands and command output in the total
2554 proper ordering of commands and command output in the total
2551 output.
2555 output.
2552 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2556 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2553 system/getoutput as defaults. The old ones are kept for
2557 system/getoutput as defaults. The old ones are kept for
2554 compatibility reasons, so no code which uses this library needs
2558 compatibility reasons, so no code which uses this library needs
2555 changing.
2559 changing.
2556
2560
2557 2003-01-27 *** Released version 0.2.14
2561 2003-01-27 *** Released version 0.2.14
2558
2562
2559 2003-01-25 Fernando Perez <fperez@colorado.edu>
2563 2003-01-25 Fernando Perez <fperez@colorado.edu>
2560
2564
2561 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2565 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2562 functions defined in previous edit sessions could not be re-edited
2566 functions defined in previous edit sessions could not be re-edited
2563 (because the temp files were immediately removed). Now temp files
2567 (because the temp files were immediately removed). Now temp files
2564 are removed only at IPython's exit.
2568 are removed only at IPython's exit.
2565 (Magic.magic_run): Improved @run to perform shell-like expansions
2569 (Magic.magic_run): Improved @run to perform shell-like expansions
2566 on its arguments (~users and $VARS). With this, @run becomes more
2570 on its arguments (~users and $VARS). With this, @run becomes more
2567 like a normal command-line.
2571 like a normal command-line.
2568
2572
2569 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2573 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2570 bugs related to embedding and cleaned up that code. A fairly
2574 bugs related to embedding and cleaned up that code. A fairly
2571 important one was the impossibility to access the global namespace
2575 important one was the impossibility to access the global namespace
2572 through the embedded IPython (only local variables were visible).
2576 through the embedded IPython (only local variables were visible).
2573
2577
2574 2003-01-14 Fernando Perez <fperez@colorado.edu>
2578 2003-01-14 Fernando Perez <fperez@colorado.edu>
2575
2579
2576 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2580 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2577 auto-calling to be a bit more conservative. Now it doesn't get
2581 auto-calling to be a bit more conservative. Now it doesn't get
2578 triggered if any of '!=()<>' are in the rest of the input line, to
2582 triggered if any of '!=()<>' are in the rest of the input line, to
2579 allow comparing callables. Thanks to Alex for the heads up.
2583 allow comparing callables. Thanks to Alex for the heads up.
2580
2584
2581 2003-01-07 Fernando Perez <fperez@colorado.edu>
2585 2003-01-07 Fernando Perez <fperez@colorado.edu>
2582
2586
2583 * IPython/genutils.py (page): fixed estimation of the number of
2587 * IPython/genutils.py (page): fixed estimation of the number of
2584 lines in a string to be paged to simply count newlines. This
2588 lines in a string to be paged to simply count newlines. This
2585 prevents over-guessing due to embedded escape sequences. A better
2589 prevents over-guessing due to embedded escape sequences. A better
2586 long-term solution would involve stripping out the control chars
2590 long-term solution would involve stripping out the control chars
2587 for the count, but it's potentially so expensive I just don't
2591 for the count, but it's potentially so expensive I just don't
2588 think it's worth doing.
2592 think it's worth doing.
2589
2593
2590 2002-12-19 *** Released version 0.2.14pre50
2594 2002-12-19 *** Released version 0.2.14pre50
2591
2595
2592 2002-12-19 Fernando Perez <fperez@colorado.edu>
2596 2002-12-19 Fernando Perez <fperez@colorado.edu>
2593
2597
2594 * tools/release (version): Changed release scripts to inform
2598 * tools/release (version): Changed release scripts to inform
2595 Andrea and build a NEWS file with a list of recent changes.
2599 Andrea and build a NEWS file with a list of recent changes.
2596
2600
2597 * IPython/ColorANSI.py (__all__): changed terminal detection
2601 * IPython/ColorANSI.py (__all__): changed terminal detection
2598 code. Seems to work better for xterms without breaking
2602 code. Seems to work better for xterms without breaking
2599 konsole. Will need more testing to determine if WinXP and Mac OSX
2603 konsole. Will need more testing to determine if WinXP and Mac OSX
2600 also work ok.
2604 also work ok.
2601
2605
2602 2002-12-18 *** Released version 0.2.14pre49
2606 2002-12-18 *** Released version 0.2.14pre49
2603
2607
2604 2002-12-18 Fernando Perez <fperez@colorado.edu>
2608 2002-12-18 Fernando Perez <fperez@colorado.edu>
2605
2609
2606 * Docs: added new info about Mac OSX, from Andrea.
2610 * Docs: added new info about Mac OSX, from Andrea.
2607
2611
2608 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2612 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2609 allow direct plotting of python strings whose format is the same
2613 allow direct plotting of python strings whose format is the same
2610 of gnuplot data files.
2614 of gnuplot data files.
2611
2615
2612 2002-12-16 Fernando Perez <fperez@colorado.edu>
2616 2002-12-16 Fernando Perez <fperez@colorado.edu>
2613
2617
2614 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2618 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2615 value of exit question to be acknowledged.
2619 value of exit question to be acknowledged.
2616
2620
2617 2002-12-03 Fernando Perez <fperez@colorado.edu>
2621 2002-12-03 Fernando Perez <fperez@colorado.edu>
2618
2622
2619 * IPython/ipmaker.py: removed generators, which had been added
2623 * IPython/ipmaker.py: removed generators, which had been added
2620 by mistake in an earlier debugging run. This was causing trouble
2624 by mistake in an earlier debugging run. This was causing trouble
2621 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2625 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2622 for pointing this out.
2626 for pointing this out.
2623
2627
2624 2002-11-17 Fernando Perez <fperez@colorado.edu>
2628 2002-11-17 Fernando Perez <fperez@colorado.edu>
2625
2629
2626 * Manual: updated the Gnuplot section.
2630 * Manual: updated the Gnuplot section.
2627
2631
2628 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2632 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2629 a much better split of what goes in Runtime and what goes in
2633 a much better split of what goes in Runtime and what goes in
2630 Interactive.
2634 Interactive.
2631
2635
2632 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2636 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2633 being imported from iplib.
2637 being imported from iplib.
2634
2638
2635 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2639 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2636 for command-passing. Now the global Gnuplot instance is called
2640 for command-passing. Now the global Gnuplot instance is called
2637 'gp' instead of 'g', which was really a far too fragile and
2641 'gp' instead of 'g', which was really a far too fragile and
2638 common name.
2642 common name.
2639
2643
2640 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2644 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2641 bounding boxes generated by Gnuplot for square plots.
2645 bounding boxes generated by Gnuplot for square plots.
2642
2646
2643 * IPython/genutils.py (popkey): new function added. I should
2647 * IPython/genutils.py (popkey): new function added. I should
2644 suggest this on c.l.py as a dict method, it seems useful.
2648 suggest this on c.l.py as a dict method, it seems useful.
2645
2649
2646 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2650 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2647 to transparently handle PostScript generation. MUCH better than
2651 to transparently handle PostScript generation. MUCH better than
2648 the previous plot_eps/replot_eps (which I removed now). The code
2652 the previous plot_eps/replot_eps (which I removed now). The code
2649 is also fairly clean and well documented now (including
2653 is also fairly clean and well documented now (including
2650 docstrings).
2654 docstrings).
2651
2655
2652 2002-11-13 Fernando Perez <fperez@colorado.edu>
2656 2002-11-13 Fernando Perez <fperez@colorado.edu>
2653
2657
2654 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2658 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2655 (inconsistent with options).
2659 (inconsistent with options).
2656
2660
2657 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2661 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2658 manually disabled, I don't know why. Fixed it.
2662 manually disabled, I don't know why. Fixed it.
2659 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2663 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2660 eps output.
2664 eps output.
2661
2665
2662 2002-11-12 Fernando Perez <fperez@colorado.edu>
2666 2002-11-12 Fernando Perez <fperez@colorado.edu>
2663
2667
2664 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2668 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2665 don't propagate up to caller. Fixes crash reported by François
2669 don't propagate up to caller. Fixes crash reported by François
2666 Pinard.
2670 Pinard.
2667
2671
2668 2002-11-09 Fernando Perez <fperez@colorado.edu>
2672 2002-11-09 Fernando Perez <fperez@colorado.edu>
2669
2673
2670 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2674 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2671 history file for new users.
2675 history file for new users.
2672 (make_IPython): fixed bug where initial install would leave the
2676 (make_IPython): fixed bug where initial install would leave the
2673 user running in the .ipython dir.
2677 user running in the .ipython dir.
2674 (make_IPython): fixed bug where config dir .ipython would be
2678 (make_IPython): fixed bug where config dir .ipython would be
2675 created regardless of the given -ipythondir option. Thanks to Cory
2679 created regardless of the given -ipythondir option. Thanks to Cory
2676 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2680 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2677
2681
2678 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2682 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2679 type confirmations. Will need to use it in all of IPython's code
2683 type confirmations. Will need to use it in all of IPython's code
2680 consistently.
2684 consistently.
2681
2685
2682 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2686 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2683 context to print 31 lines instead of the default 5. This will make
2687 context to print 31 lines instead of the default 5. This will make
2684 the crash reports extremely detailed in case the problem is in
2688 the crash reports extremely detailed in case the problem is in
2685 libraries I don't have access to.
2689 libraries I don't have access to.
2686
2690
2687 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2691 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2688 line of defense' code to still crash, but giving users fair
2692 line of defense' code to still crash, but giving users fair
2689 warning. I don't want internal errors to go unreported: if there's
2693 warning. I don't want internal errors to go unreported: if there's
2690 an internal problem, IPython should crash and generate a full
2694 an internal problem, IPython should crash and generate a full
2691 report.
2695 report.
2692
2696
2693 2002-11-08 Fernando Perez <fperez@colorado.edu>
2697 2002-11-08 Fernando Perez <fperez@colorado.edu>
2694
2698
2695 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2699 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2696 otherwise uncaught exceptions which can appear if people set
2700 otherwise uncaught exceptions which can appear if people set
2697 sys.stdout to something badly broken. Thanks to a crash report
2701 sys.stdout to something badly broken. Thanks to a crash report
2698 from henni-AT-mail.brainbot.com.
2702 from henni-AT-mail.brainbot.com.
2699
2703
2700 2002-11-04 Fernando Perez <fperez@colorado.edu>
2704 2002-11-04 Fernando Perez <fperez@colorado.edu>
2701
2705
2702 * IPython/iplib.py (InteractiveShell.interact): added
2706 * IPython/iplib.py (InteractiveShell.interact): added
2703 __IPYTHON__active to the builtins. It's a flag which goes on when
2707 __IPYTHON__active to the builtins. It's a flag which goes on when
2704 the interaction starts and goes off again when it stops. This
2708 the interaction starts and goes off again when it stops. This
2705 allows embedding code to detect being inside IPython. Before this
2709 allows embedding code to detect being inside IPython. Before this
2706 was done via __IPYTHON__, but that only shows that an IPython
2710 was done via __IPYTHON__, but that only shows that an IPython
2707 instance has been created.
2711 instance has been created.
2708
2712
2709 * IPython/Magic.py (Magic.magic_env): I realized that in a
2713 * IPython/Magic.py (Magic.magic_env): I realized that in a
2710 UserDict, instance.data holds the data as a normal dict. So I
2714 UserDict, instance.data holds the data as a normal dict. So I
2711 modified @env to return os.environ.data instead of rebuilding a
2715 modified @env to return os.environ.data instead of rebuilding a
2712 dict by hand.
2716 dict by hand.
2713
2717
2714 2002-11-02 Fernando Perez <fperez@colorado.edu>
2718 2002-11-02 Fernando Perez <fperez@colorado.edu>
2715
2719
2716 * IPython/genutils.py (warn): changed so that level 1 prints no
2720 * IPython/genutils.py (warn): changed so that level 1 prints no
2717 header. Level 2 is now the default (with 'WARNING' header, as
2721 header. Level 2 is now the default (with 'WARNING' header, as
2718 before). I think I tracked all places where changes were needed in
2722 before). I think I tracked all places where changes were needed in
2719 IPython, but outside code using the old level numbering may have
2723 IPython, but outside code using the old level numbering may have
2720 broken.
2724 broken.
2721
2725
2722 * IPython/iplib.py (InteractiveShell.runcode): added this to
2726 * IPython/iplib.py (InteractiveShell.runcode): added this to
2723 handle the tracebacks in SystemExit traps correctly. The previous
2727 handle the tracebacks in SystemExit traps correctly. The previous
2724 code (through interact) was printing more of the stack than
2728 code (through interact) was printing more of the stack than
2725 necessary, showing IPython internal code to the user.
2729 necessary, showing IPython internal code to the user.
2726
2730
2727 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2731 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2728 default. Now that the default at the confirmation prompt is yes,
2732 default. Now that the default at the confirmation prompt is yes,
2729 it's not so intrusive. François' argument that ipython sessions
2733 it's not so intrusive. François' argument that ipython sessions
2730 tend to be complex enough not to lose them from an accidental C-d,
2734 tend to be complex enough not to lose them from an accidental C-d,
2731 is a valid one.
2735 is a valid one.
2732
2736
2733 * IPython/iplib.py (InteractiveShell.interact): added a
2737 * IPython/iplib.py (InteractiveShell.interact): added a
2734 showtraceback() call to the SystemExit trap, and modified the exit
2738 showtraceback() call to the SystemExit trap, and modified the exit
2735 confirmation to have yes as the default.
2739 confirmation to have yes as the default.
2736
2740
2737 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2741 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2738 this file. It's been gone from the code for a long time, this was
2742 this file. It's been gone from the code for a long time, this was
2739 simply leftover junk.
2743 simply leftover junk.
2740
2744
2741 2002-11-01 Fernando Perez <fperez@colorado.edu>
2745 2002-11-01 Fernando Perez <fperez@colorado.edu>
2742
2746
2743 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2747 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2744 added. If set, IPython now traps EOF and asks for
2748 added. If set, IPython now traps EOF and asks for
2745 confirmation. After a request by François Pinard.
2749 confirmation. After a request by François Pinard.
2746
2750
2747 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2751 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2748 of @abort, and with a new (better) mechanism for handling the
2752 of @abort, and with a new (better) mechanism for handling the
2749 exceptions.
2753 exceptions.
2750
2754
2751 2002-10-27 Fernando Perez <fperez@colorado.edu>
2755 2002-10-27 Fernando Perez <fperez@colorado.edu>
2752
2756
2753 * IPython/usage.py (__doc__): updated the --help information and
2757 * IPython/usage.py (__doc__): updated the --help information and
2754 the ipythonrc file to indicate that -log generates
2758 the ipythonrc file to indicate that -log generates
2755 ./ipython.log. Also fixed the corresponding info in @logstart.
2759 ./ipython.log. Also fixed the corresponding info in @logstart.
2756 This and several other fixes in the manuals thanks to reports by
2760 This and several other fixes in the manuals thanks to reports by
2757 François Pinard <pinard-AT-iro.umontreal.ca>.
2761 François Pinard <pinard-AT-iro.umontreal.ca>.
2758
2762
2759 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2763 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2760 refer to @logstart (instead of @log, which doesn't exist).
2764 refer to @logstart (instead of @log, which doesn't exist).
2761
2765
2762 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2766 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2763 AttributeError crash. Thanks to Christopher Armstrong
2767 AttributeError crash. Thanks to Christopher Armstrong
2764 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2768 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2765 introduced recently (in 0.2.14pre37) with the fix to the eval
2769 introduced recently (in 0.2.14pre37) with the fix to the eval
2766 problem mentioned below.
2770 problem mentioned below.
2767
2771
2768 2002-10-17 Fernando Perez <fperez@colorado.edu>
2772 2002-10-17 Fernando Perez <fperez@colorado.edu>
2769
2773
2770 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2774 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2771 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2775 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2772
2776
2773 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2777 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2774 this function to fix a problem reported by Alex Schmolck. He saw
2778 this function to fix a problem reported by Alex Schmolck. He saw
2775 it with list comprehensions and generators, which were getting
2779 it with list comprehensions and generators, which were getting
2776 called twice. The real problem was an 'eval' call in testing for
2780 called twice. The real problem was an 'eval' call in testing for
2777 automagic which was evaluating the input line silently.
2781 automagic which was evaluating the input line silently.
2778
2782
2779 This is a potentially very nasty bug, if the input has side
2783 This is a potentially very nasty bug, if the input has side
2780 effects which must not be repeated. The code is much cleaner now,
2784 effects which must not be repeated. The code is much cleaner now,
2781 without any blanket 'except' left and with a regexp test for
2785 without any blanket 'except' left and with a regexp test for
2782 actual function names.
2786 actual function names.
2783
2787
2784 But an eval remains, which I'm not fully comfortable with. I just
2788 But an eval remains, which I'm not fully comfortable with. I just
2785 don't know how to find out if an expression could be a callable in
2789 don't know how to find out if an expression could be a callable in
2786 the user's namespace without doing an eval on the string. However
2790 the user's namespace without doing an eval on the string. However
2787 that string is now much more strictly checked so that no code
2791 that string is now much more strictly checked so that no code
2788 slips by, so the eval should only happen for things that can
2792 slips by, so the eval should only happen for things that can
2789 really be only function/method names.
2793 really be only function/method names.
2790
2794
2791 2002-10-15 Fernando Perez <fperez@colorado.edu>
2795 2002-10-15 Fernando Perez <fperez@colorado.edu>
2792
2796
2793 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2797 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2794 OSX information to main manual, removed README_Mac_OSX file from
2798 OSX information to main manual, removed README_Mac_OSX file from
2795 distribution. Also updated credits for recent additions.
2799 distribution. Also updated credits for recent additions.
2796
2800
2797 2002-10-10 Fernando Perez <fperez@colorado.edu>
2801 2002-10-10 Fernando Perez <fperez@colorado.edu>
2798
2802
2799 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2803 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2800 terminal-related issues. Many thanks to Andrea Riciputi
2804 terminal-related issues. Many thanks to Andrea Riciputi
2801 <andrea.riciputi-AT-libero.it> for writing it.
2805 <andrea.riciputi-AT-libero.it> for writing it.
2802
2806
2803 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2807 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2804 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2808 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2805
2809
2806 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2810 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2807 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2811 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2808 <syver-en-AT-online.no> who both submitted patches for this problem.
2812 <syver-en-AT-online.no> who both submitted patches for this problem.
2809
2813
2810 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2814 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2811 global embedding to make sure that things don't overwrite user
2815 global embedding to make sure that things don't overwrite user
2812 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2816 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2813
2817
2814 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2818 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2815 compatibility. Thanks to Hayden Callow
2819 compatibility. Thanks to Hayden Callow
2816 <h.callow-AT-elec.canterbury.ac.nz>
2820 <h.callow-AT-elec.canterbury.ac.nz>
2817
2821
2818 2002-10-04 Fernando Perez <fperez@colorado.edu>
2822 2002-10-04 Fernando Perez <fperez@colorado.edu>
2819
2823
2820 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2824 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2821 Gnuplot.File objects.
2825 Gnuplot.File objects.
2822
2826
2823 2002-07-23 Fernando Perez <fperez@colorado.edu>
2827 2002-07-23 Fernando Perez <fperez@colorado.edu>
2824
2828
2825 * IPython/genutils.py (timing): Added timings() and timing() for
2829 * IPython/genutils.py (timing): Added timings() and timing() for
2826 quick access to the most commonly needed data, the execution
2830 quick access to the most commonly needed data, the execution
2827 times. Old timing() renamed to timings_out().
2831 times. Old timing() renamed to timings_out().
2828
2832
2829 2002-07-18 Fernando Perez <fperez@colorado.edu>
2833 2002-07-18 Fernando Perez <fperez@colorado.edu>
2830
2834
2831 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2835 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2832 bug with nested instances disrupting the parent's tab completion.
2836 bug with nested instances disrupting the parent's tab completion.
2833
2837
2834 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2838 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2835 all_completions code to begin the emacs integration.
2839 all_completions code to begin the emacs integration.
2836
2840
2837 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2841 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2838 argument to allow titling individual arrays when plotting.
2842 argument to allow titling individual arrays when plotting.
2839
2843
2840 2002-07-15 Fernando Perez <fperez@colorado.edu>
2844 2002-07-15 Fernando Perez <fperez@colorado.edu>
2841
2845
2842 * setup.py (make_shortcut): changed to retrieve the value of
2846 * setup.py (make_shortcut): changed to retrieve the value of
2843 'Program Files' directory from the registry (this value changes in
2847 'Program Files' directory from the registry (this value changes in
2844 non-english versions of Windows). Thanks to Thomas Fanslau
2848 non-english versions of Windows). Thanks to Thomas Fanslau
2845 <tfanslau-AT-gmx.de> for the report.
2849 <tfanslau-AT-gmx.de> for the report.
2846
2850
2847 2002-07-10 Fernando Perez <fperez@colorado.edu>
2851 2002-07-10 Fernando Perez <fperez@colorado.edu>
2848
2852
2849 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2853 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2850 a bug in pdb, which crashes if a line with only whitespace is
2854 a bug in pdb, which crashes if a line with only whitespace is
2851 entered. Bug report submitted to sourceforge.
2855 entered. Bug report submitted to sourceforge.
2852
2856
2853 2002-07-09 Fernando Perez <fperez@colorado.edu>
2857 2002-07-09 Fernando Perez <fperez@colorado.edu>
2854
2858
2855 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2859 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2856 reporting exceptions (it's a bug in inspect.py, I just set a
2860 reporting exceptions (it's a bug in inspect.py, I just set a
2857 workaround).
2861 workaround).
2858
2862
2859 2002-07-08 Fernando Perez <fperez@colorado.edu>
2863 2002-07-08 Fernando Perez <fperez@colorado.edu>
2860
2864
2861 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2865 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2862 __IPYTHON__ in __builtins__ to show up in user_ns.
2866 __IPYTHON__ in __builtins__ to show up in user_ns.
2863
2867
2864 2002-07-03 Fernando Perez <fperez@colorado.edu>
2868 2002-07-03 Fernando Perez <fperez@colorado.edu>
2865
2869
2866 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2870 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2867 name from @gp_set_instance to @gp_set_default.
2871 name from @gp_set_instance to @gp_set_default.
2868
2872
2869 * IPython/ipmaker.py (make_IPython): default editor value set to
2873 * IPython/ipmaker.py (make_IPython): default editor value set to
2870 '0' (a string), to match the rc file. Otherwise will crash when
2874 '0' (a string), to match the rc file. Otherwise will crash when
2871 .strip() is called on it.
2875 .strip() is called on it.
2872
2876
2873
2877
2874 2002-06-28 Fernando Perez <fperez@colorado.edu>
2878 2002-06-28 Fernando Perez <fperez@colorado.edu>
2875
2879
2876 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2880 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2877 of files in current directory when a file is executed via
2881 of files in current directory when a file is executed via
2878 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2882 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2879
2883
2880 * setup.py (manfiles): fix for rpm builds, submitted by RA
2884 * setup.py (manfiles): fix for rpm builds, submitted by RA
2881 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2885 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2882
2886
2883 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2887 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2884 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2888 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2885 string!). A. Schmolck caught this one.
2889 string!). A. Schmolck caught this one.
2886
2890
2887 2002-06-27 Fernando Perez <fperez@colorado.edu>
2891 2002-06-27 Fernando Perez <fperez@colorado.edu>
2888
2892
2889 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2893 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2890 defined files at the cmd line. __name__ wasn't being set to
2894 defined files at the cmd line. __name__ wasn't being set to
2891 __main__.
2895 __main__.
2892
2896
2893 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2897 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2894 regular lists and tuples besides Numeric arrays.
2898 regular lists and tuples besides Numeric arrays.
2895
2899
2896 * IPython/Prompts.py (CachedOutput.__call__): Added output
2900 * IPython/Prompts.py (CachedOutput.__call__): Added output
2897 supression for input ending with ';'. Similar to Mathematica and
2901 supression for input ending with ';'. Similar to Mathematica and
2898 Matlab. The _* vars and Out[] list are still updated, just like
2902 Matlab. The _* vars and Out[] list are still updated, just like
2899 Mathematica behaves.
2903 Mathematica behaves.
2900
2904
2901 2002-06-25 Fernando Perez <fperez@colorado.edu>
2905 2002-06-25 Fernando Perez <fperez@colorado.edu>
2902
2906
2903 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2907 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2904 .ini extensions for profiels under Windows.
2908 .ini extensions for profiels under Windows.
2905
2909
2906 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2910 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2907 string form. Fix contributed by Alexander Schmolck
2911 string form. Fix contributed by Alexander Schmolck
2908 <a.schmolck-AT-gmx.net>
2912 <a.schmolck-AT-gmx.net>
2909
2913
2910 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2914 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2911 pre-configured Gnuplot instance.
2915 pre-configured Gnuplot instance.
2912
2916
2913 2002-06-21 Fernando Perez <fperez@colorado.edu>
2917 2002-06-21 Fernando Perez <fperez@colorado.edu>
2914
2918
2915 * IPython/numutils.py (exp_safe): new function, works around the
2919 * IPython/numutils.py (exp_safe): new function, works around the
2916 underflow problems in Numeric.
2920 underflow problems in Numeric.
2917 (log2): New fn. Safe log in base 2: returns exact integer answer
2921 (log2): New fn. Safe log in base 2: returns exact integer answer
2918 for exact integer powers of 2.
2922 for exact integer powers of 2.
2919
2923
2920 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2924 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2921 properly.
2925 properly.
2922
2926
2923 2002-06-20 Fernando Perez <fperez@colorado.edu>
2927 2002-06-20 Fernando Perez <fperez@colorado.edu>
2924
2928
2925 * IPython/genutils.py (timing): new function like
2929 * IPython/genutils.py (timing): new function like
2926 Mathematica's. Similar to time_test, but returns more info.
2930 Mathematica's. Similar to time_test, but returns more info.
2927
2931
2928 2002-06-18 Fernando Perez <fperez@colorado.edu>
2932 2002-06-18 Fernando Perez <fperez@colorado.edu>
2929
2933
2930 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2934 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2931 according to Mike Heeter's suggestions.
2935 according to Mike Heeter's suggestions.
2932
2936
2933 2002-06-16 Fernando Perez <fperez@colorado.edu>
2937 2002-06-16 Fernando Perez <fperez@colorado.edu>
2934
2938
2935 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2939 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2936 system. GnuplotMagic is gone as a user-directory option. New files
2940 system. GnuplotMagic is gone as a user-directory option. New files
2937 make it easier to use all the gnuplot stuff both from external
2941 make it easier to use all the gnuplot stuff both from external
2938 programs as well as from IPython. Had to rewrite part of
2942 programs as well as from IPython. Had to rewrite part of
2939 hardcopy() b/c of a strange bug: often the ps files simply don't
2943 hardcopy() b/c of a strange bug: often the ps files simply don't
2940 get created, and require a repeat of the command (often several
2944 get created, and require a repeat of the command (often several
2941 times).
2945 times).
2942
2946
2943 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2947 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2944 resolve output channel at call time, so that if sys.stderr has
2948 resolve output channel at call time, so that if sys.stderr has
2945 been redirected by user this gets honored.
2949 been redirected by user this gets honored.
2946
2950
2947 2002-06-13 Fernando Perez <fperez@colorado.edu>
2951 2002-06-13 Fernando Perez <fperez@colorado.edu>
2948
2952
2949 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2953 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2950 IPShell. Kept a copy with the old names to avoid breaking people's
2954 IPShell. Kept a copy with the old names to avoid breaking people's
2951 embedded code.
2955 embedded code.
2952
2956
2953 * IPython/ipython: simplified it to the bare minimum after
2957 * IPython/ipython: simplified it to the bare minimum after
2954 Holger's suggestions. Added info about how to use it in
2958 Holger's suggestions. Added info about how to use it in
2955 PYTHONSTARTUP.
2959 PYTHONSTARTUP.
2956
2960
2957 * IPython/Shell.py (IPythonShell): changed the options passing
2961 * IPython/Shell.py (IPythonShell): changed the options passing
2958 from a string with funky %s replacements to a straight list. Maybe
2962 from a string with funky %s replacements to a straight list. Maybe
2959 a bit more typing, but it follows sys.argv conventions, so there's
2963 a bit more typing, but it follows sys.argv conventions, so there's
2960 less special-casing to remember.
2964 less special-casing to remember.
2961
2965
2962 2002-06-12 Fernando Perez <fperez@colorado.edu>
2966 2002-06-12 Fernando Perez <fperez@colorado.edu>
2963
2967
2964 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2968 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2965 command. Thanks to a suggestion by Mike Heeter.
2969 command. Thanks to a suggestion by Mike Heeter.
2966 (Magic.magic_pfile): added behavior to look at filenames if given
2970 (Magic.magic_pfile): added behavior to look at filenames if given
2967 arg is not a defined object.
2971 arg is not a defined object.
2968 (Magic.magic_save): New @save function to save code snippets. Also
2972 (Magic.magic_save): New @save function to save code snippets. Also
2969 a Mike Heeter idea.
2973 a Mike Heeter idea.
2970
2974
2971 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2975 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2972 plot() and replot(). Much more convenient now, especially for
2976 plot() and replot(). Much more convenient now, especially for
2973 interactive use.
2977 interactive use.
2974
2978
2975 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2979 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2976 filenames.
2980 filenames.
2977
2981
2978 2002-06-02 Fernando Perez <fperez@colorado.edu>
2982 2002-06-02 Fernando Perez <fperez@colorado.edu>
2979
2983
2980 * IPython/Struct.py (Struct.__init__): modified to admit
2984 * IPython/Struct.py (Struct.__init__): modified to admit
2981 initialization via another struct.
2985 initialization via another struct.
2982
2986
2983 * IPython/genutils.py (SystemExec.__init__): New stateful
2987 * IPython/genutils.py (SystemExec.__init__): New stateful
2984 interface to xsys and bq. Useful for writing system scripts.
2988 interface to xsys and bq. Useful for writing system scripts.
2985
2989
2986 2002-05-30 Fernando Perez <fperez@colorado.edu>
2990 2002-05-30 Fernando Perez <fperez@colorado.edu>
2987
2991
2988 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2992 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2989 documents. This will make the user download smaller (it's getting
2993 documents. This will make the user download smaller (it's getting
2990 too big).
2994 too big).
2991
2995
2992 2002-05-29 Fernando Perez <fperez@colorado.edu>
2996 2002-05-29 Fernando Perez <fperez@colorado.edu>
2993
2997
2994 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2998 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2995 fix problems with shelve and pickle. Seems to work, but I don't
2999 fix problems with shelve and pickle. Seems to work, but I don't
2996 know if corner cases break it. Thanks to Mike Heeter
3000 know if corner cases break it. Thanks to Mike Heeter
2997 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3001 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2998
3002
2999 2002-05-24 Fernando Perez <fperez@colorado.edu>
3003 2002-05-24 Fernando Perez <fperez@colorado.edu>
3000
3004
3001 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3005 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3002 macros having broken.
3006 macros having broken.
3003
3007
3004 2002-05-21 Fernando Perez <fperez@colorado.edu>
3008 2002-05-21 Fernando Perez <fperez@colorado.edu>
3005
3009
3006 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3010 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3007 introduced logging bug: all history before logging started was
3011 introduced logging bug: all history before logging started was
3008 being written one character per line! This came from the redesign
3012 being written one character per line! This came from the redesign
3009 of the input history as a special list which slices to strings,
3013 of the input history as a special list which slices to strings,
3010 not to lists.
3014 not to lists.
3011
3015
3012 2002-05-20 Fernando Perez <fperez@colorado.edu>
3016 2002-05-20 Fernando Perez <fperez@colorado.edu>
3013
3017
3014 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3018 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3015 be an attribute of all classes in this module. The design of these
3019 be an attribute of all classes in this module. The design of these
3016 classes needs some serious overhauling.
3020 classes needs some serious overhauling.
3017
3021
3018 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3022 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3019 which was ignoring '_' in option names.
3023 which was ignoring '_' in option names.
3020
3024
3021 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3025 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3022 'Verbose_novars' to 'Context' and made it the new default. It's a
3026 'Verbose_novars' to 'Context' and made it the new default. It's a
3023 bit more readable and also safer than verbose.
3027 bit more readable and also safer than verbose.
3024
3028
3025 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3029 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3026 triple-quoted strings.
3030 triple-quoted strings.
3027
3031
3028 * IPython/OInspect.py (__all__): new module exposing the object
3032 * IPython/OInspect.py (__all__): new module exposing the object
3029 introspection facilities. Now the corresponding magics are dummy
3033 introspection facilities. Now the corresponding magics are dummy
3030 wrappers around this. Having this module will make it much easier
3034 wrappers around this. Having this module will make it much easier
3031 to put these functions into our modified pdb.
3035 to put these functions into our modified pdb.
3032 This new object inspector system uses the new colorizing module,
3036 This new object inspector system uses the new colorizing module,
3033 so source code and other things are nicely syntax highlighted.
3037 so source code and other things are nicely syntax highlighted.
3034
3038
3035 2002-05-18 Fernando Perez <fperez@colorado.edu>
3039 2002-05-18 Fernando Perez <fperez@colorado.edu>
3036
3040
3037 * IPython/ColorANSI.py: Split the coloring tools into a separate
3041 * IPython/ColorANSI.py: Split the coloring tools into a separate
3038 module so I can use them in other code easier (they were part of
3042 module so I can use them in other code easier (they were part of
3039 ultraTB).
3043 ultraTB).
3040
3044
3041 2002-05-17 Fernando Perez <fperez@colorado.edu>
3045 2002-05-17 Fernando Perez <fperez@colorado.edu>
3042
3046
3043 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3047 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3044 fixed it to set the global 'g' also to the called instance, as
3048 fixed it to set the global 'g' also to the called instance, as
3045 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3049 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3046 user's 'g' variables).
3050 user's 'g' variables).
3047
3051
3048 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3052 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3049 global variables (aliases to _ih,_oh) so that users which expect
3053 global variables (aliases to _ih,_oh) so that users which expect
3050 In[5] or Out[7] to work aren't unpleasantly surprised.
3054 In[5] or Out[7] to work aren't unpleasantly surprised.
3051 (InputList.__getslice__): new class to allow executing slices of
3055 (InputList.__getslice__): new class to allow executing slices of
3052 input history directly. Very simple class, complements the use of
3056 input history directly. Very simple class, complements the use of
3053 macros.
3057 macros.
3054
3058
3055 2002-05-16 Fernando Perez <fperez@colorado.edu>
3059 2002-05-16 Fernando Perez <fperez@colorado.edu>
3056
3060
3057 * setup.py (docdirbase): make doc directory be just doc/IPython
3061 * setup.py (docdirbase): make doc directory be just doc/IPython
3058 without version numbers, it will reduce clutter for users.
3062 without version numbers, it will reduce clutter for users.
3059
3063
3060 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3064 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3061 execfile call to prevent possible memory leak. See for details:
3065 execfile call to prevent possible memory leak. See for details:
3062 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3066 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3063
3067
3064 2002-05-15 Fernando Perez <fperez@colorado.edu>
3068 2002-05-15 Fernando Perez <fperez@colorado.edu>
3065
3069
3066 * IPython/Magic.py (Magic.magic_psource): made the object
3070 * IPython/Magic.py (Magic.magic_psource): made the object
3067 introspection names be more standard: pdoc, pdef, pfile and
3071 introspection names be more standard: pdoc, pdef, pfile and
3068 psource. They all print/page their output, and it makes
3072 psource. They all print/page their output, and it makes
3069 remembering them easier. Kept old names for compatibility as
3073 remembering them easier. Kept old names for compatibility as
3070 aliases.
3074 aliases.
3071
3075
3072 2002-05-14 Fernando Perez <fperez@colorado.edu>
3076 2002-05-14 Fernando Perez <fperez@colorado.edu>
3073
3077
3074 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3078 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3075 what the mouse problem was. The trick is to use gnuplot with temp
3079 what the mouse problem was. The trick is to use gnuplot with temp
3076 files and NOT with pipes (for data communication), because having
3080 files and NOT with pipes (for data communication), because having
3077 both pipes and the mouse on is bad news.
3081 both pipes and the mouse on is bad news.
3078
3082
3079 2002-05-13 Fernando Perez <fperez@colorado.edu>
3083 2002-05-13 Fernando Perez <fperez@colorado.edu>
3080
3084
3081 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3085 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3082 bug. Information would be reported about builtins even when
3086 bug. Information would be reported about builtins even when
3083 user-defined functions overrode them.
3087 user-defined functions overrode them.
3084
3088
3085 2002-05-11 Fernando Perez <fperez@colorado.edu>
3089 2002-05-11 Fernando Perez <fperez@colorado.edu>
3086
3090
3087 * IPython/__init__.py (__all__): removed FlexCompleter from
3091 * IPython/__init__.py (__all__): removed FlexCompleter from
3088 __all__ so that things don't fail in platforms without readline.
3092 __all__ so that things don't fail in platforms without readline.
3089
3093
3090 2002-05-10 Fernando Perez <fperez@colorado.edu>
3094 2002-05-10 Fernando Perez <fperez@colorado.edu>
3091
3095
3092 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3096 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3093 it requires Numeric, effectively making Numeric a dependency for
3097 it requires Numeric, effectively making Numeric a dependency for
3094 IPython.
3098 IPython.
3095
3099
3096 * Released 0.2.13
3100 * Released 0.2.13
3097
3101
3098 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3102 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3099 profiler interface. Now all the major options from the profiler
3103 profiler interface. Now all the major options from the profiler
3100 module are directly supported in IPython, both for single
3104 module are directly supported in IPython, both for single
3101 expressions (@prun) and for full programs (@run -p).
3105 expressions (@prun) and for full programs (@run -p).
3102
3106
3103 2002-05-09 Fernando Perez <fperez@colorado.edu>
3107 2002-05-09 Fernando Perez <fperez@colorado.edu>
3104
3108
3105 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3109 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3106 magic properly formatted for screen.
3110 magic properly formatted for screen.
3107
3111
3108 * setup.py (make_shortcut): Changed things to put pdf version in
3112 * setup.py (make_shortcut): Changed things to put pdf version in
3109 doc/ instead of doc/manual (had to change lyxport a bit).
3113 doc/ instead of doc/manual (had to change lyxport a bit).
3110
3114
3111 * IPython/Magic.py (Profile.string_stats): made profile runs go
3115 * IPython/Magic.py (Profile.string_stats): made profile runs go
3112 through pager (they are long and a pager allows searching, saving,
3116 through pager (they are long and a pager allows searching, saving,
3113 etc.)
3117 etc.)
3114
3118
3115 2002-05-08 Fernando Perez <fperez@colorado.edu>
3119 2002-05-08 Fernando Perez <fperez@colorado.edu>
3116
3120
3117 * Released 0.2.12
3121 * Released 0.2.12
3118
3122
3119 2002-05-06 Fernando Perez <fperez@colorado.edu>
3123 2002-05-06 Fernando Perez <fperez@colorado.edu>
3120
3124
3121 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3125 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3122 introduced); 'hist n1 n2' was broken.
3126 introduced); 'hist n1 n2' was broken.
3123 (Magic.magic_pdb): added optional on/off arguments to @pdb
3127 (Magic.magic_pdb): added optional on/off arguments to @pdb
3124 (Magic.magic_run): added option -i to @run, which executes code in
3128 (Magic.magic_run): added option -i to @run, which executes code in
3125 the IPython namespace instead of a clean one. Also added @irun as
3129 the IPython namespace instead of a clean one. Also added @irun as
3126 an alias to @run -i.
3130 an alias to @run -i.
3127
3131
3128 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3132 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3129 fixed (it didn't really do anything, the namespaces were wrong).
3133 fixed (it didn't really do anything, the namespaces were wrong).
3130
3134
3131 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3135 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3132
3136
3133 * IPython/__init__.py (__all__): Fixed package namespace, now
3137 * IPython/__init__.py (__all__): Fixed package namespace, now
3134 'import IPython' does give access to IPython.<all> as
3138 'import IPython' does give access to IPython.<all> as
3135 expected. Also renamed __release__ to Release.
3139 expected. Also renamed __release__ to Release.
3136
3140
3137 * IPython/Debugger.py (__license__): created new Pdb class which
3141 * IPython/Debugger.py (__license__): created new Pdb class which
3138 functions like a drop-in for the normal pdb.Pdb but does NOT
3142 functions like a drop-in for the normal pdb.Pdb but does NOT
3139 import readline by default. This way it doesn't muck up IPython's
3143 import readline by default. This way it doesn't muck up IPython's
3140 readline handling, and now tab-completion finally works in the
3144 readline handling, and now tab-completion finally works in the
3141 debugger -- sort of. It completes things globally visible, but the
3145 debugger -- sort of. It completes things globally visible, but the
3142 completer doesn't track the stack as pdb walks it. That's a bit
3146 completer doesn't track the stack as pdb walks it. That's a bit
3143 tricky, and I'll have to implement it later.
3147 tricky, and I'll have to implement it later.
3144
3148
3145 2002-05-05 Fernando Perez <fperez@colorado.edu>
3149 2002-05-05 Fernando Perez <fperez@colorado.edu>
3146
3150
3147 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3151 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3148 magic docstrings when printed via ? (explicit \'s were being
3152 magic docstrings when printed via ? (explicit \'s were being
3149 printed).
3153 printed).
3150
3154
3151 * IPython/ipmaker.py (make_IPython): fixed namespace
3155 * IPython/ipmaker.py (make_IPython): fixed namespace
3152 identification bug. Now variables loaded via logs or command-line
3156 identification bug. Now variables loaded via logs or command-line
3153 files are recognized in the interactive namespace by @who.
3157 files are recognized in the interactive namespace by @who.
3154
3158
3155 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3159 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3156 log replay system stemming from the string form of Structs.
3160 log replay system stemming from the string form of Structs.
3157
3161
3158 * IPython/Magic.py (Macro.__init__): improved macros to properly
3162 * IPython/Magic.py (Macro.__init__): improved macros to properly
3159 handle magic commands in them.
3163 handle magic commands in them.
3160 (Magic.magic_logstart): usernames are now expanded so 'logstart
3164 (Magic.magic_logstart): usernames are now expanded so 'logstart
3161 ~/mylog' now works.
3165 ~/mylog' now works.
3162
3166
3163 * IPython/iplib.py (complete): fixed bug where paths starting with
3167 * IPython/iplib.py (complete): fixed bug where paths starting with
3164 '/' would be completed as magic names.
3168 '/' would be completed as magic names.
3165
3169
3166 2002-05-04 Fernando Perez <fperez@colorado.edu>
3170 2002-05-04 Fernando Perez <fperez@colorado.edu>
3167
3171
3168 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3172 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3169 allow running full programs under the profiler's control.
3173 allow running full programs under the profiler's control.
3170
3174
3171 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3175 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3172 mode to report exceptions verbosely but without formatting
3176 mode to report exceptions verbosely but without formatting
3173 variables. This addresses the issue of ipython 'freezing' (it's
3177 variables. This addresses the issue of ipython 'freezing' (it's
3174 not frozen, but caught in an expensive formatting loop) when huge
3178 not frozen, but caught in an expensive formatting loop) when huge
3175 variables are in the context of an exception.
3179 variables are in the context of an exception.
3176 (VerboseTB.text): Added '--->' markers at line where exception was
3180 (VerboseTB.text): Added '--->' markers at line where exception was
3177 triggered. Much clearer to read, especially in NoColor modes.
3181 triggered. Much clearer to read, especially in NoColor modes.
3178
3182
3179 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3183 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3180 implemented in reverse when changing to the new parse_options().
3184 implemented in reverse when changing to the new parse_options().
3181
3185
3182 2002-05-03 Fernando Perez <fperez@colorado.edu>
3186 2002-05-03 Fernando Perez <fperez@colorado.edu>
3183
3187
3184 * IPython/Magic.py (Magic.parse_options): new function so that
3188 * IPython/Magic.py (Magic.parse_options): new function so that
3185 magics can parse options easier.
3189 magics can parse options easier.
3186 (Magic.magic_prun): new function similar to profile.run(),
3190 (Magic.magic_prun): new function similar to profile.run(),
3187 suggested by Chris Hart.
3191 suggested by Chris Hart.
3188 (Magic.magic_cd): fixed behavior so that it only changes if
3192 (Magic.magic_cd): fixed behavior so that it only changes if
3189 directory actually is in history.
3193 directory actually is in history.
3190
3194
3191 * IPython/usage.py (__doc__): added information about potential
3195 * IPython/usage.py (__doc__): added information about potential
3192 slowness of Verbose exception mode when there are huge data
3196 slowness of Verbose exception mode when there are huge data
3193 structures to be formatted (thanks to Archie Paulson).
3197 structures to be formatted (thanks to Archie Paulson).
3194
3198
3195 * IPython/ipmaker.py (make_IPython): Changed default logging
3199 * IPython/ipmaker.py (make_IPython): Changed default logging
3196 (when simply called with -log) to use curr_dir/ipython.log in
3200 (when simply called with -log) to use curr_dir/ipython.log in
3197 rotate mode. Fixed crash which was occuring with -log before
3201 rotate mode. Fixed crash which was occuring with -log before
3198 (thanks to Jim Boyle).
3202 (thanks to Jim Boyle).
3199
3203
3200 2002-05-01 Fernando Perez <fperez@colorado.edu>
3204 2002-05-01 Fernando Perez <fperez@colorado.edu>
3201
3205
3202 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3206 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3203 was nasty -- though somewhat of a corner case).
3207 was nasty -- though somewhat of a corner case).
3204
3208
3205 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3209 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3206 text (was a bug).
3210 text (was a bug).
3207
3211
3208 2002-04-30 Fernando Perez <fperez@colorado.edu>
3212 2002-04-30 Fernando Perez <fperez@colorado.edu>
3209
3213
3210 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3214 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3211 a print after ^D or ^C from the user so that the In[] prompt
3215 a print after ^D or ^C from the user so that the In[] prompt
3212 doesn't over-run the gnuplot one.
3216 doesn't over-run the gnuplot one.
3213
3217
3214 2002-04-29 Fernando Perez <fperez@colorado.edu>
3218 2002-04-29 Fernando Perez <fperez@colorado.edu>
3215
3219
3216 * Released 0.2.10
3220 * Released 0.2.10
3217
3221
3218 * IPython/__release__.py (version): get date dynamically.
3222 * IPython/__release__.py (version): get date dynamically.
3219
3223
3220 * Misc. documentation updates thanks to Arnd's comments. Also ran
3224 * Misc. documentation updates thanks to Arnd's comments. Also ran
3221 a full spellcheck on the manual (hadn't been done in a while).
3225 a full spellcheck on the manual (hadn't been done in a while).
3222
3226
3223 2002-04-27 Fernando Perez <fperez@colorado.edu>
3227 2002-04-27 Fernando Perez <fperez@colorado.edu>
3224
3228
3225 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3229 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3226 starting a log in mid-session would reset the input history list.
3230 starting a log in mid-session would reset the input history list.
3227
3231
3228 2002-04-26 Fernando Perez <fperez@colorado.edu>
3232 2002-04-26 Fernando Perez <fperez@colorado.edu>
3229
3233
3230 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3234 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3231 all files were being included in an update. Now anything in
3235 all files were being included in an update. Now anything in
3232 UserConfig that matches [A-Za-z]*.py will go (this excludes
3236 UserConfig that matches [A-Za-z]*.py will go (this excludes
3233 __init__.py)
3237 __init__.py)
3234
3238
3235 2002-04-25 Fernando Perez <fperez@colorado.edu>
3239 2002-04-25 Fernando Perez <fperez@colorado.edu>
3236
3240
3237 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3241 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3238 to __builtins__ so that any form of embedded or imported code can
3242 to __builtins__ so that any form of embedded or imported code can
3239 test for being inside IPython.
3243 test for being inside IPython.
3240
3244
3241 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3245 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3242 changed to GnuplotMagic because it's now an importable module,
3246 changed to GnuplotMagic because it's now an importable module,
3243 this makes the name follow that of the standard Gnuplot module.
3247 this makes the name follow that of the standard Gnuplot module.
3244 GnuplotMagic can now be loaded at any time in mid-session.
3248 GnuplotMagic can now be loaded at any time in mid-session.
3245
3249
3246 2002-04-24 Fernando Perez <fperez@colorado.edu>
3250 2002-04-24 Fernando Perez <fperez@colorado.edu>
3247
3251
3248 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3252 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3249 the globals (IPython has its own namespace) and the
3253 the globals (IPython has its own namespace) and the
3250 PhysicalQuantity stuff is much better anyway.
3254 PhysicalQuantity stuff is much better anyway.
3251
3255
3252 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3256 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3253 embedding example to standard user directory for
3257 embedding example to standard user directory for
3254 distribution. Also put it in the manual.
3258 distribution. Also put it in the manual.
3255
3259
3256 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3260 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3257 instance as first argument (so it doesn't rely on some obscure
3261 instance as first argument (so it doesn't rely on some obscure
3258 hidden global).
3262 hidden global).
3259
3263
3260 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3264 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3261 delimiters. While it prevents ().TAB from working, it allows
3265 delimiters. While it prevents ().TAB from working, it allows
3262 completions in open (... expressions. This is by far a more common
3266 completions in open (... expressions. This is by far a more common
3263 case.
3267 case.
3264
3268
3265 2002-04-23 Fernando Perez <fperez@colorado.edu>
3269 2002-04-23 Fernando Perez <fperez@colorado.edu>
3266
3270
3267 * IPython/Extensions/InterpreterPasteInput.py: new
3271 * IPython/Extensions/InterpreterPasteInput.py: new
3268 syntax-processing module for pasting lines with >>> or ... at the
3272 syntax-processing module for pasting lines with >>> or ... at the
3269 start.
3273 start.
3270
3274
3271 * IPython/Extensions/PhysicalQ_Interactive.py
3275 * IPython/Extensions/PhysicalQ_Interactive.py
3272 (PhysicalQuantityInteractive.__int__): fixed to work with either
3276 (PhysicalQuantityInteractive.__int__): fixed to work with either
3273 Numeric or math.
3277 Numeric or math.
3274
3278
3275 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3279 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3276 provided profiles. Now we have:
3280 provided profiles. Now we have:
3277 -math -> math module as * and cmath with its own namespace.
3281 -math -> math module as * and cmath with its own namespace.
3278 -numeric -> Numeric as *, plus gnuplot & grace
3282 -numeric -> Numeric as *, plus gnuplot & grace
3279 -physics -> same as before
3283 -physics -> same as before
3280
3284
3281 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3285 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3282 user-defined magics wouldn't be found by @magic if they were
3286 user-defined magics wouldn't be found by @magic if they were
3283 defined as class methods. Also cleaned up the namespace search
3287 defined as class methods. Also cleaned up the namespace search
3284 logic and the string building (to use %s instead of many repeated
3288 logic and the string building (to use %s instead of many repeated
3285 string adds).
3289 string adds).
3286
3290
3287 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3291 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3288 of user-defined magics to operate with class methods (cleaner, in
3292 of user-defined magics to operate with class methods (cleaner, in
3289 line with the gnuplot code).
3293 line with the gnuplot code).
3290
3294
3291 2002-04-22 Fernando Perez <fperez@colorado.edu>
3295 2002-04-22 Fernando Perez <fperez@colorado.edu>
3292
3296
3293 * setup.py: updated dependency list so that manual is updated when
3297 * setup.py: updated dependency list so that manual is updated when
3294 all included files change.
3298 all included files change.
3295
3299
3296 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3300 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3297 the delimiter removal option (the fix is ugly right now).
3301 the delimiter removal option (the fix is ugly right now).
3298
3302
3299 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3303 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3300 all of the math profile (quicker loading, no conflict between
3304 all of the math profile (quicker loading, no conflict between
3301 g-9.8 and g-gnuplot).
3305 g-9.8 and g-gnuplot).
3302
3306
3303 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3307 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3304 name of post-mortem files to IPython_crash_report.txt.
3308 name of post-mortem files to IPython_crash_report.txt.
3305
3309
3306 * Cleanup/update of the docs. Added all the new readline info and
3310 * Cleanup/update of the docs. Added all the new readline info and
3307 formatted all lists as 'real lists'.
3311 formatted all lists as 'real lists'.
3308
3312
3309 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3313 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3310 tab-completion options, since the full readline parse_and_bind is
3314 tab-completion options, since the full readline parse_and_bind is
3311 now accessible.
3315 now accessible.
3312
3316
3313 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3317 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3314 handling of readline options. Now users can specify any string to
3318 handling of readline options. Now users can specify any string to
3315 be passed to parse_and_bind(), as well as the delimiters to be
3319 be passed to parse_and_bind(), as well as the delimiters to be
3316 removed.
3320 removed.
3317 (InteractiveShell.__init__): Added __name__ to the global
3321 (InteractiveShell.__init__): Added __name__ to the global
3318 namespace so that things like Itpl which rely on its existence
3322 namespace so that things like Itpl which rely on its existence
3319 don't crash.
3323 don't crash.
3320 (InteractiveShell._prefilter): Defined the default with a _ so
3324 (InteractiveShell._prefilter): Defined the default with a _ so
3321 that prefilter() is easier to override, while the default one
3325 that prefilter() is easier to override, while the default one
3322 remains available.
3326 remains available.
3323
3327
3324 2002-04-18 Fernando Perez <fperez@colorado.edu>
3328 2002-04-18 Fernando Perez <fperez@colorado.edu>
3325
3329
3326 * Added information about pdb in the docs.
3330 * Added information about pdb in the docs.
3327
3331
3328 2002-04-17 Fernando Perez <fperez@colorado.edu>
3332 2002-04-17 Fernando Perez <fperez@colorado.edu>
3329
3333
3330 * IPython/ipmaker.py (make_IPython): added rc_override option to
3334 * IPython/ipmaker.py (make_IPython): added rc_override option to
3331 allow passing config options at creation time which may override
3335 allow passing config options at creation time which may override
3332 anything set in the config files or command line. This is
3336 anything set in the config files or command line. This is
3333 particularly useful for configuring embedded instances.
3337 particularly useful for configuring embedded instances.
3334
3338
3335 2002-04-15 Fernando Perez <fperez@colorado.edu>
3339 2002-04-15 Fernando Perez <fperez@colorado.edu>
3336
3340
3337 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3341 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3338 crash embedded instances because of the input cache falling out of
3342 crash embedded instances because of the input cache falling out of
3339 sync with the output counter.
3343 sync with the output counter.
3340
3344
3341 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3345 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3342 mode which calls pdb after an uncaught exception in IPython itself.
3346 mode which calls pdb after an uncaught exception in IPython itself.
3343
3347
3344 2002-04-14 Fernando Perez <fperez@colorado.edu>
3348 2002-04-14 Fernando Perez <fperez@colorado.edu>
3345
3349
3346 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3350 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3347 readline, fix it back after each call.
3351 readline, fix it back after each call.
3348
3352
3349 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3353 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3350 method to force all access via __call__(), which guarantees that
3354 method to force all access via __call__(), which guarantees that
3351 traceback references are properly deleted.
3355 traceback references are properly deleted.
3352
3356
3353 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3357 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3354 improve printing when pprint is in use.
3358 improve printing when pprint is in use.
3355
3359
3356 2002-04-13 Fernando Perez <fperez@colorado.edu>
3360 2002-04-13 Fernando Perez <fperez@colorado.edu>
3357
3361
3358 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3362 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3359 exceptions aren't caught anymore. If the user triggers one, he
3363 exceptions aren't caught anymore. If the user triggers one, he
3360 should know why he's doing it and it should go all the way up,
3364 should know why he's doing it and it should go all the way up,
3361 just like any other exception. So now @abort will fully kill the
3365 just like any other exception. So now @abort will fully kill the
3362 embedded interpreter and the embedding code (unless that happens
3366 embedded interpreter and the embedding code (unless that happens
3363 to catch SystemExit).
3367 to catch SystemExit).
3364
3368
3365 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3369 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3366 and a debugger() method to invoke the interactive pdb debugger
3370 and a debugger() method to invoke the interactive pdb debugger
3367 after printing exception information. Also added the corresponding
3371 after printing exception information. Also added the corresponding
3368 -pdb option and @pdb magic to control this feature, and updated
3372 -pdb option and @pdb magic to control this feature, and updated
3369 the docs. After a suggestion from Christopher Hart
3373 the docs. After a suggestion from Christopher Hart
3370 (hart-AT-caltech.edu).
3374 (hart-AT-caltech.edu).
3371
3375
3372 2002-04-12 Fernando Perez <fperez@colorado.edu>
3376 2002-04-12 Fernando Perez <fperez@colorado.edu>
3373
3377
3374 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3378 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3375 the exception handlers defined by the user (not the CrashHandler)
3379 the exception handlers defined by the user (not the CrashHandler)
3376 so that user exceptions don't trigger an ipython bug report.
3380 so that user exceptions don't trigger an ipython bug report.
3377
3381
3378 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3382 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3379 configurable (it should have always been so).
3383 configurable (it should have always been so).
3380
3384
3381 2002-03-26 Fernando Perez <fperez@colorado.edu>
3385 2002-03-26 Fernando Perez <fperez@colorado.edu>
3382
3386
3383 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3387 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3384 and there to fix embedding namespace issues. This should all be
3388 and there to fix embedding namespace issues. This should all be
3385 done in a more elegant way.
3389 done in a more elegant way.
3386
3390
3387 2002-03-25 Fernando Perez <fperez@colorado.edu>
3391 2002-03-25 Fernando Perez <fperez@colorado.edu>
3388
3392
3389 * IPython/genutils.py (get_home_dir): Try to make it work under
3393 * IPython/genutils.py (get_home_dir): Try to make it work under
3390 win9x also.
3394 win9x also.
3391
3395
3392 2002-03-20 Fernando Perez <fperez@colorado.edu>
3396 2002-03-20 Fernando Perez <fperez@colorado.edu>
3393
3397
3394 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3398 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3395 sys.displayhook untouched upon __init__.
3399 sys.displayhook untouched upon __init__.
3396
3400
3397 2002-03-19 Fernando Perez <fperez@colorado.edu>
3401 2002-03-19 Fernando Perez <fperez@colorado.edu>
3398
3402
3399 * Released 0.2.9 (for embedding bug, basically).
3403 * Released 0.2.9 (for embedding bug, basically).
3400
3404
3401 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3405 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3402 exceptions so that enclosing shell's state can be restored.
3406 exceptions so that enclosing shell's state can be restored.
3403
3407
3404 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3408 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3405 naming conventions in the .ipython/ dir.
3409 naming conventions in the .ipython/ dir.
3406
3410
3407 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3411 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3408 from delimiters list so filenames with - in them get expanded.
3412 from delimiters list so filenames with - in them get expanded.
3409
3413
3410 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3414 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3411 sys.displayhook not being properly restored after an embedded call.
3415 sys.displayhook not being properly restored after an embedded call.
3412
3416
3413 2002-03-18 Fernando Perez <fperez@colorado.edu>
3417 2002-03-18 Fernando Perez <fperez@colorado.edu>
3414
3418
3415 * Released 0.2.8
3419 * Released 0.2.8
3416
3420
3417 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3421 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3418 some files weren't being included in a -upgrade.
3422 some files weren't being included in a -upgrade.
3419 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3423 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3420 on' so that the first tab completes.
3424 on' so that the first tab completes.
3421 (InteractiveShell.handle_magic): fixed bug with spaces around
3425 (InteractiveShell.handle_magic): fixed bug with spaces around
3422 quotes breaking many magic commands.
3426 quotes breaking many magic commands.
3423
3427
3424 * setup.py: added note about ignoring the syntax error messages at
3428 * setup.py: added note about ignoring the syntax error messages at
3425 installation.
3429 installation.
3426
3430
3427 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3431 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3428 streamlining the gnuplot interface, now there's only one magic @gp.
3432 streamlining the gnuplot interface, now there's only one magic @gp.
3429
3433
3430 2002-03-17 Fernando Perez <fperez@colorado.edu>
3434 2002-03-17 Fernando Perez <fperez@colorado.edu>
3431
3435
3432 * IPython/UserConfig/magic_gnuplot.py: new name for the
3436 * IPython/UserConfig/magic_gnuplot.py: new name for the
3433 example-magic_pm.py file. Much enhanced system, now with a shell
3437 example-magic_pm.py file. Much enhanced system, now with a shell
3434 for communicating directly with gnuplot, one command at a time.
3438 for communicating directly with gnuplot, one command at a time.
3435
3439
3436 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3440 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3437 setting __name__=='__main__'.
3441 setting __name__=='__main__'.
3438
3442
3439 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3443 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3440 mini-shell for accessing gnuplot from inside ipython. Should
3444 mini-shell for accessing gnuplot from inside ipython. Should
3441 extend it later for grace access too. Inspired by Arnd's
3445 extend it later for grace access too. Inspired by Arnd's
3442 suggestion.
3446 suggestion.
3443
3447
3444 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3448 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3445 calling magic functions with () in their arguments. Thanks to Arnd
3449 calling magic functions with () in their arguments. Thanks to Arnd
3446 Baecker for pointing this to me.
3450 Baecker for pointing this to me.
3447
3451
3448 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3452 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3449 infinitely for integer or complex arrays (only worked with floats).
3453 infinitely for integer or complex arrays (only worked with floats).
3450
3454
3451 2002-03-16 Fernando Perez <fperez@colorado.edu>
3455 2002-03-16 Fernando Perez <fperez@colorado.edu>
3452
3456
3453 * setup.py: Merged setup and setup_windows into a single script
3457 * setup.py: Merged setup and setup_windows into a single script
3454 which properly handles things for windows users.
3458 which properly handles things for windows users.
3455
3459
3456 2002-03-15 Fernando Perez <fperez@colorado.edu>
3460 2002-03-15 Fernando Perez <fperez@colorado.edu>
3457
3461
3458 * Big change to the manual: now the magics are all automatically
3462 * Big change to the manual: now the magics are all automatically
3459 documented. This information is generated from their docstrings
3463 documented. This information is generated from their docstrings
3460 and put in a latex file included by the manual lyx file. This way
3464 and put in a latex file included by the manual lyx file. This way
3461 we get always up to date information for the magics. The manual
3465 we get always up to date information for the magics. The manual
3462 now also has proper version information, also auto-synced.
3466 now also has proper version information, also auto-synced.
3463
3467
3464 For this to work, an undocumented --magic_docstrings option was added.
3468 For this to work, an undocumented --magic_docstrings option was added.
3465
3469
3466 2002-03-13 Fernando Perez <fperez@colorado.edu>
3470 2002-03-13 Fernando Perez <fperez@colorado.edu>
3467
3471
3468 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3472 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3469 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3473 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3470
3474
3471 2002-03-12 Fernando Perez <fperez@colorado.edu>
3475 2002-03-12 Fernando Perez <fperez@colorado.edu>
3472
3476
3473 * IPython/ultraTB.py (TermColors): changed color escapes again to
3477 * IPython/ultraTB.py (TermColors): changed color escapes again to
3474 fix the (old, reintroduced) line-wrapping bug. Basically, if
3478 fix the (old, reintroduced) line-wrapping bug. Basically, if
3475 \001..\002 aren't given in the color escapes, lines get wrapped
3479 \001..\002 aren't given in the color escapes, lines get wrapped
3476 weirdly. But giving those screws up old xterms and emacs terms. So
3480 weirdly. But giving those screws up old xterms and emacs terms. So
3477 I added some logic for emacs terms to be ok, but I can't identify old
3481 I added some logic for emacs terms to be ok, but I can't identify old
3478 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3482 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3479
3483
3480 2002-03-10 Fernando Perez <fperez@colorado.edu>
3484 2002-03-10 Fernando Perez <fperez@colorado.edu>
3481
3485
3482 * IPython/usage.py (__doc__): Various documentation cleanups and
3486 * IPython/usage.py (__doc__): Various documentation cleanups and
3483 updates, both in usage docstrings and in the manual.
3487 updates, both in usage docstrings and in the manual.
3484
3488
3485 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3489 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3486 handling of caching. Set minimum acceptabe value for having a
3490 handling of caching. Set minimum acceptabe value for having a
3487 cache at 20 values.
3491 cache at 20 values.
3488
3492
3489 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3493 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3490 install_first_time function to a method, renamed it and added an
3494 install_first_time function to a method, renamed it and added an
3491 'upgrade' mode. Now people can update their config directory with
3495 'upgrade' mode. Now people can update their config directory with
3492 a simple command line switch (-upgrade, also new).
3496 a simple command line switch (-upgrade, also new).
3493
3497
3494 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3498 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3495 @file (convenient for automagic users under Python >= 2.2).
3499 @file (convenient for automagic users under Python >= 2.2).
3496 Removed @files (it seemed more like a plural than an abbrev. of
3500 Removed @files (it seemed more like a plural than an abbrev. of
3497 'file show').
3501 'file show').
3498
3502
3499 * IPython/iplib.py (install_first_time): Fixed crash if there were
3503 * IPython/iplib.py (install_first_time): Fixed crash if there were
3500 backup files ('~') in .ipython/ install directory.
3504 backup files ('~') in .ipython/ install directory.
3501
3505
3502 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3506 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3503 system. Things look fine, but these changes are fairly
3507 system. Things look fine, but these changes are fairly
3504 intrusive. Test them for a few days.
3508 intrusive. Test them for a few days.
3505
3509
3506 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3510 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3507 the prompts system. Now all in/out prompt strings are user
3511 the prompts system. Now all in/out prompt strings are user
3508 controllable. This is particularly useful for embedding, as one
3512 controllable. This is particularly useful for embedding, as one
3509 can tag embedded instances with particular prompts.
3513 can tag embedded instances with particular prompts.
3510
3514
3511 Also removed global use of sys.ps1/2, which now allows nested
3515 Also removed global use of sys.ps1/2, which now allows nested
3512 embeddings without any problems. Added command-line options for
3516 embeddings without any problems. Added command-line options for
3513 the prompt strings.
3517 the prompt strings.
3514
3518
3515 2002-03-08 Fernando Perez <fperez@colorado.edu>
3519 2002-03-08 Fernando Perez <fperez@colorado.edu>
3516
3520
3517 * IPython/UserConfig/example-embed-short.py (ipshell): added
3521 * IPython/UserConfig/example-embed-short.py (ipshell): added
3518 example file with the bare minimum code for embedding.
3522 example file with the bare minimum code for embedding.
3519
3523
3520 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3524 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3521 functionality for the embeddable shell to be activated/deactivated
3525 functionality for the embeddable shell to be activated/deactivated
3522 either globally or at each call.
3526 either globally or at each call.
3523
3527
3524 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3528 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3525 rewriting the prompt with '--->' for auto-inputs with proper
3529 rewriting the prompt with '--->' for auto-inputs with proper
3526 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3530 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3527 this is handled by the prompts class itself, as it should.
3531 this is handled by the prompts class itself, as it should.
3528
3532
3529 2002-03-05 Fernando Perez <fperez@colorado.edu>
3533 2002-03-05 Fernando Perez <fperez@colorado.edu>
3530
3534
3531 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3535 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3532 @logstart to avoid name clashes with the math log function.
3536 @logstart to avoid name clashes with the math log function.
3533
3537
3534 * Big updates to X/Emacs section of the manual.
3538 * Big updates to X/Emacs section of the manual.
3535
3539
3536 * Removed ipython_emacs. Milan explained to me how to pass
3540 * Removed ipython_emacs. Milan explained to me how to pass
3537 arguments to ipython through Emacs. Some day I'm going to end up
3541 arguments to ipython through Emacs. Some day I'm going to end up
3538 learning some lisp...
3542 learning some lisp...
3539
3543
3540 2002-03-04 Fernando Perez <fperez@colorado.edu>
3544 2002-03-04 Fernando Perez <fperez@colorado.edu>
3541
3545
3542 * IPython/ipython_emacs: Created script to be used as the
3546 * IPython/ipython_emacs: Created script to be used as the
3543 py-python-command Emacs variable so we can pass IPython
3547 py-python-command Emacs variable so we can pass IPython
3544 parameters. I can't figure out how to tell Emacs directly to pass
3548 parameters. I can't figure out how to tell Emacs directly to pass
3545 parameters to IPython, so a dummy shell script will do it.
3549 parameters to IPython, so a dummy shell script will do it.
3546
3550
3547 Other enhancements made for things to work better under Emacs'
3551 Other enhancements made for things to work better under Emacs'
3548 various types of terminals. Many thanks to Milan Zamazal
3552 various types of terminals. Many thanks to Milan Zamazal
3549 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3553 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3550
3554
3551 2002-03-01 Fernando Perez <fperez@colorado.edu>
3555 2002-03-01 Fernando Perez <fperez@colorado.edu>
3552
3556
3553 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3557 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3554 that loading of readline is now optional. This gives better
3558 that loading of readline is now optional. This gives better
3555 control to emacs users.
3559 control to emacs users.
3556
3560
3557 * IPython/ultraTB.py (__date__): Modified color escape sequences
3561 * IPython/ultraTB.py (__date__): Modified color escape sequences
3558 and now things work fine under xterm and in Emacs' term buffers
3562 and now things work fine under xterm and in Emacs' term buffers
3559 (though not shell ones). Well, in emacs you get colors, but all
3563 (though not shell ones). Well, in emacs you get colors, but all
3560 seem to be 'light' colors (no difference between dark and light
3564 seem to be 'light' colors (no difference between dark and light
3561 ones). But the garbage chars are gone, and also in xterms. It
3565 ones). But the garbage chars are gone, and also in xterms. It
3562 seems that now I'm using 'cleaner' ansi sequences.
3566 seems that now I'm using 'cleaner' ansi sequences.
3563
3567
3564 2002-02-21 Fernando Perez <fperez@colorado.edu>
3568 2002-02-21 Fernando Perez <fperez@colorado.edu>
3565
3569
3566 * Released 0.2.7 (mainly to publish the scoping fix).
3570 * Released 0.2.7 (mainly to publish the scoping fix).
3567
3571
3568 * IPython/Logger.py (Logger.logstate): added. A corresponding
3572 * IPython/Logger.py (Logger.logstate): added. A corresponding
3569 @logstate magic was created.
3573 @logstate magic was created.
3570
3574
3571 * IPython/Magic.py: fixed nested scoping problem under Python
3575 * IPython/Magic.py: fixed nested scoping problem under Python
3572 2.1.x (automagic wasn't working).
3576 2.1.x (automagic wasn't working).
3573
3577
3574 2002-02-20 Fernando Perez <fperez@colorado.edu>
3578 2002-02-20 Fernando Perez <fperez@colorado.edu>
3575
3579
3576 * Released 0.2.6.
3580 * Released 0.2.6.
3577
3581
3578 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3582 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3579 option so that logs can come out without any headers at all.
3583 option so that logs can come out without any headers at all.
3580
3584
3581 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3585 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3582 SciPy.
3586 SciPy.
3583
3587
3584 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3588 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3585 that embedded IPython calls don't require vars() to be explicitly
3589 that embedded IPython calls don't require vars() to be explicitly
3586 passed. Now they are extracted from the caller's frame (code
3590 passed. Now they are extracted from the caller's frame (code
3587 snatched from Eric Jones' weave). Added better documentation to
3591 snatched from Eric Jones' weave). Added better documentation to
3588 the section on embedding and the example file.
3592 the section on embedding and the example file.
3589
3593
3590 * IPython/genutils.py (page): Changed so that under emacs, it just
3594 * IPython/genutils.py (page): Changed so that under emacs, it just
3591 prints the string. You can then page up and down in the emacs
3595 prints the string. You can then page up and down in the emacs
3592 buffer itself. This is how the builtin help() works.
3596 buffer itself. This is how the builtin help() works.
3593
3597
3594 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3598 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3595 macro scoping: macros need to be executed in the user's namespace
3599 macro scoping: macros need to be executed in the user's namespace
3596 to work as if they had been typed by the user.
3600 to work as if they had been typed by the user.
3597
3601
3598 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3602 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3599 execute automatically (no need to type 'exec...'). They then
3603 execute automatically (no need to type 'exec...'). They then
3600 behave like 'true macros'. The printing system was also modified
3604 behave like 'true macros'. The printing system was also modified
3601 for this to work.
3605 for this to work.
3602
3606
3603 2002-02-19 Fernando Perez <fperez@colorado.edu>
3607 2002-02-19 Fernando Perez <fperez@colorado.edu>
3604
3608
3605 * IPython/genutils.py (page_file): new function for paging files
3609 * IPython/genutils.py (page_file): new function for paging files
3606 in an OS-independent way. Also necessary for file viewing to work
3610 in an OS-independent way. Also necessary for file viewing to work
3607 well inside Emacs buffers.
3611 well inside Emacs buffers.
3608 (page): Added checks for being in an emacs buffer.
3612 (page): Added checks for being in an emacs buffer.
3609 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3613 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3610 same bug in iplib.
3614 same bug in iplib.
3611
3615
3612 2002-02-18 Fernando Perez <fperez@colorado.edu>
3616 2002-02-18 Fernando Perez <fperez@colorado.edu>
3613
3617
3614 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3618 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3615 of readline so that IPython can work inside an Emacs buffer.
3619 of readline so that IPython can work inside an Emacs buffer.
3616
3620
3617 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3621 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3618 method signatures (they weren't really bugs, but it looks cleaner
3622 method signatures (they weren't really bugs, but it looks cleaner
3619 and keeps PyChecker happy).
3623 and keeps PyChecker happy).
3620
3624
3621 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3625 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3622 for implementing various user-defined hooks. Currently only
3626 for implementing various user-defined hooks. Currently only
3623 display is done.
3627 display is done.
3624
3628
3625 * IPython/Prompts.py (CachedOutput._display): changed display
3629 * IPython/Prompts.py (CachedOutput._display): changed display
3626 functions so that they can be dynamically changed by users easily.
3630 functions so that they can be dynamically changed by users easily.
3627
3631
3628 * IPython/Extensions/numeric_formats.py (num_display): added an
3632 * IPython/Extensions/numeric_formats.py (num_display): added an
3629 extension for printing NumPy arrays in flexible manners. It
3633 extension for printing NumPy arrays in flexible manners. It
3630 doesn't do anything yet, but all the structure is in
3634 doesn't do anything yet, but all the structure is in
3631 place. Ultimately the plan is to implement output format control
3635 place. Ultimately the plan is to implement output format control
3632 like in Octave.
3636 like in Octave.
3633
3637
3634 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3638 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3635 methods are found at run-time by all the automatic machinery.
3639 methods are found at run-time by all the automatic machinery.
3636
3640
3637 2002-02-17 Fernando Perez <fperez@colorado.edu>
3641 2002-02-17 Fernando Perez <fperez@colorado.edu>
3638
3642
3639 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3643 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3640 whole file a little.
3644 whole file a little.
3641
3645
3642 * ToDo: closed this document. Now there's a new_design.lyx
3646 * ToDo: closed this document. Now there's a new_design.lyx
3643 document for all new ideas. Added making a pdf of it for the
3647 document for all new ideas. Added making a pdf of it for the
3644 end-user distro.
3648 end-user distro.
3645
3649
3646 * IPython/Logger.py (Logger.switch_log): Created this to replace
3650 * IPython/Logger.py (Logger.switch_log): Created this to replace
3647 logon() and logoff(). It also fixes a nasty crash reported by
3651 logon() and logoff(). It also fixes a nasty crash reported by
3648 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3652 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3649
3653
3650 * IPython/iplib.py (complete): got auto-completion to work with
3654 * IPython/iplib.py (complete): got auto-completion to work with
3651 automagic (I had wanted this for a long time).
3655 automagic (I had wanted this for a long time).
3652
3656
3653 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3657 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3654 to @file, since file() is now a builtin and clashes with automagic
3658 to @file, since file() is now a builtin and clashes with automagic
3655 for @file.
3659 for @file.
3656
3660
3657 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3661 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3658 of this was previously in iplib, which had grown to more than 2000
3662 of this was previously in iplib, which had grown to more than 2000
3659 lines, way too long. No new functionality, but it makes managing
3663 lines, way too long. No new functionality, but it makes managing
3660 the code a bit easier.
3664 the code a bit easier.
3661
3665
3662 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3666 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3663 information to crash reports.
3667 information to crash reports.
3664
3668
3665 2002-02-12 Fernando Perez <fperez@colorado.edu>
3669 2002-02-12 Fernando Perez <fperez@colorado.edu>
3666
3670
3667 * Released 0.2.5.
3671 * Released 0.2.5.
3668
3672
3669 2002-02-11 Fernando Perez <fperez@colorado.edu>
3673 2002-02-11 Fernando Perez <fperez@colorado.edu>
3670
3674
3671 * Wrote a relatively complete Windows installer. It puts
3675 * Wrote a relatively complete Windows installer. It puts
3672 everything in place, creates Start Menu entries and fixes the
3676 everything in place, creates Start Menu entries and fixes the
3673 color issues. Nothing fancy, but it works.
3677 color issues. Nothing fancy, but it works.
3674
3678
3675 2002-02-10 Fernando Perez <fperez@colorado.edu>
3679 2002-02-10 Fernando Perez <fperez@colorado.edu>
3676
3680
3677 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3681 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3678 os.path.expanduser() call so that we can type @run ~/myfile.py and
3682 os.path.expanduser() call so that we can type @run ~/myfile.py and
3679 have thigs work as expected.
3683 have thigs work as expected.
3680
3684
3681 * IPython/genutils.py (page): fixed exception handling so things
3685 * IPython/genutils.py (page): fixed exception handling so things
3682 work both in Unix and Windows correctly. Quitting a pager triggers
3686 work both in Unix and Windows correctly. Quitting a pager triggers
3683 an IOError/broken pipe in Unix, and in windows not finding a pager
3687 an IOError/broken pipe in Unix, and in windows not finding a pager
3684 is also an IOError, so I had to actually look at the return value
3688 is also an IOError, so I had to actually look at the return value
3685 of the exception, not just the exception itself. Should be ok now.
3689 of the exception, not just the exception itself. Should be ok now.
3686
3690
3687 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3691 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3688 modified to allow case-insensitive color scheme changes.
3692 modified to allow case-insensitive color scheme changes.
3689
3693
3690 2002-02-09 Fernando Perez <fperez@colorado.edu>
3694 2002-02-09 Fernando Perez <fperez@colorado.edu>
3691
3695
3692 * IPython/genutils.py (native_line_ends): new function to leave
3696 * IPython/genutils.py (native_line_ends): new function to leave
3693 user config files with os-native line-endings.
3697 user config files with os-native line-endings.
3694
3698
3695 * README and manual updates.
3699 * README and manual updates.
3696
3700
3697 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3701 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3698 instead of StringType to catch Unicode strings.
3702 instead of StringType to catch Unicode strings.
3699
3703
3700 * IPython/genutils.py (filefind): fixed bug for paths with
3704 * IPython/genutils.py (filefind): fixed bug for paths with
3701 embedded spaces (very common in Windows).
3705 embedded spaces (very common in Windows).
3702
3706
3703 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3707 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3704 files under Windows, so that they get automatically associated
3708 files under Windows, so that they get automatically associated
3705 with a text editor. Windows makes it a pain to handle
3709 with a text editor. Windows makes it a pain to handle
3706 extension-less files.
3710 extension-less files.
3707
3711
3708 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3712 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3709 warning about readline only occur for Posix. In Windows there's no
3713 warning about readline only occur for Posix. In Windows there's no
3710 way to get readline, so why bother with the warning.
3714 way to get readline, so why bother with the warning.
3711
3715
3712 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3716 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3713 for __str__ instead of dir(self), since dir() changed in 2.2.
3717 for __str__ instead of dir(self), since dir() changed in 2.2.
3714
3718
3715 * Ported to Windows! Tested on XP, I suspect it should work fine
3719 * Ported to Windows! Tested on XP, I suspect it should work fine
3716 on NT/2000, but I don't think it will work on 98 et al. That
3720 on NT/2000, but I don't think it will work on 98 et al. That
3717 series of Windows is such a piece of junk anyway that I won't try
3721 series of Windows is such a piece of junk anyway that I won't try
3718 porting it there. The XP port was straightforward, showed a few
3722 porting it there. The XP port was straightforward, showed a few
3719 bugs here and there (fixed all), in particular some string
3723 bugs here and there (fixed all), in particular some string
3720 handling stuff which required considering Unicode strings (which
3724 handling stuff which required considering Unicode strings (which
3721 Windows uses). This is good, but hasn't been too tested :) No
3725 Windows uses). This is good, but hasn't been too tested :) No
3722 fancy installer yet, I'll put a note in the manual so people at
3726 fancy installer yet, I'll put a note in the manual so people at
3723 least make manually a shortcut.
3727 least make manually a shortcut.
3724
3728
3725 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3729 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3726 into a single one, "colors". This now controls both prompt and
3730 into a single one, "colors". This now controls both prompt and
3727 exception color schemes, and can be changed both at startup
3731 exception color schemes, and can be changed both at startup
3728 (either via command-line switches or via ipythonrc files) and at
3732 (either via command-line switches or via ipythonrc files) and at
3729 runtime, with @colors.
3733 runtime, with @colors.
3730 (Magic.magic_run): renamed @prun to @run and removed the old
3734 (Magic.magic_run): renamed @prun to @run and removed the old
3731 @run. The two were too similar to warrant keeping both.
3735 @run. The two were too similar to warrant keeping both.
3732
3736
3733 2002-02-03 Fernando Perez <fperez@colorado.edu>
3737 2002-02-03 Fernando Perez <fperez@colorado.edu>
3734
3738
3735 * IPython/iplib.py (install_first_time): Added comment on how to
3739 * IPython/iplib.py (install_first_time): Added comment on how to
3736 configure the color options for first-time users. Put a <return>
3740 configure the color options for first-time users. Put a <return>
3737 request at the end so that small-terminal users get a chance to
3741 request at the end so that small-terminal users get a chance to
3738 read the startup info.
3742 read the startup info.
3739
3743
3740 2002-01-23 Fernando Perez <fperez@colorado.edu>
3744 2002-01-23 Fernando Perez <fperez@colorado.edu>
3741
3745
3742 * IPython/iplib.py (CachedOutput.update): Changed output memory
3746 * IPython/iplib.py (CachedOutput.update): Changed output memory
3743 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3747 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3744 input history we still use _i. Did this b/c these variable are
3748 input history we still use _i. Did this b/c these variable are
3745 very commonly used in interactive work, so the less we need to
3749 very commonly used in interactive work, so the less we need to
3746 type the better off we are.
3750 type the better off we are.
3747 (Magic.magic_prun): updated @prun to better handle the namespaces
3751 (Magic.magic_prun): updated @prun to better handle the namespaces
3748 the file will run in, including a fix for __name__ not being set
3752 the file will run in, including a fix for __name__ not being set
3749 before.
3753 before.
3750
3754
3751 2002-01-20 Fernando Perez <fperez@colorado.edu>
3755 2002-01-20 Fernando Perez <fperez@colorado.edu>
3752
3756
3753 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3757 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3754 extra garbage for Python 2.2. Need to look more carefully into
3758 extra garbage for Python 2.2. Need to look more carefully into
3755 this later.
3759 this later.
3756
3760
3757 2002-01-19 Fernando Perez <fperez@colorado.edu>
3761 2002-01-19 Fernando Perez <fperez@colorado.edu>
3758
3762
3759 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3763 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3760 display SyntaxError exceptions properly formatted when they occur
3764 display SyntaxError exceptions properly formatted when they occur
3761 (they can be triggered by imported code).
3765 (they can be triggered by imported code).
3762
3766
3763 2002-01-18 Fernando Perez <fperez@colorado.edu>
3767 2002-01-18 Fernando Perez <fperez@colorado.edu>
3764
3768
3765 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3769 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3766 SyntaxError exceptions are reported nicely formatted, instead of
3770 SyntaxError exceptions are reported nicely formatted, instead of
3767 spitting out only offset information as before.
3771 spitting out only offset information as before.
3768 (Magic.magic_prun): Added the @prun function for executing
3772 (Magic.magic_prun): Added the @prun function for executing
3769 programs with command line args inside IPython.
3773 programs with command line args inside IPython.
3770
3774
3771 2002-01-16 Fernando Perez <fperez@colorado.edu>
3775 2002-01-16 Fernando Perez <fperez@colorado.edu>
3772
3776
3773 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3777 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3774 to *not* include the last item given in a range. This brings their
3778 to *not* include the last item given in a range. This brings their
3775 behavior in line with Python's slicing:
3779 behavior in line with Python's slicing:
3776 a[n1:n2] -> a[n1]...a[n2-1]
3780 a[n1:n2] -> a[n1]...a[n2-1]
3777 It may be a bit less convenient, but I prefer to stick to Python's
3781 It may be a bit less convenient, but I prefer to stick to Python's
3778 conventions *everywhere*, so users never have to wonder.
3782 conventions *everywhere*, so users never have to wonder.
3779 (Magic.magic_macro): Added @macro function to ease the creation of
3783 (Magic.magic_macro): Added @macro function to ease the creation of
3780 macros.
3784 macros.
3781
3785
3782 2002-01-05 Fernando Perez <fperez@colorado.edu>
3786 2002-01-05 Fernando Perez <fperez@colorado.edu>
3783
3787
3784 * Released 0.2.4.
3788 * Released 0.2.4.
3785
3789
3786 * IPython/iplib.py (Magic.magic_pdef):
3790 * IPython/iplib.py (Magic.magic_pdef):
3787 (InteractiveShell.safe_execfile): report magic lines and error
3791 (InteractiveShell.safe_execfile): report magic lines and error
3788 lines without line numbers so one can easily copy/paste them for
3792 lines without line numbers so one can easily copy/paste them for
3789 re-execution.
3793 re-execution.
3790
3794
3791 * Updated manual with recent changes.
3795 * Updated manual with recent changes.
3792
3796
3793 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3797 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3794 docstring printing when class? is called. Very handy for knowing
3798 docstring printing when class? is called. Very handy for knowing
3795 how to create class instances (as long as __init__ is well
3799 how to create class instances (as long as __init__ is well
3796 documented, of course :)
3800 documented, of course :)
3797 (Magic.magic_doc): print both class and constructor docstrings.
3801 (Magic.magic_doc): print both class and constructor docstrings.
3798 (Magic.magic_pdef): give constructor info if passed a class and
3802 (Magic.magic_pdef): give constructor info if passed a class and
3799 __call__ info for callable object instances.
3803 __call__ info for callable object instances.
3800
3804
3801 2002-01-04 Fernando Perez <fperez@colorado.edu>
3805 2002-01-04 Fernando Perez <fperez@colorado.edu>
3802
3806
3803 * Made deep_reload() off by default. It doesn't always work
3807 * Made deep_reload() off by default. It doesn't always work
3804 exactly as intended, so it's probably safer to have it off. It's
3808 exactly as intended, so it's probably safer to have it off. It's
3805 still available as dreload() anyway, so nothing is lost.
3809 still available as dreload() anyway, so nothing is lost.
3806
3810
3807 2002-01-02 Fernando Perez <fperez@colorado.edu>
3811 2002-01-02 Fernando Perez <fperez@colorado.edu>
3808
3812
3809 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3813 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3810 so I wanted an updated release).
3814 so I wanted an updated release).
3811
3815
3812 2001-12-27 Fernando Perez <fperez@colorado.edu>
3816 2001-12-27 Fernando Perez <fperez@colorado.edu>
3813
3817
3814 * IPython/iplib.py (InteractiveShell.interact): Added the original
3818 * IPython/iplib.py (InteractiveShell.interact): Added the original
3815 code from 'code.py' for this module in order to change the
3819 code from 'code.py' for this module in order to change the
3816 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3820 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3817 the history cache would break when the user hit Ctrl-C, and
3821 the history cache would break when the user hit Ctrl-C, and
3818 interact() offers no way to add any hooks to it.
3822 interact() offers no way to add any hooks to it.
3819
3823
3820 2001-12-23 Fernando Perez <fperez@colorado.edu>
3824 2001-12-23 Fernando Perez <fperez@colorado.edu>
3821
3825
3822 * setup.py: added check for 'MANIFEST' before trying to remove
3826 * setup.py: added check for 'MANIFEST' before trying to remove
3823 it. Thanks to Sean Reifschneider.
3827 it. Thanks to Sean Reifschneider.
3824
3828
3825 2001-12-22 Fernando Perez <fperez@colorado.edu>
3829 2001-12-22 Fernando Perez <fperez@colorado.edu>
3826
3830
3827 * Released 0.2.2.
3831 * Released 0.2.2.
3828
3832
3829 * Finished (reasonably) writing the manual. Later will add the
3833 * Finished (reasonably) writing the manual. Later will add the
3830 python-standard navigation stylesheets, but for the time being
3834 python-standard navigation stylesheets, but for the time being
3831 it's fairly complete. Distribution will include html and pdf
3835 it's fairly complete. Distribution will include html and pdf
3832 versions.
3836 versions.
3833
3837
3834 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3838 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3835 (MayaVi author).
3839 (MayaVi author).
3836
3840
3837 2001-12-21 Fernando Perez <fperez@colorado.edu>
3841 2001-12-21 Fernando Perez <fperez@colorado.edu>
3838
3842
3839 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3843 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3840 good public release, I think (with the manual and the distutils
3844 good public release, I think (with the manual and the distutils
3841 installer). The manual can use some work, but that can go
3845 installer). The manual can use some work, but that can go
3842 slowly. Otherwise I think it's quite nice for end users. Next
3846 slowly. Otherwise I think it's quite nice for end users. Next
3843 summer, rewrite the guts of it...
3847 summer, rewrite the guts of it...
3844
3848
3845 * Changed format of ipythonrc files to use whitespace as the
3849 * Changed format of ipythonrc files to use whitespace as the
3846 separator instead of an explicit '='. Cleaner.
3850 separator instead of an explicit '='. Cleaner.
3847
3851
3848 2001-12-20 Fernando Perez <fperez@colorado.edu>
3852 2001-12-20 Fernando Perez <fperez@colorado.edu>
3849
3853
3850 * Started a manual in LyX. For now it's just a quick merge of the
3854 * Started a manual in LyX. For now it's just a quick merge of the
3851 various internal docstrings and READMEs. Later it may grow into a
3855 various internal docstrings and READMEs. Later it may grow into a
3852 nice, full-blown manual.
3856 nice, full-blown manual.
3853
3857
3854 * Set up a distutils based installer. Installation should now be
3858 * Set up a distutils based installer. Installation should now be
3855 trivially simple for end-users.
3859 trivially simple for end-users.
3856
3860
3857 2001-12-11 Fernando Perez <fperez@colorado.edu>
3861 2001-12-11 Fernando Perez <fperez@colorado.edu>
3858
3862
3859 * Released 0.2.0. First public release, announced it at
3863 * Released 0.2.0. First public release, announced it at
3860 comp.lang.python. From now on, just bugfixes...
3864 comp.lang.python. From now on, just bugfixes...
3861
3865
3862 * Went through all the files, set copyright/license notices and
3866 * Went through all the files, set copyright/license notices and
3863 cleaned up things. Ready for release.
3867 cleaned up things. Ready for release.
3864
3868
3865 2001-12-10 Fernando Perez <fperez@colorado.edu>
3869 2001-12-10 Fernando Perez <fperez@colorado.edu>
3866
3870
3867 * Changed the first-time installer not to use tarfiles. It's more
3871 * Changed the first-time installer not to use tarfiles. It's more
3868 robust now and less unix-dependent. Also makes it easier for
3872 robust now and less unix-dependent. Also makes it easier for
3869 people to later upgrade versions.
3873 people to later upgrade versions.
3870
3874
3871 * Changed @exit to @abort to reflect the fact that it's pretty
3875 * Changed @exit to @abort to reflect the fact that it's pretty
3872 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3876 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3873 becomes significant only when IPyhton is embedded: in that case,
3877 becomes significant only when IPyhton is embedded: in that case,
3874 C-D closes IPython only, but @abort kills the enclosing program
3878 C-D closes IPython only, but @abort kills the enclosing program
3875 too (unless it had called IPython inside a try catching
3879 too (unless it had called IPython inside a try catching
3876 SystemExit).
3880 SystemExit).
3877
3881
3878 * Created Shell module which exposes the actuall IPython Shell
3882 * Created Shell module which exposes the actuall IPython Shell
3879 classes, currently the normal and the embeddable one. This at
3883 classes, currently the normal and the embeddable one. This at
3880 least offers a stable interface we won't need to change when
3884 least offers a stable interface we won't need to change when
3881 (later) the internals are rewritten. That rewrite will be confined
3885 (later) the internals are rewritten. That rewrite will be confined
3882 to iplib and ipmaker, but the Shell interface should remain as is.
3886 to iplib and ipmaker, but the Shell interface should remain as is.
3883
3887
3884 * Added embed module which offers an embeddable IPShell object,
3888 * Added embed module which offers an embeddable IPShell object,
3885 useful to fire up IPython *inside* a running program. Great for
3889 useful to fire up IPython *inside* a running program. Great for
3886 debugging or dynamical data analysis.
3890 debugging or dynamical data analysis.
3887
3891
3888 2001-12-08 Fernando Perez <fperez@colorado.edu>
3892 2001-12-08 Fernando Perez <fperez@colorado.edu>
3889
3893
3890 * Fixed small bug preventing seeing info from methods of defined
3894 * Fixed small bug preventing seeing info from methods of defined
3891 objects (incorrect namespace in _ofind()).
3895 objects (incorrect namespace in _ofind()).
3892
3896
3893 * Documentation cleanup. Moved the main usage docstrings to a
3897 * Documentation cleanup. Moved the main usage docstrings to a
3894 separate file, usage.py (cleaner to maintain, and hopefully in the
3898 separate file, usage.py (cleaner to maintain, and hopefully in the
3895 future some perlpod-like way of producing interactive, man and
3899 future some perlpod-like way of producing interactive, man and
3896 html docs out of it will be found).
3900 html docs out of it will be found).
3897
3901
3898 * Added @profile to see your profile at any time.
3902 * Added @profile to see your profile at any time.
3899
3903
3900 * Added @p as an alias for 'print'. It's especially convenient if
3904 * Added @p as an alias for 'print'. It's especially convenient if
3901 using automagic ('p x' prints x).
3905 using automagic ('p x' prints x).
3902
3906
3903 * Small cleanups and fixes after a pychecker run.
3907 * Small cleanups and fixes after a pychecker run.
3904
3908
3905 * Changed the @cd command to handle @cd - and @cd -<n> for
3909 * Changed the @cd command to handle @cd - and @cd -<n> for
3906 visiting any directory in _dh.
3910 visiting any directory in _dh.
3907
3911
3908 * Introduced _dh, a history of visited directories. @dhist prints
3912 * Introduced _dh, a history of visited directories. @dhist prints
3909 it out with numbers.
3913 it out with numbers.
3910
3914
3911 2001-12-07 Fernando Perez <fperez@colorado.edu>
3915 2001-12-07 Fernando Perez <fperez@colorado.edu>
3912
3916
3913 * Released 0.1.22
3917 * Released 0.1.22
3914
3918
3915 * Made initialization a bit more robust against invalid color
3919 * Made initialization a bit more robust against invalid color
3916 options in user input (exit, not traceback-crash).
3920 options in user input (exit, not traceback-crash).
3917
3921
3918 * Changed the bug crash reporter to write the report only in the
3922 * Changed the bug crash reporter to write the report only in the
3919 user's .ipython directory. That way IPython won't litter people's
3923 user's .ipython directory. That way IPython won't litter people's
3920 hard disks with crash files all over the place. Also print on
3924 hard disks with crash files all over the place. Also print on
3921 screen the necessary mail command.
3925 screen the necessary mail command.
3922
3926
3923 * With the new ultraTB, implemented LightBG color scheme for light
3927 * With the new ultraTB, implemented LightBG color scheme for light
3924 background terminals. A lot of people like white backgrounds, so I
3928 background terminals. A lot of people like white backgrounds, so I
3925 guess we should at least give them something readable.
3929 guess we should at least give them something readable.
3926
3930
3927 2001-12-06 Fernando Perez <fperez@colorado.edu>
3931 2001-12-06 Fernando Perez <fperez@colorado.edu>
3928
3932
3929 * Modified the structure of ultraTB. Now there's a proper class
3933 * Modified the structure of ultraTB. Now there's a proper class
3930 for tables of color schemes which allow adding schemes easily and
3934 for tables of color schemes which allow adding schemes easily and
3931 switching the active scheme without creating a new instance every
3935 switching the active scheme without creating a new instance every
3932 time (which was ridiculous). The syntax for creating new schemes
3936 time (which was ridiculous). The syntax for creating new schemes
3933 is also cleaner. I think ultraTB is finally done, with a clean
3937 is also cleaner. I think ultraTB is finally done, with a clean
3934 class structure. Names are also much cleaner (now there's proper
3938 class structure. Names are also much cleaner (now there's proper
3935 color tables, no need for every variable to also have 'color' in
3939 color tables, no need for every variable to also have 'color' in
3936 its name).
3940 its name).
3937
3941
3938 * Broke down genutils into separate files. Now genutils only
3942 * Broke down genutils into separate files. Now genutils only
3939 contains utility functions, and classes have been moved to their
3943 contains utility functions, and classes have been moved to their
3940 own files (they had enough independent functionality to warrant
3944 own files (they had enough independent functionality to warrant
3941 it): ConfigLoader, OutputTrap, Struct.
3945 it): ConfigLoader, OutputTrap, Struct.
3942
3946
3943 2001-12-05 Fernando Perez <fperez@colorado.edu>
3947 2001-12-05 Fernando Perez <fperez@colorado.edu>
3944
3948
3945 * IPython turns 21! Released version 0.1.21, as a candidate for
3949 * IPython turns 21! Released version 0.1.21, as a candidate for
3946 public consumption. If all goes well, release in a few days.
3950 public consumption. If all goes well, release in a few days.
3947
3951
3948 * Fixed path bug (files in Extensions/ directory wouldn't be found
3952 * Fixed path bug (files in Extensions/ directory wouldn't be found
3949 unless IPython/ was explicitly in sys.path).
3953 unless IPython/ was explicitly in sys.path).
3950
3954
3951 * Extended the FlexCompleter class as MagicCompleter to allow
3955 * Extended the FlexCompleter class as MagicCompleter to allow
3952 completion of @-starting lines.
3956 completion of @-starting lines.
3953
3957
3954 * Created __release__.py file as a central repository for release
3958 * Created __release__.py file as a central repository for release
3955 info that other files can read from.
3959 info that other files can read from.
3956
3960
3957 * Fixed small bug in logging: when logging was turned on in
3961 * Fixed small bug in logging: when logging was turned on in
3958 mid-session, old lines with special meanings (!@?) were being
3962 mid-session, old lines with special meanings (!@?) were being
3959 logged without the prepended comment, which is necessary since
3963 logged without the prepended comment, which is necessary since
3960 they are not truly valid python syntax. This should make session
3964 they are not truly valid python syntax. This should make session
3961 restores produce less errors.
3965 restores produce less errors.
3962
3966
3963 * The namespace cleanup forced me to make a FlexCompleter class
3967 * The namespace cleanup forced me to make a FlexCompleter class
3964 which is nothing but a ripoff of rlcompleter, but with selectable
3968 which is nothing but a ripoff of rlcompleter, but with selectable
3965 namespace (rlcompleter only works in __main__.__dict__). I'll try
3969 namespace (rlcompleter only works in __main__.__dict__). I'll try
3966 to submit a note to the authors to see if this change can be
3970 to submit a note to the authors to see if this change can be
3967 incorporated in future rlcompleter releases (Dec.6: done)
3971 incorporated in future rlcompleter releases (Dec.6: done)
3968
3972
3969 * More fixes to namespace handling. It was a mess! Now all
3973 * More fixes to namespace handling. It was a mess! Now all
3970 explicit references to __main__.__dict__ are gone (except when
3974 explicit references to __main__.__dict__ are gone (except when
3971 really needed) and everything is handled through the namespace
3975 really needed) and everything is handled through the namespace
3972 dicts in the IPython instance. We seem to be getting somewhere
3976 dicts in the IPython instance. We seem to be getting somewhere
3973 with this, finally...
3977 with this, finally...
3974
3978
3975 * Small documentation updates.
3979 * Small documentation updates.
3976
3980
3977 * Created the Extensions directory under IPython (with an
3981 * Created the Extensions directory under IPython (with an
3978 __init__.py). Put the PhysicalQ stuff there. This directory should
3982 __init__.py). Put the PhysicalQ stuff there. This directory should
3979 be used for all special-purpose extensions.
3983 be used for all special-purpose extensions.
3980
3984
3981 * File renaming:
3985 * File renaming:
3982 ipythonlib --> ipmaker
3986 ipythonlib --> ipmaker
3983 ipplib --> iplib
3987 ipplib --> iplib
3984 This makes a bit more sense in terms of what these files actually do.
3988 This makes a bit more sense in terms of what these files actually do.
3985
3989
3986 * Moved all the classes and functions in ipythonlib to ipplib, so
3990 * Moved all the classes and functions in ipythonlib to ipplib, so
3987 now ipythonlib only has make_IPython(). This will ease up its
3991 now ipythonlib only has make_IPython(). This will ease up its
3988 splitting in smaller functional chunks later.
3992 splitting in smaller functional chunks later.
3989
3993
3990 * Cleaned up (done, I think) output of @whos. Better column
3994 * Cleaned up (done, I think) output of @whos. Better column
3991 formatting, and now shows str(var) for as much as it can, which is
3995 formatting, and now shows str(var) for as much as it can, which is
3992 typically what one gets with a 'print var'.
3996 typically what one gets with a 'print var'.
3993
3997
3994 2001-12-04 Fernando Perez <fperez@colorado.edu>
3998 2001-12-04 Fernando Perez <fperez@colorado.edu>
3995
3999
3996 * Fixed namespace problems. Now builtin/IPyhton/user names get
4000 * Fixed namespace problems. Now builtin/IPyhton/user names get
3997 properly reported in their namespace. Internal namespace handling
4001 properly reported in their namespace. Internal namespace handling
3998 is finally getting decent (not perfect yet, but much better than
4002 is finally getting decent (not perfect yet, but much better than
3999 the ad-hoc mess we had).
4003 the ad-hoc mess we had).
4000
4004
4001 * Removed -exit option. If people just want to run a python
4005 * Removed -exit option. If people just want to run a python
4002 script, that's what the normal interpreter is for. Less
4006 script, that's what the normal interpreter is for. Less
4003 unnecessary options, less chances for bugs.
4007 unnecessary options, less chances for bugs.
4004
4008
4005 * Added a crash handler which generates a complete post-mortem if
4009 * Added a crash handler which generates a complete post-mortem if
4006 IPython crashes. This will help a lot in tracking bugs down the
4010 IPython crashes. This will help a lot in tracking bugs down the
4007 road.
4011 road.
4008
4012
4009 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4013 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4010 which were boud to functions being reassigned would bypass the
4014 which were boud to functions being reassigned would bypass the
4011 logger, breaking the sync of _il with the prompt counter. This
4015 logger, breaking the sync of _il with the prompt counter. This
4012 would then crash IPython later when a new line was logged.
4016 would then crash IPython later when a new line was logged.
4013
4017
4014 2001-12-02 Fernando Perez <fperez@colorado.edu>
4018 2001-12-02 Fernando Perez <fperez@colorado.edu>
4015
4019
4016 * Made IPython a package. This means people don't have to clutter
4020 * Made IPython a package. This means people don't have to clutter
4017 their sys.path with yet another directory. Changed the INSTALL
4021 their sys.path with yet another directory. Changed the INSTALL
4018 file accordingly.
4022 file accordingly.
4019
4023
4020 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4024 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4021 sorts its output (so @who shows it sorted) and @whos formats the
4025 sorts its output (so @who shows it sorted) and @whos formats the
4022 table according to the width of the first column. Nicer, easier to
4026 table according to the width of the first column. Nicer, easier to
4023 read. Todo: write a generic table_format() which takes a list of
4027 read. Todo: write a generic table_format() which takes a list of
4024 lists and prints it nicely formatted, with optional row/column
4028 lists and prints it nicely formatted, with optional row/column
4025 separators and proper padding and justification.
4029 separators and proper padding and justification.
4026
4030
4027 * Released 0.1.20
4031 * Released 0.1.20
4028
4032
4029 * Fixed bug in @log which would reverse the inputcache list (a
4033 * Fixed bug in @log which would reverse the inputcache list (a
4030 copy operation was missing).
4034 copy operation was missing).
4031
4035
4032 * Code cleanup. @config was changed to use page(). Better, since
4036 * Code cleanup. @config was changed to use page(). Better, since
4033 its output is always quite long.
4037 its output is always quite long.
4034
4038
4035 * Itpl is back as a dependency. I was having too many problems
4039 * Itpl is back as a dependency. I was having too many problems
4036 getting the parametric aliases to work reliably, and it's just
4040 getting the parametric aliases to work reliably, and it's just
4037 easier to code weird string operations with it than playing %()s
4041 easier to code weird string operations with it than playing %()s
4038 games. It's only ~6k, so I don't think it's too big a deal.
4042 games. It's only ~6k, so I don't think it's too big a deal.
4039
4043
4040 * Found (and fixed) a very nasty bug with history. !lines weren't
4044 * Found (and fixed) a very nasty bug with history. !lines weren't
4041 getting cached, and the out of sync caches would crash
4045 getting cached, and the out of sync caches would crash
4042 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4046 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4043 division of labor a bit better. Bug fixed, cleaner structure.
4047 division of labor a bit better. Bug fixed, cleaner structure.
4044
4048
4045 2001-12-01 Fernando Perez <fperez@colorado.edu>
4049 2001-12-01 Fernando Perez <fperez@colorado.edu>
4046
4050
4047 * Released 0.1.19
4051 * Released 0.1.19
4048
4052
4049 * Added option -n to @hist to prevent line number printing. Much
4053 * Added option -n to @hist to prevent line number printing. Much
4050 easier to copy/paste code this way.
4054 easier to copy/paste code this way.
4051
4055
4052 * Created global _il to hold the input list. Allows easy
4056 * Created global _il to hold the input list. Allows easy
4053 re-execution of blocks of code by slicing it (inspired by Janko's
4057 re-execution of blocks of code by slicing it (inspired by Janko's
4054 comment on 'macros').
4058 comment on 'macros').
4055
4059
4056 * Small fixes and doc updates.
4060 * Small fixes and doc updates.
4057
4061
4058 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4062 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4059 much too fragile with automagic. Handles properly multi-line
4063 much too fragile with automagic. Handles properly multi-line
4060 statements and takes parameters.
4064 statements and takes parameters.
4061
4065
4062 2001-11-30 Fernando Perez <fperez@colorado.edu>
4066 2001-11-30 Fernando Perez <fperez@colorado.edu>
4063
4067
4064 * Version 0.1.18 released.
4068 * Version 0.1.18 released.
4065
4069
4066 * Fixed nasty namespace bug in initial module imports.
4070 * Fixed nasty namespace bug in initial module imports.
4067
4071
4068 * Added copyright/license notes to all code files (except
4072 * Added copyright/license notes to all code files (except
4069 DPyGetOpt). For the time being, LGPL. That could change.
4073 DPyGetOpt). For the time being, LGPL. That could change.
4070
4074
4071 * Rewrote a much nicer README, updated INSTALL, cleaned up
4075 * Rewrote a much nicer README, updated INSTALL, cleaned up
4072 ipythonrc-* samples.
4076 ipythonrc-* samples.
4073
4077
4074 * Overall code/documentation cleanup. Basically ready for
4078 * Overall code/documentation cleanup. Basically ready for
4075 release. Only remaining thing: licence decision (LGPL?).
4079 release. Only remaining thing: licence decision (LGPL?).
4076
4080
4077 * Converted load_config to a class, ConfigLoader. Now recursion
4081 * Converted load_config to a class, ConfigLoader. Now recursion
4078 control is better organized. Doesn't include the same file twice.
4082 control is better organized. Doesn't include the same file twice.
4079
4083
4080 2001-11-29 Fernando Perez <fperez@colorado.edu>
4084 2001-11-29 Fernando Perez <fperez@colorado.edu>
4081
4085
4082 * Got input history working. Changed output history variables from
4086 * Got input history working. Changed output history variables from
4083 _p to _o so that _i is for input and _o for output. Just cleaner
4087 _p to _o so that _i is for input and _o for output. Just cleaner
4084 convention.
4088 convention.
4085
4089
4086 * Implemented parametric aliases. This pretty much allows the
4090 * Implemented parametric aliases. This pretty much allows the
4087 alias system to offer full-blown shell convenience, I think.
4091 alias system to offer full-blown shell convenience, I think.
4088
4092
4089 * Version 0.1.17 released, 0.1.18 opened.
4093 * Version 0.1.17 released, 0.1.18 opened.
4090
4094
4091 * dot_ipython/ipythonrc (alias): added documentation.
4095 * dot_ipython/ipythonrc (alias): added documentation.
4092 (xcolor): Fixed small bug (xcolors -> xcolor)
4096 (xcolor): Fixed small bug (xcolors -> xcolor)
4093
4097
4094 * Changed the alias system. Now alias is a magic command to define
4098 * Changed the alias system. Now alias is a magic command to define
4095 aliases just like the shell. Rationale: the builtin magics should
4099 aliases just like the shell. Rationale: the builtin magics should
4096 be there for things deeply connected to IPython's
4100 be there for things deeply connected to IPython's
4097 architecture. And this is a much lighter system for what I think
4101 architecture. And this is a much lighter system for what I think
4098 is the really important feature: allowing users to define quickly
4102 is the really important feature: allowing users to define quickly
4099 magics that will do shell things for them, so they can customize
4103 magics that will do shell things for them, so they can customize
4100 IPython easily to match their work habits. If someone is really
4104 IPython easily to match their work habits. If someone is really
4101 desperate to have another name for a builtin alias, they can
4105 desperate to have another name for a builtin alias, they can
4102 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4106 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4103 works.
4107 works.
4104
4108
4105 2001-11-28 Fernando Perez <fperez@colorado.edu>
4109 2001-11-28 Fernando Perez <fperez@colorado.edu>
4106
4110
4107 * Changed @file so that it opens the source file at the proper
4111 * Changed @file so that it opens the source file at the proper
4108 line. Since it uses less, if your EDITOR environment is
4112 line. Since it uses less, if your EDITOR environment is
4109 configured, typing v will immediately open your editor of choice
4113 configured, typing v will immediately open your editor of choice
4110 right at the line where the object is defined. Not as quick as
4114 right at the line where the object is defined. Not as quick as
4111 having a direct @edit command, but for all intents and purposes it
4115 having a direct @edit command, but for all intents and purposes it
4112 works. And I don't have to worry about writing @edit to deal with
4116 works. And I don't have to worry about writing @edit to deal with
4113 all the editors, less does that.
4117 all the editors, less does that.
4114
4118
4115 * Version 0.1.16 released, 0.1.17 opened.
4119 * Version 0.1.16 released, 0.1.17 opened.
4116
4120
4117 * Fixed some nasty bugs in the page/page_dumb combo that could
4121 * Fixed some nasty bugs in the page/page_dumb combo that could
4118 crash IPython.
4122 crash IPython.
4119
4123
4120 2001-11-27 Fernando Perez <fperez@colorado.edu>
4124 2001-11-27 Fernando Perez <fperez@colorado.edu>
4121
4125
4122 * Version 0.1.15 released, 0.1.16 opened.
4126 * Version 0.1.15 released, 0.1.16 opened.
4123
4127
4124 * Finally got ? and ?? to work for undefined things: now it's
4128 * Finally got ? and ?? to work for undefined things: now it's
4125 possible to type {}.get? and get information about the get method
4129 possible to type {}.get? and get information about the get method
4126 of dicts, or os.path? even if only os is defined (so technically
4130 of dicts, or os.path? even if only os is defined (so technically
4127 os.path isn't). Works at any level. For example, after import os,
4131 os.path isn't). Works at any level. For example, after import os,
4128 os?, os.path?, os.path.abspath? all work. This is great, took some
4132 os?, os.path?, os.path.abspath? all work. This is great, took some
4129 work in _ofind.
4133 work in _ofind.
4130
4134
4131 * Fixed more bugs with logging. The sanest way to do it was to add
4135 * Fixed more bugs with logging. The sanest way to do it was to add
4132 to @log a 'mode' parameter. Killed two in one shot (this mode
4136 to @log a 'mode' parameter. Killed two in one shot (this mode
4133 option was a request of Janko's). I think it's finally clean
4137 option was a request of Janko's). I think it's finally clean
4134 (famous last words).
4138 (famous last words).
4135
4139
4136 * Added a page_dumb() pager which does a decent job of paging on
4140 * Added a page_dumb() pager which does a decent job of paging on
4137 screen, if better things (like less) aren't available. One less
4141 screen, if better things (like less) aren't available. One less
4138 unix dependency (someday maybe somebody will port this to
4142 unix dependency (someday maybe somebody will port this to
4139 windows).
4143 windows).
4140
4144
4141 * Fixed problem in magic_log: would lock of logging out if log
4145 * Fixed problem in magic_log: would lock of logging out if log
4142 creation failed (because it would still think it had succeeded).
4146 creation failed (because it would still think it had succeeded).
4143
4147
4144 * Improved the page() function using curses to auto-detect screen
4148 * Improved the page() function using curses to auto-detect screen
4145 size. Now it can make a much better decision on whether to print
4149 size. Now it can make a much better decision on whether to print
4146 or page a string. Option screen_length was modified: a value 0
4150 or page a string. Option screen_length was modified: a value 0
4147 means auto-detect, and that's the default now.
4151 means auto-detect, and that's the default now.
4148
4152
4149 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4153 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4150 go out. I'll test it for a few days, then talk to Janko about
4154 go out. I'll test it for a few days, then talk to Janko about
4151 licences and announce it.
4155 licences and announce it.
4152
4156
4153 * Fixed the length of the auto-generated ---> prompt which appears
4157 * Fixed the length of the auto-generated ---> prompt which appears
4154 for auto-parens and auto-quotes. Getting this right isn't trivial,
4158 for auto-parens and auto-quotes. Getting this right isn't trivial,
4155 with all the color escapes, different prompt types and optional
4159 with all the color escapes, different prompt types and optional
4156 separators. But it seems to be working in all the combinations.
4160 separators. But it seems to be working in all the combinations.
4157
4161
4158 2001-11-26 Fernando Perez <fperez@colorado.edu>
4162 2001-11-26 Fernando Perez <fperez@colorado.edu>
4159
4163
4160 * Wrote a regexp filter to get option types from the option names
4164 * Wrote a regexp filter to get option types from the option names
4161 string. This eliminates the need to manually keep two duplicate
4165 string. This eliminates the need to manually keep two duplicate
4162 lists.
4166 lists.
4163
4167
4164 * Removed the unneeded check_option_names. Now options are handled
4168 * Removed the unneeded check_option_names. Now options are handled
4165 in a much saner manner and it's easy to visually check that things
4169 in a much saner manner and it's easy to visually check that things
4166 are ok.
4170 are ok.
4167
4171
4168 * Updated version numbers on all files I modified to carry a
4172 * Updated version numbers on all files I modified to carry a
4169 notice so Janko and Nathan have clear version markers.
4173 notice so Janko and Nathan have clear version markers.
4170
4174
4171 * Updated docstring for ultraTB with my changes. I should send
4175 * Updated docstring for ultraTB with my changes. I should send
4172 this to Nathan.
4176 this to Nathan.
4173
4177
4174 * Lots of small fixes. Ran everything through pychecker again.
4178 * Lots of small fixes. Ran everything through pychecker again.
4175
4179
4176 * Made loading of deep_reload an cmd line option. If it's not too
4180 * Made loading of deep_reload an cmd line option. If it's not too
4177 kosher, now people can just disable it. With -nodeep_reload it's
4181 kosher, now people can just disable it. With -nodeep_reload it's
4178 still available as dreload(), it just won't overwrite reload().
4182 still available as dreload(), it just won't overwrite reload().
4179
4183
4180 * Moved many options to the no| form (-opt and -noopt
4184 * Moved many options to the no| form (-opt and -noopt
4181 accepted). Cleaner.
4185 accepted). Cleaner.
4182
4186
4183 * Changed magic_log so that if called with no parameters, it uses
4187 * Changed magic_log so that if called with no parameters, it uses
4184 'rotate' mode. That way auto-generated logs aren't automatically
4188 'rotate' mode. That way auto-generated logs aren't automatically
4185 over-written. For normal logs, now a backup is made if it exists
4189 over-written. For normal logs, now a backup is made if it exists
4186 (only 1 level of backups). A new 'backup' mode was added to the
4190 (only 1 level of backups). A new 'backup' mode was added to the
4187 Logger class to support this. This was a request by Janko.
4191 Logger class to support this. This was a request by Janko.
4188
4192
4189 * Added @logoff/@logon to stop/restart an active log.
4193 * Added @logoff/@logon to stop/restart an active log.
4190
4194
4191 * Fixed a lot of bugs in log saving/replay. It was pretty
4195 * Fixed a lot of bugs in log saving/replay. It was pretty
4192 broken. Now special lines (!@,/) appear properly in the command
4196 broken. Now special lines (!@,/) appear properly in the command
4193 history after a log replay.
4197 history after a log replay.
4194
4198
4195 * Tried and failed to implement full session saving via pickle. My
4199 * Tried and failed to implement full session saving via pickle. My
4196 idea was to pickle __main__.__dict__, but modules can't be
4200 idea was to pickle __main__.__dict__, but modules can't be
4197 pickled. This would be a better alternative to replaying logs, but
4201 pickled. This would be a better alternative to replaying logs, but
4198 seems quite tricky to get to work. Changed -session to be called
4202 seems quite tricky to get to work. Changed -session to be called
4199 -logplay, which more accurately reflects what it does. And if we
4203 -logplay, which more accurately reflects what it does. And if we
4200 ever get real session saving working, -session is now available.
4204 ever get real session saving working, -session is now available.
4201
4205
4202 * Implemented color schemes for prompts also. As for tracebacks,
4206 * Implemented color schemes for prompts also. As for tracebacks,
4203 currently only NoColor and Linux are supported. But now the
4207 currently only NoColor and Linux are supported. But now the
4204 infrastructure is in place, based on a generic ColorScheme
4208 infrastructure is in place, based on a generic ColorScheme
4205 class. So writing and activating new schemes both for the prompts
4209 class. So writing and activating new schemes both for the prompts
4206 and the tracebacks should be straightforward.
4210 and the tracebacks should be straightforward.
4207
4211
4208 * Version 0.1.13 released, 0.1.14 opened.
4212 * Version 0.1.13 released, 0.1.14 opened.
4209
4213
4210 * Changed handling of options for output cache. Now counter is
4214 * Changed handling of options for output cache. Now counter is
4211 hardwired starting at 1 and one specifies the maximum number of
4215 hardwired starting at 1 and one specifies the maximum number of
4212 entries *in the outcache* (not the max prompt counter). This is
4216 entries *in the outcache* (not the max prompt counter). This is
4213 much better, since many statements won't increase the cache
4217 much better, since many statements won't increase the cache
4214 count. It also eliminated some confusing options, now there's only
4218 count. It also eliminated some confusing options, now there's only
4215 one: cache_size.
4219 one: cache_size.
4216
4220
4217 * Added 'alias' magic function and magic_alias option in the
4221 * Added 'alias' magic function and magic_alias option in the
4218 ipythonrc file. Now the user can easily define whatever names he
4222 ipythonrc file. Now the user can easily define whatever names he
4219 wants for the magic functions without having to play weird
4223 wants for the magic functions without having to play weird
4220 namespace games. This gives IPython a real shell-like feel.
4224 namespace games. This gives IPython a real shell-like feel.
4221
4225
4222 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4226 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4223 @ or not).
4227 @ or not).
4224
4228
4225 This was one of the last remaining 'visible' bugs (that I know
4229 This was one of the last remaining 'visible' bugs (that I know
4226 of). I think if I can clean up the session loading so it works
4230 of). I think if I can clean up the session loading so it works
4227 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4231 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4228 about licensing).
4232 about licensing).
4229
4233
4230 2001-11-25 Fernando Perez <fperez@colorado.edu>
4234 2001-11-25 Fernando Perez <fperez@colorado.edu>
4231
4235
4232 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4236 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4233 there's a cleaner distinction between what ? and ?? show.
4237 there's a cleaner distinction between what ? and ?? show.
4234
4238
4235 * Added screen_length option. Now the user can define his own
4239 * Added screen_length option. Now the user can define his own
4236 screen size for page() operations.
4240 screen size for page() operations.
4237
4241
4238 * Implemented magic shell-like functions with automatic code
4242 * Implemented magic shell-like functions with automatic code
4239 generation. Now adding another function is just a matter of adding
4243 generation. Now adding another function is just a matter of adding
4240 an entry to a dict, and the function is dynamically generated at
4244 an entry to a dict, and the function is dynamically generated at
4241 run-time. Python has some really cool features!
4245 run-time. Python has some really cool features!
4242
4246
4243 * Renamed many options to cleanup conventions a little. Now all
4247 * Renamed many options to cleanup conventions a little. Now all
4244 are lowercase, and only underscores where needed. Also in the code
4248 are lowercase, and only underscores where needed. Also in the code
4245 option name tables are clearer.
4249 option name tables are clearer.
4246
4250
4247 * Changed prompts a little. Now input is 'In [n]:' instead of
4251 * Changed prompts a little. Now input is 'In [n]:' instead of
4248 'In[n]:='. This allows it the numbers to be aligned with the
4252 'In[n]:='. This allows it the numbers to be aligned with the
4249 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4253 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4250 Python (it was a Mathematica thing). The '...' continuation prompt
4254 Python (it was a Mathematica thing). The '...' continuation prompt
4251 was also changed a little to align better.
4255 was also changed a little to align better.
4252
4256
4253 * Fixed bug when flushing output cache. Not all _p<n> variables
4257 * Fixed bug when flushing output cache. Not all _p<n> variables
4254 exist, so their deletion needs to be wrapped in a try:
4258 exist, so their deletion needs to be wrapped in a try:
4255
4259
4256 * Figured out how to properly use inspect.formatargspec() (it
4260 * Figured out how to properly use inspect.formatargspec() (it
4257 requires the args preceded by *). So I removed all the code from
4261 requires the args preceded by *). So I removed all the code from
4258 _get_pdef in Magic, which was just replicating that.
4262 _get_pdef in Magic, which was just replicating that.
4259
4263
4260 * Added test to prefilter to allow redefining magic function names
4264 * Added test to prefilter to allow redefining magic function names
4261 as variables. This is ok, since the @ form is always available,
4265 as variables. This is ok, since the @ form is always available,
4262 but whe should allow the user to define a variable called 'ls' if
4266 but whe should allow the user to define a variable called 'ls' if
4263 he needs it.
4267 he needs it.
4264
4268
4265 * Moved the ToDo information from README into a separate ToDo.
4269 * Moved the ToDo information from README into a separate ToDo.
4266
4270
4267 * General code cleanup and small bugfixes. I think it's close to a
4271 * General code cleanup and small bugfixes. I think it's close to a
4268 state where it can be released, obviously with a big 'beta'
4272 state where it can be released, obviously with a big 'beta'
4269 warning on it.
4273 warning on it.
4270
4274
4271 * Got the magic function split to work. Now all magics are defined
4275 * Got the magic function split to work. Now all magics are defined
4272 in a separate class. It just organizes things a bit, and now
4276 in a separate class. It just organizes things a bit, and now
4273 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4277 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4274 was too long).
4278 was too long).
4275
4279
4276 * Changed @clear to @reset to avoid potential confusions with
4280 * Changed @clear to @reset to avoid potential confusions with
4277 the shell command clear. Also renamed @cl to @clear, which does
4281 the shell command clear. Also renamed @cl to @clear, which does
4278 exactly what people expect it to from their shell experience.
4282 exactly what people expect it to from their shell experience.
4279
4283
4280 Added a check to the @reset command (since it's so
4284 Added a check to the @reset command (since it's so
4281 destructive, it's probably a good idea to ask for confirmation).
4285 destructive, it's probably a good idea to ask for confirmation).
4282 But now reset only works for full namespace resetting. Since the
4286 But now reset only works for full namespace resetting. Since the
4283 del keyword is already there for deleting a few specific
4287 del keyword is already there for deleting a few specific
4284 variables, I don't see the point of having a redundant magic
4288 variables, I don't see the point of having a redundant magic
4285 function for the same task.
4289 function for the same task.
4286
4290
4287 2001-11-24 Fernando Perez <fperez@colorado.edu>
4291 2001-11-24 Fernando Perez <fperez@colorado.edu>
4288
4292
4289 * Updated the builtin docs (esp. the ? ones).
4293 * Updated the builtin docs (esp. the ? ones).
4290
4294
4291 * Ran all the code through pychecker. Not terribly impressed with
4295 * Ran all the code through pychecker. Not terribly impressed with
4292 it: lots of spurious warnings and didn't really find anything of
4296 it: lots of spurious warnings and didn't really find anything of
4293 substance (just a few modules being imported and not used).
4297 substance (just a few modules being imported and not used).
4294
4298
4295 * Implemented the new ultraTB functionality into IPython. New
4299 * Implemented the new ultraTB functionality into IPython. New
4296 option: xcolors. This chooses color scheme. xmode now only selects
4300 option: xcolors. This chooses color scheme. xmode now only selects
4297 between Plain and Verbose. Better orthogonality.
4301 between Plain and Verbose. Better orthogonality.
4298
4302
4299 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4303 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4300 mode and color scheme for the exception handlers. Now it's
4304 mode and color scheme for the exception handlers. Now it's
4301 possible to have the verbose traceback with no coloring.
4305 possible to have the verbose traceback with no coloring.
4302
4306
4303 2001-11-23 Fernando Perez <fperez@colorado.edu>
4307 2001-11-23 Fernando Perez <fperez@colorado.edu>
4304
4308
4305 * Version 0.1.12 released, 0.1.13 opened.
4309 * Version 0.1.12 released, 0.1.13 opened.
4306
4310
4307 * Removed option to set auto-quote and auto-paren escapes by
4311 * Removed option to set auto-quote and auto-paren escapes by
4308 user. The chances of breaking valid syntax are just too high. If
4312 user. The chances of breaking valid syntax are just too high. If
4309 someone *really* wants, they can always dig into the code.
4313 someone *really* wants, they can always dig into the code.
4310
4314
4311 * Made prompt separators configurable.
4315 * Made prompt separators configurable.
4312
4316
4313 2001-11-22 Fernando Perez <fperez@colorado.edu>
4317 2001-11-22 Fernando Perez <fperez@colorado.edu>
4314
4318
4315 * Small bugfixes in many places.
4319 * Small bugfixes in many places.
4316
4320
4317 * Removed the MyCompleter class from ipplib. It seemed redundant
4321 * Removed the MyCompleter class from ipplib. It seemed redundant
4318 with the C-p,C-n history search functionality. Less code to
4322 with the C-p,C-n history search functionality. Less code to
4319 maintain.
4323 maintain.
4320
4324
4321 * Moved all the original ipython.py code into ipythonlib.py. Right
4325 * Moved all the original ipython.py code into ipythonlib.py. Right
4322 now it's just one big dump into a function called make_IPython, so
4326 now it's just one big dump into a function called make_IPython, so
4323 no real modularity has been gained. But at least it makes the
4327 no real modularity has been gained. But at least it makes the
4324 wrapper script tiny, and since ipythonlib is a module, it gets
4328 wrapper script tiny, and since ipythonlib is a module, it gets
4325 compiled and startup is much faster.
4329 compiled and startup is much faster.
4326
4330
4327 This is a reasobably 'deep' change, so we should test it for a
4331 This is a reasobably 'deep' change, so we should test it for a
4328 while without messing too much more with the code.
4332 while without messing too much more with the code.
4329
4333
4330 2001-11-21 Fernando Perez <fperez@colorado.edu>
4334 2001-11-21 Fernando Perez <fperez@colorado.edu>
4331
4335
4332 * Version 0.1.11 released, 0.1.12 opened for further work.
4336 * Version 0.1.11 released, 0.1.12 opened for further work.
4333
4337
4334 * Removed dependency on Itpl. It was only needed in one place. It
4338 * Removed dependency on Itpl. It was only needed in one place. It
4335 would be nice if this became part of python, though. It makes life
4339 would be nice if this became part of python, though. It makes life
4336 *a lot* easier in some cases.
4340 *a lot* easier in some cases.
4337
4341
4338 * Simplified the prefilter code a bit. Now all handlers are
4342 * Simplified the prefilter code a bit. Now all handlers are
4339 expected to explicitly return a value (at least a blank string).
4343 expected to explicitly return a value (at least a blank string).
4340
4344
4341 * Heavy edits in ipplib. Removed the help system altogether. Now
4345 * Heavy edits in ipplib. Removed the help system altogether. Now
4342 obj?/?? is used for inspecting objects, a magic @doc prints
4346 obj?/?? is used for inspecting objects, a magic @doc prints
4343 docstrings, and full-blown Python help is accessed via the 'help'
4347 docstrings, and full-blown Python help is accessed via the 'help'
4344 keyword. This cleans up a lot of code (less to maintain) and does
4348 keyword. This cleans up a lot of code (less to maintain) and does
4345 the job. Since 'help' is now a standard Python component, might as
4349 the job. Since 'help' is now a standard Python component, might as
4346 well use it and remove duplicate functionality.
4350 well use it and remove duplicate functionality.
4347
4351
4348 Also removed the option to use ipplib as a standalone program. By
4352 Also removed the option to use ipplib as a standalone program. By
4349 now it's too dependent on other parts of IPython to function alone.
4353 now it's too dependent on other parts of IPython to function alone.
4350
4354
4351 * Fixed bug in genutils.pager. It would crash if the pager was
4355 * Fixed bug in genutils.pager. It would crash if the pager was
4352 exited immediately after opening (broken pipe).
4356 exited immediately after opening (broken pipe).
4353
4357
4354 * Trimmed down the VerboseTB reporting a little. The header is
4358 * Trimmed down the VerboseTB reporting a little. The header is
4355 much shorter now and the repeated exception arguments at the end
4359 much shorter now and the repeated exception arguments at the end
4356 have been removed. For interactive use the old header seemed a bit
4360 have been removed. For interactive use the old header seemed a bit
4357 excessive.
4361 excessive.
4358
4362
4359 * Fixed small bug in output of @whos for variables with multi-word
4363 * Fixed small bug in output of @whos for variables with multi-word
4360 types (only first word was displayed).
4364 types (only first word was displayed).
4361
4365
4362 2001-11-17 Fernando Perez <fperez@colorado.edu>
4366 2001-11-17 Fernando Perez <fperez@colorado.edu>
4363
4367
4364 * Version 0.1.10 released, 0.1.11 opened for further work.
4368 * Version 0.1.10 released, 0.1.11 opened for further work.
4365
4369
4366 * Modified dirs and friends. dirs now *returns* the stack (not
4370 * Modified dirs and friends. dirs now *returns* the stack (not
4367 prints), so one can manipulate it as a variable. Convenient to
4371 prints), so one can manipulate it as a variable. Convenient to
4368 travel along many directories.
4372 travel along many directories.
4369
4373
4370 * Fixed bug in magic_pdef: would only work with functions with
4374 * Fixed bug in magic_pdef: would only work with functions with
4371 arguments with default values.
4375 arguments with default values.
4372
4376
4373 2001-11-14 Fernando Perez <fperez@colorado.edu>
4377 2001-11-14 Fernando Perez <fperez@colorado.edu>
4374
4378
4375 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4379 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4376 example with IPython. Various other minor fixes and cleanups.
4380 example with IPython. Various other minor fixes and cleanups.
4377
4381
4378 * Version 0.1.9 released, 0.1.10 opened for further work.
4382 * Version 0.1.9 released, 0.1.10 opened for further work.
4379
4383
4380 * Added sys.path to the list of directories searched in the
4384 * Added sys.path to the list of directories searched in the
4381 execfile= option. It used to be the current directory and the
4385 execfile= option. It used to be the current directory and the
4382 user's IPYTHONDIR only.
4386 user's IPYTHONDIR only.
4383
4387
4384 2001-11-13 Fernando Perez <fperez@colorado.edu>
4388 2001-11-13 Fernando Perez <fperez@colorado.edu>
4385
4389
4386 * Reinstated the raw_input/prefilter separation that Janko had
4390 * Reinstated the raw_input/prefilter separation that Janko had
4387 initially. This gives a more convenient setup for extending the
4391 initially. This gives a more convenient setup for extending the
4388 pre-processor from the outside: raw_input always gets a string,
4392 pre-processor from the outside: raw_input always gets a string,
4389 and prefilter has to process it. We can then redefine prefilter
4393 and prefilter has to process it. We can then redefine prefilter
4390 from the outside and implement extensions for special
4394 from the outside and implement extensions for special
4391 purposes.
4395 purposes.
4392
4396
4393 Today I got one for inputting PhysicalQuantity objects
4397 Today I got one for inputting PhysicalQuantity objects
4394 (from Scientific) without needing any function calls at
4398 (from Scientific) without needing any function calls at
4395 all. Extremely convenient, and it's all done as a user-level
4399 all. Extremely convenient, and it's all done as a user-level
4396 extension (no IPython code was touched). Now instead of:
4400 extension (no IPython code was touched). Now instead of:
4397 a = PhysicalQuantity(4.2,'m/s**2')
4401 a = PhysicalQuantity(4.2,'m/s**2')
4398 one can simply say
4402 one can simply say
4399 a = 4.2 m/s**2
4403 a = 4.2 m/s**2
4400 or even
4404 or even
4401 a = 4.2 m/s^2
4405 a = 4.2 m/s^2
4402
4406
4403 I use this, but it's also a proof of concept: IPython really is
4407 I use this, but it's also a proof of concept: IPython really is
4404 fully user-extensible, even at the level of the parsing of the
4408 fully user-extensible, even at the level of the parsing of the
4405 command line. It's not trivial, but it's perfectly doable.
4409 command line. It's not trivial, but it's perfectly doable.
4406
4410
4407 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4411 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4408 the problem of modules being loaded in the inverse order in which
4412 the problem of modules being loaded in the inverse order in which
4409 they were defined in
4413 they were defined in
4410
4414
4411 * Version 0.1.8 released, 0.1.9 opened for further work.
4415 * Version 0.1.8 released, 0.1.9 opened for further work.
4412
4416
4413 * Added magics pdef, source and file. They respectively show the
4417 * Added magics pdef, source and file. They respectively show the
4414 definition line ('prototype' in C), source code and full python
4418 definition line ('prototype' in C), source code and full python
4415 file for any callable object. The object inspector oinfo uses
4419 file for any callable object. The object inspector oinfo uses
4416 these to show the same information.
4420 these to show the same information.
4417
4421
4418 * Version 0.1.7 released, 0.1.8 opened for further work.
4422 * Version 0.1.7 released, 0.1.8 opened for further work.
4419
4423
4420 * Separated all the magic functions into a class called Magic. The
4424 * Separated all the magic functions into a class called Magic. The
4421 InteractiveShell class was becoming too big for Xemacs to handle
4425 InteractiveShell class was becoming too big for Xemacs to handle
4422 (de-indenting a line would lock it up for 10 seconds while it
4426 (de-indenting a line would lock it up for 10 seconds while it
4423 backtracked on the whole class!)
4427 backtracked on the whole class!)
4424
4428
4425 FIXME: didn't work. It can be done, but right now namespaces are
4429 FIXME: didn't work. It can be done, but right now namespaces are
4426 all messed up. Do it later (reverted it for now, so at least
4430 all messed up. Do it later (reverted it for now, so at least
4427 everything works as before).
4431 everything works as before).
4428
4432
4429 * Got the object introspection system (magic_oinfo) working! I
4433 * Got the object introspection system (magic_oinfo) working! I
4430 think this is pretty much ready for release to Janko, so he can
4434 think this is pretty much ready for release to Janko, so he can
4431 test it for a while and then announce it. Pretty much 100% of what
4435 test it for a while and then announce it. Pretty much 100% of what
4432 I wanted for the 'phase 1' release is ready. Happy, tired.
4436 I wanted for the 'phase 1' release is ready. Happy, tired.
4433
4437
4434 2001-11-12 Fernando Perez <fperez@colorado.edu>
4438 2001-11-12 Fernando Perez <fperez@colorado.edu>
4435
4439
4436 * Version 0.1.6 released, 0.1.7 opened for further work.
4440 * Version 0.1.6 released, 0.1.7 opened for further work.
4437
4441
4438 * Fixed bug in printing: it used to test for truth before
4442 * Fixed bug in printing: it used to test for truth before
4439 printing, so 0 wouldn't print. Now checks for None.
4443 printing, so 0 wouldn't print. Now checks for None.
4440
4444
4441 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4445 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4442 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4446 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4443 reaches by hand into the outputcache. Think of a better way to do
4447 reaches by hand into the outputcache. Think of a better way to do
4444 this later.
4448 this later.
4445
4449
4446 * Various small fixes thanks to Nathan's comments.
4450 * Various small fixes thanks to Nathan's comments.
4447
4451
4448 * Changed magic_pprint to magic_Pprint. This way it doesn't
4452 * Changed magic_pprint to magic_Pprint. This way it doesn't
4449 collide with pprint() and the name is consistent with the command
4453 collide with pprint() and the name is consistent with the command
4450 line option.
4454 line option.
4451
4455
4452 * Changed prompt counter behavior to be fully like
4456 * Changed prompt counter behavior to be fully like
4453 Mathematica's. That is, even input that doesn't return a result
4457 Mathematica's. That is, even input that doesn't return a result
4454 raises the prompt counter. The old behavior was kind of confusing
4458 raises the prompt counter. The old behavior was kind of confusing
4455 (getting the same prompt number several times if the operation
4459 (getting the same prompt number several times if the operation
4456 didn't return a result).
4460 didn't return a result).
4457
4461
4458 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4462 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4459
4463
4460 * Fixed -Classic mode (wasn't working anymore).
4464 * Fixed -Classic mode (wasn't working anymore).
4461
4465
4462 * Added colored prompts using Nathan's new code. Colors are
4466 * Added colored prompts using Nathan's new code. Colors are
4463 currently hardwired, they can be user-configurable. For
4467 currently hardwired, they can be user-configurable. For
4464 developers, they can be chosen in file ipythonlib.py, at the
4468 developers, they can be chosen in file ipythonlib.py, at the
4465 beginning of the CachedOutput class def.
4469 beginning of the CachedOutput class def.
4466
4470
4467 2001-11-11 Fernando Perez <fperez@colorado.edu>
4471 2001-11-11 Fernando Perez <fperez@colorado.edu>
4468
4472
4469 * Version 0.1.5 released, 0.1.6 opened for further work.
4473 * Version 0.1.5 released, 0.1.6 opened for further work.
4470
4474
4471 * Changed magic_env to *return* the environment as a dict (not to
4475 * Changed magic_env to *return* the environment as a dict (not to
4472 print it). This way it prints, but it can also be processed.
4476 print it). This way it prints, but it can also be processed.
4473
4477
4474 * Added Verbose exception reporting to interactive
4478 * Added Verbose exception reporting to interactive
4475 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4479 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4476 traceback. Had to make some changes to the ultraTB file. This is
4480 traceback. Had to make some changes to the ultraTB file. This is
4477 probably the last 'big' thing in my mental todo list. This ties
4481 probably the last 'big' thing in my mental todo list. This ties
4478 in with the next entry:
4482 in with the next entry:
4479
4483
4480 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4484 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4481 has to specify is Plain, Color or Verbose for all exception
4485 has to specify is Plain, Color or Verbose for all exception
4482 handling.
4486 handling.
4483
4487
4484 * Removed ShellServices option. All this can really be done via
4488 * Removed ShellServices option. All this can really be done via
4485 the magic system. It's easier to extend, cleaner and has automatic
4489 the magic system. It's easier to extend, cleaner and has automatic
4486 namespace protection and documentation.
4490 namespace protection and documentation.
4487
4491
4488 2001-11-09 Fernando Perez <fperez@colorado.edu>
4492 2001-11-09 Fernando Perez <fperez@colorado.edu>
4489
4493
4490 * Fixed bug in output cache flushing (missing parameter to
4494 * Fixed bug in output cache flushing (missing parameter to
4491 __init__). Other small bugs fixed (found using pychecker).
4495 __init__). Other small bugs fixed (found using pychecker).
4492
4496
4493 * Version 0.1.4 opened for bugfixing.
4497 * Version 0.1.4 opened for bugfixing.
4494
4498
4495 2001-11-07 Fernando Perez <fperez@colorado.edu>
4499 2001-11-07 Fernando Perez <fperez@colorado.edu>
4496
4500
4497 * Version 0.1.3 released, mainly because of the raw_input bug.
4501 * Version 0.1.3 released, mainly because of the raw_input bug.
4498
4502
4499 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4503 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4500 and when testing for whether things were callable, a call could
4504 and when testing for whether things were callable, a call could
4501 actually be made to certain functions. They would get called again
4505 actually be made to certain functions. They would get called again
4502 once 'really' executed, with a resulting double call. A disaster
4506 once 'really' executed, with a resulting double call. A disaster
4503 in many cases (list.reverse() would never work!).
4507 in many cases (list.reverse() would never work!).
4504
4508
4505 * Removed prefilter() function, moved its code to raw_input (which
4509 * Removed prefilter() function, moved its code to raw_input (which
4506 after all was just a near-empty caller for prefilter). This saves
4510 after all was just a near-empty caller for prefilter). This saves
4507 a function call on every prompt, and simplifies the class a tiny bit.
4511 a function call on every prompt, and simplifies the class a tiny bit.
4508
4512
4509 * Fix _ip to __ip name in magic example file.
4513 * Fix _ip to __ip name in magic example file.
4510
4514
4511 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4515 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4512 work with non-gnu versions of tar.
4516 work with non-gnu versions of tar.
4513
4517
4514 2001-11-06 Fernando Perez <fperez@colorado.edu>
4518 2001-11-06 Fernando Perez <fperez@colorado.edu>
4515
4519
4516 * Version 0.1.2. Just to keep track of the recent changes.
4520 * Version 0.1.2. Just to keep track of the recent changes.
4517
4521
4518 * Fixed nasty bug in output prompt routine. It used to check 'if
4522 * Fixed nasty bug in output prompt routine. It used to check 'if
4519 arg != None...'. Problem is, this fails if arg implements a
4523 arg != None...'. Problem is, this fails if arg implements a
4520 special comparison (__cmp__) which disallows comparing to
4524 special comparison (__cmp__) which disallows comparing to
4521 None. Found it when trying to use the PhysicalQuantity module from
4525 None. Found it when trying to use the PhysicalQuantity module from
4522 ScientificPython.
4526 ScientificPython.
4523
4527
4524 2001-11-05 Fernando Perez <fperez@colorado.edu>
4528 2001-11-05 Fernando Perez <fperez@colorado.edu>
4525
4529
4526 * Also added dirs. Now the pushd/popd/dirs family functions
4530 * Also added dirs. Now the pushd/popd/dirs family functions
4527 basically like the shell, with the added convenience of going home
4531 basically like the shell, with the added convenience of going home
4528 when called with no args.
4532 when called with no args.
4529
4533
4530 * pushd/popd slightly modified to mimic shell behavior more
4534 * pushd/popd slightly modified to mimic shell behavior more
4531 closely.
4535 closely.
4532
4536
4533 * Added env,pushd,popd from ShellServices as magic functions. I
4537 * Added env,pushd,popd from ShellServices as magic functions. I
4534 think the cleanest will be to port all desired functions from
4538 think the cleanest will be to port all desired functions from
4535 ShellServices as magics and remove ShellServices altogether. This
4539 ShellServices as magics and remove ShellServices altogether. This
4536 will provide a single, clean way of adding functionality
4540 will provide a single, clean way of adding functionality
4537 (shell-type or otherwise) to IP.
4541 (shell-type or otherwise) to IP.
4538
4542
4539 2001-11-04 Fernando Perez <fperez@colorado.edu>
4543 2001-11-04 Fernando Perez <fperez@colorado.edu>
4540
4544
4541 * Added .ipython/ directory to sys.path. This way users can keep
4545 * Added .ipython/ directory to sys.path. This way users can keep
4542 customizations there and access them via import.
4546 customizations there and access them via import.
4543
4547
4544 2001-11-03 Fernando Perez <fperez@colorado.edu>
4548 2001-11-03 Fernando Perez <fperez@colorado.edu>
4545
4549
4546 * Opened version 0.1.1 for new changes.
4550 * Opened version 0.1.1 for new changes.
4547
4551
4548 * Changed version number to 0.1.0: first 'public' release, sent to
4552 * Changed version number to 0.1.0: first 'public' release, sent to
4549 Nathan and Janko.
4553 Nathan and Janko.
4550
4554
4551 * Lots of small fixes and tweaks.
4555 * Lots of small fixes and tweaks.
4552
4556
4553 * Minor changes to whos format. Now strings are shown, snipped if
4557 * Minor changes to whos format. Now strings are shown, snipped if
4554 too long.
4558 too long.
4555
4559
4556 * Changed ShellServices to work on __main__ so they show up in @who
4560 * Changed ShellServices to work on __main__ so they show up in @who
4557
4561
4558 * Help also works with ? at the end of a line:
4562 * Help also works with ? at the end of a line:
4559 ?sin and sin?
4563 ?sin and sin?
4560 both produce the same effect. This is nice, as often I use the
4564 both produce the same effect. This is nice, as often I use the
4561 tab-complete to find the name of a method, but I used to then have
4565 tab-complete to find the name of a method, but I used to then have
4562 to go to the beginning of the line to put a ? if I wanted more
4566 to go to the beginning of the line to put a ? if I wanted more
4563 info. Now I can just add the ? and hit return. Convenient.
4567 info. Now I can just add the ? and hit return. Convenient.
4564
4568
4565 2001-11-02 Fernando Perez <fperez@colorado.edu>
4569 2001-11-02 Fernando Perez <fperez@colorado.edu>
4566
4570
4567 * Python version check (>=2.1) added.
4571 * Python version check (>=2.1) added.
4568
4572
4569 * Added LazyPython documentation. At this point the docs are quite
4573 * Added LazyPython documentation. At this point the docs are quite
4570 a mess. A cleanup is in order.
4574 a mess. A cleanup is in order.
4571
4575
4572 * Auto-installer created. For some bizarre reason, the zipfiles
4576 * Auto-installer created. For some bizarre reason, the zipfiles
4573 module isn't working on my system. So I made a tar version
4577 module isn't working on my system. So I made a tar version
4574 (hopefully the command line options in various systems won't kill
4578 (hopefully the command line options in various systems won't kill
4575 me).
4579 me).
4576
4580
4577 * Fixes to Struct in genutils. Now all dictionary-like methods are
4581 * Fixes to Struct in genutils. Now all dictionary-like methods are
4578 protected (reasonably).
4582 protected (reasonably).
4579
4583
4580 * Added pager function to genutils and changed ? to print usage
4584 * Added pager function to genutils and changed ? to print usage
4581 note through it (it was too long).
4585 note through it (it was too long).
4582
4586
4583 * Added the LazyPython functionality. Works great! I changed the
4587 * Added the LazyPython functionality. Works great! I changed the
4584 auto-quote escape to ';', it's on home row and next to '. But
4588 auto-quote escape to ';', it's on home row and next to '. But
4585 both auto-quote and auto-paren (still /) escapes are command-line
4589 both auto-quote and auto-paren (still /) escapes are command-line
4586 parameters.
4590 parameters.
4587
4591
4588
4592
4589 2001-11-01 Fernando Perez <fperez@colorado.edu>
4593 2001-11-01 Fernando Perez <fperez@colorado.edu>
4590
4594
4591 * Version changed to 0.0.7. Fairly large change: configuration now
4595 * Version changed to 0.0.7. Fairly large change: configuration now
4592 is all stored in a directory, by default .ipython. There, all
4596 is all stored in a directory, by default .ipython. There, all
4593 config files have normal looking names (not .names)
4597 config files have normal looking names (not .names)
4594
4598
4595 * Version 0.0.6 Released first to Lucas and Archie as a test
4599 * Version 0.0.6 Released first to Lucas and Archie as a test
4596 run. Since it's the first 'semi-public' release, change version to
4600 run. Since it's the first 'semi-public' release, change version to
4597 > 0.0.6 for any changes now.
4601 > 0.0.6 for any changes now.
4598
4602
4599 * Stuff I had put in the ipplib.py changelog:
4603 * Stuff I had put in the ipplib.py changelog:
4600
4604
4601 Changes to InteractiveShell:
4605 Changes to InteractiveShell:
4602
4606
4603 - Made the usage message a parameter.
4607 - Made the usage message a parameter.
4604
4608
4605 - Require the name of the shell variable to be given. It's a bit
4609 - Require the name of the shell variable to be given. It's a bit
4606 of a hack, but allows the name 'shell' not to be hardwire in the
4610 of a hack, but allows the name 'shell' not to be hardwire in the
4607 magic (@) handler, which is problematic b/c it requires
4611 magic (@) handler, which is problematic b/c it requires
4608 polluting the global namespace with 'shell'. This in turn is
4612 polluting the global namespace with 'shell'. This in turn is
4609 fragile: if a user redefines a variable called shell, things
4613 fragile: if a user redefines a variable called shell, things
4610 break.
4614 break.
4611
4615
4612 - magic @: all functions available through @ need to be defined
4616 - magic @: all functions available through @ need to be defined
4613 as magic_<name>, even though they can be called simply as
4617 as magic_<name>, even though they can be called simply as
4614 @<name>. This allows the special command @magic to gather
4618 @<name>. This allows the special command @magic to gather
4615 information automatically about all existing magic functions,
4619 information automatically about all existing magic functions,
4616 even if they are run-time user extensions, by parsing the shell
4620 even if they are run-time user extensions, by parsing the shell
4617 instance __dict__ looking for special magic_ names.
4621 instance __dict__ looking for special magic_ names.
4618
4622
4619 - mainloop: added *two* local namespace parameters. This allows
4623 - mainloop: added *two* local namespace parameters. This allows
4620 the class to differentiate between parameters which were there
4624 the class to differentiate between parameters which were there
4621 before and after command line initialization was processed. This
4625 before and after command line initialization was processed. This
4622 way, later @who can show things loaded at startup by the
4626 way, later @who can show things loaded at startup by the
4623 user. This trick was necessary to make session saving/reloading
4627 user. This trick was necessary to make session saving/reloading
4624 really work: ideally after saving/exiting/reloading a session,
4628 really work: ideally after saving/exiting/reloading a session,
4625 *everythin* should look the same, including the output of @who. I
4629 *everythin* should look the same, including the output of @who. I
4626 was only able to make this work with this double namespace
4630 was only able to make this work with this double namespace
4627 trick.
4631 trick.
4628
4632
4629 - added a header to the logfile which allows (almost) full
4633 - added a header to the logfile which allows (almost) full
4630 session restoring.
4634 session restoring.
4631
4635
4632 - prepend lines beginning with @ or !, with a and log
4636 - prepend lines beginning with @ or !, with a and log
4633 them. Why? !lines: may be useful to know what you did @lines:
4637 them. Why? !lines: may be useful to know what you did @lines:
4634 they may affect session state. So when restoring a session, at
4638 they may affect session state. So when restoring a session, at
4635 least inform the user of their presence. I couldn't quite get
4639 least inform the user of their presence. I couldn't quite get
4636 them to properly re-execute, but at least the user is warned.
4640 them to properly re-execute, but at least the user is warned.
4637
4641
4638 * Started ChangeLog.
4642 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now