##// END OF EJS Templates
%whos abbreviates typename of Macro
vivainio -
Show More
@@ -1,3027 +1,3036 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 1934 2006-11-26 20:37:01Z vivainio $"""
4 $Id: Magic.py 1941 2006-11-26 22:24:43Z 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 sys
29 import sys
30 import re
30 import re
31 import tempfile
31 import tempfile
32 import time
32 import time
33 import cPickle as pickle
33 import cPickle as pickle
34 import textwrap
34 import textwrap
35 from cStringIO import StringIO
35 from cStringIO import StringIO
36 from getopt import getopt,GetoptError
36 from getopt import getopt,GetoptError
37 from pprint import pprint, pformat
37 from pprint import pprint, pformat
38
38
39 # cProfile was added in Python2.5
39 # cProfile was added in Python2.5
40 try:
40 try:
41 import cProfile as profile
41 import cProfile as profile
42 import pstats
42 import pstats
43 except ImportError:
43 except ImportError:
44 # profile isn't bundled by default in Debian for license reasons
44 # profile isn't bundled by default in Debian for license reasons
45 try:
45 try:
46 import profile,pstats
46 import profile,pstats
47 except ImportError:
47 except ImportError:
48 profile = pstats = None
48 profile = pstats = None
49
49
50 # Homebrewed
50 # Homebrewed
51 import IPython
51 import IPython
52 from IPython import Debugger, OInspect, wildcard
52 from IPython import Debugger, OInspect, wildcard
53 from IPython.FakeModule import FakeModule
53 from IPython.FakeModule import FakeModule
54 from IPython.Itpl import Itpl, itpl, printpl,itplns
54 from IPython.Itpl import Itpl, itpl, printpl,itplns
55 from IPython.PyColorize import Parser
55 from IPython.PyColorize import Parser
56 from IPython.ipstruct import Struct
56 from IPython.ipstruct import Struct
57 from IPython.macro import Macro
57 from IPython.macro import Macro
58 from IPython.genutils import *
58 from IPython.genutils import *
59 from IPython import platutils
59 from IPython import platutils
60
60
61 #***************************************************************************
61 #***************************************************************************
62 # Utility functions
62 # Utility functions
63 def on_off(tag):
63 def on_off(tag):
64 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
64 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
65 return ['OFF','ON'][tag]
65 return ['OFF','ON'][tag]
66
66
67 class Bunch: pass
67 class Bunch: pass
68
68
69 #***************************************************************************
69 #***************************************************************************
70 # Main class implementing Magic functionality
70 # Main class implementing Magic functionality
71 class Magic:
71 class Magic:
72 """Magic functions for InteractiveShell.
72 """Magic functions for InteractiveShell.
73
73
74 Shell functions which can be reached as %function_name. All magic
74 Shell functions which can be reached as %function_name. All magic
75 functions should accept a string, which they can parse for their own
75 functions should accept a string, which they can parse for their own
76 needs. This can make some functions easier to type, eg `%cd ../`
76 needs. This can make some functions easier to type, eg `%cd ../`
77 vs. `%cd("../")`
77 vs. `%cd("../")`
78
78
79 ALL definitions MUST begin with the prefix magic_. The user won't need it
79 ALL definitions MUST begin with the prefix magic_. The user won't need it
80 at the command line, but it is is needed in the definition. """
80 at the command line, but it is is needed in the definition. """
81
81
82 # class globals
82 # class globals
83 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
83 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
84 'Automagic is ON, % prefix NOT needed for magic functions.']
84 'Automagic is ON, % prefix NOT needed for magic functions.']
85
85
86 #......................................................................
86 #......................................................................
87 # some utility functions
87 # some utility functions
88
88
89 def __init__(self,shell):
89 def __init__(self,shell):
90
90
91 self.options_table = {}
91 self.options_table = {}
92 if profile is None:
92 if profile is None:
93 self.magic_prun = self.profile_missing_notice
93 self.magic_prun = self.profile_missing_notice
94 self.shell = shell
94 self.shell = shell
95
95
96 # namespace for holding state we may need
96 # namespace for holding state we may need
97 self._magic_state = Bunch()
97 self._magic_state = Bunch()
98
98
99 def profile_missing_notice(self, *args, **kwargs):
99 def profile_missing_notice(self, *args, **kwargs):
100 error("""\
100 error("""\
101 The profile module could not be found. If you are a Debian user,
101 The profile module could not be found. If you are a Debian user,
102 it has been removed from the standard Debian package because of its non-free
102 it has been removed from the standard Debian package because of its non-free
103 license. To use profiling, please install"python2.3-profiler" from non-free.""")
103 license. To use profiling, please install"python2.3-profiler" from non-free.""")
104
104
105 def default_option(self,fn,optstr):
105 def default_option(self,fn,optstr):
106 """Make an entry in the options_table for fn, with value optstr"""
106 """Make an entry in the options_table for fn, with value optstr"""
107
107
108 if fn not in self.lsmagic():
108 if fn not in self.lsmagic():
109 error("%s is not a magic function" % fn)
109 error("%s is not a magic function" % fn)
110 self.options_table[fn] = optstr
110 self.options_table[fn] = optstr
111
111
112 def lsmagic(self):
112 def lsmagic(self):
113 """Return a list of currently available magic functions.
113 """Return a list of currently available magic functions.
114
114
115 Gives a list of the bare names after mangling (['ls','cd', ...], not
115 Gives a list of the bare names after mangling (['ls','cd', ...], not
116 ['magic_ls','magic_cd',...]"""
116 ['magic_ls','magic_cd',...]"""
117
117
118 # FIXME. This needs a cleanup, in the way the magics list is built.
118 # FIXME. This needs a cleanup, in the way the magics list is built.
119
119
120 # magics in class definition
120 # magics in class definition
121 class_magic = lambda fn: fn.startswith('magic_') and \
121 class_magic = lambda fn: fn.startswith('magic_') and \
122 callable(Magic.__dict__[fn])
122 callable(Magic.__dict__[fn])
123 # in instance namespace (run-time user additions)
123 # in instance namespace (run-time user additions)
124 inst_magic = lambda fn: fn.startswith('magic_') and \
124 inst_magic = lambda fn: fn.startswith('magic_') and \
125 callable(self.__dict__[fn])
125 callable(self.__dict__[fn])
126 # and bound magics by user (so they can access self):
126 # and bound magics by user (so they can access self):
127 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
127 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
128 callable(self.__class__.__dict__[fn])
128 callable(self.__class__.__dict__[fn])
129 magics = filter(class_magic,Magic.__dict__.keys()) + \
129 magics = filter(class_magic,Magic.__dict__.keys()) + \
130 filter(inst_magic,self.__dict__.keys()) + \
130 filter(inst_magic,self.__dict__.keys()) + \
131 filter(inst_bound_magic,self.__class__.__dict__.keys())
131 filter(inst_bound_magic,self.__class__.__dict__.keys())
132 out = []
132 out = []
133 for fn in magics:
133 for fn in magics:
134 out.append(fn.replace('magic_','',1))
134 out.append(fn.replace('magic_','',1))
135 out.sort()
135 out.sort()
136 return out
136 return out
137
137
138 def extract_input_slices(self,slices,raw=False):
138 def extract_input_slices(self,slices,raw=False):
139 """Return as a string a set of input history slices.
139 """Return as a string a set of input history slices.
140
140
141 Inputs:
141 Inputs:
142
142
143 - slices: the set of slices is given as a list of strings (like
143 - slices: the set of slices is given as a list of strings (like
144 ['1','4:8','9'], since this function is for use by magic functions
144 ['1','4:8','9'], since this function is for use by magic functions
145 which get their arguments as strings.
145 which get their arguments as strings.
146
146
147 Optional inputs:
147 Optional inputs:
148
148
149 - raw(False): by default, the processed input is used. If this is
149 - raw(False): by default, the processed input is used. If this is
150 true, the raw input history is used instead.
150 true, the raw input history is used instead.
151
151
152 Note that slices can be called with two notations:
152 Note that slices can be called with two notations:
153
153
154 N:M -> standard python form, means including items N...(M-1).
154 N:M -> standard python form, means including items N...(M-1).
155
155
156 N-M -> include items N..M (closed endpoint)."""
156 N-M -> include items N..M (closed endpoint)."""
157
157
158 if raw:
158 if raw:
159 hist = self.shell.input_hist_raw
159 hist = self.shell.input_hist_raw
160 else:
160 else:
161 hist = self.shell.input_hist
161 hist = self.shell.input_hist
162
162
163 cmds = []
163 cmds = []
164 for chunk in slices:
164 for chunk in slices:
165 if ':' in chunk:
165 if ':' in chunk:
166 ini,fin = map(int,chunk.split(':'))
166 ini,fin = map(int,chunk.split(':'))
167 elif '-' in chunk:
167 elif '-' in chunk:
168 ini,fin = map(int,chunk.split('-'))
168 ini,fin = map(int,chunk.split('-'))
169 fin += 1
169 fin += 1
170 else:
170 else:
171 ini = int(chunk)
171 ini = int(chunk)
172 fin = ini+1
172 fin = ini+1
173 cmds.append(hist[ini:fin])
173 cmds.append(hist[ini:fin])
174 return cmds
174 return cmds
175
175
176 def _ofind(self, oname, namespaces=None):
176 def _ofind(self, oname, namespaces=None):
177 """Find an object in the available namespaces.
177 """Find an object in the available namespaces.
178
178
179 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
179 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
180
180
181 Has special code to detect magic functions.
181 Has special code to detect magic functions.
182 """
182 """
183
183
184 oname = oname.strip()
184 oname = oname.strip()
185
185
186 alias_ns = None
186 alias_ns = None
187 if namespaces is None:
187 if namespaces is None:
188 # Namespaces to search in:
188 # Namespaces to search in:
189 # Put them in a list. The order is important so that we
189 # Put them in a list. The order is important so that we
190 # find things in the same order that Python finds them.
190 # find things in the same order that Python finds them.
191 namespaces = [ ('Interactive', self.shell.user_ns),
191 namespaces = [ ('Interactive', self.shell.user_ns),
192 ('IPython internal', self.shell.internal_ns),
192 ('IPython internal', self.shell.internal_ns),
193 ('Python builtin', __builtin__.__dict__),
193 ('Python builtin', __builtin__.__dict__),
194 ('Alias', self.shell.alias_table),
194 ('Alias', self.shell.alias_table),
195 ]
195 ]
196 alias_ns = self.shell.alias_table
196 alias_ns = self.shell.alias_table
197
197
198 # initialize results to 'null'
198 # initialize results to 'null'
199 found = 0; obj = None; ospace = None; ds = None;
199 found = 0; obj = None; ospace = None; ds = None;
200 ismagic = 0; isalias = 0; parent = None
200 ismagic = 0; isalias = 0; parent = None
201
201
202 # Look for the given name by splitting it in parts. If the head is
202 # Look for the given name by splitting it in parts. If the head is
203 # found, then we look for all the remaining parts as members, and only
203 # found, then we look for all the remaining parts as members, and only
204 # declare success if we can find them all.
204 # declare success if we can find them all.
205 oname_parts = oname.split('.')
205 oname_parts = oname.split('.')
206 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
206 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
207 for nsname,ns in namespaces:
207 for nsname,ns in namespaces:
208 try:
208 try:
209 obj = ns[oname_head]
209 obj = ns[oname_head]
210 except KeyError:
210 except KeyError:
211 continue
211 continue
212 else:
212 else:
213 for part in oname_rest:
213 for part in oname_rest:
214 try:
214 try:
215 parent = obj
215 parent = obj
216 obj = getattr(obj,part)
216 obj = getattr(obj,part)
217 except:
217 except:
218 # Blanket except b/c some badly implemented objects
218 # Blanket except b/c some badly implemented objects
219 # allow __getattr__ to raise exceptions other than
219 # allow __getattr__ to raise exceptions other than
220 # AttributeError, which then crashes IPython.
220 # AttributeError, which then crashes IPython.
221 break
221 break
222 else:
222 else:
223 # If we finish the for loop (no break), we got all members
223 # If we finish the for loop (no break), we got all members
224 found = 1
224 found = 1
225 ospace = nsname
225 ospace = nsname
226 if ns == alias_ns:
226 if ns == alias_ns:
227 isalias = 1
227 isalias = 1
228 break # namespace loop
228 break # namespace loop
229
229
230 # Try to see if it's magic
230 # Try to see if it's magic
231 if not found:
231 if not found:
232 if oname.startswith(self.shell.ESC_MAGIC):
232 if oname.startswith(self.shell.ESC_MAGIC):
233 oname = oname[1:]
233 oname = oname[1:]
234 obj = getattr(self,'magic_'+oname,None)
234 obj = getattr(self,'magic_'+oname,None)
235 if obj is not None:
235 if obj is not None:
236 found = 1
236 found = 1
237 ospace = 'IPython internal'
237 ospace = 'IPython internal'
238 ismagic = 1
238 ismagic = 1
239
239
240 # Last try: special-case some literals like '', [], {}, etc:
240 # Last try: special-case some literals like '', [], {}, etc:
241 if not found and oname_head in ["''",'""','[]','{}','()']:
241 if not found and oname_head in ["''",'""','[]','{}','()']:
242 obj = eval(oname_head)
242 obj = eval(oname_head)
243 found = 1
243 found = 1
244 ospace = 'Interactive'
244 ospace = 'Interactive'
245
245
246 return {'found':found, 'obj':obj, 'namespace':ospace,
246 return {'found':found, 'obj':obj, 'namespace':ospace,
247 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
247 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
248
248
249 def arg_err(self,func):
249 def arg_err(self,func):
250 """Print docstring if incorrect arguments were passed"""
250 """Print docstring if incorrect arguments were passed"""
251 print 'Error in arguments:'
251 print 'Error in arguments:'
252 print OInspect.getdoc(func)
252 print OInspect.getdoc(func)
253
253
254 def format_latex(self,strng):
254 def format_latex(self,strng):
255 """Format a string for latex inclusion."""
255 """Format a string for latex inclusion."""
256
256
257 # Characters that need to be escaped for latex:
257 # Characters that need to be escaped for latex:
258 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
258 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
259 # Magic command names as headers:
259 # Magic command names as headers:
260 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
260 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
261 re.MULTILINE)
261 re.MULTILINE)
262 # Magic commands
262 # Magic commands
263 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
263 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
264 re.MULTILINE)
264 re.MULTILINE)
265 # Paragraph continue
265 # Paragraph continue
266 par_re = re.compile(r'\\$',re.MULTILINE)
266 par_re = re.compile(r'\\$',re.MULTILINE)
267
267
268 # The "\n" symbol
268 # The "\n" symbol
269 newline_re = re.compile(r'\\n')
269 newline_re = re.compile(r'\\n')
270
270
271 # Now build the string for output:
271 # Now build the string for output:
272 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
272 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
273 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
273 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
274 strng)
274 strng)
275 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
275 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
276 strng = par_re.sub(r'\\\\',strng)
276 strng = par_re.sub(r'\\\\',strng)
277 strng = escape_re.sub(r'\\\1',strng)
277 strng = escape_re.sub(r'\\\1',strng)
278 strng = newline_re.sub(r'\\textbackslash{}n',strng)
278 strng = newline_re.sub(r'\\textbackslash{}n',strng)
279 return strng
279 return strng
280
280
281 def format_screen(self,strng):
281 def format_screen(self,strng):
282 """Format a string for screen printing.
282 """Format a string for screen printing.
283
283
284 This removes some latex-type format codes."""
284 This removes some latex-type format codes."""
285 # Paragraph continue
285 # Paragraph continue
286 par_re = re.compile(r'\\$',re.MULTILINE)
286 par_re = re.compile(r'\\$',re.MULTILINE)
287 strng = par_re.sub('',strng)
287 strng = par_re.sub('',strng)
288 return strng
288 return strng
289
289
290 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
290 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
291 """Parse options passed to an argument string.
291 """Parse options passed to an argument string.
292
292
293 The interface is similar to that of getopt(), but it returns back a
293 The interface is similar to that of getopt(), but it returns back a
294 Struct with the options as keys and the stripped argument string still
294 Struct with the options as keys and the stripped argument string still
295 as a string.
295 as a string.
296
296
297 arg_str is quoted as a true sys.argv vector by using shlex.split.
297 arg_str is quoted as a true sys.argv vector by using shlex.split.
298 This allows us to easily expand variables, glob files, quote
298 This allows us to easily expand variables, glob files, quote
299 arguments, etc.
299 arguments, etc.
300
300
301 Options:
301 Options:
302 -mode: default 'string'. If given as 'list', the argument string is
302 -mode: default 'string'. If given as 'list', the argument string is
303 returned as a list (split on whitespace) instead of a string.
303 returned as a list (split on whitespace) instead of a string.
304
304
305 -list_all: put all option values in lists. Normally only options
305 -list_all: put all option values in lists. Normally only options
306 appearing more than once are put in a list.
306 appearing more than once are put in a list.
307
307
308 -posix (True): whether to split the input line in POSIX mode or not,
308 -posix (True): whether to split the input line in POSIX mode or not,
309 as per the conventions outlined in the shlex module from the
309 as per the conventions outlined in the shlex module from the
310 standard library."""
310 standard library."""
311
311
312 # inject default options at the beginning of the input line
312 # inject default options at the beginning of the input line
313 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
313 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
314 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
314 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
315
315
316 mode = kw.get('mode','string')
316 mode = kw.get('mode','string')
317 if mode not in ['string','list']:
317 if mode not in ['string','list']:
318 raise ValueError,'incorrect mode given: %s' % mode
318 raise ValueError,'incorrect mode given: %s' % mode
319 # Get options
319 # Get options
320 list_all = kw.get('list_all',0)
320 list_all = kw.get('list_all',0)
321 posix = kw.get('posix',True)
321 posix = kw.get('posix',True)
322
322
323 # Check if we have more than one argument to warrant extra processing:
323 # Check if we have more than one argument to warrant extra processing:
324 odict = {} # Dictionary with options
324 odict = {} # Dictionary with options
325 args = arg_str.split()
325 args = arg_str.split()
326 if len(args) >= 1:
326 if len(args) >= 1:
327 # If the list of inputs only has 0 or 1 thing in it, there's no
327 # If the list of inputs only has 0 or 1 thing in it, there's no
328 # need to look for options
328 # need to look for options
329 argv = arg_split(arg_str,posix)
329 argv = arg_split(arg_str,posix)
330 # Do regular option processing
330 # Do regular option processing
331 try:
331 try:
332 opts,args = getopt(argv,opt_str,*long_opts)
332 opts,args = getopt(argv,opt_str,*long_opts)
333 except GetoptError,e:
333 except GetoptError,e:
334 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
334 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
335 " ".join(long_opts)))
335 " ".join(long_opts)))
336 for o,a in opts:
336 for o,a in opts:
337 if o.startswith('--'):
337 if o.startswith('--'):
338 o = o[2:]
338 o = o[2:]
339 else:
339 else:
340 o = o[1:]
340 o = o[1:]
341 try:
341 try:
342 odict[o].append(a)
342 odict[o].append(a)
343 except AttributeError:
343 except AttributeError:
344 odict[o] = [odict[o],a]
344 odict[o] = [odict[o],a]
345 except KeyError:
345 except KeyError:
346 if list_all:
346 if list_all:
347 odict[o] = [a]
347 odict[o] = [a]
348 else:
348 else:
349 odict[o] = a
349 odict[o] = a
350
350
351 # Prepare opts,args for return
351 # Prepare opts,args for return
352 opts = Struct(odict)
352 opts = Struct(odict)
353 if mode == 'string':
353 if mode == 'string':
354 args = ' '.join(args)
354 args = ' '.join(args)
355
355
356 return opts,args
356 return opts,args
357
357
358 #......................................................................
358 #......................................................................
359 # And now the actual magic functions
359 # And now the actual magic functions
360
360
361 # Functions for IPython shell work (vars,funcs, config, etc)
361 # Functions for IPython shell work (vars,funcs, config, etc)
362 def magic_lsmagic(self, parameter_s = ''):
362 def magic_lsmagic(self, parameter_s = ''):
363 """List currently available magic functions."""
363 """List currently available magic functions."""
364 mesc = self.shell.ESC_MAGIC
364 mesc = self.shell.ESC_MAGIC
365 print 'Available magic functions:\n'+mesc+\
365 print 'Available magic functions:\n'+mesc+\
366 (' '+mesc).join(self.lsmagic())
366 (' '+mesc).join(self.lsmagic())
367 print '\n' + Magic.auto_status[self.shell.rc.automagic]
367 print '\n' + Magic.auto_status[self.shell.rc.automagic]
368 return None
368 return None
369
369
370 def magic_magic(self, parameter_s = ''):
370 def magic_magic(self, parameter_s = ''):
371 """Print information about the magic function system."""
371 """Print information about the magic function system."""
372
372
373 mode = ''
373 mode = ''
374 try:
374 try:
375 if parameter_s.split()[0] == '-latex':
375 if parameter_s.split()[0] == '-latex':
376 mode = 'latex'
376 mode = 'latex'
377 if parameter_s.split()[0] == '-brief':
377 if parameter_s.split()[0] == '-brief':
378 mode = 'brief'
378 mode = 'brief'
379 except:
379 except:
380 pass
380 pass
381
381
382 magic_docs = []
382 magic_docs = []
383 for fname in self.lsmagic():
383 for fname in self.lsmagic():
384 mname = 'magic_' + fname
384 mname = 'magic_' + fname
385 for space in (Magic,self,self.__class__):
385 for space in (Magic,self,self.__class__):
386 try:
386 try:
387 fn = space.__dict__[mname]
387 fn = space.__dict__[mname]
388 except KeyError:
388 except KeyError:
389 pass
389 pass
390 else:
390 else:
391 break
391 break
392 if mode == 'brief':
392 if mode == 'brief':
393 # only first line
393 # only first line
394 fndoc = fn.__doc__.split('\n',1)[0]
394 fndoc = fn.__doc__.split('\n',1)[0]
395 else:
395 else:
396 fndoc = fn.__doc__
396 fndoc = fn.__doc__
397
397
398 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
398 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
399 fname,fndoc))
399 fname,fndoc))
400 magic_docs = ''.join(magic_docs)
400 magic_docs = ''.join(magic_docs)
401
401
402 if mode == 'latex':
402 if mode == 'latex':
403 print self.format_latex(magic_docs)
403 print self.format_latex(magic_docs)
404 return
404 return
405 else:
405 else:
406 magic_docs = self.format_screen(magic_docs)
406 magic_docs = self.format_screen(magic_docs)
407 if mode == 'brief':
407 if mode == 'brief':
408 return magic_docs
408 return magic_docs
409
409
410 outmsg = """
410 outmsg = """
411 IPython's 'magic' functions
411 IPython's 'magic' functions
412 ===========================
412 ===========================
413
413
414 The magic function system provides a series of functions which allow you to
414 The magic function system provides a series of functions which allow you to
415 control the behavior of IPython itself, plus a lot of system-type
415 control the behavior of IPython itself, plus a lot of system-type
416 features. All these functions are prefixed with a % character, but parameters
416 features. All these functions are prefixed with a % character, but parameters
417 are given without parentheses or quotes.
417 are given without parentheses or quotes.
418
418
419 NOTE: If you have 'automagic' enabled (via the command line option or with the
419 NOTE: If you have 'automagic' enabled (via the command line option or with the
420 %automagic function), you don't need to type in the % explicitly. By default,
420 %automagic function), you don't need to type in the % explicitly. By default,
421 IPython ships with automagic on, so you should only rarely need the % escape.
421 IPython ships with automagic on, so you should only rarely need the % escape.
422
422
423 Example: typing '%cd mydir' (without the quotes) changes you working directory
423 Example: typing '%cd mydir' (without the quotes) changes you working directory
424 to 'mydir', if it exists.
424 to 'mydir', if it exists.
425
425
426 You can define your own magic functions to extend the system. See the supplied
426 You can define your own magic functions to extend the system. See the supplied
427 ipythonrc and example-magic.py files for details (in your ipython
427 ipythonrc and example-magic.py files for details (in your ipython
428 configuration directory, typically $HOME/.ipython/).
428 configuration directory, typically $HOME/.ipython/).
429
429
430 You can also define your own aliased names for magic functions. In your
430 You can also define your own aliased names for magic functions. In your
431 ipythonrc file, placing a line like:
431 ipythonrc file, placing a line like:
432
432
433 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
433 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
434
434
435 will define %pf as a new name for %profile.
435 will define %pf as a new name for %profile.
436
436
437 You can also call magics in code using the ipmagic() function, which IPython
437 You can also call magics in code using the ipmagic() function, which IPython
438 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
438 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
439
439
440 For a list of the available magic functions, use %lsmagic. For a description
440 For a list of the available magic functions, use %lsmagic. For a description
441 of any of them, type %magic_name?, e.g. '%cd?'.
441 of any of them, type %magic_name?, e.g. '%cd?'.
442
442
443 Currently the magic system has the following functions:\n"""
443 Currently the magic system has the following functions:\n"""
444
444
445 mesc = self.shell.ESC_MAGIC
445 mesc = self.shell.ESC_MAGIC
446 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
446 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
447 "\n\n%s%s\n\n%s" % (outmsg,
447 "\n\n%s%s\n\n%s" % (outmsg,
448 magic_docs,mesc,mesc,
448 magic_docs,mesc,mesc,
449 (' '+mesc).join(self.lsmagic()),
449 (' '+mesc).join(self.lsmagic()),
450 Magic.auto_status[self.shell.rc.automagic] ) )
450 Magic.auto_status[self.shell.rc.automagic] ) )
451
451
452 page(outmsg,screen_lines=self.shell.rc.screen_length)
452 page(outmsg,screen_lines=self.shell.rc.screen_length)
453
453
454 def magic_automagic(self, parameter_s = ''):
454 def magic_automagic(self, parameter_s = ''):
455 """Make magic functions callable without having to type the initial %.
455 """Make magic functions callable without having to type the initial %.
456
456
457 Toggles on/off (when off, you must call it as %automagic, of
457 Toggles on/off (when off, you must call it as %automagic, of
458 course). Note that magic functions have lowest priority, so if there's
458 course). Note that magic functions have lowest priority, so if there's
459 a variable whose name collides with that of a magic fn, automagic
459 a variable whose name collides with that of a magic fn, automagic
460 won't work for that function (you get the variable instead). However,
460 won't work for that function (you get the variable instead). However,
461 if you delete the variable (del var), the previously shadowed magic
461 if you delete the variable (del var), the previously shadowed magic
462 function becomes visible to automagic again."""
462 function becomes visible to automagic again."""
463
463
464 rc = self.shell.rc
464 rc = self.shell.rc
465 rc.automagic = not rc.automagic
465 rc.automagic = not rc.automagic
466 print '\n' + Magic.auto_status[rc.automagic]
466 print '\n' + Magic.auto_status[rc.automagic]
467
467
468 def magic_autocall(self, parameter_s = ''):
468 def magic_autocall(self, parameter_s = ''):
469 """Make functions callable without having to type parentheses.
469 """Make functions callable without having to type parentheses.
470
470
471 Usage:
471 Usage:
472
472
473 %autocall [mode]
473 %autocall [mode]
474
474
475 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
475 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
476 value is toggled on and off (remembering the previous state)."""
476 value is toggled on and off (remembering the previous state)."""
477
477
478 rc = self.shell.rc
478 rc = self.shell.rc
479
479
480 if parameter_s:
480 if parameter_s:
481 arg = int(parameter_s)
481 arg = int(parameter_s)
482 else:
482 else:
483 arg = 'toggle'
483 arg = 'toggle'
484
484
485 if not arg in (0,1,2,'toggle'):
485 if not arg in (0,1,2,'toggle'):
486 error('Valid modes: (0->Off, 1->Smart, 2->Full')
486 error('Valid modes: (0->Off, 1->Smart, 2->Full')
487 return
487 return
488
488
489 if arg in (0,1,2):
489 if arg in (0,1,2):
490 rc.autocall = arg
490 rc.autocall = arg
491 else: # toggle
491 else: # toggle
492 if rc.autocall:
492 if rc.autocall:
493 self._magic_state.autocall_save = rc.autocall
493 self._magic_state.autocall_save = rc.autocall
494 rc.autocall = 0
494 rc.autocall = 0
495 else:
495 else:
496 try:
496 try:
497 rc.autocall = self._magic_state.autocall_save
497 rc.autocall = self._magic_state.autocall_save
498 except AttributeError:
498 except AttributeError:
499 rc.autocall = self._magic_state.autocall_save = 1
499 rc.autocall = self._magic_state.autocall_save = 1
500
500
501 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
501 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
502
502
503 def magic_autoindent(self, parameter_s = ''):
503 def magic_autoindent(self, parameter_s = ''):
504 """Toggle autoindent on/off (if available)."""
504 """Toggle autoindent on/off (if available)."""
505
505
506 self.shell.set_autoindent()
506 self.shell.set_autoindent()
507 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
507 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
508
508
509 def magic_system_verbose(self, parameter_s = ''):
509 def magic_system_verbose(self, parameter_s = ''):
510 """Set verbose printing of system calls.
510 """Set verbose printing of system calls.
511
511
512 If called without an argument, act as a toggle"""
512 If called without an argument, act as a toggle"""
513
513
514 if parameter_s:
514 if parameter_s:
515 val = bool(eval(parameter_s))
515 val = bool(eval(parameter_s))
516 else:
516 else:
517 val = None
517 val = None
518
518
519 self.shell.rc_set_toggle('system_verbose',val)
519 self.shell.rc_set_toggle('system_verbose',val)
520 print "System verbose printing is:",\
520 print "System verbose printing is:",\
521 ['OFF','ON'][self.shell.rc.system_verbose]
521 ['OFF','ON'][self.shell.rc.system_verbose]
522
522
523 def magic_history(self, parameter_s = ''):
523 def magic_history(self, parameter_s = ''):
524 """Print input history (_i<n> variables), with most recent last.
524 """Print input history (_i<n> variables), with most recent last.
525
525
526 %history -> print at most 40 inputs (some may be multi-line)\\
526 %history -> print at most 40 inputs (some may be multi-line)\\
527 %history n -> print at most n inputs\\
527 %history n -> print at most n inputs\\
528 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
528 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
529
529
530 Each input's number <n> is shown, and is accessible as the
530 Each input's number <n> is shown, and is accessible as the
531 automatically generated variable _i<n>. Multi-line statements are
531 automatically generated variable _i<n>. Multi-line statements are
532 printed starting at a new line for easy copy/paste.
532 printed starting at a new line for easy copy/paste.
533
533
534
534
535 Options:
535 Options:
536
536
537 -n: do NOT print line numbers. This is useful if you want to get a
537 -n: do NOT print line numbers. This is useful if you want to get a
538 printout of many lines which can be directly pasted into a text
538 printout of many lines which can be directly pasted into a text
539 editor.
539 editor.
540
540
541 This feature is only available if numbered prompts are in use.
541 This feature is only available if numbered prompts are in use.
542
542
543 -r: print the 'raw' history. IPython filters your input and
543 -r: print the 'raw' history. IPython filters your input and
544 converts it all into valid Python source before executing it (things
544 converts it all into valid Python source before executing it (things
545 like magics or aliases are turned into function calls, for
545 like magics or aliases are turned into function calls, for
546 example). With this option, you'll see the unfiltered history
546 example). With this option, you'll see the unfiltered history
547 instead of the filtered version: '%cd /' will be seen as '%cd /'
547 instead of the filtered version: '%cd /' will be seen as '%cd /'
548 instead of '_ip.magic("%cd /")'.
548 instead of '_ip.magic("%cd /")'.
549 """
549 """
550
550
551 shell = self.shell
551 shell = self.shell
552 if not shell.outputcache.do_full_cache:
552 if not shell.outputcache.do_full_cache:
553 print 'This feature is only available if numbered prompts are in use.'
553 print 'This feature is only available if numbered prompts are in use.'
554 return
554 return
555 opts,args = self.parse_options(parameter_s,'nr',mode='list')
555 opts,args = self.parse_options(parameter_s,'nr',mode='list')
556
556
557 if opts.has_key('r'):
557 if opts.has_key('r'):
558 input_hist = shell.input_hist_raw
558 input_hist = shell.input_hist_raw
559 else:
559 else:
560 input_hist = shell.input_hist
560 input_hist = shell.input_hist
561
561
562 default_length = 40
562 default_length = 40
563 if len(args) == 0:
563 if len(args) == 0:
564 final = len(input_hist)
564 final = len(input_hist)
565 init = max(1,final-default_length)
565 init = max(1,final-default_length)
566 elif len(args) == 1:
566 elif len(args) == 1:
567 final = len(input_hist)
567 final = len(input_hist)
568 init = max(1,final-int(args[0]))
568 init = max(1,final-int(args[0]))
569 elif len(args) == 2:
569 elif len(args) == 2:
570 init,final = map(int,args)
570 init,final = map(int,args)
571 else:
571 else:
572 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
572 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
573 print self.magic_hist.__doc__
573 print self.magic_hist.__doc__
574 return
574 return
575 width = len(str(final))
575 width = len(str(final))
576 line_sep = ['','\n']
576 line_sep = ['','\n']
577 print_nums = not opts.has_key('n')
577 print_nums = not opts.has_key('n')
578 for in_num in range(init,final):
578 for in_num in range(init,final):
579 inline = input_hist[in_num]
579 inline = input_hist[in_num]
580 multiline = int(inline.count('\n') > 1)
580 multiline = int(inline.count('\n') > 1)
581 if print_nums:
581 if print_nums:
582 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
582 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
583 print inline,
583 print inline,
584
584
585 def magic_hist(self, parameter_s=''):
585 def magic_hist(self, parameter_s=''):
586 """Alternate name for %history."""
586 """Alternate name for %history."""
587 return self.magic_history(parameter_s)
587 return self.magic_history(parameter_s)
588
588
589 def magic_p(self, parameter_s=''):
589 def magic_p(self, parameter_s=''):
590 """Just a short alias for Python's 'print'."""
590 """Just a short alias for Python's 'print'."""
591 exec 'print ' + parameter_s in self.shell.user_ns
591 exec 'print ' + parameter_s in self.shell.user_ns
592
592
593 def magic_r(self, parameter_s=''):
593 def magic_r(self, parameter_s=''):
594 """Repeat previous input.
594 """Repeat previous input.
595
595
596 If given an argument, repeats the previous command which starts with
596 If given an argument, repeats the previous command which starts with
597 the same string, otherwise it just repeats the previous input.
597 the same string, otherwise it just repeats the previous input.
598
598
599 Shell escaped commands (with ! as first character) are not recognized
599 Shell escaped commands (with ! as first character) are not recognized
600 by this system, only pure python code and magic commands.
600 by this system, only pure python code and magic commands.
601 """
601 """
602
602
603 start = parameter_s.strip()
603 start = parameter_s.strip()
604 esc_magic = self.shell.ESC_MAGIC
604 esc_magic = self.shell.ESC_MAGIC
605 # Identify magic commands even if automagic is on (which means
605 # Identify magic commands even if automagic is on (which means
606 # the in-memory version is different from that typed by the user).
606 # the in-memory version is different from that typed by the user).
607 if self.shell.rc.automagic:
607 if self.shell.rc.automagic:
608 start_magic = esc_magic+start
608 start_magic = esc_magic+start
609 else:
609 else:
610 start_magic = start
610 start_magic = start
611 # Look through the input history in reverse
611 # Look through the input history in reverse
612 for n in range(len(self.shell.input_hist)-2,0,-1):
612 for n in range(len(self.shell.input_hist)-2,0,-1):
613 input = self.shell.input_hist[n]
613 input = self.shell.input_hist[n]
614 # skip plain 'r' lines so we don't recurse to infinity
614 # skip plain 'r' lines so we don't recurse to infinity
615 if input != '_ip.magic("r")\n' and \
615 if input != '_ip.magic("r")\n' and \
616 (input.startswith(start) or input.startswith(start_magic)):
616 (input.startswith(start) or input.startswith(start_magic)):
617 #print 'match',`input` # dbg
617 #print 'match',`input` # dbg
618 print 'Executing:',input,
618 print 'Executing:',input,
619 self.shell.runlines(input)
619 self.shell.runlines(input)
620 return
620 return
621 print 'No previous input matching `%s` found.' % start
621 print 'No previous input matching `%s` found.' % start
622
622
623 def magic_page(self, parameter_s=''):
623 def magic_page(self, parameter_s=''):
624 """Pretty print the object and display it through a pager.
624 """Pretty print the object and display it through a pager.
625
625
626 %page [options] OBJECT
626 %page [options] OBJECT
627
627
628 If no object is given, use _ (last output).
628 If no object is given, use _ (last output).
629
629
630 Options:
630 Options:
631
631
632 -r: page str(object), don't pretty-print it."""
632 -r: page str(object), don't pretty-print it."""
633
633
634 # After a function contributed by Olivier Aubert, slightly modified.
634 # After a function contributed by Olivier Aubert, slightly modified.
635
635
636 # Process options/args
636 # Process options/args
637 opts,args = self.parse_options(parameter_s,'r')
637 opts,args = self.parse_options(parameter_s,'r')
638 raw = 'r' in opts
638 raw = 'r' in opts
639
639
640 oname = args and args or '_'
640 oname = args and args or '_'
641 info = self._ofind(oname)
641 info = self._ofind(oname)
642 if info['found']:
642 if info['found']:
643 txt = (raw and str or pformat)( info['obj'] )
643 txt = (raw and str or pformat)( info['obj'] )
644 page(txt)
644 page(txt)
645 else:
645 else:
646 print 'Object `%s` not found' % oname
646 print 'Object `%s` not found' % oname
647
647
648 def magic_profile(self, parameter_s=''):
648 def magic_profile(self, parameter_s=''):
649 """Print your currently active IPyhton profile."""
649 """Print your currently active IPyhton profile."""
650 if self.shell.rc.profile:
650 if self.shell.rc.profile:
651 printpl('Current IPython profile: $self.shell.rc.profile.')
651 printpl('Current IPython profile: $self.shell.rc.profile.')
652 else:
652 else:
653 print 'No profile active.'
653 print 'No profile active.'
654
654
655 def _inspect(self,meth,oname,namespaces=None,**kw):
655 def _inspect(self,meth,oname,namespaces=None,**kw):
656 """Generic interface to the inspector system.
656 """Generic interface to the inspector system.
657
657
658 This function is meant to be called by pdef, pdoc & friends."""
658 This function is meant to be called by pdef, pdoc & friends."""
659
659
660 oname = oname.strip()
660 oname = oname.strip()
661 info = Struct(self._ofind(oname, namespaces))
661 info = Struct(self._ofind(oname, namespaces))
662
662
663 if info.found:
663 if info.found:
664 # Get the docstring of the class property if it exists.
664 # Get the docstring of the class property if it exists.
665 path = oname.split('.')
665 path = oname.split('.')
666 root = '.'.join(path[:-1])
666 root = '.'.join(path[:-1])
667 if info.parent is not None:
667 if info.parent is not None:
668 try:
668 try:
669 target = getattr(info.parent, '__class__')
669 target = getattr(info.parent, '__class__')
670 # The object belongs to a class instance.
670 # The object belongs to a class instance.
671 try:
671 try:
672 target = getattr(target, path[-1])
672 target = getattr(target, path[-1])
673 # The class defines the object.
673 # The class defines the object.
674 if isinstance(target, property):
674 if isinstance(target, property):
675 oname = root + '.__class__.' + path[-1]
675 oname = root + '.__class__.' + path[-1]
676 info = Struct(self._ofind(oname))
676 info = Struct(self._ofind(oname))
677 except AttributeError: pass
677 except AttributeError: pass
678 except AttributeError: pass
678 except AttributeError: pass
679
679
680 pmethod = getattr(self.shell.inspector,meth)
680 pmethod = getattr(self.shell.inspector,meth)
681 formatter = info.ismagic and self.format_screen or None
681 formatter = info.ismagic and self.format_screen or None
682 if meth == 'pdoc':
682 if meth == 'pdoc':
683 pmethod(info.obj,oname,formatter)
683 pmethod(info.obj,oname,formatter)
684 elif meth == 'pinfo':
684 elif meth == 'pinfo':
685 pmethod(info.obj,oname,formatter,info,**kw)
685 pmethod(info.obj,oname,formatter,info,**kw)
686 else:
686 else:
687 pmethod(info.obj,oname)
687 pmethod(info.obj,oname)
688 else:
688 else:
689 print 'Object `%s` not found.' % oname
689 print 'Object `%s` not found.' % oname
690 return 'not found' # so callers can take other action
690 return 'not found' # so callers can take other action
691
691
692 def magic_pdef(self, parameter_s='', namespaces=None):
692 def magic_pdef(self, parameter_s='', namespaces=None):
693 """Print the definition header for any callable object.
693 """Print the definition header for any callable object.
694
694
695 If the object is a class, print the constructor information."""
695 If the object is a class, print the constructor information."""
696 print "+++"
696 print "+++"
697 self._inspect('pdef',parameter_s, namespaces)
697 self._inspect('pdef',parameter_s, namespaces)
698
698
699 def magic_pdoc(self, parameter_s='', namespaces=None):
699 def magic_pdoc(self, parameter_s='', namespaces=None):
700 """Print the docstring for an object.
700 """Print the docstring for an object.
701
701
702 If the given object is a class, it will print both the class and the
702 If the given object is a class, it will print both the class and the
703 constructor docstrings."""
703 constructor docstrings."""
704 self._inspect('pdoc',parameter_s, namespaces)
704 self._inspect('pdoc',parameter_s, namespaces)
705
705
706 def magic_psource(self, parameter_s='', namespaces=None):
706 def magic_psource(self, parameter_s='', namespaces=None):
707 """Print (or run through pager) the source code for an object."""
707 """Print (or run through pager) the source code for an object."""
708 self._inspect('psource',parameter_s, namespaces)
708 self._inspect('psource',parameter_s, namespaces)
709
709
710 def magic_pfile(self, parameter_s=''):
710 def magic_pfile(self, parameter_s=''):
711 """Print (or run through pager) the file where an object is defined.
711 """Print (or run through pager) the file where an object is defined.
712
712
713 The file opens at the line where the object definition begins. IPython
713 The file opens at the line where the object definition begins. IPython
714 will honor the environment variable PAGER if set, and otherwise will
714 will honor the environment variable PAGER if set, and otherwise will
715 do its best to print the file in a convenient form.
715 do its best to print the file in a convenient form.
716
716
717 If the given argument is not an object currently defined, IPython will
717 If the given argument is not an object currently defined, IPython will
718 try to interpret it as a filename (automatically adding a .py extension
718 try to interpret it as a filename (automatically adding a .py extension
719 if needed). You can thus use %pfile as a syntax highlighting code
719 if needed). You can thus use %pfile as a syntax highlighting code
720 viewer."""
720 viewer."""
721
721
722 # first interpret argument as an object name
722 # first interpret argument as an object name
723 out = self._inspect('pfile',parameter_s)
723 out = self._inspect('pfile',parameter_s)
724 # if not, try the input as a filename
724 # if not, try the input as a filename
725 if out == 'not found':
725 if out == 'not found':
726 try:
726 try:
727 filename = get_py_filename(parameter_s)
727 filename = get_py_filename(parameter_s)
728 except IOError,msg:
728 except IOError,msg:
729 print msg
729 print msg
730 return
730 return
731 page(self.shell.inspector.format(file(filename).read()))
731 page(self.shell.inspector.format(file(filename).read()))
732
732
733 def magic_pinfo(self, parameter_s='', namespaces=None):
733 def magic_pinfo(self, parameter_s='', namespaces=None):
734 """Provide detailed information about an object.
734 """Provide detailed information about an object.
735
735
736 '%pinfo object' is just a synonym for object? or ?object."""
736 '%pinfo object' is just a synonym for object? or ?object."""
737
737
738 #print 'pinfo par: <%s>' % parameter_s # dbg
738 #print 'pinfo par: <%s>' % parameter_s # dbg
739
739
740 # detail_level: 0 -> obj? , 1 -> obj??
740 # detail_level: 0 -> obj? , 1 -> obj??
741 detail_level = 0
741 detail_level = 0
742 # We need to detect if we got called as 'pinfo pinfo foo', which can
742 # We need to detect if we got called as 'pinfo pinfo foo', which can
743 # happen if the user types 'pinfo foo?' at the cmd line.
743 # happen if the user types 'pinfo foo?' at the cmd line.
744 pinfo,qmark1,oname,qmark2 = \
744 pinfo,qmark1,oname,qmark2 = \
745 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
745 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
746 if pinfo or qmark1 or qmark2:
746 if pinfo or qmark1 or qmark2:
747 detail_level = 1
747 detail_level = 1
748 if "*" in oname:
748 if "*" in oname:
749 self.magic_psearch(oname)
749 self.magic_psearch(oname)
750 else:
750 else:
751 self._inspect('pinfo', oname, detail_level=detail_level,
751 self._inspect('pinfo', oname, detail_level=detail_level,
752 namespaces=namespaces)
752 namespaces=namespaces)
753
753
754 def magic_psearch(self, parameter_s=''):
754 def magic_psearch(self, parameter_s=''):
755 """Search for object in namespaces by wildcard.
755 """Search for object in namespaces by wildcard.
756
756
757 %psearch [options] PATTERN [OBJECT TYPE]
757 %psearch [options] PATTERN [OBJECT TYPE]
758
758
759 Note: ? can be used as a synonym for %psearch, at the beginning or at
759 Note: ? can be used as a synonym for %psearch, at the beginning or at
760 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
760 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
761 rest of the command line must be unchanged (options come first), so
761 rest of the command line must be unchanged (options come first), so
762 for example the following forms are equivalent
762 for example the following forms are equivalent
763
763
764 %psearch -i a* function
764 %psearch -i a* function
765 -i a* function?
765 -i a* function?
766 ?-i a* function
766 ?-i a* function
767
767
768 Arguments:
768 Arguments:
769
769
770 PATTERN
770 PATTERN
771
771
772 where PATTERN is a string containing * as a wildcard similar to its
772 where PATTERN is a string containing * as a wildcard similar to its
773 use in a shell. The pattern is matched in all namespaces on the
773 use in a shell. The pattern is matched in all namespaces on the
774 search path. By default objects starting with a single _ are not
774 search path. By default objects starting with a single _ are not
775 matched, many IPython generated objects have a single
775 matched, many IPython generated objects have a single
776 underscore. The default is case insensitive matching. Matching is
776 underscore. The default is case insensitive matching. Matching is
777 also done on the attributes of objects and not only on the objects
777 also done on the attributes of objects and not only on the objects
778 in a module.
778 in a module.
779
779
780 [OBJECT TYPE]
780 [OBJECT TYPE]
781
781
782 Is the name of a python type from the types module. The name is
782 Is the name of a python type from the types module. The name is
783 given in lowercase without the ending type, ex. StringType is
783 given in lowercase without the ending type, ex. StringType is
784 written string. By adding a type here only objects matching the
784 written string. By adding a type here only objects matching the
785 given type are matched. Using all here makes the pattern match all
785 given type are matched. Using all here makes the pattern match all
786 types (this is the default).
786 types (this is the default).
787
787
788 Options:
788 Options:
789
789
790 -a: makes the pattern match even objects whose names start with a
790 -a: makes the pattern match even objects whose names start with a
791 single underscore. These names are normally ommitted from the
791 single underscore. These names are normally ommitted from the
792 search.
792 search.
793
793
794 -i/-c: make the pattern case insensitive/sensitive. If neither of
794 -i/-c: make the pattern case insensitive/sensitive. If neither of
795 these options is given, the default is read from your ipythonrc
795 these options is given, the default is read from your ipythonrc
796 file. The option name which sets this value is
796 file. The option name which sets this value is
797 'wildcards_case_sensitive'. If this option is not specified in your
797 'wildcards_case_sensitive'. If this option is not specified in your
798 ipythonrc file, IPython's internal default is to do a case sensitive
798 ipythonrc file, IPython's internal default is to do a case sensitive
799 search.
799 search.
800
800
801 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
801 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
802 specifiy can be searched in any of the following namespaces:
802 specifiy can be searched in any of the following namespaces:
803 'builtin', 'user', 'user_global','internal', 'alias', where
803 'builtin', 'user', 'user_global','internal', 'alias', where
804 'builtin' and 'user' are the search defaults. Note that you should
804 'builtin' and 'user' are the search defaults. Note that you should
805 not use quotes when specifying namespaces.
805 not use quotes when specifying namespaces.
806
806
807 'Builtin' contains the python module builtin, 'user' contains all
807 'Builtin' contains the python module builtin, 'user' contains all
808 user data, 'alias' only contain the shell aliases and no python
808 user data, 'alias' only contain the shell aliases and no python
809 objects, 'internal' contains objects used by IPython. The
809 objects, 'internal' contains objects used by IPython. The
810 'user_global' namespace is only used by embedded IPython instances,
810 'user_global' namespace is only used by embedded IPython instances,
811 and it contains module-level globals. You can add namespaces to the
811 and it contains module-level globals. You can add namespaces to the
812 search with -s or exclude them with -e (these options can be given
812 search with -s or exclude them with -e (these options can be given
813 more than once).
813 more than once).
814
814
815 Examples:
815 Examples:
816
816
817 %psearch a* -> objects beginning with an a
817 %psearch a* -> objects beginning with an a
818 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
818 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
819 %psearch a* function -> all functions beginning with an a
819 %psearch a* function -> all functions beginning with an a
820 %psearch re.e* -> objects beginning with an e in module re
820 %psearch re.e* -> objects beginning with an e in module re
821 %psearch r*.e* -> objects that start with e in modules starting in r
821 %psearch r*.e* -> objects that start with e in modules starting in r
822 %psearch r*.* string -> all strings in modules beginning with r
822 %psearch r*.* string -> all strings in modules beginning with r
823
823
824 Case sensitve search:
824 Case sensitve search:
825
825
826 %psearch -c a* list all object beginning with lower case a
826 %psearch -c a* list all object beginning with lower case a
827
827
828 Show objects beginning with a single _:
828 Show objects beginning with a single _:
829
829
830 %psearch -a _* list objects beginning with a single underscore"""
830 %psearch -a _* list objects beginning with a single underscore"""
831
831
832 # default namespaces to be searched
832 # default namespaces to be searched
833 def_search = ['user','builtin']
833 def_search = ['user','builtin']
834
834
835 # Process options/args
835 # Process options/args
836 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
836 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
837 opt = opts.get
837 opt = opts.get
838 shell = self.shell
838 shell = self.shell
839 psearch = shell.inspector.psearch
839 psearch = shell.inspector.psearch
840
840
841 # select case options
841 # select case options
842 if opts.has_key('i'):
842 if opts.has_key('i'):
843 ignore_case = True
843 ignore_case = True
844 elif opts.has_key('c'):
844 elif opts.has_key('c'):
845 ignore_case = False
845 ignore_case = False
846 else:
846 else:
847 ignore_case = not shell.rc.wildcards_case_sensitive
847 ignore_case = not shell.rc.wildcards_case_sensitive
848
848
849 # Build list of namespaces to search from user options
849 # Build list of namespaces to search from user options
850 def_search.extend(opt('s',[]))
850 def_search.extend(opt('s',[]))
851 ns_exclude = ns_exclude=opt('e',[])
851 ns_exclude = ns_exclude=opt('e',[])
852 ns_search = [nm for nm in def_search if nm not in ns_exclude]
852 ns_search = [nm for nm in def_search if nm not in ns_exclude]
853
853
854 # Call the actual search
854 # Call the actual search
855 try:
855 try:
856 psearch(args,shell.ns_table,ns_search,
856 psearch(args,shell.ns_table,ns_search,
857 show_all=opt('a'),ignore_case=ignore_case)
857 show_all=opt('a'),ignore_case=ignore_case)
858 except:
858 except:
859 shell.showtraceback()
859 shell.showtraceback()
860
860
861 def magic_who_ls(self, parameter_s=''):
861 def magic_who_ls(self, parameter_s=''):
862 """Return a sorted list of all interactive variables.
862 """Return a sorted list of all interactive variables.
863
863
864 If arguments are given, only variables of types matching these
864 If arguments are given, only variables of types matching these
865 arguments are returned."""
865 arguments are returned."""
866
866
867 user_ns = self.shell.user_ns
867 user_ns = self.shell.user_ns
868 internal_ns = self.shell.internal_ns
868 internal_ns = self.shell.internal_ns
869 user_config_ns = self.shell.user_config_ns
869 user_config_ns = self.shell.user_config_ns
870 out = []
870 out = []
871 typelist = parameter_s.split()
871 typelist = parameter_s.split()
872
872
873 for i in user_ns:
873 for i in user_ns:
874 if not (i.startswith('_') or i.startswith('_i')) \
874 if not (i.startswith('_') or i.startswith('_i')) \
875 and not (i in internal_ns or i in user_config_ns):
875 and not (i in internal_ns or i in user_config_ns):
876 if typelist:
876 if typelist:
877 if type(user_ns[i]).__name__ in typelist:
877 if type(user_ns[i]).__name__ in typelist:
878 out.append(i)
878 out.append(i)
879 else:
879 else:
880 out.append(i)
880 out.append(i)
881 out.sort()
881 out.sort()
882 return out
882 return out
883
883
884 def magic_who(self, parameter_s=''):
884 def magic_who(self, parameter_s=''):
885 """Print all interactive variables, with some minimal formatting.
885 """Print all interactive variables, with some minimal formatting.
886
886
887 If any arguments are given, only variables whose type matches one of
887 If any arguments are given, only variables whose type matches one of
888 these are printed. For example:
888 these are printed. For example:
889
889
890 %who function str
890 %who function str
891
891
892 will only list functions and strings, excluding all other types of
892 will only list functions and strings, excluding all other types of
893 variables. To find the proper type names, simply use type(var) at a
893 variables. To find the proper type names, simply use type(var) at a
894 command line to see how python prints type names. For example:
894 command line to see how python prints type names. For example:
895
895
896 In [1]: type('hello')\\
896 In [1]: type('hello')\\
897 Out[1]: <type 'str'>
897 Out[1]: <type 'str'>
898
898
899 indicates that the type name for strings is 'str'.
899 indicates that the type name for strings is 'str'.
900
900
901 %who always excludes executed names loaded through your configuration
901 %who always excludes executed names loaded through your configuration
902 file and things which are internal to IPython.
902 file and things which are internal to IPython.
903
903
904 This is deliberate, as typically you may load many modules and the
904 This is deliberate, as typically you may load many modules and the
905 purpose of %who is to show you only what you've manually defined."""
905 purpose of %who is to show you only what you've manually defined."""
906
906
907 varlist = self.magic_who_ls(parameter_s)
907 varlist = self.magic_who_ls(parameter_s)
908 if not varlist:
908 if not varlist:
909 print 'Interactive namespace is empty.'
909 print 'Interactive namespace is empty.'
910 return
910 return
911
911
912 # if we have variables, move on...
912 # if we have variables, move on...
913
913
914 # stupid flushing problem: when prompts have no separators, stdout is
914 # stupid flushing problem: when prompts have no separators, stdout is
915 # getting lost. I'm starting to think this is a python bug. I'm having
915 # getting lost. I'm starting to think this is a python bug. I'm having
916 # to force a flush with a print because even a sys.stdout.flush
916 # to force a flush with a print because even a sys.stdout.flush
917 # doesn't seem to do anything!
917 # doesn't seem to do anything!
918
918
919 count = 0
919 count = 0
920 for i in varlist:
920 for i in varlist:
921 print i+'\t',
921 print i+'\t',
922 count += 1
922 count += 1
923 if count > 8:
923 if count > 8:
924 count = 0
924 count = 0
925 print
925 print
926 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
926 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
927
927
928 print # well, this does force a flush at the expense of an extra \n
928 print # well, this does force a flush at the expense of an extra \n
929
929
930 def magic_whos(self, parameter_s=''):
930 def magic_whos(self, parameter_s=''):
931 """Like %who, but gives some extra information about each variable.
931 """Like %who, but gives some extra information about each variable.
932
932
933 The same type filtering of %who can be applied here.
933 The same type filtering of %who can be applied here.
934
934
935 For all variables, the type is printed. Additionally it prints:
935 For all variables, the type is printed. Additionally it prints:
936
936
937 - For {},[],(): their length.
937 - For {},[],(): their length.
938
938
939 - For Numeric arrays, a summary with shape, number of elements,
939 - For Numeric arrays, a summary with shape, number of elements,
940 typecode and size in memory.
940 typecode and size in memory.
941
941
942 - Everything else: a string representation, snipping their middle if
942 - Everything else: a string representation, snipping their middle if
943 too long."""
943 too long."""
944
944
945 varnames = self.magic_who_ls(parameter_s)
945 varnames = self.magic_who_ls(parameter_s)
946 if not varnames:
946 if not varnames:
947 print 'Interactive namespace is empty.'
947 print 'Interactive namespace is empty.'
948 return
948 return
949
949
950 # if we have variables, move on...
950 # if we have variables, move on...
951
951
952 # for these types, show len() instead of data:
952 # for these types, show len() instead of data:
953 seq_types = [types.DictType,types.ListType,types.TupleType]
953 seq_types = [types.DictType,types.ListType,types.TupleType]
954
954
955 # for Numeric arrays, display summary info
955 # for Numeric arrays, display summary info
956 try:
956 try:
957 import Numeric
957 import Numeric
958 except ImportError:
958 except ImportError:
959 array_type = None
959 array_type = None
960 else:
960 else:
961 array_type = Numeric.ArrayType.__name__
961 array_type = Numeric.ArrayType.__name__
962
962
963 # Find all variable names and types so we can figure out column sizes
963 # Find all variable names and types so we can figure out column sizes
964 get_vars = lambda i: self.shell.user_ns[i]
964
965 type_name = lambda v: type(v).__name__
965 def get_vars(i):
966 return self.shell.user_ns[i]
967
968 # some types are well known and can be shorter
969 abbrevs = {'IPython.macro.Macro' : 'Macro'}
970 def type_name(v):
971 tn = type(v).__name__
972 return abbrevs.get(tn,tn)
973
966 varlist = map(get_vars,varnames)
974 varlist = map(get_vars,varnames)
967
975
968 typelist = []
976 typelist = []
969 for vv in varlist:
977 for vv in varlist:
970 tt = type_name(vv)
978 tt = type_name(vv)
979
971 if tt=='instance':
980 if tt=='instance':
972 typelist.append(str(vv.__class__))
981 typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__)))
973 else:
982 else:
974 typelist.append(tt)
983 typelist.append(tt)
975
984
976 # column labels and # of spaces as separator
985 # column labels and # of spaces as separator
977 varlabel = 'Variable'
986 varlabel = 'Variable'
978 typelabel = 'Type'
987 typelabel = 'Type'
979 datalabel = 'Data/Info'
988 datalabel = 'Data/Info'
980 colsep = 3
989 colsep = 3
981 # variable format strings
990 # variable format strings
982 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
991 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
983 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
992 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
984 aformat = "%s: %s elems, type `%s`, %s bytes"
993 aformat = "%s: %s elems, type `%s`, %s bytes"
985 # find the size of the columns to format the output nicely
994 # find the size of the columns to format the output nicely
986 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
995 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
987 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
996 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
988 # table header
997 # table header
989 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
998 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
990 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
999 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
991 # and the table itself
1000 # and the table itself
992 kb = 1024
1001 kb = 1024
993 Mb = 1048576 # kb**2
1002 Mb = 1048576 # kb**2
994 for vname,var,vtype in zip(varnames,varlist,typelist):
1003 for vname,var,vtype in zip(varnames,varlist,typelist):
995 print itpl(vformat),
1004 print itpl(vformat),
996 if vtype in seq_types:
1005 if vtype in seq_types:
997 print len(var)
1006 print len(var)
998 elif vtype==array_type:
1007 elif vtype==array_type:
999 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1008 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1000 vsize = Numeric.size(var)
1009 vsize = Numeric.size(var)
1001 vbytes = vsize*var.itemsize()
1010 vbytes = vsize*var.itemsize()
1002 if vbytes < 100000:
1011 if vbytes < 100000:
1003 print aformat % (vshape,vsize,var.typecode(),vbytes)
1012 print aformat % (vshape,vsize,var.typecode(),vbytes)
1004 else:
1013 else:
1005 print aformat % (vshape,vsize,var.typecode(),vbytes),
1014 print aformat % (vshape,vsize,var.typecode(),vbytes),
1006 if vbytes < Mb:
1015 if vbytes < Mb:
1007 print '(%s kb)' % (vbytes/kb,)
1016 print '(%s kb)' % (vbytes/kb,)
1008 else:
1017 else:
1009 print '(%s Mb)' % (vbytes/Mb,)
1018 print '(%s Mb)' % (vbytes/Mb,)
1010 else:
1019 else:
1011 vstr = str(var).replace('\n','\\n')
1020 vstr = str(var).replace('\n','\\n')
1012 if len(vstr) < 50:
1021 if len(vstr) < 50:
1013 print vstr
1022 print vstr
1014 else:
1023 else:
1015 printpl(vfmt_short)
1024 printpl(vfmt_short)
1016
1025
1017 def magic_reset(self, parameter_s=''):
1026 def magic_reset(self, parameter_s=''):
1018 """Resets the namespace by removing all names defined by the user.
1027 """Resets the namespace by removing all names defined by the user.
1019
1028
1020 Input/Output history are left around in case you need them."""
1029 Input/Output history are left around in case you need them."""
1021
1030
1022 ans = self.shell.ask_yes_no(
1031 ans = self.shell.ask_yes_no(
1023 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1032 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1024 if not ans:
1033 if not ans:
1025 print 'Nothing done.'
1034 print 'Nothing done.'
1026 return
1035 return
1027 user_ns = self.shell.user_ns
1036 user_ns = self.shell.user_ns
1028 for i in self.magic_who_ls():
1037 for i in self.magic_who_ls():
1029 del(user_ns[i])
1038 del(user_ns[i])
1030
1039
1031 def magic_logstart(self,parameter_s=''):
1040 def magic_logstart(self,parameter_s=''):
1032 """Start logging anywhere in a session.
1041 """Start logging anywhere in a session.
1033
1042
1034 %logstart [-o|-r|-t] [log_name [log_mode]]
1043 %logstart [-o|-r|-t] [log_name [log_mode]]
1035
1044
1036 If no name is given, it defaults to a file named 'ipython_log.py' in your
1045 If no name is given, it defaults to a file named 'ipython_log.py' in your
1037 current directory, in 'rotate' mode (see below).
1046 current directory, in 'rotate' mode (see below).
1038
1047
1039 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1048 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1040 history up to that point and then continues logging.
1049 history up to that point and then continues logging.
1041
1050
1042 %logstart takes a second optional parameter: logging mode. This can be one
1051 %logstart takes a second optional parameter: logging mode. This can be one
1043 of (note that the modes are given unquoted):\\
1052 of (note that the modes are given unquoted):\\
1044 append: well, that says it.\\
1053 append: well, that says it.\\
1045 backup: rename (if exists) to name~ and start name.\\
1054 backup: rename (if exists) to name~ and start name.\\
1046 global: single logfile in your home dir, appended to.\\
1055 global: single logfile in your home dir, appended to.\\
1047 over : overwrite existing log.\\
1056 over : overwrite existing log.\\
1048 rotate: create rotating logs name.1~, name.2~, etc.
1057 rotate: create rotating logs name.1~, name.2~, etc.
1049
1058
1050 Options:
1059 Options:
1051
1060
1052 -o: log also IPython's output. In this mode, all commands which
1061 -o: log also IPython's output. In this mode, all commands which
1053 generate an Out[NN] prompt are recorded to the logfile, right after
1062 generate an Out[NN] prompt are recorded to the logfile, right after
1054 their corresponding input line. The output lines are always
1063 their corresponding input line. The output lines are always
1055 prepended with a '#[Out]# ' marker, so that the log remains valid
1064 prepended with a '#[Out]# ' marker, so that the log remains valid
1056 Python code.
1065 Python code.
1057
1066
1058 Since this marker is always the same, filtering only the output from
1067 Since this marker is always the same, filtering only the output from
1059 a log is very easy, using for example a simple awk call:
1068 a log is very easy, using for example a simple awk call:
1060
1069
1061 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1070 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1062
1071
1063 -r: log 'raw' input. Normally, IPython's logs contain the processed
1072 -r: log 'raw' input. Normally, IPython's logs contain the processed
1064 input, so that user lines are logged in their final form, converted
1073 input, so that user lines are logged in their final form, converted
1065 into valid Python. For example, %Exit is logged as
1074 into valid Python. For example, %Exit is logged as
1066 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1075 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1067 exactly as typed, with no transformations applied.
1076 exactly as typed, with no transformations applied.
1068
1077
1069 -t: put timestamps before each input line logged (these are put in
1078 -t: put timestamps before each input line logged (these are put in
1070 comments)."""
1079 comments)."""
1071
1080
1072 opts,par = self.parse_options(parameter_s,'ort')
1081 opts,par = self.parse_options(parameter_s,'ort')
1073 log_output = 'o' in opts
1082 log_output = 'o' in opts
1074 log_raw_input = 'r' in opts
1083 log_raw_input = 'r' in opts
1075 timestamp = 't' in opts
1084 timestamp = 't' in opts
1076
1085
1077 rc = self.shell.rc
1086 rc = self.shell.rc
1078 logger = self.shell.logger
1087 logger = self.shell.logger
1079
1088
1080 # if no args are given, the defaults set in the logger constructor by
1089 # if no args are given, the defaults set in the logger constructor by
1081 # ipytohn remain valid
1090 # ipytohn remain valid
1082 if par:
1091 if par:
1083 try:
1092 try:
1084 logfname,logmode = par.split()
1093 logfname,logmode = par.split()
1085 except:
1094 except:
1086 logfname = par
1095 logfname = par
1087 logmode = 'backup'
1096 logmode = 'backup'
1088 else:
1097 else:
1089 logfname = logger.logfname
1098 logfname = logger.logfname
1090 logmode = logger.logmode
1099 logmode = logger.logmode
1091 # put logfname into rc struct as if it had been called on the command
1100 # put logfname into rc struct as if it had been called on the command
1092 # line, so it ends up saved in the log header Save it in case we need
1101 # line, so it ends up saved in the log header Save it in case we need
1093 # to restore it...
1102 # to restore it...
1094 old_logfile = rc.opts.get('logfile','')
1103 old_logfile = rc.opts.get('logfile','')
1095 if logfname:
1104 if logfname:
1096 logfname = os.path.expanduser(logfname)
1105 logfname = os.path.expanduser(logfname)
1097 rc.opts.logfile = logfname
1106 rc.opts.logfile = logfname
1098 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1107 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1099 try:
1108 try:
1100 started = logger.logstart(logfname,loghead,logmode,
1109 started = logger.logstart(logfname,loghead,logmode,
1101 log_output,timestamp,log_raw_input)
1110 log_output,timestamp,log_raw_input)
1102 except:
1111 except:
1103 rc.opts.logfile = old_logfile
1112 rc.opts.logfile = old_logfile
1104 warn("Couldn't start log: %s" % sys.exc_info()[1])
1113 warn("Couldn't start log: %s" % sys.exc_info()[1])
1105 else:
1114 else:
1106 # log input history up to this point, optionally interleaving
1115 # log input history up to this point, optionally interleaving
1107 # output if requested
1116 # output if requested
1108
1117
1109 if timestamp:
1118 if timestamp:
1110 # disable timestamping for the previous history, since we've
1119 # disable timestamping for the previous history, since we've
1111 # lost those already (no time machine here).
1120 # lost those already (no time machine here).
1112 logger.timestamp = False
1121 logger.timestamp = False
1113
1122
1114 if log_raw_input:
1123 if log_raw_input:
1115 input_hist = self.shell.input_hist_raw
1124 input_hist = self.shell.input_hist_raw
1116 else:
1125 else:
1117 input_hist = self.shell.input_hist
1126 input_hist = self.shell.input_hist
1118
1127
1119 if log_output:
1128 if log_output:
1120 log_write = logger.log_write
1129 log_write = logger.log_write
1121 output_hist = self.shell.output_hist
1130 output_hist = self.shell.output_hist
1122 for n in range(1,len(input_hist)-1):
1131 for n in range(1,len(input_hist)-1):
1123 log_write(input_hist[n].rstrip())
1132 log_write(input_hist[n].rstrip())
1124 if n in output_hist:
1133 if n in output_hist:
1125 log_write(repr(output_hist[n]),'output')
1134 log_write(repr(output_hist[n]),'output')
1126 else:
1135 else:
1127 logger.log_write(input_hist[1:])
1136 logger.log_write(input_hist[1:])
1128 if timestamp:
1137 if timestamp:
1129 # re-enable timestamping
1138 # re-enable timestamping
1130 logger.timestamp = True
1139 logger.timestamp = True
1131
1140
1132 print ('Activating auto-logging. '
1141 print ('Activating auto-logging. '
1133 'Current session state plus future input saved.')
1142 'Current session state plus future input saved.')
1134 logger.logstate()
1143 logger.logstate()
1135
1144
1136 def magic_logoff(self,parameter_s=''):
1145 def magic_logoff(self,parameter_s=''):
1137 """Temporarily stop logging.
1146 """Temporarily stop logging.
1138
1147
1139 You must have previously started logging."""
1148 You must have previously started logging."""
1140 self.shell.logger.switch_log(0)
1149 self.shell.logger.switch_log(0)
1141
1150
1142 def magic_logon(self,parameter_s=''):
1151 def magic_logon(self,parameter_s=''):
1143 """Restart logging.
1152 """Restart logging.
1144
1153
1145 This function is for restarting logging which you've temporarily
1154 This function is for restarting logging which you've temporarily
1146 stopped with %logoff. For starting logging for the first time, you
1155 stopped with %logoff. For starting logging for the first time, you
1147 must use the %logstart function, which allows you to specify an
1156 must use the %logstart function, which allows you to specify an
1148 optional log filename."""
1157 optional log filename."""
1149
1158
1150 self.shell.logger.switch_log(1)
1159 self.shell.logger.switch_log(1)
1151
1160
1152 def magic_logstate(self,parameter_s=''):
1161 def magic_logstate(self,parameter_s=''):
1153 """Print the status of the logging system."""
1162 """Print the status of the logging system."""
1154
1163
1155 self.shell.logger.logstate()
1164 self.shell.logger.logstate()
1156
1165
1157 def magic_pdb(self, parameter_s=''):
1166 def magic_pdb(self, parameter_s=''):
1158 """Control the calling of the pdb interactive debugger.
1167 """Control the calling of the pdb interactive debugger.
1159
1168
1160 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1169 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1161 argument it works as a toggle.
1170 argument it works as a toggle.
1162
1171
1163 When an exception is triggered, IPython can optionally call the
1172 When an exception is triggered, IPython can optionally call the
1164 interactive pdb debugger after the traceback printout. %pdb toggles
1173 interactive pdb debugger after the traceback printout. %pdb toggles
1165 this feature on and off."""
1174 this feature on and off."""
1166
1175
1167 par = parameter_s.strip().lower()
1176 par = parameter_s.strip().lower()
1168
1177
1169 if par:
1178 if par:
1170 try:
1179 try:
1171 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1180 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1172 except KeyError:
1181 except KeyError:
1173 print ('Incorrect argument. Use on/1, off/0, '
1182 print ('Incorrect argument. Use on/1, off/0, '
1174 'or nothing for a toggle.')
1183 'or nothing for a toggle.')
1175 return
1184 return
1176 else:
1185 else:
1177 # toggle
1186 # toggle
1178 new_pdb = not self.shell.InteractiveTB.call_pdb
1187 new_pdb = not self.shell.InteractiveTB.call_pdb
1179
1188
1180 # set on the shell
1189 # set on the shell
1181 self.shell.call_pdb = new_pdb
1190 self.shell.call_pdb = new_pdb
1182 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1191 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1183
1192
1184 def magic_prun(self, parameter_s ='',user_mode=1,
1193 def magic_prun(self, parameter_s ='',user_mode=1,
1185 opts=None,arg_lst=None,prog_ns=None):
1194 opts=None,arg_lst=None,prog_ns=None):
1186
1195
1187 """Run a statement through the python code profiler.
1196 """Run a statement through the python code profiler.
1188
1197
1189 Usage:\\
1198 Usage:\\
1190 %prun [options] statement
1199 %prun [options] statement
1191
1200
1192 The given statement (which doesn't require quote marks) is run via the
1201 The given statement (which doesn't require quote marks) is run via the
1193 python profiler in a manner similar to the profile.run() function.
1202 python profiler in a manner similar to the profile.run() function.
1194 Namespaces are internally managed to work correctly; profile.run
1203 Namespaces are internally managed to work correctly; profile.run
1195 cannot be used in IPython because it makes certain assumptions about
1204 cannot be used in IPython because it makes certain assumptions about
1196 namespaces which do not hold under IPython.
1205 namespaces which do not hold under IPython.
1197
1206
1198 Options:
1207 Options:
1199
1208
1200 -l <limit>: you can place restrictions on what or how much of the
1209 -l <limit>: you can place restrictions on what or how much of the
1201 profile gets printed. The limit value can be:
1210 profile gets printed. The limit value can be:
1202
1211
1203 * A string: only information for function names containing this string
1212 * A string: only information for function names containing this string
1204 is printed.
1213 is printed.
1205
1214
1206 * An integer: only these many lines are printed.
1215 * An integer: only these many lines are printed.
1207
1216
1208 * A float (between 0 and 1): this fraction of the report is printed
1217 * A float (between 0 and 1): this fraction of the report is printed
1209 (for example, use a limit of 0.4 to see the topmost 40% only).
1218 (for example, use a limit of 0.4 to see the topmost 40% only).
1210
1219
1211 You can combine several limits with repeated use of the option. For
1220 You can combine several limits with repeated use of the option. For
1212 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1221 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1213 information about class constructors.
1222 information about class constructors.
1214
1223
1215 -r: return the pstats.Stats object generated by the profiling. This
1224 -r: return the pstats.Stats object generated by the profiling. This
1216 object has all the information about the profile in it, and you can
1225 object has all the information about the profile in it, and you can
1217 later use it for further analysis or in other functions.
1226 later use it for further analysis or in other functions.
1218
1227
1219 -s <key>: sort profile by given key. You can provide more than one key
1228 -s <key>: sort profile by given key. You can provide more than one key
1220 by using the option several times: '-s key1 -s key2 -s key3...'. The
1229 by using the option several times: '-s key1 -s key2 -s key3...'. The
1221 default sorting key is 'time'.
1230 default sorting key is 'time'.
1222
1231
1223 The following is copied verbatim from the profile documentation
1232 The following is copied verbatim from the profile documentation
1224 referenced below:
1233 referenced below:
1225
1234
1226 When more than one key is provided, additional keys are used as
1235 When more than one key is provided, additional keys are used as
1227 secondary criteria when the there is equality in all keys selected
1236 secondary criteria when the there is equality in all keys selected
1228 before them.
1237 before them.
1229
1238
1230 Abbreviations can be used for any key names, as long as the
1239 Abbreviations can be used for any key names, as long as the
1231 abbreviation is unambiguous. The following are the keys currently
1240 abbreviation is unambiguous. The following are the keys currently
1232 defined:
1241 defined:
1233
1242
1234 Valid Arg Meaning\\
1243 Valid Arg Meaning\\
1235 "calls" call count\\
1244 "calls" call count\\
1236 "cumulative" cumulative time\\
1245 "cumulative" cumulative time\\
1237 "file" file name\\
1246 "file" file name\\
1238 "module" file name\\
1247 "module" file name\\
1239 "pcalls" primitive call count\\
1248 "pcalls" primitive call count\\
1240 "line" line number\\
1249 "line" line number\\
1241 "name" function name\\
1250 "name" function name\\
1242 "nfl" name/file/line\\
1251 "nfl" name/file/line\\
1243 "stdname" standard name\\
1252 "stdname" standard name\\
1244 "time" internal time
1253 "time" internal time
1245
1254
1246 Note that all sorts on statistics are in descending order (placing
1255 Note that all sorts on statistics are in descending order (placing
1247 most time consuming items first), where as name, file, and line number
1256 most time consuming items first), where as name, file, and line number
1248 searches are in ascending order (i.e., alphabetical). The subtle
1257 searches are in ascending order (i.e., alphabetical). The subtle
1249 distinction between "nfl" and "stdname" is that the standard name is a
1258 distinction between "nfl" and "stdname" is that the standard name is a
1250 sort of the name as printed, which means that the embedded line
1259 sort of the name as printed, which means that the embedded line
1251 numbers get compared in an odd way. For example, lines 3, 20, and 40
1260 numbers get compared in an odd way. For example, lines 3, 20, and 40
1252 would (if the file names were the same) appear in the string order
1261 would (if the file names were the same) appear in the string order
1253 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1262 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1254 line numbers. In fact, sort_stats("nfl") is the same as
1263 line numbers. In fact, sort_stats("nfl") is the same as
1255 sort_stats("name", "file", "line").
1264 sort_stats("name", "file", "line").
1256
1265
1257 -T <filename>: save profile results as shown on screen to a text
1266 -T <filename>: save profile results as shown on screen to a text
1258 file. The profile is still shown on screen.
1267 file. The profile is still shown on screen.
1259
1268
1260 -D <filename>: save (via dump_stats) profile statistics to given
1269 -D <filename>: save (via dump_stats) profile statistics to given
1261 filename. This data is in a format understod by the pstats module, and
1270 filename. This data is in a format understod by the pstats module, and
1262 is generated by a call to the dump_stats() method of profile
1271 is generated by a call to the dump_stats() method of profile
1263 objects. The profile is still shown on screen.
1272 objects. The profile is still shown on screen.
1264
1273
1265 If you want to run complete programs under the profiler's control, use
1274 If you want to run complete programs under the profiler's control, use
1266 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1275 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1267 contains profiler specific options as described here.
1276 contains profiler specific options as described here.
1268
1277
1269 You can read the complete documentation for the profile module with:\\
1278 You can read the complete documentation for the profile module with:\\
1270 In [1]: import profile; profile.help() """
1279 In [1]: import profile; profile.help() """
1271
1280
1272 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1281 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1273 # protect user quote marks
1282 # protect user quote marks
1274 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1283 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1275
1284
1276 if user_mode: # regular user call
1285 if user_mode: # regular user call
1277 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1286 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1278 list_all=1)
1287 list_all=1)
1279 namespace = self.shell.user_ns
1288 namespace = self.shell.user_ns
1280 else: # called to run a program by %run -p
1289 else: # called to run a program by %run -p
1281 try:
1290 try:
1282 filename = get_py_filename(arg_lst[0])
1291 filename = get_py_filename(arg_lst[0])
1283 except IOError,msg:
1292 except IOError,msg:
1284 error(msg)
1293 error(msg)
1285 return
1294 return
1286
1295
1287 arg_str = 'execfile(filename,prog_ns)'
1296 arg_str = 'execfile(filename,prog_ns)'
1288 namespace = locals()
1297 namespace = locals()
1289
1298
1290 opts.merge(opts_def)
1299 opts.merge(opts_def)
1291
1300
1292 prof = profile.Profile()
1301 prof = profile.Profile()
1293 try:
1302 try:
1294 prof = prof.runctx(arg_str,namespace,namespace)
1303 prof = prof.runctx(arg_str,namespace,namespace)
1295 sys_exit = ''
1304 sys_exit = ''
1296 except SystemExit:
1305 except SystemExit:
1297 sys_exit = """*** SystemExit exception caught in code being profiled."""
1306 sys_exit = """*** SystemExit exception caught in code being profiled."""
1298
1307
1299 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1308 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1300
1309
1301 lims = opts.l
1310 lims = opts.l
1302 if lims:
1311 if lims:
1303 lims = [] # rebuild lims with ints/floats/strings
1312 lims = [] # rebuild lims with ints/floats/strings
1304 for lim in opts.l:
1313 for lim in opts.l:
1305 try:
1314 try:
1306 lims.append(int(lim))
1315 lims.append(int(lim))
1307 except ValueError:
1316 except ValueError:
1308 try:
1317 try:
1309 lims.append(float(lim))
1318 lims.append(float(lim))
1310 except ValueError:
1319 except ValueError:
1311 lims.append(lim)
1320 lims.append(lim)
1312
1321
1313 # trap output
1322 # trap output
1314 sys_stdout = sys.stdout
1323 sys_stdout = sys.stdout
1315 stdout_trap = StringIO()
1324 stdout_trap = StringIO()
1316 try:
1325 try:
1317 sys.stdout = stdout_trap
1326 sys.stdout = stdout_trap
1318 stats.print_stats(*lims)
1327 stats.print_stats(*lims)
1319 finally:
1328 finally:
1320 sys.stdout = sys_stdout
1329 sys.stdout = sys_stdout
1321 output = stdout_trap.getvalue()
1330 output = stdout_trap.getvalue()
1322 output = output.rstrip()
1331 output = output.rstrip()
1323
1332
1324 page(output,screen_lines=self.shell.rc.screen_length)
1333 page(output,screen_lines=self.shell.rc.screen_length)
1325 print sys_exit,
1334 print sys_exit,
1326
1335
1327 dump_file = opts.D[0]
1336 dump_file = opts.D[0]
1328 text_file = opts.T[0]
1337 text_file = opts.T[0]
1329 if dump_file:
1338 if dump_file:
1330 prof.dump_stats(dump_file)
1339 prof.dump_stats(dump_file)
1331 print '\n*** Profile stats marshalled to file',\
1340 print '\n*** Profile stats marshalled to file',\
1332 `dump_file`+'.',sys_exit
1341 `dump_file`+'.',sys_exit
1333 if text_file:
1342 if text_file:
1334 file(text_file,'w').write(output)
1343 file(text_file,'w').write(output)
1335 print '\n*** Profile printout saved to text file',\
1344 print '\n*** Profile printout saved to text file',\
1336 `text_file`+'.',sys_exit
1345 `text_file`+'.',sys_exit
1337
1346
1338 if opts.has_key('r'):
1347 if opts.has_key('r'):
1339 return stats
1348 return stats
1340 else:
1349 else:
1341 return None
1350 return None
1342
1351
1343 def magic_run(self, parameter_s ='',runner=None):
1352 def magic_run(self, parameter_s ='',runner=None):
1344 """Run the named file inside IPython as a program.
1353 """Run the named file inside IPython as a program.
1345
1354
1346 Usage:\\
1355 Usage:\\
1347 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1356 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1348
1357
1349 Parameters after the filename are passed as command-line arguments to
1358 Parameters after the filename are passed as command-line arguments to
1350 the program (put in sys.argv). Then, control returns to IPython's
1359 the program (put in sys.argv). Then, control returns to IPython's
1351 prompt.
1360 prompt.
1352
1361
1353 This is similar to running at a system prompt:\\
1362 This is similar to running at a system prompt:\\
1354 $ python file args\\
1363 $ python file args\\
1355 but with the advantage of giving you IPython's tracebacks, and of
1364 but with the advantage of giving you IPython's tracebacks, and of
1356 loading all variables into your interactive namespace for further use
1365 loading all variables into your interactive namespace for further use
1357 (unless -p is used, see below).
1366 (unless -p is used, see below).
1358
1367
1359 The file is executed in a namespace initially consisting only of
1368 The file is executed in a namespace initially consisting only of
1360 __name__=='__main__' and sys.argv constructed as indicated. It thus
1369 __name__=='__main__' and sys.argv constructed as indicated. It thus
1361 sees its environment as if it were being run as a stand-alone
1370 sees its environment as if it were being run as a stand-alone
1362 program. But after execution, the IPython interactive namespace gets
1371 program. But after execution, the IPython interactive namespace gets
1363 updated with all variables defined in the program (except for __name__
1372 updated with all variables defined in the program (except for __name__
1364 and sys.argv). This allows for very convenient loading of code for
1373 and sys.argv). This allows for very convenient loading of code for
1365 interactive work, while giving each program a 'clean sheet' to run in.
1374 interactive work, while giving each program a 'clean sheet' to run in.
1366
1375
1367 Options:
1376 Options:
1368
1377
1369 -n: __name__ is NOT set to '__main__', but to the running file's name
1378 -n: __name__ is NOT set to '__main__', but to the running file's name
1370 without extension (as python does under import). This allows running
1379 without extension (as python does under import). This allows running
1371 scripts and reloading the definitions in them without calling code
1380 scripts and reloading the definitions in them without calling code
1372 protected by an ' if __name__ == "__main__" ' clause.
1381 protected by an ' if __name__ == "__main__" ' clause.
1373
1382
1374 -i: run the file in IPython's namespace instead of an empty one. This
1383 -i: run the file in IPython's namespace instead of an empty one. This
1375 is useful if you are experimenting with code written in a text editor
1384 is useful if you are experimenting with code written in a text editor
1376 which depends on variables defined interactively.
1385 which depends on variables defined interactively.
1377
1386
1378 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1387 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1379 being run. This is particularly useful if IPython is being used to
1388 being run. This is particularly useful if IPython is being used to
1380 run unittests, which always exit with a sys.exit() call. In such
1389 run unittests, which always exit with a sys.exit() call. In such
1381 cases you are interested in the output of the test results, not in
1390 cases you are interested in the output of the test results, not in
1382 seeing a traceback of the unittest module.
1391 seeing a traceback of the unittest module.
1383
1392
1384 -t: print timing information at the end of the run. IPython will give
1393 -t: print timing information at the end of the run. IPython will give
1385 you an estimated CPU time consumption for your script, which under
1394 you an estimated CPU time consumption for your script, which under
1386 Unix uses the resource module to avoid the wraparound problems of
1395 Unix uses the resource module to avoid the wraparound problems of
1387 time.clock(). Under Unix, an estimate of time spent on system tasks
1396 time.clock(). Under Unix, an estimate of time spent on system tasks
1388 is also given (for Windows platforms this is reported as 0.0).
1397 is also given (for Windows platforms this is reported as 0.0).
1389
1398
1390 If -t is given, an additional -N<N> option can be given, where <N>
1399 If -t is given, an additional -N<N> option can be given, where <N>
1391 must be an integer indicating how many times you want the script to
1400 must be an integer indicating how many times you want the script to
1392 run. The final timing report will include total and per run results.
1401 run. The final timing report will include total and per run results.
1393
1402
1394 For example (testing the script uniq_stable.py):
1403 For example (testing the script uniq_stable.py):
1395
1404
1396 In [1]: run -t uniq_stable
1405 In [1]: run -t uniq_stable
1397
1406
1398 IPython CPU timings (estimated):\\
1407 IPython CPU timings (estimated):\\
1399 User : 0.19597 s.\\
1408 User : 0.19597 s.\\
1400 System: 0.0 s.\\
1409 System: 0.0 s.\\
1401
1410
1402 In [2]: run -t -N5 uniq_stable
1411 In [2]: run -t -N5 uniq_stable
1403
1412
1404 IPython CPU timings (estimated):\\
1413 IPython CPU timings (estimated):\\
1405 Total runs performed: 5\\
1414 Total runs performed: 5\\
1406 Times : Total Per run\\
1415 Times : Total Per run\\
1407 User : 0.910862 s, 0.1821724 s.\\
1416 User : 0.910862 s, 0.1821724 s.\\
1408 System: 0.0 s, 0.0 s.
1417 System: 0.0 s, 0.0 s.
1409
1418
1410 -d: run your program under the control of pdb, the Python debugger.
1419 -d: run your program under the control of pdb, the Python debugger.
1411 This allows you to execute your program step by step, watch variables,
1420 This allows you to execute your program step by step, watch variables,
1412 etc. Internally, what IPython does is similar to calling:
1421 etc. Internally, what IPython does is similar to calling:
1413
1422
1414 pdb.run('execfile("YOURFILENAME")')
1423 pdb.run('execfile("YOURFILENAME")')
1415
1424
1416 with a breakpoint set on line 1 of your file. You can change the line
1425 with a breakpoint set on line 1 of your file. You can change the line
1417 number for this automatic breakpoint to be <N> by using the -bN option
1426 number for this automatic breakpoint to be <N> by using the -bN option
1418 (where N must be an integer). For example:
1427 (where N must be an integer). For example:
1419
1428
1420 %run -d -b40 myscript
1429 %run -d -b40 myscript
1421
1430
1422 will set the first breakpoint at line 40 in myscript.py. Note that
1431 will set the first breakpoint at line 40 in myscript.py. Note that
1423 the first breakpoint must be set on a line which actually does
1432 the first breakpoint must be set on a line which actually does
1424 something (not a comment or docstring) for it to stop execution.
1433 something (not a comment or docstring) for it to stop execution.
1425
1434
1426 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1435 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1427 first enter 'c' (without qoutes) to start execution up to the first
1436 first enter 'c' (without qoutes) to start execution up to the first
1428 breakpoint.
1437 breakpoint.
1429
1438
1430 Entering 'help' gives information about the use of the debugger. You
1439 Entering 'help' gives information about the use of the debugger. You
1431 can easily see pdb's full documentation with "import pdb;pdb.help()"
1440 can easily see pdb's full documentation with "import pdb;pdb.help()"
1432 at a prompt.
1441 at a prompt.
1433
1442
1434 -p: run program under the control of the Python profiler module (which
1443 -p: run program under the control of the Python profiler module (which
1435 prints a detailed report of execution times, function calls, etc).
1444 prints a detailed report of execution times, function calls, etc).
1436
1445
1437 You can pass other options after -p which affect the behavior of the
1446 You can pass other options after -p which affect the behavior of the
1438 profiler itself. See the docs for %prun for details.
1447 profiler itself. See the docs for %prun for details.
1439
1448
1440 In this mode, the program's variables do NOT propagate back to the
1449 In this mode, the program's variables do NOT propagate back to the
1441 IPython interactive namespace (because they remain in the namespace
1450 IPython interactive namespace (because they remain in the namespace
1442 where the profiler executes them).
1451 where the profiler executes them).
1443
1452
1444 Internally this triggers a call to %prun, see its documentation for
1453 Internally this triggers a call to %prun, see its documentation for
1445 details on the options available specifically for profiling."""
1454 details on the options available specifically for profiling."""
1446
1455
1447 # get arguments and set sys.argv for program to be run.
1456 # get arguments and set sys.argv for program to be run.
1448 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1457 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1449 mode='list',list_all=1)
1458 mode='list',list_all=1)
1450
1459
1451 try:
1460 try:
1452 filename = get_py_filename(arg_lst[0])
1461 filename = get_py_filename(arg_lst[0])
1453 except IndexError:
1462 except IndexError:
1454 warn('you must provide at least a filename.')
1463 warn('you must provide at least a filename.')
1455 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1464 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1456 return
1465 return
1457 except IOError,msg:
1466 except IOError,msg:
1458 error(msg)
1467 error(msg)
1459 return
1468 return
1460
1469
1461 # Control the response to exit() calls made by the script being run
1470 # Control the response to exit() calls made by the script being run
1462 exit_ignore = opts.has_key('e')
1471 exit_ignore = opts.has_key('e')
1463
1472
1464 # Make sure that the running script gets a proper sys.argv as if it
1473 # Make sure that the running script gets a proper sys.argv as if it
1465 # were run from a system shell.
1474 # were run from a system shell.
1466 save_argv = sys.argv # save it for later restoring
1475 save_argv = sys.argv # save it for later restoring
1467 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1476 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1468
1477
1469 if opts.has_key('i'):
1478 if opts.has_key('i'):
1470 prog_ns = self.shell.user_ns
1479 prog_ns = self.shell.user_ns
1471 __name__save = self.shell.user_ns['__name__']
1480 __name__save = self.shell.user_ns['__name__']
1472 prog_ns['__name__'] = '__main__'
1481 prog_ns['__name__'] = '__main__'
1473 else:
1482 else:
1474 if opts.has_key('n'):
1483 if opts.has_key('n'):
1475 name = os.path.splitext(os.path.basename(filename))[0]
1484 name = os.path.splitext(os.path.basename(filename))[0]
1476 else:
1485 else:
1477 name = '__main__'
1486 name = '__main__'
1478 prog_ns = {'__name__':name}
1487 prog_ns = {'__name__':name}
1479
1488
1480 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1489 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1481 # set the __file__ global in the script's namespace
1490 # set the __file__ global in the script's namespace
1482 prog_ns['__file__'] = filename
1491 prog_ns['__file__'] = filename
1483
1492
1484 # pickle fix. See iplib for an explanation. But we need to make sure
1493 # pickle fix. See iplib for an explanation. But we need to make sure
1485 # that, if we overwrite __main__, we replace it at the end
1494 # that, if we overwrite __main__, we replace it at the end
1486 if prog_ns['__name__'] == '__main__':
1495 if prog_ns['__name__'] == '__main__':
1487 restore_main = sys.modules['__main__']
1496 restore_main = sys.modules['__main__']
1488 else:
1497 else:
1489 restore_main = False
1498 restore_main = False
1490
1499
1491 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1500 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1492
1501
1493 stats = None
1502 stats = None
1494 try:
1503 try:
1495 if self.shell.has_readline:
1504 if self.shell.has_readline:
1496 self.shell.savehist()
1505 self.shell.savehist()
1497
1506
1498 if opts.has_key('p'):
1507 if opts.has_key('p'):
1499 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1508 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1500 else:
1509 else:
1501 if opts.has_key('d'):
1510 if opts.has_key('d'):
1502 deb = Debugger.Pdb(self.shell.rc.colors)
1511 deb = Debugger.Pdb(self.shell.rc.colors)
1503 # reset Breakpoint state, which is moronically kept
1512 # reset Breakpoint state, which is moronically kept
1504 # in a class
1513 # in a class
1505 bdb.Breakpoint.next = 1
1514 bdb.Breakpoint.next = 1
1506 bdb.Breakpoint.bplist = {}
1515 bdb.Breakpoint.bplist = {}
1507 bdb.Breakpoint.bpbynumber = [None]
1516 bdb.Breakpoint.bpbynumber = [None]
1508 # Set an initial breakpoint to stop execution
1517 # Set an initial breakpoint to stop execution
1509 maxtries = 10
1518 maxtries = 10
1510 bp = int(opts.get('b',[1])[0])
1519 bp = int(opts.get('b',[1])[0])
1511 checkline = deb.checkline(filename,bp)
1520 checkline = deb.checkline(filename,bp)
1512 if not checkline:
1521 if not checkline:
1513 for bp in range(bp+1,bp+maxtries+1):
1522 for bp in range(bp+1,bp+maxtries+1):
1514 if deb.checkline(filename,bp):
1523 if deb.checkline(filename,bp):
1515 break
1524 break
1516 else:
1525 else:
1517 msg = ("\nI failed to find a valid line to set "
1526 msg = ("\nI failed to find a valid line to set "
1518 "a breakpoint\n"
1527 "a breakpoint\n"
1519 "after trying up to line: %s.\n"
1528 "after trying up to line: %s.\n"
1520 "Please set a valid breakpoint manually "
1529 "Please set a valid breakpoint manually "
1521 "with the -b option." % bp)
1530 "with the -b option." % bp)
1522 error(msg)
1531 error(msg)
1523 return
1532 return
1524 # if we find a good linenumber, set the breakpoint
1533 # if we find a good linenumber, set the breakpoint
1525 deb.do_break('%s:%s' % (filename,bp))
1534 deb.do_break('%s:%s' % (filename,bp))
1526 # Start file run
1535 # Start file run
1527 print "NOTE: Enter 'c' at the",
1536 print "NOTE: Enter 'c' at the",
1528 print "%s prompt to start your script." % deb.prompt
1537 print "%s prompt to start your script." % deb.prompt
1529 try:
1538 try:
1530 deb.run('execfile("%s")' % filename,prog_ns)
1539 deb.run('execfile("%s")' % filename,prog_ns)
1531
1540
1532 except:
1541 except:
1533 etype, value, tb = sys.exc_info()
1542 etype, value, tb = sys.exc_info()
1534 # Skip three frames in the traceback: the %run one,
1543 # Skip three frames in the traceback: the %run one,
1535 # one inside bdb.py, and the command-line typed by the
1544 # one inside bdb.py, and the command-line typed by the
1536 # user (run by exec in pdb itself).
1545 # user (run by exec in pdb itself).
1537 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1546 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1538 else:
1547 else:
1539 if runner is None:
1548 if runner is None:
1540 runner = self.shell.safe_execfile
1549 runner = self.shell.safe_execfile
1541 if opts.has_key('t'):
1550 if opts.has_key('t'):
1542 try:
1551 try:
1543 nruns = int(opts['N'][0])
1552 nruns = int(opts['N'][0])
1544 if nruns < 1:
1553 if nruns < 1:
1545 error('Number of runs must be >=1')
1554 error('Number of runs must be >=1')
1546 return
1555 return
1547 except (KeyError):
1556 except (KeyError):
1548 nruns = 1
1557 nruns = 1
1549 if nruns == 1:
1558 if nruns == 1:
1550 t0 = clock2()
1559 t0 = clock2()
1551 runner(filename,prog_ns,prog_ns,
1560 runner(filename,prog_ns,prog_ns,
1552 exit_ignore=exit_ignore)
1561 exit_ignore=exit_ignore)
1553 t1 = clock2()
1562 t1 = clock2()
1554 t_usr = t1[0]-t0[0]
1563 t_usr = t1[0]-t0[0]
1555 t_sys = t1[1]-t1[1]
1564 t_sys = t1[1]-t1[1]
1556 print "\nIPython CPU timings (estimated):"
1565 print "\nIPython CPU timings (estimated):"
1557 print " User : %10s s." % t_usr
1566 print " User : %10s s." % t_usr
1558 print " System: %10s s." % t_sys
1567 print " System: %10s s." % t_sys
1559 else:
1568 else:
1560 runs = range(nruns)
1569 runs = range(nruns)
1561 t0 = clock2()
1570 t0 = clock2()
1562 for nr in runs:
1571 for nr in runs:
1563 runner(filename,prog_ns,prog_ns,
1572 runner(filename,prog_ns,prog_ns,
1564 exit_ignore=exit_ignore)
1573 exit_ignore=exit_ignore)
1565 t1 = clock2()
1574 t1 = clock2()
1566 t_usr = t1[0]-t0[0]
1575 t_usr = t1[0]-t0[0]
1567 t_sys = t1[1]-t1[1]
1576 t_sys = t1[1]-t1[1]
1568 print "\nIPython CPU timings (estimated):"
1577 print "\nIPython CPU timings (estimated):"
1569 print "Total runs performed:",nruns
1578 print "Total runs performed:",nruns
1570 print " Times : %10s %10s" % ('Total','Per run')
1579 print " Times : %10s %10s" % ('Total','Per run')
1571 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1580 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1572 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1581 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1573
1582
1574 else:
1583 else:
1575 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1584 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1576 if opts.has_key('i'):
1585 if opts.has_key('i'):
1577 self.shell.user_ns['__name__'] = __name__save
1586 self.shell.user_ns['__name__'] = __name__save
1578 else:
1587 else:
1579 # update IPython interactive namespace
1588 # update IPython interactive namespace
1580 del prog_ns['__name__']
1589 del prog_ns['__name__']
1581 self.shell.user_ns.update(prog_ns)
1590 self.shell.user_ns.update(prog_ns)
1582 finally:
1591 finally:
1583 sys.argv = save_argv
1592 sys.argv = save_argv
1584 if restore_main:
1593 if restore_main:
1585 sys.modules['__main__'] = restore_main
1594 sys.modules['__main__'] = restore_main
1586 if self.shell.has_readline:
1595 if self.shell.has_readline:
1587 self.shell.readline.read_history_file(self.shell.histfile)
1596 self.shell.readline.read_history_file(self.shell.histfile)
1588
1597
1589 return stats
1598 return stats
1590
1599
1591 def magic_runlog(self, parameter_s =''):
1600 def magic_runlog(self, parameter_s =''):
1592 """Run files as logs.
1601 """Run files as logs.
1593
1602
1594 Usage:\\
1603 Usage:\\
1595 %runlog file1 file2 ...
1604 %runlog file1 file2 ...
1596
1605
1597 Run the named files (treating them as log files) in sequence inside
1606 Run the named files (treating them as log files) in sequence inside
1598 the interpreter, and return to the prompt. This is much slower than
1607 the interpreter, and return to the prompt. This is much slower than
1599 %run because each line is executed in a try/except block, but it
1608 %run because each line is executed in a try/except block, but it
1600 allows running files with syntax errors in them.
1609 allows running files with syntax errors in them.
1601
1610
1602 Normally IPython will guess when a file is one of its own logfiles, so
1611 Normally IPython will guess when a file is one of its own logfiles, so
1603 you can typically use %run even for logs. This shorthand allows you to
1612 you can typically use %run even for logs. This shorthand allows you to
1604 force any file to be treated as a log file."""
1613 force any file to be treated as a log file."""
1605
1614
1606 for f in parameter_s.split():
1615 for f in parameter_s.split():
1607 self.shell.safe_execfile(f,self.shell.user_ns,
1616 self.shell.safe_execfile(f,self.shell.user_ns,
1608 self.shell.user_ns,islog=1)
1617 self.shell.user_ns,islog=1)
1609
1618
1610 def magic_timeit(self, parameter_s =''):
1619 def magic_timeit(self, parameter_s =''):
1611 """Time execution of a Python statement or expression
1620 """Time execution of a Python statement or expression
1612
1621
1613 Usage:\\
1622 Usage:\\
1614 %timeit [-n<N> -r<R> [-t|-c]] statement
1623 %timeit [-n<N> -r<R> [-t|-c]] statement
1615
1624
1616 Time execution of a Python statement or expression using the timeit
1625 Time execution of a Python statement or expression using the timeit
1617 module.
1626 module.
1618
1627
1619 Options:
1628 Options:
1620 -n<N>: execute the given statement <N> times in a loop. If this value
1629 -n<N>: execute the given statement <N> times in a loop. If this value
1621 is not given, a fitting value is chosen.
1630 is not given, a fitting value is chosen.
1622
1631
1623 -r<R>: repeat the loop iteration <R> times and take the best result.
1632 -r<R>: repeat the loop iteration <R> times and take the best result.
1624 Default: 3
1633 Default: 3
1625
1634
1626 -t: use time.time to measure the time, which is the default on Unix.
1635 -t: use time.time to measure the time, which is the default on Unix.
1627 This function measures wall time.
1636 This function measures wall time.
1628
1637
1629 -c: use time.clock to measure the time, which is the default on
1638 -c: use time.clock to measure the time, which is the default on
1630 Windows and measures wall time. On Unix, resource.getrusage is used
1639 Windows and measures wall time. On Unix, resource.getrusage is used
1631 instead and returns the CPU user time.
1640 instead and returns the CPU user time.
1632
1641
1633 -p<P>: use a precision of <P> digits to display the timing result.
1642 -p<P>: use a precision of <P> digits to display the timing result.
1634 Default: 3
1643 Default: 3
1635
1644
1636
1645
1637 Examples:\\
1646 Examples:\\
1638 In [1]: %timeit pass
1647 In [1]: %timeit pass
1639 10000000 loops, best of 3: 53.3 ns per loop
1648 10000000 loops, best of 3: 53.3 ns per loop
1640
1649
1641 In [2]: u = None
1650 In [2]: u = None
1642
1651
1643 In [3]: %timeit u is None
1652 In [3]: %timeit u is None
1644 10000000 loops, best of 3: 184 ns per loop
1653 10000000 loops, best of 3: 184 ns per loop
1645
1654
1646 In [4]: %timeit -r 4 u == None
1655 In [4]: %timeit -r 4 u == None
1647 1000000 loops, best of 4: 242 ns per loop
1656 1000000 loops, best of 4: 242 ns per loop
1648
1657
1649 In [5]: import time
1658 In [5]: import time
1650
1659
1651 In [6]: %timeit -n1 time.sleep(2)
1660 In [6]: %timeit -n1 time.sleep(2)
1652 1 loops, best of 3: 2 s per loop
1661 1 loops, best of 3: 2 s per loop
1653
1662
1654
1663
1655 The times reported by %timeit will be slightly higher than those
1664 The times reported by %timeit will be slightly higher than those
1656 reported by the timeit.py script when variables are accessed. This is
1665 reported by the timeit.py script when variables are accessed. This is
1657 due to the fact that %timeit executes the statement in the namespace
1666 due to the fact that %timeit executes the statement in the namespace
1658 of the shell, compared with timeit.py, which uses a single setup
1667 of the shell, compared with timeit.py, which uses a single setup
1659 statement to import function or create variables. Generally, the bias
1668 statement to import function or create variables. Generally, the bias
1660 does not matter as long as results from timeit.py are not mixed with
1669 does not matter as long as results from timeit.py are not mixed with
1661 those from %timeit."""
1670 those from %timeit."""
1662
1671
1663 import timeit
1672 import timeit
1664 import math
1673 import math
1665
1674
1666 units = ["s", "ms", "\xc2\xb5s", "ns"]
1675 units = ["s", "ms", "\xc2\xb5s", "ns"]
1667 scaling = [1, 1e3, 1e6, 1e9]
1676 scaling = [1, 1e3, 1e6, 1e9]
1668
1677
1669 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1678 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1670 posix=False)
1679 posix=False)
1671 if stmt == "":
1680 if stmt == "":
1672 return
1681 return
1673 timefunc = timeit.default_timer
1682 timefunc = timeit.default_timer
1674 number = int(getattr(opts, "n", 0))
1683 number = int(getattr(opts, "n", 0))
1675 repeat = int(getattr(opts, "r", timeit.default_repeat))
1684 repeat = int(getattr(opts, "r", timeit.default_repeat))
1676 precision = int(getattr(opts, "p", 3))
1685 precision = int(getattr(opts, "p", 3))
1677 if hasattr(opts, "t"):
1686 if hasattr(opts, "t"):
1678 timefunc = time.time
1687 timefunc = time.time
1679 if hasattr(opts, "c"):
1688 if hasattr(opts, "c"):
1680 timefunc = clock
1689 timefunc = clock
1681
1690
1682 timer = timeit.Timer(timer=timefunc)
1691 timer = timeit.Timer(timer=timefunc)
1683 # this code has tight coupling to the inner workings of timeit.Timer,
1692 # this code has tight coupling to the inner workings of timeit.Timer,
1684 # but is there a better way to achieve that the code stmt has access
1693 # but is there a better way to achieve that the code stmt has access
1685 # to the shell namespace?
1694 # to the shell namespace?
1686
1695
1687 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1696 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1688 'setup': "pass"}
1697 'setup': "pass"}
1689 code = compile(src, "<magic-timeit>", "exec")
1698 code = compile(src, "<magic-timeit>", "exec")
1690 ns = {}
1699 ns = {}
1691 exec code in self.shell.user_ns, ns
1700 exec code in self.shell.user_ns, ns
1692 timer.inner = ns["inner"]
1701 timer.inner = ns["inner"]
1693
1702
1694 if number == 0:
1703 if number == 0:
1695 # determine number so that 0.2 <= total time < 2.0
1704 # determine number so that 0.2 <= total time < 2.0
1696 number = 1
1705 number = 1
1697 for i in range(1, 10):
1706 for i in range(1, 10):
1698 number *= 10
1707 number *= 10
1699 if timer.timeit(number) >= 0.2:
1708 if timer.timeit(number) >= 0.2:
1700 break
1709 break
1701
1710
1702 best = min(timer.repeat(repeat, number)) / number
1711 best = min(timer.repeat(repeat, number)) / number
1703
1712
1704 if best > 0.0:
1713 if best > 0.0:
1705 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1714 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1706 else:
1715 else:
1707 order = 3
1716 order = 3
1708 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1717 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1709 precision,
1718 precision,
1710 best * scaling[order],
1719 best * scaling[order],
1711 units[order])
1720 units[order])
1712
1721
1713 def magic_time(self,parameter_s = ''):
1722 def magic_time(self,parameter_s = ''):
1714 """Time execution of a Python statement or expression.
1723 """Time execution of a Python statement or expression.
1715
1724
1716 The CPU and wall clock times are printed, and the value of the
1725 The CPU and wall clock times are printed, and the value of the
1717 expression (if any) is returned. Note that under Win32, system time
1726 expression (if any) is returned. Note that under Win32, system time
1718 is always reported as 0, since it can not be measured.
1727 is always reported as 0, since it can not be measured.
1719
1728
1720 This function provides very basic timing functionality. In Python
1729 This function provides very basic timing functionality. In Python
1721 2.3, the timeit module offers more control and sophistication, so this
1730 2.3, the timeit module offers more control and sophistication, so this
1722 could be rewritten to use it (patches welcome).
1731 could be rewritten to use it (patches welcome).
1723
1732
1724 Some examples:
1733 Some examples:
1725
1734
1726 In [1]: time 2**128
1735 In [1]: time 2**128
1727 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1736 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1728 Wall time: 0.00
1737 Wall time: 0.00
1729 Out[1]: 340282366920938463463374607431768211456L
1738 Out[1]: 340282366920938463463374607431768211456L
1730
1739
1731 In [2]: n = 1000000
1740 In [2]: n = 1000000
1732
1741
1733 In [3]: time sum(range(n))
1742 In [3]: time sum(range(n))
1734 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1743 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1735 Wall time: 1.37
1744 Wall time: 1.37
1736 Out[3]: 499999500000L
1745 Out[3]: 499999500000L
1737
1746
1738 In [4]: time print 'hello world'
1747 In [4]: time print 'hello world'
1739 hello world
1748 hello world
1740 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1749 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1741 Wall time: 0.00
1750 Wall time: 0.00
1742 """
1751 """
1743
1752
1744 # fail immediately if the given expression can't be compiled
1753 # fail immediately if the given expression can't be compiled
1745 try:
1754 try:
1746 mode = 'eval'
1755 mode = 'eval'
1747 code = compile(parameter_s,'<timed eval>',mode)
1756 code = compile(parameter_s,'<timed eval>',mode)
1748 except SyntaxError:
1757 except SyntaxError:
1749 mode = 'exec'
1758 mode = 'exec'
1750 code = compile(parameter_s,'<timed exec>',mode)
1759 code = compile(parameter_s,'<timed exec>',mode)
1751 # skew measurement as little as possible
1760 # skew measurement as little as possible
1752 glob = self.shell.user_ns
1761 glob = self.shell.user_ns
1753 clk = clock2
1762 clk = clock2
1754 wtime = time.time
1763 wtime = time.time
1755 # time execution
1764 # time execution
1756 wall_st = wtime()
1765 wall_st = wtime()
1757 if mode=='eval':
1766 if mode=='eval':
1758 st = clk()
1767 st = clk()
1759 out = eval(code,glob)
1768 out = eval(code,glob)
1760 end = clk()
1769 end = clk()
1761 else:
1770 else:
1762 st = clk()
1771 st = clk()
1763 exec code in glob
1772 exec code in glob
1764 end = clk()
1773 end = clk()
1765 out = None
1774 out = None
1766 wall_end = wtime()
1775 wall_end = wtime()
1767 # Compute actual times and report
1776 # Compute actual times and report
1768 wall_time = wall_end-wall_st
1777 wall_time = wall_end-wall_st
1769 cpu_user = end[0]-st[0]
1778 cpu_user = end[0]-st[0]
1770 cpu_sys = end[1]-st[1]
1779 cpu_sys = end[1]-st[1]
1771 cpu_tot = cpu_user+cpu_sys
1780 cpu_tot = cpu_user+cpu_sys
1772 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1781 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1773 (cpu_user,cpu_sys,cpu_tot)
1782 (cpu_user,cpu_sys,cpu_tot)
1774 print "Wall time: %.2f" % wall_time
1783 print "Wall time: %.2f" % wall_time
1775 return out
1784 return out
1776
1785
1777 def magic_macro(self,parameter_s = ''):
1786 def magic_macro(self,parameter_s = ''):
1778 """Define a set of input lines as a macro for future re-execution.
1787 """Define a set of input lines as a macro for future re-execution.
1779
1788
1780 Usage:\\
1789 Usage:\\
1781 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1790 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1782
1791
1783 Options:
1792 Options:
1784
1793
1785 -r: use 'raw' input. By default, the 'processed' history is used,
1794 -r: use 'raw' input. By default, the 'processed' history is used,
1786 so that magics are loaded in their transformed version to valid
1795 so that magics are loaded in their transformed version to valid
1787 Python. If this option is given, the raw input as typed as the
1796 Python. If this option is given, the raw input as typed as the
1788 command line is used instead.
1797 command line is used instead.
1789
1798
1790 This will define a global variable called `name` which is a string
1799 This will define a global variable called `name` which is a string
1791 made of joining the slices and lines you specify (n1,n2,... numbers
1800 made of joining the slices and lines you specify (n1,n2,... numbers
1792 above) from your input history into a single string. This variable
1801 above) from your input history into a single string. This variable
1793 acts like an automatic function which re-executes those lines as if
1802 acts like an automatic function which re-executes those lines as if
1794 you had typed them. You just type 'name' at the prompt and the code
1803 you had typed them. You just type 'name' at the prompt and the code
1795 executes.
1804 executes.
1796
1805
1797 The notation for indicating number ranges is: n1-n2 means 'use line
1806 The notation for indicating number ranges is: n1-n2 means 'use line
1798 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1807 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1799 using the lines numbered 5,6 and 7.
1808 using the lines numbered 5,6 and 7.
1800
1809
1801 Note: as a 'hidden' feature, you can also use traditional python slice
1810 Note: as a 'hidden' feature, you can also use traditional python slice
1802 notation, where N:M means numbers N through M-1.
1811 notation, where N:M means numbers N through M-1.
1803
1812
1804 For example, if your history contains (%hist prints it):
1813 For example, if your history contains (%hist prints it):
1805
1814
1806 44: x=1\\
1815 44: x=1\\
1807 45: y=3\\
1816 45: y=3\\
1808 46: z=x+y\\
1817 46: z=x+y\\
1809 47: print x\\
1818 47: print x\\
1810 48: a=5\\
1819 48: a=5\\
1811 49: print 'x',x,'y',y\\
1820 49: print 'x',x,'y',y\\
1812
1821
1813 you can create a macro with lines 44 through 47 (included) and line 49
1822 you can create a macro with lines 44 through 47 (included) and line 49
1814 called my_macro with:
1823 called my_macro with:
1815
1824
1816 In [51]: %macro my_macro 44-47 49
1825 In [51]: %macro my_macro 44-47 49
1817
1826
1818 Now, typing `my_macro` (without quotes) will re-execute all this code
1827 Now, typing `my_macro` (without quotes) will re-execute all this code
1819 in one pass.
1828 in one pass.
1820
1829
1821 You don't need to give the line-numbers in order, and any given line
1830 You don't need to give the line-numbers in order, and any given line
1822 number can appear multiple times. You can assemble macros with any
1831 number can appear multiple times. You can assemble macros with any
1823 lines from your input history in any order.
1832 lines from your input history in any order.
1824
1833
1825 The macro is a simple object which holds its value in an attribute,
1834 The macro is a simple object which holds its value in an attribute,
1826 but IPython's display system checks for macros and executes them as
1835 but IPython's display system checks for macros and executes them as
1827 code instead of printing them when you type their name.
1836 code instead of printing them when you type their name.
1828
1837
1829 You can view a macro's contents by explicitly printing it with:
1838 You can view a macro's contents by explicitly printing it with:
1830
1839
1831 'print macro_name'.
1840 'print macro_name'.
1832
1841
1833 For one-off cases which DON'T contain magic function calls in them you
1842 For one-off cases which DON'T contain magic function calls in them you
1834 can obtain similar results by explicitly executing slices from your
1843 can obtain similar results by explicitly executing slices from your
1835 input history with:
1844 input history with:
1836
1845
1837 In [60]: exec In[44:48]+In[49]"""
1846 In [60]: exec In[44:48]+In[49]"""
1838
1847
1839 opts,args = self.parse_options(parameter_s,'r',mode='list')
1848 opts,args = self.parse_options(parameter_s,'r',mode='list')
1840 name,ranges = args[0], args[1:]
1849 name,ranges = args[0], args[1:]
1841 #print 'rng',ranges # dbg
1850 #print 'rng',ranges # dbg
1842 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1851 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1843 macro = Macro(lines)
1852 macro = Macro(lines)
1844 self.shell.user_ns.update({name:macro})
1853 self.shell.user_ns.update({name:macro})
1845 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1854 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1846 print 'Macro contents:'
1855 print 'Macro contents:'
1847 print macro,
1856 print macro,
1848
1857
1849 def magic_save(self,parameter_s = ''):
1858 def magic_save(self,parameter_s = ''):
1850 """Save a set of lines to a given filename.
1859 """Save a set of lines to a given filename.
1851
1860
1852 Usage:\\
1861 Usage:\\
1853 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1862 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1854
1863
1855 Options:
1864 Options:
1856
1865
1857 -r: use 'raw' input. By default, the 'processed' history is used,
1866 -r: use 'raw' input. By default, the 'processed' history is used,
1858 so that magics are loaded in their transformed version to valid
1867 so that magics are loaded in their transformed version to valid
1859 Python. If this option is given, the raw input as typed as the
1868 Python. If this option is given, the raw input as typed as the
1860 command line is used instead.
1869 command line is used instead.
1861
1870
1862 This function uses the same syntax as %macro for line extraction, but
1871 This function uses the same syntax as %macro for line extraction, but
1863 instead of creating a macro it saves the resulting string to the
1872 instead of creating a macro it saves the resulting string to the
1864 filename you specify.
1873 filename you specify.
1865
1874
1866 It adds a '.py' extension to the file if you don't do so yourself, and
1875 It adds a '.py' extension to the file if you don't do so yourself, and
1867 it asks for confirmation before overwriting existing files."""
1876 it asks for confirmation before overwriting existing files."""
1868
1877
1869 opts,args = self.parse_options(parameter_s,'r',mode='list')
1878 opts,args = self.parse_options(parameter_s,'r',mode='list')
1870 fname,ranges = args[0], args[1:]
1879 fname,ranges = args[0], args[1:]
1871 if not fname.endswith('.py'):
1880 if not fname.endswith('.py'):
1872 fname += '.py'
1881 fname += '.py'
1873 if os.path.isfile(fname):
1882 if os.path.isfile(fname):
1874 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1883 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1875 if ans.lower() not in ['y','yes']:
1884 if ans.lower() not in ['y','yes']:
1876 print 'Operation cancelled.'
1885 print 'Operation cancelled.'
1877 return
1886 return
1878 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1887 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1879 f = file(fname,'w')
1888 f = file(fname,'w')
1880 f.write(cmds)
1889 f.write(cmds)
1881 f.close()
1890 f.close()
1882 print 'The following commands were written to file `%s`:' % fname
1891 print 'The following commands were written to file `%s`:' % fname
1883 print cmds
1892 print cmds
1884
1893
1885 def _edit_macro(self,mname,macro):
1894 def _edit_macro(self,mname,macro):
1886 """open an editor with the macro data in a file"""
1895 """open an editor with the macro data in a file"""
1887 filename = self.shell.mktempfile(macro.value)
1896 filename = self.shell.mktempfile(macro.value)
1888 self.shell.hooks.editor(filename)
1897 self.shell.hooks.editor(filename)
1889
1898
1890 # and make a new macro object, to replace the old one
1899 # and make a new macro object, to replace the old one
1891 mfile = open(filename)
1900 mfile = open(filename)
1892 mvalue = mfile.read()
1901 mvalue = mfile.read()
1893 mfile.close()
1902 mfile.close()
1894 self.shell.user_ns[mname] = Macro(mvalue)
1903 self.shell.user_ns[mname] = Macro(mvalue)
1895
1904
1896 def magic_ed(self,parameter_s=''):
1905 def magic_ed(self,parameter_s=''):
1897 """Alias to %edit."""
1906 """Alias to %edit."""
1898 return self.magic_edit(parameter_s)
1907 return self.magic_edit(parameter_s)
1899
1908
1900 def magic_edit(self,parameter_s='',last_call=['','']):
1909 def magic_edit(self,parameter_s='',last_call=['','']):
1901 """Bring up an editor and execute the resulting code.
1910 """Bring up an editor and execute the resulting code.
1902
1911
1903 Usage:
1912 Usage:
1904 %edit [options] [args]
1913 %edit [options] [args]
1905
1914
1906 %edit runs IPython's editor hook. The default version of this hook is
1915 %edit runs IPython's editor hook. The default version of this hook is
1907 set to call the __IPYTHON__.rc.editor command. This is read from your
1916 set to call the __IPYTHON__.rc.editor command. This is read from your
1908 environment variable $EDITOR. If this isn't found, it will default to
1917 environment variable $EDITOR. If this isn't found, it will default to
1909 vi under Linux/Unix and to notepad under Windows. See the end of this
1918 vi under Linux/Unix and to notepad under Windows. See the end of this
1910 docstring for how to change the editor hook.
1919 docstring for how to change the editor hook.
1911
1920
1912 You can also set the value of this editor via the command line option
1921 You can also set the value of this editor via the command line option
1913 '-editor' or in your ipythonrc file. This is useful if you wish to use
1922 '-editor' or in your ipythonrc file. This is useful if you wish to use
1914 specifically for IPython an editor different from your typical default
1923 specifically for IPython an editor different from your typical default
1915 (and for Windows users who typically don't set environment variables).
1924 (and for Windows users who typically don't set environment variables).
1916
1925
1917 This command allows you to conveniently edit multi-line code right in
1926 This command allows you to conveniently edit multi-line code right in
1918 your IPython session.
1927 your IPython session.
1919
1928
1920 If called without arguments, %edit opens up an empty editor with a
1929 If called without arguments, %edit opens up an empty editor with a
1921 temporary file and will execute the contents of this file when you
1930 temporary file and will execute the contents of this file when you
1922 close it (don't forget to save it!).
1931 close it (don't forget to save it!).
1923
1932
1924
1933
1925 Options:
1934 Options:
1926
1935
1927 -n <number>: open the editor at a specified line number. By default,
1936 -n <number>: open the editor at a specified line number. By default,
1928 the IPython editor hook uses the unix syntax 'editor +N filename', but
1937 the IPython editor hook uses the unix syntax 'editor +N filename', but
1929 you can configure this by providing your own modified hook if your
1938 you can configure this by providing your own modified hook if your
1930 favorite editor supports line-number specifications with a different
1939 favorite editor supports line-number specifications with a different
1931 syntax.
1940 syntax.
1932
1941
1933 -p: this will call the editor with the same data as the previous time
1942 -p: this will call the editor with the same data as the previous time
1934 it was used, regardless of how long ago (in your current session) it
1943 it was used, regardless of how long ago (in your current session) it
1935 was.
1944 was.
1936
1945
1937 -r: use 'raw' input. This option only applies to input taken from the
1946 -r: use 'raw' input. This option only applies to input taken from the
1938 user's history. By default, the 'processed' history is used, so that
1947 user's history. By default, the 'processed' history is used, so that
1939 magics are loaded in their transformed version to valid Python. If
1948 magics are loaded in their transformed version to valid Python. If
1940 this option is given, the raw input as typed as the command line is
1949 this option is given, the raw input as typed as the command line is
1941 used instead. When you exit the editor, it will be executed by
1950 used instead. When you exit the editor, it will be executed by
1942 IPython's own processor.
1951 IPython's own processor.
1943
1952
1944 -x: do not execute the edited code immediately upon exit. This is
1953 -x: do not execute the edited code immediately upon exit. This is
1945 mainly useful if you are editing programs which need to be called with
1954 mainly useful if you are editing programs which need to be called with
1946 command line arguments, which you can then do using %run.
1955 command line arguments, which you can then do using %run.
1947
1956
1948
1957
1949 Arguments:
1958 Arguments:
1950
1959
1951 If arguments are given, the following possibilites exist:
1960 If arguments are given, the following possibilites exist:
1952
1961
1953 - The arguments are numbers or pairs of colon-separated numbers (like
1962 - The arguments are numbers or pairs of colon-separated numbers (like
1954 1 4:8 9). These are interpreted as lines of previous input to be
1963 1 4:8 9). These are interpreted as lines of previous input to be
1955 loaded into the editor. The syntax is the same of the %macro command.
1964 loaded into the editor. The syntax is the same of the %macro command.
1956
1965
1957 - If the argument doesn't start with a number, it is evaluated as a
1966 - If the argument doesn't start with a number, it is evaluated as a
1958 variable and its contents loaded into the editor. You can thus edit
1967 variable and its contents loaded into the editor. You can thus edit
1959 any string which contains python code (including the result of
1968 any string which contains python code (including the result of
1960 previous edits).
1969 previous edits).
1961
1970
1962 - If the argument is the name of an object (other than a string),
1971 - If the argument is the name of an object (other than a string),
1963 IPython will try to locate the file where it was defined and open the
1972 IPython will try to locate the file where it was defined and open the
1964 editor at the point where it is defined. You can use `%edit function`
1973 editor at the point where it is defined. You can use `%edit function`
1965 to load an editor exactly at the point where 'function' is defined,
1974 to load an editor exactly at the point where 'function' is defined,
1966 edit it and have the file be executed automatically.
1975 edit it and have the file be executed automatically.
1967
1976
1968 If the object is a macro (see %macro for details), this opens up your
1977 If the object is a macro (see %macro for details), this opens up your
1969 specified editor with a temporary file containing the macro's data.
1978 specified editor with a temporary file containing the macro's data.
1970 Upon exit, the macro is reloaded with the contents of the file.
1979 Upon exit, the macro is reloaded with the contents of the file.
1971
1980
1972 Note: opening at an exact line is only supported under Unix, and some
1981 Note: opening at an exact line is only supported under Unix, and some
1973 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1982 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1974 '+NUMBER' parameter necessary for this feature. Good editors like
1983 '+NUMBER' parameter necessary for this feature. Good editors like
1975 (X)Emacs, vi, jed, pico and joe all do.
1984 (X)Emacs, vi, jed, pico and joe all do.
1976
1985
1977 - If the argument is not found as a variable, IPython will look for a
1986 - If the argument is not found as a variable, IPython will look for a
1978 file with that name (adding .py if necessary) and load it into the
1987 file with that name (adding .py if necessary) and load it into the
1979 editor. It will execute its contents with execfile() when you exit,
1988 editor. It will execute its contents with execfile() when you exit,
1980 loading any code in the file into your interactive namespace.
1989 loading any code in the file into your interactive namespace.
1981
1990
1982 After executing your code, %edit will return as output the code you
1991 After executing your code, %edit will return as output the code you
1983 typed in the editor (except when it was an existing file). This way
1992 typed in the editor (except when it was an existing file). This way
1984 you can reload the code in further invocations of %edit as a variable,
1993 you can reload the code in further invocations of %edit as a variable,
1985 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1994 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1986 the output.
1995 the output.
1987
1996
1988 Note that %edit is also available through the alias %ed.
1997 Note that %edit is also available through the alias %ed.
1989
1998
1990 This is an example of creating a simple function inside the editor and
1999 This is an example of creating a simple function inside the editor and
1991 then modifying it. First, start up the editor:
2000 then modifying it. First, start up the editor:
1992
2001
1993 In [1]: ed\\
2002 In [1]: ed\\
1994 Editing... done. Executing edited code...\\
2003 Editing... done. Executing edited code...\\
1995 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2004 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1996
2005
1997 We can then call the function foo():
2006 We can then call the function foo():
1998
2007
1999 In [2]: foo()\\
2008 In [2]: foo()\\
2000 foo() was defined in an editing session
2009 foo() was defined in an editing session
2001
2010
2002 Now we edit foo. IPython automatically loads the editor with the
2011 Now we edit foo. IPython automatically loads the editor with the
2003 (temporary) file where foo() was previously defined:
2012 (temporary) file where foo() was previously defined:
2004
2013
2005 In [3]: ed foo\\
2014 In [3]: ed foo\\
2006 Editing... done. Executing edited code...
2015 Editing... done. Executing edited code...
2007
2016
2008 And if we call foo() again we get the modified version:
2017 And if we call foo() again we get the modified version:
2009
2018
2010 In [4]: foo()\\
2019 In [4]: foo()\\
2011 foo() has now been changed!
2020 foo() has now been changed!
2012
2021
2013 Here is an example of how to edit a code snippet successive
2022 Here is an example of how to edit a code snippet successive
2014 times. First we call the editor:
2023 times. First we call the editor:
2015
2024
2016 In [8]: ed\\
2025 In [8]: ed\\
2017 Editing... done. Executing edited code...\\
2026 Editing... done. Executing edited code...\\
2018 hello\\
2027 hello\\
2019 Out[8]: "print 'hello'\\n"
2028 Out[8]: "print 'hello'\\n"
2020
2029
2021 Now we call it again with the previous output (stored in _):
2030 Now we call it again with the previous output (stored in _):
2022
2031
2023 In [9]: ed _\\
2032 In [9]: ed _\\
2024 Editing... done. Executing edited code...\\
2033 Editing... done. Executing edited code...\\
2025 hello world\\
2034 hello world\\
2026 Out[9]: "print 'hello world'\\n"
2035 Out[9]: "print 'hello world'\\n"
2027
2036
2028 Now we call it with the output #8 (stored in _8, also as Out[8]):
2037 Now we call it with the output #8 (stored in _8, also as Out[8]):
2029
2038
2030 In [10]: ed _8\\
2039 In [10]: ed _8\\
2031 Editing... done. Executing edited code...\\
2040 Editing... done. Executing edited code...\\
2032 hello again\\
2041 hello again\\
2033 Out[10]: "print 'hello again'\\n"
2042 Out[10]: "print 'hello again'\\n"
2034
2043
2035
2044
2036 Changing the default editor hook:
2045 Changing the default editor hook:
2037
2046
2038 If you wish to write your own editor hook, you can put it in a
2047 If you wish to write your own editor hook, you can put it in a
2039 configuration file which you load at startup time. The default hook
2048 configuration file which you load at startup time. The default hook
2040 is defined in the IPython.hooks module, and you can use that as a
2049 is defined in the IPython.hooks module, and you can use that as a
2041 starting example for further modifications. That file also has
2050 starting example for further modifications. That file also has
2042 general instructions on how to set a new hook for use once you've
2051 general instructions on how to set a new hook for use once you've
2043 defined it."""
2052 defined it."""
2044
2053
2045 # FIXME: This function has become a convoluted mess. It needs a
2054 # FIXME: This function has become a convoluted mess. It needs a
2046 # ground-up rewrite with clean, simple logic.
2055 # ground-up rewrite with clean, simple logic.
2047
2056
2048 def make_filename(arg):
2057 def make_filename(arg):
2049 "Make a filename from the given args"
2058 "Make a filename from the given args"
2050 try:
2059 try:
2051 filename = get_py_filename(arg)
2060 filename = get_py_filename(arg)
2052 except IOError:
2061 except IOError:
2053 if args.endswith('.py'):
2062 if args.endswith('.py'):
2054 filename = arg
2063 filename = arg
2055 else:
2064 else:
2056 filename = None
2065 filename = None
2057 return filename
2066 return filename
2058
2067
2059 # custom exceptions
2068 # custom exceptions
2060 class DataIsObject(Exception): pass
2069 class DataIsObject(Exception): pass
2061
2070
2062 opts,args = self.parse_options(parameter_s,'prxn:')
2071 opts,args = self.parse_options(parameter_s,'prxn:')
2063 # Set a few locals from the options for convenience:
2072 # Set a few locals from the options for convenience:
2064 opts_p = opts.has_key('p')
2073 opts_p = opts.has_key('p')
2065 opts_r = opts.has_key('r')
2074 opts_r = opts.has_key('r')
2066
2075
2067 # Default line number value
2076 # Default line number value
2068 lineno = opts.get('n',None)
2077 lineno = opts.get('n',None)
2069
2078
2070 if opts_p:
2079 if opts_p:
2071 args = '_%s' % last_call[0]
2080 args = '_%s' % last_call[0]
2072 if not self.shell.user_ns.has_key(args):
2081 if not self.shell.user_ns.has_key(args):
2073 args = last_call[1]
2082 args = last_call[1]
2074
2083
2075 # use last_call to remember the state of the previous call, but don't
2084 # use last_call to remember the state of the previous call, but don't
2076 # let it be clobbered by successive '-p' calls.
2085 # let it be clobbered by successive '-p' calls.
2077 try:
2086 try:
2078 last_call[0] = self.shell.outputcache.prompt_count
2087 last_call[0] = self.shell.outputcache.prompt_count
2079 if not opts_p:
2088 if not opts_p:
2080 last_call[1] = parameter_s
2089 last_call[1] = parameter_s
2081 except:
2090 except:
2082 pass
2091 pass
2083
2092
2084 # by default this is done with temp files, except when the given
2093 # by default this is done with temp files, except when the given
2085 # arg is a filename
2094 # arg is a filename
2086 use_temp = 1
2095 use_temp = 1
2087
2096
2088 if re.match(r'\d',args):
2097 if re.match(r'\d',args):
2089 # Mode where user specifies ranges of lines, like in %macro.
2098 # Mode where user specifies ranges of lines, like in %macro.
2090 # This means that you can't edit files whose names begin with
2099 # This means that you can't edit files whose names begin with
2091 # numbers this way. Tough.
2100 # numbers this way. Tough.
2092 ranges = args.split()
2101 ranges = args.split()
2093 data = ''.join(self.extract_input_slices(ranges,opts_r))
2102 data = ''.join(self.extract_input_slices(ranges,opts_r))
2094 elif args.endswith('.py'):
2103 elif args.endswith('.py'):
2095 filename = make_filename(args)
2104 filename = make_filename(args)
2096 data = ''
2105 data = ''
2097 use_temp = 0
2106 use_temp = 0
2098 elif args:
2107 elif args:
2099 try:
2108 try:
2100 # Load the parameter given as a variable. If not a string,
2109 # Load the parameter given as a variable. If not a string,
2101 # process it as an object instead (below)
2110 # process it as an object instead (below)
2102
2111
2103 #print '*** args',args,'type',type(args) # dbg
2112 #print '*** args',args,'type',type(args) # dbg
2104 data = eval(args,self.shell.user_ns)
2113 data = eval(args,self.shell.user_ns)
2105 if not type(data) in StringTypes:
2114 if not type(data) in StringTypes:
2106 raise DataIsObject
2115 raise DataIsObject
2107
2116
2108 except (NameError,SyntaxError):
2117 except (NameError,SyntaxError):
2109 # given argument is not a variable, try as a filename
2118 # given argument is not a variable, try as a filename
2110 filename = make_filename(args)
2119 filename = make_filename(args)
2111 if filename is None:
2120 if filename is None:
2112 warn("Argument given (%s) can't be found as a variable "
2121 warn("Argument given (%s) can't be found as a variable "
2113 "or as a filename." % args)
2122 "or as a filename." % args)
2114 return
2123 return
2115
2124
2116 data = ''
2125 data = ''
2117 use_temp = 0
2126 use_temp = 0
2118 except DataIsObject:
2127 except DataIsObject:
2119
2128
2120 # macros have a special edit function
2129 # macros have a special edit function
2121 if isinstance(data,Macro):
2130 if isinstance(data,Macro):
2122 self._edit_macro(args,data)
2131 self._edit_macro(args,data)
2123 return
2132 return
2124
2133
2125 # For objects, try to edit the file where they are defined
2134 # For objects, try to edit the file where they are defined
2126 try:
2135 try:
2127 filename = inspect.getabsfile(data)
2136 filename = inspect.getabsfile(data)
2128 datafile = 1
2137 datafile = 1
2129 except TypeError:
2138 except TypeError:
2130 filename = make_filename(args)
2139 filename = make_filename(args)
2131 datafile = 1
2140 datafile = 1
2132 warn('Could not find file where `%s` is defined.\n'
2141 warn('Could not find file where `%s` is defined.\n'
2133 'Opening a file named `%s`' % (args,filename))
2142 'Opening a file named `%s`' % (args,filename))
2134 # Now, make sure we can actually read the source (if it was in
2143 # Now, make sure we can actually read the source (if it was in
2135 # a temp file it's gone by now).
2144 # a temp file it's gone by now).
2136 if datafile:
2145 if datafile:
2137 try:
2146 try:
2138 if lineno is None:
2147 if lineno is None:
2139 lineno = inspect.getsourcelines(data)[1]
2148 lineno = inspect.getsourcelines(data)[1]
2140 except IOError:
2149 except IOError:
2141 filename = make_filename(args)
2150 filename = make_filename(args)
2142 if filename is None:
2151 if filename is None:
2143 warn('The file `%s` where `%s` was defined cannot '
2152 warn('The file `%s` where `%s` was defined cannot '
2144 'be read.' % (filename,data))
2153 'be read.' % (filename,data))
2145 return
2154 return
2146 use_temp = 0
2155 use_temp = 0
2147 else:
2156 else:
2148 data = ''
2157 data = ''
2149
2158
2150 if use_temp:
2159 if use_temp:
2151 filename = self.shell.mktempfile(data)
2160 filename = self.shell.mktempfile(data)
2152 print 'IPython will make a temporary file named:',filename
2161 print 'IPython will make a temporary file named:',filename
2153
2162
2154 # do actual editing here
2163 # do actual editing here
2155 print 'Editing...',
2164 print 'Editing...',
2156 sys.stdout.flush()
2165 sys.stdout.flush()
2157 self.shell.hooks.editor(filename,lineno)
2166 self.shell.hooks.editor(filename,lineno)
2158 if opts.has_key('x'): # -x prevents actual execution
2167 if opts.has_key('x'): # -x prevents actual execution
2159 print
2168 print
2160 else:
2169 else:
2161 print 'done. Executing edited code...'
2170 print 'done. Executing edited code...'
2162 if opts_r:
2171 if opts_r:
2163 self.shell.runlines(file_read(filename))
2172 self.shell.runlines(file_read(filename))
2164 else:
2173 else:
2165 self.shell.safe_execfile(filename,self.shell.user_ns)
2174 self.shell.safe_execfile(filename,self.shell.user_ns)
2166 if use_temp:
2175 if use_temp:
2167 try:
2176 try:
2168 return open(filename).read()
2177 return open(filename).read()
2169 except IOError,msg:
2178 except IOError,msg:
2170 if msg.filename == filename:
2179 if msg.filename == filename:
2171 warn('File not found. Did you forget to save?')
2180 warn('File not found. Did you forget to save?')
2172 return
2181 return
2173 else:
2182 else:
2174 self.shell.showtraceback()
2183 self.shell.showtraceback()
2175
2184
2176 def magic_xmode(self,parameter_s = ''):
2185 def magic_xmode(self,parameter_s = ''):
2177 """Switch modes for the exception handlers.
2186 """Switch modes for the exception handlers.
2178
2187
2179 Valid modes: Plain, Context and Verbose.
2188 Valid modes: Plain, Context and Verbose.
2180
2189
2181 If called without arguments, acts as a toggle."""
2190 If called without arguments, acts as a toggle."""
2182
2191
2183 def xmode_switch_err(name):
2192 def xmode_switch_err(name):
2184 warn('Error changing %s exception modes.\n%s' %
2193 warn('Error changing %s exception modes.\n%s' %
2185 (name,sys.exc_info()[1]))
2194 (name,sys.exc_info()[1]))
2186
2195
2187 shell = self.shell
2196 shell = self.shell
2188 new_mode = parameter_s.strip().capitalize()
2197 new_mode = parameter_s.strip().capitalize()
2189 try:
2198 try:
2190 shell.InteractiveTB.set_mode(mode=new_mode)
2199 shell.InteractiveTB.set_mode(mode=new_mode)
2191 print 'Exception reporting mode:',shell.InteractiveTB.mode
2200 print 'Exception reporting mode:',shell.InteractiveTB.mode
2192 except:
2201 except:
2193 xmode_switch_err('user')
2202 xmode_switch_err('user')
2194
2203
2195 # threaded shells use a special handler in sys.excepthook
2204 # threaded shells use a special handler in sys.excepthook
2196 if shell.isthreaded:
2205 if shell.isthreaded:
2197 try:
2206 try:
2198 shell.sys_excepthook.set_mode(mode=new_mode)
2207 shell.sys_excepthook.set_mode(mode=new_mode)
2199 except:
2208 except:
2200 xmode_switch_err('threaded')
2209 xmode_switch_err('threaded')
2201
2210
2202 def magic_colors(self,parameter_s = ''):
2211 def magic_colors(self,parameter_s = ''):
2203 """Switch color scheme for prompts, info system and exception handlers.
2212 """Switch color scheme for prompts, info system and exception handlers.
2204
2213
2205 Currently implemented schemes: NoColor, Linux, LightBG.
2214 Currently implemented schemes: NoColor, Linux, LightBG.
2206
2215
2207 Color scheme names are not case-sensitive."""
2216 Color scheme names are not case-sensitive."""
2208
2217
2209 def color_switch_err(name):
2218 def color_switch_err(name):
2210 warn('Error changing %s color schemes.\n%s' %
2219 warn('Error changing %s color schemes.\n%s' %
2211 (name,sys.exc_info()[1]))
2220 (name,sys.exc_info()[1]))
2212
2221
2213
2222
2214 new_scheme = parameter_s.strip()
2223 new_scheme = parameter_s.strip()
2215 if not new_scheme:
2224 if not new_scheme:
2216 print 'You must specify a color scheme.'
2225 print 'You must specify a color scheme.'
2217 return
2226 return
2218 import IPython.rlineimpl as readline
2227 import IPython.rlineimpl as readline
2219 if not readline.have_readline:
2228 if not readline.have_readline:
2220 msg = """\
2229 msg = """\
2221 Proper color support under MS Windows requires the pyreadline library.
2230 Proper color support under MS Windows requires the pyreadline library.
2222 You can find it at:
2231 You can find it at:
2223 http://ipython.scipy.org/moin/PyReadline/Intro
2232 http://ipython.scipy.org/moin/PyReadline/Intro
2224 Gary's readline needs the ctypes module, from:
2233 Gary's readline needs the ctypes module, from:
2225 http://starship.python.net/crew/theller/ctypes
2234 http://starship.python.net/crew/theller/ctypes
2226 (Note that ctypes is already part of Python versions 2.5 and newer).
2235 (Note that ctypes is already part of Python versions 2.5 and newer).
2227
2236
2228 Defaulting color scheme to 'NoColor'"""
2237 Defaulting color scheme to 'NoColor'"""
2229 new_scheme = 'NoColor'
2238 new_scheme = 'NoColor'
2230 warn(msg)
2239 warn(msg)
2231 # local shortcut
2240 # local shortcut
2232 shell = self.shell
2241 shell = self.shell
2233
2242
2234 # Set prompt colors
2243 # Set prompt colors
2235 try:
2244 try:
2236 shell.outputcache.set_colors(new_scheme)
2245 shell.outputcache.set_colors(new_scheme)
2237 except:
2246 except:
2238 color_switch_err('prompt')
2247 color_switch_err('prompt')
2239 else:
2248 else:
2240 shell.rc.colors = \
2249 shell.rc.colors = \
2241 shell.outputcache.color_table.active_scheme_name
2250 shell.outputcache.color_table.active_scheme_name
2242 # Set exception colors
2251 # Set exception colors
2243 try:
2252 try:
2244 shell.InteractiveTB.set_colors(scheme = new_scheme)
2253 shell.InteractiveTB.set_colors(scheme = new_scheme)
2245 shell.SyntaxTB.set_colors(scheme = new_scheme)
2254 shell.SyntaxTB.set_colors(scheme = new_scheme)
2246 except:
2255 except:
2247 color_switch_err('exception')
2256 color_switch_err('exception')
2248
2257
2249 # threaded shells use a verbose traceback in sys.excepthook
2258 # threaded shells use a verbose traceback in sys.excepthook
2250 if shell.isthreaded:
2259 if shell.isthreaded:
2251 try:
2260 try:
2252 shell.sys_excepthook.set_colors(scheme=new_scheme)
2261 shell.sys_excepthook.set_colors(scheme=new_scheme)
2253 except:
2262 except:
2254 color_switch_err('system exception handler')
2263 color_switch_err('system exception handler')
2255
2264
2256 # Set info (for 'object?') colors
2265 # Set info (for 'object?') colors
2257 if shell.rc.color_info:
2266 if shell.rc.color_info:
2258 try:
2267 try:
2259 shell.inspector.set_active_scheme(new_scheme)
2268 shell.inspector.set_active_scheme(new_scheme)
2260 except:
2269 except:
2261 color_switch_err('object inspector')
2270 color_switch_err('object inspector')
2262 else:
2271 else:
2263 shell.inspector.set_active_scheme('NoColor')
2272 shell.inspector.set_active_scheme('NoColor')
2264
2273
2265 def magic_color_info(self,parameter_s = ''):
2274 def magic_color_info(self,parameter_s = ''):
2266 """Toggle color_info.
2275 """Toggle color_info.
2267
2276
2268 The color_info configuration parameter controls whether colors are
2277 The color_info configuration parameter controls whether colors are
2269 used for displaying object details (by things like %psource, %pfile or
2278 used for displaying object details (by things like %psource, %pfile or
2270 the '?' system). This function toggles this value with each call.
2279 the '?' system). This function toggles this value with each call.
2271
2280
2272 Note that unless you have a fairly recent pager (less works better
2281 Note that unless you have a fairly recent pager (less works better
2273 than more) in your system, using colored object information displays
2282 than more) in your system, using colored object information displays
2274 will not work properly. Test it and see."""
2283 will not work properly. Test it and see."""
2275
2284
2276 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2285 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2277 self.magic_colors(self.shell.rc.colors)
2286 self.magic_colors(self.shell.rc.colors)
2278 print 'Object introspection functions have now coloring:',
2287 print 'Object introspection functions have now coloring:',
2279 print ['OFF','ON'][self.shell.rc.color_info]
2288 print ['OFF','ON'][self.shell.rc.color_info]
2280
2289
2281 def magic_Pprint(self, parameter_s=''):
2290 def magic_Pprint(self, parameter_s=''):
2282 """Toggle pretty printing on/off."""
2291 """Toggle pretty printing on/off."""
2283
2292
2284 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2293 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2285 print 'Pretty printing has been turned', \
2294 print 'Pretty printing has been turned', \
2286 ['OFF','ON'][self.shell.rc.pprint]
2295 ['OFF','ON'][self.shell.rc.pprint]
2287
2296
2288 def magic_exit(self, parameter_s=''):
2297 def magic_exit(self, parameter_s=''):
2289 """Exit IPython, confirming if configured to do so.
2298 """Exit IPython, confirming if configured to do so.
2290
2299
2291 You can configure whether IPython asks for confirmation upon exit by
2300 You can configure whether IPython asks for confirmation upon exit by
2292 setting the confirm_exit flag in the ipythonrc file."""
2301 setting the confirm_exit flag in the ipythonrc file."""
2293
2302
2294 self.shell.exit()
2303 self.shell.exit()
2295
2304
2296 def magic_quit(self, parameter_s=''):
2305 def magic_quit(self, parameter_s=''):
2297 """Exit IPython, confirming if configured to do so (like %exit)"""
2306 """Exit IPython, confirming if configured to do so (like %exit)"""
2298
2307
2299 self.shell.exit()
2308 self.shell.exit()
2300
2309
2301 def magic_Exit(self, parameter_s=''):
2310 def magic_Exit(self, parameter_s=''):
2302 """Exit IPython without confirmation."""
2311 """Exit IPython without confirmation."""
2303
2312
2304 self.shell.exit_now = True
2313 self.shell.exit_now = True
2305
2314
2306 def magic_Quit(self, parameter_s=''):
2315 def magic_Quit(self, parameter_s=''):
2307 """Exit IPython without confirmation (like %Exit)."""
2316 """Exit IPython without confirmation (like %Exit)."""
2308
2317
2309 self.shell.exit_now = True
2318 self.shell.exit_now = True
2310
2319
2311 #......................................................................
2320 #......................................................................
2312 # Functions to implement unix shell-type things
2321 # Functions to implement unix shell-type things
2313
2322
2314 def magic_alias(self, parameter_s = ''):
2323 def magic_alias(self, parameter_s = ''):
2315 """Define an alias for a system command.
2324 """Define an alias for a system command.
2316
2325
2317 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2326 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2318
2327
2319 Then, typing 'alias_name params' will execute the system command 'cmd
2328 Then, typing 'alias_name params' will execute the system command 'cmd
2320 params' (from your underlying operating system).
2329 params' (from your underlying operating system).
2321
2330
2322 Aliases have lower precedence than magic functions and Python normal
2331 Aliases have lower precedence than magic functions and Python normal
2323 variables, so if 'foo' is both a Python variable and an alias, the
2332 variables, so if 'foo' is both a Python variable and an alias, the
2324 alias can not be executed until 'del foo' removes the Python variable.
2333 alias can not be executed until 'del foo' removes the Python variable.
2325
2334
2326 You can use the %l specifier in an alias definition to represent the
2335 You can use the %l specifier in an alias definition to represent the
2327 whole line when the alias is called. For example:
2336 whole line when the alias is called. For example:
2328
2337
2329 In [2]: alias all echo "Input in brackets: <%l>"\\
2338 In [2]: alias all echo "Input in brackets: <%l>"\\
2330 In [3]: all hello world\\
2339 In [3]: all hello world\\
2331 Input in brackets: <hello world>
2340 Input in brackets: <hello world>
2332
2341
2333 You can also define aliases with parameters using %s specifiers (one
2342 You can also define aliases with parameters using %s specifiers (one
2334 per parameter):
2343 per parameter):
2335
2344
2336 In [1]: alias parts echo first %s second %s\\
2345 In [1]: alias parts echo first %s second %s\\
2337 In [2]: %parts A B\\
2346 In [2]: %parts A B\\
2338 first A second B\\
2347 first A second B\\
2339 In [3]: %parts A\\
2348 In [3]: %parts A\\
2340 Incorrect number of arguments: 2 expected.\\
2349 Incorrect number of arguments: 2 expected.\\
2341 parts is an alias to: 'echo first %s second %s'
2350 parts is an alias to: 'echo first %s second %s'
2342
2351
2343 Note that %l and %s are mutually exclusive. You can only use one or
2352 Note that %l and %s are mutually exclusive. You can only use one or
2344 the other in your aliases.
2353 the other in your aliases.
2345
2354
2346 Aliases expand Python variables just like system calls using ! or !!
2355 Aliases expand Python variables just like system calls using ! or !!
2347 do: all expressions prefixed with '$' get expanded. For details of
2356 do: all expressions prefixed with '$' get expanded. For details of
2348 the semantic rules, see PEP-215:
2357 the semantic rules, see PEP-215:
2349 http://www.python.org/peps/pep-0215.html. This is the library used by
2358 http://www.python.org/peps/pep-0215.html. This is the library used by
2350 IPython for variable expansion. If you want to access a true shell
2359 IPython for variable expansion. If you want to access a true shell
2351 variable, an extra $ is necessary to prevent its expansion by IPython:
2360 variable, an extra $ is necessary to prevent its expansion by IPython:
2352
2361
2353 In [6]: alias show echo\\
2362 In [6]: alias show echo\\
2354 In [7]: PATH='A Python string'\\
2363 In [7]: PATH='A Python string'\\
2355 In [8]: show $PATH\\
2364 In [8]: show $PATH\\
2356 A Python string\\
2365 A Python string\\
2357 In [9]: show $$PATH\\
2366 In [9]: show $$PATH\\
2358 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2367 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2359
2368
2360 You can use the alias facility to acess all of $PATH. See the %rehash
2369 You can use the alias facility to acess all of $PATH. See the %rehash
2361 and %rehashx functions, which automatically create aliases for the
2370 and %rehashx functions, which automatically create aliases for the
2362 contents of your $PATH.
2371 contents of your $PATH.
2363
2372
2364 If called with no parameters, %alias prints the current alias table."""
2373 If called with no parameters, %alias prints the current alias table."""
2365
2374
2366 par = parameter_s.strip()
2375 par = parameter_s.strip()
2367 if not par:
2376 if not par:
2368 stored = self.db.get('stored_aliases', {} )
2377 stored = self.db.get('stored_aliases', {} )
2369 atab = self.shell.alias_table
2378 atab = self.shell.alias_table
2370 aliases = atab.keys()
2379 aliases = atab.keys()
2371 aliases.sort()
2380 aliases.sort()
2372 res = []
2381 res = []
2373 showlast = []
2382 showlast = []
2374 for alias in aliases:
2383 for alias in aliases:
2375 tgt = atab[alias][1]
2384 tgt = atab[alias][1]
2376 # 'interesting' aliases
2385 # 'interesting' aliases
2377 if (alias in stored or
2386 if (alias in stored or
2378 alias != os.path.splitext(tgt)[0] or
2387 alias != os.path.splitext(tgt)[0] or
2379 ' ' in tgt):
2388 ' ' in tgt):
2380 showlast.append((alias, tgt))
2389 showlast.append((alias, tgt))
2381 else:
2390 else:
2382 res.append((alias, tgt ))
2391 res.append((alias, tgt ))
2383
2392
2384 # show most interesting aliases last
2393 # show most interesting aliases last
2385 res.extend(showlast)
2394 res.extend(showlast)
2386 print "Total number of aliases:",len(aliases)
2395 print "Total number of aliases:",len(aliases)
2387 return res
2396 return res
2388 try:
2397 try:
2389 alias,cmd = par.split(None,1)
2398 alias,cmd = par.split(None,1)
2390 except:
2399 except:
2391 print OInspect.getdoc(self.magic_alias)
2400 print OInspect.getdoc(self.magic_alias)
2392 else:
2401 else:
2393 nargs = cmd.count('%s')
2402 nargs = cmd.count('%s')
2394 if nargs>0 and cmd.find('%l')>=0:
2403 if nargs>0 and cmd.find('%l')>=0:
2395 error('The %s and %l specifiers are mutually exclusive '
2404 error('The %s and %l specifiers are mutually exclusive '
2396 'in alias definitions.')
2405 'in alias definitions.')
2397 else: # all looks OK
2406 else: # all looks OK
2398 self.shell.alias_table[alias] = (nargs,cmd)
2407 self.shell.alias_table[alias] = (nargs,cmd)
2399 self.shell.alias_table_validate(verbose=0)
2408 self.shell.alias_table_validate(verbose=0)
2400 # end magic_alias
2409 # end magic_alias
2401
2410
2402 def magic_unalias(self, parameter_s = ''):
2411 def magic_unalias(self, parameter_s = ''):
2403 """Remove an alias"""
2412 """Remove an alias"""
2404
2413
2405 aname = parameter_s.strip()
2414 aname = parameter_s.strip()
2406 if aname in self.shell.alias_table:
2415 if aname in self.shell.alias_table:
2407 del self.shell.alias_table[aname]
2416 del self.shell.alias_table[aname]
2408 stored = self.db.get('stored_aliases', {} )
2417 stored = self.db.get('stored_aliases', {} )
2409 if aname in stored:
2418 if aname in stored:
2410 print "Removing %stored alias",aname
2419 print "Removing %stored alias",aname
2411 del stored[aname]
2420 del stored[aname]
2412 self.db['stored_aliases'] = stored
2421 self.db['stored_aliases'] = stored
2413
2422
2414 def magic_rehash(self, parameter_s = ''):
2423 def magic_rehash(self, parameter_s = ''):
2415 """Update the alias table with all entries in $PATH.
2424 """Update the alias table with all entries in $PATH.
2416
2425
2417 This version does no checks on execute permissions or whether the
2426 This version does no checks on execute permissions or whether the
2418 contents of $PATH are truly files (instead of directories or something
2427 contents of $PATH are truly files (instead of directories or something
2419 else). For such a safer (but slower) version, use %rehashx."""
2428 else). For such a safer (but slower) version, use %rehashx."""
2420
2429
2421 # This function (and rehashx) manipulate the alias_table directly
2430 # This function (and rehashx) manipulate the alias_table directly
2422 # rather than calling magic_alias, for speed reasons. A rehash on a
2431 # rather than calling magic_alias, for speed reasons. A rehash on a
2423 # typical Linux box involves several thousand entries, so efficiency
2432 # typical Linux box involves several thousand entries, so efficiency
2424 # here is a top concern.
2433 # here is a top concern.
2425
2434
2426 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2435 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2427 alias_table = self.shell.alias_table
2436 alias_table = self.shell.alias_table
2428 for pdir in path:
2437 for pdir in path:
2429 for ff in os.listdir(pdir):
2438 for ff in os.listdir(pdir):
2430 # each entry in the alias table must be (N,name), where
2439 # each entry in the alias table must be (N,name), where
2431 # N is the number of positional arguments of the alias.
2440 # N is the number of positional arguments of the alias.
2432 alias_table[ff] = (0,ff)
2441 alias_table[ff] = (0,ff)
2433 # Make sure the alias table doesn't contain keywords or builtins
2442 # Make sure the alias table doesn't contain keywords or builtins
2434 self.shell.alias_table_validate()
2443 self.shell.alias_table_validate()
2435 # Call again init_auto_alias() so we get 'rm -i' and other modified
2444 # Call again init_auto_alias() so we get 'rm -i' and other modified
2436 # aliases since %rehash will probably clobber them
2445 # aliases since %rehash will probably clobber them
2437 self.shell.init_auto_alias()
2446 self.shell.init_auto_alias()
2438
2447
2439 def magic_rehashx(self, parameter_s = ''):
2448 def magic_rehashx(self, parameter_s = ''):
2440 """Update the alias table with all executable files in $PATH.
2449 """Update the alias table with all executable files in $PATH.
2441
2450
2442 This version explicitly checks that every entry in $PATH is a file
2451 This version explicitly checks that every entry in $PATH is a file
2443 with execute access (os.X_OK), so it is much slower than %rehash.
2452 with execute access (os.X_OK), so it is much slower than %rehash.
2444
2453
2445 Under Windows, it checks executability as a match agains a
2454 Under Windows, it checks executability as a match agains a
2446 '|'-separated string of extensions, stored in the IPython config
2455 '|'-separated string of extensions, stored in the IPython config
2447 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2456 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2448
2457
2449 path = [os.path.abspath(os.path.expanduser(p)) for p in
2458 path = [os.path.abspath(os.path.expanduser(p)) for p in
2450 os.environ['PATH'].split(os.pathsep)]
2459 os.environ['PATH'].split(os.pathsep)]
2451 path = filter(os.path.isdir,path)
2460 path = filter(os.path.isdir,path)
2452
2461
2453 alias_table = self.shell.alias_table
2462 alias_table = self.shell.alias_table
2454 syscmdlist = []
2463 syscmdlist = []
2455 if os.name == 'posix':
2464 if os.name == 'posix':
2456 isexec = lambda fname:os.path.isfile(fname) and \
2465 isexec = lambda fname:os.path.isfile(fname) and \
2457 os.access(fname,os.X_OK)
2466 os.access(fname,os.X_OK)
2458 else:
2467 else:
2459
2468
2460 try:
2469 try:
2461 winext = os.environ['pathext'].replace(';','|').replace('.','')
2470 winext = os.environ['pathext'].replace(';','|').replace('.','')
2462 except KeyError:
2471 except KeyError:
2463 winext = 'exe|com|bat|py'
2472 winext = 'exe|com|bat|py'
2464 if 'py' not in winext:
2473 if 'py' not in winext:
2465 winext += '|py'
2474 winext += '|py'
2466 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2475 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2467 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2476 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2468 savedir = os.getcwd()
2477 savedir = os.getcwd()
2469 try:
2478 try:
2470 # write the whole loop for posix/Windows so we don't have an if in
2479 # write the whole loop for posix/Windows so we don't have an if in
2471 # the innermost part
2480 # the innermost part
2472 if os.name == 'posix':
2481 if os.name == 'posix':
2473 for pdir in path:
2482 for pdir in path:
2474 os.chdir(pdir)
2483 os.chdir(pdir)
2475 for ff in os.listdir(pdir):
2484 for ff in os.listdir(pdir):
2476 if isexec(ff) and ff not in self.shell.no_alias:
2485 if isexec(ff) and ff not in self.shell.no_alias:
2477 # each entry in the alias table must be (N,name),
2486 # each entry in the alias table must be (N,name),
2478 # where N is the number of positional arguments of the
2487 # where N is the number of positional arguments of the
2479 # alias.
2488 # alias.
2480 alias_table[ff] = (0,ff)
2489 alias_table[ff] = (0,ff)
2481 syscmdlist.append(ff)
2490 syscmdlist.append(ff)
2482 else:
2491 else:
2483 for pdir in path:
2492 for pdir in path:
2484 os.chdir(pdir)
2493 os.chdir(pdir)
2485 for ff in os.listdir(pdir):
2494 for ff in os.listdir(pdir):
2486 base, ext = os.path.splitext(ff)
2495 base, ext = os.path.splitext(ff)
2487 if isexec(ff) and base not in self.shell.no_alias:
2496 if isexec(ff) and base not in self.shell.no_alias:
2488 if ext.lower() == '.exe':
2497 if ext.lower() == '.exe':
2489 ff = base
2498 ff = base
2490 alias_table[base] = (0,ff)
2499 alias_table[base] = (0,ff)
2491 syscmdlist.append(ff)
2500 syscmdlist.append(ff)
2492 # Make sure the alias table doesn't contain keywords or builtins
2501 # Make sure the alias table doesn't contain keywords or builtins
2493 self.shell.alias_table_validate()
2502 self.shell.alias_table_validate()
2494 # Call again init_auto_alias() so we get 'rm -i' and other
2503 # Call again init_auto_alias() so we get 'rm -i' and other
2495 # modified aliases since %rehashx will probably clobber them
2504 # modified aliases since %rehashx will probably clobber them
2496 self.shell.init_auto_alias()
2505 self.shell.init_auto_alias()
2497 db = self.getapi().db
2506 db = self.getapi().db
2498 db['syscmdlist'] = syscmdlist
2507 db['syscmdlist'] = syscmdlist
2499 finally:
2508 finally:
2500 os.chdir(savedir)
2509 os.chdir(savedir)
2501
2510
2502 def magic_pwd(self, parameter_s = ''):
2511 def magic_pwd(self, parameter_s = ''):
2503 """Return the current working directory path."""
2512 """Return the current working directory path."""
2504 return os.getcwd()
2513 return os.getcwd()
2505
2514
2506 def magic_cd(self, parameter_s=''):
2515 def magic_cd(self, parameter_s=''):
2507 """Change the current working directory.
2516 """Change the current working directory.
2508
2517
2509 This command automatically maintains an internal list of directories
2518 This command automatically maintains an internal list of directories
2510 you visit during your IPython session, in the variable _dh. The
2519 you visit during your IPython session, in the variable _dh. The
2511 command %dhist shows this history nicely formatted.
2520 command %dhist shows this history nicely formatted.
2512
2521
2513 Usage:
2522 Usage:
2514
2523
2515 cd 'dir': changes to directory 'dir'.
2524 cd 'dir': changes to directory 'dir'.
2516
2525
2517 cd -: changes to the last visited directory.
2526 cd -: changes to the last visited directory.
2518
2527
2519 cd -<n>: changes to the n-th directory in the directory history.
2528 cd -<n>: changes to the n-th directory in the directory history.
2520
2529
2521 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2530 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2522 (note: cd <bookmark_name> is enough if there is no
2531 (note: cd <bookmark_name> is enough if there is no
2523 directory <bookmark_name>, but a bookmark with the name exists.)
2532 directory <bookmark_name>, but a bookmark with the name exists.)
2524
2533
2525 Options:
2534 Options:
2526
2535
2527 -q: quiet. Do not print the working directory after the cd command is
2536 -q: quiet. Do not print the working directory after the cd command is
2528 executed. By default IPython's cd command does print this directory,
2537 executed. By default IPython's cd command does print this directory,
2529 since the default prompts do not display path information.
2538 since the default prompts do not display path information.
2530
2539
2531 Note that !cd doesn't work for this purpose because the shell where
2540 Note that !cd doesn't work for this purpose because the shell where
2532 !command runs is immediately discarded after executing 'command'."""
2541 !command runs is immediately discarded after executing 'command'."""
2533
2542
2534 parameter_s = parameter_s.strip()
2543 parameter_s = parameter_s.strip()
2535 #bkms = self.shell.persist.get("bookmarks",{})
2544 #bkms = self.shell.persist.get("bookmarks",{})
2536
2545
2537 numcd = re.match(r'(-)(\d+)$',parameter_s)
2546 numcd = re.match(r'(-)(\d+)$',parameter_s)
2538 # jump in directory history by number
2547 # jump in directory history by number
2539 if numcd:
2548 if numcd:
2540 nn = int(numcd.group(2))
2549 nn = int(numcd.group(2))
2541 try:
2550 try:
2542 ps = self.shell.user_ns['_dh'][nn]
2551 ps = self.shell.user_ns['_dh'][nn]
2543 except IndexError:
2552 except IndexError:
2544 print 'The requested directory does not exist in history.'
2553 print 'The requested directory does not exist in history.'
2545 return
2554 return
2546 else:
2555 else:
2547 opts = {}
2556 opts = {}
2548 else:
2557 else:
2549 #turn all non-space-escaping backslashes to slashes,
2558 #turn all non-space-escaping backslashes to slashes,
2550 # for c:\windows\directory\names\
2559 # for c:\windows\directory\names\
2551 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2560 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2552 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2561 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2553 # jump to previous
2562 # jump to previous
2554 if ps == '-':
2563 if ps == '-':
2555 try:
2564 try:
2556 ps = self.shell.user_ns['_dh'][-2]
2565 ps = self.shell.user_ns['_dh'][-2]
2557 except IndexError:
2566 except IndexError:
2558 print 'No previous directory to change to.'
2567 print 'No previous directory to change to.'
2559 return
2568 return
2560 # jump to bookmark if needed
2569 # jump to bookmark if needed
2561 else:
2570 else:
2562 if not os.path.isdir(ps) or opts.has_key('b'):
2571 if not os.path.isdir(ps) or opts.has_key('b'):
2563 bkms = self.db.get('bookmarks', {})
2572 bkms = self.db.get('bookmarks', {})
2564
2573
2565 if bkms.has_key(ps):
2574 if bkms.has_key(ps):
2566 target = bkms[ps]
2575 target = bkms[ps]
2567 print '(bookmark:%s) -> %s' % (ps,target)
2576 print '(bookmark:%s) -> %s' % (ps,target)
2568 ps = target
2577 ps = target
2569 else:
2578 else:
2570 if opts.has_key('b'):
2579 if opts.has_key('b'):
2571 error("Bookmark '%s' not found. "
2580 error("Bookmark '%s' not found. "
2572 "Use '%%bookmark -l' to see your bookmarks." % ps)
2581 "Use '%%bookmark -l' to see your bookmarks." % ps)
2573 return
2582 return
2574
2583
2575 # at this point ps should point to the target dir
2584 # at this point ps should point to the target dir
2576 if ps:
2585 if ps:
2577 try:
2586 try:
2578 os.chdir(os.path.expanduser(ps))
2587 os.chdir(os.path.expanduser(ps))
2579 ttitle = ("IPy:" + (
2588 ttitle = ("IPy:" + (
2580 os.getcwd() == '/' and '/' or os.path.basename(os.getcwd())))
2589 os.getcwd() == '/' and '/' or os.path.basename(os.getcwd())))
2581 platutils.set_term_title(ttitle)
2590 platutils.set_term_title(ttitle)
2582 except OSError:
2591 except OSError:
2583 print sys.exc_info()[1]
2592 print sys.exc_info()[1]
2584 else:
2593 else:
2585 self.shell.user_ns['_dh'].append(os.getcwd())
2594 self.shell.user_ns['_dh'].append(os.getcwd())
2586 else:
2595 else:
2587 os.chdir(self.shell.home_dir)
2596 os.chdir(self.shell.home_dir)
2588 platutils.set_term_title("IPy:~")
2597 platutils.set_term_title("IPy:~")
2589 self.shell.user_ns['_dh'].append(os.getcwd())
2598 self.shell.user_ns['_dh'].append(os.getcwd())
2590 if not 'q' in opts:
2599 if not 'q' in opts:
2591 print self.shell.user_ns['_dh'][-1]
2600 print self.shell.user_ns['_dh'][-1]
2592
2601
2593 def magic_dhist(self, parameter_s=''):
2602 def magic_dhist(self, parameter_s=''):
2594 """Print your history of visited directories.
2603 """Print your history of visited directories.
2595
2604
2596 %dhist -> print full history\\
2605 %dhist -> print full history\\
2597 %dhist n -> print last n entries only\\
2606 %dhist n -> print last n entries only\\
2598 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2607 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2599
2608
2600 This history is automatically maintained by the %cd command, and
2609 This history is automatically maintained by the %cd command, and
2601 always available as the global list variable _dh. You can use %cd -<n>
2610 always available as the global list variable _dh. You can use %cd -<n>
2602 to go to directory number <n>."""
2611 to go to directory number <n>."""
2603
2612
2604 dh = self.shell.user_ns['_dh']
2613 dh = self.shell.user_ns['_dh']
2605 if parameter_s:
2614 if parameter_s:
2606 try:
2615 try:
2607 args = map(int,parameter_s.split())
2616 args = map(int,parameter_s.split())
2608 except:
2617 except:
2609 self.arg_err(Magic.magic_dhist)
2618 self.arg_err(Magic.magic_dhist)
2610 return
2619 return
2611 if len(args) == 1:
2620 if len(args) == 1:
2612 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2621 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2613 elif len(args) == 2:
2622 elif len(args) == 2:
2614 ini,fin = args
2623 ini,fin = args
2615 else:
2624 else:
2616 self.arg_err(Magic.magic_dhist)
2625 self.arg_err(Magic.magic_dhist)
2617 return
2626 return
2618 else:
2627 else:
2619 ini,fin = 0,len(dh)
2628 ini,fin = 0,len(dh)
2620 nlprint(dh,
2629 nlprint(dh,
2621 header = 'Directory history (kept in _dh)',
2630 header = 'Directory history (kept in _dh)',
2622 start=ini,stop=fin)
2631 start=ini,stop=fin)
2623
2632
2624 def magic_env(self, parameter_s=''):
2633 def magic_env(self, parameter_s=''):
2625 """List environment variables."""
2634 """List environment variables."""
2626
2635
2627 return os.environ.data
2636 return os.environ.data
2628
2637
2629 def magic_pushd(self, parameter_s=''):
2638 def magic_pushd(self, parameter_s=''):
2630 """Place the current dir on stack and change directory.
2639 """Place the current dir on stack and change directory.
2631
2640
2632 Usage:\\
2641 Usage:\\
2633 %pushd ['dirname']
2642 %pushd ['dirname']
2634
2643
2635 %pushd with no arguments does a %pushd to your home directory.
2644 %pushd with no arguments does a %pushd to your home directory.
2636 """
2645 """
2637 if parameter_s == '': parameter_s = '~'
2646 if parameter_s == '': parameter_s = '~'
2638 dir_s = self.shell.dir_stack
2647 dir_s = self.shell.dir_stack
2639 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2648 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2640 os.path.expanduser(self.shell.dir_stack[0]):
2649 os.path.expanduser(self.shell.dir_stack[0]):
2641 try:
2650 try:
2642 self.magic_cd(parameter_s)
2651 self.magic_cd(parameter_s)
2643 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2652 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2644 self.magic_dirs()
2653 self.magic_dirs()
2645 except:
2654 except:
2646 print 'Invalid directory'
2655 print 'Invalid directory'
2647 else:
2656 else:
2648 print 'You are already there!'
2657 print 'You are already there!'
2649
2658
2650 def magic_popd(self, parameter_s=''):
2659 def magic_popd(self, parameter_s=''):
2651 """Change to directory popped off the top of the stack.
2660 """Change to directory popped off the top of the stack.
2652 """
2661 """
2653 if len (self.shell.dir_stack) > 1:
2662 if len (self.shell.dir_stack) > 1:
2654 self.shell.dir_stack.pop(0)
2663 self.shell.dir_stack.pop(0)
2655 self.magic_cd(self.shell.dir_stack[0])
2664 self.magic_cd(self.shell.dir_stack[0])
2656 print self.shell.dir_stack[0]
2665 print self.shell.dir_stack[0]
2657 else:
2666 else:
2658 print "You can't remove the starting directory from the stack:",\
2667 print "You can't remove the starting directory from the stack:",\
2659 self.shell.dir_stack
2668 self.shell.dir_stack
2660
2669
2661 def magic_dirs(self, parameter_s=''):
2670 def magic_dirs(self, parameter_s=''):
2662 """Return the current directory stack."""
2671 """Return the current directory stack."""
2663
2672
2664 return self.shell.dir_stack[:]
2673 return self.shell.dir_stack[:]
2665
2674
2666 def magic_sc(self, parameter_s=''):
2675 def magic_sc(self, parameter_s=''):
2667 """Shell capture - execute a shell command and capture its output.
2676 """Shell capture - execute a shell command and capture its output.
2668
2677
2669 DEPRECATED. Suboptimal, retained for backwards compatibility.
2678 DEPRECATED. Suboptimal, retained for backwards compatibility.
2670
2679
2671 You should use the form 'var = !command' instead. Example:
2680 You should use the form 'var = !command' instead. Example:
2672
2681
2673 "%sc -l myfiles = ls ~" should now be written as
2682 "%sc -l myfiles = ls ~" should now be written as
2674
2683
2675 "myfiles = !ls ~"
2684 "myfiles = !ls ~"
2676
2685
2677 myfiles.s, myfiles.l and myfiles.n still apply as documented
2686 myfiles.s, myfiles.l and myfiles.n still apply as documented
2678 below.
2687 below.
2679
2688
2680 --
2689 --
2681 %sc [options] varname=command
2690 %sc [options] varname=command
2682
2691
2683 IPython will run the given command using commands.getoutput(), and
2692 IPython will run the given command using commands.getoutput(), and
2684 will then update the user's interactive namespace with a variable
2693 will then update the user's interactive namespace with a variable
2685 called varname, containing the value of the call. Your command can
2694 called varname, containing the value of the call. Your command can
2686 contain shell wildcards, pipes, etc.
2695 contain shell wildcards, pipes, etc.
2687
2696
2688 The '=' sign in the syntax is mandatory, and the variable name you
2697 The '=' sign in the syntax is mandatory, and the variable name you
2689 supply must follow Python's standard conventions for valid names.
2698 supply must follow Python's standard conventions for valid names.
2690
2699
2691 (A special format without variable name exists for internal use)
2700 (A special format without variable name exists for internal use)
2692
2701
2693 Options:
2702 Options:
2694
2703
2695 -l: list output. Split the output on newlines into a list before
2704 -l: list output. Split the output on newlines into a list before
2696 assigning it to the given variable. By default the output is stored
2705 assigning it to the given variable. By default the output is stored
2697 as a single string.
2706 as a single string.
2698
2707
2699 -v: verbose. Print the contents of the variable.
2708 -v: verbose. Print the contents of the variable.
2700
2709
2701 In most cases you should not need to split as a list, because the
2710 In most cases you should not need to split as a list, because the
2702 returned value is a special type of string which can automatically
2711 returned value is a special type of string which can automatically
2703 provide its contents either as a list (split on newlines) or as a
2712 provide its contents either as a list (split on newlines) or as a
2704 space-separated string. These are convenient, respectively, either
2713 space-separated string. These are convenient, respectively, either
2705 for sequential processing or to be passed to a shell command.
2714 for sequential processing or to be passed to a shell command.
2706
2715
2707 For example:
2716 For example:
2708
2717
2709 # Capture into variable a
2718 # Capture into variable a
2710 In [9]: sc a=ls *py
2719 In [9]: sc a=ls *py
2711
2720
2712 # a is a string with embedded newlines
2721 # a is a string with embedded newlines
2713 In [10]: a
2722 In [10]: a
2714 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2723 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2715
2724
2716 # which can be seen as a list:
2725 # which can be seen as a list:
2717 In [11]: a.l
2726 In [11]: a.l
2718 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2727 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2719
2728
2720 # or as a whitespace-separated string:
2729 # or as a whitespace-separated string:
2721 In [12]: a.s
2730 In [12]: a.s
2722 Out[12]: 'setup.py win32_manual_post_install.py'
2731 Out[12]: 'setup.py win32_manual_post_install.py'
2723
2732
2724 # a.s is useful to pass as a single command line:
2733 # a.s is useful to pass as a single command line:
2725 In [13]: !wc -l $a.s
2734 In [13]: !wc -l $a.s
2726 146 setup.py
2735 146 setup.py
2727 130 win32_manual_post_install.py
2736 130 win32_manual_post_install.py
2728 276 total
2737 276 total
2729
2738
2730 # while the list form is useful to loop over:
2739 # while the list form is useful to loop over:
2731 In [14]: for f in a.l:
2740 In [14]: for f in a.l:
2732 ....: !wc -l $f
2741 ....: !wc -l $f
2733 ....:
2742 ....:
2734 146 setup.py
2743 146 setup.py
2735 130 win32_manual_post_install.py
2744 130 win32_manual_post_install.py
2736
2745
2737 Similiarly, the lists returned by the -l option are also special, in
2746 Similiarly, the lists returned by the -l option are also special, in
2738 the sense that you can equally invoke the .s attribute on them to
2747 the sense that you can equally invoke the .s attribute on them to
2739 automatically get a whitespace-separated string from their contents:
2748 automatically get a whitespace-separated string from their contents:
2740
2749
2741 In [1]: sc -l b=ls *py
2750 In [1]: sc -l b=ls *py
2742
2751
2743 In [2]: b
2752 In [2]: b
2744 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2753 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2745
2754
2746 In [3]: b.s
2755 In [3]: b.s
2747 Out[3]: 'setup.py win32_manual_post_install.py'
2756 Out[3]: 'setup.py win32_manual_post_install.py'
2748
2757
2749 In summary, both the lists and strings used for ouptut capture have
2758 In summary, both the lists and strings used for ouptut capture have
2750 the following special attributes:
2759 the following special attributes:
2751
2760
2752 .l (or .list) : value as list.
2761 .l (or .list) : value as list.
2753 .n (or .nlstr): value as newline-separated string.
2762 .n (or .nlstr): value as newline-separated string.
2754 .s (or .spstr): value as space-separated string.
2763 .s (or .spstr): value as space-separated string.
2755 """
2764 """
2756
2765
2757 opts,args = self.parse_options(parameter_s,'lv')
2766 opts,args = self.parse_options(parameter_s,'lv')
2758 # Try to get a variable name and command to run
2767 # Try to get a variable name and command to run
2759 try:
2768 try:
2760 # the variable name must be obtained from the parse_options
2769 # the variable name must be obtained from the parse_options
2761 # output, which uses shlex.split to strip options out.
2770 # output, which uses shlex.split to strip options out.
2762 var,_ = args.split('=',1)
2771 var,_ = args.split('=',1)
2763 var = var.strip()
2772 var = var.strip()
2764 # But the the command has to be extracted from the original input
2773 # But the the command has to be extracted from the original input
2765 # parameter_s, not on what parse_options returns, to avoid the
2774 # parameter_s, not on what parse_options returns, to avoid the
2766 # quote stripping which shlex.split performs on it.
2775 # quote stripping which shlex.split performs on it.
2767 _,cmd = parameter_s.split('=',1)
2776 _,cmd = parameter_s.split('=',1)
2768 except ValueError:
2777 except ValueError:
2769 var,cmd = '',''
2778 var,cmd = '',''
2770 # If all looks ok, proceed
2779 # If all looks ok, proceed
2771 out,err = self.shell.getoutputerror(cmd)
2780 out,err = self.shell.getoutputerror(cmd)
2772 if err:
2781 if err:
2773 print >> Term.cerr,err
2782 print >> Term.cerr,err
2774 if opts.has_key('l'):
2783 if opts.has_key('l'):
2775 out = SList(out.split('\n'))
2784 out = SList(out.split('\n'))
2776 else:
2785 else:
2777 out = LSString(out)
2786 out = LSString(out)
2778 if opts.has_key('v'):
2787 if opts.has_key('v'):
2779 print '%s ==\n%s' % (var,pformat(out))
2788 print '%s ==\n%s' % (var,pformat(out))
2780 if var:
2789 if var:
2781 self.shell.user_ns.update({var:out})
2790 self.shell.user_ns.update({var:out})
2782 else:
2791 else:
2783 return out
2792 return out
2784
2793
2785 def magic_sx(self, parameter_s=''):
2794 def magic_sx(self, parameter_s=''):
2786 """Shell execute - run a shell command and capture its output.
2795 """Shell execute - run a shell command and capture its output.
2787
2796
2788 %sx command
2797 %sx command
2789
2798
2790 IPython will run the given command using commands.getoutput(), and
2799 IPython will run the given command using commands.getoutput(), and
2791 return the result formatted as a list (split on '\\n'). Since the
2800 return the result formatted as a list (split on '\\n'). Since the
2792 output is _returned_, it will be stored in ipython's regular output
2801 output is _returned_, it will be stored in ipython's regular output
2793 cache Out[N] and in the '_N' automatic variables.
2802 cache Out[N] and in the '_N' automatic variables.
2794
2803
2795 Notes:
2804 Notes:
2796
2805
2797 1) If an input line begins with '!!', then %sx is automatically
2806 1) If an input line begins with '!!', then %sx is automatically
2798 invoked. That is, while:
2807 invoked. That is, while:
2799 !ls
2808 !ls
2800 causes ipython to simply issue system('ls'), typing
2809 causes ipython to simply issue system('ls'), typing
2801 !!ls
2810 !!ls
2802 is a shorthand equivalent to:
2811 is a shorthand equivalent to:
2803 %sx ls
2812 %sx ls
2804
2813
2805 2) %sx differs from %sc in that %sx automatically splits into a list,
2814 2) %sx differs from %sc in that %sx automatically splits into a list,
2806 like '%sc -l'. The reason for this is to make it as easy as possible
2815 like '%sc -l'. The reason for this is to make it as easy as possible
2807 to process line-oriented shell output via further python commands.
2816 to process line-oriented shell output via further python commands.
2808 %sc is meant to provide much finer control, but requires more
2817 %sc is meant to provide much finer control, but requires more
2809 typing.
2818 typing.
2810
2819
2811 3) Just like %sc -l, this is a list with special attributes:
2820 3) Just like %sc -l, this is a list with special attributes:
2812
2821
2813 .l (or .list) : value as list.
2822 .l (or .list) : value as list.
2814 .n (or .nlstr): value as newline-separated string.
2823 .n (or .nlstr): value as newline-separated string.
2815 .s (or .spstr): value as whitespace-separated string.
2824 .s (or .spstr): value as whitespace-separated string.
2816
2825
2817 This is very useful when trying to use such lists as arguments to
2826 This is very useful when trying to use such lists as arguments to
2818 system commands."""
2827 system commands."""
2819
2828
2820 if parameter_s:
2829 if parameter_s:
2821 out,err = self.shell.getoutputerror(parameter_s)
2830 out,err = self.shell.getoutputerror(parameter_s)
2822 if err:
2831 if err:
2823 print >> Term.cerr,err
2832 print >> Term.cerr,err
2824 return SList(out.split('\n'))
2833 return SList(out.split('\n'))
2825
2834
2826 def magic_bg(self, parameter_s=''):
2835 def magic_bg(self, parameter_s=''):
2827 """Run a job in the background, in a separate thread.
2836 """Run a job in the background, in a separate thread.
2828
2837
2829 For example,
2838 For example,
2830
2839
2831 %bg myfunc(x,y,z=1)
2840 %bg myfunc(x,y,z=1)
2832
2841
2833 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2842 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2834 execution starts, a message will be printed indicating the job
2843 execution starts, a message will be printed indicating the job
2835 number. If your job number is 5, you can use
2844 number. If your job number is 5, you can use
2836
2845
2837 myvar = jobs.result(5) or myvar = jobs[5].result
2846 myvar = jobs.result(5) or myvar = jobs[5].result
2838
2847
2839 to assign this result to variable 'myvar'.
2848 to assign this result to variable 'myvar'.
2840
2849
2841 IPython has a job manager, accessible via the 'jobs' object. You can
2850 IPython has a job manager, accessible via the 'jobs' object. You can
2842 type jobs? to get more information about it, and use jobs.<TAB> to see
2851 type jobs? to get more information about it, and use jobs.<TAB> to see
2843 its attributes. All attributes not starting with an underscore are
2852 its attributes. All attributes not starting with an underscore are
2844 meant for public use.
2853 meant for public use.
2845
2854
2846 In particular, look at the jobs.new() method, which is used to create
2855 In particular, look at the jobs.new() method, which is used to create
2847 new jobs. This magic %bg function is just a convenience wrapper
2856 new jobs. This magic %bg function is just a convenience wrapper
2848 around jobs.new(), for expression-based jobs. If you want to create a
2857 around jobs.new(), for expression-based jobs. If you want to create a
2849 new job with an explicit function object and arguments, you must call
2858 new job with an explicit function object and arguments, you must call
2850 jobs.new() directly.
2859 jobs.new() directly.
2851
2860
2852 The jobs.new docstring also describes in detail several important
2861 The jobs.new docstring also describes in detail several important
2853 caveats associated with a thread-based model for background job
2862 caveats associated with a thread-based model for background job
2854 execution. Type jobs.new? for details.
2863 execution. Type jobs.new? for details.
2855
2864
2856 You can check the status of all jobs with jobs.status().
2865 You can check the status of all jobs with jobs.status().
2857
2866
2858 The jobs variable is set by IPython into the Python builtin namespace.
2867 The jobs variable is set by IPython into the Python builtin namespace.
2859 If you ever declare a variable named 'jobs', you will shadow this
2868 If you ever declare a variable named 'jobs', you will shadow this
2860 name. You can either delete your global jobs variable to regain
2869 name. You can either delete your global jobs variable to regain
2861 access to the job manager, or make a new name and assign it manually
2870 access to the job manager, or make a new name and assign it manually
2862 to the manager (stored in IPython's namespace). For example, to
2871 to the manager (stored in IPython's namespace). For example, to
2863 assign the job manager to the Jobs name, use:
2872 assign the job manager to the Jobs name, use:
2864
2873
2865 Jobs = __builtins__.jobs"""
2874 Jobs = __builtins__.jobs"""
2866
2875
2867 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2876 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2868
2877
2869
2878
2870 def magic_bookmark(self, parameter_s=''):
2879 def magic_bookmark(self, parameter_s=''):
2871 """Manage IPython's bookmark system.
2880 """Manage IPython's bookmark system.
2872
2881
2873 %bookmark <name> - set bookmark to current dir
2882 %bookmark <name> - set bookmark to current dir
2874 %bookmark <name> <dir> - set bookmark to <dir>
2883 %bookmark <name> <dir> - set bookmark to <dir>
2875 %bookmark -l - list all bookmarks
2884 %bookmark -l - list all bookmarks
2876 %bookmark -d <name> - remove bookmark
2885 %bookmark -d <name> - remove bookmark
2877 %bookmark -r - remove all bookmarks
2886 %bookmark -r - remove all bookmarks
2878
2887
2879 You can later on access a bookmarked folder with:
2888 You can later on access a bookmarked folder with:
2880 %cd -b <name>
2889 %cd -b <name>
2881 or simply '%cd <name>' if there is no directory called <name> AND
2890 or simply '%cd <name>' if there is no directory called <name> AND
2882 there is such a bookmark defined.
2891 there is such a bookmark defined.
2883
2892
2884 Your bookmarks persist through IPython sessions, but they are
2893 Your bookmarks persist through IPython sessions, but they are
2885 associated with each profile."""
2894 associated with each profile."""
2886
2895
2887 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2896 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2888 if len(args) > 2:
2897 if len(args) > 2:
2889 error('You can only give at most two arguments')
2898 error('You can only give at most two arguments')
2890 return
2899 return
2891
2900
2892 bkms = self.db.get('bookmarks',{})
2901 bkms = self.db.get('bookmarks',{})
2893
2902
2894 if opts.has_key('d'):
2903 if opts.has_key('d'):
2895 try:
2904 try:
2896 todel = args[0]
2905 todel = args[0]
2897 except IndexError:
2906 except IndexError:
2898 error('You must provide a bookmark to delete')
2907 error('You must provide a bookmark to delete')
2899 else:
2908 else:
2900 try:
2909 try:
2901 del bkms[todel]
2910 del bkms[todel]
2902 except:
2911 except:
2903 error("Can't delete bookmark '%s'" % todel)
2912 error("Can't delete bookmark '%s'" % todel)
2904 elif opts.has_key('r'):
2913 elif opts.has_key('r'):
2905 bkms = {}
2914 bkms = {}
2906 elif opts.has_key('l'):
2915 elif opts.has_key('l'):
2907 bks = bkms.keys()
2916 bks = bkms.keys()
2908 bks.sort()
2917 bks.sort()
2909 if bks:
2918 if bks:
2910 size = max(map(len,bks))
2919 size = max(map(len,bks))
2911 else:
2920 else:
2912 size = 0
2921 size = 0
2913 fmt = '%-'+str(size)+'s -> %s'
2922 fmt = '%-'+str(size)+'s -> %s'
2914 print 'Current bookmarks:'
2923 print 'Current bookmarks:'
2915 for bk in bks:
2924 for bk in bks:
2916 print fmt % (bk,bkms[bk])
2925 print fmt % (bk,bkms[bk])
2917 else:
2926 else:
2918 if not args:
2927 if not args:
2919 error("You must specify the bookmark name")
2928 error("You must specify the bookmark name")
2920 elif len(args)==1:
2929 elif len(args)==1:
2921 bkms[args[0]] = os.getcwd()
2930 bkms[args[0]] = os.getcwd()
2922 elif len(args)==2:
2931 elif len(args)==2:
2923 bkms[args[0]] = args[1]
2932 bkms[args[0]] = args[1]
2924 self.db['bookmarks'] = bkms
2933 self.db['bookmarks'] = bkms
2925
2934
2926 def magic_pycat(self, parameter_s=''):
2935 def magic_pycat(self, parameter_s=''):
2927 """Show a syntax-highlighted file through a pager.
2936 """Show a syntax-highlighted file through a pager.
2928
2937
2929 This magic is similar to the cat utility, but it will assume the file
2938 This magic is similar to the cat utility, but it will assume the file
2930 to be Python source and will show it with syntax highlighting. """
2939 to be Python source and will show it with syntax highlighting. """
2931
2940
2932 try:
2941 try:
2933 filename = get_py_filename(parameter_s)
2942 filename = get_py_filename(parameter_s)
2934 cont = file_read(filename)
2943 cont = file_read(filename)
2935 except IOError:
2944 except IOError:
2936 try:
2945 try:
2937 cont = eval(parameter_s,self.user_ns)
2946 cont = eval(parameter_s,self.user_ns)
2938 except NameError:
2947 except NameError:
2939 cont = None
2948 cont = None
2940 if cont is None:
2949 if cont is None:
2941 print "Error: no such file or variable"
2950 print "Error: no such file or variable"
2942 return
2951 return
2943
2952
2944 page(self.shell.pycolorize(cont),
2953 page(self.shell.pycolorize(cont),
2945 screen_lines=self.shell.rc.screen_length)
2954 screen_lines=self.shell.rc.screen_length)
2946
2955
2947 def magic_cpaste(self, parameter_s=''):
2956 def magic_cpaste(self, parameter_s=''):
2948 """Allows you to paste & execute a pre-formatted code block from clipboard
2957 """Allows you to paste & execute a pre-formatted code block from clipboard
2949
2958
2950 You must terminate the block with '--' (two minus-signs) alone on the
2959 You must terminate the block with '--' (two minus-signs) alone on the
2951 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2960 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2952 is the new sentinel for this operation)
2961 is the new sentinel for this operation)
2953
2962
2954 The block is dedented prior to execution to enable execution of
2963 The block is dedented prior to execution to enable execution of
2955 method definitions. '>' characters at the beginning of a line is
2964 method definitions. '>' characters at the beginning of a line is
2956 ignored, to allow pasting directly from e-mails. The executed block
2965 ignored, to allow pasting directly from e-mails. The executed block
2957 is also assigned to variable named 'pasted_block' for later editing
2966 is also assigned to variable named 'pasted_block' for later editing
2958 with '%edit pasted_block'.
2967 with '%edit pasted_block'.
2959
2968
2960 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
2969 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
2961 This assigns the pasted block to variable 'foo' as string, without
2970 This assigns the pasted block to variable 'foo' as string, without
2962 dedenting or executing it.
2971 dedenting or executing it.
2963
2972
2964 Do not be alarmed by garbled output on Windows (it's a readline bug).
2973 Do not be alarmed by garbled output on Windows (it's a readline bug).
2965 Just press enter and type -- (and press enter again) and the block
2974 Just press enter and type -- (and press enter again) and the block
2966 will be what was just pasted.
2975 will be what was just pasted.
2967
2976
2968 IPython statements (magics, shell escapes) are not supported (yet).
2977 IPython statements (magics, shell escapes) are not supported (yet).
2969 """
2978 """
2970 opts,args = self.parse_options(parameter_s,'s:',mode='string')
2979 opts,args = self.parse_options(parameter_s,'s:',mode='string')
2971 par = args.strip()
2980 par = args.strip()
2972 sentinel = opts.get('s','--')
2981 sentinel = opts.get('s','--')
2973
2982
2974 from IPython import iplib
2983 from IPython import iplib
2975 lines = []
2984 lines = []
2976 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
2985 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
2977 while 1:
2986 while 1:
2978 l = iplib.raw_input_original(':')
2987 l = iplib.raw_input_original(':')
2979 if l ==sentinel:
2988 if l ==sentinel:
2980 break
2989 break
2981 lines.append(l.lstrip('>'))
2990 lines.append(l.lstrip('>'))
2982 block = "\n".join(lines) + '\n'
2991 block = "\n".join(lines) + '\n'
2983 #print "block:\n",block
2992 #print "block:\n",block
2984 if not par:
2993 if not par:
2985 b = textwrap.dedent(block)
2994 b = textwrap.dedent(block)
2986 exec b in self.user_ns
2995 exec b in self.user_ns
2987 self.user_ns['pasted_block'] = b
2996 self.user_ns['pasted_block'] = b
2988 else:
2997 else:
2989 self.user_ns[par] = block
2998 self.user_ns[par] = block
2990 print "Block assigned to '%s'" % par
2999 print "Block assigned to '%s'" % par
2991
3000
2992 def magic_quickref(self,arg):
3001 def magic_quickref(self,arg):
2993 """ Show a quick reference sheet """
3002 """ Show a quick reference sheet """
2994 import IPython.usage
3003 import IPython.usage
2995 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3004 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
2996
3005
2997 page(qr)
3006 page(qr)
2998
3007
2999 def magic_upgrade(self,arg):
3008 def magic_upgrade(self,arg):
3000 """ Upgrade your IPython installation
3009 """ Upgrade your IPython installation
3001
3010
3002 This will copy the config files that don't yet exist in your
3011 This will copy the config files that don't yet exist in your
3003 ipython dir from the system config dir. Use this after upgrading
3012 ipython dir from the system config dir. Use this after upgrading
3004 IPython if you don't wish to delete your .ipython dir.
3013 IPython if you don't wish to delete your .ipython dir.
3005
3014
3006 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3015 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3007 new users)
3016 new users)
3008
3017
3009 """
3018 """
3010 ip = self.getapi()
3019 ip = self.getapi()
3011 ipinstallation = path(IPython.__file__).dirname()
3020 ipinstallation = path(IPython.__file__).dirname()
3012 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3021 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3013 src_config = ipinstallation / 'UserConfig'
3022 src_config = ipinstallation / 'UserConfig'
3014 userdir = path(ip.options.ipythondir)
3023 userdir = path(ip.options.ipythondir)
3015 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3024 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3016 print ">",cmd
3025 print ">",cmd
3017 shell(cmd)
3026 shell(cmd)
3018 if arg == '-nolegacy':
3027 if arg == '-nolegacy':
3019 legacy = userdir.files('ipythonrc*')
3028 legacy = userdir.files('ipythonrc*')
3020 print "Nuking legacy files:",legacy
3029 print "Nuking legacy files:",legacy
3021
3030
3022 [p.remove() for p in legacy]
3031 [p.remove() for p in legacy]
3023 suffix = (sys.platform == 'win32' and '.ini' or '')
3032 suffix = (sys.platform == 'win32' and '.ini' or '')
3024 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3033 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3025
3034
3026
3035
3027 # end Magic
3036 # end Magic
@@ -1,6014 +1,6016 b''
1 2006-11-26 Ville Vainio <vivainio@gmail.com>
1 2006-11-26 Ville Vainio <vivainio@gmail.com>
2
2
3 * Remove ipconfig and %config; you should use _ip.options structure
3 * Remove ipconfig and %config; you should use _ip.options structure
4 directly instead!
4 directly instead!
5
5
6 * genutils.py: add wrap_deprecated function for deprecating callables
6 * genutils.py: add wrap_deprecated function for deprecating callables
7
7
8 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
8 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
9 _ip.system instead. ipalias is redundant.
9 _ip.system instead. ipalias is redundant.
10
10
11 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
11 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
12 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
12 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
13 explicit.
13 explicit.
14
14
15 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
15 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
16 completer. Try it by entering 'hg ' and pressing tab.
16 completer. Try it by entering 'hg ' and pressing tab.
17
17
18 * macro.py: Give Macro a useful __repr__ method
18 * macro.py: Give Macro a useful __repr__ method
19
19
20 * Magic.py: %whos abbreviates the typename of Macro for brevity.
21
20 2006-11-24 Walter Doerwald <walter@livinglogic.de>
22 2006-11-24 Walter Doerwald <walter@livinglogic.de>
21 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
23 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
22 we don't get a duplicate ipipe module, where registration of the xrepr
24 we don't get a duplicate ipipe module, where registration of the xrepr
23 implementation for Text is useless.
25 implementation for Text is useless.
24
26
25 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
27 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
26
28
27 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
29 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
28
30
29 2006-11-24 Ville Vainio <vivainio@gmail.com>
31 2006-11-24 Ville Vainio <vivainio@gmail.com>
30
32
31 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
33 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
32 try to use "cProfile" instead of the slower pure python
34 try to use "cProfile" instead of the slower pure python
33 "profile"
35 "profile"
34
36
35 2006-11-23 Ville Vainio <vivainio@gmail.com>
37 2006-11-23 Ville Vainio <vivainio@gmail.com>
36
38
37 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
39 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
38 Qt+IPython+Designer link in documentation.
40 Qt+IPython+Designer link in documentation.
39
41
40 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
42 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
41 correct Pdb object to %pydb.
43 correct Pdb object to %pydb.
42
44
43
45
44 2006-11-22 Walter Doerwald <walter@livinglogic.de>
46 2006-11-22 Walter Doerwald <walter@livinglogic.de>
45 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
47 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
46 generic xrepr(), otherwise the list implementation would kick in.
48 generic xrepr(), otherwise the list implementation would kick in.
47
49
48 2006-11-21 Ville Vainio <vivainio@gmail.com>
50 2006-11-21 Ville Vainio <vivainio@gmail.com>
49
51
50 * upgrade_dir.py: Now actually overwrites a nonmodified user file
52 * upgrade_dir.py: Now actually overwrites a nonmodified user file
51 with one from UserConfig.
53 with one from UserConfig.
52
54
53 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
55 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
54 it was missing which broke the sh profile.
56 it was missing which broke the sh profile.
55
57
56 * completer.py: file completer now uses explicit '/' instead
58 * completer.py: file completer now uses explicit '/' instead
57 of os.path.join, expansion of 'foo' was broken on win32
59 of os.path.join, expansion of 'foo' was broken on win32
58 if there was one directory with name 'foobar'.
60 if there was one directory with name 'foobar'.
59
61
60 * A bunch of patches from Kirill Smelkov:
62 * A bunch of patches from Kirill Smelkov:
61
63
62 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
64 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
63
65
64 * [patch 7/9] Implement %page -r (page in raw mode) -
66 * [patch 7/9] Implement %page -r (page in raw mode) -
65
67
66 * [patch 5/9] ScientificPython webpage has moved
68 * [patch 5/9] ScientificPython webpage has moved
67
69
68 * [patch 4/9] The manual mentions %ds, should be %dhist
70 * [patch 4/9] The manual mentions %ds, should be %dhist
69
71
70 * [patch 3/9] Kill old bits from %prun doc.
72 * [patch 3/9] Kill old bits from %prun doc.
71
73
72 * [patch 1/9] Fix typos here and there.
74 * [patch 1/9] Fix typos here and there.
73
75
74 2006-11-08 Ville Vainio <vivainio@gmail.com>
76 2006-11-08 Ville Vainio <vivainio@gmail.com>
75
77
76 * completer.py (attr_matches): catch all exceptions raised
78 * completer.py (attr_matches): catch all exceptions raised
77 by eval of expr with dots.
79 by eval of expr with dots.
78
80
79 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
81 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
80
82
81 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
83 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
82 input if it starts with whitespace. This allows you to paste
84 input if it starts with whitespace. This allows you to paste
83 indented input from any editor without manually having to type in
85 indented input from any editor without manually having to type in
84 the 'if 1:', which is convenient when working interactively.
86 the 'if 1:', which is convenient when working interactively.
85 Slightly modifed version of a patch by Bo Peng
87 Slightly modifed version of a patch by Bo Peng
86 <bpeng-AT-rice.edu>.
88 <bpeng-AT-rice.edu>.
87
89
88 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
90 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
89
91
90 * IPython/irunner.py (main): modified irunner so it automatically
92 * IPython/irunner.py (main): modified irunner so it automatically
91 recognizes the right runner to use based on the extension (.py for
93 recognizes the right runner to use based on the extension (.py for
92 python, .ipy for ipython and .sage for sage).
94 python, .ipy for ipython and .sage for sage).
93
95
94 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
96 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
95 visible in ipapi as ip.config(), to programatically control the
97 visible in ipapi as ip.config(), to programatically control the
96 internal rc object. There's an accompanying %config magic for
98 internal rc object. There's an accompanying %config magic for
97 interactive use, which has been enhanced to match the
99 interactive use, which has been enhanced to match the
98 funtionality in ipconfig.
100 funtionality in ipconfig.
99
101
100 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
102 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
101 so it's not just a toggle, it now takes an argument. Add support
103 so it's not just a toggle, it now takes an argument. Add support
102 for a customizable header when making system calls, as the new
104 for a customizable header when making system calls, as the new
103 system_header variable in the ipythonrc file.
105 system_header variable in the ipythonrc file.
104
106
105 2006-11-03 Walter Doerwald <walter@livinglogic.de>
107 2006-11-03 Walter Doerwald <walter@livinglogic.de>
106
108
107 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
109 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
108 generic functions (using Philip J. Eby's simplegeneric package).
110 generic functions (using Philip J. Eby's simplegeneric package).
109 This makes it possible to customize the display of third-party classes
111 This makes it possible to customize the display of third-party classes
110 without having to monkeypatch them. xiter() no longer supports a mode
112 without having to monkeypatch them. xiter() no longer supports a mode
111 argument and the XMode class has been removed. The same functionality can
113 argument and the XMode class has been removed. The same functionality can
112 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
114 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
113 One consequence of the switch to generic functions is that xrepr() and
115 One consequence of the switch to generic functions is that xrepr() and
114 xattrs() implementation must define the default value for the mode
116 xattrs() implementation must define the default value for the mode
115 argument themselves and xattrs() implementations must return real
117 argument themselves and xattrs() implementations must return real
116 descriptors.
118 descriptors.
117
119
118 * IPython/external: This new subpackage will contain all third-party
120 * IPython/external: This new subpackage will contain all third-party
119 packages that are bundled with IPython. (The first one is simplegeneric).
121 packages that are bundled with IPython. (The first one is simplegeneric).
120
122
121 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
123 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
122 directory which as been dropped in r1703.
124 directory which as been dropped in r1703.
123
125
124 * IPython/Extensions/ipipe.py (iless): Fixed.
126 * IPython/Extensions/ipipe.py (iless): Fixed.
125
127
126 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
128 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
127
129
128 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
130 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
129
131
130 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
132 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
131 handling in variable expansion so that shells and magics recognize
133 handling in variable expansion so that shells and magics recognize
132 function local scopes correctly. Bug reported by Brian.
134 function local scopes correctly. Bug reported by Brian.
133
135
134 * scripts/ipython: remove the very first entry in sys.path which
136 * scripts/ipython: remove the very first entry in sys.path which
135 Python auto-inserts for scripts, so that sys.path under IPython is
137 Python auto-inserts for scripts, so that sys.path under IPython is
136 as similar as possible to that under plain Python.
138 as similar as possible to that under plain Python.
137
139
138 * IPython/completer.py (IPCompleter.file_matches): Fix
140 * IPython/completer.py (IPCompleter.file_matches): Fix
139 tab-completion so that quotes are not closed unless the completion
141 tab-completion so that quotes are not closed unless the completion
140 is unambiguous. After a request by Stefan. Minor cleanups in
142 is unambiguous. After a request by Stefan. Minor cleanups in
141 ipy_stock_completers.
143 ipy_stock_completers.
142
144
143 2006-11-02 Ville Vainio <vivainio@gmail.com>
145 2006-11-02 Ville Vainio <vivainio@gmail.com>
144
146
145 * ipy_stock_completers.py: Add %run and %cd completers.
147 * ipy_stock_completers.py: Add %run and %cd completers.
146
148
147 * completer.py: Try running custom completer for both
149 * completer.py: Try running custom completer for both
148 "foo" and "%foo" if the command is just "foo". Ignore case
150 "foo" and "%foo" if the command is just "foo". Ignore case
149 when filtering possible completions.
151 when filtering possible completions.
150
152
151 * UserConfig/ipy_user_conf.py: install stock completers as default
153 * UserConfig/ipy_user_conf.py: install stock completers as default
152
154
153 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
155 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
154 simplified readline history save / restore through a wrapper
156 simplified readline history save / restore through a wrapper
155 function
157 function
156
158
157
159
158 2006-10-31 Ville Vainio <vivainio@gmail.com>
160 2006-10-31 Ville Vainio <vivainio@gmail.com>
159
161
160 * strdispatch.py, completer.py, ipy_stock_completers.py:
162 * strdispatch.py, completer.py, ipy_stock_completers.py:
161 Allow str_key ("command") in completer hooks. Implement
163 Allow str_key ("command") in completer hooks. Implement
162 trivial completer for 'import' (stdlib modules only). Rename
164 trivial completer for 'import' (stdlib modules only). Rename
163 ipy_linux_package_managers.py to ipy_stock_completers.py.
165 ipy_linux_package_managers.py to ipy_stock_completers.py.
164 SVN completer.
166 SVN completer.
165
167
166 * Extensions/ledit.py: %magic line editor for easily and
168 * Extensions/ledit.py: %magic line editor for easily and
167 incrementally manipulating lists of strings. The magic command
169 incrementally manipulating lists of strings. The magic command
168 name is %led.
170 name is %led.
169
171
170 2006-10-30 Ville Vainio <vivainio@gmail.com>
172 2006-10-30 Ville Vainio <vivainio@gmail.com>
171
173
172 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
174 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
173 Bernsteins's patches for pydb integration.
175 Bernsteins's patches for pydb integration.
174 http://bashdb.sourceforge.net/pydb/
176 http://bashdb.sourceforge.net/pydb/
175
177
176 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
178 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
177 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
179 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
178 custom completer hook to allow the users to implement their own
180 custom completer hook to allow the users to implement their own
179 completers. See ipy_linux_package_managers.py for example. The
181 completers. See ipy_linux_package_managers.py for example. The
180 hook name is 'complete_command'.
182 hook name is 'complete_command'.
181
183
182 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
184 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
183
185
184 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
186 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
185 Numeric leftovers.
187 Numeric leftovers.
186
188
187 * ipython.el (py-execute-region): apply Stefan's patch to fix
189 * ipython.el (py-execute-region): apply Stefan's patch to fix
188 garbled results if the python shell hasn't been previously started.
190 garbled results if the python shell hasn't been previously started.
189
191
190 * IPython/genutils.py (arg_split): moved to genutils, since it's a
192 * IPython/genutils.py (arg_split): moved to genutils, since it's a
191 pretty generic function and useful for other things.
193 pretty generic function and useful for other things.
192
194
193 * IPython/OInspect.py (getsource): Add customizable source
195 * IPython/OInspect.py (getsource): Add customizable source
194 extractor. After a request/patch form W. Stein (SAGE).
196 extractor. After a request/patch form W. Stein (SAGE).
195
197
196 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
198 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
197 window size to a more reasonable value from what pexpect does,
199 window size to a more reasonable value from what pexpect does,
198 since their choice causes wrapping bugs with long input lines.
200 since their choice causes wrapping bugs with long input lines.
199
201
200 2006-10-28 Ville Vainio <vivainio@gmail.com>
202 2006-10-28 Ville Vainio <vivainio@gmail.com>
201
203
202 * Magic.py (%run): Save and restore the readline history from
204 * Magic.py (%run): Save and restore the readline history from
203 file around %run commands to prevent side effects from
205 file around %run commands to prevent side effects from
204 %runned programs that might use readline (e.g. pydb).
206 %runned programs that might use readline (e.g. pydb).
205
207
206 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
208 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
207 invoking the pydb enhanced debugger.
209 invoking the pydb enhanced debugger.
208
210
209 2006-10-23 Walter Doerwald <walter@livinglogic.de>
211 2006-10-23 Walter Doerwald <walter@livinglogic.de>
210
212
211 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
213 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
212 call the base class method and propagate the return value to
214 call the base class method and propagate the return value to
213 ifile. This is now done by path itself.
215 ifile. This is now done by path itself.
214
216
215 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
217 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
216
218
217 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
219 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
218 api: set_crash_handler(), to expose the ability to change the
220 api: set_crash_handler(), to expose the ability to change the
219 internal crash handler.
221 internal crash handler.
220
222
221 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
223 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
222 the various parameters of the crash handler so that apps using
224 the various parameters of the crash handler so that apps using
223 IPython as their engine can customize crash handling. Ipmlemented
225 IPython as their engine can customize crash handling. Ipmlemented
224 at the request of SAGE.
226 at the request of SAGE.
225
227
226 2006-10-14 Ville Vainio <vivainio@gmail.com>
228 2006-10-14 Ville Vainio <vivainio@gmail.com>
227
229
228 * Magic.py, ipython.el: applied first "safe" part of Rocky
230 * Magic.py, ipython.el: applied first "safe" part of Rocky
229 Bernstein's patch set for pydb integration.
231 Bernstein's patch set for pydb integration.
230
232
231 * Magic.py (%unalias, %alias): %store'd aliases can now be
233 * Magic.py (%unalias, %alias): %store'd aliases can now be
232 removed with '%unalias'. %alias w/o args now shows most
234 removed with '%unalias'. %alias w/o args now shows most
233 interesting (stored / manually defined) aliases last
235 interesting (stored / manually defined) aliases last
234 where they catch the eye w/o scrolling.
236 where they catch the eye w/o scrolling.
235
237
236 * Magic.py (%rehashx), ext_rehashdir.py: files with
238 * Magic.py (%rehashx), ext_rehashdir.py: files with
237 'py' extension are always considered executable, even
239 'py' extension are always considered executable, even
238 when not in PATHEXT environment variable.
240 when not in PATHEXT environment variable.
239
241
240 2006-10-12 Ville Vainio <vivainio@gmail.com>
242 2006-10-12 Ville Vainio <vivainio@gmail.com>
241
243
242 * jobctrl.py: Add new "jobctrl" extension for spawning background
244 * jobctrl.py: Add new "jobctrl" extension for spawning background
243 processes with "&find /". 'import jobctrl' to try it out. Requires
245 processes with "&find /". 'import jobctrl' to try it out. Requires
244 'subprocess' module, standard in python 2.4+.
246 'subprocess' module, standard in python 2.4+.
245
247
246 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
248 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
247 so if foo -> bar and bar -> baz, then foo -> baz.
249 so if foo -> bar and bar -> baz, then foo -> baz.
248
250
249 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
251 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
250
252
251 * IPython/Magic.py (Magic.parse_options): add a new posix option
253 * IPython/Magic.py (Magic.parse_options): add a new posix option
252 to allow parsing of input args in magics that doesn't strip quotes
254 to allow parsing of input args in magics that doesn't strip quotes
253 (if posix=False). This also closes %timeit bug reported by
255 (if posix=False). This also closes %timeit bug reported by
254 Stefan.
256 Stefan.
255
257
256 2006-10-03 Ville Vainio <vivainio@gmail.com>
258 2006-10-03 Ville Vainio <vivainio@gmail.com>
257
259
258 * iplib.py (raw_input, interact): Return ValueError catching for
260 * iplib.py (raw_input, interact): Return ValueError catching for
259 raw_input. Fixes infinite loop for sys.stdin.close() or
261 raw_input. Fixes infinite loop for sys.stdin.close() or
260 sys.stdout.close().
262 sys.stdout.close().
261
263
262 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
264 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
263
265
264 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
266 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
265 to help in handling doctests. irunner is now pretty useful for
267 to help in handling doctests. irunner is now pretty useful for
266 running standalone scripts and simulate a full interactive session
268 running standalone scripts and simulate a full interactive session
267 in a format that can be then pasted as a doctest.
269 in a format that can be then pasted as a doctest.
268
270
269 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
271 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
270 on top of the default (useless) ones. This also fixes the nasty
272 on top of the default (useless) ones. This also fixes the nasty
271 way in which 2.5's Quitter() exits (reverted [1785]).
273 way in which 2.5's Quitter() exits (reverted [1785]).
272
274
273 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
275 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
274 2.5.
276 2.5.
275
277
276 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
278 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
277 color scheme is updated as well when color scheme is changed
279 color scheme is updated as well when color scheme is changed
278 interactively.
280 interactively.
279
281
280 2006-09-27 Ville Vainio <vivainio@gmail.com>
282 2006-09-27 Ville Vainio <vivainio@gmail.com>
281
283
282 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
284 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
283 infinite loop and just exit. It's a hack, but will do for a while.
285 infinite loop and just exit. It's a hack, but will do for a while.
284
286
285 2006-08-25 Walter Doerwald <walter@livinglogic.de>
287 2006-08-25 Walter Doerwald <walter@livinglogic.de>
286
288
287 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
289 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
288 the constructor, this makes it possible to get a list of only directories
290 the constructor, this makes it possible to get a list of only directories
289 or only files.
291 or only files.
290
292
291 2006-08-12 Ville Vainio <vivainio@gmail.com>
293 2006-08-12 Ville Vainio <vivainio@gmail.com>
292
294
293 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
295 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
294 they broke unittest
296 they broke unittest
295
297
296 2006-08-11 Ville Vainio <vivainio@gmail.com>
298 2006-08-11 Ville Vainio <vivainio@gmail.com>
297
299
298 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
300 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
299 by resolving issue properly, i.e. by inheriting FakeModule
301 by resolving issue properly, i.e. by inheriting FakeModule
300 from types.ModuleType. Pickling ipython interactive data
302 from types.ModuleType. Pickling ipython interactive data
301 should still work as usual (testing appreciated).
303 should still work as usual (testing appreciated).
302
304
303 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
305 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
304
306
305 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
307 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
306 running under python 2.3 with code from 2.4 to fix a bug with
308 running under python 2.3 with code from 2.4 to fix a bug with
307 help(). Reported by the Debian maintainers, Norbert Tretkowski
309 help(). Reported by the Debian maintainers, Norbert Tretkowski
308 <norbert-AT-tretkowski.de> and Alexandre Fayolle
310 <norbert-AT-tretkowski.de> and Alexandre Fayolle
309 <afayolle-AT-debian.org>.
311 <afayolle-AT-debian.org>.
310
312
311 2006-08-04 Walter Doerwald <walter@livinglogic.de>
313 2006-08-04 Walter Doerwald <walter@livinglogic.de>
312
314
313 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
315 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
314 (which was displaying "quit" twice).
316 (which was displaying "quit" twice).
315
317
316 2006-07-28 Walter Doerwald <walter@livinglogic.de>
318 2006-07-28 Walter Doerwald <walter@livinglogic.de>
317
319
318 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
320 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
319 the mode argument).
321 the mode argument).
320
322
321 2006-07-27 Walter Doerwald <walter@livinglogic.de>
323 2006-07-27 Walter Doerwald <walter@livinglogic.de>
322
324
323 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
325 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
324 not running under IPython.
326 not running under IPython.
325
327
326 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
328 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
327 and make it iterable (iterating over the attribute itself). Add two new
329 and make it iterable (iterating over the attribute itself). Add two new
328 magic strings for __xattrs__(): If the string starts with "-", the attribute
330 magic strings for __xattrs__(): If the string starts with "-", the attribute
329 will not be displayed in ibrowse's detail view (but it can still be
331 will not be displayed in ibrowse's detail view (but it can still be
330 iterated over). This makes it possible to add attributes that are large
332 iterated over). This makes it possible to add attributes that are large
331 lists or generator methods to the detail view. Replace magic attribute names
333 lists or generator methods to the detail view. Replace magic attribute names
332 and _attrname() and _getattr() with "descriptors": For each type of magic
334 and _attrname() and _getattr() with "descriptors": For each type of magic
333 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
335 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
334 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
336 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
335 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
337 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
336 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
338 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
337 are still supported.
339 are still supported.
338
340
339 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
341 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
340 fails in ibrowse.fetch(), the exception object is added as the last item
342 fails in ibrowse.fetch(), the exception object is added as the last item
341 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
343 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
342 a generator throws an exception midway through execution.
344 a generator throws an exception midway through execution.
343
345
344 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
346 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
345 encoding into methods.
347 encoding into methods.
346
348
347 2006-07-26 Ville Vainio <vivainio@gmail.com>
349 2006-07-26 Ville Vainio <vivainio@gmail.com>
348
350
349 * iplib.py: history now stores multiline input as single
351 * iplib.py: history now stores multiline input as single
350 history entries. Patch by Jorgen Cederlof.
352 history entries. Patch by Jorgen Cederlof.
351
353
352 2006-07-18 Walter Doerwald <walter@livinglogic.de>
354 2006-07-18 Walter Doerwald <walter@livinglogic.de>
353
355
354 * IPython/Extensions/ibrowse.py: Make cursor visible over
356 * IPython/Extensions/ibrowse.py: Make cursor visible over
355 non existing attributes.
357 non existing attributes.
356
358
357 2006-07-14 Walter Doerwald <walter@livinglogic.de>
359 2006-07-14 Walter Doerwald <walter@livinglogic.de>
358
360
359 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
361 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
360 error output of the running command doesn't mess up the screen.
362 error output of the running command doesn't mess up the screen.
361
363
362 2006-07-13 Walter Doerwald <walter@livinglogic.de>
364 2006-07-13 Walter Doerwald <walter@livinglogic.de>
363
365
364 * IPython/Extensions/ipipe.py (isort): Make isort usable without
366 * IPython/Extensions/ipipe.py (isort): Make isort usable without
365 argument. This sorts the items themselves.
367 argument. This sorts the items themselves.
366
368
367 2006-07-12 Walter Doerwald <walter@livinglogic.de>
369 2006-07-12 Walter Doerwald <walter@livinglogic.de>
368
370
369 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
371 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
370 Compile expression strings into code objects. This should speed
372 Compile expression strings into code objects. This should speed
371 up ifilter and friends somewhat.
373 up ifilter and friends somewhat.
372
374
373 2006-07-08 Ville Vainio <vivainio@gmail.com>
375 2006-07-08 Ville Vainio <vivainio@gmail.com>
374
376
375 * Magic.py: %cpaste now strips > from the beginning of lines
377 * Magic.py: %cpaste now strips > from the beginning of lines
376 to ease pasting quoted code from emails. Contributed by
378 to ease pasting quoted code from emails. Contributed by
377 Stefan van der Walt.
379 Stefan van der Walt.
378
380
379 2006-06-29 Ville Vainio <vivainio@gmail.com>
381 2006-06-29 Ville Vainio <vivainio@gmail.com>
380
382
381 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
383 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
382 mode, patch contributed by Darren Dale. NEEDS TESTING!
384 mode, patch contributed by Darren Dale. NEEDS TESTING!
383
385
384 2006-06-28 Walter Doerwald <walter@livinglogic.de>
386 2006-06-28 Walter Doerwald <walter@livinglogic.de>
385
387
386 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
388 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
387 a blue background. Fix fetching new display rows when the browser
389 a blue background. Fix fetching new display rows when the browser
388 scrolls more than a screenful (e.g. by using the goto command).
390 scrolls more than a screenful (e.g. by using the goto command).
389
391
390 2006-06-27 Ville Vainio <vivainio@gmail.com>
392 2006-06-27 Ville Vainio <vivainio@gmail.com>
391
393
392 * Magic.py (_inspect, _ofind) Apply David Huard's
394 * Magic.py (_inspect, _ofind) Apply David Huard's
393 patch for displaying the correct docstring for 'property'
395 patch for displaying the correct docstring for 'property'
394 attributes.
396 attributes.
395
397
396 2006-06-23 Walter Doerwald <walter@livinglogic.de>
398 2006-06-23 Walter Doerwald <walter@livinglogic.de>
397
399
398 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
400 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
399 commands into the methods implementing them.
401 commands into the methods implementing them.
400
402
401 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
403 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
402
404
403 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
405 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
404 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
406 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
405 autoindent support was authored by Jin Liu.
407 autoindent support was authored by Jin Liu.
406
408
407 2006-06-22 Walter Doerwald <walter@livinglogic.de>
409 2006-06-22 Walter Doerwald <walter@livinglogic.de>
408
410
409 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
411 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
410 for keymaps with a custom class that simplifies handling.
412 for keymaps with a custom class that simplifies handling.
411
413
412 2006-06-19 Walter Doerwald <walter@livinglogic.de>
414 2006-06-19 Walter Doerwald <walter@livinglogic.de>
413
415
414 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
416 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
415 resizing. This requires Python 2.5 to work.
417 resizing. This requires Python 2.5 to work.
416
418
417 2006-06-16 Walter Doerwald <walter@livinglogic.de>
419 2006-06-16 Walter Doerwald <walter@livinglogic.de>
418
420
419 * IPython/Extensions/ibrowse.py: Add two new commands to
421 * IPython/Extensions/ibrowse.py: Add two new commands to
420 ibrowse: "hideattr" (mapped to "h") hides the attribute under
422 ibrowse: "hideattr" (mapped to "h") hides the attribute under
421 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
423 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
422 attributes again. Remapped the help command to "?". Display
424 attributes again. Remapped the help command to "?". Display
423 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
425 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
424 as keys for the "home" and "end" commands. Add three new commands
426 as keys for the "home" and "end" commands. Add three new commands
425 to the input mode for "find" and friends: "delend" (CTRL-K)
427 to the input mode for "find" and friends: "delend" (CTRL-K)
426 deletes to the end of line. "incsearchup" searches upwards in the
428 deletes to the end of line. "incsearchup" searches upwards in the
427 command history for an input that starts with the text before the cursor.
429 command history for an input that starts with the text before the cursor.
428 "incsearchdown" does the same downwards. Removed a bogus mapping of
430 "incsearchdown" does the same downwards. Removed a bogus mapping of
429 the x key to "delete".
431 the x key to "delete".
430
432
431 2006-06-15 Ville Vainio <vivainio@gmail.com>
433 2006-06-15 Ville Vainio <vivainio@gmail.com>
432
434
433 * iplib.py, hooks.py: Added new generate_prompt hook that can be
435 * iplib.py, hooks.py: Added new generate_prompt hook that can be
434 used to create prompts dynamically, instead of the "old" way of
436 used to create prompts dynamically, instead of the "old" way of
435 assigning "magic" strings to prompt_in1 and prompt_in2. The old
437 assigning "magic" strings to prompt_in1 and prompt_in2. The old
436 way still works (it's invoked by the default hook), of course.
438 way still works (it's invoked by the default hook), of course.
437
439
438 * Prompts.py: added generate_output_prompt hook for altering output
440 * Prompts.py: added generate_output_prompt hook for altering output
439 prompt
441 prompt
440
442
441 * Release.py: Changed version string to 0.7.3.svn.
443 * Release.py: Changed version string to 0.7.3.svn.
442
444
443 2006-06-15 Walter Doerwald <walter@livinglogic.de>
445 2006-06-15 Walter Doerwald <walter@livinglogic.de>
444
446
445 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
447 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
446 the call to fetch() always tries to fetch enough data for at least one
448 the call to fetch() always tries to fetch enough data for at least one
447 full screen. This makes it possible to simply call moveto(0,0,True) in
449 full screen. This makes it possible to simply call moveto(0,0,True) in
448 the constructor. Fix typos and removed the obsolete goto attribute.
450 the constructor. Fix typos and removed the obsolete goto attribute.
449
451
450 2006-06-12 Ville Vainio <vivainio@gmail.com>
452 2006-06-12 Ville Vainio <vivainio@gmail.com>
451
453
452 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
454 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
453 allowing $variable interpolation within multiline statements,
455 allowing $variable interpolation within multiline statements,
454 though so far only with "sh" profile for a testing period.
456 though so far only with "sh" profile for a testing period.
455 The patch also enables splitting long commands with \ but it
457 The patch also enables splitting long commands with \ but it
456 doesn't work properly yet.
458 doesn't work properly yet.
457
459
458 2006-06-12 Walter Doerwald <walter@livinglogic.de>
460 2006-06-12 Walter Doerwald <walter@livinglogic.de>
459
461
460 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
462 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
461 input history and the position of the cursor in the input history for
463 input history and the position of the cursor in the input history for
462 the find, findbackwards and goto command.
464 the find, findbackwards and goto command.
463
465
464 2006-06-10 Walter Doerwald <walter@livinglogic.de>
466 2006-06-10 Walter Doerwald <walter@livinglogic.de>
465
467
466 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
468 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
467 implements the basic functionality of browser commands that require
469 implements the basic functionality of browser commands that require
468 input. Reimplement the goto, find and findbackwards commands as
470 input. Reimplement the goto, find and findbackwards commands as
469 subclasses of _CommandInput. Add an input history and keymaps to those
471 subclasses of _CommandInput. Add an input history and keymaps to those
470 commands. Add "\r" as a keyboard shortcut for the enterdefault and
472 commands. Add "\r" as a keyboard shortcut for the enterdefault and
471 execute commands.
473 execute commands.
472
474
473 2006-06-07 Ville Vainio <vivainio@gmail.com>
475 2006-06-07 Ville Vainio <vivainio@gmail.com>
474
476
475 * iplib.py: ipython mybatch.ipy exits ipython immediately after
477 * iplib.py: ipython mybatch.ipy exits ipython immediately after
476 running the batch files instead of leaving the session open.
478 running the batch files instead of leaving the session open.
477
479
478 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
480 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
479
481
480 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
482 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
481 the original fix was incomplete. Patch submitted by W. Maier.
483 the original fix was incomplete. Patch submitted by W. Maier.
482
484
483 2006-06-07 Ville Vainio <vivainio@gmail.com>
485 2006-06-07 Ville Vainio <vivainio@gmail.com>
484
486
485 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
487 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
486 Confirmation prompts can be supressed by 'quiet' option.
488 Confirmation prompts can be supressed by 'quiet' option.
487 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
489 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
488
490
489 2006-06-06 *** Released version 0.7.2
491 2006-06-06 *** Released version 0.7.2
490
492
491 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
493 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
492
494
493 * IPython/Release.py (version): Made 0.7.2 final for release.
495 * IPython/Release.py (version): Made 0.7.2 final for release.
494 Repo tagged and release cut.
496 Repo tagged and release cut.
495
497
496 2006-06-05 Ville Vainio <vivainio@gmail.com>
498 2006-06-05 Ville Vainio <vivainio@gmail.com>
497
499
498 * Magic.py (magic_rehashx): Honor no_alias list earlier in
500 * Magic.py (magic_rehashx): Honor no_alias list earlier in
499 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
501 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
500
502
501 * upgrade_dir.py: try import 'path' module a bit harder
503 * upgrade_dir.py: try import 'path' module a bit harder
502 (for %upgrade)
504 (for %upgrade)
503
505
504 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
506 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
505
507
506 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
508 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
507 instead of looping 20 times.
509 instead of looping 20 times.
508
510
509 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
511 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
510 correctly at initialization time. Bug reported by Krishna Mohan
512 correctly at initialization time. Bug reported by Krishna Mohan
511 Gundu <gkmohan-AT-gmail.com> on the user list.
513 Gundu <gkmohan-AT-gmail.com> on the user list.
512
514
513 * IPython/Release.py (version): Mark 0.7.2 version to start
515 * IPython/Release.py (version): Mark 0.7.2 version to start
514 testing for release on 06/06.
516 testing for release on 06/06.
515
517
516 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
518 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
517
519
518 * scripts/irunner: thin script interface so users don't have to
520 * scripts/irunner: thin script interface so users don't have to
519 find the module and call it as an executable, since modules rarely
521 find the module and call it as an executable, since modules rarely
520 live in people's PATH.
522 live in people's PATH.
521
523
522 * IPython/irunner.py (InteractiveRunner.__init__): added
524 * IPython/irunner.py (InteractiveRunner.__init__): added
523 delaybeforesend attribute to control delays with newer versions of
525 delaybeforesend attribute to control delays with newer versions of
524 pexpect. Thanks to detailed help from pexpect's author, Noah
526 pexpect. Thanks to detailed help from pexpect's author, Noah
525 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
527 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
526 correctly (it works in NoColor mode).
528 correctly (it works in NoColor mode).
527
529
528 * IPython/iplib.py (handle_normal): fix nasty crash reported on
530 * IPython/iplib.py (handle_normal): fix nasty crash reported on
529 SAGE list, from improper log() calls.
531 SAGE list, from improper log() calls.
530
532
531 2006-05-31 Ville Vainio <vivainio@gmail.com>
533 2006-05-31 Ville Vainio <vivainio@gmail.com>
532
534
533 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
535 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
534 with args in parens to work correctly with dirs that have spaces.
536 with args in parens to work correctly with dirs that have spaces.
535
537
536 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
538 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
537
539
538 * IPython/Logger.py (Logger.logstart): add option to log raw input
540 * IPython/Logger.py (Logger.logstart): add option to log raw input
539 instead of the processed one. A -r flag was added to the
541 instead of the processed one. A -r flag was added to the
540 %logstart magic used for controlling logging.
542 %logstart magic used for controlling logging.
541
543
542 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
544 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
543
545
544 * IPython/iplib.py (InteractiveShell.__init__): add check for the
546 * IPython/iplib.py (InteractiveShell.__init__): add check for the
545 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
547 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
546 recognize the option. After a bug report by Will Maier. This
548 recognize the option. After a bug report by Will Maier. This
547 closes #64 (will do it after confirmation from W. Maier).
549 closes #64 (will do it after confirmation from W. Maier).
548
550
549 * IPython/irunner.py: New module to run scripts as if manually
551 * IPython/irunner.py: New module to run scripts as if manually
550 typed into an interactive environment, based on pexpect. After a
552 typed into an interactive environment, based on pexpect. After a
551 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
553 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
552 ipython-user list. Simple unittests in the tests/ directory.
554 ipython-user list. Simple unittests in the tests/ directory.
553
555
554 * tools/release: add Will Maier, OpenBSD port maintainer, to
556 * tools/release: add Will Maier, OpenBSD port maintainer, to
555 recepients list. We are now officially part of the OpenBSD ports:
557 recepients list. We are now officially part of the OpenBSD ports:
556 http://www.openbsd.org/ports.html ! Many thanks to Will for the
558 http://www.openbsd.org/ports.html ! Many thanks to Will for the
557 work.
559 work.
558
560
559 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
561 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
560
562
561 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
563 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
562 so that it doesn't break tkinter apps.
564 so that it doesn't break tkinter apps.
563
565
564 * IPython/iplib.py (_prefilter): fix bug where aliases would
566 * IPython/iplib.py (_prefilter): fix bug where aliases would
565 shadow variables when autocall was fully off. Reported by SAGE
567 shadow variables when autocall was fully off. Reported by SAGE
566 author William Stein.
568 author William Stein.
567
569
568 * IPython/OInspect.py (Inspector.__init__): add a flag to control
570 * IPython/OInspect.py (Inspector.__init__): add a flag to control
569 at what detail level strings are computed when foo? is requested.
571 at what detail level strings are computed when foo? is requested.
570 This allows users to ask for example that the string form of an
572 This allows users to ask for example that the string form of an
571 object is only computed when foo?? is called, or even never, by
573 object is only computed when foo?? is called, or even never, by
572 setting the object_info_string_level >= 2 in the configuration
574 setting the object_info_string_level >= 2 in the configuration
573 file. This new option has been added and documented. After a
575 file. This new option has been added and documented. After a
574 request by SAGE to be able to control the printing of very large
576 request by SAGE to be able to control the printing of very large
575 objects more easily.
577 objects more easily.
576
578
577 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
579 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
578
580
579 * IPython/ipmaker.py (make_IPython): remove the ipython call path
581 * IPython/ipmaker.py (make_IPython): remove the ipython call path
580 from sys.argv, to be 100% consistent with how Python itself works
582 from sys.argv, to be 100% consistent with how Python itself works
581 (as seen for example with python -i file.py). After a bug report
583 (as seen for example with python -i file.py). After a bug report
582 by Jeffrey Collins.
584 by Jeffrey Collins.
583
585
584 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
586 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
585 nasty bug which was preventing custom namespaces with -pylab,
587 nasty bug which was preventing custom namespaces with -pylab,
586 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
588 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
587 compatibility (long gone from mpl).
589 compatibility (long gone from mpl).
588
590
589 * IPython/ipapi.py (make_session): name change: create->make. We
591 * IPython/ipapi.py (make_session): name change: create->make. We
590 use make in other places (ipmaker,...), it's shorter and easier to
592 use make in other places (ipmaker,...), it's shorter and easier to
591 type and say, etc. I'm trying to clean things before 0.7.2 so
593 type and say, etc. I'm trying to clean things before 0.7.2 so
592 that I can keep things stable wrt to ipapi in the chainsaw branch.
594 that I can keep things stable wrt to ipapi in the chainsaw branch.
593
595
594 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
596 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
595 python-mode recognizes our debugger mode. Add support for
597 python-mode recognizes our debugger mode. Add support for
596 autoindent inside (X)emacs. After a patch sent in by Jin Liu
598 autoindent inside (X)emacs. After a patch sent in by Jin Liu
597 <m.liu.jin-AT-gmail.com> originally written by
599 <m.liu.jin-AT-gmail.com> originally written by
598 doxgen-AT-newsmth.net (with minor modifications for xemacs
600 doxgen-AT-newsmth.net (with minor modifications for xemacs
599 compatibility)
601 compatibility)
600
602
601 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
603 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
602 tracebacks when walking the stack so that the stack tracking system
604 tracebacks when walking the stack so that the stack tracking system
603 in emacs' python-mode can identify the frames correctly.
605 in emacs' python-mode can identify the frames correctly.
604
606
605 * IPython/ipmaker.py (make_IPython): make the internal (and
607 * IPython/ipmaker.py (make_IPython): make the internal (and
606 default config) autoedit_syntax value false by default. Too many
608 default config) autoedit_syntax value false by default. Too many
607 users have complained to me (both on and off-list) about problems
609 users have complained to me (both on and off-list) about problems
608 with this option being on by default, so I'm making it default to
610 with this option being on by default, so I'm making it default to
609 off. It can still be enabled by anyone via the usual mechanisms.
611 off. It can still be enabled by anyone via the usual mechanisms.
610
612
611 * IPython/completer.py (Completer.attr_matches): add support for
613 * IPython/completer.py (Completer.attr_matches): add support for
612 PyCrust-style _getAttributeNames magic method. Patch contributed
614 PyCrust-style _getAttributeNames magic method. Patch contributed
613 by <mscott-AT-goldenspud.com>. Closes #50.
615 by <mscott-AT-goldenspud.com>. Closes #50.
614
616
615 * IPython/iplib.py (InteractiveShell.__init__): remove the
617 * IPython/iplib.py (InteractiveShell.__init__): remove the
616 deletion of exit/quit from __builtin__, which can break
618 deletion of exit/quit from __builtin__, which can break
617 third-party tools like the Zope debugging console. The
619 third-party tools like the Zope debugging console. The
618 %exit/%quit magics remain. In general, it's probably a good idea
620 %exit/%quit magics remain. In general, it's probably a good idea
619 not to delete anything from __builtin__, since we never know what
621 not to delete anything from __builtin__, since we never know what
620 that will break. In any case, python now (for 2.5) will support
622 that will break. In any case, python now (for 2.5) will support
621 'real' exit/quit, so this issue is moot. Closes #55.
623 'real' exit/quit, so this issue is moot. Closes #55.
622
624
623 * IPython/genutils.py (with_obj): rename the 'with' function to
625 * IPython/genutils.py (with_obj): rename the 'with' function to
624 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
626 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
625 becomes a language keyword. Closes #53.
627 becomes a language keyword. Closes #53.
626
628
627 * IPython/FakeModule.py (FakeModule.__init__): add a proper
629 * IPython/FakeModule.py (FakeModule.__init__): add a proper
628 __file__ attribute to this so it fools more things into thinking
630 __file__ attribute to this so it fools more things into thinking
629 it is a real module. Closes #59.
631 it is a real module. Closes #59.
630
632
631 * IPython/Magic.py (magic_edit): add -n option to open the editor
633 * IPython/Magic.py (magic_edit): add -n option to open the editor
632 at a specific line number. After a patch by Stefan van der Walt.
634 at a specific line number. After a patch by Stefan van der Walt.
633
635
634 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
636 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
635
637
636 * IPython/iplib.py (edit_syntax_error): fix crash when for some
638 * IPython/iplib.py (edit_syntax_error): fix crash when for some
637 reason the file could not be opened. After automatic crash
639 reason the file could not be opened. After automatic crash
638 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
640 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
639 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
641 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
640 (_should_recompile): Don't fire editor if using %bg, since there
642 (_should_recompile): Don't fire editor if using %bg, since there
641 is no file in the first place. From the same report as above.
643 is no file in the first place. From the same report as above.
642 (raw_input): protect against faulty third-party prefilters. After
644 (raw_input): protect against faulty third-party prefilters. After
643 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
645 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
644 while running under SAGE.
646 while running under SAGE.
645
647
646 2006-05-23 Ville Vainio <vivainio@gmail.com>
648 2006-05-23 Ville Vainio <vivainio@gmail.com>
647
649
648 * ipapi.py: Stripped down ip.to_user_ns() to work only as
650 * ipapi.py: Stripped down ip.to_user_ns() to work only as
649 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
651 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
650 now returns None (again), unless dummy is specifically allowed by
652 now returns None (again), unless dummy is specifically allowed by
651 ipapi.get(allow_dummy=True).
653 ipapi.get(allow_dummy=True).
652
654
653 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
655 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
654
656
655 * IPython: remove all 2.2-compatibility objects and hacks from
657 * IPython: remove all 2.2-compatibility objects and hacks from
656 everywhere, since we only support 2.3 at this point. Docs
658 everywhere, since we only support 2.3 at this point. Docs
657 updated.
659 updated.
658
660
659 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
661 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
660 Anything requiring extra validation can be turned into a Python
662 Anything requiring extra validation can be turned into a Python
661 property in the future. I used a property for the db one b/c
663 property in the future. I used a property for the db one b/c
662 there was a nasty circularity problem with the initialization
664 there was a nasty circularity problem with the initialization
663 order, which right now I don't have time to clean up.
665 order, which right now I don't have time to clean up.
664
666
665 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
667 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
666 another locking bug reported by Jorgen. I'm not 100% sure though,
668 another locking bug reported by Jorgen. I'm not 100% sure though,
667 so more testing is needed...
669 so more testing is needed...
668
670
669 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
671 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
670
672
671 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
673 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
672 local variables from any routine in user code (typically executed
674 local variables from any routine in user code (typically executed
673 with %run) directly into the interactive namespace. Very useful
675 with %run) directly into the interactive namespace. Very useful
674 when doing complex debugging.
676 when doing complex debugging.
675 (IPythonNotRunning): Changed the default None object to a dummy
677 (IPythonNotRunning): Changed the default None object to a dummy
676 whose attributes can be queried as well as called without
678 whose attributes can be queried as well as called without
677 exploding, to ease writing code which works transparently both in
679 exploding, to ease writing code which works transparently both in
678 and out of ipython and uses some of this API.
680 and out of ipython and uses some of this API.
679
681
680 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
682 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
681
683
682 * IPython/hooks.py (result_display): Fix the fact that our display
684 * IPython/hooks.py (result_display): Fix the fact that our display
683 hook was using str() instead of repr(), as the default python
685 hook was using str() instead of repr(), as the default python
684 console does. This had gone unnoticed b/c it only happened if
686 console does. This had gone unnoticed b/c it only happened if
685 %Pprint was off, but the inconsistency was there.
687 %Pprint was off, but the inconsistency was there.
686
688
687 2006-05-15 Ville Vainio <vivainio@gmail.com>
689 2006-05-15 Ville Vainio <vivainio@gmail.com>
688
690
689 * Oinspect.py: Only show docstring for nonexisting/binary files
691 * Oinspect.py: Only show docstring for nonexisting/binary files
690 when doing object??, closing ticket #62
692 when doing object??, closing ticket #62
691
693
692 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
694 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
693
695
694 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
696 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
695 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
697 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
696 was being released in a routine which hadn't checked if it had
698 was being released in a routine which hadn't checked if it had
697 been the one to acquire it.
699 been the one to acquire it.
698
700
699 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
701 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
700
702
701 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
703 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
702
704
703 2006-04-11 Ville Vainio <vivainio@gmail.com>
705 2006-04-11 Ville Vainio <vivainio@gmail.com>
704
706
705 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
707 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
706 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
708 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
707 prefilters, allowing stuff like magics and aliases in the file.
709 prefilters, allowing stuff like magics and aliases in the file.
708
710
709 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
711 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
710 added. Supported now are "%clear in" and "%clear out" (clear input and
712 added. Supported now are "%clear in" and "%clear out" (clear input and
711 output history, respectively). Also fixed CachedOutput.flush to
713 output history, respectively). Also fixed CachedOutput.flush to
712 properly flush the output cache.
714 properly flush the output cache.
713
715
714 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
716 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
715 half-success (and fail explicitly).
717 half-success (and fail explicitly).
716
718
717 2006-03-28 Ville Vainio <vivainio@gmail.com>
719 2006-03-28 Ville Vainio <vivainio@gmail.com>
718
720
719 * iplib.py: Fix quoting of aliases so that only argless ones
721 * iplib.py: Fix quoting of aliases so that only argless ones
720 are quoted
722 are quoted
721
723
722 2006-03-28 Ville Vainio <vivainio@gmail.com>
724 2006-03-28 Ville Vainio <vivainio@gmail.com>
723
725
724 * iplib.py: Quote aliases with spaces in the name.
726 * iplib.py: Quote aliases with spaces in the name.
725 "c:\program files\blah\bin" is now legal alias target.
727 "c:\program files\blah\bin" is now legal alias target.
726
728
727 * ext_rehashdir.py: Space no longer allowed as arg
729 * ext_rehashdir.py: Space no longer allowed as arg
728 separator, since space is legal in path names.
730 separator, since space is legal in path names.
729
731
730 2006-03-16 Ville Vainio <vivainio@gmail.com>
732 2006-03-16 Ville Vainio <vivainio@gmail.com>
731
733
732 * upgrade_dir.py: Take path.py from Extensions, correcting
734 * upgrade_dir.py: Take path.py from Extensions, correcting
733 %upgrade magic
735 %upgrade magic
734
736
735 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
737 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
736
738
737 * hooks.py: Only enclose editor binary in quotes if legal and
739 * hooks.py: Only enclose editor binary in quotes if legal and
738 necessary (space in the name, and is an existing file). Fixes a bug
740 necessary (space in the name, and is an existing file). Fixes a bug
739 reported by Zachary Pincus.
741 reported by Zachary Pincus.
740
742
741 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
743 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
742
744
743 * Manual: thanks to a tip on proper color handling for Emacs, by
745 * Manual: thanks to a tip on proper color handling for Emacs, by
744 Eric J Haywiser <ejh1-AT-MIT.EDU>.
746 Eric J Haywiser <ejh1-AT-MIT.EDU>.
745
747
746 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
748 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
747 by applying the provided patch. Thanks to Liu Jin
749 by applying the provided patch. Thanks to Liu Jin
748 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
750 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
749 XEmacs/Linux, I'm trusting the submitter that it actually helps
751 XEmacs/Linux, I'm trusting the submitter that it actually helps
750 under win32/GNU Emacs. Will revisit if any problems are reported.
752 under win32/GNU Emacs. Will revisit if any problems are reported.
751
753
752 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
754 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
753
755
754 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
756 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
755 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
757 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
756
758
757 2006-03-12 Ville Vainio <vivainio@gmail.com>
759 2006-03-12 Ville Vainio <vivainio@gmail.com>
758
760
759 * Magic.py (magic_timeit): Added %timeit magic, contributed by
761 * Magic.py (magic_timeit): Added %timeit magic, contributed by
760 Torsten Marek.
762 Torsten Marek.
761
763
762 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
764 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
763
765
764 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
766 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
765 line ranges works again.
767 line ranges works again.
766
768
767 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
769 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
768
770
769 * IPython/iplib.py (showtraceback): add back sys.last_traceback
771 * IPython/iplib.py (showtraceback): add back sys.last_traceback
770 and friends, after a discussion with Zach Pincus on ipython-user.
772 and friends, after a discussion with Zach Pincus on ipython-user.
771 I'm not 100% sure, but after thinking about it quite a bit, it may
773 I'm not 100% sure, but after thinking about it quite a bit, it may
772 be OK. Testing with the multithreaded shells didn't reveal any
774 be OK. Testing with the multithreaded shells didn't reveal any
773 problems, but let's keep an eye out.
775 problems, but let's keep an eye out.
774
776
775 In the process, I fixed a few things which were calling
777 In the process, I fixed a few things which were calling
776 self.InteractiveTB() directly (like safe_execfile), which is a
778 self.InteractiveTB() directly (like safe_execfile), which is a
777 mistake: ALL exception reporting should be done by calling
779 mistake: ALL exception reporting should be done by calling
778 self.showtraceback(), which handles state and tab-completion and
780 self.showtraceback(), which handles state and tab-completion and
779 more.
781 more.
780
782
781 2006-03-01 Ville Vainio <vivainio@gmail.com>
783 2006-03-01 Ville Vainio <vivainio@gmail.com>
782
784
783 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
785 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
784 To use, do "from ipipe import *".
786 To use, do "from ipipe import *".
785
787
786 2006-02-24 Ville Vainio <vivainio@gmail.com>
788 2006-02-24 Ville Vainio <vivainio@gmail.com>
787
789
788 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
790 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
789 "cleanly" and safely than the older upgrade mechanism.
791 "cleanly" and safely than the older upgrade mechanism.
790
792
791 2006-02-21 Ville Vainio <vivainio@gmail.com>
793 2006-02-21 Ville Vainio <vivainio@gmail.com>
792
794
793 * Magic.py: %save works again.
795 * Magic.py: %save works again.
794
796
795 2006-02-15 Ville Vainio <vivainio@gmail.com>
797 2006-02-15 Ville Vainio <vivainio@gmail.com>
796
798
797 * Magic.py: %Pprint works again
799 * Magic.py: %Pprint works again
798
800
799 * Extensions/ipy_sane_defaults.py: Provide everything provided
801 * Extensions/ipy_sane_defaults.py: Provide everything provided
800 in default ipythonrc, to make it possible to have a completely empty
802 in default ipythonrc, to make it possible to have a completely empty
801 ipythonrc (and thus completely rc-file free configuration)
803 ipythonrc (and thus completely rc-file free configuration)
802
804
803 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
805 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
804
806
805 * IPython/hooks.py (editor): quote the call to the editor command,
807 * IPython/hooks.py (editor): quote the call to the editor command,
806 to allow commands with spaces in them. Problem noted by watching
808 to allow commands with spaces in them. Problem noted by watching
807 Ian Oswald's video about textpad under win32 at
809 Ian Oswald's video about textpad under win32 at
808 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
810 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
809
811
810 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
812 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
811 describing magics (we haven't used @ for a loong time).
813 describing magics (we haven't used @ for a loong time).
812
814
813 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
815 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
814 contributed by marienz to close
816 contributed by marienz to close
815 http://www.scipy.net/roundup/ipython/issue53.
817 http://www.scipy.net/roundup/ipython/issue53.
816
818
817 2006-02-10 Ville Vainio <vivainio@gmail.com>
819 2006-02-10 Ville Vainio <vivainio@gmail.com>
818
820
819 * genutils.py: getoutput now works in win32 too
821 * genutils.py: getoutput now works in win32 too
820
822
821 * completer.py: alias and magic completion only invoked
823 * completer.py: alias and magic completion only invoked
822 at the first "item" in the line, to avoid "cd %store"
824 at the first "item" in the line, to avoid "cd %store"
823 nonsense.
825 nonsense.
824
826
825 2006-02-09 Ville Vainio <vivainio@gmail.com>
827 2006-02-09 Ville Vainio <vivainio@gmail.com>
826
828
827 * test/*: Added a unit testing framework (finally).
829 * test/*: Added a unit testing framework (finally).
828 '%run runtests.py' to run test_*.
830 '%run runtests.py' to run test_*.
829
831
830 * ipapi.py: Exposed runlines and set_custom_exc
832 * ipapi.py: Exposed runlines and set_custom_exc
831
833
832 2006-02-07 Ville Vainio <vivainio@gmail.com>
834 2006-02-07 Ville Vainio <vivainio@gmail.com>
833
835
834 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
836 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
835 instead use "f(1 2)" as before.
837 instead use "f(1 2)" as before.
836
838
837 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
839 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
838
840
839 * IPython/demo.py (IPythonDemo): Add new classes to the demo
841 * IPython/demo.py (IPythonDemo): Add new classes to the demo
840 facilities, for demos processed by the IPython input filter
842 facilities, for demos processed by the IPython input filter
841 (IPythonDemo), and for running a script one-line-at-a-time as a
843 (IPythonDemo), and for running a script one-line-at-a-time as a
842 demo, both for pure Python (LineDemo) and for IPython-processed
844 demo, both for pure Python (LineDemo) and for IPython-processed
843 input (IPythonLineDemo). After a request by Dave Kohel, from the
845 input (IPythonLineDemo). After a request by Dave Kohel, from the
844 SAGE team.
846 SAGE team.
845 (Demo.edit): added an edit() method to the demo objects, to edit
847 (Demo.edit): added an edit() method to the demo objects, to edit
846 the in-memory copy of the last executed block.
848 the in-memory copy of the last executed block.
847
849
848 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
850 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
849 processing to %edit, %macro and %save. These commands can now be
851 processing to %edit, %macro and %save. These commands can now be
850 invoked on the unprocessed input as it was typed by the user
852 invoked on the unprocessed input as it was typed by the user
851 (without any prefilters applied). After requests by the SAGE team
853 (without any prefilters applied). After requests by the SAGE team
852 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
854 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
853
855
854 2006-02-01 Ville Vainio <vivainio@gmail.com>
856 2006-02-01 Ville Vainio <vivainio@gmail.com>
855
857
856 * setup.py, eggsetup.py: easy_install ipython==dev works
858 * setup.py, eggsetup.py: easy_install ipython==dev works
857 correctly now (on Linux)
859 correctly now (on Linux)
858
860
859 * ipy_user_conf,ipmaker: user config changes, removed spurious
861 * ipy_user_conf,ipmaker: user config changes, removed spurious
860 warnings
862 warnings
861
863
862 * iplib: if rc.banner is string, use it as is.
864 * iplib: if rc.banner is string, use it as is.
863
865
864 * Magic: %pycat accepts a string argument and pages it's contents.
866 * Magic: %pycat accepts a string argument and pages it's contents.
865
867
866
868
867 2006-01-30 Ville Vainio <vivainio@gmail.com>
869 2006-01-30 Ville Vainio <vivainio@gmail.com>
868
870
869 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
871 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
870 Now %store and bookmarks work through PickleShare, meaning that
872 Now %store and bookmarks work through PickleShare, meaning that
871 concurrent access is possible and all ipython sessions see the
873 concurrent access is possible and all ipython sessions see the
872 same database situation all the time, instead of snapshot of
874 same database situation all the time, instead of snapshot of
873 the situation when the session was started. Hence, %bookmark
875 the situation when the session was started. Hence, %bookmark
874 results are immediately accessible from othes sessions. The database
876 results are immediately accessible from othes sessions. The database
875 is also available for use by user extensions. See:
877 is also available for use by user extensions. See:
876 http://www.python.org/pypi/pickleshare
878 http://www.python.org/pypi/pickleshare
877
879
878 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
880 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
879
881
880 * aliases can now be %store'd
882 * aliases can now be %store'd
881
883
882 * path.py moved to Extensions so that pickleshare does not need
884 * path.py moved to Extensions so that pickleshare does not need
883 IPython-specific import. Extensions added to pythonpath right
885 IPython-specific import. Extensions added to pythonpath right
884 at __init__.
886 at __init__.
885
887
886 * iplib.py: ipalias deprecated/redundant; aliases are converted and
888 * iplib.py: ipalias deprecated/redundant; aliases are converted and
887 called with _ip.system and the pre-transformed command string.
889 called with _ip.system and the pre-transformed command string.
888
890
889 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
891 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
890
892
891 * IPython/iplib.py (interact): Fix that we were not catching
893 * IPython/iplib.py (interact): Fix that we were not catching
892 KeyboardInterrupt exceptions properly. I'm not quite sure why the
894 KeyboardInterrupt exceptions properly. I'm not quite sure why the
893 logic here had to change, but it's fixed now.
895 logic here had to change, but it's fixed now.
894
896
895 2006-01-29 Ville Vainio <vivainio@gmail.com>
897 2006-01-29 Ville Vainio <vivainio@gmail.com>
896
898
897 * iplib.py: Try to import pyreadline on Windows.
899 * iplib.py: Try to import pyreadline on Windows.
898
900
899 2006-01-27 Ville Vainio <vivainio@gmail.com>
901 2006-01-27 Ville Vainio <vivainio@gmail.com>
900
902
901 * iplib.py: Expose ipapi as _ip in builtin namespace.
903 * iplib.py: Expose ipapi as _ip in builtin namespace.
902 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
904 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
903 and ip_set_hook (-> _ip.set_hook) redundant. % and !
905 and ip_set_hook (-> _ip.set_hook) redundant. % and !
904 syntax now produce _ip.* variant of the commands.
906 syntax now produce _ip.* variant of the commands.
905
907
906 * "_ip.options().autoedit_syntax = 2" automatically throws
908 * "_ip.options().autoedit_syntax = 2" automatically throws
907 user to editor for syntax error correction without prompting.
909 user to editor for syntax error correction without prompting.
908
910
909 2006-01-27 Ville Vainio <vivainio@gmail.com>
911 2006-01-27 Ville Vainio <vivainio@gmail.com>
910
912
911 * ipmaker.py: Give "realistic" sys.argv for scripts (without
913 * ipmaker.py: Give "realistic" sys.argv for scripts (without
912 'ipython' at argv[0]) executed through command line.
914 'ipython' at argv[0]) executed through command line.
913 NOTE: this DEPRECATES calling ipython with multiple scripts
915 NOTE: this DEPRECATES calling ipython with multiple scripts
914 ("ipython a.py b.py c.py")
916 ("ipython a.py b.py c.py")
915
917
916 * iplib.py, hooks.py: Added configurable input prefilter,
918 * iplib.py, hooks.py: Added configurable input prefilter,
917 named 'input_prefilter'. See ext_rescapture.py for example
919 named 'input_prefilter'. See ext_rescapture.py for example
918 usage.
920 usage.
919
921
920 * ext_rescapture.py, Magic.py: Better system command output capture
922 * ext_rescapture.py, Magic.py: Better system command output capture
921 through 'var = !ls' (deprecates user-visible %sc). Same notation
923 through 'var = !ls' (deprecates user-visible %sc). Same notation
922 applies for magics, 'var = %alias' assigns alias list to var.
924 applies for magics, 'var = %alias' assigns alias list to var.
923
925
924 * ipapi.py: added meta() for accessing extension-usable data store.
926 * ipapi.py: added meta() for accessing extension-usable data store.
925
927
926 * iplib.py: added InteractiveShell.getapi(). New magics should be
928 * iplib.py: added InteractiveShell.getapi(). New magics should be
927 written doing self.getapi() instead of using the shell directly.
929 written doing self.getapi() instead of using the shell directly.
928
930
929 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
931 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
930 %store foo >> ~/myfoo.txt to store variables to files (in clean
932 %store foo >> ~/myfoo.txt to store variables to files (in clean
931 textual form, not a restorable pickle).
933 textual form, not a restorable pickle).
932
934
933 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
935 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
934
936
935 * usage.py, Magic.py: added %quickref
937 * usage.py, Magic.py: added %quickref
936
938
937 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
939 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
938
940
939 * GetoptErrors when invoking magics etc. with wrong args
941 * GetoptErrors when invoking magics etc. with wrong args
940 are now more helpful:
942 are now more helpful:
941 GetoptError: option -l not recognized (allowed: "qb" )
943 GetoptError: option -l not recognized (allowed: "qb" )
942
944
943 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
945 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
944
946
945 * IPython/demo.py (Demo.show): Flush stdout after each block, so
947 * IPython/demo.py (Demo.show): Flush stdout after each block, so
946 computationally intensive blocks don't appear to stall the demo.
948 computationally intensive blocks don't appear to stall the demo.
947
949
948 2006-01-24 Ville Vainio <vivainio@gmail.com>
950 2006-01-24 Ville Vainio <vivainio@gmail.com>
949
951
950 * iplib.py, hooks.py: 'result_display' hook can return a non-None
952 * iplib.py, hooks.py: 'result_display' hook can return a non-None
951 value to manipulate resulting history entry.
953 value to manipulate resulting history entry.
952
954
953 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
955 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
954 to instance methods of IPApi class, to make extending an embedded
956 to instance methods of IPApi class, to make extending an embedded
955 IPython feasible. See ext_rehashdir.py for example usage.
957 IPython feasible. See ext_rehashdir.py for example usage.
956
958
957 * Merged 1071-1076 from branches/0.7.1
959 * Merged 1071-1076 from branches/0.7.1
958
960
959
961
960 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
962 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
961
963
962 * tools/release (daystamp): Fix build tools to use the new
964 * tools/release (daystamp): Fix build tools to use the new
963 eggsetup.py script to build lightweight eggs.
965 eggsetup.py script to build lightweight eggs.
964
966
965 * Applied changesets 1062 and 1064 before 0.7.1 release.
967 * Applied changesets 1062 and 1064 before 0.7.1 release.
966
968
967 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
969 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
968 see the raw input history (without conversions like %ls ->
970 see the raw input history (without conversions like %ls ->
969 ipmagic("ls")). After a request from W. Stein, SAGE
971 ipmagic("ls")). After a request from W. Stein, SAGE
970 (http://modular.ucsd.edu/sage) developer. This information is
972 (http://modular.ucsd.edu/sage) developer. This information is
971 stored in the input_hist_raw attribute of the IPython instance, so
973 stored in the input_hist_raw attribute of the IPython instance, so
972 developers can access it if needed (it's an InputList instance).
974 developers can access it if needed (it's an InputList instance).
973
975
974 * Versionstring = 0.7.2.svn
976 * Versionstring = 0.7.2.svn
975
977
976 * eggsetup.py: A separate script for constructing eggs, creates
978 * eggsetup.py: A separate script for constructing eggs, creates
977 proper launch scripts even on Windows (an .exe file in
979 proper launch scripts even on Windows (an .exe file in
978 \python24\scripts).
980 \python24\scripts).
979
981
980 * ipapi.py: launch_new_instance, launch entry point needed for the
982 * ipapi.py: launch_new_instance, launch entry point needed for the
981 egg.
983 egg.
982
984
983 2006-01-23 Ville Vainio <vivainio@gmail.com>
985 2006-01-23 Ville Vainio <vivainio@gmail.com>
984
986
985 * Added %cpaste magic for pasting python code
987 * Added %cpaste magic for pasting python code
986
988
987 2006-01-22 Ville Vainio <vivainio@gmail.com>
989 2006-01-22 Ville Vainio <vivainio@gmail.com>
988
990
989 * Merge from branches/0.7.1 into trunk, revs 1052-1057
991 * Merge from branches/0.7.1 into trunk, revs 1052-1057
990
992
991 * Versionstring = 0.7.2.svn
993 * Versionstring = 0.7.2.svn
992
994
993 * eggsetup.py: A separate script for constructing eggs, creates
995 * eggsetup.py: A separate script for constructing eggs, creates
994 proper launch scripts even on Windows (an .exe file in
996 proper launch scripts even on Windows (an .exe file in
995 \python24\scripts).
997 \python24\scripts).
996
998
997 * ipapi.py: launch_new_instance, launch entry point needed for the
999 * ipapi.py: launch_new_instance, launch entry point needed for the
998 egg.
1000 egg.
999
1001
1000 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1002 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1001
1003
1002 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1004 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1003 %pfile foo would print the file for foo even if it was a binary.
1005 %pfile foo would print the file for foo even if it was a binary.
1004 Now, extensions '.so' and '.dll' are skipped.
1006 Now, extensions '.so' and '.dll' are skipped.
1005
1007
1006 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1008 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1007 bug, where macros would fail in all threaded modes. I'm not 100%
1009 bug, where macros would fail in all threaded modes. I'm not 100%
1008 sure, so I'm going to put out an rc instead of making a release
1010 sure, so I'm going to put out an rc instead of making a release
1009 today, and wait for feedback for at least a few days.
1011 today, and wait for feedback for at least a few days.
1010
1012
1011 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1013 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1012 it...) the handling of pasting external code with autoindent on.
1014 it...) the handling of pasting external code with autoindent on.
1013 To get out of a multiline input, the rule will appear for most
1015 To get out of a multiline input, the rule will appear for most
1014 users unchanged: two blank lines or change the indent level
1016 users unchanged: two blank lines or change the indent level
1015 proposed by IPython. But there is a twist now: you can
1017 proposed by IPython. But there is a twist now: you can
1016 add/subtract only *one or two spaces*. If you add/subtract three
1018 add/subtract only *one or two spaces*. If you add/subtract three
1017 or more (unless you completely delete the line), IPython will
1019 or more (unless you completely delete the line), IPython will
1018 accept that line, and you'll need to enter a second one of pure
1020 accept that line, and you'll need to enter a second one of pure
1019 whitespace. I know it sounds complicated, but I can't find a
1021 whitespace. I know it sounds complicated, but I can't find a
1020 different solution that covers all the cases, with the right
1022 different solution that covers all the cases, with the right
1021 heuristics. Hopefully in actual use, nobody will really notice
1023 heuristics. Hopefully in actual use, nobody will really notice
1022 all these strange rules and things will 'just work'.
1024 all these strange rules and things will 'just work'.
1023
1025
1024 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1026 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1025
1027
1026 * IPython/iplib.py (interact): catch exceptions which can be
1028 * IPython/iplib.py (interact): catch exceptions which can be
1027 triggered asynchronously by signal handlers. Thanks to an
1029 triggered asynchronously by signal handlers. Thanks to an
1028 automatic crash report, submitted by Colin Kingsley
1030 automatic crash report, submitted by Colin Kingsley
1029 <tercel-AT-gentoo.org>.
1031 <tercel-AT-gentoo.org>.
1030
1032
1031 2006-01-20 Ville Vainio <vivainio@gmail.com>
1033 2006-01-20 Ville Vainio <vivainio@gmail.com>
1032
1034
1033 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1035 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1034 (%rehashdir, very useful, try it out) of how to extend ipython
1036 (%rehashdir, very useful, try it out) of how to extend ipython
1035 with new magics. Also added Extensions dir to pythonpath to make
1037 with new magics. Also added Extensions dir to pythonpath to make
1036 importing extensions easy.
1038 importing extensions easy.
1037
1039
1038 * %store now complains when trying to store interactively declared
1040 * %store now complains when trying to store interactively declared
1039 classes / instances of those classes.
1041 classes / instances of those classes.
1040
1042
1041 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1043 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1042 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1044 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1043 if they exist, and ipy_user_conf.py with some defaults is created for
1045 if they exist, and ipy_user_conf.py with some defaults is created for
1044 the user.
1046 the user.
1045
1047
1046 * Startup rehashing done by the config file, not InterpreterExec.
1048 * Startup rehashing done by the config file, not InterpreterExec.
1047 This means system commands are available even without selecting the
1049 This means system commands are available even without selecting the
1048 pysh profile. It's the sensible default after all.
1050 pysh profile. It's the sensible default after all.
1049
1051
1050 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1052 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1051
1053
1052 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1054 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1053 multiline code with autoindent on working. But I am really not
1055 multiline code with autoindent on working. But I am really not
1054 sure, so this needs more testing. Will commit a debug-enabled
1056 sure, so this needs more testing. Will commit a debug-enabled
1055 version for now, while I test it some more, so that Ville and
1057 version for now, while I test it some more, so that Ville and
1056 others may also catch any problems. Also made
1058 others may also catch any problems. Also made
1057 self.indent_current_str() a method, to ensure that there's no
1059 self.indent_current_str() a method, to ensure that there's no
1058 chance of the indent space count and the corresponding string
1060 chance of the indent space count and the corresponding string
1059 falling out of sync. All code needing the string should just call
1061 falling out of sync. All code needing the string should just call
1060 the method.
1062 the method.
1061
1063
1062 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1064 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1063
1065
1064 * IPython/Magic.py (magic_edit): fix check for when users don't
1066 * IPython/Magic.py (magic_edit): fix check for when users don't
1065 save their output files, the try/except was in the wrong section.
1067 save their output files, the try/except was in the wrong section.
1066
1068
1067 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1069 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1068
1070
1069 * IPython/Magic.py (magic_run): fix __file__ global missing from
1071 * IPython/Magic.py (magic_run): fix __file__ global missing from
1070 script's namespace when executed via %run. After a report by
1072 script's namespace when executed via %run. After a report by
1071 Vivian.
1073 Vivian.
1072
1074
1073 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1075 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1074 when using python 2.4. The parent constructor changed in 2.4, and
1076 when using python 2.4. The parent constructor changed in 2.4, and
1075 we need to track it directly (we can't call it, as it messes up
1077 we need to track it directly (we can't call it, as it messes up
1076 readline and tab-completion inside our pdb would stop working).
1078 readline and tab-completion inside our pdb would stop working).
1077 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1079 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1078
1080
1079 2006-01-16 Ville Vainio <vivainio@gmail.com>
1081 2006-01-16 Ville Vainio <vivainio@gmail.com>
1080
1082
1081 * Ipython/magic.py: Reverted back to old %edit functionality
1083 * Ipython/magic.py: Reverted back to old %edit functionality
1082 that returns file contents on exit.
1084 that returns file contents on exit.
1083
1085
1084 * IPython/path.py: Added Jason Orendorff's "path" module to
1086 * IPython/path.py: Added Jason Orendorff's "path" module to
1085 IPython tree, http://www.jorendorff.com/articles/python/path/.
1087 IPython tree, http://www.jorendorff.com/articles/python/path/.
1086 You can get path objects conveniently through %sc, and !!, e.g.:
1088 You can get path objects conveniently through %sc, and !!, e.g.:
1087 sc files=ls
1089 sc files=ls
1088 for p in files.paths: # or files.p
1090 for p in files.paths: # or files.p
1089 print p,p.mtime
1091 print p,p.mtime
1090
1092
1091 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1093 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1092 now work again without considering the exclusion regexp -
1094 now work again without considering the exclusion regexp -
1093 hence, things like ',foo my/path' turn to 'foo("my/path")'
1095 hence, things like ',foo my/path' turn to 'foo("my/path")'
1094 instead of syntax error.
1096 instead of syntax error.
1095
1097
1096
1098
1097 2006-01-14 Ville Vainio <vivainio@gmail.com>
1099 2006-01-14 Ville Vainio <vivainio@gmail.com>
1098
1100
1099 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1101 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1100 ipapi decorators for python 2.4 users, options() provides access to rc
1102 ipapi decorators for python 2.4 users, options() provides access to rc
1101 data.
1103 data.
1102
1104
1103 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1105 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1104 as path separators (even on Linux ;-). Space character after
1106 as path separators (even on Linux ;-). Space character after
1105 backslash (as yielded by tab completer) is still space;
1107 backslash (as yielded by tab completer) is still space;
1106 "%cd long\ name" works as expected.
1108 "%cd long\ name" works as expected.
1107
1109
1108 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1110 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1109 as "chain of command", with priority. API stays the same,
1111 as "chain of command", with priority. API stays the same,
1110 TryNext exception raised by a hook function signals that
1112 TryNext exception raised by a hook function signals that
1111 current hook failed and next hook should try handling it, as
1113 current hook failed and next hook should try handling it, as
1112 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1114 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1113 requested configurable display hook, which is now implemented.
1115 requested configurable display hook, which is now implemented.
1114
1116
1115 2006-01-13 Ville Vainio <vivainio@gmail.com>
1117 2006-01-13 Ville Vainio <vivainio@gmail.com>
1116
1118
1117 * IPython/platutils*.py: platform specific utility functions,
1119 * IPython/platutils*.py: platform specific utility functions,
1118 so far only set_term_title is implemented (change terminal
1120 so far only set_term_title is implemented (change terminal
1119 label in windowing systems). %cd now changes the title to
1121 label in windowing systems). %cd now changes the title to
1120 current dir.
1122 current dir.
1121
1123
1122 * IPython/Release.py: Added myself to "authors" list,
1124 * IPython/Release.py: Added myself to "authors" list,
1123 had to create new files.
1125 had to create new files.
1124
1126
1125 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1127 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1126 shell escape; not a known bug but had potential to be one in the
1128 shell escape; not a known bug but had potential to be one in the
1127 future.
1129 future.
1128
1130
1129 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1131 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1130 extension API for IPython! See the module for usage example. Fix
1132 extension API for IPython! See the module for usage example. Fix
1131 OInspect for docstring-less magic functions.
1133 OInspect for docstring-less magic functions.
1132
1134
1133
1135
1134 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1136 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1135
1137
1136 * IPython/iplib.py (raw_input): temporarily deactivate all
1138 * IPython/iplib.py (raw_input): temporarily deactivate all
1137 attempts at allowing pasting of code with autoindent on. It
1139 attempts at allowing pasting of code with autoindent on. It
1138 introduced bugs (reported by Prabhu) and I can't seem to find a
1140 introduced bugs (reported by Prabhu) and I can't seem to find a
1139 robust combination which works in all cases. Will have to revisit
1141 robust combination which works in all cases. Will have to revisit
1140 later.
1142 later.
1141
1143
1142 * IPython/genutils.py: remove isspace() function. We've dropped
1144 * IPython/genutils.py: remove isspace() function. We've dropped
1143 2.2 compatibility, so it's OK to use the string method.
1145 2.2 compatibility, so it's OK to use the string method.
1144
1146
1145 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1147 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1146
1148
1147 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1149 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1148 matching what NOT to autocall on, to include all python binary
1150 matching what NOT to autocall on, to include all python binary
1149 operators (including things like 'and', 'or', 'is' and 'in').
1151 operators (including things like 'and', 'or', 'is' and 'in').
1150 Prompted by a bug report on 'foo & bar', but I realized we had
1152 Prompted by a bug report on 'foo & bar', but I realized we had
1151 many more potential bug cases with other operators. The regexp is
1153 many more potential bug cases with other operators. The regexp is
1152 self.re_exclude_auto, it's fairly commented.
1154 self.re_exclude_auto, it's fairly commented.
1153
1155
1154 2006-01-12 Ville Vainio <vivainio@gmail.com>
1156 2006-01-12 Ville Vainio <vivainio@gmail.com>
1155
1157
1156 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1158 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1157 Prettified and hardened string/backslash quoting with ipsystem(),
1159 Prettified and hardened string/backslash quoting with ipsystem(),
1158 ipalias() and ipmagic(). Now even \ characters are passed to
1160 ipalias() and ipmagic(). Now even \ characters are passed to
1159 %magics, !shell escapes and aliases exactly as they are in the
1161 %magics, !shell escapes and aliases exactly as they are in the
1160 ipython command line. Should improve backslash experience,
1162 ipython command line. Should improve backslash experience,
1161 particularly in Windows (path delimiter for some commands that
1163 particularly in Windows (path delimiter for some commands that
1162 won't understand '/'), but Unix benefits as well (regexps). %cd
1164 won't understand '/'), but Unix benefits as well (regexps). %cd
1163 magic still doesn't support backslash path delimiters, though. Also
1165 magic still doesn't support backslash path delimiters, though. Also
1164 deleted all pretense of supporting multiline command strings in
1166 deleted all pretense of supporting multiline command strings in
1165 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1167 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1166
1168
1167 * doc/build_doc_instructions.txt added. Documentation on how to
1169 * doc/build_doc_instructions.txt added. Documentation on how to
1168 use doc/update_manual.py, added yesterday. Both files contributed
1170 use doc/update_manual.py, added yesterday. Both files contributed
1169 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1171 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1170 doc/*.sh for deprecation at a later date.
1172 doc/*.sh for deprecation at a later date.
1171
1173
1172 * /ipython.py Added ipython.py to root directory for
1174 * /ipython.py Added ipython.py to root directory for
1173 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1175 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1174 ipython.py) and development convenience (no need to keep doing
1176 ipython.py) and development convenience (no need to keep doing
1175 "setup.py install" between changes).
1177 "setup.py install" between changes).
1176
1178
1177 * Made ! and !! shell escapes work (again) in multiline expressions:
1179 * Made ! and !! shell escapes work (again) in multiline expressions:
1178 if 1:
1180 if 1:
1179 !ls
1181 !ls
1180 !!ls
1182 !!ls
1181
1183
1182 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1184 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1183
1185
1184 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1186 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1185 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1187 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1186 module in case-insensitive installation. Was causing crashes
1188 module in case-insensitive installation. Was causing crashes
1187 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1189 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1188
1190
1189 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1191 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1190 <marienz-AT-gentoo.org>, closes
1192 <marienz-AT-gentoo.org>, closes
1191 http://www.scipy.net/roundup/ipython/issue51.
1193 http://www.scipy.net/roundup/ipython/issue51.
1192
1194
1193 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1195 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1194
1196
1195 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1197 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1196 problem of excessive CPU usage under *nix and keyboard lag under
1198 problem of excessive CPU usage under *nix and keyboard lag under
1197 win32.
1199 win32.
1198
1200
1199 2006-01-10 *** Released version 0.7.0
1201 2006-01-10 *** Released version 0.7.0
1200
1202
1201 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1203 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1202
1204
1203 * IPython/Release.py (revision): tag version number to 0.7.0,
1205 * IPython/Release.py (revision): tag version number to 0.7.0,
1204 ready for release.
1206 ready for release.
1205
1207
1206 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1208 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1207 it informs the user of the name of the temp. file used. This can
1209 it informs the user of the name of the temp. file used. This can
1208 help if you decide later to reuse that same file, so you know
1210 help if you decide later to reuse that same file, so you know
1209 where to copy the info from.
1211 where to copy the info from.
1210
1212
1211 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1213 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1212
1214
1213 * setup_bdist_egg.py: little script to build an egg. Added
1215 * setup_bdist_egg.py: little script to build an egg. Added
1214 support in the release tools as well.
1216 support in the release tools as well.
1215
1217
1216 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1218 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1217
1219
1218 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1220 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1219 version selection (new -wxversion command line and ipythonrc
1221 version selection (new -wxversion command line and ipythonrc
1220 parameter). Patch contributed by Arnd Baecker
1222 parameter). Patch contributed by Arnd Baecker
1221 <arnd.baecker-AT-web.de>.
1223 <arnd.baecker-AT-web.de>.
1222
1224
1223 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1225 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1224 embedded instances, for variables defined at the interactive
1226 embedded instances, for variables defined at the interactive
1225 prompt of the embedded ipython. Reported by Arnd.
1227 prompt of the embedded ipython. Reported by Arnd.
1226
1228
1227 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1229 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1228 it can be used as a (stateful) toggle, or with a direct parameter.
1230 it can be used as a (stateful) toggle, or with a direct parameter.
1229
1231
1230 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1232 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1231 could be triggered in certain cases and cause the traceback
1233 could be triggered in certain cases and cause the traceback
1232 printer not to work.
1234 printer not to work.
1233
1235
1234 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1236 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1235
1237
1236 * IPython/iplib.py (_should_recompile): Small fix, closes
1238 * IPython/iplib.py (_should_recompile): Small fix, closes
1237 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1239 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1238
1240
1239 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1241 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1240
1242
1241 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1243 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1242 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1244 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1243 Moad for help with tracking it down.
1245 Moad for help with tracking it down.
1244
1246
1245 * IPython/iplib.py (handle_auto): fix autocall handling for
1247 * IPython/iplib.py (handle_auto): fix autocall handling for
1246 objects which support BOTH __getitem__ and __call__ (so that f [x]
1248 objects which support BOTH __getitem__ and __call__ (so that f [x]
1247 is left alone, instead of becoming f([x]) automatically).
1249 is left alone, instead of becoming f([x]) automatically).
1248
1250
1249 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1251 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1250 Ville's patch.
1252 Ville's patch.
1251
1253
1252 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1254 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1253
1255
1254 * IPython/iplib.py (handle_auto): changed autocall semantics to
1256 * IPython/iplib.py (handle_auto): changed autocall semantics to
1255 include 'smart' mode, where the autocall transformation is NOT
1257 include 'smart' mode, where the autocall transformation is NOT
1256 applied if there are no arguments on the line. This allows you to
1258 applied if there are no arguments on the line. This allows you to
1257 just type 'foo' if foo is a callable to see its internal form,
1259 just type 'foo' if foo is a callable to see its internal form,
1258 instead of having it called with no arguments (typically a
1260 instead of having it called with no arguments (typically a
1259 mistake). The old 'full' autocall still exists: for that, you
1261 mistake). The old 'full' autocall still exists: for that, you
1260 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1262 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1261
1263
1262 * IPython/completer.py (Completer.attr_matches): add
1264 * IPython/completer.py (Completer.attr_matches): add
1263 tab-completion support for Enthoughts' traits. After a report by
1265 tab-completion support for Enthoughts' traits. After a report by
1264 Arnd and a patch by Prabhu.
1266 Arnd and a patch by Prabhu.
1265
1267
1266 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1268 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1267
1269
1268 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1270 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1269 Schmolck's patch to fix inspect.getinnerframes().
1271 Schmolck's patch to fix inspect.getinnerframes().
1270
1272
1271 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1273 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1272 for embedded instances, regarding handling of namespaces and items
1274 for embedded instances, regarding handling of namespaces and items
1273 added to the __builtin__ one. Multiple embedded instances and
1275 added to the __builtin__ one. Multiple embedded instances and
1274 recursive embeddings should work better now (though I'm not sure
1276 recursive embeddings should work better now (though I'm not sure
1275 I've got all the corner cases fixed, that code is a bit of a brain
1277 I've got all the corner cases fixed, that code is a bit of a brain
1276 twister).
1278 twister).
1277
1279
1278 * IPython/Magic.py (magic_edit): added support to edit in-memory
1280 * IPython/Magic.py (magic_edit): added support to edit in-memory
1279 macros (automatically creates the necessary temp files). %edit
1281 macros (automatically creates the necessary temp files). %edit
1280 also doesn't return the file contents anymore, it's just noise.
1282 also doesn't return the file contents anymore, it's just noise.
1281
1283
1282 * IPython/completer.py (Completer.attr_matches): revert change to
1284 * IPython/completer.py (Completer.attr_matches): revert change to
1283 complete only on attributes listed in __all__. I realized it
1285 complete only on attributes listed in __all__. I realized it
1284 cripples the tab-completion system as a tool for exploring the
1286 cripples the tab-completion system as a tool for exploring the
1285 internals of unknown libraries (it renders any non-__all__
1287 internals of unknown libraries (it renders any non-__all__
1286 attribute off-limits). I got bit by this when trying to see
1288 attribute off-limits). I got bit by this when trying to see
1287 something inside the dis module.
1289 something inside the dis module.
1288
1290
1289 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1291 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1290
1292
1291 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1293 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1292 namespace for users and extension writers to hold data in. This
1294 namespace for users and extension writers to hold data in. This
1293 follows the discussion in
1295 follows the discussion in
1294 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1296 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1295
1297
1296 * IPython/completer.py (IPCompleter.complete): small patch to help
1298 * IPython/completer.py (IPCompleter.complete): small patch to help
1297 tab-completion under Emacs, after a suggestion by John Barnard
1299 tab-completion under Emacs, after a suggestion by John Barnard
1298 <barnarj-AT-ccf.org>.
1300 <barnarj-AT-ccf.org>.
1299
1301
1300 * IPython/Magic.py (Magic.extract_input_slices): added support for
1302 * IPython/Magic.py (Magic.extract_input_slices): added support for
1301 the slice notation in magics to use N-M to represent numbers N...M
1303 the slice notation in magics to use N-M to represent numbers N...M
1302 (closed endpoints). This is used by %macro and %save.
1304 (closed endpoints). This is used by %macro and %save.
1303
1305
1304 * IPython/completer.py (Completer.attr_matches): for modules which
1306 * IPython/completer.py (Completer.attr_matches): for modules which
1305 define __all__, complete only on those. After a patch by Jeffrey
1307 define __all__, complete only on those. After a patch by Jeffrey
1306 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1308 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1307 speed up this routine.
1309 speed up this routine.
1308
1310
1309 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1311 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1310 don't know if this is the end of it, but the behavior now is
1312 don't know if this is the end of it, but the behavior now is
1311 certainly much more correct. Note that coupled with macros,
1313 certainly much more correct. Note that coupled with macros,
1312 slightly surprising (at first) behavior may occur: a macro will in
1314 slightly surprising (at first) behavior may occur: a macro will in
1313 general expand to multiple lines of input, so upon exiting, the
1315 general expand to multiple lines of input, so upon exiting, the
1314 in/out counters will both be bumped by the corresponding amount
1316 in/out counters will both be bumped by the corresponding amount
1315 (as if the macro's contents had been typed interactively). Typing
1317 (as if the macro's contents had been typed interactively). Typing
1316 %hist will reveal the intermediate (silently processed) lines.
1318 %hist will reveal the intermediate (silently processed) lines.
1317
1319
1318 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1320 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1319 pickle to fail (%run was overwriting __main__ and not restoring
1321 pickle to fail (%run was overwriting __main__ and not restoring
1320 it, but pickle relies on __main__ to operate).
1322 it, but pickle relies on __main__ to operate).
1321
1323
1322 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1324 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1323 using properties, but forgot to make the main InteractiveShell
1325 using properties, but forgot to make the main InteractiveShell
1324 class a new-style class. Properties fail silently, and
1326 class a new-style class. Properties fail silently, and
1325 mysteriously, with old-style class (getters work, but
1327 mysteriously, with old-style class (getters work, but
1326 setters don't do anything).
1328 setters don't do anything).
1327
1329
1328 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1330 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1329
1331
1330 * IPython/Magic.py (magic_history): fix history reporting bug (I
1332 * IPython/Magic.py (magic_history): fix history reporting bug (I
1331 know some nasties are still there, I just can't seem to find a
1333 know some nasties are still there, I just can't seem to find a
1332 reproducible test case to track them down; the input history is
1334 reproducible test case to track them down; the input history is
1333 falling out of sync...)
1335 falling out of sync...)
1334
1336
1335 * IPython/iplib.py (handle_shell_escape): fix bug where both
1337 * IPython/iplib.py (handle_shell_escape): fix bug where both
1336 aliases and system accesses where broken for indented code (such
1338 aliases and system accesses where broken for indented code (such
1337 as loops).
1339 as loops).
1338
1340
1339 * IPython/genutils.py (shell): fix small but critical bug for
1341 * IPython/genutils.py (shell): fix small but critical bug for
1340 win32 system access.
1342 win32 system access.
1341
1343
1342 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1344 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1343
1345
1344 * IPython/iplib.py (showtraceback): remove use of the
1346 * IPython/iplib.py (showtraceback): remove use of the
1345 sys.last_{type/value/traceback} structures, which are non
1347 sys.last_{type/value/traceback} structures, which are non
1346 thread-safe.
1348 thread-safe.
1347 (_prefilter): change control flow to ensure that we NEVER
1349 (_prefilter): change control flow to ensure that we NEVER
1348 introspect objects when autocall is off. This will guarantee that
1350 introspect objects when autocall is off. This will guarantee that
1349 having an input line of the form 'x.y', where access to attribute
1351 having an input line of the form 'x.y', where access to attribute
1350 'y' has side effects, doesn't trigger the side effect TWICE. It
1352 'y' has side effects, doesn't trigger the side effect TWICE. It
1351 is important to note that, with autocall on, these side effects
1353 is important to note that, with autocall on, these side effects
1352 can still happen.
1354 can still happen.
1353 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1355 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1354 trio. IPython offers these three kinds of special calls which are
1356 trio. IPython offers these three kinds of special calls which are
1355 not python code, and it's a good thing to have their call method
1357 not python code, and it's a good thing to have their call method
1356 be accessible as pure python functions (not just special syntax at
1358 be accessible as pure python functions (not just special syntax at
1357 the command line). It gives us a better internal implementation
1359 the command line). It gives us a better internal implementation
1358 structure, as well as exposing these for user scripting more
1360 structure, as well as exposing these for user scripting more
1359 cleanly.
1361 cleanly.
1360
1362
1361 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1363 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1362 file. Now that they'll be more likely to be used with the
1364 file. Now that they'll be more likely to be used with the
1363 persistance system (%store), I want to make sure their module path
1365 persistance system (%store), I want to make sure their module path
1364 doesn't change in the future, so that we don't break things for
1366 doesn't change in the future, so that we don't break things for
1365 users' persisted data.
1367 users' persisted data.
1366
1368
1367 * IPython/iplib.py (autoindent_update): move indentation
1369 * IPython/iplib.py (autoindent_update): move indentation
1368 management into the _text_ processing loop, not the keyboard
1370 management into the _text_ processing loop, not the keyboard
1369 interactive one. This is necessary to correctly process non-typed
1371 interactive one. This is necessary to correctly process non-typed
1370 multiline input (such as macros).
1372 multiline input (such as macros).
1371
1373
1372 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1374 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1373 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1375 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1374 which was producing problems in the resulting manual.
1376 which was producing problems in the resulting manual.
1375 (magic_whos): improve reporting of instances (show their class,
1377 (magic_whos): improve reporting of instances (show their class,
1376 instead of simply printing 'instance' which isn't terribly
1378 instead of simply printing 'instance' which isn't terribly
1377 informative).
1379 informative).
1378
1380
1379 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1381 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1380 (minor mods) to support network shares under win32.
1382 (minor mods) to support network shares under win32.
1381
1383
1382 * IPython/winconsole.py (get_console_size): add new winconsole
1384 * IPython/winconsole.py (get_console_size): add new winconsole
1383 module and fixes to page_dumb() to improve its behavior under
1385 module and fixes to page_dumb() to improve its behavior under
1384 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1386 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1385
1387
1386 * IPython/Magic.py (Macro): simplified Macro class to just
1388 * IPython/Magic.py (Macro): simplified Macro class to just
1387 subclass list. We've had only 2.2 compatibility for a very long
1389 subclass list. We've had only 2.2 compatibility for a very long
1388 time, yet I was still avoiding subclassing the builtin types. No
1390 time, yet I was still avoiding subclassing the builtin types. No
1389 more (I'm also starting to use properties, though I won't shift to
1391 more (I'm also starting to use properties, though I won't shift to
1390 2.3-specific features quite yet).
1392 2.3-specific features quite yet).
1391 (magic_store): added Ville's patch for lightweight variable
1393 (magic_store): added Ville's patch for lightweight variable
1392 persistence, after a request on the user list by Matt Wilkie
1394 persistence, after a request on the user list by Matt Wilkie
1393 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1395 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1394 details.
1396 details.
1395
1397
1396 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1398 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1397 changed the default logfile name from 'ipython.log' to
1399 changed the default logfile name from 'ipython.log' to
1398 'ipython_log.py'. These logs are real python files, and now that
1400 'ipython_log.py'. These logs are real python files, and now that
1399 we have much better multiline support, people are more likely to
1401 we have much better multiline support, people are more likely to
1400 want to use them as such. Might as well name them correctly.
1402 want to use them as such. Might as well name them correctly.
1401
1403
1402 * IPython/Magic.py: substantial cleanup. While we can't stop
1404 * IPython/Magic.py: substantial cleanup. While we can't stop
1403 using magics as mixins, due to the existing customizations 'out
1405 using magics as mixins, due to the existing customizations 'out
1404 there' which rely on the mixin naming conventions, at least I
1406 there' which rely on the mixin naming conventions, at least I
1405 cleaned out all cross-class name usage. So once we are OK with
1407 cleaned out all cross-class name usage. So once we are OK with
1406 breaking compatibility, the two systems can be separated.
1408 breaking compatibility, the two systems can be separated.
1407
1409
1408 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1410 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1409 anymore, and the class is a fair bit less hideous as well. New
1411 anymore, and the class is a fair bit less hideous as well. New
1410 features were also introduced: timestamping of input, and logging
1412 features were also introduced: timestamping of input, and logging
1411 of output results. These are user-visible with the -t and -o
1413 of output results. These are user-visible with the -t and -o
1412 options to %logstart. Closes
1414 options to %logstart. Closes
1413 http://www.scipy.net/roundup/ipython/issue11 and a request by
1415 http://www.scipy.net/roundup/ipython/issue11 and a request by
1414 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1416 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1415
1417
1416 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1418 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1417
1419
1418 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1420 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1419 better handle backslashes in paths. See the thread 'More Windows
1421 better handle backslashes in paths. See the thread 'More Windows
1420 questions part 2 - \/ characters revisited' on the iypthon user
1422 questions part 2 - \/ characters revisited' on the iypthon user
1421 list:
1423 list:
1422 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1424 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1423
1425
1424 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1426 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1425
1427
1426 (InteractiveShell.__init__): change threaded shells to not use the
1428 (InteractiveShell.__init__): change threaded shells to not use the
1427 ipython crash handler. This was causing more problems than not,
1429 ipython crash handler. This was causing more problems than not,
1428 as exceptions in the main thread (GUI code, typically) would
1430 as exceptions in the main thread (GUI code, typically) would
1429 always show up as a 'crash', when they really weren't.
1431 always show up as a 'crash', when they really weren't.
1430
1432
1431 The colors and exception mode commands (%colors/%xmode) have been
1433 The colors and exception mode commands (%colors/%xmode) have been
1432 synchronized to also take this into account, so users can get
1434 synchronized to also take this into account, so users can get
1433 verbose exceptions for their threaded code as well. I also added
1435 verbose exceptions for their threaded code as well. I also added
1434 support for activating pdb inside this exception handler as well,
1436 support for activating pdb inside this exception handler as well,
1435 so now GUI authors can use IPython's enhanced pdb at runtime.
1437 so now GUI authors can use IPython's enhanced pdb at runtime.
1436
1438
1437 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1439 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1438 true by default, and add it to the shipped ipythonrc file. Since
1440 true by default, and add it to the shipped ipythonrc file. Since
1439 this asks the user before proceeding, I think it's OK to make it
1441 this asks the user before proceeding, I think it's OK to make it
1440 true by default.
1442 true by default.
1441
1443
1442 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1444 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1443 of the previous special-casing of input in the eval loop. I think
1445 of the previous special-casing of input in the eval loop. I think
1444 this is cleaner, as they really are commands and shouldn't have
1446 this is cleaner, as they really are commands and shouldn't have
1445 a special role in the middle of the core code.
1447 a special role in the middle of the core code.
1446
1448
1447 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1449 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1448
1450
1449 * IPython/iplib.py (edit_syntax_error): added support for
1451 * IPython/iplib.py (edit_syntax_error): added support for
1450 automatically reopening the editor if the file had a syntax error
1452 automatically reopening the editor if the file had a syntax error
1451 in it. Thanks to scottt who provided the patch at:
1453 in it. Thanks to scottt who provided the patch at:
1452 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1454 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1453 version committed).
1455 version committed).
1454
1456
1455 * IPython/iplib.py (handle_normal): add suport for multi-line
1457 * IPython/iplib.py (handle_normal): add suport for multi-line
1456 input with emtpy lines. This fixes
1458 input with emtpy lines. This fixes
1457 http://www.scipy.net/roundup/ipython/issue43 and a similar
1459 http://www.scipy.net/roundup/ipython/issue43 and a similar
1458 discussion on the user list.
1460 discussion on the user list.
1459
1461
1460 WARNING: a behavior change is necessarily introduced to support
1462 WARNING: a behavior change is necessarily introduced to support
1461 blank lines: now a single blank line with whitespace does NOT
1463 blank lines: now a single blank line with whitespace does NOT
1462 break the input loop, which means that when autoindent is on, by
1464 break the input loop, which means that when autoindent is on, by
1463 default hitting return on the next (indented) line does NOT exit.
1465 default hitting return on the next (indented) line does NOT exit.
1464
1466
1465 Instead, to exit a multiline input you can either have:
1467 Instead, to exit a multiline input you can either have:
1466
1468
1467 - TWO whitespace lines (just hit return again), or
1469 - TWO whitespace lines (just hit return again), or
1468 - a single whitespace line of a different length than provided
1470 - a single whitespace line of a different length than provided
1469 by the autoindent (add or remove a space).
1471 by the autoindent (add or remove a space).
1470
1472
1471 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1473 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1472 module to better organize all readline-related functionality.
1474 module to better organize all readline-related functionality.
1473 I've deleted FlexCompleter and put all completion clases here.
1475 I've deleted FlexCompleter and put all completion clases here.
1474
1476
1475 * IPython/iplib.py (raw_input): improve indentation management.
1477 * IPython/iplib.py (raw_input): improve indentation management.
1476 It is now possible to paste indented code with autoindent on, and
1478 It is now possible to paste indented code with autoindent on, and
1477 the code is interpreted correctly (though it still looks bad on
1479 the code is interpreted correctly (though it still looks bad on
1478 screen, due to the line-oriented nature of ipython).
1480 screen, due to the line-oriented nature of ipython).
1479 (MagicCompleter.complete): change behavior so that a TAB key on an
1481 (MagicCompleter.complete): change behavior so that a TAB key on an
1480 otherwise empty line actually inserts a tab, instead of completing
1482 otherwise empty line actually inserts a tab, instead of completing
1481 on the entire global namespace. This makes it easier to use the
1483 on the entire global namespace. This makes it easier to use the
1482 TAB key for indentation. After a request by Hans Meine
1484 TAB key for indentation. After a request by Hans Meine
1483 <hans_meine-AT-gmx.net>
1485 <hans_meine-AT-gmx.net>
1484 (_prefilter): add support so that typing plain 'exit' or 'quit'
1486 (_prefilter): add support so that typing plain 'exit' or 'quit'
1485 does a sensible thing. Originally I tried to deviate as little as
1487 does a sensible thing. Originally I tried to deviate as little as
1486 possible from the default python behavior, but even that one may
1488 possible from the default python behavior, but even that one may
1487 change in this direction (thread on python-dev to that effect).
1489 change in this direction (thread on python-dev to that effect).
1488 Regardless, ipython should do the right thing even if CPython's
1490 Regardless, ipython should do the right thing even if CPython's
1489 '>>>' prompt doesn't.
1491 '>>>' prompt doesn't.
1490 (InteractiveShell): removed subclassing code.InteractiveConsole
1492 (InteractiveShell): removed subclassing code.InteractiveConsole
1491 class. By now we'd overridden just about all of its methods: I've
1493 class. By now we'd overridden just about all of its methods: I've
1492 copied the remaining two over, and now ipython is a standalone
1494 copied the remaining two over, and now ipython is a standalone
1493 class. This will provide a clearer picture for the chainsaw
1495 class. This will provide a clearer picture for the chainsaw
1494 branch refactoring.
1496 branch refactoring.
1495
1497
1496 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1498 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1497
1499
1498 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1500 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1499 failures for objects which break when dir() is called on them.
1501 failures for objects which break when dir() is called on them.
1500
1502
1501 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1503 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1502 distinct local and global namespaces in the completer API. This
1504 distinct local and global namespaces in the completer API. This
1503 change allows us to properly handle completion with distinct
1505 change allows us to properly handle completion with distinct
1504 scopes, including in embedded instances (this had never really
1506 scopes, including in embedded instances (this had never really
1505 worked correctly).
1507 worked correctly).
1506
1508
1507 Note: this introduces a change in the constructor for
1509 Note: this introduces a change in the constructor for
1508 MagicCompleter, as a new global_namespace parameter is now the
1510 MagicCompleter, as a new global_namespace parameter is now the
1509 second argument (the others were bumped one position).
1511 second argument (the others were bumped one position).
1510
1512
1511 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1513 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1512
1514
1513 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1515 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1514 embedded instances (which can be done now thanks to Vivian's
1516 embedded instances (which can be done now thanks to Vivian's
1515 frame-handling fixes for pdb).
1517 frame-handling fixes for pdb).
1516 (InteractiveShell.__init__): Fix namespace handling problem in
1518 (InteractiveShell.__init__): Fix namespace handling problem in
1517 embedded instances. We were overwriting __main__ unconditionally,
1519 embedded instances. We were overwriting __main__ unconditionally,
1518 and this should only be done for 'full' (non-embedded) IPython;
1520 and this should only be done for 'full' (non-embedded) IPython;
1519 embedded instances must respect the caller's __main__. Thanks to
1521 embedded instances must respect the caller's __main__. Thanks to
1520 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1522 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1521
1523
1522 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1524 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1523
1525
1524 * setup.py: added download_url to setup(). This registers the
1526 * setup.py: added download_url to setup(). This registers the
1525 download address at PyPI, which is not only useful to humans
1527 download address at PyPI, which is not only useful to humans
1526 browsing the site, but is also picked up by setuptools (the Eggs
1528 browsing the site, but is also picked up by setuptools (the Eggs
1527 machinery). Thanks to Ville and R. Kern for the info/discussion
1529 machinery). Thanks to Ville and R. Kern for the info/discussion
1528 on this.
1530 on this.
1529
1531
1530 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1532 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1531
1533
1532 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1534 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1533 This brings a lot of nice functionality to the pdb mode, which now
1535 This brings a lot of nice functionality to the pdb mode, which now
1534 has tab-completion, syntax highlighting, and better stack handling
1536 has tab-completion, syntax highlighting, and better stack handling
1535 than before. Many thanks to Vivian De Smedt
1537 than before. Many thanks to Vivian De Smedt
1536 <vivian-AT-vdesmedt.com> for the original patches.
1538 <vivian-AT-vdesmedt.com> for the original patches.
1537
1539
1538 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1540 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1539
1541
1540 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1542 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1541 sequence to consistently accept the banner argument. The
1543 sequence to consistently accept the banner argument. The
1542 inconsistency was tripping SAGE, thanks to Gary Zablackis
1544 inconsistency was tripping SAGE, thanks to Gary Zablackis
1543 <gzabl-AT-yahoo.com> for the report.
1545 <gzabl-AT-yahoo.com> for the report.
1544
1546
1545 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1547 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1546
1548
1547 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1549 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1548 Fix bug where a naked 'alias' call in the ipythonrc file would
1550 Fix bug where a naked 'alias' call in the ipythonrc file would
1549 cause a crash. Bug reported by Jorgen Stenarson.
1551 cause a crash. Bug reported by Jorgen Stenarson.
1550
1552
1551 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1553 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1552
1554
1553 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1555 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1554 startup time.
1556 startup time.
1555
1557
1556 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1558 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1557 instances had introduced a bug with globals in normal code. Now
1559 instances had introduced a bug with globals in normal code. Now
1558 it's working in all cases.
1560 it's working in all cases.
1559
1561
1560 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1562 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1561 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1563 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1562 has been introduced to set the default case sensitivity of the
1564 has been introduced to set the default case sensitivity of the
1563 searches. Users can still select either mode at runtime on a
1565 searches. Users can still select either mode at runtime on a
1564 per-search basis.
1566 per-search basis.
1565
1567
1566 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1568 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1567
1569
1568 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1570 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1569 attributes in wildcard searches for subclasses. Modified version
1571 attributes in wildcard searches for subclasses. Modified version
1570 of a patch by Jorgen.
1572 of a patch by Jorgen.
1571
1573
1572 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1574 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1573
1575
1574 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1576 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1575 embedded instances. I added a user_global_ns attribute to the
1577 embedded instances. I added a user_global_ns attribute to the
1576 InteractiveShell class to handle this.
1578 InteractiveShell class to handle this.
1577
1579
1578 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1580 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1579
1581
1580 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1582 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1581 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1583 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1582 (reported under win32, but may happen also in other platforms).
1584 (reported under win32, but may happen also in other platforms).
1583 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1585 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1584
1586
1585 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1587 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1586
1588
1587 * IPython/Magic.py (magic_psearch): new support for wildcard
1589 * IPython/Magic.py (magic_psearch): new support for wildcard
1588 patterns. Now, typing ?a*b will list all names which begin with a
1590 patterns. Now, typing ?a*b will list all names which begin with a
1589 and end in b, for example. The %psearch magic has full
1591 and end in b, for example. The %psearch magic has full
1590 docstrings. Many thanks to JΓΆrgen Stenarson
1592 docstrings. Many thanks to JΓΆrgen Stenarson
1591 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1593 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1592 implementing this functionality.
1594 implementing this functionality.
1593
1595
1594 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1596 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1595
1597
1596 * Manual: fixed long-standing annoyance of double-dashes (as in
1598 * Manual: fixed long-standing annoyance of double-dashes (as in
1597 --prefix=~, for example) being stripped in the HTML version. This
1599 --prefix=~, for example) being stripped in the HTML version. This
1598 is a latex2html bug, but a workaround was provided. Many thanks
1600 is a latex2html bug, but a workaround was provided. Many thanks
1599 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1601 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1600 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1602 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1601 rolling. This seemingly small issue had tripped a number of users
1603 rolling. This seemingly small issue had tripped a number of users
1602 when first installing, so I'm glad to see it gone.
1604 when first installing, so I'm glad to see it gone.
1603
1605
1604 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1606 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1605
1607
1606 * IPython/Extensions/numeric_formats.py: fix missing import,
1608 * IPython/Extensions/numeric_formats.py: fix missing import,
1607 reported by Stephen Walton.
1609 reported by Stephen Walton.
1608
1610
1609 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1611 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1610
1612
1611 * IPython/demo.py: finish demo module, fully documented now.
1613 * IPython/demo.py: finish demo module, fully documented now.
1612
1614
1613 * IPython/genutils.py (file_read): simple little utility to read a
1615 * IPython/genutils.py (file_read): simple little utility to read a
1614 file and ensure it's closed afterwards.
1616 file and ensure it's closed afterwards.
1615
1617
1616 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1618 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1617
1619
1618 * IPython/demo.py (Demo.__init__): added support for individually
1620 * IPython/demo.py (Demo.__init__): added support for individually
1619 tagging blocks for automatic execution.
1621 tagging blocks for automatic execution.
1620
1622
1621 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1623 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1622 syntax-highlighted python sources, requested by John.
1624 syntax-highlighted python sources, requested by John.
1623
1625
1624 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1626 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1625
1627
1626 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1628 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1627 finishing.
1629 finishing.
1628
1630
1629 * IPython/genutils.py (shlex_split): moved from Magic to here,
1631 * IPython/genutils.py (shlex_split): moved from Magic to here,
1630 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1632 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1631
1633
1632 * IPython/demo.py (Demo.__init__): added support for silent
1634 * IPython/demo.py (Demo.__init__): added support for silent
1633 blocks, improved marks as regexps, docstrings written.
1635 blocks, improved marks as regexps, docstrings written.
1634 (Demo.__init__): better docstring, added support for sys.argv.
1636 (Demo.__init__): better docstring, added support for sys.argv.
1635
1637
1636 * IPython/genutils.py (marquee): little utility used by the demo
1638 * IPython/genutils.py (marquee): little utility used by the demo
1637 code, handy in general.
1639 code, handy in general.
1638
1640
1639 * IPython/demo.py (Demo.__init__): new class for interactive
1641 * IPython/demo.py (Demo.__init__): new class for interactive
1640 demos. Not documented yet, I just wrote it in a hurry for
1642 demos. Not documented yet, I just wrote it in a hurry for
1641 scipy'05. Will docstring later.
1643 scipy'05. Will docstring later.
1642
1644
1643 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1645 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1644
1646
1645 * IPython/Shell.py (sigint_handler): Drastic simplification which
1647 * IPython/Shell.py (sigint_handler): Drastic simplification which
1646 also seems to make Ctrl-C work correctly across threads! This is
1648 also seems to make Ctrl-C work correctly across threads! This is
1647 so simple, that I can't beleive I'd missed it before. Needs more
1649 so simple, that I can't beleive I'd missed it before. Needs more
1648 testing, though.
1650 testing, though.
1649 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1651 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1650 like this before...
1652 like this before...
1651
1653
1652 * IPython/genutils.py (get_home_dir): add protection against
1654 * IPython/genutils.py (get_home_dir): add protection against
1653 non-dirs in win32 registry.
1655 non-dirs in win32 registry.
1654
1656
1655 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1657 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1656 bug where dict was mutated while iterating (pysh crash).
1658 bug where dict was mutated while iterating (pysh crash).
1657
1659
1658 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1660 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1659
1661
1660 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1662 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1661 spurious newlines added by this routine. After a report by
1663 spurious newlines added by this routine. After a report by
1662 F. Mantegazza.
1664 F. Mantegazza.
1663
1665
1664 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1666 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1665
1667
1666 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1668 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1667 calls. These were a leftover from the GTK 1.x days, and can cause
1669 calls. These were a leftover from the GTK 1.x days, and can cause
1668 problems in certain cases (after a report by John Hunter).
1670 problems in certain cases (after a report by John Hunter).
1669
1671
1670 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1672 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1671 os.getcwd() fails at init time. Thanks to patch from David Remahl
1673 os.getcwd() fails at init time. Thanks to patch from David Remahl
1672 <chmod007-AT-mac.com>.
1674 <chmod007-AT-mac.com>.
1673 (InteractiveShell.__init__): prevent certain special magics from
1675 (InteractiveShell.__init__): prevent certain special magics from
1674 being shadowed by aliases. Closes
1676 being shadowed by aliases. Closes
1675 http://www.scipy.net/roundup/ipython/issue41.
1677 http://www.scipy.net/roundup/ipython/issue41.
1676
1678
1677 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1679 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1678
1680
1679 * IPython/iplib.py (InteractiveShell.complete): Added new
1681 * IPython/iplib.py (InteractiveShell.complete): Added new
1680 top-level completion method to expose the completion mechanism
1682 top-level completion method to expose the completion mechanism
1681 beyond readline-based environments.
1683 beyond readline-based environments.
1682
1684
1683 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1685 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1684
1686
1685 * tools/ipsvnc (svnversion): fix svnversion capture.
1687 * tools/ipsvnc (svnversion): fix svnversion capture.
1686
1688
1687 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1689 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1688 attribute to self, which was missing. Before, it was set by a
1690 attribute to self, which was missing. Before, it was set by a
1689 routine which in certain cases wasn't being called, so the
1691 routine which in certain cases wasn't being called, so the
1690 instance could end up missing the attribute. This caused a crash.
1692 instance could end up missing the attribute. This caused a crash.
1691 Closes http://www.scipy.net/roundup/ipython/issue40.
1693 Closes http://www.scipy.net/roundup/ipython/issue40.
1692
1694
1693 2005-08-16 Fernando Perez <fperez@colorado.edu>
1695 2005-08-16 Fernando Perez <fperez@colorado.edu>
1694
1696
1695 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1697 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1696 contains non-string attribute. Closes
1698 contains non-string attribute. Closes
1697 http://www.scipy.net/roundup/ipython/issue38.
1699 http://www.scipy.net/roundup/ipython/issue38.
1698
1700
1699 2005-08-14 Fernando Perez <fperez@colorado.edu>
1701 2005-08-14 Fernando Perez <fperez@colorado.edu>
1700
1702
1701 * tools/ipsvnc: Minor improvements, to add changeset info.
1703 * tools/ipsvnc: Minor improvements, to add changeset info.
1702
1704
1703 2005-08-12 Fernando Perez <fperez@colorado.edu>
1705 2005-08-12 Fernando Perez <fperez@colorado.edu>
1704
1706
1705 * IPython/iplib.py (runsource): remove self.code_to_run_src
1707 * IPython/iplib.py (runsource): remove self.code_to_run_src
1706 attribute. I realized this is nothing more than
1708 attribute. I realized this is nothing more than
1707 '\n'.join(self.buffer), and having the same data in two different
1709 '\n'.join(self.buffer), and having the same data in two different
1708 places is just asking for synchronization bugs. This may impact
1710 places is just asking for synchronization bugs. This may impact
1709 people who have custom exception handlers, so I need to warn
1711 people who have custom exception handlers, so I need to warn
1710 ipython-dev about it (F. Mantegazza may use them).
1712 ipython-dev about it (F. Mantegazza may use them).
1711
1713
1712 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1714 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1713
1715
1714 * IPython/genutils.py: fix 2.2 compatibility (generators)
1716 * IPython/genutils.py: fix 2.2 compatibility (generators)
1715
1717
1716 2005-07-18 Fernando Perez <fperez@colorado.edu>
1718 2005-07-18 Fernando Perez <fperez@colorado.edu>
1717
1719
1718 * IPython/genutils.py (get_home_dir): fix to help users with
1720 * IPython/genutils.py (get_home_dir): fix to help users with
1719 invalid $HOME under win32.
1721 invalid $HOME under win32.
1720
1722
1721 2005-07-17 Fernando Perez <fperez@colorado.edu>
1723 2005-07-17 Fernando Perez <fperez@colorado.edu>
1722
1724
1723 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1725 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1724 some old hacks and clean up a bit other routines; code should be
1726 some old hacks and clean up a bit other routines; code should be
1725 simpler and a bit faster.
1727 simpler and a bit faster.
1726
1728
1727 * IPython/iplib.py (interact): removed some last-resort attempts
1729 * IPython/iplib.py (interact): removed some last-resort attempts
1728 to survive broken stdout/stderr. That code was only making it
1730 to survive broken stdout/stderr. That code was only making it
1729 harder to abstract out the i/o (necessary for gui integration),
1731 harder to abstract out the i/o (necessary for gui integration),
1730 and the crashes it could prevent were extremely rare in practice
1732 and the crashes it could prevent were extremely rare in practice
1731 (besides being fully user-induced in a pretty violent manner).
1733 (besides being fully user-induced in a pretty violent manner).
1732
1734
1733 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1735 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1734 Nothing major yet, but the code is simpler to read; this should
1736 Nothing major yet, but the code is simpler to read; this should
1735 make it easier to do more serious modifications in the future.
1737 make it easier to do more serious modifications in the future.
1736
1738
1737 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1739 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1738 which broke in .15 (thanks to a report by Ville).
1740 which broke in .15 (thanks to a report by Ville).
1739
1741
1740 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1742 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1741 be quite correct, I know next to nothing about unicode). This
1743 be quite correct, I know next to nothing about unicode). This
1742 will allow unicode strings to be used in prompts, amongst other
1744 will allow unicode strings to be used in prompts, amongst other
1743 cases. It also will prevent ipython from crashing when unicode
1745 cases. It also will prevent ipython from crashing when unicode
1744 shows up unexpectedly in many places. If ascii encoding fails, we
1746 shows up unexpectedly in many places. If ascii encoding fails, we
1745 assume utf_8. Currently the encoding is not a user-visible
1747 assume utf_8. Currently the encoding is not a user-visible
1746 setting, though it could be made so if there is demand for it.
1748 setting, though it could be made so if there is demand for it.
1747
1749
1748 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1750 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1749
1751
1750 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1752 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1751
1753
1752 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1754 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1753
1755
1754 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1756 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1755 code can work transparently for 2.2/2.3.
1757 code can work transparently for 2.2/2.3.
1756
1758
1757 2005-07-16 Fernando Perez <fperez@colorado.edu>
1759 2005-07-16 Fernando Perez <fperez@colorado.edu>
1758
1760
1759 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1761 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1760 out of the color scheme table used for coloring exception
1762 out of the color scheme table used for coloring exception
1761 tracebacks. This allows user code to add new schemes at runtime.
1763 tracebacks. This allows user code to add new schemes at runtime.
1762 This is a minimally modified version of the patch at
1764 This is a minimally modified version of the patch at
1763 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1765 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1764 for the contribution.
1766 for the contribution.
1765
1767
1766 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1768 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1767 slightly modified version of the patch in
1769 slightly modified version of the patch in
1768 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1770 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1769 to remove the previous try/except solution (which was costlier).
1771 to remove the previous try/except solution (which was costlier).
1770 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1772 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1771
1773
1772 2005-06-08 Fernando Perez <fperez@colorado.edu>
1774 2005-06-08 Fernando Perez <fperez@colorado.edu>
1773
1775
1774 * IPython/iplib.py (write/write_err): Add methods to abstract all
1776 * IPython/iplib.py (write/write_err): Add methods to abstract all
1775 I/O a bit more.
1777 I/O a bit more.
1776
1778
1777 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1779 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1778 warning, reported by Aric Hagberg, fix by JD Hunter.
1780 warning, reported by Aric Hagberg, fix by JD Hunter.
1779
1781
1780 2005-06-02 *** Released version 0.6.15
1782 2005-06-02 *** Released version 0.6.15
1781
1783
1782 2005-06-01 Fernando Perez <fperez@colorado.edu>
1784 2005-06-01 Fernando Perez <fperez@colorado.edu>
1783
1785
1784 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1786 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1785 tab-completion of filenames within open-quoted strings. Note that
1787 tab-completion of filenames within open-quoted strings. Note that
1786 this requires that in ~/.ipython/ipythonrc, users change the
1788 this requires that in ~/.ipython/ipythonrc, users change the
1787 readline delimiters configuration to read:
1789 readline delimiters configuration to read:
1788
1790
1789 readline_remove_delims -/~
1791 readline_remove_delims -/~
1790
1792
1791
1793
1792 2005-05-31 *** Released version 0.6.14
1794 2005-05-31 *** Released version 0.6.14
1793
1795
1794 2005-05-29 Fernando Perez <fperez@colorado.edu>
1796 2005-05-29 Fernando Perez <fperez@colorado.edu>
1795
1797
1796 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1798 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1797 with files not on the filesystem. Reported by Eliyahu Sandler
1799 with files not on the filesystem. Reported by Eliyahu Sandler
1798 <eli@gondolin.net>
1800 <eli@gondolin.net>
1799
1801
1800 2005-05-22 Fernando Perez <fperez@colorado.edu>
1802 2005-05-22 Fernando Perez <fperez@colorado.edu>
1801
1803
1802 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1804 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1803 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1805 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1804
1806
1805 2005-05-19 Fernando Perez <fperez@colorado.edu>
1807 2005-05-19 Fernando Perez <fperez@colorado.edu>
1806
1808
1807 * IPython/iplib.py (safe_execfile): close a file which could be
1809 * IPython/iplib.py (safe_execfile): close a file which could be
1808 left open (causing problems in win32, which locks open files).
1810 left open (causing problems in win32, which locks open files).
1809 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1811 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1810
1812
1811 2005-05-18 Fernando Perez <fperez@colorado.edu>
1813 2005-05-18 Fernando Perez <fperez@colorado.edu>
1812
1814
1813 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1815 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1814 keyword arguments correctly to safe_execfile().
1816 keyword arguments correctly to safe_execfile().
1815
1817
1816 2005-05-13 Fernando Perez <fperez@colorado.edu>
1818 2005-05-13 Fernando Perez <fperez@colorado.edu>
1817
1819
1818 * ipython.1: Added info about Qt to manpage, and threads warning
1820 * ipython.1: Added info about Qt to manpage, and threads warning
1819 to usage page (invoked with --help).
1821 to usage page (invoked with --help).
1820
1822
1821 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1823 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1822 new matcher (it goes at the end of the priority list) to do
1824 new matcher (it goes at the end of the priority list) to do
1823 tab-completion on named function arguments. Submitted by George
1825 tab-completion on named function arguments. Submitted by George
1824 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1826 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1825 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1827 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1826 for more details.
1828 for more details.
1827
1829
1828 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1830 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1829 SystemExit exceptions in the script being run. Thanks to a report
1831 SystemExit exceptions in the script being run. Thanks to a report
1830 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1832 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1831 producing very annoying behavior when running unit tests.
1833 producing very annoying behavior when running unit tests.
1832
1834
1833 2005-05-12 Fernando Perez <fperez@colorado.edu>
1835 2005-05-12 Fernando Perez <fperez@colorado.edu>
1834
1836
1835 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1837 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1836 which I'd broken (again) due to a changed regexp. In the process,
1838 which I'd broken (again) due to a changed regexp. In the process,
1837 added ';' as an escape to auto-quote the whole line without
1839 added ';' as an escape to auto-quote the whole line without
1838 splitting its arguments. Thanks to a report by Jerry McRae
1840 splitting its arguments. Thanks to a report by Jerry McRae
1839 <qrs0xyc02-AT-sneakemail.com>.
1841 <qrs0xyc02-AT-sneakemail.com>.
1840
1842
1841 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1843 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1842 possible crashes caused by a TokenError. Reported by Ed Schofield
1844 possible crashes caused by a TokenError. Reported by Ed Schofield
1843 <schofield-AT-ftw.at>.
1845 <schofield-AT-ftw.at>.
1844
1846
1845 2005-05-06 Fernando Perez <fperez@colorado.edu>
1847 2005-05-06 Fernando Perez <fperez@colorado.edu>
1846
1848
1847 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1849 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1848
1850
1849 2005-04-29 Fernando Perez <fperez@colorado.edu>
1851 2005-04-29 Fernando Perez <fperez@colorado.edu>
1850
1852
1851 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1853 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1852 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1854 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1853 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1855 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1854 which provides support for Qt interactive usage (similar to the
1856 which provides support for Qt interactive usage (similar to the
1855 existing one for WX and GTK). This had been often requested.
1857 existing one for WX and GTK). This had been often requested.
1856
1858
1857 2005-04-14 *** Released version 0.6.13
1859 2005-04-14 *** Released version 0.6.13
1858
1860
1859 2005-04-08 Fernando Perez <fperez@colorado.edu>
1861 2005-04-08 Fernando Perez <fperez@colorado.edu>
1860
1862
1861 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1863 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1862 from _ofind, which gets called on almost every input line. Now,
1864 from _ofind, which gets called on almost every input line. Now,
1863 we only try to get docstrings if they are actually going to be
1865 we only try to get docstrings if they are actually going to be
1864 used (the overhead of fetching unnecessary docstrings can be
1866 used (the overhead of fetching unnecessary docstrings can be
1865 noticeable for certain objects, such as Pyro proxies).
1867 noticeable for certain objects, such as Pyro proxies).
1866
1868
1867 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1869 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1868 for completers. For some reason I had been passing them the state
1870 for completers. For some reason I had been passing them the state
1869 variable, which completers never actually need, and was in
1871 variable, which completers never actually need, and was in
1870 conflict with the rlcompleter API. Custom completers ONLY need to
1872 conflict with the rlcompleter API. Custom completers ONLY need to
1871 take the text parameter.
1873 take the text parameter.
1872
1874
1873 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1875 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1874 work correctly in pysh. I've also moved all the logic which used
1876 work correctly in pysh. I've also moved all the logic which used
1875 to be in pysh.py here, which will prevent problems with future
1877 to be in pysh.py here, which will prevent problems with future
1876 upgrades. However, this time I must warn users to update their
1878 upgrades. However, this time I must warn users to update their
1877 pysh profile to include the line
1879 pysh profile to include the line
1878
1880
1879 import_all IPython.Extensions.InterpreterExec
1881 import_all IPython.Extensions.InterpreterExec
1880
1882
1881 because otherwise things won't work for them. They MUST also
1883 because otherwise things won't work for them. They MUST also
1882 delete pysh.py and the line
1884 delete pysh.py and the line
1883
1885
1884 execfile pysh.py
1886 execfile pysh.py
1885
1887
1886 from their ipythonrc-pysh.
1888 from their ipythonrc-pysh.
1887
1889
1888 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1890 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1889 robust in the face of objects whose dir() returns non-strings
1891 robust in the face of objects whose dir() returns non-strings
1890 (which it shouldn't, but some broken libs like ITK do). Thanks to
1892 (which it shouldn't, but some broken libs like ITK do). Thanks to
1891 a patch by John Hunter (implemented differently, though). Also
1893 a patch by John Hunter (implemented differently, though). Also
1892 minor improvements by using .extend instead of + on lists.
1894 minor improvements by using .extend instead of + on lists.
1893
1895
1894 * pysh.py:
1896 * pysh.py:
1895
1897
1896 2005-04-06 Fernando Perez <fperez@colorado.edu>
1898 2005-04-06 Fernando Perez <fperez@colorado.edu>
1897
1899
1898 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1900 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1899 by default, so that all users benefit from it. Those who don't
1901 by default, so that all users benefit from it. Those who don't
1900 want it can still turn it off.
1902 want it can still turn it off.
1901
1903
1902 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1904 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1903 config file, I'd forgotten about this, so users were getting it
1905 config file, I'd forgotten about this, so users were getting it
1904 off by default.
1906 off by default.
1905
1907
1906 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1908 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1907 consistency. Now magics can be called in multiline statements,
1909 consistency. Now magics can be called in multiline statements,
1908 and python variables can be expanded in magic calls via $var.
1910 and python variables can be expanded in magic calls via $var.
1909 This makes the magic system behave just like aliases or !system
1911 This makes the magic system behave just like aliases or !system
1910 calls.
1912 calls.
1911
1913
1912 2005-03-28 Fernando Perez <fperez@colorado.edu>
1914 2005-03-28 Fernando Perez <fperez@colorado.edu>
1913
1915
1914 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1916 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1915 expensive string additions for building command. Add support for
1917 expensive string additions for building command. Add support for
1916 trailing ';' when autocall is used.
1918 trailing ';' when autocall is used.
1917
1919
1918 2005-03-26 Fernando Perez <fperez@colorado.edu>
1920 2005-03-26 Fernando Perez <fperez@colorado.edu>
1919
1921
1920 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1922 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1921 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1923 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1922 ipython.el robust against prompts with any number of spaces
1924 ipython.el robust against prompts with any number of spaces
1923 (including 0) after the ':' character.
1925 (including 0) after the ':' character.
1924
1926
1925 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1927 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1926 continuation prompt, which misled users to think the line was
1928 continuation prompt, which misled users to think the line was
1927 already indented. Closes debian Bug#300847, reported to me by
1929 already indented. Closes debian Bug#300847, reported to me by
1928 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1930 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1929
1931
1930 2005-03-23 Fernando Perez <fperez@colorado.edu>
1932 2005-03-23 Fernando Perez <fperez@colorado.edu>
1931
1933
1932 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1934 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1933 properly aligned if they have embedded newlines.
1935 properly aligned if they have embedded newlines.
1934
1936
1935 * IPython/iplib.py (runlines): Add a public method to expose
1937 * IPython/iplib.py (runlines): Add a public method to expose
1936 IPython's code execution machinery, so that users can run strings
1938 IPython's code execution machinery, so that users can run strings
1937 as if they had been typed at the prompt interactively.
1939 as if they had been typed at the prompt interactively.
1938 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1940 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1939 methods which can call the system shell, but with python variable
1941 methods which can call the system shell, but with python variable
1940 expansion. The three such methods are: __IPYTHON__.system,
1942 expansion. The three such methods are: __IPYTHON__.system,
1941 .getoutput and .getoutputerror. These need to be documented in a
1943 .getoutput and .getoutputerror. These need to be documented in a
1942 'public API' section (to be written) of the manual.
1944 'public API' section (to be written) of the manual.
1943
1945
1944 2005-03-20 Fernando Perez <fperez@colorado.edu>
1946 2005-03-20 Fernando Perez <fperez@colorado.edu>
1945
1947
1946 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1948 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1947 for custom exception handling. This is quite powerful, and it
1949 for custom exception handling. This is quite powerful, and it
1948 allows for user-installable exception handlers which can trap
1950 allows for user-installable exception handlers which can trap
1949 custom exceptions at runtime and treat them separately from
1951 custom exceptions at runtime and treat them separately from
1950 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1952 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1951 Mantegazza <mantegazza-AT-ill.fr>.
1953 Mantegazza <mantegazza-AT-ill.fr>.
1952 (InteractiveShell.set_custom_completer): public API function to
1954 (InteractiveShell.set_custom_completer): public API function to
1953 add new completers at runtime.
1955 add new completers at runtime.
1954
1956
1955 2005-03-19 Fernando Perez <fperez@colorado.edu>
1957 2005-03-19 Fernando Perez <fperez@colorado.edu>
1956
1958
1957 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1959 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1958 allow objects which provide their docstrings via non-standard
1960 allow objects which provide their docstrings via non-standard
1959 mechanisms (like Pyro proxies) to still be inspected by ipython's
1961 mechanisms (like Pyro proxies) to still be inspected by ipython's
1960 ? system.
1962 ? system.
1961
1963
1962 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1964 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1963 automatic capture system. I tried quite hard to make it work
1965 automatic capture system. I tried quite hard to make it work
1964 reliably, and simply failed. I tried many combinations with the
1966 reliably, and simply failed. I tried many combinations with the
1965 subprocess module, but eventually nothing worked in all needed
1967 subprocess module, but eventually nothing worked in all needed
1966 cases (not blocking stdin for the child, duplicating stdout
1968 cases (not blocking stdin for the child, duplicating stdout
1967 without blocking, etc). The new %sc/%sx still do capture to these
1969 without blocking, etc). The new %sc/%sx still do capture to these
1968 magical list/string objects which make shell use much more
1970 magical list/string objects which make shell use much more
1969 conveninent, so not all is lost.
1971 conveninent, so not all is lost.
1970
1972
1971 XXX - FIX MANUAL for the change above!
1973 XXX - FIX MANUAL for the change above!
1972
1974
1973 (runsource): I copied code.py's runsource() into ipython to modify
1975 (runsource): I copied code.py's runsource() into ipython to modify
1974 it a bit. Now the code object and source to be executed are
1976 it a bit. Now the code object and source to be executed are
1975 stored in ipython. This makes this info accessible to third-party
1977 stored in ipython. This makes this info accessible to third-party
1976 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1978 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1977 Mantegazza <mantegazza-AT-ill.fr>.
1979 Mantegazza <mantegazza-AT-ill.fr>.
1978
1980
1979 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1981 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1980 history-search via readline (like C-p/C-n). I'd wanted this for a
1982 history-search via readline (like C-p/C-n). I'd wanted this for a
1981 long time, but only recently found out how to do it. For users
1983 long time, but only recently found out how to do it. For users
1982 who already have their ipythonrc files made and want this, just
1984 who already have their ipythonrc files made and want this, just
1983 add:
1985 add:
1984
1986
1985 readline_parse_and_bind "\e[A": history-search-backward
1987 readline_parse_and_bind "\e[A": history-search-backward
1986 readline_parse_and_bind "\e[B": history-search-forward
1988 readline_parse_and_bind "\e[B": history-search-forward
1987
1989
1988 2005-03-18 Fernando Perez <fperez@colorado.edu>
1990 2005-03-18 Fernando Perez <fperez@colorado.edu>
1989
1991
1990 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1992 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1991 LSString and SList classes which allow transparent conversions
1993 LSString and SList classes which allow transparent conversions
1992 between list mode and whitespace-separated string.
1994 between list mode and whitespace-separated string.
1993 (magic_r): Fix recursion problem in %r.
1995 (magic_r): Fix recursion problem in %r.
1994
1996
1995 * IPython/genutils.py (LSString): New class to be used for
1997 * IPython/genutils.py (LSString): New class to be used for
1996 automatic storage of the results of all alias/system calls in _o
1998 automatic storage of the results of all alias/system calls in _o
1997 and _e (stdout/err). These provide a .l/.list attribute which
1999 and _e (stdout/err). These provide a .l/.list attribute which
1998 does automatic splitting on newlines. This means that for most
2000 does automatic splitting on newlines. This means that for most
1999 uses, you'll never need to do capturing of output with %sc/%sx
2001 uses, you'll never need to do capturing of output with %sc/%sx
2000 anymore, since ipython keeps this always done for you. Note that
2002 anymore, since ipython keeps this always done for you. Note that
2001 only the LAST results are stored, the _o/e variables are
2003 only the LAST results are stored, the _o/e variables are
2002 overwritten on each call. If you need to save their contents
2004 overwritten on each call. If you need to save their contents
2003 further, simply bind them to any other name.
2005 further, simply bind them to any other name.
2004
2006
2005 2005-03-17 Fernando Perez <fperez@colorado.edu>
2007 2005-03-17 Fernando Perez <fperez@colorado.edu>
2006
2008
2007 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2009 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2008 prompt namespace handling.
2010 prompt namespace handling.
2009
2011
2010 2005-03-16 Fernando Perez <fperez@colorado.edu>
2012 2005-03-16 Fernando Perez <fperez@colorado.edu>
2011
2013
2012 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2014 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2013 classic prompts to be '>>> ' (final space was missing, and it
2015 classic prompts to be '>>> ' (final space was missing, and it
2014 trips the emacs python mode).
2016 trips the emacs python mode).
2015 (BasePrompt.__str__): Added safe support for dynamic prompt
2017 (BasePrompt.__str__): Added safe support for dynamic prompt
2016 strings. Now you can set your prompt string to be '$x', and the
2018 strings. Now you can set your prompt string to be '$x', and the
2017 value of x will be printed from your interactive namespace. The
2019 value of x will be printed from your interactive namespace. The
2018 interpolation syntax includes the full Itpl support, so
2020 interpolation syntax includes the full Itpl support, so
2019 ${foo()+x+bar()} is a valid prompt string now, and the function
2021 ${foo()+x+bar()} is a valid prompt string now, and the function
2020 calls will be made at runtime.
2022 calls will be made at runtime.
2021
2023
2022 2005-03-15 Fernando Perez <fperez@colorado.edu>
2024 2005-03-15 Fernando Perez <fperez@colorado.edu>
2023
2025
2024 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2026 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2025 avoid name clashes in pylab. %hist still works, it just forwards
2027 avoid name clashes in pylab. %hist still works, it just forwards
2026 the call to %history.
2028 the call to %history.
2027
2029
2028 2005-03-02 *** Released version 0.6.12
2030 2005-03-02 *** Released version 0.6.12
2029
2031
2030 2005-03-02 Fernando Perez <fperez@colorado.edu>
2032 2005-03-02 Fernando Perez <fperez@colorado.edu>
2031
2033
2032 * IPython/iplib.py (handle_magic): log magic calls properly as
2034 * IPython/iplib.py (handle_magic): log magic calls properly as
2033 ipmagic() function calls.
2035 ipmagic() function calls.
2034
2036
2035 * IPython/Magic.py (magic_time): Improved %time to support
2037 * IPython/Magic.py (magic_time): Improved %time to support
2036 statements and provide wall-clock as well as CPU time.
2038 statements and provide wall-clock as well as CPU time.
2037
2039
2038 2005-02-27 Fernando Perez <fperez@colorado.edu>
2040 2005-02-27 Fernando Perez <fperez@colorado.edu>
2039
2041
2040 * IPython/hooks.py: New hooks module, to expose user-modifiable
2042 * IPython/hooks.py: New hooks module, to expose user-modifiable
2041 IPython functionality in a clean manner. For now only the editor
2043 IPython functionality in a clean manner. For now only the editor
2042 hook is actually written, and other thigns which I intend to turn
2044 hook is actually written, and other thigns which I intend to turn
2043 into proper hooks aren't yet there. The display and prefilter
2045 into proper hooks aren't yet there. The display and prefilter
2044 stuff, for example, should be hooks. But at least now the
2046 stuff, for example, should be hooks. But at least now the
2045 framework is in place, and the rest can be moved here with more
2047 framework is in place, and the rest can be moved here with more
2046 time later. IPython had had a .hooks variable for a long time for
2048 time later. IPython had had a .hooks variable for a long time for
2047 this purpose, but I'd never actually used it for anything.
2049 this purpose, but I'd never actually used it for anything.
2048
2050
2049 2005-02-26 Fernando Perez <fperez@colorado.edu>
2051 2005-02-26 Fernando Perez <fperez@colorado.edu>
2050
2052
2051 * IPython/ipmaker.py (make_IPython): make the default ipython
2053 * IPython/ipmaker.py (make_IPython): make the default ipython
2052 directory be called _ipython under win32, to follow more the
2054 directory be called _ipython under win32, to follow more the
2053 naming peculiarities of that platform (where buggy software like
2055 naming peculiarities of that platform (where buggy software like
2054 Visual Sourcesafe breaks with .named directories). Reported by
2056 Visual Sourcesafe breaks with .named directories). Reported by
2055 Ville Vainio.
2057 Ville Vainio.
2056
2058
2057 2005-02-23 Fernando Perez <fperez@colorado.edu>
2059 2005-02-23 Fernando Perez <fperez@colorado.edu>
2058
2060
2059 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2061 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2060 auto_aliases for win32 which were causing problems. Users can
2062 auto_aliases for win32 which were causing problems. Users can
2061 define the ones they personally like.
2063 define the ones they personally like.
2062
2064
2063 2005-02-21 Fernando Perez <fperez@colorado.edu>
2065 2005-02-21 Fernando Perez <fperez@colorado.edu>
2064
2066
2065 * IPython/Magic.py (magic_time): new magic to time execution of
2067 * IPython/Magic.py (magic_time): new magic to time execution of
2066 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2068 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2067
2069
2068 2005-02-19 Fernando Perez <fperez@colorado.edu>
2070 2005-02-19 Fernando Perez <fperez@colorado.edu>
2069
2071
2070 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2072 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2071 into keys (for prompts, for example).
2073 into keys (for prompts, for example).
2072
2074
2073 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2075 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2074 prompts in case users want them. This introduces a small behavior
2076 prompts in case users want them. This introduces a small behavior
2075 change: ipython does not automatically add a space to all prompts
2077 change: ipython does not automatically add a space to all prompts
2076 anymore. To get the old prompts with a space, users should add it
2078 anymore. To get the old prompts with a space, users should add it
2077 manually to their ipythonrc file, so for example prompt_in1 should
2079 manually to their ipythonrc file, so for example prompt_in1 should
2078 now read 'In [\#]: ' instead of 'In [\#]:'.
2080 now read 'In [\#]: ' instead of 'In [\#]:'.
2079 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2081 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2080 file) to control left-padding of secondary prompts.
2082 file) to control left-padding of secondary prompts.
2081
2083
2082 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2084 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2083 the profiler can't be imported. Fix for Debian, which removed
2085 the profiler can't be imported. Fix for Debian, which removed
2084 profile.py because of License issues. I applied a slightly
2086 profile.py because of License issues. I applied a slightly
2085 modified version of the original Debian patch at
2087 modified version of the original Debian patch at
2086 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2088 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2087
2089
2088 2005-02-17 Fernando Perez <fperez@colorado.edu>
2090 2005-02-17 Fernando Perez <fperez@colorado.edu>
2089
2091
2090 * IPython/genutils.py (native_line_ends): Fix bug which would
2092 * IPython/genutils.py (native_line_ends): Fix bug which would
2091 cause improper line-ends under win32 b/c I was not opening files
2093 cause improper line-ends under win32 b/c I was not opening files
2092 in binary mode. Bug report and fix thanks to Ville.
2094 in binary mode. Bug report and fix thanks to Ville.
2093
2095
2094 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2096 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2095 trying to catch spurious foo[1] autocalls. My fix actually broke
2097 trying to catch spurious foo[1] autocalls. My fix actually broke
2096 ',/' autoquote/call with explicit escape (bad regexp).
2098 ',/' autoquote/call with explicit escape (bad regexp).
2097
2099
2098 2005-02-15 *** Released version 0.6.11
2100 2005-02-15 *** Released version 0.6.11
2099
2101
2100 2005-02-14 Fernando Perez <fperez@colorado.edu>
2102 2005-02-14 Fernando Perez <fperez@colorado.edu>
2101
2103
2102 * IPython/background_jobs.py: New background job management
2104 * IPython/background_jobs.py: New background job management
2103 subsystem. This is implemented via a new set of classes, and
2105 subsystem. This is implemented via a new set of classes, and
2104 IPython now provides a builtin 'jobs' object for background job
2106 IPython now provides a builtin 'jobs' object for background job
2105 execution. A convenience %bg magic serves as a lightweight
2107 execution. A convenience %bg magic serves as a lightweight
2106 frontend for starting the more common type of calls. This was
2108 frontend for starting the more common type of calls. This was
2107 inspired by discussions with B. Granger and the BackgroundCommand
2109 inspired by discussions with B. Granger and the BackgroundCommand
2108 class described in the book Python Scripting for Computational
2110 class described in the book Python Scripting for Computational
2109 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2111 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2110 (although ultimately no code from this text was used, as IPython's
2112 (although ultimately no code from this text was used, as IPython's
2111 system is a separate implementation).
2113 system is a separate implementation).
2112
2114
2113 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2115 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2114 to control the completion of single/double underscore names
2116 to control the completion of single/double underscore names
2115 separately. As documented in the example ipytonrc file, the
2117 separately. As documented in the example ipytonrc file, the
2116 readline_omit__names variable can now be set to 2, to omit even
2118 readline_omit__names variable can now be set to 2, to omit even
2117 single underscore names. Thanks to a patch by Brian Wong
2119 single underscore names. Thanks to a patch by Brian Wong
2118 <BrianWong-AT-AirgoNetworks.Com>.
2120 <BrianWong-AT-AirgoNetworks.Com>.
2119 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2121 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2120 be autocalled as foo([1]) if foo were callable. A problem for
2122 be autocalled as foo([1]) if foo were callable. A problem for
2121 things which are both callable and implement __getitem__.
2123 things which are both callable and implement __getitem__.
2122 (init_readline): Fix autoindentation for win32. Thanks to a patch
2124 (init_readline): Fix autoindentation for win32. Thanks to a patch
2123 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2125 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2124
2126
2125 2005-02-12 Fernando Perez <fperez@colorado.edu>
2127 2005-02-12 Fernando Perez <fperez@colorado.edu>
2126
2128
2127 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2129 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2128 which I had written long ago to sort out user error messages which
2130 which I had written long ago to sort out user error messages which
2129 may occur during startup. This seemed like a good idea initially,
2131 may occur during startup. This seemed like a good idea initially,
2130 but it has proven a disaster in retrospect. I don't want to
2132 but it has proven a disaster in retrospect. I don't want to
2131 change much code for now, so my fix is to set the internal 'debug'
2133 change much code for now, so my fix is to set the internal 'debug'
2132 flag to true everywhere, whose only job was precisely to control
2134 flag to true everywhere, whose only job was precisely to control
2133 this subsystem. This closes issue 28 (as well as avoiding all
2135 this subsystem. This closes issue 28 (as well as avoiding all
2134 sorts of strange hangups which occur from time to time).
2136 sorts of strange hangups which occur from time to time).
2135
2137
2136 2005-02-07 Fernando Perez <fperez@colorado.edu>
2138 2005-02-07 Fernando Perez <fperez@colorado.edu>
2137
2139
2138 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2140 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2139 previous call produced a syntax error.
2141 previous call produced a syntax error.
2140
2142
2141 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2143 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2142 classes without constructor.
2144 classes without constructor.
2143
2145
2144 2005-02-06 Fernando Perez <fperez@colorado.edu>
2146 2005-02-06 Fernando Perez <fperez@colorado.edu>
2145
2147
2146 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2148 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2147 completions with the results of each matcher, so we return results
2149 completions with the results of each matcher, so we return results
2148 to the user from all namespaces. This breaks with ipython
2150 to the user from all namespaces. This breaks with ipython
2149 tradition, but I think it's a nicer behavior. Now you get all
2151 tradition, but I think it's a nicer behavior. Now you get all
2150 possible completions listed, from all possible namespaces (python,
2152 possible completions listed, from all possible namespaces (python,
2151 filesystem, magics...) After a request by John Hunter
2153 filesystem, magics...) After a request by John Hunter
2152 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2154 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2153
2155
2154 2005-02-05 Fernando Perez <fperez@colorado.edu>
2156 2005-02-05 Fernando Perez <fperez@colorado.edu>
2155
2157
2156 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2158 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2157 the call had quote characters in it (the quotes were stripped).
2159 the call had quote characters in it (the quotes were stripped).
2158
2160
2159 2005-01-31 Fernando Perez <fperez@colorado.edu>
2161 2005-01-31 Fernando Perez <fperez@colorado.edu>
2160
2162
2161 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2163 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2162 Itpl.itpl() to make the code more robust against psyco
2164 Itpl.itpl() to make the code more robust against psyco
2163 optimizations.
2165 optimizations.
2164
2166
2165 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2167 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2166 of causing an exception. Quicker, cleaner.
2168 of causing an exception. Quicker, cleaner.
2167
2169
2168 2005-01-28 Fernando Perez <fperez@colorado.edu>
2170 2005-01-28 Fernando Perez <fperez@colorado.edu>
2169
2171
2170 * scripts/ipython_win_post_install.py (install): hardcode
2172 * scripts/ipython_win_post_install.py (install): hardcode
2171 sys.prefix+'python.exe' as the executable path. It turns out that
2173 sys.prefix+'python.exe' as the executable path. It turns out that
2172 during the post-installation run, sys.executable resolves to the
2174 during the post-installation run, sys.executable resolves to the
2173 name of the binary installer! I should report this as a distutils
2175 name of the binary installer! I should report this as a distutils
2174 bug, I think. I updated the .10 release with this tiny fix, to
2176 bug, I think. I updated the .10 release with this tiny fix, to
2175 avoid annoying the lists further.
2177 avoid annoying the lists further.
2176
2178
2177 2005-01-27 *** Released version 0.6.10
2179 2005-01-27 *** Released version 0.6.10
2178
2180
2179 2005-01-27 Fernando Perez <fperez@colorado.edu>
2181 2005-01-27 Fernando Perez <fperez@colorado.edu>
2180
2182
2181 * IPython/numutils.py (norm): Added 'inf' as optional name for
2183 * IPython/numutils.py (norm): Added 'inf' as optional name for
2182 L-infinity norm, included references to mathworld.com for vector
2184 L-infinity norm, included references to mathworld.com for vector
2183 norm definitions.
2185 norm definitions.
2184 (amin/amax): added amin/amax for array min/max. Similar to what
2186 (amin/amax): added amin/amax for array min/max. Similar to what
2185 pylab ships with after the recent reorganization of names.
2187 pylab ships with after the recent reorganization of names.
2186 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2188 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2187
2189
2188 * ipython.el: committed Alex's recent fixes and improvements.
2190 * ipython.el: committed Alex's recent fixes and improvements.
2189 Tested with python-mode from CVS, and it looks excellent. Since
2191 Tested with python-mode from CVS, and it looks excellent. Since
2190 python-mode hasn't released anything in a while, I'm temporarily
2192 python-mode hasn't released anything in a while, I'm temporarily
2191 putting a copy of today's CVS (v 4.70) of python-mode in:
2193 putting a copy of today's CVS (v 4.70) of python-mode in:
2192 http://ipython.scipy.org/tmp/python-mode.el
2194 http://ipython.scipy.org/tmp/python-mode.el
2193
2195
2194 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2196 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2195 sys.executable for the executable name, instead of assuming it's
2197 sys.executable for the executable name, instead of assuming it's
2196 called 'python.exe' (the post-installer would have produced broken
2198 called 'python.exe' (the post-installer would have produced broken
2197 setups on systems with a differently named python binary).
2199 setups on systems with a differently named python binary).
2198
2200
2199 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2201 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2200 references to os.linesep, to make the code more
2202 references to os.linesep, to make the code more
2201 platform-independent. This is also part of the win32 coloring
2203 platform-independent. This is also part of the win32 coloring
2202 fixes.
2204 fixes.
2203
2205
2204 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2206 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2205 lines, which actually cause coloring bugs because the length of
2207 lines, which actually cause coloring bugs because the length of
2206 the line is very difficult to correctly compute with embedded
2208 the line is very difficult to correctly compute with embedded
2207 escapes. This was the source of all the coloring problems under
2209 escapes. This was the source of all the coloring problems under
2208 Win32. I think that _finally_, Win32 users have a properly
2210 Win32. I think that _finally_, Win32 users have a properly
2209 working ipython in all respects. This would never have happened
2211 working ipython in all respects. This would never have happened
2210 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2212 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2211
2213
2212 2005-01-26 *** Released version 0.6.9
2214 2005-01-26 *** Released version 0.6.9
2213
2215
2214 2005-01-25 Fernando Perez <fperez@colorado.edu>
2216 2005-01-25 Fernando Perez <fperez@colorado.edu>
2215
2217
2216 * setup.py: finally, we have a true Windows installer, thanks to
2218 * setup.py: finally, we have a true Windows installer, thanks to
2217 the excellent work of Viktor Ransmayr
2219 the excellent work of Viktor Ransmayr
2218 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2220 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2219 Windows users. The setup routine is quite a bit cleaner thanks to
2221 Windows users. The setup routine is quite a bit cleaner thanks to
2220 this, and the post-install script uses the proper functions to
2222 this, and the post-install script uses the proper functions to
2221 allow a clean de-installation using the standard Windows Control
2223 allow a clean de-installation using the standard Windows Control
2222 Panel.
2224 Panel.
2223
2225
2224 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2226 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2225 environment variable under all OSes (including win32) if
2227 environment variable under all OSes (including win32) if
2226 available. This will give consistency to win32 users who have set
2228 available. This will give consistency to win32 users who have set
2227 this variable for any reason. If os.environ['HOME'] fails, the
2229 this variable for any reason. If os.environ['HOME'] fails, the
2228 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2230 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2229
2231
2230 2005-01-24 Fernando Perez <fperez@colorado.edu>
2232 2005-01-24 Fernando Perez <fperez@colorado.edu>
2231
2233
2232 * IPython/numutils.py (empty_like): add empty_like(), similar to
2234 * IPython/numutils.py (empty_like): add empty_like(), similar to
2233 zeros_like() but taking advantage of the new empty() Numeric routine.
2235 zeros_like() but taking advantage of the new empty() Numeric routine.
2234
2236
2235 2005-01-23 *** Released version 0.6.8
2237 2005-01-23 *** Released version 0.6.8
2236
2238
2237 2005-01-22 Fernando Perez <fperez@colorado.edu>
2239 2005-01-22 Fernando Perez <fperez@colorado.edu>
2238
2240
2239 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2241 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2240 automatic show() calls. After discussing things with JDH, it
2242 automatic show() calls. After discussing things with JDH, it
2241 turns out there are too many corner cases where this can go wrong.
2243 turns out there are too many corner cases where this can go wrong.
2242 It's best not to try to be 'too smart', and simply have ipython
2244 It's best not to try to be 'too smart', and simply have ipython
2243 reproduce as much as possible the default behavior of a normal
2245 reproduce as much as possible the default behavior of a normal
2244 python shell.
2246 python shell.
2245
2247
2246 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2248 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2247 line-splitting regexp and _prefilter() to avoid calling getattr()
2249 line-splitting regexp and _prefilter() to avoid calling getattr()
2248 on assignments. This closes
2250 on assignments. This closes
2249 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2251 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2250 readline uses getattr(), so a simple <TAB> keypress is still
2252 readline uses getattr(), so a simple <TAB> keypress is still
2251 enough to trigger getattr() calls on an object.
2253 enough to trigger getattr() calls on an object.
2252
2254
2253 2005-01-21 Fernando Perez <fperez@colorado.edu>
2255 2005-01-21 Fernando Perez <fperez@colorado.edu>
2254
2256
2255 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2257 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2256 docstring under pylab so it doesn't mask the original.
2258 docstring under pylab so it doesn't mask the original.
2257
2259
2258 2005-01-21 *** Released version 0.6.7
2260 2005-01-21 *** Released version 0.6.7
2259
2261
2260 2005-01-21 Fernando Perez <fperez@colorado.edu>
2262 2005-01-21 Fernando Perez <fperez@colorado.edu>
2261
2263
2262 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2264 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2263 signal handling for win32 users in multithreaded mode.
2265 signal handling for win32 users in multithreaded mode.
2264
2266
2265 2005-01-17 Fernando Perez <fperez@colorado.edu>
2267 2005-01-17 Fernando Perez <fperez@colorado.edu>
2266
2268
2267 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2269 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2268 instances with no __init__. After a crash report by Norbert Nemec
2270 instances with no __init__. After a crash report by Norbert Nemec
2269 <Norbert-AT-nemec-online.de>.
2271 <Norbert-AT-nemec-online.de>.
2270
2272
2271 2005-01-14 Fernando Perez <fperez@colorado.edu>
2273 2005-01-14 Fernando Perez <fperez@colorado.edu>
2272
2274
2273 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2275 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2274 names for verbose exceptions, when multiple dotted names and the
2276 names for verbose exceptions, when multiple dotted names and the
2275 'parent' object were present on the same line.
2277 'parent' object were present on the same line.
2276
2278
2277 2005-01-11 Fernando Perez <fperez@colorado.edu>
2279 2005-01-11 Fernando Perez <fperez@colorado.edu>
2278
2280
2279 * IPython/genutils.py (flag_calls): new utility to trap and flag
2281 * IPython/genutils.py (flag_calls): new utility to trap and flag
2280 calls in functions. I need it to clean up matplotlib support.
2282 calls in functions. I need it to clean up matplotlib support.
2281 Also removed some deprecated code in genutils.
2283 Also removed some deprecated code in genutils.
2282
2284
2283 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2285 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2284 that matplotlib scripts called with %run, which don't call show()
2286 that matplotlib scripts called with %run, which don't call show()
2285 themselves, still have their plotting windows open.
2287 themselves, still have their plotting windows open.
2286
2288
2287 2005-01-05 Fernando Perez <fperez@colorado.edu>
2289 2005-01-05 Fernando Perez <fperez@colorado.edu>
2288
2290
2289 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2291 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2290 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2292 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2291
2293
2292 2004-12-19 Fernando Perez <fperez@colorado.edu>
2294 2004-12-19 Fernando Perez <fperez@colorado.edu>
2293
2295
2294 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2296 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2295 parent_runcode, which was an eyesore. The same result can be
2297 parent_runcode, which was an eyesore. The same result can be
2296 obtained with Python's regular superclass mechanisms.
2298 obtained with Python's regular superclass mechanisms.
2297
2299
2298 2004-12-17 Fernando Perez <fperez@colorado.edu>
2300 2004-12-17 Fernando Perez <fperez@colorado.edu>
2299
2301
2300 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2302 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2301 reported by Prabhu.
2303 reported by Prabhu.
2302 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2304 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2303 sys.stderr) instead of explicitly calling sys.stderr. This helps
2305 sys.stderr) instead of explicitly calling sys.stderr. This helps
2304 maintain our I/O abstractions clean, for future GUI embeddings.
2306 maintain our I/O abstractions clean, for future GUI embeddings.
2305
2307
2306 * IPython/genutils.py (info): added new utility for sys.stderr
2308 * IPython/genutils.py (info): added new utility for sys.stderr
2307 unified info message handling (thin wrapper around warn()).
2309 unified info message handling (thin wrapper around warn()).
2308
2310
2309 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2311 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2310 composite (dotted) names on verbose exceptions.
2312 composite (dotted) names on verbose exceptions.
2311 (VerboseTB.nullrepr): harden against another kind of errors which
2313 (VerboseTB.nullrepr): harden against another kind of errors which
2312 Python's inspect module can trigger, and which were crashing
2314 Python's inspect module can trigger, and which were crashing
2313 IPython. Thanks to a report by Marco Lombardi
2315 IPython. Thanks to a report by Marco Lombardi
2314 <mlombard-AT-ma010192.hq.eso.org>.
2316 <mlombard-AT-ma010192.hq.eso.org>.
2315
2317
2316 2004-12-13 *** Released version 0.6.6
2318 2004-12-13 *** Released version 0.6.6
2317
2319
2318 2004-12-12 Fernando Perez <fperez@colorado.edu>
2320 2004-12-12 Fernando Perez <fperez@colorado.edu>
2319
2321
2320 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2322 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2321 generated by pygtk upon initialization if it was built without
2323 generated by pygtk upon initialization if it was built without
2322 threads (for matplotlib users). After a crash reported by
2324 threads (for matplotlib users). After a crash reported by
2323 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2325 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2324
2326
2325 * IPython/ipmaker.py (make_IPython): fix small bug in the
2327 * IPython/ipmaker.py (make_IPython): fix small bug in the
2326 import_some parameter for multiple imports.
2328 import_some parameter for multiple imports.
2327
2329
2328 * IPython/iplib.py (ipmagic): simplified the interface of
2330 * IPython/iplib.py (ipmagic): simplified the interface of
2329 ipmagic() to take a single string argument, just as it would be
2331 ipmagic() to take a single string argument, just as it would be
2330 typed at the IPython cmd line.
2332 typed at the IPython cmd line.
2331 (ipalias): Added new ipalias() with an interface identical to
2333 (ipalias): Added new ipalias() with an interface identical to
2332 ipmagic(). This completes exposing a pure python interface to the
2334 ipmagic(). This completes exposing a pure python interface to the
2333 alias and magic system, which can be used in loops or more complex
2335 alias and magic system, which can be used in loops or more complex
2334 code where IPython's automatic line mangling is not active.
2336 code where IPython's automatic line mangling is not active.
2335
2337
2336 * IPython/genutils.py (timing): changed interface of timing to
2338 * IPython/genutils.py (timing): changed interface of timing to
2337 simply run code once, which is the most common case. timings()
2339 simply run code once, which is the most common case. timings()
2338 remains unchanged, for the cases where you want multiple runs.
2340 remains unchanged, for the cases where you want multiple runs.
2339
2341
2340 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2342 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2341 bug where Python2.2 crashes with exec'ing code which does not end
2343 bug where Python2.2 crashes with exec'ing code which does not end
2342 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2344 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2343 before.
2345 before.
2344
2346
2345 2004-12-10 Fernando Perez <fperez@colorado.edu>
2347 2004-12-10 Fernando Perez <fperez@colorado.edu>
2346
2348
2347 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2349 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2348 -t to -T, to accomodate the new -t flag in %run (the %run and
2350 -t to -T, to accomodate the new -t flag in %run (the %run and
2349 %prun options are kind of intermixed, and it's not easy to change
2351 %prun options are kind of intermixed, and it's not easy to change
2350 this with the limitations of python's getopt).
2352 this with the limitations of python's getopt).
2351
2353
2352 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2354 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2353 the execution of scripts. It's not as fine-tuned as timeit.py,
2355 the execution of scripts. It's not as fine-tuned as timeit.py,
2354 but it works from inside ipython (and under 2.2, which lacks
2356 but it works from inside ipython (and under 2.2, which lacks
2355 timeit.py). Optionally a number of runs > 1 can be given for
2357 timeit.py). Optionally a number of runs > 1 can be given for
2356 timing very short-running code.
2358 timing very short-running code.
2357
2359
2358 * IPython/genutils.py (uniq_stable): new routine which returns a
2360 * IPython/genutils.py (uniq_stable): new routine which returns a
2359 list of unique elements in any iterable, but in stable order of
2361 list of unique elements in any iterable, but in stable order of
2360 appearance. I needed this for the ultraTB fixes, and it's a handy
2362 appearance. I needed this for the ultraTB fixes, and it's a handy
2361 utility.
2363 utility.
2362
2364
2363 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2365 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2364 dotted names in Verbose exceptions. This had been broken since
2366 dotted names in Verbose exceptions. This had been broken since
2365 the very start, now x.y will properly be printed in a Verbose
2367 the very start, now x.y will properly be printed in a Verbose
2366 traceback, instead of x being shown and y appearing always as an
2368 traceback, instead of x being shown and y appearing always as an
2367 'undefined global'. Getting this to work was a bit tricky,
2369 'undefined global'. Getting this to work was a bit tricky,
2368 because by default python tokenizers are stateless. Saved by
2370 because by default python tokenizers are stateless. Saved by
2369 python's ability to easily add a bit of state to an arbitrary
2371 python's ability to easily add a bit of state to an arbitrary
2370 function (without needing to build a full-blown callable object).
2372 function (without needing to build a full-blown callable object).
2371
2373
2372 Also big cleanup of this code, which had horrendous runtime
2374 Also big cleanup of this code, which had horrendous runtime
2373 lookups of zillions of attributes for colorization. Moved all
2375 lookups of zillions of attributes for colorization. Moved all
2374 this code into a few templates, which make it cleaner and quicker.
2376 this code into a few templates, which make it cleaner and quicker.
2375
2377
2376 Printout quality was also improved for Verbose exceptions: one
2378 Printout quality was also improved for Verbose exceptions: one
2377 variable per line, and memory addresses are printed (this can be
2379 variable per line, and memory addresses are printed (this can be
2378 quite handy in nasty debugging situations, which is what Verbose
2380 quite handy in nasty debugging situations, which is what Verbose
2379 is for).
2381 is for).
2380
2382
2381 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2383 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2382 the command line as scripts to be loaded by embedded instances.
2384 the command line as scripts to be loaded by embedded instances.
2383 Doing so has the potential for an infinite recursion if there are
2385 Doing so has the potential for an infinite recursion if there are
2384 exceptions thrown in the process. This fixes a strange crash
2386 exceptions thrown in the process. This fixes a strange crash
2385 reported by Philippe MULLER <muller-AT-irit.fr>.
2387 reported by Philippe MULLER <muller-AT-irit.fr>.
2386
2388
2387 2004-12-09 Fernando Perez <fperez@colorado.edu>
2389 2004-12-09 Fernando Perez <fperez@colorado.edu>
2388
2390
2389 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2391 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2390 to reflect new names in matplotlib, which now expose the
2392 to reflect new names in matplotlib, which now expose the
2391 matlab-compatible interface via a pylab module instead of the
2393 matlab-compatible interface via a pylab module instead of the
2392 'matlab' name. The new code is backwards compatible, so users of
2394 'matlab' name. The new code is backwards compatible, so users of
2393 all matplotlib versions are OK. Patch by J. Hunter.
2395 all matplotlib versions are OK. Patch by J. Hunter.
2394
2396
2395 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2397 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2396 of __init__ docstrings for instances (class docstrings are already
2398 of __init__ docstrings for instances (class docstrings are already
2397 automatically printed). Instances with customized docstrings
2399 automatically printed). Instances with customized docstrings
2398 (indep. of the class) are also recognized and all 3 separate
2400 (indep. of the class) are also recognized and all 3 separate
2399 docstrings are printed (instance, class, constructor). After some
2401 docstrings are printed (instance, class, constructor). After some
2400 comments/suggestions by J. Hunter.
2402 comments/suggestions by J. Hunter.
2401
2403
2402 2004-12-05 Fernando Perez <fperez@colorado.edu>
2404 2004-12-05 Fernando Perez <fperez@colorado.edu>
2403
2405
2404 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2406 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2405 warnings when tab-completion fails and triggers an exception.
2407 warnings when tab-completion fails and triggers an exception.
2406
2408
2407 2004-12-03 Fernando Perez <fperez@colorado.edu>
2409 2004-12-03 Fernando Perez <fperez@colorado.edu>
2408
2410
2409 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2411 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2410 be triggered when using 'run -p'. An incorrect option flag was
2412 be triggered when using 'run -p'. An incorrect option flag was
2411 being set ('d' instead of 'D').
2413 being set ('d' instead of 'D').
2412 (manpage): fix missing escaped \- sign.
2414 (manpage): fix missing escaped \- sign.
2413
2415
2414 2004-11-30 *** Released version 0.6.5
2416 2004-11-30 *** Released version 0.6.5
2415
2417
2416 2004-11-30 Fernando Perez <fperez@colorado.edu>
2418 2004-11-30 Fernando Perez <fperez@colorado.edu>
2417
2419
2418 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2420 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2419 setting with -d option.
2421 setting with -d option.
2420
2422
2421 * setup.py (docfiles): Fix problem where the doc glob I was using
2423 * setup.py (docfiles): Fix problem where the doc glob I was using
2422 was COMPLETELY BROKEN. It was giving the right files by pure
2424 was COMPLETELY BROKEN. It was giving the right files by pure
2423 accident, but failed once I tried to include ipython.el. Note:
2425 accident, but failed once I tried to include ipython.el. Note:
2424 glob() does NOT allow you to do exclusion on multiple endings!
2426 glob() does NOT allow you to do exclusion on multiple endings!
2425
2427
2426 2004-11-29 Fernando Perez <fperez@colorado.edu>
2428 2004-11-29 Fernando Perez <fperez@colorado.edu>
2427
2429
2428 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2430 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2429 the manpage as the source. Better formatting & consistency.
2431 the manpage as the source. Better formatting & consistency.
2430
2432
2431 * IPython/Magic.py (magic_run): Added new -d option, to run
2433 * IPython/Magic.py (magic_run): Added new -d option, to run
2432 scripts under the control of the python pdb debugger. Note that
2434 scripts under the control of the python pdb debugger. Note that
2433 this required changing the %prun option -d to -D, to avoid a clash
2435 this required changing the %prun option -d to -D, to avoid a clash
2434 (since %run must pass options to %prun, and getopt is too dumb to
2436 (since %run must pass options to %prun, and getopt is too dumb to
2435 handle options with string values with embedded spaces). Thanks
2437 handle options with string values with embedded spaces). Thanks
2436 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2438 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2437 (magic_who_ls): added type matching to %who and %whos, so that one
2439 (magic_who_ls): added type matching to %who and %whos, so that one
2438 can filter their output to only include variables of certain
2440 can filter their output to only include variables of certain
2439 types. Another suggestion by Matthew.
2441 types. Another suggestion by Matthew.
2440 (magic_whos): Added memory summaries in kb and Mb for arrays.
2442 (magic_whos): Added memory summaries in kb and Mb for arrays.
2441 (magic_who): Improve formatting (break lines every 9 vars).
2443 (magic_who): Improve formatting (break lines every 9 vars).
2442
2444
2443 2004-11-28 Fernando Perez <fperez@colorado.edu>
2445 2004-11-28 Fernando Perez <fperez@colorado.edu>
2444
2446
2445 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2447 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2446 cache when empty lines were present.
2448 cache when empty lines were present.
2447
2449
2448 2004-11-24 Fernando Perez <fperez@colorado.edu>
2450 2004-11-24 Fernando Perez <fperez@colorado.edu>
2449
2451
2450 * IPython/usage.py (__doc__): document the re-activated threading
2452 * IPython/usage.py (__doc__): document the re-activated threading
2451 options for WX and GTK.
2453 options for WX and GTK.
2452
2454
2453 2004-11-23 Fernando Perez <fperez@colorado.edu>
2455 2004-11-23 Fernando Perez <fperez@colorado.edu>
2454
2456
2455 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2457 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2456 the -wthread and -gthread options, along with a new -tk one to try
2458 the -wthread and -gthread options, along with a new -tk one to try
2457 and coordinate Tk threading with wx/gtk. The tk support is very
2459 and coordinate Tk threading with wx/gtk. The tk support is very
2458 platform dependent, since it seems to require Tcl and Tk to be
2460 platform dependent, since it seems to require Tcl and Tk to be
2459 built with threads (Fedora1/2 appears NOT to have it, but in
2461 built with threads (Fedora1/2 appears NOT to have it, but in
2460 Prabhu's Debian boxes it works OK). But even with some Tk
2462 Prabhu's Debian boxes it works OK). But even with some Tk
2461 limitations, this is a great improvement.
2463 limitations, this is a great improvement.
2462
2464
2463 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2465 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2464 info in user prompts. Patch by Prabhu.
2466 info in user prompts. Patch by Prabhu.
2465
2467
2466 2004-11-18 Fernando Perez <fperez@colorado.edu>
2468 2004-11-18 Fernando Perez <fperez@colorado.edu>
2467
2469
2468 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2470 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2469 EOFErrors and bail, to avoid infinite loops if a non-terminating
2471 EOFErrors and bail, to avoid infinite loops if a non-terminating
2470 file is fed into ipython. Patch submitted in issue 19 by user,
2472 file is fed into ipython. Patch submitted in issue 19 by user,
2471 many thanks.
2473 many thanks.
2472
2474
2473 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2475 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2474 autoquote/parens in continuation prompts, which can cause lots of
2476 autoquote/parens in continuation prompts, which can cause lots of
2475 problems. Closes roundup issue 20.
2477 problems. Closes roundup issue 20.
2476
2478
2477 2004-11-17 Fernando Perez <fperez@colorado.edu>
2479 2004-11-17 Fernando Perez <fperez@colorado.edu>
2478
2480
2479 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2481 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2480 reported as debian bug #280505. I'm not sure my local changelog
2482 reported as debian bug #280505. I'm not sure my local changelog
2481 entry has the proper debian format (Jack?).
2483 entry has the proper debian format (Jack?).
2482
2484
2483 2004-11-08 *** Released version 0.6.4
2485 2004-11-08 *** Released version 0.6.4
2484
2486
2485 2004-11-08 Fernando Perez <fperez@colorado.edu>
2487 2004-11-08 Fernando Perez <fperez@colorado.edu>
2486
2488
2487 * IPython/iplib.py (init_readline): Fix exit message for Windows
2489 * IPython/iplib.py (init_readline): Fix exit message for Windows
2488 when readline is active. Thanks to a report by Eric Jones
2490 when readline is active. Thanks to a report by Eric Jones
2489 <eric-AT-enthought.com>.
2491 <eric-AT-enthought.com>.
2490
2492
2491 2004-11-07 Fernando Perez <fperez@colorado.edu>
2493 2004-11-07 Fernando Perez <fperez@colorado.edu>
2492
2494
2493 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2495 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2494 sometimes seen by win2k/cygwin users.
2496 sometimes seen by win2k/cygwin users.
2495
2497
2496 2004-11-06 Fernando Perez <fperez@colorado.edu>
2498 2004-11-06 Fernando Perez <fperez@colorado.edu>
2497
2499
2498 * IPython/iplib.py (interact): Change the handling of %Exit from
2500 * IPython/iplib.py (interact): Change the handling of %Exit from
2499 trying to propagate a SystemExit to an internal ipython flag.
2501 trying to propagate a SystemExit to an internal ipython flag.
2500 This is less elegant than using Python's exception mechanism, but
2502 This is less elegant than using Python's exception mechanism, but
2501 I can't get that to work reliably with threads, so under -pylab
2503 I can't get that to work reliably with threads, so under -pylab
2502 %Exit was hanging IPython. Cross-thread exception handling is
2504 %Exit was hanging IPython. Cross-thread exception handling is
2503 really a bitch. Thaks to a bug report by Stephen Walton
2505 really a bitch. Thaks to a bug report by Stephen Walton
2504 <stephen.walton-AT-csun.edu>.
2506 <stephen.walton-AT-csun.edu>.
2505
2507
2506 2004-11-04 Fernando Perez <fperez@colorado.edu>
2508 2004-11-04 Fernando Perez <fperez@colorado.edu>
2507
2509
2508 * IPython/iplib.py (raw_input_original): store a pointer to the
2510 * IPython/iplib.py (raw_input_original): store a pointer to the
2509 true raw_input to harden against code which can modify it
2511 true raw_input to harden against code which can modify it
2510 (wx.py.PyShell does this and would otherwise crash ipython).
2512 (wx.py.PyShell does this and would otherwise crash ipython).
2511 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2513 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2512
2514
2513 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2515 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2514 Ctrl-C problem, which does not mess up the input line.
2516 Ctrl-C problem, which does not mess up the input line.
2515
2517
2516 2004-11-03 Fernando Perez <fperez@colorado.edu>
2518 2004-11-03 Fernando Perez <fperez@colorado.edu>
2517
2519
2518 * IPython/Release.py: Changed licensing to BSD, in all files.
2520 * IPython/Release.py: Changed licensing to BSD, in all files.
2519 (name): lowercase name for tarball/RPM release.
2521 (name): lowercase name for tarball/RPM release.
2520
2522
2521 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2523 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2522 use throughout ipython.
2524 use throughout ipython.
2523
2525
2524 * IPython/Magic.py (Magic._ofind): Switch to using the new
2526 * IPython/Magic.py (Magic._ofind): Switch to using the new
2525 OInspect.getdoc() function.
2527 OInspect.getdoc() function.
2526
2528
2527 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2529 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2528 of the line currently being canceled via Ctrl-C. It's extremely
2530 of the line currently being canceled via Ctrl-C. It's extremely
2529 ugly, but I don't know how to do it better (the problem is one of
2531 ugly, but I don't know how to do it better (the problem is one of
2530 handling cross-thread exceptions).
2532 handling cross-thread exceptions).
2531
2533
2532 2004-10-28 Fernando Perez <fperez@colorado.edu>
2534 2004-10-28 Fernando Perez <fperez@colorado.edu>
2533
2535
2534 * IPython/Shell.py (signal_handler): add signal handlers to trap
2536 * IPython/Shell.py (signal_handler): add signal handlers to trap
2535 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2537 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2536 report by Francesc Alted.
2538 report by Francesc Alted.
2537
2539
2538 2004-10-21 Fernando Perez <fperez@colorado.edu>
2540 2004-10-21 Fernando Perez <fperez@colorado.edu>
2539
2541
2540 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2542 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2541 to % for pysh syntax extensions.
2543 to % for pysh syntax extensions.
2542
2544
2543 2004-10-09 Fernando Perez <fperez@colorado.edu>
2545 2004-10-09 Fernando Perez <fperez@colorado.edu>
2544
2546
2545 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2547 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2546 arrays to print a more useful summary, without calling str(arr).
2548 arrays to print a more useful summary, without calling str(arr).
2547 This avoids the problem of extremely lengthy computations which
2549 This avoids the problem of extremely lengthy computations which
2548 occur if arr is large, and appear to the user as a system lockup
2550 occur if arr is large, and appear to the user as a system lockup
2549 with 100% cpu activity. After a suggestion by Kristian Sandberg
2551 with 100% cpu activity. After a suggestion by Kristian Sandberg
2550 <Kristian.Sandberg@colorado.edu>.
2552 <Kristian.Sandberg@colorado.edu>.
2551 (Magic.__init__): fix bug in global magic escapes not being
2553 (Magic.__init__): fix bug in global magic escapes not being
2552 correctly set.
2554 correctly set.
2553
2555
2554 2004-10-08 Fernando Perez <fperez@colorado.edu>
2556 2004-10-08 Fernando Perez <fperez@colorado.edu>
2555
2557
2556 * IPython/Magic.py (__license__): change to absolute imports of
2558 * IPython/Magic.py (__license__): change to absolute imports of
2557 ipython's own internal packages, to start adapting to the absolute
2559 ipython's own internal packages, to start adapting to the absolute
2558 import requirement of PEP-328.
2560 import requirement of PEP-328.
2559
2561
2560 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2562 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2561 files, and standardize author/license marks through the Release
2563 files, and standardize author/license marks through the Release
2562 module instead of having per/file stuff (except for files with
2564 module instead of having per/file stuff (except for files with
2563 particular licenses, like the MIT/PSF-licensed codes).
2565 particular licenses, like the MIT/PSF-licensed codes).
2564
2566
2565 * IPython/Debugger.py: remove dead code for python 2.1
2567 * IPython/Debugger.py: remove dead code for python 2.1
2566
2568
2567 2004-10-04 Fernando Perez <fperez@colorado.edu>
2569 2004-10-04 Fernando Perez <fperez@colorado.edu>
2568
2570
2569 * IPython/iplib.py (ipmagic): New function for accessing magics
2571 * IPython/iplib.py (ipmagic): New function for accessing magics
2570 via a normal python function call.
2572 via a normal python function call.
2571
2573
2572 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2574 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2573 from '@' to '%', to accomodate the new @decorator syntax of python
2575 from '@' to '%', to accomodate the new @decorator syntax of python
2574 2.4.
2576 2.4.
2575
2577
2576 2004-09-29 Fernando Perez <fperez@colorado.edu>
2578 2004-09-29 Fernando Perez <fperez@colorado.edu>
2577
2579
2578 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2580 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2579 matplotlib.use to prevent running scripts which try to switch
2581 matplotlib.use to prevent running scripts which try to switch
2580 interactive backends from within ipython. This will just crash
2582 interactive backends from within ipython. This will just crash
2581 the python interpreter, so we can't allow it (but a detailed error
2583 the python interpreter, so we can't allow it (but a detailed error
2582 is given to the user).
2584 is given to the user).
2583
2585
2584 2004-09-28 Fernando Perez <fperez@colorado.edu>
2586 2004-09-28 Fernando Perez <fperez@colorado.edu>
2585
2587
2586 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2588 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2587 matplotlib-related fixes so that using @run with non-matplotlib
2589 matplotlib-related fixes so that using @run with non-matplotlib
2588 scripts doesn't pop up spurious plot windows. This requires
2590 scripts doesn't pop up spurious plot windows. This requires
2589 matplotlib >= 0.63, where I had to make some changes as well.
2591 matplotlib >= 0.63, where I had to make some changes as well.
2590
2592
2591 * IPython/ipmaker.py (make_IPython): update version requirement to
2593 * IPython/ipmaker.py (make_IPython): update version requirement to
2592 python 2.2.
2594 python 2.2.
2593
2595
2594 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2596 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2595 banner arg for embedded customization.
2597 banner arg for embedded customization.
2596
2598
2597 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2599 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2598 explicit uses of __IP as the IPython's instance name. Now things
2600 explicit uses of __IP as the IPython's instance name. Now things
2599 are properly handled via the shell.name value. The actual code
2601 are properly handled via the shell.name value. The actual code
2600 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2602 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2601 is much better than before. I'll clean things completely when the
2603 is much better than before. I'll clean things completely when the
2602 magic stuff gets a real overhaul.
2604 magic stuff gets a real overhaul.
2603
2605
2604 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2606 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2605 minor changes to debian dir.
2607 minor changes to debian dir.
2606
2608
2607 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2609 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2608 pointer to the shell itself in the interactive namespace even when
2610 pointer to the shell itself in the interactive namespace even when
2609 a user-supplied dict is provided. This is needed for embedding
2611 a user-supplied dict is provided. This is needed for embedding
2610 purposes (found by tests with Michel Sanner).
2612 purposes (found by tests with Michel Sanner).
2611
2613
2612 2004-09-27 Fernando Perez <fperez@colorado.edu>
2614 2004-09-27 Fernando Perez <fperez@colorado.edu>
2613
2615
2614 * IPython/UserConfig/ipythonrc: remove []{} from
2616 * IPython/UserConfig/ipythonrc: remove []{} from
2615 readline_remove_delims, so that things like [modname.<TAB> do
2617 readline_remove_delims, so that things like [modname.<TAB> do
2616 proper completion. This disables [].TAB, but that's a less common
2618 proper completion. This disables [].TAB, but that's a less common
2617 case than module names in list comprehensions, for example.
2619 case than module names in list comprehensions, for example.
2618 Thanks to a report by Andrea Riciputi.
2620 Thanks to a report by Andrea Riciputi.
2619
2621
2620 2004-09-09 Fernando Perez <fperez@colorado.edu>
2622 2004-09-09 Fernando Perez <fperez@colorado.edu>
2621
2623
2622 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2624 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2623 blocking problems in win32 and osx. Fix by John.
2625 blocking problems in win32 and osx. Fix by John.
2624
2626
2625 2004-09-08 Fernando Perez <fperez@colorado.edu>
2627 2004-09-08 Fernando Perez <fperez@colorado.edu>
2626
2628
2627 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2629 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2628 for Win32 and OSX. Fix by John Hunter.
2630 for Win32 and OSX. Fix by John Hunter.
2629
2631
2630 2004-08-30 *** Released version 0.6.3
2632 2004-08-30 *** Released version 0.6.3
2631
2633
2632 2004-08-30 Fernando Perez <fperez@colorado.edu>
2634 2004-08-30 Fernando Perez <fperez@colorado.edu>
2633
2635
2634 * setup.py (isfile): Add manpages to list of dependent files to be
2636 * setup.py (isfile): Add manpages to list of dependent files to be
2635 updated.
2637 updated.
2636
2638
2637 2004-08-27 Fernando Perez <fperez@colorado.edu>
2639 2004-08-27 Fernando Perez <fperez@colorado.edu>
2638
2640
2639 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2641 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2640 for now. They don't really work with standalone WX/GTK code
2642 for now. They don't really work with standalone WX/GTK code
2641 (though matplotlib IS working fine with both of those backends).
2643 (though matplotlib IS working fine with both of those backends).
2642 This will neeed much more testing. I disabled most things with
2644 This will neeed much more testing. I disabled most things with
2643 comments, so turning it back on later should be pretty easy.
2645 comments, so turning it back on later should be pretty easy.
2644
2646
2645 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2647 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2646 autocalling of expressions like r'foo', by modifying the line
2648 autocalling of expressions like r'foo', by modifying the line
2647 split regexp. Closes
2649 split regexp. Closes
2648 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2650 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2649 Riley <ipythonbugs-AT-sabi.net>.
2651 Riley <ipythonbugs-AT-sabi.net>.
2650 (InteractiveShell.mainloop): honor --nobanner with banner
2652 (InteractiveShell.mainloop): honor --nobanner with banner
2651 extensions.
2653 extensions.
2652
2654
2653 * IPython/Shell.py: Significant refactoring of all classes, so
2655 * IPython/Shell.py: Significant refactoring of all classes, so
2654 that we can really support ALL matplotlib backends and threading
2656 that we can really support ALL matplotlib backends and threading
2655 models (John spotted a bug with Tk which required this). Now we
2657 models (John spotted a bug with Tk which required this). Now we
2656 should support single-threaded, WX-threads and GTK-threads, both
2658 should support single-threaded, WX-threads and GTK-threads, both
2657 for generic code and for matplotlib.
2659 for generic code and for matplotlib.
2658
2660
2659 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2661 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2660 -pylab, to simplify things for users. Will also remove the pylab
2662 -pylab, to simplify things for users. Will also remove the pylab
2661 profile, since now all of matplotlib configuration is directly
2663 profile, since now all of matplotlib configuration is directly
2662 handled here. This also reduces startup time.
2664 handled here. This also reduces startup time.
2663
2665
2664 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2666 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2665 shell wasn't being correctly called. Also in IPShellWX.
2667 shell wasn't being correctly called. Also in IPShellWX.
2666
2668
2667 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2669 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2668 fine-tune banner.
2670 fine-tune banner.
2669
2671
2670 * IPython/numutils.py (spike): Deprecate these spike functions,
2672 * IPython/numutils.py (spike): Deprecate these spike functions,
2671 delete (long deprecated) gnuplot_exec handler.
2673 delete (long deprecated) gnuplot_exec handler.
2672
2674
2673 2004-08-26 Fernando Perez <fperez@colorado.edu>
2675 2004-08-26 Fernando Perez <fperez@colorado.edu>
2674
2676
2675 * ipython.1: Update for threading options, plus some others which
2677 * ipython.1: Update for threading options, plus some others which
2676 were missing.
2678 were missing.
2677
2679
2678 * IPython/ipmaker.py (__call__): Added -wthread option for
2680 * IPython/ipmaker.py (__call__): Added -wthread option for
2679 wxpython thread handling. Make sure threading options are only
2681 wxpython thread handling. Make sure threading options are only
2680 valid at the command line.
2682 valid at the command line.
2681
2683
2682 * scripts/ipython: moved shell selection into a factory function
2684 * scripts/ipython: moved shell selection into a factory function
2683 in Shell.py, to keep the starter script to a minimum.
2685 in Shell.py, to keep the starter script to a minimum.
2684
2686
2685 2004-08-25 Fernando Perez <fperez@colorado.edu>
2687 2004-08-25 Fernando Perez <fperez@colorado.edu>
2686
2688
2687 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2689 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2688 John. Along with some recent changes he made to matplotlib, the
2690 John. Along with some recent changes he made to matplotlib, the
2689 next versions of both systems should work very well together.
2691 next versions of both systems should work very well together.
2690
2692
2691 2004-08-24 Fernando Perez <fperez@colorado.edu>
2693 2004-08-24 Fernando Perez <fperez@colorado.edu>
2692
2694
2693 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2695 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2694 tried to switch the profiling to using hotshot, but I'm getting
2696 tried to switch the profiling to using hotshot, but I'm getting
2695 strange errors from prof.runctx() there. I may be misreading the
2697 strange errors from prof.runctx() there. I may be misreading the
2696 docs, but it looks weird. For now the profiling code will
2698 docs, but it looks weird. For now the profiling code will
2697 continue to use the standard profiler.
2699 continue to use the standard profiler.
2698
2700
2699 2004-08-23 Fernando Perez <fperez@colorado.edu>
2701 2004-08-23 Fernando Perez <fperez@colorado.edu>
2700
2702
2701 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2703 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2702 threaded shell, by John Hunter. It's not quite ready yet, but
2704 threaded shell, by John Hunter. It's not quite ready yet, but
2703 close.
2705 close.
2704
2706
2705 2004-08-22 Fernando Perez <fperez@colorado.edu>
2707 2004-08-22 Fernando Perez <fperez@colorado.edu>
2706
2708
2707 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2709 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2708 in Magic and ultraTB.
2710 in Magic and ultraTB.
2709
2711
2710 * ipython.1: document threading options in manpage.
2712 * ipython.1: document threading options in manpage.
2711
2713
2712 * scripts/ipython: Changed name of -thread option to -gthread,
2714 * scripts/ipython: Changed name of -thread option to -gthread,
2713 since this is GTK specific. I want to leave the door open for a
2715 since this is GTK specific. I want to leave the door open for a
2714 -wthread option for WX, which will most likely be necessary. This
2716 -wthread option for WX, which will most likely be necessary. This
2715 change affects usage and ipmaker as well.
2717 change affects usage and ipmaker as well.
2716
2718
2717 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2719 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2718 handle the matplotlib shell issues. Code by John Hunter
2720 handle the matplotlib shell issues. Code by John Hunter
2719 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2721 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2720 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2722 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2721 broken (and disabled for end users) for now, but it puts the
2723 broken (and disabled for end users) for now, but it puts the
2722 infrastructure in place.
2724 infrastructure in place.
2723
2725
2724 2004-08-21 Fernando Perez <fperez@colorado.edu>
2726 2004-08-21 Fernando Perez <fperez@colorado.edu>
2725
2727
2726 * ipythonrc-pylab: Add matplotlib support.
2728 * ipythonrc-pylab: Add matplotlib support.
2727
2729
2728 * matplotlib_config.py: new files for matplotlib support, part of
2730 * matplotlib_config.py: new files for matplotlib support, part of
2729 the pylab profile.
2731 the pylab profile.
2730
2732
2731 * IPython/usage.py (__doc__): documented the threading options.
2733 * IPython/usage.py (__doc__): documented the threading options.
2732
2734
2733 2004-08-20 Fernando Perez <fperez@colorado.edu>
2735 2004-08-20 Fernando Perez <fperez@colorado.edu>
2734
2736
2735 * ipython: Modified the main calling routine to handle the -thread
2737 * ipython: Modified the main calling routine to handle the -thread
2736 and -mpthread options. This needs to be done as a top-level hack,
2738 and -mpthread options. This needs to be done as a top-level hack,
2737 because it determines which class to instantiate for IPython
2739 because it determines which class to instantiate for IPython
2738 itself.
2740 itself.
2739
2741
2740 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2742 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2741 classes to support multithreaded GTK operation without blocking,
2743 classes to support multithreaded GTK operation without blocking,
2742 and matplotlib with all backends. This is a lot of still very
2744 and matplotlib with all backends. This is a lot of still very
2743 experimental code, and threads are tricky. So it may still have a
2745 experimental code, and threads are tricky. So it may still have a
2744 few rough edges... This code owes a lot to
2746 few rough edges... This code owes a lot to
2745 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2747 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2746 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2748 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2747 to John Hunter for all the matplotlib work.
2749 to John Hunter for all the matplotlib work.
2748
2750
2749 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2751 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2750 options for gtk thread and matplotlib support.
2752 options for gtk thread and matplotlib support.
2751
2753
2752 2004-08-16 Fernando Perez <fperez@colorado.edu>
2754 2004-08-16 Fernando Perez <fperez@colorado.edu>
2753
2755
2754 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2756 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2755 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2757 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2756 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2758 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2757
2759
2758 2004-08-11 Fernando Perez <fperez@colorado.edu>
2760 2004-08-11 Fernando Perez <fperez@colorado.edu>
2759
2761
2760 * setup.py (isfile): Fix build so documentation gets updated for
2762 * setup.py (isfile): Fix build so documentation gets updated for
2761 rpms (it was only done for .tgz builds).
2763 rpms (it was only done for .tgz builds).
2762
2764
2763 2004-08-10 Fernando Perez <fperez@colorado.edu>
2765 2004-08-10 Fernando Perez <fperez@colorado.edu>
2764
2766
2765 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2767 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2766
2768
2767 * iplib.py : Silence syntax error exceptions in tab-completion.
2769 * iplib.py : Silence syntax error exceptions in tab-completion.
2768
2770
2769 2004-08-05 Fernando Perez <fperez@colorado.edu>
2771 2004-08-05 Fernando Perez <fperez@colorado.edu>
2770
2772
2771 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2773 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2772 'color off' mark for continuation prompts. This was causing long
2774 'color off' mark for continuation prompts. This was causing long
2773 continuation lines to mis-wrap.
2775 continuation lines to mis-wrap.
2774
2776
2775 2004-08-01 Fernando Perez <fperez@colorado.edu>
2777 2004-08-01 Fernando Perez <fperez@colorado.edu>
2776
2778
2777 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2779 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2778 for building ipython to be a parameter. All this is necessary
2780 for building ipython to be a parameter. All this is necessary
2779 right now to have a multithreaded version, but this insane
2781 right now to have a multithreaded version, but this insane
2780 non-design will be cleaned up soon. For now, it's a hack that
2782 non-design will be cleaned up soon. For now, it's a hack that
2781 works.
2783 works.
2782
2784
2783 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2785 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2784 args in various places. No bugs so far, but it's a dangerous
2786 args in various places. No bugs so far, but it's a dangerous
2785 practice.
2787 practice.
2786
2788
2787 2004-07-31 Fernando Perez <fperez@colorado.edu>
2789 2004-07-31 Fernando Perez <fperez@colorado.edu>
2788
2790
2789 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2791 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2790 fix completion of files with dots in their names under most
2792 fix completion of files with dots in their names under most
2791 profiles (pysh was OK because the completion order is different).
2793 profiles (pysh was OK because the completion order is different).
2792
2794
2793 2004-07-27 Fernando Perez <fperez@colorado.edu>
2795 2004-07-27 Fernando Perez <fperez@colorado.edu>
2794
2796
2795 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2797 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2796 keywords manually, b/c the one in keyword.py was removed in python
2798 keywords manually, b/c the one in keyword.py was removed in python
2797 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2799 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2798 This is NOT a bug under python 2.3 and earlier.
2800 This is NOT a bug under python 2.3 and earlier.
2799
2801
2800 2004-07-26 Fernando Perez <fperez@colorado.edu>
2802 2004-07-26 Fernando Perez <fperez@colorado.edu>
2801
2803
2802 * IPython/ultraTB.py (VerboseTB.text): Add another
2804 * IPython/ultraTB.py (VerboseTB.text): Add another
2803 linecache.checkcache() call to try to prevent inspect.py from
2805 linecache.checkcache() call to try to prevent inspect.py from
2804 crashing under python 2.3. I think this fixes
2806 crashing under python 2.3. I think this fixes
2805 http://www.scipy.net/roundup/ipython/issue17.
2807 http://www.scipy.net/roundup/ipython/issue17.
2806
2808
2807 2004-07-26 *** Released version 0.6.2
2809 2004-07-26 *** Released version 0.6.2
2808
2810
2809 2004-07-26 Fernando Perez <fperez@colorado.edu>
2811 2004-07-26 Fernando Perez <fperez@colorado.edu>
2810
2812
2811 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2813 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2812 fail for any number.
2814 fail for any number.
2813 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2815 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2814 empty bookmarks.
2816 empty bookmarks.
2815
2817
2816 2004-07-26 *** Released version 0.6.1
2818 2004-07-26 *** Released version 0.6.1
2817
2819
2818 2004-07-26 Fernando Perez <fperez@colorado.edu>
2820 2004-07-26 Fernando Perez <fperez@colorado.edu>
2819
2821
2820 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2822 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2821
2823
2822 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2824 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2823 escaping '()[]{}' in filenames.
2825 escaping '()[]{}' in filenames.
2824
2826
2825 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2827 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2826 Python 2.2 users who lack a proper shlex.split.
2828 Python 2.2 users who lack a proper shlex.split.
2827
2829
2828 2004-07-19 Fernando Perez <fperez@colorado.edu>
2830 2004-07-19 Fernando Perez <fperez@colorado.edu>
2829
2831
2830 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2832 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2831 for reading readline's init file. I follow the normal chain:
2833 for reading readline's init file. I follow the normal chain:
2832 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2834 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2833 report by Mike Heeter. This closes
2835 report by Mike Heeter. This closes
2834 http://www.scipy.net/roundup/ipython/issue16.
2836 http://www.scipy.net/roundup/ipython/issue16.
2835
2837
2836 2004-07-18 Fernando Perez <fperez@colorado.edu>
2838 2004-07-18 Fernando Perez <fperez@colorado.edu>
2837
2839
2838 * IPython/iplib.py (__init__): Add better handling of '\' under
2840 * IPython/iplib.py (__init__): Add better handling of '\' under
2839 Win32 for filenames. After a patch by Ville.
2841 Win32 for filenames. After a patch by Ville.
2840
2842
2841 2004-07-17 Fernando Perez <fperez@colorado.edu>
2843 2004-07-17 Fernando Perez <fperez@colorado.edu>
2842
2844
2843 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2845 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2844 autocalling would be triggered for 'foo is bar' if foo is
2846 autocalling would be triggered for 'foo is bar' if foo is
2845 callable. I also cleaned up the autocall detection code to use a
2847 callable. I also cleaned up the autocall detection code to use a
2846 regexp, which is faster. Bug reported by Alexander Schmolck.
2848 regexp, which is faster. Bug reported by Alexander Schmolck.
2847
2849
2848 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2850 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2849 '?' in them would confuse the help system. Reported by Alex
2851 '?' in them would confuse the help system. Reported by Alex
2850 Schmolck.
2852 Schmolck.
2851
2853
2852 2004-07-16 Fernando Perez <fperez@colorado.edu>
2854 2004-07-16 Fernando Perez <fperez@colorado.edu>
2853
2855
2854 * IPython/GnuplotInteractive.py (__all__): added plot2.
2856 * IPython/GnuplotInteractive.py (__all__): added plot2.
2855
2857
2856 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2858 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2857 plotting dictionaries, lists or tuples of 1d arrays.
2859 plotting dictionaries, lists or tuples of 1d arrays.
2858
2860
2859 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2861 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2860 optimizations.
2862 optimizations.
2861
2863
2862 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2864 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2863 the information which was there from Janko's original IPP code:
2865 the information which was there from Janko's original IPP code:
2864
2866
2865 03.05.99 20:53 porto.ifm.uni-kiel.de
2867 03.05.99 20:53 porto.ifm.uni-kiel.de
2866 --Started changelog.
2868 --Started changelog.
2867 --make clear do what it say it does
2869 --make clear do what it say it does
2868 --added pretty output of lines from inputcache
2870 --added pretty output of lines from inputcache
2869 --Made Logger a mixin class, simplifies handling of switches
2871 --Made Logger a mixin class, simplifies handling of switches
2870 --Added own completer class. .string<TAB> expands to last history
2872 --Added own completer class. .string<TAB> expands to last history
2871 line which starts with string. The new expansion is also present
2873 line which starts with string. The new expansion is also present
2872 with Ctrl-r from the readline library. But this shows, who this
2874 with Ctrl-r from the readline library. But this shows, who this
2873 can be done for other cases.
2875 can be done for other cases.
2874 --Added convention that all shell functions should accept a
2876 --Added convention that all shell functions should accept a
2875 parameter_string This opens the door for different behaviour for
2877 parameter_string This opens the door for different behaviour for
2876 each function. @cd is a good example of this.
2878 each function. @cd is a good example of this.
2877
2879
2878 04.05.99 12:12 porto.ifm.uni-kiel.de
2880 04.05.99 12:12 porto.ifm.uni-kiel.de
2879 --added logfile rotation
2881 --added logfile rotation
2880 --added new mainloop method which freezes first the namespace
2882 --added new mainloop method which freezes first the namespace
2881
2883
2882 07.05.99 21:24 porto.ifm.uni-kiel.de
2884 07.05.99 21:24 porto.ifm.uni-kiel.de
2883 --added the docreader classes. Now there is a help system.
2885 --added the docreader classes. Now there is a help system.
2884 -This is only a first try. Currently it's not easy to put new
2886 -This is only a first try. Currently it's not easy to put new
2885 stuff in the indices. But this is the way to go. Info would be
2887 stuff in the indices. But this is the way to go. Info would be
2886 better, but HTML is every where and not everybody has an info
2888 better, but HTML is every where and not everybody has an info
2887 system installed and it's not so easy to change html-docs to info.
2889 system installed and it's not so easy to change html-docs to info.
2888 --added global logfile option
2890 --added global logfile option
2889 --there is now a hook for object inspection method pinfo needs to
2891 --there is now a hook for object inspection method pinfo needs to
2890 be provided for this. Can be reached by two '??'.
2892 be provided for this. Can be reached by two '??'.
2891
2893
2892 08.05.99 20:51 porto.ifm.uni-kiel.de
2894 08.05.99 20:51 porto.ifm.uni-kiel.de
2893 --added a README
2895 --added a README
2894 --bug in rc file. Something has changed so functions in the rc
2896 --bug in rc file. Something has changed so functions in the rc
2895 file need to reference the shell and not self. Not clear if it's a
2897 file need to reference the shell and not self. Not clear if it's a
2896 bug or feature.
2898 bug or feature.
2897 --changed rc file for new behavior
2899 --changed rc file for new behavior
2898
2900
2899 2004-07-15 Fernando Perez <fperez@colorado.edu>
2901 2004-07-15 Fernando Perez <fperez@colorado.edu>
2900
2902
2901 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2903 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2902 cache was falling out of sync in bizarre manners when multi-line
2904 cache was falling out of sync in bizarre manners when multi-line
2903 input was present. Minor optimizations and cleanup.
2905 input was present. Minor optimizations and cleanup.
2904
2906
2905 (Logger): Remove old Changelog info for cleanup. This is the
2907 (Logger): Remove old Changelog info for cleanup. This is the
2906 information which was there from Janko's original code:
2908 information which was there from Janko's original code:
2907
2909
2908 Changes to Logger: - made the default log filename a parameter
2910 Changes to Logger: - made the default log filename a parameter
2909
2911
2910 - put a check for lines beginning with !@? in log(). Needed
2912 - put a check for lines beginning with !@? in log(). Needed
2911 (even if the handlers properly log their lines) for mid-session
2913 (even if the handlers properly log their lines) for mid-session
2912 logging activation to work properly. Without this, lines logged
2914 logging activation to work properly. Without this, lines logged
2913 in mid session, which get read from the cache, would end up
2915 in mid session, which get read from the cache, would end up
2914 'bare' (with !@? in the open) in the log. Now they are caught
2916 'bare' (with !@? in the open) in the log. Now they are caught
2915 and prepended with a #.
2917 and prepended with a #.
2916
2918
2917 * IPython/iplib.py (InteractiveShell.init_readline): added check
2919 * IPython/iplib.py (InteractiveShell.init_readline): added check
2918 in case MagicCompleter fails to be defined, so we don't crash.
2920 in case MagicCompleter fails to be defined, so we don't crash.
2919
2921
2920 2004-07-13 Fernando Perez <fperez@colorado.edu>
2922 2004-07-13 Fernando Perez <fperez@colorado.edu>
2921
2923
2922 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2924 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2923 of EPS if the requested filename ends in '.eps'.
2925 of EPS if the requested filename ends in '.eps'.
2924
2926
2925 2004-07-04 Fernando Perez <fperez@colorado.edu>
2927 2004-07-04 Fernando Perez <fperez@colorado.edu>
2926
2928
2927 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2929 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2928 escaping of quotes when calling the shell.
2930 escaping of quotes when calling the shell.
2929
2931
2930 2004-07-02 Fernando Perez <fperez@colorado.edu>
2932 2004-07-02 Fernando Perez <fperez@colorado.edu>
2931
2933
2932 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2934 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2933 gettext not working because we were clobbering '_'. Fixes
2935 gettext not working because we were clobbering '_'. Fixes
2934 http://www.scipy.net/roundup/ipython/issue6.
2936 http://www.scipy.net/roundup/ipython/issue6.
2935
2937
2936 2004-07-01 Fernando Perez <fperez@colorado.edu>
2938 2004-07-01 Fernando Perez <fperez@colorado.edu>
2937
2939
2938 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2940 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2939 into @cd. Patch by Ville.
2941 into @cd. Patch by Ville.
2940
2942
2941 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2943 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2942 new function to store things after ipmaker runs. Patch by Ville.
2944 new function to store things after ipmaker runs. Patch by Ville.
2943 Eventually this will go away once ipmaker is removed and the class
2945 Eventually this will go away once ipmaker is removed and the class
2944 gets cleaned up, but for now it's ok. Key functionality here is
2946 gets cleaned up, but for now it's ok. Key functionality here is
2945 the addition of the persistent storage mechanism, a dict for
2947 the addition of the persistent storage mechanism, a dict for
2946 keeping data across sessions (for now just bookmarks, but more can
2948 keeping data across sessions (for now just bookmarks, but more can
2947 be implemented later).
2949 be implemented later).
2948
2950
2949 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2951 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2950 persistent across sections. Patch by Ville, I modified it
2952 persistent across sections. Patch by Ville, I modified it
2951 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2953 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2952 added a '-l' option to list all bookmarks.
2954 added a '-l' option to list all bookmarks.
2953
2955
2954 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2956 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2955 center for cleanup. Registered with atexit.register(). I moved
2957 center for cleanup. Registered with atexit.register(). I moved
2956 here the old exit_cleanup(). After a patch by Ville.
2958 here the old exit_cleanup(). After a patch by Ville.
2957
2959
2958 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2960 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2959 characters in the hacked shlex_split for python 2.2.
2961 characters in the hacked shlex_split for python 2.2.
2960
2962
2961 * IPython/iplib.py (file_matches): more fixes to filenames with
2963 * IPython/iplib.py (file_matches): more fixes to filenames with
2962 whitespace in them. It's not perfect, but limitations in python's
2964 whitespace in them. It's not perfect, but limitations in python's
2963 readline make it impossible to go further.
2965 readline make it impossible to go further.
2964
2966
2965 2004-06-29 Fernando Perez <fperez@colorado.edu>
2967 2004-06-29 Fernando Perez <fperez@colorado.edu>
2966
2968
2967 * IPython/iplib.py (file_matches): escape whitespace correctly in
2969 * IPython/iplib.py (file_matches): escape whitespace correctly in
2968 filename completions. Bug reported by Ville.
2970 filename completions. Bug reported by Ville.
2969
2971
2970 2004-06-28 Fernando Perez <fperez@colorado.edu>
2972 2004-06-28 Fernando Perez <fperez@colorado.edu>
2971
2973
2972 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2974 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2973 the history file will be called 'history-PROFNAME' (or just
2975 the history file will be called 'history-PROFNAME' (or just
2974 'history' if no profile is loaded). I was getting annoyed at
2976 'history' if no profile is loaded). I was getting annoyed at
2975 getting my Numerical work history clobbered by pysh sessions.
2977 getting my Numerical work history clobbered by pysh sessions.
2976
2978
2977 * IPython/iplib.py (InteractiveShell.__init__): Internal
2979 * IPython/iplib.py (InteractiveShell.__init__): Internal
2978 getoutputerror() function so that we can honor the system_verbose
2980 getoutputerror() function so that we can honor the system_verbose
2979 flag for _all_ system calls. I also added escaping of #
2981 flag for _all_ system calls. I also added escaping of #
2980 characters here to avoid confusing Itpl.
2982 characters here to avoid confusing Itpl.
2981
2983
2982 * IPython/Magic.py (shlex_split): removed call to shell in
2984 * IPython/Magic.py (shlex_split): removed call to shell in
2983 parse_options and replaced it with shlex.split(). The annoying
2985 parse_options and replaced it with shlex.split(). The annoying
2984 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2986 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2985 to backport it from 2.3, with several frail hacks (the shlex
2987 to backport it from 2.3, with several frail hacks (the shlex
2986 module is rather limited in 2.2). Thanks to a suggestion by Ville
2988 module is rather limited in 2.2). Thanks to a suggestion by Ville
2987 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2989 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2988 problem.
2990 problem.
2989
2991
2990 (Magic.magic_system_verbose): new toggle to print the actual
2992 (Magic.magic_system_verbose): new toggle to print the actual
2991 system calls made by ipython. Mainly for debugging purposes.
2993 system calls made by ipython. Mainly for debugging purposes.
2992
2994
2993 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2995 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2994 doesn't support persistence. Reported (and fix suggested) by
2996 doesn't support persistence. Reported (and fix suggested) by
2995 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2997 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2996
2998
2997 2004-06-26 Fernando Perez <fperez@colorado.edu>
2999 2004-06-26 Fernando Perez <fperez@colorado.edu>
2998
3000
2999 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3001 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3000 continue prompts.
3002 continue prompts.
3001
3003
3002 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3004 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3003 function (basically a big docstring) and a few more things here to
3005 function (basically a big docstring) and a few more things here to
3004 speedup startup. pysh.py is now very lightweight. We want because
3006 speedup startup. pysh.py is now very lightweight. We want because
3005 it gets execfile'd, while InterpreterExec gets imported, so
3007 it gets execfile'd, while InterpreterExec gets imported, so
3006 byte-compilation saves time.
3008 byte-compilation saves time.
3007
3009
3008 2004-06-25 Fernando Perez <fperez@colorado.edu>
3010 2004-06-25 Fernando Perez <fperez@colorado.edu>
3009
3011
3010 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3012 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3011 -NUM', which was recently broken.
3013 -NUM', which was recently broken.
3012
3014
3013 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3015 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3014 in multi-line input (but not !!, which doesn't make sense there).
3016 in multi-line input (but not !!, which doesn't make sense there).
3015
3017
3016 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3018 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3017 It's just too useful, and people can turn it off in the less
3019 It's just too useful, and people can turn it off in the less
3018 common cases where it's a problem.
3020 common cases where it's a problem.
3019
3021
3020 2004-06-24 Fernando Perez <fperez@colorado.edu>
3022 2004-06-24 Fernando Perez <fperez@colorado.edu>
3021
3023
3022 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3024 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3023 special syntaxes (like alias calling) is now allied in multi-line
3025 special syntaxes (like alias calling) is now allied in multi-line
3024 input. This is still _very_ experimental, but it's necessary for
3026 input. This is still _very_ experimental, but it's necessary for
3025 efficient shell usage combining python looping syntax with system
3027 efficient shell usage combining python looping syntax with system
3026 calls. For now it's restricted to aliases, I don't think it
3028 calls. For now it's restricted to aliases, I don't think it
3027 really even makes sense to have this for magics.
3029 really even makes sense to have this for magics.
3028
3030
3029 2004-06-23 Fernando Perez <fperez@colorado.edu>
3031 2004-06-23 Fernando Perez <fperez@colorado.edu>
3030
3032
3031 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3033 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3032 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3034 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3033
3035
3034 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3036 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3035 extensions under Windows (after code sent by Gary Bishop). The
3037 extensions under Windows (after code sent by Gary Bishop). The
3036 extensions considered 'executable' are stored in IPython's rc
3038 extensions considered 'executable' are stored in IPython's rc
3037 structure as win_exec_ext.
3039 structure as win_exec_ext.
3038
3040
3039 * IPython/genutils.py (shell): new function, like system() but
3041 * IPython/genutils.py (shell): new function, like system() but
3040 without return value. Very useful for interactive shell work.
3042 without return value. Very useful for interactive shell work.
3041
3043
3042 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3044 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3043 delete aliases.
3045 delete aliases.
3044
3046
3045 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3047 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3046 sure that the alias table doesn't contain python keywords.
3048 sure that the alias table doesn't contain python keywords.
3047
3049
3048 2004-06-21 Fernando Perez <fperez@colorado.edu>
3050 2004-06-21 Fernando Perez <fperez@colorado.edu>
3049
3051
3050 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3052 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3051 non-existent items are found in $PATH. Reported by Thorsten.
3053 non-existent items are found in $PATH. Reported by Thorsten.
3052
3054
3053 2004-06-20 Fernando Perez <fperez@colorado.edu>
3055 2004-06-20 Fernando Perez <fperez@colorado.edu>
3054
3056
3055 * IPython/iplib.py (complete): modified the completer so that the
3057 * IPython/iplib.py (complete): modified the completer so that the
3056 order of priorities can be easily changed at runtime.
3058 order of priorities can be easily changed at runtime.
3057
3059
3058 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3060 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3059 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3061 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3060
3062
3061 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3063 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3062 expand Python variables prepended with $ in all system calls. The
3064 expand Python variables prepended with $ in all system calls. The
3063 same was done to InteractiveShell.handle_shell_escape. Now all
3065 same was done to InteractiveShell.handle_shell_escape. Now all
3064 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3066 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3065 expansion of python variables and expressions according to the
3067 expansion of python variables and expressions according to the
3066 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3068 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3067
3069
3068 Though PEP-215 has been rejected, a similar (but simpler) one
3070 Though PEP-215 has been rejected, a similar (but simpler) one
3069 seems like it will go into Python 2.4, PEP-292 -
3071 seems like it will go into Python 2.4, PEP-292 -
3070 http://www.python.org/peps/pep-0292.html.
3072 http://www.python.org/peps/pep-0292.html.
3071
3073
3072 I'll keep the full syntax of PEP-215, since IPython has since the
3074 I'll keep the full syntax of PEP-215, since IPython has since the
3073 start used Ka-Ping Yee's reference implementation discussed there
3075 start used Ka-Ping Yee's reference implementation discussed there
3074 (Itpl), and I actually like the powerful semantics it offers.
3076 (Itpl), and I actually like the powerful semantics it offers.
3075
3077
3076 In order to access normal shell variables, the $ has to be escaped
3078 In order to access normal shell variables, the $ has to be escaped
3077 via an extra $. For example:
3079 via an extra $. For example:
3078
3080
3079 In [7]: PATH='a python variable'
3081 In [7]: PATH='a python variable'
3080
3082
3081 In [8]: !echo $PATH
3083 In [8]: !echo $PATH
3082 a python variable
3084 a python variable
3083
3085
3084 In [9]: !echo $$PATH
3086 In [9]: !echo $$PATH
3085 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3087 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3086
3088
3087 (Magic.parse_options): escape $ so the shell doesn't evaluate
3089 (Magic.parse_options): escape $ so the shell doesn't evaluate
3088 things prematurely.
3090 things prematurely.
3089
3091
3090 * IPython/iplib.py (InteractiveShell.call_alias): added the
3092 * IPython/iplib.py (InteractiveShell.call_alias): added the
3091 ability for aliases to expand python variables via $.
3093 ability for aliases to expand python variables via $.
3092
3094
3093 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3095 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3094 system, now there's a @rehash/@rehashx pair of magics. These work
3096 system, now there's a @rehash/@rehashx pair of magics. These work
3095 like the csh rehash command, and can be invoked at any time. They
3097 like the csh rehash command, and can be invoked at any time. They
3096 build a table of aliases to everything in the user's $PATH
3098 build a table of aliases to everything in the user's $PATH
3097 (@rehash uses everything, @rehashx is slower but only adds
3099 (@rehash uses everything, @rehashx is slower but only adds
3098 executable files). With this, the pysh.py-based shell profile can
3100 executable files). With this, the pysh.py-based shell profile can
3099 now simply call rehash upon startup, and full access to all
3101 now simply call rehash upon startup, and full access to all
3100 programs in the user's path is obtained.
3102 programs in the user's path is obtained.
3101
3103
3102 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3104 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3103 functionality is now fully in place. I removed the old dynamic
3105 functionality is now fully in place. I removed the old dynamic
3104 code generation based approach, in favor of a much lighter one
3106 code generation based approach, in favor of a much lighter one
3105 based on a simple dict. The advantage is that this allows me to
3107 based on a simple dict. The advantage is that this allows me to
3106 now have thousands of aliases with negligible cost (unthinkable
3108 now have thousands of aliases with negligible cost (unthinkable
3107 with the old system).
3109 with the old system).
3108
3110
3109 2004-06-19 Fernando Perez <fperez@colorado.edu>
3111 2004-06-19 Fernando Perez <fperez@colorado.edu>
3110
3112
3111 * IPython/iplib.py (__init__): extended MagicCompleter class to
3113 * IPython/iplib.py (__init__): extended MagicCompleter class to
3112 also complete (last in priority) on user aliases.
3114 also complete (last in priority) on user aliases.
3113
3115
3114 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3116 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3115 call to eval.
3117 call to eval.
3116 (ItplNS.__init__): Added a new class which functions like Itpl,
3118 (ItplNS.__init__): Added a new class which functions like Itpl,
3117 but allows configuring the namespace for the evaluation to occur
3119 but allows configuring the namespace for the evaluation to occur
3118 in.
3120 in.
3119
3121
3120 2004-06-18 Fernando Perez <fperez@colorado.edu>
3122 2004-06-18 Fernando Perez <fperez@colorado.edu>
3121
3123
3122 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3124 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3123 better message when 'exit' or 'quit' are typed (a common newbie
3125 better message when 'exit' or 'quit' are typed (a common newbie
3124 confusion).
3126 confusion).
3125
3127
3126 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3128 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3127 check for Windows users.
3129 check for Windows users.
3128
3130
3129 * IPython/iplib.py (InteractiveShell.user_setup): removed
3131 * IPython/iplib.py (InteractiveShell.user_setup): removed
3130 disabling of colors for Windows. I'll test at runtime and issue a
3132 disabling of colors for Windows. I'll test at runtime and issue a
3131 warning if Gary's readline isn't found, as to nudge users to
3133 warning if Gary's readline isn't found, as to nudge users to
3132 download it.
3134 download it.
3133
3135
3134 2004-06-16 Fernando Perez <fperez@colorado.edu>
3136 2004-06-16 Fernando Perez <fperez@colorado.edu>
3135
3137
3136 * IPython/genutils.py (Stream.__init__): changed to print errors
3138 * IPython/genutils.py (Stream.__init__): changed to print errors
3137 to sys.stderr. I had a circular dependency here. Now it's
3139 to sys.stderr. I had a circular dependency here. Now it's
3138 possible to run ipython as IDLE's shell (consider this pre-alpha,
3140 possible to run ipython as IDLE's shell (consider this pre-alpha,
3139 since true stdout things end up in the starting terminal instead
3141 since true stdout things end up in the starting terminal instead
3140 of IDLE's out).
3142 of IDLE's out).
3141
3143
3142 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3144 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3143 users who haven't # updated their prompt_in2 definitions. Remove
3145 users who haven't # updated their prompt_in2 definitions. Remove
3144 eventually.
3146 eventually.
3145 (multiple_replace): added credit to original ASPN recipe.
3147 (multiple_replace): added credit to original ASPN recipe.
3146
3148
3147 2004-06-15 Fernando Perez <fperez@colorado.edu>
3149 2004-06-15 Fernando Perez <fperez@colorado.edu>
3148
3150
3149 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3151 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3150 list of auto-defined aliases.
3152 list of auto-defined aliases.
3151
3153
3152 2004-06-13 Fernando Perez <fperez@colorado.edu>
3154 2004-06-13 Fernando Perez <fperez@colorado.edu>
3153
3155
3154 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3156 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3155 install was really requested (so setup.py can be used for other
3157 install was really requested (so setup.py can be used for other
3156 things under Windows).
3158 things under Windows).
3157
3159
3158 2004-06-10 Fernando Perez <fperez@colorado.edu>
3160 2004-06-10 Fernando Perez <fperez@colorado.edu>
3159
3161
3160 * IPython/Logger.py (Logger.create_log): Manually remove any old
3162 * IPython/Logger.py (Logger.create_log): Manually remove any old
3161 backup, since os.remove may fail under Windows. Fixes bug
3163 backup, since os.remove may fail under Windows. Fixes bug
3162 reported by Thorsten.
3164 reported by Thorsten.
3163
3165
3164 2004-06-09 Fernando Perez <fperez@colorado.edu>
3166 2004-06-09 Fernando Perez <fperez@colorado.edu>
3165
3167
3166 * examples/example-embed.py: fixed all references to %n (replaced
3168 * examples/example-embed.py: fixed all references to %n (replaced
3167 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3169 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3168 for all examples and the manual as well.
3170 for all examples and the manual as well.
3169
3171
3170 2004-06-08 Fernando Perez <fperez@colorado.edu>
3172 2004-06-08 Fernando Perez <fperez@colorado.edu>
3171
3173
3172 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3174 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3173 alignment and color management. All 3 prompt subsystems now
3175 alignment and color management. All 3 prompt subsystems now
3174 inherit from BasePrompt.
3176 inherit from BasePrompt.
3175
3177
3176 * tools/release: updates for windows installer build and tag rpms
3178 * tools/release: updates for windows installer build and tag rpms
3177 with python version (since paths are fixed).
3179 with python version (since paths are fixed).
3178
3180
3179 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3181 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3180 which will become eventually obsolete. Also fixed the default
3182 which will become eventually obsolete. Also fixed the default
3181 prompt_in2 to use \D, so at least new users start with the correct
3183 prompt_in2 to use \D, so at least new users start with the correct
3182 defaults.
3184 defaults.
3183 WARNING: Users with existing ipythonrc files will need to apply
3185 WARNING: Users with existing ipythonrc files will need to apply
3184 this fix manually!
3186 this fix manually!
3185
3187
3186 * setup.py: make windows installer (.exe). This is finally the
3188 * setup.py: make windows installer (.exe). This is finally the
3187 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3189 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3188 which I hadn't included because it required Python 2.3 (or recent
3190 which I hadn't included because it required Python 2.3 (or recent
3189 distutils).
3191 distutils).
3190
3192
3191 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3193 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3192 usage of new '\D' escape.
3194 usage of new '\D' escape.
3193
3195
3194 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3196 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3195 lacks os.getuid())
3197 lacks os.getuid())
3196 (CachedOutput.set_colors): Added the ability to turn coloring
3198 (CachedOutput.set_colors): Added the ability to turn coloring
3197 on/off with @colors even for manually defined prompt colors. It
3199 on/off with @colors even for manually defined prompt colors. It
3198 uses a nasty global, but it works safely and via the generic color
3200 uses a nasty global, but it works safely and via the generic color
3199 handling mechanism.
3201 handling mechanism.
3200 (Prompt2.__init__): Introduced new escape '\D' for continuation
3202 (Prompt2.__init__): Introduced new escape '\D' for continuation
3201 prompts. It represents the counter ('\#') as dots.
3203 prompts. It represents the counter ('\#') as dots.
3202 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3204 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3203 need to update their ipythonrc files and replace '%n' with '\D' in
3205 need to update their ipythonrc files and replace '%n' with '\D' in
3204 their prompt_in2 settings everywhere. Sorry, but there's
3206 their prompt_in2 settings everywhere. Sorry, but there's
3205 otherwise no clean way to get all prompts to properly align. The
3207 otherwise no clean way to get all prompts to properly align. The
3206 ipythonrc shipped with IPython has been updated.
3208 ipythonrc shipped with IPython has been updated.
3207
3209
3208 2004-06-07 Fernando Perez <fperez@colorado.edu>
3210 2004-06-07 Fernando Perez <fperez@colorado.edu>
3209
3211
3210 * setup.py (isfile): Pass local_icons option to latex2html, so the
3212 * setup.py (isfile): Pass local_icons option to latex2html, so the
3211 resulting HTML file is self-contained. Thanks to
3213 resulting HTML file is self-contained. Thanks to
3212 dryice-AT-liu.com.cn for the tip.
3214 dryice-AT-liu.com.cn for the tip.
3213
3215
3214 * pysh.py: I created a new profile 'shell', which implements a
3216 * pysh.py: I created a new profile 'shell', which implements a
3215 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3217 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3216 system shell, nor will it become one anytime soon. It's mainly
3218 system shell, nor will it become one anytime soon. It's mainly
3217 meant to illustrate the use of the new flexible bash-like prompts.
3219 meant to illustrate the use of the new flexible bash-like prompts.
3218 I guess it could be used by hardy souls for true shell management,
3220 I guess it could be used by hardy souls for true shell management,
3219 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3221 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3220 profile. This uses the InterpreterExec extension provided by
3222 profile. This uses the InterpreterExec extension provided by
3221 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3223 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3222
3224
3223 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3225 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3224 auto-align itself with the length of the previous input prompt
3226 auto-align itself with the length of the previous input prompt
3225 (taking into account the invisible color escapes).
3227 (taking into account the invisible color escapes).
3226 (CachedOutput.__init__): Large restructuring of this class. Now
3228 (CachedOutput.__init__): Large restructuring of this class. Now
3227 all three prompts (primary1, primary2, output) are proper objects,
3229 all three prompts (primary1, primary2, output) are proper objects,
3228 managed by the 'parent' CachedOutput class. The code is still a
3230 managed by the 'parent' CachedOutput class. The code is still a
3229 bit hackish (all prompts share state via a pointer to the cache),
3231 bit hackish (all prompts share state via a pointer to the cache),
3230 but it's overall far cleaner than before.
3232 but it's overall far cleaner than before.
3231
3233
3232 * IPython/genutils.py (getoutputerror): modified to add verbose,
3234 * IPython/genutils.py (getoutputerror): modified to add verbose,
3233 debug and header options. This makes the interface of all getout*
3235 debug and header options. This makes the interface of all getout*
3234 functions uniform.
3236 functions uniform.
3235 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3237 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3236
3238
3237 * IPython/Magic.py (Magic.default_option): added a function to
3239 * IPython/Magic.py (Magic.default_option): added a function to
3238 allow registering default options for any magic command. This
3240 allow registering default options for any magic command. This
3239 makes it easy to have profiles which customize the magics globally
3241 makes it easy to have profiles which customize the magics globally
3240 for a certain use. The values set through this function are
3242 for a certain use. The values set through this function are
3241 picked up by the parse_options() method, which all magics should
3243 picked up by the parse_options() method, which all magics should
3242 use to parse their options.
3244 use to parse their options.
3243
3245
3244 * IPython/genutils.py (warn): modified the warnings framework to
3246 * IPython/genutils.py (warn): modified the warnings framework to
3245 use the Term I/O class. I'm trying to slowly unify all of
3247 use the Term I/O class. I'm trying to slowly unify all of
3246 IPython's I/O operations to pass through Term.
3248 IPython's I/O operations to pass through Term.
3247
3249
3248 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3250 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3249 the secondary prompt to correctly match the length of the primary
3251 the secondary prompt to correctly match the length of the primary
3250 one for any prompt. Now multi-line code will properly line up
3252 one for any prompt. Now multi-line code will properly line up
3251 even for path dependent prompts, such as the new ones available
3253 even for path dependent prompts, such as the new ones available
3252 via the prompt_specials.
3254 via the prompt_specials.
3253
3255
3254 2004-06-06 Fernando Perez <fperez@colorado.edu>
3256 2004-06-06 Fernando Perez <fperez@colorado.edu>
3255
3257
3256 * IPython/Prompts.py (prompt_specials): Added the ability to have
3258 * IPython/Prompts.py (prompt_specials): Added the ability to have
3257 bash-like special sequences in the prompts, which get
3259 bash-like special sequences in the prompts, which get
3258 automatically expanded. Things like hostname, current working
3260 automatically expanded. Things like hostname, current working
3259 directory and username are implemented already, but it's easy to
3261 directory and username are implemented already, but it's easy to
3260 add more in the future. Thanks to a patch by W.J. van der Laan
3262 add more in the future. Thanks to a patch by W.J. van der Laan
3261 <gnufnork-AT-hetdigitalegat.nl>
3263 <gnufnork-AT-hetdigitalegat.nl>
3262 (prompt_specials): Added color support for prompt strings, so
3264 (prompt_specials): Added color support for prompt strings, so
3263 users can define arbitrary color setups for their prompts.
3265 users can define arbitrary color setups for their prompts.
3264
3266
3265 2004-06-05 Fernando Perez <fperez@colorado.edu>
3267 2004-06-05 Fernando Perez <fperez@colorado.edu>
3266
3268
3267 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3269 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3268 code to load Gary Bishop's readline and configure it
3270 code to load Gary Bishop's readline and configure it
3269 automatically. Thanks to Gary for help on this.
3271 automatically. Thanks to Gary for help on this.
3270
3272
3271 2004-06-01 Fernando Perez <fperez@colorado.edu>
3273 2004-06-01 Fernando Perez <fperez@colorado.edu>
3272
3274
3273 * IPython/Logger.py (Logger.create_log): fix bug for logging
3275 * IPython/Logger.py (Logger.create_log): fix bug for logging
3274 with no filename (previous fix was incomplete).
3276 with no filename (previous fix was incomplete).
3275
3277
3276 2004-05-25 Fernando Perez <fperez@colorado.edu>
3278 2004-05-25 Fernando Perez <fperez@colorado.edu>
3277
3279
3278 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3280 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3279 parens would get passed to the shell.
3281 parens would get passed to the shell.
3280
3282
3281 2004-05-20 Fernando Perez <fperez@colorado.edu>
3283 2004-05-20 Fernando Perez <fperez@colorado.edu>
3282
3284
3283 * IPython/Magic.py (Magic.magic_prun): changed default profile
3285 * IPython/Magic.py (Magic.magic_prun): changed default profile
3284 sort order to 'time' (the more common profiling need).
3286 sort order to 'time' (the more common profiling need).
3285
3287
3286 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3288 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3287 so that source code shown is guaranteed in sync with the file on
3289 so that source code shown is guaranteed in sync with the file on
3288 disk (also changed in psource). Similar fix to the one for
3290 disk (also changed in psource). Similar fix to the one for
3289 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3291 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3290 <yann.ledu-AT-noos.fr>.
3292 <yann.ledu-AT-noos.fr>.
3291
3293
3292 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3294 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3293 with a single option would not be correctly parsed. Closes
3295 with a single option would not be correctly parsed. Closes
3294 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3296 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3295 introduced in 0.6.0 (on 2004-05-06).
3297 introduced in 0.6.0 (on 2004-05-06).
3296
3298
3297 2004-05-13 *** Released version 0.6.0
3299 2004-05-13 *** Released version 0.6.0
3298
3300
3299 2004-05-13 Fernando Perez <fperez@colorado.edu>
3301 2004-05-13 Fernando Perez <fperez@colorado.edu>
3300
3302
3301 * debian/: Added debian/ directory to CVS, so that debian support
3303 * debian/: Added debian/ directory to CVS, so that debian support
3302 is publicly accessible. The debian package is maintained by Jack
3304 is publicly accessible. The debian package is maintained by Jack
3303 Moffit <jack-AT-xiph.org>.
3305 Moffit <jack-AT-xiph.org>.
3304
3306
3305 * Documentation: included the notes about an ipython-based system
3307 * Documentation: included the notes about an ipython-based system
3306 shell (the hypothetical 'pysh') into the new_design.pdf document,
3308 shell (the hypothetical 'pysh') into the new_design.pdf document,
3307 so that these ideas get distributed to users along with the
3309 so that these ideas get distributed to users along with the
3308 official documentation.
3310 official documentation.
3309
3311
3310 2004-05-10 Fernando Perez <fperez@colorado.edu>
3312 2004-05-10 Fernando Perez <fperez@colorado.edu>
3311
3313
3312 * IPython/Logger.py (Logger.create_log): fix recently introduced
3314 * IPython/Logger.py (Logger.create_log): fix recently introduced
3313 bug (misindented line) where logstart would fail when not given an
3315 bug (misindented line) where logstart would fail when not given an
3314 explicit filename.
3316 explicit filename.
3315
3317
3316 2004-05-09 Fernando Perez <fperez@colorado.edu>
3318 2004-05-09 Fernando Perez <fperez@colorado.edu>
3317
3319
3318 * IPython/Magic.py (Magic.parse_options): skip system call when
3320 * IPython/Magic.py (Magic.parse_options): skip system call when
3319 there are no options to look for. Faster, cleaner for the common
3321 there are no options to look for. Faster, cleaner for the common
3320 case.
3322 case.
3321
3323
3322 * Documentation: many updates to the manual: describing Windows
3324 * Documentation: many updates to the manual: describing Windows
3323 support better, Gnuplot updates, credits, misc small stuff. Also
3325 support better, Gnuplot updates, credits, misc small stuff. Also
3324 updated the new_design doc a bit.
3326 updated the new_design doc a bit.
3325
3327
3326 2004-05-06 *** Released version 0.6.0.rc1
3328 2004-05-06 *** Released version 0.6.0.rc1
3327
3329
3328 2004-05-06 Fernando Perez <fperez@colorado.edu>
3330 2004-05-06 Fernando Perez <fperez@colorado.edu>
3329
3331
3330 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3332 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3331 operations to use the vastly more efficient list/''.join() method.
3333 operations to use the vastly more efficient list/''.join() method.
3332 (FormattedTB.text): Fix
3334 (FormattedTB.text): Fix
3333 http://www.scipy.net/roundup/ipython/issue12 - exception source
3335 http://www.scipy.net/roundup/ipython/issue12 - exception source
3334 extract not updated after reload. Thanks to Mike Salib
3336 extract not updated after reload. Thanks to Mike Salib
3335 <msalib-AT-mit.edu> for pinning the source of the problem.
3337 <msalib-AT-mit.edu> for pinning the source of the problem.
3336 Fortunately, the solution works inside ipython and doesn't require
3338 Fortunately, the solution works inside ipython and doesn't require
3337 any changes to python proper.
3339 any changes to python proper.
3338
3340
3339 * IPython/Magic.py (Magic.parse_options): Improved to process the
3341 * IPython/Magic.py (Magic.parse_options): Improved to process the
3340 argument list as a true shell would (by actually using the
3342 argument list as a true shell would (by actually using the
3341 underlying system shell). This way, all @magics automatically get
3343 underlying system shell). This way, all @magics automatically get
3342 shell expansion for variables. Thanks to a comment by Alex
3344 shell expansion for variables. Thanks to a comment by Alex
3343 Schmolck.
3345 Schmolck.
3344
3346
3345 2004-04-04 Fernando Perez <fperez@colorado.edu>
3347 2004-04-04 Fernando Perez <fperez@colorado.edu>
3346
3348
3347 * IPython/iplib.py (InteractiveShell.interact): Added a special
3349 * IPython/iplib.py (InteractiveShell.interact): Added a special
3348 trap for a debugger quit exception, which is basically impossible
3350 trap for a debugger quit exception, which is basically impossible
3349 to handle by normal mechanisms, given what pdb does to the stack.
3351 to handle by normal mechanisms, given what pdb does to the stack.
3350 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3352 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3351
3353
3352 2004-04-03 Fernando Perez <fperez@colorado.edu>
3354 2004-04-03 Fernando Perez <fperez@colorado.edu>
3353
3355
3354 * IPython/genutils.py (Term): Standardized the names of the Term
3356 * IPython/genutils.py (Term): Standardized the names of the Term
3355 class streams to cin/cout/cerr, following C++ naming conventions
3357 class streams to cin/cout/cerr, following C++ naming conventions
3356 (I can't use in/out/err because 'in' is not a valid attribute
3358 (I can't use in/out/err because 'in' is not a valid attribute
3357 name).
3359 name).
3358
3360
3359 * IPython/iplib.py (InteractiveShell.interact): don't increment
3361 * IPython/iplib.py (InteractiveShell.interact): don't increment
3360 the prompt if there's no user input. By Daniel 'Dang' Griffith
3362 the prompt if there's no user input. By Daniel 'Dang' Griffith
3361 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3363 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3362 Francois Pinard.
3364 Francois Pinard.
3363
3365
3364 2004-04-02 Fernando Perez <fperez@colorado.edu>
3366 2004-04-02 Fernando Perez <fperez@colorado.edu>
3365
3367
3366 * IPython/genutils.py (Stream.__init__): Modified to survive at
3368 * IPython/genutils.py (Stream.__init__): Modified to survive at
3367 least importing in contexts where stdin/out/err aren't true file
3369 least importing in contexts where stdin/out/err aren't true file
3368 objects, such as PyCrust (they lack fileno() and mode). However,
3370 objects, such as PyCrust (they lack fileno() and mode). However,
3369 the recovery facilities which rely on these things existing will
3371 the recovery facilities which rely on these things existing will
3370 not work.
3372 not work.
3371
3373
3372 2004-04-01 Fernando Perez <fperez@colorado.edu>
3374 2004-04-01 Fernando Perez <fperez@colorado.edu>
3373
3375
3374 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3376 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3375 use the new getoutputerror() function, so it properly
3377 use the new getoutputerror() function, so it properly
3376 distinguishes stdout/err.
3378 distinguishes stdout/err.
3377
3379
3378 * IPython/genutils.py (getoutputerror): added a function to
3380 * IPython/genutils.py (getoutputerror): added a function to
3379 capture separately the standard output and error of a command.
3381 capture separately the standard output and error of a command.
3380 After a comment from dang on the mailing lists. This code is
3382 After a comment from dang on the mailing lists. This code is
3381 basically a modified version of commands.getstatusoutput(), from
3383 basically a modified version of commands.getstatusoutput(), from
3382 the standard library.
3384 the standard library.
3383
3385
3384 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3386 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3385 '!!' as a special syntax (shorthand) to access @sx.
3387 '!!' as a special syntax (shorthand) to access @sx.
3386
3388
3387 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3389 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3388 command and return its output as a list split on '\n'.
3390 command and return its output as a list split on '\n'.
3389
3391
3390 2004-03-31 Fernando Perez <fperez@colorado.edu>
3392 2004-03-31 Fernando Perez <fperez@colorado.edu>
3391
3393
3392 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3394 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3393 method to dictionaries used as FakeModule instances if they lack
3395 method to dictionaries used as FakeModule instances if they lack
3394 it. At least pydoc in python2.3 breaks for runtime-defined
3396 it. At least pydoc in python2.3 breaks for runtime-defined
3395 functions without this hack. At some point I need to _really_
3397 functions without this hack. At some point I need to _really_
3396 understand what FakeModule is doing, because it's a gross hack.
3398 understand what FakeModule is doing, because it's a gross hack.
3397 But it solves Arnd's problem for now...
3399 But it solves Arnd's problem for now...
3398
3400
3399 2004-02-27 Fernando Perez <fperez@colorado.edu>
3401 2004-02-27 Fernando Perez <fperez@colorado.edu>
3400
3402
3401 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3403 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3402 mode would behave erratically. Also increased the number of
3404 mode would behave erratically. Also increased the number of
3403 possible logs in rotate mod to 999. Thanks to Rod Holland
3405 possible logs in rotate mod to 999. Thanks to Rod Holland
3404 <rhh@StructureLABS.com> for the report and fixes.
3406 <rhh@StructureLABS.com> for the report and fixes.
3405
3407
3406 2004-02-26 Fernando Perez <fperez@colorado.edu>
3408 2004-02-26 Fernando Perez <fperez@colorado.edu>
3407
3409
3408 * IPython/genutils.py (page): Check that the curses module really
3410 * IPython/genutils.py (page): Check that the curses module really
3409 has the initscr attribute before trying to use it. For some
3411 has the initscr attribute before trying to use it. For some
3410 reason, the Solaris curses module is missing this. I think this
3412 reason, the Solaris curses module is missing this. I think this
3411 should be considered a Solaris python bug, but I'm not sure.
3413 should be considered a Solaris python bug, but I'm not sure.
3412
3414
3413 2004-01-17 Fernando Perez <fperez@colorado.edu>
3415 2004-01-17 Fernando Perez <fperez@colorado.edu>
3414
3416
3415 * IPython/genutils.py (Stream.__init__): Changes to try to make
3417 * IPython/genutils.py (Stream.__init__): Changes to try to make
3416 ipython robust against stdin/out/err being closed by the user.
3418 ipython robust against stdin/out/err being closed by the user.
3417 This is 'user error' (and blocks a normal python session, at least
3419 This is 'user error' (and blocks a normal python session, at least
3418 the stdout case). However, Ipython should be able to survive such
3420 the stdout case). However, Ipython should be able to survive such
3419 instances of abuse as gracefully as possible. To simplify the
3421 instances of abuse as gracefully as possible. To simplify the
3420 coding and maintain compatibility with Gary Bishop's Term
3422 coding and maintain compatibility with Gary Bishop's Term
3421 contributions, I've made use of classmethods for this. I think
3423 contributions, I've made use of classmethods for this. I think
3422 this introduces a dependency on python 2.2.
3424 this introduces a dependency on python 2.2.
3423
3425
3424 2004-01-13 Fernando Perez <fperez@colorado.edu>
3426 2004-01-13 Fernando Perez <fperez@colorado.edu>
3425
3427
3426 * IPython/numutils.py (exp_safe): simplified the code a bit and
3428 * IPython/numutils.py (exp_safe): simplified the code a bit and
3427 removed the need for importing the kinds module altogether.
3429 removed the need for importing the kinds module altogether.
3428
3430
3429 2004-01-06 Fernando Perez <fperez@colorado.edu>
3431 2004-01-06 Fernando Perez <fperez@colorado.edu>
3430
3432
3431 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3433 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3432 a magic function instead, after some community feedback. No
3434 a magic function instead, after some community feedback. No
3433 special syntax will exist for it, but its name is deliberately
3435 special syntax will exist for it, but its name is deliberately
3434 very short.
3436 very short.
3435
3437
3436 2003-12-20 Fernando Perez <fperez@colorado.edu>
3438 2003-12-20 Fernando Perez <fperez@colorado.edu>
3437
3439
3438 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3440 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3439 new functionality, to automagically assign the result of a shell
3441 new functionality, to automagically assign the result of a shell
3440 command to a variable. I'll solicit some community feedback on
3442 command to a variable. I'll solicit some community feedback on
3441 this before making it permanent.
3443 this before making it permanent.
3442
3444
3443 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3445 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3444 requested about callables for which inspect couldn't obtain a
3446 requested about callables for which inspect couldn't obtain a
3445 proper argspec. Thanks to a crash report sent by Etienne
3447 proper argspec. Thanks to a crash report sent by Etienne
3446 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3448 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3447
3449
3448 2003-12-09 Fernando Perez <fperez@colorado.edu>
3450 2003-12-09 Fernando Perez <fperez@colorado.edu>
3449
3451
3450 * IPython/genutils.py (page): patch for the pager to work across
3452 * IPython/genutils.py (page): patch for the pager to work across
3451 various versions of Windows. By Gary Bishop.
3453 various versions of Windows. By Gary Bishop.
3452
3454
3453 2003-12-04 Fernando Perez <fperez@colorado.edu>
3455 2003-12-04 Fernando Perez <fperez@colorado.edu>
3454
3456
3455 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3457 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3456 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3458 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3457 While I tested this and it looks ok, there may still be corner
3459 While I tested this and it looks ok, there may still be corner
3458 cases I've missed.
3460 cases I've missed.
3459
3461
3460 2003-12-01 Fernando Perez <fperez@colorado.edu>
3462 2003-12-01 Fernando Perez <fperez@colorado.edu>
3461
3463
3462 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3464 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3463 where a line like 'p,q=1,2' would fail because the automagic
3465 where a line like 'p,q=1,2' would fail because the automagic
3464 system would be triggered for @p.
3466 system would be triggered for @p.
3465
3467
3466 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3468 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3467 cleanups, code unmodified.
3469 cleanups, code unmodified.
3468
3470
3469 * IPython/genutils.py (Term): added a class for IPython to handle
3471 * IPython/genutils.py (Term): added a class for IPython to handle
3470 output. In most cases it will just be a proxy for stdout/err, but
3472 output. In most cases it will just be a proxy for stdout/err, but
3471 having this allows modifications to be made for some platforms,
3473 having this allows modifications to be made for some platforms,
3472 such as handling color escapes under Windows. All of this code
3474 such as handling color escapes under Windows. All of this code
3473 was contributed by Gary Bishop, with minor modifications by me.
3475 was contributed by Gary Bishop, with minor modifications by me.
3474 The actual changes affect many files.
3476 The actual changes affect many files.
3475
3477
3476 2003-11-30 Fernando Perez <fperez@colorado.edu>
3478 2003-11-30 Fernando Perez <fperez@colorado.edu>
3477
3479
3478 * IPython/iplib.py (file_matches): new completion code, courtesy
3480 * IPython/iplib.py (file_matches): new completion code, courtesy
3479 of Jeff Collins. This enables filename completion again under
3481 of Jeff Collins. This enables filename completion again under
3480 python 2.3, which disabled it at the C level.
3482 python 2.3, which disabled it at the C level.
3481
3483
3482 2003-11-11 Fernando Perez <fperez@colorado.edu>
3484 2003-11-11 Fernando Perez <fperez@colorado.edu>
3483
3485
3484 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3486 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3485 for Numeric.array(map(...)), but often convenient.
3487 for Numeric.array(map(...)), but often convenient.
3486
3488
3487 2003-11-05 Fernando Perez <fperez@colorado.edu>
3489 2003-11-05 Fernando Perez <fperez@colorado.edu>
3488
3490
3489 * IPython/numutils.py (frange): Changed a call from int() to
3491 * IPython/numutils.py (frange): Changed a call from int() to
3490 int(round()) to prevent a problem reported with arange() in the
3492 int(round()) to prevent a problem reported with arange() in the
3491 numpy list.
3493 numpy list.
3492
3494
3493 2003-10-06 Fernando Perez <fperez@colorado.edu>
3495 2003-10-06 Fernando Perez <fperez@colorado.edu>
3494
3496
3495 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3497 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3496 prevent crashes if sys lacks an argv attribute (it happens with
3498 prevent crashes if sys lacks an argv attribute (it happens with
3497 embedded interpreters which build a bare-bones sys module).
3499 embedded interpreters which build a bare-bones sys module).
3498 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3500 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3499
3501
3500 2003-09-24 Fernando Perez <fperez@colorado.edu>
3502 2003-09-24 Fernando Perez <fperez@colorado.edu>
3501
3503
3502 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3504 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3503 to protect against poorly written user objects where __getattr__
3505 to protect against poorly written user objects where __getattr__
3504 raises exceptions other than AttributeError. Thanks to a bug
3506 raises exceptions other than AttributeError. Thanks to a bug
3505 report by Oliver Sander <osander-AT-gmx.de>.
3507 report by Oliver Sander <osander-AT-gmx.de>.
3506
3508
3507 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3509 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3508 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3510 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3509
3511
3510 2003-09-09 Fernando Perez <fperez@colorado.edu>
3512 2003-09-09 Fernando Perez <fperez@colorado.edu>
3511
3513
3512 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3514 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3513 unpacking a list whith a callable as first element would
3515 unpacking a list whith a callable as first element would
3514 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3516 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3515 Collins.
3517 Collins.
3516
3518
3517 2003-08-25 *** Released version 0.5.0
3519 2003-08-25 *** Released version 0.5.0
3518
3520
3519 2003-08-22 Fernando Perez <fperez@colorado.edu>
3521 2003-08-22 Fernando Perez <fperez@colorado.edu>
3520
3522
3521 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3523 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3522 improperly defined user exceptions. Thanks to feedback from Mark
3524 improperly defined user exceptions. Thanks to feedback from Mark
3523 Russell <mrussell-AT-verio.net>.
3525 Russell <mrussell-AT-verio.net>.
3524
3526
3525 2003-08-20 Fernando Perez <fperez@colorado.edu>
3527 2003-08-20 Fernando Perez <fperez@colorado.edu>
3526
3528
3527 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3529 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3528 printing so that it would print multi-line string forms starting
3530 printing so that it would print multi-line string forms starting
3529 with a new line. This way the formatting is better respected for
3531 with a new line. This way the formatting is better respected for
3530 objects which work hard to make nice string forms.
3532 objects which work hard to make nice string forms.
3531
3533
3532 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3534 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3533 autocall would overtake data access for objects with both
3535 autocall would overtake data access for objects with both
3534 __getitem__ and __call__.
3536 __getitem__ and __call__.
3535
3537
3536 2003-08-19 *** Released version 0.5.0-rc1
3538 2003-08-19 *** Released version 0.5.0-rc1
3537
3539
3538 2003-08-19 Fernando Perez <fperez@colorado.edu>
3540 2003-08-19 Fernando Perez <fperez@colorado.edu>
3539
3541
3540 * IPython/deep_reload.py (load_tail): single tiny change here
3542 * IPython/deep_reload.py (load_tail): single tiny change here
3541 seems to fix the long-standing bug of dreload() failing to work
3543 seems to fix the long-standing bug of dreload() failing to work
3542 for dotted names. But this module is pretty tricky, so I may have
3544 for dotted names. But this module is pretty tricky, so I may have
3543 missed some subtlety. Needs more testing!.
3545 missed some subtlety. Needs more testing!.
3544
3546
3545 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3547 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3546 exceptions which have badly implemented __str__ methods.
3548 exceptions which have badly implemented __str__ methods.
3547 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3549 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3548 which I've been getting reports about from Python 2.3 users. I
3550 which I've been getting reports about from Python 2.3 users. I
3549 wish I had a simple test case to reproduce the problem, so I could
3551 wish I had a simple test case to reproduce the problem, so I could
3550 either write a cleaner workaround or file a bug report if
3552 either write a cleaner workaround or file a bug report if
3551 necessary.
3553 necessary.
3552
3554
3553 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3555 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3554 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3556 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3555 a bug report by Tjabo Kloppenburg.
3557 a bug report by Tjabo Kloppenburg.
3556
3558
3557 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3559 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3558 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3560 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3559 seems rather unstable. Thanks to a bug report by Tjabo
3561 seems rather unstable. Thanks to a bug report by Tjabo
3560 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3562 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3561
3563
3562 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3564 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3563 this out soon because of the critical fixes in the inner loop for
3565 this out soon because of the critical fixes in the inner loop for
3564 generators.
3566 generators.
3565
3567
3566 * IPython/Magic.py (Magic.getargspec): removed. This (and
3568 * IPython/Magic.py (Magic.getargspec): removed. This (and
3567 _get_def) have been obsoleted by OInspect for a long time, I
3569 _get_def) have been obsoleted by OInspect for a long time, I
3568 hadn't noticed that they were dead code.
3570 hadn't noticed that they were dead code.
3569 (Magic._ofind): restored _ofind functionality for a few literals
3571 (Magic._ofind): restored _ofind functionality for a few literals
3570 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3572 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3571 for things like "hello".capitalize?, since that would require a
3573 for things like "hello".capitalize?, since that would require a
3572 potentially dangerous eval() again.
3574 potentially dangerous eval() again.
3573
3575
3574 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3576 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3575 logic a bit more to clean up the escapes handling and minimize the
3577 logic a bit more to clean up the escapes handling and minimize the
3576 use of _ofind to only necessary cases. The interactive 'feel' of
3578 use of _ofind to only necessary cases. The interactive 'feel' of
3577 IPython should have improved quite a bit with the changes in
3579 IPython should have improved quite a bit with the changes in
3578 _prefilter and _ofind (besides being far safer than before).
3580 _prefilter and _ofind (besides being far safer than before).
3579
3581
3580 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3582 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3581 obscure, never reported). Edit would fail to find the object to
3583 obscure, never reported). Edit would fail to find the object to
3582 edit under some circumstances.
3584 edit under some circumstances.
3583 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3585 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3584 which were causing double-calling of generators. Those eval calls
3586 which were causing double-calling of generators. Those eval calls
3585 were _very_ dangerous, since code with side effects could be
3587 were _very_ dangerous, since code with side effects could be
3586 triggered. As they say, 'eval is evil'... These were the
3588 triggered. As they say, 'eval is evil'... These were the
3587 nastiest evals in IPython. Besides, _ofind is now far simpler,
3589 nastiest evals in IPython. Besides, _ofind is now far simpler,
3588 and it should also be quite a bit faster. Its use of inspect is
3590 and it should also be quite a bit faster. Its use of inspect is
3589 also safer, so perhaps some of the inspect-related crashes I've
3591 also safer, so perhaps some of the inspect-related crashes I've
3590 seen lately with Python 2.3 might be taken care of. That will
3592 seen lately with Python 2.3 might be taken care of. That will
3591 need more testing.
3593 need more testing.
3592
3594
3593 2003-08-17 Fernando Perez <fperez@colorado.edu>
3595 2003-08-17 Fernando Perez <fperez@colorado.edu>
3594
3596
3595 * IPython/iplib.py (InteractiveShell._prefilter): significant
3597 * IPython/iplib.py (InteractiveShell._prefilter): significant
3596 simplifications to the logic for handling user escapes. Faster
3598 simplifications to the logic for handling user escapes. Faster
3597 and simpler code.
3599 and simpler code.
3598
3600
3599 2003-08-14 Fernando Perez <fperez@colorado.edu>
3601 2003-08-14 Fernando Perez <fperez@colorado.edu>
3600
3602
3601 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3603 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3602 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3604 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3603 but it should be quite a bit faster. And the recursive version
3605 but it should be quite a bit faster. And the recursive version
3604 generated O(log N) intermediate storage for all rank>1 arrays,
3606 generated O(log N) intermediate storage for all rank>1 arrays,
3605 even if they were contiguous.
3607 even if they were contiguous.
3606 (l1norm): Added this function.
3608 (l1norm): Added this function.
3607 (norm): Added this function for arbitrary norms (including
3609 (norm): Added this function for arbitrary norms (including
3608 l-infinity). l1 and l2 are still special cases for convenience
3610 l-infinity). l1 and l2 are still special cases for convenience
3609 and speed.
3611 and speed.
3610
3612
3611 2003-08-03 Fernando Perez <fperez@colorado.edu>
3613 2003-08-03 Fernando Perez <fperez@colorado.edu>
3612
3614
3613 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3615 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3614 exceptions, which now raise PendingDeprecationWarnings in Python
3616 exceptions, which now raise PendingDeprecationWarnings in Python
3615 2.3. There were some in Magic and some in Gnuplot2.
3617 2.3. There were some in Magic and some in Gnuplot2.
3616
3618
3617 2003-06-30 Fernando Perez <fperez@colorado.edu>
3619 2003-06-30 Fernando Perez <fperez@colorado.edu>
3618
3620
3619 * IPython/genutils.py (page): modified to call curses only for
3621 * IPython/genutils.py (page): modified to call curses only for
3620 terminals where TERM=='xterm'. After problems under many other
3622 terminals where TERM=='xterm'. After problems under many other
3621 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3623 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3622
3624
3623 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3625 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3624 would be triggered when readline was absent. This was just an old
3626 would be triggered when readline was absent. This was just an old
3625 debugging statement I'd forgotten to take out.
3627 debugging statement I'd forgotten to take out.
3626
3628
3627 2003-06-20 Fernando Perez <fperez@colorado.edu>
3629 2003-06-20 Fernando Perez <fperez@colorado.edu>
3628
3630
3629 * IPython/genutils.py (clock): modified to return only user time
3631 * IPython/genutils.py (clock): modified to return only user time
3630 (not counting system time), after a discussion on scipy. While
3632 (not counting system time), after a discussion on scipy. While
3631 system time may be a useful quantity occasionally, it may much
3633 system time may be a useful quantity occasionally, it may much
3632 more easily be skewed by occasional swapping or other similar
3634 more easily be skewed by occasional swapping or other similar
3633 activity.
3635 activity.
3634
3636
3635 2003-06-05 Fernando Perez <fperez@colorado.edu>
3637 2003-06-05 Fernando Perez <fperez@colorado.edu>
3636
3638
3637 * IPython/numutils.py (identity): new function, for building
3639 * IPython/numutils.py (identity): new function, for building
3638 arbitrary rank Kronecker deltas (mostly backwards compatible with
3640 arbitrary rank Kronecker deltas (mostly backwards compatible with
3639 Numeric.identity)
3641 Numeric.identity)
3640
3642
3641 2003-06-03 Fernando Perez <fperez@colorado.edu>
3643 2003-06-03 Fernando Perez <fperez@colorado.edu>
3642
3644
3643 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3645 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3644 arguments passed to magics with spaces, to allow trailing '\' to
3646 arguments passed to magics with spaces, to allow trailing '\' to
3645 work normally (mainly for Windows users).
3647 work normally (mainly for Windows users).
3646
3648
3647 2003-05-29 Fernando Perez <fperez@colorado.edu>
3649 2003-05-29 Fernando Perez <fperez@colorado.edu>
3648
3650
3649 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3651 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3650 instead of pydoc.help. This fixes a bizarre behavior where
3652 instead of pydoc.help. This fixes a bizarre behavior where
3651 printing '%s' % locals() would trigger the help system. Now
3653 printing '%s' % locals() would trigger the help system. Now
3652 ipython behaves like normal python does.
3654 ipython behaves like normal python does.
3653
3655
3654 Note that if one does 'from pydoc import help', the bizarre
3656 Note that if one does 'from pydoc import help', the bizarre
3655 behavior returns, but this will also happen in normal python, so
3657 behavior returns, but this will also happen in normal python, so
3656 it's not an ipython bug anymore (it has to do with how pydoc.help
3658 it's not an ipython bug anymore (it has to do with how pydoc.help
3657 is implemented).
3659 is implemented).
3658
3660
3659 2003-05-22 Fernando Perez <fperez@colorado.edu>
3661 2003-05-22 Fernando Perez <fperez@colorado.edu>
3660
3662
3661 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3663 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3662 return [] instead of None when nothing matches, also match to end
3664 return [] instead of None when nothing matches, also match to end
3663 of line. Patch by Gary Bishop.
3665 of line. Patch by Gary Bishop.
3664
3666
3665 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3667 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3666 protection as before, for files passed on the command line. This
3668 protection as before, for files passed on the command line. This
3667 prevents the CrashHandler from kicking in if user files call into
3669 prevents the CrashHandler from kicking in if user files call into
3668 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3670 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3669 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3671 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3670
3672
3671 2003-05-20 *** Released version 0.4.0
3673 2003-05-20 *** Released version 0.4.0
3672
3674
3673 2003-05-20 Fernando Perez <fperez@colorado.edu>
3675 2003-05-20 Fernando Perez <fperez@colorado.edu>
3674
3676
3675 * setup.py: added support for manpages. It's a bit hackish b/c of
3677 * setup.py: added support for manpages. It's a bit hackish b/c of
3676 a bug in the way the bdist_rpm distutils target handles gzipped
3678 a bug in the way the bdist_rpm distutils target handles gzipped
3677 manpages, but it works. After a patch by Jack.
3679 manpages, but it works. After a patch by Jack.
3678
3680
3679 2003-05-19 Fernando Perez <fperez@colorado.edu>
3681 2003-05-19 Fernando Perez <fperez@colorado.edu>
3680
3682
3681 * IPython/numutils.py: added a mockup of the kinds module, since
3683 * IPython/numutils.py: added a mockup of the kinds module, since
3682 it was recently removed from Numeric. This way, numutils will
3684 it was recently removed from Numeric. This way, numutils will
3683 work for all users even if they are missing kinds.
3685 work for all users even if they are missing kinds.
3684
3686
3685 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3687 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3686 failure, which can occur with SWIG-wrapped extensions. After a
3688 failure, which can occur with SWIG-wrapped extensions. After a
3687 crash report from Prabhu.
3689 crash report from Prabhu.
3688
3690
3689 2003-05-16 Fernando Perez <fperez@colorado.edu>
3691 2003-05-16 Fernando Perez <fperez@colorado.edu>
3690
3692
3691 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3693 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3692 protect ipython from user code which may call directly
3694 protect ipython from user code which may call directly
3693 sys.excepthook (this looks like an ipython crash to the user, even
3695 sys.excepthook (this looks like an ipython crash to the user, even
3694 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3696 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3695 This is especially important to help users of WxWindows, but may
3697 This is especially important to help users of WxWindows, but may
3696 also be useful in other cases.
3698 also be useful in other cases.
3697
3699
3698 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3700 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3699 an optional tb_offset to be specified, and to preserve exception
3701 an optional tb_offset to be specified, and to preserve exception
3700 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3702 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3701
3703
3702 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3704 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3703
3705
3704 2003-05-15 Fernando Perez <fperez@colorado.edu>
3706 2003-05-15 Fernando Perez <fperez@colorado.edu>
3705
3707
3706 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3708 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3707 installing for a new user under Windows.
3709 installing for a new user under Windows.
3708
3710
3709 2003-05-12 Fernando Perez <fperez@colorado.edu>
3711 2003-05-12 Fernando Perez <fperez@colorado.edu>
3710
3712
3711 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3713 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3712 handler for Emacs comint-based lines. Currently it doesn't do
3714 handler for Emacs comint-based lines. Currently it doesn't do
3713 much (but importantly, it doesn't update the history cache). In
3715 much (but importantly, it doesn't update the history cache). In
3714 the future it may be expanded if Alex needs more functionality
3716 the future it may be expanded if Alex needs more functionality
3715 there.
3717 there.
3716
3718
3717 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3719 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3718 info to crash reports.
3720 info to crash reports.
3719
3721
3720 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3722 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3721 just like Python's -c. Also fixed crash with invalid -color
3723 just like Python's -c. Also fixed crash with invalid -color
3722 option value at startup. Thanks to Will French
3724 option value at startup. Thanks to Will French
3723 <wfrench-AT-bestweb.net> for the bug report.
3725 <wfrench-AT-bestweb.net> for the bug report.
3724
3726
3725 2003-05-09 Fernando Perez <fperez@colorado.edu>
3727 2003-05-09 Fernando Perez <fperez@colorado.edu>
3726
3728
3727 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3729 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3728 to EvalDict (it's a mapping, after all) and simplified its code
3730 to EvalDict (it's a mapping, after all) and simplified its code
3729 quite a bit, after a nice discussion on c.l.py where Gustavo
3731 quite a bit, after a nice discussion on c.l.py where Gustavo
3730 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3732 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3731
3733
3732 2003-04-30 Fernando Perez <fperez@colorado.edu>
3734 2003-04-30 Fernando Perez <fperez@colorado.edu>
3733
3735
3734 * IPython/genutils.py (timings_out): modified it to reduce its
3736 * IPython/genutils.py (timings_out): modified it to reduce its
3735 overhead in the common reps==1 case.
3737 overhead in the common reps==1 case.
3736
3738
3737 2003-04-29 Fernando Perez <fperez@colorado.edu>
3739 2003-04-29 Fernando Perez <fperez@colorado.edu>
3738
3740
3739 * IPython/genutils.py (timings_out): Modified to use the resource
3741 * IPython/genutils.py (timings_out): Modified to use the resource
3740 module, which avoids the wraparound problems of time.clock().
3742 module, which avoids the wraparound problems of time.clock().
3741
3743
3742 2003-04-17 *** Released version 0.2.15pre4
3744 2003-04-17 *** Released version 0.2.15pre4
3743
3745
3744 2003-04-17 Fernando Perez <fperez@colorado.edu>
3746 2003-04-17 Fernando Perez <fperez@colorado.edu>
3745
3747
3746 * setup.py (scriptfiles): Split windows-specific stuff over to a
3748 * setup.py (scriptfiles): Split windows-specific stuff over to a
3747 separate file, in an attempt to have a Windows GUI installer.
3749 separate file, in an attempt to have a Windows GUI installer.
3748 That didn't work, but part of the groundwork is done.
3750 That didn't work, but part of the groundwork is done.
3749
3751
3750 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3752 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3751 indent/unindent with 4 spaces. Particularly useful in combination
3753 indent/unindent with 4 spaces. Particularly useful in combination
3752 with the new auto-indent option.
3754 with the new auto-indent option.
3753
3755
3754 2003-04-16 Fernando Perez <fperez@colorado.edu>
3756 2003-04-16 Fernando Perez <fperez@colorado.edu>
3755
3757
3756 * IPython/Magic.py: various replacements of self.rc for
3758 * IPython/Magic.py: various replacements of self.rc for
3757 self.shell.rc. A lot more remains to be done to fully disentangle
3759 self.shell.rc. A lot more remains to be done to fully disentangle
3758 this class from the main Shell class.
3760 this class from the main Shell class.
3759
3761
3760 * IPython/GnuplotRuntime.py: added checks for mouse support so
3762 * IPython/GnuplotRuntime.py: added checks for mouse support so
3761 that we don't try to enable it if the current gnuplot doesn't
3763 that we don't try to enable it if the current gnuplot doesn't
3762 really support it. Also added checks so that we don't try to
3764 really support it. Also added checks so that we don't try to
3763 enable persist under Windows (where Gnuplot doesn't recognize the
3765 enable persist under Windows (where Gnuplot doesn't recognize the
3764 option).
3766 option).
3765
3767
3766 * IPython/iplib.py (InteractiveShell.interact): Added optional
3768 * IPython/iplib.py (InteractiveShell.interact): Added optional
3767 auto-indenting code, after a patch by King C. Shu
3769 auto-indenting code, after a patch by King C. Shu
3768 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3770 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3769 get along well with pasting indented code. If I ever figure out
3771 get along well with pasting indented code. If I ever figure out
3770 how to make that part go well, it will become on by default.
3772 how to make that part go well, it will become on by default.
3771
3773
3772 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3774 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3773 crash ipython if there was an unmatched '%' in the user's prompt
3775 crash ipython if there was an unmatched '%' in the user's prompt
3774 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3776 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3775
3777
3776 * IPython/iplib.py (InteractiveShell.interact): removed the
3778 * IPython/iplib.py (InteractiveShell.interact): removed the
3777 ability to ask the user whether he wants to crash or not at the
3779 ability to ask the user whether he wants to crash or not at the
3778 'last line' exception handler. Calling functions at that point
3780 'last line' exception handler. Calling functions at that point
3779 changes the stack, and the error reports would have incorrect
3781 changes the stack, and the error reports would have incorrect
3780 tracebacks.
3782 tracebacks.
3781
3783
3782 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3784 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3783 pass through a peger a pretty-printed form of any object. After a
3785 pass through a peger a pretty-printed form of any object. After a
3784 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3786 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3785
3787
3786 2003-04-14 Fernando Perez <fperez@colorado.edu>
3788 2003-04-14 Fernando Perez <fperez@colorado.edu>
3787
3789
3788 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3790 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3789 all files in ~ would be modified at first install (instead of
3791 all files in ~ would be modified at first install (instead of
3790 ~/.ipython). This could be potentially disastrous, as the
3792 ~/.ipython). This could be potentially disastrous, as the
3791 modification (make line-endings native) could damage binary files.
3793 modification (make line-endings native) could damage binary files.
3792
3794
3793 2003-04-10 Fernando Perez <fperez@colorado.edu>
3795 2003-04-10 Fernando Perez <fperez@colorado.edu>
3794
3796
3795 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3797 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3796 handle only lines which are invalid python. This now means that
3798 handle only lines which are invalid python. This now means that
3797 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3799 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3798 for the bug report.
3800 for the bug report.
3799
3801
3800 2003-04-01 Fernando Perez <fperez@colorado.edu>
3802 2003-04-01 Fernando Perez <fperez@colorado.edu>
3801
3803
3802 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3804 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3803 where failing to set sys.last_traceback would crash pdb.pm().
3805 where failing to set sys.last_traceback would crash pdb.pm().
3804 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3806 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3805 report.
3807 report.
3806
3808
3807 2003-03-25 Fernando Perez <fperez@colorado.edu>
3809 2003-03-25 Fernando Perez <fperez@colorado.edu>
3808
3810
3809 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3811 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3810 before printing it (it had a lot of spurious blank lines at the
3812 before printing it (it had a lot of spurious blank lines at the
3811 end).
3813 end).
3812
3814
3813 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3815 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3814 output would be sent 21 times! Obviously people don't use this
3816 output would be sent 21 times! Obviously people don't use this
3815 too often, or I would have heard about it.
3817 too often, or I would have heard about it.
3816
3818
3817 2003-03-24 Fernando Perez <fperez@colorado.edu>
3819 2003-03-24 Fernando Perez <fperez@colorado.edu>
3818
3820
3819 * setup.py (scriptfiles): renamed the data_files parameter from
3821 * setup.py (scriptfiles): renamed the data_files parameter from
3820 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3822 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3821 for the patch.
3823 for the patch.
3822
3824
3823 2003-03-20 Fernando Perez <fperez@colorado.edu>
3825 2003-03-20 Fernando Perez <fperez@colorado.edu>
3824
3826
3825 * IPython/genutils.py (error): added error() and fatal()
3827 * IPython/genutils.py (error): added error() and fatal()
3826 functions.
3828 functions.
3827
3829
3828 2003-03-18 *** Released version 0.2.15pre3
3830 2003-03-18 *** Released version 0.2.15pre3
3829
3831
3830 2003-03-18 Fernando Perez <fperez@colorado.edu>
3832 2003-03-18 Fernando Perez <fperez@colorado.edu>
3831
3833
3832 * setupext/install_data_ext.py
3834 * setupext/install_data_ext.py
3833 (install_data_ext.initialize_options): Class contributed by Jack
3835 (install_data_ext.initialize_options): Class contributed by Jack
3834 Moffit for fixing the old distutils hack. He is sending this to
3836 Moffit for fixing the old distutils hack. He is sending this to
3835 the distutils folks so in the future we may not need it as a
3837 the distutils folks so in the future we may not need it as a
3836 private fix.
3838 private fix.
3837
3839
3838 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3840 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3839 changes for Debian packaging. See his patch for full details.
3841 changes for Debian packaging. See his patch for full details.
3840 The old distutils hack of making the ipythonrc* files carry a
3842 The old distutils hack of making the ipythonrc* files carry a
3841 bogus .py extension is gone, at last. Examples were moved to a
3843 bogus .py extension is gone, at last. Examples were moved to a
3842 separate subdir under doc/, and the separate executable scripts
3844 separate subdir under doc/, and the separate executable scripts
3843 now live in their own directory. Overall a great cleanup. The
3845 now live in their own directory. Overall a great cleanup. The
3844 manual was updated to use the new files, and setup.py has been
3846 manual was updated to use the new files, and setup.py has been
3845 fixed for this setup.
3847 fixed for this setup.
3846
3848
3847 * IPython/PyColorize.py (Parser.usage): made non-executable and
3849 * IPython/PyColorize.py (Parser.usage): made non-executable and
3848 created a pycolor wrapper around it to be included as a script.
3850 created a pycolor wrapper around it to be included as a script.
3849
3851
3850 2003-03-12 *** Released version 0.2.15pre2
3852 2003-03-12 *** Released version 0.2.15pre2
3851
3853
3852 2003-03-12 Fernando Perez <fperez@colorado.edu>
3854 2003-03-12 Fernando Perez <fperez@colorado.edu>
3853
3855
3854 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3856 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3855 long-standing problem with garbage characters in some terminals.
3857 long-standing problem with garbage characters in some terminals.
3856 The issue was really that the \001 and \002 escapes must _only_ be
3858 The issue was really that the \001 and \002 escapes must _only_ be
3857 passed to input prompts (which call readline), but _never_ to
3859 passed to input prompts (which call readline), but _never_ to
3858 normal text to be printed on screen. I changed ColorANSI to have
3860 normal text to be printed on screen. I changed ColorANSI to have
3859 two classes: TermColors and InputTermColors, each with the
3861 two classes: TermColors and InputTermColors, each with the
3860 appropriate escapes for input prompts or normal text. The code in
3862 appropriate escapes for input prompts or normal text. The code in
3861 Prompts.py got slightly more complicated, but this very old and
3863 Prompts.py got slightly more complicated, but this very old and
3862 annoying bug is finally fixed.
3864 annoying bug is finally fixed.
3863
3865
3864 All the credit for nailing down the real origin of this problem
3866 All the credit for nailing down the real origin of this problem
3865 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3867 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3866 *Many* thanks to him for spending quite a bit of effort on this.
3868 *Many* thanks to him for spending quite a bit of effort on this.
3867
3869
3868 2003-03-05 *** Released version 0.2.15pre1
3870 2003-03-05 *** Released version 0.2.15pre1
3869
3871
3870 2003-03-03 Fernando Perez <fperez@colorado.edu>
3872 2003-03-03 Fernando Perez <fperez@colorado.edu>
3871
3873
3872 * IPython/FakeModule.py: Moved the former _FakeModule to a
3874 * IPython/FakeModule.py: Moved the former _FakeModule to a
3873 separate file, because it's also needed by Magic (to fix a similar
3875 separate file, because it's also needed by Magic (to fix a similar
3874 pickle-related issue in @run).
3876 pickle-related issue in @run).
3875
3877
3876 2003-03-02 Fernando Perez <fperez@colorado.edu>
3878 2003-03-02 Fernando Perez <fperez@colorado.edu>
3877
3879
3878 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3880 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3879 the autocall option at runtime.
3881 the autocall option at runtime.
3880 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3882 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3881 across Magic.py to start separating Magic from InteractiveShell.
3883 across Magic.py to start separating Magic from InteractiveShell.
3882 (Magic._ofind): Fixed to return proper namespace for dotted
3884 (Magic._ofind): Fixed to return proper namespace for dotted
3883 names. Before, a dotted name would always return 'not currently
3885 names. Before, a dotted name would always return 'not currently
3884 defined', because it would find the 'parent'. s.x would be found,
3886 defined', because it would find the 'parent'. s.x would be found,
3885 but since 'x' isn't defined by itself, it would get confused.
3887 but since 'x' isn't defined by itself, it would get confused.
3886 (Magic.magic_run): Fixed pickling problems reported by Ralf
3888 (Magic.magic_run): Fixed pickling problems reported by Ralf
3887 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3889 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3888 that I'd used when Mike Heeter reported similar issues at the
3890 that I'd used when Mike Heeter reported similar issues at the
3889 top-level, but now for @run. It boils down to injecting the
3891 top-level, but now for @run. It boils down to injecting the
3890 namespace where code is being executed with something that looks
3892 namespace where code is being executed with something that looks
3891 enough like a module to fool pickle.dump(). Since a pickle stores
3893 enough like a module to fool pickle.dump(). Since a pickle stores
3892 a named reference to the importing module, we need this for
3894 a named reference to the importing module, we need this for
3893 pickles to save something sensible.
3895 pickles to save something sensible.
3894
3896
3895 * IPython/ipmaker.py (make_IPython): added an autocall option.
3897 * IPython/ipmaker.py (make_IPython): added an autocall option.
3896
3898
3897 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3899 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3898 the auto-eval code. Now autocalling is an option, and the code is
3900 the auto-eval code. Now autocalling is an option, and the code is
3899 also vastly safer. There is no more eval() involved at all.
3901 also vastly safer. There is no more eval() involved at all.
3900
3902
3901 2003-03-01 Fernando Perez <fperez@colorado.edu>
3903 2003-03-01 Fernando Perez <fperez@colorado.edu>
3902
3904
3903 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3905 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3904 dict with named keys instead of a tuple.
3906 dict with named keys instead of a tuple.
3905
3907
3906 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3908 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3907
3909
3908 * setup.py (make_shortcut): Fixed message about directories
3910 * setup.py (make_shortcut): Fixed message about directories
3909 created during Windows installation (the directories were ok, just
3911 created during Windows installation (the directories were ok, just
3910 the printed message was misleading). Thanks to Chris Liechti
3912 the printed message was misleading). Thanks to Chris Liechti
3911 <cliechti-AT-gmx.net> for the heads up.
3913 <cliechti-AT-gmx.net> for the heads up.
3912
3914
3913 2003-02-21 Fernando Perez <fperez@colorado.edu>
3915 2003-02-21 Fernando Perez <fperez@colorado.edu>
3914
3916
3915 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3917 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3916 of ValueError exception when checking for auto-execution. This
3918 of ValueError exception when checking for auto-execution. This
3917 one is raised by things like Numeric arrays arr.flat when the
3919 one is raised by things like Numeric arrays arr.flat when the
3918 array is non-contiguous.
3920 array is non-contiguous.
3919
3921
3920 2003-01-31 Fernando Perez <fperez@colorado.edu>
3922 2003-01-31 Fernando Perez <fperez@colorado.edu>
3921
3923
3922 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3924 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3923 not return any value at all (even though the command would get
3925 not return any value at all (even though the command would get
3924 executed).
3926 executed).
3925 (xsys): Flush stdout right after printing the command to ensure
3927 (xsys): Flush stdout right after printing the command to ensure
3926 proper ordering of commands and command output in the total
3928 proper ordering of commands and command output in the total
3927 output.
3929 output.
3928 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3930 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3929 system/getoutput as defaults. The old ones are kept for
3931 system/getoutput as defaults. The old ones are kept for
3930 compatibility reasons, so no code which uses this library needs
3932 compatibility reasons, so no code which uses this library needs
3931 changing.
3933 changing.
3932
3934
3933 2003-01-27 *** Released version 0.2.14
3935 2003-01-27 *** Released version 0.2.14
3934
3936
3935 2003-01-25 Fernando Perez <fperez@colorado.edu>
3937 2003-01-25 Fernando Perez <fperez@colorado.edu>
3936
3938
3937 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3939 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3938 functions defined in previous edit sessions could not be re-edited
3940 functions defined in previous edit sessions could not be re-edited
3939 (because the temp files were immediately removed). Now temp files
3941 (because the temp files were immediately removed). Now temp files
3940 are removed only at IPython's exit.
3942 are removed only at IPython's exit.
3941 (Magic.magic_run): Improved @run to perform shell-like expansions
3943 (Magic.magic_run): Improved @run to perform shell-like expansions
3942 on its arguments (~users and $VARS). With this, @run becomes more
3944 on its arguments (~users and $VARS). With this, @run becomes more
3943 like a normal command-line.
3945 like a normal command-line.
3944
3946
3945 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3947 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3946 bugs related to embedding and cleaned up that code. A fairly
3948 bugs related to embedding and cleaned up that code. A fairly
3947 important one was the impossibility to access the global namespace
3949 important one was the impossibility to access the global namespace
3948 through the embedded IPython (only local variables were visible).
3950 through the embedded IPython (only local variables were visible).
3949
3951
3950 2003-01-14 Fernando Perez <fperez@colorado.edu>
3952 2003-01-14 Fernando Perez <fperez@colorado.edu>
3951
3953
3952 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3954 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3953 auto-calling to be a bit more conservative. Now it doesn't get
3955 auto-calling to be a bit more conservative. Now it doesn't get
3954 triggered if any of '!=()<>' are in the rest of the input line, to
3956 triggered if any of '!=()<>' are in the rest of the input line, to
3955 allow comparing callables. Thanks to Alex for the heads up.
3957 allow comparing callables. Thanks to Alex for the heads up.
3956
3958
3957 2003-01-07 Fernando Perez <fperez@colorado.edu>
3959 2003-01-07 Fernando Perez <fperez@colorado.edu>
3958
3960
3959 * IPython/genutils.py (page): fixed estimation of the number of
3961 * IPython/genutils.py (page): fixed estimation of the number of
3960 lines in a string to be paged to simply count newlines. This
3962 lines in a string to be paged to simply count newlines. This
3961 prevents over-guessing due to embedded escape sequences. A better
3963 prevents over-guessing due to embedded escape sequences. A better
3962 long-term solution would involve stripping out the control chars
3964 long-term solution would involve stripping out the control chars
3963 for the count, but it's potentially so expensive I just don't
3965 for the count, but it's potentially so expensive I just don't
3964 think it's worth doing.
3966 think it's worth doing.
3965
3967
3966 2002-12-19 *** Released version 0.2.14pre50
3968 2002-12-19 *** Released version 0.2.14pre50
3967
3969
3968 2002-12-19 Fernando Perez <fperez@colorado.edu>
3970 2002-12-19 Fernando Perez <fperez@colorado.edu>
3969
3971
3970 * tools/release (version): Changed release scripts to inform
3972 * tools/release (version): Changed release scripts to inform
3971 Andrea and build a NEWS file with a list of recent changes.
3973 Andrea and build a NEWS file with a list of recent changes.
3972
3974
3973 * IPython/ColorANSI.py (__all__): changed terminal detection
3975 * IPython/ColorANSI.py (__all__): changed terminal detection
3974 code. Seems to work better for xterms without breaking
3976 code. Seems to work better for xterms without breaking
3975 konsole. Will need more testing to determine if WinXP and Mac OSX
3977 konsole. Will need more testing to determine if WinXP and Mac OSX
3976 also work ok.
3978 also work ok.
3977
3979
3978 2002-12-18 *** Released version 0.2.14pre49
3980 2002-12-18 *** Released version 0.2.14pre49
3979
3981
3980 2002-12-18 Fernando Perez <fperez@colorado.edu>
3982 2002-12-18 Fernando Perez <fperez@colorado.edu>
3981
3983
3982 * Docs: added new info about Mac OSX, from Andrea.
3984 * Docs: added new info about Mac OSX, from Andrea.
3983
3985
3984 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3986 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3985 allow direct plotting of python strings whose format is the same
3987 allow direct plotting of python strings whose format is the same
3986 of gnuplot data files.
3988 of gnuplot data files.
3987
3989
3988 2002-12-16 Fernando Perez <fperez@colorado.edu>
3990 2002-12-16 Fernando Perez <fperez@colorado.edu>
3989
3991
3990 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3992 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3991 value of exit question to be acknowledged.
3993 value of exit question to be acknowledged.
3992
3994
3993 2002-12-03 Fernando Perez <fperez@colorado.edu>
3995 2002-12-03 Fernando Perez <fperez@colorado.edu>
3994
3996
3995 * IPython/ipmaker.py: removed generators, which had been added
3997 * IPython/ipmaker.py: removed generators, which had been added
3996 by mistake in an earlier debugging run. This was causing trouble
3998 by mistake in an earlier debugging run. This was causing trouble
3997 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3999 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3998 for pointing this out.
4000 for pointing this out.
3999
4001
4000 2002-11-17 Fernando Perez <fperez@colorado.edu>
4002 2002-11-17 Fernando Perez <fperez@colorado.edu>
4001
4003
4002 * Manual: updated the Gnuplot section.
4004 * Manual: updated the Gnuplot section.
4003
4005
4004 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4006 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4005 a much better split of what goes in Runtime and what goes in
4007 a much better split of what goes in Runtime and what goes in
4006 Interactive.
4008 Interactive.
4007
4009
4008 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4010 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4009 being imported from iplib.
4011 being imported from iplib.
4010
4012
4011 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4013 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4012 for command-passing. Now the global Gnuplot instance is called
4014 for command-passing. Now the global Gnuplot instance is called
4013 'gp' instead of 'g', which was really a far too fragile and
4015 'gp' instead of 'g', which was really a far too fragile and
4014 common name.
4016 common name.
4015
4017
4016 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4018 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4017 bounding boxes generated by Gnuplot for square plots.
4019 bounding boxes generated by Gnuplot for square plots.
4018
4020
4019 * IPython/genutils.py (popkey): new function added. I should
4021 * IPython/genutils.py (popkey): new function added. I should
4020 suggest this on c.l.py as a dict method, it seems useful.
4022 suggest this on c.l.py as a dict method, it seems useful.
4021
4023
4022 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4024 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4023 to transparently handle PostScript generation. MUCH better than
4025 to transparently handle PostScript generation. MUCH better than
4024 the previous plot_eps/replot_eps (which I removed now). The code
4026 the previous plot_eps/replot_eps (which I removed now). The code
4025 is also fairly clean and well documented now (including
4027 is also fairly clean and well documented now (including
4026 docstrings).
4028 docstrings).
4027
4029
4028 2002-11-13 Fernando Perez <fperez@colorado.edu>
4030 2002-11-13 Fernando Perez <fperez@colorado.edu>
4029
4031
4030 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4032 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4031 (inconsistent with options).
4033 (inconsistent with options).
4032
4034
4033 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4035 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4034 manually disabled, I don't know why. Fixed it.
4036 manually disabled, I don't know why. Fixed it.
4035 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4037 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4036 eps output.
4038 eps output.
4037
4039
4038 2002-11-12 Fernando Perez <fperez@colorado.edu>
4040 2002-11-12 Fernando Perez <fperez@colorado.edu>
4039
4041
4040 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4042 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4041 don't propagate up to caller. Fixes crash reported by François
4043 don't propagate up to caller. Fixes crash reported by François
4042 Pinard.
4044 Pinard.
4043
4045
4044 2002-11-09 Fernando Perez <fperez@colorado.edu>
4046 2002-11-09 Fernando Perez <fperez@colorado.edu>
4045
4047
4046 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4048 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4047 history file for new users.
4049 history file for new users.
4048 (make_IPython): fixed bug where initial install would leave the
4050 (make_IPython): fixed bug where initial install would leave the
4049 user running in the .ipython dir.
4051 user running in the .ipython dir.
4050 (make_IPython): fixed bug where config dir .ipython would be
4052 (make_IPython): fixed bug where config dir .ipython would be
4051 created regardless of the given -ipythondir option. Thanks to Cory
4053 created regardless of the given -ipythondir option. Thanks to Cory
4052 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4054 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4053
4055
4054 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4056 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4055 type confirmations. Will need to use it in all of IPython's code
4057 type confirmations. Will need to use it in all of IPython's code
4056 consistently.
4058 consistently.
4057
4059
4058 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4060 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4059 context to print 31 lines instead of the default 5. This will make
4061 context to print 31 lines instead of the default 5. This will make
4060 the crash reports extremely detailed in case the problem is in
4062 the crash reports extremely detailed in case the problem is in
4061 libraries I don't have access to.
4063 libraries I don't have access to.
4062
4064
4063 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4065 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4064 line of defense' code to still crash, but giving users fair
4066 line of defense' code to still crash, but giving users fair
4065 warning. I don't want internal errors to go unreported: if there's
4067 warning. I don't want internal errors to go unreported: if there's
4066 an internal problem, IPython should crash and generate a full
4068 an internal problem, IPython should crash and generate a full
4067 report.
4069 report.
4068
4070
4069 2002-11-08 Fernando Perez <fperez@colorado.edu>
4071 2002-11-08 Fernando Perez <fperez@colorado.edu>
4070
4072
4071 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4073 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4072 otherwise uncaught exceptions which can appear if people set
4074 otherwise uncaught exceptions which can appear if people set
4073 sys.stdout to something badly broken. Thanks to a crash report
4075 sys.stdout to something badly broken. Thanks to a crash report
4074 from henni-AT-mail.brainbot.com.
4076 from henni-AT-mail.brainbot.com.
4075
4077
4076 2002-11-04 Fernando Perez <fperez@colorado.edu>
4078 2002-11-04 Fernando Perez <fperez@colorado.edu>
4077
4079
4078 * IPython/iplib.py (InteractiveShell.interact): added
4080 * IPython/iplib.py (InteractiveShell.interact): added
4079 __IPYTHON__active to the builtins. It's a flag which goes on when
4081 __IPYTHON__active to the builtins. It's a flag which goes on when
4080 the interaction starts and goes off again when it stops. This
4082 the interaction starts and goes off again when it stops. This
4081 allows embedding code to detect being inside IPython. Before this
4083 allows embedding code to detect being inside IPython. Before this
4082 was done via __IPYTHON__, but that only shows that an IPython
4084 was done via __IPYTHON__, but that only shows that an IPython
4083 instance has been created.
4085 instance has been created.
4084
4086
4085 * IPython/Magic.py (Magic.magic_env): I realized that in a
4087 * IPython/Magic.py (Magic.magic_env): I realized that in a
4086 UserDict, instance.data holds the data as a normal dict. So I
4088 UserDict, instance.data holds the data as a normal dict. So I
4087 modified @env to return os.environ.data instead of rebuilding a
4089 modified @env to return os.environ.data instead of rebuilding a
4088 dict by hand.
4090 dict by hand.
4089
4091
4090 2002-11-02 Fernando Perez <fperez@colorado.edu>
4092 2002-11-02 Fernando Perez <fperez@colorado.edu>
4091
4093
4092 * IPython/genutils.py (warn): changed so that level 1 prints no
4094 * IPython/genutils.py (warn): changed so that level 1 prints no
4093 header. Level 2 is now the default (with 'WARNING' header, as
4095 header. Level 2 is now the default (with 'WARNING' header, as
4094 before). I think I tracked all places where changes were needed in
4096 before). I think I tracked all places where changes were needed in
4095 IPython, but outside code using the old level numbering may have
4097 IPython, but outside code using the old level numbering may have
4096 broken.
4098 broken.
4097
4099
4098 * IPython/iplib.py (InteractiveShell.runcode): added this to
4100 * IPython/iplib.py (InteractiveShell.runcode): added this to
4099 handle the tracebacks in SystemExit traps correctly. The previous
4101 handle the tracebacks in SystemExit traps correctly. The previous
4100 code (through interact) was printing more of the stack than
4102 code (through interact) was printing more of the stack than
4101 necessary, showing IPython internal code to the user.
4103 necessary, showing IPython internal code to the user.
4102
4104
4103 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4105 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4104 default. Now that the default at the confirmation prompt is yes,
4106 default. Now that the default at the confirmation prompt is yes,
4105 it's not so intrusive. François' argument that ipython sessions
4107 it's not so intrusive. François' argument that ipython sessions
4106 tend to be complex enough not to lose them from an accidental C-d,
4108 tend to be complex enough not to lose them from an accidental C-d,
4107 is a valid one.
4109 is a valid one.
4108
4110
4109 * IPython/iplib.py (InteractiveShell.interact): added a
4111 * IPython/iplib.py (InteractiveShell.interact): added a
4110 showtraceback() call to the SystemExit trap, and modified the exit
4112 showtraceback() call to the SystemExit trap, and modified the exit
4111 confirmation to have yes as the default.
4113 confirmation to have yes as the default.
4112
4114
4113 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4115 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4114 this file. It's been gone from the code for a long time, this was
4116 this file. It's been gone from the code for a long time, this was
4115 simply leftover junk.
4117 simply leftover junk.
4116
4118
4117 2002-11-01 Fernando Perez <fperez@colorado.edu>
4119 2002-11-01 Fernando Perez <fperez@colorado.edu>
4118
4120
4119 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4121 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4120 added. If set, IPython now traps EOF and asks for
4122 added. If set, IPython now traps EOF and asks for
4121 confirmation. After a request by François Pinard.
4123 confirmation. After a request by François Pinard.
4122
4124
4123 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4125 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4124 of @abort, and with a new (better) mechanism for handling the
4126 of @abort, and with a new (better) mechanism for handling the
4125 exceptions.
4127 exceptions.
4126
4128
4127 2002-10-27 Fernando Perez <fperez@colorado.edu>
4129 2002-10-27 Fernando Perez <fperez@colorado.edu>
4128
4130
4129 * IPython/usage.py (__doc__): updated the --help information and
4131 * IPython/usage.py (__doc__): updated the --help information and
4130 the ipythonrc file to indicate that -log generates
4132 the ipythonrc file to indicate that -log generates
4131 ./ipython.log. Also fixed the corresponding info in @logstart.
4133 ./ipython.log. Also fixed the corresponding info in @logstart.
4132 This and several other fixes in the manuals thanks to reports by
4134 This and several other fixes in the manuals thanks to reports by
4133 François Pinard <pinard-AT-iro.umontreal.ca>.
4135 François Pinard <pinard-AT-iro.umontreal.ca>.
4134
4136
4135 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4137 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4136 refer to @logstart (instead of @log, which doesn't exist).
4138 refer to @logstart (instead of @log, which doesn't exist).
4137
4139
4138 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4140 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4139 AttributeError crash. Thanks to Christopher Armstrong
4141 AttributeError crash. Thanks to Christopher Armstrong
4140 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4142 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4141 introduced recently (in 0.2.14pre37) with the fix to the eval
4143 introduced recently (in 0.2.14pre37) with the fix to the eval
4142 problem mentioned below.
4144 problem mentioned below.
4143
4145
4144 2002-10-17 Fernando Perez <fperez@colorado.edu>
4146 2002-10-17 Fernando Perez <fperez@colorado.edu>
4145
4147
4146 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4148 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4147 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4149 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4148
4150
4149 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4151 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4150 this function to fix a problem reported by Alex Schmolck. He saw
4152 this function to fix a problem reported by Alex Schmolck. He saw
4151 it with list comprehensions and generators, which were getting
4153 it with list comprehensions and generators, which were getting
4152 called twice. The real problem was an 'eval' call in testing for
4154 called twice. The real problem was an 'eval' call in testing for
4153 automagic which was evaluating the input line silently.
4155 automagic which was evaluating the input line silently.
4154
4156
4155 This is a potentially very nasty bug, if the input has side
4157 This is a potentially very nasty bug, if the input has side
4156 effects which must not be repeated. The code is much cleaner now,
4158 effects which must not be repeated. The code is much cleaner now,
4157 without any blanket 'except' left and with a regexp test for
4159 without any blanket 'except' left and with a regexp test for
4158 actual function names.
4160 actual function names.
4159
4161
4160 But an eval remains, which I'm not fully comfortable with. I just
4162 But an eval remains, which I'm not fully comfortable with. I just
4161 don't know how to find out if an expression could be a callable in
4163 don't know how to find out if an expression could be a callable in
4162 the user's namespace without doing an eval on the string. However
4164 the user's namespace without doing an eval on the string. However
4163 that string is now much more strictly checked so that no code
4165 that string is now much more strictly checked so that no code
4164 slips by, so the eval should only happen for things that can
4166 slips by, so the eval should only happen for things that can
4165 really be only function/method names.
4167 really be only function/method names.
4166
4168
4167 2002-10-15 Fernando Perez <fperez@colorado.edu>
4169 2002-10-15 Fernando Perez <fperez@colorado.edu>
4168
4170
4169 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4171 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4170 OSX information to main manual, removed README_Mac_OSX file from
4172 OSX information to main manual, removed README_Mac_OSX file from
4171 distribution. Also updated credits for recent additions.
4173 distribution. Also updated credits for recent additions.
4172
4174
4173 2002-10-10 Fernando Perez <fperez@colorado.edu>
4175 2002-10-10 Fernando Perez <fperez@colorado.edu>
4174
4176
4175 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4177 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4176 terminal-related issues. Many thanks to Andrea Riciputi
4178 terminal-related issues. Many thanks to Andrea Riciputi
4177 <andrea.riciputi-AT-libero.it> for writing it.
4179 <andrea.riciputi-AT-libero.it> for writing it.
4178
4180
4179 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4181 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4180 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4182 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4181
4183
4182 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4184 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4183 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4185 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4184 <syver-en-AT-online.no> who both submitted patches for this problem.
4186 <syver-en-AT-online.no> who both submitted patches for this problem.
4185
4187
4186 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4188 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4187 global embedding to make sure that things don't overwrite user
4189 global embedding to make sure that things don't overwrite user
4188 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4190 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4189
4191
4190 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4192 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4191 compatibility. Thanks to Hayden Callow
4193 compatibility. Thanks to Hayden Callow
4192 <h.callow-AT-elec.canterbury.ac.nz>
4194 <h.callow-AT-elec.canterbury.ac.nz>
4193
4195
4194 2002-10-04 Fernando Perez <fperez@colorado.edu>
4196 2002-10-04 Fernando Perez <fperez@colorado.edu>
4195
4197
4196 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4198 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4197 Gnuplot.File objects.
4199 Gnuplot.File objects.
4198
4200
4199 2002-07-23 Fernando Perez <fperez@colorado.edu>
4201 2002-07-23 Fernando Perez <fperez@colorado.edu>
4200
4202
4201 * IPython/genutils.py (timing): Added timings() and timing() for
4203 * IPython/genutils.py (timing): Added timings() and timing() for
4202 quick access to the most commonly needed data, the execution
4204 quick access to the most commonly needed data, the execution
4203 times. Old timing() renamed to timings_out().
4205 times. Old timing() renamed to timings_out().
4204
4206
4205 2002-07-18 Fernando Perez <fperez@colorado.edu>
4207 2002-07-18 Fernando Perez <fperez@colorado.edu>
4206
4208
4207 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4209 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4208 bug with nested instances disrupting the parent's tab completion.
4210 bug with nested instances disrupting the parent's tab completion.
4209
4211
4210 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4212 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4211 all_completions code to begin the emacs integration.
4213 all_completions code to begin the emacs integration.
4212
4214
4213 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4215 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4214 argument to allow titling individual arrays when plotting.
4216 argument to allow titling individual arrays when plotting.
4215
4217
4216 2002-07-15 Fernando Perez <fperez@colorado.edu>
4218 2002-07-15 Fernando Perez <fperez@colorado.edu>
4217
4219
4218 * setup.py (make_shortcut): changed to retrieve the value of
4220 * setup.py (make_shortcut): changed to retrieve the value of
4219 'Program Files' directory from the registry (this value changes in
4221 'Program Files' directory from the registry (this value changes in
4220 non-english versions of Windows). Thanks to Thomas Fanslau
4222 non-english versions of Windows). Thanks to Thomas Fanslau
4221 <tfanslau-AT-gmx.de> for the report.
4223 <tfanslau-AT-gmx.de> for the report.
4222
4224
4223 2002-07-10 Fernando Perez <fperez@colorado.edu>
4225 2002-07-10 Fernando Perez <fperez@colorado.edu>
4224
4226
4225 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4227 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4226 a bug in pdb, which crashes if a line with only whitespace is
4228 a bug in pdb, which crashes if a line with only whitespace is
4227 entered. Bug report submitted to sourceforge.
4229 entered. Bug report submitted to sourceforge.
4228
4230
4229 2002-07-09 Fernando Perez <fperez@colorado.edu>
4231 2002-07-09 Fernando Perez <fperez@colorado.edu>
4230
4232
4231 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4233 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4232 reporting exceptions (it's a bug in inspect.py, I just set a
4234 reporting exceptions (it's a bug in inspect.py, I just set a
4233 workaround).
4235 workaround).
4234
4236
4235 2002-07-08 Fernando Perez <fperez@colorado.edu>
4237 2002-07-08 Fernando Perez <fperez@colorado.edu>
4236
4238
4237 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4239 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4238 __IPYTHON__ in __builtins__ to show up in user_ns.
4240 __IPYTHON__ in __builtins__ to show up in user_ns.
4239
4241
4240 2002-07-03 Fernando Perez <fperez@colorado.edu>
4242 2002-07-03 Fernando Perez <fperez@colorado.edu>
4241
4243
4242 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4244 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4243 name from @gp_set_instance to @gp_set_default.
4245 name from @gp_set_instance to @gp_set_default.
4244
4246
4245 * IPython/ipmaker.py (make_IPython): default editor value set to
4247 * IPython/ipmaker.py (make_IPython): default editor value set to
4246 '0' (a string), to match the rc file. Otherwise will crash when
4248 '0' (a string), to match the rc file. Otherwise will crash when
4247 .strip() is called on it.
4249 .strip() is called on it.
4248
4250
4249
4251
4250 2002-06-28 Fernando Perez <fperez@colorado.edu>
4252 2002-06-28 Fernando Perez <fperez@colorado.edu>
4251
4253
4252 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4254 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4253 of files in current directory when a file is executed via
4255 of files in current directory when a file is executed via
4254 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4256 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4255
4257
4256 * setup.py (manfiles): fix for rpm builds, submitted by RA
4258 * setup.py (manfiles): fix for rpm builds, submitted by RA
4257 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4259 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4258
4260
4259 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4261 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4260 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4262 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4261 string!). A. Schmolck caught this one.
4263 string!). A. Schmolck caught this one.
4262
4264
4263 2002-06-27 Fernando Perez <fperez@colorado.edu>
4265 2002-06-27 Fernando Perez <fperez@colorado.edu>
4264
4266
4265 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4267 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4266 defined files at the cmd line. __name__ wasn't being set to
4268 defined files at the cmd line. __name__ wasn't being set to
4267 __main__.
4269 __main__.
4268
4270
4269 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4271 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4270 regular lists and tuples besides Numeric arrays.
4272 regular lists and tuples besides Numeric arrays.
4271
4273
4272 * IPython/Prompts.py (CachedOutput.__call__): Added output
4274 * IPython/Prompts.py (CachedOutput.__call__): Added output
4273 supression for input ending with ';'. Similar to Mathematica and
4275 supression for input ending with ';'. Similar to Mathematica and
4274 Matlab. The _* vars and Out[] list are still updated, just like
4276 Matlab. The _* vars and Out[] list are still updated, just like
4275 Mathematica behaves.
4277 Mathematica behaves.
4276
4278
4277 2002-06-25 Fernando Perez <fperez@colorado.edu>
4279 2002-06-25 Fernando Perez <fperez@colorado.edu>
4278
4280
4279 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4281 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4280 .ini extensions for profiels under Windows.
4282 .ini extensions for profiels under Windows.
4281
4283
4282 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4284 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4283 string form. Fix contributed by Alexander Schmolck
4285 string form. Fix contributed by Alexander Schmolck
4284 <a.schmolck-AT-gmx.net>
4286 <a.schmolck-AT-gmx.net>
4285
4287
4286 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4288 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4287 pre-configured Gnuplot instance.
4289 pre-configured Gnuplot instance.
4288
4290
4289 2002-06-21 Fernando Perez <fperez@colorado.edu>
4291 2002-06-21 Fernando Perez <fperez@colorado.edu>
4290
4292
4291 * IPython/numutils.py (exp_safe): new function, works around the
4293 * IPython/numutils.py (exp_safe): new function, works around the
4292 underflow problems in Numeric.
4294 underflow problems in Numeric.
4293 (log2): New fn. Safe log in base 2: returns exact integer answer
4295 (log2): New fn. Safe log in base 2: returns exact integer answer
4294 for exact integer powers of 2.
4296 for exact integer powers of 2.
4295
4297
4296 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4298 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4297 properly.
4299 properly.
4298
4300
4299 2002-06-20 Fernando Perez <fperez@colorado.edu>
4301 2002-06-20 Fernando Perez <fperez@colorado.edu>
4300
4302
4301 * IPython/genutils.py (timing): new function like
4303 * IPython/genutils.py (timing): new function like
4302 Mathematica's. Similar to time_test, but returns more info.
4304 Mathematica's. Similar to time_test, but returns more info.
4303
4305
4304 2002-06-18 Fernando Perez <fperez@colorado.edu>
4306 2002-06-18 Fernando Perez <fperez@colorado.edu>
4305
4307
4306 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4308 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4307 according to Mike Heeter's suggestions.
4309 according to Mike Heeter's suggestions.
4308
4310
4309 2002-06-16 Fernando Perez <fperez@colorado.edu>
4311 2002-06-16 Fernando Perez <fperez@colorado.edu>
4310
4312
4311 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4313 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4312 system. GnuplotMagic is gone as a user-directory option. New files
4314 system. GnuplotMagic is gone as a user-directory option. New files
4313 make it easier to use all the gnuplot stuff both from external
4315 make it easier to use all the gnuplot stuff both from external
4314 programs as well as from IPython. Had to rewrite part of
4316 programs as well as from IPython. Had to rewrite part of
4315 hardcopy() b/c of a strange bug: often the ps files simply don't
4317 hardcopy() b/c of a strange bug: often the ps files simply don't
4316 get created, and require a repeat of the command (often several
4318 get created, and require a repeat of the command (often several
4317 times).
4319 times).
4318
4320
4319 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4321 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4320 resolve output channel at call time, so that if sys.stderr has
4322 resolve output channel at call time, so that if sys.stderr has
4321 been redirected by user this gets honored.
4323 been redirected by user this gets honored.
4322
4324
4323 2002-06-13 Fernando Perez <fperez@colorado.edu>
4325 2002-06-13 Fernando Perez <fperez@colorado.edu>
4324
4326
4325 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4327 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4326 IPShell. Kept a copy with the old names to avoid breaking people's
4328 IPShell. Kept a copy with the old names to avoid breaking people's
4327 embedded code.
4329 embedded code.
4328
4330
4329 * IPython/ipython: simplified it to the bare minimum after
4331 * IPython/ipython: simplified it to the bare minimum after
4330 Holger's suggestions. Added info about how to use it in
4332 Holger's suggestions. Added info about how to use it in
4331 PYTHONSTARTUP.
4333 PYTHONSTARTUP.
4332
4334
4333 * IPython/Shell.py (IPythonShell): changed the options passing
4335 * IPython/Shell.py (IPythonShell): changed the options passing
4334 from a string with funky %s replacements to a straight list. Maybe
4336 from a string with funky %s replacements to a straight list. Maybe
4335 a bit more typing, but it follows sys.argv conventions, so there's
4337 a bit more typing, but it follows sys.argv conventions, so there's
4336 less special-casing to remember.
4338 less special-casing to remember.
4337
4339
4338 2002-06-12 Fernando Perez <fperez@colorado.edu>
4340 2002-06-12 Fernando Perez <fperez@colorado.edu>
4339
4341
4340 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4342 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4341 command. Thanks to a suggestion by Mike Heeter.
4343 command. Thanks to a suggestion by Mike Heeter.
4342 (Magic.magic_pfile): added behavior to look at filenames if given
4344 (Magic.magic_pfile): added behavior to look at filenames if given
4343 arg is not a defined object.
4345 arg is not a defined object.
4344 (Magic.magic_save): New @save function to save code snippets. Also
4346 (Magic.magic_save): New @save function to save code snippets. Also
4345 a Mike Heeter idea.
4347 a Mike Heeter idea.
4346
4348
4347 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4349 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4348 plot() and replot(). Much more convenient now, especially for
4350 plot() and replot(). Much more convenient now, especially for
4349 interactive use.
4351 interactive use.
4350
4352
4351 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4353 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4352 filenames.
4354 filenames.
4353
4355
4354 2002-06-02 Fernando Perez <fperez@colorado.edu>
4356 2002-06-02 Fernando Perez <fperez@colorado.edu>
4355
4357
4356 * IPython/Struct.py (Struct.__init__): modified to admit
4358 * IPython/Struct.py (Struct.__init__): modified to admit
4357 initialization via another struct.
4359 initialization via another struct.
4358
4360
4359 * IPython/genutils.py (SystemExec.__init__): New stateful
4361 * IPython/genutils.py (SystemExec.__init__): New stateful
4360 interface to xsys and bq. Useful for writing system scripts.
4362 interface to xsys and bq. Useful for writing system scripts.
4361
4363
4362 2002-05-30 Fernando Perez <fperez@colorado.edu>
4364 2002-05-30 Fernando Perez <fperez@colorado.edu>
4363
4365
4364 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4366 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4365 documents. This will make the user download smaller (it's getting
4367 documents. This will make the user download smaller (it's getting
4366 too big).
4368 too big).
4367
4369
4368 2002-05-29 Fernando Perez <fperez@colorado.edu>
4370 2002-05-29 Fernando Perez <fperez@colorado.edu>
4369
4371
4370 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4372 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4371 fix problems with shelve and pickle. Seems to work, but I don't
4373 fix problems with shelve and pickle. Seems to work, but I don't
4372 know if corner cases break it. Thanks to Mike Heeter
4374 know if corner cases break it. Thanks to Mike Heeter
4373 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4375 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4374
4376
4375 2002-05-24 Fernando Perez <fperez@colorado.edu>
4377 2002-05-24 Fernando Perez <fperez@colorado.edu>
4376
4378
4377 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4379 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4378 macros having broken.
4380 macros having broken.
4379
4381
4380 2002-05-21 Fernando Perez <fperez@colorado.edu>
4382 2002-05-21 Fernando Perez <fperez@colorado.edu>
4381
4383
4382 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4384 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4383 introduced logging bug: all history before logging started was
4385 introduced logging bug: all history before logging started was
4384 being written one character per line! This came from the redesign
4386 being written one character per line! This came from the redesign
4385 of the input history as a special list which slices to strings,
4387 of the input history as a special list which slices to strings,
4386 not to lists.
4388 not to lists.
4387
4389
4388 2002-05-20 Fernando Perez <fperez@colorado.edu>
4390 2002-05-20 Fernando Perez <fperez@colorado.edu>
4389
4391
4390 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4392 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4391 be an attribute of all classes in this module. The design of these
4393 be an attribute of all classes in this module. The design of these
4392 classes needs some serious overhauling.
4394 classes needs some serious overhauling.
4393
4395
4394 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4396 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4395 which was ignoring '_' in option names.
4397 which was ignoring '_' in option names.
4396
4398
4397 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4399 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4398 'Verbose_novars' to 'Context' and made it the new default. It's a
4400 'Verbose_novars' to 'Context' and made it the new default. It's a
4399 bit more readable and also safer than verbose.
4401 bit more readable and also safer than verbose.
4400
4402
4401 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4403 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4402 triple-quoted strings.
4404 triple-quoted strings.
4403
4405
4404 * IPython/OInspect.py (__all__): new module exposing the object
4406 * IPython/OInspect.py (__all__): new module exposing the object
4405 introspection facilities. Now the corresponding magics are dummy
4407 introspection facilities. Now the corresponding magics are dummy
4406 wrappers around this. Having this module will make it much easier
4408 wrappers around this. Having this module will make it much easier
4407 to put these functions into our modified pdb.
4409 to put these functions into our modified pdb.
4408 This new object inspector system uses the new colorizing module,
4410 This new object inspector system uses the new colorizing module,
4409 so source code and other things are nicely syntax highlighted.
4411 so source code and other things are nicely syntax highlighted.
4410
4412
4411 2002-05-18 Fernando Perez <fperez@colorado.edu>
4413 2002-05-18 Fernando Perez <fperez@colorado.edu>
4412
4414
4413 * IPython/ColorANSI.py: Split the coloring tools into a separate
4415 * IPython/ColorANSI.py: Split the coloring tools into a separate
4414 module so I can use them in other code easier (they were part of
4416 module so I can use them in other code easier (they were part of
4415 ultraTB).
4417 ultraTB).
4416
4418
4417 2002-05-17 Fernando Perez <fperez@colorado.edu>
4419 2002-05-17 Fernando Perez <fperez@colorado.edu>
4418
4420
4419 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4421 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4420 fixed it to set the global 'g' also to the called instance, as
4422 fixed it to set the global 'g' also to the called instance, as
4421 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4423 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4422 user's 'g' variables).
4424 user's 'g' variables).
4423
4425
4424 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4426 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4425 global variables (aliases to _ih,_oh) so that users which expect
4427 global variables (aliases to _ih,_oh) so that users which expect
4426 In[5] or Out[7] to work aren't unpleasantly surprised.
4428 In[5] or Out[7] to work aren't unpleasantly surprised.
4427 (InputList.__getslice__): new class to allow executing slices of
4429 (InputList.__getslice__): new class to allow executing slices of
4428 input history directly. Very simple class, complements the use of
4430 input history directly. Very simple class, complements the use of
4429 macros.
4431 macros.
4430
4432
4431 2002-05-16 Fernando Perez <fperez@colorado.edu>
4433 2002-05-16 Fernando Perez <fperez@colorado.edu>
4432
4434
4433 * setup.py (docdirbase): make doc directory be just doc/IPython
4435 * setup.py (docdirbase): make doc directory be just doc/IPython
4434 without version numbers, it will reduce clutter for users.
4436 without version numbers, it will reduce clutter for users.
4435
4437
4436 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4438 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4437 execfile call to prevent possible memory leak. See for details:
4439 execfile call to prevent possible memory leak. See for details:
4438 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4440 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4439
4441
4440 2002-05-15 Fernando Perez <fperez@colorado.edu>
4442 2002-05-15 Fernando Perez <fperez@colorado.edu>
4441
4443
4442 * IPython/Magic.py (Magic.magic_psource): made the object
4444 * IPython/Magic.py (Magic.magic_psource): made the object
4443 introspection names be more standard: pdoc, pdef, pfile and
4445 introspection names be more standard: pdoc, pdef, pfile and
4444 psource. They all print/page their output, and it makes
4446 psource. They all print/page their output, and it makes
4445 remembering them easier. Kept old names for compatibility as
4447 remembering them easier. Kept old names for compatibility as
4446 aliases.
4448 aliases.
4447
4449
4448 2002-05-14 Fernando Perez <fperez@colorado.edu>
4450 2002-05-14 Fernando Perez <fperez@colorado.edu>
4449
4451
4450 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4452 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4451 what the mouse problem was. The trick is to use gnuplot with temp
4453 what the mouse problem was. The trick is to use gnuplot with temp
4452 files and NOT with pipes (for data communication), because having
4454 files and NOT with pipes (for data communication), because having
4453 both pipes and the mouse on is bad news.
4455 both pipes and the mouse on is bad news.
4454
4456
4455 2002-05-13 Fernando Perez <fperez@colorado.edu>
4457 2002-05-13 Fernando Perez <fperez@colorado.edu>
4456
4458
4457 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4459 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4458 bug. Information would be reported about builtins even when
4460 bug. Information would be reported about builtins even when
4459 user-defined functions overrode them.
4461 user-defined functions overrode them.
4460
4462
4461 2002-05-11 Fernando Perez <fperez@colorado.edu>
4463 2002-05-11 Fernando Perez <fperez@colorado.edu>
4462
4464
4463 * IPython/__init__.py (__all__): removed FlexCompleter from
4465 * IPython/__init__.py (__all__): removed FlexCompleter from
4464 __all__ so that things don't fail in platforms without readline.
4466 __all__ so that things don't fail in platforms without readline.
4465
4467
4466 2002-05-10 Fernando Perez <fperez@colorado.edu>
4468 2002-05-10 Fernando Perez <fperez@colorado.edu>
4467
4469
4468 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4470 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4469 it requires Numeric, effectively making Numeric a dependency for
4471 it requires Numeric, effectively making Numeric a dependency for
4470 IPython.
4472 IPython.
4471
4473
4472 * Released 0.2.13
4474 * Released 0.2.13
4473
4475
4474 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4476 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4475 profiler interface. Now all the major options from the profiler
4477 profiler interface. Now all the major options from the profiler
4476 module are directly supported in IPython, both for single
4478 module are directly supported in IPython, both for single
4477 expressions (@prun) and for full programs (@run -p).
4479 expressions (@prun) and for full programs (@run -p).
4478
4480
4479 2002-05-09 Fernando Perez <fperez@colorado.edu>
4481 2002-05-09 Fernando Perez <fperez@colorado.edu>
4480
4482
4481 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4483 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4482 magic properly formatted for screen.
4484 magic properly formatted for screen.
4483
4485
4484 * setup.py (make_shortcut): Changed things to put pdf version in
4486 * setup.py (make_shortcut): Changed things to put pdf version in
4485 doc/ instead of doc/manual (had to change lyxport a bit).
4487 doc/ instead of doc/manual (had to change lyxport a bit).
4486
4488
4487 * IPython/Magic.py (Profile.string_stats): made profile runs go
4489 * IPython/Magic.py (Profile.string_stats): made profile runs go
4488 through pager (they are long and a pager allows searching, saving,
4490 through pager (they are long and a pager allows searching, saving,
4489 etc.)
4491 etc.)
4490
4492
4491 2002-05-08 Fernando Perez <fperez@colorado.edu>
4493 2002-05-08 Fernando Perez <fperez@colorado.edu>
4492
4494
4493 * Released 0.2.12
4495 * Released 0.2.12
4494
4496
4495 2002-05-06 Fernando Perez <fperez@colorado.edu>
4497 2002-05-06 Fernando Perez <fperez@colorado.edu>
4496
4498
4497 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4499 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4498 introduced); 'hist n1 n2' was broken.
4500 introduced); 'hist n1 n2' was broken.
4499 (Magic.magic_pdb): added optional on/off arguments to @pdb
4501 (Magic.magic_pdb): added optional on/off arguments to @pdb
4500 (Magic.magic_run): added option -i to @run, which executes code in
4502 (Magic.magic_run): added option -i to @run, which executes code in
4501 the IPython namespace instead of a clean one. Also added @irun as
4503 the IPython namespace instead of a clean one. Also added @irun as
4502 an alias to @run -i.
4504 an alias to @run -i.
4503
4505
4504 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4506 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4505 fixed (it didn't really do anything, the namespaces were wrong).
4507 fixed (it didn't really do anything, the namespaces were wrong).
4506
4508
4507 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4509 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4508
4510
4509 * IPython/__init__.py (__all__): Fixed package namespace, now
4511 * IPython/__init__.py (__all__): Fixed package namespace, now
4510 'import IPython' does give access to IPython.<all> as
4512 'import IPython' does give access to IPython.<all> as
4511 expected. Also renamed __release__ to Release.
4513 expected. Also renamed __release__ to Release.
4512
4514
4513 * IPython/Debugger.py (__license__): created new Pdb class which
4515 * IPython/Debugger.py (__license__): created new Pdb class which
4514 functions like a drop-in for the normal pdb.Pdb but does NOT
4516 functions like a drop-in for the normal pdb.Pdb but does NOT
4515 import readline by default. This way it doesn't muck up IPython's
4517 import readline by default. This way it doesn't muck up IPython's
4516 readline handling, and now tab-completion finally works in the
4518 readline handling, and now tab-completion finally works in the
4517 debugger -- sort of. It completes things globally visible, but the
4519 debugger -- sort of. It completes things globally visible, but the
4518 completer doesn't track the stack as pdb walks it. That's a bit
4520 completer doesn't track the stack as pdb walks it. That's a bit
4519 tricky, and I'll have to implement it later.
4521 tricky, and I'll have to implement it later.
4520
4522
4521 2002-05-05 Fernando Perez <fperez@colorado.edu>
4523 2002-05-05 Fernando Perez <fperez@colorado.edu>
4522
4524
4523 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4525 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4524 magic docstrings when printed via ? (explicit \'s were being
4526 magic docstrings when printed via ? (explicit \'s were being
4525 printed).
4527 printed).
4526
4528
4527 * IPython/ipmaker.py (make_IPython): fixed namespace
4529 * IPython/ipmaker.py (make_IPython): fixed namespace
4528 identification bug. Now variables loaded via logs or command-line
4530 identification bug. Now variables loaded via logs or command-line
4529 files are recognized in the interactive namespace by @who.
4531 files are recognized in the interactive namespace by @who.
4530
4532
4531 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4533 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4532 log replay system stemming from the string form of Structs.
4534 log replay system stemming from the string form of Structs.
4533
4535
4534 * IPython/Magic.py (Macro.__init__): improved macros to properly
4536 * IPython/Magic.py (Macro.__init__): improved macros to properly
4535 handle magic commands in them.
4537 handle magic commands in them.
4536 (Magic.magic_logstart): usernames are now expanded so 'logstart
4538 (Magic.magic_logstart): usernames are now expanded so 'logstart
4537 ~/mylog' now works.
4539 ~/mylog' now works.
4538
4540
4539 * IPython/iplib.py (complete): fixed bug where paths starting with
4541 * IPython/iplib.py (complete): fixed bug where paths starting with
4540 '/' would be completed as magic names.
4542 '/' would be completed as magic names.
4541
4543
4542 2002-05-04 Fernando Perez <fperez@colorado.edu>
4544 2002-05-04 Fernando Perez <fperez@colorado.edu>
4543
4545
4544 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4546 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4545 allow running full programs under the profiler's control.
4547 allow running full programs under the profiler's control.
4546
4548
4547 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4549 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4548 mode to report exceptions verbosely but without formatting
4550 mode to report exceptions verbosely but without formatting
4549 variables. This addresses the issue of ipython 'freezing' (it's
4551 variables. This addresses the issue of ipython 'freezing' (it's
4550 not frozen, but caught in an expensive formatting loop) when huge
4552 not frozen, but caught in an expensive formatting loop) when huge
4551 variables are in the context of an exception.
4553 variables are in the context of an exception.
4552 (VerboseTB.text): Added '--->' markers at line where exception was
4554 (VerboseTB.text): Added '--->' markers at line where exception was
4553 triggered. Much clearer to read, especially in NoColor modes.
4555 triggered. Much clearer to read, especially in NoColor modes.
4554
4556
4555 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4557 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4556 implemented in reverse when changing to the new parse_options().
4558 implemented in reverse when changing to the new parse_options().
4557
4559
4558 2002-05-03 Fernando Perez <fperez@colorado.edu>
4560 2002-05-03 Fernando Perez <fperez@colorado.edu>
4559
4561
4560 * IPython/Magic.py (Magic.parse_options): new function so that
4562 * IPython/Magic.py (Magic.parse_options): new function so that
4561 magics can parse options easier.
4563 magics can parse options easier.
4562 (Magic.magic_prun): new function similar to profile.run(),
4564 (Magic.magic_prun): new function similar to profile.run(),
4563 suggested by Chris Hart.
4565 suggested by Chris Hart.
4564 (Magic.magic_cd): fixed behavior so that it only changes if
4566 (Magic.magic_cd): fixed behavior so that it only changes if
4565 directory actually is in history.
4567 directory actually is in history.
4566
4568
4567 * IPython/usage.py (__doc__): added information about potential
4569 * IPython/usage.py (__doc__): added information about potential
4568 slowness of Verbose exception mode when there are huge data
4570 slowness of Verbose exception mode when there are huge data
4569 structures to be formatted (thanks to Archie Paulson).
4571 structures to be formatted (thanks to Archie Paulson).
4570
4572
4571 * IPython/ipmaker.py (make_IPython): Changed default logging
4573 * IPython/ipmaker.py (make_IPython): Changed default logging
4572 (when simply called with -log) to use curr_dir/ipython.log in
4574 (when simply called with -log) to use curr_dir/ipython.log in
4573 rotate mode. Fixed crash which was occuring with -log before
4575 rotate mode. Fixed crash which was occuring with -log before
4574 (thanks to Jim Boyle).
4576 (thanks to Jim Boyle).
4575
4577
4576 2002-05-01 Fernando Perez <fperez@colorado.edu>
4578 2002-05-01 Fernando Perez <fperez@colorado.edu>
4577
4579
4578 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4580 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4579 was nasty -- though somewhat of a corner case).
4581 was nasty -- though somewhat of a corner case).
4580
4582
4581 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4583 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4582 text (was a bug).
4584 text (was a bug).
4583
4585
4584 2002-04-30 Fernando Perez <fperez@colorado.edu>
4586 2002-04-30 Fernando Perez <fperez@colorado.edu>
4585
4587
4586 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4588 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4587 a print after ^D or ^C from the user so that the In[] prompt
4589 a print after ^D or ^C from the user so that the In[] prompt
4588 doesn't over-run the gnuplot one.
4590 doesn't over-run the gnuplot one.
4589
4591
4590 2002-04-29 Fernando Perez <fperez@colorado.edu>
4592 2002-04-29 Fernando Perez <fperez@colorado.edu>
4591
4593
4592 * Released 0.2.10
4594 * Released 0.2.10
4593
4595
4594 * IPython/__release__.py (version): get date dynamically.
4596 * IPython/__release__.py (version): get date dynamically.
4595
4597
4596 * Misc. documentation updates thanks to Arnd's comments. Also ran
4598 * Misc. documentation updates thanks to Arnd's comments. Also ran
4597 a full spellcheck on the manual (hadn't been done in a while).
4599 a full spellcheck on the manual (hadn't been done in a while).
4598
4600
4599 2002-04-27 Fernando Perez <fperez@colorado.edu>
4601 2002-04-27 Fernando Perez <fperez@colorado.edu>
4600
4602
4601 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4603 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4602 starting a log in mid-session would reset the input history list.
4604 starting a log in mid-session would reset the input history list.
4603
4605
4604 2002-04-26 Fernando Perez <fperez@colorado.edu>
4606 2002-04-26 Fernando Perez <fperez@colorado.edu>
4605
4607
4606 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4608 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4607 all files were being included in an update. Now anything in
4609 all files were being included in an update. Now anything in
4608 UserConfig that matches [A-Za-z]*.py will go (this excludes
4610 UserConfig that matches [A-Za-z]*.py will go (this excludes
4609 __init__.py)
4611 __init__.py)
4610
4612
4611 2002-04-25 Fernando Perez <fperez@colorado.edu>
4613 2002-04-25 Fernando Perez <fperez@colorado.edu>
4612
4614
4613 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4615 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4614 to __builtins__ so that any form of embedded or imported code can
4616 to __builtins__ so that any form of embedded or imported code can
4615 test for being inside IPython.
4617 test for being inside IPython.
4616
4618
4617 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4619 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4618 changed to GnuplotMagic because it's now an importable module,
4620 changed to GnuplotMagic because it's now an importable module,
4619 this makes the name follow that of the standard Gnuplot module.
4621 this makes the name follow that of the standard Gnuplot module.
4620 GnuplotMagic can now be loaded at any time in mid-session.
4622 GnuplotMagic can now be loaded at any time in mid-session.
4621
4623
4622 2002-04-24 Fernando Perez <fperez@colorado.edu>
4624 2002-04-24 Fernando Perez <fperez@colorado.edu>
4623
4625
4624 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4626 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4625 the globals (IPython has its own namespace) and the
4627 the globals (IPython has its own namespace) and the
4626 PhysicalQuantity stuff is much better anyway.
4628 PhysicalQuantity stuff is much better anyway.
4627
4629
4628 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4630 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4629 embedding example to standard user directory for
4631 embedding example to standard user directory for
4630 distribution. Also put it in the manual.
4632 distribution. Also put it in the manual.
4631
4633
4632 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4634 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4633 instance as first argument (so it doesn't rely on some obscure
4635 instance as first argument (so it doesn't rely on some obscure
4634 hidden global).
4636 hidden global).
4635
4637
4636 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4638 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4637 delimiters. While it prevents ().TAB from working, it allows
4639 delimiters. While it prevents ().TAB from working, it allows
4638 completions in open (... expressions. This is by far a more common
4640 completions in open (... expressions. This is by far a more common
4639 case.
4641 case.
4640
4642
4641 2002-04-23 Fernando Perez <fperez@colorado.edu>
4643 2002-04-23 Fernando Perez <fperez@colorado.edu>
4642
4644
4643 * IPython/Extensions/InterpreterPasteInput.py: new
4645 * IPython/Extensions/InterpreterPasteInput.py: new
4644 syntax-processing module for pasting lines with >>> or ... at the
4646 syntax-processing module for pasting lines with >>> or ... at the
4645 start.
4647 start.
4646
4648
4647 * IPython/Extensions/PhysicalQ_Interactive.py
4649 * IPython/Extensions/PhysicalQ_Interactive.py
4648 (PhysicalQuantityInteractive.__int__): fixed to work with either
4650 (PhysicalQuantityInteractive.__int__): fixed to work with either
4649 Numeric or math.
4651 Numeric or math.
4650
4652
4651 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4653 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4652 provided profiles. Now we have:
4654 provided profiles. Now we have:
4653 -math -> math module as * and cmath with its own namespace.
4655 -math -> math module as * and cmath with its own namespace.
4654 -numeric -> Numeric as *, plus gnuplot & grace
4656 -numeric -> Numeric as *, plus gnuplot & grace
4655 -physics -> same as before
4657 -physics -> same as before
4656
4658
4657 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4659 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4658 user-defined magics wouldn't be found by @magic if they were
4660 user-defined magics wouldn't be found by @magic if they were
4659 defined as class methods. Also cleaned up the namespace search
4661 defined as class methods. Also cleaned up the namespace search
4660 logic and the string building (to use %s instead of many repeated
4662 logic and the string building (to use %s instead of many repeated
4661 string adds).
4663 string adds).
4662
4664
4663 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4665 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4664 of user-defined magics to operate with class methods (cleaner, in
4666 of user-defined magics to operate with class methods (cleaner, in
4665 line with the gnuplot code).
4667 line with the gnuplot code).
4666
4668
4667 2002-04-22 Fernando Perez <fperez@colorado.edu>
4669 2002-04-22 Fernando Perez <fperez@colorado.edu>
4668
4670
4669 * setup.py: updated dependency list so that manual is updated when
4671 * setup.py: updated dependency list so that manual is updated when
4670 all included files change.
4672 all included files change.
4671
4673
4672 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4674 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4673 the delimiter removal option (the fix is ugly right now).
4675 the delimiter removal option (the fix is ugly right now).
4674
4676
4675 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4677 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4676 all of the math profile (quicker loading, no conflict between
4678 all of the math profile (quicker loading, no conflict between
4677 g-9.8 and g-gnuplot).
4679 g-9.8 and g-gnuplot).
4678
4680
4679 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4681 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4680 name of post-mortem files to IPython_crash_report.txt.
4682 name of post-mortem files to IPython_crash_report.txt.
4681
4683
4682 * Cleanup/update of the docs. Added all the new readline info and
4684 * Cleanup/update of the docs. Added all the new readline info and
4683 formatted all lists as 'real lists'.
4685 formatted all lists as 'real lists'.
4684
4686
4685 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4687 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4686 tab-completion options, since the full readline parse_and_bind is
4688 tab-completion options, since the full readline parse_and_bind is
4687 now accessible.
4689 now accessible.
4688
4690
4689 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4691 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4690 handling of readline options. Now users can specify any string to
4692 handling of readline options. Now users can specify any string to
4691 be passed to parse_and_bind(), as well as the delimiters to be
4693 be passed to parse_and_bind(), as well as the delimiters to be
4692 removed.
4694 removed.
4693 (InteractiveShell.__init__): Added __name__ to the global
4695 (InteractiveShell.__init__): Added __name__ to the global
4694 namespace so that things like Itpl which rely on its existence
4696 namespace so that things like Itpl which rely on its existence
4695 don't crash.
4697 don't crash.
4696 (InteractiveShell._prefilter): Defined the default with a _ so
4698 (InteractiveShell._prefilter): Defined the default with a _ so
4697 that prefilter() is easier to override, while the default one
4699 that prefilter() is easier to override, while the default one
4698 remains available.
4700 remains available.
4699
4701
4700 2002-04-18 Fernando Perez <fperez@colorado.edu>
4702 2002-04-18 Fernando Perez <fperez@colorado.edu>
4701
4703
4702 * Added information about pdb in the docs.
4704 * Added information about pdb in the docs.
4703
4705
4704 2002-04-17 Fernando Perez <fperez@colorado.edu>
4706 2002-04-17 Fernando Perez <fperez@colorado.edu>
4705
4707
4706 * IPython/ipmaker.py (make_IPython): added rc_override option to
4708 * IPython/ipmaker.py (make_IPython): added rc_override option to
4707 allow passing config options at creation time which may override
4709 allow passing config options at creation time which may override
4708 anything set in the config files or command line. This is
4710 anything set in the config files or command line. This is
4709 particularly useful for configuring embedded instances.
4711 particularly useful for configuring embedded instances.
4710
4712
4711 2002-04-15 Fernando Perez <fperez@colorado.edu>
4713 2002-04-15 Fernando Perez <fperez@colorado.edu>
4712
4714
4713 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4715 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4714 crash embedded instances because of the input cache falling out of
4716 crash embedded instances because of the input cache falling out of
4715 sync with the output counter.
4717 sync with the output counter.
4716
4718
4717 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4719 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4718 mode which calls pdb after an uncaught exception in IPython itself.
4720 mode which calls pdb after an uncaught exception in IPython itself.
4719
4721
4720 2002-04-14 Fernando Perez <fperez@colorado.edu>
4722 2002-04-14 Fernando Perez <fperez@colorado.edu>
4721
4723
4722 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4724 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4723 readline, fix it back after each call.
4725 readline, fix it back after each call.
4724
4726
4725 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4727 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4726 method to force all access via __call__(), which guarantees that
4728 method to force all access via __call__(), which guarantees that
4727 traceback references are properly deleted.
4729 traceback references are properly deleted.
4728
4730
4729 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4731 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4730 improve printing when pprint is in use.
4732 improve printing when pprint is in use.
4731
4733
4732 2002-04-13 Fernando Perez <fperez@colorado.edu>
4734 2002-04-13 Fernando Perez <fperez@colorado.edu>
4733
4735
4734 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4736 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4735 exceptions aren't caught anymore. If the user triggers one, he
4737 exceptions aren't caught anymore. If the user triggers one, he
4736 should know why he's doing it and it should go all the way up,
4738 should know why he's doing it and it should go all the way up,
4737 just like any other exception. So now @abort will fully kill the
4739 just like any other exception. So now @abort will fully kill the
4738 embedded interpreter and the embedding code (unless that happens
4740 embedded interpreter and the embedding code (unless that happens
4739 to catch SystemExit).
4741 to catch SystemExit).
4740
4742
4741 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4743 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4742 and a debugger() method to invoke the interactive pdb debugger
4744 and a debugger() method to invoke the interactive pdb debugger
4743 after printing exception information. Also added the corresponding
4745 after printing exception information. Also added the corresponding
4744 -pdb option and @pdb magic to control this feature, and updated
4746 -pdb option and @pdb magic to control this feature, and updated
4745 the docs. After a suggestion from Christopher Hart
4747 the docs. After a suggestion from Christopher Hart
4746 (hart-AT-caltech.edu).
4748 (hart-AT-caltech.edu).
4747
4749
4748 2002-04-12 Fernando Perez <fperez@colorado.edu>
4750 2002-04-12 Fernando Perez <fperez@colorado.edu>
4749
4751
4750 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4752 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4751 the exception handlers defined by the user (not the CrashHandler)
4753 the exception handlers defined by the user (not the CrashHandler)
4752 so that user exceptions don't trigger an ipython bug report.
4754 so that user exceptions don't trigger an ipython bug report.
4753
4755
4754 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4756 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4755 configurable (it should have always been so).
4757 configurable (it should have always been so).
4756
4758
4757 2002-03-26 Fernando Perez <fperez@colorado.edu>
4759 2002-03-26 Fernando Perez <fperez@colorado.edu>
4758
4760
4759 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4761 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4760 and there to fix embedding namespace issues. This should all be
4762 and there to fix embedding namespace issues. This should all be
4761 done in a more elegant way.
4763 done in a more elegant way.
4762
4764
4763 2002-03-25 Fernando Perez <fperez@colorado.edu>
4765 2002-03-25 Fernando Perez <fperez@colorado.edu>
4764
4766
4765 * IPython/genutils.py (get_home_dir): Try to make it work under
4767 * IPython/genutils.py (get_home_dir): Try to make it work under
4766 win9x also.
4768 win9x also.
4767
4769
4768 2002-03-20 Fernando Perez <fperez@colorado.edu>
4770 2002-03-20 Fernando Perez <fperez@colorado.edu>
4769
4771
4770 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4772 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4771 sys.displayhook untouched upon __init__.
4773 sys.displayhook untouched upon __init__.
4772
4774
4773 2002-03-19 Fernando Perez <fperez@colorado.edu>
4775 2002-03-19 Fernando Perez <fperez@colorado.edu>
4774
4776
4775 * Released 0.2.9 (for embedding bug, basically).
4777 * Released 0.2.9 (for embedding bug, basically).
4776
4778
4777 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4779 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4778 exceptions so that enclosing shell's state can be restored.
4780 exceptions so that enclosing shell's state can be restored.
4779
4781
4780 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4782 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4781 naming conventions in the .ipython/ dir.
4783 naming conventions in the .ipython/ dir.
4782
4784
4783 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4785 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4784 from delimiters list so filenames with - in them get expanded.
4786 from delimiters list so filenames with - in them get expanded.
4785
4787
4786 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4788 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4787 sys.displayhook not being properly restored after an embedded call.
4789 sys.displayhook not being properly restored after an embedded call.
4788
4790
4789 2002-03-18 Fernando Perez <fperez@colorado.edu>
4791 2002-03-18 Fernando Perez <fperez@colorado.edu>
4790
4792
4791 * Released 0.2.8
4793 * Released 0.2.8
4792
4794
4793 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4795 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4794 some files weren't being included in a -upgrade.
4796 some files weren't being included in a -upgrade.
4795 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4797 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4796 on' so that the first tab completes.
4798 on' so that the first tab completes.
4797 (InteractiveShell.handle_magic): fixed bug with spaces around
4799 (InteractiveShell.handle_magic): fixed bug with spaces around
4798 quotes breaking many magic commands.
4800 quotes breaking many magic commands.
4799
4801
4800 * setup.py: added note about ignoring the syntax error messages at
4802 * setup.py: added note about ignoring the syntax error messages at
4801 installation.
4803 installation.
4802
4804
4803 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4805 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4804 streamlining the gnuplot interface, now there's only one magic @gp.
4806 streamlining the gnuplot interface, now there's only one magic @gp.
4805
4807
4806 2002-03-17 Fernando Perez <fperez@colorado.edu>
4808 2002-03-17 Fernando Perez <fperez@colorado.edu>
4807
4809
4808 * IPython/UserConfig/magic_gnuplot.py: new name for the
4810 * IPython/UserConfig/magic_gnuplot.py: new name for the
4809 example-magic_pm.py file. Much enhanced system, now with a shell
4811 example-magic_pm.py file. Much enhanced system, now with a shell
4810 for communicating directly with gnuplot, one command at a time.
4812 for communicating directly with gnuplot, one command at a time.
4811
4813
4812 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4814 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4813 setting __name__=='__main__'.
4815 setting __name__=='__main__'.
4814
4816
4815 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4817 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4816 mini-shell for accessing gnuplot from inside ipython. Should
4818 mini-shell for accessing gnuplot from inside ipython. Should
4817 extend it later for grace access too. Inspired by Arnd's
4819 extend it later for grace access too. Inspired by Arnd's
4818 suggestion.
4820 suggestion.
4819
4821
4820 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4822 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4821 calling magic functions with () in their arguments. Thanks to Arnd
4823 calling magic functions with () in their arguments. Thanks to Arnd
4822 Baecker for pointing this to me.
4824 Baecker for pointing this to me.
4823
4825
4824 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4826 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4825 infinitely for integer or complex arrays (only worked with floats).
4827 infinitely for integer or complex arrays (only worked with floats).
4826
4828
4827 2002-03-16 Fernando Perez <fperez@colorado.edu>
4829 2002-03-16 Fernando Perez <fperez@colorado.edu>
4828
4830
4829 * setup.py: Merged setup and setup_windows into a single script
4831 * setup.py: Merged setup and setup_windows into a single script
4830 which properly handles things for windows users.
4832 which properly handles things for windows users.
4831
4833
4832 2002-03-15 Fernando Perez <fperez@colorado.edu>
4834 2002-03-15 Fernando Perez <fperez@colorado.edu>
4833
4835
4834 * Big change to the manual: now the magics are all automatically
4836 * Big change to the manual: now the magics are all automatically
4835 documented. This information is generated from their docstrings
4837 documented. This information is generated from their docstrings
4836 and put in a latex file included by the manual lyx file. This way
4838 and put in a latex file included by the manual lyx file. This way
4837 we get always up to date information for the magics. The manual
4839 we get always up to date information for the magics. The manual
4838 now also has proper version information, also auto-synced.
4840 now also has proper version information, also auto-synced.
4839
4841
4840 For this to work, an undocumented --magic_docstrings option was added.
4842 For this to work, an undocumented --magic_docstrings option was added.
4841
4843
4842 2002-03-13 Fernando Perez <fperez@colorado.edu>
4844 2002-03-13 Fernando Perez <fperez@colorado.edu>
4843
4845
4844 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4846 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4845 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4847 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4846
4848
4847 2002-03-12 Fernando Perez <fperez@colorado.edu>
4849 2002-03-12 Fernando Perez <fperez@colorado.edu>
4848
4850
4849 * IPython/ultraTB.py (TermColors): changed color escapes again to
4851 * IPython/ultraTB.py (TermColors): changed color escapes again to
4850 fix the (old, reintroduced) line-wrapping bug. Basically, if
4852 fix the (old, reintroduced) line-wrapping bug. Basically, if
4851 \001..\002 aren't given in the color escapes, lines get wrapped
4853 \001..\002 aren't given in the color escapes, lines get wrapped
4852 weirdly. But giving those screws up old xterms and emacs terms. So
4854 weirdly. But giving those screws up old xterms and emacs terms. So
4853 I added some logic for emacs terms to be ok, but I can't identify old
4855 I added some logic for emacs terms to be ok, but I can't identify old
4854 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4856 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4855
4857
4856 2002-03-10 Fernando Perez <fperez@colorado.edu>
4858 2002-03-10 Fernando Perez <fperez@colorado.edu>
4857
4859
4858 * IPython/usage.py (__doc__): Various documentation cleanups and
4860 * IPython/usage.py (__doc__): Various documentation cleanups and
4859 updates, both in usage docstrings and in the manual.
4861 updates, both in usage docstrings and in the manual.
4860
4862
4861 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4863 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4862 handling of caching. Set minimum acceptabe value for having a
4864 handling of caching. Set minimum acceptabe value for having a
4863 cache at 20 values.
4865 cache at 20 values.
4864
4866
4865 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4867 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4866 install_first_time function to a method, renamed it and added an
4868 install_first_time function to a method, renamed it and added an
4867 'upgrade' mode. Now people can update their config directory with
4869 'upgrade' mode. Now people can update their config directory with
4868 a simple command line switch (-upgrade, also new).
4870 a simple command line switch (-upgrade, also new).
4869
4871
4870 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4872 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4871 @file (convenient for automagic users under Python >= 2.2).
4873 @file (convenient for automagic users under Python >= 2.2).
4872 Removed @files (it seemed more like a plural than an abbrev. of
4874 Removed @files (it seemed more like a plural than an abbrev. of
4873 'file show').
4875 'file show').
4874
4876
4875 * IPython/iplib.py (install_first_time): Fixed crash if there were
4877 * IPython/iplib.py (install_first_time): Fixed crash if there were
4876 backup files ('~') in .ipython/ install directory.
4878 backup files ('~') in .ipython/ install directory.
4877
4879
4878 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4880 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4879 system. Things look fine, but these changes are fairly
4881 system. Things look fine, but these changes are fairly
4880 intrusive. Test them for a few days.
4882 intrusive. Test them for a few days.
4881
4883
4882 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4884 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4883 the prompts system. Now all in/out prompt strings are user
4885 the prompts system. Now all in/out prompt strings are user
4884 controllable. This is particularly useful for embedding, as one
4886 controllable. This is particularly useful for embedding, as one
4885 can tag embedded instances with particular prompts.
4887 can tag embedded instances with particular prompts.
4886
4888
4887 Also removed global use of sys.ps1/2, which now allows nested
4889 Also removed global use of sys.ps1/2, which now allows nested
4888 embeddings without any problems. Added command-line options for
4890 embeddings without any problems. Added command-line options for
4889 the prompt strings.
4891 the prompt strings.
4890
4892
4891 2002-03-08 Fernando Perez <fperez@colorado.edu>
4893 2002-03-08 Fernando Perez <fperez@colorado.edu>
4892
4894
4893 * IPython/UserConfig/example-embed-short.py (ipshell): added
4895 * IPython/UserConfig/example-embed-short.py (ipshell): added
4894 example file with the bare minimum code for embedding.
4896 example file with the bare minimum code for embedding.
4895
4897
4896 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4898 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4897 functionality for the embeddable shell to be activated/deactivated
4899 functionality for the embeddable shell to be activated/deactivated
4898 either globally or at each call.
4900 either globally or at each call.
4899
4901
4900 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4902 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4901 rewriting the prompt with '--->' for auto-inputs with proper
4903 rewriting the prompt with '--->' for auto-inputs with proper
4902 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4904 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4903 this is handled by the prompts class itself, as it should.
4905 this is handled by the prompts class itself, as it should.
4904
4906
4905 2002-03-05 Fernando Perez <fperez@colorado.edu>
4907 2002-03-05 Fernando Perez <fperez@colorado.edu>
4906
4908
4907 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4909 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4908 @logstart to avoid name clashes with the math log function.
4910 @logstart to avoid name clashes with the math log function.
4909
4911
4910 * Big updates to X/Emacs section of the manual.
4912 * Big updates to X/Emacs section of the manual.
4911
4913
4912 * Removed ipython_emacs. Milan explained to me how to pass
4914 * Removed ipython_emacs. Milan explained to me how to pass
4913 arguments to ipython through Emacs. Some day I'm going to end up
4915 arguments to ipython through Emacs. Some day I'm going to end up
4914 learning some lisp...
4916 learning some lisp...
4915
4917
4916 2002-03-04 Fernando Perez <fperez@colorado.edu>
4918 2002-03-04 Fernando Perez <fperez@colorado.edu>
4917
4919
4918 * IPython/ipython_emacs: Created script to be used as the
4920 * IPython/ipython_emacs: Created script to be used as the
4919 py-python-command Emacs variable so we can pass IPython
4921 py-python-command Emacs variable so we can pass IPython
4920 parameters. I can't figure out how to tell Emacs directly to pass
4922 parameters. I can't figure out how to tell Emacs directly to pass
4921 parameters to IPython, so a dummy shell script will do it.
4923 parameters to IPython, so a dummy shell script will do it.
4922
4924
4923 Other enhancements made for things to work better under Emacs'
4925 Other enhancements made for things to work better under Emacs'
4924 various types of terminals. Many thanks to Milan Zamazal
4926 various types of terminals. Many thanks to Milan Zamazal
4925 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4927 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4926
4928
4927 2002-03-01 Fernando Perez <fperez@colorado.edu>
4929 2002-03-01 Fernando Perez <fperez@colorado.edu>
4928
4930
4929 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4931 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4930 that loading of readline is now optional. This gives better
4932 that loading of readline is now optional. This gives better
4931 control to emacs users.
4933 control to emacs users.
4932
4934
4933 * IPython/ultraTB.py (__date__): Modified color escape sequences
4935 * IPython/ultraTB.py (__date__): Modified color escape sequences
4934 and now things work fine under xterm and in Emacs' term buffers
4936 and now things work fine under xterm and in Emacs' term buffers
4935 (though not shell ones). Well, in emacs you get colors, but all
4937 (though not shell ones). Well, in emacs you get colors, but all
4936 seem to be 'light' colors (no difference between dark and light
4938 seem to be 'light' colors (no difference between dark and light
4937 ones). But the garbage chars are gone, and also in xterms. It
4939 ones). But the garbage chars are gone, and also in xterms. It
4938 seems that now I'm using 'cleaner' ansi sequences.
4940 seems that now I'm using 'cleaner' ansi sequences.
4939
4941
4940 2002-02-21 Fernando Perez <fperez@colorado.edu>
4942 2002-02-21 Fernando Perez <fperez@colorado.edu>
4941
4943
4942 * Released 0.2.7 (mainly to publish the scoping fix).
4944 * Released 0.2.7 (mainly to publish the scoping fix).
4943
4945
4944 * IPython/Logger.py (Logger.logstate): added. A corresponding
4946 * IPython/Logger.py (Logger.logstate): added. A corresponding
4945 @logstate magic was created.
4947 @logstate magic was created.
4946
4948
4947 * IPython/Magic.py: fixed nested scoping problem under Python
4949 * IPython/Magic.py: fixed nested scoping problem under Python
4948 2.1.x (automagic wasn't working).
4950 2.1.x (automagic wasn't working).
4949
4951
4950 2002-02-20 Fernando Perez <fperez@colorado.edu>
4952 2002-02-20 Fernando Perez <fperez@colorado.edu>
4951
4953
4952 * Released 0.2.6.
4954 * Released 0.2.6.
4953
4955
4954 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4956 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4955 option so that logs can come out without any headers at all.
4957 option so that logs can come out without any headers at all.
4956
4958
4957 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4959 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4958 SciPy.
4960 SciPy.
4959
4961
4960 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4962 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4961 that embedded IPython calls don't require vars() to be explicitly
4963 that embedded IPython calls don't require vars() to be explicitly
4962 passed. Now they are extracted from the caller's frame (code
4964 passed. Now they are extracted from the caller's frame (code
4963 snatched from Eric Jones' weave). Added better documentation to
4965 snatched from Eric Jones' weave). Added better documentation to
4964 the section on embedding and the example file.
4966 the section on embedding and the example file.
4965
4967
4966 * IPython/genutils.py (page): Changed so that under emacs, it just
4968 * IPython/genutils.py (page): Changed so that under emacs, it just
4967 prints the string. You can then page up and down in the emacs
4969 prints the string. You can then page up and down in the emacs
4968 buffer itself. This is how the builtin help() works.
4970 buffer itself. This is how the builtin help() works.
4969
4971
4970 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4972 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4971 macro scoping: macros need to be executed in the user's namespace
4973 macro scoping: macros need to be executed in the user's namespace
4972 to work as if they had been typed by the user.
4974 to work as if they had been typed by the user.
4973
4975
4974 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4976 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4975 execute automatically (no need to type 'exec...'). They then
4977 execute automatically (no need to type 'exec...'). They then
4976 behave like 'true macros'. The printing system was also modified
4978 behave like 'true macros'. The printing system was also modified
4977 for this to work.
4979 for this to work.
4978
4980
4979 2002-02-19 Fernando Perez <fperez@colorado.edu>
4981 2002-02-19 Fernando Perez <fperez@colorado.edu>
4980
4982
4981 * IPython/genutils.py (page_file): new function for paging files
4983 * IPython/genutils.py (page_file): new function for paging files
4982 in an OS-independent way. Also necessary for file viewing to work
4984 in an OS-independent way. Also necessary for file viewing to work
4983 well inside Emacs buffers.
4985 well inside Emacs buffers.
4984 (page): Added checks for being in an emacs buffer.
4986 (page): Added checks for being in an emacs buffer.
4985 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4987 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4986 same bug in iplib.
4988 same bug in iplib.
4987
4989
4988 2002-02-18 Fernando Perez <fperez@colorado.edu>
4990 2002-02-18 Fernando Perez <fperez@colorado.edu>
4989
4991
4990 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4992 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4991 of readline so that IPython can work inside an Emacs buffer.
4993 of readline so that IPython can work inside an Emacs buffer.
4992
4994
4993 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4995 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4994 method signatures (they weren't really bugs, but it looks cleaner
4996 method signatures (they weren't really bugs, but it looks cleaner
4995 and keeps PyChecker happy).
4997 and keeps PyChecker happy).
4996
4998
4997 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4999 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4998 for implementing various user-defined hooks. Currently only
5000 for implementing various user-defined hooks. Currently only
4999 display is done.
5001 display is done.
5000
5002
5001 * IPython/Prompts.py (CachedOutput._display): changed display
5003 * IPython/Prompts.py (CachedOutput._display): changed display
5002 functions so that they can be dynamically changed by users easily.
5004 functions so that they can be dynamically changed by users easily.
5003
5005
5004 * IPython/Extensions/numeric_formats.py (num_display): added an
5006 * IPython/Extensions/numeric_formats.py (num_display): added an
5005 extension for printing NumPy arrays in flexible manners. It
5007 extension for printing NumPy arrays in flexible manners. It
5006 doesn't do anything yet, but all the structure is in
5008 doesn't do anything yet, but all the structure is in
5007 place. Ultimately the plan is to implement output format control
5009 place. Ultimately the plan is to implement output format control
5008 like in Octave.
5010 like in Octave.
5009
5011
5010 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5012 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5011 methods are found at run-time by all the automatic machinery.
5013 methods are found at run-time by all the automatic machinery.
5012
5014
5013 2002-02-17 Fernando Perez <fperez@colorado.edu>
5015 2002-02-17 Fernando Perez <fperez@colorado.edu>
5014
5016
5015 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5017 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5016 whole file a little.
5018 whole file a little.
5017
5019
5018 * ToDo: closed this document. Now there's a new_design.lyx
5020 * ToDo: closed this document. Now there's a new_design.lyx
5019 document for all new ideas. Added making a pdf of it for the
5021 document for all new ideas. Added making a pdf of it for the
5020 end-user distro.
5022 end-user distro.
5021
5023
5022 * IPython/Logger.py (Logger.switch_log): Created this to replace
5024 * IPython/Logger.py (Logger.switch_log): Created this to replace
5023 logon() and logoff(). It also fixes a nasty crash reported by
5025 logon() and logoff(). It also fixes a nasty crash reported by
5024 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5026 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5025
5027
5026 * IPython/iplib.py (complete): got auto-completion to work with
5028 * IPython/iplib.py (complete): got auto-completion to work with
5027 automagic (I had wanted this for a long time).
5029 automagic (I had wanted this for a long time).
5028
5030
5029 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5031 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5030 to @file, since file() is now a builtin and clashes with automagic
5032 to @file, since file() is now a builtin and clashes with automagic
5031 for @file.
5033 for @file.
5032
5034
5033 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5035 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5034 of this was previously in iplib, which had grown to more than 2000
5036 of this was previously in iplib, which had grown to more than 2000
5035 lines, way too long. No new functionality, but it makes managing
5037 lines, way too long. No new functionality, but it makes managing
5036 the code a bit easier.
5038 the code a bit easier.
5037
5039
5038 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5040 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5039 information to crash reports.
5041 information to crash reports.
5040
5042
5041 2002-02-12 Fernando Perez <fperez@colorado.edu>
5043 2002-02-12 Fernando Perez <fperez@colorado.edu>
5042
5044
5043 * Released 0.2.5.
5045 * Released 0.2.5.
5044
5046
5045 2002-02-11 Fernando Perez <fperez@colorado.edu>
5047 2002-02-11 Fernando Perez <fperez@colorado.edu>
5046
5048
5047 * Wrote a relatively complete Windows installer. It puts
5049 * Wrote a relatively complete Windows installer. It puts
5048 everything in place, creates Start Menu entries and fixes the
5050 everything in place, creates Start Menu entries and fixes the
5049 color issues. Nothing fancy, but it works.
5051 color issues. Nothing fancy, but it works.
5050
5052
5051 2002-02-10 Fernando Perez <fperez@colorado.edu>
5053 2002-02-10 Fernando Perez <fperez@colorado.edu>
5052
5054
5053 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5055 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5054 os.path.expanduser() call so that we can type @run ~/myfile.py and
5056 os.path.expanduser() call so that we can type @run ~/myfile.py and
5055 have thigs work as expected.
5057 have thigs work as expected.
5056
5058
5057 * IPython/genutils.py (page): fixed exception handling so things
5059 * IPython/genutils.py (page): fixed exception handling so things
5058 work both in Unix and Windows correctly. Quitting a pager triggers
5060 work both in Unix and Windows correctly. Quitting a pager triggers
5059 an IOError/broken pipe in Unix, and in windows not finding a pager
5061 an IOError/broken pipe in Unix, and in windows not finding a pager
5060 is also an IOError, so I had to actually look at the return value
5062 is also an IOError, so I had to actually look at the return value
5061 of the exception, not just the exception itself. Should be ok now.
5063 of the exception, not just the exception itself. Should be ok now.
5062
5064
5063 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5065 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5064 modified to allow case-insensitive color scheme changes.
5066 modified to allow case-insensitive color scheme changes.
5065
5067
5066 2002-02-09 Fernando Perez <fperez@colorado.edu>
5068 2002-02-09 Fernando Perez <fperez@colorado.edu>
5067
5069
5068 * IPython/genutils.py (native_line_ends): new function to leave
5070 * IPython/genutils.py (native_line_ends): new function to leave
5069 user config files with os-native line-endings.
5071 user config files with os-native line-endings.
5070
5072
5071 * README and manual updates.
5073 * README and manual updates.
5072
5074
5073 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5075 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5074 instead of StringType to catch Unicode strings.
5076 instead of StringType to catch Unicode strings.
5075
5077
5076 * IPython/genutils.py (filefind): fixed bug for paths with
5078 * IPython/genutils.py (filefind): fixed bug for paths with
5077 embedded spaces (very common in Windows).
5079 embedded spaces (very common in Windows).
5078
5080
5079 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5081 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5080 files under Windows, so that they get automatically associated
5082 files under Windows, so that they get automatically associated
5081 with a text editor. Windows makes it a pain to handle
5083 with a text editor. Windows makes it a pain to handle
5082 extension-less files.
5084 extension-less files.
5083
5085
5084 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5086 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5085 warning about readline only occur for Posix. In Windows there's no
5087 warning about readline only occur for Posix. In Windows there's no
5086 way to get readline, so why bother with the warning.
5088 way to get readline, so why bother with the warning.
5087
5089
5088 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5090 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5089 for __str__ instead of dir(self), since dir() changed in 2.2.
5091 for __str__ instead of dir(self), since dir() changed in 2.2.
5090
5092
5091 * Ported to Windows! Tested on XP, I suspect it should work fine
5093 * Ported to Windows! Tested on XP, I suspect it should work fine
5092 on NT/2000, but I don't think it will work on 98 et al. That
5094 on NT/2000, but I don't think it will work on 98 et al. That
5093 series of Windows is such a piece of junk anyway that I won't try
5095 series of Windows is such a piece of junk anyway that I won't try
5094 porting it there. The XP port was straightforward, showed a few
5096 porting it there. The XP port was straightforward, showed a few
5095 bugs here and there (fixed all), in particular some string
5097 bugs here and there (fixed all), in particular some string
5096 handling stuff which required considering Unicode strings (which
5098 handling stuff which required considering Unicode strings (which
5097 Windows uses). This is good, but hasn't been too tested :) No
5099 Windows uses). This is good, but hasn't been too tested :) No
5098 fancy installer yet, I'll put a note in the manual so people at
5100 fancy installer yet, I'll put a note in the manual so people at
5099 least make manually a shortcut.
5101 least make manually a shortcut.
5100
5102
5101 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5103 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5102 into a single one, "colors". This now controls both prompt and
5104 into a single one, "colors". This now controls both prompt and
5103 exception color schemes, and can be changed both at startup
5105 exception color schemes, and can be changed both at startup
5104 (either via command-line switches or via ipythonrc files) and at
5106 (either via command-line switches or via ipythonrc files) and at
5105 runtime, with @colors.
5107 runtime, with @colors.
5106 (Magic.magic_run): renamed @prun to @run and removed the old
5108 (Magic.magic_run): renamed @prun to @run and removed the old
5107 @run. The two were too similar to warrant keeping both.
5109 @run. The two were too similar to warrant keeping both.
5108
5110
5109 2002-02-03 Fernando Perez <fperez@colorado.edu>
5111 2002-02-03 Fernando Perez <fperez@colorado.edu>
5110
5112
5111 * IPython/iplib.py (install_first_time): Added comment on how to
5113 * IPython/iplib.py (install_first_time): Added comment on how to
5112 configure the color options for first-time users. Put a <return>
5114 configure the color options for first-time users. Put a <return>
5113 request at the end so that small-terminal users get a chance to
5115 request at the end so that small-terminal users get a chance to
5114 read the startup info.
5116 read the startup info.
5115
5117
5116 2002-01-23 Fernando Perez <fperez@colorado.edu>
5118 2002-01-23 Fernando Perez <fperez@colorado.edu>
5117
5119
5118 * IPython/iplib.py (CachedOutput.update): Changed output memory
5120 * IPython/iplib.py (CachedOutput.update): Changed output memory
5119 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5121 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5120 input history we still use _i. Did this b/c these variable are
5122 input history we still use _i. Did this b/c these variable are
5121 very commonly used in interactive work, so the less we need to
5123 very commonly used in interactive work, so the less we need to
5122 type the better off we are.
5124 type the better off we are.
5123 (Magic.magic_prun): updated @prun to better handle the namespaces
5125 (Magic.magic_prun): updated @prun to better handle the namespaces
5124 the file will run in, including a fix for __name__ not being set
5126 the file will run in, including a fix for __name__ not being set
5125 before.
5127 before.
5126
5128
5127 2002-01-20 Fernando Perez <fperez@colorado.edu>
5129 2002-01-20 Fernando Perez <fperez@colorado.edu>
5128
5130
5129 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5131 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5130 extra garbage for Python 2.2. Need to look more carefully into
5132 extra garbage for Python 2.2. Need to look more carefully into
5131 this later.
5133 this later.
5132
5134
5133 2002-01-19 Fernando Perez <fperez@colorado.edu>
5135 2002-01-19 Fernando Perez <fperez@colorado.edu>
5134
5136
5135 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5137 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5136 display SyntaxError exceptions properly formatted when they occur
5138 display SyntaxError exceptions properly formatted when they occur
5137 (they can be triggered by imported code).
5139 (they can be triggered by imported code).
5138
5140
5139 2002-01-18 Fernando Perez <fperez@colorado.edu>
5141 2002-01-18 Fernando Perez <fperez@colorado.edu>
5140
5142
5141 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5143 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5142 SyntaxError exceptions are reported nicely formatted, instead of
5144 SyntaxError exceptions are reported nicely formatted, instead of
5143 spitting out only offset information as before.
5145 spitting out only offset information as before.
5144 (Magic.magic_prun): Added the @prun function for executing
5146 (Magic.magic_prun): Added the @prun function for executing
5145 programs with command line args inside IPython.
5147 programs with command line args inside IPython.
5146
5148
5147 2002-01-16 Fernando Perez <fperez@colorado.edu>
5149 2002-01-16 Fernando Perez <fperez@colorado.edu>
5148
5150
5149 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5151 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5150 to *not* include the last item given in a range. This brings their
5152 to *not* include the last item given in a range. This brings their
5151 behavior in line with Python's slicing:
5153 behavior in line with Python's slicing:
5152 a[n1:n2] -> a[n1]...a[n2-1]
5154 a[n1:n2] -> a[n1]...a[n2-1]
5153 It may be a bit less convenient, but I prefer to stick to Python's
5155 It may be a bit less convenient, but I prefer to stick to Python's
5154 conventions *everywhere*, so users never have to wonder.
5156 conventions *everywhere*, so users never have to wonder.
5155 (Magic.magic_macro): Added @macro function to ease the creation of
5157 (Magic.magic_macro): Added @macro function to ease the creation of
5156 macros.
5158 macros.
5157
5159
5158 2002-01-05 Fernando Perez <fperez@colorado.edu>
5160 2002-01-05 Fernando Perez <fperez@colorado.edu>
5159
5161
5160 * Released 0.2.4.
5162 * Released 0.2.4.
5161
5163
5162 * IPython/iplib.py (Magic.magic_pdef):
5164 * IPython/iplib.py (Magic.magic_pdef):
5163 (InteractiveShell.safe_execfile): report magic lines and error
5165 (InteractiveShell.safe_execfile): report magic lines and error
5164 lines without line numbers so one can easily copy/paste them for
5166 lines without line numbers so one can easily copy/paste them for
5165 re-execution.
5167 re-execution.
5166
5168
5167 * Updated manual with recent changes.
5169 * Updated manual with recent changes.
5168
5170
5169 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5171 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5170 docstring printing when class? is called. Very handy for knowing
5172 docstring printing when class? is called. Very handy for knowing
5171 how to create class instances (as long as __init__ is well
5173 how to create class instances (as long as __init__ is well
5172 documented, of course :)
5174 documented, of course :)
5173 (Magic.magic_doc): print both class and constructor docstrings.
5175 (Magic.magic_doc): print both class and constructor docstrings.
5174 (Magic.magic_pdef): give constructor info if passed a class and
5176 (Magic.magic_pdef): give constructor info if passed a class and
5175 __call__ info for callable object instances.
5177 __call__ info for callable object instances.
5176
5178
5177 2002-01-04 Fernando Perez <fperez@colorado.edu>
5179 2002-01-04 Fernando Perez <fperez@colorado.edu>
5178
5180
5179 * Made deep_reload() off by default. It doesn't always work
5181 * Made deep_reload() off by default. It doesn't always work
5180 exactly as intended, so it's probably safer to have it off. It's
5182 exactly as intended, so it's probably safer to have it off. It's
5181 still available as dreload() anyway, so nothing is lost.
5183 still available as dreload() anyway, so nothing is lost.
5182
5184
5183 2002-01-02 Fernando Perez <fperez@colorado.edu>
5185 2002-01-02 Fernando Perez <fperez@colorado.edu>
5184
5186
5185 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5187 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5186 so I wanted an updated release).
5188 so I wanted an updated release).
5187
5189
5188 2001-12-27 Fernando Perez <fperez@colorado.edu>
5190 2001-12-27 Fernando Perez <fperez@colorado.edu>
5189
5191
5190 * IPython/iplib.py (InteractiveShell.interact): Added the original
5192 * IPython/iplib.py (InteractiveShell.interact): Added the original
5191 code from 'code.py' for this module in order to change the
5193 code from 'code.py' for this module in order to change the
5192 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5194 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5193 the history cache would break when the user hit Ctrl-C, and
5195 the history cache would break when the user hit Ctrl-C, and
5194 interact() offers no way to add any hooks to it.
5196 interact() offers no way to add any hooks to it.
5195
5197
5196 2001-12-23 Fernando Perez <fperez@colorado.edu>
5198 2001-12-23 Fernando Perez <fperez@colorado.edu>
5197
5199
5198 * setup.py: added check for 'MANIFEST' before trying to remove
5200 * setup.py: added check for 'MANIFEST' before trying to remove
5199 it. Thanks to Sean Reifschneider.
5201 it. Thanks to Sean Reifschneider.
5200
5202
5201 2001-12-22 Fernando Perez <fperez@colorado.edu>
5203 2001-12-22 Fernando Perez <fperez@colorado.edu>
5202
5204
5203 * Released 0.2.2.
5205 * Released 0.2.2.
5204
5206
5205 * Finished (reasonably) writing the manual. Later will add the
5207 * Finished (reasonably) writing the manual. Later will add the
5206 python-standard navigation stylesheets, but for the time being
5208 python-standard navigation stylesheets, but for the time being
5207 it's fairly complete. Distribution will include html and pdf
5209 it's fairly complete. Distribution will include html and pdf
5208 versions.
5210 versions.
5209
5211
5210 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5212 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5211 (MayaVi author).
5213 (MayaVi author).
5212
5214
5213 2001-12-21 Fernando Perez <fperez@colorado.edu>
5215 2001-12-21 Fernando Perez <fperez@colorado.edu>
5214
5216
5215 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5217 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5216 good public release, I think (with the manual and the distutils
5218 good public release, I think (with the manual and the distutils
5217 installer). The manual can use some work, but that can go
5219 installer). The manual can use some work, but that can go
5218 slowly. Otherwise I think it's quite nice for end users. Next
5220 slowly. Otherwise I think it's quite nice for end users. Next
5219 summer, rewrite the guts of it...
5221 summer, rewrite the guts of it...
5220
5222
5221 * Changed format of ipythonrc files to use whitespace as the
5223 * Changed format of ipythonrc files to use whitespace as the
5222 separator instead of an explicit '='. Cleaner.
5224 separator instead of an explicit '='. Cleaner.
5223
5225
5224 2001-12-20 Fernando Perez <fperez@colorado.edu>
5226 2001-12-20 Fernando Perez <fperez@colorado.edu>
5225
5227
5226 * Started a manual in LyX. For now it's just a quick merge of the
5228 * Started a manual in LyX. For now it's just a quick merge of the
5227 various internal docstrings and READMEs. Later it may grow into a
5229 various internal docstrings and READMEs. Later it may grow into a
5228 nice, full-blown manual.
5230 nice, full-blown manual.
5229
5231
5230 * Set up a distutils based installer. Installation should now be
5232 * Set up a distutils based installer. Installation should now be
5231 trivially simple for end-users.
5233 trivially simple for end-users.
5232
5234
5233 2001-12-11 Fernando Perez <fperez@colorado.edu>
5235 2001-12-11 Fernando Perez <fperez@colorado.edu>
5234
5236
5235 * Released 0.2.0. First public release, announced it at
5237 * Released 0.2.0. First public release, announced it at
5236 comp.lang.python. From now on, just bugfixes...
5238 comp.lang.python. From now on, just bugfixes...
5237
5239
5238 * Went through all the files, set copyright/license notices and
5240 * Went through all the files, set copyright/license notices and
5239 cleaned up things. Ready for release.
5241 cleaned up things. Ready for release.
5240
5242
5241 2001-12-10 Fernando Perez <fperez@colorado.edu>
5243 2001-12-10 Fernando Perez <fperez@colorado.edu>
5242
5244
5243 * Changed the first-time installer not to use tarfiles. It's more
5245 * Changed the first-time installer not to use tarfiles. It's more
5244 robust now and less unix-dependent. Also makes it easier for
5246 robust now and less unix-dependent. Also makes it easier for
5245 people to later upgrade versions.
5247 people to later upgrade versions.
5246
5248
5247 * Changed @exit to @abort to reflect the fact that it's pretty
5249 * Changed @exit to @abort to reflect the fact that it's pretty
5248 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5250 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5249 becomes significant only when IPyhton is embedded: in that case,
5251 becomes significant only when IPyhton is embedded: in that case,
5250 C-D closes IPython only, but @abort kills the enclosing program
5252 C-D closes IPython only, but @abort kills the enclosing program
5251 too (unless it had called IPython inside a try catching
5253 too (unless it had called IPython inside a try catching
5252 SystemExit).
5254 SystemExit).
5253
5255
5254 * Created Shell module which exposes the actuall IPython Shell
5256 * Created Shell module which exposes the actuall IPython Shell
5255 classes, currently the normal and the embeddable one. This at
5257 classes, currently the normal and the embeddable one. This at
5256 least offers a stable interface we won't need to change when
5258 least offers a stable interface we won't need to change when
5257 (later) the internals are rewritten. That rewrite will be confined
5259 (later) the internals are rewritten. That rewrite will be confined
5258 to iplib and ipmaker, but the Shell interface should remain as is.
5260 to iplib and ipmaker, but the Shell interface should remain as is.
5259
5261
5260 * Added embed module which offers an embeddable IPShell object,
5262 * Added embed module which offers an embeddable IPShell object,
5261 useful to fire up IPython *inside* a running program. Great for
5263 useful to fire up IPython *inside* a running program. Great for
5262 debugging or dynamical data analysis.
5264 debugging or dynamical data analysis.
5263
5265
5264 2001-12-08 Fernando Perez <fperez@colorado.edu>
5266 2001-12-08 Fernando Perez <fperez@colorado.edu>
5265
5267
5266 * Fixed small bug preventing seeing info from methods of defined
5268 * Fixed small bug preventing seeing info from methods of defined
5267 objects (incorrect namespace in _ofind()).
5269 objects (incorrect namespace in _ofind()).
5268
5270
5269 * Documentation cleanup. Moved the main usage docstrings to a
5271 * Documentation cleanup. Moved the main usage docstrings to a
5270 separate file, usage.py (cleaner to maintain, and hopefully in the
5272 separate file, usage.py (cleaner to maintain, and hopefully in the
5271 future some perlpod-like way of producing interactive, man and
5273 future some perlpod-like way of producing interactive, man and
5272 html docs out of it will be found).
5274 html docs out of it will be found).
5273
5275
5274 * Added @profile to see your profile at any time.
5276 * Added @profile to see your profile at any time.
5275
5277
5276 * Added @p as an alias for 'print'. It's especially convenient if
5278 * Added @p as an alias for 'print'. It's especially convenient if
5277 using automagic ('p x' prints x).
5279 using automagic ('p x' prints x).
5278
5280
5279 * Small cleanups and fixes after a pychecker run.
5281 * Small cleanups and fixes after a pychecker run.
5280
5282
5281 * Changed the @cd command to handle @cd - and @cd -<n> for
5283 * Changed the @cd command to handle @cd - and @cd -<n> for
5282 visiting any directory in _dh.
5284 visiting any directory in _dh.
5283
5285
5284 * Introduced _dh, a history of visited directories. @dhist prints
5286 * Introduced _dh, a history of visited directories. @dhist prints
5285 it out with numbers.
5287 it out with numbers.
5286
5288
5287 2001-12-07 Fernando Perez <fperez@colorado.edu>
5289 2001-12-07 Fernando Perez <fperez@colorado.edu>
5288
5290
5289 * Released 0.1.22
5291 * Released 0.1.22
5290
5292
5291 * Made initialization a bit more robust against invalid color
5293 * Made initialization a bit more robust against invalid color
5292 options in user input (exit, not traceback-crash).
5294 options in user input (exit, not traceback-crash).
5293
5295
5294 * Changed the bug crash reporter to write the report only in the
5296 * Changed the bug crash reporter to write the report only in the
5295 user's .ipython directory. That way IPython won't litter people's
5297 user's .ipython directory. That way IPython won't litter people's
5296 hard disks with crash files all over the place. Also print on
5298 hard disks with crash files all over the place. Also print on
5297 screen the necessary mail command.
5299 screen the necessary mail command.
5298
5300
5299 * With the new ultraTB, implemented LightBG color scheme for light
5301 * With the new ultraTB, implemented LightBG color scheme for light
5300 background terminals. A lot of people like white backgrounds, so I
5302 background terminals. A lot of people like white backgrounds, so I
5301 guess we should at least give them something readable.
5303 guess we should at least give them something readable.
5302
5304
5303 2001-12-06 Fernando Perez <fperez@colorado.edu>
5305 2001-12-06 Fernando Perez <fperez@colorado.edu>
5304
5306
5305 * Modified the structure of ultraTB. Now there's a proper class
5307 * Modified the structure of ultraTB. Now there's a proper class
5306 for tables of color schemes which allow adding schemes easily and
5308 for tables of color schemes which allow adding schemes easily and
5307 switching the active scheme without creating a new instance every
5309 switching the active scheme without creating a new instance every
5308 time (which was ridiculous). The syntax for creating new schemes
5310 time (which was ridiculous). The syntax for creating new schemes
5309 is also cleaner. I think ultraTB is finally done, with a clean
5311 is also cleaner. I think ultraTB is finally done, with a clean
5310 class structure. Names are also much cleaner (now there's proper
5312 class structure. Names are also much cleaner (now there's proper
5311 color tables, no need for every variable to also have 'color' in
5313 color tables, no need for every variable to also have 'color' in
5312 its name).
5314 its name).
5313
5315
5314 * Broke down genutils into separate files. Now genutils only
5316 * Broke down genutils into separate files. Now genutils only
5315 contains utility functions, and classes have been moved to their
5317 contains utility functions, and classes have been moved to their
5316 own files (they had enough independent functionality to warrant
5318 own files (they had enough independent functionality to warrant
5317 it): ConfigLoader, OutputTrap, Struct.
5319 it): ConfigLoader, OutputTrap, Struct.
5318
5320
5319 2001-12-05 Fernando Perez <fperez@colorado.edu>
5321 2001-12-05 Fernando Perez <fperez@colorado.edu>
5320
5322
5321 * IPython turns 21! Released version 0.1.21, as a candidate for
5323 * IPython turns 21! Released version 0.1.21, as a candidate for
5322 public consumption. If all goes well, release in a few days.
5324 public consumption. If all goes well, release in a few days.
5323
5325
5324 * Fixed path bug (files in Extensions/ directory wouldn't be found
5326 * Fixed path bug (files in Extensions/ directory wouldn't be found
5325 unless IPython/ was explicitly in sys.path).
5327 unless IPython/ was explicitly in sys.path).
5326
5328
5327 * Extended the FlexCompleter class as MagicCompleter to allow
5329 * Extended the FlexCompleter class as MagicCompleter to allow
5328 completion of @-starting lines.
5330 completion of @-starting lines.
5329
5331
5330 * Created __release__.py file as a central repository for release
5332 * Created __release__.py file as a central repository for release
5331 info that other files can read from.
5333 info that other files can read from.
5332
5334
5333 * Fixed small bug in logging: when logging was turned on in
5335 * Fixed small bug in logging: when logging was turned on in
5334 mid-session, old lines with special meanings (!@?) were being
5336 mid-session, old lines with special meanings (!@?) were being
5335 logged without the prepended comment, which is necessary since
5337 logged without the prepended comment, which is necessary since
5336 they are not truly valid python syntax. This should make session
5338 they are not truly valid python syntax. This should make session
5337 restores produce less errors.
5339 restores produce less errors.
5338
5340
5339 * The namespace cleanup forced me to make a FlexCompleter class
5341 * The namespace cleanup forced me to make a FlexCompleter class
5340 which is nothing but a ripoff of rlcompleter, but with selectable
5342 which is nothing but a ripoff of rlcompleter, but with selectable
5341 namespace (rlcompleter only works in __main__.__dict__). I'll try
5343 namespace (rlcompleter only works in __main__.__dict__). I'll try
5342 to submit a note to the authors to see if this change can be
5344 to submit a note to the authors to see if this change can be
5343 incorporated in future rlcompleter releases (Dec.6: done)
5345 incorporated in future rlcompleter releases (Dec.6: done)
5344
5346
5345 * More fixes to namespace handling. It was a mess! Now all
5347 * More fixes to namespace handling. It was a mess! Now all
5346 explicit references to __main__.__dict__ are gone (except when
5348 explicit references to __main__.__dict__ are gone (except when
5347 really needed) and everything is handled through the namespace
5349 really needed) and everything is handled through the namespace
5348 dicts in the IPython instance. We seem to be getting somewhere
5350 dicts in the IPython instance. We seem to be getting somewhere
5349 with this, finally...
5351 with this, finally...
5350
5352
5351 * Small documentation updates.
5353 * Small documentation updates.
5352
5354
5353 * Created the Extensions directory under IPython (with an
5355 * Created the Extensions directory under IPython (with an
5354 __init__.py). Put the PhysicalQ stuff there. This directory should
5356 __init__.py). Put the PhysicalQ stuff there. This directory should
5355 be used for all special-purpose extensions.
5357 be used for all special-purpose extensions.
5356
5358
5357 * File renaming:
5359 * File renaming:
5358 ipythonlib --> ipmaker
5360 ipythonlib --> ipmaker
5359 ipplib --> iplib
5361 ipplib --> iplib
5360 This makes a bit more sense in terms of what these files actually do.
5362 This makes a bit more sense in terms of what these files actually do.
5361
5363
5362 * Moved all the classes and functions in ipythonlib to ipplib, so
5364 * Moved all the classes and functions in ipythonlib to ipplib, so
5363 now ipythonlib only has make_IPython(). This will ease up its
5365 now ipythonlib only has make_IPython(). This will ease up its
5364 splitting in smaller functional chunks later.
5366 splitting in smaller functional chunks later.
5365
5367
5366 * Cleaned up (done, I think) output of @whos. Better column
5368 * Cleaned up (done, I think) output of @whos. Better column
5367 formatting, and now shows str(var) for as much as it can, which is
5369 formatting, and now shows str(var) for as much as it can, which is
5368 typically what one gets with a 'print var'.
5370 typically what one gets with a 'print var'.
5369
5371
5370 2001-12-04 Fernando Perez <fperez@colorado.edu>
5372 2001-12-04 Fernando Perez <fperez@colorado.edu>
5371
5373
5372 * Fixed namespace problems. Now builtin/IPyhton/user names get
5374 * Fixed namespace problems. Now builtin/IPyhton/user names get
5373 properly reported in their namespace. Internal namespace handling
5375 properly reported in their namespace. Internal namespace handling
5374 is finally getting decent (not perfect yet, but much better than
5376 is finally getting decent (not perfect yet, but much better than
5375 the ad-hoc mess we had).
5377 the ad-hoc mess we had).
5376
5378
5377 * Removed -exit option. If people just want to run a python
5379 * Removed -exit option. If people just want to run a python
5378 script, that's what the normal interpreter is for. Less
5380 script, that's what the normal interpreter is for. Less
5379 unnecessary options, less chances for bugs.
5381 unnecessary options, less chances for bugs.
5380
5382
5381 * Added a crash handler which generates a complete post-mortem if
5383 * Added a crash handler which generates a complete post-mortem if
5382 IPython crashes. This will help a lot in tracking bugs down the
5384 IPython crashes. This will help a lot in tracking bugs down the
5383 road.
5385 road.
5384
5386
5385 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5387 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5386 which were boud to functions being reassigned would bypass the
5388 which were boud to functions being reassigned would bypass the
5387 logger, breaking the sync of _il with the prompt counter. This
5389 logger, breaking the sync of _il with the prompt counter. This
5388 would then crash IPython later when a new line was logged.
5390 would then crash IPython later when a new line was logged.
5389
5391
5390 2001-12-02 Fernando Perez <fperez@colorado.edu>
5392 2001-12-02 Fernando Perez <fperez@colorado.edu>
5391
5393
5392 * Made IPython a package. This means people don't have to clutter
5394 * Made IPython a package. This means people don't have to clutter
5393 their sys.path with yet another directory. Changed the INSTALL
5395 their sys.path with yet another directory. Changed the INSTALL
5394 file accordingly.
5396 file accordingly.
5395
5397
5396 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5398 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5397 sorts its output (so @who shows it sorted) and @whos formats the
5399 sorts its output (so @who shows it sorted) and @whos formats the
5398 table according to the width of the first column. Nicer, easier to
5400 table according to the width of the first column. Nicer, easier to
5399 read. Todo: write a generic table_format() which takes a list of
5401 read. Todo: write a generic table_format() which takes a list of
5400 lists and prints it nicely formatted, with optional row/column
5402 lists and prints it nicely formatted, with optional row/column
5401 separators and proper padding and justification.
5403 separators and proper padding and justification.
5402
5404
5403 * Released 0.1.20
5405 * Released 0.1.20
5404
5406
5405 * Fixed bug in @log which would reverse the inputcache list (a
5407 * Fixed bug in @log which would reverse the inputcache list (a
5406 copy operation was missing).
5408 copy operation was missing).
5407
5409
5408 * Code cleanup. @config was changed to use page(). Better, since
5410 * Code cleanup. @config was changed to use page(). Better, since
5409 its output is always quite long.
5411 its output is always quite long.
5410
5412
5411 * Itpl is back as a dependency. I was having too many problems
5413 * Itpl is back as a dependency. I was having too many problems
5412 getting the parametric aliases to work reliably, and it's just
5414 getting the parametric aliases to work reliably, and it's just
5413 easier to code weird string operations with it than playing %()s
5415 easier to code weird string operations with it than playing %()s
5414 games. It's only ~6k, so I don't think it's too big a deal.
5416 games. It's only ~6k, so I don't think it's too big a deal.
5415
5417
5416 * Found (and fixed) a very nasty bug with history. !lines weren't
5418 * Found (and fixed) a very nasty bug with history. !lines weren't
5417 getting cached, and the out of sync caches would crash
5419 getting cached, and the out of sync caches would crash
5418 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5420 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5419 division of labor a bit better. Bug fixed, cleaner structure.
5421 division of labor a bit better. Bug fixed, cleaner structure.
5420
5422
5421 2001-12-01 Fernando Perez <fperez@colorado.edu>
5423 2001-12-01 Fernando Perez <fperez@colorado.edu>
5422
5424
5423 * Released 0.1.19
5425 * Released 0.1.19
5424
5426
5425 * Added option -n to @hist to prevent line number printing. Much
5427 * Added option -n to @hist to prevent line number printing. Much
5426 easier to copy/paste code this way.
5428 easier to copy/paste code this way.
5427
5429
5428 * Created global _il to hold the input list. Allows easy
5430 * Created global _il to hold the input list. Allows easy
5429 re-execution of blocks of code by slicing it (inspired by Janko's
5431 re-execution of blocks of code by slicing it (inspired by Janko's
5430 comment on 'macros').
5432 comment on 'macros').
5431
5433
5432 * Small fixes and doc updates.
5434 * Small fixes and doc updates.
5433
5435
5434 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5436 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5435 much too fragile with automagic. Handles properly multi-line
5437 much too fragile with automagic. Handles properly multi-line
5436 statements and takes parameters.
5438 statements and takes parameters.
5437
5439
5438 2001-11-30 Fernando Perez <fperez@colorado.edu>
5440 2001-11-30 Fernando Perez <fperez@colorado.edu>
5439
5441
5440 * Version 0.1.18 released.
5442 * Version 0.1.18 released.
5441
5443
5442 * Fixed nasty namespace bug in initial module imports.
5444 * Fixed nasty namespace bug in initial module imports.
5443
5445
5444 * Added copyright/license notes to all code files (except
5446 * Added copyright/license notes to all code files (except
5445 DPyGetOpt). For the time being, LGPL. That could change.
5447 DPyGetOpt). For the time being, LGPL. That could change.
5446
5448
5447 * Rewrote a much nicer README, updated INSTALL, cleaned up
5449 * Rewrote a much nicer README, updated INSTALL, cleaned up
5448 ipythonrc-* samples.
5450 ipythonrc-* samples.
5449
5451
5450 * Overall code/documentation cleanup. Basically ready for
5452 * Overall code/documentation cleanup. Basically ready for
5451 release. Only remaining thing: licence decision (LGPL?).
5453 release. Only remaining thing: licence decision (LGPL?).
5452
5454
5453 * Converted load_config to a class, ConfigLoader. Now recursion
5455 * Converted load_config to a class, ConfigLoader. Now recursion
5454 control is better organized. Doesn't include the same file twice.
5456 control is better organized. Doesn't include the same file twice.
5455
5457
5456 2001-11-29 Fernando Perez <fperez@colorado.edu>
5458 2001-11-29 Fernando Perez <fperez@colorado.edu>
5457
5459
5458 * Got input history working. Changed output history variables from
5460 * Got input history working. Changed output history variables from
5459 _p to _o so that _i is for input and _o for output. Just cleaner
5461 _p to _o so that _i is for input and _o for output. Just cleaner
5460 convention.
5462 convention.
5461
5463
5462 * Implemented parametric aliases. This pretty much allows the
5464 * Implemented parametric aliases. This pretty much allows the
5463 alias system to offer full-blown shell convenience, I think.
5465 alias system to offer full-blown shell convenience, I think.
5464
5466
5465 * Version 0.1.17 released, 0.1.18 opened.
5467 * Version 0.1.17 released, 0.1.18 opened.
5466
5468
5467 * dot_ipython/ipythonrc (alias): added documentation.
5469 * dot_ipython/ipythonrc (alias): added documentation.
5468 (xcolor): Fixed small bug (xcolors -> xcolor)
5470 (xcolor): Fixed small bug (xcolors -> xcolor)
5469
5471
5470 * Changed the alias system. Now alias is a magic command to define
5472 * Changed the alias system. Now alias is a magic command to define
5471 aliases just like the shell. Rationale: the builtin magics should
5473 aliases just like the shell. Rationale: the builtin magics should
5472 be there for things deeply connected to IPython's
5474 be there for things deeply connected to IPython's
5473 architecture. And this is a much lighter system for what I think
5475 architecture. And this is a much lighter system for what I think
5474 is the really important feature: allowing users to define quickly
5476 is the really important feature: allowing users to define quickly
5475 magics that will do shell things for them, so they can customize
5477 magics that will do shell things for them, so they can customize
5476 IPython easily to match their work habits. If someone is really
5478 IPython easily to match their work habits. If someone is really
5477 desperate to have another name for a builtin alias, they can
5479 desperate to have another name for a builtin alias, they can
5478 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5480 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5479 works.
5481 works.
5480
5482
5481 2001-11-28 Fernando Perez <fperez@colorado.edu>
5483 2001-11-28 Fernando Perez <fperez@colorado.edu>
5482
5484
5483 * Changed @file so that it opens the source file at the proper
5485 * Changed @file so that it opens the source file at the proper
5484 line. Since it uses less, if your EDITOR environment is
5486 line. Since it uses less, if your EDITOR environment is
5485 configured, typing v will immediately open your editor of choice
5487 configured, typing v will immediately open your editor of choice
5486 right at the line where the object is defined. Not as quick as
5488 right at the line where the object is defined. Not as quick as
5487 having a direct @edit command, but for all intents and purposes it
5489 having a direct @edit command, but for all intents and purposes it
5488 works. And I don't have to worry about writing @edit to deal with
5490 works. And I don't have to worry about writing @edit to deal with
5489 all the editors, less does that.
5491 all the editors, less does that.
5490
5492
5491 * Version 0.1.16 released, 0.1.17 opened.
5493 * Version 0.1.16 released, 0.1.17 opened.
5492
5494
5493 * Fixed some nasty bugs in the page/page_dumb combo that could
5495 * Fixed some nasty bugs in the page/page_dumb combo that could
5494 crash IPython.
5496 crash IPython.
5495
5497
5496 2001-11-27 Fernando Perez <fperez@colorado.edu>
5498 2001-11-27 Fernando Perez <fperez@colorado.edu>
5497
5499
5498 * Version 0.1.15 released, 0.1.16 opened.
5500 * Version 0.1.15 released, 0.1.16 opened.
5499
5501
5500 * Finally got ? and ?? to work for undefined things: now it's
5502 * Finally got ? and ?? to work for undefined things: now it's
5501 possible to type {}.get? and get information about the get method
5503 possible to type {}.get? and get information about the get method
5502 of dicts, or os.path? even if only os is defined (so technically
5504 of dicts, or os.path? even if only os is defined (so technically
5503 os.path isn't). Works at any level. For example, after import os,
5505 os.path isn't). Works at any level. For example, after import os,
5504 os?, os.path?, os.path.abspath? all work. This is great, took some
5506 os?, os.path?, os.path.abspath? all work. This is great, took some
5505 work in _ofind.
5507 work in _ofind.
5506
5508
5507 * Fixed more bugs with logging. The sanest way to do it was to add
5509 * Fixed more bugs with logging. The sanest way to do it was to add
5508 to @log a 'mode' parameter. Killed two in one shot (this mode
5510 to @log a 'mode' parameter. Killed two in one shot (this mode
5509 option was a request of Janko's). I think it's finally clean
5511 option was a request of Janko's). I think it's finally clean
5510 (famous last words).
5512 (famous last words).
5511
5513
5512 * Added a page_dumb() pager which does a decent job of paging on
5514 * Added a page_dumb() pager which does a decent job of paging on
5513 screen, if better things (like less) aren't available. One less
5515 screen, if better things (like less) aren't available. One less
5514 unix dependency (someday maybe somebody will port this to
5516 unix dependency (someday maybe somebody will port this to
5515 windows).
5517 windows).
5516
5518
5517 * Fixed problem in magic_log: would lock of logging out if log
5519 * Fixed problem in magic_log: would lock of logging out if log
5518 creation failed (because it would still think it had succeeded).
5520 creation failed (because it would still think it had succeeded).
5519
5521
5520 * Improved the page() function using curses to auto-detect screen
5522 * Improved the page() function using curses to auto-detect screen
5521 size. Now it can make a much better decision on whether to print
5523 size. Now it can make a much better decision on whether to print
5522 or page a string. Option screen_length was modified: a value 0
5524 or page a string. Option screen_length was modified: a value 0
5523 means auto-detect, and that's the default now.
5525 means auto-detect, and that's the default now.
5524
5526
5525 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5527 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5526 go out. I'll test it for a few days, then talk to Janko about
5528 go out. I'll test it for a few days, then talk to Janko about
5527 licences and announce it.
5529 licences and announce it.
5528
5530
5529 * Fixed the length of the auto-generated ---> prompt which appears
5531 * Fixed the length of the auto-generated ---> prompt which appears
5530 for auto-parens and auto-quotes. Getting this right isn't trivial,
5532 for auto-parens and auto-quotes. Getting this right isn't trivial,
5531 with all the color escapes, different prompt types and optional
5533 with all the color escapes, different prompt types and optional
5532 separators. But it seems to be working in all the combinations.
5534 separators. But it seems to be working in all the combinations.
5533
5535
5534 2001-11-26 Fernando Perez <fperez@colorado.edu>
5536 2001-11-26 Fernando Perez <fperez@colorado.edu>
5535
5537
5536 * Wrote a regexp filter to get option types from the option names
5538 * Wrote a regexp filter to get option types from the option names
5537 string. This eliminates the need to manually keep two duplicate
5539 string. This eliminates the need to manually keep two duplicate
5538 lists.
5540 lists.
5539
5541
5540 * Removed the unneeded check_option_names. Now options are handled
5542 * Removed the unneeded check_option_names. Now options are handled
5541 in a much saner manner and it's easy to visually check that things
5543 in a much saner manner and it's easy to visually check that things
5542 are ok.
5544 are ok.
5543
5545
5544 * Updated version numbers on all files I modified to carry a
5546 * Updated version numbers on all files I modified to carry a
5545 notice so Janko and Nathan have clear version markers.
5547 notice so Janko and Nathan have clear version markers.
5546
5548
5547 * Updated docstring for ultraTB with my changes. I should send
5549 * Updated docstring for ultraTB with my changes. I should send
5548 this to Nathan.
5550 this to Nathan.
5549
5551
5550 * Lots of small fixes. Ran everything through pychecker again.
5552 * Lots of small fixes. Ran everything through pychecker again.
5551
5553
5552 * Made loading of deep_reload an cmd line option. If it's not too
5554 * Made loading of deep_reload an cmd line option. If it's not too
5553 kosher, now people can just disable it. With -nodeep_reload it's
5555 kosher, now people can just disable it. With -nodeep_reload it's
5554 still available as dreload(), it just won't overwrite reload().
5556 still available as dreload(), it just won't overwrite reload().
5555
5557
5556 * Moved many options to the no| form (-opt and -noopt
5558 * Moved many options to the no| form (-opt and -noopt
5557 accepted). Cleaner.
5559 accepted). Cleaner.
5558
5560
5559 * Changed magic_log so that if called with no parameters, it uses
5561 * Changed magic_log so that if called with no parameters, it uses
5560 'rotate' mode. That way auto-generated logs aren't automatically
5562 'rotate' mode. That way auto-generated logs aren't automatically
5561 over-written. For normal logs, now a backup is made if it exists
5563 over-written. For normal logs, now a backup is made if it exists
5562 (only 1 level of backups). A new 'backup' mode was added to the
5564 (only 1 level of backups). A new 'backup' mode was added to the
5563 Logger class to support this. This was a request by Janko.
5565 Logger class to support this. This was a request by Janko.
5564
5566
5565 * Added @logoff/@logon to stop/restart an active log.
5567 * Added @logoff/@logon to stop/restart an active log.
5566
5568
5567 * Fixed a lot of bugs in log saving/replay. It was pretty
5569 * Fixed a lot of bugs in log saving/replay. It was pretty
5568 broken. Now special lines (!@,/) appear properly in the command
5570 broken. Now special lines (!@,/) appear properly in the command
5569 history after a log replay.
5571 history after a log replay.
5570
5572
5571 * Tried and failed to implement full session saving via pickle. My
5573 * Tried and failed to implement full session saving via pickle. My
5572 idea was to pickle __main__.__dict__, but modules can't be
5574 idea was to pickle __main__.__dict__, but modules can't be
5573 pickled. This would be a better alternative to replaying logs, but
5575 pickled. This would be a better alternative to replaying logs, but
5574 seems quite tricky to get to work. Changed -session to be called
5576 seems quite tricky to get to work. Changed -session to be called
5575 -logplay, which more accurately reflects what it does. And if we
5577 -logplay, which more accurately reflects what it does. And if we
5576 ever get real session saving working, -session is now available.
5578 ever get real session saving working, -session is now available.
5577
5579
5578 * Implemented color schemes for prompts also. As for tracebacks,
5580 * Implemented color schemes for prompts also. As for tracebacks,
5579 currently only NoColor and Linux are supported. But now the
5581 currently only NoColor and Linux are supported. But now the
5580 infrastructure is in place, based on a generic ColorScheme
5582 infrastructure is in place, based on a generic ColorScheme
5581 class. So writing and activating new schemes both for the prompts
5583 class. So writing and activating new schemes both for the prompts
5582 and the tracebacks should be straightforward.
5584 and the tracebacks should be straightforward.
5583
5585
5584 * Version 0.1.13 released, 0.1.14 opened.
5586 * Version 0.1.13 released, 0.1.14 opened.
5585
5587
5586 * Changed handling of options for output cache. Now counter is
5588 * Changed handling of options for output cache. Now counter is
5587 hardwired starting at 1 and one specifies the maximum number of
5589 hardwired starting at 1 and one specifies the maximum number of
5588 entries *in the outcache* (not the max prompt counter). This is
5590 entries *in the outcache* (not the max prompt counter). This is
5589 much better, since many statements won't increase the cache
5591 much better, since many statements won't increase the cache
5590 count. It also eliminated some confusing options, now there's only
5592 count. It also eliminated some confusing options, now there's only
5591 one: cache_size.
5593 one: cache_size.
5592
5594
5593 * Added 'alias' magic function and magic_alias option in the
5595 * Added 'alias' magic function and magic_alias option in the
5594 ipythonrc file. Now the user can easily define whatever names he
5596 ipythonrc file. Now the user can easily define whatever names he
5595 wants for the magic functions without having to play weird
5597 wants for the magic functions without having to play weird
5596 namespace games. This gives IPython a real shell-like feel.
5598 namespace games. This gives IPython a real shell-like feel.
5597
5599
5598 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5600 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5599 @ or not).
5601 @ or not).
5600
5602
5601 This was one of the last remaining 'visible' bugs (that I know
5603 This was one of the last remaining 'visible' bugs (that I know
5602 of). I think if I can clean up the session loading so it works
5604 of). I think if I can clean up the session loading so it works
5603 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5605 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5604 about licensing).
5606 about licensing).
5605
5607
5606 2001-11-25 Fernando Perez <fperez@colorado.edu>
5608 2001-11-25 Fernando Perez <fperez@colorado.edu>
5607
5609
5608 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5610 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5609 there's a cleaner distinction between what ? and ?? show.
5611 there's a cleaner distinction between what ? and ?? show.
5610
5612
5611 * Added screen_length option. Now the user can define his own
5613 * Added screen_length option. Now the user can define his own
5612 screen size for page() operations.
5614 screen size for page() operations.
5613
5615
5614 * Implemented magic shell-like functions with automatic code
5616 * Implemented magic shell-like functions with automatic code
5615 generation. Now adding another function is just a matter of adding
5617 generation. Now adding another function is just a matter of adding
5616 an entry to a dict, and the function is dynamically generated at
5618 an entry to a dict, and the function is dynamically generated at
5617 run-time. Python has some really cool features!
5619 run-time. Python has some really cool features!
5618
5620
5619 * Renamed many options to cleanup conventions a little. Now all
5621 * Renamed many options to cleanup conventions a little. Now all
5620 are lowercase, and only underscores where needed. Also in the code
5622 are lowercase, and only underscores where needed. Also in the code
5621 option name tables are clearer.
5623 option name tables are clearer.
5622
5624
5623 * Changed prompts a little. Now input is 'In [n]:' instead of
5625 * Changed prompts a little. Now input is 'In [n]:' instead of
5624 'In[n]:='. This allows it the numbers to be aligned with the
5626 'In[n]:='. This allows it the numbers to be aligned with the
5625 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5627 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5626 Python (it was a Mathematica thing). The '...' continuation prompt
5628 Python (it was a Mathematica thing). The '...' continuation prompt
5627 was also changed a little to align better.
5629 was also changed a little to align better.
5628
5630
5629 * Fixed bug when flushing output cache. Not all _p<n> variables
5631 * Fixed bug when flushing output cache. Not all _p<n> variables
5630 exist, so their deletion needs to be wrapped in a try:
5632 exist, so their deletion needs to be wrapped in a try:
5631
5633
5632 * Figured out how to properly use inspect.formatargspec() (it
5634 * Figured out how to properly use inspect.formatargspec() (it
5633 requires the args preceded by *). So I removed all the code from
5635 requires the args preceded by *). So I removed all the code from
5634 _get_pdef in Magic, which was just replicating that.
5636 _get_pdef in Magic, which was just replicating that.
5635
5637
5636 * Added test to prefilter to allow redefining magic function names
5638 * Added test to prefilter to allow redefining magic function names
5637 as variables. This is ok, since the @ form is always available,
5639 as variables. This is ok, since the @ form is always available,
5638 but whe should allow the user to define a variable called 'ls' if
5640 but whe should allow the user to define a variable called 'ls' if
5639 he needs it.
5641 he needs it.
5640
5642
5641 * Moved the ToDo information from README into a separate ToDo.
5643 * Moved the ToDo information from README into a separate ToDo.
5642
5644
5643 * General code cleanup and small bugfixes. I think it's close to a
5645 * General code cleanup and small bugfixes. I think it's close to a
5644 state where it can be released, obviously with a big 'beta'
5646 state where it can be released, obviously with a big 'beta'
5645 warning on it.
5647 warning on it.
5646
5648
5647 * Got the magic function split to work. Now all magics are defined
5649 * Got the magic function split to work. Now all magics are defined
5648 in a separate class. It just organizes things a bit, and now
5650 in a separate class. It just organizes things a bit, and now
5649 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5651 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5650 was too long).
5652 was too long).
5651
5653
5652 * Changed @clear to @reset to avoid potential confusions with
5654 * Changed @clear to @reset to avoid potential confusions with
5653 the shell command clear. Also renamed @cl to @clear, which does
5655 the shell command clear. Also renamed @cl to @clear, which does
5654 exactly what people expect it to from their shell experience.
5656 exactly what people expect it to from their shell experience.
5655
5657
5656 Added a check to the @reset command (since it's so
5658 Added a check to the @reset command (since it's so
5657 destructive, it's probably a good idea to ask for confirmation).
5659 destructive, it's probably a good idea to ask for confirmation).
5658 But now reset only works for full namespace resetting. Since the
5660 But now reset only works for full namespace resetting. Since the
5659 del keyword is already there for deleting a few specific
5661 del keyword is already there for deleting a few specific
5660 variables, I don't see the point of having a redundant magic
5662 variables, I don't see the point of having a redundant magic
5661 function for the same task.
5663 function for the same task.
5662
5664
5663 2001-11-24 Fernando Perez <fperez@colorado.edu>
5665 2001-11-24 Fernando Perez <fperez@colorado.edu>
5664
5666
5665 * Updated the builtin docs (esp. the ? ones).
5667 * Updated the builtin docs (esp. the ? ones).
5666
5668
5667 * Ran all the code through pychecker. Not terribly impressed with
5669 * Ran all the code through pychecker. Not terribly impressed with
5668 it: lots of spurious warnings and didn't really find anything of
5670 it: lots of spurious warnings and didn't really find anything of
5669 substance (just a few modules being imported and not used).
5671 substance (just a few modules being imported and not used).
5670
5672
5671 * Implemented the new ultraTB functionality into IPython. New
5673 * Implemented the new ultraTB functionality into IPython. New
5672 option: xcolors. This chooses color scheme. xmode now only selects
5674 option: xcolors. This chooses color scheme. xmode now only selects
5673 between Plain and Verbose. Better orthogonality.
5675 between Plain and Verbose. Better orthogonality.
5674
5676
5675 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5677 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5676 mode and color scheme for the exception handlers. Now it's
5678 mode and color scheme for the exception handlers. Now it's
5677 possible to have the verbose traceback with no coloring.
5679 possible to have the verbose traceback with no coloring.
5678
5680
5679 2001-11-23 Fernando Perez <fperez@colorado.edu>
5681 2001-11-23 Fernando Perez <fperez@colorado.edu>
5680
5682
5681 * Version 0.1.12 released, 0.1.13 opened.
5683 * Version 0.1.12 released, 0.1.13 opened.
5682
5684
5683 * Removed option to set auto-quote and auto-paren escapes by
5685 * Removed option to set auto-quote and auto-paren escapes by
5684 user. The chances of breaking valid syntax are just too high. If
5686 user. The chances of breaking valid syntax are just too high. If
5685 someone *really* wants, they can always dig into the code.
5687 someone *really* wants, they can always dig into the code.
5686
5688
5687 * Made prompt separators configurable.
5689 * Made prompt separators configurable.
5688
5690
5689 2001-11-22 Fernando Perez <fperez@colorado.edu>
5691 2001-11-22 Fernando Perez <fperez@colorado.edu>
5690
5692
5691 * Small bugfixes in many places.
5693 * Small bugfixes in many places.
5692
5694
5693 * Removed the MyCompleter class from ipplib. It seemed redundant
5695 * Removed the MyCompleter class from ipplib. It seemed redundant
5694 with the C-p,C-n history search functionality. Less code to
5696 with the C-p,C-n history search functionality. Less code to
5695 maintain.
5697 maintain.
5696
5698
5697 * Moved all the original ipython.py code into ipythonlib.py. Right
5699 * Moved all the original ipython.py code into ipythonlib.py. Right
5698 now it's just one big dump into a function called make_IPython, so
5700 now it's just one big dump into a function called make_IPython, so
5699 no real modularity has been gained. But at least it makes the
5701 no real modularity has been gained. But at least it makes the
5700 wrapper script tiny, and since ipythonlib is a module, it gets
5702 wrapper script tiny, and since ipythonlib is a module, it gets
5701 compiled and startup is much faster.
5703 compiled and startup is much faster.
5702
5704
5703 This is a reasobably 'deep' change, so we should test it for a
5705 This is a reasobably 'deep' change, so we should test it for a
5704 while without messing too much more with the code.
5706 while without messing too much more with the code.
5705
5707
5706 2001-11-21 Fernando Perez <fperez@colorado.edu>
5708 2001-11-21 Fernando Perez <fperez@colorado.edu>
5707
5709
5708 * Version 0.1.11 released, 0.1.12 opened for further work.
5710 * Version 0.1.11 released, 0.1.12 opened for further work.
5709
5711
5710 * Removed dependency on Itpl. It was only needed in one place. It
5712 * Removed dependency on Itpl. It was only needed in one place. It
5711 would be nice if this became part of python, though. It makes life
5713 would be nice if this became part of python, though. It makes life
5712 *a lot* easier in some cases.
5714 *a lot* easier in some cases.
5713
5715
5714 * Simplified the prefilter code a bit. Now all handlers are
5716 * Simplified the prefilter code a bit. Now all handlers are
5715 expected to explicitly return a value (at least a blank string).
5717 expected to explicitly return a value (at least a blank string).
5716
5718
5717 * Heavy edits in ipplib. Removed the help system altogether. Now
5719 * Heavy edits in ipplib. Removed the help system altogether. Now
5718 obj?/?? is used for inspecting objects, a magic @doc prints
5720 obj?/?? is used for inspecting objects, a magic @doc prints
5719 docstrings, and full-blown Python help is accessed via the 'help'
5721 docstrings, and full-blown Python help is accessed via the 'help'
5720 keyword. This cleans up a lot of code (less to maintain) and does
5722 keyword. This cleans up a lot of code (less to maintain) and does
5721 the job. Since 'help' is now a standard Python component, might as
5723 the job. Since 'help' is now a standard Python component, might as
5722 well use it and remove duplicate functionality.
5724 well use it and remove duplicate functionality.
5723
5725
5724 Also removed the option to use ipplib as a standalone program. By
5726 Also removed the option to use ipplib as a standalone program. By
5725 now it's too dependent on other parts of IPython to function alone.
5727 now it's too dependent on other parts of IPython to function alone.
5726
5728
5727 * Fixed bug in genutils.pager. It would crash if the pager was
5729 * Fixed bug in genutils.pager. It would crash if the pager was
5728 exited immediately after opening (broken pipe).
5730 exited immediately after opening (broken pipe).
5729
5731
5730 * Trimmed down the VerboseTB reporting a little. The header is
5732 * Trimmed down the VerboseTB reporting a little. The header is
5731 much shorter now and the repeated exception arguments at the end
5733 much shorter now and the repeated exception arguments at the end
5732 have been removed. For interactive use the old header seemed a bit
5734 have been removed. For interactive use the old header seemed a bit
5733 excessive.
5735 excessive.
5734
5736
5735 * Fixed small bug in output of @whos for variables with multi-word
5737 * Fixed small bug in output of @whos for variables with multi-word
5736 types (only first word was displayed).
5738 types (only first word was displayed).
5737
5739
5738 2001-11-17 Fernando Perez <fperez@colorado.edu>
5740 2001-11-17 Fernando Perez <fperez@colorado.edu>
5739
5741
5740 * Version 0.1.10 released, 0.1.11 opened for further work.
5742 * Version 0.1.10 released, 0.1.11 opened for further work.
5741
5743
5742 * Modified dirs and friends. dirs now *returns* the stack (not
5744 * Modified dirs and friends. dirs now *returns* the stack (not
5743 prints), so one can manipulate it as a variable. Convenient to
5745 prints), so one can manipulate it as a variable. Convenient to
5744 travel along many directories.
5746 travel along many directories.
5745
5747
5746 * Fixed bug in magic_pdef: would only work with functions with
5748 * Fixed bug in magic_pdef: would only work with functions with
5747 arguments with default values.
5749 arguments with default values.
5748
5750
5749 2001-11-14 Fernando Perez <fperez@colorado.edu>
5751 2001-11-14 Fernando Perez <fperez@colorado.edu>
5750
5752
5751 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5753 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5752 example with IPython. Various other minor fixes and cleanups.
5754 example with IPython. Various other minor fixes and cleanups.
5753
5755
5754 * Version 0.1.9 released, 0.1.10 opened for further work.
5756 * Version 0.1.9 released, 0.1.10 opened for further work.
5755
5757
5756 * Added sys.path to the list of directories searched in the
5758 * Added sys.path to the list of directories searched in the
5757 execfile= option. It used to be the current directory and the
5759 execfile= option. It used to be the current directory and the
5758 user's IPYTHONDIR only.
5760 user's IPYTHONDIR only.
5759
5761
5760 2001-11-13 Fernando Perez <fperez@colorado.edu>
5762 2001-11-13 Fernando Perez <fperez@colorado.edu>
5761
5763
5762 * Reinstated the raw_input/prefilter separation that Janko had
5764 * Reinstated the raw_input/prefilter separation that Janko had
5763 initially. This gives a more convenient setup for extending the
5765 initially. This gives a more convenient setup for extending the
5764 pre-processor from the outside: raw_input always gets a string,
5766 pre-processor from the outside: raw_input always gets a string,
5765 and prefilter has to process it. We can then redefine prefilter
5767 and prefilter has to process it. We can then redefine prefilter
5766 from the outside and implement extensions for special
5768 from the outside and implement extensions for special
5767 purposes.
5769 purposes.
5768
5770
5769 Today I got one for inputting PhysicalQuantity objects
5771 Today I got one for inputting PhysicalQuantity objects
5770 (from Scientific) without needing any function calls at
5772 (from Scientific) without needing any function calls at
5771 all. Extremely convenient, and it's all done as a user-level
5773 all. Extremely convenient, and it's all done as a user-level
5772 extension (no IPython code was touched). Now instead of:
5774 extension (no IPython code was touched). Now instead of:
5773 a = PhysicalQuantity(4.2,'m/s**2')
5775 a = PhysicalQuantity(4.2,'m/s**2')
5774 one can simply say
5776 one can simply say
5775 a = 4.2 m/s**2
5777 a = 4.2 m/s**2
5776 or even
5778 or even
5777 a = 4.2 m/s^2
5779 a = 4.2 m/s^2
5778
5780
5779 I use this, but it's also a proof of concept: IPython really is
5781 I use this, but it's also a proof of concept: IPython really is
5780 fully user-extensible, even at the level of the parsing of the
5782 fully user-extensible, even at the level of the parsing of the
5781 command line. It's not trivial, but it's perfectly doable.
5783 command line. It's not trivial, but it's perfectly doable.
5782
5784
5783 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5785 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5784 the problem of modules being loaded in the inverse order in which
5786 the problem of modules being loaded in the inverse order in which
5785 they were defined in
5787 they were defined in
5786
5788
5787 * Version 0.1.8 released, 0.1.9 opened for further work.
5789 * Version 0.1.8 released, 0.1.9 opened for further work.
5788
5790
5789 * Added magics pdef, source and file. They respectively show the
5791 * Added magics pdef, source and file. They respectively show the
5790 definition line ('prototype' in C), source code and full python
5792 definition line ('prototype' in C), source code and full python
5791 file for any callable object. The object inspector oinfo uses
5793 file for any callable object. The object inspector oinfo uses
5792 these to show the same information.
5794 these to show the same information.
5793
5795
5794 * Version 0.1.7 released, 0.1.8 opened for further work.
5796 * Version 0.1.7 released, 0.1.8 opened for further work.
5795
5797
5796 * Separated all the magic functions into a class called Magic. The
5798 * Separated all the magic functions into a class called Magic. The
5797 InteractiveShell class was becoming too big for Xemacs to handle
5799 InteractiveShell class was becoming too big for Xemacs to handle
5798 (de-indenting a line would lock it up for 10 seconds while it
5800 (de-indenting a line would lock it up for 10 seconds while it
5799 backtracked on the whole class!)
5801 backtracked on the whole class!)
5800
5802
5801 FIXME: didn't work. It can be done, but right now namespaces are
5803 FIXME: didn't work. It can be done, but right now namespaces are
5802 all messed up. Do it later (reverted it for now, so at least
5804 all messed up. Do it later (reverted it for now, so at least
5803 everything works as before).
5805 everything works as before).
5804
5806
5805 * Got the object introspection system (magic_oinfo) working! I
5807 * Got the object introspection system (magic_oinfo) working! I
5806 think this is pretty much ready for release to Janko, so he can
5808 think this is pretty much ready for release to Janko, so he can
5807 test it for a while and then announce it. Pretty much 100% of what
5809 test it for a while and then announce it. Pretty much 100% of what
5808 I wanted for the 'phase 1' release is ready. Happy, tired.
5810 I wanted for the 'phase 1' release is ready. Happy, tired.
5809
5811
5810 2001-11-12 Fernando Perez <fperez@colorado.edu>
5812 2001-11-12 Fernando Perez <fperez@colorado.edu>
5811
5813
5812 * Version 0.1.6 released, 0.1.7 opened for further work.
5814 * Version 0.1.6 released, 0.1.7 opened for further work.
5813
5815
5814 * Fixed bug in printing: it used to test for truth before
5816 * Fixed bug in printing: it used to test for truth before
5815 printing, so 0 wouldn't print. Now checks for None.
5817 printing, so 0 wouldn't print. Now checks for None.
5816
5818
5817 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5819 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5818 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5820 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5819 reaches by hand into the outputcache. Think of a better way to do
5821 reaches by hand into the outputcache. Think of a better way to do
5820 this later.
5822 this later.
5821
5823
5822 * Various small fixes thanks to Nathan's comments.
5824 * Various small fixes thanks to Nathan's comments.
5823
5825
5824 * Changed magic_pprint to magic_Pprint. This way it doesn't
5826 * Changed magic_pprint to magic_Pprint. This way it doesn't
5825 collide with pprint() and the name is consistent with the command
5827 collide with pprint() and the name is consistent with the command
5826 line option.
5828 line option.
5827
5829
5828 * Changed prompt counter behavior to be fully like
5830 * Changed prompt counter behavior to be fully like
5829 Mathematica's. That is, even input that doesn't return a result
5831 Mathematica's. That is, even input that doesn't return a result
5830 raises the prompt counter. The old behavior was kind of confusing
5832 raises the prompt counter. The old behavior was kind of confusing
5831 (getting the same prompt number several times if the operation
5833 (getting the same prompt number several times if the operation
5832 didn't return a result).
5834 didn't return a result).
5833
5835
5834 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5836 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5835
5837
5836 * Fixed -Classic mode (wasn't working anymore).
5838 * Fixed -Classic mode (wasn't working anymore).
5837
5839
5838 * Added colored prompts using Nathan's new code. Colors are
5840 * Added colored prompts using Nathan's new code. Colors are
5839 currently hardwired, they can be user-configurable. For
5841 currently hardwired, they can be user-configurable. For
5840 developers, they can be chosen in file ipythonlib.py, at the
5842 developers, they can be chosen in file ipythonlib.py, at the
5841 beginning of the CachedOutput class def.
5843 beginning of the CachedOutput class def.
5842
5844
5843 2001-11-11 Fernando Perez <fperez@colorado.edu>
5845 2001-11-11 Fernando Perez <fperez@colorado.edu>
5844
5846
5845 * Version 0.1.5 released, 0.1.6 opened for further work.
5847 * Version 0.1.5 released, 0.1.6 opened for further work.
5846
5848
5847 * Changed magic_env to *return* the environment as a dict (not to
5849 * Changed magic_env to *return* the environment as a dict (not to
5848 print it). This way it prints, but it can also be processed.
5850 print it). This way it prints, but it can also be processed.
5849
5851
5850 * Added Verbose exception reporting to interactive
5852 * Added Verbose exception reporting to interactive
5851 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5853 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5852 traceback. Had to make some changes to the ultraTB file. This is
5854 traceback. Had to make some changes to the ultraTB file. This is
5853 probably the last 'big' thing in my mental todo list. This ties
5855 probably the last 'big' thing in my mental todo list. This ties
5854 in with the next entry:
5856 in with the next entry:
5855
5857
5856 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5858 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5857 has to specify is Plain, Color or Verbose for all exception
5859 has to specify is Plain, Color or Verbose for all exception
5858 handling.
5860 handling.
5859
5861
5860 * Removed ShellServices option. All this can really be done via
5862 * Removed ShellServices option. All this can really be done via
5861 the magic system. It's easier to extend, cleaner and has automatic
5863 the magic system. It's easier to extend, cleaner and has automatic
5862 namespace protection and documentation.
5864 namespace protection and documentation.
5863
5865
5864 2001-11-09 Fernando Perez <fperez@colorado.edu>
5866 2001-11-09 Fernando Perez <fperez@colorado.edu>
5865
5867
5866 * Fixed bug in output cache flushing (missing parameter to
5868 * Fixed bug in output cache flushing (missing parameter to
5867 __init__). Other small bugs fixed (found using pychecker).
5869 __init__). Other small bugs fixed (found using pychecker).
5868
5870
5869 * Version 0.1.4 opened for bugfixing.
5871 * Version 0.1.4 opened for bugfixing.
5870
5872
5871 2001-11-07 Fernando Perez <fperez@colorado.edu>
5873 2001-11-07 Fernando Perez <fperez@colorado.edu>
5872
5874
5873 * Version 0.1.3 released, mainly because of the raw_input bug.
5875 * Version 0.1.3 released, mainly because of the raw_input bug.
5874
5876
5875 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5877 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5876 and when testing for whether things were callable, a call could
5878 and when testing for whether things were callable, a call could
5877 actually be made to certain functions. They would get called again
5879 actually be made to certain functions. They would get called again
5878 once 'really' executed, with a resulting double call. A disaster
5880 once 'really' executed, with a resulting double call. A disaster
5879 in many cases (list.reverse() would never work!).
5881 in many cases (list.reverse() would never work!).
5880
5882
5881 * Removed prefilter() function, moved its code to raw_input (which
5883 * Removed prefilter() function, moved its code to raw_input (which
5882 after all was just a near-empty caller for prefilter). This saves
5884 after all was just a near-empty caller for prefilter). This saves
5883 a function call on every prompt, and simplifies the class a tiny bit.
5885 a function call on every prompt, and simplifies the class a tiny bit.
5884
5886
5885 * Fix _ip to __ip name in magic example file.
5887 * Fix _ip to __ip name in magic example file.
5886
5888
5887 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5889 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5888 work with non-gnu versions of tar.
5890 work with non-gnu versions of tar.
5889
5891
5890 2001-11-06 Fernando Perez <fperez@colorado.edu>
5892 2001-11-06 Fernando Perez <fperez@colorado.edu>
5891
5893
5892 * Version 0.1.2. Just to keep track of the recent changes.
5894 * Version 0.1.2. Just to keep track of the recent changes.
5893
5895
5894 * Fixed nasty bug in output prompt routine. It used to check 'if
5896 * Fixed nasty bug in output prompt routine. It used to check 'if
5895 arg != None...'. Problem is, this fails if arg implements a
5897 arg != None...'. Problem is, this fails if arg implements a
5896 special comparison (__cmp__) which disallows comparing to
5898 special comparison (__cmp__) which disallows comparing to
5897 None. Found it when trying to use the PhysicalQuantity module from
5899 None. Found it when trying to use the PhysicalQuantity module from
5898 ScientificPython.
5900 ScientificPython.
5899
5901
5900 2001-11-05 Fernando Perez <fperez@colorado.edu>
5902 2001-11-05 Fernando Perez <fperez@colorado.edu>
5901
5903
5902 * Also added dirs. Now the pushd/popd/dirs family functions
5904 * Also added dirs. Now the pushd/popd/dirs family functions
5903 basically like the shell, with the added convenience of going home
5905 basically like the shell, with the added convenience of going home
5904 when called with no args.
5906 when called with no args.
5905
5907
5906 * pushd/popd slightly modified to mimic shell behavior more
5908 * pushd/popd slightly modified to mimic shell behavior more
5907 closely.
5909 closely.
5908
5910
5909 * Added env,pushd,popd from ShellServices as magic functions. I
5911 * Added env,pushd,popd from ShellServices as magic functions. I
5910 think the cleanest will be to port all desired functions from
5912 think the cleanest will be to port all desired functions from
5911 ShellServices as magics and remove ShellServices altogether. This
5913 ShellServices as magics and remove ShellServices altogether. This
5912 will provide a single, clean way of adding functionality
5914 will provide a single, clean way of adding functionality
5913 (shell-type or otherwise) to IP.
5915 (shell-type or otherwise) to IP.
5914
5916
5915 2001-11-04 Fernando Perez <fperez@colorado.edu>
5917 2001-11-04 Fernando Perez <fperez@colorado.edu>
5916
5918
5917 * Added .ipython/ directory to sys.path. This way users can keep
5919 * Added .ipython/ directory to sys.path. This way users can keep
5918 customizations there and access them via import.
5920 customizations there and access them via import.
5919
5921
5920 2001-11-03 Fernando Perez <fperez@colorado.edu>
5922 2001-11-03 Fernando Perez <fperez@colorado.edu>
5921
5923
5922 * Opened version 0.1.1 for new changes.
5924 * Opened version 0.1.1 for new changes.
5923
5925
5924 * Changed version number to 0.1.0: first 'public' release, sent to
5926 * Changed version number to 0.1.0: first 'public' release, sent to
5925 Nathan and Janko.
5927 Nathan and Janko.
5926
5928
5927 * Lots of small fixes and tweaks.
5929 * Lots of small fixes and tweaks.
5928
5930
5929 * Minor changes to whos format. Now strings are shown, snipped if
5931 * Minor changes to whos format. Now strings are shown, snipped if
5930 too long.
5932 too long.
5931
5933
5932 * Changed ShellServices to work on __main__ so they show up in @who
5934 * Changed ShellServices to work on __main__ so they show up in @who
5933
5935
5934 * Help also works with ? at the end of a line:
5936 * Help also works with ? at the end of a line:
5935 ?sin and sin?
5937 ?sin and sin?
5936 both produce the same effect. This is nice, as often I use the
5938 both produce the same effect. This is nice, as often I use the
5937 tab-complete to find the name of a method, but I used to then have
5939 tab-complete to find the name of a method, but I used to then have
5938 to go to the beginning of the line to put a ? if I wanted more
5940 to go to the beginning of the line to put a ? if I wanted more
5939 info. Now I can just add the ? and hit return. Convenient.
5941 info. Now I can just add the ? and hit return. Convenient.
5940
5942
5941 2001-11-02 Fernando Perez <fperez@colorado.edu>
5943 2001-11-02 Fernando Perez <fperez@colorado.edu>
5942
5944
5943 * Python version check (>=2.1) added.
5945 * Python version check (>=2.1) added.
5944
5946
5945 * Added LazyPython documentation. At this point the docs are quite
5947 * Added LazyPython documentation. At this point the docs are quite
5946 a mess. A cleanup is in order.
5948 a mess. A cleanup is in order.
5947
5949
5948 * Auto-installer created. For some bizarre reason, the zipfiles
5950 * Auto-installer created. For some bizarre reason, the zipfiles
5949 module isn't working on my system. So I made a tar version
5951 module isn't working on my system. So I made a tar version
5950 (hopefully the command line options in various systems won't kill
5952 (hopefully the command line options in various systems won't kill
5951 me).
5953 me).
5952
5954
5953 * Fixes to Struct in genutils. Now all dictionary-like methods are
5955 * Fixes to Struct in genutils. Now all dictionary-like methods are
5954 protected (reasonably).
5956 protected (reasonably).
5955
5957
5956 * Added pager function to genutils and changed ? to print usage
5958 * Added pager function to genutils and changed ? to print usage
5957 note through it (it was too long).
5959 note through it (it was too long).
5958
5960
5959 * Added the LazyPython functionality. Works great! I changed the
5961 * Added the LazyPython functionality. Works great! I changed the
5960 auto-quote escape to ';', it's on home row and next to '. But
5962 auto-quote escape to ';', it's on home row and next to '. But
5961 both auto-quote and auto-paren (still /) escapes are command-line
5963 both auto-quote and auto-paren (still /) escapes are command-line
5962 parameters.
5964 parameters.
5963
5965
5964
5966
5965 2001-11-01 Fernando Perez <fperez@colorado.edu>
5967 2001-11-01 Fernando Perez <fperez@colorado.edu>
5966
5968
5967 * Version changed to 0.0.7. Fairly large change: configuration now
5969 * Version changed to 0.0.7. Fairly large change: configuration now
5968 is all stored in a directory, by default .ipython. There, all
5970 is all stored in a directory, by default .ipython. There, all
5969 config files have normal looking names (not .names)
5971 config files have normal looking names (not .names)
5970
5972
5971 * Version 0.0.6 Released first to Lucas and Archie as a test
5973 * Version 0.0.6 Released first to Lucas and Archie as a test
5972 run. Since it's the first 'semi-public' release, change version to
5974 run. Since it's the first 'semi-public' release, change version to
5973 > 0.0.6 for any changes now.
5975 > 0.0.6 for any changes now.
5974
5976
5975 * Stuff I had put in the ipplib.py changelog:
5977 * Stuff I had put in the ipplib.py changelog:
5976
5978
5977 Changes to InteractiveShell:
5979 Changes to InteractiveShell:
5978
5980
5979 - Made the usage message a parameter.
5981 - Made the usage message a parameter.
5980
5982
5981 - Require the name of the shell variable to be given. It's a bit
5983 - Require the name of the shell variable to be given. It's a bit
5982 of a hack, but allows the name 'shell' not to be hardwired in the
5984 of a hack, but allows the name 'shell' not to be hardwired in the
5983 magic (@) handler, which is problematic b/c it requires
5985 magic (@) handler, which is problematic b/c it requires
5984 polluting the global namespace with 'shell'. This in turn is
5986 polluting the global namespace with 'shell'. This in turn is
5985 fragile: if a user redefines a variable called shell, things
5987 fragile: if a user redefines a variable called shell, things
5986 break.
5988 break.
5987
5989
5988 - magic @: all functions available through @ need to be defined
5990 - magic @: all functions available through @ need to be defined
5989 as magic_<name>, even though they can be called simply as
5991 as magic_<name>, even though they can be called simply as
5990 @<name>. This allows the special command @magic to gather
5992 @<name>. This allows the special command @magic to gather
5991 information automatically about all existing magic functions,
5993 information automatically about all existing magic functions,
5992 even if they are run-time user extensions, by parsing the shell
5994 even if they are run-time user extensions, by parsing the shell
5993 instance __dict__ looking for special magic_ names.
5995 instance __dict__ looking for special magic_ names.
5994
5996
5995 - mainloop: added *two* local namespace parameters. This allows
5997 - mainloop: added *two* local namespace parameters. This allows
5996 the class to differentiate between parameters which were there
5998 the class to differentiate between parameters which were there
5997 before and after command line initialization was processed. This
5999 before and after command line initialization was processed. This
5998 way, later @who can show things loaded at startup by the
6000 way, later @who can show things loaded at startup by the
5999 user. This trick was necessary to make session saving/reloading
6001 user. This trick was necessary to make session saving/reloading
6000 really work: ideally after saving/exiting/reloading a session,
6002 really work: ideally after saving/exiting/reloading a session,
6001 *everything* should look the same, including the output of @who. I
6003 *everything* should look the same, including the output of @who. I
6002 was only able to make this work with this double namespace
6004 was only able to make this work with this double namespace
6003 trick.
6005 trick.
6004
6006
6005 - added a header to the logfile which allows (almost) full
6007 - added a header to the logfile which allows (almost) full
6006 session restoring.
6008 session restoring.
6007
6009
6008 - prepend lines beginning with @ or !, with a and log
6010 - prepend lines beginning with @ or !, with a and log
6009 them. Why? !lines: may be useful to know what you did @lines:
6011 them. Why? !lines: may be useful to know what you did @lines:
6010 they may affect session state. So when restoring a session, at
6012 they may affect session state. So when restoring a session, at
6011 least inform the user of their presence. I couldn't quite get
6013 least inform the user of their presence. I couldn't quite get
6012 them to properly re-execute, but at least the user is warned.
6014 them to properly re-execute, but at least the user is warned.
6013
6015
6014 * Started ChangeLog.
6016 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now