##// END OF EJS Templates
%cpaste now strips > from the beginning of lines, after a patch by ...
vivainio -
Show More
@@ -1,2988 +1,2990 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 1380 2006-06-27 11:34:39Z vivainio $"""
4 $Id: Magic.py 1386 2006-07-08 09:32:30Z vivainio $"""
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-2006 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2006 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 shlex
29 import shlex
30 import sys
30 import sys
31 import re
31 import re
32 import tempfile
32 import tempfile
33 import time
33 import time
34 import cPickle as pickle
34 import cPickle as pickle
35 import textwrap
35 import textwrap
36 from cStringIO import StringIO
36 from cStringIO import StringIO
37 from getopt import getopt,GetoptError
37 from getopt import getopt,GetoptError
38 from pprint import pprint, pformat
38 from pprint import pprint, pformat
39
39
40 # profile isn't bundled by default in Debian for license reasons
40 # profile isn't bundled by default in Debian for license reasons
41 try:
41 try:
42 import profile,pstats
42 import profile,pstats
43 except ImportError:
43 except ImportError:
44 profile = pstats = None
44 profile = pstats = None
45
45
46 # Homebrewed
46 # Homebrewed
47 import IPython
47 import IPython
48 from IPython import Debugger, OInspect, wildcard
48 from IPython import Debugger, OInspect, wildcard
49 from IPython.FakeModule import FakeModule
49 from IPython.FakeModule import FakeModule
50 from IPython.Itpl import Itpl, itpl, printpl,itplns
50 from IPython.Itpl import Itpl, itpl, printpl,itplns
51 from IPython.PyColorize import Parser
51 from IPython.PyColorize import Parser
52 from IPython.ipstruct import Struct
52 from IPython.ipstruct import Struct
53 from IPython.macro import Macro
53 from IPython.macro import Macro
54 from IPython.genutils import *
54 from IPython.genutils import *
55 from IPython import platutils
55 from IPython import platutils
56
56
57 #***************************************************************************
57 #***************************************************************************
58 # Utility functions
58 # Utility functions
59 def on_off(tag):
59 def on_off(tag):
60 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
60 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
61 return ['OFF','ON'][tag]
61 return ['OFF','ON'][tag]
62
62
63 class Bunch: pass
63 class Bunch: pass
64
64
65 #***************************************************************************
65 #***************************************************************************
66 # Main class implementing Magic functionality
66 # Main class implementing Magic functionality
67 class Magic:
67 class Magic:
68 """Magic functions for InteractiveShell.
68 """Magic functions for InteractiveShell.
69
69
70 Shell functions which can be reached as %function_name. All magic
70 Shell functions which can be reached as %function_name. All magic
71 functions should accept a string, which they can parse for their own
71 functions should accept a string, which they can parse for their own
72 needs. This can make some functions easier to type, eg `%cd ../`
72 needs. This can make some functions easier to type, eg `%cd ../`
73 vs. `%cd("../")`
73 vs. `%cd("../")`
74
74
75 ALL definitions MUST begin with the prefix magic_. The user won't need it
75 ALL definitions MUST begin with the prefix magic_. The user won't need it
76 at the command line, but it is is needed in the definition. """
76 at the command line, but it is is needed in the definition. """
77
77
78 # class globals
78 # class globals
79 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
79 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
80 'Automagic is ON, % prefix NOT needed for magic functions.']
80 'Automagic is ON, % prefix NOT needed for magic functions.']
81
81
82 #......................................................................
82 #......................................................................
83 # some utility functions
83 # some utility functions
84
84
85 def __init__(self,shell):
85 def __init__(self,shell):
86
86
87 self.options_table = {}
87 self.options_table = {}
88 if profile is None:
88 if profile is None:
89 self.magic_prun = self.profile_missing_notice
89 self.magic_prun = self.profile_missing_notice
90 self.shell = shell
90 self.shell = shell
91
91
92 # namespace for holding state we may need
92 # namespace for holding state we may need
93 self._magic_state = Bunch()
93 self._magic_state = Bunch()
94
94
95 def profile_missing_notice(self, *args, **kwargs):
95 def profile_missing_notice(self, *args, **kwargs):
96 error("""\
96 error("""\
97 The profile module could not be found. If you are a Debian user,
97 The profile module could not be found. If you are a Debian user,
98 it has been removed from the standard Debian package because of its non-free
98 it has been removed from the standard Debian package because of its non-free
99 license. To use profiling, please install"python2.3-profiler" from non-free.""")
99 license. To use profiling, please install"python2.3-profiler" from non-free.""")
100
100
101 def default_option(self,fn,optstr):
101 def default_option(self,fn,optstr):
102 """Make an entry in the options_table for fn, with value optstr"""
102 """Make an entry in the options_table for fn, with value optstr"""
103
103
104 if fn not in self.lsmagic():
104 if fn not in self.lsmagic():
105 error("%s is not a magic function" % fn)
105 error("%s is not a magic function" % fn)
106 self.options_table[fn] = optstr
106 self.options_table[fn] = optstr
107
107
108 def lsmagic(self):
108 def lsmagic(self):
109 """Return a list of currently available magic functions.
109 """Return a list of currently available magic functions.
110
110
111 Gives a list of the bare names after mangling (['ls','cd', ...], not
111 Gives a list of the bare names after mangling (['ls','cd', ...], not
112 ['magic_ls','magic_cd',...]"""
112 ['magic_ls','magic_cd',...]"""
113
113
114 # FIXME. This needs a cleanup, in the way the magics list is built.
114 # FIXME. This needs a cleanup, in the way the magics list is built.
115
115
116 # magics in class definition
116 # magics in class definition
117 class_magic = lambda fn: fn.startswith('magic_') and \
117 class_magic = lambda fn: fn.startswith('magic_') and \
118 callable(Magic.__dict__[fn])
118 callable(Magic.__dict__[fn])
119 # in instance namespace (run-time user additions)
119 # in instance namespace (run-time user additions)
120 inst_magic = lambda fn: fn.startswith('magic_') and \
120 inst_magic = lambda fn: fn.startswith('magic_') and \
121 callable(self.__dict__[fn])
121 callable(self.__dict__[fn])
122 # and bound magics by user (so they can access self):
122 # and bound magics by user (so they can access self):
123 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
123 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
124 callable(self.__class__.__dict__[fn])
124 callable(self.__class__.__dict__[fn])
125 magics = filter(class_magic,Magic.__dict__.keys()) + \
125 magics = filter(class_magic,Magic.__dict__.keys()) + \
126 filter(inst_magic,self.__dict__.keys()) + \
126 filter(inst_magic,self.__dict__.keys()) + \
127 filter(inst_bound_magic,self.__class__.__dict__.keys())
127 filter(inst_bound_magic,self.__class__.__dict__.keys())
128 out = []
128 out = []
129 for fn in magics:
129 for fn in magics:
130 out.append(fn.replace('magic_','',1))
130 out.append(fn.replace('magic_','',1))
131 out.sort()
131 out.sort()
132 return out
132 return out
133
133
134 def extract_input_slices(self,slices,raw=False):
134 def extract_input_slices(self,slices,raw=False):
135 """Return as a string a set of input history slices.
135 """Return as a string a set of input history slices.
136
136
137 Inputs:
137 Inputs:
138
138
139 - slices: the set of slices is given as a list of strings (like
139 - slices: the set of slices is given as a list of strings (like
140 ['1','4:8','9'], since this function is for use by magic functions
140 ['1','4:8','9'], since this function is for use by magic functions
141 which get their arguments as strings.
141 which get their arguments as strings.
142
142
143 Optional inputs:
143 Optional inputs:
144
144
145 - raw(False): by default, the processed input is used. If this is
145 - raw(False): by default, the processed input is used. If this is
146 true, the raw input history is used instead.
146 true, the raw input history is used instead.
147
147
148 Note that slices can be called with two notations:
148 Note that slices can be called with two notations:
149
149
150 N:M -> standard python form, means including items N...(M-1).
150 N:M -> standard python form, means including items N...(M-1).
151
151
152 N-M -> include items N..M (closed endpoint)."""
152 N-M -> include items N..M (closed endpoint)."""
153
153
154 if raw:
154 if raw:
155 hist = self.shell.input_hist_raw
155 hist = self.shell.input_hist_raw
156 else:
156 else:
157 hist = self.shell.input_hist
157 hist = self.shell.input_hist
158
158
159 cmds = []
159 cmds = []
160 for chunk in slices:
160 for chunk in slices:
161 if ':' in chunk:
161 if ':' in chunk:
162 ini,fin = map(int,chunk.split(':'))
162 ini,fin = map(int,chunk.split(':'))
163 elif '-' in chunk:
163 elif '-' in chunk:
164 ini,fin = map(int,chunk.split('-'))
164 ini,fin = map(int,chunk.split('-'))
165 fin += 1
165 fin += 1
166 else:
166 else:
167 ini = int(chunk)
167 ini = int(chunk)
168 fin = ini+1
168 fin = ini+1
169 cmds.append(hist[ini:fin])
169 cmds.append(hist[ini:fin])
170 return cmds
170 return cmds
171
171
172 def _ofind(self,oname):
172 def _ofind(self,oname):
173 """Find an object in the available namespaces.
173 """Find an object in the available namespaces.
174
174
175 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
175 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
176
176
177 Has special code to detect magic functions.
177 Has special code to detect magic functions.
178 """
178 """
179
179
180 oname = oname.strip()
180 oname = oname.strip()
181
181
182 # Namespaces to search in:
182 # Namespaces to search in:
183 user_ns = self.shell.user_ns
183 user_ns = self.shell.user_ns
184 internal_ns = self.shell.internal_ns
184 internal_ns = self.shell.internal_ns
185 builtin_ns = __builtin__.__dict__
185 builtin_ns = __builtin__.__dict__
186 alias_ns = self.shell.alias_table
186 alias_ns = self.shell.alias_table
187
187
188 # Put them in a list. The order is important so that we find things in
188 # Put them in a list. The order is important so that we find things in
189 # the same order that Python finds them.
189 # the same order that Python finds them.
190 namespaces = [ ('Interactive',user_ns),
190 namespaces = [ ('Interactive',user_ns),
191 ('IPython internal',internal_ns),
191 ('IPython internal',internal_ns),
192 ('Python builtin',builtin_ns),
192 ('Python builtin',builtin_ns),
193 ('Alias',alias_ns),
193 ('Alias',alias_ns),
194 ]
194 ]
195
195
196 # initialize results to 'null'
196 # initialize results to 'null'
197 found = 0; obj = None; ospace = None; ds = None;
197 found = 0; obj = None; ospace = None; ds = None;
198 ismagic = 0; isalias = 0; parent = None
198 ismagic = 0; isalias = 0; parent = None
199
199
200 # Look for the given name by splitting it in parts. If the head is
200 # Look for the given name by splitting it in parts. If the head is
201 # found, then we look for all the remaining parts as members, and only
201 # found, then we look for all the remaining parts as members, and only
202 # declare success if we can find them all.
202 # declare success if we can find them all.
203 oname_parts = oname.split('.')
203 oname_parts = oname.split('.')
204 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
204 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
205 for nsname,ns in namespaces:
205 for nsname,ns in namespaces:
206 try:
206 try:
207 obj = ns[oname_head]
207 obj = ns[oname_head]
208 except KeyError:
208 except KeyError:
209 continue
209 continue
210 else:
210 else:
211 for part in oname_rest:
211 for part in oname_rest:
212 try:
212 try:
213 parent = obj
213 parent = obj
214 obj = getattr(obj,part)
214 obj = getattr(obj,part)
215 except:
215 except:
216 # Blanket except b/c some badly implemented objects
216 # Blanket except b/c some badly implemented objects
217 # allow __getattr__ to raise exceptions other than
217 # allow __getattr__ to raise exceptions other than
218 # AttributeError, which then crashes IPython.
218 # AttributeError, which then crashes IPython.
219 break
219 break
220 else:
220 else:
221 # If we finish the for loop (no break), we got all members
221 # If we finish the for loop (no break), we got all members
222 found = 1
222 found = 1
223 ospace = nsname
223 ospace = nsname
224 if ns == alias_ns:
224 if ns == alias_ns:
225 isalias = 1
225 isalias = 1
226 break # namespace loop
226 break # namespace loop
227
227
228 # Try to see if it's magic
228 # Try to see if it's magic
229 if not found:
229 if not found:
230 if oname.startswith(self.shell.ESC_MAGIC):
230 if oname.startswith(self.shell.ESC_MAGIC):
231 oname = oname[1:]
231 oname = oname[1:]
232 obj = getattr(self,'magic_'+oname,None)
232 obj = getattr(self,'magic_'+oname,None)
233 if obj is not None:
233 if obj is not None:
234 found = 1
234 found = 1
235 ospace = 'IPython internal'
235 ospace = 'IPython internal'
236 ismagic = 1
236 ismagic = 1
237
237
238 # Last try: special-case some literals like '', [], {}, etc:
238 # Last try: special-case some literals like '', [], {}, etc:
239 if not found and oname_head in ["''",'""','[]','{}','()']:
239 if not found and oname_head in ["''",'""','[]','{}','()']:
240 obj = eval(oname_head)
240 obj = eval(oname_head)
241 found = 1
241 found = 1
242 ospace = 'Interactive'
242 ospace = 'Interactive'
243
243
244 return {'found':found, 'obj':obj, 'namespace':ospace,
244 return {'found':found, 'obj':obj, 'namespace':ospace,
245 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
245 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
246
246
247 def arg_err(self,func):
247 def arg_err(self,func):
248 """Print docstring if incorrect arguments were passed"""
248 """Print docstring if incorrect arguments were passed"""
249 print 'Error in arguments:'
249 print 'Error in arguments:'
250 print OInspect.getdoc(func)
250 print OInspect.getdoc(func)
251
251
252 def format_latex(self,strng):
252 def format_latex(self,strng):
253 """Format a string for latex inclusion."""
253 """Format a string for latex inclusion."""
254
254
255 # Characters that need to be escaped for latex:
255 # Characters that need to be escaped for latex:
256 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
256 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
257 # Magic command names as headers:
257 # Magic command names as headers:
258 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
258 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
259 re.MULTILINE)
259 re.MULTILINE)
260 # Magic commands
260 # Magic commands
261 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
261 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
262 re.MULTILINE)
262 re.MULTILINE)
263 # Paragraph continue
263 # Paragraph continue
264 par_re = re.compile(r'\\$',re.MULTILINE)
264 par_re = re.compile(r'\\$',re.MULTILINE)
265
265
266 # The "\n" symbol
266 # The "\n" symbol
267 newline_re = re.compile(r'\\n')
267 newline_re = re.compile(r'\\n')
268
268
269 # Now build the string for output:
269 # Now build the string for output:
270 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
270 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
271 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
271 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
272 strng)
272 strng)
273 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
273 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
274 strng = par_re.sub(r'\\\\',strng)
274 strng = par_re.sub(r'\\\\',strng)
275 strng = escape_re.sub(r'\\\1',strng)
275 strng = escape_re.sub(r'\\\1',strng)
276 strng = newline_re.sub(r'\\textbackslash{}n',strng)
276 strng = newline_re.sub(r'\\textbackslash{}n',strng)
277 return strng
277 return strng
278
278
279 def format_screen(self,strng):
279 def format_screen(self,strng):
280 """Format a string for screen printing.
280 """Format a string for screen printing.
281
281
282 This removes some latex-type format codes."""
282 This removes some latex-type format codes."""
283 # Paragraph continue
283 # Paragraph continue
284 par_re = re.compile(r'\\$',re.MULTILINE)
284 par_re = re.compile(r'\\$',re.MULTILINE)
285 strng = par_re.sub('',strng)
285 strng = par_re.sub('',strng)
286 return strng
286 return strng
287
287
288 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
288 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
289 """Parse options passed to an argument string.
289 """Parse options passed to an argument string.
290
290
291 The interface is similar to that of getopt(), but it returns back a
291 The interface is similar to that of getopt(), but it returns back a
292 Struct with the options as keys and the stripped argument string still
292 Struct with the options as keys and the stripped argument string still
293 as a string.
293 as a string.
294
294
295 arg_str is quoted as a true sys.argv vector by using shlex.split.
295 arg_str is quoted as a true sys.argv vector by using shlex.split.
296 This allows us to easily expand variables, glob files, quote
296 This allows us to easily expand variables, glob files, quote
297 arguments, etc.
297 arguments, etc.
298
298
299 Options:
299 Options:
300 -mode: default 'string'. If given as 'list', the argument string is
300 -mode: default 'string'. If given as 'list', the argument string is
301 returned as a list (split on whitespace) instead of a string.
301 returned as a list (split on whitespace) instead of a string.
302
302
303 -list_all: put all option values in lists. Normally only options
303 -list_all: put all option values in lists. Normally only options
304 appearing more than once are put in a list."""
304 appearing more than once are put in a list."""
305
305
306 # inject default options at the beginning of the input line
306 # inject default options at the beginning of the input line
307 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
307 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
308 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
308 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
309
309
310 mode = kw.get('mode','string')
310 mode = kw.get('mode','string')
311 if mode not in ['string','list']:
311 if mode not in ['string','list']:
312 raise ValueError,'incorrect mode given: %s' % mode
312 raise ValueError,'incorrect mode given: %s' % mode
313 # Get options
313 # Get options
314 list_all = kw.get('list_all',0)
314 list_all = kw.get('list_all',0)
315
315
316 # Check if we have more than one argument to warrant extra processing:
316 # Check if we have more than one argument to warrant extra processing:
317 odict = {} # Dictionary with options
317 odict = {} # Dictionary with options
318 args = arg_str.split()
318 args = arg_str.split()
319 if len(args) >= 1:
319 if len(args) >= 1:
320 # If the list of inputs only has 0 or 1 thing in it, there's no
320 # If the list of inputs only has 0 or 1 thing in it, there's no
321 # need to look for options
321 # need to look for options
322 argv = shlex.split(arg_str)
322 argv = shlex.split(arg_str)
323 # Do regular option processing
323 # Do regular option processing
324 try:
324 try:
325 opts,args = getopt(argv,opt_str,*long_opts)
325 opts,args = getopt(argv,opt_str,*long_opts)
326 except GetoptError,e:
326 except GetoptError,e:
327 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
327 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
328 " ".join(long_opts)))
328 " ".join(long_opts)))
329 for o,a in opts:
329 for o,a in opts:
330 if o.startswith('--'):
330 if o.startswith('--'):
331 o = o[2:]
331 o = o[2:]
332 else:
332 else:
333 o = o[1:]
333 o = o[1:]
334 try:
334 try:
335 odict[o].append(a)
335 odict[o].append(a)
336 except AttributeError:
336 except AttributeError:
337 odict[o] = [odict[o],a]
337 odict[o] = [odict[o],a]
338 except KeyError:
338 except KeyError:
339 if list_all:
339 if list_all:
340 odict[o] = [a]
340 odict[o] = [a]
341 else:
341 else:
342 odict[o] = a
342 odict[o] = a
343
343
344 # Prepare opts,args for return
344 # Prepare opts,args for return
345 opts = Struct(odict)
345 opts = Struct(odict)
346 if mode == 'string':
346 if mode == 'string':
347 args = ' '.join(args)
347 args = ' '.join(args)
348
348
349 return opts,args
349 return opts,args
350
350
351 #......................................................................
351 #......................................................................
352 # And now the actual magic functions
352 # And now the actual magic functions
353
353
354 # Functions for IPython shell work (vars,funcs, config, etc)
354 # Functions for IPython shell work (vars,funcs, config, etc)
355 def magic_lsmagic(self, parameter_s = ''):
355 def magic_lsmagic(self, parameter_s = ''):
356 """List currently available magic functions."""
356 """List currently available magic functions."""
357 mesc = self.shell.ESC_MAGIC
357 mesc = self.shell.ESC_MAGIC
358 print 'Available magic functions:\n'+mesc+\
358 print 'Available magic functions:\n'+mesc+\
359 (' '+mesc).join(self.lsmagic())
359 (' '+mesc).join(self.lsmagic())
360 print '\n' + Magic.auto_status[self.shell.rc.automagic]
360 print '\n' + Magic.auto_status[self.shell.rc.automagic]
361 return None
361 return None
362
362
363 def magic_magic(self, parameter_s = ''):
363 def magic_magic(self, parameter_s = ''):
364 """Print information about the magic function system."""
364 """Print information about the magic function system."""
365
365
366 mode = ''
366 mode = ''
367 try:
367 try:
368 if parameter_s.split()[0] == '-latex':
368 if parameter_s.split()[0] == '-latex':
369 mode = 'latex'
369 mode = 'latex'
370 if parameter_s.split()[0] == '-brief':
370 if parameter_s.split()[0] == '-brief':
371 mode = 'brief'
371 mode = 'brief'
372 except:
372 except:
373 pass
373 pass
374
374
375 magic_docs = []
375 magic_docs = []
376 for fname in self.lsmagic():
376 for fname in self.lsmagic():
377 mname = 'magic_' + fname
377 mname = 'magic_' + fname
378 for space in (Magic,self,self.__class__):
378 for space in (Magic,self,self.__class__):
379 try:
379 try:
380 fn = space.__dict__[mname]
380 fn = space.__dict__[mname]
381 except KeyError:
381 except KeyError:
382 pass
382 pass
383 else:
383 else:
384 break
384 break
385 if mode == 'brief':
385 if mode == 'brief':
386 # only first line
386 # only first line
387 fndoc = fn.__doc__.split('\n',1)[0]
387 fndoc = fn.__doc__.split('\n',1)[0]
388 else:
388 else:
389 fndoc = fn.__doc__
389 fndoc = fn.__doc__
390
390
391 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
391 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
392 fname,fndoc))
392 fname,fndoc))
393 magic_docs = ''.join(magic_docs)
393 magic_docs = ''.join(magic_docs)
394
394
395 if mode == 'latex':
395 if mode == 'latex':
396 print self.format_latex(magic_docs)
396 print self.format_latex(magic_docs)
397 return
397 return
398 else:
398 else:
399 magic_docs = self.format_screen(magic_docs)
399 magic_docs = self.format_screen(magic_docs)
400 if mode == 'brief':
400 if mode == 'brief':
401 return magic_docs
401 return magic_docs
402
402
403 outmsg = """
403 outmsg = """
404 IPython's 'magic' functions
404 IPython's 'magic' functions
405 ===========================
405 ===========================
406
406
407 The magic function system provides a series of functions which allow you to
407 The magic function system provides a series of functions which allow you to
408 control the behavior of IPython itself, plus a lot of system-type
408 control the behavior of IPython itself, plus a lot of system-type
409 features. All these functions are prefixed with a % character, but parameters
409 features. All these functions are prefixed with a % character, but parameters
410 are given without parentheses or quotes.
410 are given without parentheses or quotes.
411
411
412 NOTE: If you have 'automagic' enabled (via the command line option or with the
412 NOTE: If you have 'automagic' enabled (via the command line option or with the
413 %automagic function), you don't need to type in the % explicitly. By default,
413 %automagic function), you don't need to type in the % explicitly. By default,
414 IPython ships with automagic on, so you should only rarely need the % escape.
414 IPython ships with automagic on, so you should only rarely need the % escape.
415
415
416 Example: typing '%cd mydir' (without the quotes) changes you working directory
416 Example: typing '%cd mydir' (without the quotes) changes you working directory
417 to 'mydir', if it exists.
417 to 'mydir', if it exists.
418
418
419 You can define your own magic functions to extend the system. See the supplied
419 You can define your own magic functions to extend the system. See the supplied
420 ipythonrc and example-magic.py files for details (in your ipython
420 ipythonrc and example-magic.py files for details (in your ipython
421 configuration directory, typically $HOME/.ipython/).
421 configuration directory, typically $HOME/.ipython/).
422
422
423 You can also define your own aliased names for magic functions. In your
423 You can also define your own aliased names for magic functions. In your
424 ipythonrc file, placing a line like:
424 ipythonrc file, placing a line like:
425
425
426 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
426 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
427
427
428 will define %pf as a new name for %profile.
428 will define %pf as a new name for %profile.
429
429
430 You can also call magics in code using the ipmagic() function, which IPython
430 You can also call magics in code using the ipmagic() function, which IPython
431 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
431 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
432
432
433 For a list of the available magic functions, use %lsmagic. For a description
433 For a list of the available magic functions, use %lsmagic. For a description
434 of any of them, type %magic_name?, e.g. '%cd?'.
434 of any of them, type %magic_name?, e.g. '%cd?'.
435
435
436 Currently the magic system has the following functions:\n"""
436 Currently the magic system has the following functions:\n"""
437
437
438 mesc = self.shell.ESC_MAGIC
438 mesc = self.shell.ESC_MAGIC
439 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
439 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
440 "\n\n%s%s\n\n%s" % (outmsg,
440 "\n\n%s%s\n\n%s" % (outmsg,
441 magic_docs,mesc,mesc,
441 magic_docs,mesc,mesc,
442 (' '+mesc).join(self.lsmagic()),
442 (' '+mesc).join(self.lsmagic()),
443 Magic.auto_status[self.shell.rc.automagic] ) )
443 Magic.auto_status[self.shell.rc.automagic] ) )
444
444
445 page(outmsg,screen_lines=self.shell.rc.screen_length)
445 page(outmsg,screen_lines=self.shell.rc.screen_length)
446
446
447 def magic_automagic(self, parameter_s = ''):
447 def magic_automagic(self, parameter_s = ''):
448 """Make magic functions callable without having to type the initial %.
448 """Make magic functions callable without having to type the initial %.
449
449
450 Toggles on/off (when off, you must call it as %automagic, of
450 Toggles on/off (when off, you must call it as %automagic, of
451 course). Note that magic functions have lowest priority, so if there's
451 course). Note that magic functions have lowest priority, so if there's
452 a variable whose name collides with that of a magic fn, automagic
452 a variable whose name collides with that of a magic fn, automagic
453 won't work for that function (you get the variable instead). However,
453 won't work for that function (you get the variable instead). However,
454 if you delete the variable (del var), the previously shadowed magic
454 if you delete the variable (del var), the previously shadowed magic
455 function becomes visible to automagic again."""
455 function becomes visible to automagic again."""
456
456
457 rc = self.shell.rc
457 rc = self.shell.rc
458 rc.automagic = not rc.automagic
458 rc.automagic = not rc.automagic
459 print '\n' + Magic.auto_status[rc.automagic]
459 print '\n' + Magic.auto_status[rc.automagic]
460
460
461 def magic_autocall(self, parameter_s = ''):
461 def magic_autocall(self, parameter_s = ''):
462 """Make functions callable without having to type parentheses.
462 """Make functions callable without having to type parentheses.
463
463
464 Usage:
464 Usage:
465
465
466 %autocall [mode]
466 %autocall [mode]
467
467
468 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
468 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
469 value is toggled on and off (remembering the previous state)."""
469 value is toggled on and off (remembering the previous state)."""
470
470
471 rc = self.shell.rc
471 rc = self.shell.rc
472
472
473 if parameter_s:
473 if parameter_s:
474 arg = int(parameter_s)
474 arg = int(parameter_s)
475 else:
475 else:
476 arg = 'toggle'
476 arg = 'toggle'
477
477
478 if not arg in (0,1,2,'toggle'):
478 if not arg in (0,1,2,'toggle'):
479 error('Valid modes: (0->Off, 1->Smart, 2->Full')
479 error('Valid modes: (0->Off, 1->Smart, 2->Full')
480 return
480 return
481
481
482 if arg in (0,1,2):
482 if arg in (0,1,2):
483 rc.autocall = arg
483 rc.autocall = arg
484 else: # toggle
484 else: # toggle
485 if rc.autocall:
485 if rc.autocall:
486 self._magic_state.autocall_save = rc.autocall
486 self._magic_state.autocall_save = rc.autocall
487 rc.autocall = 0
487 rc.autocall = 0
488 else:
488 else:
489 try:
489 try:
490 rc.autocall = self._magic_state.autocall_save
490 rc.autocall = self._magic_state.autocall_save
491 except AttributeError:
491 except AttributeError:
492 rc.autocall = self._magic_state.autocall_save = 1
492 rc.autocall = self._magic_state.autocall_save = 1
493
493
494 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
494 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
495
495
496 def magic_autoindent(self, parameter_s = ''):
496 def magic_autoindent(self, parameter_s = ''):
497 """Toggle autoindent on/off (if available)."""
497 """Toggle autoindent on/off (if available)."""
498
498
499 self.shell.set_autoindent()
499 self.shell.set_autoindent()
500 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
500 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
501
501
502 def magic_system_verbose(self, parameter_s = ''):
502 def magic_system_verbose(self, parameter_s = ''):
503 """Toggle verbose printing of system calls on/off."""
503 """Toggle verbose printing of system calls on/off."""
504
504
505 self.shell.rc_set_toggle('system_verbose')
505 self.shell.rc_set_toggle('system_verbose')
506 print "System verbose printing is:",\
506 print "System verbose printing is:",\
507 ['OFF','ON'][self.shell.rc.system_verbose]
507 ['OFF','ON'][self.shell.rc.system_verbose]
508
508
509 def magic_history(self, parameter_s = ''):
509 def magic_history(self, parameter_s = ''):
510 """Print input history (_i<n> variables), with most recent last.
510 """Print input history (_i<n> variables), with most recent last.
511
511
512 %history -> print at most 40 inputs (some may be multi-line)\\
512 %history -> print at most 40 inputs (some may be multi-line)\\
513 %history n -> print at most n inputs\\
513 %history n -> print at most n inputs\\
514 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
514 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
515
515
516 Each input's number <n> is shown, and is accessible as the
516 Each input's number <n> is shown, and is accessible as the
517 automatically generated variable _i<n>. Multi-line statements are
517 automatically generated variable _i<n>. Multi-line statements are
518 printed starting at a new line for easy copy/paste.
518 printed starting at a new line for easy copy/paste.
519
519
520
520
521 Options:
521 Options:
522
522
523 -n: do NOT print line numbers. This is useful if you want to get a
523 -n: do NOT print line numbers. This is useful if you want to get a
524 printout of many lines which can be directly pasted into a text
524 printout of many lines which can be directly pasted into a text
525 editor.
525 editor.
526
526
527 This feature is only available if numbered prompts are in use.
527 This feature is only available if numbered prompts are in use.
528
528
529 -r: print the 'raw' history. IPython filters your input and
529 -r: print the 'raw' history. IPython filters your input and
530 converts it all into valid Python source before executing it (things
530 converts it all into valid Python source before executing it (things
531 like magics or aliases are turned into function calls, for
531 like magics or aliases are turned into function calls, for
532 example). With this option, you'll see the unfiltered history
532 example). With this option, you'll see the unfiltered history
533 instead of the filtered version: '%cd /' will be seen as '%cd /'
533 instead of the filtered version: '%cd /' will be seen as '%cd /'
534 instead of '_ip.magic("%cd /")'.
534 instead of '_ip.magic("%cd /")'.
535 """
535 """
536
536
537 shell = self.shell
537 shell = self.shell
538 if not shell.outputcache.do_full_cache:
538 if not shell.outputcache.do_full_cache:
539 print 'This feature is only available if numbered prompts are in use.'
539 print 'This feature is only available if numbered prompts are in use.'
540 return
540 return
541 opts,args = self.parse_options(parameter_s,'nr',mode='list')
541 opts,args = self.parse_options(parameter_s,'nr',mode='list')
542
542
543 if opts.has_key('r'):
543 if opts.has_key('r'):
544 input_hist = shell.input_hist_raw
544 input_hist = shell.input_hist_raw
545 else:
545 else:
546 input_hist = shell.input_hist
546 input_hist = shell.input_hist
547
547
548 default_length = 40
548 default_length = 40
549 if len(args) == 0:
549 if len(args) == 0:
550 final = len(input_hist)
550 final = len(input_hist)
551 init = max(1,final-default_length)
551 init = max(1,final-default_length)
552 elif len(args) == 1:
552 elif len(args) == 1:
553 final = len(input_hist)
553 final = len(input_hist)
554 init = max(1,final-int(args[0]))
554 init = max(1,final-int(args[0]))
555 elif len(args) == 2:
555 elif len(args) == 2:
556 init,final = map(int,args)
556 init,final = map(int,args)
557 else:
557 else:
558 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
558 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
559 print self.magic_hist.__doc__
559 print self.magic_hist.__doc__
560 return
560 return
561 width = len(str(final))
561 width = len(str(final))
562 line_sep = ['','\n']
562 line_sep = ['','\n']
563 print_nums = not opts.has_key('n')
563 print_nums = not opts.has_key('n')
564 for in_num in range(init,final):
564 for in_num in range(init,final):
565 inline = input_hist[in_num]
565 inline = input_hist[in_num]
566 multiline = int(inline.count('\n') > 1)
566 multiline = int(inline.count('\n') > 1)
567 if print_nums:
567 if print_nums:
568 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
568 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
569 print inline,
569 print inline,
570
570
571 def magic_hist(self, parameter_s=''):
571 def magic_hist(self, parameter_s=''):
572 """Alternate name for %history."""
572 """Alternate name for %history."""
573 return self.magic_history(parameter_s)
573 return self.magic_history(parameter_s)
574
574
575 def magic_p(self, parameter_s=''):
575 def magic_p(self, parameter_s=''):
576 """Just a short alias for Python's 'print'."""
576 """Just a short alias for Python's 'print'."""
577 exec 'print ' + parameter_s in self.shell.user_ns
577 exec 'print ' + parameter_s in self.shell.user_ns
578
578
579 def magic_r(self, parameter_s=''):
579 def magic_r(self, parameter_s=''):
580 """Repeat previous input.
580 """Repeat previous input.
581
581
582 If given an argument, repeats the previous command which starts with
582 If given an argument, repeats the previous command which starts with
583 the same string, otherwise it just repeats the previous input.
583 the same string, otherwise it just repeats the previous input.
584
584
585 Shell escaped commands (with ! as first character) are not recognized
585 Shell escaped commands (with ! as first character) are not recognized
586 by this system, only pure python code and magic commands.
586 by this system, only pure python code and magic commands.
587 """
587 """
588
588
589 start = parameter_s.strip()
589 start = parameter_s.strip()
590 esc_magic = self.shell.ESC_MAGIC
590 esc_magic = self.shell.ESC_MAGIC
591 # Identify magic commands even if automagic is on (which means
591 # Identify magic commands even if automagic is on (which means
592 # the in-memory version is different from that typed by the user).
592 # the in-memory version is different from that typed by the user).
593 if self.shell.rc.automagic:
593 if self.shell.rc.automagic:
594 start_magic = esc_magic+start
594 start_magic = esc_magic+start
595 else:
595 else:
596 start_magic = start
596 start_magic = start
597 # Look through the input history in reverse
597 # Look through the input history in reverse
598 for n in range(len(self.shell.input_hist)-2,0,-1):
598 for n in range(len(self.shell.input_hist)-2,0,-1):
599 input = self.shell.input_hist[n]
599 input = self.shell.input_hist[n]
600 # skip plain 'r' lines so we don't recurse to infinity
600 # skip plain 'r' lines so we don't recurse to infinity
601 if input != '_ip.magic("r")\n' and \
601 if input != '_ip.magic("r")\n' and \
602 (input.startswith(start) or input.startswith(start_magic)):
602 (input.startswith(start) or input.startswith(start_magic)):
603 #print 'match',`input` # dbg
603 #print 'match',`input` # dbg
604 print 'Executing:',input,
604 print 'Executing:',input,
605 self.shell.runlines(input)
605 self.shell.runlines(input)
606 return
606 return
607 print 'No previous input matching `%s` found.' % start
607 print 'No previous input matching `%s` found.' % start
608
608
609 def magic_page(self, parameter_s=''):
609 def magic_page(self, parameter_s=''):
610 """Pretty print the object and display it through a pager.
610 """Pretty print the object and display it through a pager.
611
611
612 If no parameter is given, use _ (last output)."""
612 If no parameter is given, use _ (last output)."""
613 # After a function contributed by Olivier Aubert, slightly modified.
613 # After a function contributed by Olivier Aubert, slightly modified.
614
614
615 oname = parameter_s and parameter_s or '_'
615 oname = parameter_s and parameter_s or '_'
616 info = self._ofind(oname)
616 info = self._ofind(oname)
617 if info['found']:
617 if info['found']:
618 page(pformat(info['obj']))
618 page(pformat(info['obj']))
619 else:
619 else:
620 print 'Object `%s` not found' % oname
620 print 'Object `%s` not found' % oname
621
621
622 def magic_profile(self, parameter_s=''):
622 def magic_profile(self, parameter_s=''):
623 """Print your currently active IPyhton profile."""
623 """Print your currently active IPyhton profile."""
624 if self.shell.rc.profile:
624 if self.shell.rc.profile:
625 printpl('Current IPython profile: $self.shell.rc.profile.')
625 printpl('Current IPython profile: $self.shell.rc.profile.')
626 else:
626 else:
627 print 'No profile active.'
627 print 'No profile active.'
628
628
629 def _inspect(self,meth,oname,**kw):
629 def _inspect(self,meth,oname,**kw):
630 """Generic interface to the inspector system.
630 """Generic interface to the inspector system.
631
631
632 This function is meant to be called by pdef, pdoc & friends."""
632 This function is meant to be called by pdef, pdoc & friends."""
633
633
634 oname = oname.strip()
634 oname = oname.strip()
635 info = Struct(self._ofind(oname))
635 info = Struct(self._ofind(oname))
636
636
637 if info.found:
637 if info.found:
638 # Get the docstring of the class property if it exists.
638 # Get the docstring of the class property if it exists.
639 path = oname.split('.')
639 path = oname.split('.')
640 root = '.'.join(path[:-1])
640 root = '.'.join(path[:-1])
641 if info.parent is not None:
641 if info.parent is not None:
642 try:
642 try:
643 target = getattr(info.parent, '__class__')
643 target = getattr(info.parent, '__class__')
644 # The object belongs to a class instance.
644 # The object belongs to a class instance.
645 try:
645 try:
646 target = getattr(target, path[-1])
646 target = getattr(target, path[-1])
647 # The class defines the object.
647 # The class defines the object.
648 if isinstance(target, property):
648 if isinstance(target, property):
649 oname = root + '.__class__.' + path[-1]
649 oname = root + '.__class__.' + path[-1]
650 info = Struct(self._ofind(oname))
650 info = Struct(self._ofind(oname))
651 except AttributeError: pass
651 except AttributeError: pass
652 except AttributeError: pass
652 except AttributeError: pass
653
653
654 pmethod = getattr(self.shell.inspector,meth)
654 pmethod = getattr(self.shell.inspector,meth)
655 formatter = info.ismagic and self.format_screen or None
655 formatter = info.ismagic and self.format_screen or None
656 if meth == 'pdoc':
656 if meth == 'pdoc':
657 pmethod(info.obj,oname,formatter)
657 pmethod(info.obj,oname,formatter)
658 elif meth == 'pinfo':
658 elif meth == 'pinfo':
659 pmethod(info.obj,oname,formatter,info,**kw)
659 pmethod(info.obj,oname,formatter,info,**kw)
660 else:
660 else:
661 pmethod(info.obj,oname)
661 pmethod(info.obj,oname)
662 else:
662 else:
663 print 'Object `%s` not found.' % oname
663 print 'Object `%s` not found.' % oname
664 return 'not found' # so callers can take other action
664 return 'not found' # so callers can take other action
665
665
666 def magic_pdef(self, parameter_s=''):
666 def magic_pdef(self, parameter_s=''):
667 """Print the definition header for any callable object.
667 """Print the definition header for any callable object.
668
668
669 If the object is a class, print the constructor information."""
669 If the object is a class, print the constructor information."""
670 self._inspect('pdef',parameter_s)
670 self._inspect('pdef',parameter_s)
671
671
672 def magic_pdoc(self, parameter_s=''):
672 def magic_pdoc(self, parameter_s=''):
673 """Print the docstring for an object.
673 """Print the docstring for an object.
674
674
675 If the given object is a class, it will print both the class and the
675 If the given object is a class, it will print both the class and the
676 constructor docstrings."""
676 constructor docstrings."""
677 self._inspect('pdoc',parameter_s)
677 self._inspect('pdoc',parameter_s)
678
678
679 def magic_psource(self, parameter_s=''):
679 def magic_psource(self, parameter_s=''):
680 """Print (or run through pager) the source code for an object."""
680 """Print (or run through pager) the source code for an object."""
681 self._inspect('psource',parameter_s)
681 self._inspect('psource',parameter_s)
682
682
683 def magic_pfile(self, parameter_s=''):
683 def magic_pfile(self, parameter_s=''):
684 """Print (or run through pager) the file where an object is defined.
684 """Print (or run through pager) the file where an object is defined.
685
685
686 The file opens at the line where the object definition begins. IPython
686 The file opens at the line where the object definition begins. IPython
687 will honor the environment variable PAGER if set, and otherwise will
687 will honor the environment variable PAGER if set, and otherwise will
688 do its best to print the file in a convenient form.
688 do its best to print the file in a convenient form.
689
689
690 If the given argument is not an object currently defined, IPython will
690 If the given argument is not an object currently defined, IPython will
691 try to interpret it as a filename (automatically adding a .py extension
691 try to interpret it as a filename (automatically adding a .py extension
692 if needed). You can thus use %pfile as a syntax highlighting code
692 if needed). You can thus use %pfile as a syntax highlighting code
693 viewer."""
693 viewer."""
694
694
695 # first interpret argument as an object name
695 # first interpret argument as an object name
696 out = self._inspect('pfile',parameter_s)
696 out = self._inspect('pfile',parameter_s)
697 # if not, try the input as a filename
697 # if not, try the input as a filename
698 if out == 'not found':
698 if out == 'not found':
699 try:
699 try:
700 filename = get_py_filename(parameter_s)
700 filename = get_py_filename(parameter_s)
701 except IOError,msg:
701 except IOError,msg:
702 print msg
702 print msg
703 return
703 return
704 page(self.shell.inspector.format(file(filename).read()))
704 page(self.shell.inspector.format(file(filename).read()))
705
705
706 def magic_pinfo(self, parameter_s=''):
706 def magic_pinfo(self, parameter_s=''):
707 """Provide detailed information about an object.
707 """Provide detailed information about an object.
708
708
709 '%pinfo object' is just a synonym for object? or ?object."""
709 '%pinfo object' is just a synonym for object? or ?object."""
710
710
711 #print 'pinfo par: <%s>' % parameter_s # dbg
711 #print 'pinfo par: <%s>' % parameter_s # dbg
712
712
713 # detail_level: 0 -> obj? , 1 -> obj??
713 # detail_level: 0 -> obj? , 1 -> obj??
714 detail_level = 0
714 detail_level = 0
715 # We need to detect if we got called as 'pinfo pinfo foo', which can
715 # We need to detect if we got called as 'pinfo pinfo foo', which can
716 # happen if the user types 'pinfo foo?' at the cmd line.
716 # happen if the user types 'pinfo foo?' at the cmd line.
717 pinfo,qmark1,oname,qmark2 = \
717 pinfo,qmark1,oname,qmark2 = \
718 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
718 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
719 if pinfo or qmark1 or qmark2:
719 if pinfo or qmark1 or qmark2:
720 detail_level = 1
720 detail_level = 1
721 if "*" in oname:
721 if "*" in oname:
722 self.magic_psearch(oname)
722 self.magic_psearch(oname)
723 else:
723 else:
724 self._inspect('pinfo',oname,detail_level=detail_level)
724 self._inspect('pinfo',oname,detail_level=detail_level)
725
725
726 def magic_psearch(self, parameter_s=''):
726 def magic_psearch(self, parameter_s=''):
727 """Search for object in namespaces by wildcard.
727 """Search for object in namespaces by wildcard.
728
728
729 %psearch [options] PATTERN [OBJECT TYPE]
729 %psearch [options] PATTERN [OBJECT TYPE]
730
730
731 Note: ? can be used as a synonym for %psearch, at the beginning or at
731 Note: ? can be used as a synonym for %psearch, at the beginning or at
732 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
732 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
733 rest of the command line must be unchanged (options come first), so
733 rest of the command line must be unchanged (options come first), so
734 for example the following forms are equivalent
734 for example the following forms are equivalent
735
735
736 %psearch -i a* function
736 %psearch -i a* function
737 -i a* function?
737 -i a* function?
738 ?-i a* function
738 ?-i a* function
739
739
740 Arguments:
740 Arguments:
741
741
742 PATTERN
742 PATTERN
743
743
744 where PATTERN is a string containing * as a wildcard similar to its
744 where PATTERN is a string containing * as a wildcard similar to its
745 use in a shell. The pattern is matched in all namespaces on the
745 use in a shell. The pattern is matched in all namespaces on the
746 search path. By default objects starting with a single _ are not
746 search path. By default objects starting with a single _ are not
747 matched, many IPython generated objects have a single
747 matched, many IPython generated objects have a single
748 underscore. The default is case insensitive matching. Matching is
748 underscore. The default is case insensitive matching. Matching is
749 also done on the attributes of objects and not only on the objects
749 also done on the attributes of objects and not only on the objects
750 in a module.
750 in a module.
751
751
752 [OBJECT TYPE]
752 [OBJECT TYPE]
753
753
754 Is the name of a python type from the types module. The name is
754 Is the name of a python type from the types module. The name is
755 given in lowercase without the ending type, ex. StringType is
755 given in lowercase without the ending type, ex. StringType is
756 written string. By adding a type here only objects matching the
756 written string. By adding a type here only objects matching the
757 given type are matched. Using all here makes the pattern match all
757 given type are matched. Using all here makes the pattern match all
758 types (this is the default).
758 types (this is the default).
759
759
760 Options:
760 Options:
761
761
762 -a: makes the pattern match even objects whose names start with a
762 -a: makes the pattern match even objects whose names start with a
763 single underscore. These names are normally ommitted from the
763 single underscore. These names are normally ommitted from the
764 search.
764 search.
765
765
766 -i/-c: make the pattern case insensitive/sensitive. If neither of
766 -i/-c: make the pattern case insensitive/sensitive. If neither of
767 these options is given, the default is read from your ipythonrc
767 these options is given, the default is read from your ipythonrc
768 file. The option name which sets this value is
768 file. The option name which sets this value is
769 'wildcards_case_sensitive'. If this option is not specified in your
769 'wildcards_case_sensitive'. If this option is not specified in your
770 ipythonrc file, IPython's internal default is to do a case sensitive
770 ipythonrc file, IPython's internal default is to do a case sensitive
771 search.
771 search.
772
772
773 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
773 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
774 specifiy can be searched in any of the following namespaces:
774 specifiy can be searched in any of the following namespaces:
775 'builtin', 'user', 'user_global','internal', 'alias', where
775 'builtin', 'user', 'user_global','internal', 'alias', where
776 'builtin' and 'user' are the search defaults. Note that you should
776 'builtin' and 'user' are the search defaults. Note that you should
777 not use quotes when specifying namespaces.
777 not use quotes when specifying namespaces.
778
778
779 'Builtin' contains the python module builtin, 'user' contains all
779 'Builtin' contains the python module builtin, 'user' contains all
780 user data, 'alias' only contain the shell aliases and no python
780 user data, 'alias' only contain the shell aliases and no python
781 objects, 'internal' contains objects used by IPython. The
781 objects, 'internal' contains objects used by IPython. The
782 'user_global' namespace is only used by embedded IPython instances,
782 'user_global' namespace is only used by embedded IPython instances,
783 and it contains module-level globals. You can add namespaces to the
783 and it contains module-level globals. You can add namespaces to the
784 search with -s or exclude them with -e (these options can be given
784 search with -s or exclude them with -e (these options can be given
785 more than once).
785 more than once).
786
786
787 Examples:
787 Examples:
788
788
789 %psearch a* -> objects beginning with an a
789 %psearch a* -> objects beginning with an a
790 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
790 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
791 %psearch a* function -> all functions beginning with an a
791 %psearch a* function -> all functions beginning with an a
792 %psearch re.e* -> objects beginning with an e in module re
792 %psearch re.e* -> objects beginning with an e in module re
793 %psearch r*.e* -> objects that start with e in modules starting in r
793 %psearch r*.e* -> objects that start with e in modules starting in r
794 %psearch r*.* string -> all strings in modules beginning with r
794 %psearch r*.* string -> all strings in modules beginning with r
795
795
796 Case sensitve search:
796 Case sensitve search:
797
797
798 %psearch -c a* list all object beginning with lower case a
798 %psearch -c a* list all object beginning with lower case a
799
799
800 Show objects beginning with a single _:
800 Show objects beginning with a single _:
801
801
802 %psearch -a _* list objects beginning with a single underscore"""
802 %psearch -a _* list objects beginning with a single underscore"""
803
803
804 # default namespaces to be searched
804 # default namespaces to be searched
805 def_search = ['user','builtin']
805 def_search = ['user','builtin']
806
806
807 # Process options/args
807 # Process options/args
808 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
808 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
809 opt = opts.get
809 opt = opts.get
810 shell = self.shell
810 shell = self.shell
811 psearch = shell.inspector.psearch
811 psearch = shell.inspector.psearch
812
812
813 # select case options
813 # select case options
814 if opts.has_key('i'):
814 if opts.has_key('i'):
815 ignore_case = True
815 ignore_case = True
816 elif opts.has_key('c'):
816 elif opts.has_key('c'):
817 ignore_case = False
817 ignore_case = False
818 else:
818 else:
819 ignore_case = not shell.rc.wildcards_case_sensitive
819 ignore_case = not shell.rc.wildcards_case_sensitive
820
820
821 # Build list of namespaces to search from user options
821 # Build list of namespaces to search from user options
822 def_search.extend(opt('s',[]))
822 def_search.extend(opt('s',[]))
823 ns_exclude = ns_exclude=opt('e',[])
823 ns_exclude = ns_exclude=opt('e',[])
824 ns_search = [nm for nm in def_search if nm not in ns_exclude]
824 ns_search = [nm for nm in def_search if nm not in ns_exclude]
825
825
826 # Call the actual search
826 # Call the actual search
827 try:
827 try:
828 psearch(args,shell.ns_table,ns_search,
828 psearch(args,shell.ns_table,ns_search,
829 show_all=opt('a'),ignore_case=ignore_case)
829 show_all=opt('a'),ignore_case=ignore_case)
830 except:
830 except:
831 shell.showtraceback()
831 shell.showtraceback()
832
832
833 def magic_who_ls(self, parameter_s=''):
833 def magic_who_ls(self, parameter_s=''):
834 """Return a sorted list of all interactive variables.
834 """Return a sorted list of all interactive variables.
835
835
836 If arguments are given, only variables of types matching these
836 If arguments are given, only variables of types matching these
837 arguments are returned."""
837 arguments are returned."""
838
838
839 user_ns = self.shell.user_ns
839 user_ns = self.shell.user_ns
840 internal_ns = self.shell.internal_ns
840 internal_ns = self.shell.internal_ns
841 user_config_ns = self.shell.user_config_ns
841 user_config_ns = self.shell.user_config_ns
842 out = []
842 out = []
843 typelist = parameter_s.split()
843 typelist = parameter_s.split()
844
844
845 for i in user_ns:
845 for i in user_ns:
846 if not (i.startswith('_') or i.startswith('_i')) \
846 if not (i.startswith('_') or i.startswith('_i')) \
847 and not (i in internal_ns or i in user_config_ns):
847 and not (i in internal_ns or i in user_config_ns):
848 if typelist:
848 if typelist:
849 if type(user_ns[i]).__name__ in typelist:
849 if type(user_ns[i]).__name__ in typelist:
850 out.append(i)
850 out.append(i)
851 else:
851 else:
852 out.append(i)
852 out.append(i)
853 out.sort()
853 out.sort()
854 return out
854 return out
855
855
856 def magic_who(self, parameter_s=''):
856 def magic_who(self, parameter_s=''):
857 """Print all interactive variables, with some minimal formatting.
857 """Print all interactive variables, with some minimal formatting.
858
858
859 If any arguments are given, only variables whose type matches one of
859 If any arguments are given, only variables whose type matches one of
860 these are printed. For example:
860 these are printed. For example:
861
861
862 %who function str
862 %who function str
863
863
864 will only list functions and strings, excluding all other types of
864 will only list functions and strings, excluding all other types of
865 variables. To find the proper type names, simply use type(var) at a
865 variables. To find the proper type names, simply use type(var) at a
866 command line to see how python prints type names. For example:
866 command line to see how python prints type names. For example:
867
867
868 In [1]: type('hello')\\
868 In [1]: type('hello')\\
869 Out[1]: <type 'str'>
869 Out[1]: <type 'str'>
870
870
871 indicates that the type name for strings is 'str'.
871 indicates that the type name for strings is 'str'.
872
872
873 %who always excludes executed names loaded through your configuration
873 %who always excludes executed names loaded through your configuration
874 file and things which are internal to IPython.
874 file and things which are internal to IPython.
875
875
876 This is deliberate, as typically you may load many modules and the
876 This is deliberate, as typically you may load many modules and the
877 purpose of %who is to show you only what you've manually defined."""
877 purpose of %who is to show you only what you've manually defined."""
878
878
879 varlist = self.magic_who_ls(parameter_s)
879 varlist = self.magic_who_ls(parameter_s)
880 if not varlist:
880 if not varlist:
881 print 'Interactive namespace is empty.'
881 print 'Interactive namespace is empty.'
882 return
882 return
883
883
884 # if we have variables, move on...
884 # if we have variables, move on...
885
885
886 # stupid flushing problem: when prompts have no separators, stdout is
886 # stupid flushing problem: when prompts have no separators, stdout is
887 # getting lost. I'm starting to think this is a python bug. I'm having
887 # getting lost. I'm starting to think this is a python bug. I'm having
888 # to force a flush with a print because even a sys.stdout.flush
888 # to force a flush with a print because even a sys.stdout.flush
889 # doesn't seem to do anything!
889 # doesn't seem to do anything!
890
890
891 count = 0
891 count = 0
892 for i in varlist:
892 for i in varlist:
893 print i+'\t',
893 print i+'\t',
894 count += 1
894 count += 1
895 if count > 8:
895 if count > 8:
896 count = 0
896 count = 0
897 print
897 print
898 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
898 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
899
899
900 print # well, this does force a flush at the expense of an extra \n
900 print # well, this does force a flush at the expense of an extra \n
901
901
902 def magic_whos(self, parameter_s=''):
902 def magic_whos(self, parameter_s=''):
903 """Like %who, but gives some extra information about each variable.
903 """Like %who, but gives some extra information about each variable.
904
904
905 The same type filtering of %who can be applied here.
905 The same type filtering of %who can be applied here.
906
906
907 For all variables, the type is printed. Additionally it prints:
907 For all variables, the type is printed. Additionally it prints:
908
908
909 - For {},[],(): their length.
909 - For {},[],(): their length.
910
910
911 - For Numeric arrays, a summary with shape, number of elements,
911 - For Numeric arrays, a summary with shape, number of elements,
912 typecode and size in memory.
912 typecode and size in memory.
913
913
914 - Everything else: a string representation, snipping their middle if
914 - Everything else: a string representation, snipping their middle if
915 too long."""
915 too long."""
916
916
917 varnames = self.magic_who_ls(parameter_s)
917 varnames = self.magic_who_ls(parameter_s)
918 if not varnames:
918 if not varnames:
919 print 'Interactive namespace is empty.'
919 print 'Interactive namespace is empty.'
920 return
920 return
921
921
922 # if we have variables, move on...
922 # if we have variables, move on...
923
923
924 # for these types, show len() instead of data:
924 # for these types, show len() instead of data:
925 seq_types = [types.DictType,types.ListType,types.TupleType]
925 seq_types = [types.DictType,types.ListType,types.TupleType]
926
926
927 # for Numeric arrays, display summary info
927 # for Numeric arrays, display summary info
928 try:
928 try:
929 import Numeric
929 import Numeric
930 except ImportError:
930 except ImportError:
931 array_type = None
931 array_type = None
932 else:
932 else:
933 array_type = Numeric.ArrayType.__name__
933 array_type = Numeric.ArrayType.__name__
934
934
935 # Find all variable names and types so we can figure out column sizes
935 # Find all variable names and types so we can figure out column sizes
936 get_vars = lambda i: self.shell.user_ns[i]
936 get_vars = lambda i: self.shell.user_ns[i]
937 type_name = lambda v: type(v).__name__
937 type_name = lambda v: type(v).__name__
938 varlist = map(get_vars,varnames)
938 varlist = map(get_vars,varnames)
939
939
940 typelist = []
940 typelist = []
941 for vv in varlist:
941 for vv in varlist:
942 tt = type_name(vv)
942 tt = type_name(vv)
943 if tt=='instance':
943 if tt=='instance':
944 typelist.append(str(vv.__class__))
944 typelist.append(str(vv.__class__))
945 else:
945 else:
946 typelist.append(tt)
946 typelist.append(tt)
947
947
948 # column labels and # of spaces as separator
948 # column labels and # of spaces as separator
949 varlabel = 'Variable'
949 varlabel = 'Variable'
950 typelabel = 'Type'
950 typelabel = 'Type'
951 datalabel = 'Data/Info'
951 datalabel = 'Data/Info'
952 colsep = 3
952 colsep = 3
953 # variable format strings
953 # variable format strings
954 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
954 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
955 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
955 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
956 aformat = "%s: %s elems, type `%s`, %s bytes"
956 aformat = "%s: %s elems, type `%s`, %s bytes"
957 # find the size of the columns to format the output nicely
957 # find the size of the columns to format the output nicely
958 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
958 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
959 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
959 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
960 # table header
960 # table header
961 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
961 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
962 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
962 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
963 # and the table itself
963 # and the table itself
964 kb = 1024
964 kb = 1024
965 Mb = 1048576 # kb**2
965 Mb = 1048576 # kb**2
966 for vname,var,vtype in zip(varnames,varlist,typelist):
966 for vname,var,vtype in zip(varnames,varlist,typelist):
967 print itpl(vformat),
967 print itpl(vformat),
968 if vtype in seq_types:
968 if vtype in seq_types:
969 print len(var)
969 print len(var)
970 elif vtype==array_type:
970 elif vtype==array_type:
971 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
971 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
972 vsize = Numeric.size(var)
972 vsize = Numeric.size(var)
973 vbytes = vsize*var.itemsize()
973 vbytes = vsize*var.itemsize()
974 if vbytes < 100000:
974 if vbytes < 100000:
975 print aformat % (vshape,vsize,var.typecode(),vbytes)
975 print aformat % (vshape,vsize,var.typecode(),vbytes)
976 else:
976 else:
977 print aformat % (vshape,vsize,var.typecode(),vbytes),
977 print aformat % (vshape,vsize,var.typecode(),vbytes),
978 if vbytes < Mb:
978 if vbytes < Mb:
979 print '(%s kb)' % (vbytes/kb,)
979 print '(%s kb)' % (vbytes/kb,)
980 else:
980 else:
981 print '(%s Mb)' % (vbytes/Mb,)
981 print '(%s Mb)' % (vbytes/Mb,)
982 else:
982 else:
983 vstr = str(var).replace('\n','\\n')
983 vstr = str(var).replace('\n','\\n')
984 if len(vstr) < 50:
984 if len(vstr) < 50:
985 print vstr
985 print vstr
986 else:
986 else:
987 printpl(vfmt_short)
987 printpl(vfmt_short)
988
988
989 def magic_reset(self, parameter_s=''):
989 def magic_reset(self, parameter_s=''):
990 """Resets the namespace by removing all names defined by the user.
990 """Resets the namespace by removing all names defined by the user.
991
991
992 Input/Output history are left around in case you need them."""
992 Input/Output history are left around in case you need them."""
993
993
994 ans = self.shell.ask_yes_no(
994 ans = self.shell.ask_yes_no(
995 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
995 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
996 if not ans:
996 if not ans:
997 print 'Nothing done.'
997 print 'Nothing done.'
998 return
998 return
999 user_ns = self.shell.user_ns
999 user_ns = self.shell.user_ns
1000 for i in self.magic_who_ls():
1000 for i in self.magic_who_ls():
1001 del(user_ns[i])
1001 del(user_ns[i])
1002
1002
1003 def magic_config(self,parameter_s=''):
1003 def magic_config(self,parameter_s=''):
1004 """Show IPython's internal configuration."""
1004 """Show IPython's internal configuration."""
1005
1005
1006 page('Current configuration structure:\n'+
1006 page('Current configuration structure:\n'+
1007 pformat(self.shell.rc.dict()))
1007 pformat(self.shell.rc.dict()))
1008
1008
1009 def magic_logstart(self,parameter_s=''):
1009 def magic_logstart(self,parameter_s=''):
1010 """Start logging anywhere in a session.
1010 """Start logging anywhere in a session.
1011
1011
1012 %logstart [-o|-r|-t] [log_name [log_mode]]
1012 %logstart [-o|-r|-t] [log_name [log_mode]]
1013
1013
1014 If no name is given, it defaults to a file named 'ipython_log.py' in your
1014 If no name is given, it defaults to a file named 'ipython_log.py' in your
1015 current directory, in 'rotate' mode (see below).
1015 current directory, in 'rotate' mode (see below).
1016
1016
1017 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1017 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1018 history up to that point and then continues logging.
1018 history up to that point and then continues logging.
1019
1019
1020 %logstart takes a second optional parameter: logging mode. This can be one
1020 %logstart takes a second optional parameter: logging mode. This can be one
1021 of (note that the modes are given unquoted):\\
1021 of (note that the modes are given unquoted):\\
1022 append: well, that says it.\\
1022 append: well, that says it.\\
1023 backup: rename (if exists) to name~ and start name.\\
1023 backup: rename (if exists) to name~ and start name.\\
1024 global: single logfile in your home dir, appended to.\\
1024 global: single logfile in your home dir, appended to.\\
1025 over : overwrite existing log.\\
1025 over : overwrite existing log.\\
1026 rotate: create rotating logs name.1~, name.2~, etc.
1026 rotate: create rotating logs name.1~, name.2~, etc.
1027
1027
1028 Options:
1028 Options:
1029
1029
1030 -o: log also IPython's output. In this mode, all commands which
1030 -o: log also IPython's output. In this mode, all commands which
1031 generate an Out[NN] prompt are recorded to the logfile, right after
1031 generate an Out[NN] prompt are recorded to the logfile, right after
1032 their corresponding input line. The output lines are always
1032 their corresponding input line. The output lines are always
1033 prepended with a '#[Out]# ' marker, so that the log remains valid
1033 prepended with a '#[Out]# ' marker, so that the log remains valid
1034 Python code.
1034 Python code.
1035
1035
1036 Since this marker is always the same, filtering only the output from
1036 Since this marker is always the same, filtering only the output from
1037 a log is very easy, using for example a simple awk call:
1037 a log is very easy, using for example a simple awk call:
1038
1038
1039 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1039 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1040
1040
1041 -r: log 'raw' input. Normally, IPython's logs contain the processed
1041 -r: log 'raw' input. Normally, IPython's logs contain the processed
1042 input, so that user lines are logged in their final form, converted
1042 input, so that user lines are logged in their final form, converted
1043 into valid Python. For example, %Exit is logged as
1043 into valid Python. For example, %Exit is logged as
1044 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1044 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1045 exactly as typed, with no transformations applied.
1045 exactly as typed, with no transformations applied.
1046
1046
1047 -t: put timestamps before each input line logged (these are put in
1047 -t: put timestamps before each input line logged (these are put in
1048 comments)."""
1048 comments)."""
1049
1049
1050 opts,par = self.parse_options(parameter_s,'ort')
1050 opts,par = self.parse_options(parameter_s,'ort')
1051 log_output = 'o' in opts
1051 log_output = 'o' in opts
1052 log_raw_input = 'r' in opts
1052 log_raw_input = 'r' in opts
1053 timestamp = 't' in opts
1053 timestamp = 't' in opts
1054
1054
1055 rc = self.shell.rc
1055 rc = self.shell.rc
1056 logger = self.shell.logger
1056 logger = self.shell.logger
1057
1057
1058 # if no args are given, the defaults set in the logger constructor by
1058 # if no args are given, the defaults set in the logger constructor by
1059 # ipytohn remain valid
1059 # ipytohn remain valid
1060 if par:
1060 if par:
1061 try:
1061 try:
1062 logfname,logmode = par.split()
1062 logfname,logmode = par.split()
1063 except:
1063 except:
1064 logfname = par
1064 logfname = par
1065 logmode = 'backup'
1065 logmode = 'backup'
1066 else:
1066 else:
1067 logfname = logger.logfname
1067 logfname = logger.logfname
1068 logmode = logger.logmode
1068 logmode = logger.logmode
1069 # put logfname into rc struct as if it had been called on the command
1069 # put logfname into rc struct as if it had been called on the command
1070 # line, so it ends up saved in the log header Save it in case we need
1070 # line, so it ends up saved in the log header Save it in case we need
1071 # to restore it...
1071 # to restore it...
1072 old_logfile = rc.opts.get('logfile','')
1072 old_logfile = rc.opts.get('logfile','')
1073 if logfname:
1073 if logfname:
1074 logfname = os.path.expanduser(logfname)
1074 logfname = os.path.expanduser(logfname)
1075 rc.opts.logfile = logfname
1075 rc.opts.logfile = logfname
1076 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1076 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1077 try:
1077 try:
1078 started = logger.logstart(logfname,loghead,logmode,
1078 started = logger.logstart(logfname,loghead,logmode,
1079 log_output,timestamp,log_raw_input)
1079 log_output,timestamp,log_raw_input)
1080 except:
1080 except:
1081 rc.opts.logfile = old_logfile
1081 rc.opts.logfile = old_logfile
1082 warn("Couldn't start log: %s" % sys.exc_info()[1])
1082 warn("Couldn't start log: %s" % sys.exc_info()[1])
1083 else:
1083 else:
1084 # log input history up to this point, optionally interleaving
1084 # log input history up to this point, optionally interleaving
1085 # output if requested
1085 # output if requested
1086
1086
1087 if timestamp:
1087 if timestamp:
1088 # disable timestamping for the previous history, since we've
1088 # disable timestamping for the previous history, since we've
1089 # lost those already (no time machine here).
1089 # lost those already (no time machine here).
1090 logger.timestamp = False
1090 logger.timestamp = False
1091
1091
1092 if log_raw_input:
1092 if log_raw_input:
1093 input_hist = self.shell.input_hist_raw
1093 input_hist = self.shell.input_hist_raw
1094 else:
1094 else:
1095 input_hist = self.shell.input_hist
1095 input_hist = self.shell.input_hist
1096
1096
1097 if log_output:
1097 if log_output:
1098 log_write = logger.log_write
1098 log_write = logger.log_write
1099 output_hist = self.shell.output_hist
1099 output_hist = self.shell.output_hist
1100 for n in range(1,len(input_hist)-1):
1100 for n in range(1,len(input_hist)-1):
1101 log_write(input_hist[n].rstrip())
1101 log_write(input_hist[n].rstrip())
1102 if n in output_hist:
1102 if n in output_hist:
1103 log_write(repr(output_hist[n]),'output')
1103 log_write(repr(output_hist[n]),'output')
1104 else:
1104 else:
1105 logger.log_write(input_hist[1:])
1105 logger.log_write(input_hist[1:])
1106 if timestamp:
1106 if timestamp:
1107 # re-enable timestamping
1107 # re-enable timestamping
1108 logger.timestamp = True
1108 logger.timestamp = True
1109
1109
1110 print ('Activating auto-logging. '
1110 print ('Activating auto-logging. '
1111 'Current session state plus future input saved.')
1111 'Current session state plus future input saved.')
1112 logger.logstate()
1112 logger.logstate()
1113
1113
1114 def magic_logoff(self,parameter_s=''):
1114 def magic_logoff(self,parameter_s=''):
1115 """Temporarily stop logging.
1115 """Temporarily stop logging.
1116
1116
1117 You must have previously started logging."""
1117 You must have previously started logging."""
1118 self.shell.logger.switch_log(0)
1118 self.shell.logger.switch_log(0)
1119
1119
1120 def magic_logon(self,parameter_s=''):
1120 def magic_logon(self,parameter_s=''):
1121 """Restart logging.
1121 """Restart logging.
1122
1122
1123 This function is for restarting logging which you've temporarily
1123 This function is for restarting logging which you've temporarily
1124 stopped with %logoff. For starting logging for the first time, you
1124 stopped with %logoff. For starting logging for the first time, you
1125 must use the %logstart function, which allows you to specify an
1125 must use the %logstart function, which allows you to specify an
1126 optional log filename."""
1126 optional log filename."""
1127
1127
1128 self.shell.logger.switch_log(1)
1128 self.shell.logger.switch_log(1)
1129
1129
1130 def magic_logstate(self,parameter_s=''):
1130 def magic_logstate(self,parameter_s=''):
1131 """Print the status of the logging system."""
1131 """Print the status of the logging system."""
1132
1132
1133 self.shell.logger.logstate()
1133 self.shell.logger.logstate()
1134
1134
1135 def magic_pdb(self, parameter_s=''):
1135 def magic_pdb(self, parameter_s=''):
1136 """Control the calling of the pdb interactive debugger.
1136 """Control the calling of the pdb interactive debugger.
1137
1137
1138 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1138 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1139 argument it works as a toggle.
1139 argument it works as a toggle.
1140
1140
1141 When an exception is triggered, IPython can optionally call the
1141 When an exception is triggered, IPython can optionally call the
1142 interactive pdb debugger after the traceback printout. %pdb toggles
1142 interactive pdb debugger after the traceback printout. %pdb toggles
1143 this feature on and off."""
1143 this feature on and off."""
1144
1144
1145 par = parameter_s.strip().lower()
1145 par = parameter_s.strip().lower()
1146
1146
1147 if par:
1147 if par:
1148 try:
1148 try:
1149 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1149 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1150 except KeyError:
1150 except KeyError:
1151 print ('Incorrect argument. Use on/1, off/0, '
1151 print ('Incorrect argument. Use on/1, off/0, '
1152 'or nothing for a toggle.')
1152 'or nothing for a toggle.')
1153 return
1153 return
1154 else:
1154 else:
1155 # toggle
1155 # toggle
1156 new_pdb = not self.shell.InteractiveTB.call_pdb
1156 new_pdb = not self.shell.InteractiveTB.call_pdb
1157
1157
1158 # set on the shell
1158 # set on the shell
1159 self.shell.call_pdb = new_pdb
1159 self.shell.call_pdb = new_pdb
1160 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1160 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1161
1161
1162 def magic_prun(self, parameter_s ='',user_mode=1,
1162 def magic_prun(self, parameter_s ='',user_mode=1,
1163 opts=None,arg_lst=None,prog_ns=None):
1163 opts=None,arg_lst=None,prog_ns=None):
1164
1164
1165 """Run a statement through the python code profiler.
1165 """Run a statement through the python code profiler.
1166
1166
1167 Usage:\\
1167 Usage:\\
1168 %prun [options] statement
1168 %prun [options] statement
1169
1169
1170 The given statement (which doesn't require quote marks) is run via the
1170 The given statement (which doesn't require quote marks) is run via the
1171 python profiler in a manner similar to the profile.run() function.
1171 python profiler in a manner similar to the profile.run() function.
1172 Namespaces are internally managed to work correctly; profile.run
1172 Namespaces are internally managed to work correctly; profile.run
1173 cannot be used in IPython because it makes certain assumptions about
1173 cannot be used in IPython because it makes certain assumptions about
1174 namespaces which do not hold under IPython.
1174 namespaces which do not hold under IPython.
1175
1175
1176 Options:
1176 Options:
1177
1177
1178 -l <limit>: you can place restrictions on what or how much of the
1178 -l <limit>: you can place restrictions on what or how much of the
1179 profile gets printed. The limit value can be:
1179 profile gets printed. The limit value can be:
1180
1180
1181 * A string: only information for function names containing this string
1181 * A string: only information for function names containing this string
1182 is printed.
1182 is printed.
1183
1183
1184 * An integer: only these many lines are printed.
1184 * An integer: only these many lines are printed.
1185
1185
1186 * A float (between 0 and 1): this fraction of the report is printed
1186 * A float (between 0 and 1): this fraction of the report is printed
1187 (for example, use a limit of 0.4 to see the topmost 40% only).
1187 (for example, use a limit of 0.4 to see the topmost 40% only).
1188
1188
1189 You can combine several limits with repeated use of the option. For
1189 You can combine several limits with repeated use of the option. For
1190 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1190 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1191 information about class constructors.
1191 information about class constructors.
1192
1192
1193 -r: return the pstats.Stats object generated by the profiling. This
1193 -r: return the pstats.Stats object generated by the profiling. This
1194 object has all the information about the profile in it, and you can
1194 object has all the information about the profile in it, and you can
1195 later use it for further analysis or in other functions.
1195 later use it for further analysis or in other functions.
1196
1196
1197 Since magic functions have a particular form of calling which prevents
1197 Since magic functions have a particular form of calling which prevents
1198 you from writing something like:\\
1198 you from writing something like:\\
1199 In [1]: p = %prun -r print 4 # invalid!\\
1199 In [1]: p = %prun -r print 4 # invalid!\\
1200 you must instead use IPython's automatic variables to assign this:\\
1200 you must instead use IPython's automatic variables to assign this:\\
1201 In [1]: %prun -r print 4 \\
1201 In [1]: %prun -r print 4 \\
1202 Out[1]: <pstats.Stats instance at 0x8222cec>\\
1202 Out[1]: <pstats.Stats instance at 0x8222cec>\\
1203 In [2]: stats = _
1203 In [2]: stats = _
1204
1204
1205 If you really need to assign this value via an explicit function call,
1205 If you really need to assign this value via an explicit function call,
1206 you can always tap directly into the true name of the magic function
1206 you can always tap directly into the true name of the magic function
1207 by using the _ip.magic function:\\
1207 by using the _ip.magic function:\\
1208 In [3]: stats = _ip.magic('prun','-r print 4')
1208 In [3]: stats = _ip.magic('prun','-r print 4')
1209
1209
1210 You can type _ip.magic? for more details.
1210 You can type _ip.magic? for more details.
1211
1211
1212 -s <key>: sort profile by given key. You can provide more than one key
1212 -s <key>: sort profile by given key. You can provide more than one key
1213 by using the option several times: '-s key1 -s key2 -s key3...'. The
1213 by using the option several times: '-s key1 -s key2 -s key3...'. The
1214 default sorting key is 'time'.
1214 default sorting key is 'time'.
1215
1215
1216 The following is copied verbatim from the profile documentation
1216 The following is copied verbatim from the profile documentation
1217 referenced below:
1217 referenced below:
1218
1218
1219 When more than one key is provided, additional keys are used as
1219 When more than one key is provided, additional keys are used as
1220 secondary criteria when the there is equality in all keys selected
1220 secondary criteria when the there is equality in all keys selected
1221 before them.
1221 before them.
1222
1222
1223 Abbreviations can be used for any key names, as long as the
1223 Abbreviations can be used for any key names, as long as the
1224 abbreviation is unambiguous. The following are the keys currently
1224 abbreviation is unambiguous. The following are the keys currently
1225 defined:
1225 defined:
1226
1226
1227 Valid Arg Meaning\\
1227 Valid Arg Meaning\\
1228 "calls" call count\\
1228 "calls" call count\\
1229 "cumulative" cumulative time\\
1229 "cumulative" cumulative time\\
1230 "file" file name\\
1230 "file" file name\\
1231 "module" file name\\
1231 "module" file name\\
1232 "pcalls" primitive call count\\
1232 "pcalls" primitive call count\\
1233 "line" line number\\
1233 "line" line number\\
1234 "name" function name\\
1234 "name" function name\\
1235 "nfl" name/file/line\\
1235 "nfl" name/file/line\\
1236 "stdname" standard name\\
1236 "stdname" standard name\\
1237 "time" internal time
1237 "time" internal time
1238
1238
1239 Note that all sorts on statistics are in descending order (placing
1239 Note that all sorts on statistics are in descending order (placing
1240 most time consuming items first), where as name, file, and line number
1240 most time consuming items first), where as name, file, and line number
1241 searches are in ascending order (i.e., alphabetical). The subtle
1241 searches are in ascending order (i.e., alphabetical). The subtle
1242 distinction between "nfl" and "stdname" is that the standard name is a
1242 distinction between "nfl" and "stdname" is that the standard name is a
1243 sort of the name as printed, which means that the embedded line
1243 sort of the name as printed, which means that the embedded line
1244 numbers get compared in an odd way. For example, lines 3, 20, and 40
1244 numbers get compared in an odd way. For example, lines 3, 20, and 40
1245 would (if the file names were the same) appear in the string order
1245 would (if the file names were the same) appear in the string order
1246 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1246 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1247 line numbers. In fact, sort_stats("nfl") is the same as
1247 line numbers. In fact, sort_stats("nfl") is the same as
1248 sort_stats("name", "file", "line").
1248 sort_stats("name", "file", "line").
1249
1249
1250 -T <filename>: save profile results as shown on screen to a text
1250 -T <filename>: save profile results as shown on screen to a text
1251 file. The profile is still shown on screen.
1251 file. The profile is still shown on screen.
1252
1252
1253 -D <filename>: save (via dump_stats) profile statistics to given
1253 -D <filename>: save (via dump_stats) profile statistics to given
1254 filename. This data is in a format understod by the pstats module, and
1254 filename. This data is in a format understod by the pstats module, and
1255 is generated by a call to the dump_stats() method of profile
1255 is generated by a call to the dump_stats() method of profile
1256 objects. The profile is still shown on screen.
1256 objects. The profile is still shown on screen.
1257
1257
1258 If you want to run complete programs under the profiler's control, use
1258 If you want to run complete programs under the profiler's control, use
1259 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1259 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1260 contains profiler specific options as described here.
1260 contains profiler specific options as described here.
1261
1261
1262 You can read the complete documentation for the profile module with:\\
1262 You can read the complete documentation for the profile module with:\\
1263 In [1]: import profile; profile.help() """
1263 In [1]: import profile; profile.help() """
1264
1264
1265 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1265 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1266 # protect user quote marks
1266 # protect user quote marks
1267 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1267 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1268
1268
1269 if user_mode: # regular user call
1269 if user_mode: # regular user call
1270 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1270 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1271 list_all=1)
1271 list_all=1)
1272 namespace = self.shell.user_ns
1272 namespace = self.shell.user_ns
1273 else: # called to run a program by %run -p
1273 else: # called to run a program by %run -p
1274 try:
1274 try:
1275 filename = get_py_filename(arg_lst[0])
1275 filename = get_py_filename(arg_lst[0])
1276 except IOError,msg:
1276 except IOError,msg:
1277 error(msg)
1277 error(msg)
1278 return
1278 return
1279
1279
1280 arg_str = 'execfile(filename,prog_ns)'
1280 arg_str = 'execfile(filename,prog_ns)'
1281 namespace = locals()
1281 namespace = locals()
1282
1282
1283 opts.merge(opts_def)
1283 opts.merge(opts_def)
1284
1284
1285 prof = profile.Profile()
1285 prof = profile.Profile()
1286 try:
1286 try:
1287 prof = prof.runctx(arg_str,namespace,namespace)
1287 prof = prof.runctx(arg_str,namespace,namespace)
1288 sys_exit = ''
1288 sys_exit = ''
1289 except SystemExit:
1289 except SystemExit:
1290 sys_exit = """*** SystemExit exception caught in code being profiled."""
1290 sys_exit = """*** SystemExit exception caught in code being profiled."""
1291
1291
1292 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1292 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1293
1293
1294 lims = opts.l
1294 lims = opts.l
1295 if lims:
1295 if lims:
1296 lims = [] # rebuild lims with ints/floats/strings
1296 lims = [] # rebuild lims with ints/floats/strings
1297 for lim in opts.l:
1297 for lim in opts.l:
1298 try:
1298 try:
1299 lims.append(int(lim))
1299 lims.append(int(lim))
1300 except ValueError:
1300 except ValueError:
1301 try:
1301 try:
1302 lims.append(float(lim))
1302 lims.append(float(lim))
1303 except ValueError:
1303 except ValueError:
1304 lims.append(lim)
1304 lims.append(lim)
1305
1305
1306 # trap output
1306 # trap output
1307 sys_stdout = sys.stdout
1307 sys_stdout = sys.stdout
1308 stdout_trap = StringIO()
1308 stdout_trap = StringIO()
1309 try:
1309 try:
1310 sys.stdout = stdout_trap
1310 sys.stdout = stdout_trap
1311 stats.print_stats(*lims)
1311 stats.print_stats(*lims)
1312 finally:
1312 finally:
1313 sys.stdout = sys_stdout
1313 sys.stdout = sys_stdout
1314 output = stdout_trap.getvalue()
1314 output = stdout_trap.getvalue()
1315 output = output.rstrip()
1315 output = output.rstrip()
1316
1316
1317 page(output,screen_lines=self.shell.rc.screen_length)
1317 page(output,screen_lines=self.shell.rc.screen_length)
1318 print sys_exit,
1318 print sys_exit,
1319
1319
1320 dump_file = opts.D[0]
1320 dump_file = opts.D[0]
1321 text_file = opts.T[0]
1321 text_file = opts.T[0]
1322 if dump_file:
1322 if dump_file:
1323 prof.dump_stats(dump_file)
1323 prof.dump_stats(dump_file)
1324 print '\n*** Profile stats marshalled to file',\
1324 print '\n*** Profile stats marshalled to file',\
1325 `dump_file`+'.',sys_exit
1325 `dump_file`+'.',sys_exit
1326 if text_file:
1326 if text_file:
1327 file(text_file,'w').write(output)
1327 file(text_file,'w').write(output)
1328 print '\n*** Profile printout saved to text file',\
1328 print '\n*** Profile printout saved to text file',\
1329 `text_file`+'.',sys_exit
1329 `text_file`+'.',sys_exit
1330
1330
1331 if opts.has_key('r'):
1331 if opts.has_key('r'):
1332 return stats
1332 return stats
1333 else:
1333 else:
1334 return None
1334 return None
1335
1335
1336 def magic_run(self, parameter_s ='',runner=None):
1336 def magic_run(self, parameter_s ='',runner=None):
1337 """Run the named file inside IPython as a program.
1337 """Run the named file inside IPython as a program.
1338
1338
1339 Usage:\\
1339 Usage:\\
1340 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1340 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1341
1341
1342 Parameters after the filename are passed as command-line arguments to
1342 Parameters after the filename are passed as command-line arguments to
1343 the program (put in sys.argv). Then, control returns to IPython's
1343 the program (put in sys.argv). Then, control returns to IPython's
1344 prompt.
1344 prompt.
1345
1345
1346 This is similar to running at a system prompt:\\
1346 This is similar to running at a system prompt:\\
1347 $ python file args\\
1347 $ python file args\\
1348 but with the advantage of giving you IPython's tracebacks, and of
1348 but with the advantage of giving you IPython's tracebacks, and of
1349 loading all variables into your interactive namespace for further use
1349 loading all variables into your interactive namespace for further use
1350 (unless -p is used, see below).
1350 (unless -p is used, see below).
1351
1351
1352 The file is executed in a namespace initially consisting only of
1352 The file is executed in a namespace initially consisting only of
1353 __name__=='__main__' and sys.argv constructed as indicated. It thus
1353 __name__=='__main__' and sys.argv constructed as indicated. It thus
1354 sees its environment as if it were being run as a stand-alone
1354 sees its environment as if it were being run as a stand-alone
1355 program. But after execution, the IPython interactive namespace gets
1355 program. But after execution, the IPython interactive namespace gets
1356 updated with all variables defined in the program (except for __name__
1356 updated with all variables defined in the program (except for __name__
1357 and sys.argv). This allows for very convenient loading of code for
1357 and sys.argv). This allows for very convenient loading of code for
1358 interactive work, while giving each program a 'clean sheet' to run in.
1358 interactive work, while giving each program a 'clean sheet' to run in.
1359
1359
1360 Options:
1360 Options:
1361
1361
1362 -n: __name__ is NOT set to '__main__', but to the running file's name
1362 -n: __name__ is NOT set to '__main__', but to the running file's name
1363 without extension (as python does under import). This allows running
1363 without extension (as python does under import). This allows running
1364 scripts and reloading the definitions in them without calling code
1364 scripts and reloading the definitions in them without calling code
1365 protected by an ' if __name__ == "__main__" ' clause.
1365 protected by an ' if __name__ == "__main__" ' clause.
1366
1366
1367 -i: run the file in IPython's namespace instead of an empty one. This
1367 -i: run the file in IPython's namespace instead of an empty one. This
1368 is useful if you are experimenting with code written in a text editor
1368 is useful if you are experimenting with code written in a text editor
1369 which depends on variables defined interactively.
1369 which depends on variables defined interactively.
1370
1370
1371 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1371 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1372 being run. This is particularly useful if IPython is being used to
1372 being run. This is particularly useful if IPython is being used to
1373 run unittests, which always exit with a sys.exit() call. In such
1373 run unittests, which always exit with a sys.exit() call. In such
1374 cases you are interested in the output of the test results, not in
1374 cases you are interested in the output of the test results, not in
1375 seeing a traceback of the unittest module.
1375 seeing a traceback of the unittest module.
1376
1376
1377 -t: print timing information at the end of the run. IPython will give
1377 -t: print timing information at the end of the run. IPython will give
1378 you an estimated CPU time consumption for your script, which under
1378 you an estimated CPU time consumption for your script, which under
1379 Unix uses the resource module to avoid the wraparound problems of
1379 Unix uses the resource module to avoid the wraparound problems of
1380 time.clock(). Under Unix, an estimate of time spent on system tasks
1380 time.clock(). Under Unix, an estimate of time spent on system tasks
1381 is also given (for Windows platforms this is reported as 0.0).
1381 is also given (for Windows platforms this is reported as 0.0).
1382
1382
1383 If -t is given, an additional -N<N> option can be given, where <N>
1383 If -t is given, an additional -N<N> option can be given, where <N>
1384 must be an integer indicating how many times you want the script to
1384 must be an integer indicating how many times you want the script to
1385 run. The final timing report will include total and per run results.
1385 run. The final timing report will include total and per run results.
1386
1386
1387 For example (testing the script uniq_stable.py):
1387 For example (testing the script uniq_stable.py):
1388
1388
1389 In [1]: run -t uniq_stable
1389 In [1]: run -t uniq_stable
1390
1390
1391 IPython CPU timings (estimated):\\
1391 IPython CPU timings (estimated):\\
1392 User : 0.19597 s.\\
1392 User : 0.19597 s.\\
1393 System: 0.0 s.\\
1393 System: 0.0 s.\\
1394
1394
1395 In [2]: run -t -N5 uniq_stable
1395 In [2]: run -t -N5 uniq_stable
1396
1396
1397 IPython CPU timings (estimated):\\
1397 IPython CPU timings (estimated):\\
1398 Total runs performed: 5\\
1398 Total runs performed: 5\\
1399 Times : Total Per run\\
1399 Times : Total Per run\\
1400 User : 0.910862 s, 0.1821724 s.\\
1400 User : 0.910862 s, 0.1821724 s.\\
1401 System: 0.0 s, 0.0 s.
1401 System: 0.0 s, 0.0 s.
1402
1402
1403 -d: run your program under the control of pdb, the Python debugger.
1403 -d: run your program under the control of pdb, the Python debugger.
1404 This allows you to execute your program step by step, watch variables,
1404 This allows you to execute your program step by step, watch variables,
1405 etc. Internally, what IPython does is similar to calling:
1405 etc. Internally, what IPython does is similar to calling:
1406
1406
1407 pdb.run('execfile("YOURFILENAME")')
1407 pdb.run('execfile("YOURFILENAME")')
1408
1408
1409 with a breakpoint set on line 1 of your file. You can change the line
1409 with a breakpoint set on line 1 of your file. You can change the line
1410 number for this automatic breakpoint to be <N> by using the -bN option
1410 number for this automatic breakpoint to be <N> by using the -bN option
1411 (where N must be an integer). For example:
1411 (where N must be an integer). For example:
1412
1412
1413 %run -d -b40 myscript
1413 %run -d -b40 myscript
1414
1414
1415 will set the first breakpoint at line 40 in myscript.py. Note that
1415 will set the first breakpoint at line 40 in myscript.py. Note that
1416 the first breakpoint must be set on a line which actually does
1416 the first breakpoint must be set on a line which actually does
1417 something (not a comment or docstring) for it to stop execution.
1417 something (not a comment or docstring) for it to stop execution.
1418
1418
1419 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1419 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1420 first enter 'c' (without qoutes) to start execution up to the first
1420 first enter 'c' (without qoutes) to start execution up to the first
1421 breakpoint.
1421 breakpoint.
1422
1422
1423 Entering 'help' gives information about the use of the debugger. You
1423 Entering 'help' gives information about the use of the debugger. You
1424 can easily see pdb's full documentation with "import pdb;pdb.help()"
1424 can easily see pdb's full documentation with "import pdb;pdb.help()"
1425 at a prompt.
1425 at a prompt.
1426
1426
1427 -p: run program under the control of the Python profiler module (which
1427 -p: run program under the control of the Python profiler module (which
1428 prints a detailed report of execution times, function calls, etc).
1428 prints a detailed report of execution times, function calls, etc).
1429
1429
1430 You can pass other options after -p which affect the behavior of the
1430 You can pass other options after -p which affect the behavior of the
1431 profiler itself. See the docs for %prun for details.
1431 profiler itself. See the docs for %prun for details.
1432
1432
1433 In this mode, the program's variables do NOT propagate back to the
1433 In this mode, the program's variables do NOT propagate back to the
1434 IPython interactive namespace (because they remain in the namespace
1434 IPython interactive namespace (because they remain in the namespace
1435 where the profiler executes them).
1435 where the profiler executes them).
1436
1436
1437 Internally this triggers a call to %prun, see its documentation for
1437 Internally this triggers a call to %prun, see its documentation for
1438 details on the options available specifically for profiling."""
1438 details on the options available specifically for profiling."""
1439
1439
1440 # get arguments and set sys.argv for program to be run.
1440 # get arguments and set sys.argv for program to be run.
1441 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1441 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1442 mode='list',list_all=1)
1442 mode='list',list_all=1)
1443
1443
1444 try:
1444 try:
1445 filename = get_py_filename(arg_lst[0])
1445 filename = get_py_filename(arg_lst[0])
1446 except IndexError:
1446 except IndexError:
1447 warn('you must provide at least a filename.')
1447 warn('you must provide at least a filename.')
1448 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1448 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1449 return
1449 return
1450 except IOError,msg:
1450 except IOError,msg:
1451 error(msg)
1451 error(msg)
1452 return
1452 return
1453
1453
1454 # Control the response to exit() calls made by the script being run
1454 # Control the response to exit() calls made by the script being run
1455 exit_ignore = opts.has_key('e')
1455 exit_ignore = opts.has_key('e')
1456
1456
1457 # Make sure that the running script gets a proper sys.argv as if it
1457 # Make sure that the running script gets a proper sys.argv as if it
1458 # were run from a system shell.
1458 # were run from a system shell.
1459 save_argv = sys.argv # save it for later restoring
1459 save_argv = sys.argv # save it for later restoring
1460 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1460 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1461
1461
1462 if opts.has_key('i'):
1462 if opts.has_key('i'):
1463 prog_ns = self.shell.user_ns
1463 prog_ns = self.shell.user_ns
1464 __name__save = self.shell.user_ns['__name__']
1464 __name__save = self.shell.user_ns['__name__']
1465 prog_ns['__name__'] = '__main__'
1465 prog_ns['__name__'] = '__main__'
1466 else:
1466 else:
1467 if opts.has_key('n'):
1467 if opts.has_key('n'):
1468 name = os.path.splitext(os.path.basename(filename))[0]
1468 name = os.path.splitext(os.path.basename(filename))[0]
1469 else:
1469 else:
1470 name = '__main__'
1470 name = '__main__'
1471 prog_ns = {'__name__':name}
1471 prog_ns = {'__name__':name}
1472
1472
1473 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1473 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1474 # set the __file__ global in the script's namespace
1474 # set the __file__ global in the script's namespace
1475 prog_ns['__file__'] = filename
1475 prog_ns['__file__'] = filename
1476
1476
1477 # pickle fix. See iplib for an explanation. But we need to make sure
1477 # pickle fix. See iplib for an explanation. But we need to make sure
1478 # that, if we overwrite __main__, we replace it at the end
1478 # that, if we overwrite __main__, we replace it at the end
1479 if prog_ns['__name__'] == '__main__':
1479 if prog_ns['__name__'] == '__main__':
1480 restore_main = sys.modules['__main__']
1480 restore_main = sys.modules['__main__']
1481 else:
1481 else:
1482 restore_main = False
1482 restore_main = False
1483
1483
1484 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1484 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1485
1485
1486 stats = None
1486 stats = None
1487 try:
1487 try:
1488 if opts.has_key('p'):
1488 if opts.has_key('p'):
1489 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1489 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1490 else:
1490 else:
1491 if opts.has_key('d'):
1491 if opts.has_key('d'):
1492 deb = Debugger.Pdb(self.shell.rc.colors)
1492 deb = Debugger.Pdb(self.shell.rc.colors)
1493 # reset Breakpoint state, which is moronically kept
1493 # reset Breakpoint state, which is moronically kept
1494 # in a class
1494 # in a class
1495 bdb.Breakpoint.next = 1
1495 bdb.Breakpoint.next = 1
1496 bdb.Breakpoint.bplist = {}
1496 bdb.Breakpoint.bplist = {}
1497 bdb.Breakpoint.bpbynumber = [None]
1497 bdb.Breakpoint.bpbynumber = [None]
1498 # Set an initial breakpoint to stop execution
1498 # Set an initial breakpoint to stop execution
1499 maxtries = 10
1499 maxtries = 10
1500 bp = int(opts.get('b',[1])[0])
1500 bp = int(opts.get('b',[1])[0])
1501 checkline = deb.checkline(filename,bp)
1501 checkline = deb.checkline(filename,bp)
1502 if not checkline:
1502 if not checkline:
1503 for bp in range(bp+1,bp+maxtries+1):
1503 for bp in range(bp+1,bp+maxtries+1):
1504 if deb.checkline(filename,bp):
1504 if deb.checkline(filename,bp):
1505 break
1505 break
1506 else:
1506 else:
1507 msg = ("\nI failed to find a valid line to set "
1507 msg = ("\nI failed to find a valid line to set "
1508 "a breakpoint\n"
1508 "a breakpoint\n"
1509 "after trying up to line: %s.\n"
1509 "after trying up to line: %s.\n"
1510 "Please set a valid breakpoint manually "
1510 "Please set a valid breakpoint manually "
1511 "with the -b option." % bp)
1511 "with the -b option." % bp)
1512 error(msg)
1512 error(msg)
1513 return
1513 return
1514 # if we find a good linenumber, set the breakpoint
1514 # if we find a good linenumber, set the breakpoint
1515 deb.do_break('%s:%s' % (filename,bp))
1515 deb.do_break('%s:%s' % (filename,bp))
1516 # Start file run
1516 # Start file run
1517 print "NOTE: Enter 'c' at the",
1517 print "NOTE: Enter 'c' at the",
1518 print "ipdb> prompt to start your script."
1518 print "ipdb> prompt to start your script."
1519 try:
1519 try:
1520 deb.run('execfile("%s")' % filename,prog_ns)
1520 deb.run('execfile("%s")' % filename,prog_ns)
1521 except:
1521 except:
1522 etype, value, tb = sys.exc_info()
1522 etype, value, tb = sys.exc_info()
1523 # Skip three frames in the traceback: the %run one,
1523 # Skip three frames in the traceback: the %run one,
1524 # one inside bdb.py, and the command-line typed by the
1524 # one inside bdb.py, and the command-line typed by the
1525 # user (run by exec in pdb itself).
1525 # user (run by exec in pdb itself).
1526 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1526 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1527 else:
1527 else:
1528 if runner is None:
1528 if runner is None:
1529 runner = self.shell.safe_execfile
1529 runner = self.shell.safe_execfile
1530 if opts.has_key('t'):
1530 if opts.has_key('t'):
1531 try:
1531 try:
1532 nruns = int(opts['N'][0])
1532 nruns = int(opts['N'][0])
1533 if nruns < 1:
1533 if nruns < 1:
1534 error('Number of runs must be >=1')
1534 error('Number of runs must be >=1')
1535 return
1535 return
1536 except (KeyError):
1536 except (KeyError):
1537 nruns = 1
1537 nruns = 1
1538 if nruns == 1:
1538 if nruns == 1:
1539 t0 = clock2()
1539 t0 = clock2()
1540 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1540 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1541 t1 = clock2()
1541 t1 = clock2()
1542 t_usr = t1[0]-t0[0]
1542 t_usr = t1[0]-t0[0]
1543 t_sys = t1[1]-t1[1]
1543 t_sys = t1[1]-t1[1]
1544 print "\nIPython CPU timings (estimated):"
1544 print "\nIPython CPU timings (estimated):"
1545 print " User : %10s s." % t_usr
1545 print " User : %10s s." % t_usr
1546 print " System: %10s s." % t_sys
1546 print " System: %10s s." % t_sys
1547 else:
1547 else:
1548 runs = range(nruns)
1548 runs = range(nruns)
1549 t0 = clock2()
1549 t0 = clock2()
1550 for nr in runs:
1550 for nr in runs:
1551 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1551 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1552 t1 = clock2()
1552 t1 = clock2()
1553 t_usr = t1[0]-t0[0]
1553 t_usr = t1[0]-t0[0]
1554 t_sys = t1[1]-t1[1]
1554 t_sys = t1[1]-t1[1]
1555 print "\nIPython CPU timings (estimated):"
1555 print "\nIPython CPU timings (estimated):"
1556 print "Total runs performed:",nruns
1556 print "Total runs performed:",nruns
1557 print " Times : %10s %10s" % ('Total','Per run')
1557 print " Times : %10s %10s" % ('Total','Per run')
1558 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1558 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1559 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1559 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1560
1560
1561 else:
1561 else:
1562 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1562 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1563 if opts.has_key('i'):
1563 if opts.has_key('i'):
1564 self.shell.user_ns['__name__'] = __name__save
1564 self.shell.user_ns['__name__'] = __name__save
1565 else:
1565 else:
1566 # update IPython interactive namespace
1566 # update IPython interactive namespace
1567 del prog_ns['__name__']
1567 del prog_ns['__name__']
1568 self.shell.user_ns.update(prog_ns)
1568 self.shell.user_ns.update(prog_ns)
1569 finally:
1569 finally:
1570 sys.argv = save_argv
1570 sys.argv = save_argv
1571 if restore_main:
1571 if restore_main:
1572 sys.modules['__main__'] = restore_main
1572 sys.modules['__main__'] = restore_main
1573 return stats
1573 return stats
1574
1574
1575 def magic_runlog(self, parameter_s =''):
1575 def magic_runlog(self, parameter_s =''):
1576 """Run files as logs.
1576 """Run files as logs.
1577
1577
1578 Usage:\\
1578 Usage:\\
1579 %runlog file1 file2 ...
1579 %runlog file1 file2 ...
1580
1580
1581 Run the named files (treating them as log files) in sequence inside
1581 Run the named files (treating them as log files) in sequence inside
1582 the interpreter, and return to the prompt. This is much slower than
1582 the interpreter, and return to the prompt. This is much slower than
1583 %run because each line is executed in a try/except block, but it
1583 %run because each line is executed in a try/except block, but it
1584 allows running files with syntax errors in them.
1584 allows running files with syntax errors in them.
1585
1585
1586 Normally IPython will guess when a file is one of its own logfiles, so
1586 Normally IPython will guess when a file is one of its own logfiles, so
1587 you can typically use %run even for logs. This shorthand allows you to
1587 you can typically use %run even for logs. This shorthand allows you to
1588 force any file to be treated as a log file."""
1588 force any file to be treated as a log file."""
1589
1589
1590 for f in parameter_s.split():
1590 for f in parameter_s.split():
1591 self.shell.safe_execfile(f,self.shell.user_ns,
1591 self.shell.safe_execfile(f,self.shell.user_ns,
1592 self.shell.user_ns,islog=1)
1592 self.shell.user_ns,islog=1)
1593
1593
1594 def magic_timeit(self, parameter_s =''):
1594 def magic_timeit(self, parameter_s =''):
1595 """Time execution of a Python statement or expression
1595 """Time execution of a Python statement or expression
1596
1596
1597 Usage:\\
1597 Usage:\\
1598 %timeit [-n<N> -r<R> [-t|-c]] statement
1598 %timeit [-n<N> -r<R> [-t|-c]] statement
1599
1599
1600 Time execution of a Python statement or expression using the timeit
1600 Time execution of a Python statement or expression using the timeit
1601 module.
1601 module.
1602
1602
1603 Options:
1603 Options:
1604 -n<N>: execute the given statement <N> times in a loop. If this value
1604 -n<N>: execute the given statement <N> times in a loop. If this value
1605 is not given, a fitting value is chosen.
1605 is not given, a fitting value is chosen.
1606
1606
1607 -r<R>: repeat the loop iteration <R> times and take the best result.
1607 -r<R>: repeat the loop iteration <R> times and take the best result.
1608 Default: 3
1608 Default: 3
1609
1609
1610 -t: use time.time to measure the time, which is the default on Unix.
1610 -t: use time.time to measure the time, which is the default on Unix.
1611 This function measures wall time.
1611 This function measures wall time.
1612
1612
1613 -c: use time.clock to measure the time, which is the default on
1613 -c: use time.clock to measure the time, which is the default on
1614 Windows and measures wall time. On Unix, resource.getrusage is used
1614 Windows and measures wall time. On Unix, resource.getrusage is used
1615 instead and returns the CPU user time.
1615 instead and returns the CPU user time.
1616
1616
1617 -p<P>: use a precision of <P> digits to display the timing result.
1617 -p<P>: use a precision of <P> digits to display the timing result.
1618 Default: 3
1618 Default: 3
1619
1619
1620
1620
1621 Examples:\\
1621 Examples:\\
1622 In [1]: %timeit pass
1622 In [1]: %timeit pass
1623 10000000 loops, best of 3: 53.3 ns per loop
1623 10000000 loops, best of 3: 53.3 ns per loop
1624
1624
1625 In [2]: u = None
1625 In [2]: u = None
1626
1626
1627 In [3]: %timeit u is None
1627 In [3]: %timeit u is None
1628 10000000 loops, best of 3: 184 ns per loop
1628 10000000 loops, best of 3: 184 ns per loop
1629
1629
1630 In [4]: %timeit -r 4 u == None
1630 In [4]: %timeit -r 4 u == None
1631 1000000 loops, best of 4: 242 ns per loop
1631 1000000 loops, best of 4: 242 ns per loop
1632
1632
1633 In [5]: import time
1633 In [5]: import time
1634
1634
1635 In [6]: %timeit -n1 time.sleep(2)
1635 In [6]: %timeit -n1 time.sleep(2)
1636 1 loops, best of 3: 2 s per loop
1636 1 loops, best of 3: 2 s per loop
1637
1637
1638
1638
1639 The times reported by %timeit will be slightly higher than those reported
1639 The times reported by %timeit will be slightly higher than those reported
1640 by the timeit.py script when variables are accessed. This is due to the
1640 by the timeit.py script when variables are accessed. This is due to the
1641 fact that %timeit executes the statement in the namespace of the shell,
1641 fact that %timeit executes the statement in the namespace of the shell,
1642 compared with timeit.py, which uses a single setup statement to import
1642 compared with timeit.py, which uses a single setup statement to import
1643 function or create variables. Generally, the bias does not matter as long
1643 function or create variables. Generally, the bias does not matter as long
1644 as results from timeit.py are not mixed with those from %timeit."""
1644 as results from timeit.py are not mixed with those from %timeit."""
1645 import timeit
1645 import timeit
1646 import math
1646 import math
1647
1647
1648 units = ["s", "ms", "\xc2\xb5s", "ns"]
1648 units = ["s", "ms", "\xc2\xb5s", "ns"]
1649 scaling = [1, 1e3, 1e6, 1e9]
1649 scaling = [1, 1e3, 1e6, 1e9]
1650
1650
1651 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:')
1651 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:')
1652 if stmt == "":
1652 if stmt == "":
1653 return
1653 return
1654 timefunc = timeit.default_timer
1654 timefunc = timeit.default_timer
1655 number = int(getattr(opts, "n", 0))
1655 number = int(getattr(opts, "n", 0))
1656 repeat = int(getattr(opts, "r", timeit.default_repeat))
1656 repeat = int(getattr(opts, "r", timeit.default_repeat))
1657 precision = int(getattr(opts, "p", 3))
1657 precision = int(getattr(opts, "p", 3))
1658 if hasattr(opts, "t"):
1658 if hasattr(opts, "t"):
1659 timefunc = time.time
1659 timefunc = time.time
1660 if hasattr(opts, "c"):
1660 if hasattr(opts, "c"):
1661 timefunc = clock
1661 timefunc = clock
1662
1662
1663 timer = timeit.Timer(timer=timefunc)
1663 timer = timeit.Timer(timer=timefunc)
1664 # this code has tight coupling to the inner workings of timeit.Timer,
1664 # this code has tight coupling to the inner workings of timeit.Timer,
1665 # but is there a better way to achieve that the code stmt has access
1665 # but is there a better way to achieve that the code stmt has access
1666 # to the shell namespace?
1666 # to the shell namespace?
1667
1667
1668 src = timeit.template % {'stmt': timeit.reindent(stmt, 8), 'setup': "pass"}
1668 src = timeit.template % {'stmt': timeit.reindent(stmt, 8), 'setup': "pass"}
1669 code = compile(src, "<magic-timeit>", "exec")
1669 code = compile(src, "<magic-timeit>", "exec")
1670 ns = {}
1670 ns = {}
1671 exec code in self.shell.user_ns, ns
1671 exec code in self.shell.user_ns, ns
1672 timer.inner = ns["inner"]
1672 timer.inner = ns["inner"]
1673
1673
1674 if number == 0:
1674 if number == 0:
1675 # determine number so that 0.2 <= total time < 2.0
1675 # determine number so that 0.2 <= total time < 2.0
1676 number = 1
1676 number = 1
1677 for i in range(1, 10):
1677 for i in range(1, 10):
1678 number *= 10
1678 number *= 10
1679 if timer.timeit(number) >= 0.2:
1679 if timer.timeit(number) >= 0.2:
1680 break
1680 break
1681
1681
1682 best = min(timer.repeat(repeat, number)) / number
1682 best = min(timer.repeat(repeat, number)) / number
1683
1683
1684 if best > 0.0:
1684 if best > 0.0:
1685 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1685 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1686 else:
1686 else:
1687 order = 3
1687 order = 3
1688 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1688 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1689 precision,
1689 precision,
1690 best * scaling[order],
1690 best * scaling[order],
1691 units[order])
1691 units[order])
1692
1692
1693 def magic_time(self,parameter_s = ''):
1693 def magic_time(self,parameter_s = ''):
1694 """Time execution of a Python statement or expression.
1694 """Time execution of a Python statement or expression.
1695
1695
1696 The CPU and wall clock times are printed, and the value of the
1696 The CPU and wall clock times are printed, and the value of the
1697 expression (if any) is returned. Note that under Win32, system time
1697 expression (if any) is returned. Note that under Win32, system time
1698 is always reported as 0, since it can not be measured.
1698 is always reported as 0, since it can not be measured.
1699
1699
1700 This function provides very basic timing functionality. In Python
1700 This function provides very basic timing functionality. In Python
1701 2.3, the timeit module offers more control and sophistication, so this
1701 2.3, the timeit module offers more control and sophistication, so this
1702 could be rewritten to use it (patches welcome).
1702 could be rewritten to use it (patches welcome).
1703
1703
1704 Some examples:
1704 Some examples:
1705
1705
1706 In [1]: time 2**128
1706 In [1]: time 2**128
1707 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1707 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1708 Wall time: 0.00
1708 Wall time: 0.00
1709 Out[1]: 340282366920938463463374607431768211456L
1709 Out[1]: 340282366920938463463374607431768211456L
1710
1710
1711 In [2]: n = 1000000
1711 In [2]: n = 1000000
1712
1712
1713 In [3]: time sum(range(n))
1713 In [3]: time sum(range(n))
1714 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1714 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1715 Wall time: 1.37
1715 Wall time: 1.37
1716 Out[3]: 499999500000L
1716 Out[3]: 499999500000L
1717
1717
1718 In [4]: time print 'hello world'
1718 In [4]: time print 'hello world'
1719 hello world
1719 hello world
1720 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1720 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1721 Wall time: 0.00
1721 Wall time: 0.00
1722 """
1722 """
1723
1723
1724 # fail immediately if the given expression can't be compiled
1724 # fail immediately if the given expression can't be compiled
1725 try:
1725 try:
1726 mode = 'eval'
1726 mode = 'eval'
1727 code = compile(parameter_s,'<timed eval>',mode)
1727 code = compile(parameter_s,'<timed eval>',mode)
1728 except SyntaxError:
1728 except SyntaxError:
1729 mode = 'exec'
1729 mode = 'exec'
1730 code = compile(parameter_s,'<timed exec>',mode)
1730 code = compile(parameter_s,'<timed exec>',mode)
1731 # skew measurement as little as possible
1731 # skew measurement as little as possible
1732 glob = self.shell.user_ns
1732 glob = self.shell.user_ns
1733 clk = clock2
1733 clk = clock2
1734 wtime = time.time
1734 wtime = time.time
1735 # time execution
1735 # time execution
1736 wall_st = wtime()
1736 wall_st = wtime()
1737 if mode=='eval':
1737 if mode=='eval':
1738 st = clk()
1738 st = clk()
1739 out = eval(code,glob)
1739 out = eval(code,glob)
1740 end = clk()
1740 end = clk()
1741 else:
1741 else:
1742 st = clk()
1742 st = clk()
1743 exec code in glob
1743 exec code in glob
1744 end = clk()
1744 end = clk()
1745 out = None
1745 out = None
1746 wall_end = wtime()
1746 wall_end = wtime()
1747 # Compute actual times and report
1747 # Compute actual times and report
1748 wall_time = wall_end-wall_st
1748 wall_time = wall_end-wall_st
1749 cpu_user = end[0]-st[0]
1749 cpu_user = end[0]-st[0]
1750 cpu_sys = end[1]-st[1]
1750 cpu_sys = end[1]-st[1]
1751 cpu_tot = cpu_user+cpu_sys
1751 cpu_tot = cpu_user+cpu_sys
1752 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1752 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1753 (cpu_user,cpu_sys,cpu_tot)
1753 (cpu_user,cpu_sys,cpu_tot)
1754 print "Wall time: %.2f" % wall_time
1754 print "Wall time: %.2f" % wall_time
1755 return out
1755 return out
1756
1756
1757 def magic_macro(self,parameter_s = ''):
1757 def magic_macro(self,parameter_s = ''):
1758 """Define a set of input lines as a macro for future re-execution.
1758 """Define a set of input lines as a macro for future re-execution.
1759
1759
1760 Usage:\\
1760 Usage:\\
1761 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1761 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1762
1762
1763 Options:
1763 Options:
1764
1764
1765 -r: use 'raw' input. By default, the 'processed' history is used,
1765 -r: use 'raw' input. By default, the 'processed' history is used,
1766 so that magics are loaded in their transformed version to valid
1766 so that magics are loaded in their transformed version to valid
1767 Python. If this option is given, the raw input as typed as the
1767 Python. If this option is given, the raw input as typed as the
1768 command line is used instead.
1768 command line is used instead.
1769
1769
1770 This will define a global variable called `name` which is a string
1770 This will define a global variable called `name` which is a string
1771 made of joining the slices and lines you specify (n1,n2,... numbers
1771 made of joining the slices and lines you specify (n1,n2,... numbers
1772 above) from your input history into a single string. This variable
1772 above) from your input history into a single string. This variable
1773 acts like an automatic function which re-executes those lines as if
1773 acts like an automatic function which re-executes those lines as if
1774 you had typed them. You just type 'name' at the prompt and the code
1774 you had typed them. You just type 'name' at the prompt and the code
1775 executes.
1775 executes.
1776
1776
1777 The notation for indicating number ranges is: n1-n2 means 'use line
1777 The notation for indicating number ranges is: n1-n2 means 'use line
1778 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1778 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1779 using the lines numbered 5,6 and 7.
1779 using the lines numbered 5,6 and 7.
1780
1780
1781 Note: as a 'hidden' feature, you can also use traditional python slice
1781 Note: as a 'hidden' feature, you can also use traditional python slice
1782 notation, where N:M means numbers N through M-1.
1782 notation, where N:M means numbers N through M-1.
1783
1783
1784 For example, if your history contains (%hist prints it):
1784 For example, if your history contains (%hist prints it):
1785
1785
1786 44: x=1\\
1786 44: x=1\\
1787 45: y=3\\
1787 45: y=3\\
1788 46: z=x+y\\
1788 46: z=x+y\\
1789 47: print x\\
1789 47: print x\\
1790 48: a=5\\
1790 48: a=5\\
1791 49: print 'x',x,'y',y\\
1791 49: print 'x',x,'y',y\\
1792
1792
1793 you can create a macro with lines 44 through 47 (included) and line 49
1793 you can create a macro with lines 44 through 47 (included) and line 49
1794 called my_macro with:
1794 called my_macro with:
1795
1795
1796 In [51]: %macro my_macro 44-47 49
1796 In [51]: %macro my_macro 44-47 49
1797
1797
1798 Now, typing `my_macro` (without quotes) will re-execute all this code
1798 Now, typing `my_macro` (without quotes) will re-execute all this code
1799 in one pass.
1799 in one pass.
1800
1800
1801 You don't need to give the line-numbers in order, and any given line
1801 You don't need to give the line-numbers in order, and any given line
1802 number can appear multiple times. You can assemble macros with any
1802 number can appear multiple times. You can assemble macros with any
1803 lines from your input history in any order.
1803 lines from your input history in any order.
1804
1804
1805 The macro is a simple object which holds its value in an attribute,
1805 The macro is a simple object which holds its value in an attribute,
1806 but IPython's display system checks for macros and executes them as
1806 but IPython's display system checks for macros and executes them as
1807 code instead of printing them when you type their name.
1807 code instead of printing them when you type their name.
1808
1808
1809 You can view a macro's contents by explicitly printing it with:
1809 You can view a macro's contents by explicitly printing it with:
1810
1810
1811 'print macro_name'.
1811 'print macro_name'.
1812
1812
1813 For one-off cases which DON'T contain magic function calls in them you
1813 For one-off cases which DON'T contain magic function calls in them you
1814 can obtain similar results by explicitly executing slices from your
1814 can obtain similar results by explicitly executing slices from your
1815 input history with:
1815 input history with:
1816
1816
1817 In [60]: exec In[44:48]+In[49]"""
1817 In [60]: exec In[44:48]+In[49]"""
1818
1818
1819 opts,args = self.parse_options(parameter_s,'r',mode='list')
1819 opts,args = self.parse_options(parameter_s,'r',mode='list')
1820 name,ranges = args[0], args[1:]
1820 name,ranges = args[0], args[1:]
1821 #print 'rng',ranges # dbg
1821 #print 'rng',ranges # dbg
1822 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1822 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1823 macro = Macro(lines)
1823 macro = Macro(lines)
1824 self.shell.user_ns.update({name:macro})
1824 self.shell.user_ns.update({name:macro})
1825 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1825 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1826 print 'Macro contents:'
1826 print 'Macro contents:'
1827 print macro,
1827 print macro,
1828
1828
1829 def magic_save(self,parameter_s = ''):
1829 def magic_save(self,parameter_s = ''):
1830 """Save a set of lines to a given filename.
1830 """Save a set of lines to a given filename.
1831
1831
1832 Usage:\\
1832 Usage:\\
1833 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1833 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1834
1834
1835 Options:
1835 Options:
1836
1836
1837 -r: use 'raw' input. By default, the 'processed' history is used,
1837 -r: use 'raw' input. By default, the 'processed' history is used,
1838 so that magics are loaded in their transformed version to valid
1838 so that magics are loaded in their transformed version to valid
1839 Python. If this option is given, the raw input as typed as the
1839 Python. If this option is given, the raw input as typed as the
1840 command line is used instead.
1840 command line is used instead.
1841
1841
1842 This function uses the same syntax as %macro for line extraction, but
1842 This function uses the same syntax as %macro for line extraction, but
1843 instead of creating a macro it saves the resulting string to the
1843 instead of creating a macro it saves the resulting string to the
1844 filename you specify.
1844 filename you specify.
1845
1845
1846 It adds a '.py' extension to the file if you don't do so yourself, and
1846 It adds a '.py' extension to the file if you don't do so yourself, and
1847 it asks for confirmation before overwriting existing files."""
1847 it asks for confirmation before overwriting existing files."""
1848
1848
1849 opts,args = self.parse_options(parameter_s,'r',mode='list')
1849 opts,args = self.parse_options(parameter_s,'r',mode='list')
1850 fname,ranges = args[0], args[1:]
1850 fname,ranges = args[0], args[1:]
1851 if not fname.endswith('.py'):
1851 if not fname.endswith('.py'):
1852 fname += '.py'
1852 fname += '.py'
1853 if os.path.isfile(fname):
1853 if os.path.isfile(fname):
1854 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1854 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1855 if ans.lower() not in ['y','yes']:
1855 if ans.lower() not in ['y','yes']:
1856 print 'Operation cancelled.'
1856 print 'Operation cancelled.'
1857 return
1857 return
1858 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1858 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1859 f = file(fname,'w')
1859 f = file(fname,'w')
1860 f.write(cmds)
1860 f.write(cmds)
1861 f.close()
1861 f.close()
1862 print 'The following commands were written to file `%s`:' % fname
1862 print 'The following commands were written to file `%s`:' % fname
1863 print cmds
1863 print cmds
1864
1864
1865 def _edit_macro(self,mname,macro):
1865 def _edit_macro(self,mname,macro):
1866 """open an editor with the macro data in a file"""
1866 """open an editor with the macro data in a file"""
1867 filename = self.shell.mktempfile(macro.value)
1867 filename = self.shell.mktempfile(macro.value)
1868 self.shell.hooks.editor(filename)
1868 self.shell.hooks.editor(filename)
1869
1869
1870 # and make a new macro object, to replace the old one
1870 # and make a new macro object, to replace the old one
1871 mfile = open(filename)
1871 mfile = open(filename)
1872 mvalue = mfile.read()
1872 mvalue = mfile.read()
1873 mfile.close()
1873 mfile.close()
1874 self.shell.user_ns[mname] = Macro(mvalue)
1874 self.shell.user_ns[mname] = Macro(mvalue)
1875
1875
1876 def magic_ed(self,parameter_s=''):
1876 def magic_ed(self,parameter_s=''):
1877 """Alias to %edit."""
1877 """Alias to %edit."""
1878 return self.magic_edit(parameter_s)
1878 return self.magic_edit(parameter_s)
1879
1879
1880 def magic_edit(self,parameter_s='',last_call=['','']):
1880 def magic_edit(self,parameter_s='',last_call=['','']):
1881 """Bring up an editor and execute the resulting code.
1881 """Bring up an editor and execute the resulting code.
1882
1882
1883 Usage:
1883 Usage:
1884 %edit [options] [args]
1884 %edit [options] [args]
1885
1885
1886 %edit runs IPython's editor hook. The default version of this hook is
1886 %edit runs IPython's editor hook. The default version of this hook is
1887 set to call the __IPYTHON__.rc.editor command. This is read from your
1887 set to call the __IPYTHON__.rc.editor command. This is read from your
1888 environment variable $EDITOR. If this isn't found, it will default to
1888 environment variable $EDITOR. If this isn't found, it will default to
1889 vi under Linux/Unix and to notepad under Windows. See the end of this
1889 vi under Linux/Unix and to notepad under Windows. See the end of this
1890 docstring for how to change the editor hook.
1890 docstring for how to change the editor hook.
1891
1891
1892 You can also set the value of this editor via the command line option
1892 You can also set the value of this editor via the command line option
1893 '-editor' or in your ipythonrc file. This is useful if you wish to use
1893 '-editor' or in your ipythonrc file. This is useful if you wish to use
1894 specifically for IPython an editor different from your typical default
1894 specifically for IPython an editor different from your typical default
1895 (and for Windows users who typically don't set environment variables).
1895 (and for Windows users who typically don't set environment variables).
1896
1896
1897 This command allows you to conveniently edit multi-line code right in
1897 This command allows you to conveniently edit multi-line code right in
1898 your IPython session.
1898 your IPython session.
1899
1899
1900 If called without arguments, %edit opens up an empty editor with a
1900 If called without arguments, %edit opens up an empty editor with a
1901 temporary file and will execute the contents of this file when you
1901 temporary file and will execute the contents of this file when you
1902 close it (don't forget to save it!).
1902 close it (don't forget to save it!).
1903
1903
1904
1904
1905 Options:
1905 Options:
1906
1906
1907 -n <number>: open the editor at a specified line number. By default,
1907 -n <number>: open the editor at a specified line number. By default,
1908 the IPython editor hook uses the unix syntax 'editor +N filename', but
1908 the IPython editor hook uses the unix syntax 'editor +N filename', but
1909 you can configure this by providing your own modified hook if your
1909 you can configure this by providing your own modified hook if your
1910 favorite editor supports line-number specifications with a different
1910 favorite editor supports line-number specifications with a different
1911 syntax.
1911 syntax.
1912
1912
1913 -p: this will call the editor with the same data as the previous time
1913 -p: this will call the editor with the same data as the previous time
1914 it was used, regardless of how long ago (in your current session) it
1914 it was used, regardless of how long ago (in your current session) it
1915 was.
1915 was.
1916
1916
1917 -r: use 'raw' input. This option only applies to input taken from the
1917 -r: use 'raw' input. This option only applies to input taken from the
1918 user's history. By default, the 'processed' history is used, so that
1918 user's history. By default, the 'processed' history is used, so that
1919 magics are loaded in their transformed version to valid Python. If
1919 magics are loaded in their transformed version to valid Python. If
1920 this option is given, the raw input as typed as the command line is
1920 this option is given, the raw input as typed as the command line is
1921 used instead. When you exit the editor, it will be executed by
1921 used instead. When you exit the editor, it will be executed by
1922 IPython's own processor.
1922 IPython's own processor.
1923
1923
1924 -x: do not execute the edited code immediately upon exit. This is
1924 -x: do not execute the edited code immediately upon exit. This is
1925 mainly useful if you are editing programs which need to be called with
1925 mainly useful if you are editing programs which need to be called with
1926 command line arguments, which you can then do using %run.
1926 command line arguments, which you can then do using %run.
1927
1927
1928
1928
1929 Arguments:
1929 Arguments:
1930
1930
1931 If arguments are given, the following possibilites exist:
1931 If arguments are given, the following possibilites exist:
1932
1932
1933 - The arguments are numbers or pairs of colon-separated numbers (like
1933 - The arguments are numbers or pairs of colon-separated numbers (like
1934 1 4:8 9). These are interpreted as lines of previous input to be
1934 1 4:8 9). These are interpreted as lines of previous input to be
1935 loaded into the editor. The syntax is the same of the %macro command.
1935 loaded into the editor. The syntax is the same of the %macro command.
1936
1936
1937 - If the argument doesn't start with a number, it is evaluated as a
1937 - If the argument doesn't start with a number, it is evaluated as a
1938 variable and its contents loaded into the editor. You can thus edit
1938 variable and its contents loaded into the editor. You can thus edit
1939 any string which contains python code (including the result of
1939 any string which contains python code (including the result of
1940 previous edits).
1940 previous edits).
1941
1941
1942 - If the argument is the name of an object (other than a string),
1942 - If the argument is the name of an object (other than a string),
1943 IPython will try to locate the file where it was defined and open the
1943 IPython will try to locate the file where it was defined and open the
1944 editor at the point where it is defined. You can use `%edit function`
1944 editor at the point where it is defined. You can use `%edit function`
1945 to load an editor exactly at the point where 'function' is defined,
1945 to load an editor exactly at the point where 'function' is defined,
1946 edit it and have the file be executed automatically.
1946 edit it and have the file be executed automatically.
1947
1947
1948 If the object is a macro (see %macro for details), this opens up your
1948 If the object is a macro (see %macro for details), this opens up your
1949 specified editor with a temporary file containing the macro's data.
1949 specified editor with a temporary file containing the macro's data.
1950 Upon exit, the macro is reloaded with the contents of the file.
1950 Upon exit, the macro is reloaded with the contents of the file.
1951
1951
1952 Note: opening at an exact line is only supported under Unix, and some
1952 Note: opening at an exact line is only supported under Unix, and some
1953 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1953 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1954 '+NUMBER' parameter necessary for this feature. Good editors like
1954 '+NUMBER' parameter necessary for this feature. Good editors like
1955 (X)Emacs, vi, jed, pico and joe all do.
1955 (X)Emacs, vi, jed, pico and joe all do.
1956
1956
1957 - If the argument is not found as a variable, IPython will look for a
1957 - If the argument is not found as a variable, IPython will look for a
1958 file with that name (adding .py if necessary) and load it into the
1958 file with that name (adding .py if necessary) and load it into the
1959 editor. It will execute its contents with execfile() when you exit,
1959 editor. It will execute its contents with execfile() when you exit,
1960 loading any code in the file into your interactive namespace.
1960 loading any code in the file into your interactive namespace.
1961
1961
1962 After executing your code, %edit will return as output the code you
1962 After executing your code, %edit will return as output the code you
1963 typed in the editor (except when it was an existing file). This way
1963 typed in the editor (except when it was an existing file). This way
1964 you can reload the code in further invocations of %edit as a variable,
1964 you can reload the code in further invocations of %edit as a variable,
1965 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1965 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1966 the output.
1966 the output.
1967
1967
1968 Note that %edit is also available through the alias %ed.
1968 Note that %edit is also available through the alias %ed.
1969
1969
1970 This is an example of creating a simple function inside the editor and
1970 This is an example of creating a simple function inside the editor and
1971 then modifying it. First, start up the editor:
1971 then modifying it. First, start up the editor:
1972
1972
1973 In [1]: ed\\
1973 In [1]: ed\\
1974 Editing... done. Executing edited code...\\
1974 Editing... done. Executing edited code...\\
1975 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1975 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1976
1976
1977 We can then call the function foo():
1977 We can then call the function foo():
1978
1978
1979 In [2]: foo()\\
1979 In [2]: foo()\\
1980 foo() was defined in an editing session
1980 foo() was defined in an editing session
1981
1981
1982 Now we edit foo. IPython automatically loads the editor with the
1982 Now we edit foo. IPython automatically loads the editor with the
1983 (temporary) file where foo() was previously defined:
1983 (temporary) file where foo() was previously defined:
1984
1984
1985 In [3]: ed foo\\
1985 In [3]: ed foo\\
1986 Editing... done. Executing edited code...
1986 Editing... done. Executing edited code...
1987
1987
1988 And if we call foo() again we get the modified version:
1988 And if we call foo() again we get the modified version:
1989
1989
1990 In [4]: foo()\\
1990 In [4]: foo()\\
1991 foo() has now been changed!
1991 foo() has now been changed!
1992
1992
1993 Here is an example of how to edit a code snippet successive
1993 Here is an example of how to edit a code snippet successive
1994 times. First we call the editor:
1994 times. First we call the editor:
1995
1995
1996 In [8]: ed\\
1996 In [8]: ed\\
1997 Editing... done. Executing edited code...\\
1997 Editing... done. Executing edited code...\\
1998 hello\\
1998 hello\\
1999 Out[8]: "print 'hello'\\n"
1999 Out[8]: "print 'hello'\\n"
2000
2000
2001 Now we call it again with the previous output (stored in _):
2001 Now we call it again with the previous output (stored in _):
2002
2002
2003 In [9]: ed _\\
2003 In [9]: ed _\\
2004 Editing... done. Executing edited code...\\
2004 Editing... done. Executing edited code...\\
2005 hello world\\
2005 hello world\\
2006 Out[9]: "print 'hello world'\\n"
2006 Out[9]: "print 'hello world'\\n"
2007
2007
2008 Now we call it with the output #8 (stored in _8, also as Out[8]):
2008 Now we call it with the output #8 (stored in _8, also as Out[8]):
2009
2009
2010 In [10]: ed _8\\
2010 In [10]: ed _8\\
2011 Editing... done. Executing edited code...\\
2011 Editing... done. Executing edited code...\\
2012 hello again\\
2012 hello again\\
2013 Out[10]: "print 'hello again'\\n"
2013 Out[10]: "print 'hello again'\\n"
2014
2014
2015
2015
2016 Changing the default editor hook:
2016 Changing the default editor hook:
2017
2017
2018 If you wish to write your own editor hook, you can put it in a
2018 If you wish to write your own editor hook, you can put it in a
2019 configuration file which you load at startup time. The default hook
2019 configuration file which you load at startup time. The default hook
2020 is defined in the IPython.hooks module, and you can use that as a
2020 is defined in the IPython.hooks module, and you can use that as a
2021 starting example for further modifications. That file also has
2021 starting example for further modifications. That file also has
2022 general instructions on how to set a new hook for use once you've
2022 general instructions on how to set a new hook for use once you've
2023 defined it."""
2023 defined it."""
2024
2024
2025 # FIXME: This function has become a convoluted mess. It needs a
2025 # FIXME: This function has become a convoluted mess. It needs a
2026 # ground-up rewrite with clean, simple logic.
2026 # ground-up rewrite with clean, simple logic.
2027
2027
2028 def make_filename(arg):
2028 def make_filename(arg):
2029 "Make a filename from the given args"
2029 "Make a filename from the given args"
2030 try:
2030 try:
2031 filename = get_py_filename(arg)
2031 filename = get_py_filename(arg)
2032 except IOError:
2032 except IOError:
2033 if args.endswith('.py'):
2033 if args.endswith('.py'):
2034 filename = arg
2034 filename = arg
2035 else:
2035 else:
2036 filename = None
2036 filename = None
2037 return filename
2037 return filename
2038
2038
2039 # custom exceptions
2039 # custom exceptions
2040 class DataIsObject(Exception): pass
2040 class DataIsObject(Exception): pass
2041
2041
2042 opts,args = self.parse_options(parameter_s,'prxn:')
2042 opts,args = self.parse_options(parameter_s,'prxn:')
2043 # Set a few locals from the options for convenience:
2043 # Set a few locals from the options for convenience:
2044 opts_p = opts.has_key('p')
2044 opts_p = opts.has_key('p')
2045 opts_r = opts.has_key('r')
2045 opts_r = opts.has_key('r')
2046
2046
2047 # Default line number value
2047 # Default line number value
2048 lineno = opts.get('n',None)
2048 lineno = opts.get('n',None)
2049
2049
2050 if opts_p:
2050 if opts_p:
2051 args = '_%s' % last_call[0]
2051 args = '_%s' % last_call[0]
2052 if not self.shell.user_ns.has_key(args):
2052 if not self.shell.user_ns.has_key(args):
2053 args = last_call[1]
2053 args = last_call[1]
2054
2054
2055 # use last_call to remember the state of the previous call, but don't
2055 # use last_call to remember the state of the previous call, but don't
2056 # let it be clobbered by successive '-p' calls.
2056 # let it be clobbered by successive '-p' calls.
2057 try:
2057 try:
2058 last_call[0] = self.shell.outputcache.prompt_count
2058 last_call[0] = self.shell.outputcache.prompt_count
2059 if not opts_p:
2059 if not opts_p:
2060 last_call[1] = parameter_s
2060 last_call[1] = parameter_s
2061 except:
2061 except:
2062 pass
2062 pass
2063
2063
2064 # by default this is done with temp files, except when the given
2064 # by default this is done with temp files, except when the given
2065 # arg is a filename
2065 # arg is a filename
2066 use_temp = 1
2066 use_temp = 1
2067
2067
2068 if re.match(r'\d',args):
2068 if re.match(r'\d',args):
2069 # Mode where user specifies ranges of lines, like in %macro.
2069 # Mode where user specifies ranges of lines, like in %macro.
2070 # This means that you can't edit files whose names begin with
2070 # This means that you can't edit files whose names begin with
2071 # numbers this way. Tough.
2071 # numbers this way. Tough.
2072 ranges = args.split()
2072 ranges = args.split()
2073 data = ''.join(self.extract_input_slices(ranges,opts_r))
2073 data = ''.join(self.extract_input_slices(ranges,opts_r))
2074 elif args.endswith('.py'):
2074 elif args.endswith('.py'):
2075 filename = make_filename(args)
2075 filename = make_filename(args)
2076 data = ''
2076 data = ''
2077 use_temp = 0
2077 use_temp = 0
2078 elif args:
2078 elif args:
2079 try:
2079 try:
2080 # Load the parameter given as a variable. If not a string,
2080 # Load the parameter given as a variable. If not a string,
2081 # process it as an object instead (below)
2081 # process it as an object instead (below)
2082
2082
2083 #print '*** args',args,'type',type(args) # dbg
2083 #print '*** args',args,'type',type(args) # dbg
2084 data = eval(args,self.shell.user_ns)
2084 data = eval(args,self.shell.user_ns)
2085 if not type(data) in StringTypes:
2085 if not type(data) in StringTypes:
2086 raise DataIsObject
2086 raise DataIsObject
2087
2087
2088 except (NameError,SyntaxError):
2088 except (NameError,SyntaxError):
2089 # given argument is not a variable, try as a filename
2089 # given argument is not a variable, try as a filename
2090 filename = make_filename(args)
2090 filename = make_filename(args)
2091 if filename is None:
2091 if filename is None:
2092 warn("Argument given (%s) can't be found as a variable "
2092 warn("Argument given (%s) can't be found as a variable "
2093 "or as a filename." % args)
2093 "or as a filename." % args)
2094 return
2094 return
2095
2095
2096 data = ''
2096 data = ''
2097 use_temp = 0
2097 use_temp = 0
2098 except DataIsObject:
2098 except DataIsObject:
2099
2099
2100 # macros have a special edit function
2100 # macros have a special edit function
2101 if isinstance(data,Macro):
2101 if isinstance(data,Macro):
2102 self._edit_macro(args,data)
2102 self._edit_macro(args,data)
2103 return
2103 return
2104
2104
2105 # For objects, try to edit the file where they are defined
2105 # For objects, try to edit the file where they are defined
2106 try:
2106 try:
2107 filename = inspect.getabsfile(data)
2107 filename = inspect.getabsfile(data)
2108 datafile = 1
2108 datafile = 1
2109 except TypeError:
2109 except TypeError:
2110 filename = make_filename(args)
2110 filename = make_filename(args)
2111 datafile = 1
2111 datafile = 1
2112 warn('Could not find file where `%s` is defined.\n'
2112 warn('Could not find file where `%s` is defined.\n'
2113 'Opening a file named `%s`' % (args,filename))
2113 'Opening a file named `%s`' % (args,filename))
2114 # Now, make sure we can actually read the source (if it was in
2114 # Now, make sure we can actually read the source (if it was in
2115 # a temp file it's gone by now).
2115 # a temp file it's gone by now).
2116 if datafile:
2116 if datafile:
2117 try:
2117 try:
2118 if lineno is None:
2118 if lineno is None:
2119 lineno = inspect.getsourcelines(data)[1]
2119 lineno = inspect.getsourcelines(data)[1]
2120 except IOError:
2120 except IOError:
2121 filename = make_filename(args)
2121 filename = make_filename(args)
2122 if filename is None:
2122 if filename is None:
2123 warn('The file `%s` where `%s` was defined cannot '
2123 warn('The file `%s` where `%s` was defined cannot '
2124 'be read.' % (filename,data))
2124 'be read.' % (filename,data))
2125 return
2125 return
2126 use_temp = 0
2126 use_temp = 0
2127 else:
2127 else:
2128 data = ''
2128 data = ''
2129
2129
2130 if use_temp:
2130 if use_temp:
2131 filename = self.shell.mktempfile(data)
2131 filename = self.shell.mktempfile(data)
2132 print 'IPython will make a temporary file named:',filename
2132 print 'IPython will make a temporary file named:',filename
2133
2133
2134 # do actual editing here
2134 # do actual editing here
2135 print 'Editing...',
2135 print 'Editing...',
2136 sys.stdout.flush()
2136 sys.stdout.flush()
2137 self.shell.hooks.editor(filename,lineno)
2137 self.shell.hooks.editor(filename,lineno)
2138 if opts.has_key('x'): # -x prevents actual execution
2138 if opts.has_key('x'): # -x prevents actual execution
2139 print
2139 print
2140 else:
2140 else:
2141 print 'done. Executing edited code...'
2141 print 'done. Executing edited code...'
2142 if opts_r:
2142 if opts_r:
2143 self.shell.runlines(file_read(filename))
2143 self.shell.runlines(file_read(filename))
2144 else:
2144 else:
2145 self.shell.safe_execfile(filename,self.shell.user_ns)
2145 self.shell.safe_execfile(filename,self.shell.user_ns)
2146 if use_temp:
2146 if use_temp:
2147 try:
2147 try:
2148 return open(filename).read()
2148 return open(filename).read()
2149 except IOError,msg:
2149 except IOError,msg:
2150 if msg.filename == filename:
2150 if msg.filename == filename:
2151 warn('File not found. Did you forget to save?')
2151 warn('File not found. Did you forget to save?')
2152 return
2152 return
2153 else:
2153 else:
2154 self.shell.showtraceback()
2154 self.shell.showtraceback()
2155
2155
2156 def magic_xmode(self,parameter_s = ''):
2156 def magic_xmode(self,parameter_s = ''):
2157 """Switch modes for the exception handlers.
2157 """Switch modes for the exception handlers.
2158
2158
2159 Valid modes: Plain, Context and Verbose.
2159 Valid modes: Plain, Context and Verbose.
2160
2160
2161 If called without arguments, acts as a toggle."""
2161 If called without arguments, acts as a toggle."""
2162
2162
2163 def xmode_switch_err(name):
2163 def xmode_switch_err(name):
2164 warn('Error changing %s exception modes.\n%s' %
2164 warn('Error changing %s exception modes.\n%s' %
2165 (name,sys.exc_info()[1]))
2165 (name,sys.exc_info()[1]))
2166
2166
2167 shell = self.shell
2167 shell = self.shell
2168 new_mode = parameter_s.strip().capitalize()
2168 new_mode = parameter_s.strip().capitalize()
2169 try:
2169 try:
2170 shell.InteractiveTB.set_mode(mode=new_mode)
2170 shell.InteractiveTB.set_mode(mode=new_mode)
2171 print 'Exception reporting mode:',shell.InteractiveTB.mode
2171 print 'Exception reporting mode:',shell.InteractiveTB.mode
2172 except:
2172 except:
2173 xmode_switch_err('user')
2173 xmode_switch_err('user')
2174
2174
2175 # threaded shells use a special handler in sys.excepthook
2175 # threaded shells use a special handler in sys.excepthook
2176 if shell.isthreaded:
2176 if shell.isthreaded:
2177 try:
2177 try:
2178 shell.sys_excepthook.set_mode(mode=new_mode)
2178 shell.sys_excepthook.set_mode(mode=new_mode)
2179 except:
2179 except:
2180 xmode_switch_err('threaded')
2180 xmode_switch_err('threaded')
2181
2181
2182 def magic_colors(self,parameter_s = ''):
2182 def magic_colors(self,parameter_s = ''):
2183 """Switch color scheme for prompts, info system and exception handlers.
2183 """Switch color scheme for prompts, info system and exception handlers.
2184
2184
2185 Currently implemented schemes: NoColor, Linux, LightBG.
2185 Currently implemented schemes: NoColor, Linux, LightBG.
2186
2186
2187 Color scheme names are not case-sensitive."""
2187 Color scheme names are not case-sensitive."""
2188
2188
2189 def color_switch_err(name):
2189 def color_switch_err(name):
2190 warn('Error changing %s color schemes.\n%s' %
2190 warn('Error changing %s color schemes.\n%s' %
2191 (name,sys.exc_info()[1]))
2191 (name,sys.exc_info()[1]))
2192
2192
2193
2193
2194 new_scheme = parameter_s.strip()
2194 new_scheme = parameter_s.strip()
2195 if not new_scheme:
2195 if not new_scheme:
2196 print 'You must specify a color scheme.'
2196 print 'You must specify a color scheme.'
2197 return
2197 return
2198 import IPython.rlineimpl as readline
2198 import IPython.rlineimpl as readline
2199 if not readline.have_readline:
2199 if not readline.have_readline:
2200 msg = """\
2200 msg = """\
2201 Proper color support under MS Windows requires Gary Bishop's readline library.
2201 Proper color support under MS Windows requires Gary Bishop's readline library.
2202 You can find it at:
2202 You can find it at:
2203 http://sourceforge.net/projects/uncpythontools
2203 http://sourceforge.net/projects/uncpythontools
2204 Gary's readline needs the ctypes module, from:
2204 Gary's readline needs the ctypes module, from:
2205 http://starship.python.net/crew/theller/ctypes
2205 http://starship.python.net/crew/theller/ctypes
2206
2206
2207 Defaulting color scheme to 'NoColor'"""
2207 Defaulting color scheme to 'NoColor'"""
2208 new_scheme = 'NoColor'
2208 new_scheme = 'NoColor'
2209 warn(msg)
2209 warn(msg)
2210 # local shortcut
2210 # local shortcut
2211 shell = self.shell
2211 shell = self.shell
2212
2212
2213 # Set prompt colors
2213 # Set prompt colors
2214 try:
2214 try:
2215 shell.outputcache.set_colors(new_scheme)
2215 shell.outputcache.set_colors(new_scheme)
2216 except:
2216 except:
2217 color_switch_err('prompt')
2217 color_switch_err('prompt')
2218 else:
2218 else:
2219 shell.rc.colors = \
2219 shell.rc.colors = \
2220 shell.outputcache.color_table.active_scheme_name
2220 shell.outputcache.color_table.active_scheme_name
2221 # Set exception colors
2221 # Set exception colors
2222 try:
2222 try:
2223 shell.InteractiveTB.set_colors(scheme = new_scheme)
2223 shell.InteractiveTB.set_colors(scheme = new_scheme)
2224 shell.SyntaxTB.set_colors(scheme = new_scheme)
2224 shell.SyntaxTB.set_colors(scheme = new_scheme)
2225 except:
2225 except:
2226 color_switch_err('exception')
2226 color_switch_err('exception')
2227
2227
2228 # threaded shells use a verbose traceback in sys.excepthook
2228 # threaded shells use a verbose traceback in sys.excepthook
2229 if shell.isthreaded:
2229 if shell.isthreaded:
2230 try:
2230 try:
2231 shell.sys_excepthook.set_colors(scheme=new_scheme)
2231 shell.sys_excepthook.set_colors(scheme=new_scheme)
2232 except:
2232 except:
2233 color_switch_err('system exception handler')
2233 color_switch_err('system exception handler')
2234
2234
2235 # Set info (for 'object?') colors
2235 # Set info (for 'object?') colors
2236 if shell.rc.color_info:
2236 if shell.rc.color_info:
2237 try:
2237 try:
2238 shell.inspector.set_active_scheme(new_scheme)
2238 shell.inspector.set_active_scheme(new_scheme)
2239 except:
2239 except:
2240 color_switch_err('object inspector')
2240 color_switch_err('object inspector')
2241 else:
2241 else:
2242 shell.inspector.set_active_scheme('NoColor')
2242 shell.inspector.set_active_scheme('NoColor')
2243
2243
2244 def magic_color_info(self,parameter_s = ''):
2244 def magic_color_info(self,parameter_s = ''):
2245 """Toggle color_info.
2245 """Toggle color_info.
2246
2246
2247 The color_info configuration parameter controls whether colors are
2247 The color_info configuration parameter controls whether colors are
2248 used for displaying object details (by things like %psource, %pfile or
2248 used for displaying object details (by things like %psource, %pfile or
2249 the '?' system). This function toggles this value with each call.
2249 the '?' system). This function toggles this value with each call.
2250
2250
2251 Note that unless you have a fairly recent pager (less works better
2251 Note that unless you have a fairly recent pager (less works better
2252 than more) in your system, using colored object information displays
2252 than more) in your system, using colored object information displays
2253 will not work properly. Test it and see."""
2253 will not work properly. Test it and see."""
2254
2254
2255 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2255 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2256 self.magic_colors(self.shell.rc.colors)
2256 self.magic_colors(self.shell.rc.colors)
2257 print 'Object introspection functions have now coloring:',
2257 print 'Object introspection functions have now coloring:',
2258 print ['OFF','ON'][self.shell.rc.color_info]
2258 print ['OFF','ON'][self.shell.rc.color_info]
2259
2259
2260 def magic_Pprint(self, parameter_s=''):
2260 def magic_Pprint(self, parameter_s=''):
2261 """Toggle pretty printing on/off."""
2261 """Toggle pretty printing on/off."""
2262
2262
2263 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2263 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2264 print 'Pretty printing has been turned', \
2264 print 'Pretty printing has been turned', \
2265 ['OFF','ON'][self.shell.rc.pprint]
2265 ['OFF','ON'][self.shell.rc.pprint]
2266
2266
2267 def magic_exit(self, parameter_s=''):
2267 def magic_exit(self, parameter_s=''):
2268 """Exit IPython, confirming if configured to do so.
2268 """Exit IPython, confirming if configured to do so.
2269
2269
2270 You can configure whether IPython asks for confirmation upon exit by
2270 You can configure whether IPython asks for confirmation upon exit by
2271 setting the confirm_exit flag in the ipythonrc file."""
2271 setting the confirm_exit flag in the ipythonrc file."""
2272
2272
2273 self.shell.exit()
2273 self.shell.exit()
2274
2274
2275 def magic_quit(self, parameter_s=''):
2275 def magic_quit(self, parameter_s=''):
2276 """Exit IPython, confirming if configured to do so (like %exit)"""
2276 """Exit IPython, confirming if configured to do so (like %exit)"""
2277
2277
2278 self.shell.exit()
2278 self.shell.exit()
2279
2279
2280 def magic_Exit(self, parameter_s=''):
2280 def magic_Exit(self, parameter_s=''):
2281 """Exit IPython without confirmation."""
2281 """Exit IPython without confirmation."""
2282
2282
2283 self.shell.exit_now = True
2283 self.shell.exit_now = True
2284
2284
2285 def magic_Quit(self, parameter_s=''):
2285 def magic_Quit(self, parameter_s=''):
2286 """Exit IPython without confirmation (like %Exit)."""
2286 """Exit IPython without confirmation (like %Exit)."""
2287
2287
2288 self.shell.exit_now = True
2288 self.shell.exit_now = True
2289
2289
2290 #......................................................................
2290 #......................................................................
2291 # Functions to implement unix shell-type things
2291 # Functions to implement unix shell-type things
2292
2292
2293 def magic_alias(self, parameter_s = ''):
2293 def magic_alias(self, parameter_s = ''):
2294 """Define an alias for a system command.
2294 """Define an alias for a system command.
2295
2295
2296 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2296 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2297
2297
2298 Then, typing 'alias_name params' will execute the system command 'cmd
2298 Then, typing 'alias_name params' will execute the system command 'cmd
2299 params' (from your underlying operating system).
2299 params' (from your underlying operating system).
2300
2300
2301 Aliases have lower precedence than magic functions and Python normal
2301 Aliases have lower precedence than magic functions and Python normal
2302 variables, so if 'foo' is both a Python variable and an alias, the
2302 variables, so if 'foo' is both a Python variable and an alias, the
2303 alias can not be executed until 'del foo' removes the Python variable.
2303 alias can not be executed until 'del foo' removes the Python variable.
2304
2304
2305 You can use the %l specifier in an alias definition to represent the
2305 You can use the %l specifier in an alias definition to represent the
2306 whole line when the alias is called. For example:
2306 whole line when the alias is called. For example:
2307
2307
2308 In [2]: alias all echo "Input in brackets: <%l>"\\
2308 In [2]: alias all echo "Input in brackets: <%l>"\\
2309 In [3]: all hello world\\
2309 In [3]: all hello world\\
2310 Input in brackets: <hello world>
2310 Input in brackets: <hello world>
2311
2311
2312 You can also define aliases with parameters using %s specifiers (one
2312 You can also define aliases with parameters using %s specifiers (one
2313 per parameter):
2313 per parameter):
2314
2314
2315 In [1]: alias parts echo first %s second %s\\
2315 In [1]: alias parts echo first %s second %s\\
2316 In [2]: %parts A B\\
2316 In [2]: %parts A B\\
2317 first A second B\\
2317 first A second B\\
2318 In [3]: %parts A\\
2318 In [3]: %parts A\\
2319 Incorrect number of arguments: 2 expected.\\
2319 Incorrect number of arguments: 2 expected.\\
2320 parts is an alias to: 'echo first %s second %s'
2320 parts is an alias to: 'echo first %s second %s'
2321
2321
2322 Note that %l and %s are mutually exclusive. You can only use one or
2322 Note that %l and %s are mutually exclusive. You can only use one or
2323 the other in your aliases.
2323 the other in your aliases.
2324
2324
2325 Aliases expand Python variables just like system calls using ! or !!
2325 Aliases expand Python variables just like system calls using ! or !!
2326 do: all expressions prefixed with '$' get expanded. For details of
2326 do: all expressions prefixed with '$' get expanded. For details of
2327 the semantic rules, see PEP-215:
2327 the semantic rules, see PEP-215:
2328 http://www.python.org/peps/pep-0215.html. This is the library used by
2328 http://www.python.org/peps/pep-0215.html. This is the library used by
2329 IPython for variable expansion. If you want to access a true shell
2329 IPython for variable expansion. If you want to access a true shell
2330 variable, an extra $ is necessary to prevent its expansion by IPython:
2330 variable, an extra $ is necessary to prevent its expansion by IPython:
2331
2331
2332 In [6]: alias show echo\\
2332 In [6]: alias show echo\\
2333 In [7]: PATH='A Python string'\\
2333 In [7]: PATH='A Python string'\\
2334 In [8]: show $PATH\\
2334 In [8]: show $PATH\\
2335 A Python string\\
2335 A Python string\\
2336 In [9]: show $$PATH\\
2336 In [9]: show $$PATH\\
2337 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2337 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2338
2338
2339 You can use the alias facility to acess all of $PATH. See the %rehash
2339 You can use the alias facility to acess all of $PATH. See the %rehash
2340 and %rehashx functions, which automatically create aliases for the
2340 and %rehashx functions, which automatically create aliases for the
2341 contents of your $PATH.
2341 contents of your $PATH.
2342
2342
2343 If called with no parameters, %alias prints the current alias table."""
2343 If called with no parameters, %alias prints the current alias table."""
2344
2344
2345 par = parameter_s.strip()
2345 par = parameter_s.strip()
2346 if not par:
2346 if not par:
2347 if self.shell.rc.automagic:
2347 if self.shell.rc.automagic:
2348 prechar = ''
2348 prechar = ''
2349 else:
2349 else:
2350 prechar = self.shell.ESC_MAGIC
2350 prechar = self.shell.ESC_MAGIC
2351 #print 'Alias\t\tSystem Command\n'+'-'*30
2351 #print 'Alias\t\tSystem Command\n'+'-'*30
2352 atab = self.shell.alias_table
2352 atab = self.shell.alias_table
2353 aliases = atab.keys()
2353 aliases = atab.keys()
2354 aliases.sort()
2354 aliases.sort()
2355 res = []
2355 res = []
2356 for alias in aliases:
2356 for alias in aliases:
2357 res.append((alias, atab[alias][1]))
2357 res.append((alias, atab[alias][1]))
2358 print "Total number of aliases:",len(aliases)
2358 print "Total number of aliases:",len(aliases)
2359 return res
2359 return res
2360 try:
2360 try:
2361 alias,cmd = par.split(None,1)
2361 alias,cmd = par.split(None,1)
2362 except:
2362 except:
2363 print OInspect.getdoc(self.magic_alias)
2363 print OInspect.getdoc(self.magic_alias)
2364 else:
2364 else:
2365 nargs = cmd.count('%s')
2365 nargs = cmd.count('%s')
2366 if nargs>0 and cmd.find('%l')>=0:
2366 if nargs>0 and cmd.find('%l')>=0:
2367 error('The %s and %l specifiers are mutually exclusive '
2367 error('The %s and %l specifiers are mutually exclusive '
2368 'in alias definitions.')
2368 'in alias definitions.')
2369 else: # all looks OK
2369 else: # all looks OK
2370 self.shell.alias_table[alias] = (nargs,cmd)
2370 self.shell.alias_table[alias] = (nargs,cmd)
2371 self.shell.alias_table_validate(verbose=0)
2371 self.shell.alias_table_validate(verbose=0)
2372 # end magic_alias
2372 # end magic_alias
2373
2373
2374 def magic_unalias(self, parameter_s = ''):
2374 def magic_unalias(self, parameter_s = ''):
2375 """Remove an alias"""
2375 """Remove an alias"""
2376
2376
2377 aname = parameter_s.strip()
2377 aname = parameter_s.strip()
2378 if aname in self.shell.alias_table:
2378 if aname in self.shell.alias_table:
2379 del self.shell.alias_table[aname]
2379 del self.shell.alias_table[aname]
2380
2380
2381 def magic_rehash(self, parameter_s = ''):
2381 def magic_rehash(self, parameter_s = ''):
2382 """Update the alias table with all entries in $PATH.
2382 """Update the alias table with all entries in $PATH.
2383
2383
2384 This version does no checks on execute permissions or whether the
2384 This version does no checks on execute permissions or whether the
2385 contents of $PATH are truly files (instead of directories or something
2385 contents of $PATH are truly files (instead of directories or something
2386 else). For such a safer (but slower) version, use %rehashx."""
2386 else). For such a safer (but slower) version, use %rehashx."""
2387
2387
2388 # This function (and rehashx) manipulate the alias_table directly
2388 # This function (and rehashx) manipulate the alias_table directly
2389 # rather than calling magic_alias, for speed reasons. A rehash on a
2389 # rather than calling magic_alias, for speed reasons. A rehash on a
2390 # typical Linux box involves several thousand entries, so efficiency
2390 # typical Linux box involves several thousand entries, so efficiency
2391 # here is a top concern.
2391 # here is a top concern.
2392
2392
2393 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2393 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2394 alias_table = self.shell.alias_table
2394 alias_table = self.shell.alias_table
2395 for pdir in path:
2395 for pdir in path:
2396 for ff in os.listdir(pdir):
2396 for ff in os.listdir(pdir):
2397 # each entry in the alias table must be (N,name), where
2397 # each entry in the alias table must be (N,name), where
2398 # N is the number of positional arguments of the alias.
2398 # N is the number of positional arguments of the alias.
2399 alias_table[ff] = (0,ff)
2399 alias_table[ff] = (0,ff)
2400 # Make sure the alias table doesn't contain keywords or builtins
2400 # Make sure the alias table doesn't contain keywords or builtins
2401 self.shell.alias_table_validate()
2401 self.shell.alias_table_validate()
2402 # Call again init_auto_alias() so we get 'rm -i' and other modified
2402 # Call again init_auto_alias() so we get 'rm -i' and other modified
2403 # aliases since %rehash will probably clobber them
2403 # aliases since %rehash will probably clobber them
2404 self.shell.init_auto_alias()
2404 self.shell.init_auto_alias()
2405
2405
2406 def magic_rehashx(self, parameter_s = ''):
2406 def magic_rehashx(self, parameter_s = ''):
2407 """Update the alias table with all executable files in $PATH.
2407 """Update the alias table with all executable files in $PATH.
2408
2408
2409 This version explicitly checks that every entry in $PATH is a file
2409 This version explicitly checks that every entry in $PATH is a file
2410 with execute access (os.X_OK), so it is much slower than %rehash.
2410 with execute access (os.X_OK), so it is much slower than %rehash.
2411
2411
2412 Under Windows, it checks executability as a match agains a
2412 Under Windows, it checks executability as a match agains a
2413 '|'-separated string of extensions, stored in the IPython config
2413 '|'-separated string of extensions, stored in the IPython config
2414 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2414 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2415
2415
2416 path = [os.path.abspath(os.path.expanduser(p)) for p in
2416 path = [os.path.abspath(os.path.expanduser(p)) for p in
2417 os.environ['PATH'].split(os.pathsep)]
2417 os.environ['PATH'].split(os.pathsep)]
2418 path = filter(os.path.isdir,path)
2418 path = filter(os.path.isdir,path)
2419
2419
2420 alias_table = self.shell.alias_table
2420 alias_table = self.shell.alias_table
2421 syscmdlist = []
2421 syscmdlist = []
2422 if os.name == 'posix':
2422 if os.name == 'posix':
2423 isexec = lambda fname:os.path.isfile(fname) and \
2423 isexec = lambda fname:os.path.isfile(fname) and \
2424 os.access(fname,os.X_OK)
2424 os.access(fname,os.X_OK)
2425 else:
2425 else:
2426
2426
2427 try:
2427 try:
2428 winext = os.environ['pathext'].replace(';','|').replace('.','')
2428 winext = os.environ['pathext'].replace(';','|').replace('.','')
2429 except KeyError:
2429 except KeyError:
2430 winext = 'exe|com|bat'
2430 winext = 'exe|com|bat'
2431
2431
2432 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2432 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2433 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2433 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2434 savedir = os.getcwd()
2434 savedir = os.getcwd()
2435 try:
2435 try:
2436 # write the whole loop for posix/Windows so we don't have an if in
2436 # write the whole loop for posix/Windows so we don't have an if in
2437 # the innermost part
2437 # the innermost part
2438 if os.name == 'posix':
2438 if os.name == 'posix':
2439 for pdir in path:
2439 for pdir in path:
2440 os.chdir(pdir)
2440 os.chdir(pdir)
2441 for ff in os.listdir(pdir):
2441 for ff in os.listdir(pdir):
2442 if isexec(ff) and ff not in self.shell.no_alias:
2442 if isexec(ff) and ff not in self.shell.no_alias:
2443 # each entry in the alias table must be (N,name),
2443 # each entry in the alias table must be (N,name),
2444 # where N is the number of positional arguments of the
2444 # where N is the number of positional arguments of the
2445 # alias.
2445 # alias.
2446 alias_table[ff] = (0,ff)
2446 alias_table[ff] = (0,ff)
2447 syscmdlist.append(ff)
2447 syscmdlist.append(ff)
2448 else:
2448 else:
2449 for pdir in path:
2449 for pdir in path:
2450 os.chdir(pdir)
2450 os.chdir(pdir)
2451 for ff in os.listdir(pdir):
2451 for ff in os.listdir(pdir):
2452 if isexec(ff) and os.path.splitext(ff)[0] not in self.shell.no_alias:
2452 if isexec(ff) and os.path.splitext(ff)[0] not in self.shell.no_alias:
2453 alias_table[execre.sub(r'\1',ff)] = (0,ff)
2453 alias_table[execre.sub(r'\1',ff)] = (0,ff)
2454 syscmdlist.append(ff)
2454 syscmdlist.append(ff)
2455 # Make sure the alias table doesn't contain keywords or builtins
2455 # Make sure the alias table doesn't contain keywords or builtins
2456 self.shell.alias_table_validate()
2456 self.shell.alias_table_validate()
2457 # Call again init_auto_alias() so we get 'rm -i' and other
2457 # Call again init_auto_alias() so we get 'rm -i' and other
2458 # modified aliases since %rehashx will probably clobber them
2458 # modified aliases since %rehashx will probably clobber them
2459 self.shell.init_auto_alias()
2459 self.shell.init_auto_alias()
2460 db = self.getapi().db
2460 db = self.getapi().db
2461 db['syscmdlist'] = syscmdlist
2461 db['syscmdlist'] = syscmdlist
2462 finally:
2462 finally:
2463 os.chdir(savedir)
2463 os.chdir(savedir)
2464
2464
2465 def magic_pwd(self, parameter_s = ''):
2465 def magic_pwd(self, parameter_s = ''):
2466 """Return the current working directory path."""
2466 """Return the current working directory path."""
2467 return os.getcwd()
2467 return os.getcwd()
2468
2468
2469 def magic_cd(self, parameter_s=''):
2469 def magic_cd(self, parameter_s=''):
2470 """Change the current working directory.
2470 """Change the current working directory.
2471
2471
2472 This command automatically maintains an internal list of directories
2472 This command automatically maintains an internal list of directories
2473 you visit during your IPython session, in the variable _dh. The
2473 you visit during your IPython session, in the variable _dh. The
2474 command %dhist shows this history nicely formatted.
2474 command %dhist shows this history nicely formatted.
2475
2475
2476 Usage:
2476 Usage:
2477
2477
2478 cd 'dir': changes to directory 'dir'.
2478 cd 'dir': changes to directory 'dir'.
2479
2479
2480 cd -: changes to the last visited directory.
2480 cd -: changes to the last visited directory.
2481
2481
2482 cd -<n>: changes to the n-th directory in the directory history.
2482 cd -<n>: changes to the n-th directory in the directory history.
2483
2483
2484 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2484 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2485 (note: cd <bookmark_name> is enough if there is no
2485 (note: cd <bookmark_name> is enough if there is no
2486 directory <bookmark_name>, but a bookmark with the name exists.)
2486 directory <bookmark_name>, but a bookmark with the name exists.)
2487
2487
2488 Options:
2488 Options:
2489
2489
2490 -q: quiet. Do not print the working directory after the cd command is
2490 -q: quiet. Do not print the working directory after the cd command is
2491 executed. By default IPython's cd command does print this directory,
2491 executed. By default IPython's cd command does print this directory,
2492 since the default prompts do not display path information.
2492 since the default prompts do not display path information.
2493
2493
2494 Note that !cd doesn't work for this purpose because the shell where
2494 Note that !cd doesn't work for this purpose because the shell where
2495 !command runs is immediately discarded after executing 'command'."""
2495 !command runs is immediately discarded after executing 'command'."""
2496
2496
2497 parameter_s = parameter_s.strip()
2497 parameter_s = parameter_s.strip()
2498 #bkms = self.shell.persist.get("bookmarks",{})
2498 #bkms = self.shell.persist.get("bookmarks",{})
2499
2499
2500 numcd = re.match(r'(-)(\d+)$',parameter_s)
2500 numcd = re.match(r'(-)(\d+)$',parameter_s)
2501 # jump in directory history by number
2501 # jump in directory history by number
2502 if numcd:
2502 if numcd:
2503 nn = int(numcd.group(2))
2503 nn = int(numcd.group(2))
2504 try:
2504 try:
2505 ps = self.shell.user_ns['_dh'][nn]
2505 ps = self.shell.user_ns['_dh'][nn]
2506 except IndexError:
2506 except IndexError:
2507 print 'The requested directory does not exist in history.'
2507 print 'The requested directory does not exist in history.'
2508 return
2508 return
2509 else:
2509 else:
2510 opts = {}
2510 opts = {}
2511 else:
2511 else:
2512 #turn all non-space-escaping backslashes to slashes,
2512 #turn all non-space-escaping backslashes to slashes,
2513 # for c:\windows\directory\names\
2513 # for c:\windows\directory\names\
2514 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2514 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2515 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2515 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2516 # jump to previous
2516 # jump to previous
2517 if ps == '-':
2517 if ps == '-':
2518 try:
2518 try:
2519 ps = self.shell.user_ns['_dh'][-2]
2519 ps = self.shell.user_ns['_dh'][-2]
2520 except IndexError:
2520 except IndexError:
2521 print 'No previous directory to change to.'
2521 print 'No previous directory to change to.'
2522 return
2522 return
2523 # jump to bookmark if needed
2523 # jump to bookmark if needed
2524 else:
2524 else:
2525 if not os.path.isdir(ps) or opts.has_key('b'):
2525 if not os.path.isdir(ps) or opts.has_key('b'):
2526 bkms = self.db.get('bookmarks', {})
2526 bkms = self.db.get('bookmarks', {})
2527
2527
2528 if bkms.has_key(ps):
2528 if bkms.has_key(ps):
2529 target = bkms[ps]
2529 target = bkms[ps]
2530 print '(bookmark:%s) -> %s' % (ps,target)
2530 print '(bookmark:%s) -> %s' % (ps,target)
2531 ps = target
2531 ps = target
2532 else:
2532 else:
2533 if opts.has_key('b'):
2533 if opts.has_key('b'):
2534 error("Bookmark '%s' not found. "
2534 error("Bookmark '%s' not found. "
2535 "Use '%%bookmark -l' to see your bookmarks." % ps)
2535 "Use '%%bookmark -l' to see your bookmarks." % ps)
2536 return
2536 return
2537
2537
2538 # at this point ps should point to the target dir
2538 # at this point ps should point to the target dir
2539 if ps:
2539 if ps:
2540 try:
2540 try:
2541 os.chdir(os.path.expanduser(ps))
2541 os.chdir(os.path.expanduser(ps))
2542 ttitle = ("IPy:" + (
2542 ttitle = ("IPy:" + (
2543 os.getcwd() == '/' and '/' or os.path.basename(os.getcwd())))
2543 os.getcwd() == '/' and '/' or os.path.basename(os.getcwd())))
2544 platutils.set_term_title(ttitle)
2544 platutils.set_term_title(ttitle)
2545 except OSError:
2545 except OSError:
2546 print sys.exc_info()[1]
2546 print sys.exc_info()[1]
2547 else:
2547 else:
2548 self.shell.user_ns['_dh'].append(os.getcwd())
2548 self.shell.user_ns['_dh'].append(os.getcwd())
2549 else:
2549 else:
2550 os.chdir(self.shell.home_dir)
2550 os.chdir(self.shell.home_dir)
2551 platutils.set_term_title("IPy:~")
2551 platutils.set_term_title("IPy:~")
2552 self.shell.user_ns['_dh'].append(os.getcwd())
2552 self.shell.user_ns['_dh'].append(os.getcwd())
2553 if not 'q' in opts:
2553 if not 'q' in opts:
2554 print self.shell.user_ns['_dh'][-1]
2554 print self.shell.user_ns['_dh'][-1]
2555
2555
2556 def magic_dhist(self, parameter_s=''):
2556 def magic_dhist(self, parameter_s=''):
2557 """Print your history of visited directories.
2557 """Print your history of visited directories.
2558
2558
2559 %dhist -> print full history\\
2559 %dhist -> print full history\\
2560 %dhist n -> print last n entries only\\
2560 %dhist n -> print last n entries only\\
2561 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2561 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2562
2562
2563 This history is automatically maintained by the %cd command, and
2563 This history is automatically maintained by the %cd command, and
2564 always available as the global list variable _dh. You can use %cd -<n>
2564 always available as the global list variable _dh. You can use %cd -<n>
2565 to go to directory number <n>."""
2565 to go to directory number <n>."""
2566
2566
2567 dh = self.shell.user_ns['_dh']
2567 dh = self.shell.user_ns['_dh']
2568 if parameter_s:
2568 if parameter_s:
2569 try:
2569 try:
2570 args = map(int,parameter_s.split())
2570 args = map(int,parameter_s.split())
2571 except:
2571 except:
2572 self.arg_err(Magic.magic_dhist)
2572 self.arg_err(Magic.magic_dhist)
2573 return
2573 return
2574 if len(args) == 1:
2574 if len(args) == 1:
2575 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2575 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2576 elif len(args) == 2:
2576 elif len(args) == 2:
2577 ini,fin = args
2577 ini,fin = args
2578 else:
2578 else:
2579 self.arg_err(Magic.magic_dhist)
2579 self.arg_err(Magic.magic_dhist)
2580 return
2580 return
2581 else:
2581 else:
2582 ini,fin = 0,len(dh)
2582 ini,fin = 0,len(dh)
2583 nlprint(dh,
2583 nlprint(dh,
2584 header = 'Directory history (kept in _dh)',
2584 header = 'Directory history (kept in _dh)',
2585 start=ini,stop=fin)
2585 start=ini,stop=fin)
2586
2586
2587 def magic_env(self, parameter_s=''):
2587 def magic_env(self, parameter_s=''):
2588 """List environment variables."""
2588 """List environment variables."""
2589
2589
2590 return os.environ.data
2590 return os.environ.data
2591
2591
2592 def magic_pushd(self, parameter_s=''):
2592 def magic_pushd(self, parameter_s=''):
2593 """Place the current dir on stack and change directory.
2593 """Place the current dir on stack and change directory.
2594
2594
2595 Usage:\\
2595 Usage:\\
2596 %pushd ['dirname']
2596 %pushd ['dirname']
2597
2597
2598 %pushd with no arguments does a %pushd to your home directory.
2598 %pushd with no arguments does a %pushd to your home directory.
2599 """
2599 """
2600 if parameter_s == '': parameter_s = '~'
2600 if parameter_s == '': parameter_s = '~'
2601 dir_s = self.shell.dir_stack
2601 dir_s = self.shell.dir_stack
2602 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2602 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2603 os.path.expanduser(self.shell.dir_stack[0]):
2603 os.path.expanduser(self.shell.dir_stack[0]):
2604 try:
2604 try:
2605 self.magic_cd(parameter_s)
2605 self.magic_cd(parameter_s)
2606 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2606 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2607 self.magic_dirs()
2607 self.magic_dirs()
2608 except:
2608 except:
2609 print 'Invalid directory'
2609 print 'Invalid directory'
2610 else:
2610 else:
2611 print 'You are already there!'
2611 print 'You are already there!'
2612
2612
2613 def magic_popd(self, parameter_s=''):
2613 def magic_popd(self, parameter_s=''):
2614 """Change to directory popped off the top of the stack.
2614 """Change to directory popped off the top of the stack.
2615 """
2615 """
2616 if len (self.shell.dir_stack) > 1:
2616 if len (self.shell.dir_stack) > 1:
2617 self.shell.dir_stack.pop(0)
2617 self.shell.dir_stack.pop(0)
2618 self.magic_cd(self.shell.dir_stack[0])
2618 self.magic_cd(self.shell.dir_stack[0])
2619 print self.shell.dir_stack[0]
2619 print self.shell.dir_stack[0]
2620 else:
2620 else:
2621 print "You can't remove the starting directory from the stack:",\
2621 print "You can't remove the starting directory from the stack:",\
2622 self.shell.dir_stack
2622 self.shell.dir_stack
2623
2623
2624 def magic_dirs(self, parameter_s=''):
2624 def magic_dirs(self, parameter_s=''):
2625 """Return the current directory stack."""
2625 """Return the current directory stack."""
2626
2626
2627 return self.shell.dir_stack[:]
2627 return self.shell.dir_stack[:]
2628
2628
2629 def magic_sc(self, parameter_s=''):
2629 def magic_sc(self, parameter_s=''):
2630 """Shell capture - execute a shell command and capture its output.
2630 """Shell capture - execute a shell command and capture its output.
2631
2631
2632 DEPRECATED. Suboptimal, retained for backwards compatibility.
2632 DEPRECATED. Suboptimal, retained for backwards compatibility.
2633
2633
2634 You should use the form 'var = !command' instead. Example:
2634 You should use the form 'var = !command' instead. Example:
2635
2635
2636 "%sc -l myfiles = ls ~" should now be written as
2636 "%sc -l myfiles = ls ~" should now be written as
2637
2637
2638 "myfiles = !ls ~"
2638 "myfiles = !ls ~"
2639
2639
2640 myfiles.s, myfiles.l and myfiles.n still apply as documented
2640 myfiles.s, myfiles.l and myfiles.n still apply as documented
2641 below.
2641 below.
2642
2642
2643 --
2643 --
2644 %sc [options] varname=command
2644 %sc [options] varname=command
2645
2645
2646 IPython will run the given command using commands.getoutput(), and
2646 IPython will run the given command using commands.getoutput(), and
2647 will then update the user's interactive namespace with a variable
2647 will then update the user's interactive namespace with a variable
2648 called varname, containing the value of the call. Your command can
2648 called varname, containing the value of the call. Your command can
2649 contain shell wildcards, pipes, etc.
2649 contain shell wildcards, pipes, etc.
2650
2650
2651 The '=' sign in the syntax is mandatory, and the variable name you
2651 The '=' sign in the syntax is mandatory, and the variable name you
2652 supply must follow Python's standard conventions for valid names.
2652 supply must follow Python's standard conventions for valid names.
2653
2653
2654 (A special format without variable name exists for internal use)
2654 (A special format without variable name exists for internal use)
2655
2655
2656 Options:
2656 Options:
2657
2657
2658 -l: list output. Split the output on newlines into a list before
2658 -l: list output. Split the output on newlines into a list before
2659 assigning it to the given variable. By default the output is stored
2659 assigning it to the given variable. By default the output is stored
2660 as a single string.
2660 as a single string.
2661
2661
2662 -v: verbose. Print the contents of the variable.
2662 -v: verbose. Print the contents of the variable.
2663
2663
2664 In most cases you should not need to split as a list, because the
2664 In most cases you should not need to split as a list, because the
2665 returned value is a special type of string which can automatically
2665 returned value is a special type of string which can automatically
2666 provide its contents either as a list (split on newlines) or as a
2666 provide its contents either as a list (split on newlines) or as a
2667 space-separated string. These are convenient, respectively, either
2667 space-separated string. These are convenient, respectively, either
2668 for sequential processing or to be passed to a shell command.
2668 for sequential processing or to be passed to a shell command.
2669
2669
2670 For example:
2670 For example:
2671
2671
2672 # Capture into variable a
2672 # Capture into variable a
2673 In [9]: sc a=ls *py
2673 In [9]: sc a=ls *py
2674
2674
2675 # a is a string with embedded newlines
2675 # a is a string with embedded newlines
2676 In [10]: a
2676 In [10]: a
2677 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2677 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2678
2678
2679 # which can be seen as a list:
2679 # which can be seen as a list:
2680 In [11]: a.l
2680 In [11]: a.l
2681 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2681 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2682
2682
2683 # or as a whitespace-separated string:
2683 # or as a whitespace-separated string:
2684 In [12]: a.s
2684 In [12]: a.s
2685 Out[12]: 'setup.py win32_manual_post_install.py'
2685 Out[12]: 'setup.py win32_manual_post_install.py'
2686
2686
2687 # a.s is useful to pass as a single command line:
2687 # a.s is useful to pass as a single command line:
2688 In [13]: !wc -l $a.s
2688 In [13]: !wc -l $a.s
2689 146 setup.py
2689 146 setup.py
2690 130 win32_manual_post_install.py
2690 130 win32_manual_post_install.py
2691 276 total
2691 276 total
2692
2692
2693 # while the list form is useful to loop over:
2693 # while the list form is useful to loop over:
2694 In [14]: for f in a.l:
2694 In [14]: for f in a.l:
2695 ....: !wc -l $f
2695 ....: !wc -l $f
2696 ....:
2696 ....:
2697 146 setup.py
2697 146 setup.py
2698 130 win32_manual_post_install.py
2698 130 win32_manual_post_install.py
2699
2699
2700 Similiarly, the lists returned by the -l option are also special, in
2700 Similiarly, the lists returned by the -l option are also special, in
2701 the sense that you can equally invoke the .s attribute on them to
2701 the sense that you can equally invoke the .s attribute on them to
2702 automatically get a whitespace-separated string from their contents:
2702 automatically get a whitespace-separated string from their contents:
2703
2703
2704 In [1]: sc -l b=ls *py
2704 In [1]: sc -l b=ls *py
2705
2705
2706 In [2]: b
2706 In [2]: b
2707 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2707 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2708
2708
2709 In [3]: b.s
2709 In [3]: b.s
2710 Out[3]: 'setup.py win32_manual_post_install.py'
2710 Out[3]: 'setup.py win32_manual_post_install.py'
2711
2711
2712 In summary, both the lists and strings used for ouptut capture have
2712 In summary, both the lists and strings used for ouptut capture have
2713 the following special attributes:
2713 the following special attributes:
2714
2714
2715 .l (or .list) : value as list.
2715 .l (or .list) : value as list.
2716 .n (or .nlstr): value as newline-separated string.
2716 .n (or .nlstr): value as newline-separated string.
2717 .s (or .spstr): value as space-separated string.
2717 .s (or .spstr): value as space-separated string.
2718 """
2718 """
2719
2719
2720 opts,args = self.parse_options(parameter_s,'lv')
2720 opts,args = self.parse_options(parameter_s,'lv')
2721 # Try to get a variable name and command to run
2721 # Try to get a variable name and command to run
2722 try:
2722 try:
2723 # the variable name must be obtained from the parse_options
2723 # the variable name must be obtained from the parse_options
2724 # output, which uses shlex.split to strip options out.
2724 # output, which uses shlex.split to strip options out.
2725 var,_ = args.split('=',1)
2725 var,_ = args.split('=',1)
2726 var = var.strip()
2726 var = var.strip()
2727 # But the the command has to be extracted from the original input
2727 # But the the command has to be extracted from the original input
2728 # parameter_s, not on what parse_options returns, to avoid the
2728 # parameter_s, not on what parse_options returns, to avoid the
2729 # quote stripping which shlex.split performs on it.
2729 # quote stripping which shlex.split performs on it.
2730 _,cmd = parameter_s.split('=',1)
2730 _,cmd = parameter_s.split('=',1)
2731 except ValueError:
2731 except ValueError:
2732 var,cmd = '',''
2732 var,cmd = '',''
2733 # If all looks ok, proceed
2733 # If all looks ok, proceed
2734 out,err = self.shell.getoutputerror(cmd)
2734 out,err = self.shell.getoutputerror(cmd)
2735 if err:
2735 if err:
2736 print >> Term.cerr,err
2736 print >> Term.cerr,err
2737 if opts.has_key('l'):
2737 if opts.has_key('l'):
2738 out = SList(out.split('\n'))
2738 out = SList(out.split('\n'))
2739 else:
2739 else:
2740 out = LSString(out)
2740 out = LSString(out)
2741 if opts.has_key('v'):
2741 if opts.has_key('v'):
2742 print '%s ==\n%s' % (var,pformat(out))
2742 print '%s ==\n%s' % (var,pformat(out))
2743 if var:
2743 if var:
2744 self.shell.user_ns.update({var:out})
2744 self.shell.user_ns.update({var:out})
2745 else:
2745 else:
2746 return out
2746 return out
2747
2747
2748 def magic_sx(self, parameter_s=''):
2748 def magic_sx(self, parameter_s=''):
2749 """Shell execute - run a shell command and capture its output.
2749 """Shell execute - run a shell command and capture its output.
2750
2750
2751 %sx command
2751 %sx command
2752
2752
2753 IPython will run the given command using commands.getoutput(), and
2753 IPython will run the given command using commands.getoutput(), and
2754 return the result formatted as a list (split on '\\n'). Since the
2754 return the result formatted as a list (split on '\\n'). Since the
2755 output is _returned_, it will be stored in ipython's regular output
2755 output is _returned_, it will be stored in ipython's regular output
2756 cache Out[N] and in the '_N' automatic variables.
2756 cache Out[N] and in the '_N' automatic variables.
2757
2757
2758 Notes:
2758 Notes:
2759
2759
2760 1) If an input line begins with '!!', then %sx is automatically
2760 1) If an input line begins with '!!', then %sx is automatically
2761 invoked. That is, while:
2761 invoked. That is, while:
2762 !ls
2762 !ls
2763 causes ipython to simply issue system('ls'), typing
2763 causes ipython to simply issue system('ls'), typing
2764 !!ls
2764 !!ls
2765 is a shorthand equivalent to:
2765 is a shorthand equivalent to:
2766 %sx ls
2766 %sx ls
2767
2767
2768 2) %sx differs from %sc in that %sx automatically splits into a list,
2768 2) %sx differs from %sc in that %sx automatically splits into a list,
2769 like '%sc -l'. The reason for this is to make it as easy as possible
2769 like '%sc -l'. The reason for this is to make it as easy as possible
2770 to process line-oriented shell output via further python commands.
2770 to process line-oriented shell output via further python commands.
2771 %sc is meant to provide much finer control, but requires more
2771 %sc is meant to provide much finer control, but requires more
2772 typing.
2772 typing.
2773
2773
2774 3) Just like %sc -l, this is a list with special attributes:
2774 3) Just like %sc -l, this is a list with special attributes:
2775
2775
2776 .l (or .list) : value as list.
2776 .l (or .list) : value as list.
2777 .n (or .nlstr): value as newline-separated string.
2777 .n (or .nlstr): value as newline-separated string.
2778 .s (or .spstr): value as whitespace-separated string.
2778 .s (or .spstr): value as whitespace-separated string.
2779
2779
2780 This is very useful when trying to use such lists as arguments to
2780 This is very useful when trying to use such lists as arguments to
2781 system commands."""
2781 system commands."""
2782
2782
2783 if parameter_s:
2783 if parameter_s:
2784 out,err = self.shell.getoutputerror(parameter_s)
2784 out,err = self.shell.getoutputerror(parameter_s)
2785 if err:
2785 if err:
2786 print >> Term.cerr,err
2786 print >> Term.cerr,err
2787 return SList(out.split('\n'))
2787 return SList(out.split('\n'))
2788
2788
2789 def magic_bg(self, parameter_s=''):
2789 def magic_bg(self, parameter_s=''):
2790 """Run a job in the background, in a separate thread.
2790 """Run a job in the background, in a separate thread.
2791
2791
2792 For example,
2792 For example,
2793
2793
2794 %bg myfunc(x,y,z=1)
2794 %bg myfunc(x,y,z=1)
2795
2795
2796 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2796 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2797 execution starts, a message will be printed indicating the job
2797 execution starts, a message will be printed indicating the job
2798 number. If your job number is 5, you can use
2798 number. If your job number is 5, you can use
2799
2799
2800 myvar = jobs.result(5) or myvar = jobs[5].result
2800 myvar = jobs.result(5) or myvar = jobs[5].result
2801
2801
2802 to assign this result to variable 'myvar'.
2802 to assign this result to variable 'myvar'.
2803
2803
2804 IPython has a job manager, accessible via the 'jobs' object. You can
2804 IPython has a job manager, accessible via the 'jobs' object. You can
2805 type jobs? to get more information about it, and use jobs.<TAB> to see
2805 type jobs? to get more information about it, and use jobs.<TAB> to see
2806 its attributes. All attributes not starting with an underscore are
2806 its attributes. All attributes not starting with an underscore are
2807 meant for public use.
2807 meant for public use.
2808
2808
2809 In particular, look at the jobs.new() method, which is used to create
2809 In particular, look at the jobs.new() method, which is used to create
2810 new jobs. This magic %bg function is just a convenience wrapper
2810 new jobs. This magic %bg function is just a convenience wrapper
2811 around jobs.new(), for expression-based jobs. If you want to create a
2811 around jobs.new(), for expression-based jobs. If you want to create a
2812 new job with an explicit function object and arguments, you must call
2812 new job with an explicit function object and arguments, you must call
2813 jobs.new() directly.
2813 jobs.new() directly.
2814
2814
2815 The jobs.new docstring also describes in detail several important
2815 The jobs.new docstring also describes in detail several important
2816 caveats associated with a thread-based model for background job
2816 caveats associated with a thread-based model for background job
2817 execution. Type jobs.new? for details.
2817 execution. Type jobs.new? for details.
2818
2818
2819 You can check the status of all jobs with jobs.status().
2819 You can check the status of all jobs with jobs.status().
2820
2820
2821 The jobs variable is set by IPython into the Python builtin namespace.
2821 The jobs variable is set by IPython into the Python builtin namespace.
2822 If you ever declare a variable named 'jobs', you will shadow this
2822 If you ever declare a variable named 'jobs', you will shadow this
2823 name. You can either delete your global jobs variable to regain
2823 name. You can either delete your global jobs variable to regain
2824 access to the job manager, or make a new name and assign it manually
2824 access to the job manager, or make a new name and assign it manually
2825 to the manager (stored in IPython's namespace). For example, to
2825 to the manager (stored in IPython's namespace). For example, to
2826 assign the job manager to the Jobs name, use:
2826 assign the job manager to the Jobs name, use:
2827
2827
2828 Jobs = __builtins__.jobs"""
2828 Jobs = __builtins__.jobs"""
2829
2829
2830 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2830 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2831
2831
2832
2832
2833 def magic_bookmark(self, parameter_s=''):
2833 def magic_bookmark(self, parameter_s=''):
2834 """Manage IPython's bookmark system.
2834 """Manage IPython's bookmark system.
2835
2835
2836 %bookmark <name> - set bookmark to current dir
2836 %bookmark <name> - set bookmark to current dir
2837 %bookmark <name> <dir> - set bookmark to <dir>
2837 %bookmark <name> <dir> - set bookmark to <dir>
2838 %bookmark -l - list all bookmarks
2838 %bookmark -l - list all bookmarks
2839 %bookmark -d <name> - remove bookmark
2839 %bookmark -d <name> - remove bookmark
2840 %bookmark -r - remove all bookmarks
2840 %bookmark -r - remove all bookmarks
2841
2841
2842 You can later on access a bookmarked folder with:
2842 You can later on access a bookmarked folder with:
2843 %cd -b <name>
2843 %cd -b <name>
2844 or simply '%cd <name>' if there is no directory called <name> AND
2844 or simply '%cd <name>' if there is no directory called <name> AND
2845 there is such a bookmark defined.
2845 there is such a bookmark defined.
2846
2846
2847 Your bookmarks persist through IPython sessions, but they are
2847 Your bookmarks persist through IPython sessions, but they are
2848 associated with each profile."""
2848 associated with each profile."""
2849
2849
2850 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2850 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2851 if len(args) > 2:
2851 if len(args) > 2:
2852 error('You can only give at most two arguments')
2852 error('You can only give at most two arguments')
2853 return
2853 return
2854
2854
2855 bkms = self.db.get('bookmarks',{})
2855 bkms = self.db.get('bookmarks',{})
2856
2856
2857 if opts.has_key('d'):
2857 if opts.has_key('d'):
2858 try:
2858 try:
2859 todel = args[0]
2859 todel = args[0]
2860 except IndexError:
2860 except IndexError:
2861 error('You must provide a bookmark to delete')
2861 error('You must provide a bookmark to delete')
2862 else:
2862 else:
2863 try:
2863 try:
2864 del bkms[todel]
2864 del bkms[todel]
2865 except:
2865 except:
2866 error("Can't delete bookmark '%s'" % todel)
2866 error("Can't delete bookmark '%s'" % todel)
2867 elif opts.has_key('r'):
2867 elif opts.has_key('r'):
2868 bkms = {}
2868 bkms = {}
2869 elif opts.has_key('l'):
2869 elif opts.has_key('l'):
2870 bks = bkms.keys()
2870 bks = bkms.keys()
2871 bks.sort()
2871 bks.sort()
2872 if bks:
2872 if bks:
2873 size = max(map(len,bks))
2873 size = max(map(len,bks))
2874 else:
2874 else:
2875 size = 0
2875 size = 0
2876 fmt = '%-'+str(size)+'s -> %s'
2876 fmt = '%-'+str(size)+'s -> %s'
2877 print 'Current bookmarks:'
2877 print 'Current bookmarks:'
2878 for bk in bks:
2878 for bk in bks:
2879 print fmt % (bk,bkms[bk])
2879 print fmt % (bk,bkms[bk])
2880 else:
2880 else:
2881 if not args:
2881 if not args:
2882 error("You must specify the bookmark name")
2882 error("You must specify the bookmark name")
2883 elif len(args)==1:
2883 elif len(args)==1:
2884 bkms[args[0]] = os.getcwd()
2884 bkms[args[0]] = os.getcwd()
2885 elif len(args)==2:
2885 elif len(args)==2:
2886 bkms[args[0]] = args[1]
2886 bkms[args[0]] = args[1]
2887 self.db['bookmarks'] = bkms
2887 self.db['bookmarks'] = bkms
2888
2888
2889 def magic_pycat(self, parameter_s=''):
2889 def magic_pycat(self, parameter_s=''):
2890 """Show a syntax-highlighted file through a pager.
2890 """Show a syntax-highlighted file through a pager.
2891
2891
2892 This magic is similar to the cat utility, but it will assume the file
2892 This magic is similar to the cat utility, but it will assume the file
2893 to be Python source and will show it with syntax highlighting. """
2893 to be Python source and will show it with syntax highlighting. """
2894
2894
2895 try:
2895 try:
2896 filename = get_py_filename(parameter_s)
2896 filename = get_py_filename(parameter_s)
2897 cont = file_read(filename)
2897 cont = file_read(filename)
2898 except IOError:
2898 except IOError:
2899 try:
2899 try:
2900 cont = eval(parameter_s,self.user_ns)
2900 cont = eval(parameter_s,self.user_ns)
2901 except NameError:
2901 except NameError:
2902 cont = None
2902 cont = None
2903 if cont is None:
2903 if cont is None:
2904 print "Error: no such file or variable"
2904 print "Error: no such file or variable"
2905 return
2905 return
2906
2906
2907 page(self.shell.pycolorize(cont),
2907 page(self.shell.pycolorize(cont),
2908 screen_lines=self.shell.rc.screen_length)
2908 screen_lines=self.shell.rc.screen_length)
2909
2909
2910 def magic_cpaste(self, parameter_s=''):
2910 def magic_cpaste(self, parameter_s=''):
2911 """Allows you to paste & execute a pre-formatted code block from clipboard
2911 """Allows you to paste & execute a pre-formatted code block from clipboard
2912
2912
2913 You must terminate the block with '--' (two minus-signs) alone on the
2913 You must terminate the block with '--' (two minus-signs) alone on the
2914 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2914 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2915 is the new sentinel for this operation)
2915 is the new sentinel for this operation)
2916
2916
2917 The block is dedented prior to execution to enable execution of
2917 The block is dedented prior to execution to enable execution of
2918 method definitions. The executed block is also assigned to variable
2918 method definitions. '>' characters at the beginning of a line is
2919 named 'pasted_block' for later editing with '%edit pasted_block'.
2919 ignored, to allow pasting directly from e-mails. The executed block
2920 is also assigned to variable named 'pasted_block' for later editing
2921 with '%edit pasted_block'.
2920
2922
2921 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
2923 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
2922 This assigns the pasted block to variable 'foo' as string, without
2924 This assigns the pasted block to variable 'foo' as string, without
2923 dedenting or executing it.
2925 dedenting or executing it.
2924
2926
2925 Do not be alarmed by garbled output on Windows (it's a readline bug).
2927 Do not be alarmed by garbled output on Windows (it's a readline bug).
2926 Just press enter and type -- (and press enter again) and the block
2928 Just press enter and type -- (and press enter again) and the block
2927 will be what was just pasted.
2929 will be what was just pasted.
2928
2930
2929 IPython statements (magics, shell escapes) are not supported (yet).
2931 IPython statements (magics, shell escapes) are not supported (yet).
2930 """
2932 """
2931 opts,args = self.parse_options(parameter_s,'s:',mode='string')
2933 opts,args = self.parse_options(parameter_s,'s:',mode='string')
2932 par = args.strip()
2934 par = args.strip()
2933 sentinel = opts.get('s','--')
2935 sentinel = opts.get('s','--')
2934
2936
2935 from IPython import iplib
2937 from IPython import iplib
2936 lines = []
2938 lines = []
2937 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
2939 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
2938 while 1:
2940 while 1:
2939 l = iplib.raw_input_original(':')
2941 l = iplib.raw_input_original(':')
2940 if l ==sentinel:
2942 if l ==sentinel:
2941 break
2943 break
2942 lines.append(l)
2944 lines.append(l.lstrip('>'))
2943 block = "\n".join(lines) + '\n'
2945 block = "\n".join(lines) + '\n'
2944 #print "block:\n",block
2946 #print "block:\n",block
2945 if not par:
2947 if not par:
2946 b = textwrap.dedent(block)
2948 b = textwrap.dedent(block)
2947 exec b in self.user_ns
2949 exec b in self.user_ns
2948 self.user_ns['pasted_block'] = b
2950 self.user_ns['pasted_block'] = b
2949 else:
2951 else:
2950 self.user_ns[par] = block
2952 self.user_ns[par] = block
2951 print "Block assigned to '%s'" % par
2953 print "Block assigned to '%s'" % par
2952
2954
2953 def magic_quickref(self,arg):
2955 def magic_quickref(self,arg):
2954 """ Show a quick reference sheet """
2956 """ Show a quick reference sheet """
2955 import IPython.usage
2957 import IPython.usage
2956 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
2958 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
2957
2959
2958 page(qr)
2960 page(qr)
2959
2961
2960 def magic_upgrade(self,arg):
2962 def magic_upgrade(self,arg):
2961 """ Upgrade your IPython installation
2963 """ Upgrade your IPython installation
2962
2964
2963 This will copy the config files that don't yet exist in your
2965 This will copy the config files that don't yet exist in your
2964 ipython dir from the system config dir. Use this after upgrading
2966 ipython dir from the system config dir. Use this after upgrading
2965 IPython if you don't wish to delete your .ipython dir.
2967 IPython if you don't wish to delete your .ipython dir.
2966
2968
2967 Call with -nolegacy to get rid of ipythonrc* files (recommended for
2969 Call with -nolegacy to get rid of ipythonrc* files (recommended for
2968 new users)
2970 new users)
2969
2971
2970 """
2972 """
2971 ip = self.getapi()
2973 ip = self.getapi()
2972 ipinstallation = path(IPython.__file__).dirname()
2974 ipinstallation = path(IPython.__file__).dirname()
2973 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
2975 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
2974 src_config = ipinstallation / 'UserConfig'
2976 src_config = ipinstallation / 'UserConfig'
2975 userdir = path(ip.options.ipythondir)
2977 userdir = path(ip.options.ipythondir)
2976 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
2978 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
2977 print ">",cmd
2979 print ">",cmd
2978 shell(cmd)
2980 shell(cmd)
2979 if arg == '-nolegacy':
2981 if arg == '-nolegacy':
2980 legacy = userdir.files('ipythonrc*')
2982 legacy = userdir.files('ipythonrc*')
2981 print "Nuking legacy files:",legacy
2983 print "Nuking legacy files:",legacy
2982
2984
2983 [p.remove() for p in legacy]
2985 [p.remove() for p in legacy]
2984 suffix = (sys.platform == 'win32' and '.ini' or '')
2986 suffix = (sys.platform == 'win32' and '.ini' or '')
2985 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
2987 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
2986
2988
2987
2989
2988 # end Magic
2990 # end Magic
@@ -1,5636 +1,5642 b''
1 2006-07-08 Ville Vainio <vivainio@gmail.com>
2
3 * Magic.py: %cpaste now strips > from the beginning of lines
4 to ease pasting quoted code from emails. Contributed by
5 Stefan van der Walt.
6
1 2006-06-29 Ville Vainio <vivainio@gmail.com>
7 2006-06-29 Ville Vainio <vivainio@gmail.com>
2
8
3 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
9 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
4 mode, patch contributed by Darren Dale. NEEDS TESTING!
10 mode, patch contributed by Darren Dale. NEEDS TESTING!
5
11
6 2006-06-28 Walter Doerwald <walter@livinglogic.de>
12 2006-06-28 Walter Doerwald <walter@livinglogic.de>
7
13
8 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
14 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
9 a blue background. Fix fetching new display rows when the browser
15 a blue background. Fix fetching new display rows when the browser
10 scrolls more than a screenful (e.g. by using the goto command).
16 scrolls more than a screenful (e.g. by using the goto command).
11
17
12 2006-06-27 Ville Vainio <vivainio@gmail.com>
18 2006-06-27 Ville Vainio <vivainio@gmail.com>
13
19
14 * Magic.py (_inspect, _ofind) Apply David Huard's
20 * Magic.py (_inspect, _ofind) Apply David Huard's
15 patch for displaying the correct docstring for 'property'
21 patch for displaying the correct docstring for 'property'
16 attributes.
22 attributes.
17
23
18 2006-06-23 Walter Doerwald <walter@livinglogic.de>
24 2006-06-23 Walter Doerwald <walter@livinglogic.de>
19
25
20 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
26 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
21 commands into the methods implementing them.
27 commands into the methods implementing them.
22
28
23 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
29 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
24
30
25 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
31 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
26 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
32 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
27 autoindent support was authored by Jin Liu.
33 autoindent support was authored by Jin Liu.
28
34
29 2006-06-22 Walter Doerwald <walter@livinglogic.de>
35 2006-06-22 Walter Doerwald <walter@livinglogic.de>
30
36
31 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
37 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
32 for keymaps with a custom class that simplifies handling.
38 for keymaps with a custom class that simplifies handling.
33
39
34 2006-06-19 Walter Doerwald <walter@livinglogic.de>
40 2006-06-19 Walter Doerwald <walter@livinglogic.de>
35
41
36 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
42 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
37 resizing. This requires Python 2.5 to work.
43 resizing. This requires Python 2.5 to work.
38
44
39 2006-06-16 Walter Doerwald <walter@livinglogic.de>
45 2006-06-16 Walter Doerwald <walter@livinglogic.de>
40
46
41 * IPython/Extensions/ibrowse.py: Add two new commands to
47 * IPython/Extensions/ibrowse.py: Add two new commands to
42 ibrowse: "hideattr" (mapped to "h") hides the attribute under
48 ibrowse: "hideattr" (mapped to "h") hides the attribute under
43 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
49 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
44 attributes again. Remapped the help command to "?". Display
50 attributes again. Remapped the help command to "?". Display
45 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
51 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
46 as keys for the "home" and "end" commands. Add three new commands
52 as keys for the "home" and "end" commands. Add three new commands
47 to the input mode for "find" and friends: "delend" (CTRL-K)
53 to the input mode for "find" and friends: "delend" (CTRL-K)
48 deletes to the end of line. "incsearchup" searches upwards in the
54 deletes to the end of line. "incsearchup" searches upwards in the
49 command history for an input that starts with the text before the cursor.
55 command history for an input that starts with the text before the cursor.
50 "incsearchdown" does the same downwards. Removed a bogus mapping of
56 "incsearchdown" does the same downwards. Removed a bogus mapping of
51 the x key to "delete".
57 the x key to "delete".
52
58
53 2006-06-15 Ville Vainio <vivainio@gmail.com>
59 2006-06-15 Ville Vainio <vivainio@gmail.com>
54
60
55 * iplib.py, hooks.py: Added new generate_prompt hook that can be
61 * iplib.py, hooks.py: Added new generate_prompt hook that can be
56 used to create prompts dynamically, instead of the "old" way of
62 used to create prompts dynamically, instead of the "old" way of
57 assigning "magic" strings to prompt_in1 and prompt_in2. The old
63 assigning "magic" strings to prompt_in1 and prompt_in2. The old
58 way still works (it's invoked by the default hook), of course.
64 way still works (it's invoked by the default hook), of course.
59
65
60 * Prompts.py: added generate_output_prompt hook for altering output
66 * Prompts.py: added generate_output_prompt hook for altering output
61 prompt
67 prompt
62
68
63 * Release.py: Changed version string to 0.7.3.svn.
69 * Release.py: Changed version string to 0.7.3.svn.
64
70
65 2006-06-15 Walter Doerwald <walter@livinglogic.de>
71 2006-06-15 Walter Doerwald <walter@livinglogic.de>
66
72
67 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
73 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
68 the call to fetch() always tries to fetch enough data for at least one
74 the call to fetch() always tries to fetch enough data for at least one
69 full screen. This makes it possible to simply call moveto(0,0,True) in
75 full screen. This makes it possible to simply call moveto(0,0,True) in
70 the constructor. Fix typos and removed the obsolete goto attribute.
76 the constructor. Fix typos and removed the obsolete goto attribute.
71
77
72 2006-06-12 Ville Vainio <vivainio@gmail.com>
78 2006-06-12 Ville Vainio <vivainio@gmail.com>
73
79
74 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
80 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
75 allowing $variable interpolation within multiline statements,
81 allowing $variable interpolation within multiline statements,
76 though so far only with "sh" profile for a testing period.
82 though so far only with "sh" profile for a testing period.
77 The patch also enables splitting long commands with \ but it
83 The patch also enables splitting long commands with \ but it
78 doesn't work properly yet.
84 doesn't work properly yet.
79
85
80 2006-06-12 Walter Doerwald <walter@livinglogic.de>
86 2006-06-12 Walter Doerwald <walter@livinglogic.de>
81
87
82 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
88 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
83 input history and the position of the cursor in the input history for
89 input history and the position of the cursor in the input history for
84 the find, findbackwards and goto command.
90 the find, findbackwards and goto command.
85
91
86 2006-06-10 Walter Doerwald <walter@livinglogic.de>
92 2006-06-10 Walter Doerwald <walter@livinglogic.de>
87
93
88 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
94 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
89 implements the basic functionality of browser commands that require
95 implements the basic functionality of browser commands that require
90 input. Reimplement the goto, find and findbackwards commands as
96 input. Reimplement the goto, find and findbackwards commands as
91 subclasses of _CommandInput. Add an input history and keymaps to those
97 subclasses of _CommandInput. Add an input history and keymaps to those
92 commands. Add "\r" as a keyboard shortcut for the enterdefault and
98 commands. Add "\r" as a keyboard shortcut for the enterdefault and
93 execute commands.
99 execute commands.
94
100
95 2006-06-07 Ville Vainio <vivainio@gmail.com>
101 2006-06-07 Ville Vainio <vivainio@gmail.com>
96
102
97 * iplib.py: ipython mybatch.ipy exits ipython immediately after
103 * iplib.py: ipython mybatch.ipy exits ipython immediately after
98 running the batch files instead of leaving the session open.
104 running the batch files instead of leaving the session open.
99
105
100 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
106 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
101
107
102 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
108 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
103 the original fix was incomplete. Patch submitted by W. Maier.
109 the original fix was incomplete. Patch submitted by W. Maier.
104
110
105 2006-06-07 Ville Vainio <vivainio@gmail.com>
111 2006-06-07 Ville Vainio <vivainio@gmail.com>
106
112
107 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
113 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
108 Confirmation prompts can be supressed by 'quiet' option.
114 Confirmation prompts can be supressed by 'quiet' option.
109 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
115 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
110
116
111 2006-06-06 *** Released version 0.7.2
117 2006-06-06 *** Released version 0.7.2
112
118
113 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
119 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
114
120
115 * IPython/Release.py (version): Made 0.7.2 final for release.
121 * IPython/Release.py (version): Made 0.7.2 final for release.
116 Repo tagged and release cut.
122 Repo tagged and release cut.
117
123
118 2006-06-05 Ville Vainio <vivainio@gmail.com>
124 2006-06-05 Ville Vainio <vivainio@gmail.com>
119
125
120 * Magic.py (magic_rehashx): Honor no_alias list earlier in
126 * Magic.py (magic_rehashx): Honor no_alias list earlier in
121 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
127 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
122
128
123 * upgrade_dir.py: try import 'path' module a bit harder
129 * upgrade_dir.py: try import 'path' module a bit harder
124 (for %upgrade)
130 (for %upgrade)
125
131
126 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
132 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
127
133
128 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
134 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
129 instead of looping 20 times.
135 instead of looping 20 times.
130
136
131 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
137 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
132 correctly at initialization time. Bug reported by Krishna Mohan
138 correctly at initialization time. Bug reported by Krishna Mohan
133 Gundu <gkmohan-AT-gmail.com> on the user list.
139 Gundu <gkmohan-AT-gmail.com> on the user list.
134
140
135 * IPython/Release.py (version): Mark 0.7.2 version to start
141 * IPython/Release.py (version): Mark 0.7.2 version to start
136 testing for release on 06/06.
142 testing for release on 06/06.
137
143
138 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
144 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
139
145
140 * scripts/irunner: thin script interface so users don't have to
146 * scripts/irunner: thin script interface so users don't have to
141 find the module and call it as an executable, since modules rarely
147 find the module and call it as an executable, since modules rarely
142 live in people's PATH.
148 live in people's PATH.
143
149
144 * IPython/irunner.py (InteractiveRunner.__init__): added
150 * IPython/irunner.py (InteractiveRunner.__init__): added
145 delaybeforesend attribute to control delays with newer versions of
151 delaybeforesend attribute to control delays with newer versions of
146 pexpect. Thanks to detailed help from pexpect's author, Noah
152 pexpect. Thanks to detailed help from pexpect's author, Noah
147 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
153 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
148 correctly (it works in NoColor mode).
154 correctly (it works in NoColor mode).
149
155
150 * IPython/iplib.py (handle_normal): fix nasty crash reported on
156 * IPython/iplib.py (handle_normal): fix nasty crash reported on
151 SAGE list, from improper log() calls.
157 SAGE list, from improper log() calls.
152
158
153 2006-05-31 Ville Vainio <vivainio@gmail.com>
159 2006-05-31 Ville Vainio <vivainio@gmail.com>
154
160
155 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
161 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
156 with args in parens to work correctly with dirs that have spaces.
162 with args in parens to work correctly with dirs that have spaces.
157
163
158 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
164 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
159
165
160 * IPython/Logger.py (Logger.logstart): add option to log raw input
166 * IPython/Logger.py (Logger.logstart): add option to log raw input
161 instead of the processed one. A -r flag was added to the
167 instead of the processed one. A -r flag was added to the
162 %logstart magic used for controlling logging.
168 %logstart magic used for controlling logging.
163
169
164 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
170 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
165
171
166 * IPython/iplib.py (InteractiveShell.__init__): add check for the
172 * IPython/iplib.py (InteractiveShell.__init__): add check for the
167 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
173 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
168 recognize the option. After a bug report by Will Maier. This
174 recognize the option. After a bug report by Will Maier. This
169 closes #64 (will do it after confirmation from W. Maier).
175 closes #64 (will do it after confirmation from W. Maier).
170
176
171 * IPython/irunner.py: New module to run scripts as if manually
177 * IPython/irunner.py: New module to run scripts as if manually
172 typed into an interactive environment, based on pexpect. After a
178 typed into an interactive environment, based on pexpect. After a
173 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
179 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
174 ipython-user list. Simple unittests in the tests/ directory.
180 ipython-user list. Simple unittests in the tests/ directory.
175
181
176 * tools/release: add Will Maier, OpenBSD port maintainer, to
182 * tools/release: add Will Maier, OpenBSD port maintainer, to
177 recepients list. We are now officially part of the OpenBSD ports:
183 recepients list. We are now officially part of the OpenBSD ports:
178 http://www.openbsd.org/ports.html ! Many thanks to Will for the
184 http://www.openbsd.org/ports.html ! Many thanks to Will for the
179 work.
185 work.
180
186
181 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
187 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
182
188
183 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
189 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
184 so that it doesn't break tkinter apps.
190 so that it doesn't break tkinter apps.
185
191
186 * IPython/iplib.py (_prefilter): fix bug where aliases would
192 * IPython/iplib.py (_prefilter): fix bug where aliases would
187 shadow variables when autocall was fully off. Reported by SAGE
193 shadow variables when autocall was fully off. Reported by SAGE
188 author William Stein.
194 author William Stein.
189
195
190 * IPython/OInspect.py (Inspector.__init__): add a flag to control
196 * IPython/OInspect.py (Inspector.__init__): add a flag to control
191 at what detail level strings are computed when foo? is requested.
197 at what detail level strings are computed when foo? is requested.
192 This allows users to ask for example that the string form of an
198 This allows users to ask for example that the string form of an
193 object is only computed when foo?? is called, or even never, by
199 object is only computed when foo?? is called, or even never, by
194 setting the object_info_string_level >= 2 in the configuration
200 setting the object_info_string_level >= 2 in the configuration
195 file. This new option has been added and documented. After a
201 file. This new option has been added and documented. After a
196 request by SAGE to be able to control the printing of very large
202 request by SAGE to be able to control the printing of very large
197 objects more easily.
203 objects more easily.
198
204
199 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
205 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
200
206
201 * IPython/ipmaker.py (make_IPython): remove the ipython call path
207 * IPython/ipmaker.py (make_IPython): remove the ipython call path
202 from sys.argv, to be 100% consistent with how Python itself works
208 from sys.argv, to be 100% consistent with how Python itself works
203 (as seen for example with python -i file.py). After a bug report
209 (as seen for example with python -i file.py). After a bug report
204 by Jeffrey Collins.
210 by Jeffrey Collins.
205
211
206 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
212 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
207 nasty bug which was preventing custom namespaces with -pylab,
213 nasty bug which was preventing custom namespaces with -pylab,
208 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
214 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
209 compatibility (long gone from mpl).
215 compatibility (long gone from mpl).
210
216
211 * IPython/ipapi.py (make_session): name change: create->make. We
217 * IPython/ipapi.py (make_session): name change: create->make. We
212 use make in other places (ipmaker,...), it's shorter and easier to
218 use make in other places (ipmaker,...), it's shorter and easier to
213 type and say, etc. I'm trying to clean things before 0.7.2 so
219 type and say, etc. I'm trying to clean things before 0.7.2 so
214 that I can keep things stable wrt to ipapi in the chainsaw branch.
220 that I can keep things stable wrt to ipapi in the chainsaw branch.
215
221
216 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
222 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
217 python-mode recognizes our debugger mode. Add support for
223 python-mode recognizes our debugger mode. Add support for
218 autoindent inside (X)emacs. After a patch sent in by Jin Liu
224 autoindent inside (X)emacs. After a patch sent in by Jin Liu
219 <m.liu.jin-AT-gmail.com> originally written by
225 <m.liu.jin-AT-gmail.com> originally written by
220 doxgen-AT-newsmth.net (with minor modifications for xemacs
226 doxgen-AT-newsmth.net (with minor modifications for xemacs
221 compatibility)
227 compatibility)
222
228
223 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
229 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
224 tracebacks when walking the stack so that the stack tracking system
230 tracebacks when walking the stack so that the stack tracking system
225 in emacs' python-mode can identify the frames correctly.
231 in emacs' python-mode can identify the frames correctly.
226
232
227 * IPython/ipmaker.py (make_IPython): make the internal (and
233 * IPython/ipmaker.py (make_IPython): make the internal (and
228 default config) autoedit_syntax value false by default. Too many
234 default config) autoedit_syntax value false by default. Too many
229 users have complained to me (both on and off-list) about problems
235 users have complained to me (both on and off-list) about problems
230 with this option being on by default, so I'm making it default to
236 with this option being on by default, so I'm making it default to
231 off. It can still be enabled by anyone via the usual mechanisms.
237 off. It can still be enabled by anyone via the usual mechanisms.
232
238
233 * IPython/completer.py (Completer.attr_matches): add support for
239 * IPython/completer.py (Completer.attr_matches): add support for
234 PyCrust-style _getAttributeNames magic method. Patch contributed
240 PyCrust-style _getAttributeNames magic method. Patch contributed
235 by <mscott-AT-goldenspud.com>. Closes #50.
241 by <mscott-AT-goldenspud.com>. Closes #50.
236
242
237 * IPython/iplib.py (InteractiveShell.__init__): remove the
243 * IPython/iplib.py (InteractiveShell.__init__): remove the
238 deletion of exit/quit from __builtin__, which can break
244 deletion of exit/quit from __builtin__, which can break
239 third-party tools like the Zope debugging console. The
245 third-party tools like the Zope debugging console. The
240 %exit/%quit magics remain. In general, it's probably a good idea
246 %exit/%quit magics remain. In general, it's probably a good idea
241 not to delete anything from __builtin__, since we never know what
247 not to delete anything from __builtin__, since we never know what
242 that will break. In any case, python now (for 2.5) will support
248 that will break. In any case, python now (for 2.5) will support
243 'real' exit/quit, so this issue is moot. Closes #55.
249 'real' exit/quit, so this issue is moot. Closes #55.
244
250
245 * IPython/genutils.py (with_obj): rename the 'with' function to
251 * IPython/genutils.py (with_obj): rename the 'with' function to
246 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
252 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
247 becomes a language keyword. Closes #53.
253 becomes a language keyword. Closes #53.
248
254
249 * IPython/FakeModule.py (FakeModule.__init__): add a proper
255 * IPython/FakeModule.py (FakeModule.__init__): add a proper
250 __file__ attribute to this so it fools more things into thinking
256 __file__ attribute to this so it fools more things into thinking
251 it is a real module. Closes #59.
257 it is a real module. Closes #59.
252
258
253 * IPython/Magic.py (magic_edit): add -n option to open the editor
259 * IPython/Magic.py (magic_edit): add -n option to open the editor
254 at a specific line number. After a patch by Stefan van der Walt.
260 at a specific line number. After a patch by Stefan van der Walt.
255
261
256 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
262 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
257
263
258 * IPython/iplib.py (edit_syntax_error): fix crash when for some
264 * IPython/iplib.py (edit_syntax_error): fix crash when for some
259 reason the file could not be opened. After automatic crash
265 reason the file could not be opened. After automatic crash
260 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
266 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
261 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
267 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
262 (_should_recompile): Don't fire editor if using %bg, since there
268 (_should_recompile): Don't fire editor if using %bg, since there
263 is no file in the first place. From the same report as above.
269 is no file in the first place. From the same report as above.
264 (raw_input): protect against faulty third-party prefilters. After
270 (raw_input): protect against faulty third-party prefilters. After
265 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
271 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
266 while running under SAGE.
272 while running under SAGE.
267
273
268 2006-05-23 Ville Vainio <vivainio@gmail.com>
274 2006-05-23 Ville Vainio <vivainio@gmail.com>
269
275
270 * ipapi.py: Stripped down ip.to_user_ns() to work only as
276 * ipapi.py: Stripped down ip.to_user_ns() to work only as
271 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
277 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
272 now returns None (again), unless dummy is specifically allowed by
278 now returns None (again), unless dummy is specifically allowed by
273 ipapi.get(allow_dummy=True).
279 ipapi.get(allow_dummy=True).
274
280
275 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
281 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
276
282
277 * IPython: remove all 2.2-compatibility objects and hacks from
283 * IPython: remove all 2.2-compatibility objects and hacks from
278 everywhere, since we only support 2.3 at this point. Docs
284 everywhere, since we only support 2.3 at this point. Docs
279 updated.
285 updated.
280
286
281 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
287 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
282 Anything requiring extra validation can be turned into a Python
288 Anything requiring extra validation can be turned into a Python
283 property in the future. I used a property for the db one b/c
289 property in the future. I used a property for the db one b/c
284 there was a nasty circularity problem with the initialization
290 there was a nasty circularity problem with the initialization
285 order, which right now I don't have time to clean up.
291 order, which right now I don't have time to clean up.
286
292
287 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
293 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
288 another locking bug reported by Jorgen. I'm not 100% sure though,
294 another locking bug reported by Jorgen. I'm not 100% sure though,
289 so more testing is needed...
295 so more testing is needed...
290
296
291 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
297 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
292
298
293 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
299 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
294 local variables from any routine in user code (typically executed
300 local variables from any routine in user code (typically executed
295 with %run) directly into the interactive namespace. Very useful
301 with %run) directly into the interactive namespace. Very useful
296 when doing complex debugging.
302 when doing complex debugging.
297 (IPythonNotRunning): Changed the default None object to a dummy
303 (IPythonNotRunning): Changed the default None object to a dummy
298 whose attributes can be queried as well as called without
304 whose attributes can be queried as well as called without
299 exploding, to ease writing code which works transparently both in
305 exploding, to ease writing code which works transparently both in
300 and out of ipython and uses some of this API.
306 and out of ipython and uses some of this API.
301
307
302 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
308 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
303
309
304 * IPython/hooks.py (result_display): Fix the fact that our display
310 * IPython/hooks.py (result_display): Fix the fact that our display
305 hook was using str() instead of repr(), as the default python
311 hook was using str() instead of repr(), as the default python
306 console does. This had gone unnoticed b/c it only happened if
312 console does. This had gone unnoticed b/c it only happened if
307 %Pprint was off, but the inconsistency was there.
313 %Pprint was off, but the inconsistency was there.
308
314
309 2006-05-15 Ville Vainio <vivainio@gmail.com>
315 2006-05-15 Ville Vainio <vivainio@gmail.com>
310
316
311 * Oinspect.py: Only show docstring for nonexisting/binary files
317 * Oinspect.py: Only show docstring for nonexisting/binary files
312 when doing object??, closing ticket #62
318 when doing object??, closing ticket #62
313
319
314 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
320 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
315
321
316 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
322 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
317 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
323 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
318 was being released in a routine which hadn't checked if it had
324 was being released in a routine which hadn't checked if it had
319 been the one to acquire it.
325 been the one to acquire it.
320
326
321 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
327 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
322
328
323 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
329 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
324
330
325 2006-04-11 Ville Vainio <vivainio@gmail.com>
331 2006-04-11 Ville Vainio <vivainio@gmail.com>
326
332
327 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
333 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
328 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
334 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
329 prefilters, allowing stuff like magics and aliases in the file.
335 prefilters, allowing stuff like magics and aliases in the file.
330
336
331 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
337 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
332 added. Supported now are "%clear in" and "%clear out" (clear input and
338 added. Supported now are "%clear in" and "%clear out" (clear input and
333 output history, respectively). Also fixed CachedOutput.flush to
339 output history, respectively). Also fixed CachedOutput.flush to
334 properly flush the output cache.
340 properly flush the output cache.
335
341
336 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
342 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
337 half-success (and fail explicitly).
343 half-success (and fail explicitly).
338
344
339 2006-03-28 Ville Vainio <vivainio@gmail.com>
345 2006-03-28 Ville Vainio <vivainio@gmail.com>
340
346
341 * iplib.py: Fix quoting of aliases so that only argless ones
347 * iplib.py: Fix quoting of aliases so that only argless ones
342 are quoted
348 are quoted
343
349
344 2006-03-28 Ville Vainio <vivainio@gmail.com>
350 2006-03-28 Ville Vainio <vivainio@gmail.com>
345
351
346 * iplib.py: Quote aliases with spaces in the name.
352 * iplib.py: Quote aliases with spaces in the name.
347 "c:\program files\blah\bin" is now legal alias target.
353 "c:\program files\blah\bin" is now legal alias target.
348
354
349 * ext_rehashdir.py: Space no longer allowed as arg
355 * ext_rehashdir.py: Space no longer allowed as arg
350 separator, since space is legal in path names.
356 separator, since space is legal in path names.
351
357
352 2006-03-16 Ville Vainio <vivainio@gmail.com>
358 2006-03-16 Ville Vainio <vivainio@gmail.com>
353
359
354 * upgrade_dir.py: Take path.py from Extensions, correcting
360 * upgrade_dir.py: Take path.py from Extensions, correcting
355 %upgrade magic
361 %upgrade magic
356
362
357 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
363 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
358
364
359 * hooks.py: Only enclose editor binary in quotes if legal and
365 * hooks.py: Only enclose editor binary in quotes if legal and
360 necessary (space in the name, and is an existing file). Fixes a bug
366 necessary (space in the name, and is an existing file). Fixes a bug
361 reported by Zachary Pincus.
367 reported by Zachary Pincus.
362
368
363 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
369 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
364
370
365 * Manual: thanks to a tip on proper color handling for Emacs, by
371 * Manual: thanks to a tip on proper color handling for Emacs, by
366 Eric J Haywiser <ejh1-AT-MIT.EDU>.
372 Eric J Haywiser <ejh1-AT-MIT.EDU>.
367
373
368 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
374 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
369 by applying the provided patch. Thanks to Liu Jin
375 by applying the provided patch. Thanks to Liu Jin
370 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
376 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
371 XEmacs/Linux, I'm trusting the submitter that it actually helps
377 XEmacs/Linux, I'm trusting the submitter that it actually helps
372 under win32/GNU Emacs. Will revisit if any problems are reported.
378 under win32/GNU Emacs. Will revisit if any problems are reported.
373
379
374 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
380 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
375
381
376 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
382 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
377 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
383 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
378
384
379 2006-03-12 Ville Vainio <vivainio@gmail.com>
385 2006-03-12 Ville Vainio <vivainio@gmail.com>
380
386
381 * Magic.py (magic_timeit): Added %timeit magic, contributed by
387 * Magic.py (magic_timeit): Added %timeit magic, contributed by
382 Torsten Marek.
388 Torsten Marek.
383
389
384 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
390 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
385
391
386 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
392 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
387 line ranges works again.
393 line ranges works again.
388
394
389 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
395 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
390
396
391 * IPython/iplib.py (showtraceback): add back sys.last_traceback
397 * IPython/iplib.py (showtraceback): add back sys.last_traceback
392 and friends, after a discussion with Zach Pincus on ipython-user.
398 and friends, after a discussion with Zach Pincus on ipython-user.
393 I'm not 100% sure, but after thinking about it quite a bit, it may
399 I'm not 100% sure, but after thinking about it quite a bit, it may
394 be OK. Testing with the multithreaded shells didn't reveal any
400 be OK. Testing with the multithreaded shells didn't reveal any
395 problems, but let's keep an eye out.
401 problems, but let's keep an eye out.
396
402
397 In the process, I fixed a few things which were calling
403 In the process, I fixed a few things which were calling
398 self.InteractiveTB() directly (like safe_execfile), which is a
404 self.InteractiveTB() directly (like safe_execfile), which is a
399 mistake: ALL exception reporting should be done by calling
405 mistake: ALL exception reporting should be done by calling
400 self.showtraceback(), which handles state and tab-completion and
406 self.showtraceback(), which handles state and tab-completion and
401 more.
407 more.
402
408
403 2006-03-01 Ville Vainio <vivainio@gmail.com>
409 2006-03-01 Ville Vainio <vivainio@gmail.com>
404
410
405 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
411 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
406 To use, do "from ipipe import *".
412 To use, do "from ipipe import *".
407
413
408 2006-02-24 Ville Vainio <vivainio@gmail.com>
414 2006-02-24 Ville Vainio <vivainio@gmail.com>
409
415
410 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
416 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
411 "cleanly" and safely than the older upgrade mechanism.
417 "cleanly" and safely than the older upgrade mechanism.
412
418
413 2006-02-21 Ville Vainio <vivainio@gmail.com>
419 2006-02-21 Ville Vainio <vivainio@gmail.com>
414
420
415 * Magic.py: %save works again.
421 * Magic.py: %save works again.
416
422
417 2006-02-15 Ville Vainio <vivainio@gmail.com>
423 2006-02-15 Ville Vainio <vivainio@gmail.com>
418
424
419 * Magic.py: %Pprint works again
425 * Magic.py: %Pprint works again
420
426
421 * Extensions/ipy_sane_defaults.py: Provide everything provided
427 * Extensions/ipy_sane_defaults.py: Provide everything provided
422 in default ipythonrc, to make it possible to have a completely empty
428 in default ipythonrc, to make it possible to have a completely empty
423 ipythonrc (and thus completely rc-file free configuration)
429 ipythonrc (and thus completely rc-file free configuration)
424
430
425 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
431 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
426
432
427 * IPython/hooks.py (editor): quote the call to the editor command,
433 * IPython/hooks.py (editor): quote the call to the editor command,
428 to allow commands with spaces in them. Problem noted by watching
434 to allow commands with spaces in them. Problem noted by watching
429 Ian Oswald's video about textpad under win32 at
435 Ian Oswald's video about textpad under win32 at
430 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
436 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
431
437
432 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
438 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
433 describing magics (we haven't used @ for a loong time).
439 describing magics (we haven't used @ for a loong time).
434
440
435 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
441 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
436 contributed by marienz to close
442 contributed by marienz to close
437 http://www.scipy.net/roundup/ipython/issue53.
443 http://www.scipy.net/roundup/ipython/issue53.
438
444
439 2006-02-10 Ville Vainio <vivainio@gmail.com>
445 2006-02-10 Ville Vainio <vivainio@gmail.com>
440
446
441 * genutils.py: getoutput now works in win32 too
447 * genutils.py: getoutput now works in win32 too
442
448
443 * completer.py: alias and magic completion only invoked
449 * completer.py: alias and magic completion only invoked
444 at the first "item" in the line, to avoid "cd %store"
450 at the first "item" in the line, to avoid "cd %store"
445 nonsense.
451 nonsense.
446
452
447 2006-02-09 Ville Vainio <vivainio@gmail.com>
453 2006-02-09 Ville Vainio <vivainio@gmail.com>
448
454
449 * test/*: Added a unit testing framework (finally).
455 * test/*: Added a unit testing framework (finally).
450 '%run runtests.py' to run test_*.
456 '%run runtests.py' to run test_*.
451
457
452 * ipapi.py: Exposed runlines and set_custom_exc
458 * ipapi.py: Exposed runlines and set_custom_exc
453
459
454 2006-02-07 Ville Vainio <vivainio@gmail.com>
460 2006-02-07 Ville Vainio <vivainio@gmail.com>
455
461
456 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
462 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
457 instead use "f(1 2)" as before.
463 instead use "f(1 2)" as before.
458
464
459 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
465 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
460
466
461 * IPython/demo.py (IPythonDemo): Add new classes to the demo
467 * IPython/demo.py (IPythonDemo): Add new classes to the demo
462 facilities, for demos processed by the IPython input filter
468 facilities, for demos processed by the IPython input filter
463 (IPythonDemo), and for running a script one-line-at-a-time as a
469 (IPythonDemo), and for running a script one-line-at-a-time as a
464 demo, both for pure Python (LineDemo) and for IPython-processed
470 demo, both for pure Python (LineDemo) and for IPython-processed
465 input (IPythonLineDemo). After a request by Dave Kohel, from the
471 input (IPythonLineDemo). After a request by Dave Kohel, from the
466 SAGE team.
472 SAGE team.
467 (Demo.edit): added an edit() method to the demo objects, to edit
473 (Demo.edit): added an edit() method to the demo objects, to edit
468 the in-memory copy of the last executed block.
474 the in-memory copy of the last executed block.
469
475
470 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
476 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
471 processing to %edit, %macro and %save. These commands can now be
477 processing to %edit, %macro and %save. These commands can now be
472 invoked on the unprocessed input as it was typed by the user
478 invoked on the unprocessed input as it was typed by the user
473 (without any prefilters applied). After requests by the SAGE team
479 (without any prefilters applied). After requests by the SAGE team
474 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
480 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
475
481
476 2006-02-01 Ville Vainio <vivainio@gmail.com>
482 2006-02-01 Ville Vainio <vivainio@gmail.com>
477
483
478 * setup.py, eggsetup.py: easy_install ipython==dev works
484 * setup.py, eggsetup.py: easy_install ipython==dev works
479 correctly now (on Linux)
485 correctly now (on Linux)
480
486
481 * ipy_user_conf,ipmaker: user config changes, removed spurious
487 * ipy_user_conf,ipmaker: user config changes, removed spurious
482 warnings
488 warnings
483
489
484 * iplib: if rc.banner is string, use it as is.
490 * iplib: if rc.banner is string, use it as is.
485
491
486 * Magic: %pycat accepts a string argument and pages it's contents.
492 * Magic: %pycat accepts a string argument and pages it's contents.
487
493
488
494
489 2006-01-30 Ville Vainio <vivainio@gmail.com>
495 2006-01-30 Ville Vainio <vivainio@gmail.com>
490
496
491 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
497 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
492 Now %store and bookmarks work through PickleShare, meaning that
498 Now %store and bookmarks work through PickleShare, meaning that
493 concurrent access is possible and all ipython sessions see the
499 concurrent access is possible and all ipython sessions see the
494 same database situation all the time, instead of snapshot of
500 same database situation all the time, instead of snapshot of
495 the situation when the session was started. Hence, %bookmark
501 the situation when the session was started. Hence, %bookmark
496 results are immediately accessible from othes sessions. The database
502 results are immediately accessible from othes sessions. The database
497 is also available for use by user extensions. See:
503 is also available for use by user extensions. See:
498 http://www.python.org/pypi/pickleshare
504 http://www.python.org/pypi/pickleshare
499
505
500 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
506 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
501
507
502 * aliases can now be %store'd
508 * aliases can now be %store'd
503
509
504 * path.py moved to Extensions so that pickleshare does not need
510 * path.py moved to Extensions so that pickleshare does not need
505 IPython-specific import. Extensions added to pythonpath right
511 IPython-specific import. Extensions added to pythonpath right
506 at __init__.
512 at __init__.
507
513
508 * iplib.py: ipalias deprecated/redundant; aliases are converted and
514 * iplib.py: ipalias deprecated/redundant; aliases are converted and
509 called with _ip.system and the pre-transformed command string.
515 called with _ip.system and the pre-transformed command string.
510
516
511 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
517 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
512
518
513 * IPython/iplib.py (interact): Fix that we were not catching
519 * IPython/iplib.py (interact): Fix that we were not catching
514 KeyboardInterrupt exceptions properly. I'm not quite sure why the
520 KeyboardInterrupt exceptions properly. I'm not quite sure why the
515 logic here had to change, but it's fixed now.
521 logic here had to change, but it's fixed now.
516
522
517 2006-01-29 Ville Vainio <vivainio@gmail.com>
523 2006-01-29 Ville Vainio <vivainio@gmail.com>
518
524
519 * iplib.py: Try to import pyreadline on Windows.
525 * iplib.py: Try to import pyreadline on Windows.
520
526
521 2006-01-27 Ville Vainio <vivainio@gmail.com>
527 2006-01-27 Ville Vainio <vivainio@gmail.com>
522
528
523 * iplib.py: Expose ipapi as _ip in builtin namespace.
529 * iplib.py: Expose ipapi as _ip in builtin namespace.
524 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
530 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
525 and ip_set_hook (-> _ip.set_hook) redundant. % and !
531 and ip_set_hook (-> _ip.set_hook) redundant. % and !
526 syntax now produce _ip.* variant of the commands.
532 syntax now produce _ip.* variant of the commands.
527
533
528 * "_ip.options().autoedit_syntax = 2" automatically throws
534 * "_ip.options().autoedit_syntax = 2" automatically throws
529 user to editor for syntax error correction without prompting.
535 user to editor for syntax error correction without prompting.
530
536
531 2006-01-27 Ville Vainio <vivainio@gmail.com>
537 2006-01-27 Ville Vainio <vivainio@gmail.com>
532
538
533 * ipmaker.py: Give "realistic" sys.argv for scripts (without
539 * ipmaker.py: Give "realistic" sys.argv for scripts (without
534 'ipython' at argv[0]) executed through command line.
540 'ipython' at argv[0]) executed through command line.
535 NOTE: this DEPRECATES calling ipython with multiple scripts
541 NOTE: this DEPRECATES calling ipython with multiple scripts
536 ("ipython a.py b.py c.py")
542 ("ipython a.py b.py c.py")
537
543
538 * iplib.py, hooks.py: Added configurable input prefilter,
544 * iplib.py, hooks.py: Added configurable input prefilter,
539 named 'input_prefilter'. See ext_rescapture.py for example
545 named 'input_prefilter'. See ext_rescapture.py for example
540 usage.
546 usage.
541
547
542 * ext_rescapture.py, Magic.py: Better system command output capture
548 * ext_rescapture.py, Magic.py: Better system command output capture
543 through 'var = !ls' (deprecates user-visible %sc). Same notation
549 through 'var = !ls' (deprecates user-visible %sc). Same notation
544 applies for magics, 'var = %alias' assigns alias list to var.
550 applies for magics, 'var = %alias' assigns alias list to var.
545
551
546 * ipapi.py: added meta() for accessing extension-usable data store.
552 * ipapi.py: added meta() for accessing extension-usable data store.
547
553
548 * iplib.py: added InteractiveShell.getapi(). New magics should be
554 * iplib.py: added InteractiveShell.getapi(). New magics should be
549 written doing self.getapi() instead of using the shell directly.
555 written doing self.getapi() instead of using the shell directly.
550
556
551 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
557 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
552 %store foo >> ~/myfoo.txt to store variables to files (in clean
558 %store foo >> ~/myfoo.txt to store variables to files (in clean
553 textual form, not a restorable pickle).
559 textual form, not a restorable pickle).
554
560
555 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
561 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
556
562
557 * usage.py, Magic.py: added %quickref
563 * usage.py, Magic.py: added %quickref
558
564
559 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
565 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
560
566
561 * GetoptErrors when invoking magics etc. with wrong args
567 * GetoptErrors when invoking magics etc. with wrong args
562 are now more helpful:
568 are now more helpful:
563 GetoptError: option -l not recognized (allowed: "qb" )
569 GetoptError: option -l not recognized (allowed: "qb" )
564
570
565 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
571 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
566
572
567 * IPython/demo.py (Demo.show): Flush stdout after each block, so
573 * IPython/demo.py (Demo.show): Flush stdout after each block, so
568 computationally intensive blocks don't appear to stall the demo.
574 computationally intensive blocks don't appear to stall the demo.
569
575
570 2006-01-24 Ville Vainio <vivainio@gmail.com>
576 2006-01-24 Ville Vainio <vivainio@gmail.com>
571
577
572 * iplib.py, hooks.py: 'result_display' hook can return a non-None
578 * iplib.py, hooks.py: 'result_display' hook can return a non-None
573 value to manipulate resulting history entry.
579 value to manipulate resulting history entry.
574
580
575 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
581 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
576 to instance methods of IPApi class, to make extending an embedded
582 to instance methods of IPApi class, to make extending an embedded
577 IPython feasible. See ext_rehashdir.py for example usage.
583 IPython feasible. See ext_rehashdir.py for example usage.
578
584
579 * Merged 1071-1076 from branches/0.7.1
585 * Merged 1071-1076 from branches/0.7.1
580
586
581
587
582 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
588 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
583
589
584 * tools/release (daystamp): Fix build tools to use the new
590 * tools/release (daystamp): Fix build tools to use the new
585 eggsetup.py script to build lightweight eggs.
591 eggsetup.py script to build lightweight eggs.
586
592
587 * Applied changesets 1062 and 1064 before 0.7.1 release.
593 * Applied changesets 1062 and 1064 before 0.7.1 release.
588
594
589 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
595 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
590 see the raw input history (without conversions like %ls ->
596 see the raw input history (without conversions like %ls ->
591 ipmagic("ls")). After a request from W. Stein, SAGE
597 ipmagic("ls")). After a request from W. Stein, SAGE
592 (http://modular.ucsd.edu/sage) developer. This information is
598 (http://modular.ucsd.edu/sage) developer. This information is
593 stored in the input_hist_raw attribute of the IPython instance, so
599 stored in the input_hist_raw attribute of the IPython instance, so
594 developers can access it if needed (it's an InputList instance).
600 developers can access it if needed (it's an InputList instance).
595
601
596 * Versionstring = 0.7.2.svn
602 * Versionstring = 0.7.2.svn
597
603
598 * eggsetup.py: A separate script for constructing eggs, creates
604 * eggsetup.py: A separate script for constructing eggs, creates
599 proper launch scripts even on Windows (an .exe file in
605 proper launch scripts even on Windows (an .exe file in
600 \python24\scripts).
606 \python24\scripts).
601
607
602 * ipapi.py: launch_new_instance, launch entry point needed for the
608 * ipapi.py: launch_new_instance, launch entry point needed for the
603 egg.
609 egg.
604
610
605 2006-01-23 Ville Vainio <vivainio@gmail.com>
611 2006-01-23 Ville Vainio <vivainio@gmail.com>
606
612
607 * Added %cpaste magic for pasting python code
613 * Added %cpaste magic for pasting python code
608
614
609 2006-01-22 Ville Vainio <vivainio@gmail.com>
615 2006-01-22 Ville Vainio <vivainio@gmail.com>
610
616
611 * Merge from branches/0.7.1 into trunk, revs 1052-1057
617 * Merge from branches/0.7.1 into trunk, revs 1052-1057
612
618
613 * Versionstring = 0.7.2.svn
619 * Versionstring = 0.7.2.svn
614
620
615 * eggsetup.py: A separate script for constructing eggs, creates
621 * eggsetup.py: A separate script for constructing eggs, creates
616 proper launch scripts even on Windows (an .exe file in
622 proper launch scripts even on Windows (an .exe file in
617 \python24\scripts).
623 \python24\scripts).
618
624
619 * ipapi.py: launch_new_instance, launch entry point needed for the
625 * ipapi.py: launch_new_instance, launch entry point needed for the
620 egg.
626 egg.
621
627
622 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
628 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
623
629
624 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
630 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
625 %pfile foo would print the file for foo even if it was a binary.
631 %pfile foo would print the file for foo even if it was a binary.
626 Now, extensions '.so' and '.dll' are skipped.
632 Now, extensions '.so' and '.dll' are skipped.
627
633
628 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
634 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
629 bug, where macros would fail in all threaded modes. I'm not 100%
635 bug, where macros would fail in all threaded modes. I'm not 100%
630 sure, so I'm going to put out an rc instead of making a release
636 sure, so I'm going to put out an rc instead of making a release
631 today, and wait for feedback for at least a few days.
637 today, and wait for feedback for at least a few days.
632
638
633 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
639 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
634 it...) the handling of pasting external code with autoindent on.
640 it...) the handling of pasting external code with autoindent on.
635 To get out of a multiline input, the rule will appear for most
641 To get out of a multiline input, the rule will appear for most
636 users unchanged: two blank lines or change the indent level
642 users unchanged: two blank lines or change the indent level
637 proposed by IPython. But there is a twist now: you can
643 proposed by IPython. But there is a twist now: you can
638 add/subtract only *one or two spaces*. If you add/subtract three
644 add/subtract only *one or two spaces*. If you add/subtract three
639 or more (unless you completely delete the line), IPython will
645 or more (unless you completely delete the line), IPython will
640 accept that line, and you'll need to enter a second one of pure
646 accept that line, and you'll need to enter a second one of pure
641 whitespace. I know it sounds complicated, but I can't find a
647 whitespace. I know it sounds complicated, but I can't find a
642 different solution that covers all the cases, with the right
648 different solution that covers all the cases, with the right
643 heuristics. Hopefully in actual use, nobody will really notice
649 heuristics. Hopefully in actual use, nobody will really notice
644 all these strange rules and things will 'just work'.
650 all these strange rules and things will 'just work'.
645
651
646 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
652 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
647
653
648 * IPython/iplib.py (interact): catch exceptions which can be
654 * IPython/iplib.py (interact): catch exceptions which can be
649 triggered asynchronously by signal handlers. Thanks to an
655 triggered asynchronously by signal handlers. Thanks to an
650 automatic crash report, submitted by Colin Kingsley
656 automatic crash report, submitted by Colin Kingsley
651 <tercel-AT-gentoo.org>.
657 <tercel-AT-gentoo.org>.
652
658
653 2006-01-20 Ville Vainio <vivainio@gmail.com>
659 2006-01-20 Ville Vainio <vivainio@gmail.com>
654
660
655 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
661 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
656 (%rehashdir, very useful, try it out) of how to extend ipython
662 (%rehashdir, very useful, try it out) of how to extend ipython
657 with new magics. Also added Extensions dir to pythonpath to make
663 with new magics. Also added Extensions dir to pythonpath to make
658 importing extensions easy.
664 importing extensions easy.
659
665
660 * %store now complains when trying to store interactively declared
666 * %store now complains when trying to store interactively declared
661 classes / instances of those classes.
667 classes / instances of those classes.
662
668
663 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
669 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
664 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
670 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
665 if they exist, and ipy_user_conf.py with some defaults is created for
671 if they exist, and ipy_user_conf.py with some defaults is created for
666 the user.
672 the user.
667
673
668 * Startup rehashing done by the config file, not InterpreterExec.
674 * Startup rehashing done by the config file, not InterpreterExec.
669 This means system commands are available even without selecting the
675 This means system commands are available even without selecting the
670 pysh profile. It's the sensible default after all.
676 pysh profile. It's the sensible default after all.
671
677
672 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
678 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
673
679
674 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
680 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
675 multiline code with autoindent on working. But I am really not
681 multiline code with autoindent on working. But I am really not
676 sure, so this needs more testing. Will commit a debug-enabled
682 sure, so this needs more testing. Will commit a debug-enabled
677 version for now, while I test it some more, so that Ville and
683 version for now, while I test it some more, so that Ville and
678 others may also catch any problems. Also made
684 others may also catch any problems. Also made
679 self.indent_current_str() a method, to ensure that there's no
685 self.indent_current_str() a method, to ensure that there's no
680 chance of the indent space count and the corresponding string
686 chance of the indent space count and the corresponding string
681 falling out of sync. All code needing the string should just call
687 falling out of sync. All code needing the string should just call
682 the method.
688 the method.
683
689
684 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
690 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
685
691
686 * IPython/Magic.py (magic_edit): fix check for when users don't
692 * IPython/Magic.py (magic_edit): fix check for when users don't
687 save their output files, the try/except was in the wrong section.
693 save their output files, the try/except was in the wrong section.
688
694
689 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
695 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
690
696
691 * IPython/Magic.py (magic_run): fix __file__ global missing from
697 * IPython/Magic.py (magic_run): fix __file__ global missing from
692 script's namespace when executed via %run. After a report by
698 script's namespace when executed via %run. After a report by
693 Vivian.
699 Vivian.
694
700
695 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
701 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
696 when using python 2.4. The parent constructor changed in 2.4, and
702 when using python 2.4. The parent constructor changed in 2.4, and
697 we need to track it directly (we can't call it, as it messes up
703 we need to track it directly (we can't call it, as it messes up
698 readline and tab-completion inside our pdb would stop working).
704 readline and tab-completion inside our pdb would stop working).
699 After a bug report by R. Bernstein <rocky-AT-panix.com>.
705 After a bug report by R. Bernstein <rocky-AT-panix.com>.
700
706
701 2006-01-16 Ville Vainio <vivainio@gmail.com>
707 2006-01-16 Ville Vainio <vivainio@gmail.com>
702
708
703 * Ipython/magic.py: Reverted back to old %edit functionality
709 * Ipython/magic.py: Reverted back to old %edit functionality
704 that returns file contents on exit.
710 that returns file contents on exit.
705
711
706 * IPython/path.py: Added Jason Orendorff's "path" module to
712 * IPython/path.py: Added Jason Orendorff's "path" module to
707 IPython tree, http://www.jorendorff.com/articles/python/path/.
713 IPython tree, http://www.jorendorff.com/articles/python/path/.
708 You can get path objects conveniently through %sc, and !!, e.g.:
714 You can get path objects conveniently through %sc, and !!, e.g.:
709 sc files=ls
715 sc files=ls
710 for p in files.paths: # or files.p
716 for p in files.paths: # or files.p
711 print p,p.mtime
717 print p,p.mtime
712
718
713 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
719 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
714 now work again without considering the exclusion regexp -
720 now work again without considering the exclusion regexp -
715 hence, things like ',foo my/path' turn to 'foo("my/path")'
721 hence, things like ',foo my/path' turn to 'foo("my/path")'
716 instead of syntax error.
722 instead of syntax error.
717
723
718
724
719 2006-01-14 Ville Vainio <vivainio@gmail.com>
725 2006-01-14 Ville Vainio <vivainio@gmail.com>
720
726
721 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
727 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
722 ipapi decorators for python 2.4 users, options() provides access to rc
728 ipapi decorators for python 2.4 users, options() provides access to rc
723 data.
729 data.
724
730
725 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
731 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
726 as path separators (even on Linux ;-). Space character after
732 as path separators (even on Linux ;-). Space character after
727 backslash (as yielded by tab completer) is still space;
733 backslash (as yielded by tab completer) is still space;
728 "%cd long\ name" works as expected.
734 "%cd long\ name" works as expected.
729
735
730 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
736 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
731 as "chain of command", with priority. API stays the same,
737 as "chain of command", with priority. API stays the same,
732 TryNext exception raised by a hook function signals that
738 TryNext exception raised by a hook function signals that
733 current hook failed and next hook should try handling it, as
739 current hook failed and next hook should try handling it, as
734 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
740 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
735 requested configurable display hook, which is now implemented.
741 requested configurable display hook, which is now implemented.
736
742
737 2006-01-13 Ville Vainio <vivainio@gmail.com>
743 2006-01-13 Ville Vainio <vivainio@gmail.com>
738
744
739 * IPython/platutils*.py: platform specific utility functions,
745 * IPython/platutils*.py: platform specific utility functions,
740 so far only set_term_title is implemented (change terminal
746 so far only set_term_title is implemented (change terminal
741 label in windowing systems). %cd now changes the title to
747 label in windowing systems). %cd now changes the title to
742 current dir.
748 current dir.
743
749
744 * IPython/Release.py: Added myself to "authors" list,
750 * IPython/Release.py: Added myself to "authors" list,
745 had to create new files.
751 had to create new files.
746
752
747 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
753 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
748 shell escape; not a known bug but had potential to be one in the
754 shell escape; not a known bug but had potential to be one in the
749 future.
755 future.
750
756
751 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
757 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
752 extension API for IPython! See the module for usage example. Fix
758 extension API for IPython! See the module for usage example. Fix
753 OInspect for docstring-less magic functions.
759 OInspect for docstring-less magic functions.
754
760
755
761
756 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
762 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
757
763
758 * IPython/iplib.py (raw_input): temporarily deactivate all
764 * IPython/iplib.py (raw_input): temporarily deactivate all
759 attempts at allowing pasting of code with autoindent on. It
765 attempts at allowing pasting of code with autoindent on. It
760 introduced bugs (reported by Prabhu) and I can't seem to find a
766 introduced bugs (reported by Prabhu) and I can't seem to find a
761 robust combination which works in all cases. Will have to revisit
767 robust combination which works in all cases. Will have to revisit
762 later.
768 later.
763
769
764 * IPython/genutils.py: remove isspace() function. We've dropped
770 * IPython/genutils.py: remove isspace() function. We've dropped
765 2.2 compatibility, so it's OK to use the string method.
771 2.2 compatibility, so it's OK to use the string method.
766
772
767 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
773 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
768
774
769 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
775 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
770 matching what NOT to autocall on, to include all python binary
776 matching what NOT to autocall on, to include all python binary
771 operators (including things like 'and', 'or', 'is' and 'in').
777 operators (including things like 'and', 'or', 'is' and 'in').
772 Prompted by a bug report on 'foo & bar', but I realized we had
778 Prompted by a bug report on 'foo & bar', but I realized we had
773 many more potential bug cases with other operators. The regexp is
779 many more potential bug cases with other operators. The regexp is
774 self.re_exclude_auto, it's fairly commented.
780 self.re_exclude_auto, it's fairly commented.
775
781
776 2006-01-12 Ville Vainio <vivainio@gmail.com>
782 2006-01-12 Ville Vainio <vivainio@gmail.com>
777
783
778 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
784 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
779 Prettified and hardened string/backslash quoting with ipsystem(),
785 Prettified and hardened string/backslash quoting with ipsystem(),
780 ipalias() and ipmagic(). Now even \ characters are passed to
786 ipalias() and ipmagic(). Now even \ characters are passed to
781 %magics, !shell escapes and aliases exactly as they are in the
787 %magics, !shell escapes and aliases exactly as they are in the
782 ipython command line. Should improve backslash experience,
788 ipython command line. Should improve backslash experience,
783 particularly in Windows (path delimiter for some commands that
789 particularly in Windows (path delimiter for some commands that
784 won't understand '/'), but Unix benefits as well (regexps). %cd
790 won't understand '/'), but Unix benefits as well (regexps). %cd
785 magic still doesn't support backslash path delimiters, though. Also
791 magic still doesn't support backslash path delimiters, though. Also
786 deleted all pretense of supporting multiline command strings in
792 deleted all pretense of supporting multiline command strings in
787 !system or %magic commands. Thanks to Jerry McRae for suggestions.
793 !system or %magic commands. Thanks to Jerry McRae for suggestions.
788
794
789 * doc/build_doc_instructions.txt added. Documentation on how to
795 * doc/build_doc_instructions.txt added. Documentation on how to
790 use doc/update_manual.py, added yesterday. Both files contributed
796 use doc/update_manual.py, added yesterday. Both files contributed
791 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
797 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
792 doc/*.sh for deprecation at a later date.
798 doc/*.sh for deprecation at a later date.
793
799
794 * /ipython.py Added ipython.py to root directory for
800 * /ipython.py Added ipython.py to root directory for
795 zero-installation (tar xzvf ipython.tgz; cd ipython; python
801 zero-installation (tar xzvf ipython.tgz; cd ipython; python
796 ipython.py) and development convenience (no need to keep doing
802 ipython.py) and development convenience (no need to keep doing
797 "setup.py install" between changes).
803 "setup.py install" between changes).
798
804
799 * Made ! and !! shell escapes work (again) in multiline expressions:
805 * Made ! and !! shell escapes work (again) in multiline expressions:
800 if 1:
806 if 1:
801 !ls
807 !ls
802 !!ls
808 !!ls
803
809
804 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
810 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
805
811
806 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
812 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
807 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
813 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
808 module in case-insensitive installation. Was causing crashes
814 module in case-insensitive installation. Was causing crashes
809 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
815 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
810
816
811 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
817 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
812 <marienz-AT-gentoo.org>, closes
818 <marienz-AT-gentoo.org>, closes
813 http://www.scipy.net/roundup/ipython/issue51.
819 http://www.scipy.net/roundup/ipython/issue51.
814
820
815 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
821 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
816
822
817 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
823 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
818 problem of excessive CPU usage under *nix and keyboard lag under
824 problem of excessive CPU usage under *nix and keyboard lag under
819 win32.
825 win32.
820
826
821 2006-01-10 *** Released version 0.7.0
827 2006-01-10 *** Released version 0.7.0
822
828
823 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
829 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
824
830
825 * IPython/Release.py (revision): tag version number to 0.7.0,
831 * IPython/Release.py (revision): tag version number to 0.7.0,
826 ready for release.
832 ready for release.
827
833
828 * IPython/Magic.py (magic_edit): Add print statement to %edit so
834 * IPython/Magic.py (magic_edit): Add print statement to %edit so
829 it informs the user of the name of the temp. file used. This can
835 it informs the user of the name of the temp. file used. This can
830 help if you decide later to reuse that same file, so you know
836 help if you decide later to reuse that same file, so you know
831 where to copy the info from.
837 where to copy the info from.
832
838
833 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
839 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
834
840
835 * setup_bdist_egg.py: little script to build an egg. Added
841 * setup_bdist_egg.py: little script to build an egg. Added
836 support in the release tools as well.
842 support in the release tools as well.
837
843
838 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
844 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
839
845
840 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
846 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
841 version selection (new -wxversion command line and ipythonrc
847 version selection (new -wxversion command line and ipythonrc
842 parameter). Patch contributed by Arnd Baecker
848 parameter). Patch contributed by Arnd Baecker
843 <arnd.baecker-AT-web.de>.
849 <arnd.baecker-AT-web.de>.
844
850
845 * IPython/iplib.py (embed_mainloop): fix tab-completion in
851 * IPython/iplib.py (embed_mainloop): fix tab-completion in
846 embedded instances, for variables defined at the interactive
852 embedded instances, for variables defined at the interactive
847 prompt of the embedded ipython. Reported by Arnd.
853 prompt of the embedded ipython. Reported by Arnd.
848
854
849 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
855 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
850 it can be used as a (stateful) toggle, or with a direct parameter.
856 it can be used as a (stateful) toggle, or with a direct parameter.
851
857
852 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
858 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
853 could be triggered in certain cases and cause the traceback
859 could be triggered in certain cases and cause the traceback
854 printer not to work.
860 printer not to work.
855
861
856 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
862 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
857
863
858 * IPython/iplib.py (_should_recompile): Small fix, closes
864 * IPython/iplib.py (_should_recompile): Small fix, closes
859 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
865 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
860
866
861 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
867 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
862
868
863 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
869 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
864 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
870 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
865 Moad for help with tracking it down.
871 Moad for help with tracking it down.
866
872
867 * IPython/iplib.py (handle_auto): fix autocall handling for
873 * IPython/iplib.py (handle_auto): fix autocall handling for
868 objects which support BOTH __getitem__ and __call__ (so that f [x]
874 objects which support BOTH __getitem__ and __call__ (so that f [x]
869 is left alone, instead of becoming f([x]) automatically).
875 is left alone, instead of becoming f([x]) automatically).
870
876
871 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
877 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
872 Ville's patch.
878 Ville's patch.
873
879
874 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
880 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
875
881
876 * IPython/iplib.py (handle_auto): changed autocall semantics to
882 * IPython/iplib.py (handle_auto): changed autocall semantics to
877 include 'smart' mode, where the autocall transformation is NOT
883 include 'smart' mode, where the autocall transformation is NOT
878 applied if there are no arguments on the line. This allows you to
884 applied if there are no arguments on the line. This allows you to
879 just type 'foo' if foo is a callable to see its internal form,
885 just type 'foo' if foo is a callable to see its internal form,
880 instead of having it called with no arguments (typically a
886 instead of having it called with no arguments (typically a
881 mistake). The old 'full' autocall still exists: for that, you
887 mistake). The old 'full' autocall still exists: for that, you
882 need to set the 'autocall' parameter to 2 in your ipythonrc file.
888 need to set the 'autocall' parameter to 2 in your ipythonrc file.
883
889
884 * IPython/completer.py (Completer.attr_matches): add
890 * IPython/completer.py (Completer.attr_matches): add
885 tab-completion support for Enthoughts' traits. After a report by
891 tab-completion support for Enthoughts' traits. After a report by
886 Arnd and a patch by Prabhu.
892 Arnd and a patch by Prabhu.
887
893
888 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
894 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
889
895
890 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
896 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
891 Schmolck's patch to fix inspect.getinnerframes().
897 Schmolck's patch to fix inspect.getinnerframes().
892
898
893 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
899 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
894 for embedded instances, regarding handling of namespaces and items
900 for embedded instances, regarding handling of namespaces and items
895 added to the __builtin__ one. Multiple embedded instances and
901 added to the __builtin__ one. Multiple embedded instances and
896 recursive embeddings should work better now (though I'm not sure
902 recursive embeddings should work better now (though I'm not sure
897 I've got all the corner cases fixed, that code is a bit of a brain
903 I've got all the corner cases fixed, that code is a bit of a brain
898 twister).
904 twister).
899
905
900 * IPython/Magic.py (magic_edit): added support to edit in-memory
906 * IPython/Magic.py (magic_edit): added support to edit in-memory
901 macros (automatically creates the necessary temp files). %edit
907 macros (automatically creates the necessary temp files). %edit
902 also doesn't return the file contents anymore, it's just noise.
908 also doesn't return the file contents anymore, it's just noise.
903
909
904 * IPython/completer.py (Completer.attr_matches): revert change to
910 * IPython/completer.py (Completer.attr_matches): revert change to
905 complete only on attributes listed in __all__. I realized it
911 complete only on attributes listed in __all__. I realized it
906 cripples the tab-completion system as a tool for exploring the
912 cripples the tab-completion system as a tool for exploring the
907 internals of unknown libraries (it renders any non-__all__
913 internals of unknown libraries (it renders any non-__all__
908 attribute off-limits). I got bit by this when trying to see
914 attribute off-limits). I got bit by this when trying to see
909 something inside the dis module.
915 something inside the dis module.
910
916
911 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
917 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
912
918
913 * IPython/iplib.py (InteractiveShell.__init__): add .meta
919 * IPython/iplib.py (InteractiveShell.__init__): add .meta
914 namespace for users and extension writers to hold data in. This
920 namespace for users and extension writers to hold data in. This
915 follows the discussion in
921 follows the discussion in
916 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
922 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
917
923
918 * IPython/completer.py (IPCompleter.complete): small patch to help
924 * IPython/completer.py (IPCompleter.complete): small patch to help
919 tab-completion under Emacs, after a suggestion by John Barnard
925 tab-completion under Emacs, after a suggestion by John Barnard
920 <barnarj-AT-ccf.org>.
926 <barnarj-AT-ccf.org>.
921
927
922 * IPython/Magic.py (Magic.extract_input_slices): added support for
928 * IPython/Magic.py (Magic.extract_input_slices): added support for
923 the slice notation in magics to use N-M to represent numbers N...M
929 the slice notation in magics to use N-M to represent numbers N...M
924 (closed endpoints). This is used by %macro and %save.
930 (closed endpoints). This is used by %macro and %save.
925
931
926 * IPython/completer.py (Completer.attr_matches): for modules which
932 * IPython/completer.py (Completer.attr_matches): for modules which
927 define __all__, complete only on those. After a patch by Jeffrey
933 define __all__, complete only on those. After a patch by Jeffrey
928 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
934 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
929 speed up this routine.
935 speed up this routine.
930
936
931 * IPython/Logger.py (Logger.log): fix a history handling bug. I
937 * IPython/Logger.py (Logger.log): fix a history handling bug. I
932 don't know if this is the end of it, but the behavior now is
938 don't know if this is the end of it, but the behavior now is
933 certainly much more correct. Note that coupled with macros,
939 certainly much more correct. Note that coupled with macros,
934 slightly surprising (at first) behavior may occur: a macro will in
940 slightly surprising (at first) behavior may occur: a macro will in
935 general expand to multiple lines of input, so upon exiting, the
941 general expand to multiple lines of input, so upon exiting, the
936 in/out counters will both be bumped by the corresponding amount
942 in/out counters will both be bumped by the corresponding amount
937 (as if the macro's contents had been typed interactively). Typing
943 (as if the macro's contents had been typed interactively). Typing
938 %hist will reveal the intermediate (silently processed) lines.
944 %hist will reveal the intermediate (silently processed) lines.
939
945
940 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
946 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
941 pickle to fail (%run was overwriting __main__ and not restoring
947 pickle to fail (%run was overwriting __main__ and not restoring
942 it, but pickle relies on __main__ to operate).
948 it, but pickle relies on __main__ to operate).
943
949
944 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
950 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
945 using properties, but forgot to make the main InteractiveShell
951 using properties, but forgot to make the main InteractiveShell
946 class a new-style class. Properties fail silently, and
952 class a new-style class. Properties fail silently, and
947 mysteriously, with old-style class (getters work, but
953 mysteriously, with old-style class (getters work, but
948 setters don't do anything).
954 setters don't do anything).
949
955
950 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
956 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
951
957
952 * IPython/Magic.py (magic_history): fix history reporting bug (I
958 * IPython/Magic.py (magic_history): fix history reporting bug (I
953 know some nasties are still there, I just can't seem to find a
959 know some nasties are still there, I just can't seem to find a
954 reproducible test case to track them down; the input history is
960 reproducible test case to track them down; the input history is
955 falling out of sync...)
961 falling out of sync...)
956
962
957 * IPython/iplib.py (handle_shell_escape): fix bug where both
963 * IPython/iplib.py (handle_shell_escape): fix bug where both
958 aliases and system accesses where broken for indented code (such
964 aliases and system accesses where broken for indented code (such
959 as loops).
965 as loops).
960
966
961 * IPython/genutils.py (shell): fix small but critical bug for
967 * IPython/genutils.py (shell): fix small but critical bug for
962 win32 system access.
968 win32 system access.
963
969
964 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
970 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
965
971
966 * IPython/iplib.py (showtraceback): remove use of the
972 * IPython/iplib.py (showtraceback): remove use of the
967 sys.last_{type/value/traceback} structures, which are non
973 sys.last_{type/value/traceback} structures, which are non
968 thread-safe.
974 thread-safe.
969 (_prefilter): change control flow to ensure that we NEVER
975 (_prefilter): change control flow to ensure that we NEVER
970 introspect objects when autocall is off. This will guarantee that
976 introspect objects when autocall is off. This will guarantee that
971 having an input line of the form 'x.y', where access to attribute
977 having an input line of the form 'x.y', where access to attribute
972 'y' has side effects, doesn't trigger the side effect TWICE. It
978 'y' has side effects, doesn't trigger the side effect TWICE. It
973 is important to note that, with autocall on, these side effects
979 is important to note that, with autocall on, these side effects
974 can still happen.
980 can still happen.
975 (ipsystem): new builtin, to complete the ip{magic/alias/system}
981 (ipsystem): new builtin, to complete the ip{magic/alias/system}
976 trio. IPython offers these three kinds of special calls which are
982 trio. IPython offers these three kinds of special calls which are
977 not python code, and it's a good thing to have their call method
983 not python code, and it's a good thing to have their call method
978 be accessible as pure python functions (not just special syntax at
984 be accessible as pure python functions (not just special syntax at
979 the command line). It gives us a better internal implementation
985 the command line). It gives us a better internal implementation
980 structure, as well as exposing these for user scripting more
986 structure, as well as exposing these for user scripting more
981 cleanly.
987 cleanly.
982
988
983 * IPython/macro.py (Macro.__init__): moved macros to a standalone
989 * IPython/macro.py (Macro.__init__): moved macros to a standalone
984 file. Now that they'll be more likely to be used with the
990 file. Now that they'll be more likely to be used with the
985 persistance system (%store), I want to make sure their module path
991 persistance system (%store), I want to make sure their module path
986 doesn't change in the future, so that we don't break things for
992 doesn't change in the future, so that we don't break things for
987 users' persisted data.
993 users' persisted data.
988
994
989 * IPython/iplib.py (autoindent_update): move indentation
995 * IPython/iplib.py (autoindent_update): move indentation
990 management into the _text_ processing loop, not the keyboard
996 management into the _text_ processing loop, not the keyboard
991 interactive one. This is necessary to correctly process non-typed
997 interactive one. This is necessary to correctly process non-typed
992 multiline input (such as macros).
998 multiline input (such as macros).
993
999
994 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1000 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
995 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1001 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
996 which was producing problems in the resulting manual.
1002 which was producing problems in the resulting manual.
997 (magic_whos): improve reporting of instances (show their class,
1003 (magic_whos): improve reporting of instances (show their class,
998 instead of simply printing 'instance' which isn't terribly
1004 instead of simply printing 'instance' which isn't terribly
999 informative).
1005 informative).
1000
1006
1001 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1007 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1002 (minor mods) to support network shares under win32.
1008 (minor mods) to support network shares under win32.
1003
1009
1004 * IPython/winconsole.py (get_console_size): add new winconsole
1010 * IPython/winconsole.py (get_console_size): add new winconsole
1005 module and fixes to page_dumb() to improve its behavior under
1011 module and fixes to page_dumb() to improve its behavior under
1006 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1012 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1007
1013
1008 * IPython/Magic.py (Macro): simplified Macro class to just
1014 * IPython/Magic.py (Macro): simplified Macro class to just
1009 subclass list. We've had only 2.2 compatibility for a very long
1015 subclass list. We've had only 2.2 compatibility for a very long
1010 time, yet I was still avoiding subclassing the builtin types. No
1016 time, yet I was still avoiding subclassing the builtin types. No
1011 more (I'm also starting to use properties, though I won't shift to
1017 more (I'm also starting to use properties, though I won't shift to
1012 2.3-specific features quite yet).
1018 2.3-specific features quite yet).
1013 (magic_store): added Ville's patch for lightweight variable
1019 (magic_store): added Ville's patch for lightweight variable
1014 persistence, after a request on the user list by Matt Wilkie
1020 persistence, after a request on the user list by Matt Wilkie
1015 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1021 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1016 details.
1022 details.
1017
1023
1018 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1024 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1019 changed the default logfile name from 'ipython.log' to
1025 changed the default logfile name from 'ipython.log' to
1020 'ipython_log.py'. These logs are real python files, and now that
1026 'ipython_log.py'. These logs are real python files, and now that
1021 we have much better multiline support, people are more likely to
1027 we have much better multiline support, people are more likely to
1022 want to use them as such. Might as well name them correctly.
1028 want to use them as such. Might as well name them correctly.
1023
1029
1024 * IPython/Magic.py: substantial cleanup. While we can't stop
1030 * IPython/Magic.py: substantial cleanup. While we can't stop
1025 using magics as mixins, due to the existing customizations 'out
1031 using magics as mixins, due to the existing customizations 'out
1026 there' which rely on the mixin naming conventions, at least I
1032 there' which rely on the mixin naming conventions, at least I
1027 cleaned out all cross-class name usage. So once we are OK with
1033 cleaned out all cross-class name usage. So once we are OK with
1028 breaking compatibility, the two systems can be separated.
1034 breaking compatibility, the two systems can be separated.
1029
1035
1030 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1036 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1031 anymore, and the class is a fair bit less hideous as well. New
1037 anymore, and the class is a fair bit less hideous as well. New
1032 features were also introduced: timestamping of input, and logging
1038 features were also introduced: timestamping of input, and logging
1033 of output results. These are user-visible with the -t and -o
1039 of output results. These are user-visible with the -t and -o
1034 options to %logstart. Closes
1040 options to %logstart. Closes
1035 http://www.scipy.net/roundup/ipython/issue11 and a request by
1041 http://www.scipy.net/roundup/ipython/issue11 and a request by
1036 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1042 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1037
1043
1038 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1044 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1039
1045
1040 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1046 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1041 better handle backslashes in paths. See the thread 'More Windows
1047 better handle backslashes in paths. See the thread 'More Windows
1042 questions part 2 - \/ characters revisited' on the iypthon user
1048 questions part 2 - \/ characters revisited' on the iypthon user
1043 list:
1049 list:
1044 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1050 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1045
1051
1046 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1052 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1047
1053
1048 (InteractiveShell.__init__): change threaded shells to not use the
1054 (InteractiveShell.__init__): change threaded shells to not use the
1049 ipython crash handler. This was causing more problems than not,
1055 ipython crash handler. This was causing more problems than not,
1050 as exceptions in the main thread (GUI code, typically) would
1056 as exceptions in the main thread (GUI code, typically) would
1051 always show up as a 'crash', when they really weren't.
1057 always show up as a 'crash', when they really weren't.
1052
1058
1053 The colors and exception mode commands (%colors/%xmode) have been
1059 The colors and exception mode commands (%colors/%xmode) have been
1054 synchronized to also take this into account, so users can get
1060 synchronized to also take this into account, so users can get
1055 verbose exceptions for their threaded code as well. I also added
1061 verbose exceptions for their threaded code as well. I also added
1056 support for activating pdb inside this exception handler as well,
1062 support for activating pdb inside this exception handler as well,
1057 so now GUI authors can use IPython's enhanced pdb at runtime.
1063 so now GUI authors can use IPython's enhanced pdb at runtime.
1058
1064
1059 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1065 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1060 true by default, and add it to the shipped ipythonrc file. Since
1066 true by default, and add it to the shipped ipythonrc file. Since
1061 this asks the user before proceeding, I think it's OK to make it
1067 this asks the user before proceeding, I think it's OK to make it
1062 true by default.
1068 true by default.
1063
1069
1064 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1070 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1065 of the previous special-casing of input in the eval loop. I think
1071 of the previous special-casing of input in the eval loop. I think
1066 this is cleaner, as they really are commands and shouldn't have
1072 this is cleaner, as they really are commands and shouldn't have
1067 a special role in the middle of the core code.
1073 a special role in the middle of the core code.
1068
1074
1069 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1075 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1070
1076
1071 * IPython/iplib.py (edit_syntax_error): added support for
1077 * IPython/iplib.py (edit_syntax_error): added support for
1072 automatically reopening the editor if the file had a syntax error
1078 automatically reopening the editor if the file had a syntax error
1073 in it. Thanks to scottt who provided the patch at:
1079 in it. Thanks to scottt who provided the patch at:
1074 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1080 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1075 version committed).
1081 version committed).
1076
1082
1077 * IPython/iplib.py (handle_normal): add suport for multi-line
1083 * IPython/iplib.py (handle_normal): add suport for multi-line
1078 input with emtpy lines. This fixes
1084 input with emtpy lines. This fixes
1079 http://www.scipy.net/roundup/ipython/issue43 and a similar
1085 http://www.scipy.net/roundup/ipython/issue43 and a similar
1080 discussion on the user list.
1086 discussion on the user list.
1081
1087
1082 WARNING: a behavior change is necessarily introduced to support
1088 WARNING: a behavior change is necessarily introduced to support
1083 blank lines: now a single blank line with whitespace does NOT
1089 blank lines: now a single blank line with whitespace does NOT
1084 break the input loop, which means that when autoindent is on, by
1090 break the input loop, which means that when autoindent is on, by
1085 default hitting return on the next (indented) line does NOT exit.
1091 default hitting return on the next (indented) line does NOT exit.
1086
1092
1087 Instead, to exit a multiline input you can either have:
1093 Instead, to exit a multiline input you can either have:
1088
1094
1089 - TWO whitespace lines (just hit return again), or
1095 - TWO whitespace lines (just hit return again), or
1090 - a single whitespace line of a different length than provided
1096 - a single whitespace line of a different length than provided
1091 by the autoindent (add or remove a space).
1097 by the autoindent (add or remove a space).
1092
1098
1093 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1099 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1094 module to better organize all readline-related functionality.
1100 module to better organize all readline-related functionality.
1095 I've deleted FlexCompleter and put all completion clases here.
1101 I've deleted FlexCompleter and put all completion clases here.
1096
1102
1097 * IPython/iplib.py (raw_input): improve indentation management.
1103 * IPython/iplib.py (raw_input): improve indentation management.
1098 It is now possible to paste indented code with autoindent on, and
1104 It is now possible to paste indented code with autoindent on, and
1099 the code is interpreted correctly (though it still looks bad on
1105 the code is interpreted correctly (though it still looks bad on
1100 screen, due to the line-oriented nature of ipython).
1106 screen, due to the line-oriented nature of ipython).
1101 (MagicCompleter.complete): change behavior so that a TAB key on an
1107 (MagicCompleter.complete): change behavior so that a TAB key on an
1102 otherwise empty line actually inserts a tab, instead of completing
1108 otherwise empty line actually inserts a tab, instead of completing
1103 on the entire global namespace. This makes it easier to use the
1109 on the entire global namespace. This makes it easier to use the
1104 TAB key for indentation. After a request by Hans Meine
1110 TAB key for indentation. After a request by Hans Meine
1105 <hans_meine-AT-gmx.net>
1111 <hans_meine-AT-gmx.net>
1106 (_prefilter): add support so that typing plain 'exit' or 'quit'
1112 (_prefilter): add support so that typing plain 'exit' or 'quit'
1107 does a sensible thing. Originally I tried to deviate as little as
1113 does a sensible thing. Originally I tried to deviate as little as
1108 possible from the default python behavior, but even that one may
1114 possible from the default python behavior, but even that one may
1109 change in this direction (thread on python-dev to that effect).
1115 change in this direction (thread on python-dev to that effect).
1110 Regardless, ipython should do the right thing even if CPython's
1116 Regardless, ipython should do the right thing even if CPython's
1111 '>>>' prompt doesn't.
1117 '>>>' prompt doesn't.
1112 (InteractiveShell): removed subclassing code.InteractiveConsole
1118 (InteractiveShell): removed subclassing code.InteractiveConsole
1113 class. By now we'd overridden just about all of its methods: I've
1119 class. By now we'd overridden just about all of its methods: I've
1114 copied the remaining two over, and now ipython is a standalone
1120 copied the remaining two over, and now ipython is a standalone
1115 class. This will provide a clearer picture for the chainsaw
1121 class. This will provide a clearer picture for the chainsaw
1116 branch refactoring.
1122 branch refactoring.
1117
1123
1118 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1124 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1119
1125
1120 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1126 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1121 failures for objects which break when dir() is called on them.
1127 failures for objects which break when dir() is called on them.
1122
1128
1123 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1129 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1124 distinct local and global namespaces in the completer API. This
1130 distinct local and global namespaces in the completer API. This
1125 change allows us to properly handle completion with distinct
1131 change allows us to properly handle completion with distinct
1126 scopes, including in embedded instances (this had never really
1132 scopes, including in embedded instances (this had never really
1127 worked correctly).
1133 worked correctly).
1128
1134
1129 Note: this introduces a change in the constructor for
1135 Note: this introduces a change in the constructor for
1130 MagicCompleter, as a new global_namespace parameter is now the
1136 MagicCompleter, as a new global_namespace parameter is now the
1131 second argument (the others were bumped one position).
1137 second argument (the others were bumped one position).
1132
1138
1133 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1139 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1134
1140
1135 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1141 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1136 embedded instances (which can be done now thanks to Vivian's
1142 embedded instances (which can be done now thanks to Vivian's
1137 frame-handling fixes for pdb).
1143 frame-handling fixes for pdb).
1138 (InteractiveShell.__init__): Fix namespace handling problem in
1144 (InteractiveShell.__init__): Fix namespace handling problem in
1139 embedded instances. We were overwriting __main__ unconditionally,
1145 embedded instances. We were overwriting __main__ unconditionally,
1140 and this should only be done for 'full' (non-embedded) IPython;
1146 and this should only be done for 'full' (non-embedded) IPython;
1141 embedded instances must respect the caller's __main__. Thanks to
1147 embedded instances must respect the caller's __main__. Thanks to
1142 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1148 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1143
1149
1144 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1150 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1145
1151
1146 * setup.py: added download_url to setup(). This registers the
1152 * setup.py: added download_url to setup(). This registers the
1147 download address at PyPI, which is not only useful to humans
1153 download address at PyPI, which is not only useful to humans
1148 browsing the site, but is also picked up by setuptools (the Eggs
1154 browsing the site, but is also picked up by setuptools (the Eggs
1149 machinery). Thanks to Ville and R. Kern for the info/discussion
1155 machinery). Thanks to Ville and R. Kern for the info/discussion
1150 on this.
1156 on this.
1151
1157
1152 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1158 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1153
1159
1154 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1160 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1155 This brings a lot of nice functionality to the pdb mode, which now
1161 This brings a lot of nice functionality to the pdb mode, which now
1156 has tab-completion, syntax highlighting, and better stack handling
1162 has tab-completion, syntax highlighting, and better stack handling
1157 than before. Many thanks to Vivian De Smedt
1163 than before. Many thanks to Vivian De Smedt
1158 <vivian-AT-vdesmedt.com> for the original patches.
1164 <vivian-AT-vdesmedt.com> for the original patches.
1159
1165
1160 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1166 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1161
1167
1162 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1168 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1163 sequence to consistently accept the banner argument. The
1169 sequence to consistently accept the banner argument. The
1164 inconsistency was tripping SAGE, thanks to Gary Zablackis
1170 inconsistency was tripping SAGE, thanks to Gary Zablackis
1165 <gzabl-AT-yahoo.com> for the report.
1171 <gzabl-AT-yahoo.com> for the report.
1166
1172
1167 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1173 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1168
1174
1169 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1175 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1170 Fix bug where a naked 'alias' call in the ipythonrc file would
1176 Fix bug where a naked 'alias' call in the ipythonrc file would
1171 cause a crash. Bug reported by Jorgen Stenarson.
1177 cause a crash. Bug reported by Jorgen Stenarson.
1172
1178
1173 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1179 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1174
1180
1175 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1181 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1176 startup time.
1182 startup time.
1177
1183
1178 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1184 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1179 instances had introduced a bug with globals in normal code. Now
1185 instances had introduced a bug with globals in normal code. Now
1180 it's working in all cases.
1186 it's working in all cases.
1181
1187
1182 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1188 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1183 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1189 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1184 has been introduced to set the default case sensitivity of the
1190 has been introduced to set the default case sensitivity of the
1185 searches. Users can still select either mode at runtime on a
1191 searches. Users can still select either mode at runtime on a
1186 per-search basis.
1192 per-search basis.
1187
1193
1188 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1194 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1189
1195
1190 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1196 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1191 attributes in wildcard searches for subclasses. Modified version
1197 attributes in wildcard searches for subclasses. Modified version
1192 of a patch by Jorgen.
1198 of a patch by Jorgen.
1193
1199
1194 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1200 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1195
1201
1196 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1202 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1197 embedded instances. I added a user_global_ns attribute to the
1203 embedded instances. I added a user_global_ns attribute to the
1198 InteractiveShell class to handle this.
1204 InteractiveShell class to handle this.
1199
1205
1200 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1206 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1201
1207
1202 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1208 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1203 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1209 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1204 (reported under win32, but may happen also in other platforms).
1210 (reported under win32, but may happen also in other platforms).
1205 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1211 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1206
1212
1207 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1213 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1208
1214
1209 * IPython/Magic.py (magic_psearch): new support for wildcard
1215 * IPython/Magic.py (magic_psearch): new support for wildcard
1210 patterns. Now, typing ?a*b will list all names which begin with a
1216 patterns. Now, typing ?a*b will list all names which begin with a
1211 and end in b, for example. The %psearch magic has full
1217 and end in b, for example. The %psearch magic has full
1212 docstrings. Many thanks to JΓΆrgen Stenarson
1218 docstrings. Many thanks to JΓΆrgen Stenarson
1213 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1219 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1214 implementing this functionality.
1220 implementing this functionality.
1215
1221
1216 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1222 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1217
1223
1218 * Manual: fixed long-standing annoyance of double-dashes (as in
1224 * Manual: fixed long-standing annoyance of double-dashes (as in
1219 --prefix=~, for example) being stripped in the HTML version. This
1225 --prefix=~, for example) being stripped in the HTML version. This
1220 is a latex2html bug, but a workaround was provided. Many thanks
1226 is a latex2html bug, but a workaround was provided. Many thanks
1221 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1227 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1222 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1228 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1223 rolling. This seemingly small issue had tripped a number of users
1229 rolling. This seemingly small issue had tripped a number of users
1224 when first installing, so I'm glad to see it gone.
1230 when first installing, so I'm glad to see it gone.
1225
1231
1226 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1232 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1227
1233
1228 * IPython/Extensions/numeric_formats.py: fix missing import,
1234 * IPython/Extensions/numeric_formats.py: fix missing import,
1229 reported by Stephen Walton.
1235 reported by Stephen Walton.
1230
1236
1231 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1237 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1232
1238
1233 * IPython/demo.py: finish demo module, fully documented now.
1239 * IPython/demo.py: finish demo module, fully documented now.
1234
1240
1235 * IPython/genutils.py (file_read): simple little utility to read a
1241 * IPython/genutils.py (file_read): simple little utility to read a
1236 file and ensure it's closed afterwards.
1242 file and ensure it's closed afterwards.
1237
1243
1238 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1244 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1239
1245
1240 * IPython/demo.py (Demo.__init__): added support for individually
1246 * IPython/demo.py (Demo.__init__): added support for individually
1241 tagging blocks for automatic execution.
1247 tagging blocks for automatic execution.
1242
1248
1243 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1249 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1244 syntax-highlighted python sources, requested by John.
1250 syntax-highlighted python sources, requested by John.
1245
1251
1246 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1252 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1247
1253
1248 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1254 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1249 finishing.
1255 finishing.
1250
1256
1251 * IPython/genutils.py (shlex_split): moved from Magic to here,
1257 * IPython/genutils.py (shlex_split): moved from Magic to here,
1252 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1258 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1253
1259
1254 * IPython/demo.py (Demo.__init__): added support for silent
1260 * IPython/demo.py (Demo.__init__): added support for silent
1255 blocks, improved marks as regexps, docstrings written.
1261 blocks, improved marks as regexps, docstrings written.
1256 (Demo.__init__): better docstring, added support for sys.argv.
1262 (Demo.__init__): better docstring, added support for sys.argv.
1257
1263
1258 * IPython/genutils.py (marquee): little utility used by the demo
1264 * IPython/genutils.py (marquee): little utility used by the demo
1259 code, handy in general.
1265 code, handy in general.
1260
1266
1261 * IPython/demo.py (Demo.__init__): new class for interactive
1267 * IPython/demo.py (Demo.__init__): new class for interactive
1262 demos. Not documented yet, I just wrote it in a hurry for
1268 demos. Not documented yet, I just wrote it in a hurry for
1263 scipy'05. Will docstring later.
1269 scipy'05. Will docstring later.
1264
1270
1265 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1271 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1266
1272
1267 * IPython/Shell.py (sigint_handler): Drastic simplification which
1273 * IPython/Shell.py (sigint_handler): Drastic simplification which
1268 also seems to make Ctrl-C work correctly across threads! This is
1274 also seems to make Ctrl-C work correctly across threads! This is
1269 so simple, that I can't beleive I'd missed it before. Needs more
1275 so simple, that I can't beleive I'd missed it before. Needs more
1270 testing, though.
1276 testing, though.
1271 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1277 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1272 like this before...
1278 like this before...
1273
1279
1274 * IPython/genutils.py (get_home_dir): add protection against
1280 * IPython/genutils.py (get_home_dir): add protection against
1275 non-dirs in win32 registry.
1281 non-dirs in win32 registry.
1276
1282
1277 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1283 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1278 bug where dict was mutated while iterating (pysh crash).
1284 bug where dict was mutated while iterating (pysh crash).
1279
1285
1280 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1286 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1281
1287
1282 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1288 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1283 spurious newlines added by this routine. After a report by
1289 spurious newlines added by this routine. After a report by
1284 F. Mantegazza.
1290 F. Mantegazza.
1285
1291
1286 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1292 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1287
1293
1288 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1294 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1289 calls. These were a leftover from the GTK 1.x days, and can cause
1295 calls. These were a leftover from the GTK 1.x days, and can cause
1290 problems in certain cases (after a report by John Hunter).
1296 problems in certain cases (after a report by John Hunter).
1291
1297
1292 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1298 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1293 os.getcwd() fails at init time. Thanks to patch from David Remahl
1299 os.getcwd() fails at init time. Thanks to patch from David Remahl
1294 <chmod007-AT-mac.com>.
1300 <chmod007-AT-mac.com>.
1295 (InteractiveShell.__init__): prevent certain special magics from
1301 (InteractiveShell.__init__): prevent certain special magics from
1296 being shadowed by aliases. Closes
1302 being shadowed by aliases. Closes
1297 http://www.scipy.net/roundup/ipython/issue41.
1303 http://www.scipy.net/roundup/ipython/issue41.
1298
1304
1299 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1305 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1300
1306
1301 * IPython/iplib.py (InteractiveShell.complete): Added new
1307 * IPython/iplib.py (InteractiveShell.complete): Added new
1302 top-level completion method to expose the completion mechanism
1308 top-level completion method to expose the completion mechanism
1303 beyond readline-based environments.
1309 beyond readline-based environments.
1304
1310
1305 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1311 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1306
1312
1307 * tools/ipsvnc (svnversion): fix svnversion capture.
1313 * tools/ipsvnc (svnversion): fix svnversion capture.
1308
1314
1309 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1315 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1310 attribute to self, which was missing. Before, it was set by a
1316 attribute to self, which was missing. Before, it was set by a
1311 routine which in certain cases wasn't being called, so the
1317 routine which in certain cases wasn't being called, so the
1312 instance could end up missing the attribute. This caused a crash.
1318 instance could end up missing the attribute. This caused a crash.
1313 Closes http://www.scipy.net/roundup/ipython/issue40.
1319 Closes http://www.scipy.net/roundup/ipython/issue40.
1314
1320
1315 2005-08-16 Fernando Perez <fperez@colorado.edu>
1321 2005-08-16 Fernando Perez <fperez@colorado.edu>
1316
1322
1317 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1323 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1318 contains non-string attribute. Closes
1324 contains non-string attribute. Closes
1319 http://www.scipy.net/roundup/ipython/issue38.
1325 http://www.scipy.net/roundup/ipython/issue38.
1320
1326
1321 2005-08-14 Fernando Perez <fperez@colorado.edu>
1327 2005-08-14 Fernando Perez <fperez@colorado.edu>
1322
1328
1323 * tools/ipsvnc: Minor improvements, to add changeset info.
1329 * tools/ipsvnc: Minor improvements, to add changeset info.
1324
1330
1325 2005-08-12 Fernando Perez <fperez@colorado.edu>
1331 2005-08-12 Fernando Perez <fperez@colorado.edu>
1326
1332
1327 * IPython/iplib.py (runsource): remove self.code_to_run_src
1333 * IPython/iplib.py (runsource): remove self.code_to_run_src
1328 attribute. I realized this is nothing more than
1334 attribute. I realized this is nothing more than
1329 '\n'.join(self.buffer), and having the same data in two different
1335 '\n'.join(self.buffer), and having the same data in two different
1330 places is just asking for synchronization bugs. This may impact
1336 places is just asking for synchronization bugs. This may impact
1331 people who have custom exception handlers, so I need to warn
1337 people who have custom exception handlers, so I need to warn
1332 ipython-dev about it (F. Mantegazza may use them).
1338 ipython-dev about it (F. Mantegazza may use them).
1333
1339
1334 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1340 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1335
1341
1336 * IPython/genutils.py: fix 2.2 compatibility (generators)
1342 * IPython/genutils.py: fix 2.2 compatibility (generators)
1337
1343
1338 2005-07-18 Fernando Perez <fperez@colorado.edu>
1344 2005-07-18 Fernando Perez <fperez@colorado.edu>
1339
1345
1340 * IPython/genutils.py (get_home_dir): fix to help users with
1346 * IPython/genutils.py (get_home_dir): fix to help users with
1341 invalid $HOME under win32.
1347 invalid $HOME under win32.
1342
1348
1343 2005-07-17 Fernando Perez <fperez@colorado.edu>
1349 2005-07-17 Fernando Perez <fperez@colorado.edu>
1344
1350
1345 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1351 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1346 some old hacks and clean up a bit other routines; code should be
1352 some old hacks and clean up a bit other routines; code should be
1347 simpler and a bit faster.
1353 simpler and a bit faster.
1348
1354
1349 * IPython/iplib.py (interact): removed some last-resort attempts
1355 * IPython/iplib.py (interact): removed some last-resort attempts
1350 to survive broken stdout/stderr. That code was only making it
1356 to survive broken stdout/stderr. That code was only making it
1351 harder to abstract out the i/o (necessary for gui integration),
1357 harder to abstract out the i/o (necessary for gui integration),
1352 and the crashes it could prevent were extremely rare in practice
1358 and the crashes it could prevent were extremely rare in practice
1353 (besides being fully user-induced in a pretty violent manner).
1359 (besides being fully user-induced in a pretty violent manner).
1354
1360
1355 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1361 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1356 Nothing major yet, but the code is simpler to read; this should
1362 Nothing major yet, but the code is simpler to read; this should
1357 make it easier to do more serious modifications in the future.
1363 make it easier to do more serious modifications in the future.
1358
1364
1359 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1365 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1360 which broke in .15 (thanks to a report by Ville).
1366 which broke in .15 (thanks to a report by Ville).
1361
1367
1362 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1368 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1363 be quite correct, I know next to nothing about unicode). This
1369 be quite correct, I know next to nothing about unicode). This
1364 will allow unicode strings to be used in prompts, amongst other
1370 will allow unicode strings to be used in prompts, amongst other
1365 cases. It also will prevent ipython from crashing when unicode
1371 cases. It also will prevent ipython from crashing when unicode
1366 shows up unexpectedly in many places. If ascii encoding fails, we
1372 shows up unexpectedly in many places. If ascii encoding fails, we
1367 assume utf_8. Currently the encoding is not a user-visible
1373 assume utf_8. Currently the encoding is not a user-visible
1368 setting, though it could be made so if there is demand for it.
1374 setting, though it could be made so if there is demand for it.
1369
1375
1370 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1376 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1371
1377
1372 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1378 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1373
1379
1374 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1380 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1375
1381
1376 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1382 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1377 code can work transparently for 2.2/2.3.
1383 code can work transparently for 2.2/2.3.
1378
1384
1379 2005-07-16 Fernando Perez <fperez@colorado.edu>
1385 2005-07-16 Fernando Perez <fperez@colorado.edu>
1380
1386
1381 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1387 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1382 out of the color scheme table used for coloring exception
1388 out of the color scheme table used for coloring exception
1383 tracebacks. This allows user code to add new schemes at runtime.
1389 tracebacks. This allows user code to add new schemes at runtime.
1384 This is a minimally modified version of the patch at
1390 This is a minimally modified version of the patch at
1385 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1391 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1386 for the contribution.
1392 for the contribution.
1387
1393
1388 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1394 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1389 slightly modified version of the patch in
1395 slightly modified version of the patch in
1390 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1396 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1391 to remove the previous try/except solution (which was costlier).
1397 to remove the previous try/except solution (which was costlier).
1392 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1398 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1393
1399
1394 2005-06-08 Fernando Perez <fperez@colorado.edu>
1400 2005-06-08 Fernando Perez <fperez@colorado.edu>
1395
1401
1396 * IPython/iplib.py (write/write_err): Add methods to abstract all
1402 * IPython/iplib.py (write/write_err): Add methods to abstract all
1397 I/O a bit more.
1403 I/O a bit more.
1398
1404
1399 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1405 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1400 warning, reported by Aric Hagberg, fix by JD Hunter.
1406 warning, reported by Aric Hagberg, fix by JD Hunter.
1401
1407
1402 2005-06-02 *** Released version 0.6.15
1408 2005-06-02 *** Released version 0.6.15
1403
1409
1404 2005-06-01 Fernando Perez <fperez@colorado.edu>
1410 2005-06-01 Fernando Perez <fperez@colorado.edu>
1405
1411
1406 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1412 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1407 tab-completion of filenames within open-quoted strings. Note that
1413 tab-completion of filenames within open-quoted strings. Note that
1408 this requires that in ~/.ipython/ipythonrc, users change the
1414 this requires that in ~/.ipython/ipythonrc, users change the
1409 readline delimiters configuration to read:
1415 readline delimiters configuration to read:
1410
1416
1411 readline_remove_delims -/~
1417 readline_remove_delims -/~
1412
1418
1413
1419
1414 2005-05-31 *** Released version 0.6.14
1420 2005-05-31 *** Released version 0.6.14
1415
1421
1416 2005-05-29 Fernando Perez <fperez@colorado.edu>
1422 2005-05-29 Fernando Perez <fperez@colorado.edu>
1417
1423
1418 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1424 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1419 with files not on the filesystem. Reported by Eliyahu Sandler
1425 with files not on the filesystem. Reported by Eliyahu Sandler
1420 <eli@gondolin.net>
1426 <eli@gondolin.net>
1421
1427
1422 2005-05-22 Fernando Perez <fperez@colorado.edu>
1428 2005-05-22 Fernando Perez <fperez@colorado.edu>
1423
1429
1424 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1430 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1425 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1431 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1426
1432
1427 2005-05-19 Fernando Perez <fperez@colorado.edu>
1433 2005-05-19 Fernando Perez <fperez@colorado.edu>
1428
1434
1429 * IPython/iplib.py (safe_execfile): close a file which could be
1435 * IPython/iplib.py (safe_execfile): close a file which could be
1430 left open (causing problems in win32, which locks open files).
1436 left open (causing problems in win32, which locks open files).
1431 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1437 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1432
1438
1433 2005-05-18 Fernando Perez <fperez@colorado.edu>
1439 2005-05-18 Fernando Perez <fperez@colorado.edu>
1434
1440
1435 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1441 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1436 keyword arguments correctly to safe_execfile().
1442 keyword arguments correctly to safe_execfile().
1437
1443
1438 2005-05-13 Fernando Perez <fperez@colorado.edu>
1444 2005-05-13 Fernando Perez <fperez@colorado.edu>
1439
1445
1440 * ipython.1: Added info about Qt to manpage, and threads warning
1446 * ipython.1: Added info about Qt to manpage, and threads warning
1441 to usage page (invoked with --help).
1447 to usage page (invoked with --help).
1442
1448
1443 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1449 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1444 new matcher (it goes at the end of the priority list) to do
1450 new matcher (it goes at the end of the priority list) to do
1445 tab-completion on named function arguments. Submitted by George
1451 tab-completion on named function arguments. Submitted by George
1446 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1452 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1447 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1453 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1448 for more details.
1454 for more details.
1449
1455
1450 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1456 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1451 SystemExit exceptions in the script being run. Thanks to a report
1457 SystemExit exceptions in the script being run. Thanks to a report
1452 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1458 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1453 producing very annoying behavior when running unit tests.
1459 producing very annoying behavior when running unit tests.
1454
1460
1455 2005-05-12 Fernando Perez <fperez@colorado.edu>
1461 2005-05-12 Fernando Perez <fperez@colorado.edu>
1456
1462
1457 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1463 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1458 which I'd broken (again) due to a changed regexp. In the process,
1464 which I'd broken (again) due to a changed regexp. In the process,
1459 added ';' as an escape to auto-quote the whole line without
1465 added ';' as an escape to auto-quote the whole line without
1460 splitting its arguments. Thanks to a report by Jerry McRae
1466 splitting its arguments. Thanks to a report by Jerry McRae
1461 <qrs0xyc02-AT-sneakemail.com>.
1467 <qrs0xyc02-AT-sneakemail.com>.
1462
1468
1463 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1469 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1464 possible crashes caused by a TokenError. Reported by Ed Schofield
1470 possible crashes caused by a TokenError. Reported by Ed Schofield
1465 <schofield-AT-ftw.at>.
1471 <schofield-AT-ftw.at>.
1466
1472
1467 2005-05-06 Fernando Perez <fperez@colorado.edu>
1473 2005-05-06 Fernando Perez <fperez@colorado.edu>
1468
1474
1469 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1475 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1470
1476
1471 2005-04-29 Fernando Perez <fperez@colorado.edu>
1477 2005-04-29 Fernando Perez <fperez@colorado.edu>
1472
1478
1473 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1479 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1474 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1480 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1475 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1481 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1476 which provides support for Qt interactive usage (similar to the
1482 which provides support for Qt interactive usage (similar to the
1477 existing one for WX and GTK). This had been often requested.
1483 existing one for WX and GTK). This had been often requested.
1478
1484
1479 2005-04-14 *** Released version 0.6.13
1485 2005-04-14 *** Released version 0.6.13
1480
1486
1481 2005-04-08 Fernando Perez <fperez@colorado.edu>
1487 2005-04-08 Fernando Perez <fperez@colorado.edu>
1482
1488
1483 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1489 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1484 from _ofind, which gets called on almost every input line. Now,
1490 from _ofind, which gets called on almost every input line. Now,
1485 we only try to get docstrings if they are actually going to be
1491 we only try to get docstrings if they are actually going to be
1486 used (the overhead of fetching unnecessary docstrings can be
1492 used (the overhead of fetching unnecessary docstrings can be
1487 noticeable for certain objects, such as Pyro proxies).
1493 noticeable for certain objects, such as Pyro proxies).
1488
1494
1489 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1495 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1490 for completers. For some reason I had been passing them the state
1496 for completers. For some reason I had been passing them the state
1491 variable, which completers never actually need, and was in
1497 variable, which completers never actually need, and was in
1492 conflict with the rlcompleter API. Custom completers ONLY need to
1498 conflict with the rlcompleter API. Custom completers ONLY need to
1493 take the text parameter.
1499 take the text parameter.
1494
1500
1495 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1501 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1496 work correctly in pysh. I've also moved all the logic which used
1502 work correctly in pysh. I've also moved all the logic which used
1497 to be in pysh.py here, which will prevent problems with future
1503 to be in pysh.py here, which will prevent problems with future
1498 upgrades. However, this time I must warn users to update their
1504 upgrades. However, this time I must warn users to update their
1499 pysh profile to include the line
1505 pysh profile to include the line
1500
1506
1501 import_all IPython.Extensions.InterpreterExec
1507 import_all IPython.Extensions.InterpreterExec
1502
1508
1503 because otherwise things won't work for them. They MUST also
1509 because otherwise things won't work for them. They MUST also
1504 delete pysh.py and the line
1510 delete pysh.py and the line
1505
1511
1506 execfile pysh.py
1512 execfile pysh.py
1507
1513
1508 from their ipythonrc-pysh.
1514 from their ipythonrc-pysh.
1509
1515
1510 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1516 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1511 robust in the face of objects whose dir() returns non-strings
1517 robust in the face of objects whose dir() returns non-strings
1512 (which it shouldn't, but some broken libs like ITK do). Thanks to
1518 (which it shouldn't, but some broken libs like ITK do). Thanks to
1513 a patch by John Hunter (implemented differently, though). Also
1519 a patch by John Hunter (implemented differently, though). Also
1514 minor improvements by using .extend instead of + on lists.
1520 minor improvements by using .extend instead of + on lists.
1515
1521
1516 * pysh.py:
1522 * pysh.py:
1517
1523
1518 2005-04-06 Fernando Perez <fperez@colorado.edu>
1524 2005-04-06 Fernando Perez <fperez@colorado.edu>
1519
1525
1520 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1526 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1521 by default, so that all users benefit from it. Those who don't
1527 by default, so that all users benefit from it. Those who don't
1522 want it can still turn it off.
1528 want it can still turn it off.
1523
1529
1524 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1530 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1525 config file, I'd forgotten about this, so users were getting it
1531 config file, I'd forgotten about this, so users were getting it
1526 off by default.
1532 off by default.
1527
1533
1528 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1534 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1529 consistency. Now magics can be called in multiline statements,
1535 consistency. Now magics can be called in multiline statements,
1530 and python variables can be expanded in magic calls via $var.
1536 and python variables can be expanded in magic calls via $var.
1531 This makes the magic system behave just like aliases or !system
1537 This makes the magic system behave just like aliases or !system
1532 calls.
1538 calls.
1533
1539
1534 2005-03-28 Fernando Perez <fperez@colorado.edu>
1540 2005-03-28 Fernando Perez <fperez@colorado.edu>
1535
1541
1536 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1542 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1537 expensive string additions for building command. Add support for
1543 expensive string additions for building command. Add support for
1538 trailing ';' when autocall is used.
1544 trailing ';' when autocall is used.
1539
1545
1540 2005-03-26 Fernando Perez <fperez@colorado.edu>
1546 2005-03-26 Fernando Perez <fperez@colorado.edu>
1541
1547
1542 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1548 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1543 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1549 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1544 ipython.el robust against prompts with any number of spaces
1550 ipython.el robust against prompts with any number of spaces
1545 (including 0) after the ':' character.
1551 (including 0) after the ':' character.
1546
1552
1547 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1553 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1548 continuation prompt, which misled users to think the line was
1554 continuation prompt, which misled users to think the line was
1549 already indented. Closes debian Bug#300847, reported to me by
1555 already indented. Closes debian Bug#300847, reported to me by
1550 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1556 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1551
1557
1552 2005-03-23 Fernando Perez <fperez@colorado.edu>
1558 2005-03-23 Fernando Perez <fperez@colorado.edu>
1553
1559
1554 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1560 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1555 properly aligned if they have embedded newlines.
1561 properly aligned if they have embedded newlines.
1556
1562
1557 * IPython/iplib.py (runlines): Add a public method to expose
1563 * IPython/iplib.py (runlines): Add a public method to expose
1558 IPython's code execution machinery, so that users can run strings
1564 IPython's code execution machinery, so that users can run strings
1559 as if they had been typed at the prompt interactively.
1565 as if they had been typed at the prompt interactively.
1560 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1566 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1561 methods which can call the system shell, but with python variable
1567 methods which can call the system shell, but with python variable
1562 expansion. The three such methods are: __IPYTHON__.system,
1568 expansion. The three such methods are: __IPYTHON__.system,
1563 .getoutput and .getoutputerror. These need to be documented in a
1569 .getoutput and .getoutputerror. These need to be documented in a
1564 'public API' section (to be written) of the manual.
1570 'public API' section (to be written) of the manual.
1565
1571
1566 2005-03-20 Fernando Perez <fperez@colorado.edu>
1572 2005-03-20 Fernando Perez <fperez@colorado.edu>
1567
1573
1568 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1574 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1569 for custom exception handling. This is quite powerful, and it
1575 for custom exception handling. This is quite powerful, and it
1570 allows for user-installable exception handlers which can trap
1576 allows for user-installable exception handlers which can trap
1571 custom exceptions at runtime and treat them separately from
1577 custom exceptions at runtime and treat them separately from
1572 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1578 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1573 Mantegazza <mantegazza-AT-ill.fr>.
1579 Mantegazza <mantegazza-AT-ill.fr>.
1574 (InteractiveShell.set_custom_completer): public API function to
1580 (InteractiveShell.set_custom_completer): public API function to
1575 add new completers at runtime.
1581 add new completers at runtime.
1576
1582
1577 2005-03-19 Fernando Perez <fperez@colorado.edu>
1583 2005-03-19 Fernando Perez <fperez@colorado.edu>
1578
1584
1579 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1585 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1580 allow objects which provide their docstrings via non-standard
1586 allow objects which provide their docstrings via non-standard
1581 mechanisms (like Pyro proxies) to still be inspected by ipython's
1587 mechanisms (like Pyro proxies) to still be inspected by ipython's
1582 ? system.
1588 ? system.
1583
1589
1584 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1590 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1585 automatic capture system. I tried quite hard to make it work
1591 automatic capture system. I tried quite hard to make it work
1586 reliably, and simply failed. I tried many combinations with the
1592 reliably, and simply failed. I tried many combinations with the
1587 subprocess module, but eventually nothing worked in all needed
1593 subprocess module, but eventually nothing worked in all needed
1588 cases (not blocking stdin for the child, duplicating stdout
1594 cases (not blocking stdin for the child, duplicating stdout
1589 without blocking, etc). The new %sc/%sx still do capture to these
1595 without blocking, etc). The new %sc/%sx still do capture to these
1590 magical list/string objects which make shell use much more
1596 magical list/string objects which make shell use much more
1591 conveninent, so not all is lost.
1597 conveninent, so not all is lost.
1592
1598
1593 XXX - FIX MANUAL for the change above!
1599 XXX - FIX MANUAL for the change above!
1594
1600
1595 (runsource): I copied code.py's runsource() into ipython to modify
1601 (runsource): I copied code.py's runsource() into ipython to modify
1596 it a bit. Now the code object and source to be executed are
1602 it a bit. Now the code object and source to be executed are
1597 stored in ipython. This makes this info accessible to third-party
1603 stored in ipython. This makes this info accessible to third-party
1598 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1604 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1599 Mantegazza <mantegazza-AT-ill.fr>.
1605 Mantegazza <mantegazza-AT-ill.fr>.
1600
1606
1601 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1607 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1602 history-search via readline (like C-p/C-n). I'd wanted this for a
1608 history-search via readline (like C-p/C-n). I'd wanted this for a
1603 long time, but only recently found out how to do it. For users
1609 long time, but only recently found out how to do it. For users
1604 who already have their ipythonrc files made and want this, just
1610 who already have their ipythonrc files made and want this, just
1605 add:
1611 add:
1606
1612
1607 readline_parse_and_bind "\e[A": history-search-backward
1613 readline_parse_and_bind "\e[A": history-search-backward
1608 readline_parse_and_bind "\e[B": history-search-forward
1614 readline_parse_and_bind "\e[B": history-search-forward
1609
1615
1610 2005-03-18 Fernando Perez <fperez@colorado.edu>
1616 2005-03-18 Fernando Perez <fperez@colorado.edu>
1611
1617
1612 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1618 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1613 LSString and SList classes which allow transparent conversions
1619 LSString and SList classes which allow transparent conversions
1614 between list mode and whitespace-separated string.
1620 between list mode and whitespace-separated string.
1615 (magic_r): Fix recursion problem in %r.
1621 (magic_r): Fix recursion problem in %r.
1616
1622
1617 * IPython/genutils.py (LSString): New class to be used for
1623 * IPython/genutils.py (LSString): New class to be used for
1618 automatic storage of the results of all alias/system calls in _o
1624 automatic storage of the results of all alias/system calls in _o
1619 and _e (stdout/err). These provide a .l/.list attribute which
1625 and _e (stdout/err). These provide a .l/.list attribute which
1620 does automatic splitting on newlines. This means that for most
1626 does automatic splitting on newlines. This means that for most
1621 uses, you'll never need to do capturing of output with %sc/%sx
1627 uses, you'll never need to do capturing of output with %sc/%sx
1622 anymore, since ipython keeps this always done for you. Note that
1628 anymore, since ipython keeps this always done for you. Note that
1623 only the LAST results are stored, the _o/e variables are
1629 only the LAST results are stored, the _o/e variables are
1624 overwritten on each call. If you need to save their contents
1630 overwritten on each call. If you need to save their contents
1625 further, simply bind them to any other name.
1631 further, simply bind them to any other name.
1626
1632
1627 2005-03-17 Fernando Perez <fperez@colorado.edu>
1633 2005-03-17 Fernando Perez <fperez@colorado.edu>
1628
1634
1629 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1635 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1630 prompt namespace handling.
1636 prompt namespace handling.
1631
1637
1632 2005-03-16 Fernando Perez <fperez@colorado.edu>
1638 2005-03-16 Fernando Perez <fperez@colorado.edu>
1633
1639
1634 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1640 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1635 classic prompts to be '>>> ' (final space was missing, and it
1641 classic prompts to be '>>> ' (final space was missing, and it
1636 trips the emacs python mode).
1642 trips the emacs python mode).
1637 (BasePrompt.__str__): Added safe support for dynamic prompt
1643 (BasePrompt.__str__): Added safe support for dynamic prompt
1638 strings. Now you can set your prompt string to be '$x', and the
1644 strings. Now you can set your prompt string to be '$x', and the
1639 value of x will be printed from your interactive namespace. The
1645 value of x will be printed from your interactive namespace. The
1640 interpolation syntax includes the full Itpl support, so
1646 interpolation syntax includes the full Itpl support, so
1641 ${foo()+x+bar()} is a valid prompt string now, and the function
1647 ${foo()+x+bar()} is a valid prompt string now, and the function
1642 calls will be made at runtime.
1648 calls will be made at runtime.
1643
1649
1644 2005-03-15 Fernando Perez <fperez@colorado.edu>
1650 2005-03-15 Fernando Perez <fperez@colorado.edu>
1645
1651
1646 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1652 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1647 avoid name clashes in pylab. %hist still works, it just forwards
1653 avoid name clashes in pylab. %hist still works, it just forwards
1648 the call to %history.
1654 the call to %history.
1649
1655
1650 2005-03-02 *** Released version 0.6.12
1656 2005-03-02 *** Released version 0.6.12
1651
1657
1652 2005-03-02 Fernando Perez <fperez@colorado.edu>
1658 2005-03-02 Fernando Perez <fperez@colorado.edu>
1653
1659
1654 * IPython/iplib.py (handle_magic): log magic calls properly as
1660 * IPython/iplib.py (handle_magic): log magic calls properly as
1655 ipmagic() function calls.
1661 ipmagic() function calls.
1656
1662
1657 * IPython/Magic.py (magic_time): Improved %time to support
1663 * IPython/Magic.py (magic_time): Improved %time to support
1658 statements and provide wall-clock as well as CPU time.
1664 statements and provide wall-clock as well as CPU time.
1659
1665
1660 2005-02-27 Fernando Perez <fperez@colorado.edu>
1666 2005-02-27 Fernando Perez <fperez@colorado.edu>
1661
1667
1662 * IPython/hooks.py: New hooks module, to expose user-modifiable
1668 * IPython/hooks.py: New hooks module, to expose user-modifiable
1663 IPython functionality in a clean manner. For now only the editor
1669 IPython functionality in a clean manner. For now only the editor
1664 hook is actually written, and other thigns which I intend to turn
1670 hook is actually written, and other thigns which I intend to turn
1665 into proper hooks aren't yet there. The display and prefilter
1671 into proper hooks aren't yet there. The display and prefilter
1666 stuff, for example, should be hooks. But at least now the
1672 stuff, for example, should be hooks. But at least now the
1667 framework is in place, and the rest can be moved here with more
1673 framework is in place, and the rest can be moved here with more
1668 time later. IPython had had a .hooks variable for a long time for
1674 time later. IPython had had a .hooks variable for a long time for
1669 this purpose, but I'd never actually used it for anything.
1675 this purpose, but I'd never actually used it for anything.
1670
1676
1671 2005-02-26 Fernando Perez <fperez@colorado.edu>
1677 2005-02-26 Fernando Perez <fperez@colorado.edu>
1672
1678
1673 * IPython/ipmaker.py (make_IPython): make the default ipython
1679 * IPython/ipmaker.py (make_IPython): make the default ipython
1674 directory be called _ipython under win32, to follow more the
1680 directory be called _ipython under win32, to follow more the
1675 naming peculiarities of that platform (where buggy software like
1681 naming peculiarities of that platform (where buggy software like
1676 Visual Sourcesafe breaks with .named directories). Reported by
1682 Visual Sourcesafe breaks with .named directories). Reported by
1677 Ville Vainio.
1683 Ville Vainio.
1678
1684
1679 2005-02-23 Fernando Perez <fperez@colorado.edu>
1685 2005-02-23 Fernando Perez <fperez@colorado.edu>
1680
1686
1681 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1687 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1682 auto_aliases for win32 which were causing problems. Users can
1688 auto_aliases for win32 which were causing problems. Users can
1683 define the ones they personally like.
1689 define the ones they personally like.
1684
1690
1685 2005-02-21 Fernando Perez <fperez@colorado.edu>
1691 2005-02-21 Fernando Perez <fperez@colorado.edu>
1686
1692
1687 * IPython/Magic.py (magic_time): new magic to time execution of
1693 * IPython/Magic.py (magic_time): new magic to time execution of
1688 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1694 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1689
1695
1690 2005-02-19 Fernando Perez <fperez@colorado.edu>
1696 2005-02-19 Fernando Perez <fperez@colorado.edu>
1691
1697
1692 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1698 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1693 into keys (for prompts, for example).
1699 into keys (for prompts, for example).
1694
1700
1695 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1701 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1696 prompts in case users want them. This introduces a small behavior
1702 prompts in case users want them. This introduces a small behavior
1697 change: ipython does not automatically add a space to all prompts
1703 change: ipython does not automatically add a space to all prompts
1698 anymore. To get the old prompts with a space, users should add it
1704 anymore. To get the old prompts with a space, users should add it
1699 manually to their ipythonrc file, so for example prompt_in1 should
1705 manually to their ipythonrc file, so for example prompt_in1 should
1700 now read 'In [\#]: ' instead of 'In [\#]:'.
1706 now read 'In [\#]: ' instead of 'In [\#]:'.
1701 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1707 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1702 file) to control left-padding of secondary prompts.
1708 file) to control left-padding of secondary prompts.
1703
1709
1704 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1710 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1705 the profiler can't be imported. Fix for Debian, which removed
1711 the profiler can't be imported. Fix for Debian, which removed
1706 profile.py because of License issues. I applied a slightly
1712 profile.py because of License issues. I applied a slightly
1707 modified version of the original Debian patch at
1713 modified version of the original Debian patch at
1708 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1714 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1709
1715
1710 2005-02-17 Fernando Perez <fperez@colorado.edu>
1716 2005-02-17 Fernando Perez <fperez@colorado.edu>
1711
1717
1712 * IPython/genutils.py (native_line_ends): Fix bug which would
1718 * IPython/genutils.py (native_line_ends): Fix bug which would
1713 cause improper line-ends under win32 b/c I was not opening files
1719 cause improper line-ends under win32 b/c I was not opening files
1714 in binary mode. Bug report and fix thanks to Ville.
1720 in binary mode. Bug report and fix thanks to Ville.
1715
1721
1716 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1722 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1717 trying to catch spurious foo[1] autocalls. My fix actually broke
1723 trying to catch spurious foo[1] autocalls. My fix actually broke
1718 ',/' autoquote/call with explicit escape (bad regexp).
1724 ',/' autoquote/call with explicit escape (bad regexp).
1719
1725
1720 2005-02-15 *** Released version 0.6.11
1726 2005-02-15 *** Released version 0.6.11
1721
1727
1722 2005-02-14 Fernando Perez <fperez@colorado.edu>
1728 2005-02-14 Fernando Perez <fperez@colorado.edu>
1723
1729
1724 * IPython/background_jobs.py: New background job management
1730 * IPython/background_jobs.py: New background job management
1725 subsystem. This is implemented via a new set of classes, and
1731 subsystem. This is implemented via a new set of classes, and
1726 IPython now provides a builtin 'jobs' object for background job
1732 IPython now provides a builtin 'jobs' object for background job
1727 execution. A convenience %bg magic serves as a lightweight
1733 execution. A convenience %bg magic serves as a lightweight
1728 frontend for starting the more common type of calls. This was
1734 frontend for starting the more common type of calls. This was
1729 inspired by discussions with B. Granger and the BackgroundCommand
1735 inspired by discussions with B. Granger and the BackgroundCommand
1730 class described in the book Python Scripting for Computational
1736 class described in the book Python Scripting for Computational
1731 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1737 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1732 (although ultimately no code from this text was used, as IPython's
1738 (although ultimately no code from this text was used, as IPython's
1733 system is a separate implementation).
1739 system is a separate implementation).
1734
1740
1735 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1741 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1736 to control the completion of single/double underscore names
1742 to control the completion of single/double underscore names
1737 separately. As documented in the example ipytonrc file, the
1743 separately. As documented in the example ipytonrc file, the
1738 readline_omit__names variable can now be set to 2, to omit even
1744 readline_omit__names variable can now be set to 2, to omit even
1739 single underscore names. Thanks to a patch by Brian Wong
1745 single underscore names. Thanks to a patch by Brian Wong
1740 <BrianWong-AT-AirgoNetworks.Com>.
1746 <BrianWong-AT-AirgoNetworks.Com>.
1741 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1747 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1742 be autocalled as foo([1]) if foo were callable. A problem for
1748 be autocalled as foo([1]) if foo were callable. A problem for
1743 things which are both callable and implement __getitem__.
1749 things which are both callable and implement __getitem__.
1744 (init_readline): Fix autoindentation for win32. Thanks to a patch
1750 (init_readline): Fix autoindentation for win32. Thanks to a patch
1745 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1751 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1746
1752
1747 2005-02-12 Fernando Perez <fperez@colorado.edu>
1753 2005-02-12 Fernando Perez <fperez@colorado.edu>
1748
1754
1749 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1755 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1750 which I had written long ago to sort out user error messages which
1756 which I had written long ago to sort out user error messages which
1751 may occur during startup. This seemed like a good idea initially,
1757 may occur during startup. This seemed like a good idea initially,
1752 but it has proven a disaster in retrospect. I don't want to
1758 but it has proven a disaster in retrospect. I don't want to
1753 change much code for now, so my fix is to set the internal 'debug'
1759 change much code for now, so my fix is to set the internal 'debug'
1754 flag to true everywhere, whose only job was precisely to control
1760 flag to true everywhere, whose only job was precisely to control
1755 this subsystem. This closes issue 28 (as well as avoiding all
1761 this subsystem. This closes issue 28 (as well as avoiding all
1756 sorts of strange hangups which occur from time to time).
1762 sorts of strange hangups which occur from time to time).
1757
1763
1758 2005-02-07 Fernando Perez <fperez@colorado.edu>
1764 2005-02-07 Fernando Perez <fperez@colorado.edu>
1759
1765
1760 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1766 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1761 previous call produced a syntax error.
1767 previous call produced a syntax error.
1762
1768
1763 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1769 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1764 classes without constructor.
1770 classes without constructor.
1765
1771
1766 2005-02-06 Fernando Perez <fperez@colorado.edu>
1772 2005-02-06 Fernando Perez <fperez@colorado.edu>
1767
1773
1768 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1774 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1769 completions with the results of each matcher, so we return results
1775 completions with the results of each matcher, so we return results
1770 to the user from all namespaces. This breaks with ipython
1776 to the user from all namespaces. This breaks with ipython
1771 tradition, but I think it's a nicer behavior. Now you get all
1777 tradition, but I think it's a nicer behavior. Now you get all
1772 possible completions listed, from all possible namespaces (python,
1778 possible completions listed, from all possible namespaces (python,
1773 filesystem, magics...) After a request by John Hunter
1779 filesystem, magics...) After a request by John Hunter
1774 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1780 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1775
1781
1776 2005-02-05 Fernando Perez <fperez@colorado.edu>
1782 2005-02-05 Fernando Perez <fperez@colorado.edu>
1777
1783
1778 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1784 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1779 the call had quote characters in it (the quotes were stripped).
1785 the call had quote characters in it (the quotes were stripped).
1780
1786
1781 2005-01-31 Fernando Perez <fperez@colorado.edu>
1787 2005-01-31 Fernando Perez <fperez@colorado.edu>
1782
1788
1783 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1789 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1784 Itpl.itpl() to make the code more robust against psyco
1790 Itpl.itpl() to make the code more robust against psyco
1785 optimizations.
1791 optimizations.
1786
1792
1787 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1793 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1788 of causing an exception. Quicker, cleaner.
1794 of causing an exception. Quicker, cleaner.
1789
1795
1790 2005-01-28 Fernando Perez <fperez@colorado.edu>
1796 2005-01-28 Fernando Perez <fperez@colorado.edu>
1791
1797
1792 * scripts/ipython_win_post_install.py (install): hardcode
1798 * scripts/ipython_win_post_install.py (install): hardcode
1793 sys.prefix+'python.exe' as the executable path. It turns out that
1799 sys.prefix+'python.exe' as the executable path. It turns out that
1794 during the post-installation run, sys.executable resolves to the
1800 during the post-installation run, sys.executable resolves to the
1795 name of the binary installer! I should report this as a distutils
1801 name of the binary installer! I should report this as a distutils
1796 bug, I think. I updated the .10 release with this tiny fix, to
1802 bug, I think. I updated the .10 release with this tiny fix, to
1797 avoid annoying the lists further.
1803 avoid annoying the lists further.
1798
1804
1799 2005-01-27 *** Released version 0.6.10
1805 2005-01-27 *** Released version 0.6.10
1800
1806
1801 2005-01-27 Fernando Perez <fperez@colorado.edu>
1807 2005-01-27 Fernando Perez <fperez@colorado.edu>
1802
1808
1803 * IPython/numutils.py (norm): Added 'inf' as optional name for
1809 * IPython/numutils.py (norm): Added 'inf' as optional name for
1804 L-infinity norm, included references to mathworld.com for vector
1810 L-infinity norm, included references to mathworld.com for vector
1805 norm definitions.
1811 norm definitions.
1806 (amin/amax): added amin/amax for array min/max. Similar to what
1812 (amin/amax): added amin/amax for array min/max. Similar to what
1807 pylab ships with after the recent reorganization of names.
1813 pylab ships with after the recent reorganization of names.
1808 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1814 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1809
1815
1810 * ipython.el: committed Alex's recent fixes and improvements.
1816 * ipython.el: committed Alex's recent fixes and improvements.
1811 Tested with python-mode from CVS, and it looks excellent. Since
1817 Tested with python-mode from CVS, and it looks excellent. Since
1812 python-mode hasn't released anything in a while, I'm temporarily
1818 python-mode hasn't released anything in a while, I'm temporarily
1813 putting a copy of today's CVS (v 4.70) of python-mode in:
1819 putting a copy of today's CVS (v 4.70) of python-mode in:
1814 http://ipython.scipy.org/tmp/python-mode.el
1820 http://ipython.scipy.org/tmp/python-mode.el
1815
1821
1816 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1822 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1817 sys.executable for the executable name, instead of assuming it's
1823 sys.executable for the executable name, instead of assuming it's
1818 called 'python.exe' (the post-installer would have produced broken
1824 called 'python.exe' (the post-installer would have produced broken
1819 setups on systems with a differently named python binary).
1825 setups on systems with a differently named python binary).
1820
1826
1821 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1827 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1822 references to os.linesep, to make the code more
1828 references to os.linesep, to make the code more
1823 platform-independent. This is also part of the win32 coloring
1829 platform-independent. This is also part of the win32 coloring
1824 fixes.
1830 fixes.
1825
1831
1826 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1832 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1827 lines, which actually cause coloring bugs because the length of
1833 lines, which actually cause coloring bugs because the length of
1828 the line is very difficult to correctly compute with embedded
1834 the line is very difficult to correctly compute with embedded
1829 escapes. This was the source of all the coloring problems under
1835 escapes. This was the source of all the coloring problems under
1830 Win32. I think that _finally_, Win32 users have a properly
1836 Win32. I think that _finally_, Win32 users have a properly
1831 working ipython in all respects. This would never have happened
1837 working ipython in all respects. This would never have happened
1832 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1838 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1833
1839
1834 2005-01-26 *** Released version 0.6.9
1840 2005-01-26 *** Released version 0.6.9
1835
1841
1836 2005-01-25 Fernando Perez <fperez@colorado.edu>
1842 2005-01-25 Fernando Perez <fperez@colorado.edu>
1837
1843
1838 * setup.py: finally, we have a true Windows installer, thanks to
1844 * setup.py: finally, we have a true Windows installer, thanks to
1839 the excellent work of Viktor Ransmayr
1845 the excellent work of Viktor Ransmayr
1840 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1846 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1841 Windows users. The setup routine is quite a bit cleaner thanks to
1847 Windows users. The setup routine is quite a bit cleaner thanks to
1842 this, and the post-install script uses the proper functions to
1848 this, and the post-install script uses the proper functions to
1843 allow a clean de-installation using the standard Windows Control
1849 allow a clean de-installation using the standard Windows Control
1844 Panel.
1850 Panel.
1845
1851
1846 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1852 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1847 environment variable under all OSes (including win32) if
1853 environment variable under all OSes (including win32) if
1848 available. This will give consistency to win32 users who have set
1854 available. This will give consistency to win32 users who have set
1849 this variable for any reason. If os.environ['HOME'] fails, the
1855 this variable for any reason. If os.environ['HOME'] fails, the
1850 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1856 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1851
1857
1852 2005-01-24 Fernando Perez <fperez@colorado.edu>
1858 2005-01-24 Fernando Perez <fperez@colorado.edu>
1853
1859
1854 * IPython/numutils.py (empty_like): add empty_like(), similar to
1860 * IPython/numutils.py (empty_like): add empty_like(), similar to
1855 zeros_like() but taking advantage of the new empty() Numeric routine.
1861 zeros_like() but taking advantage of the new empty() Numeric routine.
1856
1862
1857 2005-01-23 *** Released version 0.6.8
1863 2005-01-23 *** Released version 0.6.8
1858
1864
1859 2005-01-22 Fernando Perez <fperez@colorado.edu>
1865 2005-01-22 Fernando Perez <fperez@colorado.edu>
1860
1866
1861 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1867 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1862 automatic show() calls. After discussing things with JDH, it
1868 automatic show() calls. After discussing things with JDH, it
1863 turns out there are too many corner cases where this can go wrong.
1869 turns out there are too many corner cases where this can go wrong.
1864 It's best not to try to be 'too smart', and simply have ipython
1870 It's best not to try to be 'too smart', and simply have ipython
1865 reproduce as much as possible the default behavior of a normal
1871 reproduce as much as possible the default behavior of a normal
1866 python shell.
1872 python shell.
1867
1873
1868 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1874 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1869 line-splitting regexp and _prefilter() to avoid calling getattr()
1875 line-splitting regexp and _prefilter() to avoid calling getattr()
1870 on assignments. This closes
1876 on assignments. This closes
1871 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1877 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1872 readline uses getattr(), so a simple <TAB> keypress is still
1878 readline uses getattr(), so a simple <TAB> keypress is still
1873 enough to trigger getattr() calls on an object.
1879 enough to trigger getattr() calls on an object.
1874
1880
1875 2005-01-21 Fernando Perez <fperez@colorado.edu>
1881 2005-01-21 Fernando Perez <fperez@colorado.edu>
1876
1882
1877 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1883 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1878 docstring under pylab so it doesn't mask the original.
1884 docstring under pylab so it doesn't mask the original.
1879
1885
1880 2005-01-21 *** Released version 0.6.7
1886 2005-01-21 *** Released version 0.6.7
1881
1887
1882 2005-01-21 Fernando Perez <fperez@colorado.edu>
1888 2005-01-21 Fernando Perez <fperez@colorado.edu>
1883
1889
1884 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1890 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1885 signal handling for win32 users in multithreaded mode.
1891 signal handling for win32 users in multithreaded mode.
1886
1892
1887 2005-01-17 Fernando Perez <fperez@colorado.edu>
1893 2005-01-17 Fernando Perez <fperez@colorado.edu>
1888
1894
1889 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1895 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1890 instances with no __init__. After a crash report by Norbert Nemec
1896 instances with no __init__. After a crash report by Norbert Nemec
1891 <Norbert-AT-nemec-online.de>.
1897 <Norbert-AT-nemec-online.de>.
1892
1898
1893 2005-01-14 Fernando Perez <fperez@colorado.edu>
1899 2005-01-14 Fernando Perez <fperez@colorado.edu>
1894
1900
1895 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1901 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1896 names for verbose exceptions, when multiple dotted names and the
1902 names for verbose exceptions, when multiple dotted names and the
1897 'parent' object were present on the same line.
1903 'parent' object were present on the same line.
1898
1904
1899 2005-01-11 Fernando Perez <fperez@colorado.edu>
1905 2005-01-11 Fernando Perez <fperez@colorado.edu>
1900
1906
1901 * IPython/genutils.py (flag_calls): new utility to trap and flag
1907 * IPython/genutils.py (flag_calls): new utility to trap and flag
1902 calls in functions. I need it to clean up matplotlib support.
1908 calls in functions. I need it to clean up matplotlib support.
1903 Also removed some deprecated code in genutils.
1909 Also removed some deprecated code in genutils.
1904
1910
1905 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1911 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1906 that matplotlib scripts called with %run, which don't call show()
1912 that matplotlib scripts called with %run, which don't call show()
1907 themselves, still have their plotting windows open.
1913 themselves, still have their plotting windows open.
1908
1914
1909 2005-01-05 Fernando Perez <fperez@colorado.edu>
1915 2005-01-05 Fernando Perez <fperez@colorado.edu>
1910
1916
1911 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1917 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1912 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1918 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1913
1919
1914 2004-12-19 Fernando Perez <fperez@colorado.edu>
1920 2004-12-19 Fernando Perez <fperez@colorado.edu>
1915
1921
1916 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1922 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1917 parent_runcode, which was an eyesore. The same result can be
1923 parent_runcode, which was an eyesore. The same result can be
1918 obtained with Python's regular superclass mechanisms.
1924 obtained with Python's regular superclass mechanisms.
1919
1925
1920 2004-12-17 Fernando Perez <fperez@colorado.edu>
1926 2004-12-17 Fernando Perez <fperez@colorado.edu>
1921
1927
1922 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1928 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1923 reported by Prabhu.
1929 reported by Prabhu.
1924 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1930 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1925 sys.stderr) instead of explicitly calling sys.stderr. This helps
1931 sys.stderr) instead of explicitly calling sys.stderr. This helps
1926 maintain our I/O abstractions clean, for future GUI embeddings.
1932 maintain our I/O abstractions clean, for future GUI embeddings.
1927
1933
1928 * IPython/genutils.py (info): added new utility for sys.stderr
1934 * IPython/genutils.py (info): added new utility for sys.stderr
1929 unified info message handling (thin wrapper around warn()).
1935 unified info message handling (thin wrapper around warn()).
1930
1936
1931 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1937 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1932 composite (dotted) names on verbose exceptions.
1938 composite (dotted) names on verbose exceptions.
1933 (VerboseTB.nullrepr): harden against another kind of errors which
1939 (VerboseTB.nullrepr): harden against another kind of errors which
1934 Python's inspect module can trigger, and which were crashing
1940 Python's inspect module can trigger, and which were crashing
1935 IPython. Thanks to a report by Marco Lombardi
1941 IPython. Thanks to a report by Marco Lombardi
1936 <mlombard-AT-ma010192.hq.eso.org>.
1942 <mlombard-AT-ma010192.hq.eso.org>.
1937
1943
1938 2004-12-13 *** Released version 0.6.6
1944 2004-12-13 *** Released version 0.6.6
1939
1945
1940 2004-12-12 Fernando Perez <fperez@colorado.edu>
1946 2004-12-12 Fernando Perez <fperez@colorado.edu>
1941
1947
1942 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1948 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1943 generated by pygtk upon initialization if it was built without
1949 generated by pygtk upon initialization if it was built without
1944 threads (for matplotlib users). After a crash reported by
1950 threads (for matplotlib users). After a crash reported by
1945 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1951 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1946
1952
1947 * IPython/ipmaker.py (make_IPython): fix small bug in the
1953 * IPython/ipmaker.py (make_IPython): fix small bug in the
1948 import_some parameter for multiple imports.
1954 import_some parameter for multiple imports.
1949
1955
1950 * IPython/iplib.py (ipmagic): simplified the interface of
1956 * IPython/iplib.py (ipmagic): simplified the interface of
1951 ipmagic() to take a single string argument, just as it would be
1957 ipmagic() to take a single string argument, just as it would be
1952 typed at the IPython cmd line.
1958 typed at the IPython cmd line.
1953 (ipalias): Added new ipalias() with an interface identical to
1959 (ipalias): Added new ipalias() with an interface identical to
1954 ipmagic(). This completes exposing a pure python interface to the
1960 ipmagic(). This completes exposing a pure python interface to the
1955 alias and magic system, which can be used in loops or more complex
1961 alias and magic system, which can be used in loops or more complex
1956 code where IPython's automatic line mangling is not active.
1962 code where IPython's automatic line mangling is not active.
1957
1963
1958 * IPython/genutils.py (timing): changed interface of timing to
1964 * IPython/genutils.py (timing): changed interface of timing to
1959 simply run code once, which is the most common case. timings()
1965 simply run code once, which is the most common case. timings()
1960 remains unchanged, for the cases where you want multiple runs.
1966 remains unchanged, for the cases where you want multiple runs.
1961
1967
1962 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1968 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1963 bug where Python2.2 crashes with exec'ing code which does not end
1969 bug where Python2.2 crashes with exec'ing code which does not end
1964 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1970 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1965 before.
1971 before.
1966
1972
1967 2004-12-10 Fernando Perez <fperez@colorado.edu>
1973 2004-12-10 Fernando Perez <fperez@colorado.edu>
1968
1974
1969 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1975 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1970 -t to -T, to accomodate the new -t flag in %run (the %run and
1976 -t to -T, to accomodate the new -t flag in %run (the %run and
1971 %prun options are kind of intermixed, and it's not easy to change
1977 %prun options are kind of intermixed, and it's not easy to change
1972 this with the limitations of python's getopt).
1978 this with the limitations of python's getopt).
1973
1979
1974 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1980 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1975 the execution of scripts. It's not as fine-tuned as timeit.py,
1981 the execution of scripts. It's not as fine-tuned as timeit.py,
1976 but it works from inside ipython (and under 2.2, which lacks
1982 but it works from inside ipython (and under 2.2, which lacks
1977 timeit.py). Optionally a number of runs > 1 can be given for
1983 timeit.py). Optionally a number of runs > 1 can be given for
1978 timing very short-running code.
1984 timing very short-running code.
1979
1985
1980 * IPython/genutils.py (uniq_stable): new routine which returns a
1986 * IPython/genutils.py (uniq_stable): new routine which returns a
1981 list of unique elements in any iterable, but in stable order of
1987 list of unique elements in any iterable, but in stable order of
1982 appearance. I needed this for the ultraTB fixes, and it's a handy
1988 appearance. I needed this for the ultraTB fixes, and it's a handy
1983 utility.
1989 utility.
1984
1990
1985 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1991 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1986 dotted names in Verbose exceptions. This had been broken since
1992 dotted names in Verbose exceptions. This had been broken since
1987 the very start, now x.y will properly be printed in a Verbose
1993 the very start, now x.y will properly be printed in a Verbose
1988 traceback, instead of x being shown and y appearing always as an
1994 traceback, instead of x being shown and y appearing always as an
1989 'undefined global'. Getting this to work was a bit tricky,
1995 'undefined global'. Getting this to work was a bit tricky,
1990 because by default python tokenizers are stateless. Saved by
1996 because by default python tokenizers are stateless. Saved by
1991 python's ability to easily add a bit of state to an arbitrary
1997 python's ability to easily add a bit of state to an arbitrary
1992 function (without needing to build a full-blown callable object).
1998 function (without needing to build a full-blown callable object).
1993
1999
1994 Also big cleanup of this code, which had horrendous runtime
2000 Also big cleanup of this code, which had horrendous runtime
1995 lookups of zillions of attributes for colorization. Moved all
2001 lookups of zillions of attributes for colorization. Moved all
1996 this code into a few templates, which make it cleaner and quicker.
2002 this code into a few templates, which make it cleaner and quicker.
1997
2003
1998 Printout quality was also improved for Verbose exceptions: one
2004 Printout quality was also improved for Verbose exceptions: one
1999 variable per line, and memory addresses are printed (this can be
2005 variable per line, and memory addresses are printed (this can be
2000 quite handy in nasty debugging situations, which is what Verbose
2006 quite handy in nasty debugging situations, which is what Verbose
2001 is for).
2007 is for).
2002
2008
2003 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2009 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2004 the command line as scripts to be loaded by embedded instances.
2010 the command line as scripts to be loaded by embedded instances.
2005 Doing so has the potential for an infinite recursion if there are
2011 Doing so has the potential for an infinite recursion if there are
2006 exceptions thrown in the process. This fixes a strange crash
2012 exceptions thrown in the process. This fixes a strange crash
2007 reported by Philippe MULLER <muller-AT-irit.fr>.
2013 reported by Philippe MULLER <muller-AT-irit.fr>.
2008
2014
2009 2004-12-09 Fernando Perez <fperez@colorado.edu>
2015 2004-12-09 Fernando Perez <fperez@colorado.edu>
2010
2016
2011 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2017 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2012 to reflect new names in matplotlib, which now expose the
2018 to reflect new names in matplotlib, which now expose the
2013 matlab-compatible interface via a pylab module instead of the
2019 matlab-compatible interface via a pylab module instead of the
2014 'matlab' name. The new code is backwards compatible, so users of
2020 'matlab' name. The new code is backwards compatible, so users of
2015 all matplotlib versions are OK. Patch by J. Hunter.
2021 all matplotlib versions are OK. Patch by J. Hunter.
2016
2022
2017 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2023 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2018 of __init__ docstrings for instances (class docstrings are already
2024 of __init__ docstrings for instances (class docstrings are already
2019 automatically printed). Instances with customized docstrings
2025 automatically printed). Instances with customized docstrings
2020 (indep. of the class) are also recognized and all 3 separate
2026 (indep. of the class) are also recognized and all 3 separate
2021 docstrings are printed (instance, class, constructor). After some
2027 docstrings are printed (instance, class, constructor). After some
2022 comments/suggestions by J. Hunter.
2028 comments/suggestions by J. Hunter.
2023
2029
2024 2004-12-05 Fernando Perez <fperez@colorado.edu>
2030 2004-12-05 Fernando Perez <fperez@colorado.edu>
2025
2031
2026 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2032 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2027 warnings when tab-completion fails and triggers an exception.
2033 warnings when tab-completion fails and triggers an exception.
2028
2034
2029 2004-12-03 Fernando Perez <fperez@colorado.edu>
2035 2004-12-03 Fernando Perez <fperez@colorado.edu>
2030
2036
2031 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2037 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2032 be triggered when using 'run -p'. An incorrect option flag was
2038 be triggered when using 'run -p'. An incorrect option flag was
2033 being set ('d' instead of 'D').
2039 being set ('d' instead of 'D').
2034 (manpage): fix missing escaped \- sign.
2040 (manpage): fix missing escaped \- sign.
2035
2041
2036 2004-11-30 *** Released version 0.6.5
2042 2004-11-30 *** Released version 0.6.5
2037
2043
2038 2004-11-30 Fernando Perez <fperez@colorado.edu>
2044 2004-11-30 Fernando Perez <fperez@colorado.edu>
2039
2045
2040 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2046 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2041 setting with -d option.
2047 setting with -d option.
2042
2048
2043 * setup.py (docfiles): Fix problem where the doc glob I was using
2049 * setup.py (docfiles): Fix problem where the doc glob I was using
2044 was COMPLETELY BROKEN. It was giving the right files by pure
2050 was COMPLETELY BROKEN. It was giving the right files by pure
2045 accident, but failed once I tried to include ipython.el. Note:
2051 accident, but failed once I tried to include ipython.el. Note:
2046 glob() does NOT allow you to do exclusion on multiple endings!
2052 glob() does NOT allow you to do exclusion on multiple endings!
2047
2053
2048 2004-11-29 Fernando Perez <fperez@colorado.edu>
2054 2004-11-29 Fernando Perez <fperez@colorado.edu>
2049
2055
2050 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2056 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2051 the manpage as the source. Better formatting & consistency.
2057 the manpage as the source. Better formatting & consistency.
2052
2058
2053 * IPython/Magic.py (magic_run): Added new -d option, to run
2059 * IPython/Magic.py (magic_run): Added new -d option, to run
2054 scripts under the control of the python pdb debugger. Note that
2060 scripts under the control of the python pdb debugger. Note that
2055 this required changing the %prun option -d to -D, to avoid a clash
2061 this required changing the %prun option -d to -D, to avoid a clash
2056 (since %run must pass options to %prun, and getopt is too dumb to
2062 (since %run must pass options to %prun, and getopt is too dumb to
2057 handle options with string values with embedded spaces). Thanks
2063 handle options with string values with embedded spaces). Thanks
2058 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2064 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2059 (magic_who_ls): added type matching to %who and %whos, so that one
2065 (magic_who_ls): added type matching to %who and %whos, so that one
2060 can filter their output to only include variables of certain
2066 can filter their output to only include variables of certain
2061 types. Another suggestion by Matthew.
2067 types. Another suggestion by Matthew.
2062 (magic_whos): Added memory summaries in kb and Mb for arrays.
2068 (magic_whos): Added memory summaries in kb and Mb for arrays.
2063 (magic_who): Improve formatting (break lines every 9 vars).
2069 (magic_who): Improve formatting (break lines every 9 vars).
2064
2070
2065 2004-11-28 Fernando Perez <fperez@colorado.edu>
2071 2004-11-28 Fernando Perez <fperez@colorado.edu>
2066
2072
2067 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2073 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2068 cache when empty lines were present.
2074 cache when empty lines were present.
2069
2075
2070 2004-11-24 Fernando Perez <fperez@colorado.edu>
2076 2004-11-24 Fernando Perez <fperez@colorado.edu>
2071
2077
2072 * IPython/usage.py (__doc__): document the re-activated threading
2078 * IPython/usage.py (__doc__): document the re-activated threading
2073 options for WX and GTK.
2079 options for WX and GTK.
2074
2080
2075 2004-11-23 Fernando Perez <fperez@colorado.edu>
2081 2004-11-23 Fernando Perez <fperez@colorado.edu>
2076
2082
2077 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2083 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2078 the -wthread and -gthread options, along with a new -tk one to try
2084 the -wthread and -gthread options, along with a new -tk one to try
2079 and coordinate Tk threading with wx/gtk. The tk support is very
2085 and coordinate Tk threading with wx/gtk. The tk support is very
2080 platform dependent, since it seems to require Tcl and Tk to be
2086 platform dependent, since it seems to require Tcl and Tk to be
2081 built with threads (Fedora1/2 appears NOT to have it, but in
2087 built with threads (Fedora1/2 appears NOT to have it, but in
2082 Prabhu's Debian boxes it works OK). But even with some Tk
2088 Prabhu's Debian boxes it works OK). But even with some Tk
2083 limitations, this is a great improvement.
2089 limitations, this is a great improvement.
2084
2090
2085 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2091 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2086 info in user prompts. Patch by Prabhu.
2092 info in user prompts. Patch by Prabhu.
2087
2093
2088 2004-11-18 Fernando Perez <fperez@colorado.edu>
2094 2004-11-18 Fernando Perez <fperez@colorado.edu>
2089
2095
2090 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2096 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2091 EOFErrors and bail, to avoid infinite loops if a non-terminating
2097 EOFErrors and bail, to avoid infinite loops if a non-terminating
2092 file is fed into ipython. Patch submitted in issue 19 by user,
2098 file is fed into ipython. Patch submitted in issue 19 by user,
2093 many thanks.
2099 many thanks.
2094
2100
2095 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2101 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2096 autoquote/parens in continuation prompts, which can cause lots of
2102 autoquote/parens in continuation prompts, which can cause lots of
2097 problems. Closes roundup issue 20.
2103 problems. Closes roundup issue 20.
2098
2104
2099 2004-11-17 Fernando Perez <fperez@colorado.edu>
2105 2004-11-17 Fernando Perez <fperez@colorado.edu>
2100
2106
2101 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2107 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2102 reported as debian bug #280505. I'm not sure my local changelog
2108 reported as debian bug #280505. I'm not sure my local changelog
2103 entry has the proper debian format (Jack?).
2109 entry has the proper debian format (Jack?).
2104
2110
2105 2004-11-08 *** Released version 0.6.4
2111 2004-11-08 *** Released version 0.6.4
2106
2112
2107 2004-11-08 Fernando Perez <fperez@colorado.edu>
2113 2004-11-08 Fernando Perez <fperez@colorado.edu>
2108
2114
2109 * IPython/iplib.py (init_readline): Fix exit message for Windows
2115 * IPython/iplib.py (init_readline): Fix exit message for Windows
2110 when readline is active. Thanks to a report by Eric Jones
2116 when readline is active. Thanks to a report by Eric Jones
2111 <eric-AT-enthought.com>.
2117 <eric-AT-enthought.com>.
2112
2118
2113 2004-11-07 Fernando Perez <fperez@colorado.edu>
2119 2004-11-07 Fernando Perez <fperez@colorado.edu>
2114
2120
2115 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2121 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2116 sometimes seen by win2k/cygwin users.
2122 sometimes seen by win2k/cygwin users.
2117
2123
2118 2004-11-06 Fernando Perez <fperez@colorado.edu>
2124 2004-11-06 Fernando Perez <fperez@colorado.edu>
2119
2125
2120 * IPython/iplib.py (interact): Change the handling of %Exit from
2126 * IPython/iplib.py (interact): Change the handling of %Exit from
2121 trying to propagate a SystemExit to an internal ipython flag.
2127 trying to propagate a SystemExit to an internal ipython flag.
2122 This is less elegant than using Python's exception mechanism, but
2128 This is less elegant than using Python's exception mechanism, but
2123 I can't get that to work reliably with threads, so under -pylab
2129 I can't get that to work reliably with threads, so under -pylab
2124 %Exit was hanging IPython. Cross-thread exception handling is
2130 %Exit was hanging IPython. Cross-thread exception handling is
2125 really a bitch. Thaks to a bug report by Stephen Walton
2131 really a bitch. Thaks to a bug report by Stephen Walton
2126 <stephen.walton-AT-csun.edu>.
2132 <stephen.walton-AT-csun.edu>.
2127
2133
2128 2004-11-04 Fernando Perez <fperez@colorado.edu>
2134 2004-11-04 Fernando Perez <fperez@colorado.edu>
2129
2135
2130 * IPython/iplib.py (raw_input_original): store a pointer to the
2136 * IPython/iplib.py (raw_input_original): store a pointer to the
2131 true raw_input to harden against code which can modify it
2137 true raw_input to harden against code which can modify it
2132 (wx.py.PyShell does this and would otherwise crash ipython).
2138 (wx.py.PyShell does this and would otherwise crash ipython).
2133 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2139 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2134
2140
2135 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2141 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2136 Ctrl-C problem, which does not mess up the input line.
2142 Ctrl-C problem, which does not mess up the input line.
2137
2143
2138 2004-11-03 Fernando Perez <fperez@colorado.edu>
2144 2004-11-03 Fernando Perez <fperez@colorado.edu>
2139
2145
2140 * IPython/Release.py: Changed licensing to BSD, in all files.
2146 * IPython/Release.py: Changed licensing to BSD, in all files.
2141 (name): lowercase name for tarball/RPM release.
2147 (name): lowercase name for tarball/RPM release.
2142
2148
2143 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2149 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2144 use throughout ipython.
2150 use throughout ipython.
2145
2151
2146 * IPython/Magic.py (Magic._ofind): Switch to using the new
2152 * IPython/Magic.py (Magic._ofind): Switch to using the new
2147 OInspect.getdoc() function.
2153 OInspect.getdoc() function.
2148
2154
2149 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2155 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2150 of the line currently being canceled via Ctrl-C. It's extremely
2156 of the line currently being canceled via Ctrl-C. It's extremely
2151 ugly, but I don't know how to do it better (the problem is one of
2157 ugly, but I don't know how to do it better (the problem is one of
2152 handling cross-thread exceptions).
2158 handling cross-thread exceptions).
2153
2159
2154 2004-10-28 Fernando Perez <fperez@colorado.edu>
2160 2004-10-28 Fernando Perez <fperez@colorado.edu>
2155
2161
2156 * IPython/Shell.py (signal_handler): add signal handlers to trap
2162 * IPython/Shell.py (signal_handler): add signal handlers to trap
2157 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2163 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2158 report by Francesc Alted.
2164 report by Francesc Alted.
2159
2165
2160 2004-10-21 Fernando Perez <fperez@colorado.edu>
2166 2004-10-21 Fernando Perez <fperez@colorado.edu>
2161
2167
2162 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2168 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2163 to % for pysh syntax extensions.
2169 to % for pysh syntax extensions.
2164
2170
2165 2004-10-09 Fernando Perez <fperez@colorado.edu>
2171 2004-10-09 Fernando Perez <fperez@colorado.edu>
2166
2172
2167 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2173 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2168 arrays to print a more useful summary, without calling str(arr).
2174 arrays to print a more useful summary, without calling str(arr).
2169 This avoids the problem of extremely lengthy computations which
2175 This avoids the problem of extremely lengthy computations which
2170 occur if arr is large, and appear to the user as a system lockup
2176 occur if arr is large, and appear to the user as a system lockup
2171 with 100% cpu activity. After a suggestion by Kristian Sandberg
2177 with 100% cpu activity. After a suggestion by Kristian Sandberg
2172 <Kristian.Sandberg@colorado.edu>.
2178 <Kristian.Sandberg@colorado.edu>.
2173 (Magic.__init__): fix bug in global magic escapes not being
2179 (Magic.__init__): fix bug in global magic escapes not being
2174 correctly set.
2180 correctly set.
2175
2181
2176 2004-10-08 Fernando Perez <fperez@colorado.edu>
2182 2004-10-08 Fernando Perez <fperez@colorado.edu>
2177
2183
2178 * IPython/Magic.py (__license__): change to absolute imports of
2184 * IPython/Magic.py (__license__): change to absolute imports of
2179 ipython's own internal packages, to start adapting to the absolute
2185 ipython's own internal packages, to start adapting to the absolute
2180 import requirement of PEP-328.
2186 import requirement of PEP-328.
2181
2187
2182 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2188 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2183 files, and standardize author/license marks through the Release
2189 files, and standardize author/license marks through the Release
2184 module instead of having per/file stuff (except for files with
2190 module instead of having per/file stuff (except for files with
2185 particular licenses, like the MIT/PSF-licensed codes).
2191 particular licenses, like the MIT/PSF-licensed codes).
2186
2192
2187 * IPython/Debugger.py: remove dead code for python 2.1
2193 * IPython/Debugger.py: remove dead code for python 2.1
2188
2194
2189 2004-10-04 Fernando Perez <fperez@colorado.edu>
2195 2004-10-04 Fernando Perez <fperez@colorado.edu>
2190
2196
2191 * IPython/iplib.py (ipmagic): New function for accessing magics
2197 * IPython/iplib.py (ipmagic): New function for accessing magics
2192 via a normal python function call.
2198 via a normal python function call.
2193
2199
2194 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2200 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2195 from '@' to '%', to accomodate the new @decorator syntax of python
2201 from '@' to '%', to accomodate the new @decorator syntax of python
2196 2.4.
2202 2.4.
2197
2203
2198 2004-09-29 Fernando Perez <fperez@colorado.edu>
2204 2004-09-29 Fernando Perez <fperez@colorado.edu>
2199
2205
2200 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2206 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2201 matplotlib.use to prevent running scripts which try to switch
2207 matplotlib.use to prevent running scripts which try to switch
2202 interactive backends from within ipython. This will just crash
2208 interactive backends from within ipython. This will just crash
2203 the python interpreter, so we can't allow it (but a detailed error
2209 the python interpreter, so we can't allow it (but a detailed error
2204 is given to the user).
2210 is given to the user).
2205
2211
2206 2004-09-28 Fernando Perez <fperez@colorado.edu>
2212 2004-09-28 Fernando Perez <fperez@colorado.edu>
2207
2213
2208 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2214 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2209 matplotlib-related fixes so that using @run with non-matplotlib
2215 matplotlib-related fixes so that using @run with non-matplotlib
2210 scripts doesn't pop up spurious plot windows. This requires
2216 scripts doesn't pop up spurious plot windows. This requires
2211 matplotlib >= 0.63, where I had to make some changes as well.
2217 matplotlib >= 0.63, where I had to make some changes as well.
2212
2218
2213 * IPython/ipmaker.py (make_IPython): update version requirement to
2219 * IPython/ipmaker.py (make_IPython): update version requirement to
2214 python 2.2.
2220 python 2.2.
2215
2221
2216 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2222 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2217 banner arg for embedded customization.
2223 banner arg for embedded customization.
2218
2224
2219 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2225 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2220 explicit uses of __IP as the IPython's instance name. Now things
2226 explicit uses of __IP as the IPython's instance name. Now things
2221 are properly handled via the shell.name value. The actual code
2227 are properly handled via the shell.name value. The actual code
2222 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2228 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2223 is much better than before. I'll clean things completely when the
2229 is much better than before. I'll clean things completely when the
2224 magic stuff gets a real overhaul.
2230 magic stuff gets a real overhaul.
2225
2231
2226 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2232 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2227 minor changes to debian dir.
2233 minor changes to debian dir.
2228
2234
2229 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2235 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2230 pointer to the shell itself in the interactive namespace even when
2236 pointer to the shell itself in the interactive namespace even when
2231 a user-supplied dict is provided. This is needed for embedding
2237 a user-supplied dict is provided. This is needed for embedding
2232 purposes (found by tests with Michel Sanner).
2238 purposes (found by tests with Michel Sanner).
2233
2239
2234 2004-09-27 Fernando Perez <fperez@colorado.edu>
2240 2004-09-27 Fernando Perez <fperez@colorado.edu>
2235
2241
2236 * IPython/UserConfig/ipythonrc: remove []{} from
2242 * IPython/UserConfig/ipythonrc: remove []{} from
2237 readline_remove_delims, so that things like [modname.<TAB> do
2243 readline_remove_delims, so that things like [modname.<TAB> do
2238 proper completion. This disables [].TAB, but that's a less common
2244 proper completion. This disables [].TAB, but that's a less common
2239 case than module names in list comprehensions, for example.
2245 case than module names in list comprehensions, for example.
2240 Thanks to a report by Andrea Riciputi.
2246 Thanks to a report by Andrea Riciputi.
2241
2247
2242 2004-09-09 Fernando Perez <fperez@colorado.edu>
2248 2004-09-09 Fernando Perez <fperez@colorado.edu>
2243
2249
2244 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2250 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2245 blocking problems in win32 and osx. Fix by John.
2251 blocking problems in win32 and osx. Fix by John.
2246
2252
2247 2004-09-08 Fernando Perez <fperez@colorado.edu>
2253 2004-09-08 Fernando Perez <fperez@colorado.edu>
2248
2254
2249 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2255 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2250 for Win32 and OSX. Fix by John Hunter.
2256 for Win32 and OSX. Fix by John Hunter.
2251
2257
2252 2004-08-30 *** Released version 0.6.3
2258 2004-08-30 *** Released version 0.6.3
2253
2259
2254 2004-08-30 Fernando Perez <fperez@colorado.edu>
2260 2004-08-30 Fernando Perez <fperez@colorado.edu>
2255
2261
2256 * setup.py (isfile): Add manpages to list of dependent files to be
2262 * setup.py (isfile): Add manpages to list of dependent files to be
2257 updated.
2263 updated.
2258
2264
2259 2004-08-27 Fernando Perez <fperez@colorado.edu>
2265 2004-08-27 Fernando Perez <fperez@colorado.edu>
2260
2266
2261 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2267 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2262 for now. They don't really work with standalone WX/GTK code
2268 for now. They don't really work with standalone WX/GTK code
2263 (though matplotlib IS working fine with both of those backends).
2269 (though matplotlib IS working fine with both of those backends).
2264 This will neeed much more testing. I disabled most things with
2270 This will neeed much more testing. I disabled most things with
2265 comments, so turning it back on later should be pretty easy.
2271 comments, so turning it back on later should be pretty easy.
2266
2272
2267 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2273 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2268 autocalling of expressions like r'foo', by modifying the line
2274 autocalling of expressions like r'foo', by modifying the line
2269 split regexp. Closes
2275 split regexp. Closes
2270 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2276 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2271 Riley <ipythonbugs-AT-sabi.net>.
2277 Riley <ipythonbugs-AT-sabi.net>.
2272 (InteractiveShell.mainloop): honor --nobanner with banner
2278 (InteractiveShell.mainloop): honor --nobanner with banner
2273 extensions.
2279 extensions.
2274
2280
2275 * IPython/Shell.py: Significant refactoring of all classes, so
2281 * IPython/Shell.py: Significant refactoring of all classes, so
2276 that we can really support ALL matplotlib backends and threading
2282 that we can really support ALL matplotlib backends and threading
2277 models (John spotted a bug with Tk which required this). Now we
2283 models (John spotted a bug with Tk which required this). Now we
2278 should support single-threaded, WX-threads and GTK-threads, both
2284 should support single-threaded, WX-threads and GTK-threads, both
2279 for generic code and for matplotlib.
2285 for generic code and for matplotlib.
2280
2286
2281 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2287 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2282 -pylab, to simplify things for users. Will also remove the pylab
2288 -pylab, to simplify things for users. Will also remove the pylab
2283 profile, since now all of matplotlib configuration is directly
2289 profile, since now all of matplotlib configuration is directly
2284 handled here. This also reduces startup time.
2290 handled here. This also reduces startup time.
2285
2291
2286 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2292 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2287 shell wasn't being correctly called. Also in IPShellWX.
2293 shell wasn't being correctly called. Also in IPShellWX.
2288
2294
2289 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2295 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2290 fine-tune banner.
2296 fine-tune banner.
2291
2297
2292 * IPython/numutils.py (spike): Deprecate these spike functions,
2298 * IPython/numutils.py (spike): Deprecate these spike functions,
2293 delete (long deprecated) gnuplot_exec handler.
2299 delete (long deprecated) gnuplot_exec handler.
2294
2300
2295 2004-08-26 Fernando Perez <fperez@colorado.edu>
2301 2004-08-26 Fernando Perez <fperez@colorado.edu>
2296
2302
2297 * ipython.1: Update for threading options, plus some others which
2303 * ipython.1: Update for threading options, plus some others which
2298 were missing.
2304 were missing.
2299
2305
2300 * IPython/ipmaker.py (__call__): Added -wthread option for
2306 * IPython/ipmaker.py (__call__): Added -wthread option for
2301 wxpython thread handling. Make sure threading options are only
2307 wxpython thread handling. Make sure threading options are only
2302 valid at the command line.
2308 valid at the command line.
2303
2309
2304 * scripts/ipython: moved shell selection into a factory function
2310 * scripts/ipython: moved shell selection into a factory function
2305 in Shell.py, to keep the starter script to a minimum.
2311 in Shell.py, to keep the starter script to a minimum.
2306
2312
2307 2004-08-25 Fernando Perez <fperez@colorado.edu>
2313 2004-08-25 Fernando Perez <fperez@colorado.edu>
2308
2314
2309 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2315 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2310 John. Along with some recent changes he made to matplotlib, the
2316 John. Along with some recent changes he made to matplotlib, the
2311 next versions of both systems should work very well together.
2317 next versions of both systems should work very well together.
2312
2318
2313 2004-08-24 Fernando Perez <fperez@colorado.edu>
2319 2004-08-24 Fernando Perez <fperez@colorado.edu>
2314
2320
2315 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2321 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2316 tried to switch the profiling to using hotshot, but I'm getting
2322 tried to switch the profiling to using hotshot, but I'm getting
2317 strange errors from prof.runctx() there. I may be misreading the
2323 strange errors from prof.runctx() there. I may be misreading the
2318 docs, but it looks weird. For now the profiling code will
2324 docs, but it looks weird. For now the profiling code will
2319 continue to use the standard profiler.
2325 continue to use the standard profiler.
2320
2326
2321 2004-08-23 Fernando Perez <fperez@colorado.edu>
2327 2004-08-23 Fernando Perez <fperez@colorado.edu>
2322
2328
2323 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2329 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2324 threaded shell, by John Hunter. It's not quite ready yet, but
2330 threaded shell, by John Hunter. It's not quite ready yet, but
2325 close.
2331 close.
2326
2332
2327 2004-08-22 Fernando Perez <fperez@colorado.edu>
2333 2004-08-22 Fernando Perez <fperez@colorado.edu>
2328
2334
2329 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2335 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2330 in Magic and ultraTB.
2336 in Magic and ultraTB.
2331
2337
2332 * ipython.1: document threading options in manpage.
2338 * ipython.1: document threading options in manpage.
2333
2339
2334 * scripts/ipython: Changed name of -thread option to -gthread,
2340 * scripts/ipython: Changed name of -thread option to -gthread,
2335 since this is GTK specific. I want to leave the door open for a
2341 since this is GTK specific. I want to leave the door open for a
2336 -wthread option for WX, which will most likely be necessary. This
2342 -wthread option for WX, which will most likely be necessary. This
2337 change affects usage and ipmaker as well.
2343 change affects usage and ipmaker as well.
2338
2344
2339 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2345 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2340 handle the matplotlib shell issues. Code by John Hunter
2346 handle the matplotlib shell issues. Code by John Hunter
2341 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2347 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2342 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2348 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2343 broken (and disabled for end users) for now, but it puts the
2349 broken (and disabled for end users) for now, but it puts the
2344 infrastructure in place.
2350 infrastructure in place.
2345
2351
2346 2004-08-21 Fernando Perez <fperez@colorado.edu>
2352 2004-08-21 Fernando Perez <fperez@colorado.edu>
2347
2353
2348 * ipythonrc-pylab: Add matplotlib support.
2354 * ipythonrc-pylab: Add matplotlib support.
2349
2355
2350 * matplotlib_config.py: new files for matplotlib support, part of
2356 * matplotlib_config.py: new files for matplotlib support, part of
2351 the pylab profile.
2357 the pylab profile.
2352
2358
2353 * IPython/usage.py (__doc__): documented the threading options.
2359 * IPython/usage.py (__doc__): documented the threading options.
2354
2360
2355 2004-08-20 Fernando Perez <fperez@colorado.edu>
2361 2004-08-20 Fernando Perez <fperez@colorado.edu>
2356
2362
2357 * ipython: Modified the main calling routine to handle the -thread
2363 * ipython: Modified the main calling routine to handle the -thread
2358 and -mpthread options. This needs to be done as a top-level hack,
2364 and -mpthread options. This needs to be done as a top-level hack,
2359 because it determines which class to instantiate for IPython
2365 because it determines which class to instantiate for IPython
2360 itself.
2366 itself.
2361
2367
2362 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2368 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2363 classes to support multithreaded GTK operation without blocking,
2369 classes to support multithreaded GTK operation without blocking,
2364 and matplotlib with all backends. This is a lot of still very
2370 and matplotlib with all backends. This is a lot of still very
2365 experimental code, and threads are tricky. So it may still have a
2371 experimental code, and threads are tricky. So it may still have a
2366 few rough edges... This code owes a lot to
2372 few rough edges... This code owes a lot to
2367 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2373 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2368 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2374 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2369 to John Hunter for all the matplotlib work.
2375 to John Hunter for all the matplotlib work.
2370
2376
2371 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2377 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2372 options for gtk thread and matplotlib support.
2378 options for gtk thread and matplotlib support.
2373
2379
2374 2004-08-16 Fernando Perez <fperez@colorado.edu>
2380 2004-08-16 Fernando Perez <fperez@colorado.edu>
2375
2381
2376 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2382 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2377 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2383 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2378 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2384 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2379
2385
2380 2004-08-11 Fernando Perez <fperez@colorado.edu>
2386 2004-08-11 Fernando Perez <fperez@colorado.edu>
2381
2387
2382 * setup.py (isfile): Fix build so documentation gets updated for
2388 * setup.py (isfile): Fix build so documentation gets updated for
2383 rpms (it was only done for .tgz builds).
2389 rpms (it was only done for .tgz builds).
2384
2390
2385 2004-08-10 Fernando Perez <fperez@colorado.edu>
2391 2004-08-10 Fernando Perez <fperez@colorado.edu>
2386
2392
2387 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2393 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2388
2394
2389 * iplib.py : Silence syntax error exceptions in tab-completion.
2395 * iplib.py : Silence syntax error exceptions in tab-completion.
2390
2396
2391 2004-08-05 Fernando Perez <fperez@colorado.edu>
2397 2004-08-05 Fernando Perez <fperez@colorado.edu>
2392
2398
2393 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2399 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2394 'color off' mark for continuation prompts. This was causing long
2400 'color off' mark for continuation prompts. This was causing long
2395 continuation lines to mis-wrap.
2401 continuation lines to mis-wrap.
2396
2402
2397 2004-08-01 Fernando Perez <fperez@colorado.edu>
2403 2004-08-01 Fernando Perez <fperez@colorado.edu>
2398
2404
2399 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2405 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2400 for building ipython to be a parameter. All this is necessary
2406 for building ipython to be a parameter. All this is necessary
2401 right now to have a multithreaded version, but this insane
2407 right now to have a multithreaded version, but this insane
2402 non-design will be cleaned up soon. For now, it's a hack that
2408 non-design will be cleaned up soon. For now, it's a hack that
2403 works.
2409 works.
2404
2410
2405 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2411 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2406 args in various places. No bugs so far, but it's a dangerous
2412 args in various places. No bugs so far, but it's a dangerous
2407 practice.
2413 practice.
2408
2414
2409 2004-07-31 Fernando Perez <fperez@colorado.edu>
2415 2004-07-31 Fernando Perez <fperez@colorado.edu>
2410
2416
2411 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2417 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2412 fix completion of files with dots in their names under most
2418 fix completion of files with dots in their names under most
2413 profiles (pysh was OK because the completion order is different).
2419 profiles (pysh was OK because the completion order is different).
2414
2420
2415 2004-07-27 Fernando Perez <fperez@colorado.edu>
2421 2004-07-27 Fernando Perez <fperez@colorado.edu>
2416
2422
2417 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2423 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2418 keywords manually, b/c the one in keyword.py was removed in python
2424 keywords manually, b/c the one in keyword.py was removed in python
2419 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2425 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2420 This is NOT a bug under python 2.3 and earlier.
2426 This is NOT a bug under python 2.3 and earlier.
2421
2427
2422 2004-07-26 Fernando Perez <fperez@colorado.edu>
2428 2004-07-26 Fernando Perez <fperez@colorado.edu>
2423
2429
2424 * IPython/ultraTB.py (VerboseTB.text): Add another
2430 * IPython/ultraTB.py (VerboseTB.text): Add another
2425 linecache.checkcache() call to try to prevent inspect.py from
2431 linecache.checkcache() call to try to prevent inspect.py from
2426 crashing under python 2.3. I think this fixes
2432 crashing under python 2.3. I think this fixes
2427 http://www.scipy.net/roundup/ipython/issue17.
2433 http://www.scipy.net/roundup/ipython/issue17.
2428
2434
2429 2004-07-26 *** Released version 0.6.2
2435 2004-07-26 *** Released version 0.6.2
2430
2436
2431 2004-07-26 Fernando Perez <fperez@colorado.edu>
2437 2004-07-26 Fernando Perez <fperez@colorado.edu>
2432
2438
2433 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2439 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2434 fail for any number.
2440 fail for any number.
2435 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2441 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2436 empty bookmarks.
2442 empty bookmarks.
2437
2443
2438 2004-07-26 *** Released version 0.6.1
2444 2004-07-26 *** Released version 0.6.1
2439
2445
2440 2004-07-26 Fernando Perez <fperez@colorado.edu>
2446 2004-07-26 Fernando Perez <fperez@colorado.edu>
2441
2447
2442 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2448 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2443
2449
2444 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2450 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2445 escaping '()[]{}' in filenames.
2451 escaping '()[]{}' in filenames.
2446
2452
2447 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2453 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2448 Python 2.2 users who lack a proper shlex.split.
2454 Python 2.2 users who lack a proper shlex.split.
2449
2455
2450 2004-07-19 Fernando Perez <fperez@colorado.edu>
2456 2004-07-19 Fernando Perez <fperez@colorado.edu>
2451
2457
2452 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2458 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2453 for reading readline's init file. I follow the normal chain:
2459 for reading readline's init file. I follow the normal chain:
2454 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2460 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2455 report by Mike Heeter. This closes
2461 report by Mike Heeter. This closes
2456 http://www.scipy.net/roundup/ipython/issue16.
2462 http://www.scipy.net/roundup/ipython/issue16.
2457
2463
2458 2004-07-18 Fernando Perez <fperez@colorado.edu>
2464 2004-07-18 Fernando Perez <fperez@colorado.edu>
2459
2465
2460 * IPython/iplib.py (__init__): Add better handling of '\' under
2466 * IPython/iplib.py (__init__): Add better handling of '\' under
2461 Win32 for filenames. After a patch by Ville.
2467 Win32 for filenames. After a patch by Ville.
2462
2468
2463 2004-07-17 Fernando Perez <fperez@colorado.edu>
2469 2004-07-17 Fernando Perez <fperez@colorado.edu>
2464
2470
2465 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2471 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2466 autocalling would be triggered for 'foo is bar' if foo is
2472 autocalling would be triggered for 'foo is bar' if foo is
2467 callable. I also cleaned up the autocall detection code to use a
2473 callable. I also cleaned up the autocall detection code to use a
2468 regexp, which is faster. Bug reported by Alexander Schmolck.
2474 regexp, which is faster. Bug reported by Alexander Schmolck.
2469
2475
2470 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2476 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2471 '?' in them would confuse the help system. Reported by Alex
2477 '?' in them would confuse the help system. Reported by Alex
2472 Schmolck.
2478 Schmolck.
2473
2479
2474 2004-07-16 Fernando Perez <fperez@colorado.edu>
2480 2004-07-16 Fernando Perez <fperez@colorado.edu>
2475
2481
2476 * IPython/GnuplotInteractive.py (__all__): added plot2.
2482 * IPython/GnuplotInteractive.py (__all__): added plot2.
2477
2483
2478 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2484 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2479 plotting dictionaries, lists or tuples of 1d arrays.
2485 plotting dictionaries, lists or tuples of 1d arrays.
2480
2486
2481 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2487 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2482 optimizations.
2488 optimizations.
2483
2489
2484 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2490 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2485 the information which was there from Janko's original IPP code:
2491 the information which was there from Janko's original IPP code:
2486
2492
2487 03.05.99 20:53 porto.ifm.uni-kiel.de
2493 03.05.99 20:53 porto.ifm.uni-kiel.de
2488 --Started changelog.
2494 --Started changelog.
2489 --make clear do what it say it does
2495 --make clear do what it say it does
2490 --added pretty output of lines from inputcache
2496 --added pretty output of lines from inputcache
2491 --Made Logger a mixin class, simplifies handling of switches
2497 --Made Logger a mixin class, simplifies handling of switches
2492 --Added own completer class. .string<TAB> expands to last history
2498 --Added own completer class. .string<TAB> expands to last history
2493 line which starts with string. The new expansion is also present
2499 line which starts with string. The new expansion is also present
2494 with Ctrl-r from the readline library. But this shows, who this
2500 with Ctrl-r from the readline library. But this shows, who this
2495 can be done for other cases.
2501 can be done for other cases.
2496 --Added convention that all shell functions should accept a
2502 --Added convention that all shell functions should accept a
2497 parameter_string This opens the door for different behaviour for
2503 parameter_string This opens the door for different behaviour for
2498 each function. @cd is a good example of this.
2504 each function. @cd is a good example of this.
2499
2505
2500 04.05.99 12:12 porto.ifm.uni-kiel.de
2506 04.05.99 12:12 porto.ifm.uni-kiel.de
2501 --added logfile rotation
2507 --added logfile rotation
2502 --added new mainloop method which freezes first the namespace
2508 --added new mainloop method which freezes first the namespace
2503
2509
2504 07.05.99 21:24 porto.ifm.uni-kiel.de
2510 07.05.99 21:24 porto.ifm.uni-kiel.de
2505 --added the docreader classes. Now there is a help system.
2511 --added the docreader classes. Now there is a help system.
2506 -This is only a first try. Currently it's not easy to put new
2512 -This is only a first try. Currently it's not easy to put new
2507 stuff in the indices. But this is the way to go. Info would be
2513 stuff in the indices. But this is the way to go. Info would be
2508 better, but HTML is every where and not everybody has an info
2514 better, but HTML is every where and not everybody has an info
2509 system installed and it's not so easy to change html-docs to info.
2515 system installed and it's not so easy to change html-docs to info.
2510 --added global logfile option
2516 --added global logfile option
2511 --there is now a hook for object inspection method pinfo needs to
2517 --there is now a hook for object inspection method pinfo needs to
2512 be provided for this. Can be reached by two '??'.
2518 be provided for this. Can be reached by two '??'.
2513
2519
2514 08.05.99 20:51 porto.ifm.uni-kiel.de
2520 08.05.99 20:51 porto.ifm.uni-kiel.de
2515 --added a README
2521 --added a README
2516 --bug in rc file. Something has changed so functions in the rc
2522 --bug in rc file. Something has changed so functions in the rc
2517 file need to reference the shell and not self. Not clear if it's a
2523 file need to reference the shell and not self. Not clear if it's a
2518 bug or feature.
2524 bug or feature.
2519 --changed rc file for new behavior
2525 --changed rc file for new behavior
2520
2526
2521 2004-07-15 Fernando Perez <fperez@colorado.edu>
2527 2004-07-15 Fernando Perez <fperez@colorado.edu>
2522
2528
2523 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2529 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2524 cache was falling out of sync in bizarre manners when multi-line
2530 cache was falling out of sync in bizarre manners when multi-line
2525 input was present. Minor optimizations and cleanup.
2531 input was present. Minor optimizations and cleanup.
2526
2532
2527 (Logger): Remove old Changelog info for cleanup. This is the
2533 (Logger): Remove old Changelog info for cleanup. This is the
2528 information which was there from Janko's original code:
2534 information which was there from Janko's original code:
2529
2535
2530 Changes to Logger: - made the default log filename a parameter
2536 Changes to Logger: - made the default log filename a parameter
2531
2537
2532 - put a check for lines beginning with !@? in log(). Needed
2538 - put a check for lines beginning with !@? in log(). Needed
2533 (even if the handlers properly log their lines) for mid-session
2539 (even if the handlers properly log their lines) for mid-session
2534 logging activation to work properly. Without this, lines logged
2540 logging activation to work properly. Without this, lines logged
2535 in mid session, which get read from the cache, would end up
2541 in mid session, which get read from the cache, would end up
2536 'bare' (with !@? in the open) in the log. Now they are caught
2542 'bare' (with !@? in the open) in the log. Now they are caught
2537 and prepended with a #.
2543 and prepended with a #.
2538
2544
2539 * IPython/iplib.py (InteractiveShell.init_readline): added check
2545 * IPython/iplib.py (InteractiveShell.init_readline): added check
2540 in case MagicCompleter fails to be defined, so we don't crash.
2546 in case MagicCompleter fails to be defined, so we don't crash.
2541
2547
2542 2004-07-13 Fernando Perez <fperez@colorado.edu>
2548 2004-07-13 Fernando Perez <fperez@colorado.edu>
2543
2549
2544 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2550 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2545 of EPS if the requested filename ends in '.eps'.
2551 of EPS if the requested filename ends in '.eps'.
2546
2552
2547 2004-07-04 Fernando Perez <fperez@colorado.edu>
2553 2004-07-04 Fernando Perez <fperez@colorado.edu>
2548
2554
2549 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2555 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2550 escaping of quotes when calling the shell.
2556 escaping of quotes when calling the shell.
2551
2557
2552 2004-07-02 Fernando Perez <fperez@colorado.edu>
2558 2004-07-02 Fernando Perez <fperez@colorado.edu>
2553
2559
2554 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2560 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2555 gettext not working because we were clobbering '_'. Fixes
2561 gettext not working because we were clobbering '_'. Fixes
2556 http://www.scipy.net/roundup/ipython/issue6.
2562 http://www.scipy.net/roundup/ipython/issue6.
2557
2563
2558 2004-07-01 Fernando Perez <fperez@colorado.edu>
2564 2004-07-01 Fernando Perez <fperez@colorado.edu>
2559
2565
2560 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2566 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2561 into @cd. Patch by Ville.
2567 into @cd. Patch by Ville.
2562
2568
2563 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2569 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2564 new function to store things after ipmaker runs. Patch by Ville.
2570 new function to store things after ipmaker runs. Patch by Ville.
2565 Eventually this will go away once ipmaker is removed and the class
2571 Eventually this will go away once ipmaker is removed and the class
2566 gets cleaned up, but for now it's ok. Key functionality here is
2572 gets cleaned up, but for now it's ok. Key functionality here is
2567 the addition of the persistent storage mechanism, a dict for
2573 the addition of the persistent storage mechanism, a dict for
2568 keeping data across sessions (for now just bookmarks, but more can
2574 keeping data across sessions (for now just bookmarks, but more can
2569 be implemented later).
2575 be implemented later).
2570
2576
2571 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2577 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2572 persistent across sections. Patch by Ville, I modified it
2578 persistent across sections. Patch by Ville, I modified it
2573 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2579 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2574 added a '-l' option to list all bookmarks.
2580 added a '-l' option to list all bookmarks.
2575
2581
2576 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2582 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2577 center for cleanup. Registered with atexit.register(). I moved
2583 center for cleanup. Registered with atexit.register(). I moved
2578 here the old exit_cleanup(). After a patch by Ville.
2584 here the old exit_cleanup(). After a patch by Ville.
2579
2585
2580 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2586 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2581 characters in the hacked shlex_split for python 2.2.
2587 characters in the hacked shlex_split for python 2.2.
2582
2588
2583 * IPython/iplib.py (file_matches): more fixes to filenames with
2589 * IPython/iplib.py (file_matches): more fixes to filenames with
2584 whitespace in them. It's not perfect, but limitations in python's
2590 whitespace in them. It's not perfect, but limitations in python's
2585 readline make it impossible to go further.
2591 readline make it impossible to go further.
2586
2592
2587 2004-06-29 Fernando Perez <fperez@colorado.edu>
2593 2004-06-29 Fernando Perez <fperez@colorado.edu>
2588
2594
2589 * IPython/iplib.py (file_matches): escape whitespace correctly in
2595 * IPython/iplib.py (file_matches): escape whitespace correctly in
2590 filename completions. Bug reported by Ville.
2596 filename completions. Bug reported by Ville.
2591
2597
2592 2004-06-28 Fernando Perez <fperez@colorado.edu>
2598 2004-06-28 Fernando Perez <fperez@colorado.edu>
2593
2599
2594 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2600 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2595 the history file will be called 'history-PROFNAME' (or just
2601 the history file will be called 'history-PROFNAME' (or just
2596 'history' if no profile is loaded). I was getting annoyed at
2602 'history' if no profile is loaded). I was getting annoyed at
2597 getting my Numerical work history clobbered by pysh sessions.
2603 getting my Numerical work history clobbered by pysh sessions.
2598
2604
2599 * IPython/iplib.py (InteractiveShell.__init__): Internal
2605 * IPython/iplib.py (InteractiveShell.__init__): Internal
2600 getoutputerror() function so that we can honor the system_verbose
2606 getoutputerror() function so that we can honor the system_verbose
2601 flag for _all_ system calls. I also added escaping of #
2607 flag for _all_ system calls. I also added escaping of #
2602 characters here to avoid confusing Itpl.
2608 characters here to avoid confusing Itpl.
2603
2609
2604 * IPython/Magic.py (shlex_split): removed call to shell in
2610 * IPython/Magic.py (shlex_split): removed call to shell in
2605 parse_options and replaced it with shlex.split(). The annoying
2611 parse_options and replaced it with shlex.split(). The annoying
2606 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2612 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2607 to backport it from 2.3, with several frail hacks (the shlex
2613 to backport it from 2.3, with several frail hacks (the shlex
2608 module is rather limited in 2.2). Thanks to a suggestion by Ville
2614 module is rather limited in 2.2). Thanks to a suggestion by Ville
2609 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2615 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2610 problem.
2616 problem.
2611
2617
2612 (Magic.magic_system_verbose): new toggle to print the actual
2618 (Magic.magic_system_verbose): new toggle to print the actual
2613 system calls made by ipython. Mainly for debugging purposes.
2619 system calls made by ipython. Mainly for debugging purposes.
2614
2620
2615 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2621 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2616 doesn't support persistence. Reported (and fix suggested) by
2622 doesn't support persistence. Reported (and fix suggested) by
2617 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2623 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2618
2624
2619 2004-06-26 Fernando Perez <fperez@colorado.edu>
2625 2004-06-26 Fernando Perez <fperez@colorado.edu>
2620
2626
2621 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2627 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2622 continue prompts.
2628 continue prompts.
2623
2629
2624 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2630 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2625 function (basically a big docstring) and a few more things here to
2631 function (basically a big docstring) and a few more things here to
2626 speedup startup. pysh.py is now very lightweight. We want because
2632 speedup startup. pysh.py is now very lightweight. We want because
2627 it gets execfile'd, while InterpreterExec gets imported, so
2633 it gets execfile'd, while InterpreterExec gets imported, so
2628 byte-compilation saves time.
2634 byte-compilation saves time.
2629
2635
2630 2004-06-25 Fernando Perez <fperez@colorado.edu>
2636 2004-06-25 Fernando Perez <fperez@colorado.edu>
2631
2637
2632 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2638 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2633 -NUM', which was recently broken.
2639 -NUM', which was recently broken.
2634
2640
2635 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2641 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2636 in multi-line input (but not !!, which doesn't make sense there).
2642 in multi-line input (but not !!, which doesn't make sense there).
2637
2643
2638 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2644 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2639 It's just too useful, and people can turn it off in the less
2645 It's just too useful, and people can turn it off in the less
2640 common cases where it's a problem.
2646 common cases where it's a problem.
2641
2647
2642 2004-06-24 Fernando Perez <fperez@colorado.edu>
2648 2004-06-24 Fernando Perez <fperez@colorado.edu>
2643
2649
2644 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2650 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2645 special syntaxes (like alias calling) is now allied in multi-line
2651 special syntaxes (like alias calling) is now allied in multi-line
2646 input. This is still _very_ experimental, but it's necessary for
2652 input. This is still _very_ experimental, but it's necessary for
2647 efficient shell usage combining python looping syntax with system
2653 efficient shell usage combining python looping syntax with system
2648 calls. For now it's restricted to aliases, I don't think it
2654 calls. For now it's restricted to aliases, I don't think it
2649 really even makes sense to have this for magics.
2655 really even makes sense to have this for magics.
2650
2656
2651 2004-06-23 Fernando Perez <fperez@colorado.edu>
2657 2004-06-23 Fernando Perez <fperez@colorado.edu>
2652
2658
2653 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2659 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2654 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2660 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2655
2661
2656 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2662 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2657 extensions under Windows (after code sent by Gary Bishop). The
2663 extensions under Windows (after code sent by Gary Bishop). The
2658 extensions considered 'executable' are stored in IPython's rc
2664 extensions considered 'executable' are stored in IPython's rc
2659 structure as win_exec_ext.
2665 structure as win_exec_ext.
2660
2666
2661 * IPython/genutils.py (shell): new function, like system() but
2667 * IPython/genutils.py (shell): new function, like system() but
2662 without return value. Very useful for interactive shell work.
2668 without return value. Very useful for interactive shell work.
2663
2669
2664 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2670 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2665 delete aliases.
2671 delete aliases.
2666
2672
2667 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2673 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2668 sure that the alias table doesn't contain python keywords.
2674 sure that the alias table doesn't contain python keywords.
2669
2675
2670 2004-06-21 Fernando Perez <fperez@colorado.edu>
2676 2004-06-21 Fernando Perez <fperez@colorado.edu>
2671
2677
2672 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2678 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2673 non-existent items are found in $PATH. Reported by Thorsten.
2679 non-existent items are found in $PATH. Reported by Thorsten.
2674
2680
2675 2004-06-20 Fernando Perez <fperez@colorado.edu>
2681 2004-06-20 Fernando Perez <fperez@colorado.edu>
2676
2682
2677 * IPython/iplib.py (complete): modified the completer so that the
2683 * IPython/iplib.py (complete): modified the completer so that the
2678 order of priorities can be easily changed at runtime.
2684 order of priorities can be easily changed at runtime.
2679
2685
2680 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2686 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2681 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2687 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2682
2688
2683 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2689 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2684 expand Python variables prepended with $ in all system calls. The
2690 expand Python variables prepended with $ in all system calls. The
2685 same was done to InteractiveShell.handle_shell_escape. Now all
2691 same was done to InteractiveShell.handle_shell_escape. Now all
2686 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2692 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2687 expansion of python variables and expressions according to the
2693 expansion of python variables and expressions according to the
2688 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2694 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2689
2695
2690 Though PEP-215 has been rejected, a similar (but simpler) one
2696 Though PEP-215 has been rejected, a similar (but simpler) one
2691 seems like it will go into Python 2.4, PEP-292 -
2697 seems like it will go into Python 2.4, PEP-292 -
2692 http://www.python.org/peps/pep-0292.html.
2698 http://www.python.org/peps/pep-0292.html.
2693
2699
2694 I'll keep the full syntax of PEP-215, since IPython has since the
2700 I'll keep the full syntax of PEP-215, since IPython has since the
2695 start used Ka-Ping Yee's reference implementation discussed there
2701 start used Ka-Ping Yee's reference implementation discussed there
2696 (Itpl), and I actually like the powerful semantics it offers.
2702 (Itpl), and I actually like the powerful semantics it offers.
2697
2703
2698 In order to access normal shell variables, the $ has to be escaped
2704 In order to access normal shell variables, the $ has to be escaped
2699 via an extra $. For example:
2705 via an extra $. For example:
2700
2706
2701 In [7]: PATH='a python variable'
2707 In [7]: PATH='a python variable'
2702
2708
2703 In [8]: !echo $PATH
2709 In [8]: !echo $PATH
2704 a python variable
2710 a python variable
2705
2711
2706 In [9]: !echo $$PATH
2712 In [9]: !echo $$PATH
2707 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2713 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2708
2714
2709 (Magic.parse_options): escape $ so the shell doesn't evaluate
2715 (Magic.parse_options): escape $ so the shell doesn't evaluate
2710 things prematurely.
2716 things prematurely.
2711
2717
2712 * IPython/iplib.py (InteractiveShell.call_alias): added the
2718 * IPython/iplib.py (InteractiveShell.call_alias): added the
2713 ability for aliases to expand python variables via $.
2719 ability for aliases to expand python variables via $.
2714
2720
2715 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2721 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2716 system, now there's a @rehash/@rehashx pair of magics. These work
2722 system, now there's a @rehash/@rehashx pair of magics. These work
2717 like the csh rehash command, and can be invoked at any time. They
2723 like the csh rehash command, and can be invoked at any time. They
2718 build a table of aliases to everything in the user's $PATH
2724 build a table of aliases to everything in the user's $PATH
2719 (@rehash uses everything, @rehashx is slower but only adds
2725 (@rehash uses everything, @rehashx is slower but only adds
2720 executable files). With this, the pysh.py-based shell profile can
2726 executable files). With this, the pysh.py-based shell profile can
2721 now simply call rehash upon startup, and full access to all
2727 now simply call rehash upon startup, and full access to all
2722 programs in the user's path is obtained.
2728 programs in the user's path is obtained.
2723
2729
2724 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2730 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2725 functionality is now fully in place. I removed the old dynamic
2731 functionality is now fully in place. I removed the old dynamic
2726 code generation based approach, in favor of a much lighter one
2732 code generation based approach, in favor of a much lighter one
2727 based on a simple dict. The advantage is that this allows me to
2733 based on a simple dict. The advantage is that this allows me to
2728 now have thousands of aliases with negligible cost (unthinkable
2734 now have thousands of aliases with negligible cost (unthinkable
2729 with the old system).
2735 with the old system).
2730
2736
2731 2004-06-19 Fernando Perez <fperez@colorado.edu>
2737 2004-06-19 Fernando Perez <fperez@colorado.edu>
2732
2738
2733 * IPython/iplib.py (__init__): extended MagicCompleter class to
2739 * IPython/iplib.py (__init__): extended MagicCompleter class to
2734 also complete (last in priority) on user aliases.
2740 also complete (last in priority) on user aliases.
2735
2741
2736 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2742 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2737 call to eval.
2743 call to eval.
2738 (ItplNS.__init__): Added a new class which functions like Itpl,
2744 (ItplNS.__init__): Added a new class which functions like Itpl,
2739 but allows configuring the namespace for the evaluation to occur
2745 but allows configuring the namespace for the evaluation to occur
2740 in.
2746 in.
2741
2747
2742 2004-06-18 Fernando Perez <fperez@colorado.edu>
2748 2004-06-18 Fernando Perez <fperez@colorado.edu>
2743
2749
2744 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2750 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2745 better message when 'exit' or 'quit' are typed (a common newbie
2751 better message when 'exit' or 'quit' are typed (a common newbie
2746 confusion).
2752 confusion).
2747
2753
2748 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2754 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2749 check for Windows users.
2755 check for Windows users.
2750
2756
2751 * IPython/iplib.py (InteractiveShell.user_setup): removed
2757 * IPython/iplib.py (InteractiveShell.user_setup): removed
2752 disabling of colors for Windows. I'll test at runtime and issue a
2758 disabling of colors for Windows. I'll test at runtime and issue a
2753 warning if Gary's readline isn't found, as to nudge users to
2759 warning if Gary's readline isn't found, as to nudge users to
2754 download it.
2760 download it.
2755
2761
2756 2004-06-16 Fernando Perez <fperez@colorado.edu>
2762 2004-06-16 Fernando Perez <fperez@colorado.edu>
2757
2763
2758 * IPython/genutils.py (Stream.__init__): changed to print errors
2764 * IPython/genutils.py (Stream.__init__): changed to print errors
2759 to sys.stderr. I had a circular dependency here. Now it's
2765 to sys.stderr. I had a circular dependency here. Now it's
2760 possible to run ipython as IDLE's shell (consider this pre-alpha,
2766 possible to run ipython as IDLE's shell (consider this pre-alpha,
2761 since true stdout things end up in the starting terminal instead
2767 since true stdout things end up in the starting terminal instead
2762 of IDLE's out).
2768 of IDLE's out).
2763
2769
2764 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2770 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2765 users who haven't # updated their prompt_in2 definitions. Remove
2771 users who haven't # updated their prompt_in2 definitions. Remove
2766 eventually.
2772 eventually.
2767 (multiple_replace): added credit to original ASPN recipe.
2773 (multiple_replace): added credit to original ASPN recipe.
2768
2774
2769 2004-06-15 Fernando Perez <fperez@colorado.edu>
2775 2004-06-15 Fernando Perez <fperez@colorado.edu>
2770
2776
2771 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2777 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2772 list of auto-defined aliases.
2778 list of auto-defined aliases.
2773
2779
2774 2004-06-13 Fernando Perez <fperez@colorado.edu>
2780 2004-06-13 Fernando Perez <fperez@colorado.edu>
2775
2781
2776 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2782 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2777 install was really requested (so setup.py can be used for other
2783 install was really requested (so setup.py can be used for other
2778 things under Windows).
2784 things under Windows).
2779
2785
2780 2004-06-10 Fernando Perez <fperez@colorado.edu>
2786 2004-06-10 Fernando Perez <fperez@colorado.edu>
2781
2787
2782 * IPython/Logger.py (Logger.create_log): Manually remove any old
2788 * IPython/Logger.py (Logger.create_log): Manually remove any old
2783 backup, since os.remove may fail under Windows. Fixes bug
2789 backup, since os.remove may fail under Windows. Fixes bug
2784 reported by Thorsten.
2790 reported by Thorsten.
2785
2791
2786 2004-06-09 Fernando Perez <fperez@colorado.edu>
2792 2004-06-09 Fernando Perez <fperez@colorado.edu>
2787
2793
2788 * examples/example-embed.py: fixed all references to %n (replaced
2794 * examples/example-embed.py: fixed all references to %n (replaced
2789 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2795 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2790 for all examples and the manual as well.
2796 for all examples and the manual as well.
2791
2797
2792 2004-06-08 Fernando Perez <fperez@colorado.edu>
2798 2004-06-08 Fernando Perez <fperez@colorado.edu>
2793
2799
2794 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2800 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2795 alignment and color management. All 3 prompt subsystems now
2801 alignment and color management. All 3 prompt subsystems now
2796 inherit from BasePrompt.
2802 inherit from BasePrompt.
2797
2803
2798 * tools/release: updates for windows installer build and tag rpms
2804 * tools/release: updates for windows installer build and tag rpms
2799 with python version (since paths are fixed).
2805 with python version (since paths are fixed).
2800
2806
2801 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2807 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2802 which will become eventually obsolete. Also fixed the default
2808 which will become eventually obsolete. Also fixed the default
2803 prompt_in2 to use \D, so at least new users start with the correct
2809 prompt_in2 to use \D, so at least new users start with the correct
2804 defaults.
2810 defaults.
2805 WARNING: Users with existing ipythonrc files will need to apply
2811 WARNING: Users with existing ipythonrc files will need to apply
2806 this fix manually!
2812 this fix manually!
2807
2813
2808 * setup.py: make windows installer (.exe). This is finally the
2814 * setup.py: make windows installer (.exe). This is finally the
2809 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2815 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2810 which I hadn't included because it required Python 2.3 (or recent
2816 which I hadn't included because it required Python 2.3 (or recent
2811 distutils).
2817 distutils).
2812
2818
2813 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2819 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2814 usage of new '\D' escape.
2820 usage of new '\D' escape.
2815
2821
2816 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2822 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2817 lacks os.getuid())
2823 lacks os.getuid())
2818 (CachedOutput.set_colors): Added the ability to turn coloring
2824 (CachedOutput.set_colors): Added the ability to turn coloring
2819 on/off with @colors even for manually defined prompt colors. It
2825 on/off with @colors even for manually defined prompt colors. It
2820 uses a nasty global, but it works safely and via the generic color
2826 uses a nasty global, but it works safely and via the generic color
2821 handling mechanism.
2827 handling mechanism.
2822 (Prompt2.__init__): Introduced new escape '\D' for continuation
2828 (Prompt2.__init__): Introduced new escape '\D' for continuation
2823 prompts. It represents the counter ('\#') as dots.
2829 prompts. It represents the counter ('\#') as dots.
2824 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2830 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2825 need to update their ipythonrc files and replace '%n' with '\D' in
2831 need to update their ipythonrc files and replace '%n' with '\D' in
2826 their prompt_in2 settings everywhere. Sorry, but there's
2832 their prompt_in2 settings everywhere. Sorry, but there's
2827 otherwise no clean way to get all prompts to properly align. The
2833 otherwise no clean way to get all prompts to properly align. The
2828 ipythonrc shipped with IPython has been updated.
2834 ipythonrc shipped with IPython has been updated.
2829
2835
2830 2004-06-07 Fernando Perez <fperez@colorado.edu>
2836 2004-06-07 Fernando Perez <fperez@colorado.edu>
2831
2837
2832 * setup.py (isfile): Pass local_icons option to latex2html, so the
2838 * setup.py (isfile): Pass local_icons option to latex2html, so the
2833 resulting HTML file is self-contained. Thanks to
2839 resulting HTML file is self-contained. Thanks to
2834 dryice-AT-liu.com.cn for the tip.
2840 dryice-AT-liu.com.cn for the tip.
2835
2841
2836 * pysh.py: I created a new profile 'shell', which implements a
2842 * pysh.py: I created a new profile 'shell', which implements a
2837 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2843 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2838 system shell, nor will it become one anytime soon. It's mainly
2844 system shell, nor will it become one anytime soon. It's mainly
2839 meant to illustrate the use of the new flexible bash-like prompts.
2845 meant to illustrate the use of the new flexible bash-like prompts.
2840 I guess it could be used by hardy souls for true shell management,
2846 I guess it could be used by hardy souls for true shell management,
2841 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2847 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2842 profile. This uses the InterpreterExec extension provided by
2848 profile. This uses the InterpreterExec extension provided by
2843 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2849 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2844
2850
2845 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2851 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2846 auto-align itself with the length of the previous input prompt
2852 auto-align itself with the length of the previous input prompt
2847 (taking into account the invisible color escapes).
2853 (taking into account the invisible color escapes).
2848 (CachedOutput.__init__): Large restructuring of this class. Now
2854 (CachedOutput.__init__): Large restructuring of this class. Now
2849 all three prompts (primary1, primary2, output) are proper objects,
2855 all three prompts (primary1, primary2, output) are proper objects,
2850 managed by the 'parent' CachedOutput class. The code is still a
2856 managed by the 'parent' CachedOutput class. The code is still a
2851 bit hackish (all prompts share state via a pointer to the cache),
2857 bit hackish (all prompts share state via a pointer to the cache),
2852 but it's overall far cleaner than before.
2858 but it's overall far cleaner than before.
2853
2859
2854 * IPython/genutils.py (getoutputerror): modified to add verbose,
2860 * IPython/genutils.py (getoutputerror): modified to add verbose,
2855 debug and header options. This makes the interface of all getout*
2861 debug and header options. This makes the interface of all getout*
2856 functions uniform.
2862 functions uniform.
2857 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2863 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2858
2864
2859 * IPython/Magic.py (Magic.default_option): added a function to
2865 * IPython/Magic.py (Magic.default_option): added a function to
2860 allow registering default options for any magic command. This
2866 allow registering default options for any magic command. This
2861 makes it easy to have profiles which customize the magics globally
2867 makes it easy to have profiles which customize the magics globally
2862 for a certain use. The values set through this function are
2868 for a certain use. The values set through this function are
2863 picked up by the parse_options() method, which all magics should
2869 picked up by the parse_options() method, which all magics should
2864 use to parse their options.
2870 use to parse their options.
2865
2871
2866 * IPython/genutils.py (warn): modified the warnings framework to
2872 * IPython/genutils.py (warn): modified the warnings framework to
2867 use the Term I/O class. I'm trying to slowly unify all of
2873 use the Term I/O class. I'm trying to slowly unify all of
2868 IPython's I/O operations to pass through Term.
2874 IPython's I/O operations to pass through Term.
2869
2875
2870 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2876 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2871 the secondary prompt to correctly match the length of the primary
2877 the secondary prompt to correctly match the length of the primary
2872 one for any prompt. Now multi-line code will properly line up
2878 one for any prompt. Now multi-line code will properly line up
2873 even for path dependent prompts, such as the new ones available
2879 even for path dependent prompts, such as the new ones available
2874 via the prompt_specials.
2880 via the prompt_specials.
2875
2881
2876 2004-06-06 Fernando Perez <fperez@colorado.edu>
2882 2004-06-06 Fernando Perez <fperez@colorado.edu>
2877
2883
2878 * IPython/Prompts.py (prompt_specials): Added the ability to have
2884 * IPython/Prompts.py (prompt_specials): Added the ability to have
2879 bash-like special sequences in the prompts, which get
2885 bash-like special sequences in the prompts, which get
2880 automatically expanded. Things like hostname, current working
2886 automatically expanded. Things like hostname, current working
2881 directory and username are implemented already, but it's easy to
2887 directory and username are implemented already, but it's easy to
2882 add more in the future. Thanks to a patch by W.J. van der Laan
2888 add more in the future. Thanks to a patch by W.J. van der Laan
2883 <gnufnork-AT-hetdigitalegat.nl>
2889 <gnufnork-AT-hetdigitalegat.nl>
2884 (prompt_specials): Added color support for prompt strings, so
2890 (prompt_specials): Added color support for prompt strings, so
2885 users can define arbitrary color setups for their prompts.
2891 users can define arbitrary color setups for their prompts.
2886
2892
2887 2004-06-05 Fernando Perez <fperez@colorado.edu>
2893 2004-06-05 Fernando Perez <fperez@colorado.edu>
2888
2894
2889 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2895 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2890 code to load Gary Bishop's readline and configure it
2896 code to load Gary Bishop's readline and configure it
2891 automatically. Thanks to Gary for help on this.
2897 automatically. Thanks to Gary for help on this.
2892
2898
2893 2004-06-01 Fernando Perez <fperez@colorado.edu>
2899 2004-06-01 Fernando Perez <fperez@colorado.edu>
2894
2900
2895 * IPython/Logger.py (Logger.create_log): fix bug for logging
2901 * IPython/Logger.py (Logger.create_log): fix bug for logging
2896 with no filename (previous fix was incomplete).
2902 with no filename (previous fix was incomplete).
2897
2903
2898 2004-05-25 Fernando Perez <fperez@colorado.edu>
2904 2004-05-25 Fernando Perez <fperez@colorado.edu>
2899
2905
2900 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2906 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2901 parens would get passed to the shell.
2907 parens would get passed to the shell.
2902
2908
2903 2004-05-20 Fernando Perez <fperez@colorado.edu>
2909 2004-05-20 Fernando Perez <fperez@colorado.edu>
2904
2910
2905 * IPython/Magic.py (Magic.magic_prun): changed default profile
2911 * IPython/Magic.py (Magic.magic_prun): changed default profile
2906 sort order to 'time' (the more common profiling need).
2912 sort order to 'time' (the more common profiling need).
2907
2913
2908 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2914 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2909 so that source code shown is guaranteed in sync with the file on
2915 so that source code shown is guaranteed in sync with the file on
2910 disk (also changed in psource). Similar fix to the one for
2916 disk (also changed in psource). Similar fix to the one for
2911 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2917 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2912 <yann.ledu-AT-noos.fr>.
2918 <yann.ledu-AT-noos.fr>.
2913
2919
2914 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2920 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2915 with a single option would not be correctly parsed. Closes
2921 with a single option would not be correctly parsed. Closes
2916 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2922 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2917 introduced in 0.6.0 (on 2004-05-06).
2923 introduced in 0.6.0 (on 2004-05-06).
2918
2924
2919 2004-05-13 *** Released version 0.6.0
2925 2004-05-13 *** Released version 0.6.0
2920
2926
2921 2004-05-13 Fernando Perez <fperez@colorado.edu>
2927 2004-05-13 Fernando Perez <fperez@colorado.edu>
2922
2928
2923 * debian/: Added debian/ directory to CVS, so that debian support
2929 * debian/: Added debian/ directory to CVS, so that debian support
2924 is publicly accessible. The debian package is maintained by Jack
2930 is publicly accessible. The debian package is maintained by Jack
2925 Moffit <jack-AT-xiph.org>.
2931 Moffit <jack-AT-xiph.org>.
2926
2932
2927 * Documentation: included the notes about an ipython-based system
2933 * Documentation: included the notes about an ipython-based system
2928 shell (the hypothetical 'pysh') into the new_design.pdf document,
2934 shell (the hypothetical 'pysh') into the new_design.pdf document,
2929 so that these ideas get distributed to users along with the
2935 so that these ideas get distributed to users along with the
2930 official documentation.
2936 official documentation.
2931
2937
2932 2004-05-10 Fernando Perez <fperez@colorado.edu>
2938 2004-05-10 Fernando Perez <fperez@colorado.edu>
2933
2939
2934 * IPython/Logger.py (Logger.create_log): fix recently introduced
2940 * IPython/Logger.py (Logger.create_log): fix recently introduced
2935 bug (misindented line) where logstart would fail when not given an
2941 bug (misindented line) where logstart would fail when not given an
2936 explicit filename.
2942 explicit filename.
2937
2943
2938 2004-05-09 Fernando Perez <fperez@colorado.edu>
2944 2004-05-09 Fernando Perez <fperez@colorado.edu>
2939
2945
2940 * IPython/Magic.py (Magic.parse_options): skip system call when
2946 * IPython/Magic.py (Magic.parse_options): skip system call when
2941 there are no options to look for. Faster, cleaner for the common
2947 there are no options to look for. Faster, cleaner for the common
2942 case.
2948 case.
2943
2949
2944 * Documentation: many updates to the manual: describing Windows
2950 * Documentation: many updates to the manual: describing Windows
2945 support better, Gnuplot updates, credits, misc small stuff. Also
2951 support better, Gnuplot updates, credits, misc small stuff. Also
2946 updated the new_design doc a bit.
2952 updated the new_design doc a bit.
2947
2953
2948 2004-05-06 *** Released version 0.6.0.rc1
2954 2004-05-06 *** Released version 0.6.0.rc1
2949
2955
2950 2004-05-06 Fernando Perez <fperez@colorado.edu>
2956 2004-05-06 Fernando Perez <fperez@colorado.edu>
2951
2957
2952 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2958 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2953 operations to use the vastly more efficient list/''.join() method.
2959 operations to use the vastly more efficient list/''.join() method.
2954 (FormattedTB.text): Fix
2960 (FormattedTB.text): Fix
2955 http://www.scipy.net/roundup/ipython/issue12 - exception source
2961 http://www.scipy.net/roundup/ipython/issue12 - exception source
2956 extract not updated after reload. Thanks to Mike Salib
2962 extract not updated after reload. Thanks to Mike Salib
2957 <msalib-AT-mit.edu> for pinning the source of the problem.
2963 <msalib-AT-mit.edu> for pinning the source of the problem.
2958 Fortunately, the solution works inside ipython and doesn't require
2964 Fortunately, the solution works inside ipython and doesn't require
2959 any changes to python proper.
2965 any changes to python proper.
2960
2966
2961 * IPython/Magic.py (Magic.parse_options): Improved to process the
2967 * IPython/Magic.py (Magic.parse_options): Improved to process the
2962 argument list as a true shell would (by actually using the
2968 argument list as a true shell would (by actually using the
2963 underlying system shell). This way, all @magics automatically get
2969 underlying system shell). This way, all @magics automatically get
2964 shell expansion for variables. Thanks to a comment by Alex
2970 shell expansion for variables. Thanks to a comment by Alex
2965 Schmolck.
2971 Schmolck.
2966
2972
2967 2004-04-04 Fernando Perez <fperez@colorado.edu>
2973 2004-04-04 Fernando Perez <fperez@colorado.edu>
2968
2974
2969 * IPython/iplib.py (InteractiveShell.interact): Added a special
2975 * IPython/iplib.py (InteractiveShell.interact): Added a special
2970 trap for a debugger quit exception, which is basically impossible
2976 trap for a debugger quit exception, which is basically impossible
2971 to handle by normal mechanisms, given what pdb does to the stack.
2977 to handle by normal mechanisms, given what pdb does to the stack.
2972 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2978 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2973
2979
2974 2004-04-03 Fernando Perez <fperez@colorado.edu>
2980 2004-04-03 Fernando Perez <fperez@colorado.edu>
2975
2981
2976 * IPython/genutils.py (Term): Standardized the names of the Term
2982 * IPython/genutils.py (Term): Standardized the names of the Term
2977 class streams to cin/cout/cerr, following C++ naming conventions
2983 class streams to cin/cout/cerr, following C++ naming conventions
2978 (I can't use in/out/err because 'in' is not a valid attribute
2984 (I can't use in/out/err because 'in' is not a valid attribute
2979 name).
2985 name).
2980
2986
2981 * IPython/iplib.py (InteractiveShell.interact): don't increment
2987 * IPython/iplib.py (InteractiveShell.interact): don't increment
2982 the prompt if there's no user input. By Daniel 'Dang' Griffith
2988 the prompt if there's no user input. By Daniel 'Dang' Griffith
2983 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2989 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2984 Francois Pinard.
2990 Francois Pinard.
2985
2991
2986 2004-04-02 Fernando Perez <fperez@colorado.edu>
2992 2004-04-02 Fernando Perez <fperez@colorado.edu>
2987
2993
2988 * IPython/genutils.py (Stream.__init__): Modified to survive at
2994 * IPython/genutils.py (Stream.__init__): Modified to survive at
2989 least importing in contexts where stdin/out/err aren't true file
2995 least importing in contexts where stdin/out/err aren't true file
2990 objects, such as PyCrust (they lack fileno() and mode). However,
2996 objects, such as PyCrust (they lack fileno() and mode). However,
2991 the recovery facilities which rely on these things existing will
2997 the recovery facilities which rely on these things existing will
2992 not work.
2998 not work.
2993
2999
2994 2004-04-01 Fernando Perez <fperez@colorado.edu>
3000 2004-04-01 Fernando Perez <fperez@colorado.edu>
2995
3001
2996 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3002 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2997 use the new getoutputerror() function, so it properly
3003 use the new getoutputerror() function, so it properly
2998 distinguishes stdout/err.
3004 distinguishes stdout/err.
2999
3005
3000 * IPython/genutils.py (getoutputerror): added a function to
3006 * IPython/genutils.py (getoutputerror): added a function to
3001 capture separately the standard output and error of a command.
3007 capture separately the standard output and error of a command.
3002 After a comment from dang on the mailing lists. This code is
3008 After a comment from dang on the mailing lists. This code is
3003 basically a modified version of commands.getstatusoutput(), from
3009 basically a modified version of commands.getstatusoutput(), from
3004 the standard library.
3010 the standard library.
3005
3011
3006 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3012 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3007 '!!' as a special syntax (shorthand) to access @sx.
3013 '!!' as a special syntax (shorthand) to access @sx.
3008
3014
3009 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3015 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3010 command and return its output as a list split on '\n'.
3016 command and return its output as a list split on '\n'.
3011
3017
3012 2004-03-31 Fernando Perez <fperez@colorado.edu>
3018 2004-03-31 Fernando Perez <fperez@colorado.edu>
3013
3019
3014 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3020 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3015 method to dictionaries used as FakeModule instances if they lack
3021 method to dictionaries used as FakeModule instances if they lack
3016 it. At least pydoc in python2.3 breaks for runtime-defined
3022 it. At least pydoc in python2.3 breaks for runtime-defined
3017 functions without this hack. At some point I need to _really_
3023 functions without this hack. At some point I need to _really_
3018 understand what FakeModule is doing, because it's a gross hack.
3024 understand what FakeModule is doing, because it's a gross hack.
3019 But it solves Arnd's problem for now...
3025 But it solves Arnd's problem for now...
3020
3026
3021 2004-02-27 Fernando Perez <fperez@colorado.edu>
3027 2004-02-27 Fernando Perez <fperez@colorado.edu>
3022
3028
3023 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3029 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3024 mode would behave erratically. Also increased the number of
3030 mode would behave erratically. Also increased the number of
3025 possible logs in rotate mod to 999. Thanks to Rod Holland
3031 possible logs in rotate mod to 999. Thanks to Rod Holland
3026 <rhh@StructureLABS.com> for the report and fixes.
3032 <rhh@StructureLABS.com> for the report and fixes.
3027
3033
3028 2004-02-26 Fernando Perez <fperez@colorado.edu>
3034 2004-02-26 Fernando Perez <fperez@colorado.edu>
3029
3035
3030 * IPython/genutils.py (page): Check that the curses module really
3036 * IPython/genutils.py (page): Check that the curses module really
3031 has the initscr attribute before trying to use it. For some
3037 has the initscr attribute before trying to use it. For some
3032 reason, the Solaris curses module is missing this. I think this
3038 reason, the Solaris curses module is missing this. I think this
3033 should be considered a Solaris python bug, but I'm not sure.
3039 should be considered a Solaris python bug, but I'm not sure.
3034
3040
3035 2004-01-17 Fernando Perez <fperez@colorado.edu>
3041 2004-01-17 Fernando Perez <fperez@colorado.edu>
3036
3042
3037 * IPython/genutils.py (Stream.__init__): Changes to try to make
3043 * IPython/genutils.py (Stream.__init__): Changes to try to make
3038 ipython robust against stdin/out/err being closed by the user.
3044 ipython robust against stdin/out/err being closed by the user.
3039 This is 'user error' (and blocks a normal python session, at least
3045 This is 'user error' (and blocks a normal python session, at least
3040 the stdout case). However, Ipython should be able to survive such
3046 the stdout case). However, Ipython should be able to survive such
3041 instances of abuse as gracefully as possible. To simplify the
3047 instances of abuse as gracefully as possible. To simplify the
3042 coding and maintain compatibility with Gary Bishop's Term
3048 coding and maintain compatibility with Gary Bishop's Term
3043 contributions, I've made use of classmethods for this. I think
3049 contributions, I've made use of classmethods for this. I think
3044 this introduces a dependency on python 2.2.
3050 this introduces a dependency on python 2.2.
3045
3051
3046 2004-01-13 Fernando Perez <fperez@colorado.edu>
3052 2004-01-13 Fernando Perez <fperez@colorado.edu>
3047
3053
3048 * IPython/numutils.py (exp_safe): simplified the code a bit and
3054 * IPython/numutils.py (exp_safe): simplified the code a bit and
3049 removed the need for importing the kinds module altogether.
3055 removed the need for importing the kinds module altogether.
3050
3056
3051 2004-01-06 Fernando Perez <fperez@colorado.edu>
3057 2004-01-06 Fernando Perez <fperez@colorado.edu>
3052
3058
3053 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3059 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3054 a magic function instead, after some community feedback. No
3060 a magic function instead, after some community feedback. No
3055 special syntax will exist for it, but its name is deliberately
3061 special syntax will exist for it, but its name is deliberately
3056 very short.
3062 very short.
3057
3063
3058 2003-12-20 Fernando Perez <fperez@colorado.edu>
3064 2003-12-20 Fernando Perez <fperez@colorado.edu>
3059
3065
3060 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3066 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3061 new functionality, to automagically assign the result of a shell
3067 new functionality, to automagically assign the result of a shell
3062 command to a variable. I'll solicit some community feedback on
3068 command to a variable. I'll solicit some community feedback on
3063 this before making it permanent.
3069 this before making it permanent.
3064
3070
3065 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3071 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3066 requested about callables for which inspect couldn't obtain a
3072 requested about callables for which inspect couldn't obtain a
3067 proper argspec. Thanks to a crash report sent by Etienne
3073 proper argspec. Thanks to a crash report sent by Etienne
3068 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3074 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3069
3075
3070 2003-12-09 Fernando Perez <fperez@colorado.edu>
3076 2003-12-09 Fernando Perez <fperez@colorado.edu>
3071
3077
3072 * IPython/genutils.py (page): patch for the pager to work across
3078 * IPython/genutils.py (page): patch for the pager to work across
3073 various versions of Windows. By Gary Bishop.
3079 various versions of Windows. By Gary Bishop.
3074
3080
3075 2003-12-04 Fernando Perez <fperez@colorado.edu>
3081 2003-12-04 Fernando Perez <fperez@colorado.edu>
3076
3082
3077 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3083 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3078 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3084 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3079 While I tested this and it looks ok, there may still be corner
3085 While I tested this and it looks ok, there may still be corner
3080 cases I've missed.
3086 cases I've missed.
3081
3087
3082 2003-12-01 Fernando Perez <fperez@colorado.edu>
3088 2003-12-01 Fernando Perez <fperez@colorado.edu>
3083
3089
3084 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3090 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3085 where a line like 'p,q=1,2' would fail because the automagic
3091 where a line like 'p,q=1,2' would fail because the automagic
3086 system would be triggered for @p.
3092 system would be triggered for @p.
3087
3093
3088 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3094 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3089 cleanups, code unmodified.
3095 cleanups, code unmodified.
3090
3096
3091 * IPython/genutils.py (Term): added a class for IPython to handle
3097 * IPython/genutils.py (Term): added a class for IPython to handle
3092 output. In most cases it will just be a proxy for stdout/err, but
3098 output. In most cases it will just be a proxy for stdout/err, but
3093 having this allows modifications to be made for some platforms,
3099 having this allows modifications to be made for some platforms,
3094 such as handling color escapes under Windows. All of this code
3100 such as handling color escapes under Windows. All of this code
3095 was contributed by Gary Bishop, with minor modifications by me.
3101 was contributed by Gary Bishop, with minor modifications by me.
3096 The actual changes affect many files.
3102 The actual changes affect many files.
3097
3103
3098 2003-11-30 Fernando Perez <fperez@colorado.edu>
3104 2003-11-30 Fernando Perez <fperez@colorado.edu>
3099
3105
3100 * IPython/iplib.py (file_matches): new completion code, courtesy
3106 * IPython/iplib.py (file_matches): new completion code, courtesy
3101 of Jeff Collins. This enables filename completion again under
3107 of Jeff Collins. This enables filename completion again under
3102 python 2.3, which disabled it at the C level.
3108 python 2.3, which disabled it at the C level.
3103
3109
3104 2003-11-11 Fernando Perez <fperez@colorado.edu>
3110 2003-11-11 Fernando Perez <fperez@colorado.edu>
3105
3111
3106 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3112 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3107 for Numeric.array(map(...)), but often convenient.
3113 for Numeric.array(map(...)), but often convenient.
3108
3114
3109 2003-11-05 Fernando Perez <fperez@colorado.edu>
3115 2003-11-05 Fernando Perez <fperez@colorado.edu>
3110
3116
3111 * IPython/numutils.py (frange): Changed a call from int() to
3117 * IPython/numutils.py (frange): Changed a call from int() to
3112 int(round()) to prevent a problem reported with arange() in the
3118 int(round()) to prevent a problem reported with arange() in the
3113 numpy list.
3119 numpy list.
3114
3120
3115 2003-10-06 Fernando Perez <fperez@colorado.edu>
3121 2003-10-06 Fernando Perez <fperez@colorado.edu>
3116
3122
3117 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3123 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3118 prevent crashes if sys lacks an argv attribute (it happens with
3124 prevent crashes if sys lacks an argv attribute (it happens with
3119 embedded interpreters which build a bare-bones sys module).
3125 embedded interpreters which build a bare-bones sys module).
3120 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3126 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3121
3127
3122 2003-09-24 Fernando Perez <fperez@colorado.edu>
3128 2003-09-24 Fernando Perez <fperez@colorado.edu>
3123
3129
3124 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3130 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3125 to protect against poorly written user objects where __getattr__
3131 to protect against poorly written user objects where __getattr__
3126 raises exceptions other than AttributeError. Thanks to a bug
3132 raises exceptions other than AttributeError. Thanks to a bug
3127 report by Oliver Sander <osander-AT-gmx.de>.
3133 report by Oliver Sander <osander-AT-gmx.de>.
3128
3134
3129 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3135 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3130 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3136 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3131
3137
3132 2003-09-09 Fernando Perez <fperez@colorado.edu>
3138 2003-09-09 Fernando Perez <fperez@colorado.edu>
3133
3139
3134 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3140 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3135 unpacking a list whith a callable as first element would
3141 unpacking a list whith a callable as first element would
3136 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3142 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3137 Collins.
3143 Collins.
3138
3144
3139 2003-08-25 *** Released version 0.5.0
3145 2003-08-25 *** Released version 0.5.0
3140
3146
3141 2003-08-22 Fernando Perez <fperez@colorado.edu>
3147 2003-08-22 Fernando Perez <fperez@colorado.edu>
3142
3148
3143 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3149 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3144 improperly defined user exceptions. Thanks to feedback from Mark
3150 improperly defined user exceptions. Thanks to feedback from Mark
3145 Russell <mrussell-AT-verio.net>.
3151 Russell <mrussell-AT-verio.net>.
3146
3152
3147 2003-08-20 Fernando Perez <fperez@colorado.edu>
3153 2003-08-20 Fernando Perez <fperez@colorado.edu>
3148
3154
3149 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3155 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3150 printing so that it would print multi-line string forms starting
3156 printing so that it would print multi-line string forms starting
3151 with a new line. This way the formatting is better respected for
3157 with a new line. This way the formatting is better respected for
3152 objects which work hard to make nice string forms.
3158 objects which work hard to make nice string forms.
3153
3159
3154 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3160 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3155 autocall would overtake data access for objects with both
3161 autocall would overtake data access for objects with both
3156 __getitem__ and __call__.
3162 __getitem__ and __call__.
3157
3163
3158 2003-08-19 *** Released version 0.5.0-rc1
3164 2003-08-19 *** Released version 0.5.0-rc1
3159
3165
3160 2003-08-19 Fernando Perez <fperez@colorado.edu>
3166 2003-08-19 Fernando Perez <fperez@colorado.edu>
3161
3167
3162 * IPython/deep_reload.py (load_tail): single tiny change here
3168 * IPython/deep_reload.py (load_tail): single tiny change here
3163 seems to fix the long-standing bug of dreload() failing to work
3169 seems to fix the long-standing bug of dreload() failing to work
3164 for dotted names. But this module is pretty tricky, so I may have
3170 for dotted names. But this module is pretty tricky, so I may have
3165 missed some subtlety. Needs more testing!.
3171 missed some subtlety. Needs more testing!.
3166
3172
3167 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3173 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3168 exceptions which have badly implemented __str__ methods.
3174 exceptions which have badly implemented __str__ methods.
3169 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3175 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3170 which I've been getting reports about from Python 2.3 users. I
3176 which I've been getting reports about from Python 2.3 users. I
3171 wish I had a simple test case to reproduce the problem, so I could
3177 wish I had a simple test case to reproduce the problem, so I could
3172 either write a cleaner workaround or file a bug report if
3178 either write a cleaner workaround or file a bug report if
3173 necessary.
3179 necessary.
3174
3180
3175 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3181 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3176 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3182 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3177 a bug report by Tjabo Kloppenburg.
3183 a bug report by Tjabo Kloppenburg.
3178
3184
3179 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3185 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3180 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3186 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3181 seems rather unstable. Thanks to a bug report by Tjabo
3187 seems rather unstable. Thanks to a bug report by Tjabo
3182 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3188 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3183
3189
3184 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3190 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3185 this out soon because of the critical fixes in the inner loop for
3191 this out soon because of the critical fixes in the inner loop for
3186 generators.
3192 generators.
3187
3193
3188 * IPython/Magic.py (Magic.getargspec): removed. This (and
3194 * IPython/Magic.py (Magic.getargspec): removed. This (and
3189 _get_def) have been obsoleted by OInspect for a long time, I
3195 _get_def) have been obsoleted by OInspect for a long time, I
3190 hadn't noticed that they were dead code.
3196 hadn't noticed that they were dead code.
3191 (Magic._ofind): restored _ofind functionality for a few literals
3197 (Magic._ofind): restored _ofind functionality for a few literals
3192 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3198 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3193 for things like "hello".capitalize?, since that would require a
3199 for things like "hello".capitalize?, since that would require a
3194 potentially dangerous eval() again.
3200 potentially dangerous eval() again.
3195
3201
3196 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3202 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3197 logic a bit more to clean up the escapes handling and minimize the
3203 logic a bit more to clean up the escapes handling and minimize the
3198 use of _ofind to only necessary cases. The interactive 'feel' of
3204 use of _ofind to only necessary cases. The interactive 'feel' of
3199 IPython should have improved quite a bit with the changes in
3205 IPython should have improved quite a bit with the changes in
3200 _prefilter and _ofind (besides being far safer than before).
3206 _prefilter and _ofind (besides being far safer than before).
3201
3207
3202 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3208 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3203 obscure, never reported). Edit would fail to find the object to
3209 obscure, never reported). Edit would fail to find the object to
3204 edit under some circumstances.
3210 edit under some circumstances.
3205 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3211 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3206 which were causing double-calling of generators. Those eval calls
3212 which were causing double-calling of generators. Those eval calls
3207 were _very_ dangerous, since code with side effects could be
3213 were _very_ dangerous, since code with side effects could be
3208 triggered. As they say, 'eval is evil'... These were the
3214 triggered. As they say, 'eval is evil'... These were the
3209 nastiest evals in IPython. Besides, _ofind is now far simpler,
3215 nastiest evals in IPython. Besides, _ofind is now far simpler,
3210 and it should also be quite a bit faster. Its use of inspect is
3216 and it should also be quite a bit faster. Its use of inspect is
3211 also safer, so perhaps some of the inspect-related crashes I've
3217 also safer, so perhaps some of the inspect-related crashes I've
3212 seen lately with Python 2.3 might be taken care of. That will
3218 seen lately with Python 2.3 might be taken care of. That will
3213 need more testing.
3219 need more testing.
3214
3220
3215 2003-08-17 Fernando Perez <fperez@colorado.edu>
3221 2003-08-17 Fernando Perez <fperez@colorado.edu>
3216
3222
3217 * IPython/iplib.py (InteractiveShell._prefilter): significant
3223 * IPython/iplib.py (InteractiveShell._prefilter): significant
3218 simplifications to the logic for handling user escapes. Faster
3224 simplifications to the logic for handling user escapes. Faster
3219 and simpler code.
3225 and simpler code.
3220
3226
3221 2003-08-14 Fernando Perez <fperez@colorado.edu>
3227 2003-08-14 Fernando Perez <fperez@colorado.edu>
3222
3228
3223 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3229 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3224 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3230 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3225 but it should be quite a bit faster. And the recursive version
3231 but it should be quite a bit faster. And the recursive version
3226 generated O(log N) intermediate storage for all rank>1 arrays,
3232 generated O(log N) intermediate storage for all rank>1 arrays,
3227 even if they were contiguous.
3233 even if they were contiguous.
3228 (l1norm): Added this function.
3234 (l1norm): Added this function.
3229 (norm): Added this function for arbitrary norms (including
3235 (norm): Added this function for arbitrary norms (including
3230 l-infinity). l1 and l2 are still special cases for convenience
3236 l-infinity). l1 and l2 are still special cases for convenience
3231 and speed.
3237 and speed.
3232
3238
3233 2003-08-03 Fernando Perez <fperez@colorado.edu>
3239 2003-08-03 Fernando Perez <fperez@colorado.edu>
3234
3240
3235 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3241 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3236 exceptions, which now raise PendingDeprecationWarnings in Python
3242 exceptions, which now raise PendingDeprecationWarnings in Python
3237 2.3. There were some in Magic and some in Gnuplot2.
3243 2.3. There were some in Magic and some in Gnuplot2.
3238
3244
3239 2003-06-30 Fernando Perez <fperez@colorado.edu>
3245 2003-06-30 Fernando Perez <fperez@colorado.edu>
3240
3246
3241 * IPython/genutils.py (page): modified to call curses only for
3247 * IPython/genutils.py (page): modified to call curses only for
3242 terminals where TERM=='xterm'. After problems under many other
3248 terminals where TERM=='xterm'. After problems under many other
3243 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3249 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3244
3250
3245 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3251 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3246 would be triggered when readline was absent. This was just an old
3252 would be triggered when readline was absent. This was just an old
3247 debugging statement I'd forgotten to take out.
3253 debugging statement I'd forgotten to take out.
3248
3254
3249 2003-06-20 Fernando Perez <fperez@colorado.edu>
3255 2003-06-20 Fernando Perez <fperez@colorado.edu>
3250
3256
3251 * IPython/genutils.py (clock): modified to return only user time
3257 * IPython/genutils.py (clock): modified to return only user time
3252 (not counting system time), after a discussion on scipy. While
3258 (not counting system time), after a discussion on scipy. While
3253 system time may be a useful quantity occasionally, it may much
3259 system time may be a useful quantity occasionally, it may much
3254 more easily be skewed by occasional swapping or other similar
3260 more easily be skewed by occasional swapping or other similar
3255 activity.
3261 activity.
3256
3262
3257 2003-06-05 Fernando Perez <fperez@colorado.edu>
3263 2003-06-05 Fernando Perez <fperez@colorado.edu>
3258
3264
3259 * IPython/numutils.py (identity): new function, for building
3265 * IPython/numutils.py (identity): new function, for building
3260 arbitrary rank Kronecker deltas (mostly backwards compatible with
3266 arbitrary rank Kronecker deltas (mostly backwards compatible with
3261 Numeric.identity)
3267 Numeric.identity)
3262
3268
3263 2003-06-03 Fernando Perez <fperez@colorado.edu>
3269 2003-06-03 Fernando Perez <fperez@colorado.edu>
3264
3270
3265 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3271 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3266 arguments passed to magics with spaces, to allow trailing '\' to
3272 arguments passed to magics with spaces, to allow trailing '\' to
3267 work normally (mainly for Windows users).
3273 work normally (mainly for Windows users).
3268
3274
3269 2003-05-29 Fernando Perez <fperez@colorado.edu>
3275 2003-05-29 Fernando Perez <fperez@colorado.edu>
3270
3276
3271 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3277 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3272 instead of pydoc.help. This fixes a bizarre behavior where
3278 instead of pydoc.help. This fixes a bizarre behavior where
3273 printing '%s' % locals() would trigger the help system. Now
3279 printing '%s' % locals() would trigger the help system. Now
3274 ipython behaves like normal python does.
3280 ipython behaves like normal python does.
3275
3281
3276 Note that if one does 'from pydoc import help', the bizarre
3282 Note that if one does 'from pydoc import help', the bizarre
3277 behavior returns, but this will also happen in normal python, so
3283 behavior returns, but this will also happen in normal python, so
3278 it's not an ipython bug anymore (it has to do with how pydoc.help
3284 it's not an ipython bug anymore (it has to do with how pydoc.help
3279 is implemented).
3285 is implemented).
3280
3286
3281 2003-05-22 Fernando Perez <fperez@colorado.edu>
3287 2003-05-22 Fernando Perez <fperez@colorado.edu>
3282
3288
3283 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3289 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3284 return [] instead of None when nothing matches, also match to end
3290 return [] instead of None when nothing matches, also match to end
3285 of line. Patch by Gary Bishop.
3291 of line. Patch by Gary Bishop.
3286
3292
3287 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3293 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3288 protection as before, for files passed on the command line. This
3294 protection as before, for files passed on the command line. This
3289 prevents the CrashHandler from kicking in if user files call into
3295 prevents the CrashHandler from kicking in if user files call into
3290 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3296 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3291 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3297 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3292
3298
3293 2003-05-20 *** Released version 0.4.0
3299 2003-05-20 *** Released version 0.4.0
3294
3300
3295 2003-05-20 Fernando Perez <fperez@colorado.edu>
3301 2003-05-20 Fernando Perez <fperez@colorado.edu>
3296
3302
3297 * setup.py: added support for manpages. It's a bit hackish b/c of
3303 * setup.py: added support for manpages. It's a bit hackish b/c of
3298 a bug in the way the bdist_rpm distutils target handles gzipped
3304 a bug in the way the bdist_rpm distutils target handles gzipped
3299 manpages, but it works. After a patch by Jack.
3305 manpages, but it works. After a patch by Jack.
3300
3306
3301 2003-05-19 Fernando Perez <fperez@colorado.edu>
3307 2003-05-19 Fernando Perez <fperez@colorado.edu>
3302
3308
3303 * IPython/numutils.py: added a mockup of the kinds module, since
3309 * IPython/numutils.py: added a mockup of the kinds module, since
3304 it was recently removed from Numeric. This way, numutils will
3310 it was recently removed from Numeric. This way, numutils will
3305 work for all users even if they are missing kinds.
3311 work for all users even if they are missing kinds.
3306
3312
3307 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3313 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3308 failure, which can occur with SWIG-wrapped extensions. After a
3314 failure, which can occur with SWIG-wrapped extensions. After a
3309 crash report from Prabhu.
3315 crash report from Prabhu.
3310
3316
3311 2003-05-16 Fernando Perez <fperez@colorado.edu>
3317 2003-05-16 Fernando Perez <fperez@colorado.edu>
3312
3318
3313 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3319 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3314 protect ipython from user code which may call directly
3320 protect ipython from user code which may call directly
3315 sys.excepthook (this looks like an ipython crash to the user, even
3321 sys.excepthook (this looks like an ipython crash to the user, even
3316 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3322 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3317 This is especially important to help users of WxWindows, but may
3323 This is especially important to help users of WxWindows, but may
3318 also be useful in other cases.
3324 also be useful in other cases.
3319
3325
3320 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3326 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3321 an optional tb_offset to be specified, and to preserve exception
3327 an optional tb_offset to be specified, and to preserve exception
3322 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3328 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3323
3329
3324 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3330 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3325
3331
3326 2003-05-15 Fernando Perez <fperez@colorado.edu>
3332 2003-05-15 Fernando Perez <fperez@colorado.edu>
3327
3333
3328 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3334 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3329 installing for a new user under Windows.
3335 installing for a new user under Windows.
3330
3336
3331 2003-05-12 Fernando Perez <fperez@colorado.edu>
3337 2003-05-12 Fernando Perez <fperez@colorado.edu>
3332
3338
3333 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3339 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3334 handler for Emacs comint-based lines. Currently it doesn't do
3340 handler for Emacs comint-based lines. Currently it doesn't do
3335 much (but importantly, it doesn't update the history cache). In
3341 much (but importantly, it doesn't update the history cache). In
3336 the future it may be expanded if Alex needs more functionality
3342 the future it may be expanded if Alex needs more functionality
3337 there.
3343 there.
3338
3344
3339 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3345 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3340 info to crash reports.
3346 info to crash reports.
3341
3347
3342 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3348 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3343 just like Python's -c. Also fixed crash with invalid -color
3349 just like Python's -c. Also fixed crash with invalid -color
3344 option value at startup. Thanks to Will French
3350 option value at startup. Thanks to Will French
3345 <wfrench-AT-bestweb.net> for the bug report.
3351 <wfrench-AT-bestweb.net> for the bug report.
3346
3352
3347 2003-05-09 Fernando Perez <fperez@colorado.edu>
3353 2003-05-09 Fernando Perez <fperez@colorado.edu>
3348
3354
3349 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3355 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3350 to EvalDict (it's a mapping, after all) and simplified its code
3356 to EvalDict (it's a mapping, after all) and simplified its code
3351 quite a bit, after a nice discussion on c.l.py where Gustavo
3357 quite a bit, after a nice discussion on c.l.py where Gustavo
3352 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3358 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3353
3359
3354 2003-04-30 Fernando Perez <fperez@colorado.edu>
3360 2003-04-30 Fernando Perez <fperez@colorado.edu>
3355
3361
3356 * IPython/genutils.py (timings_out): modified it to reduce its
3362 * IPython/genutils.py (timings_out): modified it to reduce its
3357 overhead in the common reps==1 case.
3363 overhead in the common reps==1 case.
3358
3364
3359 2003-04-29 Fernando Perez <fperez@colorado.edu>
3365 2003-04-29 Fernando Perez <fperez@colorado.edu>
3360
3366
3361 * IPython/genutils.py (timings_out): Modified to use the resource
3367 * IPython/genutils.py (timings_out): Modified to use the resource
3362 module, which avoids the wraparound problems of time.clock().
3368 module, which avoids the wraparound problems of time.clock().
3363
3369
3364 2003-04-17 *** Released version 0.2.15pre4
3370 2003-04-17 *** Released version 0.2.15pre4
3365
3371
3366 2003-04-17 Fernando Perez <fperez@colorado.edu>
3372 2003-04-17 Fernando Perez <fperez@colorado.edu>
3367
3373
3368 * setup.py (scriptfiles): Split windows-specific stuff over to a
3374 * setup.py (scriptfiles): Split windows-specific stuff over to a
3369 separate file, in an attempt to have a Windows GUI installer.
3375 separate file, in an attempt to have a Windows GUI installer.
3370 That didn't work, but part of the groundwork is done.
3376 That didn't work, but part of the groundwork is done.
3371
3377
3372 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3378 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3373 indent/unindent with 4 spaces. Particularly useful in combination
3379 indent/unindent with 4 spaces. Particularly useful in combination
3374 with the new auto-indent option.
3380 with the new auto-indent option.
3375
3381
3376 2003-04-16 Fernando Perez <fperez@colorado.edu>
3382 2003-04-16 Fernando Perez <fperez@colorado.edu>
3377
3383
3378 * IPython/Magic.py: various replacements of self.rc for
3384 * IPython/Magic.py: various replacements of self.rc for
3379 self.shell.rc. A lot more remains to be done to fully disentangle
3385 self.shell.rc. A lot more remains to be done to fully disentangle
3380 this class from the main Shell class.
3386 this class from the main Shell class.
3381
3387
3382 * IPython/GnuplotRuntime.py: added checks for mouse support so
3388 * IPython/GnuplotRuntime.py: added checks for mouse support so
3383 that we don't try to enable it if the current gnuplot doesn't
3389 that we don't try to enable it if the current gnuplot doesn't
3384 really support it. Also added checks so that we don't try to
3390 really support it. Also added checks so that we don't try to
3385 enable persist under Windows (where Gnuplot doesn't recognize the
3391 enable persist under Windows (where Gnuplot doesn't recognize the
3386 option).
3392 option).
3387
3393
3388 * IPython/iplib.py (InteractiveShell.interact): Added optional
3394 * IPython/iplib.py (InteractiveShell.interact): Added optional
3389 auto-indenting code, after a patch by King C. Shu
3395 auto-indenting code, after a patch by King C. Shu
3390 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3396 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3391 get along well with pasting indented code. If I ever figure out
3397 get along well with pasting indented code. If I ever figure out
3392 how to make that part go well, it will become on by default.
3398 how to make that part go well, it will become on by default.
3393
3399
3394 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3400 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3395 crash ipython if there was an unmatched '%' in the user's prompt
3401 crash ipython if there was an unmatched '%' in the user's prompt
3396 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3402 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3397
3403
3398 * IPython/iplib.py (InteractiveShell.interact): removed the
3404 * IPython/iplib.py (InteractiveShell.interact): removed the
3399 ability to ask the user whether he wants to crash or not at the
3405 ability to ask the user whether he wants to crash or not at the
3400 'last line' exception handler. Calling functions at that point
3406 'last line' exception handler. Calling functions at that point
3401 changes the stack, and the error reports would have incorrect
3407 changes the stack, and the error reports would have incorrect
3402 tracebacks.
3408 tracebacks.
3403
3409
3404 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3410 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3405 pass through a peger a pretty-printed form of any object. After a
3411 pass through a peger a pretty-printed form of any object. After a
3406 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3412 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3407
3413
3408 2003-04-14 Fernando Perez <fperez@colorado.edu>
3414 2003-04-14 Fernando Perez <fperez@colorado.edu>
3409
3415
3410 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3416 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3411 all files in ~ would be modified at first install (instead of
3417 all files in ~ would be modified at first install (instead of
3412 ~/.ipython). This could be potentially disastrous, as the
3418 ~/.ipython). This could be potentially disastrous, as the
3413 modification (make line-endings native) could damage binary files.
3419 modification (make line-endings native) could damage binary files.
3414
3420
3415 2003-04-10 Fernando Perez <fperez@colorado.edu>
3421 2003-04-10 Fernando Perez <fperez@colorado.edu>
3416
3422
3417 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3423 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3418 handle only lines which are invalid python. This now means that
3424 handle only lines which are invalid python. This now means that
3419 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3425 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3420 for the bug report.
3426 for the bug report.
3421
3427
3422 2003-04-01 Fernando Perez <fperez@colorado.edu>
3428 2003-04-01 Fernando Perez <fperez@colorado.edu>
3423
3429
3424 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3430 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3425 where failing to set sys.last_traceback would crash pdb.pm().
3431 where failing to set sys.last_traceback would crash pdb.pm().
3426 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3432 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3427 report.
3433 report.
3428
3434
3429 2003-03-25 Fernando Perez <fperez@colorado.edu>
3435 2003-03-25 Fernando Perez <fperez@colorado.edu>
3430
3436
3431 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3437 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3432 before printing it (it had a lot of spurious blank lines at the
3438 before printing it (it had a lot of spurious blank lines at the
3433 end).
3439 end).
3434
3440
3435 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3441 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3436 output would be sent 21 times! Obviously people don't use this
3442 output would be sent 21 times! Obviously people don't use this
3437 too often, or I would have heard about it.
3443 too often, or I would have heard about it.
3438
3444
3439 2003-03-24 Fernando Perez <fperez@colorado.edu>
3445 2003-03-24 Fernando Perez <fperez@colorado.edu>
3440
3446
3441 * setup.py (scriptfiles): renamed the data_files parameter from
3447 * setup.py (scriptfiles): renamed the data_files parameter from
3442 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3448 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3443 for the patch.
3449 for the patch.
3444
3450
3445 2003-03-20 Fernando Perez <fperez@colorado.edu>
3451 2003-03-20 Fernando Perez <fperez@colorado.edu>
3446
3452
3447 * IPython/genutils.py (error): added error() and fatal()
3453 * IPython/genutils.py (error): added error() and fatal()
3448 functions.
3454 functions.
3449
3455
3450 2003-03-18 *** Released version 0.2.15pre3
3456 2003-03-18 *** Released version 0.2.15pre3
3451
3457
3452 2003-03-18 Fernando Perez <fperez@colorado.edu>
3458 2003-03-18 Fernando Perez <fperez@colorado.edu>
3453
3459
3454 * setupext/install_data_ext.py
3460 * setupext/install_data_ext.py
3455 (install_data_ext.initialize_options): Class contributed by Jack
3461 (install_data_ext.initialize_options): Class contributed by Jack
3456 Moffit for fixing the old distutils hack. He is sending this to
3462 Moffit for fixing the old distutils hack. He is sending this to
3457 the distutils folks so in the future we may not need it as a
3463 the distutils folks so in the future we may not need it as a
3458 private fix.
3464 private fix.
3459
3465
3460 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3466 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3461 changes for Debian packaging. See his patch for full details.
3467 changes for Debian packaging. See his patch for full details.
3462 The old distutils hack of making the ipythonrc* files carry a
3468 The old distutils hack of making the ipythonrc* files carry a
3463 bogus .py extension is gone, at last. Examples were moved to a
3469 bogus .py extension is gone, at last. Examples were moved to a
3464 separate subdir under doc/, and the separate executable scripts
3470 separate subdir under doc/, and the separate executable scripts
3465 now live in their own directory. Overall a great cleanup. The
3471 now live in their own directory. Overall a great cleanup. The
3466 manual was updated to use the new files, and setup.py has been
3472 manual was updated to use the new files, and setup.py has been
3467 fixed for this setup.
3473 fixed for this setup.
3468
3474
3469 * IPython/PyColorize.py (Parser.usage): made non-executable and
3475 * IPython/PyColorize.py (Parser.usage): made non-executable and
3470 created a pycolor wrapper around it to be included as a script.
3476 created a pycolor wrapper around it to be included as a script.
3471
3477
3472 2003-03-12 *** Released version 0.2.15pre2
3478 2003-03-12 *** Released version 0.2.15pre2
3473
3479
3474 2003-03-12 Fernando Perez <fperez@colorado.edu>
3480 2003-03-12 Fernando Perez <fperez@colorado.edu>
3475
3481
3476 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3482 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3477 long-standing problem with garbage characters in some terminals.
3483 long-standing problem with garbage characters in some terminals.
3478 The issue was really that the \001 and \002 escapes must _only_ be
3484 The issue was really that the \001 and \002 escapes must _only_ be
3479 passed to input prompts (which call readline), but _never_ to
3485 passed to input prompts (which call readline), but _never_ to
3480 normal text to be printed on screen. I changed ColorANSI to have
3486 normal text to be printed on screen. I changed ColorANSI to have
3481 two classes: TermColors and InputTermColors, each with the
3487 two classes: TermColors and InputTermColors, each with the
3482 appropriate escapes for input prompts or normal text. The code in
3488 appropriate escapes for input prompts or normal text. The code in
3483 Prompts.py got slightly more complicated, but this very old and
3489 Prompts.py got slightly more complicated, but this very old and
3484 annoying bug is finally fixed.
3490 annoying bug is finally fixed.
3485
3491
3486 All the credit for nailing down the real origin of this problem
3492 All the credit for nailing down the real origin of this problem
3487 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3493 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3488 *Many* thanks to him for spending quite a bit of effort on this.
3494 *Many* thanks to him for spending quite a bit of effort on this.
3489
3495
3490 2003-03-05 *** Released version 0.2.15pre1
3496 2003-03-05 *** Released version 0.2.15pre1
3491
3497
3492 2003-03-03 Fernando Perez <fperez@colorado.edu>
3498 2003-03-03 Fernando Perez <fperez@colorado.edu>
3493
3499
3494 * IPython/FakeModule.py: Moved the former _FakeModule to a
3500 * IPython/FakeModule.py: Moved the former _FakeModule to a
3495 separate file, because it's also needed by Magic (to fix a similar
3501 separate file, because it's also needed by Magic (to fix a similar
3496 pickle-related issue in @run).
3502 pickle-related issue in @run).
3497
3503
3498 2003-03-02 Fernando Perez <fperez@colorado.edu>
3504 2003-03-02 Fernando Perez <fperez@colorado.edu>
3499
3505
3500 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3506 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3501 the autocall option at runtime.
3507 the autocall option at runtime.
3502 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3508 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3503 across Magic.py to start separating Magic from InteractiveShell.
3509 across Magic.py to start separating Magic from InteractiveShell.
3504 (Magic._ofind): Fixed to return proper namespace for dotted
3510 (Magic._ofind): Fixed to return proper namespace for dotted
3505 names. Before, a dotted name would always return 'not currently
3511 names. Before, a dotted name would always return 'not currently
3506 defined', because it would find the 'parent'. s.x would be found,
3512 defined', because it would find the 'parent'. s.x would be found,
3507 but since 'x' isn't defined by itself, it would get confused.
3513 but since 'x' isn't defined by itself, it would get confused.
3508 (Magic.magic_run): Fixed pickling problems reported by Ralf
3514 (Magic.magic_run): Fixed pickling problems reported by Ralf
3509 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3515 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3510 that I'd used when Mike Heeter reported similar issues at the
3516 that I'd used when Mike Heeter reported similar issues at the
3511 top-level, but now for @run. It boils down to injecting the
3517 top-level, but now for @run. It boils down to injecting the
3512 namespace where code is being executed with something that looks
3518 namespace where code is being executed with something that looks
3513 enough like a module to fool pickle.dump(). Since a pickle stores
3519 enough like a module to fool pickle.dump(). Since a pickle stores
3514 a named reference to the importing module, we need this for
3520 a named reference to the importing module, we need this for
3515 pickles to save something sensible.
3521 pickles to save something sensible.
3516
3522
3517 * IPython/ipmaker.py (make_IPython): added an autocall option.
3523 * IPython/ipmaker.py (make_IPython): added an autocall option.
3518
3524
3519 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3525 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3520 the auto-eval code. Now autocalling is an option, and the code is
3526 the auto-eval code. Now autocalling is an option, and the code is
3521 also vastly safer. There is no more eval() involved at all.
3527 also vastly safer. There is no more eval() involved at all.
3522
3528
3523 2003-03-01 Fernando Perez <fperez@colorado.edu>
3529 2003-03-01 Fernando Perez <fperez@colorado.edu>
3524
3530
3525 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3531 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3526 dict with named keys instead of a tuple.
3532 dict with named keys instead of a tuple.
3527
3533
3528 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3534 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3529
3535
3530 * setup.py (make_shortcut): Fixed message about directories
3536 * setup.py (make_shortcut): Fixed message about directories
3531 created during Windows installation (the directories were ok, just
3537 created during Windows installation (the directories were ok, just
3532 the printed message was misleading). Thanks to Chris Liechti
3538 the printed message was misleading). Thanks to Chris Liechti
3533 <cliechti-AT-gmx.net> for the heads up.
3539 <cliechti-AT-gmx.net> for the heads up.
3534
3540
3535 2003-02-21 Fernando Perez <fperez@colorado.edu>
3541 2003-02-21 Fernando Perez <fperez@colorado.edu>
3536
3542
3537 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3543 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3538 of ValueError exception when checking for auto-execution. This
3544 of ValueError exception when checking for auto-execution. This
3539 one is raised by things like Numeric arrays arr.flat when the
3545 one is raised by things like Numeric arrays arr.flat when the
3540 array is non-contiguous.
3546 array is non-contiguous.
3541
3547
3542 2003-01-31 Fernando Perez <fperez@colorado.edu>
3548 2003-01-31 Fernando Perez <fperez@colorado.edu>
3543
3549
3544 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3550 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3545 not return any value at all (even though the command would get
3551 not return any value at all (even though the command would get
3546 executed).
3552 executed).
3547 (xsys): Flush stdout right after printing the command to ensure
3553 (xsys): Flush stdout right after printing the command to ensure
3548 proper ordering of commands and command output in the total
3554 proper ordering of commands and command output in the total
3549 output.
3555 output.
3550 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3556 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3551 system/getoutput as defaults. The old ones are kept for
3557 system/getoutput as defaults. The old ones are kept for
3552 compatibility reasons, so no code which uses this library needs
3558 compatibility reasons, so no code which uses this library needs
3553 changing.
3559 changing.
3554
3560
3555 2003-01-27 *** Released version 0.2.14
3561 2003-01-27 *** Released version 0.2.14
3556
3562
3557 2003-01-25 Fernando Perez <fperez@colorado.edu>
3563 2003-01-25 Fernando Perez <fperez@colorado.edu>
3558
3564
3559 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3565 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3560 functions defined in previous edit sessions could not be re-edited
3566 functions defined in previous edit sessions could not be re-edited
3561 (because the temp files were immediately removed). Now temp files
3567 (because the temp files were immediately removed). Now temp files
3562 are removed only at IPython's exit.
3568 are removed only at IPython's exit.
3563 (Magic.magic_run): Improved @run to perform shell-like expansions
3569 (Magic.magic_run): Improved @run to perform shell-like expansions
3564 on its arguments (~users and $VARS). With this, @run becomes more
3570 on its arguments (~users and $VARS). With this, @run becomes more
3565 like a normal command-line.
3571 like a normal command-line.
3566
3572
3567 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3573 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3568 bugs related to embedding and cleaned up that code. A fairly
3574 bugs related to embedding and cleaned up that code. A fairly
3569 important one was the impossibility to access the global namespace
3575 important one was the impossibility to access the global namespace
3570 through the embedded IPython (only local variables were visible).
3576 through the embedded IPython (only local variables were visible).
3571
3577
3572 2003-01-14 Fernando Perez <fperez@colorado.edu>
3578 2003-01-14 Fernando Perez <fperez@colorado.edu>
3573
3579
3574 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3580 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3575 auto-calling to be a bit more conservative. Now it doesn't get
3581 auto-calling to be a bit more conservative. Now it doesn't get
3576 triggered if any of '!=()<>' are in the rest of the input line, to
3582 triggered if any of '!=()<>' are in the rest of the input line, to
3577 allow comparing callables. Thanks to Alex for the heads up.
3583 allow comparing callables. Thanks to Alex for the heads up.
3578
3584
3579 2003-01-07 Fernando Perez <fperez@colorado.edu>
3585 2003-01-07 Fernando Perez <fperez@colorado.edu>
3580
3586
3581 * IPython/genutils.py (page): fixed estimation of the number of
3587 * IPython/genutils.py (page): fixed estimation of the number of
3582 lines in a string to be paged to simply count newlines. This
3588 lines in a string to be paged to simply count newlines. This
3583 prevents over-guessing due to embedded escape sequences. A better
3589 prevents over-guessing due to embedded escape sequences. A better
3584 long-term solution would involve stripping out the control chars
3590 long-term solution would involve stripping out the control chars
3585 for the count, but it's potentially so expensive I just don't
3591 for the count, but it's potentially so expensive I just don't
3586 think it's worth doing.
3592 think it's worth doing.
3587
3593
3588 2002-12-19 *** Released version 0.2.14pre50
3594 2002-12-19 *** Released version 0.2.14pre50
3589
3595
3590 2002-12-19 Fernando Perez <fperez@colorado.edu>
3596 2002-12-19 Fernando Perez <fperez@colorado.edu>
3591
3597
3592 * tools/release (version): Changed release scripts to inform
3598 * tools/release (version): Changed release scripts to inform
3593 Andrea and build a NEWS file with a list of recent changes.
3599 Andrea and build a NEWS file with a list of recent changes.
3594
3600
3595 * IPython/ColorANSI.py (__all__): changed terminal detection
3601 * IPython/ColorANSI.py (__all__): changed terminal detection
3596 code. Seems to work better for xterms without breaking
3602 code. Seems to work better for xterms without breaking
3597 konsole. Will need more testing to determine if WinXP and Mac OSX
3603 konsole. Will need more testing to determine if WinXP and Mac OSX
3598 also work ok.
3604 also work ok.
3599
3605
3600 2002-12-18 *** Released version 0.2.14pre49
3606 2002-12-18 *** Released version 0.2.14pre49
3601
3607
3602 2002-12-18 Fernando Perez <fperez@colorado.edu>
3608 2002-12-18 Fernando Perez <fperez@colorado.edu>
3603
3609
3604 * Docs: added new info about Mac OSX, from Andrea.
3610 * Docs: added new info about Mac OSX, from Andrea.
3605
3611
3606 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3612 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3607 allow direct plotting of python strings whose format is the same
3613 allow direct plotting of python strings whose format is the same
3608 of gnuplot data files.
3614 of gnuplot data files.
3609
3615
3610 2002-12-16 Fernando Perez <fperez@colorado.edu>
3616 2002-12-16 Fernando Perez <fperez@colorado.edu>
3611
3617
3612 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3618 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3613 value of exit question to be acknowledged.
3619 value of exit question to be acknowledged.
3614
3620
3615 2002-12-03 Fernando Perez <fperez@colorado.edu>
3621 2002-12-03 Fernando Perez <fperez@colorado.edu>
3616
3622
3617 * IPython/ipmaker.py: removed generators, which had been added
3623 * IPython/ipmaker.py: removed generators, which had been added
3618 by mistake in an earlier debugging run. This was causing trouble
3624 by mistake in an earlier debugging run. This was causing trouble
3619 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3625 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3620 for pointing this out.
3626 for pointing this out.
3621
3627
3622 2002-11-17 Fernando Perez <fperez@colorado.edu>
3628 2002-11-17 Fernando Perez <fperez@colorado.edu>
3623
3629
3624 * Manual: updated the Gnuplot section.
3630 * Manual: updated the Gnuplot section.
3625
3631
3626 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3632 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3627 a much better split of what goes in Runtime and what goes in
3633 a much better split of what goes in Runtime and what goes in
3628 Interactive.
3634 Interactive.
3629
3635
3630 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3636 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3631 being imported from iplib.
3637 being imported from iplib.
3632
3638
3633 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3639 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3634 for command-passing. Now the global Gnuplot instance is called
3640 for command-passing. Now the global Gnuplot instance is called
3635 'gp' instead of 'g', which was really a far too fragile and
3641 'gp' instead of 'g', which was really a far too fragile and
3636 common name.
3642 common name.
3637
3643
3638 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3644 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3639 bounding boxes generated by Gnuplot for square plots.
3645 bounding boxes generated by Gnuplot for square plots.
3640
3646
3641 * IPython/genutils.py (popkey): new function added. I should
3647 * IPython/genutils.py (popkey): new function added. I should
3642 suggest this on c.l.py as a dict method, it seems useful.
3648 suggest this on c.l.py as a dict method, it seems useful.
3643
3649
3644 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3650 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3645 to transparently handle PostScript generation. MUCH better than
3651 to transparently handle PostScript generation. MUCH better than
3646 the previous plot_eps/replot_eps (which I removed now). The code
3652 the previous plot_eps/replot_eps (which I removed now). The code
3647 is also fairly clean and well documented now (including
3653 is also fairly clean and well documented now (including
3648 docstrings).
3654 docstrings).
3649
3655
3650 2002-11-13 Fernando Perez <fperez@colorado.edu>
3656 2002-11-13 Fernando Perez <fperez@colorado.edu>
3651
3657
3652 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3658 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3653 (inconsistent with options).
3659 (inconsistent with options).
3654
3660
3655 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3661 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3656 manually disabled, I don't know why. Fixed it.
3662 manually disabled, I don't know why. Fixed it.
3657 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3663 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3658 eps output.
3664 eps output.
3659
3665
3660 2002-11-12 Fernando Perez <fperez@colorado.edu>
3666 2002-11-12 Fernando Perez <fperez@colorado.edu>
3661
3667
3662 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3668 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3663 don't propagate up to caller. Fixes crash reported by François
3669 don't propagate up to caller. Fixes crash reported by François
3664 Pinard.
3670 Pinard.
3665
3671
3666 2002-11-09 Fernando Perez <fperez@colorado.edu>
3672 2002-11-09 Fernando Perez <fperez@colorado.edu>
3667
3673
3668 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3674 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3669 history file for new users.
3675 history file for new users.
3670 (make_IPython): fixed bug where initial install would leave the
3676 (make_IPython): fixed bug where initial install would leave the
3671 user running in the .ipython dir.
3677 user running in the .ipython dir.
3672 (make_IPython): fixed bug where config dir .ipython would be
3678 (make_IPython): fixed bug where config dir .ipython would be
3673 created regardless of the given -ipythondir option. Thanks to Cory
3679 created regardless of the given -ipythondir option. Thanks to Cory
3674 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3680 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3675
3681
3676 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3682 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3677 type confirmations. Will need to use it in all of IPython's code
3683 type confirmations. Will need to use it in all of IPython's code
3678 consistently.
3684 consistently.
3679
3685
3680 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3686 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3681 context to print 31 lines instead of the default 5. This will make
3687 context to print 31 lines instead of the default 5. This will make
3682 the crash reports extremely detailed in case the problem is in
3688 the crash reports extremely detailed in case the problem is in
3683 libraries I don't have access to.
3689 libraries I don't have access to.
3684
3690
3685 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3691 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3686 line of defense' code to still crash, but giving users fair
3692 line of defense' code to still crash, but giving users fair
3687 warning. I don't want internal errors to go unreported: if there's
3693 warning. I don't want internal errors to go unreported: if there's
3688 an internal problem, IPython should crash and generate a full
3694 an internal problem, IPython should crash and generate a full
3689 report.
3695 report.
3690
3696
3691 2002-11-08 Fernando Perez <fperez@colorado.edu>
3697 2002-11-08 Fernando Perez <fperez@colorado.edu>
3692
3698
3693 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3699 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3694 otherwise uncaught exceptions which can appear if people set
3700 otherwise uncaught exceptions which can appear if people set
3695 sys.stdout to something badly broken. Thanks to a crash report
3701 sys.stdout to something badly broken. Thanks to a crash report
3696 from henni-AT-mail.brainbot.com.
3702 from henni-AT-mail.brainbot.com.
3697
3703
3698 2002-11-04 Fernando Perez <fperez@colorado.edu>
3704 2002-11-04 Fernando Perez <fperez@colorado.edu>
3699
3705
3700 * IPython/iplib.py (InteractiveShell.interact): added
3706 * IPython/iplib.py (InteractiveShell.interact): added
3701 __IPYTHON__active to the builtins. It's a flag which goes on when
3707 __IPYTHON__active to the builtins. It's a flag which goes on when
3702 the interaction starts and goes off again when it stops. This
3708 the interaction starts and goes off again when it stops. This
3703 allows embedding code to detect being inside IPython. Before this
3709 allows embedding code to detect being inside IPython. Before this
3704 was done via __IPYTHON__, but that only shows that an IPython
3710 was done via __IPYTHON__, but that only shows that an IPython
3705 instance has been created.
3711 instance has been created.
3706
3712
3707 * IPython/Magic.py (Magic.magic_env): I realized that in a
3713 * IPython/Magic.py (Magic.magic_env): I realized that in a
3708 UserDict, instance.data holds the data as a normal dict. So I
3714 UserDict, instance.data holds the data as a normal dict. So I
3709 modified @env to return os.environ.data instead of rebuilding a
3715 modified @env to return os.environ.data instead of rebuilding a
3710 dict by hand.
3716 dict by hand.
3711
3717
3712 2002-11-02 Fernando Perez <fperez@colorado.edu>
3718 2002-11-02 Fernando Perez <fperez@colorado.edu>
3713
3719
3714 * IPython/genutils.py (warn): changed so that level 1 prints no
3720 * IPython/genutils.py (warn): changed so that level 1 prints no
3715 header. Level 2 is now the default (with 'WARNING' header, as
3721 header. Level 2 is now the default (with 'WARNING' header, as
3716 before). I think I tracked all places where changes were needed in
3722 before). I think I tracked all places where changes were needed in
3717 IPython, but outside code using the old level numbering may have
3723 IPython, but outside code using the old level numbering may have
3718 broken.
3724 broken.
3719
3725
3720 * IPython/iplib.py (InteractiveShell.runcode): added this to
3726 * IPython/iplib.py (InteractiveShell.runcode): added this to
3721 handle the tracebacks in SystemExit traps correctly. The previous
3727 handle the tracebacks in SystemExit traps correctly. The previous
3722 code (through interact) was printing more of the stack than
3728 code (through interact) was printing more of the stack than
3723 necessary, showing IPython internal code to the user.
3729 necessary, showing IPython internal code to the user.
3724
3730
3725 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3731 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3726 default. Now that the default at the confirmation prompt is yes,
3732 default. Now that the default at the confirmation prompt is yes,
3727 it's not so intrusive. François' argument that ipython sessions
3733 it's not so intrusive. François' argument that ipython sessions
3728 tend to be complex enough not to lose them from an accidental C-d,
3734 tend to be complex enough not to lose them from an accidental C-d,
3729 is a valid one.
3735 is a valid one.
3730
3736
3731 * IPython/iplib.py (InteractiveShell.interact): added a
3737 * IPython/iplib.py (InteractiveShell.interact): added a
3732 showtraceback() call to the SystemExit trap, and modified the exit
3738 showtraceback() call to the SystemExit trap, and modified the exit
3733 confirmation to have yes as the default.
3739 confirmation to have yes as the default.
3734
3740
3735 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3741 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3736 this file. It's been gone from the code for a long time, this was
3742 this file. It's been gone from the code for a long time, this was
3737 simply leftover junk.
3743 simply leftover junk.
3738
3744
3739 2002-11-01 Fernando Perez <fperez@colorado.edu>
3745 2002-11-01 Fernando Perez <fperez@colorado.edu>
3740
3746
3741 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3747 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3742 added. If set, IPython now traps EOF and asks for
3748 added. If set, IPython now traps EOF and asks for
3743 confirmation. After a request by François Pinard.
3749 confirmation. After a request by François Pinard.
3744
3750
3745 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3751 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3746 of @abort, and with a new (better) mechanism for handling the
3752 of @abort, and with a new (better) mechanism for handling the
3747 exceptions.
3753 exceptions.
3748
3754
3749 2002-10-27 Fernando Perez <fperez@colorado.edu>
3755 2002-10-27 Fernando Perez <fperez@colorado.edu>
3750
3756
3751 * IPython/usage.py (__doc__): updated the --help information and
3757 * IPython/usage.py (__doc__): updated the --help information and
3752 the ipythonrc file to indicate that -log generates
3758 the ipythonrc file to indicate that -log generates
3753 ./ipython.log. Also fixed the corresponding info in @logstart.
3759 ./ipython.log. Also fixed the corresponding info in @logstart.
3754 This and several other fixes in the manuals thanks to reports by
3760 This and several other fixes in the manuals thanks to reports by
3755 François Pinard <pinard-AT-iro.umontreal.ca>.
3761 François Pinard <pinard-AT-iro.umontreal.ca>.
3756
3762
3757 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3763 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3758 refer to @logstart (instead of @log, which doesn't exist).
3764 refer to @logstart (instead of @log, which doesn't exist).
3759
3765
3760 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3766 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3761 AttributeError crash. Thanks to Christopher Armstrong
3767 AttributeError crash. Thanks to Christopher Armstrong
3762 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3768 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3763 introduced recently (in 0.2.14pre37) with the fix to the eval
3769 introduced recently (in 0.2.14pre37) with the fix to the eval
3764 problem mentioned below.
3770 problem mentioned below.
3765
3771
3766 2002-10-17 Fernando Perez <fperez@colorado.edu>
3772 2002-10-17 Fernando Perez <fperez@colorado.edu>
3767
3773
3768 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3774 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3769 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3775 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3770
3776
3771 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3777 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3772 this function to fix a problem reported by Alex Schmolck. He saw
3778 this function to fix a problem reported by Alex Schmolck. He saw
3773 it with list comprehensions and generators, which were getting
3779 it with list comprehensions and generators, which were getting
3774 called twice. The real problem was an 'eval' call in testing for
3780 called twice. The real problem was an 'eval' call in testing for
3775 automagic which was evaluating the input line silently.
3781 automagic which was evaluating the input line silently.
3776
3782
3777 This is a potentially very nasty bug, if the input has side
3783 This is a potentially very nasty bug, if the input has side
3778 effects which must not be repeated. The code is much cleaner now,
3784 effects which must not be repeated. The code is much cleaner now,
3779 without any blanket 'except' left and with a regexp test for
3785 without any blanket 'except' left and with a regexp test for
3780 actual function names.
3786 actual function names.
3781
3787
3782 But an eval remains, which I'm not fully comfortable with. I just
3788 But an eval remains, which I'm not fully comfortable with. I just
3783 don't know how to find out if an expression could be a callable in
3789 don't know how to find out if an expression could be a callable in
3784 the user's namespace without doing an eval on the string. However
3790 the user's namespace without doing an eval on the string. However
3785 that string is now much more strictly checked so that no code
3791 that string is now much more strictly checked so that no code
3786 slips by, so the eval should only happen for things that can
3792 slips by, so the eval should only happen for things that can
3787 really be only function/method names.
3793 really be only function/method names.
3788
3794
3789 2002-10-15 Fernando Perez <fperez@colorado.edu>
3795 2002-10-15 Fernando Perez <fperez@colorado.edu>
3790
3796
3791 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3797 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3792 OSX information to main manual, removed README_Mac_OSX file from
3798 OSX information to main manual, removed README_Mac_OSX file from
3793 distribution. Also updated credits for recent additions.
3799 distribution. Also updated credits for recent additions.
3794
3800
3795 2002-10-10 Fernando Perez <fperez@colorado.edu>
3801 2002-10-10 Fernando Perez <fperez@colorado.edu>
3796
3802
3797 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3803 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3798 terminal-related issues. Many thanks to Andrea Riciputi
3804 terminal-related issues. Many thanks to Andrea Riciputi
3799 <andrea.riciputi-AT-libero.it> for writing it.
3805 <andrea.riciputi-AT-libero.it> for writing it.
3800
3806
3801 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3807 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3802 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3808 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3803
3809
3804 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3810 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3805 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3811 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3806 <syver-en-AT-online.no> who both submitted patches for this problem.
3812 <syver-en-AT-online.no> who both submitted patches for this problem.
3807
3813
3808 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3814 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3809 global embedding to make sure that things don't overwrite user
3815 global embedding to make sure that things don't overwrite user
3810 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3816 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3811
3817
3812 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3818 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3813 compatibility. Thanks to Hayden Callow
3819 compatibility. Thanks to Hayden Callow
3814 <h.callow-AT-elec.canterbury.ac.nz>
3820 <h.callow-AT-elec.canterbury.ac.nz>
3815
3821
3816 2002-10-04 Fernando Perez <fperez@colorado.edu>
3822 2002-10-04 Fernando Perez <fperez@colorado.edu>
3817
3823
3818 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3824 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3819 Gnuplot.File objects.
3825 Gnuplot.File objects.
3820
3826
3821 2002-07-23 Fernando Perez <fperez@colorado.edu>
3827 2002-07-23 Fernando Perez <fperez@colorado.edu>
3822
3828
3823 * IPython/genutils.py (timing): Added timings() and timing() for
3829 * IPython/genutils.py (timing): Added timings() and timing() for
3824 quick access to the most commonly needed data, the execution
3830 quick access to the most commonly needed data, the execution
3825 times. Old timing() renamed to timings_out().
3831 times. Old timing() renamed to timings_out().
3826
3832
3827 2002-07-18 Fernando Perez <fperez@colorado.edu>
3833 2002-07-18 Fernando Perez <fperez@colorado.edu>
3828
3834
3829 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3835 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3830 bug with nested instances disrupting the parent's tab completion.
3836 bug with nested instances disrupting the parent's tab completion.
3831
3837
3832 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3838 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3833 all_completions code to begin the emacs integration.
3839 all_completions code to begin the emacs integration.
3834
3840
3835 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3841 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3836 argument to allow titling individual arrays when plotting.
3842 argument to allow titling individual arrays when plotting.
3837
3843
3838 2002-07-15 Fernando Perez <fperez@colorado.edu>
3844 2002-07-15 Fernando Perez <fperez@colorado.edu>
3839
3845
3840 * setup.py (make_shortcut): changed to retrieve the value of
3846 * setup.py (make_shortcut): changed to retrieve the value of
3841 'Program Files' directory from the registry (this value changes in
3847 'Program Files' directory from the registry (this value changes in
3842 non-english versions of Windows). Thanks to Thomas Fanslau
3848 non-english versions of Windows). Thanks to Thomas Fanslau
3843 <tfanslau-AT-gmx.de> for the report.
3849 <tfanslau-AT-gmx.de> for the report.
3844
3850
3845 2002-07-10 Fernando Perez <fperez@colorado.edu>
3851 2002-07-10 Fernando Perez <fperez@colorado.edu>
3846
3852
3847 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3853 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3848 a bug in pdb, which crashes if a line with only whitespace is
3854 a bug in pdb, which crashes if a line with only whitespace is
3849 entered. Bug report submitted to sourceforge.
3855 entered. Bug report submitted to sourceforge.
3850
3856
3851 2002-07-09 Fernando Perez <fperez@colorado.edu>
3857 2002-07-09 Fernando Perez <fperez@colorado.edu>
3852
3858
3853 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3859 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3854 reporting exceptions (it's a bug in inspect.py, I just set a
3860 reporting exceptions (it's a bug in inspect.py, I just set a
3855 workaround).
3861 workaround).
3856
3862
3857 2002-07-08 Fernando Perez <fperez@colorado.edu>
3863 2002-07-08 Fernando Perez <fperez@colorado.edu>
3858
3864
3859 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3865 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3860 __IPYTHON__ in __builtins__ to show up in user_ns.
3866 __IPYTHON__ in __builtins__ to show up in user_ns.
3861
3867
3862 2002-07-03 Fernando Perez <fperez@colorado.edu>
3868 2002-07-03 Fernando Perez <fperez@colorado.edu>
3863
3869
3864 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3870 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3865 name from @gp_set_instance to @gp_set_default.
3871 name from @gp_set_instance to @gp_set_default.
3866
3872
3867 * IPython/ipmaker.py (make_IPython): default editor value set to
3873 * IPython/ipmaker.py (make_IPython): default editor value set to
3868 '0' (a string), to match the rc file. Otherwise will crash when
3874 '0' (a string), to match the rc file. Otherwise will crash when
3869 .strip() is called on it.
3875 .strip() is called on it.
3870
3876
3871
3877
3872 2002-06-28 Fernando Perez <fperez@colorado.edu>
3878 2002-06-28 Fernando Perez <fperez@colorado.edu>
3873
3879
3874 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3880 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3875 of files in current directory when a file is executed via
3881 of files in current directory when a file is executed via
3876 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3882 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3877
3883
3878 * setup.py (manfiles): fix for rpm builds, submitted by RA
3884 * setup.py (manfiles): fix for rpm builds, submitted by RA
3879 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3885 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3880
3886
3881 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3887 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3882 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3888 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3883 string!). A. Schmolck caught this one.
3889 string!). A. Schmolck caught this one.
3884
3890
3885 2002-06-27 Fernando Perez <fperez@colorado.edu>
3891 2002-06-27 Fernando Perez <fperez@colorado.edu>
3886
3892
3887 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3893 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3888 defined files at the cmd line. __name__ wasn't being set to
3894 defined files at the cmd line. __name__ wasn't being set to
3889 __main__.
3895 __main__.
3890
3896
3891 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3897 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3892 regular lists and tuples besides Numeric arrays.
3898 regular lists and tuples besides Numeric arrays.
3893
3899
3894 * IPython/Prompts.py (CachedOutput.__call__): Added output
3900 * IPython/Prompts.py (CachedOutput.__call__): Added output
3895 supression for input ending with ';'. Similar to Mathematica and
3901 supression for input ending with ';'. Similar to Mathematica and
3896 Matlab. The _* vars and Out[] list are still updated, just like
3902 Matlab. The _* vars and Out[] list are still updated, just like
3897 Mathematica behaves.
3903 Mathematica behaves.
3898
3904
3899 2002-06-25 Fernando Perez <fperez@colorado.edu>
3905 2002-06-25 Fernando Perez <fperez@colorado.edu>
3900
3906
3901 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3907 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3902 .ini extensions for profiels under Windows.
3908 .ini extensions for profiels under Windows.
3903
3909
3904 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3910 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3905 string form. Fix contributed by Alexander Schmolck
3911 string form. Fix contributed by Alexander Schmolck
3906 <a.schmolck-AT-gmx.net>
3912 <a.schmolck-AT-gmx.net>
3907
3913
3908 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3914 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3909 pre-configured Gnuplot instance.
3915 pre-configured Gnuplot instance.
3910
3916
3911 2002-06-21 Fernando Perez <fperez@colorado.edu>
3917 2002-06-21 Fernando Perez <fperez@colorado.edu>
3912
3918
3913 * IPython/numutils.py (exp_safe): new function, works around the
3919 * IPython/numutils.py (exp_safe): new function, works around the
3914 underflow problems in Numeric.
3920 underflow problems in Numeric.
3915 (log2): New fn. Safe log in base 2: returns exact integer answer
3921 (log2): New fn. Safe log in base 2: returns exact integer answer
3916 for exact integer powers of 2.
3922 for exact integer powers of 2.
3917
3923
3918 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3924 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3919 properly.
3925 properly.
3920
3926
3921 2002-06-20 Fernando Perez <fperez@colorado.edu>
3927 2002-06-20 Fernando Perez <fperez@colorado.edu>
3922
3928
3923 * IPython/genutils.py (timing): new function like
3929 * IPython/genutils.py (timing): new function like
3924 Mathematica's. Similar to time_test, but returns more info.
3930 Mathematica's. Similar to time_test, but returns more info.
3925
3931
3926 2002-06-18 Fernando Perez <fperez@colorado.edu>
3932 2002-06-18 Fernando Perez <fperez@colorado.edu>
3927
3933
3928 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3934 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3929 according to Mike Heeter's suggestions.
3935 according to Mike Heeter's suggestions.
3930
3936
3931 2002-06-16 Fernando Perez <fperez@colorado.edu>
3937 2002-06-16 Fernando Perez <fperez@colorado.edu>
3932
3938
3933 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3939 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3934 system. GnuplotMagic is gone as a user-directory option. New files
3940 system. GnuplotMagic is gone as a user-directory option. New files
3935 make it easier to use all the gnuplot stuff both from external
3941 make it easier to use all the gnuplot stuff both from external
3936 programs as well as from IPython. Had to rewrite part of
3942 programs as well as from IPython. Had to rewrite part of
3937 hardcopy() b/c of a strange bug: often the ps files simply don't
3943 hardcopy() b/c of a strange bug: often the ps files simply don't
3938 get created, and require a repeat of the command (often several
3944 get created, and require a repeat of the command (often several
3939 times).
3945 times).
3940
3946
3941 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3947 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3942 resolve output channel at call time, so that if sys.stderr has
3948 resolve output channel at call time, so that if sys.stderr has
3943 been redirected by user this gets honored.
3949 been redirected by user this gets honored.
3944
3950
3945 2002-06-13 Fernando Perez <fperez@colorado.edu>
3951 2002-06-13 Fernando Perez <fperez@colorado.edu>
3946
3952
3947 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3953 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3948 IPShell. Kept a copy with the old names to avoid breaking people's
3954 IPShell. Kept a copy with the old names to avoid breaking people's
3949 embedded code.
3955 embedded code.
3950
3956
3951 * IPython/ipython: simplified it to the bare minimum after
3957 * IPython/ipython: simplified it to the bare minimum after
3952 Holger's suggestions. Added info about how to use it in
3958 Holger's suggestions. Added info about how to use it in
3953 PYTHONSTARTUP.
3959 PYTHONSTARTUP.
3954
3960
3955 * IPython/Shell.py (IPythonShell): changed the options passing
3961 * IPython/Shell.py (IPythonShell): changed the options passing
3956 from a string with funky %s replacements to a straight list. Maybe
3962 from a string with funky %s replacements to a straight list. Maybe
3957 a bit more typing, but it follows sys.argv conventions, so there's
3963 a bit more typing, but it follows sys.argv conventions, so there's
3958 less special-casing to remember.
3964 less special-casing to remember.
3959
3965
3960 2002-06-12 Fernando Perez <fperez@colorado.edu>
3966 2002-06-12 Fernando Perez <fperez@colorado.edu>
3961
3967
3962 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3968 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3963 command. Thanks to a suggestion by Mike Heeter.
3969 command. Thanks to a suggestion by Mike Heeter.
3964 (Magic.magic_pfile): added behavior to look at filenames if given
3970 (Magic.magic_pfile): added behavior to look at filenames if given
3965 arg is not a defined object.
3971 arg is not a defined object.
3966 (Magic.magic_save): New @save function to save code snippets. Also
3972 (Magic.magic_save): New @save function to save code snippets. Also
3967 a Mike Heeter idea.
3973 a Mike Heeter idea.
3968
3974
3969 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3975 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3970 plot() and replot(). Much more convenient now, especially for
3976 plot() and replot(). Much more convenient now, especially for
3971 interactive use.
3977 interactive use.
3972
3978
3973 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3979 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3974 filenames.
3980 filenames.
3975
3981
3976 2002-06-02 Fernando Perez <fperez@colorado.edu>
3982 2002-06-02 Fernando Perez <fperez@colorado.edu>
3977
3983
3978 * IPython/Struct.py (Struct.__init__): modified to admit
3984 * IPython/Struct.py (Struct.__init__): modified to admit
3979 initialization via another struct.
3985 initialization via another struct.
3980
3986
3981 * IPython/genutils.py (SystemExec.__init__): New stateful
3987 * IPython/genutils.py (SystemExec.__init__): New stateful
3982 interface to xsys and bq. Useful for writing system scripts.
3988 interface to xsys and bq. Useful for writing system scripts.
3983
3989
3984 2002-05-30 Fernando Perez <fperez@colorado.edu>
3990 2002-05-30 Fernando Perez <fperez@colorado.edu>
3985
3991
3986 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3992 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3987 documents. This will make the user download smaller (it's getting
3993 documents. This will make the user download smaller (it's getting
3988 too big).
3994 too big).
3989
3995
3990 2002-05-29 Fernando Perez <fperez@colorado.edu>
3996 2002-05-29 Fernando Perez <fperez@colorado.edu>
3991
3997
3992 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3998 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3993 fix problems with shelve and pickle. Seems to work, but I don't
3999 fix problems with shelve and pickle. Seems to work, but I don't
3994 know if corner cases break it. Thanks to Mike Heeter
4000 know if corner cases break it. Thanks to Mike Heeter
3995 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4001 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3996
4002
3997 2002-05-24 Fernando Perez <fperez@colorado.edu>
4003 2002-05-24 Fernando Perez <fperez@colorado.edu>
3998
4004
3999 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4005 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4000 macros having broken.
4006 macros having broken.
4001
4007
4002 2002-05-21 Fernando Perez <fperez@colorado.edu>
4008 2002-05-21 Fernando Perez <fperez@colorado.edu>
4003
4009
4004 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4010 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4005 introduced logging bug: all history before logging started was
4011 introduced logging bug: all history before logging started was
4006 being written one character per line! This came from the redesign
4012 being written one character per line! This came from the redesign
4007 of the input history as a special list which slices to strings,
4013 of the input history as a special list which slices to strings,
4008 not to lists.
4014 not to lists.
4009
4015
4010 2002-05-20 Fernando Perez <fperez@colorado.edu>
4016 2002-05-20 Fernando Perez <fperez@colorado.edu>
4011
4017
4012 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4018 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4013 be an attribute of all classes in this module. The design of these
4019 be an attribute of all classes in this module. The design of these
4014 classes needs some serious overhauling.
4020 classes needs some serious overhauling.
4015
4021
4016 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4022 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4017 which was ignoring '_' in option names.
4023 which was ignoring '_' in option names.
4018
4024
4019 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4025 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4020 'Verbose_novars' to 'Context' and made it the new default. It's a
4026 'Verbose_novars' to 'Context' and made it the new default. It's a
4021 bit more readable and also safer than verbose.
4027 bit more readable and also safer than verbose.
4022
4028
4023 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4029 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4024 triple-quoted strings.
4030 triple-quoted strings.
4025
4031
4026 * IPython/OInspect.py (__all__): new module exposing the object
4032 * IPython/OInspect.py (__all__): new module exposing the object
4027 introspection facilities. Now the corresponding magics are dummy
4033 introspection facilities. Now the corresponding magics are dummy
4028 wrappers around this. Having this module will make it much easier
4034 wrappers around this. Having this module will make it much easier
4029 to put these functions into our modified pdb.
4035 to put these functions into our modified pdb.
4030 This new object inspector system uses the new colorizing module,
4036 This new object inspector system uses the new colorizing module,
4031 so source code and other things are nicely syntax highlighted.
4037 so source code and other things are nicely syntax highlighted.
4032
4038
4033 2002-05-18 Fernando Perez <fperez@colorado.edu>
4039 2002-05-18 Fernando Perez <fperez@colorado.edu>
4034
4040
4035 * IPython/ColorANSI.py: Split the coloring tools into a separate
4041 * IPython/ColorANSI.py: Split the coloring tools into a separate
4036 module so I can use them in other code easier (they were part of
4042 module so I can use them in other code easier (they were part of
4037 ultraTB).
4043 ultraTB).
4038
4044
4039 2002-05-17 Fernando Perez <fperez@colorado.edu>
4045 2002-05-17 Fernando Perez <fperez@colorado.edu>
4040
4046
4041 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4047 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4042 fixed it to set the global 'g' also to the called instance, as
4048 fixed it to set the global 'g' also to the called instance, as
4043 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4049 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4044 user's 'g' variables).
4050 user's 'g' variables).
4045
4051
4046 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4052 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4047 global variables (aliases to _ih,_oh) so that users which expect
4053 global variables (aliases to _ih,_oh) so that users which expect
4048 In[5] or Out[7] to work aren't unpleasantly surprised.
4054 In[5] or Out[7] to work aren't unpleasantly surprised.
4049 (InputList.__getslice__): new class to allow executing slices of
4055 (InputList.__getslice__): new class to allow executing slices of
4050 input history directly. Very simple class, complements the use of
4056 input history directly. Very simple class, complements the use of
4051 macros.
4057 macros.
4052
4058
4053 2002-05-16 Fernando Perez <fperez@colorado.edu>
4059 2002-05-16 Fernando Perez <fperez@colorado.edu>
4054
4060
4055 * setup.py (docdirbase): make doc directory be just doc/IPython
4061 * setup.py (docdirbase): make doc directory be just doc/IPython
4056 without version numbers, it will reduce clutter for users.
4062 without version numbers, it will reduce clutter for users.
4057
4063
4058 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4064 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4059 execfile call to prevent possible memory leak. See for details:
4065 execfile call to prevent possible memory leak. See for details:
4060 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4066 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4061
4067
4062 2002-05-15 Fernando Perez <fperez@colorado.edu>
4068 2002-05-15 Fernando Perez <fperez@colorado.edu>
4063
4069
4064 * IPython/Magic.py (Magic.magic_psource): made the object
4070 * IPython/Magic.py (Magic.magic_psource): made the object
4065 introspection names be more standard: pdoc, pdef, pfile and
4071 introspection names be more standard: pdoc, pdef, pfile and
4066 psource. They all print/page their output, and it makes
4072 psource. They all print/page their output, and it makes
4067 remembering them easier. Kept old names for compatibility as
4073 remembering them easier. Kept old names for compatibility as
4068 aliases.
4074 aliases.
4069
4075
4070 2002-05-14 Fernando Perez <fperez@colorado.edu>
4076 2002-05-14 Fernando Perez <fperez@colorado.edu>
4071
4077
4072 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4078 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4073 what the mouse problem was. The trick is to use gnuplot with temp
4079 what the mouse problem was. The trick is to use gnuplot with temp
4074 files and NOT with pipes (for data communication), because having
4080 files and NOT with pipes (for data communication), because having
4075 both pipes and the mouse on is bad news.
4081 both pipes and the mouse on is bad news.
4076
4082
4077 2002-05-13 Fernando Perez <fperez@colorado.edu>
4083 2002-05-13 Fernando Perez <fperez@colorado.edu>
4078
4084
4079 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4085 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4080 bug. Information would be reported about builtins even when
4086 bug. Information would be reported about builtins even when
4081 user-defined functions overrode them.
4087 user-defined functions overrode them.
4082
4088
4083 2002-05-11 Fernando Perez <fperez@colorado.edu>
4089 2002-05-11 Fernando Perez <fperez@colorado.edu>
4084
4090
4085 * IPython/__init__.py (__all__): removed FlexCompleter from
4091 * IPython/__init__.py (__all__): removed FlexCompleter from
4086 __all__ so that things don't fail in platforms without readline.
4092 __all__ so that things don't fail in platforms without readline.
4087
4093
4088 2002-05-10 Fernando Perez <fperez@colorado.edu>
4094 2002-05-10 Fernando Perez <fperez@colorado.edu>
4089
4095
4090 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4096 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4091 it requires Numeric, effectively making Numeric a dependency for
4097 it requires Numeric, effectively making Numeric a dependency for
4092 IPython.
4098 IPython.
4093
4099
4094 * Released 0.2.13
4100 * Released 0.2.13
4095
4101
4096 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4102 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4097 profiler interface. Now all the major options from the profiler
4103 profiler interface. Now all the major options from the profiler
4098 module are directly supported in IPython, both for single
4104 module are directly supported in IPython, both for single
4099 expressions (@prun) and for full programs (@run -p).
4105 expressions (@prun) and for full programs (@run -p).
4100
4106
4101 2002-05-09 Fernando Perez <fperez@colorado.edu>
4107 2002-05-09 Fernando Perez <fperez@colorado.edu>
4102
4108
4103 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4109 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4104 magic properly formatted for screen.
4110 magic properly formatted for screen.
4105
4111
4106 * setup.py (make_shortcut): Changed things to put pdf version in
4112 * setup.py (make_shortcut): Changed things to put pdf version in
4107 doc/ instead of doc/manual (had to change lyxport a bit).
4113 doc/ instead of doc/manual (had to change lyxport a bit).
4108
4114
4109 * IPython/Magic.py (Profile.string_stats): made profile runs go
4115 * IPython/Magic.py (Profile.string_stats): made profile runs go
4110 through pager (they are long and a pager allows searching, saving,
4116 through pager (they are long and a pager allows searching, saving,
4111 etc.)
4117 etc.)
4112
4118
4113 2002-05-08 Fernando Perez <fperez@colorado.edu>
4119 2002-05-08 Fernando Perez <fperez@colorado.edu>
4114
4120
4115 * Released 0.2.12
4121 * Released 0.2.12
4116
4122
4117 2002-05-06 Fernando Perez <fperez@colorado.edu>
4123 2002-05-06 Fernando Perez <fperez@colorado.edu>
4118
4124
4119 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4125 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4120 introduced); 'hist n1 n2' was broken.
4126 introduced); 'hist n1 n2' was broken.
4121 (Magic.magic_pdb): added optional on/off arguments to @pdb
4127 (Magic.magic_pdb): added optional on/off arguments to @pdb
4122 (Magic.magic_run): added option -i to @run, which executes code in
4128 (Magic.magic_run): added option -i to @run, which executes code in
4123 the IPython namespace instead of a clean one. Also added @irun as
4129 the IPython namespace instead of a clean one. Also added @irun as
4124 an alias to @run -i.
4130 an alias to @run -i.
4125
4131
4126 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4132 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4127 fixed (it didn't really do anything, the namespaces were wrong).
4133 fixed (it didn't really do anything, the namespaces were wrong).
4128
4134
4129 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4135 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4130
4136
4131 * IPython/__init__.py (__all__): Fixed package namespace, now
4137 * IPython/__init__.py (__all__): Fixed package namespace, now
4132 'import IPython' does give access to IPython.<all> as
4138 'import IPython' does give access to IPython.<all> as
4133 expected. Also renamed __release__ to Release.
4139 expected. Also renamed __release__ to Release.
4134
4140
4135 * IPython/Debugger.py (__license__): created new Pdb class which
4141 * IPython/Debugger.py (__license__): created new Pdb class which
4136 functions like a drop-in for the normal pdb.Pdb but does NOT
4142 functions like a drop-in for the normal pdb.Pdb but does NOT
4137 import readline by default. This way it doesn't muck up IPython's
4143 import readline by default. This way it doesn't muck up IPython's
4138 readline handling, and now tab-completion finally works in the
4144 readline handling, and now tab-completion finally works in the
4139 debugger -- sort of. It completes things globally visible, but the
4145 debugger -- sort of. It completes things globally visible, but the
4140 completer doesn't track the stack as pdb walks it. That's a bit
4146 completer doesn't track the stack as pdb walks it. That's a bit
4141 tricky, and I'll have to implement it later.
4147 tricky, and I'll have to implement it later.
4142
4148
4143 2002-05-05 Fernando Perez <fperez@colorado.edu>
4149 2002-05-05 Fernando Perez <fperez@colorado.edu>
4144
4150
4145 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4151 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4146 magic docstrings when printed via ? (explicit \'s were being
4152 magic docstrings when printed via ? (explicit \'s were being
4147 printed).
4153 printed).
4148
4154
4149 * IPython/ipmaker.py (make_IPython): fixed namespace
4155 * IPython/ipmaker.py (make_IPython): fixed namespace
4150 identification bug. Now variables loaded via logs or command-line
4156 identification bug. Now variables loaded via logs or command-line
4151 files are recognized in the interactive namespace by @who.
4157 files are recognized in the interactive namespace by @who.
4152
4158
4153 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4159 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4154 log replay system stemming from the string form of Structs.
4160 log replay system stemming from the string form of Structs.
4155
4161
4156 * IPython/Magic.py (Macro.__init__): improved macros to properly
4162 * IPython/Magic.py (Macro.__init__): improved macros to properly
4157 handle magic commands in them.
4163 handle magic commands in them.
4158 (Magic.magic_logstart): usernames are now expanded so 'logstart
4164 (Magic.magic_logstart): usernames are now expanded so 'logstart
4159 ~/mylog' now works.
4165 ~/mylog' now works.
4160
4166
4161 * IPython/iplib.py (complete): fixed bug where paths starting with
4167 * IPython/iplib.py (complete): fixed bug where paths starting with
4162 '/' would be completed as magic names.
4168 '/' would be completed as magic names.
4163
4169
4164 2002-05-04 Fernando Perez <fperez@colorado.edu>
4170 2002-05-04 Fernando Perez <fperez@colorado.edu>
4165
4171
4166 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4172 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4167 allow running full programs under the profiler's control.
4173 allow running full programs under the profiler's control.
4168
4174
4169 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4175 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4170 mode to report exceptions verbosely but without formatting
4176 mode to report exceptions verbosely but without formatting
4171 variables. This addresses the issue of ipython 'freezing' (it's
4177 variables. This addresses the issue of ipython 'freezing' (it's
4172 not frozen, but caught in an expensive formatting loop) when huge
4178 not frozen, but caught in an expensive formatting loop) when huge
4173 variables are in the context of an exception.
4179 variables are in the context of an exception.
4174 (VerboseTB.text): Added '--->' markers at line where exception was
4180 (VerboseTB.text): Added '--->' markers at line where exception was
4175 triggered. Much clearer to read, especially in NoColor modes.
4181 triggered. Much clearer to read, especially in NoColor modes.
4176
4182
4177 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4183 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4178 implemented in reverse when changing to the new parse_options().
4184 implemented in reverse when changing to the new parse_options().
4179
4185
4180 2002-05-03 Fernando Perez <fperez@colorado.edu>
4186 2002-05-03 Fernando Perez <fperez@colorado.edu>
4181
4187
4182 * IPython/Magic.py (Magic.parse_options): new function so that
4188 * IPython/Magic.py (Magic.parse_options): new function so that
4183 magics can parse options easier.
4189 magics can parse options easier.
4184 (Magic.magic_prun): new function similar to profile.run(),
4190 (Magic.magic_prun): new function similar to profile.run(),
4185 suggested by Chris Hart.
4191 suggested by Chris Hart.
4186 (Magic.magic_cd): fixed behavior so that it only changes if
4192 (Magic.magic_cd): fixed behavior so that it only changes if
4187 directory actually is in history.
4193 directory actually is in history.
4188
4194
4189 * IPython/usage.py (__doc__): added information about potential
4195 * IPython/usage.py (__doc__): added information about potential
4190 slowness of Verbose exception mode when there are huge data
4196 slowness of Verbose exception mode when there are huge data
4191 structures to be formatted (thanks to Archie Paulson).
4197 structures to be formatted (thanks to Archie Paulson).
4192
4198
4193 * IPython/ipmaker.py (make_IPython): Changed default logging
4199 * IPython/ipmaker.py (make_IPython): Changed default logging
4194 (when simply called with -log) to use curr_dir/ipython.log in
4200 (when simply called with -log) to use curr_dir/ipython.log in
4195 rotate mode. Fixed crash which was occuring with -log before
4201 rotate mode. Fixed crash which was occuring with -log before
4196 (thanks to Jim Boyle).
4202 (thanks to Jim Boyle).
4197
4203
4198 2002-05-01 Fernando Perez <fperez@colorado.edu>
4204 2002-05-01 Fernando Perez <fperez@colorado.edu>
4199
4205
4200 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4206 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4201 was nasty -- though somewhat of a corner case).
4207 was nasty -- though somewhat of a corner case).
4202
4208
4203 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4209 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4204 text (was a bug).
4210 text (was a bug).
4205
4211
4206 2002-04-30 Fernando Perez <fperez@colorado.edu>
4212 2002-04-30 Fernando Perez <fperez@colorado.edu>
4207
4213
4208 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4214 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4209 a print after ^D or ^C from the user so that the In[] prompt
4215 a print after ^D or ^C from the user so that the In[] prompt
4210 doesn't over-run the gnuplot one.
4216 doesn't over-run the gnuplot one.
4211
4217
4212 2002-04-29 Fernando Perez <fperez@colorado.edu>
4218 2002-04-29 Fernando Perez <fperez@colorado.edu>
4213
4219
4214 * Released 0.2.10
4220 * Released 0.2.10
4215
4221
4216 * IPython/__release__.py (version): get date dynamically.
4222 * IPython/__release__.py (version): get date dynamically.
4217
4223
4218 * Misc. documentation updates thanks to Arnd's comments. Also ran
4224 * Misc. documentation updates thanks to Arnd's comments. Also ran
4219 a full spellcheck on the manual (hadn't been done in a while).
4225 a full spellcheck on the manual (hadn't been done in a while).
4220
4226
4221 2002-04-27 Fernando Perez <fperez@colorado.edu>
4227 2002-04-27 Fernando Perez <fperez@colorado.edu>
4222
4228
4223 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4229 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4224 starting a log in mid-session would reset the input history list.
4230 starting a log in mid-session would reset the input history list.
4225
4231
4226 2002-04-26 Fernando Perez <fperez@colorado.edu>
4232 2002-04-26 Fernando Perez <fperez@colorado.edu>
4227
4233
4228 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4234 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4229 all files were being included in an update. Now anything in
4235 all files were being included in an update. Now anything in
4230 UserConfig that matches [A-Za-z]*.py will go (this excludes
4236 UserConfig that matches [A-Za-z]*.py will go (this excludes
4231 __init__.py)
4237 __init__.py)
4232
4238
4233 2002-04-25 Fernando Perez <fperez@colorado.edu>
4239 2002-04-25 Fernando Perez <fperez@colorado.edu>
4234
4240
4235 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4241 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4236 to __builtins__ so that any form of embedded or imported code can
4242 to __builtins__ so that any form of embedded or imported code can
4237 test for being inside IPython.
4243 test for being inside IPython.
4238
4244
4239 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4245 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4240 changed to GnuplotMagic because it's now an importable module,
4246 changed to GnuplotMagic because it's now an importable module,
4241 this makes the name follow that of the standard Gnuplot module.
4247 this makes the name follow that of the standard Gnuplot module.
4242 GnuplotMagic can now be loaded at any time in mid-session.
4248 GnuplotMagic can now be loaded at any time in mid-session.
4243
4249
4244 2002-04-24 Fernando Perez <fperez@colorado.edu>
4250 2002-04-24 Fernando Perez <fperez@colorado.edu>
4245
4251
4246 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4252 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4247 the globals (IPython has its own namespace) and the
4253 the globals (IPython has its own namespace) and the
4248 PhysicalQuantity stuff is much better anyway.
4254 PhysicalQuantity stuff is much better anyway.
4249
4255
4250 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4256 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4251 embedding example to standard user directory for
4257 embedding example to standard user directory for
4252 distribution. Also put it in the manual.
4258 distribution. Also put it in the manual.
4253
4259
4254 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4260 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4255 instance as first argument (so it doesn't rely on some obscure
4261 instance as first argument (so it doesn't rely on some obscure
4256 hidden global).
4262 hidden global).
4257
4263
4258 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4264 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4259 delimiters. While it prevents ().TAB from working, it allows
4265 delimiters. While it prevents ().TAB from working, it allows
4260 completions in open (... expressions. This is by far a more common
4266 completions in open (... expressions. This is by far a more common
4261 case.
4267 case.
4262
4268
4263 2002-04-23 Fernando Perez <fperez@colorado.edu>
4269 2002-04-23 Fernando Perez <fperez@colorado.edu>
4264
4270
4265 * IPython/Extensions/InterpreterPasteInput.py: new
4271 * IPython/Extensions/InterpreterPasteInput.py: new
4266 syntax-processing module for pasting lines with >>> or ... at the
4272 syntax-processing module for pasting lines with >>> or ... at the
4267 start.
4273 start.
4268
4274
4269 * IPython/Extensions/PhysicalQ_Interactive.py
4275 * IPython/Extensions/PhysicalQ_Interactive.py
4270 (PhysicalQuantityInteractive.__int__): fixed to work with either
4276 (PhysicalQuantityInteractive.__int__): fixed to work with either
4271 Numeric or math.
4277 Numeric or math.
4272
4278
4273 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4279 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4274 provided profiles. Now we have:
4280 provided profiles. Now we have:
4275 -math -> math module as * and cmath with its own namespace.
4281 -math -> math module as * and cmath with its own namespace.
4276 -numeric -> Numeric as *, plus gnuplot & grace
4282 -numeric -> Numeric as *, plus gnuplot & grace
4277 -physics -> same as before
4283 -physics -> same as before
4278
4284
4279 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4285 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4280 user-defined magics wouldn't be found by @magic if they were
4286 user-defined magics wouldn't be found by @magic if they were
4281 defined as class methods. Also cleaned up the namespace search
4287 defined as class methods. Also cleaned up the namespace search
4282 logic and the string building (to use %s instead of many repeated
4288 logic and the string building (to use %s instead of many repeated
4283 string adds).
4289 string adds).
4284
4290
4285 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4291 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4286 of user-defined magics to operate with class methods (cleaner, in
4292 of user-defined magics to operate with class methods (cleaner, in
4287 line with the gnuplot code).
4293 line with the gnuplot code).
4288
4294
4289 2002-04-22 Fernando Perez <fperez@colorado.edu>
4295 2002-04-22 Fernando Perez <fperez@colorado.edu>
4290
4296
4291 * setup.py: updated dependency list so that manual is updated when
4297 * setup.py: updated dependency list so that manual is updated when
4292 all included files change.
4298 all included files change.
4293
4299
4294 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4300 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4295 the delimiter removal option (the fix is ugly right now).
4301 the delimiter removal option (the fix is ugly right now).
4296
4302
4297 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4303 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4298 all of the math profile (quicker loading, no conflict between
4304 all of the math profile (quicker loading, no conflict between
4299 g-9.8 and g-gnuplot).
4305 g-9.8 and g-gnuplot).
4300
4306
4301 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4307 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4302 name of post-mortem files to IPython_crash_report.txt.
4308 name of post-mortem files to IPython_crash_report.txt.
4303
4309
4304 * Cleanup/update of the docs. Added all the new readline info and
4310 * Cleanup/update of the docs. Added all the new readline info and
4305 formatted all lists as 'real lists'.
4311 formatted all lists as 'real lists'.
4306
4312
4307 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4313 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4308 tab-completion options, since the full readline parse_and_bind is
4314 tab-completion options, since the full readline parse_and_bind is
4309 now accessible.
4315 now accessible.
4310
4316
4311 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4317 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4312 handling of readline options. Now users can specify any string to
4318 handling of readline options. Now users can specify any string to
4313 be passed to parse_and_bind(), as well as the delimiters to be
4319 be passed to parse_and_bind(), as well as the delimiters to be
4314 removed.
4320 removed.
4315 (InteractiveShell.__init__): Added __name__ to the global
4321 (InteractiveShell.__init__): Added __name__ to the global
4316 namespace so that things like Itpl which rely on its existence
4322 namespace so that things like Itpl which rely on its existence
4317 don't crash.
4323 don't crash.
4318 (InteractiveShell._prefilter): Defined the default with a _ so
4324 (InteractiveShell._prefilter): Defined the default with a _ so
4319 that prefilter() is easier to override, while the default one
4325 that prefilter() is easier to override, while the default one
4320 remains available.
4326 remains available.
4321
4327
4322 2002-04-18 Fernando Perez <fperez@colorado.edu>
4328 2002-04-18 Fernando Perez <fperez@colorado.edu>
4323
4329
4324 * Added information about pdb in the docs.
4330 * Added information about pdb in the docs.
4325
4331
4326 2002-04-17 Fernando Perez <fperez@colorado.edu>
4332 2002-04-17 Fernando Perez <fperez@colorado.edu>
4327
4333
4328 * IPython/ipmaker.py (make_IPython): added rc_override option to
4334 * IPython/ipmaker.py (make_IPython): added rc_override option to
4329 allow passing config options at creation time which may override
4335 allow passing config options at creation time which may override
4330 anything set in the config files or command line. This is
4336 anything set in the config files or command line. This is
4331 particularly useful for configuring embedded instances.
4337 particularly useful for configuring embedded instances.
4332
4338
4333 2002-04-15 Fernando Perez <fperez@colorado.edu>
4339 2002-04-15 Fernando Perez <fperez@colorado.edu>
4334
4340
4335 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4341 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4336 crash embedded instances because of the input cache falling out of
4342 crash embedded instances because of the input cache falling out of
4337 sync with the output counter.
4343 sync with the output counter.
4338
4344
4339 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4345 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4340 mode which calls pdb after an uncaught exception in IPython itself.
4346 mode which calls pdb after an uncaught exception in IPython itself.
4341
4347
4342 2002-04-14 Fernando Perez <fperez@colorado.edu>
4348 2002-04-14 Fernando Perez <fperez@colorado.edu>
4343
4349
4344 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4350 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4345 readline, fix it back after each call.
4351 readline, fix it back after each call.
4346
4352
4347 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4353 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4348 method to force all access via __call__(), which guarantees that
4354 method to force all access via __call__(), which guarantees that
4349 traceback references are properly deleted.
4355 traceback references are properly deleted.
4350
4356
4351 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4357 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4352 improve printing when pprint is in use.
4358 improve printing when pprint is in use.
4353
4359
4354 2002-04-13 Fernando Perez <fperez@colorado.edu>
4360 2002-04-13 Fernando Perez <fperez@colorado.edu>
4355
4361
4356 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4362 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4357 exceptions aren't caught anymore. If the user triggers one, he
4363 exceptions aren't caught anymore. If the user triggers one, he
4358 should know why he's doing it and it should go all the way up,
4364 should know why he's doing it and it should go all the way up,
4359 just like any other exception. So now @abort will fully kill the
4365 just like any other exception. So now @abort will fully kill the
4360 embedded interpreter and the embedding code (unless that happens
4366 embedded interpreter and the embedding code (unless that happens
4361 to catch SystemExit).
4367 to catch SystemExit).
4362
4368
4363 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4369 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4364 and a debugger() method to invoke the interactive pdb debugger
4370 and a debugger() method to invoke the interactive pdb debugger
4365 after printing exception information. Also added the corresponding
4371 after printing exception information. Also added the corresponding
4366 -pdb option and @pdb magic to control this feature, and updated
4372 -pdb option and @pdb magic to control this feature, and updated
4367 the docs. After a suggestion from Christopher Hart
4373 the docs. After a suggestion from Christopher Hart
4368 (hart-AT-caltech.edu).
4374 (hart-AT-caltech.edu).
4369
4375
4370 2002-04-12 Fernando Perez <fperez@colorado.edu>
4376 2002-04-12 Fernando Perez <fperez@colorado.edu>
4371
4377
4372 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4378 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4373 the exception handlers defined by the user (not the CrashHandler)
4379 the exception handlers defined by the user (not the CrashHandler)
4374 so that user exceptions don't trigger an ipython bug report.
4380 so that user exceptions don't trigger an ipython bug report.
4375
4381
4376 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4382 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4377 configurable (it should have always been so).
4383 configurable (it should have always been so).
4378
4384
4379 2002-03-26 Fernando Perez <fperez@colorado.edu>
4385 2002-03-26 Fernando Perez <fperez@colorado.edu>
4380
4386
4381 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4387 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4382 and there to fix embedding namespace issues. This should all be
4388 and there to fix embedding namespace issues. This should all be
4383 done in a more elegant way.
4389 done in a more elegant way.
4384
4390
4385 2002-03-25 Fernando Perez <fperez@colorado.edu>
4391 2002-03-25 Fernando Perez <fperez@colorado.edu>
4386
4392
4387 * IPython/genutils.py (get_home_dir): Try to make it work under
4393 * IPython/genutils.py (get_home_dir): Try to make it work under
4388 win9x also.
4394 win9x also.
4389
4395
4390 2002-03-20 Fernando Perez <fperez@colorado.edu>
4396 2002-03-20 Fernando Perez <fperez@colorado.edu>
4391
4397
4392 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4398 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4393 sys.displayhook untouched upon __init__.
4399 sys.displayhook untouched upon __init__.
4394
4400
4395 2002-03-19 Fernando Perez <fperez@colorado.edu>
4401 2002-03-19 Fernando Perez <fperez@colorado.edu>
4396
4402
4397 * Released 0.2.9 (for embedding bug, basically).
4403 * Released 0.2.9 (for embedding bug, basically).
4398
4404
4399 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4405 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4400 exceptions so that enclosing shell's state can be restored.
4406 exceptions so that enclosing shell's state can be restored.
4401
4407
4402 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4408 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4403 naming conventions in the .ipython/ dir.
4409 naming conventions in the .ipython/ dir.
4404
4410
4405 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4411 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4406 from delimiters list so filenames with - in them get expanded.
4412 from delimiters list so filenames with - in them get expanded.
4407
4413
4408 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4414 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4409 sys.displayhook not being properly restored after an embedded call.
4415 sys.displayhook not being properly restored after an embedded call.
4410
4416
4411 2002-03-18 Fernando Perez <fperez@colorado.edu>
4417 2002-03-18 Fernando Perez <fperez@colorado.edu>
4412
4418
4413 * Released 0.2.8
4419 * Released 0.2.8
4414
4420
4415 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4421 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4416 some files weren't being included in a -upgrade.
4422 some files weren't being included in a -upgrade.
4417 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4423 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4418 on' so that the first tab completes.
4424 on' so that the first tab completes.
4419 (InteractiveShell.handle_magic): fixed bug with spaces around
4425 (InteractiveShell.handle_magic): fixed bug with spaces around
4420 quotes breaking many magic commands.
4426 quotes breaking many magic commands.
4421
4427
4422 * setup.py: added note about ignoring the syntax error messages at
4428 * setup.py: added note about ignoring the syntax error messages at
4423 installation.
4429 installation.
4424
4430
4425 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4431 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4426 streamlining the gnuplot interface, now there's only one magic @gp.
4432 streamlining the gnuplot interface, now there's only one magic @gp.
4427
4433
4428 2002-03-17 Fernando Perez <fperez@colorado.edu>
4434 2002-03-17 Fernando Perez <fperez@colorado.edu>
4429
4435
4430 * IPython/UserConfig/magic_gnuplot.py: new name for the
4436 * IPython/UserConfig/magic_gnuplot.py: new name for the
4431 example-magic_pm.py file. Much enhanced system, now with a shell
4437 example-magic_pm.py file. Much enhanced system, now with a shell
4432 for communicating directly with gnuplot, one command at a time.
4438 for communicating directly with gnuplot, one command at a time.
4433
4439
4434 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4440 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4435 setting __name__=='__main__'.
4441 setting __name__=='__main__'.
4436
4442
4437 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4443 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4438 mini-shell for accessing gnuplot from inside ipython. Should
4444 mini-shell for accessing gnuplot from inside ipython. Should
4439 extend it later for grace access too. Inspired by Arnd's
4445 extend it later for grace access too. Inspired by Arnd's
4440 suggestion.
4446 suggestion.
4441
4447
4442 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4448 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4443 calling magic functions with () in their arguments. Thanks to Arnd
4449 calling magic functions with () in their arguments. Thanks to Arnd
4444 Baecker for pointing this to me.
4450 Baecker for pointing this to me.
4445
4451
4446 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4452 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4447 infinitely for integer or complex arrays (only worked with floats).
4453 infinitely for integer or complex arrays (only worked with floats).
4448
4454
4449 2002-03-16 Fernando Perez <fperez@colorado.edu>
4455 2002-03-16 Fernando Perez <fperez@colorado.edu>
4450
4456
4451 * setup.py: Merged setup and setup_windows into a single script
4457 * setup.py: Merged setup and setup_windows into a single script
4452 which properly handles things for windows users.
4458 which properly handles things for windows users.
4453
4459
4454 2002-03-15 Fernando Perez <fperez@colorado.edu>
4460 2002-03-15 Fernando Perez <fperez@colorado.edu>
4455
4461
4456 * Big change to the manual: now the magics are all automatically
4462 * Big change to the manual: now the magics are all automatically
4457 documented. This information is generated from their docstrings
4463 documented. This information is generated from their docstrings
4458 and put in a latex file included by the manual lyx file. This way
4464 and put in a latex file included by the manual lyx file. This way
4459 we get always up to date information for the magics. The manual
4465 we get always up to date information for the magics. The manual
4460 now also has proper version information, also auto-synced.
4466 now also has proper version information, also auto-synced.
4461
4467
4462 For this to work, an undocumented --magic_docstrings option was added.
4468 For this to work, an undocumented --magic_docstrings option was added.
4463
4469
4464 2002-03-13 Fernando Perez <fperez@colorado.edu>
4470 2002-03-13 Fernando Perez <fperez@colorado.edu>
4465
4471
4466 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4472 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4467 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4473 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4468
4474
4469 2002-03-12 Fernando Perez <fperez@colorado.edu>
4475 2002-03-12 Fernando Perez <fperez@colorado.edu>
4470
4476
4471 * IPython/ultraTB.py (TermColors): changed color escapes again to
4477 * IPython/ultraTB.py (TermColors): changed color escapes again to
4472 fix the (old, reintroduced) line-wrapping bug. Basically, if
4478 fix the (old, reintroduced) line-wrapping bug. Basically, if
4473 \001..\002 aren't given in the color escapes, lines get wrapped
4479 \001..\002 aren't given in the color escapes, lines get wrapped
4474 weirdly. But giving those screws up old xterms and emacs terms. So
4480 weirdly. But giving those screws up old xterms and emacs terms. So
4475 I added some logic for emacs terms to be ok, but I can't identify old
4481 I added some logic for emacs terms to be ok, but I can't identify old
4476 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4482 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4477
4483
4478 2002-03-10 Fernando Perez <fperez@colorado.edu>
4484 2002-03-10 Fernando Perez <fperez@colorado.edu>
4479
4485
4480 * IPython/usage.py (__doc__): Various documentation cleanups and
4486 * IPython/usage.py (__doc__): Various documentation cleanups and
4481 updates, both in usage docstrings and in the manual.
4487 updates, both in usage docstrings and in the manual.
4482
4488
4483 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4489 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4484 handling of caching. Set minimum acceptabe value for having a
4490 handling of caching. Set minimum acceptabe value for having a
4485 cache at 20 values.
4491 cache at 20 values.
4486
4492
4487 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4493 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4488 install_first_time function to a method, renamed it and added an
4494 install_first_time function to a method, renamed it and added an
4489 'upgrade' mode. Now people can update their config directory with
4495 'upgrade' mode. Now people can update their config directory with
4490 a simple command line switch (-upgrade, also new).
4496 a simple command line switch (-upgrade, also new).
4491
4497
4492 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4498 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4493 @file (convenient for automagic users under Python >= 2.2).
4499 @file (convenient for automagic users under Python >= 2.2).
4494 Removed @files (it seemed more like a plural than an abbrev. of
4500 Removed @files (it seemed more like a plural than an abbrev. of
4495 'file show').
4501 'file show').
4496
4502
4497 * IPython/iplib.py (install_first_time): Fixed crash if there were
4503 * IPython/iplib.py (install_first_time): Fixed crash if there were
4498 backup files ('~') in .ipython/ install directory.
4504 backup files ('~') in .ipython/ install directory.
4499
4505
4500 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4506 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4501 system. Things look fine, but these changes are fairly
4507 system. Things look fine, but these changes are fairly
4502 intrusive. Test them for a few days.
4508 intrusive. Test them for a few days.
4503
4509
4504 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4510 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4505 the prompts system. Now all in/out prompt strings are user
4511 the prompts system. Now all in/out prompt strings are user
4506 controllable. This is particularly useful for embedding, as one
4512 controllable. This is particularly useful for embedding, as one
4507 can tag embedded instances with particular prompts.
4513 can tag embedded instances with particular prompts.
4508
4514
4509 Also removed global use of sys.ps1/2, which now allows nested
4515 Also removed global use of sys.ps1/2, which now allows nested
4510 embeddings without any problems. Added command-line options for
4516 embeddings without any problems. Added command-line options for
4511 the prompt strings.
4517 the prompt strings.
4512
4518
4513 2002-03-08 Fernando Perez <fperez@colorado.edu>
4519 2002-03-08 Fernando Perez <fperez@colorado.edu>
4514
4520
4515 * IPython/UserConfig/example-embed-short.py (ipshell): added
4521 * IPython/UserConfig/example-embed-short.py (ipshell): added
4516 example file with the bare minimum code for embedding.
4522 example file with the bare minimum code for embedding.
4517
4523
4518 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4524 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4519 functionality for the embeddable shell to be activated/deactivated
4525 functionality for the embeddable shell to be activated/deactivated
4520 either globally or at each call.
4526 either globally or at each call.
4521
4527
4522 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4528 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4523 rewriting the prompt with '--->' for auto-inputs with proper
4529 rewriting the prompt with '--->' for auto-inputs with proper
4524 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4530 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4525 this is handled by the prompts class itself, as it should.
4531 this is handled by the prompts class itself, as it should.
4526
4532
4527 2002-03-05 Fernando Perez <fperez@colorado.edu>
4533 2002-03-05 Fernando Perez <fperez@colorado.edu>
4528
4534
4529 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4535 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4530 @logstart to avoid name clashes with the math log function.
4536 @logstart to avoid name clashes with the math log function.
4531
4537
4532 * Big updates to X/Emacs section of the manual.
4538 * Big updates to X/Emacs section of the manual.
4533
4539
4534 * Removed ipython_emacs. Milan explained to me how to pass
4540 * Removed ipython_emacs. Milan explained to me how to pass
4535 arguments to ipython through Emacs. Some day I'm going to end up
4541 arguments to ipython through Emacs. Some day I'm going to end up
4536 learning some lisp...
4542 learning some lisp...
4537
4543
4538 2002-03-04 Fernando Perez <fperez@colorado.edu>
4544 2002-03-04 Fernando Perez <fperez@colorado.edu>
4539
4545
4540 * IPython/ipython_emacs: Created script to be used as the
4546 * IPython/ipython_emacs: Created script to be used as the
4541 py-python-command Emacs variable so we can pass IPython
4547 py-python-command Emacs variable so we can pass IPython
4542 parameters. I can't figure out how to tell Emacs directly to pass
4548 parameters. I can't figure out how to tell Emacs directly to pass
4543 parameters to IPython, so a dummy shell script will do it.
4549 parameters to IPython, so a dummy shell script will do it.
4544
4550
4545 Other enhancements made for things to work better under Emacs'
4551 Other enhancements made for things to work better under Emacs'
4546 various types of terminals. Many thanks to Milan Zamazal
4552 various types of terminals. Many thanks to Milan Zamazal
4547 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4553 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4548
4554
4549 2002-03-01 Fernando Perez <fperez@colorado.edu>
4555 2002-03-01 Fernando Perez <fperez@colorado.edu>
4550
4556
4551 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4557 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4552 that loading of readline is now optional. This gives better
4558 that loading of readline is now optional. This gives better
4553 control to emacs users.
4559 control to emacs users.
4554
4560
4555 * IPython/ultraTB.py (__date__): Modified color escape sequences
4561 * IPython/ultraTB.py (__date__): Modified color escape sequences
4556 and now things work fine under xterm and in Emacs' term buffers
4562 and now things work fine under xterm and in Emacs' term buffers
4557 (though not shell ones). Well, in emacs you get colors, but all
4563 (though not shell ones). Well, in emacs you get colors, but all
4558 seem to be 'light' colors (no difference between dark and light
4564 seem to be 'light' colors (no difference between dark and light
4559 ones). But the garbage chars are gone, and also in xterms. It
4565 ones). But the garbage chars are gone, and also in xterms. It
4560 seems that now I'm using 'cleaner' ansi sequences.
4566 seems that now I'm using 'cleaner' ansi sequences.
4561
4567
4562 2002-02-21 Fernando Perez <fperez@colorado.edu>
4568 2002-02-21 Fernando Perez <fperez@colorado.edu>
4563
4569
4564 * Released 0.2.7 (mainly to publish the scoping fix).
4570 * Released 0.2.7 (mainly to publish the scoping fix).
4565
4571
4566 * IPython/Logger.py (Logger.logstate): added. A corresponding
4572 * IPython/Logger.py (Logger.logstate): added. A corresponding
4567 @logstate magic was created.
4573 @logstate magic was created.
4568
4574
4569 * IPython/Magic.py: fixed nested scoping problem under Python
4575 * IPython/Magic.py: fixed nested scoping problem under Python
4570 2.1.x (automagic wasn't working).
4576 2.1.x (automagic wasn't working).
4571
4577
4572 2002-02-20 Fernando Perez <fperez@colorado.edu>
4578 2002-02-20 Fernando Perez <fperez@colorado.edu>
4573
4579
4574 * Released 0.2.6.
4580 * Released 0.2.6.
4575
4581
4576 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4582 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4577 option so that logs can come out without any headers at all.
4583 option so that logs can come out without any headers at all.
4578
4584
4579 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4585 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4580 SciPy.
4586 SciPy.
4581
4587
4582 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4588 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4583 that embedded IPython calls don't require vars() to be explicitly
4589 that embedded IPython calls don't require vars() to be explicitly
4584 passed. Now they are extracted from the caller's frame (code
4590 passed. Now they are extracted from the caller's frame (code
4585 snatched from Eric Jones' weave). Added better documentation to
4591 snatched from Eric Jones' weave). Added better documentation to
4586 the section on embedding and the example file.
4592 the section on embedding and the example file.
4587
4593
4588 * IPython/genutils.py (page): Changed so that under emacs, it just
4594 * IPython/genutils.py (page): Changed so that under emacs, it just
4589 prints the string. You can then page up and down in the emacs
4595 prints the string. You can then page up and down in the emacs
4590 buffer itself. This is how the builtin help() works.
4596 buffer itself. This is how the builtin help() works.
4591
4597
4592 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4598 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4593 macro scoping: macros need to be executed in the user's namespace
4599 macro scoping: macros need to be executed in the user's namespace
4594 to work as if they had been typed by the user.
4600 to work as if they had been typed by the user.
4595
4601
4596 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4602 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4597 execute automatically (no need to type 'exec...'). They then
4603 execute automatically (no need to type 'exec...'). They then
4598 behave like 'true macros'. The printing system was also modified
4604 behave like 'true macros'. The printing system was also modified
4599 for this to work.
4605 for this to work.
4600
4606
4601 2002-02-19 Fernando Perez <fperez@colorado.edu>
4607 2002-02-19 Fernando Perez <fperez@colorado.edu>
4602
4608
4603 * IPython/genutils.py (page_file): new function for paging files
4609 * IPython/genutils.py (page_file): new function for paging files
4604 in an OS-independent way. Also necessary for file viewing to work
4610 in an OS-independent way. Also necessary for file viewing to work
4605 well inside Emacs buffers.
4611 well inside Emacs buffers.
4606 (page): Added checks for being in an emacs buffer.
4612 (page): Added checks for being in an emacs buffer.
4607 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4613 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4608 same bug in iplib.
4614 same bug in iplib.
4609
4615
4610 2002-02-18 Fernando Perez <fperez@colorado.edu>
4616 2002-02-18 Fernando Perez <fperez@colorado.edu>
4611
4617
4612 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4618 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4613 of readline so that IPython can work inside an Emacs buffer.
4619 of readline so that IPython can work inside an Emacs buffer.
4614
4620
4615 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4621 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4616 method signatures (they weren't really bugs, but it looks cleaner
4622 method signatures (they weren't really bugs, but it looks cleaner
4617 and keeps PyChecker happy).
4623 and keeps PyChecker happy).
4618
4624
4619 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4625 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4620 for implementing various user-defined hooks. Currently only
4626 for implementing various user-defined hooks. Currently only
4621 display is done.
4627 display is done.
4622
4628
4623 * IPython/Prompts.py (CachedOutput._display): changed display
4629 * IPython/Prompts.py (CachedOutput._display): changed display
4624 functions so that they can be dynamically changed by users easily.
4630 functions so that they can be dynamically changed by users easily.
4625
4631
4626 * IPython/Extensions/numeric_formats.py (num_display): added an
4632 * IPython/Extensions/numeric_formats.py (num_display): added an
4627 extension for printing NumPy arrays in flexible manners. It
4633 extension for printing NumPy arrays in flexible manners. It
4628 doesn't do anything yet, but all the structure is in
4634 doesn't do anything yet, but all the structure is in
4629 place. Ultimately the plan is to implement output format control
4635 place. Ultimately the plan is to implement output format control
4630 like in Octave.
4636 like in Octave.
4631
4637
4632 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4638 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4633 methods are found at run-time by all the automatic machinery.
4639 methods are found at run-time by all the automatic machinery.
4634
4640
4635 2002-02-17 Fernando Perez <fperez@colorado.edu>
4641 2002-02-17 Fernando Perez <fperez@colorado.edu>
4636
4642
4637 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4643 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4638 whole file a little.
4644 whole file a little.
4639
4645
4640 * ToDo: closed this document. Now there's a new_design.lyx
4646 * ToDo: closed this document. Now there's a new_design.lyx
4641 document for all new ideas. Added making a pdf of it for the
4647 document for all new ideas. Added making a pdf of it for the
4642 end-user distro.
4648 end-user distro.
4643
4649
4644 * IPython/Logger.py (Logger.switch_log): Created this to replace
4650 * IPython/Logger.py (Logger.switch_log): Created this to replace
4645 logon() and logoff(). It also fixes a nasty crash reported by
4651 logon() and logoff(). It also fixes a nasty crash reported by
4646 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4652 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4647
4653
4648 * IPython/iplib.py (complete): got auto-completion to work with
4654 * IPython/iplib.py (complete): got auto-completion to work with
4649 automagic (I had wanted this for a long time).
4655 automagic (I had wanted this for a long time).
4650
4656
4651 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4657 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4652 to @file, since file() is now a builtin and clashes with automagic
4658 to @file, since file() is now a builtin and clashes with automagic
4653 for @file.
4659 for @file.
4654
4660
4655 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4661 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4656 of this was previously in iplib, which had grown to more than 2000
4662 of this was previously in iplib, which had grown to more than 2000
4657 lines, way too long. No new functionality, but it makes managing
4663 lines, way too long. No new functionality, but it makes managing
4658 the code a bit easier.
4664 the code a bit easier.
4659
4665
4660 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4666 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4661 information to crash reports.
4667 information to crash reports.
4662
4668
4663 2002-02-12 Fernando Perez <fperez@colorado.edu>
4669 2002-02-12 Fernando Perez <fperez@colorado.edu>
4664
4670
4665 * Released 0.2.5.
4671 * Released 0.2.5.
4666
4672
4667 2002-02-11 Fernando Perez <fperez@colorado.edu>
4673 2002-02-11 Fernando Perez <fperez@colorado.edu>
4668
4674
4669 * Wrote a relatively complete Windows installer. It puts
4675 * Wrote a relatively complete Windows installer. It puts
4670 everything in place, creates Start Menu entries and fixes the
4676 everything in place, creates Start Menu entries and fixes the
4671 color issues. Nothing fancy, but it works.
4677 color issues. Nothing fancy, but it works.
4672
4678
4673 2002-02-10 Fernando Perez <fperez@colorado.edu>
4679 2002-02-10 Fernando Perez <fperez@colorado.edu>
4674
4680
4675 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4681 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4676 os.path.expanduser() call so that we can type @run ~/myfile.py and
4682 os.path.expanduser() call so that we can type @run ~/myfile.py and
4677 have thigs work as expected.
4683 have thigs work as expected.
4678
4684
4679 * IPython/genutils.py (page): fixed exception handling so things
4685 * IPython/genutils.py (page): fixed exception handling so things
4680 work both in Unix and Windows correctly. Quitting a pager triggers
4686 work both in Unix and Windows correctly. Quitting a pager triggers
4681 an IOError/broken pipe in Unix, and in windows not finding a pager
4687 an IOError/broken pipe in Unix, and in windows not finding a pager
4682 is also an IOError, so I had to actually look at the return value
4688 is also an IOError, so I had to actually look at the return value
4683 of the exception, not just the exception itself. Should be ok now.
4689 of the exception, not just the exception itself. Should be ok now.
4684
4690
4685 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4691 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4686 modified to allow case-insensitive color scheme changes.
4692 modified to allow case-insensitive color scheme changes.
4687
4693
4688 2002-02-09 Fernando Perez <fperez@colorado.edu>
4694 2002-02-09 Fernando Perez <fperez@colorado.edu>
4689
4695
4690 * IPython/genutils.py (native_line_ends): new function to leave
4696 * IPython/genutils.py (native_line_ends): new function to leave
4691 user config files with os-native line-endings.
4697 user config files with os-native line-endings.
4692
4698
4693 * README and manual updates.
4699 * README and manual updates.
4694
4700
4695 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4701 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4696 instead of StringType to catch Unicode strings.
4702 instead of StringType to catch Unicode strings.
4697
4703
4698 * IPython/genutils.py (filefind): fixed bug for paths with
4704 * IPython/genutils.py (filefind): fixed bug for paths with
4699 embedded spaces (very common in Windows).
4705 embedded spaces (very common in Windows).
4700
4706
4701 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4707 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4702 files under Windows, so that they get automatically associated
4708 files under Windows, so that they get automatically associated
4703 with a text editor. Windows makes it a pain to handle
4709 with a text editor. Windows makes it a pain to handle
4704 extension-less files.
4710 extension-less files.
4705
4711
4706 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4712 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4707 warning about readline only occur for Posix. In Windows there's no
4713 warning about readline only occur for Posix. In Windows there's no
4708 way to get readline, so why bother with the warning.
4714 way to get readline, so why bother with the warning.
4709
4715
4710 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4716 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4711 for __str__ instead of dir(self), since dir() changed in 2.2.
4717 for __str__ instead of dir(self), since dir() changed in 2.2.
4712
4718
4713 * Ported to Windows! Tested on XP, I suspect it should work fine
4719 * Ported to Windows! Tested on XP, I suspect it should work fine
4714 on NT/2000, but I don't think it will work on 98 et al. That
4720 on NT/2000, but I don't think it will work on 98 et al. That
4715 series of Windows is such a piece of junk anyway that I won't try
4721 series of Windows is such a piece of junk anyway that I won't try
4716 porting it there. The XP port was straightforward, showed a few
4722 porting it there. The XP port was straightforward, showed a few
4717 bugs here and there (fixed all), in particular some string
4723 bugs here and there (fixed all), in particular some string
4718 handling stuff which required considering Unicode strings (which
4724 handling stuff which required considering Unicode strings (which
4719 Windows uses). This is good, but hasn't been too tested :) No
4725 Windows uses). This is good, but hasn't been too tested :) No
4720 fancy installer yet, I'll put a note in the manual so people at
4726 fancy installer yet, I'll put a note in the manual so people at
4721 least make manually a shortcut.
4727 least make manually a shortcut.
4722
4728
4723 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4729 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4724 into a single one, "colors". This now controls both prompt and
4730 into a single one, "colors". This now controls both prompt and
4725 exception color schemes, and can be changed both at startup
4731 exception color schemes, and can be changed both at startup
4726 (either via command-line switches or via ipythonrc files) and at
4732 (either via command-line switches or via ipythonrc files) and at
4727 runtime, with @colors.
4733 runtime, with @colors.
4728 (Magic.magic_run): renamed @prun to @run and removed the old
4734 (Magic.magic_run): renamed @prun to @run and removed the old
4729 @run. The two were too similar to warrant keeping both.
4735 @run. The two were too similar to warrant keeping both.
4730
4736
4731 2002-02-03 Fernando Perez <fperez@colorado.edu>
4737 2002-02-03 Fernando Perez <fperez@colorado.edu>
4732
4738
4733 * IPython/iplib.py (install_first_time): Added comment on how to
4739 * IPython/iplib.py (install_first_time): Added comment on how to
4734 configure the color options for first-time users. Put a <return>
4740 configure the color options for first-time users. Put a <return>
4735 request at the end so that small-terminal users get a chance to
4741 request at the end so that small-terminal users get a chance to
4736 read the startup info.
4742 read the startup info.
4737
4743
4738 2002-01-23 Fernando Perez <fperez@colorado.edu>
4744 2002-01-23 Fernando Perez <fperez@colorado.edu>
4739
4745
4740 * IPython/iplib.py (CachedOutput.update): Changed output memory
4746 * IPython/iplib.py (CachedOutput.update): Changed output memory
4741 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4747 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4742 input history we still use _i. Did this b/c these variable are
4748 input history we still use _i. Did this b/c these variable are
4743 very commonly used in interactive work, so the less we need to
4749 very commonly used in interactive work, so the less we need to
4744 type the better off we are.
4750 type the better off we are.
4745 (Magic.magic_prun): updated @prun to better handle the namespaces
4751 (Magic.magic_prun): updated @prun to better handle the namespaces
4746 the file will run in, including a fix for __name__ not being set
4752 the file will run in, including a fix for __name__ not being set
4747 before.
4753 before.
4748
4754
4749 2002-01-20 Fernando Perez <fperez@colorado.edu>
4755 2002-01-20 Fernando Perez <fperez@colorado.edu>
4750
4756
4751 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4757 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4752 extra garbage for Python 2.2. Need to look more carefully into
4758 extra garbage for Python 2.2. Need to look more carefully into
4753 this later.
4759 this later.
4754
4760
4755 2002-01-19 Fernando Perez <fperez@colorado.edu>
4761 2002-01-19 Fernando Perez <fperez@colorado.edu>
4756
4762
4757 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4763 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4758 display SyntaxError exceptions properly formatted when they occur
4764 display SyntaxError exceptions properly formatted when they occur
4759 (they can be triggered by imported code).
4765 (they can be triggered by imported code).
4760
4766
4761 2002-01-18 Fernando Perez <fperez@colorado.edu>
4767 2002-01-18 Fernando Perez <fperez@colorado.edu>
4762
4768
4763 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4769 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4764 SyntaxError exceptions are reported nicely formatted, instead of
4770 SyntaxError exceptions are reported nicely formatted, instead of
4765 spitting out only offset information as before.
4771 spitting out only offset information as before.
4766 (Magic.magic_prun): Added the @prun function for executing
4772 (Magic.magic_prun): Added the @prun function for executing
4767 programs with command line args inside IPython.
4773 programs with command line args inside IPython.
4768
4774
4769 2002-01-16 Fernando Perez <fperez@colorado.edu>
4775 2002-01-16 Fernando Perez <fperez@colorado.edu>
4770
4776
4771 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4777 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4772 to *not* include the last item given in a range. This brings their
4778 to *not* include the last item given in a range. This brings their
4773 behavior in line with Python's slicing:
4779 behavior in line with Python's slicing:
4774 a[n1:n2] -> a[n1]...a[n2-1]
4780 a[n1:n2] -> a[n1]...a[n2-1]
4775 It may be a bit less convenient, but I prefer to stick to Python's
4781 It may be a bit less convenient, but I prefer to stick to Python's
4776 conventions *everywhere*, so users never have to wonder.
4782 conventions *everywhere*, so users never have to wonder.
4777 (Magic.magic_macro): Added @macro function to ease the creation of
4783 (Magic.magic_macro): Added @macro function to ease the creation of
4778 macros.
4784 macros.
4779
4785
4780 2002-01-05 Fernando Perez <fperez@colorado.edu>
4786 2002-01-05 Fernando Perez <fperez@colorado.edu>
4781
4787
4782 * Released 0.2.4.
4788 * Released 0.2.4.
4783
4789
4784 * IPython/iplib.py (Magic.magic_pdef):
4790 * IPython/iplib.py (Magic.magic_pdef):
4785 (InteractiveShell.safe_execfile): report magic lines and error
4791 (InteractiveShell.safe_execfile): report magic lines and error
4786 lines without line numbers so one can easily copy/paste them for
4792 lines without line numbers so one can easily copy/paste them for
4787 re-execution.
4793 re-execution.
4788
4794
4789 * Updated manual with recent changes.
4795 * Updated manual with recent changes.
4790
4796
4791 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4797 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4792 docstring printing when class? is called. Very handy for knowing
4798 docstring printing when class? is called. Very handy for knowing
4793 how to create class instances (as long as __init__ is well
4799 how to create class instances (as long as __init__ is well
4794 documented, of course :)
4800 documented, of course :)
4795 (Magic.magic_doc): print both class and constructor docstrings.
4801 (Magic.magic_doc): print both class and constructor docstrings.
4796 (Magic.magic_pdef): give constructor info if passed a class and
4802 (Magic.magic_pdef): give constructor info if passed a class and
4797 __call__ info for callable object instances.
4803 __call__ info for callable object instances.
4798
4804
4799 2002-01-04 Fernando Perez <fperez@colorado.edu>
4805 2002-01-04 Fernando Perez <fperez@colorado.edu>
4800
4806
4801 * Made deep_reload() off by default. It doesn't always work
4807 * Made deep_reload() off by default. It doesn't always work
4802 exactly as intended, so it's probably safer to have it off. It's
4808 exactly as intended, so it's probably safer to have it off. It's
4803 still available as dreload() anyway, so nothing is lost.
4809 still available as dreload() anyway, so nothing is lost.
4804
4810
4805 2002-01-02 Fernando Perez <fperez@colorado.edu>
4811 2002-01-02 Fernando Perez <fperez@colorado.edu>
4806
4812
4807 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4813 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4808 so I wanted an updated release).
4814 so I wanted an updated release).
4809
4815
4810 2001-12-27 Fernando Perez <fperez@colorado.edu>
4816 2001-12-27 Fernando Perez <fperez@colorado.edu>
4811
4817
4812 * IPython/iplib.py (InteractiveShell.interact): Added the original
4818 * IPython/iplib.py (InteractiveShell.interact): Added the original
4813 code from 'code.py' for this module in order to change the
4819 code from 'code.py' for this module in order to change the
4814 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4820 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4815 the history cache would break when the user hit Ctrl-C, and
4821 the history cache would break when the user hit Ctrl-C, and
4816 interact() offers no way to add any hooks to it.
4822 interact() offers no way to add any hooks to it.
4817
4823
4818 2001-12-23 Fernando Perez <fperez@colorado.edu>
4824 2001-12-23 Fernando Perez <fperez@colorado.edu>
4819
4825
4820 * setup.py: added check for 'MANIFEST' before trying to remove
4826 * setup.py: added check for 'MANIFEST' before trying to remove
4821 it. Thanks to Sean Reifschneider.
4827 it. Thanks to Sean Reifschneider.
4822
4828
4823 2001-12-22 Fernando Perez <fperez@colorado.edu>
4829 2001-12-22 Fernando Perez <fperez@colorado.edu>
4824
4830
4825 * Released 0.2.2.
4831 * Released 0.2.2.
4826
4832
4827 * Finished (reasonably) writing the manual. Later will add the
4833 * Finished (reasonably) writing the manual. Later will add the
4828 python-standard navigation stylesheets, but for the time being
4834 python-standard navigation stylesheets, but for the time being
4829 it's fairly complete. Distribution will include html and pdf
4835 it's fairly complete. Distribution will include html and pdf
4830 versions.
4836 versions.
4831
4837
4832 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4838 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4833 (MayaVi author).
4839 (MayaVi author).
4834
4840
4835 2001-12-21 Fernando Perez <fperez@colorado.edu>
4841 2001-12-21 Fernando Perez <fperez@colorado.edu>
4836
4842
4837 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4843 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4838 good public release, I think (with the manual and the distutils
4844 good public release, I think (with the manual and the distutils
4839 installer). The manual can use some work, but that can go
4845 installer). The manual can use some work, but that can go
4840 slowly. Otherwise I think it's quite nice for end users. Next
4846 slowly. Otherwise I think it's quite nice for end users. Next
4841 summer, rewrite the guts of it...
4847 summer, rewrite the guts of it...
4842
4848
4843 * Changed format of ipythonrc files to use whitespace as the
4849 * Changed format of ipythonrc files to use whitespace as the
4844 separator instead of an explicit '='. Cleaner.
4850 separator instead of an explicit '='. Cleaner.
4845
4851
4846 2001-12-20 Fernando Perez <fperez@colorado.edu>
4852 2001-12-20 Fernando Perez <fperez@colorado.edu>
4847
4853
4848 * Started a manual in LyX. For now it's just a quick merge of the
4854 * Started a manual in LyX. For now it's just a quick merge of the
4849 various internal docstrings and READMEs. Later it may grow into a
4855 various internal docstrings and READMEs. Later it may grow into a
4850 nice, full-blown manual.
4856 nice, full-blown manual.
4851
4857
4852 * Set up a distutils based installer. Installation should now be
4858 * Set up a distutils based installer. Installation should now be
4853 trivially simple for end-users.
4859 trivially simple for end-users.
4854
4860
4855 2001-12-11 Fernando Perez <fperez@colorado.edu>
4861 2001-12-11 Fernando Perez <fperez@colorado.edu>
4856
4862
4857 * Released 0.2.0. First public release, announced it at
4863 * Released 0.2.0. First public release, announced it at
4858 comp.lang.python. From now on, just bugfixes...
4864 comp.lang.python. From now on, just bugfixes...
4859
4865
4860 * Went through all the files, set copyright/license notices and
4866 * Went through all the files, set copyright/license notices and
4861 cleaned up things. Ready for release.
4867 cleaned up things. Ready for release.
4862
4868
4863 2001-12-10 Fernando Perez <fperez@colorado.edu>
4869 2001-12-10 Fernando Perez <fperez@colorado.edu>
4864
4870
4865 * Changed the first-time installer not to use tarfiles. It's more
4871 * Changed the first-time installer not to use tarfiles. It's more
4866 robust now and less unix-dependent. Also makes it easier for
4872 robust now and less unix-dependent. Also makes it easier for
4867 people to later upgrade versions.
4873 people to later upgrade versions.
4868
4874
4869 * Changed @exit to @abort to reflect the fact that it's pretty
4875 * Changed @exit to @abort to reflect the fact that it's pretty
4870 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4876 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4871 becomes significant only when IPyhton is embedded: in that case,
4877 becomes significant only when IPyhton is embedded: in that case,
4872 C-D closes IPython only, but @abort kills the enclosing program
4878 C-D closes IPython only, but @abort kills the enclosing program
4873 too (unless it had called IPython inside a try catching
4879 too (unless it had called IPython inside a try catching
4874 SystemExit).
4880 SystemExit).
4875
4881
4876 * Created Shell module which exposes the actuall IPython Shell
4882 * Created Shell module which exposes the actuall IPython Shell
4877 classes, currently the normal and the embeddable one. This at
4883 classes, currently the normal and the embeddable one. This at
4878 least offers a stable interface we won't need to change when
4884 least offers a stable interface we won't need to change when
4879 (later) the internals are rewritten. That rewrite will be confined
4885 (later) the internals are rewritten. That rewrite will be confined
4880 to iplib and ipmaker, but the Shell interface should remain as is.
4886 to iplib and ipmaker, but the Shell interface should remain as is.
4881
4887
4882 * Added embed module which offers an embeddable IPShell object,
4888 * Added embed module which offers an embeddable IPShell object,
4883 useful to fire up IPython *inside* a running program. Great for
4889 useful to fire up IPython *inside* a running program. Great for
4884 debugging or dynamical data analysis.
4890 debugging or dynamical data analysis.
4885
4891
4886 2001-12-08 Fernando Perez <fperez@colorado.edu>
4892 2001-12-08 Fernando Perez <fperez@colorado.edu>
4887
4893
4888 * Fixed small bug preventing seeing info from methods of defined
4894 * Fixed small bug preventing seeing info from methods of defined
4889 objects (incorrect namespace in _ofind()).
4895 objects (incorrect namespace in _ofind()).
4890
4896
4891 * Documentation cleanup. Moved the main usage docstrings to a
4897 * Documentation cleanup. Moved the main usage docstrings to a
4892 separate file, usage.py (cleaner to maintain, and hopefully in the
4898 separate file, usage.py (cleaner to maintain, and hopefully in the
4893 future some perlpod-like way of producing interactive, man and
4899 future some perlpod-like way of producing interactive, man and
4894 html docs out of it will be found).
4900 html docs out of it will be found).
4895
4901
4896 * Added @profile to see your profile at any time.
4902 * Added @profile to see your profile at any time.
4897
4903
4898 * Added @p as an alias for 'print'. It's especially convenient if
4904 * Added @p as an alias for 'print'. It's especially convenient if
4899 using automagic ('p x' prints x).
4905 using automagic ('p x' prints x).
4900
4906
4901 * Small cleanups and fixes after a pychecker run.
4907 * Small cleanups and fixes after a pychecker run.
4902
4908
4903 * Changed the @cd command to handle @cd - and @cd -<n> for
4909 * Changed the @cd command to handle @cd - and @cd -<n> for
4904 visiting any directory in _dh.
4910 visiting any directory in _dh.
4905
4911
4906 * Introduced _dh, a history of visited directories. @dhist prints
4912 * Introduced _dh, a history of visited directories. @dhist prints
4907 it out with numbers.
4913 it out with numbers.
4908
4914
4909 2001-12-07 Fernando Perez <fperez@colorado.edu>
4915 2001-12-07 Fernando Perez <fperez@colorado.edu>
4910
4916
4911 * Released 0.1.22
4917 * Released 0.1.22
4912
4918
4913 * Made initialization a bit more robust against invalid color
4919 * Made initialization a bit more robust against invalid color
4914 options in user input (exit, not traceback-crash).
4920 options in user input (exit, not traceback-crash).
4915
4921
4916 * Changed the bug crash reporter to write the report only in the
4922 * Changed the bug crash reporter to write the report only in the
4917 user's .ipython directory. That way IPython won't litter people's
4923 user's .ipython directory. That way IPython won't litter people's
4918 hard disks with crash files all over the place. Also print on
4924 hard disks with crash files all over the place. Also print on
4919 screen the necessary mail command.
4925 screen the necessary mail command.
4920
4926
4921 * With the new ultraTB, implemented LightBG color scheme for light
4927 * With the new ultraTB, implemented LightBG color scheme for light
4922 background terminals. A lot of people like white backgrounds, so I
4928 background terminals. A lot of people like white backgrounds, so I
4923 guess we should at least give them something readable.
4929 guess we should at least give them something readable.
4924
4930
4925 2001-12-06 Fernando Perez <fperez@colorado.edu>
4931 2001-12-06 Fernando Perez <fperez@colorado.edu>
4926
4932
4927 * Modified the structure of ultraTB. Now there's a proper class
4933 * Modified the structure of ultraTB. Now there's a proper class
4928 for tables of color schemes which allow adding schemes easily and
4934 for tables of color schemes which allow adding schemes easily and
4929 switching the active scheme without creating a new instance every
4935 switching the active scheme without creating a new instance every
4930 time (which was ridiculous). The syntax for creating new schemes
4936 time (which was ridiculous). The syntax for creating new schemes
4931 is also cleaner. I think ultraTB is finally done, with a clean
4937 is also cleaner. I think ultraTB is finally done, with a clean
4932 class structure. Names are also much cleaner (now there's proper
4938 class structure. Names are also much cleaner (now there's proper
4933 color tables, no need for every variable to also have 'color' in
4939 color tables, no need for every variable to also have 'color' in
4934 its name).
4940 its name).
4935
4941
4936 * Broke down genutils into separate files. Now genutils only
4942 * Broke down genutils into separate files. Now genutils only
4937 contains utility functions, and classes have been moved to their
4943 contains utility functions, and classes have been moved to their
4938 own files (they had enough independent functionality to warrant
4944 own files (they had enough independent functionality to warrant
4939 it): ConfigLoader, OutputTrap, Struct.
4945 it): ConfigLoader, OutputTrap, Struct.
4940
4946
4941 2001-12-05 Fernando Perez <fperez@colorado.edu>
4947 2001-12-05 Fernando Perez <fperez@colorado.edu>
4942
4948
4943 * IPython turns 21! Released version 0.1.21, as a candidate for
4949 * IPython turns 21! Released version 0.1.21, as a candidate for
4944 public consumption. If all goes well, release in a few days.
4950 public consumption. If all goes well, release in a few days.
4945
4951
4946 * Fixed path bug (files in Extensions/ directory wouldn't be found
4952 * Fixed path bug (files in Extensions/ directory wouldn't be found
4947 unless IPython/ was explicitly in sys.path).
4953 unless IPython/ was explicitly in sys.path).
4948
4954
4949 * Extended the FlexCompleter class as MagicCompleter to allow
4955 * Extended the FlexCompleter class as MagicCompleter to allow
4950 completion of @-starting lines.
4956 completion of @-starting lines.
4951
4957
4952 * Created __release__.py file as a central repository for release
4958 * Created __release__.py file as a central repository for release
4953 info that other files can read from.
4959 info that other files can read from.
4954
4960
4955 * Fixed small bug in logging: when logging was turned on in
4961 * Fixed small bug in logging: when logging was turned on in
4956 mid-session, old lines with special meanings (!@?) were being
4962 mid-session, old lines with special meanings (!@?) were being
4957 logged without the prepended comment, which is necessary since
4963 logged without the prepended comment, which is necessary since
4958 they are not truly valid python syntax. This should make session
4964 they are not truly valid python syntax. This should make session
4959 restores produce less errors.
4965 restores produce less errors.
4960
4966
4961 * The namespace cleanup forced me to make a FlexCompleter class
4967 * The namespace cleanup forced me to make a FlexCompleter class
4962 which is nothing but a ripoff of rlcompleter, but with selectable
4968 which is nothing but a ripoff of rlcompleter, but with selectable
4963 namespace (rlcompleter only works in __main__.__dict__). I'll try
4969 namespace (rlcompleter only works in __main__.__dict__). I'll try
4964 to submit a note to the authors to see if this change can be
4970 to submit a note to the authors to see if this change can be
4965 incorporated in future rlcompleter releases (Dec.6: done)
4971 incorporated in future rlcompleter releases (Dec.6: done)
4966
4972
4967 * More fixes to namespace handling. It was a mess! Now all
4973 * More fixes to namespace handling. It was a mess! Now all
4968 explicit references to __main__.__dict__ are gone (except when
4974 explicit references to __main__.__dict__ are gone (except when
4969 really needed) and everything is handled through the namespace
4975 really needed) and everything is handled through the namespace
4970 dicts in the IPython instance. We seem to be getting somewhere
4976 dicts in the IPython instance. We seem to be getting somewhere
4971 with this, finally...
4977 with this, finally...
4972
4978
4973 * Small documentation updates.
4979 * Small documentation updates.
4974
4980
4975 * Created the Extensions directory under IPython (with an
4981 * Created the Extensions directory under IPython (with an
4976 __init__.py). Put the PhysicalQ stuff there. This directory should
4982 __init__.py). Put the PhysicalQ stuff there. This directory should
4977 be used for all special-purpose extensions.
4983 be used for all special-purpose extensions.
4978
4984
4979 * File renaming:
4985 * File renaming:
4980 ipythonlib --> ipmaker
4986 ipythonlib --> ipmaker
4981 ipplib --> iplib
4987 ipplib --> iplib
4982 This makes a bit more sense in terms of what these files actually do.
4988 This makes a bit more sense in terms of what these files actually do.
4983
4989
4984 * Moved all the classes and functions in ipythonlib to ipplib, so
4990 * Moved all the classes and functions in ipythonlib to ipplib, so
4985 now ipythonlib only has make_IPython(). This will ease up its
4991 now ipythonlib only has make_IPython(). This will ease up its
4986 splitting in smaller functional chunks later.
4992 splitting in smaller functional chunks later.
4987
4993
4988 * Cleaned up (done, I think) output of @whos. Better column
4994 * Cleaned up (done, I think) output of @whos. Better column
4989 formatting, and now shows str(var) for as much as it can, which is
4995 formatting, and now shows str(var) for as much as it can, which is
4990 typically what one gets with a 'print var'.
4996 typically what one gets with a 'print var'.
4991
4997
4992 2001-12-04 Fernando Perez <fperez@colorado.edu>
4998 2001-12-04 Fernando Perez <fperez@colorado.edu>
4993
4999
4994 * Fixed namespace problems. Now builtin/IPyhton/user names get
5000 * Fixed namespace problems. Now builtin/IPyhton/user names get
4995 properly reported in their namespace. Internal namespace handling
5001 properly reported in their namespace. Internal namespace handling
4996 is finally getting decent (not perfect yet, but much better than
5002 is finally getting decent (not perfect yet, but much better than
4997 the ad-hoc mess we had).
5003 the ad-hoc mess we had).
4998
5004
4999 * Removed -exit option. If people just want to run a python
5005 * Removed -exit option. If people just want to run a python
5000 script, that's what the normal interpreter is for. Less
5006 script, that's what the normal interpreter is for. Less
5001 unnecessary options, less chances for bugs.
5007 unnecessary options, less chances for bugs.
5002
5008
5003 * Added a crash handler which generates a complete post-mortem if
5009 * Added a crash handler which generates a complete post-mortem if
5004 IPython crashes. This will help a lot in tracking bugs down the
5010 IPython crashes. This will help a lot in tracking bugs down the
5005 road.
5011 road.
5006
5012
5007 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5013 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5008 which were boud to functions being reassigned would bypass the
5014 which were boud to functions being reassigned would bypass the
5009 logger, breaking the sync of _il with the prompt counter. This
5015 logger, breaking the sync of _il with the prompt counter. This
5010 would then crash IPython later when a new line was logged.
5016 would then crash IPython later when a new line was logged.
5011
5017
5012 2001-12-02 Fernando Perez <fperez@colorado.edu>
5018 2001-12-02 Fernando Perez <fperez@colorado.edu>
5013
5019
5014 * Made IPython a package. This means people don't have to clutter
5020 * Made IPython a package. This means people don't have to clutter
5015 their sys.path with yet another directory. Changed the INSTALL
5021 their sys.path with yet another directory. Changed the INSTALL
5016 file accordingly.
5022 file accordingly.
5017
5023
5018 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5024 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5019 sorts its output (so @who shows it sorted) and @whos formats the
5025 sorts its output (so @who shows it sorted) and @whos formats the
5020 table according to the width of the first column. Nicer, easier to
5026 table according to the width of the first column. Nicer, easier to
5021 read. Todo: write a generic table_format() which takes a list of
5027 read. Todo: write a generic table_format() which takes a list of
5022 lists and prints it nicely formatted, with optional row/column
5028 lists and prints it nicely formatted, with optional row/column
5023 separators and proper padding and justification.
5029 separators and proper padding and justification.
5024
5030
5025 * Released 0.1.20
5031 * Released 0.1.20
5026
5032
5027 * Fixed bug in @log which would reverse the inputcache list (a
5033 * Fixed bug in @log which would reverse the inputcache list (a
5028 copy operation was missing).
5034 copy operation was missing).
5029
5035
5030 * Code cleanup. @config was changed to use page(). Better, since
5036 * Code cleanup. @config was changed to use page(). Better, since
5031 its output is always quite long.
5037 its output is always quite long.
5032
5038
5033 * Itpl is back as a dependency. I was having too many problems
5039 * Itpl is back as a dependency. I was having too many problems
5034 getting the parametric aliases to work reliably, and it's just
5040 getting the parametric aliases to work reliably, and it's just
5035 easier to code weird string operations with it than playing %()s
5041 easier to code weird string operations with it than playing %()s
5036 games. It's only ~6k, so I don't think it's too big a deal.
5042 games. It's only ~6k, so I don't think it's too big a deal.
5037
5043
5038 * Found (and fixed) a very nasty bug with history. !lines weren't
5044 * Found (and fixed) a very nasty bug with history. !lines weren't
5039 getting cached, and the out of sync caches would crash
5045 getting cached, and the out of sync caches would crash
5040 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5046 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5041 division of labor a bit better. Bug fixed, cleaner structure.
5047 division of labor a bit better. Bug fixed, cleaner structure.
5042
5048
5043 2001-12-01 Fernando Perez <fperez@colorado.edu>
5049 2001-12-01 Fernando Perez <fperez@colorado.edu>
5044
5050
5045 * Released 0.1.19
5051 * Released 0.1.19
5046
5052
5047 * Added option -n to @hist to prevent line number printing. Much
5053 * Added option -n to @hist to prevent line number printing. Much
5048 easier to copy/paste code this way.
5054 easier to copy/paste code this way.
5049
5055
5050 * Created global _il to hold the input list. Allows easy
5056 * Created global _il to hold the input list. Allows easy
5051 re-execution of blocks of code by slicing it (inspired by Janko's
5057 re-execution of blocks of code by slicing it (inspired by Janko's
5052 comment on 'macros').
5058 comment on 'macros').
5053
5059
5054 * Small fixes and doc updates.
5060 * Small fixes and doc updates.
5055
5061
5056 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5062 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5057 much too fragile with automagic. Handles properly multi-line
5063 much too fragile with automagic. Handles properly multi-line
5058 statements and takes parameters.
5064 statements and takes parameters.
5059
5065
5060 2001-11-30 Fernando Perez <fperez@colorado.edu>
5066 2001-11-30 Fernando Perez <fperez@colorado.edu>
5061
5067
5062 * Version 0.1.18 released.
5068 * Version 0.1.18 released.
5063
5069
5064 * Fixed nasty namespace bug in initial module imports.
5070 * Fixed nasty namespace bug in initial module imports.
5065
5071
5066 * Added copyright/license notes to all code files (except
5072 * Added copyright/license notes to all code files (except
5067 DPyGetOpt). For the time being, LGPL. That could change.
5073 DPyGetOpt). For the time being, LGPL. That could change.
5068
5074
5069 * Rewrote a much nicer README, updated INSTALL, cleaned up
5075 * Rewrote a much nicer README, updated INSTALL, cleaned up
5070 ipythonrc-* samples.
5076 ipythonrc-* samples.
5071
5077
5072 * Overall code/documentation cleanup. Basically ready for
5078 * Overall code/documentation cleanup. Basically ready for
5073 release. Only remaining thing: licence decision (LGPL?).
5079 release. Only remaining thing: licence decision (LGPL?).
5074
5080
5075 * Converted load_config to a class, ConfigLoader. Now recursion
5081 * Converted load_config to a class, ConfigLoader. Now recursion
5076 control is better organized. Doesn't include the same file twice.
5082 control is better organized. Doesn't include the same file twice.
5077
5083
5078 2001-11-29 Fernando Perez <fperez@colorado.edu>
5084 2001-11-29 Fernando Perez <fperez@colorado.edu>
5079
5085
5080 * Got input history working. Changed output history variables from
5086 * Got input history working. Changed output history variables from
5081 _p to _o so that _i is for input and _o for output. Just cleaner
5087 _p to _o so that _i is for input and _o for output. Just cleaner
5082 convention.
5088 convention.
5083
5089
5084 * Implemented parametric aliases. This pretty much allows the
5090 * Implemented parametric aliases. This pretty much allows the
5085 alias system to offer full-blown shell convenience, I think.
5091 alias system to offer full-blown shell convenience, I think.
5086
5092
5087 * Version 0.1.17 released, 0.1.18 opened.
5093 * Version 0.1.17 released, 0.1.18 opened.
5088
5094
5089 * dot_ipython/ipythonrc (alias): added documentation.
5095 * dot_ipython/ipythonrc (alias): added documentation.
5090 (xcolor): Fixed small bug (xcolors -> xcolor)
5096 (xcolor): Fixed small bug (xcolors -> xcolor)
5091
5097
5092 * Changed the alias system. Now alias is a magic command to define
5098 * Changed the alias system. Now alias is a magic command to define
5093 aliases just like the shell. Rationale: the builtin magics should
5099 aliases just like the shell. Rationale: the builtin magics should
5094 be there for things deeply connected to IPython's
5100 be there for things deeply connected to IPython's
5095 architecture. And this is a much lighter system for what I think
5101 architecture. And this is a much lighter system for what I think
5096 is the really important feature: allowing users to define quickly
5102 is the really important feature: allowing users to define quickly
5097 magics that will do shell things for them, so they can customize
5103 magics that will do shell things for them, so they can customize
5098 IPython easily to match their work habits. If someone is really
5104 IPython easily to match their work habits. If someone is really
5099 desperate to have another name for a builtin alias, they can
5105 desperate to have another name for a builtin alias, they can
5100 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5106 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5101 works.
5107 works.
5102
5108
5103 2001-11-28 Fernando Perez <fperez@colorado.edu>
5109 2001-11-28 Fernando Perez <fperez@colorado.edu>
5104
5110
5105 * Changed @file so that it opens the source file at the proper
5111 * Changed @file so that it opens the source file at the proper
5106 line. Since it uses less, if your EDITOR environment is
5112 line. Since it uses less, if your EDITOR environment is
5107 configured, typing v will immediately open your editor of choice
5113 configured, typing v will immediately open your editor of choice
5108 right at the line where the object is defined. Not as quick as
5114 right at the line where the object is defined. Not as quick as
5109 having a direct @edit command, but for all intents and purposes it
5115 having a direct @edit command, but for all intents and purposes it
5110 works. And I don't have to worry about writing @edit to deal with
5116 works. And I don't have to worry about writing @edit to deal with
5111 all the editors, less does that.
5117 all the editors, less does that.
5112
5118
5113 * Version 0.1.16 released, 0.1.17 opened.
5119 * Version 0.1.16 released, 0.1.17 opened.
5114
5120
5115 * Fixed some nasty bugs in the page/page_dumb combo that could
5121 * Fixed some nasty bugs in the page/page_dumb combo that could
5116 crash IPython.
5122 crash IPython.
5117
5123
5118 2001-11-27 Fernando Perez <fperez@colorado.edu>
5124 2001-11-27 Fernando Perez <fperez@colorado.edu>
5119
5125
5120 * Version 0.1.15 released, 0.1.16 opened.
5126 * Version 0.1.15 released, 0.1.16 opened.
5121
5127
5122 * Finally got ? and ?? to work for undefined things: now it's
5128 * Finally got ? and ?? to work for undefined things: now it's
5123 possible to type {}.get? and get information about the get method
5129 possible to type {}.get? and get information about the get method
5124 of dicts, or os.path? even if only os is defined (so technically
5130 of dicts, or os.path? even if only os is defined (so technically
5125 os.path isn't). Works at any level. For example, after import os,
5131 os.path isn't). Works at any level. For example, after import os,
5126 os?, os.path?, os.path.abspath? all work. This is great, took some
5132 os?, os.path?, os.path.abspath? all work. This is great, took some
5127 work in _ofind.
5133 work in _ofind.
5128
5134
5129 * Fixed more bugs with logging. The sanest way to do it was to add
5135 * Fixed more bugs with logging. The sanest way to do it was to add
5130 to @log a 'mode' parameter. Killed two in one shot (this mode
5136 to @log a 'mode' parameter. Killed two in one shot (this mode
5131 option was a request of Janko's). I think it's finally clean
5137 option was a request of Janko's). I think it's finally clean
5132 (famous last words).
5138 (famous last words).
5133
5139
5134 * Added a page_dumb() pager which does a decent job of paging on
5140 * Added a page_dumb() pager which does a decent job of paging on
5135 screen, if better things (like less) aren't available. One less
5141 screen, if better things (like less) aren't available. One less
5136 unix dependency (someday maybe somebody will port this to
5142 unix dependency (someday maybe somebody will port this to
5137 windows).
5143 windows).
5138
5144
5139 * Fixed problem in magic_log: would lock of logging out if log
5145 * Fixed problem in magic_log: would lock of logging out if log
5140 creation failed (because it would still think it had succeeded).
5146 creation failed (because it would still think it had succeeded).
5141
5147
5142 * Improved the page() function using curses to auto-detect screen
5148 * Improved the page() function using curses to auto-detect screen
5143 size. Now it can make a much better decision on whether to print
5149 size. Now it can make a much better decision on whether to print
5144 or page a string. Option screen_length was modified: a value 0
5150 or page a string. Option screen_length was modified: a value 0
5145 means auto-detect, and that's the default now.
5151 means auto-detect, and that's the default now.
5146
5152
5147 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5153 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5148 go out. I'll test it for a few days, then talk to Janko about
5154 go out. I'll test it for a few days, then talk to Janko about
5149 licences and announce it.
5155 licences and announce it.
5150
5156
5151 * Fixed the length of the auto-generated ---> prompt which appears
5157 * Fixed the length of the auto-generated ---> prompt which appears
5152 for auto-parens and auto-quotes. Getting this right isn't trivial,
5158 for auto-parens and auto-quotes. Getting this right isn't trivial,
5153 with all the color escapes, different prompt types and optional
5159 with all the color escapes, different prompt types and optional
5154 separators. But it seems to be working in all the combinations.
5160 separators. But it seems to be working in all the combinations.
5155
5161
5156 2001-11-26 Fernando Perez <fperez@colorado.edu>
5162 2001-11-26 Fernando Perez <fperez@colorado.edu>
5157
5163
5158 * Wrote a regexp filter to get option types from the option names
5164 * Wrote a regexp filter to get option types from the option names
5159 string. This eliminates the need to manually keep two duplicate
5165 string. This eliminates the need to manually keep two duplicate
5160 lists.
5166 lists.
5161
5167
5162 * Removed the unneeded check_option_names. Now options are handled
5168 * Removed the unneeded check_option_names. Now options are handled
5163 in a much saner manner and it's easy to visually check that things
5169 in a much saner manner and it's easy to visually check that things
5164 are ok.
5170 are ok.
5165
5171
5166 * Updated version numbers on all files I modified to carry a
5172 * Updated version numbers on all files I modified to carry a
5167 notice so Janko and Nathan have clear version markers.
5173 notice so Janko and Nathan have clear version markers.
5168
5174
5169 * Updated docstring for ultraTB with my changes. I should send
5175 * Updated docstring for ultraTB with my changes. I should send
5170 this to Nathan.
5176 this to Nathan.
5171
5177
5172 * Lots of small fixes. Ran everything through pychecker again.
5178 * Lots of small fixes. Ran everything through pychecker again.
5173
5179
5174 * Made loading of deep_reload an cmd line option. If it's not too
5180 * Made loading of deep_reload an cmd line option. If it's not too
5175 kosher, now people can just disable it. With -nodeep_reload it's
5181 kosher, now people can just disable it. With -nodeep_reload it's
5176 still available as dreload(), it just won't overwrite reload().
5182 still available as dreload(), it just won't overwrite reload().
5177
5183
5178 * Moved many options to the no| form (-opt and -noopt
5184 * Moved many options to the no| form (-opt and -noopt
5179 accepted). Cleaner.
5185 accepted). Cleaner.
5180
5186
5181 * Changed magic_log so that if called with no parameters, it uses
5187 * Changed magic_log so that if called with no parameters, it uses
5182 'rotate' mode. That way auto-generated logs aren't automatically
5188 'rotate' mode. That way auto-generated logs aren't automatically
5183 over-written. For normal logs, now a backup is made if it exists
5189 over-written. For normal logs, now a backup is made if it exists
5184 (only 1 level of backups). A new 'backup' mode was added to the
5190 (only 1 level of backups). A new 'backup' mode was added to the
5185 Logger class to support this. This was a request by Janko.
5191 Logger class to support this. This was a request by Janko.
5186
5192
5187 * Added @logoff/@logon to stop/restart an active log.
5193 * Added @logoff/@logon to stop/restart an active log.
5188
5194
5189 * Fixed a lot of bugs in log saving/replay. It was pretty
5195 * Fixed a lot of bugs in log saving/replay. It was pretty
5190 broken. Now special lines (!@,/) appear properly in the command
5196 broken. Now special lines (!@,/) appear properly in the command
5191 history after a log replay.
5197 history after a log replay.
5192
5198
5193 * Tried and failed to implement full session saving via pickle. My
5199 * Tried and failed to implement full session saving via pickle. My
5194 idea was to pickle __main__.__dict__, but modules can't be
5200 idea was to pickle __main__.__dict__, but modules can't be
5195 pickled. This would be a better alternative to replaying logs, but
5201 pickled. This would be a better alternative to replaying logs, but
5196 seems quite tricky to get to work. Changed -session to be called
5202 seems quite tricky to get to work. Changed -session to be called
5197 -logplay, which more accurately reflects what it does. And if we
5203 -logplay, which more accurately reflects what it does. And if we
5198 ever get real session saving working, -session is now available.
5204 ever get real session saving working, -session is now available.
5199
5205
5200 * Implemented color schemes for prompts also. As for tracebacks,
5206 * Implemented color schemes for prompts also. As for tracebacks,
5201 currently only NoColor and Linux are supported. But now the
5207 currently only NoColor and Linux are supported. But now the
5202 infrastructure is in place, based on a generic ColorScheme
5208 infrastructure is in place, based on a generic ColorScheme
5203 class. So writing and activating new schemes both for the prompts
5209 class. So writing and activating new schemes both for the prompts
5204 and the tracebacks should be straightforward.
5210 and the tracebacks should be straightforward.
5205
5211
5206 * Version 0.1.13 released, 0.1.14 opened.
5212 * Version 0.1.13 released, 0.1.14 opened.
5207
5213
5208 * Changed handling of options for output cache. Now counter is
5214 * Changed handling of options for output cache. Now counter is
5209 hardwired starting at 1 and one specifies the maximum number of
5215 hardwired starting at 1 and one specifies the maximum number of
5210 entries *in the outcache* (not the max prompt counter). This is
5216 entries *in the outcache* (not the max prompt counter). This is
5211 much better, since many statements won't increase the cache
5217 much better, since many statements won't increase the cache
5212 count. It also eliminated some confusing options, now there's only
5218 count. It also eliminated some confusing options, now there's only
5213 one: cache_size.
5219 one: cache_size.
5214
5220
5215 * Added 'alias' magic function and magic_alias option in the
5221 * Added 'alias' magic function and magic_alias option in the
5216 ipythonrc file. Now the user can easily define whatever names he
5222 ipythonrc file. Now the user can easily define whatever names he
5217 wants for the magic functions without having to play weird
5223 wants for the magic functions without having to play weird
5218 namespace games. This gives IPython a real shell-like feel.
5224 namespace games. This gives IPython a real shell-like feel.
5219
5225
5220 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5226 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5221 @ or not).
5227 @ or not).
5222
5228
5223 This was one of the last remaining 'visible' bugs (that I know
5229 This was one of the last remaining 'visible' bugs (that I know
5224 of). I think if I can clean up the session loading so it works
5230 of). I think if I can clean up the session loading so it works
5225 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5231 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5226 about licensing).
5232 about licensing).
5227
5233
5228 2001-11-25 Fernando Perez <fperez@colorado.edu>
5234 2001-11-25 Fernando Perez <fperez@colorado.edu>
5229
5235
5230 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5236 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5231 there's a cleaner distinction between what ? and ?? show.
5237 there's a cleaner distinction between what ? and ?? show.
5232
5238
5233 * Added screen_length option. Now the user can define his own
5239 * Added screen_length option. Now the user can define his own
5234 screen size for page() operations.
5240 screen size for page() operations.
5235
5241
5236 * Implemented magic shell-like functions with automatic code
5242 * Implemented magic shell-like functions with automatic code
5237 generation. Now adding another function is just a matter of adding
5243 generation. Now adding another function is just a matter of adding
5238 an entry to a dict, and the function is dynamically generated at
5244 an entry to a dict, and the function is dynamically generated at
5239 run-time. Python has some really cool features!
5245 run-time. Python has some really cool features!
5240
5246
5241 * Renamed many options to cleanup conventions a little. Now all
5247 * Renamed many options to cleanup conventions a little. Now all
5242 are lowercase, and only underscores where needed. Also in the code
5248 are lowercase, and only underscores where needed. Also in the code
5243 option name tables are clearer.
5249 option name tables are clearer.
5244
5250
5245 * Changed prompts a little. Now input is 'In [n]:' instead of
5251 * Changed prompts a little. Now input is 'In [n]:' instead of
5246 'In[n]:='. This allows it the numbers to be aligned with the
5252 'In[n]:='. This allows it the numbers to be aligned with the
5247 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5253 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5248 Python (it was a Mathematica thing). The '...' continuation prompt
5254 Python (it was a Mathematica thing). The '...' continuation prompt
5249 was also changed a little to align better.
5255 was also changed a little to align better.
5250
5256
5251 * Fixed bug when flushing output cache. Not all _p<n> variables
5257 * Fixed bug when flushing output cache. Not all _p<n> variables
5252 exist, so their deletion needs to be wrapped in a try:
5258 exist, so their deletion needs to be wrapped in a try:
5253
5259
5254 * Figured out how to properly use inspect.formatargspec() (it
5260 * Figured out how to properly use inspect.formatargspec() (it
5255 requires the args preceded by *). So I removed all the code from
5261 requires the args preceded by *). So I removed all the code from
5256 _get_pdef in Magic, which was just replicating that.
5262 _get_pdef in Magic, which was just replicating that.
5257
5263
5258 * Added test to prefilter to allow redefining magic function names
5264 * Added test to prefilter to allow redefining magic function names
5259 as variables. This is ok, since the @ form is always available,
5265 as variables. This is ok, since the @ form is always available,
5260 but whe should allow the user to define a variable called 'ls' if
5266 but whe should allow the user to define a variable called 'ls' if
5261 he needs it.
5267 he needs it.
5262
5268
5263 * Moved the ToDo information from README into a separate ToDo.
5269 * Moved the ToDo information from README into a separate ToDo.
5264
5270
5265 * General code cleanup and small bugfixes. I think it's close to a
5271 * General code cleanup and small bugfixes. I think it's close to a
5266 state where it can be released, obviously with a big 'beta'
5272 state where it can be released, obviously with a big 'beta'
5267 warning on it.
5273 warning on it.
5268
5274
5269 * Got the magic function split to work. Now all magics are defined
5275 * Got the magic function split to work. Now all magics are defined
5270 in a separate class. It just organizes things a bit, and now
5276 in a separate class. It just organizes things a bit, and now
5271 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5277 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5272 was too long).
5278 was too long).
5273
5279
5274 * Changed @clear to @reset to avoid potential confusions with
5280 * Changed @clear to @reset to avoid potential confusions with
5275 the shell command clear. Also renamed @cl to @clear, which does
5281 the shell command clear. Also renamed @cl to @clear, which does
5276 exactly what people expect it to from their shell experience.
5282 exactly what people expect it to from their shell experience.
5277
5283
5278 Added a check to the @reset command (since it's so
5284 Added a check to the @reset command (since it's so
5279 destructive, it's probably a good idea to ask for confirmation).
5285 destructive, it's probably a good idea to ask for confirmation).
5280 But now reset only works for full namespace resetting. Since the
5286 But now reset only works for full namespace resetting. Since the
5281 del keyword is already there for deleting a few specific
5287 del keyword is already there for deleting a few specific
5282 variables, I don't see the point of having a redundant magic
5288 variables, I don't see the point of having a redundant magic
5283 function for the same task.
5289 function for the same task.
5284
5290
5285 2001-11-24 Fernando Perez <fperez@colorado.edu>
5291 2001-11-24 Fernando Perez <fperez@colorado.edu>
5286
5292
5287 * Updated the builtin docs (esp. the ? ones).
5293 * Updated the builtin docs (esp. the ? ones).
5288
5294
5289 * Ran all the code through pychecker. Not terribly impressed with
5295 * Ran all the code through pychecker. Not terribly impressed with
5290 it: lots of spurious warnings and didn't really find anything of
5296 it: lots of spurious warnings and didn't really find anything of
5291 substance (just a few modules being imported and not used).
5297 substance (just a few modules being imported and not used).
5292
5298
5293 * Implemented the new ultraTB functionality into IPython. New
5299 * Implemented the new ultraTB functionality into IPython. New
5294 option: xcolors. This chooses color scheme. xmode now only selects
5300 option: xcolors. This chooses color scheme. xmode now only selects
5295 between Plain and Verbose. Better orthogonality.
5301 between Plain and Verbose. Better orthogonality.
5296
5302
5297 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5303 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5298 mode and color scheme for the exception handlers. Now it's
5304 mode and color scheme for the exception handlers. Now it's
5299 possible to have the verbose traceback with no coloring.
5305 possible to have the verbose traceback with no coloring.
5300
5306
5301 2001-11-23 Fernando Perez <fperez@colorado.edu>
5307 2001-11-23 Fernando Perez <fperez@colorado.edu>
5302
5308
5303 * Version 0.1.12 released, 0.1.13 opened.
5309 * Version 0.1.12 released, 0.1.13 opened.
5304
5310
5305 * Removed option to set auto-quote and auto-paren escapes by
5311 * Removed option to set auto-quote and auto-paren escapes by
5306 user. The chances of breaking valid syntax are just too high. If
5312 user. The chances of breaking valid syntax are just too high. If
5307 someone *really* wants, they can always dig into the code.
5313 someone *really* wants, they can always dig into the code.
5308
5314
5309 * Made prompt separators configurable.
5315 * Made prompt separators configurable.
5310
5316
5311 2001-11-22 Fernando Perez <fperez@colorado.edu>
5317 2001-11-22 Fernando Perez <fperez@colorado.edu>
5312
5318
5313 * Small bugfixes in many places.
5319 * Small bugfixes in many places.
5314
5320
5315 * Removed the MyCompleter class from ipplib. It seemed redundant
5321 * Removed the MyCompleter class from ipplib. It seemed redundant
5316 with the C-p,C-n history search functionality. Less code to
5322 with the C-p,C-n history search functionality. Less code to
5317 maintain.
5323 maintain.
5318
5324
5319 * Moved all the original ipython.py code into ipythonlib.py. Right
5325 * Moved all the original ipython.py code into ipythonlib.py. Right
5320 now it's just one big dump into a function called make_IPython, so
5326 now it's just one big dump into a function called make_IPython, so
5321 no real modularity has been gained. But at least it makes the
5327 no real modularity has been gained. But at least it makes the
5322 wrapper script tiny, and since ipythonlib is a module, it gets
5328 wrapper script tiny, and since ipythonlib is a module, it gets
5323 compiled and startup is much faster.
5329 compiled and startup is much faster.
5324
5330
5325 This is a reasobably 'deep' change, so we should test it for a
5331 This is a reasobably 'deep' change, so we should test it for a
5326 while without messing too much more with the code.
5332 while without messing too much more with the code.
5327
5333
5328 2001-11-21 Fernando Perez <fperez@colorado.edu>
5334 2001-11-21 Fernando Perez <fperez@colorado.edu>
5329
5335
5330 * Version 0.1.11 released, 0.1.12 opened for further work.
5336 * Version 0.1.11 released, 0.1.12 opened for further work.
5331
5337
5332 * Removed dependency on Itpl. It was only needed in one place. It
5338 * Removed dependency on Itpl. It was only needed in one place. It
5333 would be nice if this became part of python, though. It makes life
5339 would be nice if this became part of python, though. It makes life
5334 *a lot* easier in some cases.
5340 *a lot* easier in some cases.
5335
5341
5336 * Simplified the prefilter code a bit. Now all handlers are
5342 * Simplified the prefilter code a bit. Now all handlers are
5337 expected to explicitly return a value (at least a blank string).
5343 expected to explicitly return a value (at least a blank string).
5338
5344
5339 * Heavy edits in ipplib. Removed the help system altogether. Now
5345 * Heavy edits in ipplib. Removed the help system altogether. Now
5340 obj?/?? is used for inspecting objects, a magic @doc prints
5346 obj?/?? is used for inspecting objects, a magic @doc prints
5341 docstrings, and full-blown Python help is accessed via the 'help'
5347 docstrings, and full-blown Python help is accessed via the 'help'
5342 keyword. This cleans up a lot of code (less to maintain) and does
5348 keyword. This cleans up a lot of code (less to maintain) and does
5343 the job. Since 'help' is now a standard Python component, might as
5349 the job. Since 'help' is now a standard Python component, might as
5344 well use it and remove duplicate functionality.
5350 well use it and remove duplicate functionality.
5345
5351
5346 Also removed the option to use ipplib as a standalone program. By
5352 Also removed the option to use ipplib as a standalone program. By
5347 now it's too dependent on other parts of IPython to function alone.
5353 now it's too dependent on other parts of IPython to function alone.
5348
5354
5349 * Fixed bug in genutils.pager. It would crash if the pager was
5355 * Fixed bug in genutils.pager. It would crash if the pager was
5350 exited immediately after opening (broken pipe).
5356 exited immediately after opening (broken pipe).
5351
5357
5352 * Trimmed down the VerboseTB reporting a little. The header is
5358 * Trimmed down the VerboseTB reporting a little. The header is
5353 much shorter now and the repeated exception arguments at the end
5359 much shorter now and the repeated exception arguments at the end
5354 have been removed. For interactive use the old header seemed a bit
5360 have been removed. For interactive use the old header seemed a bit
5355 excessive.
5361 excessive.
5356
5362
5357 * Fixed small bug in output of @whos for variables with multi-word
5363 * Fixed small bug in output of @whos for variables with multi-word
5358 types (only first word was displayed).
5364 types (only first word was displayed).
5359
5365
5360 2001-11-17 Fernando Perez <fperez@colorado.edu>
5366 2001-11-17 Fernando Perez <fperez@colorado.edu>
5361
5367
5362 * Version 0.1.10 released, 0.1.11 opened for further work.
5368 * Version 0.1.10 released, 0.1.11 opened for further work.
5363
5369
5364 * Modified dirs and friends. dirs now *returns* the stack (not
5370 * Modified dirs and friends. dirs now *returns* the stack (not
5365 prints), so one can manipulate it as a variable. Convenient to
5371 prints), so one can manipulate it as a variable. Convenient to
5366 travel along many directories.
5372 travel along many directories.
5367
5373
5368 * Fixed bug in magic_pdef: would only work with functions with
5374 * Fixed bug in magic_pdef: would only work with functions with
5369 arguments with default values.
5375 arguments with default values.
5370
5376
5371 2001-11-14 Fernando Perez <fperez@colorado.edu>
5377 2001-11-14 Fernando Perez <fperez@colorado.edu>
5372
5378
5373 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5379 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5374 example with IPython. Various other minor fixes and cleanups.
5380 example with IPython. Various other minor fixes and cleanups.
5375
5381
5376 * Version 0.1.9 released, 0.1.10 opened for further work.
5382 * Version 0.1.9 released, 0.1.10 opened for further work.
5377
5383
5378 * Added sys.path to the list of directories searched in the
5384 * Added sys.path to the list of directories searched in the
5379 execfile= option. It used to be the current directory and the
5385 execfile= option. It used to be the current directory and the
5380 user's IPYTHONDIR only.
5386 user's IPYTHONDIR only.
5381
5387
5382 2001-11-13 Fernando Perez <fperez@colorado.edu>
5388 2001-11-13 Fernando Perez <fperez@colorado.edu>
5383
5389
5384 * Reinstated the raw_input/prefilter separation that Janko had
5390 * Reinstated the raw_input/prefilter separation that Janko had
5385 initially. This gives a more convenient setup for extending the
5391 initially. This gives a more convenient setup for extending the
5386 pre-processor from the outside: raw_input always gets a string,
5392 pre-processor from the outside: raw_input always gets a string,
5387 and prefilter has to process it. We can then redefine prefilter
5393 and prefilter has to process it. We can then redefine prefilter
5388 from the outside and implement extensions for special
5394 from the outside and implement extensions for special
5389 purposes.
5395 purposes.
5390
5396
5391 Today I got one for inputting PhysicalQuantity objects
5397 Today I got one for inputting PhysicalQuantity objects
5392 (from Scientific) without needing any function calls at
5398 (from Scientific) without needing any function calls at
5393 all. Extremely convenient, and it's all done as a user-level
5399 all. Extremely convenient, and it's all done as a user-level
5394 extension (no IPython code was touched). Now instead of:
5400 extension (no IPython code was touched). Now instead of:
5395 a = PhysicalQuantity(4.2,'m/s**2')
5401 a = PhysicalQuantity(4.2,'m/s**2')
5396 one can simply say
5402 one can simply say
5397 a = 4.2 m/s**2
5403 a = 4.2 m/s**2
5398 or even
5404 or even
5399 a = 4.2 m/s^2
5405 a = 4.2 m/s^2
5400
5406
5401 I use this, but it's also a proof of concept: IPython really is
5407 I use this, but it's also a proof of concept: IPython really is
5402 fully user-extensible, even at the level of the parsing of the
5408 fully user-extensible, even at the level of the parsing of the
5403 command line. It's not trivial, but it's perfectly doable.
5409 command line. It's not trivial, but it's perfectly doable.
5404
5410
5405 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5411 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5406 the problem of modules being loaded in the inverse order in which
5412 the problem of modules being loaded in the inverse order in which
5407 they were defined in
5413 they were defined in
5408
5414
5409 * Version 0.1.8 released, 0.1.9 opened for further work.
5415 * Version 0.1.8 released, 0.1.9 opened for further work.
5410
5416
5411 * Added magics pdef, source and file. They respectively show the
5417 * Added magics pdef, source and file. They respectively show the
5412 definition line ('prototype' in C), source code and full python
5418 definition line ('prototype' in C), source code and full python
5413 file for any callable object. The object inspector oinfo uses
5419 file for any callable object. The object inspector oinfo uses
5414 these to show the same information.
5420 these to show the same information.
5415
5421
5416 * Version 0.1.7 released, 0.1.8 opened for further work.
5422 * Version 0.1.7 released, 0.1.8 opened for further work.
5417
5423
5418 * Separated all the magic functions into a class called Magic. The
5424 * Separated all the magic functions into a class called Magic. The
5419 InteractiveShell class was becoming too big for Xemacs to handle
5425 InteractiveShell class was becoming too big for Xemacs to handle
5420 (de-indenting a line would lock it up for 10 seconds while it
5426 (de-indenting a line would lock it up for 10 seconds while it
5421 backtracked on the whole class!)
5427 backtracked on the whole class!)
5422
5428
5423 FIXME: didn't work. It can be done, but right now namespaces are
5429 FIXME: didn't work. It can be done, but right now namespaces are
5424 all messed up. Do it later (reverted it for now, so at least
5430 all messed up. Do it later (reverted it for now, so at least
5425 everything works as before).
5431 everything works as before).
5426
5432
5427 * Got the object introspection system (magic_oinfo) working! I
5433 * Got the object introspection system (magic_oinfo) working! I
5428 think this is pretty much ready for release to Janko, so he can
5434 think this is pretty much ready for release to Janko, so he can
5429 test it for a while and then announce it. Pretty much 100% of what
5435 test it for a while and then announce it. Pretty much 100% of what
5430 I wanted for the 'phase 1' release is ready. Happy, tired.
5436 I wanted for the 'phase 1' release is ready. Happy, tired.
5431
5437
5432 2001-11-12 Fernando Perez <fperez@colorado.edu>
5438 2001-11-12 Fernando Perez <fperez@colorado.edu>
5433
5439
5434 * Version 0.1.6 released, 0.1.7 opened for further work.
5440 * Version 0.1.6 released, 0.1.7 opened for further work.
5435
5441
5436 * Fixed bug in printing: it used to test for truth before
5442 * Fixed bug in printing: it used to test for truth before
5437 printing, so 0 wouldn't print. Now checks for None.
5443 printing, so 0 wouldn't print. Now checks for None.
5438
5444
5439 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5445 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5440 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5446 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5441 reaches by hand into the outputcache. Think of a better way to do
5447 reaches by hand into the outputcache. Think of a better way to do
5442 this later.
5448 this later.
5443
5449
5444 * Various small fixes thanks to Nathan's comments.
5450 * Various small fixes thanks to Nathan's comments.
5445
5451
5446 * Changed magic_pprint to magic_Pprint. This way it doesn't
5452 * Changed magic_pprint to magic_Pprint. This way it doesn't
5447 collide with pprint() and the name is consistent with the command
5453 collide with pprint() and the name is consistent with the command
5448 line option.
5454 line option.
5449
5455
5450 * Changed prompt counter behavior to be fully like
5456 * Changed prompt counter behavior to be fully like
5451 Mathematica's. That is, even input that doesn't return a result
5457 Mathematica's. That is, even input that doesn't return a result
5452 raises the prompt counter. The old behavior was kind of confusing
5458 raises the prompt counter. The old behavior was kind of confusing
5453 (getting the same prompt number several times if the operation
5459 (getting the same prompt number several times if the operation
5454 didn't return a result).
5460 didn't return a result).
5455
5461
5456 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5462 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5457
5463
5458 * Fixed -Classic mode (wasn't working anymore).
5464 * Fixed -Classic mode (wasn't working anymore).
5459
5465
5460 * Added colored prompts using Nathan's new code. Colors are
5466 * Added colored prompts using Nathan's new code. Colors are
5461 currently hardwired, they can be user-configurable. For
5467 currently hardwired, they can be user-configurable. For
5462 developers, they can be chosen in file ipythonlib.py, at the
5468 developers, they can be chosen in file ipythonlib.py, at the
5463 beginning of the CachedOutput class def.
5469 beginning of the CachedOutput class def.
5464
5470
5465 2001-11-11 Fernando Perez <fperez@colorado.edu>
5471 2001-11-11 Fernando Perez <fperez@colorado.edu>
5466
5472
5467 * Version 0.1.5 released, 0.1.6 opened for further work.
5473 * Version 0.1.5 released, 0.1.6 opened for further work.
5468
5474
5469 * Changed magic_env to *return* the environment as a dict (not to
5475 * Changed magic_env to *return* the environment as a dict (not to
5470 print it). This way it prints, but it can also be processed.
5476 print it). This way it prints, but it can also be processed.
5471
5477
5472 * Added Verbose exception reporting to interactive
5478 * Added Verbose exception reporting to interactive
5473 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5479 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5474 traceback. Had to make some changes to the ultraTB file. This is
5480 traceback. Had to make some changes to the ultraTB file. This is
5475 probably the last 'big' thing in my mental todo list. This ties
5481 probably the last 'big' thing in my mental todo list. This ties
5476 in with the next entry:
5482 in with the next entry:
5477
5483
5478 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5484 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5479 has to specify is Plain, Color or Verbose for all exception
5485 has to specify is Plain, Color or Verbose for all exception
5480 handling.
5486 handling.
5481
5487
5482 * Removed ShellServices option. All this can really be done via
5488 * Removed ShellServices option. All this can really be done via
5483 the magic system. It's easier to extend, cleaner and has automatic
5489 the magic system. It's easier to extend, cleaner and has automatic
5484 namespace protection and documentation.
5490 namespace protection and documentation.
5485
5491
5486 2001-11-09 Fernando Perez <fperez@colorado.edu>
5492 2001-11-09 Fernando Perez <fperez@colorado.edu>
5487
5493
5488 * Fixed bug in output cache flushing (missing parameter to
5494 * Fixed bug in output cache flushing (missing parameter to
5489 __init__). Other small bugs fixed (found using pychecker).
5495 __init__). Other small bugs fixed (found using pychecker).
5490
5496
5491 * Version 0.1.4 opened for bugfixing.
5497 * Version 0.1.4 opened for bugfixing.
5492
5498
5493 2001-11-07 Fernando Perez <fperez@colorado.edu>
5499 2001-11-07 Fernando Perez <fperez@colorado.edu>
5494
5500
5495 * Version 0.1.3 released, mainly because of the raw_input bug.
5501 * Version 0.1.3 released, mainly because of the raw_input bug.
5496
5502
5497 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5503 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5498 and when testing for whether things were callable, a call could
5504 and when testing for whether things were callable, a call could
5499 actually be made to certain functions. They would get called again
5505 actually be made to certain functions. They would get called again
5500 once 'really' executed, with a resulting double call. A disaster
5506 once 'really' executed, with a resulting double call. A disaster
5501 in many cases (list.reverse() would never work!).
5507 in many cases (list.reverse() would never work!).
5502
5508
5503 * Removed prefilter() function, moved its code to raw_input (which
5509 * Removed prefilter() function, moved its code to raw_input (which
5504 after all was just a near-empty caller for prefilter). This saves
5510 after all was just a near-empty caller for prefilter). This saves
5505 a function call on every prompt, and simplifies the class a tiny bit.
5511 a function call on every prompt, and simplifies the class a tiny bit.
5506
5512
5507 * Fix _ip to __ip name in magic example file.
5513 * Fix _ip to __ip name in magic example file.
5508
5514
5509 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5515 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5510 work with non-gnu versions of tar.
5516 work with non-gnu versions of tar.
5511
5517
5512 2001-11-06 Fernando Perez <fperez@colorado.edu>
5518 2001-11-06 Fernando Perez <fperez@colorado.edu>
5513
5519
5514 * Version 0.1.2. Just to keep track of the recent changes.
5520 * Version 0.1.2. Just to keep track of the recent changes.
5515
5521
5516 * Fixed nasty bug in output prompt routine. It used to check 'if
5522 * Fixed nasty bug in output prompt routine. It used to check 'if
5517 arg != None...'. Problem is, this fails if arg implements a
5523 arg != None...'. Problem is, this fails if arg implements a
5518 special comparison (__cmp__) which disallows comparing to
5524 special comparison (__cmp__) which disallows comparing to
5519 None. Found it when trying to use the PhysicalQuantity module from
5525 None. Found it when trying to use the PhysicalQuantity module from
5520 ScientificPython.
5526 ScientificPython.
5521
5527
5522 2001-11-05 Fernando Perez <fperez@colorado.edu>
5528 2001-11-05 Fernando Perez <fperez@colorado.edu>
5523
5529
5524 * Also added dirs. Now the pushd/popd/dirs family functions
5530 * Also added dirs. Now the pushd/popd/dirs family functions
5525 basically like the shell, with the added convenience of going home
5531 basically like the shell, with the added convenience of going home
5526 when called with no args.
5532 when called with no args.
5527
5533
5528 * pushd/popd slightly modified to mimic shell behavior more
5534 * pushd/popd slightly modified to mimic shell behavior more
5529 closely.
5535 closely.
5530
5536
5531 * Added env,pushd,popd from ShellServices as magic functions. I
5537 * Added env,pushd,popd from ShellServices as magic functions. I
5532 think the cleanest will be to port all desired functions from
5538 think the cleanest will be to port all desired functions from
5533 ShellServices as magics and remove ShellServices altogether. This
5539 ShellServices as magics and remove ShellServices altogether. This
5534 will provide a single, clean way of adding functionality
5540 will provide a single, clean way of adding functionality
5535 (shell-type or otherwise) to IP.
5541 (shell-type or otherwise) to IP.
5536
5542
5537 2001-11-04 Fernando Perez <fperez@colorado.edu>
5543 2001-11-04 Fernando Perez <fperez@colorado.edu>
5538
5544
5539 * Added .ipython/ directory to sys.path. This way users can keep
5545 * Added .ipython/ directory to sys.path. This way users can keep
5540 customizations there and access them via import.
5546 customizations there and access them via import.
5541
5547
5542 2001-11-03 Fernando Perez <fperez@colorado.edu>
5548 2001-11-03 Fernando Perez <fperez@colorado.edu>
5543
5549
5544 * Opened version 0.1.1 for new changes.
5550 * Opened version 0.1.1 for new changes.
5545
5551
5546 * Changed version number to 0.1.0: first 'public' release, sent to
5552 * Changed version number to 0.1.0: first 'public' release, sent to
5547 Nathan and Janko.
5553 Nathan and Janko.
5548
5554
5549 * Lots of small fixes and tweaks.
5555 * Lots of small fixes and tweaks.
5550
5556
5551 * Minor changes to whos format. Now strings are shown, snipped if
5557 * Minor changes to whos format. Now strings are shown, snipped if
5552 too long.
5558 too long.
5553
5559
5554 * Changed ShellServices to work on __main__ so they show up in @who
5560 * Changed ShellServices to work on __main__ so they show up in @who
5555
5561
5556 * Help also works with ? at the end of a line:
5562 * Help also works with ? at the end of a line:
5557 ?sin and sin?
5563 ?sin and sin?
5558 both produce the same effect. This is nice, as often I use the
5564 both produce the same effect. This is nice, as often I use the
5559 tab-complete to find the name of a method, but I used to then have
5565 tab-complete to find the name of a method, but I used to then have
5560 to go to the beginning of the line to put a ? if I wanted more
5566 to go to the beginning of the line to put a ? if I wanted more
5561 info. Now I can just add the ? and hit return. Convenient.
5567 info. Now I can just add the ? and hit return. Convenient.
5562
5568
5563 2001-11-02 Fernando Perez <fperez@colorado.edu>
5569 2001-11-02 Fernando Perez <fperez@colorado.edu>
5564
5570
5565 * Python version check (>=2.1) added.
5571 * Python version check (>=2.1) added.
5566
5572
5567 * Added LazyPython documentation. At this point the docs are quite
5573 * Added LazyPython documentation. At this point the docs are quite
5568 a mess. A cleanup is in order.
5574 a mess. A cleanup is in order.
5569
5575
5570 * Auto-installer created. For some bizarre reason, the zipfiles
5576 * Auto-installer created. For some bizarre reason, the zipfiles
5571 module isn't working on my system. So I made a tar version
5577 module isn't working on my system. So I made a tar version
5572 (hopefully the command line options in various systems won't kill
5578 (hopefully the command line options in various systems won't kill
5573 me).
5579 me).
5574
5580
5575 * Fixes to Struct in genutils. Now all dictionary-like methods are
5581 * Fixes to Struct in genutils. Now all dictionary-like methods are
5576 protected (reasonably).
5582 protected (reasonably).
5577
5583
5578 * Added pager function to genutils and changed ? to print usage
5584 * Added pager function to genutils and changed ? to print usage
5579 note through it (it was too long).
5585 note through it (it was too long).
5580
5586
5581 * Added the LazyPython functionality. Works great! I changed the
5587 * Added the LazyPython functionality. Works great! I changed the
5582 auto-quote escape to ';', it's on home row and next to '. But
5588 auto-quote escape to ';', it's on home row and next to '. But
5583 both auto-quote and auto-paren (still /) escapes are command-line
5589 both auto-quote and auto-paren (still /) escapes are command-line
5584 parameters.
5590 parameters.
5585
5591
5586
5592
5587 2001-11-01 Fernando Perez <fperez@colorado.edu>
5593 2001-11-01 Fernando Perez <fperez@colorado.edu>
5588
5594
5589 * Version changed to 0.0.7. Fairly large change: configuration now
5595 * Version changed to 0.0.7. Fairly large change: configuration now
5590 is all stored in a directory, by default .ipython. There, all
5596 is all stored in a directory, by default .ipython. There, all
5591 config files have normal looking names (not .names)
5597 config files have normal looking names (not .names)
5592
5598
5593 * Version 0.0.6 Released first to Lucas and Archie as a test
5599 * Version 0.0.6 Released first to Lucas and Archie as a test
5594 run. Since it's the first 'semi-public' release, change version to
5600 run. Since it's the first 'semi-public' release, change version to
5595 > 0.0.6 for any changes now.
5601 > 0.0.6 for any changes now.
5596
5602
5597 * Stuff I had put in the ipplib.py changelog:
5603 * Stuff I had put in the ipplib.py changelog:
5598
5604
5599 Changes to InteractiveShell:
5605 Changes to InteractiveShell:
5600
5606
5601 - Made the usage message a parameter.
5607 - Made the usage message a parameter.
5602
5608
5603 - Require the name of the shell variable to be given. It's a bit
5609 - Require the name of the shell variable to be given. It's a bit
5604 of a hack, but allows the name 'shell' not to be hardwired in the
5610 of a hack, but allows the name 'shell' not to be hardwired in the
5605 magic (@) handler, which is problematic b/c it requires
5611 magic (@) handler, which is problematic b/c it requires
5606 polluting the global namespace with 'shell'. This in turn is
5612 polluting the global namespace with 'shell'. This in turn is
5607 fragile: if a user redefines a variable called shell, things
5613 fragile: if a user redefines a variable called shell, things
5608 break.
5614 break.
5609
5615
5610 - magic @: all functions available through @ need to be defined
5616 - magic @: all functions available through @ need to be defined
5611 as magic_<name>, even though they can be called simply as
5617 as magic_<name>, even though they can be called simply as
5612 @<name>. This allows the special command @magic to gather
5618 @<name>. This allows the special command @magic to gather
5613 information automatically about all existing magic functions,
5619 information automatically about all existing magic functions,
5614 even if they are run-time user extensions, by parsing the shell
5620 even if they are run-time user extensions, by parsing the shell
5615 instance __dict__ looking for special magic_ names.
5621 instance __dict__ looking for special magic_ names.
5616
5622
5617 - mainloop: added *two* local namespace parameters. This allows
5623 - mainloop: added *two* local namespace parameters. This allows
5618 the class to differentiate between parameters which were there
5624 the class to differentiate between parameters which were there
5619 before and after command line initialization was processed. This
5625 before and after command line initialization was processed. This
5620 way, later @who can show things loaded at startup by the
5626 way, later @who can show things loaded at startup by the
5621 user. This trick was necessary to make session saving/reloading
5627 user. This trick was necessary to make session saving/reloading
5622 really work: ideally after saving/exiting/reloading a session,
5628 really work: ideally after saving/exiting/reloading a session,
5623 *everything* should look the same, including the output of @who. I
5629 *everything* should look the same, including the output of @who. I
5624 was only able to make this work with this double namespace
5630 was only able to make this work with this double namespace
5625 trick.
5631 trick.
5626
5632
5627 - added a header to the logfile which allows (almost) full
5633 - added a header to the logfile which allows (almost) full
5628 session restoring.
5634 session restoring.
5629
5635
5630 - prepend lines beginning with @ or !, with a and log
5636 - prepend lines beginning with @ or !, with a and log
5631 them. Why? !lines: may be useful to know what you did @lines:
5637 them. Why? !lines: may be useful to know what you did @lines:
5632 they may affect session state. So when restoring a session, at
5638 they may affect session state. So when restoring a session, at
5633 least inform the user of their presence. I couldn't quite get
5639 least inform the user of their presence. I couldn't quite get
5634 them to properly re-execute, but at least the user is warned.
5640 them to properly re-execute, but at least the user is warned.
5635
5641
5636 * Started ChangeLog.
5642 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now