##// END OF EJS Templates
Fix profiler stats problem with python2.5
fperez -
Show More
@@ -1,3085 +1,3096 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 2122 2007-03-01 02:27:11Z fperez $"""
4 $Id: Magic.py 2153 2007-03-18 22:53:18Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
8 # Copyright (C) 2001-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 #print 'oname_rest:', oname_rest # dbg
213 #print 'oname_rest:', oname_rest # dbg
214 for part in oname_rest:
214 for part in oname_rest:
215 try:
215 try:
216 parent = obj
216 parent = obj
217 obj = getattr(obj,part)
217 obj = getattr(obj,part)
218 except:
218 except:
219 # Blanket except b/c some badly implemented objects
219 # Blanket except b/c some badly implemented objects
220 # allow __getattr__ to raise exceptions other than
220 # allow __getattr__ to raise exceptions other than
221 # AttributeError, which then crashes IPython.
221 # AttributeError, which then crashes IPython.
222 break
222 break
223 else:
223 else:
224 # If we finish the for loop (no break), we got all members
224 # If we finish the for loop (no break), we got all members
225 found = 1
225 found = 1
226 ospace = nsname
226 ospace = nsname
227 if ns == alias_ns:
227 if ns == alias_ns:
228 isalias = 1
228 isalias = 1
229 break # namespace loop
229 break # namespace loop
230
230
231 # Try to see if it's magic
231 # Try to see if it's magic
232 if not found:
232 if not found:
233 if oname.startswith(self.shell.ESC_MAGIC):
233 if oname.startswith(self.shell.ESC_MAGIC):
234 oname = oname[1:]
234 oname = oname[1:]
235 obj = getattr(self,'magic_'+oname,None)
235 obj = getattr(self,'magic_'+oname,None)
236 if obj is not None:
236 if obj is not None:
237 found = 1
237 found = 1
238 ospace = 'IPython internal'
238 ospace = 'IPython internal'
239 ismagic = 1
239 ismagic = 1
240
240
241 # Last try: special-case some literals like '', [], {}, etc:
241 # Last try: special-case some literals like '', [], {}, etc:
242 if not found and oname_head in ["''",'""','[]','{}','()']:
242 if not found and oname_head in ["''",'""','[]','{}','()']:
243 obj = eval(oname_head)
243 obj = eval(oname_head)
244 found = 1
244 found = 1
245 ospace = 'Interactive'
245 ospace = 'Interactive'
246
246
247 return {'found':found, 'obj':obj, 'namespace':ospace,
247 return {'found':found, 'obj':obj, 'namespace':ospace,
248 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
248 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
249
249
250 def arg_err(self,func):
250 def arg_err(self,func):
251 """Print docstring if incorrect arguments were passed"""
251 """Print docstring if incorrect arguments were passed"""
252 print 'Error in arguments:'
252 print 'Error in arguments:'
253 print OInspect.getdoc(func)
253 print OInspect.getdoc(func)
254
254
255 def format_latex(self,strng):
255 def format_latex(self,strng):
256 """Format a string for latex inclusion."""
256 """Format a string for latex inclusion."""
257
257
258 # Characters that need to be escaped for latex:
258 # Characters that need to be escaped for latex:
259 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
259 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
260 # Magic command names as headers:
260 # Magic command names as headers:
261 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
261 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
262 re.MULTILINE)
262 re.MULTILINE)
263 # Magic commands
263 # Magic commands
264 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
264 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
265 re.MULTILINE)
265 re.MULTILINE)
266 # Paragraph continue
266 # Paragraph continue
267 par_re = re.compile(r'\\$',re.MULTILINE)
267 par_re = re.compile(r'\\$',re.MULTILINE)
268
268
269 # The "\n" symbol
269 # The "\n" symbol
270 newline_re = re.compile(r'\\n')
270 newline_re = re.compile(r'\\n')
271
271
272 # Now build the string for output:
272 # Now build the string for output:
273 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
273 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
274 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
274 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
275 strng)
275 strng)
276 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
276 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
277 strng = par_re.sub(r'\\\\',strng)
277 strng = par_re.sub(r'\\\\',strng)
278 strng = escape_re.sub(r'\\\1',strng)
278 strng = escape_re.sub(r'\\\1',strng)
279 strng = newline_re.sub(r'\\textbackslash{}n',strng)
279 strng = newline_re.sub(r'\\textbackslash{}n',strng)
280 return strng
280 return strng
281
281
282 def format_screen(self,strng):
282 def format_screen(self,strng):
283 """Format a string for screen printing.
283 """Format a string for screen printing.
284
284
285 This removes some latex-type format codes."""
285 This removes some latex-type format codes."""
286 # Paragraph continue
286 # Paragraph continue
287 par_re = re.compile(r'\\$',re.MULTILINE)
287 par_re = re.compile(r'\\$',re.MULTILINE)
288 strng = par_re.sub('',strng)
288 strng = par_re.sub('',strng)
289 return strng
289 return strng
290
290
291 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
291 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
292 """Parse options passed to an argument string.
292 """Parse options passed to an argument string.
293
293
294 The interface is similar to that of getopt(), but it returns back a
294 The interface is similar to that of getopt(), but it returns back a
295 Struct with the options as keys and the stripped argument string still
295 Struct with the options as keys and the stripped argument string still
296 as a string.
296 as a string.
297
297
298 arg_str is quoted as a true sys.argv vector by using shlex.split.
298 arg_str is quoted as a true sys.argv vector by using shlex.split.
299 This allows us to easily expand variables, glob files, quote
299 This allows us to easily expand variables, glob files, quote
300 arguments, etc.
300 arguments, etc.
301
301
302 Options:
302 Options:
303 -mode: default 'string'. If given as 'list', the argument string is
303 -mode: default 'string'. If given as 'list', the argument string is
304 returned as a list (split on whitespace) instead of a string.
304 returned as a list (split on whitespace) instead of a string.
305
305
306 -list_all: put all option values in lists. Normally only options
306 -list_all: put all option values in lists. Normally only options
307 appearing more than once are put in a list.
307 appearing more than once are put in a list.
308
308
309 -posix (True): whether to split the input line in POSIX mode or not,
309 -posix (True): whether to split the input line in POSIX mode or not,
310 as per the conventions outlined in the shlex module from the
310 as per the conventions outlined in the shlex module from the
311 standard library."""
311 standard library."""
312
312
313 # inject default options at the beginning of the input line
313 # inject default options at the beginning of the input line
314 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
314 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
315 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
315 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
316
316
317 mode = kw.get('mode','string')
317 mode = kw.get('mode','string')
318 if mode not in ['string','list']:
318 if mode not in ['string','list']:
319 raise ValueError,'incorrect mode given: %s' % mode
319 raise ValueError,'incorrect mode given: %s' % mode
320 # Get options
320 # Get options
321 list_all = kw.get('list_all',0)
321 list_all = kw.get('list_all',0)
322 posix = kw.get('posix',True)
322 posix = kw.get('posix',True)
323
323
324 # Check if we have more than one argument to warrant extra processing:
324 # Check if we have more than one argument to warrant extra processing:
325 odict = {} # Dictionary with options
325 odict = {} # Dictionary with options
326 args = arg_str.split()
326 args = arg_str.split()
327 if len(args) >= 1:
327 if len(args) >= 1:
328 # If the list of inputs only has 0 or 1 thing in it, there's no
328 # If the list of inputs only has 0 or 1 thing in it, there's no
329 # need to look for options
329 # need to look for options
330 argv = arg_split(arg_str,posix)
330 argv = arg_split(arg_str,posix)
331 # Do regular option processing
331 # Do regular option processing
332 try:
332 try:
333 opts,args = getopt(argv,opt_str,*long_opts)
333 opts,args = getopt(argv,opt_str,*long_opts)
334 except GetoptError,e:
334 except GetoptError,e:
335 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
335 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
336 " ".join(long_opts)))
336 " ".join(long_opts)))
337 for o,a in opts:
337 for o,a in opts:
338 if o.startswith('--'):
338 if o.startswith('--'):
339 o = o[2:]
339 o = o[2:]
340 else:
340 else:
341 o = o[1:]
341 o = o[1:]
342 try:
342 try:
343 odict[o].append(a)
343 odict[o].append(a)
344 except AttributeError:
344 except AttributeError:
345 odict[o] = [odict[o],a]
345 odict[o] = [odict[o],a]
346 except KeyError:
346 except KeyError:
347 if list_all:
347 if list_all:
348 odict[o] = [a]
348 odict[o] = [a]
349 else:
349 else:
350 odict[o] = a
350 odict[o] = a
351
351
352 # Prepare opts,args for return
352 # Prepare opts,args for return
353 opts = Struct(odict)
353 opts = Struct(odict)
354 if mode == 'string':
354 if mode == 'string':
355 args = ' '.join(args)
355 args = ' '.join(args)
356
356
357 return opts,args
357 return opts,args
358
358
359 #......................................................................
359 #......................................................................
360 # And now the actual magic functions
360 # And now the actual magic functions
361
361
362 # Functions for IPython shell work (vars,funcs, config, etc)
362 # Functions for IPython shell work (vars,funcs, config, etc)
363 def magic_lsmagic(self, parameter_s = ''):
363 def magic_lsmagic(self, parameter_s = ''):
364 """List currently available magic functions."""
364 """List currently available magic functions."""
365 mesc = self.shell.ESC_MAGIC
365 mesc = self.shell.ESC_MAGIC
366 print 'Available magic functions:\n'+mesc+\
366 print 'Available magic functions:\n'+mesc+\
367 (' '+mesc).join(self.lsmagic())
367 (' '+mesc).join(self.lsmagic())
368 print '\n' + Magic.auto_status[self.shell.rc.automagic]
368 print '\n' + Magic.auto_status[self.shell.rc.automagic]
369 return None
369 return None
370
370
371 def magic_magic(self, parameter_s = ''):
371 def magic_magic(self, parameter_s = ''):
372 """Print information about the magic function system."""
372 """Print information about the magic function system."""
373
373
374 mode = ''
374 mode = ''
375 try:
375 try:
376 if parameter_s.split()[0] == '-latex':
376 if parameter_s.split()[0] == '-latex':
377 mode = 'latex'
377 mode = 'latex'
378 if parameter_s.split()[0] == '-brief':
378 if parameter_s.split()[0] == '-brief':
379 mode = 'brief'
379 mode = 'brief'
380 except:
380 except:
381 pass
381 pass
382
382
383 magic_docs = []
383 magic_docs = []
384 for fname in self.lsmagic():
384 for fname in self.lsmagic():
385 mname = 'magic_' + fname
385 mname = 'magic_' + fname
386 for space in (Magic,self,self.__class__):
386 for space in (Magic,self,self.__class__):
387 try:
387 try:
388 fn = space.__dict__[mname]
388 fn = space.__dict__[mname]
389 except KeyError:
389 except KeyError:
390 pass
390 pass
391 else:
391 else:
392 break
392 break
393 if mode == 'brief':
393 if mode == 'brief':
394 # only first line
394 # only first line
395 fndoc = fn.__doc__.split('\n',1)[0]
395 fndoc = fn.__doc__.split('\n',1)[0]
396 else:
396 else:
397 fndoc = fn.__doc__
397 fndoc = fn.__doc__
398
398
399 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
399 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
400 fname,fndoc))
400 fname,fndoc))
401 magic_docs = ''.join(magic_docs)
401 magic_docs = ''.join(magic_docs)
402
402
403 if mode == 'latex':
403 if mode == 'latex':
404 print self.format_latex(magic_docs)
404 print self.format_latex(magic_docs)
405 return
405 return
406 else:
406 else:
407 magic_docs = self.format_screen(magic_docs)
407 magic_docs = self.format_screen(magic_docs)
408 if mode == 'brief':
408 if mode == 'brief':
409 return magic_docs
409 return magic_docs
410
410
411 outmsg = """
411 outmsg = """
412 IPython's 'magic' functions
412 IPython's 'magic' functions
413 ===========================
413 ===========================
414
414
415 The magic function system provides a series of functions which allow you to
415 The magic function system provides a series of functions which allow you to
416 control the behavior of IPython itself, plus a lot of system-type
416 control the behavior of IPython itself, plus a lot of system-type
417 features. All these functions are prefixed with a % character, but parameters
417 features. All these functions are prefixed with a % character, but parameters
418 are given without parentheses or quotes.
418 are given without parentheses or quotes.
419
419
420 NOTE: If you have 'automagic' enabled (via the command line option or with the
420 NOTE: If you have 'automagic' enabled (via the command line option or with the
421 %automagic function), you don't need to type in the % explicitly. By default,
421 %automagic function), you don't need to type in the % explicitly. By default,
422 IPython ships with automagic on, so you should only rarely need the % escape.
422 IPython ships with automagic on, so you should only rarely need the % escape.
423
423
424 Example: typing '%cd mydir' (without the quotes) changes you working directory
424 Example: typing '%cd mydir' (without the quotes) changes you working directory
425 to 'mydir', if it exists.
425 to 'mydir', if it exists.
426
426
427 You can define your own magic functions to extend the system. See the supplied
427 You can define your own magic functions to extend the system. See the supplied
428 ipythonrc and example-magic.py files for details (in your ipython
428 ipythonrc and example-magic.py files for details (in your ipython
429 configuration directory, typically $HOME/.ipython/).
429 configuration directory, typically $HOME/.ipython/).
430
430
431 You can also define your own aliased names for magic functions. In your
431 You can also define your own aliased names for magic functions. In your
432 ipythonrc file, placing a line like:
432 ipythonrc file, placing a line like:
433
433
434 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
434 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
435
435
436 will define %pf as a new name for %profile.
436 will define %pf as a new name for %profile.
437
437
438 You can also call magics in code using the ipmagic() function, which IPython
438 You can also call magics in code using the ipmagic() function, which IPython
439 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
439 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
440
440
441 For a list of the available magic functions, use %lsmagic. For a description
441 For a list of the available magic functions, use %lsmagic. For a description
442 of any of them, type %magic_name?, e.g. '%cd?'.
442 of any of them, type %magic_name?, e.g. '%cd?'.
443
443
444 Currently the magic system has the following functions:\n"""
444 Currently the magic system has the following functions:\n"""
445
445
446 mesc = self.shell.ESC_MAGIC
446 mesc = self.shell.ESC_MAGIC
447 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
447 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
448 "\n\n%s%s\n\n%s" % (outmsg,
448 "\n\n%s%s\n\n%s" % (outmsg,
449 magic_docs,mesc,mesc,
449 magic_docs,mesc,mesc,
450 (' '+mesc).join(self.lsmagic()),
450 (' '+mesc).join(self.lsmagic()),
451 Magic.auto_status[self.shell.rc.automagic] ) )
451 Magic.auto_status[self.shell.rc.automagic] ) )
452
452
453 page(outmsg,screen_lines=self.shell.rc.screen_length)
453 page(outmsg,screen_lines=self.shell.rc.screen_length)
454
454
455 def magic_automagic(self, parameter_s = ''):
455 def magic_automagic(self, parameter_s = ''):
456 """Make magic functions callable without having to type the initial %.
456 """Make magic functions callable without having to type the initial %.
457
457
458 Without argumentsl toggles on/off (when off, you must call it as
458 Without argumentsl toggles on/off (when off, you must call it as
459 %automagic, of course). With arguments it sets the value, and you can
459 %automagic, of course). With arguments it sets the value, and you can
460 use any of (case insensitive):
460 use any of (case insensitive):
461
461
462 - on,1,True: to activate
462 - on,1,True: to activate
463
463
464 - off,0,False: to deactivate.
464 - off,0,False: to deactivate.
465
465
466 Note that magic functions have lowest priority, so if there's a
466 Note that magic functions have lowest priority, so if there's a
467 variable whose name collides with that of a magic fn, automagic won't
467 variable whose name collides with that of a magic fn, automagic won't
468 work for that function (you get the variable instead). However, if you
468 work for that function (you get the variable instead). However, if you
469 delete the variable (del var), the previously shadowed magic function
469 delete the variable (del var), the previously shadowed magic function
470 becomes visible to automagic again."""
470 becomes visible to automagic again."""
471
471
472 rc = self.shell.rc
472 rc = self.shell.rc
473 arg = parameter_s.lower()
473 arg = parameter_s.lower()
474 if parameter_s in ('on','1','true'):
474 if parameter_s in ('on','1','true'):
475 rc.automagic = True
475 rc.automagic = True
476 elif parameter_s in ('off','0','false'):
476 elif parameter_s in ('off','0','false'):
477 rc.automagic = False
477 rc.automagic = False
478 else:
478 else:
479 rc.automagic = not rc.automagic
479 rc.automagic = not rc.automagic
480 print '\n' + Magic.auto_status[rc.automagic]
480 print '\n' + Magic.auto_status[rc.automagic]
481
481
482 def magic_autocall(self, parameter_s = ''):
482 def magic_autocall(self, parameter_s = ''):
483 """Make functions callable without having to type parentheses.
483 """Make functions callable without having to type parentheses.
484
484
485 Usage:
485 Usage:
486
486
487 %autocall [mode]
487 %autocall [mode]
488
488
489 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
489 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
490 value is toggled on and off (remembering the previous state)."""
490 value is toggled on and off (remembering the previous state)."""
491
491
492 rc = self.shell.rc
492 rc = self.shell.rc
493
493
494 if parameter_s:
494 if parameter_s:
495 arg = int(parameter_s)
495 arg = int(parameter_s)
496 else:
496 else:
497 arg = 'toggle'
497 arg = 'toggle'
498
498
499 if not arg in (0,1,2,'toggle'):
499 if not arg in (0,1,2,'toggle'):
500 error('Valid modes: (0->Off, 1->Smart, 2->Full')
500 error('Valid modes: (0->Off, 1->Smart, 2->Full')
501 return
501 return
502
502
503 if arg in (0,1,2):
503 if arg in (0,1,2):
504 rc.autocall = arg
504 rc.autocall = arg
505 else: # toggle
505 else: # toggle
506 if rc.autocall:
506 if rc.autocall:
507 self._magic_state.autocall_save = rc.autocall
507 self._magic_state.autocall_save = rc.autocall
508 rc.autocall = 0
508 rc.autocall = 0
509 else:
509 else:
510 try:
510 try:
511 rc.autocall = self._magic_state.autocall_save
511 rc.autocall = self._magic_state.autocall_save
512 except AttributeError:
512 except AttributeError:
513 rc.autocall = self._magic_state.autocall_save = 1
513 rc.autocall = self._magic_state.autocall_save = 1
514
514
515 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
515 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
516
516
517 def magic_autoindent(self, parameter_s = ''):
517 def magic_autoindent(self, parameter_s = ''):
518 """Toggle autoindent on/off (if available)."""
518 """Toggle autoindent on/off (if available)."""
519
519
520 self.shell.set_autoindent()
520 self.shell.set_autoindent()
521 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
521 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
522
522
523 def magic_system_verbose(self, parameter_s = ''):
523 def magic_system_verbose(self, parameter_s = ''):
524 """Set verbose printing of system calls.
524 """Set verbose printing of system calls.
525
525
526 If called without an argument, act as a toggle"""
526 If called without an argument, act as a toggle"""
527
527
528 if parameter_s:
528 if parameter_s:
529 val = bool(eval(parameter_s))
529 val = bool(eval(parameter_s))
530 else:
530 else:
531 val = None
531 val = None
532
532
533 self.shell.rc_set_toggle('system_verbose',val)
533 self.shell.rc_set_toggle('system_verbose',val)
534 print "System verbose printing is:",\
534 print "System verbose printing is:",\
535 ['OFF','ON'][self.shell.rc.system_verbose]
535 ['OFF','ON'][self.shell.rc.system_verbose]
536
536
537 def magic_history(self, parameter_s = ''):
537 def magic_history(self, parameter_s = ''):
538 """Print input history (_i<n> variables), with most recent last.
538 """Print input history (_i<n> variables), with most recent last.
539
539
540 %history -> print at most 40 inputs (some may be multi-line)\\
540 %history -> print at most 40 inputs (some may be multi-line)\\
541 %history n -> print at most n inputs\\
541 %history n -> print at most n inputs\\
542 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
542 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
543
543
544 Each input's number <n> is shown, and is accessible as the
544 Each input's number <n> is shown, and is accessible as the
545 automatically generated variable _i<n>. Multi-line statements are
545 automatically generated variable _i<n>. Multi-line statements are
546 printed starting at a new line for easy copy/paste.
546 printed starting at a new line for easy copy/paste.
547
547
548
548
549 Options:
549 Options:
550
550
551 -n: do NOT print line numbers. This is useful if you want to get a
551 -n: do NOT print line numbers. This is useful if you want to get a
552 printout of many lines which can be directly pasted into a text
552 printout of many lines which can be directly pasted into a text
553 editor.
553 editor.
554
554
555 This feature is only available if numbered prompts are in use.
555 This feature is only available if numbered prompts are in use.
556
556
557 -r: print the 'raw' history. IPython filters your input and
557 -r: print the 'raw' history. IPython filters your input and
558 converts it all into valid Python source before executing it (things
558 converts it all into valid Python source before executing it (things
559 like magics or aliases are turned into function calls, for
559 like magics or aliases are turned into function calls, for
560 example). With this option, you'll see the unfiltered history
560 example). With this option, you'll see the unfiltered history
561 instead of the filtered version: '%cd /' will be seen as '%cd /'
561 instead of the filtered version: '%cd /' will be seen as '%cd /'
562 instead of '_ip.magic("%cd /")'.
562 instead of '_ip.magic("%cd /")'.
563 """
563 """
564
564
565 shell = self.shell
565 shell = self.shell
566 if not shell.outputcache.do_full_cache:
566 if not shell.outputcache.do_full_cache:
567 print 'This feature is only available if numbered prompts are in use.'
567 print 'This feature is only available if numbered prompts are in use.'
568 return
568 return
569 opts,args = self.parse_options(parameter_s,'nr',mode='list')
569 opts,args = self.parse_options(parameter_s,'nr',mode='list')
570
570
571 if opts.has_key('r'):
571 if opts.has_key('r'):
572 input_hist = shell.input_hist_raw
572 input_hist = shell.input_hist_raw
573 else:
573 else:
574 input_hist = shell.input_hist
574 input_hist = shell.input_hist
575
575
576 default_length = 40
576 default_length = 40
577 if len(args) == 0:
577 if len(args) == 0:
578 final = len(input_hist)
578 final = len(input_hist)
579 init = max(1,final-default_length)
579 init = max(1,final-default_length)
580 elif len(args) == 1:
580 elif len(args) == 1:
581 final = len(input_hist)
581 final = len(input_hist)
582 init = max(1,final-int(args[0]))
582 init = max(1,final-int(args[0]))
583 elif len(args) == 2:
583 elif len(args) == 2:
584 init,final = map(int,args)
584 init,final = map(int,args)
585 else:
585 else:
586 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
586 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
587 print self.magic_hist.__doc__
587 print self.magic_hist.__doc__
588 return
588 return
589 width = len(str(final))
589 width = len(str(final))
590 line_sep = ['','\n']
590 line_sep = ['','\n']
591 print_nums = not opts.has_key('n')
591 print_nums = not opts.has_key('n')
592 for in_num in range(init,final):
592 for in_num in range(init,final):
593 inline = input_hist[in_num]
593 inline = input_hist[in_num]
594 multiline = int(inline.count('\n') > 1)
594 multiline = int(inline.count('\n') > 1)
595 if print_nums:
595 if print_nums:
596 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
596 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
597 print inline,
597 print inline,
598
598
599 def magic_hist(self, parameter_s=''):
599 def magic_hist(self, parameter_s=''):
600 """Alternate name for %history."""
600 """Alternate name for %history."""
601 return self.magic_history(parameter_s)
601 return self.magic_history(parameter_s)
602
602
603 def magic_p(self, parameter_s=''):
603 def magic_p(self, parameter_s=''):
604 """Just a short alias for Python's 'print'."""
604 """Just a short alias for Python's 'print'."""
605 exec 'print ' + parameter_s in self.shell.user_ns
605 exec 'print ' + parameter_s in self.shell.user_ns
606
606
607 def magic_r(self, parameter_s=''):
607 def magic_r(self, parameter_s=''):
608 """Repeat previous input.
608 """Repeat previous input.
609
609
610 If given an argument, repeats the previous command which starts with
610 If given an argument, repeats the previous command which starts with
611 the same string, otherwise it just repeats the previous input.
611 the same string, otherwise it just repeats the previous input.
612
612
613 Shell escaped commands (with ! as first character) are not recognized
613 Shell escaped commands (with ! as first character) are not recognized
614 by this system, only pure python code and magic commands.
614 by this system, only pure python code and magic commands.
615 """
615 """
616
616
617 start = parameter_s.strip()
617 start = parameter_s.strip()
618 esc_magic = self.shell.ESC_MAGIC
618 esc_magic = self.shell.ESC_MAGIC
619 # Identify magic commands even if automagic is on (which means
619 # Identify magic commands even if automagic is on (which means
620 # the in-memory version is different from that typed by the user).
620 # the in-memory version is different from that typed by the user).
621 if self.shell.rc.automagic:
621 if self.shell.rc.automagic:
622 start_magic = esc_magic+start
622 start_magic = esc_magic+start
623 else:
623 else:
624 start_magic = start
624 start_magic = start
625 # Look through the input history in reverse
625 # Look through the input history in reverse
626 for n in range(len(self.shell.input_hist)-2,0,-1):
626 for n in range(len(self.shell.input_hist)-2,0,-1):
627 input = self.shell.input_hist[n]
627 input = self.shell.input_hist[n]
628 # skip plain 'r' lines so we don't recurse to infinity
628 # skip plain 'r' lines so we don't recurse to infinity
629 if input != '_ip.magic("r")\n' and \
629 if input != '_ip.magic("r")\n' and \
630 (input.startswith(start) or input.startswith(start_magic)):
630 (input.startswith(start) or input.startswith(start_magic)):
631 #print 'match',`input` # dbg
631 #print 'match',`input` # dbg
632 print 'Executing:',input,
632 print 'Executing:',input,
633 self.shell.runlines(input)
633 self.shell.runlines(input)
634 return
634 return
635 print 'No previous input matching `%s` found.' % start
635 print 'No previous input matching `%s` found.' % start
636
636
637 def magic_page(self, parameter_s=''):
637 def magic_page(self, parameter_s=''):
638 """Pretty print the object and display it through a pager.
638 """Pretty print the object and display it through a pager.
639
639
640 %page [options] OBJECT
640 %page [options] OBJECT
641
641
642 If no object is given, use _ (last output).
642 If no object is given, use _ (last output).
643
643
644 Options:
644 Options:
645
645
646 -r: page str(object), don't pretty-print it."""
646 -r: page str(object), don't pretty-print it."""
647
647
648 # After a function contributed by Olivier Aubert, slightly modified.
648 # After a function contributed by Olivier Aubert, slightly modified.
649
649
650 # Process options/args
650 # Process options/args
651 opts,args = self.parse_options(parameter_s,'r')
651 opts,args = self.parse_options(parameter_s,'r')
652 raw = 'r' in opts
652 raw = 'r' in opts
653
653
654 oname = args and args or '_'
654 oname = args and args or '_'
655 info = self._ofind(oname)
655 info = self._ofind(oname)
656 if info['found']:
656 if info['found']:
657 txt = (raw and str or pformat)( info['obj'] )
657 txt = (raw and str or pformat)( info['obj'] )
658 page(txt)
658 page(txt)
659 else:
659 else:
660 print 'Object `%s` not found' % oname
660 print 'Object `%s` not found' % oname
661
661
662 def magic_profile(self, parameter_s=''):
662 def magic_profile(self, parameter_s=''):
663 """Print your currently active IPyhton profile."""
663 """Print your currently active IPyhton profile."""
664 if self.shell.rc.profile:
664 if self.shell.rc.profile:
665 printpl('Current IPython profile: $self.shell.rc.profile.')
665 printpl('Current IPython profile: $self.shell.rc.profile.')
666 else:
666 else:
667 print 'No profile active.'
667 print 'No profile active.'
668
668
669 def _inspect(self,meth,oname,namespaces=None,**kw):
669 def _inspect(self,meth,oname,namespaces=None,**kw):
670 """Generic interface to the inspector system.
670 """Generic interface to the inspector system.
671
671
672 This function is meant to be called by pdef, pdoc & friends."""
672 This function is meant to be called by pdef, pdoc & friends."""
673
673
674 oname = oname.strip()
674 oname = oname.strip()
675 info = Struct(self._ofind(oname, namespaces))
675 info = Struct(self._ofind(oname, namespaces))
676
676
677 if info.found:
677 if info.found:
678 # Get the docstring of the class property if it exists.
678 # Get the docstring of the class property if it exists.
679 path = oname.split('.')
679 path = oname.split('.')
680 root = '.'.join(path[:-1])
680 root = '.'.join(path[:-1])
681 if info.parent is not None:
681 if info.parent is not None:
682 try:
682 try:
683 target = getattr(info.parent, '__class__')
683 target = getattr(info.parent, '__class__')
684 # The object belongs to a class instance.
684 # The object belongs to a class instance.
685 try:
685 try:
686 target = getattr(target, path[-1])
686 target = getattr(target, path[-1])
687 # The class defines the object.
687 # The class defines the object.
688 if isinstance(target, property):
688 if isinstance(target, property):
689 oname = root + '.__class__.' + path[-1]
689 oname = root + '.__class__.' + path[-1]
690 info = Struct(self._ofind(oname))
690 info = Struct(self._ofind(oname))
691 except AttributeError: pass
691 except AttributeError: pass
692 except AttributeError: pass
692 except AttributeError: pass
693
693
694 pmethod = getattr(self.shell.inspector,meth)
694 pmethod = getattr(self.shell.inspector,meth)
695 formatter = info.ismagic and self.format_screen or None
695 formatter = info.ismagic and self.format_screen or None
696 if meth == 'pdoc':
696 if meth == 'pdoc':
697 pmethod(info.obj,oname,formatter)
697 pmethod(info.obj,oname,formatter)
698 elif meth == 'pinfo':
698 elif meth == 'pinfo':
699 pmethod(info.obj,oname,formatter,info,**kw)
699 pmethod(info.obj,oname,formatter,info,**kw)
700 else:
700 else:
701 pmethod(info.obj,oname)
701 pmethod(info.obj,oname)
702 else:
702 else:
703 print 'Object `%s` not found.' % oname
703 print 'Object `%s` not found.' % oname
704 return 'not found' # so callers can take other action
704 return 'not found' # so callers can take other action
705
705
706 def magic_pdef(self, parameter_s='', namespaces=None):
706 def magic_pdef(self, parameter_s='', namespaces=None):
707 """Print the definition header for any callable object.
707 """Print the definition header for any callable object.
708
708
709 If the object is a class, print the constructor information."""
709 If the object is a class, print the constructor information."""
710 self._inspect('pdef',parameter_s, namespaces)
710 self._inspect('pdef',parameter_s, namespaces)
711
711
712 def magic_pdoc(self, parameter_s='', namespaces=None):
712 def magic_pdoc(self, parameter_s='', namespaces=None):
713 """Print the docstring for an object.
713 """Print the docstring for an object.
714
714
715 If the given object is a class, it will print both the class and the
715 If the given object is a class, it will print both the class and the
716 constructor docstrings."""
716 constructor docstrings."""
717 self._inspect('pdoc',parameter_s, namespaces)
717 self._inspect('pdoc',parameter_s, namespaces)
718
718
719 def magic_psource(self, parameter_s='', namespaces=None):
719 def magic_psource(self, parameter_s='', namespaces=None):
720 """Print (or run through pager) the source code for an object."""
720 """Print (or run through pager) the source code for an object."""
721 self._inspect('psource',parameter_s, namespaces)
721 self._inspect('psource',parameter_s, namespaces)
722
722
723 def magic_pfile(self, parameter_s=''):
723 def magic_pfile(self, parameter_s=''):
724 """Print (or run through pager) the file where an object is defined.
724 """Print (or run through pager) the file where an object is defined.
725
725
726 The file opens at the line where the object definition begins. IPython
726 The file opens at the line where the object definition begins. IPython
727 will honor the environment variable PAGER if set, and otherwise will
727 will honor the environment variable PAGER if set, and otherwise will
728 do its best to print the file in a convenient form.
728 do its best to print the file in a convenient form.
729
729
730 If the given argument is not an object currently defined, IPython will
730 If the given argument is not an object currently defined, IPython will
731 try to interpret it as a filename (automatically adding a .py extension
731 try to interpret it as a filename (automatically adding a .py extension
732 if needed). You can thus use %pfile as a syntax highlighting code
732 if needed). You can thus use %pfile as a syntax highlighting code
733 viewer."""
733 viewer."""
734
734
735 # first interpret argument as an object name
735 # first interpret argument as an object name
736 out = self._inspect('pfile',parameter_s)
736 out = self._inspect('pfile',parameter_s)
737 # if not, try the input as a filename
737 # if not, try the input as a filename
738 if out == 'not found':
738 if out == 'not found':
739 try:
739 try:
740 filename = get_py_filename(parameter_s)
740 filename = get_py_filename(parameter_s)
741 except IOError,msg:
741 except IOError,msg:
742 print msg
742 print msg
743 return
743 return
744 page(self.shell.inspector.format(file(filename).read()))
744 page(self.shell.inspector.format(file(filename).read()))
745
745
746 def magic_pinfo(self, parameter_s='', namespaces=None):
746 def magic_pinfo(self, parameter_s='', namespaces=None):
747 """Provide detailed information about an object.
747 """Provide detailed information about an object.
748
748
749 '%pinfo object' is just a synonym for object? or ?object."""
749 '%pinfo object' is just a synonym for object? or ?object."""
750
750
751 #print 'pinfo par: <%s>' % parameter_s # dbg
751 #print 'pinfo par: <%s>' % parameter_s # dbg
752
752
753 # detail_level: 0 -> obj? , 1 -> obj??
753 # detail_level: 0 -> obj? , 1 -> obj??
754 detail_level = 0
754 detail_level = 0
755 # We need to detect if we got called as 'pinfo pinfo foo', which can
755 # We need to detect if we got called as 'pinfo pinfo foo', which can
756 # happen if the user types 'pinfo foo?' at the cmd line.
756 # happen if the user types 'pinfo foo?' at the cmd line.
757 pinfo,qmark1,oname,qmark2 = \
757 pinfo,qmark1,oname,qmark2 = \
758 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
758 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
759 if pinfo or qmark1 or qmark2:
759 if pinfo or qmark1 or qmark2:
760 detail_level = 1
760 detail_level = 1
761 if "*" in oname:
761 if "*" in oname:
762 self.magic_psearch(oname)
762 self.magic_psearch(oname)
763 else:
763 else:
764 self._inspect('pinfo', oname, detail_level=detail_level,
764 self._inspect('pinfo', oname, detail_level=detail_level,
765 namespaces=namespaces)
765 namespaces=namespaces)
766
766
767 def magic_psearch(self, parameter_s=''):
767 def magic_psearch(self, parameter_s=''):
768 """Search for object in namespaces by wildcard.
768 """Search for object in namespaces by wildcard.
769
769
770 %psearch [options] PATTERN [OBJECT TYPE]
770 %psearch [options] PATTERN [OBJECT TYPE]
771
771
772 Note: ? can be used as a synonym for %psearch, at the beginning or at
772 Note: ? can be used as a synonym for %psearch, at the beginning or at
773 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
773 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
774 rest of the command line must be unchanged (options come first), so
774 rest of the command line must be unchanged (options come first), so
775 for example the following forms are equivalent
775 for example the following forms are equivalent
776
776
777 %psearch -i a* function
777 %psearch -i a* function
778 -i a* function?
778 -i a* function?
779 ?-i a* function
779 ?-i a* function
780
780
781 Arguments:
781 Arguments:
782
782
783 PATTERN
783 PATTERN
784
784
785 where PATTERN is a string containing * as a wildcard similar to its
785 where PATTERN is a string containing * as a wildcard similar to its
786 use in a shell. The pattern is matched in all namespaces on the
786 use in a shell. The pattern is matched in all namespaces on the
787 search path. By default objects starting with a single _ are not
787 search path. By default objects starting with a single _ are not
788 matched, many IPython generated objects have a single
788 matched, many IPython generated objects have a single
789 underscore. The default is case insensitive matching. Matching is
789 underscore. The default is case insensitive matching. Matching is
790 also done on the attributes of objects and not only on the objects
790 also done on the attributes of objects and not only on the objects
791 in a module.
791 in a module.
792
792
793 [OBJECT TYPE]
793 [OBJECT TYPE]
794
794
795 Is the name of a python type from the types module. The name is
795 Is the name of a python type from the types module. The name is
796 given in lowercase without the ending type, ex. StringType is
796 given in lowercase without the ending type, ex. StringType is
797 written string. By adding a type here only objects matching the
797 written string. By adding a type here only objects matching the
798 given type are matched. Using all here makes the pattern match all
798 given type are matched. Using all here makes the pattern match all
799 types (this is the default).
799 types (this is the default).
800
800
801 Options:
801 Options:
802
802
803 -a: makes the pattern match even objects whose names start with a
803 -a: makes the pattern match even objects whose names start with a
804 single underscore. These names are normally ommitted from the
804 single underscore. These names are normally ommitted from the
805 search.
805 search.
806
806
807 -i/-c: make the pattern case insensitive/sensitive. If neither of
807 -i/-c: make the pattern case insensitive/sensitive. If neither of
808 these options is given, the default is read from your ipythonrc
808 these options is given, the default is read from your ipythonrc
809 file. The option name which sets this value is
809 file. The option name which sets this value is
810 'wildcards_case_sensitive'. If this option is not specified in your
810 'wildcards_case_sensitive'. If this option is not specified in your
811 ipythonrc file, IPython's internal default is to do a case sensitive
811 ipythonrc file, IPython's internal default is to do a case sensitive
812 search.
812 search.
813
813
814 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
814 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
815 specifiy can be searched in any of the following namespaces:
815 specifiy can be searched in any of the following namespaces:
816 'builtin', 'user', 'user_global','internal', 'alias', where
816 'builtin', 'user', 'user_global','internal', 'alias', where
817 'builtin' and 'user' are the search defaults. Note that you should
817 'builtin' and 'user' are the search defaults. Note that you should
818 not use quotes when specifying namespaces.
818 not use quotes when specifying namespaces.
819
819
820 'Builtin' contains the python module builtin, 'user' contains all
820 'Builtin' contains the python module builtin, 'user' contains all
821 user data, 'alias' only contain the shell aliases and no python
821 user data, 'alias' only contain the shell aliases and no python
822 objects, 'internal' contains objects used by IPython. The
822 objects, 'internal' contains objects used by IPython. The
823 'user_global' namespace is only used by embedded IPython instances,
823 'user_global' namespace is only used by embedded IPython instances,
824 and it contains module-level globals. You can add namespaces to the
824 and it contains module-level globals. You can add namespaces to the
825 search with -s or exclude them with -e (these options can be given
825 search with -s or exclude them with -e (these options can be given
826 more than once).
826 more than once).
827
827
828 Examples:
828 Examples:
829
829
830 %psearch a* -> objects beginning with an a
830 %psearch a* -> objects beginning with an a
831 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
831 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
832 %psearch a* function -> all functions beginning with an a
832 %psearch a* function -> all functions beginning with an a
833 %psearch re.e* -> objects beginning with an e in module re
833 %psearch re.e* -> objects beginning with an e in module re
834 %psearch r*.e* -> objects that start with e in modules starting in r
834 %psearch r*.e* -> objects that start with e in modules starting in r
835 %psearch r*.* string -> all strings in modules beginning with r
835 %psearch r*.* string -> all strings in modules beginning with r
836
836
837 Case sensitve search:
837 Case sensitve search:
838
838
839 %psearch -c a* list all object beginning with lower case a
839 %psearch -c a* list all object beginning with lower case a
840
840
841 Show objects beginning with a single _:
841 Show objects beginning with a single _:
842
842
843 %psearch -a _* list objects beginning with a single underscore"""
843 %psearch -a _* list objects beginning with a single underscore"""
844
844
845 # default namespaces to be searched
845 # default namespaces to be searched
846 def_search = ['user','builtin']
846 def_search = ['user','builtin']
847
847
848 # Process options/args
848 # Process options/args
849 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
849 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
850 opt = opts.get
850 opt = opts.get
851 shell = self.shell
851 shell = self.shell
852 psearch = shell.inspector.psearch
852 psearch = shell.inspector.psearch
853
853
854 # select case options
854 # select case options
855 if opts.has_key('i'):
855 if opts.has_key('i'):
856 ignore_case = True
856 ignore_case = True
857 elif opts.has_key('c'):
857 elif opts.has_key('c'):
858 ignore_case = False
858 ignore_case = False
859 else:
859 else:
860 ignore_case = not shell.rc.wildcards_case_sensitive
860 ignore_case = not shell.rc.wildcards_case_sensitive
861
861
862 # Build list of namespaces to search from user options
862 # Build list of namespaces to search from user options
863 def_search.extend(opt('s',[]))
863 def_search.extend(opt('s',[]))
864 ns_exclude = ns_exclude=opt('e',[])
864 ns_exclude = ns_exclude=opt('e',[])
865 ns_search = [nm for nm in def_search if nm not in ns_exclude]
865 ns_search = [nm for nm in def_search if nm not in ns_exclude]
866
866
867 # Call the actual search
867 # Call the actual search
868 try:
868 try:
869 psearch(args,shell.ns_table,ns_search,
869 psearch(args,shell.ns_table,ns_search,
870 show_all=opt('a'),ignore_case=ignore_case)
870 show_all=opt('a'),ignore_case=ignore_case)
871 except:
871 except:
872 shell.showtraceback()
872 shell.showtraceback()
873
873
874 def magic_who_ls(self, parameter_s=''):
874 def magic_who_ls(self, parameter_s=''):
875 """Return a sorted list of all interactive variables.
875 """Return a sorted list of all interactive variables.
876
876
877 If arguments are given, only variables of types matching these
877 If arguments are given, only variables of types matching these
878 arguments are returned."""
878 arguments are returned."""
879
879
880 user_ns = self.shell.user_ns
880 user_ns = self.shell.user_ns
881 internal_ns = self.shell.internal_ns
881 internal_ns = self.shell.internal_ns
882 user_config_ns = self.shell.user_config_ns
882 user_config_ns = self.shell.user_config_ns
883 out = []
883 out = []
884 typelist = parameter_s.split()
884 typelist = parameter_s.split()
885
885
886 for i in user_ns:
886 for i in user_ns:
887 if not (i.startswith('_') or i.startswith('_i')) \
887 if not (i.startswith('_') or i.startswith('_i')) \
888 and not (i in internal_ns or i in user_config_ns):
888 and not (i in internal_ns or i in user_config_ns):
889 if typelist:
889 if typelist:
890 if type(user_ns[i]).__name__ in typelist:
890 if type(user_ns[i]).__name__ in typelist:
891 out.append(i)
891 out.append(i)
892 else:
892 else:
893 out.append(i)
893 out.append(i)
894 out.sort()
894 out.sort()
895 return out
895 return out
896
896
897 def magic_who(self, parameter_s=''):
897 def magic_who(self, parameter_s=''):
898 """Print all interactive variables, with some minimal formatting.
898 """Print all interactive variables, with some minimal formatting.
899
899
900 If any arguments are given, only variables whose type matches one of
900 If any arguments are given, only variables whose type matches one of
901 these are printed. For example:
901 these are printed. For example:
902
902
903 %who function str
903 %who function str
904
904
905 will only list functions and strings, excluding all other types of
905 will only list functions and strings, excluding all other types of
906 variables. To find the proper type names, simply use type(var) at a
906 variables. To find the proper type names, simply use type(var) at a
907 command line to see how python prints type names. For example:
907 command line to see how python prints type names. For example:
908
908
909 In [1]: type('hello')\\
909 In [1]: type('hello')\\
910 Out[1]: <type 'str'>
910 Out[1]: <type 'str'>
911
911
912 indicates that the type name for strings is 'str'.
912 indicates that the type name for strings is 'str'.
913
913
914 %who always excludes executed names loaded through your configuration
914 %who always excludes executed names loaded through your configuration
915 file and things which are internal to IPython.
915 file and things which are internal to IPython.
916
916
917 This is deliberate, as typically you may load many modules and the
917 This is deliberate, as typically you may load many modules and the
918 purpose of %who is to show you only what you've manually defined."""
918 purpose of %who is to show you only what you've manually defined."""
919
919
920 varlist = self.magic_who_ls(parameter_s)
920 varlist = self.magic_who_ls(parameter_s)
921 if not varlist:
921 if not varlist:
922 print 'Interactive namespace is empty.'
922 print 'Interactive namespace is empty.'
923 return
923 return
924
924
925 # if we have variables, move on...
925 # if we have variables, move on...
926
926
927 # stupid flushing problem: when prompts have no separators, stdout is
927 # stupid flushing problem: when prompts have no separators, stdout is
928 # getting lost. I'm starting to think this is a python bug. I'm having
928 # getting lost. I'm starting to think this is a python bug. I'm having
929 # to force a flush with a print because even a sys.stdout.flush
929 # to force a flush with a print because even a sys.stdout.flush
930 # doesn't seem to do anything!
930 # doesn't seem to do anything!
931
931
932 count = 0
932 count = 0
933 for i in varlist:
933 for i in varlist:
934 print i+'\t',
934 print i+'\t',
935 count += 1
935 count += 1
936 if count > 8:
936 if count > 8:
937 count = 0
937 count = 0
938 print
938 print
939 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
939 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
940
940
941 print # well, this does force a flush at the expense of an extra \n
941 print # well, this does force a flush at the expense of an extra \n
942
942
943 def magic_whos(self, parameter_s=''):
943 def magic_whos(self, parameter_s=''):
944 """Like %who, but gives some extra information about each variable.
944 """Like %who, but gives some extra information about each variable.
945
945
946 The same type filtering of %who can be applied here.
946 The same type filtering of %who can be applied here.
947
947
948 For all variables, the type is printed. Additionally it prints:
948 For all variables, the type is printed. Additionally it prints:
949
949
950 - For {},[],(): their length.
950 - For {},[],(): their length.
951
951
952 - For Numeric arrays, a summary with shape, number of elements,
952 - For Numeric arrays, a summary with shape, number of elements,
953 typecode and size in memory.
953 typecode and size in memory.
954
954
955 - Everything else: a string representation, snipping their middle if
955 - Everything else: a string representation, snipping their middle if
956 too long."""
956 too long."""
957
957
958 varnames = self.magic_who_ls(parameter_s)
958 varnames = self.magic_who_ls(parameter_s)
959 if not varnames:
959 if not varnames:
960 print 'Interactive namespace is empty.'
960 print 'Interactive namespace is empty.'
961 return
961 return
962
962
963 # if we have variables, move on...
963 # if we have variables, move on...
964
964
965 # for these types, show len() instead of data:
965 # for these types, show len() instead of data:
966 seq_types = [types.DictType,types.ListType,types.TupleType]
966 seq_types = [types.DictType,types.ListType,types.TupleType]
967
967
968 # for Numeric arrays, display summary info
968 # for Numeric arrays, display summary info
969 try:
969 try:
970 import Numeric
970 import Numeric
971 except ImportError:
971 except ImportError:
972 array_type = None
972 array_type = None
973 else:
973 else:
974 array_type = Numeric.ArrayType.__name__
974 array_type = Numeric.ArrayType.__name__
975
975
976 # Find all variable names and types so we can figure out column sizes
976 # Find all variable names and types so we can figure out column sizes
977
977
978 def get_vars(i):
978 def get_vars(i):
979 return self.shell.user_ns[i]
979 return self.shell.user_ns[i]
980
980
981 # some types are well known and can be shorter
981 # some types are well known and can be shorter
982 abbrevs = {'IPython.macro.Macro' : 'Macro'}
982 abbrevs = {'IPython.macro.Macro' : 'Macro'}
983 def type_name(v):
983 def type_name(v):
984 tn = type(v).__name__
984 tn = type(v).__name__
985 return abbrevs.get(tn,tn)
985 return abbrevs.get(tn,tn)
986
986
987 varlist = map(get_vars,varnames)
987 varlist = map(get_vars,varnames)
988
988
989 typelist = []
989 typelist = []
990 for vv in varlist:
990 for vv in varlist:
991 tt = type_name(vv)
991 tt = type_name(vv)
992
992
993 if tt=='instance':
993 if tt=='instance':
994 typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__)))
994 typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__)))
995 else:
995 else:
996 typelist.append(tt)
996 typelist.append(tt)
997
997
998 # column labels and # of spaces as separator
998 # column labels and # of spaces as separator
999 varlabel = 'Variable'
999 varlabel = 'Variable'
1000 typelabel = 'Type'
1000 typelabel = 'Type'
1001 datalabel = 'Data/Info'
1001 datalabel = 'Data/Info'
1002 colsep = 3
1002 colsep = 3
1003 # variable format strings
1003 # variable format strings
1004 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
1004 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
1005 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
1005 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
1006 aformat = "%s: %s elems, type `%s`, %s bytes"
1006 aformat = "%s: %s elems, type `%s`, %s bytes"
1007 # find the size of the columns to format the output nicely
1007 # find the size of the columns to format the output nicely
1008 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
1008 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
1009 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
1009 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
1010 # table header
1010 # table header
1011 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
1011 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
1012 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
1012 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
1013 # and the table itself
1013 # and the table itself
1014 kb = 1024
1014 kb = 1024
1015 Mb = 1048576 # kb**2
1015 Mb = 1048576 # kb**2
1016 for vname,var,vtype in zip(varnames,varlist,typelist):
1016 for vname,var,vtype in zip(varnames,varlist,typelist):
1017 print itpl(vformat),
1017 print itpl(vformat),
1018 if vtype in seq_types:
1018 if vtype in seq_types:
1019 print len(var)
1019 print len(var)
1020 elif vtype==array_type:
1020 elif vtype==array_type:
1021 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1021 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1022 vsize = Numeric.size(var)
1022 vsize = Numeric.size(var)
1023 vbytes = vsize*var.itemsize()
1023 vbytes = vsize*var.itemsize()
1024 if vbytes < 100000:
1024 if vbytes < 100000:
1025 print aformat % (vshape,vsize,var.typecode(),vbytes)
1025 print aformat % (vshape,vsize,var.typecode(),vbytes)
1026 else:
1026 else:
1027 print aformat % (vshape,vsize,var.typecode(),vbytes),
1027 print aformat % (vshape,vsize,var.typecode(),vbytes),
1028 if vbytes < Mb:
1028 if vbytes < Mb:
1029 print '(%s kb)' % (vbytes/kb,)
1029 print '(%s kb)' % (vbytes/kb,)
1030 else:
1030 else:
1031 print '(%s Mb)' % (vbytes/Mb,)
1031 print '(%s Mb)' % (vbytes/Mb,)
1032 else:
1032 else:
1033 vstr = str(var).replace('\n','\\n')
1033 vstr = str(var).replace('\n','\\n')
1034 if len(vstr) < 50:
1034 if len(vstr) < 50:
1035 print vstr
1035 print vstr
1036 else:
1036 else:
1037 printpl(vfmt_short)
1037 printpl(vfmt_short)
1038
1038
1039 def magic_reset(self, parameter_s=''):
1039 def magic_reset(self, parameter_s=''):
1040 """Resets the namespace by removing all names defined by the user.
1040 """Resets the namespace by removing all names defined by the user.
1041
1041
1042 Input/Output history are left around in case you need them."""
1042 Input/Output history are left around in case you need them."""
1043
1043
1044 ans = self.shell.ask_yes_no(
1044 ans = self.shell.ask_yes_no(
1045 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1045 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1046 if not ans:
1046 if not ans:
1047 print 'Nothing done.'
1047 print 'Nothing done.'
1048 return
1048 return
1049 user_ns = self.shell.user_ns
1049 user_ns = self.shell.user_ns
1050 for i in self.magic_who_ls():
1050 for i in self.magic_who_ls():
1051 del(user_ns[i])
1051 del(user_ns[i])
1052
1052
1053 def magic_logstart(self,parameter_s=''):
1053 def magic_logstart(self,parameter_s=''):
1054 """Start logging anywhere in a session.
1054 """Start logging anywhere in a session.
1055
1055
1056 %logstart [-o|-r|-t] [log_name [log_mode]]
1056 %logstart [-o|-r|-t] [log_name [log_mode]]
1057
1057
1058 If no name is given, it defaults to a file named 'ipython_log.py' in your
1058 If no name is given, it defaults to a file named 'ipython_log.py' in your
1059 current directory, in 'rotate' mode (see below).
1059 current directory, in 'rotate' mode (see below).
1060
1060
1061 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1061 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1062 history up to that point and then continues logging.
1062 history up to that point and then continues logging.
1063
1063
1064 %logstart takes a second optional parameter: logging mode. This can be one
1064 %logstart takes a second optional parameter: logging mode. This can be one
1065 of (note that the modes are given unquoted):\\
1065 of (note that the modes are given unquoted):\\
1066 append: well, that says it.\\
1066 append: well, that says it.\\
1067 backup: rename (if exists) to name~ and start name.\\
1067 backup: rename (if exists) to name~ and start name.\\
1068 global: single logfile in your home dir, appended to.\\
1068 global: single logfile in your home dir, appended to.\\
1069 over : overwrite existing log.\\
1069 over : overwrite existing log.\\
1070 rotate: create rotating logs name.1~, name.2~, etc.
1070 rotate: create rotating logs name.1~, name.2~, etc.
1071
1071
1072 Options:
1072 Options:
1073
1073
1074 -o: log also IPython's output. In this mode, all commands which
1074 -o: log also IPython's output. In this mode, all commands which
1075 generate an Out[NN] prompt are recorded to the logfile, right after
1075 generate an Out[NN] prompt are recorded to the logfile, right after
1076 their corresponding input line. The output lines are always
1076 their corresponding input line. The output lines are always
1077 prepended with a '#[Out]# ' marker, so that the log remains valid
1077 prepended with a '#[Out]# ' marker, so that the log remains valid
1078 Python code.
1078 Python code.
1079
1079
1080 Since this marker is always the same, filtering only the output from
1080 Since this marker is always the same, filtering only the output from
1081 a log is very easy, using for example a simple awk call:
1081 a log is very easy, using for example a simple awk call:
1082
1082
1083 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1083 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1084
1084
1085 -r: log 'raw' input. Normally, IPython's logs contain the processed
1085 -r: log 'raw' input. Normally, IPython's logs contain the processed
1086 input, so that user lines are logged in their final form, converted
1086 input, so that user lines are logged in their final form, converted
1087 into valid Python. For example, %Exit is logged as
1087 into valid Python. For example, %Exit is logged as
1088 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1088 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1089 exactly as typed, with no transformations applied.
1089 exactly as typed, with no transformations applied.
1090
1090
1091 -t: put timestamps before each input line logged (these are put in
1091 -t: put timestamps before each input line logged (these are put in
1092 comments)."""
1092 comments)."""
1093
1093
1094 opts,par = self.parse_options(parameter_s,'ort')
1094 opts,par = self.parse_options(parameter_s,'ort')
1095 log_output = 'o' in opts
1095 log_output = 'o' in opts
1096 log_raw_input = 'r' in opts
1096 log_raw_input = 'r' in opts
1097 timestamp = 't' in opts
1097 timestamp = 't' in opts
1098
1098
1099 rc = self.shell.rc
1099 rc = self.shell.rc
1100 logger = self.shell.logger
1100 logger = self.shell.logger
1101
1101
1102 # if no args are given, the defaults set in the logger constructor by
1102 # if no args are given, the defaults set in the logger constructor by
1103 # ipytohn remain valid
1103 # ipytohn remain valid
1104 if par:
1104 if par:
1105 try:
1105 try:
1106 logfname,logmode = par.split()
1106 logfname,logmode = par.split()
1107 except:
1107 except:
1108 logfname = par
1108 logfname = par
1109 logmode = 'backup'
1109 logmode = 'backup'
1110 else:
1110 else:
1111 logfname = logger.logfname
1111 logfname = logger.logfname
1112 logmode = logger.logmode
1112 logmode = logger.logmode
1113 # put logfname into rc struct as if it had been called on the command
1113 # put logfname into rc struct as if it had been called on the command
1114 # line, so it ends up saved in the log header Save it in case we need
1114 # line, so it ends up saved in the log header Save it in case we need
1115 # to restore it...
1115 # to restore it...
1116 old_logfile = rc.opts.get('logfile','')
1116 old_logfile = rc.opts.get('logfile','')
1117 if logfname:
1117 if logfname:
1118 logfname = os.path.expanduser(logfname)
1118 logfname = os.path.expanduser(logfname)
1119 rc.opts.logfile = logfname
1119 rc.opts.logfile = logfname
1120 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1120 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1121 try:
1121 try:
1122 started = logger.logstart(logfname,loghead,logmode,
1122 started = logger.logstart(logfname,loghead,logmode,
1123 log_output,timestamp,log_raw_input)
1123 log_output,timestamp,log_raw_input)
1124 except:
1124 except:
1125 rc.opts.logfile = old_logfile
1125 rc.opts.logfile = old_logfile
1126 warn("Couldn't start log: %s" % sys.exc_info()[1])
1126 warn("Couldn't start log: %s" % sys.exc_info()[1])
1127 else:
1127 else:
1128 # log input history up to this point, optionally interleaving
1128 # log input history up to this point, optionally interleaving
1129 # output if requested
1129 # output if requested
1130
1130
1131 if timestamp:
1131 if timestamp:
1132 # disable timestamping for the previous history, since we've
1132 # disable timestamping for the previous history, since we've
1133 # lost those already (no time machine here).
1133 # lost those already (no time machine here).
1134 logger.timestamp = False
1134 logger.timestamp = False
1135
1135
1136 if log_raw_input:
1136 if log_raw_input:
1137 input_hist = self.shell.input_hist_raw
1137 input_hist = self.shell.input_hist_raw
1138 else:
1138 else:
1139 input_hist = self.shell.input_hist
1139 input_hist = self.shell.input_hist
1140
1140
1141 if log_output:
1141 if log_output:
1142 log_write = logger.log_write
1142 log_write = logger.log_write
1143 output_hist = self.shell.output_hist
1143 output_hist = self.shell.output_hist
1144 for n in range(1,len(input_hist)-1):
1144 for n in range(1,len(input_hist)-1):
1145 log_write(input_hist[n].rstrip())
1145 log_write(input_hist[n].rstrip())
1146 if n in output_hist:
1146 if n in output_hist:
1147 log_write(repr(output_hist[n]),'output')
1147 log_write(repr(output_hist[n]),'output')
1148 else:
1148 else:
1149 logger.log_write(input_hist[1:])
1149 logger.log_write(input_hist[1:])
1150 if timestamp:
1150 if timestamp:
1151 # re-enable timestamping
1151 # re-enable timestamping
1152 logger.timestamp = True
1152 logger.timestamp = True
1153
1153
1154 print ('Activating auto-logging. '
1154 print ('Activating auto-logging. '
1155 'Current session state plus future input saved.')
1155 'Current session state plus future input saved.')
1156 logger.logstate()
1156 logger.logstate()
1157
1157
1158 def magic_logoff(self,parameter_s=''):
1158 def magic_logoff(self,parameter_s=''):
1159 """Temporarily stop logging.
1159 """Temporarily stop logging.
1160
1160
1161 You must have previously started logging."""
1161 You must have previously started logging."""
1162 self.shell.logger.switch_log(0)
1162 self.shell.logger.switch_log(0)
1163
1163
1164 def magic_logon(self,parameter_s=''):
1164 def magic_logon(self,parameter_s=''):
1165 """Restart logging.
1165 """Restart logging.
1166
1166
1167 This function is for restarting logging which you've temporarily
1167 This function is for restarting logging which you've temporarily
1168 stopped with %logoff. For starting logging for the first time, you
1168 stopped with %logoff. For starting logging for the first time, you
1169 must use the %logstart function, which allows you to specify an
1169 must use the %logstart function, which allows you to specify an
1170 optional log filename."""
1170 optional log filename."""
1171
1171
1172 self.shell.logger.switch_log(1)
1172 self.shell.logger.switch_log(1)
1173
1173
1174 def magic_logstate(self,parameter_s=''):
1174 def magic_logstate(self,parameter_s=''):
1175 """Print the status of the logging system."""
1175 """Print the status of the logging system."""
1176
1176
1177 self.shell.logger.logstate()
1177 self.shell.logger.logstate()
1178
1178
1179 def magic_pdb(self, parameter_s=''):
1179 def magic_pdb(self, parameter_s=''):
1180 """Control the automatic calling of the pdb interactive debugger.
1180 """Control the automatic calling of the pdb interactive debugger.
1181
1181
1182 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1182 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1183 argument it works as a toggle.
1183 argument it works as a toggle.
1184
1184
1185 When an exception is triggered, IPython can optionally call the
1185 When an exception is triggered, IPython can optionally call the
1186 interactive pdb debugger after the traceback printout. %pdb toggles
1186 interactive pdb debugger after the traceback printout. %pdb toggles
1187 this feature on and off.
1187 this feature on and off.
1188
1188
1189 The initial state of this feature is set in your ipythonrc
1189 The initial state of this feature is set in your ipythonrc
1190 configuration file (the variable is called 'pdb').
1190 configuration file (the variable is called 'pdb').
1191
1191
1192 If you want to just activate the debugger AFTER an exception has fired,
1192 If you want to just activate the debugger AFTER an exception has fired,
1193 without having to type '%pdb on' and rerunning your code, you can use
1193 without having to type '%pdb on' and rerunning your code, you can use
1194 the %debug magic."""
1194 the %debug magic."""
1195
1195
1196 par = parameter_s.strip().lower()
1196 par = parameter_s.strip().lower()
1197
1197
1198 if par:
1198 if par:
1199 try:
1199 try:
1200 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1200 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1201 except KeyError:
1201 except KeyError:
1202 print ('Incorrect argument. Use on/1, off/0, '
1202 print ('Incorrect argument. Use on/1, off/0, '
1203 'or nothing for a toggle.')
1203 'or nothing for a toggle.')
1204 return
1204 return
1205 else:
1205 else:
1206 # toggle
1206 # toggle
1207 new_pdb = not self.shell.call_pdb
1207 new_pdb = not self.shell.call_pdb
1208
1208
1209 # set on the shell
1209 # set on the shell
1210 self.shell.call_pdb = new_pdb
1210 self.shell.call_pdb = new_pdb
1211 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1211 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1212
1212
1213 def magic_debug(self, parameter_s=''):
1213 def magic_debug(self, parameter_s=''):
1214 """Activate the interactive debugger in post-mortem mode.
1214 """Activate the interactive debugger in post-mortem mode.
1215
1215
1216 If an exception has just occurred, this lets you inspect its stack
1216 If an exception has just occurred, this lets you inspect its stack
1217 frames interactively. Note that this will always work only on the last
1217 frames interactively. Note that this will always work only on the last
1218 traceback that occurred, so you must call this quickly after an
1218 traceback that occurred, so you must call this quickly after an
1219 exception that you wish to inspect has fired, because if another one
1219 exception that you wish to inspect has fired, because if another one
1220 occurs, it clobbers the previous one.
1220 occurs, it clobbers the previous one.
1221
1221
1222 If you want IPython to automatically do this on every exception, see
1222 If you want IPython to automatically do this on every exception, see
1223 the %pdb magic for more details.
1223 the %pdb magic for more details.
1224 """
1224 """
1225
1225
1226 self.shell.debugger(force=True)
1226 self.shell.debugger(force=True)
1227
1227
1228 def magic_prun(self, parameter_s ='',user_mode=1,
1228 def magic_prun(self, parameter_s ='',user_mode=1,
1229 opts=None,arg_lst=None,prog_ns=None):
1229 opts=None,arg_lst=None,prog_ns=None):
1230
1230
1231 """Run a statement through the python code profiler.
1231 """Run a statement through the python code profiler.
1232
1232
1233 Usage:\\
1233 Usage:\\
1234 %prun [options] statement
1234 %prun [options] statement
1235
1235
1236 The given statement (which doesn't require quote marks) is run via the
1236 The given statement (which doesn't require quote marks) is run via the
1237 python profiler in a manner similar to the profile.run() function.
1237 python profiler in a manner similar to the profile.run() function.
1238 Namespaces are internally managed to work correctly; profile.run
1238 Namespaces are internally managed to work correctly; profile.run
1239 cannot be used in IPython because it makes certain assumptions about
1239 cannot be used in IPython because it makes certain assumptions about
1240 namespaces which do not hold under IPython.
1240 namespaces which do not hold under IPython.
1241
1241
1242 Options:
1242 Options:
1243
1243
1244 -l <limit>: you can place restrictions on what or how much of the
1244 -l <limit>: you can place restrictions on what or how much of the
1245 profile gets printed. The limit value can be:
1245 profile gets printed. The limit value can be:
1246
1246
1247 * A string: only information for function names containing this string
1247 * A string: only information for function names containing this string
1248 is printed.
1248 is printed.
1249
1249
1250 * An integer: only these many lines are printed.
1250 * An integer: only these many lines are printed.
1251
1251
1252 * A float (between 0 and 1): this fraction of the report is printed
1252 * A float (between 0 and 1): this fraction of the report is printed
1253 (for example, use a limit of 0.4 to see the topmost 40% only).
1253 (for example, use a limit of 0.4 to see the topmost 40% only).
1254
1254
1255 You can combine several limits with repeated use of the option. For
1255 You can combine several limits with repeated use of the option. For
1256 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1256 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1257 information about class constructors.
1257 information about class constructors.
1258
1258
1259 -r: return the pstats.Stats object generated by the profiling. This
1259 -r: return the pstats.Stats object generated by the profiling. This
1260 object has all the information about the profile in it, and you can
1260 object has all the information about the profile in it, and you can
1261 later use it for further analysis or in other functions.
1261 later use it for further analysis or in other functions.
1262
1262
1263 -s <key>: sort profile by given key. You can provide more than one key
1263 -s <key>: sort profile by given key. You can provide more than one key
1264 by using the option several times: '-s key1 -s key2 -s key3...'. The
1264 by using the option several times: '-s key1 -s key2 -s key3...'. The
1265 default sorting key is 'time'.
1265 default sorting key is 'time'.
1266
1266
1267 The following is copied verbatim from the profile documentation
1267 The following is copied verbatim from the profile documentation
1268 referenced below:
1268 referenced below:
1269
1269
1270 When more than one key is provided, additional keys are used as
1270 When more than one key is provided, additional keys are used as
1271 secondary criteria when the there is equality in all keys selected
1271 secondary criteria when the there is equality in all keys selected
1272 before them.
1272 before them.
1273
1273
1274 Abbreviations can be used for any key names, as long as the
1274 Abbreviations can be used for any key names, as long as the
1275 abbreviation is unambiguous. The following are the keys currently
1275 abbreviation is unambiguous. The following are the keys currently
1276 defined:
1276 defined:
1277
1277
1278 Valid Arg Meaning\\
1278 Valid Arg Meaning\\
1279 "calls" call count\\
1279 "calls" call count\\
1280 "cumulative" cumulative time\\
1280 "cumulative" cumulative time\\
1281 "file" file name\\
1281 "file" file name\\
1282 "module" file name\\
1282 "module" file name\\
1283 "pcalls" primitive call count\\
1283 "pcalls" primitive call count\\
1284 "line" line number\\
1284 "line" line number\\
1285 "name" function name\\
1285 "name" function name\\
1286 "nfl" name/file/line\\
1286 "nfl" name/file/line\\
1287 "stdname" standard name\\
1287 "stdname" standard name\\
1288 "time" internal time
1288 "time" internal time
1289
1289
1290 Note that all sorts on statistics are in descending order (placing
1290 Note that all sorts on statistics are in descending order (placing
1291 most time consuming items first), where as name, file, and line number
1291 most time consuming items first), where as name, file, and line number
1292 searches are in ascending order (i.e., alphabetical). The subtle
1292 searches are in ascending order (i.e., alphabetical). The subtle
1293 distinction between "nfl" and "stdname" is that the standard name is a
1293 distinction between "nfl" and "stdname" is that the standard name is a
1294 sort of the name as printed, which means that the embedded line
1294 sort of the name as printed, which means that the embedded line
1295 numbers get compared in an odd way. For example, lines 3, 20, and 40
1295 numbers get compared in an odd way. For example, lines 3, 20, and 40
1296 would (if the file names were the same) appear in the string order
1296 would (if the file names were the same) appear in the string order
1297 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1297 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1298 line numbers. In fact, sort_stats("nfl") is the same as
1298 line numbers. In fact, sort_stats("nfl") is the same as
1299 sort_stats("name", "file", "line").
1299 sort_stats("name", "file", "line").
1300
1300
1301 -T <filename>: save profile results as shown on screen to a text
1301 -T <filename>: save profile results as shown on screen to a text
1302 file. The profile is still shown on screen.
1302 file. The profile is still shown on screen.
1303
1303
1304 -D <filename>: save (via dump_stats) profile statistics to given
1304 -D <filename>: save (via dump_stats) profile statistics to given
1305 filename. This data is in a format understod by the pstats module, and
1305 filename. This data is in a format understod by the pstats module, and
1306 is generated by a call to the dump_stats() method of profile
1306 is generated by a call to the dump_stats() method of profile
1307 objects. The profile is still shown on screen.
1307 objects. The profile is still shown on screen.
1308
1308
1309 If you want to run complete programs under the profiler's control, use
1309 If you want to run complete programs under the profiler's control, use
1310 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1310 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1311 contains profiler specific options as described here.
1311 contains profiler specific options as described here.
1312
1312
1313 You can read the complete documentation for the profile module with:\\
1313 You can read the complete documentation for the profile module with:\\
1314 In [1]: import profile; profile.help() """
1314 In [1]: import profile; profile.help() """
1315
1315
1316 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1316 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1317 # protect user quote marks
1317 # protect user quote marks
1318 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1318 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1319
1319
1320 if user_mode: # regular user call
1320 if user_mode: # regular user call
1321 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1321 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1322 list_all=1)
1322 list_all=1)
1323 namespace = self.shell.user_ns
1323 namespace = self.shell.user_ns
1324 else: # called to run a program by %run -p
1324 else: # called to run a program by %run -p
1325 try:
1325 try:
1326 filename = get_py_filename(arg_lst[0])
1326 filename = get_py_filename(arg_lst[0])
1327 except IOError,msg:
1327 except IOError,msg:
1328 error(msg)
1328 error(msg)
1329 return
1329 return
1330
1330
1331 arg_str = 'execfile(filename,prog_ns)'
1331 arg_str = 'execfile(filename,prog_ns)'
1332 namespace = locals()
1332 namespace = locals()
1333
1333
1334 opts.merge(opts_def)
1334 opts.merge(opts_def)
1335
1335
1336 prof = profile.Profile()
1336 prof = profile.Profile()
1337 try:
1337 try:
1338 prof = prof.runctx(arg_str,namespace,namespace)
1338 prof = prof.runctx(arg_str,namespace,namespace)
1339 sys_exit = ''
1339 sys_exit = ''
1340 except SystemExit:
1340 except SystemExit:
1341 sys_exit = """*** SystemExit exception caught in code being profiled."""
1341 sys_exit = """*** SystemExit exception caught in code being profiled."""
1342
1342
1343 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1343 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1344
1344
1345 lims = opts.l
1345 lims = opts.l
1346 if lims:
1346 if lims:
1347 lims = [] # rebuild lims with ints/floats/strings
1347 lims = [] # rebuild lims with ints/floats/strings
1348 for lim in opts.l:
1348 for lim in opts.l:
1349 try:
1349 try:
1350 lims.append(int(lim))
1350 lims.append(int(lim))
1351 except ValueError:
1351 except ValueError:
1352 try:
1352 try:
1353 lims.append(float(lim))
1353 lims.append(float(lim))
1354 except ValueError:
1354 except ValueError:
1355 lims.append(lim)
1355 lims.append(lim)
1356
1356
1357 # trap output
1357 # Trap output.
1358 sys_stdout = sys.stdout
1359 stdout_trap = StringIO()
1358 stdout_trap = StringIO()
1359
1360 if hasattr(stats,'stream'):
1361 # In newer versions of python, the stats object has a 'stream'
1362 # attribute to write into.
1363 stats.stream = stdout_trap
1364 stats.print_stats(*lims)
1365 else:
1366 # For older versions, we manually redirect stdout during printing
1367 sys_stdout = sys.stdout
1360 try:
1368 try:
1361 sys.stdout = stdout_trap
1369 sys.stdout = stdout_trap
1362 stats.print_stats(*lims)
1370 stats.print_stats(*lims)
1363 finally:
1371 finally:
1364 sys.stdout = sys_stdout
1372 sys.stdout = sys_stdout
1373
1365 output = stdout_trap.getvalue()
1374 output = stdout_trap.getvalue()
1366 output = output.rstrip()
1375 output = output.rstrip()
1367
1376
1368 page(output,screen_lines=self.shell.rc.screen_length)
1377 page(output,screen_lines=self.shell.rc.screen_length)
1369 print sys_exit,
1378 print sys_exit,
1370
1379
1371 dump_file = opts.D[0]
1380 dump_file = opts.D[0]
1372 text_file = opts.T[0]
1381 text_file = opts.T[0]
1373 if dump_file:
1382 if dump_file:
1374 prof.dump_stats(dump_file)
1383 prof.dump_stats(dump_file)
1375 print '\n*** Profile stats marshalled to file',\
1384 print '\n*** Profile stats marshalled to file',\
1376 `dump_file`+'.',sys_exit
1385 `dump_file`+'.',sys_exit
1377 if text_file:
1386 if text_file:
1378 file(text_file,'w').write(output)
1387 pfile = file(text_file,'w')
1388 pfile.write(output)
1389 pfile.close()
1379 print '\n*** Profile printout saved to text file',\
1390 print '\n*** Profile printout saved to text file',\
1380 `text_file`+'.',sys_exit
1391 `text_file`+'.',sys_exit
1381
1392
1382 if opts.has_key('r'):
1393 if opts.has_key('r'):
1383 return stats
1394 return stats
1384 else:
1395 else:
1385 return None
1396 return None
1386
1397
1387 def magic_run(self, parameter_s ='',runner=None):
1398 def magic_run(self, parameter_s ='',runner=None):
1388 """Run the named file inside IPython as a program.
1399 """Run the named file inside IPython as a program.
1389
1400
1390 Usage:\\
1401 Usage:\\
1391 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1402 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1392
1403
1393 Parameters after the filename are passed as command-line arguments to
1404 Parameters after the filename are passed as command-line arguments to
1394 the program (put in sys.argv). Then, control returns to IPython's
1405 the program (put in sys.argv). Then, control returns to IPython's
1395 prompt.
1406 prompt.
1396
1407
1397 This is similar to running at a system prompt:\\
1408 This is similar to running at a system prompt:\\
1398 $ python file args\\
1409 $ python file args\\
1399 but with the advantage of giving you IPython's tracebacks, and of
1410 but with the advantage of giving you IPython's tracebacks, and of
1400 loading all variables into your interactive namespace for further use
1411 loading all variables into your interactive namespace for further use
1401 (unless -p is used, see below).
1412 (unless -p is used, see below).
1402
1413
1403 The file is executed in a namespace initially consisting only of
1414 The file is executed in a namespace initially consisting only of
1404 __name__=='__main__' and sys.argv constructed as indicated. It thus
1415 __name__=='__main__' and sys.argv constructed as indicated. It thus
1405 sees its environment as if it were being run as a stand-alone
1416 sees its environment as if it were being run as a stand-alone
1406 program. But after execution, the IPython interactive namespace gets
1417 program. But after execution, the IPython interactive namespace gets
1407 updated with all variables defined in the program (except for __name__
1418 updated with all variables defined in the program (except for __name__
1408 and sys.argv). This allows for very convenient loading of code for
1419 and sys.argv). This allows for very convenient loading of code for
1409 interactive work, while giving each program a 'clean sheet' to run in.
1420 interactive work, while giving each program a 'clean sheet' to run in.
1410
1421
1411 Options:
1422 Options:
1412
1423
1413 -n: __name__ is NOT set to '__main__', but to the running file's name
1424 -n: __name__ is NOT set to '__main__', but to the running file's name
1414 without extension (as python does under import). This allows running
1425 without extension (as python does under import). This allows running
1415 scripts and reloading the definitions in them without calling code
1426 scripts and reloading the definitions in them without calling code
1416 protected by an ' if __name__ == "__main__" ' clause.
1427 protected by an ' if __name__ == "__main__" ' clause.
1417
1428
1418 -i: run the file in IPython's namespace instead of an empty one. This
1429 -i: run the file in IPython's namespace instead of an empty one. This
1419 is useful if you are experimenting with code written in a text editor
1430 is useful if you are experimenting with code written in a text editor
1420 which depends on variables defined interactively.
1431 which depends on variables defined interactively.
1421
1432
1422 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1433 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1423 being run. This is particularly useful if IPython is being used to
1434 being run. This is particularly useful if IPython is being used to
1424 run unittests, which always exit with a sys.exit() call. In such
1435 run unittests, which always exit with a sys.exit() call. In such
1425 cases you are interested in the output of the test results, not in
1436 cases you are interested in the output of the test results, not in
1426 seeing a traceback of the unittest module.
1437 seeing a traceback of the unittest module.
1427
1438
1428 -t: print timing information at the end of the run. IPython will give
1439 -t: print timing information at the end of the run. IPython will give
1429 you an estimated CPU time consumption for your script, which under
1440 you an estimated CPU time consumption for your script, which under
1430 Unix uses the resource module to avoid the wraparound problems of
1441 Unix uses the resource module to avoid the wraparound problems of
1431 time.clock(). Under Unix, an estimate of time spent on system tasks
1442 time.clock(). Under Unix, an estimate of time spent on system tasks
1432 is also given (for Windows platforms this is reported as 0.0).
1443 is also given (for Windows platforms this is reported as 0.0).
1433
1444
1434 If -t is given, an additional -N<N> option can be given, where <N>
1445 If -t is given, an additional -N<N> option can be given, where <N>
1435 must be an integer indicating how many times you want the script to
1446 must be an integer indicating how many times you want the script to
1436 run. The final timing report will include total and per run results.
1447 run. The final timing report will include total and per run results.
1437
1448
1438 For example (testing the script uniq_stable.py):
1449 For example (testing the script uniq_stable.py):
1439
1450
1440 In [1]: run -t uniq_stable
1451 In [1]: run -t uniq_stable
1441
1452
1442 IPython CPU timings (estimated):\\
1453 IPython CPU timings (estimated):\\
1443 User : 0.19597 s.\\
1454 User : 0.19597 s.\\
1444 System: 0.0 s.\\
1455 System: 0.0 s.\\
1445
1456
1446 In [2]: run -t -N5 uniq_stable
1457 In [2]: run -t -N5 uniq_stable
1447
1458
1448 IPython CPU timings (estimated):\\
1459 IPython CPU timings (estimated):\\
1449 Total runs performed: 5\\
1460 Total runs performed: 5\\
1450 Times : Total Per run\\
1461 Times : Total Per run\\
1451 User : 0.910862 s, 0.1821724 s.\\
1462 User : 0.910862 s, 0.1821724 s.\\
1452 System: 0.0 s, 0.0 s.
1463 System: 0.0 s, 0.0 s.
1453
1464
1454 -d: run your program under the control of pdb, the Python debugger.
1465 -d: run your program under the control of pdb, the Python debugger.
1455 This allows you to execute your program step by step, watch variables,
1466 This allows you to execute your program step by step, watch variables,
1456 etc. Internally, what IPython does is similar to calling:
1467 etc. Internally, what IPython does is similar to calling:
1457
1468
1458 pdb.run('execfile("YOURFILENAME")')
1469 pdb.run('execfile("YOURFILENAME")')
1459
1470
1460 with a breakpoint set on line 1 of your file. You can change the line
1471 with a breakpoint set on line 1 of your file. You can change the line
1461 number for this automatic breakpoint to be <N> by using the -bN option
1472 number for this automatic breakpoint to be <N> by using the -bN option
1462 (where N must be an integer). For example:
1473 (where N must be an integer). For example:
1463
1474
1464 %run -d -b40 myscript
1475 %run -d -b40 myscript
1465
1476
1466 will set the first breakpoint at line 40 in myscript.py. Note that
1477 will set the first breakpoint at line 40 in myscript.py. Note that
1467 the first breakpoint must be set on a line which actually does
1478 the first breakpoint must be set on a line which actually does
1468 something (not a comment or docstring) for it to stop execution.
1479 something (not a comment or docstring) for it to stop execution.
1469
1480
1470 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1481 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1471 first enter 'c' (without qoutes) to start execution up to the first
1482 first enter 'c' (without qoutes) to start execution up to the first
1472 breakpoint.
1483 breakpoint.
1473
1484
1474 Entering 'help' gives information about the use of the debugger. You
1485 Entering 'help' gives information about the use of the debugger. You
1475 can easily see pdb's full documentation with "import pdb;pdb.help()"
1486 can easily see pdb's full documentation with "import pdb;pdb.help()"
1476 at a prompt.
1487 at a prompt.
1477
1488
1478 -p: run program under the control of the Python profiler module (which
1489 -p: run program under the control of the Python profiler module (which
1479 prints a detailed report of execution times, function calls, etc).
1490 prints a detailed report of execution times, function calls, etc).
1480
1491
1481 You can pass other options after -p which affect the behavior of the
1492 You can pass other options after -p which affect the behavior of the
1482 profiler itself. See the docs for %prun for details.
1493 profiler itself. See the docs for %prun for details.
1483
1494
1484 In this mode, the program's variables do NOT propagate back to the
1495 In this mode, the program's variables do NOT propagate back to the
1485 IPython interactive namespace (because they remain in the namespace
1496 IPython interactive namespace (because they remain in the namespace
1486 where the profiler executes them).
1497 where the profiler executes them).
1487
1498
1488 Internally this triggers a call to %prun, see its documentation for
1499 Internally this triggers a call to %prun, see its documentation for
1489 details on the options available specifically for profiling.
1500 details on the options available specifically for profiling.
1490
1501
1491 There is one special usage for which the text above doesn't apply:
1502 There is one special usage for which the text above doesn't apply:
1492 if the filename ends with .ipy, the file is run as ipython script,
1503 if the filename ends with .ipy, the file is run as ipython script,
1493 just as if the commands were written on IPython prompt.
1504 just as if the commands were written on IPython prompt.
1494 """
1505 """
1495
1506
1496 # get arguments and set sys.argv for program to be run.
1507 # get arguments and set sys.argv for program to be run.
1497 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1508 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1498 mode='list',list_all=1)
1509 mode='list',list_all=1)
1499
1510
1500 try:
1511 try:
1501 filename = get_py_filename(arg_lst[0])
1512 filename = get_py_filename(arg_lst[0])
1502 except IndexError:
1513 except IndexError:
1503 warn('you must provide at least a filename.')
1514 warn('you must provide at least a filename.')
1504 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1515 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1505 return
1516 return
1506 except IOError,msg:
1517 except IOError,msg:
1507 error(msg)
1518 error(msg)
1508 return
1519 return
1509
1520
1510 if filename.lower().endswith('.ipy'):
1521 if filename.lower().endswith('.ipy'):
1511 self.api.runlines(open(filename).read())
1522 self.api.runlines(open(filename).read())
1512 return
1523 return
1513
1524
1514 # Control the response to exit() calls made by the script being run
1525 # Control the response to exit() calls made by the script being run
1515 exit_ignore = opts.has_key('e')
1526 exit_ignore = opts.has_key('e')
1516
1527
1517 # Make sure that the running script gets a proper sys.argv as if it
1528 # Make sure that the running script gets a proper sys.argv as if it
1518 # were run from a system shell.
1529 # were run from a system shell.
1519 save_argv = sys.argv # save it for later restoring
1530 save_argv = sys.argv # save it for later restoring
1520 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1531 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1521
1532
1522 if opts.has_key('i'):
1533 if opts.has_key('i'):
1523 prog_ns = self.shell.user_ns
1534 prog_ns = self.shell.user_ns
1524 __name__save = self.shell.user_ns['__name__']
1535 __name__save = self.shell.user_ns['__name__']
1525 prog_ns['__name__'] = '__main__'
1536 prog_ns['__name__'] = '__main__'
1526 else:
1537 else:
1527 if opts.has_key('n'):
1538 if opts.has_key('n'):
1528 name = os.path.splitext(os.path.basename(filename))[0]
1539 name = os.path.splitext(os.path.basename(filename))[0]
1529 else:
1540 else:
1530 name = '__main__'
1541 name = '__main__'
1531 prog_ns = {'__name__':name}
1542 prog_ns = {'__name__':name}
1532
1543
1533 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1544 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1534 # set the __file__ global in the script's namespace
1545 # set the __file__ global in the script's namespace
1535 prog_ns['__file__'] = filename
1546 prog_ns['__file__'] = filename
1536
1547
1537 # pickle fix. See iplib for an explanation. But we need to make sure
1548 # pickle fix. See iplib for an explanation. But we need to make sure
1538 # that, if we overwrite __main__, we replace it at the end
1549 # that, if we overwrite __main__, we replace it at the end
1539 if prog_ns['__name__'] == '__main__':
1550 if prog_ns['__name__'] == '__main__':
1540 restore_main = sys.modules['__main__']
1551 restore_main = sys.modules['__main__']
1541 else:
1552 else:
1542 restore_main = False
1553 restore_main = False
1543
1554
1544 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1555 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1545
1556
1546 stats = None
1557 stats = None
1547 try:
1558 try:
1548 if self.shell.has_readline:
1559 if self.shell.has_readline:
1549 self.shell.savehist()
1560 self.shell.savehist()
1550
1561
1551 if opts.has_key('p'):
1562 if opts.has_key('p'):
1552 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1563 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1553 else:
1564 else:
1554 if opts.has_key('d'):
1565 if opts.has_key('d'):
1555 deb = Debugger.Pdb(self.shell.rc.colors)
1566 deb = Debugger.Pdb(self.shell.rc.colors)
1556 # reset Breakpoint state, which is moronically kept
1567 # reset Breakpoint state, which is moronically kept
1557 # in a class
1568 # in a class
1558 bdb.Breakpoint.next = 1
1569 bdb.Breakpoint.next = 1
1559 bdb.Breakpoint.bplist = {}
1570 bdb.Breakpoint.bplist = {}
1560 bdb.Breakpoint.bpbynumber = [None]
1571 bdb.Breakpoint.bpbynumber = [None]
1561 # Set an initial breakpoint to stop execution
1572 # Set an initial breakpoint to stop execution
1562 maxtries = 10
1573 maxtries = 10
1563 bp = int(opts.get('b',[1])[0])
1574 bp = int(opts.get('b',[1])[0])
1564 checkline = deb.checkline(filename,bp)
1575 checkline = deb.checkline(filename,bp)
1565 if not checkline:
1576 if not checkline:
1566 for bp in range(bp+1,bp+maxtries+1):
1577 for bp in range(bp+1,bp+maxtries+1):
1567 if deb.checkline(filename,bp):
1578 if deb.checkline(filename,bp):
1568 break
1579 break
1569 else:
1580 else:
1570 msg = ("\nI failed to find a valid line to set "
1581 msg = ("\nI failed to find a valid line to set "
1571 "a breakpoint\n"
1582 "a breakpoint\n"
1572 "after trying up to line: %s.\n"
1583 "after trying up to line: %s.\n"
1573 "Please set a valid breakpoint manually "
1584 "Please set a valid breakpoint manually "
1574 "with the -b option." % bp)
1585 "with the -b option." % bp)
1575 error(msg)
1586 error(msg)
1576 return
1587 return
1577 # if we find a good linenumber, set the breakpoint
1588 # if we find a good linenumber, set the breakpoint
1578 deb.do_break('%s:%s' % (filename,bp))
1589 deb.do_break('%s:%s' % (filename,bp))
1579 # Start file run
1590 # Start file run
1580 print "NOTE: Enter 'c' at the",
1591 print "NOTE: Enter 'c' at the",
1581 print "%s prompt to start your script." % deb.prompt
1592 print "%s prompt to start your script." % deb.prompt
1582 try:
1593 try:
1583 deb.run('execfile("%s")' % filename,prog_ns)
1594 deb.run('execfile("%s")' % filename,prog_ns)
1584
1595
1585 except:
1596 except:
1586 etype, value, tb = sys.exc_info()
1597 etype, value, tb = sys.exc_info()
1587 # Skip three frames in the traceback: the %run one,
1598 # Skip three frames in the traceback: the %run one,
1588 # one inside bdb.py, and the command-line typed by the
1599 # one inside bdb.py, and the command-line typed by the
1589 # user (run by exec in pdb itself).
1600 # user (run by exec in pdb itself).
1590 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1601 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1591 else:
1602 else:
1592 if runner is None:
1603 if runner is None:
1593 runner = self.shell.safe_execfile
1604 runner = self.shell.safe_execfile
1594 if opts.has_key('t'):
1605 if opts.has_key('t'):
1595 try:
1606 try:
1596 nruns = int(opts['N'][0])
1607 nruns = int(opts['N'][0])
1597 if nruns < 1:
1608 if nruns < 1:
1598 error('Number of runs must be >=1')
1609 error('Number of runs must be >=1')
1599 return
1610 return
1600 except (KeyError):
1611 except (KeyError):
1601 nruns = 1
1612 nruns = 1
1602 if nruns == 1:
1613 if nruns == 1:
1603 t0 = clock2()
1614 t0 = clock2()
1604 runner(filename,prog_ns,prog_ns,
1615 runner(filename,prog_ns,prog_ns,
1605 exit_ignore=exit_ignore)
1616 exit_ignore=exit_ignore)
1606 t1 = clock2()
1617 t1 = clock2()
1607 t_usr = t1[0]-t0[0]
1618 t_usr = t1[0]-t0[0]
1608 t_sys = t1[1]-t1[1]
1619 t_sys = t1[1]-t1[1]
1609 print "\nIPython CPU timings (estimated):"
1620 print "\nIPython CPU timings (estimated):"
1610 print " User : %10s s." % t_usr
1621 print " User : %10s s." % t_usr
1611 print " System: %10s s." % t_sys
1622 print " System: %10s s." % t_sys
1612 else:
1623 else:
1613 runs = range(nruns)
1624 runs = range(nruns)
1614 t0 = clock2()
1625 t0 = clock2()
1615 for nr in runs:
1626 for nr in runs:
1616 runner(filename,prog_ns,prog_ns,
1627 runner(filename,prog_ns,prog_ns,
1617 exit_ignore=exit_ignore)
1628 exit_ignore=exit_ignore)
1618 t1 = clock2()
1629 t1 = clock2()
1619 t_usr = t1[0]-t0[0]
1630 t_usr = t1[0]-t0[0]
1620 t_sys = t1[1]-t1[1]
1631 t_sys = t1[1]-t1[1]
1621 print "\nIPython CPU timings (estimated):"
1632 print "\nIPython CPU timings (estimated):"
1622 print "Total runs performed:",nruns
1633 print "Total runs performed:",nruns
1623 print " Times : %10s %10s" % ('Total','Per run')
1634 print " Times : %10s %10s" % ('Total','Per run')
1624 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1635 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1625 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1636 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1626
1637
1627 else:
1638 else:
1628 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1639 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1629 if opts.has_key('i'):
1640 if opts.has_key('i'):
1630 self.shell.user_ns['__name__'] = __name__save
1641 self.shell.user_ns['__name__'] = __name__save
1631 else:
1642 else:
1632 # update IPython interactive namespace
1643 # update IPython interactive namespace
1633 del prog_ns['__name__']
1644 del prog_ns['__name__']
1634 self.shell.user_ns.update(prog_ns)
1645 self.shell.user_ns.update(prog_ns)
1635 finally:
1646 finally:
1636 sys.argv = save_argv
1647 sys.argv = save_argv
1637 if restore_main:
1648 if restore_main:
1638 sys.modules['__main__'] = restore_main
1649 sys.modules['__main__'] = restore_main
1639 if self.shell.has_readline:
1650 if self.shell.has_readline:
1640 self.shell.readline.read_history_file(self.shell.histfile)
1651 self.shell.readline.read_history_file(self.shell.histfile)
1641
1652
1642 return stats
1653 return stats
1643
1654
1644 def magic_runlog(self, parameter_s =''):
1655 def magic_runlog(self, parameter_s =''):
1645 """Run files as logs.
1656 """Run files as logs.
1646
1657
1647 Usage:\\
1658 Usage:\\
1648 %runlog file1 file2 ...
1659 %runlog file1 file2 ...
1649
1660
1650 Run the named files (treating them as log files) in sequence inside
1661 Run the named files (treating them as log files) in sequence inside
1651 the interpreter, and return to the prompt. This is much slower than
1662 the interpreter, and return to the prompt. This is much slower than
1652 %run because each line is executed in a try/except block, but it
1663 %run because each line is executed in a try/except block, but it
1653 allows running files with syntax errors in them.
1664 allows running files with syntax errors in them.
1654
1665
1655 Normally IPython will guess when a file is one of its own logfiles, so
1666 Normally IPython will guess when a file is one of its own logfiles, so
1656 you can typically use %run even for logs. This shorthand allows you to
1667 you can typically use %run even for logs. This shorthand allows you to
1657 force any file to be treated as a log file."""
1668 force any file to be treated as a log file."""
1658
1669
1659 for f in parameter_s.split():
1670 for f in parameter_s.split():
1660 self.shell.safe_execfile(f,self.shell.user_ns,
1671 self.shell.safe_execfile(f,self.shell.user_ns,
1661 self.shell.user_ns,islog=1)
1672 self.shell.user_ns,islog=1)
1662
1673
1663 def magic_timeit(self, parameter_s =''):
1674 def magic_timeit(self, parameter_s =''):
1664 """Time execution of a Python statement or expression
1675 """Time execution of a Python statement or expression
1665
1676
1666 Usage:\\
1677 Usage:\\
1667 %timeit [-n<N> -r<R> [-t|-c]] statement
1678 %timeit [-n<N> -r<R> [-t|-c]] statement
1668
1679
1669 Time execution of a Python statement or expression using the timeit
1680 Time execution of a Python statement or expression using the timeit
1670 module.
1681 module.
1671
1682
1672 Options:
1683 Options:
1673 -n<N>: execute the given statement <N> times in a loop. If this value
1684 -n<N>: execute the given statement <N> times in a loop. If this value
1674 is not given, a fitting value is chosen.
1685 is not given, a fitting value is chosen.
1675
1686
1676 -r<R>: repeat the loop iteration <R> times and take the best result.
1687 -r<R>: repeat the loop iteration <R> times and take the best result.
1677 Default: 3
1688 Default: 3
1678
1689
1679 -t: use time.time to measure the time, which is the default on Unix.
1690 -t: use time.time to measure the time, which is the default on Unix.
1680 This function measures wall time.
1691 This function measures wall time.
1681
1692
1682 -c: use time.clock to measure the time, which is the default on
1693 -c: use time.clock to measure the time, which is the default on
1683 Windows and measures wall time. On Unix, resource.getrusage is used
1694 Windows and measures wall time. On Unix, resource.getrusage is used
1684 instead and returns the CPU user time.
1695 instead and returns the CPU user time.
1685
1696
1686 -p<P>: use a precision of <P> digits to display the timing result.
1697 -p<P>: use a precision of <P> digits to display the timing result.
1687 Default: 3
1698 Default: 3
1688
1699
1689
1700
1690 Examples:\\
1701 Examples:\\
1691 In [1]: %timeit pass
1702 In [1]: %timeit pass
1692 10000000 loops, best of 3: 53.3 ns per loop
1703 10000000 loops, best of 3: 53.3 ns per loop
1693
1704
1694 In [2]: u = None
1705 In [2]: u = None
1695
1706
1696 In [3]: %timeit u is None
1707 In [3]: %timeit u is None
1697 10000000 loops, best of 3: 184 ns per loop
1708 10000000 loops, best of 3: 184 ns per loop
1698
1709
1699 In [4]: %timeit -r 4 u == None
1710 In [4]: %timeit -r 4 u == None
1700 1000000 loops, best of 4: 242 ns per loop
1711 1000000 loops, best of 4: 242 ns per loop
1701
1712
1702 In [5]: import time
1713 In [5]: import time
1703
1714
1704 In [6]: %timeit -n1 time.sleep(2)
1715 In [6]: %timeit -n1 time.sleep(2)
1705 1 loops, best of 3: 2 s per loop
1716 1 loops, best of 3: 2 s per loop
1706
1717
1707
1718
1708 The times reported by %timeit will be slightly higher than those
1719 The times reported by %timeit will be slightly higher than those
1709 reported by the timeit.py script when variables are accessed. This is
1720 reported by the timeit.py script when variables are accessed. This is
1710 due to the fact that %timeit executes the statement in the namespace
1721 due to the fact that %timeit executes the statement in the namespace
1711 of the shell, compared with timeit.py, which uses a single setup
1722 of the shell, compared with timeit.py, which uses a single setup
1712 statement to import function or create variables. Generally, the bias
1723 statement to import function or create variables. Generally, the bias
1713 does not matter as long as results from timeit.py are not mixed with
1724 does not matter as long as results from timeit.py are not mixed with
1714 those from %timeit."""
1725 those from %timeit."""
1715
1726
1716 import timeit
1727 import timeit
1717 import math
1728 import math
1718
1729
1719 units = ["s", "ms", "\xc2\xb5s", "ns"]
1730 units = ["s", "ms", "\xc2\xb5s", "ns"]
1720 scaling = [1, 1e3, 1e6, 1e9]
1731 scaling = [1, 1e3, 1e6, 1e9]
1721
1732
1722 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1733 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1723 posix=False)
1734 posix=False)
1724 if stmt == "":
1735 if stmt == "":
1725 return
1736 return
1726 timefunc = timeit.default_timer
1737 timefunc = timeit.default_timer
1727 number = int(getattr(opts, "n", 0))
1738 number = int(getattr(opts, "n", 0))
1728 repeat = int(getattr(opts, "r", timeit.default_repeat))
1739 repeat = int(getattr(opts, "r", timeit.default_repeat))
1729 precision = int(getattr(opts, "p", 3))
1740 precision = int(getattr(opts, "p", 3))
1730 if hasattr(opts, "t"):
1741 if hasattr(opts, "t"):
1731 timefunc = time.time
1742 timefunc = time.time
1732 if hasattr(opts, "c"):
1743 if hasattr(opts, "c"):
1733 timefunc = clock
1744 timefunc = clock
1734
1745
1735 timer = timeit.Timer(timer=timefunc)
1746 timer = timeit.Timer(timer=timefunc)
1736 # this code has tight coupling to the inner workings of timeit.Timer,
1747 # this code has tight coupling to the inner workings of timeit.Timer,
1737 # but is there a better way to achieve that the code stmt has access
1748 # but is there a better way to achieve that the code stmt has access
1738 # to the shell namespace?
1749 # to the shell namespace?
1739
1750
1740 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1751 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1741 'setup': "pass"}
1752 'setup': "pass"}
1742 code = compile(src, "<magic-timeit>", "exec")
1753 code = compile(src, "<magic-timeit>", "exec")
1743 ns = {}
1754 ns = {}
1744 exec code in self.shell.user_ns, ns
1755 exec code in self.shell.user_ns, ns
1745 timer.inner = ns["inner"]
1756 timer.inner = ns["inner"]
1746
1757
1747 if number == 0:
1758 if number == 0:
1748 # determine number so that 0.2 <= total time < 2.0
1759 # determine number so that 0.2 <= total time < 2.0
1749 number = 1
1760 number = 1
1750 for i in range(1, 10):
1761 for i in range(1, 10):
1751 number *= 10
1762 number *= 10
1752 if timer.timeit(number) >= 0.2:
1763 if timer.timeit(number) >= 0.2:
1753 break
1764 break
1754
1765
1755 best = min(timer.repeat(repeat, number)) / number
1766 best = min(timer.repeat(repeat, number)) / number
1756
1767
1757 if best > 0.0:
1768 if best > 0.0:
1758 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1769 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1759 else:
1770 else:
1760 order = 3
1771 order = 3
1761 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1772 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1762 precision,
1773 precision,
1763 best * scaling[order],
1774 best * scaling[order],
1764 units[order])
1775 units[order])
1765
1776
1766 def magic_time(self,parameter_s = ''):
1777 def magic_time(self,parameter_s = ''):
1767 """Time execution of a Python statement or expression.
1778 """Time execution of a Python statement or expression.
1768
1779
1769 The CPU and wall clock times are printed, and the value of the
1780 The CPU and wall clock times are printed, and the value of the
1770 expression (if any) is returned. Note that under Win32, system time
1781 expression (if any) is returned. Note that under Win32, system time
1771 is always reported as 0, since it can not be measured.
1782 is always reported as 0, since it can not be measured.
1772
1783
1773 This function provides very basic timing functionality. In Python
1784 This function provides very basic timing functionality. In Python
1774 2.3, the timeit module offers more control and sophistication, so this
1785 2.3, the timeit module offers more control and sophistication, so this
1775 could be rewritten to use it (patches welcome).
1786 could be rewritten to use it (patches welcome).
1776
1787
1777 Some examples:
1788 Some examples:
1778
1789
1779 In [1]: time 2**128
1790 In [1]: time 2**128
1780 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1791 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1781 Wall time: 0.00
1792 Wall time: 0.00
1782 Out[1]: 340282366920938463463374607431768211456L
1793 Out[1]: 340282366920938463463374607431768211456L
1783
1794
1784 In [2]: n = 1000000
1795 In [2]: n = 1000000
1785
1796
1786 In [3]: time sum(range(n))
1797 In [3]: time sum(range(n))
1787 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1798 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1788 Wall time: 1.37
1799 Wall time: 1.37
1789 Out[3]: 499999500000L
1800 Out[3]: 499999500000L
1790
1801
1791 In [4]: time print 'hello world'
1802 In [4]: time print 'hello world'
1792 hello world
1803 hello world
1793 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1804 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1794 Wall time: 0.00
1805 Wall time: 0.00
1795 """
1806 """
1796
1807
1797 # fail immediately if the given expression can't be compiled
1808 # fail immediately if the given expression can't be compiled
1798 try:
1809 try:
1799 mode = 'eval'
1810 mode = 'eval'
1800 code = compile(parameter_s,'<timed eval>',mode)
1811 code = compile(parameter_s,'<timed eval>',mode)
1801 except SyntaxError:
1812 except SyntaxError:
1802 mode = 'exec'
1813 mode = 'exec'
1803 code = compile(parameter_s,'<timed exec>',mode)
1814 code = compile(parameter_s,'<timed exec>',mode)
1804 # skew measurement as little as possible
1815 # skew measurement as little as possible
1805 glob = self.shell.user_ns
1816 glob = self.shell.user_ns
1806 clk = clock2
1817 clk = clock2
1807 wtime = time.time
1818 wtime = time.time
1808 # time execution
1819 # time execution
1809 wall_st = wtime()
1820 wall_st = wtime()
1810 if mode=='eval':
1821 if mode=='eval':
1811 st = clk()
1822 st = clk()
1812 out = eval(code,glob)
1823 out = eval(code,glob)
1813 end = clk()
1824 end = clk()
1814 else:
1825 else:
1815 st = clk()
1826 st = clk()
1816 exec code in glob
1827 exec code in glob
1817 end = clk()
1828 end = clk()
1818 out = None
1829 out = None
1819 wall_end = wtime()
1830 wall_end = wtime()
1820 # Compute actual times and report
1831 # Compute actual times and report
1821 wall_time = wall_end-wall_st
1832 wall_time = wall_end-wall_st
1822 cpu_user = end[0]-st[0]
1833 cpu_user = end[0]-st[0]
1823 cpu_sys = end[1]-st[1]
1834 cpu_sys = end[1]-st[1]
1824 cpu_tot = cpu_user+cpu_sys
1835 cpu_tot = cpu_user+cpu_sys
1825 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1836 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1826 (cpu_user,cpu_sys,cpu_tot)
1837 (cpu_user,cpu_sys,cpu_tot)
1827 print "Wall time: %.2f" % wall_time
1838 print "Wall time: %.2f" % wall_time
1828 return out
1839 return out
1829
1840
1830 def magic_macro(self,parameter_s = ''):
1841 def magic_macro(self,parameter_s = ''):
1831 """Define a set of input lines as a macro for future re-execution.
1842 """Define a set of input lines as a macro for future re-execution.
1832
1843
1833 Usage:\\
1844 Usage:\\
1834 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1845 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1835
1846
1836 Options:
1847 Options:
1837
1848
1838 -r: use 'raw' input. By default, the 'processed' history is used,
1849 -r: use 'raw' input. By default, the 'processed' history is used,
1839 so that magics are loaded in their transformed version to valid
1850 so that magics are loaded in their transformed version to valid
1840 Python. If this option is given, the raw input as typed as the
1851 Python. If this option is given, the raw input as typed as the
1841 command line is used instead.
1852 command line is used instead.
1842
1853
1843 This will define a global variable called `name` which is a string
1854 This will define a global variable called `name` which is a string
1844 made of joining the slices and lines you specify (n1,n2,... numbers
1855 made of joining the slices and lines you specify (n1,n2,... numbers
1845 above) from your input history into a single string. This variable
1856 above) from your input history into a single string. This variable
1846 acts like an automatic function which re-executes those lines as if
1857 acts like an automatic function which re-executes those lines as if
1847 you had typed them. You just type 'name' at the prompt and the code
1858 you had typed them. You just type 'name' at the prompt and the code
1848 executes.
1859 executes.
1849
1860
1850 The notation for indicating number ranges is: n1-n2 means 'use line
1861 The notation for indicating number ranges is: n1-n2 means 'use line
1851 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1862 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1852 using the lines numbered 5,6 and 7.
1863 using the lines numbered 5,6 and 7.
1853
1864
1854 Note: as a 'hidden' feature, you can also use traditional python slice
1865 Note: as a 'hidden' feature, you can also use traditional python slice
1855 notation, where N:M means numbers N through M-1.
1866 notation, where N:M means numbers N through M-1.
1856
1867
1857 For example, if your history contains (%hist prints it):
1868 For example, if your history contains (%hist prints it):
1858
1869
1859 44: x=1\\
1870 44: x=1\\
1860 45: y=3\\
1871 45: y=3\\
1861 46: z=x+y\\
1872 46: z=x+y\\
1862 47: print x\\
1873 47: print x\\
1863 48: a=5\\
1874 48: a=5\\
1864 49: print 'x',x,'y',y\\
1875 49: print 'x',x,'y',y\\
1865
1876
1866 you can create a macro with lines 44 through 47 (included) and line 49
1877 you can create a macro with lines 44 through 47 (included) and line 49
1867 called my_macro with:
1878 called my_macro with:
1868
1879
1869 In [51]: %macro my_macro 44-47 49
1880 In [51]: %macro my_macro 44-47 49
1870
1881
1871 Now, typing `my_macro` (without quotes) will re-execute all this code
1882 Now, typing `my_macro` (without quotes) will re-execute all this code
1872 in one pass.
1883 in one pass.
1873
1884
1874 You don't need to give the line-numbers in order, and any given line
1885 You don't need to give the line-numbers in order, and any given line
1875 number can appear multiple times. You can assemble macros with any
1886 number can appear multiple times. You can assemble macros with any
1876 lines from your input history in any order.
1887 lines from your input history in any order.
1877
1888
1878 The macro is a simple object which holds its value in an attribute,
1889 The macro is a simple object which holds its value in an attribute,
1879 but IPython's display system checks for macros and executes them as
1890 but IPython's display system checks for macros and executes them as
1880 code instead of printing them when you type their name.
1891 code instead of printing them when you type their name.
1881
1892
1882 You can view a macro's contents by explicitly printing it with:
1893 You can view a macro's contents by explicitly printing it with:
1883
1894
1884 'print macro_name'.
1895 'print macro_name'.
1885
1896
1886 For one-off cases which DON'T contain magic function calls in them you
1897 For one-off cases which DON'T contain magic function calls in them you
1887 can obtain similar results by explicitly executing slices from your
1898 can obtain similar results by explicitly executing slices from your
1888 input history with:
1899 input history with:
1889
1900
1890 In [60]: exec In[44:48]+In[49]"""
1901 In [60]: exec In[44:48]+In[49]"""
1891
1902
1892 opts,args = self.parse_options(parameter_s,'r',mode='list')
1903 opts,args = self.parse_options(parameter_s,'r',mode='list')
1893 name,ranges = args[0], args[1:]
1904 name,ranges = args[0], args[1:]
1894 #print 'rng',ranges # dbg
1905 #print 'rng',ranges # dbg
1895 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1906 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1896 macro = Macro(lines)
1907 macro = Macro(lines)
1897 self.shell.user_ns.update({name:macro})
1908 self.shell.user_ns.update({name:macro})
1898 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1909 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1899 print 'Macro contents:'
1910 print 'Macro contents:'
1900 print macro,
1911 print macro,
1901
1912
1902 def magic_save(self,parameter_s = ''):
1913 def magic_save(self,parameter_s = ''):
1903 """Save a set of lines to a given filename.
1914 """Save a set of lines to a given filename.
1904
1915
1905 Usage:\\
1916 Usage:\\
1906 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1917 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1907
1918
1908 Options:
1919 Options:
1909
1920
1910 -r: use 'raw' input. By default, the 'processed' history is used,
1921 -r: use 'raw' input. By default, the 'processed' history is used,
1911 so that magics are loaded in their transformed version to valid
1922 so that magics are loaded in their transformed version to valid
1912 Python. If this option is given, the raw input as typed as the
1923 Python. If this option is given, the raw input as typed as the
1913 command line is used instead.
1924 command line is used instead.
1914
1925
1915 This function uses the same syntax as %macro for line extraction, but
1926 This function uses the same syntax as %macro for line extraction, but
1916 instead of creating a macro it saves the resulting string to the
1927 instead of creating a macro it saves the resulting string to the
1917 filename you specify.
1928 filename you specify.
1918
1929
1919 It adds a '.py' extension to the file if you don't do so yourself, and
1930 It adds a '.py' extension to the file if you don't do so yourself, and
1920 it asks for confirmation before overwriting existing files."""
1931 it asks for confirmation before overwriting existing files."""
1921
1932
1922 opts,args = self.parse_options(parameter_s,'r',mode='list')
1933 opts,args = self.parse_options(parameter_s,'r',mode='list')
1923 fname,ranges = args[0], args[1:]
1934 fname,ranges = args[0], args[1:]
1924 if not fname.endswith('.py'):
1935 if not fname.endswith('.py'):
1925 fname += '.py'
1936 fname += '.py'
1926 if os.path.isfile(fname):
1937 if os.path.isfile(fname):
1927 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1938 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1928 if ans.lower() not in ['y','yes']:
1939 if ans.lower() not in ['y','yes']:
1929 print 'Operation cancelled.'
1940 print 'Operation cancelled.'
1930 return
1941 return
1931 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1942 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1932 f = file(fname,'w')
1943 f = file(fname,'w')
1933 f.write(cmds)
1944 f.write(cmds)
1934 f.close()
1945 f.close()
1935 print 'The following commands were written to file `%s`:' % fname
1946 print 'The following commands were written to file `%s`:' % fname
1936 print cmds
1947 print cmds
1937
1948
1938 def _edit_macro(self,mname,macro):
1949 def _edit_macro(self,mname,macro):
1939 """open an editor with the macro data in a file"""
1950 """open an editor with the macro data in a file"""
1940 filename = self.shell.mktempfile(macro.value)
1951 filename = self.shell.mktempfile(macro.value)
1941 self.shell.hooks.editor(filename)
1952 self.shell.hooks.editor(filename)
1942
1953
1943 # and make a new macro object, to replace the old one
1954 # and make a new macro object, to replace the old one
1944 mfile = open(filename)
1955 mfile = open(filename)
1945 mvalue = mfile.read()
1956 mvalue = mfile.read()
1946 mfile.close()
1957 mfile.close()
1947 self.shell.user_ns[mname] = Macro(mvalue)
1958 self.shell.user_ns[mname] = Macro(mvalue)
1948
1959
1949 def magic_ed(self,parameter_s=''):
1960 def magic_ed(self,parameter_s=''):
1950 """Alias to %edit."""
1961 """Alias to %edit."""
1951 return self.magic_edit(parameter_s)
1962 return self.magic_edit(parameter_s)
1952
1963
1953 def magic_edit(self,parameter_s='',last_call=['','']):
1964 def magic_edit(self,parameter_s='',last_call=['','']):
1954 """Bring up an editor and execute the resulting code.
1965 """Bring up an editor and execute the resulting code.
1955
1966
1956 Usage:
1967 Usage:
1957 %edit [options] [args]
1968 %edit [options] [args]
1958
1969
1959 %edit runs IPython's editor hook. The default version of this hook is
1970 %edit runs IPython's editor hook. The default version of this hook is
1960 set to call the __IPYTHON__.rc.editor command. This is read from your
1971 set to call the __IPYTHON__.rc.editor command. This is read from your
1961 environment variable $EDITOR. If this isn't found, it will default to
1972 environment variable $EDITOR. If this isn't found, it will default to
1962 vi under Linux/Unix and to notepad under Windows. See the end of this
1973 vi under Linux/Unix and to notepad under Windows. See the end of this
1963 docstring for how to change the editor hook.
1974 docstring for how to change the editor hook.
1964
1975
1965 You can also set the value of this editor via the command line option
1976 You can also set the value of this editor via the command line option
1966 '-editor' or in your ipythonrc file. This is useful if you wish to use
1977 '-editor' or in your ipythonrc file. This is useful if you wish to use
1967 specifically for IPython an editor different from your typical default
1978 specifically for IPython an editor different from your typical default
1968 (and for Windows users who typically don't set environment variables).
1979 (and for Windows users who typically don't set environment variables).
1969
1980
1970 This command allows you to conveniently edit multi-line code right in
1981 This command allows you to conveniently edit multi-line code right in
1971 your IPython session.
1982 your IPython session.
1972
1983
1973 If called without arguments, %edit opens up an empty editor with a
1984 If called without arguments, %edit opens up an empty editor with a
1974 temporary file and will execute the contents of this file when you
1985 temporary file and will execute the contents of this file when you
1975 close it (don't forget to save it!).
1986 close it (don't forget to save it!).
1976
1987
1977
1988
1978 Options:
1989 Options:
1979
1990
1980 -n <number>: open the editor at a specified line number. By default,
1991 -n <number>: open the editor at a specified line number. By default,
1981 the IPython editor hook uses the unix syntax 'editor +N filename', but
1992 the IPython editor hook uses the unix syntax 'editor +N filename', but
1982 you can configure this by providing your own modified hook if your
1993 you can configure this by providing your own modified hook if your
1983 favorite editor supports line-number specifications with a different
1994 favorite editor supports line-number specifications with a different
1984 syntax.
1995 syntax.
1985
1996
1986 -p: this will call the editor with the same data as the previous time
1997 -p: this will call the editor with the same data as the previous time
1987 it was used, regardless of how long ago (in your current session) it
1998 it was used, regardless of how long ago (in your current session) it
1988 was.
1999 was.
1989
2000
1990 -r: use 'raw' input. This option only applies to input taken from the
2001 -r: use 'raw' input. This option only applies to input taken from the
1991 user's history. By default, the 'processed' history is used, so that
2002 user's history. By default, the 'processed' history is used, so that
1992 magics are loaded in their transformed version to valid Python. If
2003 magics are loaded in their transformed version to valid Python. If
1993 this option is given, the raw input as typed as the command line is
2004 this option is given, the raw input as typed as the command line is
1994 used instead. When you exit the editor, it will be executed by
2005 used instead. When you exit the editor, it will be executed by
1995 IPython's own processor.
2006 IPython's own processor.
1996
2007
1997 -x: do not execute the edited code immediately upon exit. This is
2008 -x: do not execute the edited code immediately upon exit. This is
1998 mainly useful if you are editing programs which need to be called with
2009 mainly useful if you are editing programs which need to be called with
1999 command line arguments, which you can then do using %run.
2010 command line arguments, which you can then do using %run.
2000
2011
2001
2012
2002 Arguments:
2013 Arguments:
2003
2014
2004 If arguments are given, the following possibilites exist:
2015 If arguments are given, the following possibilites exist:
2005
2016
2006 - The arguments are numbers or pairs of colon-separated numbers (like
2017 - The arguments are numbers or pairs of colon-separated numbers (like
2007 1 4:8 9). These are interpreted as lines of previous input to be
2018 1 4:8 9). These are interpreted as lines of previous input to be
2008 loaded into the editor. The syntax is the same of the %macro command.
2019 loaded into the editor. The syntax is the same of the %macro command.
2009
2020
2010 - If the argument doesn't start with a number, it is evaluated as a
2021 - If the argument doesn't start with a number, it is evaluated as a
2011 variable and its contents loaded into the editor. You can thus edit
2022 variable and its contents loaded into the editor. You can thus edit
2012 any string which contains python code (including the result of
2023 any string which contains python code (including the result of
2013 previous edits).
2024 previous edits).
2014
2025
2015 - If the argument is the name of an object (other than a string),
2026 - If the argument is the name of an object (other than a string),
2016 IPython will try to locate the file where it was defined and open the
2027 IPython will try to locate the file where it was defined and open the
2017 editor at the point where it is defined. You can use `%edit function`
2028 editor at the point where it is defined. You can use `%edit function`
2018 to load an editor exactly at the point where 'function' is defined,
2029 to load an editor exactly at the point where 'function' is defined,
2019 edit it and have the file be executed automatically.
2030 edit it and have the file be executed automatically.
2020
2031
2021 If the object is a macro (see %macro for details), this opens up your
2032 If the object is a macro (see %macro for details), this opens up your
2022 specified editor with a temporary file containing the macro's data.
2033 specified editor with a temporary file containing the macro's data.
2023 Upon exit, the macro is reloaded with the contents of the file.
2034 Upon exit, the macro is reloaded with the contents of the file.
2024
2035
2025 Note: opening at an exact line is only supported under Unix, and some
2036 Note: opening at an exact line is only supported under Unix, and some
2026 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2037 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2027 '+NUMBER' parameter necessary for this feature. Good editors like
2038 '+NUMBER' parameter necessary for this feature. Good editors like
2028 (X)Emacs, vi, jed, pico and joe all do.
2039 (X)Emacs, vi, jed, pico and joe all do.
2029
2040
2030 - If the argument is not found as a variable, IPython will look for a
2041 - If the argument is not found as a variable, IPython will look for a
2031 file with that name (adding .py if necessary) and load it into the
2042 file with that name (adding .py if necessary) and load it into the
2032 editor. It will execute its contents with execfile() when you exit,
2043 editor. It will execute its contents with execfile() when you exit,
2033 loading any code in the file into your interactive namespace.
2044 loading any code in the file into your interactive namespace.
2034
2045
2035 After executing your code, %edit will return as output the code you
2046 After executing your code, %edit will return as output the code you
2036 typed in the editor (except when it was an existing file). This way
2047 typed in the editor (except when it was an existing file). This way
2037 you can reload the code in further invocations of %edit as a variable,
2048 you can reload the code in further invocations of %edit as a variable,
2038 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2049 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2039 the output.
2050 the output.
2040
2051
2041 Note that %edit is also available through the alias %ed.
2052 Note that %edit is also available through the alias %ed.
2042
2053
2043 This is an example of creating a simple function inside the editor and
2054 This is an example of creating a simple function inside the editor and
2044 then modifying it. First, start up the editor:
2055 then modifying it. First, start up the editor:
2045
2056
2046 In [1]: ed\\
2057 In [1]: ed\\
2047 Editing... done. Executing edited code...\\
2058 Editing... done. Executing edited code...\\
2048 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2059 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2049
2060
2050 We can then call the function foo():
2061 We can then call the function foo():
2051
2062
2052 In [2]: foo()\\
2063 In [2]: foo()\\
2053 foo() was defined in an editing session
2064 foo() was defined in an editing session
2054
2065
2055 Now we edit foo. IPython automatically loads the editor with the
2066 Now we edit foo. IPython automatically loads the editor with the
2056 (temporary) file where foo() was previously defined:
2067 (temporary) file where foo() was previously defined:
2057
2068
2058 In [3]: ed foo\\
2069 In [3]: ed foo\\
2059 Editing... done. Executing edited code...
2070 Editing... done. Executing edited code...
2060
2071
2061 And if we call foo() again we get the modified version:
2072 And if we call foo() again we get the modified version:
2062
2073
2063 In [4]: foo()\\
2074 In [4]: foo()\\
2064 foo() has now been changed!
2075 foo() has now been changed!
2065
2076
2066 Here is an example of how to edit a code snippet successive
2077 Here is an example of how to edit a code snippet successive
2067 times. First we call the editor:
2078 times. First we call the editor:
2068
2079
2069 In [8]: ed\\
2080 In [8]: ed\\
2070 Editing... done. Executing edited code...\\
2081 Editing... done. Executing edited code...\\
2071 hello\\
2082 hello\\
2072 Out[8]: "print 'hello'\\n"
2083 Out[8]: "print 'hello'\\n"
2073
2084
2074 Now we call it again with the previous output (stored in _):
2085 Now we call it again with the previous output (stored in _):
2075
2086
2076 In [9]: ed _\\
2087 In [9]: ed _\\
2077 Editing... done. Executing edited code...\\
2088 Editing... done. Executing edited code...\\
2078 hello world\\
2089 hello world\\
2079 Out[9]: "print 'hello world'\\n"
2090 Out[9]: "print 'hello world'\\n"
2080
2091
2081 Now we call it with the output #8 (stored in _8, also as Out[8]):
2092 Now we call it with the output #8 (stored in _8, also as Out[8]):
2082
2093
2083 In [10]: ed _8\\
2094 In [10]: ed _8\\
2084 Editing... done. Executing edited code...\\
2095 Editing... done. Executing edited code...\\
2085 hello again\\
2096 hello again\\
2086 Out[10]: "print 'hello again'\\n"
2097 Out[10]: "print 'hello again'\\n"
2087
2098
2088
2099
2089 Changing the default editor hook:
2100 Changing the default editor hook:
2090
2101
2091 If you wish to write your own editor hook, you can put it in a
2102 If you wish to write your own editor hook, you can put it in a
2092 configuration file which you load at startup time. The default hook
2103 configuration file which you load at startup time. The default hook
2093 is defined in the IPython.hooks module, and you can use that as a
2104 is defined in the IPython.hooks module, and you can use that as a
2094 starting example for further modifications. That file also has
2105 starting example for further modifications. That file also has
2095 general instructions on how to set a new hook for use once you've
2106 general instructions on how to set a new hook for use once you've
2096 defined it."""
2107 defined it."""
2097
2108
2098 # FIXME: This function has become a convoluted mess. It needs a
2109 # FIXME: This function has become a convoluted mess. It needs a
2099 # ground-up rewrite with clean, simple logic.
2110 # ground-up rewrite with clean, simple logic.
2100
2111
2101 def make_filename(arg):
2112 def make_filename(arg):
2102 "Make a filename from the given args"
2113 "Make a filename from the given args"
2103 try:
2114 try:
2104 filename = get_py_filename(arg)
2115 filename = get_py_filename(arg)
2105 except IOError:
2116 except IOError:
2106 if args.endswith('.py'):
2117 if args.endswith('.py'):
2107 filename = arg
2118 filename = arg
2108 else:
2119 else:
2109 filename = None
2120 filename = None
2110 return filename
2121 return filename
2111
2122
2112 # custom exceptions
2123 # custom exceptions
2113 class DataIsObject(Exception): pass
2124 class DataIsObject(Exception): pass
2114
2125
2115 opts,args = self.parse_options(parameter_s,'prxn:')
2126 opts,args = self.parse_options(parameter_s,'prxn:')
2116 # Set a few locals from the options for convenience:
2127 # Set a few locals from the options for convenience:
2117 opts_p = opts.has_key('p')
2128 opts_p = opts.has_key('p')
2118 opts_r = opts.has_key('r')
2129 opts_r = opts.has_key('r')
2119
2130
2120 # Default line number value
2131 # Default line number value
2121 lineno = opts.get('n',None)
2132 lineno = opts.get('n',None)
2122
2133
2123 if opts_p:
2134 if opts_p:
2124 args = '_%s' % last_call[0]
2135 args = '_%s' % last_call[0]
2125 if not self.shell.user_ns.has_key(args):
2136 if not self.shell.user_ns.has_key(args):
2126 args = last_call[1]
2137 args = last_call[1]
2127
2138
2128 # use last_call to remember the state of the previous call, but don't
2139 # use last_call to remember the state of the previous call, but don't
2129 # let it be clobbered by successive '-p' calls.
2140 # let it be clobbered by successive '-p' calls.
2130 try:
2141 try:
2131 last_call[0] = self.shell.outputcache.prompt_count
2142 last_call[0] = self.shell.outputcache.prompt_count
2132 if not opts_p:
2143 if not opts_p:
2133 last_call[1] = parameter_s
2144 last_call[1] = parameter_s
2134 except:
2145 except:
2135 pass
2146 pass
2136
2147
2137 # by default this is done with temp files, except when the given
2148 # by default this is done with temp files, except when the given
2138 # arg is a filename
2149 # arg is a filename
2139 use_temp = 1
2150 use_temp = 1
2140
2151
2141 if re.match(r'\d',args):
2152 if re.match(r'\d',args):
2142 # Mode where user specifies ranges of lines, like in %macro.
2153 # Mode where user specifies ranges of lines, like in %macro.
2143 # This means that you can't edit files whose names begin with
2154 # This means that you can't edit files whose names begin with
2144 # numbers this way. Tough.
2155 # numbers this way. Tough.
2145 ranges = args.split()
2156 ranges = args.split()
2146 data = ''.join(self.extract_input_slices(ranges,opts_r))
2157 data = ''.join(self.extract_input_slices(ranges,opts_r))
2147 elif args.endswith('.py'):
2158 elif args.endswith('.py'):
2148 filename = make_filename(args)
2159 filename = make_filename(args)
2149 data = ''
2160 data = ''
2150 use_temp = 0
2161 use_temp = 0
2151 elif args:
2162 elif args:
2152 try:
2163 try:
2153 # Load the parameter given as a variable. If not a string,
2164 # Load the parameter given as a variable. If not a string,
2154 # process it as an object instead (below)
2165 # process it as an object instead (below)
2155
2166
2156 #print '*** args',args,'type',type(args) # dbg
2167 #print '*** args',args,'type',type(args) # dbg
2157 data = eval(args,self.shell.user_ns)
2168 data = eval(args,self.shell.user_ns)
2158 if not type(data) in StringTypes:
2169 if not type(data) in StringTypes:
2159 raise DataIsObject
2170 raise DataIsObject
2160
2171
2161 except (NameError,SyntaxError):
2172 except (NameError,SyntaxError):
2162 # given argument is not a variable, try as a filename
2173 # given argument is not a variable, try as a filename
2163 filename = make_filename(args)
2174 filename = make_filename(args)
2164 if filename is None:
2175 if filename is None:
2165 warn("Argument given (%s) can't be found as a variable "
2176 warn("Argument given (%s) can't be found as a variable "
2166 "or as a filename." % args)
2177 "or as a filename." % args)
2167 return
2178 return
2168
2179
2169 data = ''
2180 data = ''
2170 use_temp = 0
2181 use_temp = 0
2171 except DataIsObject:
2182 except DataIsObject:
2172
2183
2173 # macros have a special edit function
2184 # macros have a special edit function
2174 if isinstance(data,Macro):
2185 if isinstance(data,Macro):
2175 self._edit_macro(args,data)
2186 self._edit_macro(args,data)
2176 return
2187 return
2177
2188
2178 # For objects, try to edit the file where they are defined
2189 # For objects, try to edit the file where they are defined
2179 try:
2190 try:
2180 filename = inspect.getabsfile(data)
2191 filename = inspect.getabsfile(data)
2181 datafile = 1
2192 datafile = 1
2182 except TypeError:
2193 except TypeError:
2183 filename = make_filename(args)
2194 filename = make_filename(args)
2184 datafile = 1
2195 datafile = 1
2185 warn('Could not find file where `%s` is defined.\n'
2196 warn('Could not find file where `%s` is defined.\n'
2186 'Opening a file named `%s`' % (args,filename))
2197 'Opening a file named `%s`' % (args,filename))
2187 # Now, make sure we can actually read the source (if it was in
2198 # Now, make sure we can actually read the source (if it was in
2188 # a temp file it's gone by now).
2199 # a temp file it's gone by now).
2189 if datafile:
2200 if datafile:
2190 try:
2201 try:
2191 if lineno is None:
2202 if lineno is None:
2192 lineno = inspect.getsourcelines(data)[1]
2203 lineno = inspect.getsourcelines(data)[1]
2193 except IOError:
2204 except IOError:
2194 filename = make_filename(args)
2205 filename = make_filename(args)
2195 if filename is None:
2206 if filename is None:
2196 warn('The file `%s` where `%s` was defined cannot '
2207 warn('The file `%s` where `%s` was defined cannot '
2197 'be read.' % (filename,data))
2208 'be read.' % (filename,data))
2198 return
2209 return
2199 use_temp = 0
2210 use_temp = 0
2200 else:
2211 else:
2201 data = ''
2212 data = ''
2202
2213
2203 if use_temp:
2214 if use_temp:
2204 filename = self.shell.mktempfile(data)
2215 filename = self.shell.mktempfile(data)
2205 print 'IPython will make a temporary file named:',filename
2216 print 'IPython will make a temporary file named:',filename
2206
2217
2207 # do actual editing here
2218 # do actual editing here
2208 print 'Editing...',
2219 print 'Editing...',
2209 sys.stdout.flush()
2220 sys.stdout.flush()
2210 self.shell.hooks.editor(filename,lineno)
2221 self.shell.hooks.editor(filename,lineno)
2211 if opts.has_key('x'): # -x prevents actual execution
2222 if opts.has_key('x'): # -x prevents actual execution
2212 print
2223 print
2213 else:
2224 else:
2214 print 'done. Executing edited code...'
2225 print 'done. Executing edited code...'
2215 if opts_r:
2226 if opts_r:
2216 self.shell.runlines(file_read(filename))
2227 self.shell.runlines(file_read(filename))
2217 else:
2228 else:
2218 self.shell.safe_execfile(filename,self.shell.user_ns)
2229 self.shell.safe_execfile(filename,self.shell.user_ns)
2219 if use_temp:
2230 if use_temp:
2220 try:
2231 try:
2221 return open(filename).read()
2232 return open(filename).read()
2222 except IOError,msg:
2233 except IOError,msg:
2223 if msg.filename == filename:
2234 if msg.filename == filename:
2224 warn('File not found. Did you forget to save?')
2235 warn('File not found. Did you forget to save?')
2225 return
2236 return
2226 else:
2237 else:
2227 self.shell.showtraceback()
2238 self.shell.showtraceback()
2228
2239
2229 def magic_xmode(self,parameter_s = ''):
2240 def magic_xmode(self,parameter_s = ''):
2230 """Switch modes for the exception handlers.
2241 """Switch modes for the exception handlers.
2231
2242
2232 Valid modes: Plain, Context and Verbose.
2243 Valid modes: Plain, Context and Verbose.
2233
2244
2234 If called without arguments, acts as a toggle."""
2245 If called without arguments, acts as a toggle."""
2235
2246
2236 def xmode_switch_err(name):
2247 def xmode_switch_err(name):
2237 warn('Error changing %s exception modes.\n%s' %
2248 warn('Error changing %s exception modes.\n%s' %
2238 (name,sys.exc_info()[1]))
2249 (name,sys.exc_info()[1]))
2239
2250
2240 shell = self.shell
2251 shell = self.shell
2241 new_mode = parameter_s.strip().capitalize()
2252 new_mode = parameter_s.strip().capitalize()
2242 try:
2253 try:
2243 shell.InteractiveTB.set_mode(mode=new_mode)
2254 shell.InteractiveTB.set_mode(mode=new_mode)
2244 print 'Exception reporting mode:',shell.InteractiveTB.mode
2255 print 'Exception reporting mode:',shell.InteractiveTB.mode
2245 except:
2256 except:
2246 xmode_switch_err('user')
2257 xmode_switch_err('user')
2247
2258
2248 # threaded shells use a special handler in sys.excepthook
2259 # threaded shells use a special handler in sys.excepthook
2249 if shell.isthreaded:
2260 if shell.isthreaded:
2250 try:
2261 try:
2251 shell.sys_excepthook.set_mode(mode=new_mode)
2262 shell.sys_excepthook.set_mode(mode=new_mode)
2252 except:
2263 except:
2253 xmode_switch_err('threaded')
2264 xmode_switch_err('threaded')
2254
2265
2255 def magic_colors(self,parameter_s = ''):
2266 def magic_colors(self,parameter_s = ''):
2256 """Switch color scheme for prompts, info system and exception handlers.
2267 """Switch color scheme for prompts, info system and exception handlers.
2257
2268
2258 Currently implemented schemes: NoColor, Linux, LightBG.
2269 Currently implemented schemes: NoColor, Linux, LightBG.
2259
2270
2260 Color scheme names are not case-sensitive."""
2271 Color scheme names are not case-sensitive."""
2261
2272
2262 def color_switch_err(name):
2273 def color_switch_err(name):
2263 warn('Error changing %s color schemes.\n%s' %
2274 warn('Error changing %s color schemes.\n%s' %
2264 (name,sys.exc_info()[1]))
2275 (name,sys.exc_info()[1]))
2265
2276
2266
2277
2267 new_scheme = parameter_s.strip()
2278 new_scheme = parameter_s.strip()
2268 if not new_scheme:
2279 if not new_scheme:
2269 print 'You must specify a color scheme.'
2280 print 'You must specify a color scheme.'
2270 return
2281 return
2271 import IPython.rlineimpl as readline
2282 import IPython.rlineimpl as readline
2272 if not readline.have_readline:
2283 if not readline.have_readline:
2273 msg = """\
2284 msg = """\
2274 Proper color support under MS Windows requires the pyreadline library.
2285 Proper color support under MS Windows requires the pyreadline library.
2275 You can find it at:
2286 You can find it at:
2276 http://ipython.scipy.org/moin/PyReadline/Intro
2287 http://ipython.scipy.org/moin/PyReadline/Intro
2277 Gary's readline needs the ctypes module, from:
2288 Gary's readline needs the ctypes module, from:
2278 http://starship.python.net/crew/theller/ctypes
2289 http://starship.python.net/crew/theller/ctypes
2279 (Note that ctypes is already part of Python versions 2.5 and newer).
2290 (Note that ctypes is already part of Python versions 2.5 and newer).
2280
2291
2281 Defaulting color scheme to 'NoColor'"""
2292 Defaulting color scheme to 'NoColor'"""
2282 new_scheme = 'NoColor'
2293 new_scheme = 'NoColor'
2283 warn(msg)
2294 warn(msg)
2284 # local shortcut
2295 # local shortcut
2285 shell = self.shell
2296 shell = self.shell
2286
2297
2287 # Set prompt colors
2298 # Set prompt colors
2288 try:
2299 try:
2289 shell.outputcache.set_colors(new_scheme)
2300 shell.outputcache.set_colors(new_scheme)
2290 except:
2301 except:
2291 color_switch_err('prompt')
2302 color_switch_err('prompt')
2292 else:
2303 else:
2293 shell.rc.colors = \
2304 shell.rc.colors = \
2294 shell.outputcache.color_table.active_scheme_name
2305 shell.outputcache.color_table.active_scheme_name
2295 # Set exception colors
2306 # Set exception colors
2296 try:
2307 try:
2297 shell.InteractiveTB.set_colors(scheme = new_scheme)
2308 shell.InteractiveTB.set_colors(scheme = new_scheme)
2298 shell.SyntaxTB.set_colors(scheme = new_scheme)
2309 shell.SyntaxTB.set_colors(scheme = new_scheme)
2299 except:
2310 except:
2300 color_switch_err('exception')
2311 color_switch_err('exception')
2301
2312
2302 # threaded shells use a verbose traceback in sys.excepthook
2313 # threaded shells use a verbose traceback in sys.excepthook
2303 if shell.isthreaded:
2314 if shell.isthreaded:
2304 try:
2315 try:
2305 shell.sys_excepthook.set_colors(scheme=new_scheme)
2316 shell.sys_excepthook.set_colors(scheme=new_scheme)
2306 except:
2317 except:
2307 color_switch_err('system exception handler')
2318 color_switch_err('system exception handler')
2308
2319
2309 # Set info (for 'object?') colors
2320 # Set info (for 'object?') colors
2310 if shell.rc.color_info:
2321 if shell.rc.color_info:
2311 try:
2322 try:
2312 shell.inspector.set_active_scheme(new_scheme)
2323 shell.inspector.set_active_scheme(new_scheme)
2313 except:
2324 except:
2314 color_switch_err('object inspector')
2325 color_switch_err('object inspector')
2315 else:
2326 else:
2316 shell.inspector.set_active_scheme('NoColor')
2327 shell.inspector.set_active_scheme('NoColor')
2317
2328
2318 def magic_color_info(self,parameter_s = ''):
2329 def magic_color_info(self,parameter_s = ''):
2319 """Toggle color_info.
2330 """Toggle color_info.
2320
2331
2321 The color_info configuration parameter controls whether colors are
2332 The color_info configuration parameter controls whether colors are
2322 used for displaying object details (by things like %psource, %pfile or
2333 used for displaying object details (by things like %psource, %pfile or
2323 the '?' system). This function toggles this value with each call.
2334 the '?' system). This function toggles this value with each call.
2324
2335
2325 Note that unless you have a fairly recent pager (less works better
2336 Note that unless you have a fairly recent pager (less works better
2326 than more) in your system, using colored object information displays
2337 than more) in your system, using colored object information displays
2327 will not work properly. Test it and see."""
2338 will not work properly. Test it and see."""
2328
2339
2329 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2340 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2330 self.magic_colors(self.shell.rc.colors)
2341 self.magic_colors(self.shell.rc.colors)
2331 print 'Object introspection functions have now coloring:',
2342 print 'Object introspection functions have now coloring:',
2332 print ['OFF','ON'][self.shell.rc.color_info]
2343 print ['OFF','ON'][self.shell.rc.color_info]
2333
2344
2334 def magic_Pprint(self, parameter_s=''):
2345 def magic_Pprint(self, parameter_s=''):
2335 """Toggle pretty printing on/off."""
2346 """Toggle pretty printing on/off."""
2336
2347
2337 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2348 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2338 print 'Pretty printing has been turned', \
2349 print 'Pretty printing has been turned', \
2339 ['OFF','ON'][self.shell.rc.pprint]
2350 ['OFF','ON'][self.shell.rc.pprint]
2340
2351
2341 def magic_exit(self, parameter_s=''):
2352 def magic_exit(self, parameter_s=''):
2342 """Exit IPython, confirming if configured to do so.
2353 """Exit IPython, confirming if configured to do so.
2343
2354
2344 You can configure whether IPython asks for confirmation upon exit by
2355 You can configure whether IPython asks for confirmation upon exit by
2345 setting the confirm_exit flag in the ipythonrc file."""
2356 setting the confirm_exit flag in the ipythonrc file."""
2346
2357
2347 self.shell.exit()
2358 self.shell.exit()
2348
2359
2349 def magic_quit(self, parameter_s=''):
2360 def magic_quit(self, parameter_s=''):
2350 """Exit IPython, confirming if configured to do so (like %exit)"""
2361 """Exit IPython, confirming if configured to do so (like %exit)"""
2351
2362
2352 self.shell.exit()
2363 self.shell.exit()
2353
2364
2354 def magic_Exit(self, parameter_s=''):
2365 def magic_Exit(self, parameter_s=''):
2355 """Exit IPython without confirmation."""
2366 """Exit IPython without confirmation."""
2356
2367
2357 self.shell.exit_now = True
2368 self.shell.exit_now = True
2358
2369
2359 def magic_Quit(self, parameter_s=''):
2370 def magic_Quit(self, parameter_s=''):
2360 """Exit IPython without confirmation (like %Exit)."""
2371 """Exit IPython without confirmation (like %Exit)."""
2361
2372
2362 self.shell.exit_now = True
2373 self.shell.exit_now = True
2363
2374
2364 #......................................................................
2375 #......................................................................
2365 # Functions to implement unix shell-type things
2376 # Functions to implement unix shell-type things
2366
2377
2367 def magic_alias(self, parameter_s = ''):
2378 def magic_alias(self, parameter_s = ''):
2368 """Define an alias for a system command.
2379 """Define an alias for a system command.
2369
2380
2370 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2381 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2371
2382
2372 Then, typing 'alias_name params' will execute the system command 'cmd
2383 Then, typing 'alias_name params' will execute the system command 'cmd
2373 params' (from your underlying operating system).
2384 params' (from your underlying operating system).
2374
2385
2375 Aliases have lower precedence than magic functions and Python normal
2386 Aliases have lower precedence than magic functions and Python normal
2376 variables, so if 'foo' is both a Python variable and an alias, the
2387 variables, so if 'foo' is both a Python variable and an alias, the
2377 alias can not be executed until 'del foo' removes the Python variable.
2388 alias can not be executed until 'del foo' removes the Python variable.
2378
2389
2379 You can use the %l specifier in an alias definition to represent the
2390 You can use the %l specifier in an alias definition to represent the
2380 whole line when the alias is called. For example:
2391 whole line when the alias is called. For example:
2381
2392
2382 In [2]: alias all echo "Input in brackets: <%l>"\\
2393 In [2]: alias all echo "Input in brackets: <%l>"\\
2383 In [3]: all hello world\\
2394 In [3]: all hello world\\
2384 Input in brackets: <hello world>
2395 Input in brackets: <hello world>
2385
2396
2386 You can also define aliases with parameters using %s specifiers (one
2397 You can also define aliases with parameters using %s specifiers (one
2387 per parameter):
2398 per parameter):
2388
2399
2389 In [1]: alias parts echo first %s second %s\\
2400 In [1]: alias parts echo first %s second %s\\
2390 In [2]: %parts A B\\
2401 In [2]: %parts A B\\
2391 first A second B\\
2402 first A second B\\
2392 In [3]: %parts A\\
2403 In [3]: %parts A\\
2393 Incorrect number of arguments: 2 expected.\\
2404 Incorrect number of arguments: 2 expected.\\
2394 parts is an alias to: 'echo first %s second %s'
2405 parts is an alias to: 'echo first %s second %s'
2395
2406
2396 Note that %l and %s are mutually exclusive. You can only use one or
2407 Note that %l and %s are mutually exclusive. You can only use one or
2397 the other in your aliases.
2408 the other in your aliases.
2398
2409
2399 Aliases expand Python variables just like system calls using ! or !!
2410 Aliases expand Python variables just like system calls using ! or !!
2400 do: all expressions prefixed with '$' get expanded. For details of
2411 do: all expressions prefixed with '$' get expanded. For details of
2401 the semantic rules, see PEP-215:
2412 the semantic rules, see PEP-215:
2402 http://www.python.org/peps/pep-0215.html. This is the library used by
2413 http://www.python.org/peps/pep-0215.html. This is the library used by
2403 IPython for variable expansion. If you want to access a true shell
2414 IPython for variable expansion. If you want to access a true shell
2404 variable, an extra $ is necessary to prevent its expansion by IPython:
2415 variable, an extra $ is necessary to prevent its expansion by IPython:
2405
2416
2406 In [6]: alias show echo\\
2417 In [6]: alias show echo\\
2407 In [7]: PATH='A Python string'\\
2418 In [7]: PATH='A Python string'\\
2408 In [8]: show $PATH\\
2419 In [8]: show $PATH\\
2409 A Python string\\
2420 A Python string\\
2410 In [9]: show $$PATH\\
2421 In [9]: show $$PATH\\
2411 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2422 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2412
2423
2413 You can use the alias facility to acess all of $PATH. See the %rehash
2424 You can use the alias facility to acess all of $PATH. See the %rehash
2414 and %rehashx functions, which automatically create aliases for the
2425 and %rehashx functions, which automatically create aliases for the
2415 contents of your $PATH.
2426 contents of your $PATH.
2416
2427
2417 If called with no parameters, %alias prints the current alias table."""
2428 If called with no parameters, %alias prints the current alias table."""
2418
2429
2419 par = parameter_s.strip()
2430 par = parameter_s.strip()
2420 if not par:
2431 if not par:
2421 stored = self.db.get('stored_aliases', {} )
2432 stored = self.db.get('stored_aliases', {} )
2422 atab = self.shell.alias_table
2433 atab = self.shell.alias_table
2423 aliases = atab.keys()
2434 aliases = atab.keys()
2424 aliases.sort()
2435 aliases.sort()
2425 res = []
2436 res = []
2426 showlast = []
2437 showlast = []
2427 for alias in aliases:
2438 for alias in aliases:
2428 tgt = atab[alias][1]
2439 tgt = atab[alias][1]
2429 # 'interesting' aliases
2440 # 'interesting' aliases
2430 if (alias in stored or
2441 if (alias in stored or
2431 alias != os.path.splitext(tgt)[0] or
2442 alias != os.path.splitext(tgt)[0] or
2432 ' ' in tgt):
2443 ' ' in tgt):
2433 showlast.append((alias, tgt))
2444 showlast.append((alias, tgt))
2434 else:
2445 else:
2435 res.append((alias, tgt ))
2446 res.append((alias, tgt ))
2436
2447
2437 # show most interesting aliases last
2448 # show most interesting aliases last
2438 res.extend(showlast)
2449 res.extend(showlast)
2439 print "Total number of aliases:",len(aliases)
2450 print "Total number of aliases:",len(aliases)
2440 return res
2451 return res
2441 try:
2452 try:
2442 alias,cmd = par.split(None,1)
2453 alias,cmd = par.split(None,1)
2443 except:
2454 except:
2444 print OInspect.getdoc(self.magic_alias)
2455 print OInspect.getdoc(self.magic_alias)
2445 else:
2456 else:
2446 nargs = cmd.count('%s')
2457 nargs = cmd.count('%s')
2447 if nargs>0 and cmd.find('%l')>=0:
2458 if nargs>0 and cmd.find('%l')>=0:
2448 error('The %s and %l specifiers are mutually exclusive '
2459 error('The %s and %l specifiers are mutually exclusive '
2449 'in alias definitions.')
2460 'in alias definitions.')
2450 else: # all looks OK
2461 else: # all looks OK
2451 self.shell.alias_table[alias] = (nargs,cmd)
2462 self.shell.alias_table[alias] = (nargs,cmd)
2452 self.shell.alias_table_validate(verbose=0)
2463 self.shell.alias_table_validate(verbose=0)
2453 # end magic_alias
2464 # end magic_alias
2454
2465
2455 def magic_unalias(self, parameter_s = ''):
2466 def magic_unalias(self, parameter_s = ''):
2456 """Remove an alias"""
2467 """Remove an alias"""
2457
2468
2458 aname = parameter_s.strip()
2469 aname = parameter_s.strip()
2459 if aname in self.shell.alias_table:
2470 if aname in self.shell.alias_table:
2460 del self.shell.alias_table[aname]
2471 del self.shell.alias_table[aname]
2461 stored = self.db.get('stored_aliases', {} )
2472 stored = self.db.get('stored_aliases', {} )
2462 if aname in stored:
2473 if aname in stored:
2463 print "Removing %stored alias",aname
2474 print "Removing %stored alias",aname
2464 del stored[aname]
2475 del stored[aname]
2465 self.db['stored_aliases'] = stored
2476 self.db['stored_aliases'] = stored
2466
2477
2467 def magic_rehash(self, parameter_s = ''):
2478 def magic_rehash(self, parameter_s = ''):
2468 """Update the alias table with all entries in $PATH.
2479 """Update the alias table with all entries in $PATH.
2469
2480
2470 This version does no checks on execute permissions or whether the
2481 This version does no checks on execute permissions or whether the
2471 contents of $PATH are truly files (instead of directories or something
2482 contents of $PATH are truly files (instead of directories or something
2472 else). For such a safer (but slower) version, use %rehashx."""
2483 else). For such a safer (but slower) version, use %rehashx."""
2473
2484
2474 # This function (and rehashx) manipulate the alias_table directly
2485 # This function (and rehashx) manipulate the alias_table directly
2475 # rather than calling magic_alias, for speed reasons. A rehash on a
2486 # rather than calling magic_alias, for speed reasons. A rehash on a
2476 # typical Linux box involves several thousand entries, so efficiency
2487 # typical Linux box involves several thousand entries, so efficiency
2477 # here is a top concern.
2488 # here is a top concern.
2478
2489
2479 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2490 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2480 alias_table = self.shell.alias_table
2491 alias_table = self.shell.alias_table
2481 for pdir in path:
2492 for pdir in path:
2482 for ff in os.listdir(pdir):
2493 for ff in os.listdir(pdir):
2483 # each entry in the alias table must be (N,name), where
2494 # each entry in the alias table must be (N,name), where
2484 # N is the number of positional arguments of the alias.
2495 # N is the number of positional arguments of the alias.
2485 alias_table[ff] = (0,ff)
2496 alias_table[ff] = (0,ff)
2486 # Make sure the alias table doesn't contain keywords or builtins
2497 # Make sure the alias table doesn't contain keywords or builtins
2487 self.shell.alias_table_validate()
2498 self.shell.alias_table_validate()
2488 # Call again init_auto_alias() so we get 'rm -i' and other modified
2499 # Call again init_auto_alias() so we get 'rm -i' and other modified
2489 # aliases since %rehash will probably clobber them
2500 # aliases since %rehash will probably clobber them
2490 self.shell.init_auto_alias()
2501 self.shell.init_auto_alias()
2491
2502
2492 def magic_rehashx(self, parameter_s = ''):
2503 def magic_rehashx(self, parameter_s = ''):
2493 """Update the alias table with all executable files in $PATH.
2504 """Update the alias table with all executable files in $PATH.
2494
2505
2495 This version explicitly checks that every entry in $PATH is a file
2506 This version explicitly checks that every entry in $PATH is a file
2496 with execute access (os.X_OK), so it is much slower than %rehash.
2507 with execute access (os.X_OK), so it is much slower than %rehash.
2497
2508
2498 Under Windows, it checks executability as a match agains a
2509 Under Windows, it checks executability as a match agains a
2499 '|'-separated string of extensions, stored in the IPython config
2510 '|'-separated string of extensions, stored in the IPython config
2500 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2511 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2501
2512
2502 path = [os.path.abspath(os.path.expanduser(p)) for p in
2513 path = [os.path.abspath(os.path.expanduser(p)) for p in
2503 os.environ['PATH'].split(os.pathsep)]
2514 os.environ['PATH'].split(os.pathsep)]
2504 path = filter(os.path.isdir,path)
2515 path = filter(os.path.isdir,path)
2505
2516
2506 alias_table = self.shell.alias_table
2517 alias_table = self.shell.alias_table
2507 syscmdlist = []
2518 syscmdlist = []
2508 if os.name == 'posix':
2519 if os.name == 'posix':
2509 isexec = lambda fname:os.path.isfile(fname) and \
2520 isexec = lambda fname:os.path.isfile(fname) and \
2510 os.access(fname,os.X_OK)
2521 os.access(fname,os.X_OK)
2511 else:
2522 else:
2512
2523
2513 try:
2524 try:
2514 winext = os.environ['pathext'].replace(';','|').replace('.','')
2525 winext = os.environ['pathext'].replace(';','|').replace('.','')
2515 except KeyError:
2526 except KeyError:
2516 winext = 'exe|com|bat|py'
2527 winext = 'exe|com|bat|py'
2517 if 'py' not in winext:
2528 if 'py' not in winext:
2518 winext += '|py'
2529 winext += '|py'
2519 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2530 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2520 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2531 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2521 savedir = os.getcwd()
2532 savedir = os.getcwd()
2522 try:
2533 try:
2523 # write the whole loop for posix/Windows so we don't have an if in
2534 # write the whole loop for posix/Windows so we don't have an if in
2524 # the innermost part
2535 # the innermost part
2525 if os.name == 'posix':
2536 if os.name == 'posix':
2526 for pdir in path:
2537 for pdir in path:
2527 os.chdir(pdir)
2538 os.chdir(pdir)
2528 for ff in os.listdir(pdir):
2539 for ff in os.listdir(pdir):
2529 if isexec(ff) and ff not in self.shell.no_alias:
2540 if isexec(ff) and ff not in self.shell.no_alias:
2530 # each entry in the alias table must be (N,name),
2541 # each entry in the alias table must be (N,name),
2531 # where N is the number of positional arguments of the
2542 # where N is the number of positional arguments of the
2532 # alias.
2543 # alias.
2533 alias_table[ff] = (0,ff)
2544 alias_table[ff] = (0,ff)
2534 syscmdlist.append(ff)
2545 syscmdlist.append(ff)
2535 else:
2546 else:
2536 for pdir in path:
2547 for pdir in path:
2537 os.chdir(pdir)
2548 os.chdir(pdir)
2538 for ff in os.listdir(pdir):
2549 for ff in os.listdir(pdir):
2539 base, ext = os.path.splitext(ff)
2550 base, ext = os.path.splitext(ff)
2540 if isexec(ff) and base not in self.shell.no_alias:
2551 if isexec(ff) and base not in self.shell.no_alias:
2541 if ext.lower() == '.exe':
2552 if ext.lower() == '.exe':
2542 ff = base
2553 ff = base
2543 alias_table[base] = (0,ff)
2554 alias_table[base] = (0,ff)
2544 syscmdlist.append(ff)
2555 syscmdlist.append(ff)
2545 # Make sure the alias table doesn't contain keywords or builtins
2556 # Make sure the alias table doesn't contain keywords or builtins
2546 self.shell.alias_table_validate()
2557 self.shell.alias_table_validate()
2547 # Call again init_auto_alias() so we get 'rm -i' and other
2558 # Call again init_auto_alias() so we get 'rm -i' and other
2548 # modified aliases since %rehashx will probably clobber them
2559 # modified aliases since %rehashx will probably clobber them
2549 self.shell.init_auto_alias()
2560 self.shell.init_auto_alias()
2550 db = self.getapi().db
2561 db = self.getapi().db
2551 db['syscmdlist'] = syscmdlist
2562 db['syscmdlist'] = syscmdlist
2552 finally:
2563 finally:
2553 os.chdir(savedir)
2564 os.chdir(savedir)
2554
2565
2555 def magic_pwd(self, parameter_s = ''):
2566 def magic_pwd(self, parameter_s = ''):
2556 """Return the current working directory path."""
2567 """Return the current working directory path."""
2557 return os.getcwd()
2568 return os.getcwd()
2558
2569
2559 def magic_cd(self, parameter_s=''):
2570 def magic_cd(self, parameter_s=''):
2560 """Change the current working directory.
2571 """Change the current working directory.
2561
2572
2562 This command automatically maintains an internal list of directories
2573 This command automatically maintains an internal list of directories
2563 you visit during your IPython session, in the variable _dh. The
2574 you visit during your IPython session, in the variable _dh. The
2564 command %dhist shows this history nicely formatted. You can also
2575 command %dhist shows this history nicely formatted. You can also
2565 do 'cd -<tab>' to see directory history conveniently.
2576 do 'cd -<tab>' to see directory history conveniently.
2566
2577
2567 Usage:
2578 Usage:
2568
2579
2569 cd 'dir': changes to directory 'dir'.
2580 cd 'dir': changes to directory 'dir'.
2570
2581
2571 cd -: changes to the last visited directory.
2582 cd -: changes to the last visited directory.
2572
2583
2573 cd -<n>: changes to the n-th directory in the directory history.
2584 cd -<n>: changes to the n-th directory in the directory history.
2574
2585
2575 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2586 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2576 (note: cd <bookmark_name> is enough if there is no
2587 (note: cd <bookmark_name> is enough if there is no
2577 directory <bookmark_name>, but a bookmark with the name exists.)
2588 directory <bookmark_name>, but a bookmark with the name exists.)
2578 'cd -b <tab>' allows you to tab-complete bookmark names.
2589 'cd -b <tab>' allows you to tab-complete bookmark names.
2579
2590
2580 Options:
2591 Options:
2581
2592
2582 -q: quiet. Do not print the working directory after the cd command is
2593 -q: quiet. Do not print the working directory after the cd command is
2583 executed. By default IPython's cd command does print this directory,
2594 executed. By default IPython's cd command does print this directory,
2584 since the default prompts do not display path information.
2595 since the default prompts do not display path information.
2585
2596
2586 Note that !cd doesn't work for this purpose because the shell where
2597 Note that !cd doesn't work for this purpose because the shell where
2587 !command runs is immediately discarded after executing 'command'."""
2598 !command runs is immediately discarded after executing 'command'."""
2588
2599
2589 parameter_s = parameter_s.strip()
2600 parameter_s = parameter_s.strip()
2590 #bkms = self.shell.persist.get("bookmarks",{})
2601 #bkms = self.shell.persist.get("bookmarks",{})
2591
2602
2592 numcd = re.match(r'(-)(\d+)$',parameter_s)
2603 numcd = re.match(r'(-)(\d+)$',parameter_s)
2593 # jump in directory history by number
2604 # jump in directory history by number
2594 if numcd:
2605 if numcd:
2595 nn = int(numcd.group(2))
2606 nn = int(numcd.group(2))
2596 try:
2607 try:
2597 ps = self.shell.user_ns['_dh'][nn]
2608 ps = self.shell.user_ns['_dh'][nn]
2598 except IndexError:
2609 except IndexError:
2599 print 'The requested directory does not exist in history.'
2610 print 'The requested directory does not exist in history.'
2600 return
2611 return
2601 else:
2612 else:
2602 opts = {}
2613 opts = {}
2603 else:
2614 else:
2604 #turn all non-space-escaping backslashes to slashes,
2615 #turn all non-space-escaping backslashes to slashes,
2605 # for c:\windows\directory\names\
2616 # for c:\windows\directory\names\
2606 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2617 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2607 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2618 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2608 # jump to previous
2619 # jump to previous
2609 if ps == '-':
2620 if ps == '-':
2610 try:
2621 try:
2611 ps = self.shell.user_ns['_dh'][-2]
2622 ps = self.shell.user_ns['_dh'][-2]
2612 except IndexError:
2623 except IndexError:
2613 print 'No previous directory to change to.'
2624 print 'No previous directory to change to.'
2614 return
2625 return
2615 # jump to bookmark if needed
2626 # jump to bookmark if needed
2616 else:
2627 else:
2617 if not os.path.isdir(ps) or opts.has_key('b'):
2628 if not os.path.isdir(ps) or opts.has_key('b'):
2618 bkms = self.db.get('bookmarks', {})
2629 bkms = self.db.get('bookmarks', {})
2619
2630
2620 if bkms.has_key(ps):
2631 if bkms.has_key(ps):
2621 target = bkms[ps]
2632 target = bkms[ps]
2622 print '(bookmark:%s) -> %s' % (ps,target)
2633 print '(bookmark:%s) -> %s' % (ps,target)
2623 ps = target
2634 ps = target
2624 else:
2635 else:
2625 if opts.has_key('b'):
2636 if opts.has_key('b'):
2626 error("Bookmark '%s' not found. "
2637 error("Bookmark '%s' not found. "
2627 "Use '%%bookmark -l' to see your bookmarks." % ps)
2638 "Use '%%bookmark -l' to see your bookmarks." % ps)
2628 return
2639 return
2629
2640
2630 # at this point ps should point to the target dir
2641 # at this point ps should point to the target dir
2631 if ps:
2642 if ps:
2632 try:
2643 try:
2633 os.chdir(os.path.expanduser(ps))
2644 os.chdir(os.path.expanduser(ps))
2634 if self.shell.rc.term_title:
2645 if self.shell.rc.term_title:
2635 #print 'set term title:',self.shell.rc.term_title # dbg
2646 #print 'set term title:',self.shell.rc.term_title # dbg
2636 ttitle = ("IPy:" + (
2647 ttitle = ("IPy:" + (
2637 os.getcwd() == '/' and '/' or \
2648 os.getcwd() == '/' and '/' or \
2638 os.path.basename(os.getcwd())))
2649 os.path.basename(os.getcwd())))
2639 platutils.set_term_title(ttitle)
2650 platutils.set_term_title(ttitle)
2640 except OSError:
2651 except OSError:
2641 print sys.exc_info()[1]
2652 print sys.exc_info()[1]
2642 else:
2653 else:
2643 self.shell.user_ns['_dh'].append(os.getcwd())
2654 self.shell.user_ns['_dh'].append(os.getcwd())
2644 else:
2655 else:
2645 os.chdir(self.shell.home_dir)
2656 os.chdir(self.shell.home_dir)
2646 if self.shell.rc.term_title:
2657 if self.shell.rc.term_title:
2647 platutils.set_term_title("IPy:~")
2658 platutils.set_term_title("IPy:~")
2648 self.shell.user_ns['_dh'].append(os.getcwd())
2659 self.shell.user_ns['_dh'].append(os.getcwd())
2649 if not 'q' in opts:
2660 if not 'q' in opts:
2650 print self.shell.user_ns['_dh'][-1]
2661 print self.shell.user_ns['_dh'][-1]
2651
2662
2652 def magic_dhist(self, parameter_s=''):
2663 def magic_dhist(self, parameter_s=''):
2653 """Print your history of visited directories.
2664 """Print your history of visited directories.
2654
2665
2655 %dhist -> print full history\\
2666 %dhist -> print full history\\
2656 %dhist n -> print last n entries only\\
2667 %dhist n -> print last n entries only\\
2657 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2668 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2658
2669
2659 This history is automatically maintained by the %cd command, and
2670 This history is automatically maintained by the %cd command, and
2660 always available as the global list variable _dh. You can use %cd -<n>
2671 always available as the global list variable _dh. You can use %cd -<n>
2661 to go to directory number <n>."""
2672 to go to directory number <n>."""
2662
2673
2663 dh = self.shell.user_ns['_dh']
2674 dh = self.shell.user_ns['_dh']
2664 if parameter_s:
2675 if parameter_s:
2665 try:
2676 try:
2666 args = map(int,parameter_s.split())
2677 args = map(int,parameter_s.split())
2667 except:
2678 except:
2668 self.arg_err(Magic.magic_dhist)
2679 self.arg_err(Magic.magic_dhist)
2669 return
2680 return
2670 if len(args) == 1:
2681 if len(args) == 1:
2671 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2682 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2672 elif len(args) == 2:
2683 elif len(args) == 2:
2673 ini,fin = args
2684 ini,fin = args
2674 else:
2685 else:
2675 self.arg_err(Magic.magic_dhist)
2686 self.arg_err(Magic.magic_dhist)
2676 return
2687 return
2677 else:
2688 else:
2678 ini,fin = 0,len(dh)
2689 ini,fin = 0,len(dh)
2679 nlprint(dh,
2690 nlprint(dh,
2680 header = 'Directory history (kept in _dh)',
2691 header = 'Directory history (kept in _dh)',
2681 start=ini,stop=fin)
2692 start=ini,stop=fin)
2682
2693
2683 def magic_env(self, parameter_s=''):
2694 def magic_env(self, parameter_s=''):
2684 """List environment variables."""
2695 """List environment variables."""
2685
2696
2686 return os.environ.data
2697 return os.environ.data
2687
2698
2688 def magic_pushd(self, parameter_s=''):
2699 def magic_pushd(self, parameter_s=''):
2689 """Place the current dir on stack and change directory.
2700 """Place the current dir on stack and change directory.
2690
2701
2691 Usage:\\
2702 Usage:\\
2692 %pushd ['dirname']
2703 %pushd ['dirname']
2693
2704
2694 %pushd with no arguments does a %pushd to your home directory.
2705 %pushd with no arguments does a %pushd to your home directory.
2695 """
2706 """
2696 if parameter_s == '': parameter_s = '~'
2707 if parameter_s == '': parameter_s = '~'
2697 dir_s = self.shell.dir_stack
2708 dir_s = self.shell.dir_stack
2698 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2709 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2699 os.path.expanduser(self.shell.dir_stack[0]):
2710 os.path.expanduser(self.shell.dir_stack[0]):
2700 try:
2711 try:
2701 self.magic_cd(parameter_s)
2712 self.magic_cd(parameter_s)
2702 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2713 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2703 self.magic_dirs()
2714 self.magic_dirs()
2704 except:
2715 except:
2705 print 'Invalid directory'
2716 print 'Invalid directory'
2706 else:
2717 else:
2707 print 'You are already there!'
2718 print 'You are already there!'
2708
2719
2709 def magic_popd(self, parameter_s=''):
2720 def magic_popd(self, parameter_s=''):
2710 """Change to directory popped off the top of the stack.
2721 """Change to directory popped off the top of the stack.
2711 """
2722 """
2712 if len (self.shell.dir_stack) > 1:
2723 if len (self.shell.dir_stack) > 1:
2713 self.shell.dir_stack.pop(0)
2724 self.shell.dir_stack.pop(0)
2714 self.magic_cd(self.shell.dir_stack[0])
2725 self.magic_cd(self.shell.dir_stack[0])
2715 print self.shell.dir_stack[0]
2726 print self.shell.dir_stack[0]
2716 else:
2727 else:
2717 print "You can't remove the starting directory from the stack:",\
2728 print "You can't remove the starting directory from the stack:",\
2718 self.shell.dir_stack
2729 self.shell.dir_stack
2719
2730
2720 def magic_dirs(self, parameter_s=''):
2731 def magic_dirs(self, parameter_s=''):
2721 """Return the current directory stack."""
2732 """Return the current directory stack."""
2722
2733
2723 return self.shell.dir_stack[:]
2734 return self.shell.dir_stack[:]
2724
2735
2725 def magic_sc(self, parameter_s=''):
2736 def magic_sc(self, parameter_s=''):
2726 """Shell capture - execute a shell command and capture its output.
2737 """Shell capture - execute a shell command and capture its output.
2727
2738
2728 DEPRECATED. Suboptimal, retained for backwards compatibility.
2739 DEPRECATED. Suboptimal, retained for backwards compatibility.
2729
2740
2730 You should use the form 'var = !command' instead. Example:
2741 You should use the form 'var = !command' instead. Example:
2731
2742
2732 "%sc -l myfiles = ls ~" should now be written as
2743 "%sc -l myfiles = ls ~" should now be written as
2733
2744
2734 "myfiles = !ls ~"
2745 "myfiles = !ls ~"
2735
2746
2736 myfiles.s, myfiles.l and myfiles.n still apply as documented
2747 myfiles.s, myfiles.l and myfiles.n still apply as documented
2737 below.
2748 below.
2738
2749
2739 --
2750 --
2740 %sc [options] varname=command
2751 %sc [options] varname=command
2741
2752
2742 IPython will run the given command using commands.getoutput(), and
2753 IPython will run the given command using commands.getoutput(), and
2743 will then update the user's interactive namespace with a variable
2754 will then update the user's interactive namespace with a variable
2744 called varname, containing the value of the call. Your command can
2755 called varname, containing the value of the call. Your command can
2745 contain shell wildcards, pipes, etc.
2756 contain shell wildcards, pipes, etc.
2746
2757
2747 The '=' sign in the syntax is mandatory, and the variable name you
2758 The '=' sign in the syntax is mandatory, and the variable name you
2748 supply must follow Python's standard conventions for valid names.
2759 supply must follow Python's standard conventions for valid names.
2749
2760
2750 (A special format without variable name exists for internal use)
2761 (A special format without variable name exists for internal use)
2751
2762
2752 Options:
2763 Options:
2753
2764
2754 -l: list output. Split the output on newlines into a list before
2765 -l: list output. Split the output on newlines into a list before
2755 assigning it to the given variable. By default the output is stored
2766 assigning it to the given variable. By default the output is stored
2756 as a single string.
2767 as a single string.
2757
2768
2758 -v: verbose. Print the contents of the variable.
2769 -v: verbose. Print the contents of the variable.
2759
2770
2760 In most cases you should not need to split as a list, because the
2771 In most cases you should not need to split as a list, because the
2761 returned value is a special type of string which can automatically
2772 returned value is a special type of string which can automatically
2762 provide its contents either as a list (split on newlines) or as a
2773 provide its contents either as a list (split on newlines) or as a
2763 space-separated string. These are convenient, respectively, either
2774 space-separated string. These are convenient, respectively, either
2764 for sequential processing or to be passed to a shell command.
2775 for sequential processing or to be passed to a shell command.
2765
2776
2766 For example:
2777 For example:
2767
2778
2768 # Capture into variable a
2779 # Capture into variable a
2769 In [9]: sc a=ls *py
2780 In [9]: sc a=ls *py
2770
2781
2771 # a is a string with embedded newlines
2782 # a is a string with embedded newlines
2772 In [10]: a
2783 In [10]: a
2773 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2784 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2774
2785
2775 # which can be seen as a list:
2786 # which can be seen as a list:
2776 In [11]: a.l
2787 In [11]: a.l
2777 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2788 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2778
2789
2779 # or as a whitespace-separated string:
2790 # or as a whitespace-separated string:
2780 In [12]: a.s
2791 In [12]: a.s
2781 Out[12]: 'setup.py win32_manual_post_install.py'
2792 Out[12]: 'setup.py win32_manual_post_install.py'
2782
2793
2783 # a.s is useful to pass as a single command line:
2794 # a.s is useful to pass as a single command line:
2784 In [13]: !wc -l $a.s
2795 In [13]: !wc -l $a.s
2785 146 setup.py
2796 146 setup.py
2786 130 win32_manual_post_install.py
2797 130 win32_manual_post_install.py
2787 276 total
2798 276 total
2788
2799
2789 # while the list form is useful to loop over:
2800 # while the list form is useful to loop over:
2790 In [14]: for f in a.l:
2801 In [14]: for f in a.l:
2791 ....: !wc -l $f
2802 ....: !wc -l $f
2792 ....:
2803 ....:
2793 146 setup.py
2804 146 setup.py
2794 130 win32_manual_post_install.py
2805 130 win32_manual_post_install.py
2795
2806
2796 Similiarly, the lists returned by the -l option are also special, in
2807 Similiarly, the lists returned by the -l option are also special, in
2797 the sense that you can equally invoke the .s attribute on them to
2808 the sense that you can equally invoke the .s attribute on them to
2798 automatically get a whitespace-separated string from their contents:
2809 automatically get a whitespace-separated string from their contents:
2799
2810
2800 In [1]: sc -l b=ls *py
2811 In [1]: sc -l b=ls *py
2801
2812
2802 In [2]: b
2813 In [2]: b
2803 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2814 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2804
2815
2805 In [3]: b.s
2816 In [3]: b.s
2806 Out[3]: 'setup.py win32_manual_post_install.py'
2817 Out[3]: 'setup.py win32_manual_post_install.py'
2807
2818
2808 In summary, both the lists and strings used for ouptut capture have
2819 In summary, both the lists and strings used for ouptut capture have
2809 the following special attributes:
2820 the following special attributes:
2810
2821
2811 .l (or .list) : value as list.
2822 .l (or .list) : value as list.
2812 .n (or .nlstr): value as newline-separated string.
2823 .n (or .nlstr): value as newline-separated string.
2813 .s (or .spstr): value as space-separated string.
2824 .s (or .spstr): value as space-separated string.
2814 """
2825 """
2815
2826
2816 opts,args = self.parse_options(parameter_s,'lv')
2827 opts,args = self.parse_options(parameter_s,'lv')
2817 # Try to get a variable name and command to run
2828 # Try to get a variable name and command to run
2818 try:
2829 try:
2819 # the variable name must be obtained from the parse_options
2830 # the variable name must be obtained from the parse_options
2820 # output, which uses shlex.split to strip options out.
2831 # output, which uses shlex.split to strip options out.
2821 var,_ = args.split('=',1)
2832 var,_ = args.split('=',1)
2822 var = var.strip()
2833 var = var.strip()
2823 # But the the command has to be extracted from the original input
2834 # But the the command has to be extracted from the original input
2824 # parameter_s, not on what parse_options returns, to avoid the
2835 # parameter_s, not on what parse_options returns, to avoid the
2825 # quote stripping which shlex.split performs on it.
2836 # quote stripping which shlex.split performs on it.
2826 _,cmd = parameter_s.split('=',1)
2837 _,cmd = parameter_s.split('=',1)
2827 except ValueError:
2838 except ValueError:
2828 var,cmd = '',''
2839 var,cmd = '',''
2829 # If all looks ok, proceed
2840 # If all looks ok, proceed
2830 out,err = self.shell.getoutputerror(cmd)
2841 out,err = self.shell.getoutputerror(cmd)
2831 if err:
2842 if err:
2832 print >> Term.cerr,err
2843 print >> Term.cerr,err
2833 if opts.has_key('l'):
2844 if opts.has_key('l'):
2834 out = SList(out.split('\n'))
2845 out = SList(out.split('\n'))
2835 else:
2846 else:
2836 out = LSString(out)
2847 out = LSString(out)
2837 if opts.has_key('v'):
2848 if opts.has_key('v'):
2838 print '%s ==\n%s' % (var,pformat(out))
2849 print '%s ==\n%s' % (var,pformat(out))
2839 if var:
2850 if var:
2840 self.shell.user_ns.update({var:out})
2851 self.shell.user_ns.update({var:out})
2841 else:
2852 else:
2842 return out
2853 return out
2843
2854
2844 def magic_sx(self, parameter_s=''):
2855 def magic_sx(self, parameter_s=''):
2845 """Shell execute - run a shell command and capture its output.
2856 """Shell execute - run a shell command and capture its output.
2846
2857
2847 %sx command
2858 %sx command
2848
2859
2849 IPython will run the given command using commands.getoutput(), and
2860 IPython will run the given command using commands.getoutput(), and
2850 return the result formatted as a list (split on '\\n'). Since the
2861 return the result formatted as a list (split on '\\n'). Since the
2851 output is _returned_, it will be stored in ipython's regular output
2862 output is _returned_, it will be stored in ipython's regular output
2852 cache Out[N] and in the '_N' automatic variables.
2863 cache Out[N] and in the '_N' automatic variables.
2853
2864
2854 Notes:
2865 Notes:
2855
2866
2856 1) If an input line begins with '!!', then %sx is automatically
2867 1) If an input line begins with '!!', then %sx is automatically
2857 invoked. That is, while:
2868 invoked. That is, while:
2858 !ls
2869 !ls
2859 causes ipython to simply issue system('ls'), typing
2870 causes ipython to simply issue system('ls'), typing
2860 !!ls
2871 !!ls
2861 is a shorthand equivalent to:
2872 is a shorthand equivalent to:
2862 %sx ls
2873 %sx ls
2863
2874
2864 2) %sx differs from %sc in that %sx automatically splits into a list,
2875 2) %sx differs from %sc in that %sx automatically splits into a list,
2865 like '%sc -l'. The reason for this is to make it as easy as possible
2876 like '%sc -l'. The reason for this is to make it as easy as possible
2866 to process line-oriented shell output via further python commands.
2877 to process line-oriented shell output via further python commands.
2867 %sc is meant to provide much finer control, but requires more
2878 %sc is meant to provide much finer control, but requires more
2868 typing.
2879 typing.
2869
2880
2870 3) Just like %sc -l, this is a list with special attributes:
2881 3) Just like %sc -l, this is a list with special attributes:
2871
2882
2872 .l (or .list) : value as list.
2883 .l (or .list) : value as list.
2873 .n (or .nlstr): value as newline-separated string.
2884 .n (or .nlstr): value as newline-separated string.
2874 .s (or .spstr): value as whitespace-separated string.
2885 .s (or .spstr): value as whitespace-separated string.
2875
2886
2876 This is very useful when trying to use such lists as arguments to
2887 This is very useful when trying to use such lists as arguments to
2877 system commands."""
2888 system commands."""
2878
2889
2879 if parameter_s:
2890 if parameter_s:
2880 out,err = self.shell.getoutputerror(parameter_s)
2891 out,err = self.shell.getoutputerror(parameter_s)
2881 if err:
2892 if err:
2882 print >> Term.cerr,err
2893 print >> Term.cerr,err
2883 return SList(out.split('\n'))
2894 return SList(out.split('\n'))
2884
2895
2885 def magic_bg(self, parameter_s=''):
2896 def magic_bg(self, parameter_s=''):
2886 """Run a job in the background, in a separate thread.
2897 """Run a job in the background, in a separate thread.
2887
2898
2888 For example,
2899 For example,
2889
2900
2890 %bg myfunc(x,y,z=1)
2901 %bg myfunc(x,y,z=1)
2891
2902
2892 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2903 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2893 execution starts, a message will be printed indicating the job
2904 execution starts, a message will be printed indicating the job
2894 number. If your job number is 5, you can use
2905 number. If your job number is 5, you can use
2895
2906
2896 myvar = jobs.result(5) or myvar = jobs[5].result
2907 myvar = jobs.result(5) or myvar = jobs[5].result
2897
2908
2898 to assign this result to variable 'myvar'.
2909 to assign this result to variable 'myvar'.
2899
2910
2900 IPython has a job manager, accessible via the 'jobs' object. You can
2911 IPython has a job manager, accessible via the 'jobs' object. You can
2901 type jobs? to get more information about it, and use jobs.<TAB> to see
2912 type jobs? to get more information about it, and use jobs.<TAB> to see
2902 its attributes. All attributes not starting with an underscore are
2913 its attributes. All attributes not starting with an underscore are
2903 meant for public use.
2914 meant for public use.
2904
2915
2905 In particular, look at the jobs.new() method, which is used to create
2916 In particular, look at the jobs.new() method, which is used to create
2906 new jobs. This magic %bg function is just a convenience wrapper
2917 new jobs. This magic %bg function is just a convenience wrapper
2907 around jobs.new(), for expression-based jobs. If you want to create a
2918 around jobs.new(), for expression-based jobs. If you want to create a
2908 new job with an explicit function object and arguments, you must call
2919 new job with an explicit function object and arguments, you must call
2909 jobs.new() directly.
2920 jobs.new() directly.
2910
2921
2911 The jobs.new docstring also describes in detail several important
2922 The jobs.new docstring also describes in detail several important
2912 caveats associated with a thread-based model for background job
2923 caveats associated with a thread-based model for background job
2913 execution. Type jobs.new? for details.
2924 execution. Type jobs.new? for details.
2914
2925
2915 You can check the status of all jobs with jobs.status().
2926 You can check the status of all jobs with jobs.status().
2916
2927
2917 The jobs variable is set by IPython into the Python builtin namespace.
2928 The jobs variable is set by IPython into the Python builtin namespace.
2918 If you ever declare a variable named 'jobs', you will shadow this
2929 If you ever declare a variable named 'jobs', you will shadow this
2919 name. You can either delete your global jobs variable to regain
2930 name. You can either delete your global jobs variable to regain
2920 access to the job manager, or make a new name and assign it manually
2931 access to the job manager, or make a new name and assign it manually
2921 to the manager (stored in IPython's namespace). For example, to
2932 to the manager (stored in IPython's namespace). For example, to
2922 assign the job manager to the Jobs name, use:
2933 assign the job manager to the Jobs name, use:
2923
2934
2924 Jobs = __builtins__.jobs"""
2935 Jobs = __builtins__.jobs"""
2925
2936
2926 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2937 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2927
2938
2928
2939
2929 def magic_bookmark(self, parameter_s=''):
2940 def magic_bookmark(self, parameter_s=''):
2930 """Manage IPython's bookmark system.
2941 """Manage IPython's bookmark system.
2931
2942
2932 %bookmark <name> - set bookmark to current dir
2943 %bookmark <name> - set bookmark to current dir
2933 %bookmark <name> <dir> - set bookmark to <dir>
2944 %bookmark <name> <dir> - set bookmark to <dir>
2934 %bookmark -l - list all bookmarks
2945 %bookmark -l - list all bookmarks
2935 %bookmark -d <name> - remove bookmark
2946 %bookmark -d <name> - remove bookmark
2936 %bookmark -r - remove all bookmarks
2947 %bookmark -r - remove all bookmarks
2937
2948
2938 You can later on access a bookmarked folder with:
2949 You can later on access a bookmarked folder with:
2939 %cd -b <name>
2950 %cd -b <name>
2940 or simply '%cd <name>' if there is no directory called <name> AND
2951 or simply '%cd <name>' if there is no directory called <name> AND
2941 there is such a bookmark defined.
2952 there is such a bookmark defined.
2942
2953
2943 Your bookmarks persist through IPython sessions, but they are
2954 Your bookmarks persist through IPython sessions, but they are
2944 associated with each profile."""
2955 associated with each profile."""
2945
2956
2946 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2957 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2947 if len(args) > 2:
2958 if len(args) > 2:
2948 error('You can only give at most two arguments')
2959 error('You can only give at most two arguments')
2949 return
2960 return
2950
2961
2951 bkms = self.db.get('bookmarks',{})
2962 bkms = self.db.get('bookmarks',{})
2952
2963
2953 if opts.has_key('d'):
2964 if opts.has_key('d'):
2954 try:
2965 try:
2955 todel = args[0]
2966 todel = args[0]
2956 except IndexError:
2967 except IndexError:
2957 error('You must provide a bookmark to delete')
2968 error('You must provide a bookmark to delete')
2958 else:
2969 else:
2959 try:
2970 try:
2960 del bkms[todel]
2971 del bkms[todel]
2961 except:
2972 except:
2962 error("Can't delete bookmark '%s'" % todel)
2973 error("Can't delete bookmark '%s'" % todel)
2963 elif opts.has_key('r'):
2974 elif opts.has_key('r'):
2964 bkms = {}
2975 bkms = {}
2965 elif opts.has_key('l'):
2976 elif opts.has_key('l'):
2966 bks = bkms.keys()
2977 bks = bkms.keys()
2967 bks.sort()
2978 bks.sort()
2968 if bks:
2979 if bks:
2969 size = max(map(len,bks))
2980 size = max(map(len,bks))
2970 else:
2981 else:
2971 size = 0
2982 size = 0
2972 fmt = '%-'+str(size)+'s -> %s'
2983 fmt = '%-'+str(size)+'s -> %s'
2973 print 'Current bookmarks:'
2984 print 'Current bookmarks:'
2974 for bk in bks:
2985 for bk in bks:
2975 print fmt % (bk,bkms[bk])
2986 print fmt % (bk,bkms[bk])
2976 else:
2987 else:
2977 if not args:
2988 if not args:
2978 error("You must specify the bookmark name")
2989 error("You must specify the bookmark name")
2979 elif len(args)==1:
2990 elif len(args)==1:
2980 bkms[args[0]] = os.getcwd()
2991 bkms[args[0]] = os.getcwd()
2981 elif len(args)==2:
2992 elif len(args)==2:
2982 bkms[args[0]] = args[1]
2993 bkms[args[0]] = args[1]
2983 self.db['bookmarks'] = bkms
2994 self.db['bookmarks'] = bkms
2984
2995
2985 def magic_pycat(self, parameter_s=''):
2996 def magic_pycat(self, parameter_s=''):
2986 """Show a syntax-highlighted file through a pager.
2997 """Show a syntax-highlighted file through a pager.
2987
2998
2988 This magic is similar to the cat utility, but it will assume the file
2999 This magic is similar to the cat utility, but it will assume the file
2989 to be Python source and will show it with syntax highlighting. """
3000 to be Python source and will show it with syntax highlighting. """
2990
3001
2991 try:
3002 try:
2992 filename = get_py_filename(parameter_s)
3003 filename = get_py_filename(parameter_s)
2993 cont = file_read(filename)
3004 cont = file_read(filename)
2994 except IOError:
3005 except IOError:
2995 try:
3006 try:
2996 cont = eval(parameter_s,self.user_ns)
3007 cont = eval(parameter_s,self.user_ns)
2997 except NameError:
3008 except NameError:
2998 cont = None
3009 cont = None
2999 if cont is None:
3010 if cont is None:
3000 print "Error: no such file or variable"
3011 print "Error: no such file or variable"
3001 return
3012 return
3002
3013
3003 page(self.shell.pycolorize(cont),
3014 page(self.shell.pycolorize(cont),
3004 screen_lines=self.shell.rc.screen_length)
3015 screen_lines=self.shell.rc.screen_length)
3005
3016
3006 def magic_cpaste(self, parameter_s=''):
3017 def magic_cpaste(self, parameter_s=''):
3007 """Allows you to paste & execute a pre-formatted code block from clipboard
3018 """Allows you to paste & execute a pre-formatted code block from clipboard
3008
3019
3009 You must terminate the block with '--' (two minus-signs) alone on the
3020 You must terminate the block with '--' (two minus-signs) alone on the
3010 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3021 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3011 is the new sentinel for this operation)
3022 is the new sentinel for this operation)
3012
3023
3013 The block is dedented prior to execution to enable execution of
3024 The block is dedented prior to execution to enable execution of
3014 method definitions. '>' characters at the beginning of a line is
3025 method definitions. '>' characters at the beginning of a line is
3015 ignored, to allow pasting directly from e-mails. The executed block
3026 ignored, to allow pasting directly from e-mails. The executed block
3016 is also assigned to variable named 'pasted_block' for later editing
3027 is also assigned to variable named 'pasted_block' for later editing
3017 with '%edit pasted_block'.
3028 with '%edit pasted_block'.
3018
3029
3019 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3030 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3020 This assigns the pasted block to variable 'foo' as string, without
3031 This assigns the pasted block to variable 'foo' as string, without
3021 dedenting or executing it.
3032 dedenting or executing it.
3022
3033
3023 Do not be alarmed by garbled output on Windows (it's a readline bug).
3034 Do not be alarmed by garbled output on Windows (it's a readline bug).
3024 Just press enter and type -- (and press enter again) and the block
3035 Just press enter and type -- (and press enter again) and the block
3025 will be what was just pasted.
3036 will be what was just pasted.
3026
3037
3027 IPython statements (magics, shell escapes) are not supported (yet).
3038 IPython statements (magics, shell escapes) are not supported (yet).
3028 """
3039 """
3029 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3040 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3030 par = args.strip()
3041 par = args.strip()
3031 sentinel = opts.get('s','--')
3042 sentinel = opts.get('s','--')
3032
3043
3033 from IPython import iplib
3044 from IPython import iplib
3034 lines = []
3045 lines = []
3035 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3046 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3036 while 1:
3047 while 1:
3037 l = iplib.raw_input_original(':')
3048 l = iplib.raw_input_original(':')
3038 if l ==sentinel:
3049 if l ==sentinel:
3039 break
3050 break
3040 lines.append(l.lstrip('>'))
3051 lines.append(l.lstrip('>'))
3041 block = "\n".join(lines) + '\n'
3052 block = "\n".join(lines) + '\n'
3042 #print "block:\n",block
3053 #print "block:\n",block
3043 if not par:
3054 if not par:
3044 b = textwrap.dedent(block)
3055 b = textwrap.dedent(block)
3045 exec b in self.user_ns
3056 exec b in self.user_ns
3046 self.user_ns['pasted_block'] = b
3057 self.user_ns['pasted_block'] = b
3047 else:
3058 else:
3048 self.user_ns[par] = block
3059 self.user_ns[par] = block
3049 print "Block assigned to '%s'" % par
3060 print "Block assigned to '%s'" % par
3050
3061
3051 def magic_quickref(self,arg):
3062 def magic_quickref(self,arg):
3052 """ Show a quick reference sheet """
3063 """ Show a quick reference sheet """
3053 import IPython.usage
3064 import IPython.usage
3054 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3065 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3055
3066
3056 page(qr)
3067 page(qr)
3057
3068
3058 def magic_upgrade(self,arg):
3069 def magic_upgrade(self,arg):
3059 """ Upgrade your IPython installation
3070 """ Upgrade your IPython installation
3060
3071
3061 This will copy the config files that don't yet exist in your
3072 This will copy the config files that don't yet exist in your
3062 ipython dir from the system config dir. Use this after upgrading
3073 ipython dir from the system config dir. Use this after upgrading
3063 IPython if you don't wish to delete your .ipython dir.
3074 IPython if you don't wish to delete your .ipython dir.
3064
3075
3065 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3076 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3066 new users)
3077 new users)
3067
3078
3068 """
3079 """
3069 ip = self.getapi()
3080 ip = self.getapi()
3070 ipinstallation = path(IPython.__file__).dirname()
3081 ipinstallation = path(IPython.__file__).dirname()
3071 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3082 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3072 src_config = ipinstallation / 'UserConfig'
3083 src_config = ipinstallation / 'UserConfig'
3073 userdir = path(ip.options.ipythondir)
3084 userdir = path(ip.options.ipythondir)
3074 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3085 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3075 print ">",cmd
3086 print ">",cmd
3076 shell(cmd)
3087 shell(cmd)
3077 if arg == '-nolegacy':
3088 if arg == '-nolegacy':
3078 legacy = userdir.files('ipythonrc*')
3089 legacy = userdir.files('ipythonrc*')
3079 print "Nuking legacy files:",legacy
3090 print "Nuking legacy files:",legacy
3080
3091
3081 [p.remove() for p in legacy]
3092 [p.remove() for p in legacy]
3082 suffix = (sys.platform == 'win32' and '.ini' or '')
3093 suffix = (sys.platform == 'win32' and '.ini' or '')
3083 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3094 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3084
3095
3085 # end Magic
3096 # end Magic
@@ -1,6332 +1,6336 b''
1 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
1 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * IPython/Magic.py (magic_prun): Fix saving of profile info for
4 Python 2.5, where the stats object API changed a little. Thanks
5 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
6
3 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
7 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
4 Pernetty's patch to improve support for (X)Emacs under Win32.
8 Pernetty's patch to improve support for (X)Emacs under Win32.
5
9
6 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
10 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
7
11
8 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
12 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
9 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
13 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
10 a report by Nik Tautenhahn.
14 a report by Nik Tautenhahn.
11
15
12 2007-03-16 Walter Doerwald <walter@livinglogic.de>
16 2007-03-16 Walter Doerwald <walter@livinglogic.de>
13
17
14 * setup.py: Add the igrid help files to the list of data files
18 * setup.py: Add the igrid help files to the list of data files
15 to be installed alongside igrid.
19 to be installed alongside igrid.
16 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
20 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
17 Show the input object of the igrid browser as the window tile.
21 Show the input object of the igrid browser as the window tile.
18 Show the object the cursor is on in the statusbar.
22 Show the object the cursor is on in the statusbar.
19
23
20 2007-03-15 Ville Vainio <vivainio@gmail.com>
24 2007-03-15 Ville Vainio <vivainio@gmail.com>
21
25
22 * Extensions/ipy_stock_completers.py: Fixed exception
26 * Extensions/ipy_stock_completers.py: Fixed exception
23 on mismatching quotes in %run completer. Patch by
27 on mismatching quotes in %run completer. Patch by
24 JοΏ½rgen Stenarson. Closes #127.
28 JοΏ½rgen Stenarson. Closes #127.
25
29
26 2007-03-14 Ville Vainio <vivainio@gmail.com>
30 2007-03-14 Ville Vainio <vivainio@gmail.com>
27
31
28 * Extensions/ext_rehashdir.py: Do not do auto_alias
32 * Extensions/ext_rehashdir.py: Do not do auto_alias
29 in %rehashdir, it clobbers %store'd aliases.
33 in %rehashdir, it clobbers %store'd aliases.
30
34
31 * UserConfig/ipy_profile_sh.py: envpersist.py extension
35 * UserConfig/ipy_profile_sh.py: envpersist.py extension
32 (beefed up %env) imported for sh profile.
36 (beefed up %env) imported for sh profile.
33
37
34 2007-03-10 Walter Doerwald <walter@livinglogic.de>
38 2007-03-10 Walter Doerwald <walter@livinglogic.de>
35
39
36 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
40 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
37 as the default browser.
41 as the default browser.
38 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
42 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
39 As igrid displays all attributes it ever encounters, fetch() (which has
43 As igrid displays all attributes it ever encounters, fetch() (which has
40 been renamed to _fetch()) doesn't have to recalculate the display attributes
44 been renamed to _fetch()) doesn't have to recalculate the display attributes
41 every time a new item is fetched. This should speed up scrolling.
45 every time a new item is fetched. This should speed up scrolling.
42
46
43 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
47 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
44
48
45 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
49 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
46 Schmolck's recently reported tab-completion bug (my previous one
50 Schmolck's recently reported tab-completion bug (my previous one
47 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
51 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
48
52
49 2007-03-09 Walter Doerwald <walter@livinglogic.de>
53 2007-03-09 Walter Doerwald <walter@livinglogic.de>
50
54
51 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
55 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
52 Close help window if exiting igrid.
56 Close help window if exiting igrid.
53
57
54 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
58 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
55
59
56 * IPython/Extensions/ipy_defaults.py: Check if readline is available
60 * IPython/Extensions/ipy_defaults.py: Check if readline is available
57 before calling functions from readline.
61 before calling functions from readline.
58
62
59 2007-03-02 Walter Doerwald <walter@livinglogic.de>
63 2007-03-02 Walter Doerwald <walter@livinglogic.de>
60
64
61 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
65 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
62 igrid is a wxPython-based display object for ipipe. If your system has
66 igrid is a wxPython-based display object for ipipe. If your system has
63 wx installed igrid will be the default display. Without wx ipipe falls
67 wx installed igrid will be the default display. Without wx ipipe falls
64 back to ibrowse (which needs curses). If no curses is installed ipipe
68 back to ibrowse (which needs curses). If no curses is installed ipipe
65 falls back to idump.
69 falls back to idump.
66
70
67 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
71 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
68
72
69 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
73 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
70 my changes from yesterday, they introduced bugs. Will reactivate
74 my changes from yesterday, they introduced bugs. Will reactivate
71 once I get a correct solution, which will be much easier thanks to
75 once I get a correct solution, which will be much easier thanks to
72 Dan Milstein's new prefilter test suite.
76 Dan Milstein's new prefilter test suite.
73
77
74 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
78 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
75
79
76 * IPython/iplib.py (split_user_input): fix input splitting so we
80 * IPython/iplib.py (split_user_input): fix input splitting so we
77 don't attempt attribute accesses on things that can't possibly be
81 don't attempt attribute accesses on things that can't possibly be
78 valid Python attributes. After a bug report by Alex Schmolck.
82 valid Python attributes. After a bug report by Alex Schmolck.
79 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
83 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
80 %magic with explicit % prefix.
84 %magic with explicit % prefix.
81
85
82 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
86 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
83
87
84 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
88 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
85 avoid a DeprecationWarning from GTK.
89 avoid a DeprecationWarning from GTK.
86
90
87 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
91 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
88
92
89 * IPython/genutils.py (clock): I modified clock() to return total
93 * IPython/genutils.py (clock): I modified clock() to return total
90 time, user+system. This is a more commonly needed metric. I also
94 time, user+system. This is a more commonly needed metric. I also
91 introduced the new clocku/clocks to get only user/system time if
95 introduced the new clocku/clocks to get only user/system time if
92 one wants those instead.
96 one wants those instead.
93
97
94 ***WARNING: API CHANGE*** clock() used to return only user time,
98 ***WARNING: API CHANGE*** clock() used to return only user time,
95 so if you want exactly the same results as before, use clocku
99 so if you want exactly the same results as before, use clocku
96 instead.
100 instead.
97
101
98 2007-02-22 Ville Vainio <vivainio@gmail.com>
102 2007-02-22 Ville Vainio <vivainio@gmail.com>
99
103
100 * IPython/Extensions/ipy_p4.py: Extension for improved
104 * IPython/Extensions/ipy_p4.py: Extension for improved
101 p4 (perforce version control system) experience.
105 p4 (perforce version control system) experience.
102 Adds %p4 magic with p4 command completion and
106 Adds %p4 magic with p4 command completion and
103 automatic -G argument (marshall output as python dict)
107 automatic -G argument (marshall output as python dict)
104
108
105 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
109 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
106
110
107 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
111 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
108 stop marks.
112 stop marks.
109 (ClearingMixin): a simple mixin to easily make a Demo class clear
113 (ClearingMixin): a simple mixin to easily make a Demo class clear
110 the screen in between blocks and have empty marquees. The
114 the screen in between blocks and have empty marquees. The
111 ClearDemo and ClearIPDemo classes that use it are included.
115 ClearDemo and ClearIPDemo classes that use it are included.
112
116
113 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
117 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
114
118
115 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
119 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
116 protect against exceptions at Python shutdown time. Patch
120 protect against exceptions at Python shutdown time. Patch
117 sumbmitted to upstream.
121 sumbmitted to upstream.
118
122
119 2007-02-14 Walter Doerwald <walter@livinglogic.de>
123 2007-02-14 Walter Doerwald <walter@livinglogic.de>
120
124
121 * IPython/Extensions/ibrowse.py: If entering the first object level
125 * IPython/Extensions/ibrowse.py: If entering the first object level
122 (i.e. the object for which the browser has been started) fails,
126 (i.e. the object for which the browser has been started) fails,
123 now the error is raised directly (aborting the browser) instead of
127 now the error is raised directly (aborting the browser) instead of
124 running into an empty levels list later.
128 running into an empty levels list later.
125
129
126 2007-02-03 Walter Doerwald <walter@livinglogic.de>
130 2007-02-03 Walter Doerwald <walter@livinglogic.de>
127
131
128 * IPython/Extensions/ipipe.py: Add an xrepr implementation
132 * IPython/Extensions/ipipe.py: Add an xrepr implementation
129 for the noitem object.
133 for the noitem object.
130
134
131 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
135 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
132
136
133 * IPython/completer.py (Completer.attr_matches): Fix small
137 * IPython/completer.py (Completer.attr_matches): Fix small
134 tab-completion bug with Enthought Traits objects with units.
138 tab-completion bug with Enthought Traits objects with units.
135 Thanks to a bug report by Tom Denniston
139 Thanks to a bug report by Tom Denniston
136 <tom.denniston-AT-alum.dartmouth.org>.
140 <tom.denniston-AT-alum.dartmouth.org>.
137
141
138 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
142 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
139
143
140 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
144 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
141 bug where only .ipy or .py would be completed. Once the first
145 bug where only .ipy or .py would be completed. Once the first
142 argument to %run has been given, all completions are valid because
146 argument to %run has been given, all completions are valid because
143 they are the arguments to the script, which may well be non-python
147 they are the arguments to the script, which may well be non-python
144 filenames.
148 filenames.
145
149
146 * IPython/irunner.py (InteractiveRunner.run_source): major updates
150 * IPython/irunner.py (InteractiveRunner.run_source): major updates
147 to irunner to allow it to correctly support real doctesting of
151 to irunner to allow it to correctly support real doctesting of
148 out-of-process ipython code.
152 out-of-process ipython code.
149
153
150 * IPython/Magic.py (magic_cd): Make the setting of the terminal
154 * IPython/Magic.py (magic_cd): Make the setting of the terminal
151 title an option (-noterm_title) because it completely breaks
155 title an option (-noterm_title) because it completely breaks
152 doctesting.
156 doctesting.
153
157
154 * IPython/demo.py: fix IPythonDemo class that was not actually working.
158 * IPython/demo.py: fix IPythonDemo class that was not actually working.
155
159
156 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
160 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
157
161
158 * IPython/irunner.py (main): fix small bug where extensions were
162 * IPython/irunner.py (main): fix small bug where extensions were
159 not being correctly recognized.
163 not being correctly recognized.
160
164
161 2007-01-23 Walter Doerwald <walter@livinglogic.de>
165 2007-01-23 Walter Doerwald <walter@livinglogic.de>
162
166
163 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
167 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
164 a string containing a single line yields the string itself as the
168 a string containing a single line yields the string itself as the
165 only item.
169 only item.
166
170
167 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
171 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
168 object if it's the same as the one on the last level (This avoids
172 object if it's the same as the one on the last level (This avoids
169 infinite recursion for one line strings).
173 infinite recursion for one line strings).
170
174
171 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
175 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
172
176
173 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
177 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
174 all output streams before printing tracebacks. This ensures that
178 all output streams before printing tracebacks. This ensures that
175 user output doesn't end up interleaved with traceback output.
179 user output doesn't end up interleaved with traceback output.
176
180
177 2007-01-10 Ville Vainio <vivainio@gmail.com>
181 2007-01-10 Ville Vainio <vivainio@gmail.com>
178
182
179 * Extensions/envpersist.py: Turbocharged %env that remembers
183 * Extensions/envpersist.py: Turbocharged %env that remembers
180 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
184 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
181 "%env VISUAL=jed".
185 "%env VISUAL=jed".
182
186
183 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
187 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
184
188
185 * IPython/iplib.py (showtraceback): ensure that we correctly call
189 * IPython/iplib.py (showtraceback): ensure that we correctly call
186 custom handlers in all cases (some with pdb were slipping through,
190 custom handlers in all cases (some with pdb were slipping through,
187 but I'm not exactly sure why).
191 but I'm not exactly sure why).
188
192
189 * IPython/Debugger.py (Tracer.__init__): added new class to
193 * IPython/Debugger.py (Tracer.__init__): added new class to
190 support set_trace-like usage of IPython's enhanced debugger.
194 support set_trace-like usage of IPython's enhanced debugger.
191
195
192 2006-12-24 Ville Vainio <vivainio@gmail.com>
196 2006-12-24 Ville Vainio <vivainio@gmail.com>
193
197
194 * ipmaker.py: more informative message when ipy_user_conf
198 * ipmaker.py: more informative message when ipy_user_conf
195 import fails (suggest running %upgrade).
199 import fails (suggest running %upgrade).
196
200
197 * tools/run_ipy_in_profiler.py: Utility to see where
201 * tools/run_ipy_in_profiler.py: Utility to see where
198 the time during IPython startup is spent.
202 the time during IPython startup is spent.
199
203
200 2006-12-20 Ville Vainio <vivainio@gmail.com>
204 2006-12-20 Ville Vainio <vivainio@gmail.com>
201
205
202 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
206 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
203
207
204 * ipapi.py: Add new ipapi method, expand_alias.
208 * ipapi.py: Add new ipapi method, expand_alias.
205
209
206 * Release.py: Bump up version to 0.7.4.svn
210 * Release.py: Bump up version to 0.7.4.svn
207
211
208 2006-12-17 Ville Vainio <vivainio@gmail.com>
212 2006-12-17 Ville Vainio <vivainio@gmail.com>
209
213
210 * Extensions/jobctrl.py: Fixed &cmd arg arg...
214 * Extensions/jobctrl.py: Fixed &cmd arg arg...
211 to work properly on posix too
215 to work properly on posix too
212
216
213 * Release.py: Update revnum (version is still just 0.7.3).
217 * Release.py: Update revnum (version is still just 0.7.3).
214
218
215 2006-12-15 Ville Vainio <vivainio@gmail.com>
219 2006-12-15 Ville Vainio <vivainio@gmail.com>
216
220
217 * scripts/ipython_win_post_install: create ipython.py in
221 * scripts/ipython_win_post_install: create ipython.py in
218 prefix + "/scripts".
222 prefix + "/scripts".
219
223
220 * Release.py: Update version to 0.7.3.
224 * Release.py: Update version to 0.7.3.
221
225
222 2006-12-14 Ville Vainio <vivainio@gmail.com>
226 2006-12-14 Ville Vainio <vivainio@gmail.com>
223
227
224 * scripts/ipython_win_post_install: Overwrite old shortcuts
228 * scripts/ipython_win_post_install: Overwrite old shortcuts
225 if they already exist
229 if they already exist
226
230
227 * Release.py: release 0.7.3rc2
231 * Release.py: release 0.7.3rc2
228
232
229 2006-12-13 Ville Vainio <vivainio@gmail.com>
233 2006-12-13 Ville Vainio <vivainio@gmail.com>
230
234
231 * Branch and update Release.py for 0.7.3rc1
235 * Branch and update Release.py for 0.7.3rc1
232
236
233 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
237 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
234
238
235 * IPython/Shell.py (IPShellWX): update for current WX naming
239 * IPython/Shell.py (IPShellWX): update for current WX naming
236 conventions, to avoid a deprecation warning with current WX
240 conventions, to avoid a deprecation warning with current WX
237 versions. Thanks to a report by Danny Shevitz.
241 versions. Thanks to a report by Danny Shevitz.
238
242
239 2006-12-12 Ville Vainio <vivainio@gmail.com>
243 2006-12-12 Ville Vainio <vivainio@gmail.com>
240
244
241 * ipmaker.py: apply david cournapeau's patch to make
245 * ipmaker.py: apply david cournapeau's patch to make
242 import_some work properly even when ipythonrc does
246 import_some work properly even when ipythonrc does
243 import_some on empty list (it was an old bug!).
247 import_some on empty list (it was an old bug!).
244
248
245 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
249 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
246 Add deprecation note to ipythonrc and a url to wiki
250 Add deprecation note to ipythonrc and a url to wiki
247 in ipy_user_conf.py
251 in ipy_user_conf.py
248
252
249
253
250 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
254 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
251 as if it was typed on IPython command prompt, i.e.
255 as if it was typed on IPython command prompt, i.e.
252 as IPython script.
256 as IPython script.
253
257
254 * example-magic.py, magic_grepl.py: remove outdated examples
258 * example-magic.py, magic_grepl.py: remove outdated examples
255
259
256 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
260 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
257
261
258 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
262 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
259 is called before any exception has occurred.
263 is called before any exception has occurred.
260
264
261 2006-12-08 Ville Vainio <vivainio@gmail.com>
265 2006-12-08 Ville Vainio <vivainio@gmail.com>
262
266
263 * Extensions/ipy_stock_completers.py: fix cd completer
267 * Extensions/ipy_stock_completers.py: fix cd completer
264 to translate /'s to \'s again.
268 to translate /'s to \'s again.
265
269
266 * completer.py: prevent traceback on file completions w/
270 * completer.py: prevent traceback on file completions w/
267 backslash.
271 backslash.
268
272
269 * Release.py: Update release number to 0.7.3b3 for release
273 * Release.py: Update release number to 0.7.3b3 for release
270
274
271 2006-12-07 Ville Vainio <vivainio@gmail.com>
275 2006-12-07 Ville Vainio <vivainio@gmail.com>
272
276
273 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
277 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
274 while executing external code. Provides more shell-like behaviour
278 while executing external code. Provides more shell-like behaviour
275 and overall better response to ctrl + C / ctrl + break.
279 and overall better response to ctrl + C / ctrl + break.
276
280
277 * tools/make_tarball.py: new script to create tarball straight from svn
281 * tools/make_tarball.py: new script to create tarball straight from svn
278 (setup.py sdist doesn't work on win32).
282 (setup.py sdist doesn't work on win32).
279
283
280 * Extensions/ipy_stock_completers.py: fix cd completer to give up
284 * Extensions/ipy_stock_completers.py: fix cd completer to give up
281 on dirnames with spaces and use the default completer instead.
285 on dirnames with spaces and use the default completer instead.
282
286
283 * Revision.py: Change version to 0.7.3b2 for release.
287 * Revision.py: Change version to 0.7.3b2 for release.
284
288
285 2006-12-05 Ville Vainio <vivainio@gmail.com>
289 2006-12-05 Ville Vainio <vivainio@gmail.com>
286
290
287 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
291 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
288 pydb patch 4 (rm debug printing, py 2.5 checking)
292 pydb patch 4 (rm debug printing, py 2.5 checking)
289
293
290 2006-11-30 Walter Doerwald <walter@livinglogic.de>
294 2006-11-30 Walter Doerwald <walter@livinglogic.de>
291 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
295 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
292 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
296 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
293 "refreshfind" (mapped to "R") does the same but tries to go back to the same
297 "refreshfind" (mapped to "R") does the same but tries to go back to the same
294 object the cursor was on before the refresh. The command "markrange" is
298 object the cursor was on before the refresh. The command "markrange" is
295 mapped to "%" now.
299 mapped to "%" now.
296 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
300 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
297
301
298 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
302 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
299
303
300 * IPython/Magic.py (magic_debug): new %debug magic to activate the
304 * IPython/Magic.py (magic_debug): new %debug magic to activate the
301 interactive debugger on the last traceback, without having to call
305 interactive debugger on the last traceback, without having to call
302 %pdb and rerun your code. Made minor changes in various modules,
306 %pdb and rerun your code. Made minor changes in various modules,
303 should automatically recognize pydb if available.
307 should automatically recognize pydb if available.
304
308
305 2006-11-28 Ville Vainio <vivainio@gmail.com>
309 2006-11-28 Ville Vainio <vivainio@gmail.com>
306
310
307 * completer.py: If the text start with !, show file completions
311 * completer.py: If the text start with !, show file completions
308 properly. This helps when trying to complete command name
312 properly. This helps when trying to complete command name
309 for shell escapes.
313 for shell escapes.
310
314
311 2006-11-27 Ville Vainio <vivainio@gmail.com>
315 2006-11-27 Ville Vainio <vivainio@gmail.com>
312
316
313 * ipy_stock_completers.py: bzr completer submitted by Stefan van
317 * ipy_stock_completers.py: bzr completer submitted by Stefan van
314 der Walt. Clean up svn and hg completers by using a common
318 der Walt. Clean up svn and hg completers by using a common
315 vcs_completer.
319 vcs_completer.
316
320
317 2006-11-26 Ville Vainio <vivainio@gmail.com>
321 2006-11-26 Ville Vainio <vivainio@gmail.com>
318
322
319 * Remove ipconfig and %config; you should use _ip.options structure
323 * Remove ipconfig and %config; you should use _ip.options structure
320 directly instead!
324 directly instead!
321
325
322 * genutils.py: add wrap_deprecated function for deprecating callables
326 * genutils.py: add wrap_deprecated function for deprecating callables
323
327
324 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
328 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
325 _ip.system instead. ipalias is redundant.
329 _ip.system instead. ipalias is redundant.
326
330
327 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
331 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
328 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
332 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
329 explicit.
333 explicit.
330
334
331 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
335 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
332 completer. Try it by entering 'hg ' and pressing tab.
336 completer. Try it by entering 'hg ' and pressing tab.
333
337
334 * macro.py: Give Macro a useful __repr__ method
338 * macro.py: Give Macro a useful __repr__ method
335
339
336 * Magic.py: %whos abbreviates the typename of Macro for brevity.
340 * Magic.py: %whos abbreviates the typename of Macro for brevity.
337
341
338 2006-11-24 Walter Doerwald <walter@livinglogic.de>
342 2006-11-24 Walter Doerwald <walter@livinglogic.de>
339 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
343 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
340 we don't get a duplicate ipipe module, where registration of the xrepr
344 we don't get a duplicate ipipe module, where registration of the xrepr
341 implementation for Text is useless.
345 implementation for Text is useless.
342
346
343 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
347 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
344
348
345 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
349 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
346
350
347 2006-11-24 Ville Vainio <vivainio@gmail.com>
351 2006-11-24 Ville Vainio <vivainio@gmail.com>
348
352
349 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
353 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
350 try to use "cProfile" instead of the slower pure python
354 try to use "cProfile" instead of the slower pure python
351 "profile"
355 "profile"
352
356
353 2006-11-23 Ville Vainio <vivainio@gmail.com>
357 2006-11-23 Ville Vainio <vivainio@gmail.com>
354
358
355 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
359 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
356 Qt+IPython+Designer link in documentation.
360 Qt+IPython+Designer link in documentation.
357
361
358 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
362 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
359 correct Pdb object to %pydb.
363 correct Pdb object to %pydb.
360
364
361
365
362 2006-11-22 Walter Doerwald <walter@livinglogic.de>
366 2006-11-22 Walter Doerwald <walter@livinglogic.de>
363 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
367 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
364 generic xrepr(), otherwise the list implementation would kick in.
368 generic xrepr(), otherwise the list implementation would kick in.
365
369
366 2006-11-21 Ville Vainio <vivainio@gmail.com>
370 2006-11-21 Ville Vainio <vivainio@gmail.com>
367
371
368 * upgrade_dir.py: Now actually overwrites a nonmodified user file
372 * upgrade_dir.py: Now actually overwrites a nonmodified user file
369 with one from UserConfig.
373 with one from UserConfig.
370
374
371 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
375 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
372 it was missing which broke the sh profile.
376 it was missing which broke the sh profile.
373
377
374 * completer.py: file completer now uses explicit '/' instead
378 * completer.py: file completer now uses explicit '/' instead
375 of os.path.join, expansion of 'foo' was broken on win32
379 of os.path.join, expansion of 'foo' was broken on win32
376 if there was one directory with name 'foobar'.
380 if there was one directory with name 'foobar'.
377
381
378 * A bunch of patches from Kirill Smelkov:
382 * A bunch of patches from Kirill Smelkov:
379
383
380 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
384 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
381
385
382 * [patch 7/9] Implement %page -r (page in raw mode) -
386 * [patch 7/9] Implement %page -r (page in raw mode) -
383
387
384 * [patch 5/9] ScientificPython webpage has moved
388 * [patch 5/9] ScientificPython webpage has moved
385
389
386 * [patch 4/9] The manual mentions %ds, should be %dhist
390 * [patch 4/9] The manual mentions %ds, should be %dhist
387
391
388 * [patch 3/9] Kill old bits from %prun doc.
392 * [patch 3/9] Kill old bits from %prun doc.
389
393
390 * [patch 1/9] Fix typos here and there.
394 * [patch 1/9] Fix typos here and there.
391
395
392 2006-11-08 Ville Vainio <vivainio@gmail.com>
396 2006-11-08 Ville Vainio <vivainio@gmail.com>
393
397
394 * completer.py (attr_matches): catch all exceptions raised
398 * completer.py (attr_matches): catch all exceptions raised
395 by eval of expr with dots.
399 by eval of expr with dots.
396
400
397 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
401 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
398
402
399 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
403 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
400 input if it starts with whitespace. This allows you to paste
404 input if it starts with whitespace. This allows you to paste
401 indented input from any editor without manually having to type in
405 indented input from any editor without manually having to type in
402 the 'if 1:', which is convenient when working interactively.
406 the 'if 1:', which is convenient when working interactively.
403 Slightly modifed version of a patch by Bo Peng
407 Slightly modifed version of a patch by Bo Peng
404 <bpeng-AT-rice.edu>.
408 <bpeng-AT-rice.edu>.
405
409
406 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
410 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
407
411
408 * IPython/irunner.py (main): modified irunner so it automatically
412 * IPython/irunner.py (main): modified irunner so it automatically
409 recognizes the right runner to use based on the extension (.py for
413 recognizes the right runner to use based on the extension (.py for
410 python, .ipy for ipython and .sage for sage).
414 python, .ipy for ipython and .sage for sage).
411
415
412 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
416 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
413 visible in ipapi as ip.config(), to programatically control the
417 visible in ipapi as ip.config(), to programatically control the
414 internal rc object. There's an accompanying %config magic for
418 internal rc object. There's an accompanying %config magic for
415 interactive use, which has been enhanced to match the
419 interactive use, which has been enhanced to match the
416 funtionality in ipconfig.
420 funtionality in ipconfig.
417
421
418 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
422 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
419 so it's not just a toggle, it now takes an argument. Add support
423 so it's not just a toggle, it now takes an argument. Add support
420 for a customizable header when making system calls, as the new
424 for a customizable header when making system calls, as the new
421 system_header variable in the ipythonrc file.
425 system_header variable in the ipythonrc file.
422
426
423 2006-11-03 Walter Doerwald <walter@livinglogic.de>
427 2006-11-03 Walter Doerwald <walter@livinglogic.de>
424
428
425 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
429 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
426 generic functions (using Philip J. Eby's simplegeneric package).
430 generic functions (using Philip J. Eby's simplegeneric package).
427 This makes it possible to customize the display of third-party classes
431 This makes it possible to customize the display of third-party classes
428 without having to monkeypatch them. xiter() no longer supports a mode
432 without having to monkeypatch them. xiter() no longer supports a mode
429 argument and the XMode class has been removed. The same functionality can
433 argument and the XMode class has been removed. The same functionality can
430 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
434 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
431 One consequence of the switch to generic functions is that xrepr() and
435 One consequence of the switch to generic functions is that xrepr() and
432 xattrs() implementation must define the default value for the mode
436 xattrs() implementation must define the default value for the mode
433 argument themselves and xattrs() implementations must return real
437 argument themselves and xattrs() implementations must return real
434 descriptors.
438 descriptors.
435
439
436 * IPython/external: This new subpackage will contain all third-party
440 * IPython/external: This new subpackage will contain all third-party
437 packages that are bundled with IPython. (The first one is simplegeneric).
441 packages that are bundled with IPython. (The first one is simplegeneric).
438
442
439 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
443 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
440 directory which as been dropped in r1703.
444 directory which as been dropped in r1703.
441
445
442 * IPython/Extensions/ipipe.py (iless): Fixed.
446 * IPython/Extensions/ipipe.py (iless): Fixed.
443
447
444 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
448 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
445
449
446 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
450 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
447
451
448 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
452 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
449 handling in variable expansion so that shells and magics recognize
453 handling in variable expansion so that shells and magics recognize
450 function local scopes correctly. Bug reported by Brian.
454 function local scopes correctly. Bug reported by Brian.
451
455
452 * scripts/ipython: remove the very first entry in sys.path which
456 * scripts/ipython: remove the very first entry in sys.path which
453 Python auto-inserts for scripts, so that sys.path under IPython is
457 Python auto-inserts for scripts, so that sys.path under IPython is
454 as similar as possible to that under plain Python.
458 as similar as possible to that under plain Python.
455
459
456 * IPython/completer.py (IPCompleter.file_matches): Fix
460 * IPython/completer.py (IPCompleter.file_matches): Fix
457 tab-completion so that quotes are not closed unless the completion
461 tab-completion so that quotes are not closed unless the completion
458 is unambiguous. After a request by Stefan. Minor cleanups in
462 is unambiguous. After a request by Stefan. Minor cleanups in
459 ipy_stock_completers.
463 ipy_stock_completers.
460
464
461 2006-11-02 Ville Vainio <vivainio@gmail.com>
465 2006-11-02 Ville Vainio <vivainio@gmail.com>
462
466
463 * ipy_stock_completers.py: Add %run and %cd completers.
467 * ipy_stock_completers.py: Add %run and %cd completers.
464
468
465 * completer.py: Try running custom completer for both
469 * completer.py: Try running custom completer for both
466 "foo" and "%foo" if the command is just "foo". Ignore case
470 "foo" and "%foo" if the command is just "foo". Ignore case
467 when filtering possible completions.
471 when filtering possible completions.
468
472
469 * UserConfig/ipy_user_conf.py: install stock completers as default
473 * UserConfig/ipy_user_conf.py: install stock completers as default
470
474
471 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
475 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
472 simplified readline history save / restore through a wrapper
476 simplified readline history save / restore through a wrapper
473 function
477 function
474
478
475
479
476 2006-10-31 Ville Vainio <vivainio@gmail.com>
480 2006-10-31 Ville Vainio <vivainio@gmail.com>
477
481
478 * strdispatch.py, completer.py, ipy_stock_completers.py:
482 * strdispatch.py, completer.py, ipy_stock_completers.py:
479 Allow str_key ("command") in completer hooks. Implement
483 Allow str_key ("command") in completer hooks. Implement
480 trivial completer for 'import' (stdlib modules only). Rename
484 trivial completer for 'import' (stdlib modules only). Rename
481 ipy_linux_package_managers.py to ipy_stock_completers.py.
485 ipy_linux_package_managers.py to ipy_stock_completers.py.
482 SVN completer.
486 SVN completer.
483
487
484 * Extensions/ledit.py: %magic line editor for easily and
488 * Extensions/ledit.py: %magic line editor for easily and
485 incrementally manipulating lists of strings. The magic command
489 incrementally manipulating lists of strings. The magic command
486 name is %led.
490 name is %led.
487
491
488 2006-10-30 Ville Vainio <vivainio@gmail.com>
492 2006-10-30 Ville Vainio <vivainio@gmail.com>
489
493
490 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
494 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
491 Bernsteins's patches for pydb integration.
495 Bernsteins's patches for pydb integration.
492 http://bashdb.sourceforge.net/pydb/
496 http://bashdb.sourceforge.net/pydb/
493
497
494 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
498 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
495 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
499 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
496 custom completer hook to allow the users to implement their own
500 custom completer hook to allow the users to implement their own
497 completers. See ipy_linux_package_managers.py for example. The
501 completers. See ipy_linux_package_managers.py for example. The
498 hook name is 'complete_command'.
502 hook name is 'complete_command'.
499
503
500 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
504 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
501
505
502 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
506 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
503 Numeric leftovers.
507 Numeric leftovers.
504
508
505 * ipython.el (py-execute-region): apply Stefan's patch to fix
509 * ipython.el (py-execute-region): apply Stefan's patch to fix
506 garbled results if the python shell hasn't been previously started.
510 garbled results if the python shell hasn't been previously started.
507
511
508 * IPython/genutils.py (arg_split): moved to genutils, since it's a
512 * IPython/genutils.py (arg_split): moved to genutils, since it's a
509 pretty generic function and useful for other things.
513 pretty generic function and useful for other things.
510
514
511 * IPython/OInspect.py (getsource): Add customizable source
515 * IPython/OInspect.py (getsource): Add customizable source
512 extractor. After a request/patch form W. Stein (SAGE).
516 extractor. After a request/patch form W. Stein (SAGE).
513
517
514 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
518 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
515 window size to a more reasonable value from what pexpect does,
519 window size to a more reasonable value from what pexpect does,
516 since their choice causes wrapping bugs with long input lines.
520 since their choice causes wrapping bugs with long input lines.
517
521
518 2006-10-28 Ville Vainio <vivainio@gmail.com>
522 2006-10-28 Ville Vainio <vivainio@gmail.com>
519
523
520 * Magic.py (%run): Save and restore the readline history from
524 * Magic.py (%run): Save and restore the readline history from
521 file around %run commands to prevent side effects from
525 file around %run commands to prevent side effects from
522 %runned programs that might use readline (e.g. pydb).
526 %runned programs that might use readline (e.g. pydb).
523
527
524 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
528 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
525 invoking the pydb enhanced debugger.
529 invoking the pydb enhanced debugger.
526
530
527 2006-10-23 Walter Doerwald <walter@livinglogic.de>
531 2006-10-23 Walter Doerwald <walter@livinglogic.de>
528
532
529 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
533 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
530 call the base class method and propagate the return value to
534 call the base class method and propagate the return value to
531 ifile. This is now done by path itself.
535 ifile. This is now done by path itself.
532
536
533 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
537 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
534
538
535 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
539 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
536 api: set_crash_handler(), to expose the ability to change the
540 api: set_crash_handler(), to expose the ability to change the
537 internal crash handler.
541 internal crash handler.
538
542
539 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
543 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
540 the various parameters of the crash handler so that apps using
544 the various parameters of the crash handler so that apps using
541 IPython as their engine can customize crash handling. Ipmlemented
545 IPython as their engine can customize crash handling. Ipmlemented
542 at the request of SAGE.
546 at the request of SAGE.
543
547
544 2006-10-14 Ville Vainio <vivainio@gmail.com>
548 2006-10-14 Ville Vainio <vivainio@gmail.com>
545
549
546 * Magic.py, ipython.el: applied first "safe" part of Rocky
550 * Magic.py, ipython.el: applied first "safe" part of Rocky
547 Bernstein's patch set for pydb integration.
551 Bernstein's patch set for pydb integration.
548
552
549 * Magic.py (%unalias, %alias): %store'd aliases can now be
553 * Magic.py (%unalias, %alias): %store'd aliases can now be
550 removed with '%unalias'. %alias w/o args now shows most
554 removed with '%unalias'. %alias w/o args now shows most
551 interesting (stored / manually defined) aliases last
555 interesting (stored / manually defined) aliases last
552 where they catch the eye w/o scrolling.
556 where they catch the eye w/o scrolling.
553
557
554 * Magic.py (%rehashx), ext_rehashdir.py: files with
558 * Magic.py (%rehashx), ext_rehashdir.py: files with
555 'py' extension are always considered executable, even
559 'py' extension are always considered executable, even
556 when not in PATHEXT environment variable.
560 when not in PATHEXT environment variable.
557
561
558 2006-10-12 Ville Vainio <vivainio@gmail.com>
562 2006-10-12 Ville Vainio <vivainio@gmail.com>
559
563
560 * jobctrl.py: Add new "jobctrl" extension for spawning background
564 * jobctrl.py: Add new "jobctrl" extension for spawning background
561 processes with "&find /". 'import jobctrl' to try it out. Requires
565 processes with "&find /". 'import jobctrl' to try it out. Requires
562 'subprocess' module, standard in python 2.4+.
566 'subprocess' module, standard in python 2.4+.
563
567
564 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
568 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
565 so if foo -> bar and bar -> baz, then foo -> baz.
569 so if foo -> bar and bar -> baz, then foo -> baz.
566
570
567 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
571 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
568
572
569 * IPython/Magic.py (Magic.parse_options): add a new posix option
573 * IPython/Magic.py (Magic.parse_options): add a new posix option
570 to allow parsing of input args in magics that doesn't strip quotes
574 to allow parsing of input args in magics that doesn't strip quotes
571 (if posix=False). This also closes %timeit bug reported by
575 (if posix=False). This also closes %timeit bug reported by
572 Stefan.
576 Stefan.
573
577
574 2006-10-03 Ville Vainio <vivainio@gmail.com>
578 2006-10-03 Ville Vainio <vivainio@gmail.com>
575
579
576 * iplib.py (raw_input, interact): Return ValueError catching for
580 * iplib.py (raw_input, interact): Return ValueError catching for
577 raw_input. Fixes infinite loop for sys.stdin.close() or
581 raw_input. Fixes infinite loop for sys.stdin.close() or
578 sys.stdout.close().
582 sys.stdout.close().
579
583
580 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
584 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
581
585
582 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
586 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
583 to help in handling doctests. irunner is now pretty useful for
587 to help in handling doctests. irunner is now pretty useful for
584 running standalone scripts and simulate a full interactive session
588 running standalone scripts and simulate a full interactive session
585 in a format that can be then pasted as a doctest.
589 in a format that can be then pasted as a doctest.
586
590
587 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
591 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
588 on top of the default (useless) ones. This also fixes the nasty
592 on top of the default (useless) ones. This also fixes the nasty
589 way in which 2.5's Quitter() exits (reverted [1785]).
593 way in which 2.5's Quitter() exits (reverted [1785]).
590
594
591 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
595 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
592 2.5.
596 2.5.
593
597
594 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
598 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
595 color scheme is updated as well when color scheme is changed
599 color scheme is updated as well when color scheme is changed
596 interactively.
600 interactively.
597
601
598 2006-09-27 Ville Vainio <vivainio@gmail.com>
602 2006-09-27 Ville Vainio <vivainio@gmail.com>
599
603
600 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
604 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
601 infinite loop and just exit. It's a hack, but will do for a while.
605 infinite loop and just exit. It's a hack, but will do for a while.
602
606
603 2006-08-25 Walter Doerwald <walter@livinglogic.de>
607 2006-08-25 Walter Doerwald <walter@livinglogic.de>
604
608
605 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
609 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
606 the constructor, this makes it possible to get a list of only directories
610 the constructor, this makes it possible to get a list of only directories
607 or only files.
611 or only files.
608
612
609 2006-08-12 Ville Vainio <vivainio@gmail.com>
613 2006-08-12 Ville Vainio <vivainio@gmail.com>
610
614
611 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
615 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
612 they broke unittest
616 they broke unittest
613
617
614 2006-08-11 Ville Vainio <vivainio@gmail.com>
618 2006-08-11 Ville Vainio <vivainio@gmail.com>
615
619
616 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
620 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
617 by resolving issue properly, i.e. by inheriting FakeModule
621 by resolving issue properly, i.e. by inheriting FakeModule
618 from types.ModuleType. Pickling ipython interactive data
622 from types.ModuleType. Pickling ipython interactive data
619 should still work as usual (testing appreciated).
623 should still work as usual (testing appreciated).
620
624
621 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
625 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
622
626
623 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
627 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
624 running under python 2.3 with code from 2.4 to fix a bug with
628 running under python 2.3 with code from 2.4 to fix a bug with
625 help(). Reported by the Debian maintainers, Norbert Tretkowski
629 help(). Reported by the Debian maintainers, Norbert Tretkowski
626 <norbert-AT-tretkowski.de> and Alexandre Fayolle
630 <norbert-AT-tretkowski.de> and Alexandre Fayolle
627 <afayolle-AT-debian.org>.
631 <afayolle-AT-debian.org>.
628
632
629 2006-08-04 Walter Doerwald <walter@livinglogic.de>
633 2006-08-04 Walter Doerwald <walter@livinglogic.de>
630
634
631 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
635 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
632 (which was displaying "quit" twice).
636 (which was displaying "quit" twice).
633
637
634 2006-07-28 Walter Doerwald <walter@livinglogic.de>
638 2006-07-28 Walter Doerwald <walter@livinglogic.de>
635
639
636 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
640 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
637 the mode argument).
641 the mode argument).
638
642
639 2006-07-27 Walter Doerwald <walter@livinglogic.de>
643 2006-07-27 Walter Doerwald <walter@livinglogic.de>
640
644
641 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
645 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
642 not running under IPython.
646 not running under IPython.
643
647
644 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
648 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
645 and make it iterable (iterating over the attribute itself). Add two new
649 and make it iterable (iterating over the attribute itself). Add two new
646 magic strings for __xattrs__(): If the string starts with "-", the attribute
650 magic strings for __xattrs__(): If the string starts with "-", the attribute
647 will not be displayed in ibrowse's detail view (but it can still be
651 will not be displayed in ibrowse's detail view (but it can still be
648 iterated over). This makes it possible to add attributes that are large
652 iterated over). This makes it possible to add attributes that are large
649 lists or generator methods to the detail view. Replace magic attribute names
653 lists or generator methods to the detail view. Replace magic attribute names
650 and _attrname() and _getattr() with "descriptors": For each type of magic
654 and _attrname() and _getattr() with "descriptors": For each type of magic
651 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
655 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
652 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
656 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
653 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
657 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
654 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
658 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
655 are still supported.
659 are still supported.
656
660
657 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
661 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
658 fails in ibrowse.fetch(), the exception object is added as the last item
662 fails in ibrowse.fetch(), the exception object is added as the last item
659 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
663 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
660 a generator throws an exception midway through execution.
664 a generator throws an exception midway through execution.
661
665
662 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
666 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
663 encoding into methods.
667 encoding into methods.
664
668
665 2006-07-26 Ville Vainio <vivainio@gmail.com>
669 2006-07-26 Ville Vainio <vivainio@gmail.com>
666
670
667 * iplib.py: history now stores multiline input as single
671 * iplib.py: history now stores multiline input as single
668 history entries. Patch by Jorgen Cederlof.
672 history entries. Patch by Jorgen Cederlof.
669
673
670 2006-07-18 Walter Doerwald <walter@livinglogic.de>
674 2006-07-18 Walter Doerwald <walter@livinglogic.de>
671
675
672 * IPython/Extensions/ibrowse.py: Make cursor visible over
676 * IPython/Extensions/ibrowse.py: Make cursor visible over
673 non existing attributes.
677 non existing attributes.
674
678
675 2006-07-14 Walter Doerwald <walter@livinglogic.de>
679 2006-07-14 Walter Doerwald <walter@livinglogic.de>
676
680
677 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
681 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
678 error output of the running command doesn't mess up the screen.
682 error output of the running command doesn't mess up the screen.
679
683
680 2006-07-13 Walter Doerwald <walter@livinglogic.de>
684 2006-07-13 Walter Doerwald <walter@livinglogic.de>
681
685
682 * IPython/Extensions/ipipe.py (isort): Make isort usable without
686 * IPython/Extensions/ipipe.py (isort): Make isort usable without
683 argument. This sorts the items themselves.
687 argument. This sorts the items themselves.
684
688
685 2006-07-12 Walter Doerwald <walter@livinglogic.de>
689 2006-07-12 Walter Doerwald <walter@livinglogic.de>
686
690
687 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
691 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
688 Compile expression strings into code objects. This should speed
692 Compile expression strings into code objects. This should speed
689 up ifilter and friends somewhat.
693 up ifilter and friends somewhat.
690
694
691 2006-07-08 Ville Vainio <vivainio@gmail.com>
695 2006-07-08 Ville Vainio <vivainio@gmail.com>
692
696
693 * Magic.py: %cpaste now strips > from the beginning of lines
697 * Magic.py: %cpaste now strips > from the beginning of lines
694 to ease pasting quoted code from emails. Contributed by
698 to ease pasting quoted code from emails. Contributed by
695 Stefan van der Walt.
699 Stefan van der Walt.
696
700
697 2006-06-29 Ville Vainio <vivainio@gmail.com>
701 2006-06-29 Ville Vainio <vivainio@gmail.com>
698
702
699 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
703 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
700 mode, patch contributed by Darren Dale. NEEDS TESTING!
704 mode, patch contributed by Darren Dale. NEEDS TESTING!
701
705
702 2006-06-28 Walter Doerwald <walter@livinglogic.de>
706 2006-06-28 Walter Doerwald <walter@livinglogic.de>
703
707
704 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
708 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
705 a blue background. Fix fetching new display rows when the browser
709 a blue background. Fix fetching new display rows when the browser
706 scrolls more than a screenful (e.g. by using the goto command).
710 scrolls more than a screenful (e.g. by using the goto command).
707
711
708 2006-06-27 Ville Vainio <vivainio@gmail.com>
712 2006-06-27 Ville Vainio <vivainio@gmail.com>
709
713
710 * Magic.py (_inspect, _ofind) Apply David Huard's
714 * Magic.py (_inspect, _ofind) Apply David Huard's
711 patch for displaying the correct docstring for 'property'
715 patch for displaying the correct docstring for 'property'
712 attributes.
716 attributes.
713
717
714 2006-06-23 Walter Doerwald <walter@livinglogic.de>
718 2006-06-23 Walter Doerwald <walter@livinglogic.de>
715
719
716 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
720 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
717 commands into the methods implementing them.
721 commands into the methods implementing them.
718
722
719 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
723 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
720
724
721 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
725 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
722 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
726 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
723 autoindent support was authored by Jin Liu.
727 autoindent support was authored by Jin Liu.
724
728
725 2006-06-22 Walter Doerwald <walter@livinglogic.de>
729 2006-06-22 Walter Doerwald <walter@livinglogic.de>
726
730
727 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
731 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
728 for keymaps with a custom class that simplifies handling.
732 for keymaps with a custom class that simplifies handling.
729
733
730 2006-06-19 Walter Doerwald <walter@livinglogic.de>
734 2006-06-19 Walter Doerwald <walter@livinglogic.de>
731
735
732 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
736 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
733 resizing. This requires Python 2.5 to work.
737 resizing. This requires Python 2.5 to work.
734
738
735 2006-06-16 Walter Doerwald <walter@livinglogic.de>
739 2006-06-16 Walter Doerwald <walter@livinglogic.de>
736
740
737 * IPython/Extensions/ibrowse.py: Add two new commands to
741 * IPython/Extensions/ibrowse.py: Add two new commands to
738 ibrowse: "hideattr" (mapped to "h") hides the attribute under
742 ibrowse: "hideattr" (mapped to "h") hides the attribute under
739 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
743 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
740 attributes again. Remapped the help command to "?". Display
744 attributes again. Remapped the help command to "?". Display
741 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
745 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
742 as keys for the "home" and "end" commands. Add three new commands
746 as keys for the "home" and "end" commands. Add three new commands
743 to the input mode for "find" and friends: "delend" (CTRL-K)
747 to the input mode for "find" and friends: "delend" (CTRL-K)
744 deletes to the end of line. "incsearchup" searches upwards in the
748 deletes to the end of line. "incsearchup" searches upwards in the
745 command history for an input that starts with the text before the cursor.
749 command history for an input that starts with the text before the cursor.
746 "incsearchdown" does the same downwards. Removed a bogus mapping of
750 "incsearchdown" does the same downwards. Removed a bogus mapping of
747 the x key to "delete".
751 the x key to "delete".
748
752
749 2006-06-15 Ville Vainio <vivainio@gmail.com>
753 2006-06-15 Ville Vainio <vivainio@gmail.com>
750
754
751 * iplib.py, hooks.py: Added new generate_prompt hook that can be
755 * iplib.py, hooks.py: Added new generate_prompt hook that can be
752 used to create prompts dynamically, instead of the "old" way of
756 used to create prompts dynamically, instead of the "old" way of
753 assigning "magic" strings to prompt_in1 and prompt_in2. The old
757 assigning "magic" strings to prompt_in1 and prompt_in2. The old
754 way still works (it's invoked by the default hook), of course.
758 way still works (it's invoked by the default hook), of course.
755
759
756 * Prompts.py: added generate_output_prompt hook for altering output
760 * Prompts.py: added generate_output_prompt hook for altering output
757 prompt
761 prompt
758
762
759 * Release.py: Changed version string to 0.7.3.svn.
763 * Release.py: Changed version string to 0.7.3.svn.
760
764
761 2006-06-15 Walter Doerwald <walter@livinglogic.de>
765 2006-06-15 Walter Doerwald <walter@livinglogic.de>
762
766
763 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
767 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
764 the call to fetch() always tries to fetch enough data for at least one
768 the call to fetch() always tries to fetch enough data for at least one
765 full screen. This makes it possible to simply call moveto(0,0,True) in
769 full screen. This makes it possible to simply call moveto(0,0,True) in
766 the constructor. Fix typos and removed the obsolete goto attribute.
770 the constructor. Fix typos and removed the obsolete goto attribute.
767
771
768 2006-06-12 Ville Vainio <vivainio@gmail.com>
772 2006-06-12 Ville Vainio <vivainio@gmail.com>
769
773
770 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
774 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
771 allowing $variable interpolation within multiline statements,
775 allowing $variable interpolation within multiline statements,
772 though so far only with "sh" profile for a testing period.
776 though so far only with "sh" profile for a testing period.
773 The patch also enables splitting long commands with \ but it
777 The patch also enables splitting long commands with \ but it
774 doesn't work properly yet.
778 doesn't work properly yet.
775
779
776 2006-06-12 Walter Doerwald <walter@livinglogic.de>
780 2006-06-12 Walter Doerwald <walter@livinglogic.de>
777
781
778 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
782 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
779 input history and the position of the cursor in the input history for
783 input history and the position of the cursor in the input history for
780 the find, findbackwards and goto command.
784 the find, findbackwards and goto command.
781
785
782 2006-06-10 Walter Doerwald <walter@livinglogic.de>
786 2006-06-10 Walter Doerwald <walter@livinglogic.de>
783
787
784 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
788 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
785 implements the basic functionality of browser commands that require
789 implements the basic functionality of browser commands that require
786 input. Reimplement the goto, find and findbackwards commands as
790 input. Reimplement the goto, find and findbackwards commands as
787 subclasses of _CommandInput. Add an input history and keymaps to those
791 subclasses of _CommandInput. Add an input history and keymaps to those
788 commands. Add "\r" as a keyboard shortcut for the enterdefault and
792 commands. Add "\r" as a keyboard shortcut for the enterdefault and
789 execute commands.
793 execute commands.
790
794
791 2006-06-07 Ville Vainio <vivainio@gmail.com>
795 2006-06-07 Ville Vainio <vivainio@gmail.com>
792
796
793 * iplib.py: ipython mybatch.ipy exits ipython immediately after
797 * iplib.py: ipython mybatch.ipy exits ipython immediately after
794 running the batch files instead of leaving the session open.
798 running the batch files instead of leaving the session open.
795
799
796 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
800 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
797
801
798 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
802 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
799 the original fix was incomplete. Patch submitted by W. Maier.
803 the original fix was incomplete. Patch submitted by W. Maier.
800
804
801 2006-06-07 Ville Vainio <vivainio@gmail.com>
805 2006-06-07 Ville Vainio <vivainio@gmail.com>
802
806
803 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
807 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
804 Confirmation prompts can be supressed by 'quiet' option.
808 Confirmation prompts can be supressed by 'quiet' option.
805 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
809 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
806
810
807 2006-06-06 *** Released version 0.7.2
811 2006-06-06 *** Released version 0.7.2
808
812
809 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
813 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
810
814
811 * IPython/Release.py (version): Made 0.7.2 final for release.
815 * IPython/Release.py (version): Made 0.7.2 final for release.
812 Repo tagged and release cut.
816 Repo tagged and release cut.
813
817
814 2006-06-05 Ville Vainio <vivainio@gmail.com>
818 2006-06-05 Ville Vainio <vivainio@gmail.com>
815
819
816 * Magic.py (magic_rehashx): Honor no_alias list earlier in
820 * Magic.py (magic_rehashx): Honor no_alias list earlier in
817 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
821 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
818
822
819 * upgrade_dir.py: try import 'path' module a bit harder
823 * upgrade_dir.py: try import 'path' module a bit harder
820 (for %upgrade)
824 (for %upgrade)
821
825
822 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
826 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
823
827
824 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
828 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
825 instead of looping 20 times.
829 instead of looping 20 times.
826
830
827 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
831 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
828 correctly at initialization time. Bug reported by Krishna Mohan
832 correctly at initialization time. Bug reported by Krishna Mohan
829 Gundu <gkmohan-AT-gmail.com> on the user list.
833 Gundu <gkmohan-AT-gmail.com> on the user list.
830
834
831 * IPython/Release.py (version): Mark 0.7.2 version to start
835 * IPython/Release.py (version): Mark 0.7.2 version to start
832 testing for release on 06/06.
836 testing for release on 06/06.
833
837
834 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
838 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
835
839
836 * scripts/irunner: thin script interface so users don't have to
840 * scripts/irunner: thin script interface so users don't have to
837 find the module and call it as an executable, since modules rarely
841 find the module and call it as an executable, since modules rarely
838 live in people's PATH.
842 live in people's PATH.
839
843
840 * IPython/irunner.py (InteractiveRunner.__init__): added
844 * IPython/irunner.py (InteractiveRunner.__init__): added
841 delaybeforesend attribute to control delays with newer versions of
845 delaybeforesend attribute to control delays with newer versions of
842 pexpect. Thanks to detailed help from pexpect's author, Noah
846 pexpect. Thanks to detailed help from pexpect's author, Noah
843 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
847 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
844 correctly (it works in NoColor mode).
848 correctly (it works in NoColor mode).
845
849
846 * IPython/iplib.py (handle_normal): fix nasty crash reported on
850 * IPython/iplib.py (handle_normal): fix nasty crash reported on
847 SAGE list, from improper log() calls.
851 SAGE list, from improper log() calls.
848
852
849 2006-05-31 Ville Vainio <vivainio@gmail.com>
853 2006-05-31 Ville Vainio <vivainio@gmail.com>
850
854
851 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
855 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
852 with args in parens to work correctly with dirs that have spaces.
856 with args in parens to work correctly with dirs that have spaces.
853
857
854 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
858 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
855
859
856 * IPython/Logger.py (Logger.logstart): add option to log raw input
860 * IPython/Logger.py (Logger.logstart): add option to log raw input
857 instead of the processed one. A -r flag was added to the
861 instead of the processed one. A -r flag was added to the
858 %logstart magic used for controlling logging.
862 %logstart magic used for controlling logging.
859
863
860 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
864 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
861
865
862 * IPython/iplib.py (InteractiveShell.__init__): add check for the
866 * IPython/iplib.py (InteractiveShell.__init__): add check for the
863 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
867 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
864 recognize the option. After a bug report by Will Maier. This
868 recognize the option. After a bug report by Will Maier. This
865 closes #64 (will do it after confirmation from W. Maier).
869 closes #64 (will do it after confirmation from W. Maier).
866
870
867 * IPython/irunner.py: New module to run scripts as if manually
871 * IPython/irunner.py: New module to run scripts as if manually
868 typed into an interactive environment, based on pexpect. After a
872 typed into an interactive environment, based on pexpect. After a
869 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
873 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
870 ipython-user list. Simple unittests in the tests/ directory.
874 ipython-user list. Simple unittests in the tests/ directory.
871
875
872 * tools/release: add Will Maier, OpenBSD port maintainer, to
876 * tools/release: add Will Maier, OpenBSD port maintainer, to
873 recepients list. We are now officially part of the OpenBSD ports:
877 recepients list. We are now officially part of the OpenBSD ports:
874 http://www.openbsd.org/ports.html ! Many thanks to Will for the
878 http://www.openbsd.org/ports.html ! Many thanks to Will for the
875 work.
879 work.
876
880
877 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
881 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
878
882
879 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
883 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
880 so that it doesn't break tkinter apps.
884 so that it doesn't break tkinter apps.
881
885
882 * IPython/iplib.py (_prefilter): fix bug where aliases would
886 * IPython/iplib.py (_prefilter): fix bug where aliases would
883 shadow variables when autocall was fully off. Reported by SAGE
887 shadow variables when autocall was fully off. Reported by SAGE
884 author William Stein.
888 author William Stein.
885
889
886 * IPython/OInspect.py (Inspector.__init__): add a flag to control
890 * IPython/OInspect.py (Inspector.__init__): add a flag to control
887 at what detail level strings are computed when foo? is requested.
891 at what detail level strings are computed when foo? is requested.
888 This allows users to ask for example that the string form of an
892 This allows users to ask for example that the string form of an
889 object is only computed when foo?? is called, or even never, by
893 object is only computed when foo?? is called, or even never, by
890 setting the object_info_string_level >= 2 in the configuration
894 setting the object_info_string_level >= 2 in the configuration
891 file. This new option has been added and documented. After a
895 file. This new option has been added and documented. After a
892 request by SAGE to be able to control the printing of very large
896 request by SAGE to be able to control the printing of very large
893 objects more easily.
897 objects more easily.
894
898
895 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
899 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
896
900
897 * IPython/ipmaker.py (make_IPython): remove the ipython call path
901 * IPython/ipmaker.py (make_IPython): remove the ipython call path
898 from sys.argv, to be 100% consistent with how Python itself works
902 from sys.argv, to be 100% consistent with how Python itself works
899 (as seen for example with python -i file.py). After a bug report
903 (as seen for example with python -i file.py). After a bug report
900 by Jeffrey Collins.
904 by Jeffrey Collins.
901
905
902 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
906 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
903 nasty bug which was preventing custom namespaces with -pylab,
907 nasty bug which was preventing custom namespaces with -pylab,
904 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
908 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
905 compatibility (long gone from mpl).
909 compatibility (long gone from mpl).
906
910
907 * IPython/ipapi.py (make_session): name change: create->make. We
911 * IPython/ipapi.py (make_session): name change: create->make. We
908 use make in other places (ipmaker,...), it's shorter and easier to
912 use make in other places (ipmaker,...), it's shorter and easier to
909 type and say, etc. I'm trying to clean things before 0.7.2 so
913 type and say, etc. I'm trying to clean things before 0.7.2 so
910 that I can keep things stable wrt to ipapi in the chainsaw branch.
914 that I can keep things stable wrt to ipapi in the chainsaw branch.
911
915
912 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
916 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
913 python-mode recognizes our debugger mode. Add support for
917 python-mode recognizes our debugger mode. Add support for
914 autoindent inside (X)emacs. After a patch sent in by Jin Liu
918 autoindent inside (X)emacs. After a patch sent in by Jin Liu
915 <m.liu.jin-AT-gmail.com> originally written by
919 <m.liu.jin-AT-gmail.com> originally written by
916 doxgen-AT-newsmth.net (with minor modifications for xemacs
920 doxgen-AT-newsmth.net (with minor modifications for xemacs
917 compatibility)
921 compatibility)
918
922
919 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
923 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
920 tracebacks when walking the stack so that the stack tracking system
924 tracebacks when walking the stack so that the stack tracking system
921 in emacs' python-mode can identify the frames correctly.
925 in emacs' python-mode can identify the frames correctly.
922
926
923 * IPython/ipmaker.py (make_IPython): make the internal (and
927 * IPython/ipmaker.py (make_IPython): make the internal (and
924 default config) autoedit_syntax value false by default. Too many
928 default config) autoedit_syntax value false by default. Too many
925 users have complained to me (both on and off-list) about problems
929 users have complained to me (both on and off-list) about problems
926 with this option being on by default, so I'm making it default to
930 with this option being on by default, so I'm making it default to
927 off. It can still be enabled by anyone via the usual mechanisms.
931 off. It can still be enabled by anyone via the usual mechanisms.
928
932
929 * IPython/completer.py (Completer.attr_matches): add support for
933 * IPython/completer.py (Completer.attr_matches): add support for
930 PyCrust-style _getAttributeNames magic method. Patch contributed
934 PyCrust-style _getAttributeNames magic method. Patch contributed
931 by <mscott-AT-goldenspud.com>. Closes #50.
935 by <mscott-AT-goldenspud.com>. Closes #50.
932
936
933 * IPython/iplib.py (InteractiveShell.__init__): remove the
937 * IPython/iplib.py (InteractiveShell.__init__): remove the
934 deletion of exit/quit from __builtin__, which can break
938 deletion of exit/quit from __builtin__, which can break
935 third-party tools like the Zope debugging console. The
939 third-party tools like the Zope debugging console. The
936 %exit/%quit magics remain. In general, it's probably a good idea
940 %exit/%quit magics remain. In general, it's probably a good idea
937 not to delete anything from __builtin__, since we never know what
941 not to delete anything from __builtin__, since we never know what
938 that will break. In any case, python now (for 2.5) will support
942 that will break. In any case, python now (for 2.5) will support
939 'real' exit/quit, so this issue is moot. Closes #55.
943 'real' exit/quit, so this issue is moot. Closes #55.
940
944
941 * IPython/genutils.py (with_obj): rename the 'with' function to
945 * IPython/genutils.py (with_obj): rename the 'with' function to
942 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
946 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
943 becomes a language keyword. Closes #53.
947 becomes a language keyword. Closes #53.
944
948
945 * IPython/FakeModule.py (FakeModule.__init__): add a proper
949 * IPython/FakeModule.py (FakeModule.__init__): add a proper
946 __file__ attribute to this so it fools more things into thinking
950 __file__ attribute to this so it fools more things into thinking
947 it is a real module. Closes #59.
951 it is a real module. Closes #59.
948
952
949 * IPython/Magic.py (magic_edit): add -n option to open the editor
953 * IPython/Magic.py (magic_edit): add -n option to open the editor
950 at a specific line number. After a patch by Stefan van der Walt.
954 at a specific line number. After a patch by Stefan van der Walt.
951
955
952 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
956 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
953
957
954 * IPython/iplib.py (edit_syntax_error): fix crash when for some
958 * IPython/iplib.py (edit_syntax_error): fix crash when for some
955 reason the file could not be opened. After automatic crash
959 reason the file could not be opened. After automatic crash
956 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
960 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
957 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
961 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
958 (_should_recompile): Don't fire editor if using %bg, since there
962 (_should_recompile): Don't fire editor if using %bg, since there
959 is no file in the first place. From the same report as above.
963 is no file in the first place. From the same report as above.
960 (raw_input): protect against faulty third-party prefilters. After
964 (raw_input): protect against faulty third-party prefilters. After
961 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
965 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
962 while running under SAGE.
966 while running under SAGE.
963
967
964 2006-05-23 Ville Vainio <vivainio@gmail.com>
968 2006-05-23 Ville Vainio <vivainio@gmail.com>
965
969
966 * ipapi.py: Stripped down ip.to_user_ns() to work only as
970 * ipapi.py: Stripped down ip.to_user_ns() to work only as
967 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
971 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
968 now returns None (again), unless dummy is specifically allowed by
972 now returns None (again), unless dummy is specifically allowed by
969 ipapi.get(allow_dummy=True).
973 ipapi.get(allow_dummy=True).
970
974
971 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
975 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
972
976
973 * IPython: remove all 2.2-compatibility objects and hacks from
977 * IPython: remove all 2.2-compatibility objects and hacks from
974 everywhere, since we only support 2.3 at this point. Docs
978 everywhere, since we only support 2.3 at this point. Docs
975 updated.
979 updated.
976
980
977 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
981 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
978 Anything requiring extra validation can be turned into a Python
982 Anything requiring extra validation can be turned into a Python
979 property in the future. I used a property for the db one b/c
983 property in the future. I used a property for the db one b/c
980 there was a nasty circularity problem with the initialization
984 there was a nasty circularity problem with the initialization
981 order, which right now I don't have time to clean up.
985 order, which right now I don't have time to clean up.
982
986
983 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
987 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
984 another locking bug reported by Jorgen. I'm not 100% sure though,
988 another locking bug reported by Jorgen. I'm not 100% sure though,
985 so more testing is needed...
989 so more testing is needed...
986
990
987 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
991 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
988
992
989 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
993 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
990 local variables from any routine in user code (typically executed
994 local variables from any routine in user code (typically executed
991 with %run) directly into the interactive namespace. Very useful
995 with %run) directly into the interactive namespace. Very useful
992 when doing complex debugging.
996 when doing complex debugging.
993 (IPythonNotRunning): Changed the default None object to a dummy
997 (IPythonNotRunning): Changed the default None object to a dummy
994 whose attributes can be queried as well as called without
998 whose attributes can be queried as well as called without
995 exploding, to ease writing code which works transparently both in
999 exploding, to ease writing code which works transparently both in
996 and out of ipython and uses some of this API.
1000 and out of ipython and uses some of this API.
997
1001
998 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1002 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
999
1003
1000 * IPython/hooks.py (result_display): Fix the fact that our display
1004 * IPython/hooks.py (result_display): Fix the fact that our display
1001 hook was using str() instead of repr(), as the default python
1005 hook was using str() instead of repr(), as the default python
1002 console does. This had gone unnoticed b/c it only happened if
1006 console does. This had gone unnoticed b/c it only happened if
1003 %Pprint was off, but the inconsistency was there.
1007 %Pprint was off, but the inconsistency was there.
1004
1008
1005 2006-05-15 Ville Vainio <vivainio@gmail.com>
1009 2006-05-15 Ville Vainio <vivainio@gmail.com>
1006
1010
1007 * Oinspect.py: Only show docstring for nonexisting/binary files
1011 * Oinspect.py: Only show docstring for nonexisting/binary files
1008 when doing object??, closing ticket #62
1012 when doing object??, closing ticket #62
1009
1013
1010 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1014 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1011
1015
1012 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1016 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1013 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1017 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1014 was being released in a routine which hadn't checked if it had
1018 was being released in a routine which hadn't checked if it had
1015 been the one to acquire it.
1019 been the one to acquire it.
1016
1020
1017 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1021 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1018
1022
1019 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1023 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1020
1024
1021 2006-04-11 Ville Vainio <vivainio@gmail.com>
1025 2006-04-11 Ville Vainio <vivainio@gmail.com>
1022
1026
1023 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1027 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1024 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1028 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1025 prefilters, allowing stuff like magics and aliases in the file.
1029 prefilters, allowing stuff like magics and aliases in the file.
1026
1030
1027 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1031 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1028 added. Supported now are "%clear in" and "%clear out" (clear input and
1032 added. Supported now are "%clear in" and "%clear out" (clear input and
1029 output history, respectively). Also fixed CachedOutput.flush to
1033 output history, respectively). Also fixed CachedOutput.flush to
1030 properly flush the output cache.
1034 properly flush the output cache.
1031
1035
1032 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1036 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1033 half-success (and fail explicitly).
1037 half-success (and fail explicitly).
1034
1038
1035 2006-03-28 Ville Vainio <vivainio@gmail.com>
1039 2006-03-28 Ville Vainio <vivainio@gmail.com>
1036
1040
1037 * iplib.py: Fix quoting of aliases so that only argless ones
1041 * iplib.py: Fix quoting of aliases so that only argless ones
1038 are quoted
1042 are quoted
1039
1043
1040 2006-03-28 Ville Vainio <vivainio@gmail.com>
1044 2006-03-28 Ville Vainio <vivainio@gmail.com>
1041
1045
1042 * iplib.py: Quote aliases with spaces in the name.
1046 * iplib.py: Quote aliases with spaces in the name.
1043 "c:\program files\blah\bin" is now legal alias target.
1047 "c:\program files\blah\bin" is now legal alias target.
1044
1048
1045 * ext_rehashdir.py: Space no longer allowed as arg
1049 * ext_rehashdir.py: Space no longer allowed as arg
1046 separator, since space is legal in path names.
1050 separator, since space is legal in path names.
1047
1051
1048 2006-03-16 Ville Vainio <vivainio@gmail.com>
1052 2006-03-16 Ville Vainio <vivainio@gmail.com>
1049
1053
1050 * upgrade_dir.py: Take path.py from Extensions, correcting
1054 * upgrade_dir.py: Take path.py from Extensions, correcting
1051 %upgrade magic
1055 %upgrade magic
1052
1056
1053 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1057 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1054
1058
1055 * hooks.py: Only enclose editor binary in quotes if legal and
1059 * hooks.py: Only enclose editor binary in quotes if legal and
1056 necessary (space in the name, and is an existing file). Fixes a bug
1060 necessary (space in the name, and is an existing file). Fixes a bug
1057 reported by Zachary Pincus.
1061 reported by Zachary Pincus.
1058
1062
1059 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1063 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1060
1064
1061 * Manual: thanks to a tip on proper color handling for Emacs, by
1065 * Manual: thanks to a tip on proper color handling for Emacs, by
1062 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1066 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1063
1067
1064 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1068 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1065 by applying the provided patch. Thanks to Liu Jin
1069 by applying the provided patch. Thanks to Liu Jin
1066 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1070 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1067 XEmacs/Linux, I'm trusting the submitter that it actually helps
1071 XEmacs/Linux, I'm trusting the submitter that it actually helps
1068 under win32/GNU Emacs. Will revisit if any problems are reported.
1072 under win32/GNU Emacs. Will revisit if any problems are reported.
1069
1073
1070 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1074 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1071
1075
1072 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1076 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1073 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1077 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1074
1078
1075 2006-03-12 Ville Vainio <vivainio@gmail.com>
1079 2006-03-12 Ville Vainio <vivainio@gmail.com>
1076
1080
1077 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1081 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1078 Torsten Marek.
1082 Torsten Marek.
1079
1083
1080 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1084 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1081
1085
1082 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1086 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1083 line ranges works again.
1087 line ranges works again.
1084
1088
1085 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1089 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1086
1090
1087 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1091 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1088 and friends, after a discussion with Zach Pincus on ipython-user.
1092 and friends, after a discussion with Zach Pincus on ipython-user.
1089 I'm not 100% sure, but after thinking about it quite a bit, it may
1093 I'm not 100% sure, but after thinking about it quite a bit, it may
1090 be OK. Testing with the multithreaded shells didn't reveal any
1094 be OK. Testing with the multithreaded shells didn't reveal any
1091 problems, but let's keep an eye out.
1095 problems, but let's keep an eye out.
1092
1096
1093 In the process, I fixed a few things which were calling
1097 In the process, I fixed a few things which were calling
1094 self.InteractiveTB() directly (like safe_execfile), which is a
1098 self.InteractiveTB() directly (like safe_execfile), which is a
1095 mistake: ALL exception reporting should be done by calling
1099 mistake: ALL exception reporting should be done by calling
1096 self.showtraceback(), which handles state and tab-completion and
1100 self.showtraceback(), which handles state and tab-completion and
1097 more.
1101 more.
1098
1102
1099 2006-03-01 Ville Vainio <vivainio@gmail.com>
1103 2006-03-01 Ville Vainio <vivainio@gmail.com>
1100
1104
1101 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1105 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1102 To use, do "from ipipe import *".
1106 To use, do "from ipipe import *".
1103
1107
1104 2006-02-24 Ville Vainio <vivainio@gmail.com>
1108 2006-02-24 Ville Vainio <vivainio@gmail.com>
1105
1109
1106 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1110 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1107 "cleanly" and safely than the older upgrade mechanism.
1111 "cleanly" and safely than the older upgrade mechanism.
1108
1112
1109 2006-02-21 Ville Vainio <vivainio@gmail.com>
1113 2006-02-21 Ville Vainio <vivainio@gmail.com>
1110
1114
1111 * Magic.py: %save works again.
1115 * Magic.py: %save works again.
1112
1116
1113 2006-02-15 Ville Vainio <vivainio@gmail.com>
1117 2006-02-15 Ville Vainio <vivainio@gmail.com>
1114
1118
1115 * Magic.py: %Pprint works again
1119 * Magic.py: %Pprint works again
1116
1120
1117 * Extensions/ipy_sane_defaults.py: Provide everything provided
1121 * Extensions/ipy_sane_defaults.py: Provide everything provided
1118 in default ipythonrc, to make it possible to have a completely empty
1122 in default ipythonrc, to make it possible to have a completely empty
1119 ipythonrc (and thus completely rc-file free configuration)
1123 ipythonrc (and thus completely rc-file free configuration)
1120
1124
1121 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1125 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1122
1126
1123 * IPython/hooks.py (editor): quote the call to the editor command,
1127 * IPython/hooks.py (editor): quote the call to the editor command,
1124 to allow commands with spaces in them. Problem noted by watching
1128 to allow commands with spaces in them. Problem noted by watching
1125 Ian Oswald's video about textpad under win32 at
1129 Ian Oswald's video about textpad under win32 at
1126 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1130 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1127
1131
1128 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1132 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1129 describing magics (we haven't used @ for a loong time).
1133 describing magics (we haven't used @ for a loong time).
1130
1134
1131 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1135 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1132 contributed by marienz to close
1136 contributed by marienz to close
1133 http://www.scipy.net/roundup/ipython/issue53.
1137 http://www.scipy.net/roundup/ipython/issue53.
1134
1138
1135 2006-02-10 Ville Vainio <vivainio@gmail.com>
1139 2006-02-10 Ville Vainio <vivainio@gmail.com>
1136
1140
1137 * genutils.py: getoutput now works in win32 too
1141 * genutils.py: getoutput now works in win32 too
1138
1142
1139 * completer.py: alias and magic completion only invoked
1143 * completer.py: alias and magic completion only invoked
1140 at the first "item" in the line, to avoid "cd %store"
1144 at the first "item" in the line, to avoid "cd %store"
1141 nonsense.
1145 nonsense.
1142
1146
1143 2006-02-09 Ville Vainio <vivainio@gmail.com>
1147 2006-02-09 Ville Vainio <vivainio@gmail.com>
1144
1148
1145 * test/*: Added a unit testing framework (finally).
1149 * test/*: Added a unit testing framework (finally).
1146 '%run runtests.py' to run test_*.
1150 '%run runtests.py' to run test_*.
1147
1151
1148 * ipapi.py: Exposed runlines and set_custom_exc
1152 * ipapi.py: Exposed runlines and set_custom_exc
1149
1153
1150 2006-02-07 Ville Vainio <vivainio@gmail.com>
1154 2006-02-07 Ville Vainio <vivainio@gmail.com>
1151
1155
1152 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1156 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1153 instead use "f(1 2)" as before.
1157 instead use "f(1 2)" as before.
1154
1158
1155 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1159 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1156
1160
1157 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1161 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1158 facilities, for demos processed by the IPython input filter
1162 facilities, for demos processed by the IPython input filter
1159 (IPythonDemo), and for running a script one-line-at-a-time as a
1163 (IPythonDemo), and for running a script one-line-at-a-time as a
1160 demo, both for pure Python (LineDemo) and for IPython-processed
1164 demo, both for pure Python (LineDemo) and for IPython-processed
1161 input (IPythonLineDemo). After a request by Dave Kohel, from the
1165 input (IPythonLineDemo). After a request by Dave Kohel, from the
1162 SAGE team.
1166 SAGE team.
1163 (Demo.edit): added an edit() method to the demo objects, to edit
1167 (Demo.edit): added an edit() method to the demo objects, to edit
1164 the in-memory copy of the last executed block.
1168 the in-memory copy of the last executed block.
1165
1169
1166 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1170 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1167 processing to %edit, %macro and %save. These commands can now be
1171 processing to %edit, %macro and %save. These commands can now be
1168 invoked on the unprocessed input as it was typed by the user
1172 invoked on the unprocessed input as it was typed by the user
1169 (without any prefilters applied). After requests by the SAGE team
1173 (without any prefilters applied). After requests by the SAGE team
1170 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1174 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1171
1175
1172 2006-02-01 Ville Vainio <vivainio@gmail.com>
1176 2006-02-01 Ville Vainio <vivainio@gmail.com>
1173
1177
1174 * setup.py, eggsetup.py: easy_install ipython==dev works
1178 * setup.py, eggsetup.py: easy_install ipython==dev works
1175 correctly now (on Linux)
1179 correctly now (on Linux)
1176
1180
1177 * ipy_user_conf,ipmaker: user config changes, removed spurious
1181 * ipy_user_conf,ipmaker: user config changes, removed spurious
1178 warnings
1182 warnings
1179
1183
1180 * iplib: if rc.banner is string, use it as is.
1184 * iplib: if rc.banner is string, use it as is.
1181
1185
1182 * Magic: %pycat accepts a string argument and pages it's contents.
1186 * Magic: %pycat accepts a string argument and pages it's contents.
1183
1187
1184
1188
1185 2006-01-30 Ville Vainio <vivainio@gmail.com>
1189 2006-01-30 Ville Vainio <vivainio@gmail.com>
1186
1190
1187 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1191 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1188 Now %store and bookmarks work through PickleShare, meaning that
1192 Now %store and bookmarks work through PickleShare, meaning that
1189 concurrent access is possible and all ipython sessions see the
1193 concurrent access is possible and all ipython sessions see the
1190 same database situation all the time, instead of snapshot of
1194 same database situation all the time, instead of snapshot of
1191 the situation when the session was started. Hence, %bookmark
1195 the situation when the session was started. Hence, %bookmark
1192 results are immediately accessible from othes sessions. The database
1196 results are immediately accessible from othes sessions. The database
1193 is also available for use by user extensions. See:
1197 is also available for use by user extensions. See:
1194 http://www.python.org/pypi/pickleshare
1198 http://www.python.org/pypi/pickleshare
1195
1199
1196 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1200 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1197
1201
1198 * aliases can now be %store'd
1202 * aliases can now be %store'd
1199
1203
1200 * path.py moved to Extensions so that pickleshare does not need
1204 * path.py moved to Extensions so that pickleshare does not need
1201 IPython-specific import. Extensions added to pythonpath right
1205 IPython-specific import. Extensions added to pythonpath right
1202 at __init__.
1206 at __init__.
1203
1207
1204 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1208 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1205 called with _ip.system and the pre-transformed command string.
1209 called with _ip.system and the pre-transformed command string.
1206
1210
1207 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1211 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1208
1212
1209 * IPython/iplib.py (interact): Fix that we were not catching
1213 * IPython/iplib.py (interact): Fix that we were not catching
1210 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1214 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1211 logic here had to change, but it's fixed now.
1215 logic here had to change, but it's fixed now.
1212
1216
1213 2006-01-29 Ville Vainio <vivainio@gmail.com>
1217 2006-01-29 Ville Vainio <vivainio@gmail.com>
1214
1218
1215 * iplib.py: Try to import pyreadline on Windows.
1219 * iplib.py: Try to import pyreadline on Windows.
1216
1220
1217 2006-01-27 Ville Vainio <vivainio@gmail.com>
1221 2006-01-27 Ville Vainio <vivainio@gmail.com>
1218
1222
1219 * iplib.py: Expose ipapi as _ip in builtin namespace.
1223 * iplib.py: Expose ipapi as _ip in builtin namespace.
1220 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1224 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1221 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1225 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1222 syntax now produce _ip.* variant of the commands.
1226 syntax now produce _ip.* variant of the commands.
1223
1227
1224 * "_ip.options().autoedit_syntax = 2" automatically throws
1228 * "_ip.options().autoedit_syntax = 2" automatically throws
1225 user to editor for syntax error correction without prompting.
1229 user to editor for syntax error correction without prompting.
1226
1230
1227 2006-01-27 Ville Vainio <vivainio@gmail.com>
1231 2006-01-27 Ville Vainio <vivainio@gmail.com>
1228
1232
1229 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1233 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1230 'ipython' at argv[0]) executed through command line.
1234 'ipython' at argv[0]) executed through command line.
1231 NOTE: this DEPRECATES calling ipython with multiple scripts
1235 NOTE: this DEPRECATES calling ipython with multiple scripts
1232 ("ipython a.py b.py c.py")
1236 ("ipython a.py b.py c.py")
1233
1237
1234 * iplib.py, hooks.py: Added configurable input prefilter,
1238 * iplib.py, hooks.py: Added configurable input prefilter,
1235 named 'input_prefilter'. See ext_rescapture.py for example
1239 named 'input_prefilter'. See ext_rescapture.py for example
1236 usage.
1240 usage.
1237
1241
1238 * ext_rescapture.py, Magic.py: Better system command output capture
1242 * ext_rescapture.py, Magic.py: Better system command output capture
1239 through 'var = !ls' (deprecates user-visible %sc). Same notation
1243 through 'var = !ls' (deprecates user-visible %sc). Same notation
1240 applies for magics, 'var = %alias' assigns alias list to var.
1244 applies for magics, 'var = %alias' assigns alias list to var.
1241
1245
1242 * ipapi.py: added meta() for accessing extension-usable data store.
1246 * ipapi.py: added meta() for accessing extension-usable data store.
1243
1247
1244 * iplib.py: added InteractiveShell.getapi(). New magics should be
1248 * iplib.py: added InteractiveShell.getapi(). New magics should be
1245 written doing self.getapi() instead of using the shell directly.
1249 written doing self.getapi() instead of using the shell directly.
1246
1250
1247 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1251 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1248 %store foo >> ~/myfoo.txt to store variables to files (in clean
1252 %store foo >> ~/myfoo.txt to store variables to files (in clean
1249 textual form, not a restorable pickle).
1253 textual form, not a restorable pickle).
1250
1254
1251 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1255 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1252
1256
1253 * usage.py, Magic.py: added %quickref
1257 * usage.py, Magic.py: added %quickref
1254
1258
1255 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1259 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1256
1260
1257 * GetoptErrors when invoking magics etc. with wrong args
1261 * GetoptErrors when invoking magics etc. with wrong args
1258 are now more helpful:
1262 are now more helpful:
1259 GetoptError: option -l not recognized (allowed: "qb" )
1263 GetoptError: option -l not recognized (allowed: "qb" )
1260
1264
1261 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1265 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1262
1266
1263 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1267 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1264 computationally intensive blocks don't appear to stall the demo.
1268 computationally intensive blocks don't appear to stall the demo.
1265
1269
1266 2006-01-24 Ville Vainio <vivainio@gmail.com>
1270 2006-01-24 Ville Vainio <vivainio@gmail.com>
1267
1271
1268 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1272 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1269 value to manipulate resulting history entry.
1273 value to manipulate resulting history entry.
1270
1274
1271 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1275 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1272 to instance methods of IPApi class, to make extending an embedded
1276 to instance methods of IPApi class, to make extending an embedded
1273 IPython feasible. See ext_rehashdir.py for example usage.
1277 IPython feasible. See ext_rehashdir.py for example usage.
1274
1278
1275 * Merged 1071-1076 from branches/0.7.1
1279 * Merged 1071-1076 from branches/0.7.1
1276
1280
1277
1281
1278 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1282 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1279
1283
1280 * tools/release (daystamp): Fix build tools to use the new
1284 * tools/release (daystamp): Fix build tools to use the new
1281 eggsetup.py script to build lightweight eggs.
1285 eggsetup.py script to build lightweight eggs.
1282
1286
1283 * Applied changesets 1062 and 1064 before 0.7.1 release.
1287 * Applied changesets 1062 and 1064 before 0.7.1 release.
1284
1288
1285 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1289 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1286 see the raw input history (without conversions like %ls ->
1290 see the raw input history (without conversions like %ls ->
1287 ipmagic("ls")). After a request from W. Stein, SAGE
1291 ipmagic("ls")). After a request from W. Stein, SAGE
1288 (http://modular.ucsd.edu/sage) developer. This information is
1292 (http://modular.ucsd.edu/sage) developer. This information is
1289 stored in the input_hist_raw attribute of the IPython instance, so
1293 stored in the input_hist_raw attribute of the IPython instance, so
1290 developers can access it if needed (it's an InputList instance).
1294 developers can access it if needed (it's an InputList instance).
1291
1295
1292 * Versionstring = 0.7.2.svn
1296 * Versionstring = 0.7.2.svn
1293
1297
1294 * eggsetup.py: A separate script for constructing eggs, creates
1298 * eggsetup.py: A separate script for constructing eggs, creates
1295 proper launch scripts even on Windows (an .exe file in
1299 proper launch scripts even on Windows (an .exe file in
1296 \python24\scripts).
1300 \python24\scripts).
1297
1301
1298 * ipapi.py: launch_new_instance, launch entry point needed for the
1302 * ipapi.py: launch_new_instance, launch entry point needed for the
1299 egg.
1303 egg.
1300
1304
1301 2006-01-23 Ville Vainio <vivainio@gmail.com>
1305 2006-01-23 Ville Vainio <vivainio@gmail.com>
1302
1306
1303 * Added %cpaste magic for pasting python code
1307 * Added %cpaste magic for pasting python code
1304
1308
1305 2006-01-22 Ville Vainio <vivainio@gmail.com>
1309 2006-01-22 Ville Vainio <vivainio@gmail.com>
1306
1310
1307 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1311 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1308
1312
1309 * Versionstring = 0.7.2.svn
1313 * Versionstring = 0.7.2.svn
1310
1314
1311 * eggsetup.py: A separate script for constructing eggs, creates
1315 * eggsetup.py: A separate script for constructing eggs, creates
1312 proper launch scripts even on Windows (an .exe file in
1316 proper launch scripts even on Windows (an .exe file in
1313 \python24\scripts).
1317 \python24\scripts).
1314
1318
1315 * ipapi.py: launch_new_instance, launch entry point needed for the
1319 * ipapi.py: launch_new_instance, launch entry point needed for the
1316 egg.
1320 egg.
1317
1321
1318 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1322 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1319
1323
1320 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1324 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1321 %pfile foo would print the file for foo even if it was a binary.
1325 %pfile foo would print the file for foo even if it was a binary.
1322 Now, extensions '.so' and '.dll' are skipped.
1326 Now, extensions '.so' and '.dll' are skipped.
1323
1327
1324 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1328 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1325 bug, where macros would fail in all threaded modes. I'm not 100%
1329 bug, where macros would fail in all threaded modes. I'm not 100%
1326 sure, so I'm going to put out an rc instead of making a release
1330 sure, so I'm going to put out an rc instead of making a release
1327 today, and wait for feedback for at least a few days.
1331 today, and wait for feedback for at least a few days.
1328
1332
1329 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1333 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1330 it...) the handling of pasting external code with autoindent on.
1334 it...) the handling of pasting external code with autoindent on.
1331 To get out of a multiline input, the rule will appear for most
1335 To get out of a multiline input, the rule will appear for most
1332 users unchanged: two blank lines or change the indent level
1336 users unchanged: two blank lines or change the indent level
1333 proposed by IPython. But there is a twist now: you can
1337 proposed by IPython. But there is a twist now: you can
1334 add/subtract only *one or two spaces*. If you add/subtract three
1338 add/subtract only *one or two spaces*. If you add/subtract three
1335 or more (unless you completely delete the line), IPython will
1339 or more (unless you completely delete the line), IPython will
1336 accept that line, and you'll need to enter a second one of pure
1340 accept that line, and you'll need to enter a second one of pure
1337 whitespace. I know it sounds complicated, but I can't find a
1341 whitespace. I know it sounds complicated, but I can't find a
1338 different solution that covers all the cases, with the right
1342 different solution that covers all the cases, with the right
1339 heuristics. Hopefully in actual use, nobody will really notice
1343 heuristics. Hopefully in actual use, nobody will really notice
1340 all these strange rules and things will 'just work'.
1344 all these strange rules and things will 'just work'.
1341
1345
1342 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1346 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1343
1347
1344 * IPython/iplib.py (interact): catch exceptions which can be
1348 * IPython/iplib.py (interact): catch exceptions which can be
1345 triggered asynchronously by signal handlers. Thanks to an
1349 triggered asynchronously by signal handlers. Thanks to an
1346 automatic crash report, submitted by Colin Kingsley
1350 automatic crash report, submitted by Colin Kingsley
1347 <tercel-AT-gentoo.org>.
1351 <tercel-AT-gentoo.org>.
1348
1352
1349 2006-01-20 Ville Vainio <vivainio@gmail.com>
1353 2006-01-20 Ville Vainio <vivainio@gmail.com>
1350
1354
1351 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1355 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1352 (%rehashdir, very useful, try it out) of how to extend ipython
1356 (%rehashdir, very useful, try it out) of how to extend ipython
1353 with new magics. Also added Extensions dir to pythonpath to make
1357 with new magics. Also added Extensions dir to pythonpath to make
1354 importing extensions easy.
1358 importing extensions easy.
1355
1359
1356 * %store now complains when trying to store interactively declared
1360 * %store now complains when trying to store interactively declared
1357 classes / instances of those classes.
1361 classes / instances of those classes.
1358
1362
1359 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1363 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1360 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1364 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1361 if they exist, and ipy_user_conf.py with some defaults is created for
1365 if they exist, and ipy_user_conf.py with some defaults is created for
1362 the user.
1366 the user.
1363
1367
1364 * Startup rehashing done by the config file, not InterpreterExec.
1368 * Startup rehashing done by the config file, not InterpreterExec.
1365 This means system commands are available even without selecting the
1369 This means system commands are available even without selecting the
1366 pysh profile. It's the sensible default after all.
1370 pysh profile. It's the sensible default after all.
1367
1371
1368 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1372 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1369
1373
1370 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1374 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1371 multiline code with autoindent on working. But I am really not
1375 multiline code with autoindent on working. But I am really not
1372 sure, so this needs more testing. Will commit a debug-enabled
1376 sure, so this needs more testing. Will commit a debug-enabled
1373 version for now, while I test it some more, so that Ville and
1377 version for now, while I test it some more, so that Ville and
1374 others may also catch any problems. Also made
1378 others may also catch any problems. Also made
1375 self.indent_current_str() a method, to ensure that there's no
1379 self.indent_current_str() a method, to ensure that there's no
1376 chance of the indent space count and the corresponding string
1380 chance of the indent space count and the corresponding string
1377 falling out of sync. All code needing the string should just call
1381 falling out of sync. All code needing the string should just call
1378 the method.
1382 the method.
1379
1383
1380 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1384 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1381
1385
1382 * IPython/Magic.py (magic_edit): fix check for when users don't
1386 * IPython/Magic.py (magic_edit): fix check for when users don't
1383 save their output files, the try/except was in the wrong section.
1387 save their output files, the try/except was in the wrong section.
1384
1388
1385 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1389 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1386
1390
1387 * IPython/Magic.py (magic_run): fix __file__ global missing from
1391 * IPython/Magic.py (magic_run): fix __file__ global missing from
1388 script's namespace when executed via %run. After a report by
1392 script's namespace when executed via %run. After a report by
1389 Vivian.
1393 Vivian.
1390
1394
1391 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1395 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1392 when using python 2.4. The parent constructor changed in 2.4, and
1396 when using python 2.4. The parent constructor changed in 2.4, and
1393 we need to track it directly (we can't call it, as it messes up
1397 we need to track it directly (we can't call it, as it messes up
1394 readline and tab-completion inside our pdb would stop working).
1398 readline and tab-completion inside our pdb would stop working).
1395 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1399 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1396
1400
1397 2006-01-16 Ville Vainio <vivainio@gmail.com>
1401 2006-01-16 Ville Vainio <vivainio@gmail.com>
1398
1402
1399 * Ipython/magic.py: Reverted back to old %edit functionality
1403 * Ipython/magic.py: Reverted back to old %edit functionality
1400 that returns file contents on exit.
1404 that returns file contents on exit.
1401
1405
1402 * IPython/path.py: Added Jason Orendorff's "path" module to
1406 * IPython/path.py: Added Jason Orendorff's "path" module to
1403 IPython tree, http://www.jorendorff.com/articles/python/path/.
1407 IPython tree, http://www.jorendorff.com/articles/python/path/.
1404 You can get path objects conveniently through %sc, and !!, e.g.:
1408 You can get path objects conveniently through %sc, and !!, e.g.:
1405 sc files=ls
1409 sc files=ls
1406 for p in files.paths: # or files.p
1410 for p in files.paths: # or files.p
1407 print p,p.mtime
1411 print p,p.mtime
1408
1412
1409 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1413 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1410 now work again without considering the exclusion regexp -
1414 now work again without considering the exclusion regexp -
1411 hence, things like ',foo my/path' turn to 'foo("my/path")'
1415 hence, things like ',foo my/path' turn to 'foo("my/path")'
1412 instead of syntax error.
1416 instead of syntax error.
1413
1417
1414
1418
1415 2006-01-14 Ville Vainio <vivainio@gmail.com>
1419 2006-01-14 Ville Vainio <vivainio@gmail.com>
1416
1420
1417 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1421 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1418 ipapi decorators for python 2.4 users, options() provides access to rc
1422 ipapi decorators for python 2.4 users, options() provides access to rc
1419 data.
1423 data.
1420
1424
1421 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1425 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1422 as path separators (even on Linux ;-). Space character after
1426 as path separators (even on Linux ;-). Space character after
1423 backslash (as yielded by tab completer) is still space;
1427 backslash (as yielded by tab completer) is still space;
1424 "%cd long\ name" works as expected.
1428 "%cd long\ name" works as expected.
1425
1429
1426 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1430 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1427 as "chain of command", with priority. API stays the same,
1431 as "chain of command", with priority. API stays the same,
1428 TryNext exception raised by a hook function signals that
1432 TryNext exception raised by a hook function signals that
1429 current hook failed and next hook should try handling it, as
1433 current hook failed and next hook should try handling it, as
1430 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1434 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1431 requested configurable display hook, which is now implemented.
1435 requested configurable display hook, which is now implemented.
1432
1436
1433 2006-01-13 Ville Vainio <vivainio@gmail.com>
1437 2006-01-13 Ville Vainio <vivainio@gmail.com>
1434
1438
1435 * IPython/platutils*.py: platform specific utility functions,
1439 * IPython/platutils*.py: platform specific utility functions,
1436 so far only set_term_title is implemented (change terminal
1440 so far only set_term_title is implemented (change terminal
1437 label in windowing systems). %cd now changes the title to
1441 label in windowing systems). %cd now changes the title to
1438 current dir.
1442 current dir.
1439
1443
1440 * IPython/Release.py: Added myself to "authors" list,
1444 * IPython/Release.py: Added myself to "authors" list,
1441 had to create new files.
1445 had to create new files.
1442
1446
1443 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1447 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1444 shell escape; not a known bug but had potential to be one in the
1448 shell escape; not a known bug but had potential to be one in the
1445 future.
1449 future.
1446
1450
1447 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1451 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1448 extension API for IPython! See the module for usage example. Fix
1452 extension API for IPython! See the module for usage example. Fix
1449 OInspect for docstring-less magic functions.
1453 OInspect for docstring-less magic functions.
1450
1454
1451
1455
1452 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1456 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1453
1457
1454 * IPython/iplib.py (raw_input): temporarily deactivate all
1458 * IPython/iplib.py (raw_input): temporarily deactivate all
1455 attempts at allowing pasting of code with autoindent on. It
1459 attempts at allowing pasting of code with autoindent on. It
1456 introduced bugs (reported by Prabhu) and I can't seem to find a
1460 introduced bugs (reported by Prabhu) and I can't seem to find a
1457 robust combination which works in all cases. Will have to revisit
1461 robust combination which works in all cases. Will have to revisit
1458 later.
1462 later.
1459
1463
1460 * IPython/genutils.py: remove isspace() function. We've dropped
1464 * IPython/genutils.py: remove isspace() function. We've dropped
1461 2.2 compatibility, so it's OK to use the string method.
1465 2.2 compatibility, so it's OK to use the string method.
1462
1466
1463 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1467 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1464
1468
1465 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1469 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1466 matching what NOT to autocall on, to include all python binary
1470 matching what NOT to autocall on, to include all python binary
1467 operators (including things like 'and', 'or', 'is' and 'in').
1471 operators (including things like 'and', 'or', 'is' and 'in').
1468 Prompted by a bug report on 'foo & bar', but I realized we had
1472 Prompted by a bug report on 'foo & bar', but I realized we had
1469 many more potential bug cases with other operators. The regexp is
1473 many more potential bug cases with other operators. The regexp is
1470 self.re_exclude_auto, it's fairly commented.
1474 self.re_exclude_auto, it's fairly commented.
1471
1475
1472 2006-01-12 Ville Vainio <vivainio@gmail.com>
1476 2006-01-12 Ville Vainio <vivainio@gmail.com>
1473
1477
1474 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1478 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1475 Prettified and hardened string/backslash quoting with ipsystem(),
1479 Prettified and hardened string/backslash quoting with ipsystem(),
1476 ipalias() and ipmagic(). Now even \ characters are passed to
1480 ipalias() and ipmagic(). Now even \ characters are passed to
1477 %magics, !shell escapes and aliases exactly as they are in the
1481 %magics, !shell escapes and aliases exactly as they are in the
1478 ipython command line. Should improve backslash experience,
1482 ipython command line. Should improve backslash experience,
1479 particularly in Windows (path delimiter for some commands that
1483 particularly in Windows (path delimiter for some commands that
1480 won't understand '/'), but Unix benefits as well (regexps). %cd
1484 won't understand '/'), but Unix benefits as well (regexps). %cd
1481 magic still doesn't support backslash path delimiters, though. Also
1485 magic still doesn't support backslash path delimiters, though. Also
1482 deleted all pretense of supporting multiline command strings in
1486 deleted all pretense of supporting multiline command strings in
1483 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1487 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1484
1488
1485 * doc/build_doc_instructions.txt added. Documentation on how to
1489 * doc/build_doc_instructions.txt added. Documentation on how to
1486 use doc/update_manual.py, added yesterday. Both files contributed
1490 use doc/update_manual.py, added yesterday. Both files contributed
1487 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1491 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1488 doc/*.sh for deprecation at a later date.
1492 doc/*.sh for deprecation at a later date.
1489
1493
1490 * /ipython.py Added ipython.py to root directory for
1494 * /ipython.py Added ipython.py to root directory for
1491 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1495 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1492 ipython.py) and development convenience (no need to keep doing
1496 ipython.py) and development convenience (no need to keep doing
1493 "setup.py install" between changes).
1497 "setup.py install" between changes).
1494
1498
1495 * Made ! and !! shell escapes work (again) in multiline expressions:
1499 * Made ! and !! shell escapes work (again) in multiline expressions:
1496 if 1:
1500 if 1:
1497 !ls
1501 !ls
1498 !!ls
1502 !!ls
1499
1503
1500 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1504 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1501
1505
1502 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1506 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1503 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1507 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1504 module in case-insensitive installation. Was causing crashes
1508 module in case-insensitive installation. Was causing crashes
1505 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1509 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1506
1510
1507 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1511 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1508 <marienz-AT-gentoo.org>, closes
1512 <marienz-AT-gentoo.org>, closes
1509 http://www.scipy.net/roundup/ipython/issue51.
1513 http://www.scipy.net/roundup/ipython/issue51.
1510
1514
1511 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1515 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1512
1516
1513 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1517 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1514 problem of excessive CPU usage under *nix and keyboard lag under
1518 problem of excessive CPU usage under *nix and keyboard lag under
1515 win32.
1519 win32.
1516
1520
1517 2006-01-10 *** Released version 0.7.0
1521 2006-01-10 *** Released version 0.7.0
1518
1522
1519 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1523 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1520
1524
1521 * IPython/Release.py (revision): tag version number to 0.7.0,
1525 * IPython/Release.py (revision): tag version number to 0.7.0,
1522 ready for release.
1526 ready for release.
1523
1527
1524 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1528 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1525 it informs the user of the name of the temp. file used. This can
1529 it informs the user of the name of the temp. file used. This can
1526 help if you decide later to reuse that same file, so you know
1530 help if you decide later to reuse that same file, so you know
1527 where to copy the info from.
1531 where to copy the info from.
1528
1532
1529 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1533 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1530
1534
1531 * setup_bdist_egg.py: little script to build an egg. Added
1535 * setup_bdist_egg.py: little script to build an egg. Added
1532 support in the release tools as well.
1536 support in the release tools as well.
1533
1537
1534 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1538 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1535
1539
1536 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1540 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1537 version selection (new -wxversion command line and ipythonrc
1541 version selection (new -wxversion command line and ipythonrc
1538 parameter). Patch contributed by Arnd Baecker
1542 parameter). Patch contributed by Arnd Baecker
1539 <arnd.baecker-AT-web.de>.
1543 <arnd.baecker-AT-web.de>.
1540
1544
1541 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1545 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1542 embedded instances, for variables defined at the interactive
1546 embedded instances, for variables defined at the interactive
1543 prompt of the embedded ipython. Reported by Arnd.
1547 prompt of the embedded ipython. Reported by Arnd.
1544
1548
1545 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1549 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1546 it can be used as a (stateful) toggle, or with a direct parameter.
1550 it can be used as a (stateful) toggle, or with a direct parameter.
1547
1551
1548 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1552 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1549 could be triggered in certain cases and cause the traceback
1553 could be triggered in certain cases and cause the traceback
1550 printer not to work.
1554 printer not to work.
1551
1555
1552 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1556 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1553
1557
1554 * IPython/iplib.py (_should_recompile): Small fix, closes
1558 * IPython/iplib.py (_should_recompile): Small fix, closes
1555 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1559 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1556
1560
1557 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1561 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1558
1562
1559 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1563 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1560 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1564 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1561 Moad for help with tracking it down.
1565 Moad for help with tracking it down.
1562
1566
1563 * IPython/iplib.py (handle_auto): fix autocall handling for
1567 * IPython/iplib.py (handle_auto): fix autocall handling for
1564 objects which support BOTH __getitem__ and __call__ (so that f [x]
1568 objects which support BOTH __getitem__ and __call__ (so that f [x]
1565 is left alone, instead of becoming f([x]) automatically).
1569 is left alone, instead of becoming f([x]) automatically).
1566
1570
1567 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1571 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1568 Ville's patch.
1572 Ville's patch.
1569
1573
1570 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1574 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1571
1575
1572 * IPython/iplib.py (handle_auto): changed autocall semantics to
1576 * IPython/iplib.py (handle_auto): changed autocall semantics to
1573 include 'smart' mode, where the autocall transformation is NOT
1577 include 'smart' mode, where the autocall transformation is NOT
1574 applied if there are no arguments on the line. This allows you to
1578 applied if there are no arguments on the line. This allows you to
1575 just type 'foo' if foo is a callable to see its internal form,
1579 just type 'foo' if foo is a callable to see its internal form,
1576 instead of having it called with no arguments (typically a
1580 instead of having it called with no arguments (typically a
1577 mistake). The old 'full' autocall still exists: for that, you
1581 mistake). The old 'full' autocall still exists: for that, you
1578 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1582 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1579
1583
1580 * IPython/completer.py (Completer.attr_matches): add
1584 * IPython/completer.py (Completer.attr_matches): add
1581 tab-completion support for Enthoughts' traits. After a report by
1585 tab-completion support for Enthoughts' traits. After a report by
1582 Arnd and a patch by Prabhu.
1586 Arnd and a patch by Prabhu.
1583
1587
1584 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1588 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1585
1589
1586 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1590 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1587 Schmolck's patch to fix inspect.getinnerframes().
1591 Schmolck's patch to fix inspect.getinnerframes().
1588
1592
1589 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1593 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1590 for embedded instances, regarding handling of namespaces and items
1594 for embedded instances, regarding handling of namespaces and items
1591 added to the __builtin__ one. Multiple embedded instances and
1595 added to the __builtin__ one. Multiple embedded instances and
1592 recursive embeddings should work better now (though I'm not sure
1596 recursive embeddings should work better now (though I'm not sure
1593 I've got all the corner cases fixed, that code is a bit of a brain
1597 I've got all the corner cases fixed, that code is a bit of a brain
1594 twister).
1598 twister).
1595
1599
1596 * IPython/Magic.py (magic_edit): added support to edit in-memory
1600 * IPython/Magic.py (magic_edit): added support to edit in-memory
1597 macros (automatically creates the necessary temp files). %edit
1601 macros (automatically creates the necessary temp files). %edit
1598 also doesn't return the file contents anymore, it's just noise.
1602 also doesn't return the file contents anymore, it's just noise.
1599
1603
1600 * IPython/completer.py (Completer.attr_matches): revert change to
1604 * IPython/completer.py (Completer.attr_matches): revert change to
1601 complete only on attributes listed in __all__. I realized it
1605 complete only on attributes listed in __all__. I realized it
1602 cripples the tab-completion system as a tool for exploring the
1606 cripples the tab-completion system as a tool for exploring the
1603 internals of unknown libraries (it renders any non-__all__
1607 internals of unknown libraries (it renders any non-__all__
1604 attribute off-limits). I got bit by this when trying to see
1608 attribute off-limits). I got bit by this when trying to see
1605 something inside the dis module.
1609 something inside the dis module.
1606
1610
1607 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1611 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1608
1612
1609 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1613 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1610 namespace for users and extension writers to hold data in. This
1614 namespace for users and extension writers to hold data in. This
1611 follows the discussion in
1615 follows the discussion in
1612 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1616 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1613
1617
1614 * IPython/completer.py (IPCompleter.complete): small patch to help
1618 * IPython/completer.py (IPCompleter.complete): small patch to help
1615 tab-completion under Emacs, after a suggestion by John Barnard
1619 tab-completion under Emacs, after a suggestion by John Barnard
1616 <barnarj-AT-ccf.org>.
1620 <barnarj-AT-ccf.org>.
1617
1621
1618 * IPython/Magic.py (Magic.extract_input_slices): added support for
1622 * IPython/Magic.py (Magic.extract_input_slices): added support for
1619 the slice notation in magics to use N-M to represent numbers N...M
1623 the slice notation in magics to use N-M to represent numbers N...M
1620 (closed endpoints). This is used by %macro and %save.
1624 (closed endpoints). This is used by %macro and %save.
1621
1625
1622 * IPython/completer.py (Completer.attr_matches): for modules which
1626 * IPython/completer.py (Completer.attr_matches): for modules which
1623 define __all__, complete only on those. After a patch by Jeffrey
1627 define __all__, complete only on those. After a patch by Jeffrey
1624 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1628 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1625 speed up this routine.
1629 speed up this routine.
1626
1630
1627 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1631 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1628 don't know if this is the end of it, but the behavior now is
1632 don't know if this is the end of it, but the behavior now is
1629 certainly much more correct. Note that coupled with macros,
1633 certainly much more correct. Note that coupled with macros,
1630 slightly surprising (at first) behavior may occur: a macro will in
1634 slightly surprising (at first) behavior may occur: a macro will in
1631 general expand to multiple lines of input, so upon exiting, the
1635 general expand to multiple lines of input, so upon exiting, the
1632 in/out counters will both be bumped by the corresponding amount
1636 in/out counters will both be bumped by the corresponding amount
1633 (as if the macro's contents had been typed interactively). Typing
1637 (as if the macro's contents had been typed interactively). Typing
1634 %hist will reveal the intermediate (silently processed) lines.
1638 %hist will reveal the intermediate (silently processed) lines.
1635
1639
1636 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1640 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1637 pickle to fail (%run was overwriting __main__ and not restoring
1641 pickle to fail (%run was overwriting __main__ and not restoring
1638 it, but pickle relies on __main__ to operate).
1642 it, but pickle relies on __main__ to operate).
1639
1643
1640 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1644 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1641 using properties, but forgot to make the main InteractiveShell
1645 using properties, but forgot to make the main InteractiveShell
1642 class a new-style class. Properties fail silently, and
1646 class a new-style class. Properties fail silently, and
1643 mysteriously, with old-style class (getters work, but
1647 mysteriously, with old-style class (getters work, but
1644 setters don't do anything).
1648 setters don't do anything).
1645
1649
1646 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1650 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1647
1651
1648 * IPython/Magic.py (magic_history): fix history reporting bug (I
1652 * IPython/Magic.py (magic_history): fix history reporting bug (I
1649 know some nasties are still there, I just can't seem to find a
1653 know some nasties are still there, I just can't seem to find a
1650 reproducible test case to track them down; the input history is
1654 reproducible test case to track them down; the input history is
1651 falling out of sync...)
1655 falling out of sync...)
1652
1656
1653 * IPython/iplib.py (handle_shell_escape): fix bug where both
1657 * IPython/iplib.py (handle_shell_escape): fix bug where both
1654 aliases and system accesses where broken for indented code (such
1658 aliases and system accesses where broken for indented code (such
1655 as loops).
1659 as loops).
1656
1660
1657 * IPython/genutils.py (shell): fix small but critical bug for
1661 * IPython/genutils.py (shell): fix small but critical bug for
1658 win32 system access.
1662 win32 system access.
1659
1663
1660 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1664 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1661
1665
1662 * IPython/iplib.py (showtraceback): remove use of the
1666 * IPython/iplib.py (showtraceback): remove use of the
1663 sys.last_{type/value/traceback} structures, which are non
1667 sys.last_{type/value/traceback} structures, which are non
1664 thread-safe.
1668 thread-safe.
1665 (_prefilter): change control flow to ensure that we NEVER
1669 (_prefilter): change control flow to ensure that we NEVER
1666 introspect objects when autocall is off. This will guarantee that
1670 introspect objects when autocall is off. This will guarantee that
1667 having an input line of the form 'x.y', where access to attribute
1671 having an input line of the form 'x.y', where access to attribute
1668 'y' has side effects, doesn't trigger the side effect TWICE. It
1672 'y' has side effects, doesn't trigger the side effect TWICE. It
1669 is important to note that, with autocall on, these side effects
1673 is important to note that, with autocall on, these side effects
1670 can still happen.
1674 can still happen.
1671 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1675 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1672 trio. IPython offers these three kinds of special calls which are
1676 trio. IPython offers these three kinds of special calls which are
1673 not python code, and it's a good thing to have their call method
1677 not python code, and it's a good thing to have their call method
1674 be accessible as pure python functions (not just special syntax at
1678 be accessible as pure python functions (not just special syntax at
1675 the command line). It gives us a better internal implementation
1679 the command line). It gives us a better internal implementation
1676 structure, as well as exposing these for user scripting more
1680 structure, as well as exposing these for user scripting more
1677 cleanly.
1681 cleanly.
1678
1682
1679 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1683 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1680 file. Now that they'll be more likely to be used with the
1684 file. Now that they'll be more likely to be used with the
1681 persistance system (%store), I want to make sure their module path
1685 persistance system (%store), I want to make sure their module path
1682 doesn't change in the future, so that we don't break things for
1686 doesn't change in the future, so that we don't break things for
1683 users' persisted data.
1687 users' persisted data.
1684
1688
1685 * IPython/iplib.py (autoindent_update): move indentation
1689 * IPython/iplib.py (autoindent_update): move indentation
1686 management into the _text_ processing loop, not the keyboard
1690 management into the _text_ processing loop, not the keyboard
1687 interactive one. This is necessary to correctly process non-typed
1691 interactive one. This is necessary to correctly process non-typed
1688 multiline input (such as macros).
1692 multiline input (such as macros).
1689
1693
1690 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1694 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1691 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1695 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1692 which was producing problems in the resulting manual.
1696 which was producing problems in the resulting manual.
1693 (magic_whos): improve reporting of instances (show their class,
1697 (magic_whos): improve reporting of instances (show their class,
1694 instead of simply printing 'instance' which isn't terribly
1698 instead of simply printing 'instance' which isn't terribly
1695 informative).
1699 informative).
1696
1700
1697 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1701 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1698 (minor mods) to support network shares under win32.
1702 (minor mods) to support network shares under win32.
1699
1703
1700 * IPython/winconsole.py (get_console_size): add new winconsole
1704 * IPython/winconsole.py (get_console_size): add new winconsole
1701 module and fixes to page_dumb() to improve its behavior under
1705 module and fixes to page_dumb() to improve its behavior under
1702 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1706 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1703
1707
1704 * IPython/Magic.py (Macro): simplified Macro class to just
1708 * IPython/Magic.py (Macro): simplified Macro class to just
1705 subclass list. We've had only 2.2 compatibility for a very long
1709 subclass list. We've had only 2.2 compatibility for a very long
1706 time, yet I was still avoiding subclassing the builtin types. No
1710 time, yet I was still avoiding subclassing the builtin types. No
1707 more (I'm also starting to use properties, though I won't shift to
1711 more (I'm also starting to use properties, though I won't shift to
1708 2.3-specific features quite yet).
1712 2.3-specific features quite yet).
1709 (magic_store): added Ville's patch for lightweight variable
1713 (magic_store): added Ville's patch for lightweight variable
1710 persistence, after a request on the user list by Matt Wilkie
1714 persistence, after a request on the user list by Matt Wilkie
1711 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1715 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1712 details.
1716 details.
1713
1717
1714 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1718 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1715 changed the default logfile name from 'ipython.log' to
1719 changed the default logfile name from 'ipython.log' to
1716 'ipython_log.py'. These logs are real python files, and now that
1720 'ipython_log.py'. These logs are real python files, and now that
1717 we have much better multiline support, people are more likely to
1721 we have much better multiline support, people are more likely to
1718 want to use them as such. Might as well name them correctly.
1722 want to use them as such. Might as well name them correctly.
1719
1723
1720 * IPython/Magic.py: substantial cleanup. While we can't stop
1724 * IPython/Magic.py: substantial cleanup. While we can't stop
1721 using magics as mixins, due to the existing customizations 'out
1725 using magics as mixins, due to the existing customizations 'out
1722 there' which rely on the mixin naming conventions, at least I
1726 there' which rely on the mixin naming conventions, at least I
1723 cleaned out all cross-class name usage. So once we are OK with
1727 cleaned out all cross-class name usage. So once we are OK with
1724 breaking compatibility, the two systems can be separated.
1728 breaking compatibility, the two systems can be separated.
1725
1729
1726 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1730 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1727 anymore, and the class is a fair bit less hideous as well. New
1731 anymore, and the class is a fair bit less hideous as well. New
1728 features were also introduced: timestamping of input, and logging
1732 features were also introduced: timestamping of input, and logging
1729 of output results. These are user-visible with the -t and -o
1733 of output results. These are user-visible with the -t and -o
1730 options to %logstart. Closes
1734 options to %logstart. Closes
1731 http://www.scipy.net/roundup/ipython/issue11 and a request by
1735 http://www.scipy.net/roundup/ipython/issue11 and a request by
1732 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1736 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1733
1737
1734 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1738 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1735
1739
1736 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1740 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1737 better handle backslashes in paths. See the thread 'More Windows
1741 better handle backslashes in paths. See the thread 'More Windows
1738 questions part 2 - \/ characters revisited' on the iypthon user
1742 questions part 2 - \/ characters revisited' on the iypthon user
1739 list:
1743 list:
1740 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1744 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1741
1745
1742 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1746 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1743
1747
1744 (InteractiveShell.__init__): change threaded shells to not use the
1748 (InteractiveShell.__init__): change threaded shells to not use the
1745 ipython crash handler. This was causing more problems than not,
1749 ipython crash handler. This was causing more problems than not,
1746 as exceptions in the main thread (GUI code, typically) would
1750 as exceptions in the main thread (GUI code, typically) would
1747 always show up as a 'crash', when they really weren't.
1751 always show up as a 'crash', when they really weren't.
1748
1752
1749 The colors and exception mode commands (%colors/%xmode) have been
1753 The colors and exception mode commands (%colors/%xmode) have been
1750 synchronized to also take this into account, so users can get
1754 synchronized to also take this into account, so users can get
1751 verbose exceptions for their threaded code as well. I also added
1755 verbose exceptions for their threaded code as well. I also added
1752 support for activating pdb inside this exception handler as well,
1756 support for activating pdb inside this exception handler as well,
1753 so now GUI authors can use IPython's enhanced pdb at runtime.
1757 so now GUI authors can use IPython's enhanced pdb at runtime.
1754
1758
1755 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1759 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1756 true by default, and add it to the shipped ipythonrc file. Since
1760 true by default, and add it to the shipped ipythonrc file. Since
1757 this asks the user before proceeding, I think it's OK to make it
1761 this asks the user before proceeding, I think it's OK to make it
1758 true by default.
1762 true by default.
1759
1763
1760 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1764 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1761 of the previous special-casing of input in the eval loop. I think
1765 of the previous special-casing of input in the eval loop. I think
1762 this is cleaner, as they really are commands and shouldn't have
1766 this is cleaner, as they really are commands and shouldn't have
1763 a special role in the middle of the core code.
1767 a special role in the middle of the core code.
1764
1768
1765 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1769 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1766
1770
1767 * IPython/iplib.py (edit_syntax_error): added support for
1771 * IPython/iplib.py (edit_syntax_error): added support for
1768 automatically reopening the editor if the file had a syntax error
1772 automatically reopening the editor if the file had a syntax error
1769 in it. Thanks to scottt who provided the patch at:
1773 in it. Thanks to scottt who provided the patch at:
1770 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1774 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1771 version committed).
1775 version committed).
1772
1776
1773 * IPython/iplib.py (handle_normal): add suport for multi-line
1777 * IPython/iplib.py (handle_normal): add suport for multi-line
1774 input with emtpy lines. This fixes
1778 input with emtpy lines. This fixes
1775 http://www.scipy.net/roundup/ipython/issue43 and a similar
1779 http://www.scipy.net/roundup/ipython/issue43 and a similar
1776 discussion on the user list.
1780 discussion on the user list.
1777
1781
1778 WARNING: a behavior change is necessarily introduced to support
1782 WARNING: a behavior change is necessarily introduced to support
1779 blank lines: now a single blank line with whitespace does NOT
1783 blank lines: now a single blank line with whitespace does NOT
1780 break the input loop, which means that when autoindent is on, by
1784 break the input loop, which means that when autoindent is on, by
1781 default hitting return on the next (indented) line does NOT exit.
1785 default hitting return on the next (indented) line does NOT exit.
1782
1786
1783 Instead, to exit a multiline input you can either have:
1787 Instead, to exit a multiline input you can either have:
1784
1788
1785 - TWO whitespace lines (just hit return again), or
1789 - TWO whitespace lines (just hit return again), or
1786 - a single whitespace line of a different length than provided
1790 - a single whitespace line of a different length than provided
1787 by the autoindent (add or remove a space).
1791 by the autoindent (add or remove a space).
1788
1792
1789 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1793 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1790 module to better organize all readline-related functionality.
1794 module to better organize all readline-related functionality.
1791 I've deleted FlexCompleter and put all completion clases here.
1795 I've deleted FlexCompleter and put all completion clases here.
1792
1796
1793 * IPython/iplib.py (raw_input): improve indentation management.
1797 * IPython/iplib.py (raw_input): improve indentation management.
1794 It is now possible to paste indented code with autoindent on, and
1798 It is now possible to paste indented code with autoindent on, and
1795 the code is interpreted correctly (though it still looks bad on
1799 the code is interpreted correctly (though it still looks bad on
1796 screen, due to the line-oriented nature of ipython).
1800 screen, due to the line-oriented nature of ipython).
1797 (MagicCompleter.complete): change behavior so that a TAB key on an
1801 (MagicCompleter.complete): change behavior so that a TAB key on an
1798 otherwise empty line actually inserts a tab, instead of completing
1802 otherwise empty line actually inserts a tab, instead of completing
1799 on the entire global namespace. This makes it easier to use the
1803 on the entire global namespace. This makes it easier to use the
1800 TAB key for indentation. After a request by Hans Meine
1804 TAB key for indentation. After a request by Hans Meine
1801 <hans_meine-AT-gmx.net>
1805 <hans_meine-AT-gmx.net>
1802 (_prefilter): add support so that typing plain 'exit' or 'quit'
1806 (_prefilter): add support so that typing plain 'exit' or 'quit'
1803 does a sensible thing. Originally I tried to deviate as little as
1807 does a sensible thing. Originally I tried to deviate as little as
1804 possible from the default python behavior, but even that one may
1808 possible from the default python behavior, but even that one may
1805 change in this direction (thread on python-dev to that effect).
1809 change in this direction (thread on python-dev to that effect).
1806 Regardless, ipython should do the right thing even if CPython's
1810 Regardless, ipython should do the right thing even if CPython's
1807 '>>>' prompt doesn't.
1811 '>>>' prompt doesn't.
1808 (InteractiveShell): removed subclassing code.InteractiveConsole
1812 (InteractiveShell): removed subclassing code.InteractiveConsole
1809 class. By now we'd overridden just about all of its methods: I've
1813 class. By now we'd overridden just about all of its methods: I've
1810 copied the remaining two over, and now ipython is a standalone
1814 copied the remaining two over, and now ipython is a standalone
1811 class. This will provide a clearer picture for the chainsaw
1815 class. This will provide a clearer picture for the chainsaw
1812 branch refactoring.
1816 branch refactoring.
1813
1817
1814 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1818 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1815
1819
1816 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1820 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1817 failures for objects which break when dir() is called on them.
1821 failures for objects which break when dir() is called on them.
1818
1822
1819 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1823 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1820 distinct local and global namespaces in the completer API. This
1824 distinct local and global namespaces in the completer API. This
1821 change allows us to properly handle completion with distinct
1825 change allows us to properly handle completion with distinct
1822 scopes, including in embedded instances (this had never really
1826 scopes, including in embedded instances (this had never really
1823 worked correctly).
1827 worked correctly).
1824
1828
1825 Note: this introduces a change in the constructor for
1829 Note: this introduces a change in the constructor for
1826 MagicCompleter, as a new global_namespace parameter is now the
1830 MagicCompleter, as a new global_namespace parameter is now the
1827 second argument (the others were bumped one position).
1831 second argument (the others were bumped one position).
1828
1832
1829 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1833 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1830
1834
1831 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1835 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1832 embedded instances (which can be done now thanks to Vivian's
1836 embedded instances (which can be done now thanks to Vivian's
1833 frame-handling fixes for pdb).
1837 frame-handling fixes for pdb).
1834 (InteractiveShell.__init__): Fix namespace handling problem in
1838 (InteractiveShell.__init__): Fix namespace handling problem in
1835 embedded instances. We were overwriting __main__ unconditionally,
1839 embedded instances. We were overwriting __main__ unconditionally,
1836 and this should only be done for 'full' (non-embedded) IPython;
1840 and this should only be done for 'full' (non-embedded) IPython;
1837 embedded instances must respect the caller's __main__. Thanks to
1841 embedded instances must respect the caller's __main__. Thanks to
1838 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1842 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1839
1843
1840 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1844 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1841
1845
1842 * setup.py: added download_url to setup(). This registers the
1846 * setup.py: added download_url to setup(). This registers the
1843 download address at PyPI, which is not only useful to humans
1847 download address at PyPI, which is not only useful to humans
1844 browsing the site, but is also picked up by setuptools (the Eggs
1848 browsing the site, but is also picked up by setuptools (the Eggs
1845 machinery). Thanks to Ville and R. Kern for the info/discussion
1849 machinery). Thanks to Ville and R. Kern for the info/discussion
1846 on this.
1850 on this.
1847
1851
1848 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1852 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1849
1853
1850 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1854 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1851 This brings a lot of nice functionality to the pdb mode, which now
1855 This brings a lot of nice functionality to the pdb mode, which now
1852 has tab-completion, syntax highlighting, and better stack handling
1856 has tab-completion, syntax highlighting, and better stack handling
1853 than before. Many thanks to Vivian De Smedt
1857 than before. Many thanks to Vivian De Smedt
1854 <vivian-AT-vdesmedt.com> for the original patches.
1858 <vivian-AT-vdesmedt.com> for the original patches.
1855
1859
1856 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1860 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1857
1861
1858 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1862 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1859 sequence to consistently accept the banner argument. The
1863 sequence to consistently accept the banner argument. The
1860 inconsistency was tripping SAGE, thanks to Gary Zablackis
1864 inconsistency was tripping SAGE, thanks to Gary Zablackis
1861 <gzabl-AT-yahoo.com> for the report.
1865 <gzabl-AT-yahoo.com> for the report.
1862
1866
1863 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1867 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1864
1868
1865 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1869 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1866 Fix bug where a naked 'alias' call in the ipythonrc file would
1870 Fix bug where a naked 'alias' call in the ipythonrc file would
1867 cause a crash. Bug reported by Jorgen Stenarson.
1871 cause a crash. Bug reported by Jorgen Stenarson.
1868
1872
1869 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1873 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1870
1874
1871 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1875 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1872 startup time.
1876 startup time.
1873
1877
1874 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1878 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1875 instances had introduced a bug with globals in normal code. Now
1879 instances had introduced a bug with globals in normal code. Now
1876 it's working in all cases.
1880 it's working in all cases.
1877
1881
1878 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1882 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1879 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1883 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1880 has been introduced to set the default case sensitivity of the
1884 has been introduced to set the default case sensitivity of the
1881 searches. Users can still select either mode at runtime on a
1885 searches. Users can still select either mode at runtime on a
1882 per-search basis.
1886 per-search basis.
1883
1887
1884 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1888 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1885
1889
1886 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1890 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1887 attributes in wildcard searches for subclasses. Modified version
1891 attributes in wildcard searches for subclasses. Modified version
1888 of a patch by Jorgen.
1892 of a patch by Jorgen.
1889
1893
1890 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1894 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1891
1895
1892 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1896 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1893 embedded instances. I added a user_global_ns attribute to the
1897 embedded instances. I added a user_global_ns attribute to the
1894 InteractiveShell class to handle this.
1898 InteractiveShell class to handle this.
1895
1899
1896 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1900 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1897
1901
1898 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1902 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1899 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1903 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1900 (reported under win32, but may happen also in other platforms).
1904 (reported under win32, but may happen also in other platforms).
1901 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1905 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1902
1906
1903 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1907 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1904
1908
1905 * IPython/Magic.py (magic_psearch): new support for wildcard
1909 * IPython/Magic.py (magic_psearch): new support for wildcard
1906 patterns. Now, typing ?a*b will list all names which begin with a
1910 patterns. Now, typing ?a*b will list all names which begin with a
1907 and end in b, for example. The %psearch magic has full
1911 and end in b, for example. The %psearch magic has full
1908 docstrings. Many thanks to JΓΆrgen Stenarson
1912 docstrings. Many thanks to JΓΆrgen Stenarson
1909 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1913 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1910 implementing this functionality.
1914 implementing this functionality.
1911
1915
1912 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1916 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1913
1917
1914 * Manual: fixed long-standing annoyance of double-dashes (as in
1918 * Manual: fixed long-standing annoyance of double-dashes (as in
1915 --prefix=~, for example) being stripped in the HTML version. This
1919 --prefix=~, for example) being stripped in the HTML version. This
1916 is a latex2html bug, but a workaround was provided. Many thanks
1920 is a latex2html bug, but a workaround was provided. Many thanks
1917 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1921 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1918 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1922 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1919 rolling. This seemingly small issue had tripped a number of users
1923 rolling. This seemingly small issue had tripped a number of users
1920 when first installing, so I'm glad to see it gone.
1924 when first installing, so I'm glad to see it gone.
1921
1925
1922 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1926 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1923
1927
1924 * IPython/Extensions/numeric_formats.py: fix missing import,
1928 * IPython/Extensions/numeric_formats.py: fix missing import,
1925 reported by Stephen Walton.
1929 reported by Stephen Walton.
1926
1930
1927 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1931 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1928
1932
1929 * IPython/demo.py: finish demo module, fully documented now.
1933 * IPython/demo.py: finish demo module, fully documented now.
1930
1934
1931 * IPython/genutils.py (file_read): simple little utility to read a
1935 * IPython/genutils.py (file_read): simple little utility to read a
1932 file and ensure it's closed afterwards.
1936 file and ensure it's closed afterwards.
1933
1937
1934 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1938 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1935
1939
1936 * IPython/demo.py (Demo.__init__): added support for individually
1940 * IPython/demo.py (Demo.__init__): added support for individually
1937 tagging blocks for automatic execution.
1941 tagging blocks for automatic execution.
1938
1942
1939 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1943 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1940 syntax-highlighted python sources, requested by John.
1944 syntax-highlighted python sources, requested by John.
1941
1945
1942 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1946 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1943
1947
1944 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1948 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1945 finishing.
1949 finishing.
1946
1950
1947 * IPython/genutils.py (shlex_split): moved from Magic to here,
1951 * IPython/genutils.py (shlex_split): moved from Magic to here,
1948 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1952 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1949
1953
1950 * IPython/demo.py (Demo.__init__): added support for silent
1954 * IPython/demo.py (Demo.__init__): added support for silent
1951 blocks, improved marks as regexps, docstrings written.
1955 blocks, improved marks as regexps, docstrings written.
1952 (Demo.__init__): better docstring, added support for sys.argv.
1956 (Demo.__init__): better docstring, added support for sys.argv.
1953
1957
1954 * IPython/genutils.py (marquee): little utility used by the demo
1958 * IPython/genutils.py (marquee): little utility used by the demo
1955 code, handy in general.
1959 code, handy in general.
1956
1960
1957 * IPython/demo.py (Demo.__init__): new class for interactive
1961 * IPython/demo.py (Demo.__init__): new class for interactive
1958 demos. Not documented yet, I just wrote it in a hurry for
1962 demos. Not documented yet, I just wrote it in a hurry for
1959 scipy'05. Will docstring later.
1963 scipy'05. Will docstring later.
1960
1964
1961 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1965 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1962
1966
1963 * IPython/Shell.py (sigint_handler): Drastic simplification which
1967 * IPython/Shell.py (sigint_handler): Drastic simplification which
1964 also seems to make Ctrl-C work correctly across threads! This is
1968 also seems to make Ctrl-C work correctly across threads! This is
1965 so simple, that I can't beleive I'd missed it before. Needs more
1969 so simple, that I can't beleive I'd missed it before. Needs more
1966 testing, though.
1970 testing, though.
1967 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1971 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1968 like this before...
1972 like this before...
1969
1973
1970 * IPython/genutils.py (get_home_dir): add protection against
1974 * IPython/genutils.py (get_home_dir): add protection against
1971 non-dirs in win32 registry.
1975 non-dirs in win32 registry.
1972
1976
1973 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1977 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1974 bug where dict was mutated while iterating (pysh crash).
1978 bug where dict was mutated while iterating (pysh crash).
1975
1979
1976 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1980 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1977
1981
1978 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1982 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1979 spurious newlines added by this routine. After a report by
1983 spurious newlines added by this routine. After a report by
1980 F. Mantegazza.
1984 F. Mantegazza.
1981
1985
1982 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1986 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1983
1987
1984 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1988 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1985 calls. These were a leftover from the GTK 1.x days, and can cause
1989 calls. These were a leftover from the GTK 1.x days, and can cause
1986 problems in certain cases (after a report by John Hunter).
1990 problems in certain cases (after a report by John Hunter).
1987
1991
1988 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1992 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1989 os.getcwd() fails at init time. Thanks to patch from David Remahl
1993 os.getcwd() fails at init time. Thanks to patch from David Remahl
1990 <chmod007-AT-mac.com>.
1994 <chmod007-AT-mac.com>.
1991 (InteractiveShell.__init__): prevent certain special magics from
1995 (InteractiveShell.__init__): prevent certain special magics from
1992 being shadowed by aliases. Closes
1996 being shadowed by aliases. Closes
1993 http://www.scipy.net/roundup/ipython/issue41.
1997 http://www.scipy.net/roundup/ipython/issue41.
1994
1998
1995 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1999 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1996
2000
1997 * IPython/iplib.py (InteractiveShell.complete): Added new
2001 * IPython/iplib.py (InteractiveShell.complete): Added new
1998 top-level completion method to expose the completion mechanism
2002 top-level completion method to expose the completion mechanism
1999 beyond readline-based environments.
2003 beyond readline-based environments.
2000
2004
2001 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2005 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2002
2006
2003 * tools/ipsvnc (svnversion): fix svnversion capture.
2007 * tools/ipsvnc (svnversion): fix svnversion capture.
2004
2008
2005 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2009 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2006 attribute to self, which was missing. Before, it was set by a
2010 attribute to self, which was missing. Before, it was set by a
2007 routine which in certain cases wasn't being called, so the
2011 routine which in certain cases wasn't being called, so the
2008 instance could end up missing the attribute. This caused a crash.
2012 instance could end up missing the attribute. This caused a crash.
2009 Closes http://www.scipy.net/roundup/ipython/issue40.
2013 Closes http://www.scipy.net/roundup/ipython/issue40.
2010
2014
2011 2005-08-16 Fernando Perez <fperez@colorado.edu>
2015 2005-08-16 Fernando Perez <fperez@colorado.edu>
2012
2016
2013 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2017 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2014 contains non-string attribute. Closes
2018 contains non-string attribute. Closes
2015 http://www.scipy.net/roundup/ipython/issue38.
2019 http://www.scipy.net/roundup/ipython/issue38.
2016
2020
2017 2005-08-14 Fernando Perez <fperez@colorado.edu>
2021 2005-08-14 Fernando Perez <fperez@colorado.edu>
2018
2022
2019 * tools/ipsvnc: Minor improvements, to add changeset info.
2023 * tools/ipsvnc: Minor improvements, to add changeset info.
2020
2024
2021 2005-08-12 Fernando Perez <fperez@colorado.edu>
2025 2005-08-12 Fernando Perez <fperez@colorado.edu>
2022
2026
2023 * IPython/iplib.py (runsource): remove self.code_to_run_src
2027 * IPython/iplib.py (runsource): remove self.code_to_run_src
2024 attribute. I realized this is nothing more than
2028 attribute. I realized this is nothing more than
2025 '\n'.join(self.buffer), and having the same data in two different
2029 '\n'.join(self.buffer), and having the same data in two different
2026 places is just asking for synchronization bugs. This may impact
2030 places is just asking for synchronization bugs. This may impact
2027 people who have custom exception handlers, so I need to warn
2031 people who have custom exception handlers, so I need to warn
2028 ipython-dev about it (F. Mantegazza may use them).
2032 ipython-dev about it (F. Mantegazza may use them).
2029
2033
2030 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2034 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2031
2035
2032 * IPython/genutils.py: fix 2.2 compatibility (generators)
2036 * IPython/genutils.py: fix 2.2 compatibility (generators)
2033
2037
2034 2005-07-18 Fernando Perez <fperez@colorado.edu>
2038 2005-07-18 Fernando Perez <fperez@colorado.edu>
2035
2039
2036 * IPython/genutils.py (get_home_dir): fix to help users with
2040 * IPython/genutils.py (get_home_dir): fix to help users with
2037 invalid $HOME under win32.
2041 invalid $HOME under win32.
2038
2042
2039 2005-07-17 Fernando Perez <fperez@colorado.edu>
2043 2005-07-17 Fernando Perez <fperez@colorado.edu>
2040
2044
2041 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2045 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2042 some old hacks and clean up a bit other routines; code should be
2046 some old hacks and clean up a bit other routines; code should be
2043 simpler and a bit faster.
2047 simpler and a bit faster.
2044
2048
2045 * IPython/iplib.py (interact): removed some last-resort attempts
2049 * IPython/iplib.py (interact): removed some last-resort attempts
2046 to survive broken stdout/stderr. That code was only making it
2050 to survive broken stdout/stderr. That code was only making it
2047 harder to abstract out the i/o (necessary for gui integration),
2051 harder to abstract out the i/o (necessary for gui integration),
2048 and the crashes it could prevent were extremely rare in practice
2052 and the crashes it could prevent were extremely rare in practice
2049 (besides being fully user-induced in a pretty violent manner).
2053 (besides being fully user-induced in a pretty violent manner).
2050
2054
2051 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2055 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2052 Nothing major yet, but the code is simpler to read; this should
2056 Nothing major yet, but the code is simpler to read; this should
2053 make it easier to do more serious modifications in the future.
2057 make it easier to do more serious modifications in the future.
2054
2058
2055 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2059 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2056 which broke in .15 (thanks to a report by Ville).
2060 which broke in .15 (thanks to a report by Ville).
2057
2061
2058 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2062 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2059 be quite correct, I know next to nothing about unicode). This
2063 be quite correct, I know next to nothing about unicode). This
2060 will allow unicode strings to be used in prompts, amongst other
2064 will allow unicode strings to be used in prompts, amongst other
2061 cases. It also will prevent ipython from crashing when unicode
2065 cases. It also will prevent ipython from crashing when unicode
2062 shows up unexpectedly in many places. If ascii encoding fails, we
2066 shows up unexpectedly in many places. If ascii encoding fails, we
2063 assume utf_8. Currently the encoding is not a user-visible
2067 assume utf_8. Currently the encoding is not a user-visible
2064 setting, though it could be made so if there is demand for it.
2068 setting, though it could be made so if there is demand for it.
2065
2069
2066 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2070 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2067
2071
2068 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2072 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2069
2073
2070 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2074 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2071
2075
2072 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2076 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2073 code can work transparently for 2.2/2.3.
2077 code can work transparently for 2.2/2.3.
2074
2078
2075 2005-07-16 Fernando Perez <fperez@colorado.edu>
2079 2005-07-16 Fernando Perez <fperez@colorado.edu>
2076
2080
2077 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2081 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2078 out of the color scheme table used for coloring exception
2082 out of the color scheme table used for coloring exception
2079 tracebacks. This allows user code to add new schemes at runtime.
2083 tracebacks. This allows user code to add new schemes at runtime.
2080 This is a minimally modified version of the patch at
2084 This is a minimally modified version of the patch at
2081 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2085 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2082 for the contribution.
2086 for the contribution.
2083
2087
2084 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2088 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2085 slightly modified version of the patch in
2089 slightly modified version of the patch in
2086 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2090 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2087 to remove the previous try/except solution (which was costlier).
2091 to remove the previous try/except solution (which was costlier).
2088 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2092 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2089
2093
2090 2005-06-08 Fernando Perez <fperez@colorado.edu>
2094 2005-06-08 Fernando Perez <fperez@colorado.edu>
2091
2095
2092 * IPython/iplib.py (write/write_err): Add methods to abstract all
2096 * IPython/iplib.py (write/write_err): Add methods to abstract all
2093 I/O a bit more.
2097 I/O a bit more.
2094
2098
2095 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2099 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2096 warning, reported by Aric Hagberg, fix by JD Hunter.
2100 warning, reported by Aric Hagberg, fix by JD Hunter.
2097
2101
2098 2005-06-02 *** Released version 0.6.15
2102 2005-06-02 *** Released version 0.6.15
2099
2103
2100 2005-06-01 Fernando Perez <fperez@colorado.edu>
2104 2005-06-01 Fernando Perez <fperez@colorado.edu>
2101
2105
2102 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2106 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2103 tab-completion of filenames within open-quoted strings. Note that
2107 tab-completion of filenames within open-quoted strings. Note that
2104 this requires that in ~/.ipython/ipythonrc, users change the
2108 this requires that in ~/.ipython/ipythonrc, users change the
2105 readline delimiters configuration to read:
2109 readline delimiters configuration to read:
2106
2110
2107 readline_remove_delims -/~
2111 readline_remove_delims -/~
2108
2112
2109
2113
2110 2005-05-31 *** Released version 0.6.14
2114 2005-05-31 *** Released version 0.6.14
2111
2115
2112 2005-05-29 Fernando Perez <fperez@colorado.edu>
2116 2005-05-29 Fernando Perez <fperez@colorado.edu>
2113
2117
2114 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2118 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2115 with files not on the filesystem. Reported by Eliyahu Sandler
2119 with files not on the filesystem. Reported by Eliyahu Sandler
2116 <eli@gondolin.net>
2120 <eli@gondolin.net>
2117
2121
2118 2005-05-22 Fernando Perez <fperez@colorado.edu>
2122 2005-05-22 Fernando Perez <fperez@colorado.edu>
2119
2123
2120 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2124 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2121 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2125 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2122
2126
2123 2005-05-19 Fernando Perez <fperez@colorado.edu>
2127 2005-05-19 Fernando Perez <fperez@colorado.edu>
2124
2128
2125 * IPython/iplib.py (safe_execfile): close a file which could be
2129 * IPython/iplib.py (safe_execfile): close a file which could be
2126 left open (causing problems in win32, which locks open files).
2130 left open (causing problems in win32, which locks open files).
2127 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2131 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2128
2132
2129 2005-05-18 Fernando Perez <fperez@colorado.edu>
2133 2005-05-18 Fernando Perez <fperez@colorado.edu>
2130
2134
2131 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2135 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2132 keyword arguments correctly to safe_execfile().
2136 keyword arguments correctly to safe_execfile().
2133
2137
2134 2005-05-13 Fernando Perez <fperez@colorado.edu>
2138 2005-05-13 Fernando Perez <fperez@colorado.edu>
2135
2139
2136 * ipython.1: Added info about Qt to manpage, and threads warning
2140 * ipython.1: Added info about Qt to manpage, and threads warning
2137 to usage page (invoked with --help).
2141 to usage page (invoked with --help).
2138
2142
2139 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2143 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2140 new matcher (it goes at the end of the priority list) to do
2144 new matcher (it goes at the end of the priority list) to do
2141 tab-completion on named function arguments. Submitted by George
2145 tab-completion on named function arguments. Submitted by George
2142 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2146 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2143 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2147 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2144 for more details.
2148 for more details.
2145
2149
2146 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2150 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2147 SystemExit exceptions in the script being run. Thanks to a report
2151 SystemExit exceptions in the script being run. Thanks to a report
2148 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2152 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2149 producing very annoying behavior when running unit tests.
2153 producing very annoying behavior when running unit tests.
2150
2154
2151 2005-05-12 Fernando Perez <fperez@colorado.edu>
2155 2005-05-12 Fernando Perez <fperez@colorado.edu>
2152
2156
2153 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2157 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2154 which I'd broken (again) due to a changed regexp. In the process,
2158 which I'd broken (again) due to a changed regexp. In the process,
2155 added ';' as an escape to auto-quote the whole line without
2159 added ';' as an escape to auto-quote the whole line without
2156 splitting its arguments. Thanks to a report by Jerry McRae
2160 splitting its arguments. Thanks to a report by Jerry McRae
2157 <qrs0xyc02-AT-sneakemail.com>.
2161 <qrs0xyc02-AT-sneakemail.com>.
2158
2162
2159 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2163 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2160 possible crashes caused by a TokenError. Reported by Ed Schofield
2164 possible crashes caused by a TokenError. Reported by Ed Schofield
2161 <schofield-AT-ftw.at>.
2165 <schofield-AT-ftw.at>.
2162
2166
2163 2005-05-06 Fernando Perez <fperez@colorado.edu>
2167 2005-05-06 Fernando Perez <fperez@colorado.edu>
2164
2168
2165 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2169 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2166
2170
2167 2005-04-29 Fernando Perez <fperez@colorado.edu>
2171 2005-04-29 Fernando Perez <fperez@colorado.edu>
2168
2172
2169 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2173 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2170 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2174 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2171 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2175 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2172 which provides support for Qt interactive usage (similar to the
2176 which provides support for Qt interactive usage (similar to the
2173 existing one for WX and GTK). This had been often requested.
2177 existing one for WX and GTK). This had been often requested.
2174
2178
2175 2005-04-14 *** Released version 0.6.13
2179 2005-04-14 *** Released version 0.6.13
2176
2180
2177 2005-04-08 Fernando Perez <fperez@colorado.edu>
2181 2005-04-08 Fernando Perez <fperez@colorado.edu>
2178
2182
2179 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2183 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2180 from _ofind, which gets called on almost every input line. Now,
2184 from _ofind, which gets called on almost every input line. Now,
2181 we only try to get docstrings if they are actually going to be
2185 we only try to get docstrings if they are actually going to be
2182 used (the overhead of fetching unnecessary docstrings can be
2186 used (the overhead of fetching unnecessary docstrings can be
2183 noticeable for certain objects, such as Pyro proxies).
2187 noticeable for certain objects, such as Pyro proxies).
2184
2188
2185 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2189 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2186 for completers. For some reason I had been passing them the state
2190 for completers. For some reason I had been passing them the state
2187 variable, which completers never actually need, and was in
2191 variable, which completers never actually need, and was in
2188 conflict with the rlcompleter API. Custom completers ONLY need to
2192 conflict with the rlcompleter API. Custom completers ONLY need to
2189 take the text parameter.
2193 take the text parameter.
2190
2194
2191 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2195 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2192 work correctly in pysh. I've also moved all the logic which used
2196 work correctly in pysh. I've also moved all the logic which used
2193 to be in pysh.py here, which will prevent problems with future
2197 to be in pysh.py here, which will prevent problems with future
2194 upgrades. However, this time I must warn users to update their
2198 upgrades. However, this time I must warn users to update their
2195 pysh profile to include the line
2199 pysh profile to include the line
2196
2200
2197 import_all IPython.Extensions.InterpreterExec
2201 import_all IPython.Extensions.InterpreterExec
2198
2202
2199 because otherwise things won't work for them. They MUST also
2203 because otherwise things won't work for them. They MUST also
2200 delete pysh.py and the line
2204 delete pysh.py and the line
2201
2205
2202 execfile pysh.py
2206 execfile pysh.py
2203
2207
2204 from their ipythonrc-pysh.
2208 from their ipythonrc-pysh.
2205
2209
2206 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2210 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2207 robust in the face of objects whose dir() returns non-strings
2211 robust in the face of objects whose dir() returns non-strings
2208 (which it shouldn't, but some broken libs like ITK do). Thanks to
2212 (which it shouldn't, but some broken libs like ITK do). Thanks to
2209 a patch by John Hunter (implemented differently, though). Also
2213 a patch by John Hunter (implemented differently, though). Also
2210 minor improvements by using .extend instead of + on lists.
2214 minor improvements by using .extend instead of + on lists.
2211
2215
2212 * pysh.py:
2216 * pysh.py:
2213
2217
2214 2005-04-06 Fernando Perez <fperez@colorado.edu>
2218 2005-04-06 Fernando Perez <fperez@colorado.edu>
2215
2219
2216 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2220 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2217 by default, so that all users benefit from it. Those who don't
2221 by default, so that all users benefit from it. Those who don't
2218 want it can still turn it off.
2222 want it can still turn it off.
2219
2223
2220 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2224 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2221 config file, I'd forgotten about this, so users were getting it
2225 config file, I'd forgotten about this, so users were getting it
2222 off by default.
2226 off by default.
2223
2227
2224 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2228 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2225 consistency. Now magics can be called in multiline statements,
2229 consistency. Now magics can be called in multiline statements,
2226 and python variables can be expanded in magic calls via $var.
2230 and python variables can be expanded in magic calls via $var.
2227 This makes the magic system behave just like aliases or !system
2231 This makes the magic system behave just like aliases or !system
2228 calls.
2232 calls.
2229
2233
2230 2005-03-28 Fernando Perez <fperez@colorado.edu>
2234 2005-03-28 Fernando Perez <fperez@colorado.edu>
2231
2235
2232 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2236 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2233 expensive string additions for building command. Add support for
2237 expensive string additions for building command. Add support for
2234 trailing ';' when autocall is used.
2238 trailing ';' when autocall is used.
2235
2239
2236 2005-03-26 Fernando Perez <fperez@colorado.edu>
2240 2005-03-26 Fernando Perez <fperez@colorado.edu>
2237
2241
2238 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2242 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2239 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2243 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2240 ipython.el robust against prompts with any number of spaces
2244 ipython.el robust against prompts with any number of spaces
2241 (including 0) after the ':' character.
2245 (including 0) after the ':' character.
2242
2246
2243 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2247 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2244 continuation prompt, which misled users to think the line was
2248 continuation prompt, which misled users to think the line was
2245 already indented. Closes debian Bug#300847, reported to me by
2249 already indented. Closes debian Bug#300847, reported to me by
2246 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2250 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2247
2251
2248 2005-03-23 Fernando Perez <fperez@colorado.edu>
2252 2005-03-23 Fernando Perez <fperez@colorado.edu>
2249
2253
2250 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2254 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2251 properly aligned if they have embedded newlines.
2255 properly aligned if they have embedded newlines.
2252
2256
2253 * IPython/iplib.py (runlines): Add a public method to expose
2257 * IPython/iplib.py (runlines): Add a public method to expose
2254 IPython's code execution machinery, so that users can run strings
2258 IPython's code execution machinery, so that users can run strings
2255 as if they had been typed at the prompt interactively.
2259 as if they had been typed at the prompt interactively.
2256 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2260 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2257 methods which can call the system shell, but with python variable
2261 methods which can call the system shell, but with python variable
2258 expansion. The three such methods are: __IPYTHON__.system,
2262 expansion. The three such methods are: __IPYTHON__.system,
2259 .getoutput and .getoutputerror. These need to be documented in a
2263 .getoutput and .getoutputerror. These need to be documented in a
2260 'public API' section (to be written) of the manual.
2264 'public API' section (to be written) of the manual.
2261
2265
2262 2005-03-20 Fernando Perez <fperez@colorado.edu>
2266 2005-03-20 Fernando Perez <fperez@colorado.edu>
2263
2267
2264 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2268 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2265 for custom exception handling. This is quite powerful, and it
2269 for custom exception handling. This is quite powerful, and it
2266 allows for user-installable exception handlers which can trap
2270 allows for user-installable exception handlers which can trap
2267 custom exceptions at runtime and treat them separately from
2271 custom exceptions at runtime and treat them separately from
2268 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2272 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2269 Mantegazza <mantegazza-AT-ill.fr>.
2273 Mantegazza <mantegazza-AT-ill.fr>.
2270 (InteractiveShell.set_custom_completer): public API function to
2274 (InteractiveShell.set_custom_completer): public API function to
2271 add new completers at runtime.
2275 add new completers at runtime.
2272
2276
2273 2005-03-19 Fernando Perez <fperez@colorado.edu>
2277 2005-03-19 Fernando Perez <fperez@colorado.edu>
2274
2278
2275 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2279 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2276 allow objects which provide their docstrings via non-standard
2280 allow objects which provide their docstrings via non-standard
2277 mechanisms (like Pyro proxies) to still be inspected by ipython's
2281 mechanisms (like Pyro proxies) to still be inspected by ipython's
2278 ? system.
2282 ? system.
2279
2283
2280 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2284 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2281 automatic capture system. I tried quite hard to make it work
2285 automatic capture system. I tried quite hard to make it work
2282 reliably, and simply failed. I tried many combinations with the
2286 reliably, and simply failed. I tried many combinations with the
2283 subprocess module, but eventually nothing worked in all needed
2287 subprocess module, but eventually nothing worked in all needed
2284 cases (not blocking stdin for the child, duplicating stdout
2288 cases (not blocking stdin for the child, duplicating stdout
2285 without blocking, etc). The new %sc/%sx still do capture to these
2289 without blocking, etc). The new %sc/%sx still do capture to these
2286 magical list/string objects which make shell use much more
2290 magical list/string objects which make shell use much more
2287 conveninent, so not all is lost.
2291 conveninent, so not all is lost.
2288
2292
2289 XXX - FIX MANUAL for the change above!
2293 XXX - FIX MANUAL for the change above!
2290
2294
2291 (runsource): I copied code.py's runsource() into ipython to modify
2295 (runsource): I copied code.py's runsource() into ipython to modify
2292 it a bit. Now the code object and source to be executed are
2296 it a bit. Now the code object and source to be executed are
2293 stored in ipython. This makes this info accessible to third-party
2297 stored in ipython. This makes this info accessible to third-party
2294 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2298 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2295 Mantegazza <mantegazza-AT-ill.fr>.
2299 Mantegazza <mantegazza-AT-ill.fr>.
2296
2300
2297 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2301 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2298 history-search via readline (like C-p/C-n). I'd wanted this for a
2302 history-search via readline (like C-p/C-n). I'd wanted this for a
2299 long time, but only recently found out how to do it. For users
2303 long time, but only recently found out how to do it. For users
2300 who already have their ipythonrc files made and want this, just
2304 who already have their ipythonrc files made and want this, just
2301 add:
2305 add:
2302
2306
2303 readline_parse_and_bind "\e[A": history-search-backward
2307 readline_parse_and_bind "\e[A": history-search-backward
2304 readline_parse_and_bind "\e[B": history-search-forward
2308 readline_parse_and_bind "\e[B": history-search-forward
2305
2309
2306 2005-03-18 Fernando Perez <fperez@colorado.edu>
2310 2005-03-18 Fernando Perez <fperez@colorado.edu>
2307
2311
2308 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2312 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2309 LSString and SList classes which allow transparent conversions
2313 LSString and SList classes which allow transparent conversions
2310 between list mode and whitespace-separated string.
2314 between list mode and whitespace-separated string.
2311 (magic_r): Fix recursion problem in %r.
2315 (magic_r): Fix recursion problem in %r.
2312
2316
2313 * IPython/genutils.py (LSString): New class to be used for
2317 * IPython/genutils.py (LSString): New class to be used for
2314 automatic storage of the results of all alias/system calls in _o
2318 automatic storage of the results of all alias/system calls in _o
2315 and _e (stdout/err). These provide a .l/.list attribute which
2319 and _e (stdout/err). These provide a .l/.list attribute which
2316 does automatic splitting on newlines. This means that for most
2320 does automatic splitting on newlines. This means that for most
2317 uses, you'll never need to do capturing of output with %sc/%sx
2321 uses, you'll never need to do capturing of output with %sc/%sx
2318 anymore, since ipython keeps this always done for you. Note that
2322 anymore, since ipython keeps this always done for you. Note that
2319 only the LAST results are stored, the _o/e variables are
2323 only the LAST results are stored, the _o/e variables are
2320 overwritten on each call. If you need to save their contents
2324 overwritten on each call. If you need to save their contents
2321 further, simply bind them to any other name.
2325 further, simply bind them to any other name.
2322
2326
2323 2005-03-17 Fernando Perez <fperez@colorado.edu>
2327 2005-03-17 Fernando Perez <fperez@colorado.edu>
2324
2328
2325 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2329 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2326 prompt namespace handling.
2330 prompt namespace handling.
2327
2331
2328 2005-03-16 Fernando Perez <fperez@colorado.edu>
2332 2005-03-16 Fernando Perez <fperez@colorado.edu>
2329
2333
2330 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2334 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2331 classic prompts to be '>>> ' (final space was missing, and it
2335 classic prompts to be '>>> ' (final space was missing, and it
2332 trips the emacs python mode).
2336 trips the emacs python mode).
2333 (BasePrompt.__str__): Added safe support for dynamic prompt
2337 (BasePrompt.__str__): Added safe support for dynamic prompt
2334 strings. Now you can set your prompt string to be '$x', and the
2338 strings. Now you can set your prompt string to be '$x', and the
2335 value of x will be printed from your interactive namespace. The
2339 value of x will be printed from your interactive namespace. The
2336 interpolation syntax includes the full Itpl support, so
2340 interpolation syntax includes the full Itpl support, so
2337 ${foo()+x+bar()} is a valid prompt string now, and the function
2341 ${foo()+x+bar()} is a valid prompt string now, and the function
2338 calls will be made at runtime.
2342 calls will be made at runtime.
2339
2343
2340 2005-03-15 Fernando Perez <fperez@colorado.edu>
2344 2005-03-15 Fernando Perez <fperez@colorado.edu>
2341
2345
2342 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2346 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2343 avoid name clashes in pylab. %hist still works, it just forwards
2347 avoid name clashes in pylab. %hist still works, it just forwards
2344 the call to %history.
2348 the call to %history.
2345
2349
2346 2005-03-02 *** Released version 0.6.12
2350 2005-03-02 *** Released version 0.6.12
2347
2351
2348 2005-03-02 Fernando Perez <fperez@colorado.edu>
2352 2005-03-02 Fernando Perez <fperez@colorado.edu>
2349
2353
2350 * IPython/iplib.py (handle_magic): log magic calls properly as
2354 * IPython/iplib.py (handle_magic): log magic calls properly as
2351 ipmagic() function calls.
2355 ipmagic() function calls.
2352
2356
2353 * IPython/Magic.py (magic_time): Improved %time to support
2357 * IPython/Magic.py (magic_time): Improved %time to support
2354 statements and provide wall-clock as well as CPU time.
2358 statements and provide wall-clock as well as CPU time.
2355
2359
2356 2005-02-27 Fernando Perez <fperez@colorado.edu>
2360 2005-02-27 Fernando Perez <fperez@colorado.edu>
2357
2361
2358 * IPython/hooks.py: New hooks module, to expose user-modifiable
2362 * IPython/hooks.py: New hooks module, to expose user-modifiable
2359 IPython functionality in a clean manner. For now only the editor
2363 IPython functionality in a clean manner. For now only the editor
2360 hook is actually written, and other thigns which I intend to turn
2364 hook is actually written, and other thigns which I intend to turn
2361 into proper hooks aren't yet there. The display and prefilter
2365 into proper hooks aren't yet there. The display and prefilter
2362 stuff, for example, should be hooks. But at least now the
2366 stuff, for example, should be hooks. But at least now the
2363 framework is in place, and the rest can be moved here with more
2367 framework is in place, and the rest can be moved here with more
2364 time later. IPython had had a .hooks variable for a long time for
2368 time later. IPython had had a .hooks variable for a long time for
2365 this purpose, but I'd never actually used it for anything.
2369 this purpose, but I'd never actually used it for anything.
2366
2370
2367 2005-02-26 Fernando Perez <fperez@colorado.edu>
2371 2005-02-26 Fernando Perez <fperez@colorado.edu>
2368
2372
2369 * IPython/ipmaker.py (make_IPython): make the default ipython
2373 * IPython/ipmaker.py (make_IPython): make the default ipython
2370 directory be called _ipython under win32, to follow more the
2374 directory be called _ipython under win32, to follow more the
2371 naming peculiarities of that platform (where buggy software like
2375 naming peculiarities of that platform (where buggy software like
2372 Visual Sourcesafe breaks with .named directories). Reported by
2376 Visual Sourcesafe breaks with .named directories). Reported by
2373 Ville Vainio.
2377 Ville Vainio.
2374
2378
2375 2005-02-23 Fernando Perez <fperez@colorado.edu>
2379 2005-02-23 Fernando Perez <fperez@colorado.edu>
2376
2380
2377 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2381 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2378 auto_aliases for win32 which were causing problems. Users can
2382 auto_aliases for win32 which were causing problems. Users can
2379 define the ones they personally like.
2383 define the ones they personally like.
2380
2384
2381 2005-02-21 Fernando Perez <fperez@colorado.edu>
2385 2005-02-21 Fernando Perez <fperez@colorado.edu>
2382
2386
2383 * IPython/Magic.py (magic_time): new magic to time execution of
2387 * IPython/Magic.py (magic_time): new magic to time execution of
2384 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2388 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2385
2389
2386 2005-02-19 Fernando Perez <fperez@colorado.edu>
2390 2005-02-19 Fernando Perez <fperez@colorado.edu>
2387
2391
2388 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2392 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2389 into keys (for prompts, for example).
2393 into keys (for prompts, for example).
2390
2394
2391 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2395 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2392 prompts in case users want them. This introduces a small behavior
2396 prompts in case users want them. This introduces a small behavior
2393 change: ipython does not automatically add a space to all prompts
2397 change: ipython does not automatically add a space to all prompts
2394 anymore. To get the old prompts with a space, users should add it
2398 anymore. To get the old prompts with a space, users should add it
2395 manually to their ipythonrc file, so for example prompt_in1 should
2399 manually to their ipythonrc file, so for example prompt_in1 should
2396 now read 'In [\#]: ' instead of 'In [\#]:'.
2400 now read 'In [\#]: ' instead of 'In [\#]:'.
2397 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2401 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2398 file) to control left-padding of secondary prompts.
2402 file) to control left-padding of secondary prompts.
2399
2403
2400 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2404 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2401 the profiler can't be imported. Fix for Debian, which removed
2405 the profiler can't be imported. Fix for Debian, which removed
2402 profile.py because of License issues. I applied a slightly
2406 profile.py because of License issues. I applied a slightly
2403 modified version of the original Debian patch at
2407 modified version of the original Debian patch at
2404 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2408 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2405
2409
2406 2005-02-17 Fernando Perez <fperez@colorado.edu>
2410 2005-02-17 Fernando Perez <fperez@colorado.edu>
2407
2411
2408 * IPython/genutils.py (native_line_ends): Fix bug which would
2412 * IPython/genutils.py (native_line_ends): Fix bug which would
2409 cause improper line-ends under win32 b/c I was not opening files
2413 cause improper line-ends under win32 b/c I was not opening files
2410 in binary mode. Bug report and fix thanks to Ville.
2414 in binary mode. Bug report and fix thanks to Ville.
2411
2415
2412 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2416 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2413 trying to catch spurious foo[1] autocalls. My fix actually broke
2417 trying to catch spurious foo[1] autocalls. My fix actually broke
2414 ',/' autoquote/call with explicit escape (bad regexp).
2418 ',/' autoquote/call with explicit escape (bad regexp).
2415
2419
2416 2005-02-15 *** Released version 0.6.11
2420 2005-02-15 *** Released version 0.6.11
2417
2421
2418 2005-02-14 Fernando Perez <fperez@colorado.edu>
2422 2005-02-14 Fernando Perez <fperez@colorado.edu>
2419
2423
2420 * IPython/background_jobs.py: New background job management
2424 * IPython/background_jobs.py: New background job management
2421 subsystem. This is implemented via a new set of classes, and
2425 subsystem. This is implemented via a new set of classes, and
2422 IPython now provides a builtin 'jobs' object for background job
2426 IPython now provides a builtin 'jobs' object for background job
2423 execution. A convenience %bg magic serves as a lightweight
2427 execution. A convenience %bg magic serves as a lightweight
2424 frontend for starting the more common type of calls. This was
2428 frontend for starting the more common type of calls. This was
2425 inspired by discussions with B. Granger and the BackgroundCommand
2429 inspired by discussions with B. Granger and the BackgroundCommand
2426 class described in the book Python Scripting for Computational
2430 class described in the book Python Scripting for Computational
2427 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2431 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2428 (although ultimately no code from this text was used, as IPython's
2432 (although ultimately no code from this text was used, as IPython's
2429 system is a separate implementation).
2433 system is a separate implementation).
2430
2434
2431 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2435 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2432 to control the completion of single/double underscore names
2436 to control the completion of single/double underscore names
2433 separately. As documented in the example ipytonrc file, the
2437 separately. As documented in the example ipytonrc file, the
2434 readline_omit__names variable can now be set to 2, to omit even
2438 readline_omit__names variable can now be set to 2, to omit even
2435 single underscore names. Thanks to a patch by Brian Wong
2439 single underscore names. Thanks to a patch by Brian Wong
2436 <BrianWong-AT-AirgoNetworks.Com>.
2440 <BrianWong-AT-AirgoNetworks.Com>.
2437 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2441 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2438 be autocalled as foo([1]) if foo were callable. A problem for
2442 be autocalled as foo([1]) if foo were callable. A problem for
2439 things which are both callable and implement __getitem__.
2443 things which are both callable and implement __getitem__.
2440 (init_readline): Fix autoindentation for win32. Thanks to a patch
2444 (init_readline): Fix autoindentation for win32. Thanks to a patch
2441 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2445 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2442
2446
2443 2005-02-12 Fernando Perez <fperez@colorado.edu>
2447 2005-02-12 Fernando Perez <fperez@colorado.edu>
2444
2448
2445 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2449 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2446 which I had written long ago to sort out user error messages which
2450 which I had written long ago to sort out user error messages which
2447 may occur during startup. This seemed like a good idea initially,
2451 may occur during startup. This seemed like a good idea initially,
2448 but it has proven a disaster in retrospect. I don't want to
2452 but it has proven a disaster in retrospect. I don't want to
2449 change much code for now, so my fix is to set the internal 'debug'
2453 change much code for now, so my fix is to set the internal 'debug'
2450 flag to true everywhere, whose only job was precisely to control
2454 flag to true everywhere, whose only job was precisely to control
2451 this subsystem. This closes issue 28 (as well as avoiding all
2455 this subsystem. This closes issue 28 (as well as avoiding all
2452 sorts of strange hangups which occur from time to time).
2456 sorts of strange hangups which occur from time to time).
2453
2457
2454 2005-02-07 Fernando Perez <fperez@colorado.edu>
2458 2005-02-07 Fernando Perez <fperez@colorado.edu>
2455
2459
2456 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2460 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2457 previous call produced a syntax error.
2461 previous call produced a syntax error.
2458
2462
2459 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2463 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2460 classes without constructor.
2464 classes without constructor.
2461
2465
2462 2005-02-06 Fernando Perez <fperez@colorado.edu>
2466 2005-02-06 Fernando Perez <fperez@colorado.edu>
2463
2467
2464 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2468 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2465 completions with the results of each matcher, so we return results
2469 completions with the results of each matcher, so we return results
2466 to the user from all namespaces. This breaks with ipython
2470 to the user from all namespaces. This breaks with ipython
2467 tradition, but I think it's a nicer behavior. Now you get all
2471 tradition, but I think it's a nicer behavior. Now you get all
2468 possible completions listed, from all possible namespaces (python,
2472 possible completions listed, from all possible namespaces (python,
2469 filesystem, magics...) After a request by John Hunter
2473 filesystem, magics...) After a request by John Hunter
2470 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2474 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2471
2475
2472 2005-02-05 Fernando Perez <fperez@colorado.edu>
2476 2005-02-05 Fernando Perez <fperez@colorado.edu>
2473
2477
2474 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2478 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2475 the call had quote characters in it (the quotes were stripped).
2479 the call had quote characters in it (the quotes were stripped).
2476
2480
2477 2005-01-31 Fernando Perez <fperez@colorado.edu>
2481 2005-01-31 Fernando Perez <fperez@colorado.edu>
2478
2482
2479 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2483 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2480 Itpl.itpl() to make the code more robust against psyco
2484 Itpl.itpl() to make the code more robust against psyco
2481 optimizations.
2485 optimizations.
2482
2486
2483 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2487 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2484 of causing an exception. Quicker, cleaner.
2488 of causing an exception. Quicker, cleaner.
2485
2489
2486 2005-01-28 Fernando Perez <fperez@colorado.edu>
2490 2005-01-28 Fernando Perez <fperez@colorado.edu>
2487
2491
2488 * scripts/ipython_win_post_install.py (install): hardcode
2492 * scripts/ipython_win_post_install.py (install): hardcode
2489 sys.prefix+'python.exe' as the executable path. It turns out that
2493 sys.prefix+'python.exe' as the executable path. It turns out that
2490 during the post-installation run, sys.executable resolves to the
2494 during the post-installation run, sys.executable resolves to the
2491 name of the binary installer! I should report this as a distutils
2495 name of the binary installer! I should report this as a distutils
2492 bug, I think. I updated the .10 release with this tiny fix, to
2496 bug, I think. I updated the .10 release with this tiny fix, to
2493 avoid annoying the lists further.
2497 avoid annoying the lists further.
2494
2498
2495 2005-01-27 *** Released version 0.6.10
2499 2005-01-27 *** Released version 0.6.10
2496
2500
2497 2005-01-27 Fernando Perez <fperez@colorado.edu>
2501 2005-01-27 Fernando Perez <fperez@colorado.edu>
2498
2502
2499 * IPython/numutils.py (norm): Added 'inf' as optional name for
2503 * IPython/numutils.py (norm): Added 'inf' as optional name for
2500 L-infinity norm, included references to mathworld.com for vector
2504 L-infinity norm, included references to mathworld.com for vector
2501 norm definitions.
2505 norm definitions.
2502 (amin/amax): added amin/amax for array min/max. Similar to what
2506 (amin/amax): added amin/amax for array min/max. Similar to what
2503 pylab ships with after the recent reorganization of names.
2507 pylab ships with after the recent reorganization of names.
2504 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2508 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2505
2509
2506 * ipython.el: committed Alex's recent fixes and improvements.
2510 * ipython.el: committed Alex's recent fixes and improvements.
2507 Tested with python-mode from CVS, and it looks excellent. Since
2511 Tested with python-mode from CVS, and it looks excellent. Since
2508 python-mode hasn't released anything in a while, I'm temporarily
2512 python-mode hasn't released anything in a while, I'm temporarily
2509 putting a copy of today's CVS (v 4.70) of python-mode in:
2513 putting a copy of today's CVS (v 4.70) of python-mode in:
2510 http://ipython.scipy.org/tmp/python-mode.el
2514 http://ipython.scipy.org/tmp/python-mode.el
2511
2515
2512 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2516 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2513 sys.executable for the executable name, instead of assuming it's
2517 sys.executable for the executable name, instead of assuming it's
2514 called 'python.exe' (the post-installer would have produced broken
2518 called 'python.exe' (the post-installer would have produced broken
2515 setups on systems with a differently named python binary).
2519 setups on systems with a differently named python binary).
2516
2520
2517 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2521 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2518 references to os.linesep, to make the code more
2522 references to os.linesep, to make the code more
2519 platform-independent. This is also part of the win32 coloring
2523 platform-independent. This is also part of the win32 coloring
2520 fixes.
2524 fixes.
2521
2525
2522 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2526 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2523 lines, which actually cause coloring bugs because the length of
2527 lines, which actually cause coloring bugs because the length of
2524 the line is very difficult to correctly compute with embedded
2528 the line is very difficult to correctly compute with embedded
2525 escapes. This was the source of all the coloring problems under
2529 escapes. This was the source of all the coloring problems under
2526 Win32. I think that _finally_, Win32 users have a properly
2530 Win32. I think that _finally_, Win32 users have a properly
2527 working ipython in all respects. This would never have happened
2531 working ipython in all respects. This would never have happened
2528 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2532 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2529
2533
2530 2005-01-26 *** Released version 0.6.9
2534 2005-01-26 *** Released version 0.6.9
2531
2535
2532 2005-01-25 Fernando Perez <fperez@colorado.edu>
2536 2005-01-25 Fernando Perez <fperez@colorado.edu>
2533
2537
2534 * setup.py: finally, we have a true Windows installer, thanks to
2538 * setup.py: finally, we have a true Windows installer, thanks to
2535 the excellent work of Viktor Ransmayr
2539 the excellent work of Viktor Ransmayr
2536 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2540 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2537 Windows users. The setup routine is quite a bit cleaner thanks to
2541 Windows users. The setup routine is quite a bit cleaner thanks to
2538 this, and the post-install script uses the proper functions to
2542 this, and the post-install script uses the proper functions to
2539 allow a clean de-installation using the standard Windows Control
2543 allow a clean de-installation using the standard Windows Control
2540 Panel.
2544 Panel.
2541
2545
2542 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2546 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2543 environment variable under all OSes (including win32) if
2547 environment variable under all OSes (including win32) if
2544 available. This will give consistency to win32 users who have set
2548 available. This will give consistency to win32 users who have set
2545 this variable for any reason. If os.environ['HOME'] fails, the
2549 this variable for any reason. If os.environ['HOME'] fails, the
2546 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2550 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2547
2551
2548 2005-01-24 Fernando Perez <fperez@colorado.edu>
2552 2005-01-24 Fernando Perez <fperez@colorado.edu>
2549
2553
2550 * IPython/numutils.py (empty_like): add empty_like(), similar to
2554 * IPython/numutils.py (empty_like): add empty_like(), similar to
2551 zeros_like() but taking advantage of the new empty() Numeric routine.
2555 zeros_like() but taking advantage of the new empty() Numeric routine.
2552
2556
2553 2005-01-23 *** Released version 0.6.8
2557 2005-01-23 *** Released version 0.6.8
2554
2558
2555 2005-01-22 Fernando Perez <fperez@colorado.edu>
2559 2005-01-22 Fernando Perez <fperez@colorado.edu>
2556
2560
2557 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2561 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2558 automatic show() calls. After discussing things with JDH, it
2562 automatic show() calls. After discussing things with JDH, it
2559 turns out there are too many corner cases where this can go wrong.
2563 turns out there are too many corner cases where this can go wrong.
2560 It's best not to try to be 'too smart', and simply have ipython
2564 It's best not to try to be 'too smart', and simply have ipython
2561 reproduce as much as possible the default behavior of a normal
2565 reproduce as much as possible the default behavior of a normal
2562 python shell.
2566 python shell.
2563
2567
2564 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2568 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2565 line-splitting regexp and _prefilter() to avoid calling getattr()
2569 line-splitting regexp and _prefilter() to avoid calling getattr()
2566 on assignments. This closes
2570 on assignments. This closes
2567 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2571 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2568 readline uses getattr(), so a simple <TAB> keypress is still
2572 readline uses getattr(), so a simple <TAB> keypress is still
2569 enough to trigger getattr() calls on an object.
2573 enough to trigger getattr() calls on an object.
2570
2574
2571 2005-01-21 Fernando Perez <fperez@colorado.edu>
2575 2005-01-21 Fernando Perez <fperez@colorado.edu>
2572
2576
2573 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2577 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2574 docstring under pylab so it doesn't mask the original.
2578 docstring under pylab so it doesn't mask the original.
2575
2579
2576 2005-01-21 *** Released version 0.6.7
2580 2005-01-21 *** Released version 0.6.7
2577
2581
2578 2005-01-21 Fernando Perez <fperez@colorado.edu>
2582 2005-01-21 Fernando Perez <fperez@colorado.edu>
2579
2583
2580 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2584 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2581 signal handling for win32 users in multithreaded mode.
2585 signal handling for win32 users in multithreaded mode.
2582
2586
2583 2005-01-17 Fernando Perez <fperez@colorado.edu>
2587 2005-01-17 Fernando Perez <fperez@colorado.edu>
2584
2588
2585 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2589 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2586 instances with no __init__. After a crash report by Norbert Nemec
2590 instances with no __init__. After a crash report by Norbert Nemec
2587 <Norbert-AT-nemec-online.de>.
2591 <Norbert-AT-nemec-online.de>.
2588
2592
2589 2005-01-14 Fernando Perez <fperez@colorado.edu>
2593 2005-01-14 Fernando Perez <fperez@colorado.edu>
2590
2594
2591 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2595 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2592 names for verbose exceptions, when multiple dotted names and the
2596 names for verbose exceptions, when multiple dotted names and the
2593 'parent' object were present on the same line.
2597 'parent' object were present on the same line.
2594
2598
2595 2005-01-11 Fernando Perez <fperez@colorado.edu>
2599 2005-01-11 Fernando Perez <fperez@colorado.edu>
2596
2600
2597 * IPython/genutils.py (flag_calls): new utility to trap and flag
2601 * IPython/genutils.py (flag_calls): new utility to trap and flag
2598 calls in functions. I need it to clean up matplotlib support.
2602 calls in functions. I need it to clean up matplotlib support.
2599 Also removed some deprecated code in genutils.
2603 Also removed some deprecated code in genutils.
2600
2604
2601 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2605 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2602 that matplotlib scripts called with %run, which don't call show()
2606 that matplotlib scripts called with %run, which don't call show()
2603 themselves, still have their plotting windows open.
2607 themselves, still have their plotting windows open.
2604
2608
2605 2005-01-05 Fernando Perez <fperez@colorado.edu>
2609 2005-01-05 Fernando Perez <fperez@colorado.edu>
2606
2610
2607 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2611 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2608 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2612 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2609
2613
2610 2004-12-19 Fernando Perez <fperez@colorado.edu>
2614 2004-12-19 Fernando Perez <fperez@colorado.edu>
2611
2615
2612 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2616 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2613 parent_runcode, which was an eyesore. The same result can be
2617 parent_runcode, which was an eyesore. The same result can be
2614 obtained with Python's regular superclass mechanisms.
2618 obtained with Python's regular superclass mechanisms.
2615
2619
2616 2004-12-17 Fernando Perez <fperez@colorado.edu>
2620 2004-12-17 Fernando Perez <fperez@colorado.edu>
2617
2621
2618 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2622 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2619 reported by Prabhu.
2623 reported by Prabhu.
2620 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2624 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2621 sys.stderr) instead of explicitly calling sys.stderr. This helps
2625 sys.stderr) instead of explicitly calling sys.stderr. This helps
2622 maintain our I/O abstractions clean, for future GUI embeddings.
2626 maintain our I/O abstractions clean, for future GUI embeddings.
2623
2627
2624 * IPython/genutils.py (info): added new utility for sys.stderr
2628 * IPython/genutils.py (info): added new utility for sys.stderr
2625 unified info message handling (thin wrapper around warn()).
2629 unified info message handling (thin wrapper around warn()).
2626
2630
2627 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2631 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2628 composite (dotted) names on verbose exceptions.
2632 composite (dotted) names on verbose exceptions.
2629 (VerboseTB.nullrepr): harden against another kind of errors which
2633 (VerboseTB.nullrepr): harden against another kind of errors which
2630 Python's inspect module can trigger, and which were crashing
2634 Python's inspect module can trigger, and which were crashing
2631 IPython. Thanks to a report by Marco Lombardi
2635 IPython. Thanks to a report by Marco Lombardi
2632 <mlombard-AT-ma010192.hq.eso.org>.
2636 <mlombard-AT-ma010192.hq.eso.org>.
2633
2637
2634 2004-12-13 *** Released version 0.6.6
2638 2004-12-13 *** Released version 0.6.6
2635
2639
2636 2004-12-12 Fernando Perez <fperez@colorado.edu>
2640 2004-12-12 Fernando Perez <fperez@colorado.edu>
2637
2641
2638 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2642 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2639 generated by pygtk upon initialization if it was built without
2643 generated by pygtk upon initialization if it was built without
2640 threads (for matplotlib users). After a crash reported by
2644 threads (for matplotlib users). After a crash reported by
2641 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2645 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2642
2646
2643 * IPython/ipmaker.py (make_IPython): fix small bug in the
2647 * IPython/ipmaker.py (make_IPython): fix small bug in the
2644 import_some parameter for multiple imports.
2648 import_some parameter for multiple imports.
2645
2649
2646 * IPython/iplib.py (ipmagic): simplified the interface of
2650 * IPython/iplib.py (ipmagic): simplified the interface of
2647 ipmagic() to take a single string argument, just as it would be
2651 ipmagic() to take a single string argument, just as it would be
2648 typed at the IPython cmd line.
2652 typed at the IPython cmd line.
2649 (ipalias): Added new ipalias() with an interface identical to
2653 (ipalias): Added new ipalias() with an interface identical to
2650 ipmagic(). This completes exposing a pure python interface to the
2654 ipmagic(). This completes exposing a pure python interface to the
2651 alias and magic system, which can be used in loops or more complex
2655 alias and magic system, which can be used in loops or more complex
2652 code where IPython's automatic line mangling is not active.
2656 code where IPython's automatic line mangling is not active.
2653
2657
2654 * IPython/genutils.py (timing): changed interface of timing to
2658 * IPython/genutils.py (timing): changed interface of timing to
2655 simply run code once, which is the most common case. timings()
2659 simply run code once, which is the most common case. timings()
2656 remains unchanged, for the cases where you want multiple runs.
2660 remains unchanged, for the cases where you want multiple runs.
2657
2661
2658 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2662 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2659 bug where Python2.2 crashes with exec'ing code which does not end
2663 bug where Python2.2 crashes with exec'ing code which does not end
2660 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2664 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2661 before.
2665 before.
2662
2666
2663 2004-12-10 Fernando Perez <fperez@colorado.edu>
2667 2004-12-10 Fernando Perez <fperez@colorado.edu>
2664
2668
2665 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2669 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2666 -t to -T, to accomodate the new -t flag in %run (the %run and
2670 -t to -T, to accomodate the new -t flag in %run (the %run and
2667 %prun options are kind of intermixed, and it's not easy to change
2671 %prun options are kind of intermixed, and it's not easy to change
2668 this with the limitations of python's getopt).
2672 this with the limitations of python's getopt).
2669
2673
2670 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2674 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2671 the execution of scripts. It's not as fine-tuned as timeit.py,
2675 the execution of scripts. It's not as fine-tuned as timeit.py,
2672 but it works from inside ipython (and under 2.2, which lacks
2676 but it works from inside ipython (and under 2.2, which lacks
2673 timeit.py). Optionally a number of runs > 1 can be given for
2677 timeit.py). Optionally a number of runs > 1 can be given for
2674 timing very short-running code.
2678 timing very short-running code.
2675
2679
2676 * IPython/genutils.py (uniq_stable): new routine which returns a
2680 * IPython/genutils.py (uniq_stable): new routine which returns a
2677 list of unique elements in any iterable, but in stable order of
2681 list of unique elements in any iterable, but in stable order of
2678 appearance. I needed this for the ultraTB fixes, and it's a handy
2682 appearance. I needed this for the ultraTB fixes, and it's a handy
2679 utility.
2683 utility.
2680
2684
2681 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2685 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2682 dotted names in Verbose exceptions. This had been broken since
2686 dotted names in Verbose exceptions. This had been broken since
2683 the very start, now x.y will properly be printed in a Verbose
2687 the very start, now x.y will properly be printed in a Verbose
2684 traceback, instead of x being shown and y appearing always as an
2688 traceback, instead of x being shown and y appearing always as an
2685 'undefined global'. Getting this to work was a bit tricky,
2689 'undefined global'. Getting this to work was a bit tricky,
2686 because by default python tokenizers are stateless. Saved by
2690 because by default python tokenizers are stateless. Saved by
2687 python's ability to easily add a bit of state to an arbitrary
2691 python's ability to easily add a bit of state to an arbitrary
2688 function (without needing to build a full-blown callable object).
2692 function (without needing to build a full-blown callable object).
2689
2693
2690 Also big cleanup of this code, which had horrendous runtime
2694 Also big cleanup of this code, which had horrendous runtime
2691 lookups of zillions of attributes for colorization. Moved all
2695 lookups of zillions of attributes for colorization. Moved all
2692 this code into a few templates, which make it cleaner and quicker.
2696 this code into a few templates, which make it cleaner and quicker.
2693
2697
2694 Printout quality was also improved for Verbose exceptions: one
2698 Printout quality was also improved for Verbose exceptions: one
2695 variable per line, and memory addresses are printed (this can be
2699 variable per line, and memory addresses are printed (this can be
2696 quite handy in nasty debugging situations, which is what Verbose
2700 quite handy in nasty debugging situations, which is what Verbose
2697 is for).
2701 is for).
2698
2702
2699 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2703 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2700 the command line as scripts to be loaded by embedded instances.
2704 the command line as scripts to be loaded by embedded instances.
2701 Doing so has the potential for an infinite recursion if there are
2705 Doing so has the potential for an infinite recursion if there are
2702 exceptions thrown in the process. This fixes a strange crash
2706 exceptions thrown in the process. This fixes a strange crash
2703 reported by Philippe MULLER <muller-AT-irit.fr>.
2707 reported by Philippe MULLER <muller-AT-irit.fr>.
2704
2708
2705 2004-12-09 Fernando Perez <fperez@colorado.edu>
2709 2004-12-09 Fernando Perez <fperez@colorado.edu>
2706
2710
2707 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2711 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2708 to reflect new names in matplotlib, which now expose the
2712 to reflect new names in matplotlib, which now expose the
2709 matlab-compatible interface via a pylab module instead of the
2713 matlab-compatible interface via a pylab module instead of the
2710 'matlab' name. The new code is backwards compatible, so users of
2714 'matlab' name. The new code is backwards compatible, so users of
2711 all matplotlib versions are OK. Patch by J. Hunter.
2715 all matplotlib versions are OK. Patch by J. Hunter.
2712
2716
2713 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2717 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2714 of __init__ docstrings for instances (class docstrings are already
2718 of __init__ docstrings for instances (class docstrings are already
2715 automatically printed). Instances with customized docstrings
2719 automatically printed). Instances with customized docstrings
2716 (indep. of the class) are also recognized and all 3 separate
2720 (indep. of the class) are also recognized and all 3 separate
2717 docstrings are printed (instance, class, constructor). After some
2721 docstrings are printed (instance, class, constructor). After some
2718 comments/suggestions by J. Hunter.
2722 comments/suggestions by J. Hunter.
2719
2723
2720 2004-12-05 Fernando Perez <fperez@colorado.edu>
2724 2004-12-05 Fernando Perez <fperez@colorado.edu>
2721
2725
2722 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2726 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2723 warnings when tab-completion fails and triggers an exception.
2727 warnings when tab-completion fails and triggers an exception.
2724
2728
2725 2004-12-03 Fernando Perez <fperez@colorado.edu>
2729 2004-12-03 Fernando Perez <fperez@colorado.edu>
2726
2730
2727 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2731 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2728 be triggered when using 'run -p'. An incorrect option flag was
2732 be triggered when using 'run -p'. An incorrect option flag was
2729 being set ('d' instead of 'D').
2733 being set ('d' instead of 'D').
2730 (manpage): fix missing escaped \- sign.
2734 (manpage): fix missing escaped \- sign.
2731
2735
2732 2004-11-30 *** Released version 0.6.5
2736 2004-11-30 *** Released version 0.6.5
2733
2737
2734 2004-11-30 Fernando Perez <fperez@colorado.edu>
2738 2004-11-30 Fernando Perez <fperez@colorado.edu>
2735
2739
2736 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2740 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2737 setting with -d option.
2741 setting with -d option.
2738
2742
2739 * setup.py (docfiles): Fix problem where the doc glob I was using
2743 * setup.py (docfiles): Fix problem where the doc glob I was using
2740 was COMPLETELY BROKEN. It was giving the right files by pure
2744 was COMPLETELY BROKEN. It was giving the right files by pure
2741 accident, but failed once I tried to include ipython.el. Note:
2745 accident, but failed once I tried to include ipython.el. Note:
2742 glob() does NOT allow you to do exclusion on multiple endings!
2746 glob() does NOT allow you to do exclusion on multiple endings!
2743
2747
2744 2004-11-29 Fernando Perez <fperez@colorado.edu>
2748 2004-11-29 Fernando Perez <fperez@colorado.edu>
2745
2749
2746 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2750 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2747 the manpage as the source. Better formatting & consistency.
2751 the manpage as the source. Better formatting & consistency.
2748
2752
2749 * IPython/Magic.py (magic_run): Added new -d option, to run
2753 * IPython/Magic.py (magic_run): Added new -d option, to run
2750 scripts under the control of the python pdb debugger. Note that
2754 scripts under the control of the python pdb debugger. Note that
2751 this required changing the %prun option -d to -D, to avoid a clash
2755 this required changing the %prun option -d to -D, to avoid a clash
2752 (since %run must pass options to %prun, and getopt is too dumb to
2756 (since %run must pass options to %prun, and getopt is too dumb to
2753 handle options with string values with embedded spaces). Thanks
2757 handle options with string values with embedded spaces). Thanks
2754 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2758 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2755 (magic_who_ls): added type matching to %who and %whos, so that one
2759 (magic_who_ls): added type matching to %who and %whos, so that one
2756 can filter their output to only include variables of certain
2760 can filter their output to only include variables of certain
2757 types. Another suggestion by Matthew.
2761 types. Another suggestion by Matthew.
2758 (magic_whos): Added memory summaries in kb and Mb for arrays.
2762 (magic_whos): Added memory summaries in kb and Mb for arrays.
2759 (magic_who): Improve formatting (break lines every 9 vars).
2763 (magic_who): Improve formatting (break lines every 9 vars).
2760
2764
2761 2004-11-28 Fernando Perez <fperez@colorado.edu>
2765 2004-11-28 Fernando Perez <fperez@colorado.edu>
2762
2766
2763 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2767 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2764 cache when empty lines were present.
2768 cache when empty lines were present.
2765
2769
2766 2004-11-24 Fernando Perez <fperez@colorado.edu>
2770 2004-11-24 Fernando Perez <fperez@colorado.edu>
2767
2771
2768 * IPython/usage.py (__doc__): document the re-activated threading
2772 * IPython/usage.py (__doc__): document the re-activated threading
2769 options for WX and GTK.
2773 options for WX and GTK.
2770
2774
2771 2004-11-23 Fernando Perez <fperez@colorado.edu>
2775 2004-11-23 Fernando Perez <fperez@colorado.edu>
2772
2776
2773 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2777 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2774 the -wthread and -gthread options, along with a new -tk one to try
2778 the -wthread and -gthread options, along with a new -tk one to try
2775 and coordinate Tk threading with wx/gtk. The tk support is very
2779 and coordinate Tk threading with wx/gtk. The tk support is very
2776 platform dependent, since it seems to require Tcl and Tk to be
2780 platform dependent, since it seems to require Tcl and Tk to be
2777 built with threads (Fedora1/2 appears NOT to have it, but in
2781 built with threads (Fedora1/2 appears NOT to have it, but in
2778 Prabhu's Debian boxes it works OK). But even with some Tk
2782 Prabhu's Debian boxes it works OK). But even with some Tk
2779 limitations, this is a great improvement.
2783 limitations, this is a great improvement.
2780
2784
2781 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2785 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2782 info in user prompts. Patch by Prabhu.
2786 info in user prompts. Patch by Prabhu.
2783
2787
2784 2004-11-18 Fernando Perez <fperez@colorado.edu>
2788 2004-11-18 Fernando Perez <fperez@colorado.edu>
2785
2789
2786 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2790 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2787 EOFErrors and bail, to avoid infinite loops if a non-terminating
2791 EOFErrors and bail, to avoid infinite loops if a non-terminating
2788 file is fed into ipython. Patch submitted in issue 19 by user,
2792 file is fed into ipython. Patch submitted in issue 19 by user,
2789 many thanks.
2793 many thanks.
2790
2794
2791 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2795 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2792 autoquote/parens in continuation prompts, which can cause lots of
2796 autoquote/parens in continuation prompts, which can cause lots of
2793 problems. Closes roundup issue 20.
2797 problems. Closes roundup issue 20.
2794
2798
2795 2004-11-17 Fernando Perez <fperez@colorado.edu>
2799 2004-11-17 Fernando Perez <fperez@colorado.edu>
2796
2800
2797 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2801 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2798 reported as debian bug #280505. I'm not sure my local changelog
2802 reported as debian bug #280505. I'm not sure my local changelog
2799 entry has the proper debian format (Jack?).
2803 entry has the proper debian format (Jack?).
2800
2804
2801 2004-11-08 *** Released version 0.6.4
2805 2004-11-08 *** Released version 0.6.4
2802
2806
2803 2004-11-08 Fernando Perez <fperez@colorado.edu>
2807 2004-11-08 Fernando Perez <fperez@colorado.edu>
2804
2808
2805 * IPython/iplib.py (init_readline): Fix exit message for Windows
2809 * IPython/iplib.py (init_readline): Fix exit message for Windows
2806 when readline is active. Thanks to a report by Eric Jones
2810 when readline is active. Thanks to a report by Eric Jones
2807 <eric-AT-enthought.com>.
2811 <eric-AT-enthought.com>.
2808
2812
2809 2004-11-07 Fernando Perez <fperez@colorado.edu>
2813 2004-11-07 Fernando Perez <fperez@colorado.edu>
2810
2814
2811 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2815 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2812 sometimes seen by win2k/cygwin users.
2816 sometimes seen by win2k/cygwin users.
2813
2817
2814 2004-11-06 Fernando Perez <fperez@colorado.edu>
2818 2004-11-06 Fernando Perez <fperez@colorado.edu>
2815
2819
2816 * IPython/iplib.py (interact): Change the handling of %Exit from
2820 * IPython/iplib.py (interact): Change the handling of %Exit from
2817 trying to propagate a SystemExit to an internal ipython flag.
2821 trying to propagate a SystemExit to an internal ipython flag.
2818 This is less elegant than using Python's exception mechanism, but
2822 This is less elegant than using Python's exception mechanism, but
2819 I can't get that to work reliably with threads, so under -pylab
2823 I can't get that to work reliably with threads, so under -pylab
2820 %Exit was hanging IPython. Cross-thread exception handling is
2824 %Exit was hanging IPython. Cross-thread exception handling is
2821 really a bitch. Thaks to a bug report by Stephen Walton
2825 really a bitch. Thaks to a bug report by Stephen Walton
2822 <stephen.walton-AT-csun.edu>.
2826 <stephen.walton-AT-csun.edu>.
2823
2827
2824 2004-11-04 Fernando Perez <fperez@colorado.edu>
2828 2004-11-04 Fernando Perez <fperez@colorado.edu>
2825
2829
2826 * IPython/iplib.py (raw_input_original): store a pointer to the
2830 * IPython/iplib.py (raw_input_original): store a pointer to the
2827 true raw_input to harden against code which can modify it
2831 true raw_input to harden against code which can modify it
2828 (wx.py.PyShell does this and would otherwise crash ipython).
2832 (wx.py.PyShell does this and would otherwise crash ipython).
2829 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2833 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2830
2834
2831 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2835 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2832 Ctrl-C problem, which does not mess up the input line.
2836 Ctrl-C problem, which does not mess up the input line.
2833
2837
2834 2004-11-03 Fernando Perez <fperez@colorado.edu>
2838 2004-11-03 Fernando Perez <fperez@colorado.edu>
2835
2839
2836 * IPython/Release.py: Changed licensing to BSD, in all files.
2840 * IPython/Release.py: Changed licensing to BSD, in all files.
2837 (name): lowercase name for tarball/RPM release.
2841 (name): lowercase name for tarball/RPM release.
2838
2842
2839 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2843 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2840 use throughout ipython.
2844 use throughout ipython.
2841
2845
2842 * IPython/Magic.py (Magic._ofind): Switch to using the new
2846 * IPython/Magic.py (Magic._ofind): Switch to using the new
2843 OInspect.getdoc() function.
2847 OInspect.getdoc() function.
2844
2848
2845 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2849 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2846 of the line currently being canceled via Ctrl-C. It's extremely
2850 of the line currently being canceled via Ctrl-C. It's extremely
2847 ugly, but I don't know how to do it better (the problem is one of
2851 ugly, but I don't know how to do it better (the problem is one of
2848 handling cross-thread exceptions).
2852 handling cross-thread exceptions).
2849
2853
2850 2004-10-28 Fernando Perez <fperez@colorado.edu>
2854 2004-10-28 Fernando Perez <fperez@colorado.edu>
2851
2855
2852 * IPython/Shell.py (signal_handler): add signal handlers to trap
2856 * IPython/Shell.py (signal_handler): add signal handlers to trap
2853 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2857 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2854 report by Francesc Alted.
2858 report by Francesc Alted.
2855
2859
2856 2004-10-21 Fernando Perez <fperez@colorado.edu>
2860 2004-10-21 Fernando Perez <fperez@colorado.edu>
2857
2861
2858 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2862 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2859 to % for pysh syntax extensions.
2863 to % for pysh syntax extensions.
2860
2864
2861 2004-10-09 Fernando Perez <fperez@colorado.edu>
2865 2004-10-09 Fernando Perez <fperez@colorado.edu>
2862
2866
2863 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2867 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2864 arrays to print a more useful summary, without calling str(arr).
2868 arrays to print a more useful summary, without calling str(arr).
2865 This avoids the problem of extremely lengthy computations which
2869 This avoids the problem of extremely lengthy computations which
2866 occur if arr is large, and appear to the user as a system lockup
2870 occur if arr is large, and appear to the user as a system lockup
2867 with 100% cpu activity. After a suggestion by Kristian Sandberg
2871 with 100% cpu activity. After a suggestion by Kristian Sandberg
2868 <Kristian.Sandberg@colorado.edu>.
2872 <Kristian.Sandberg@colorado.edu>.
2869 (Magic.__init__): fix bug in global magic escapes not being
2873 (Magic.__init__): fix bug in global magic escapes not being
2870 correctly set.
2874 correctly set.
2871
2875
2872 2004-10-08 Fernando Perez <fperez@colorado.edu>
2876 2004-10-08 Fernando Perez <fperez@colorado.edu>
2873
2877
2874 * IPython/Magic.py (__license__): change to absolute imports of
2878 * IPython/Magic.py (__license__): change to absolute imports of
2875 ipython's own internal packages, to start adapting to the absolute
2879 ipython's own internal packages, to start adapting to the absolute
2876 import requirement of PEP-328.
2880 import requirement of PEP-328.
2877
2881
2878 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2882 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2879 files, and standardize author/license marks through the Release
2883 files, and standardize author/license marks through the Release
2880 module instead of having per/file stuff (except for files with
2884 module instead of having per/file stuff (except for files with
2881 particular licenses, like the MIT/PSF-licensed codes).
2885 particular licenses, like the MIT/PSF-licensed codes).
2882
2886
2883 * IPython/Debugger.py: remove dead code for python 2.1
2887 * IPython/Debugger.py: remove dead code for python 2.1
2884
2888
2885 2004-10-04 Fernando Perez <fperez@colorado.edu>
2889 2004-10-04 Fernando Perez <fperez@colorado.edu>
2886
2890
2887 * IPython/iplib.py (ipmagic): New function for accessing magics
2891 * IPython/iplib.py (ipmagic): New function for accessing magics
2888 via a normal python function call.
2892 via a normal python function call.
2889
2893
2890 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2894 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2891 from '@' to '%', to accomodate the new @decorator syntax of python
2895 from '@' to '%', to accomodate the new @decorator syntax of python
2892 2.4.
2896 2.4.
2893
2897
2894 2004-09-29 Fernando Perez <fperez@colorado.edu>
2898 2004-09-29 Fernando Perez <fperez@colorado.edu>
2895
2899
2896 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2900 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2897 matplotlib.use to prevent running scripts which try to switch
2901 matplotlib.use to prevent running scripts which try to switch
2898 interactive backends from within ipython. This will just crash
2902 interactive backends from within ipython. This will just crash
2899 the python interpreter, so we can't allow it (but a detailed error
2903 the python interpreter, so we can't allow it (but a detailed error
2900 is given to the user).
2904 is given to the user).
2901
2905
2902 2004-09-28 Fernando Perez <fperez@colorado.edu>
2906 2004-09-28 Fernando Perez <fperez@colorado.edu>
2903
2907
2904 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2908 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2905 matplotlib-related fixes so that using @run with non-matplotlib
2909 matplotlib-related fixes so that using @run with non-matplotlib
2906 scripts doesn't pop up spurious plot windows. This requires
2910 scripts doesn't pop up spurious plot windows. This requires
2907 matplotlib >= 0.63, where I had to make some changes as well.
2911 matplotlib >= 0.63, where I had to make some changes as well.
2908
2912
2909 * IPython/ipmaker.py (make_IPython): update version requirement to
2913 * IPython/ipmaker.py (make_IPython): update version requirement to
2910 python 2.2.
2914 python 2.2.
2911
2915
2912 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2916 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2913 banner arg for embedded customization.
2917 banner arg for embedded customization.
2914
2918
2915 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2919 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2916 explicit uses of __IP as the IPython's instance name. Now things
2920 explicit uses of __IP as the IPython's instance name. Now things
2917 are properly handled via the shell.name value. The actual code
2921 are properly handled via the shell.name value. The actual code
2918 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2922 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2919 is much better than before. I'll clean things completely when the
2923 is much better than before. I'll clean things completely when the
2920 magic stuff gets a real overhaul.
2924 magic stuff gets a real overhaul.
2921
2925
2922 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2926 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2923 minor changes to debian dir.
2927 minor changes to debian dir.
2924
2928
2925 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2929 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2926 pointer to the shell itself in the interactive namespace even when
2930 pointer to the shell itself in the interactive namespace even when
2927 a user-supplied dict is provided. This is needed for embedding
2931 a user-supplied dict is provided. This is needed for embedding
2928 purposes (found by tests with Michel Sanner).
2932 purposes (found by tests with Michel Sanner).
2929
2933
2930 2004-09-27 Fernando Perez <fperez@colorado.edu>
2934 2004-09-27 Fernando Perez <fperez@colorado.edu>
2931
2935
2932 * IPython/UserConfig/ipythonrc: remove []{} from
2936 * IPython/UserConfig/ipythonrc: remove []{} from
2933 readline_remove_delims, so that things like [modname.<TAB> do
2937 readline_remove_delims, so that things like [modname.<TAB> do
2934 proper completion. This disables [].TAB, but that's a less common
2938 proper completion. This disables [].TAB, but that's a less common
2935 case than module names in list comprehensions, for example.
2939 case than module names in list comprehensions, for example.
2936 Thanks to a report by Andrea Riciputi.
2940 Thanks to a report by Andrea Riciputi.
2937
2941
2938 2004-09-09 Fernando Perez <fperez@colorado.edu>
2942 2004-09-09 Fernando Perez <fperez@colorado.edu>
2939
2943
2940 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2944 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2941 blocking problems in win32 and osx. Fix by John.
2945 blocking problems in win32 and osx. Fix by John.
2942
2946
2943 2004-09-08 Fernando Perez <fperez@colorado.edu>
2947 2004-09-08 Fernando Perez <fperez@colorado.edu>
2944
2948
2945 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2949 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2946 for Win32 and OSX. Fix by John Hunter.
2950 for Win32 and OSX. Fix by John Hunter.
2947
2951
2948 2004-08-30 *** Released version 0.6.3
2952 2004-08-30 *** Released version 0.6.3
2949
2953
2950 2004-08-30 Fernando Perez <fperez@colorado.edu>
2954 2004-08-30 Fernando Perez <fperez@colorado.edu>
2951
2955
2952 * setup.py (isfile): Add manpages to list of dependent files to be
2956 * setup.py (isfile): Add manpages to list of dependent files to be
2953 updated.
2957 updated.
2954
2958
2955 2004-08-27 Fernando Perez <fperez@colorado.edu>
2959 2004-08-27 Fernando Perez <fperez@colorado.edu>
2956
2960
2957 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2961 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2958 for now. They don't really work with standalone WX/GTK code
2962 for now. They don't really work with standalone WX/GTK code
2959 (though matplotlib IS working fine with both of those backends).
2963 (though matplotlib IS working fine with both of those backends).
2960 This will neeed much more testing. I disabled most things with
2964 This will neeed much more testing. I disabled most things with
2961 comments, so turning it back on later should be pretty easy.
2965 comments, so turning it back on later should be pretty easy.
2962
2966
2963 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2967 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2964 autocalling of expressions like r'foo', by modifying the line
2968 autocalling of expressions like r'foo', by modifying the line
2965 split regexp. Closes
2969 split regexp. Closes
2966 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2970 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2967 Riley <ipythonbugs-AT-sabi.net>.
2971 Riley <ipythonbugs-AT-sabi.net>.
2968 (InteractiveShell.mainloop): honor --nobanner with banner
2972 (InteractiveShell.mainloop): honor --nobanner with banner
2969 extensions.
2973 extensions.
2970
2974
2971 * IPython/Shell.py: Significant refactoring of all classes, so
2975 * IPython/Shell.py: Significant refactoring of all classes, so
2972 that we can really support ALL matplotlib backends and threading
2976 that we can really support ALL matplotlib backends and threading
2973 models (John spotted a bug with Tk which required this). Now we
2977 models (John spotted a bug with Tk which required this). Now we
2974 should support single-threaded, WX-threads and GTK-threads, both
2978 should support single-threaded, WX-threads and GTK-threads, both
2975 for generic code and for matplotlib.
2979 for generic code and for matplotlib.
2976
2980
2977 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2981 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2978 -pylab, to simplify things for users. Will also remove the pylab
2982 -pylab, to simplify things for users. Will also remove the pylab
2979 profile, since now all of matplotlib configuration is directly
2983 profile, since now all of matplotlib configuration is directly
2980 handled here. This also reduces startup time.
2984 handled here. This also reduces startup time.
2981
2985
2982 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2986 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2983 shell wasn't being correctly called. Also in IPShellWX.
2987 shell wasn't being correctly called. Also in IPShellWX.
2984
2988
2985 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2989 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2986 fine-tune banner.
2990 fine-tune banner.
2987
2991
2988 * IPython/numutils.py (spike): Deprecate these spike functions,
2992 * IPython/numutils.py (spike): Deprecate these spike functions,
2989 delete (long deprecated) gnuplot_exec handler.
2993 delete (long deprecated) gnuplot_exec handler.
2990
2994
2991 2004-08-26 Fernando Perez <fperez@colorado.edu>
2995 2004-08-26 Fernando Perez <fperez@colorado.edu>
2992
2996
2993 * ipython.1: Update for threading options, plus some others which
2997 * ipython.1: Update for threading options, plus some others which
2994 were missing.
2998 were missing.
2995
2999
2996 * IPython/ipmaker.py (__call__): Added -wthread option for
3000 * IPython/ipmaker.py (__call__): Added -wthread option for
2997 wxpython thread handling. Make sure threading options are only
3001 wxpython thread handling. Make sure threading options are only
2998 valid at the command line.
3002 valid at the command line.
2999
3003
3000 * scripts/ipython: moved shell selection into a factory function
3004 * scripts/ipython: moved shell selection into a factory function
3001 in Shell.py, to keep the starter script to a minimum.
3005 in Shell.py, to keep the starter script to a minimum.
3002
3006
3003 2004-08-25 Fernando Perez <fperez@colorado.edu>
3007 2004-08-25 Fernando Perez <fperez@colorado.edu>
3004
3008
3005 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3009 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3006 John. Along with some recent changes he made to matplotlib, the
3010 John. Along with some recent changes he made to matplotlib, the
3007 next versions of both systems should work very well together.
3011 next versions of both systems should work very well together.
3008
3012
3009 2004-08-24 Fernando Perez <fperez@colorado.edu>
3013 2004-08-24 Fernando Perez <fperez@colorado.edu>
3010
3014
3011 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3015 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3012 tried to switch the profiling to using hotshot, but I'm getting
3016 tried to switch the profiling to using hotshot, but I'm getting
3013 strange errors from prof.runctx() there. I may be misreading the
3017 strange errors from prof.runctx() there. I may be misreading the
3014 docs, but it looks weird. For now the profiling code will
3018 docs, but it looks weird. For now the profiling code will
3015 continue to use the standard profiler.
3019 continue to use the standard profiler.
3016
3020
3017 2004-08-23 Fernando Perez <fperez@colorado.edu>
3021 2004-08-23 Fernando Perez <fperez@colorado.edu>
3018
3022
3019 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3023 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3020 threaded shell, by John Hunter. It's not quite ready yet, but
3024 threaded shell, by John Hunter. It's not quite ready yet, but
3021 close.
3025 close.
3022
3026
3023 2004-08-22 Fernando Perez <fperez@colorado.edu>
3027 2004-08-22 Fernando Perez <fperez@colorado.edu>
3024
3028
3025 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3029 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3026 in Magic and ultraTB.
3030 in Magic and ultraTB.
3027
3031
3028 * ipython.1: document threading options in manpage.
3032 * ipython.1: document threading options in manpage.
3029
3033
3030 * scripts/ipython: Changed name of -thread option to -gthread,
3034 * scripts/ipython: Changed name of -thread option to -gthread,
3031 since this is GTK specific. I want to leave the door open for a
3035 since this is GTK specific. I want to leave the door open for a
3032 -wthread option for WX, which will most likely be necessary. This
3036 -wthread option for WX, which will most likely be necessary. This
3033 change affects usage and ipmaker as well.
3037 change affects usage and ipmaker as well.
3034
3038
3035 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3039 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3036 handle the matplotlib shell issues. Code by John Hunter
3040 handle the matplotlib shell issues. Code by John Hunter
3037 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3041 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3038 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3042 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3039 broken (and disabled for end users) for now, but it puts the
3043 broken (and disabled for end users) for now, but it puts the
3040 infrastructure in place.
3044 infrastructure in place.
3041
3045
3042 2004-08-21 Fernando Perez <fperez@colorado.edu>
3046 2004-08-21 Fernando Perez <fperez@colorado.edu>
3043
3047
3044 * ipythonrc-pylab: Add matplotlib support.
3048 * ipythonrc-pylab: Add matplotlib support.
3045
3049
3046 * matplotlib_config.py: new files for matplotlib support, part of
3050 * matplotlib_config.py: new files for matplotlib support, part of
3047 the pylab profile.
3051 the pylab profile.
3048
3052
3049 * IPython/usage.py (__doc__): documented the threading options.
3053 * IPython/usage.py (__doc__): documented the threading options.
3050
3054
3051 2004-08-20 Fernando Perez <fperez@colorado.edu>
3055 2004-08-20 Fernando Perez <fperez@colorado.edu>
3052
3056
3053 * ipython: Modified the main calling routine to handle the -thread
3057 * ipython: Modified the main calling routine to handle the -thread
3054 and -mpthread options. This needs to be done as a top-level hack,
3058 and -mpthread options. This needs to be done as a top-level hack,
3055 because it determines which class to instantiate for IPython
3059 because it determines which class to instantiate for IPython
3056 itself.
3060 itself.
3057
3061
3058 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3062 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3059 classes to support multithreaded GTK operation without blocking,
3063 classes to support multithreaded GTK operation without blocking,
3060 and matplotlib with all backends. This is a lot of still very
3064 and matplotlib with all backends. This is a lot of still very
3061 experimental code, and threads are tricky. So it may still have a
3065 experimental code, and threads are tricky. So it may still have a
3062 few rough edges... This code owes a lot to
3066 few rough edges... This code owes a lot to
3063 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3067 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3064 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3068 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3065 to John Hunter for all the matplotlib work.
3069 to John Hunter for all the matplotlib work.
3066
3070
3067 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3071 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3068 options for gtk thread and matplotlib support.
3072 options for gtk thread and matplotlib support.
3069
3073
3070 2004-08-16 Fernando Perez <fperez@colorado.edu>
3074 2004-08-16 Fernando Perez <fperez@colorado.edu>
3071
3075
3072 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3076 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3073 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3077 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3074 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3078 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3075
3079
3076 2004-08-11 Fernando Perez <fperez@colorado.edu>
3080 2004-08-11 Fernando Perez <fperez@colorado.edu>
3077
3081
3078 * setup.py (isfile): Fix build so documentation gets updated for
3082 * setup.py (isfile): Fix build so documentation gets updated for
3079 rpms (it was only done for .tgz builds).
3083 rpms (it was only done for .tgz builds).
3080
3084
3081 2004-08-10 Fernando Perez <fperez@colorado.edu>
3085 2004-08-10 Fernando Perez <fperez@colorado.edu>
3082
3086
3083 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3087 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3084
3088
3085 * iplib.py : Silence syntax error exceptions in tab-completion.
3089 * iplib.py : Silence syntax error exceptions in tab-completion.
3086
3090
3087 2004-08-05 Fernando Perez <fperez@colorado.edu>
3091 2004-08-05 Fernando Perez <fperez@colorado.edu>
3088
3092
3089 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3093 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3090 'color off' mark for continuation prompts. This was causing long
3094 'color off' mark for continuation prompts. This was causing long
3091 continuation lines to mis-wrap.
3095 continuation lines to mis-wrap.
3092
3096
3093 2004-08-01 Fernando Perez <fperez@colorado.edu>
3097 2004-08-01 Fernando Perez <fperez@colorado.edu>
3094
3098
3095 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3099 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3096 for building ipython to be a parameter. All this is necessary
3100 for building ipython to be a parameter. All this is necessary
3097 right now to have a multithreaded version, but this insane
3101 right now to have a multithreaded version, but this insane
3098 non-design will be cleaned up soon. For now, it's a hack that
3102 non-design will be cleaned up soon. For now, it's a hack that
3099 works.
3103 works.
3100
3104
3101 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3105 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3102 args in various places. No bugs so far, but it's a dangerous
3106 args in various places. No bugs so far, but it's a dangerous
3103 practice.
3107 practice.
3104
3108
3105 2004-07-31 Fernando Perez <fperez@colorado.edu>
3109 2004-07-31 Fernando Perez <fperez@colorado.edu>
3106
3110
3107 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3111 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3108 fix completion of files with dots in their names under most
3112 fix completion of files with dots in their names under most
3109 profiles (pysh was OK because the completion order is different).
3113 profiles (pysh was OK because the completion order is different).
3110
3114
3111 2004-07-27 Fernando Perez <fperez@colorado.edu>
3115 2004-07-27 Fernando Perez <fperez@colorado.edu>
3112
3116
3113 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3117 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3114 keywords manually, b/c the one in keyword.py was removed in python
3118 keywords manually, b/c the one in keyword.py was removed in python
3115 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3119 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3116 This is NOT a bug under python 2.3 and earlier.
3120 This is NOT a bug under python 2.3 and earlier.
3117
3121
3118 2004-07-26 Fernando Perez <fperez@colorado.edu>
3122 2004-07-26 Fernando Perez <fperez@colorado.edu>
3119
3123
3120 * IPython/ultraTB.py (VerboseTB.text): Add another
3124 * IPython/ultraTB.py (VerboseTB.text): Add another
3121 linecache.checkcache() call to try to prevent inspect.py from
3125 linecache.checkcache() call to try to prevent inspect.py from
3122 crashing under python 2.3. I think this fixes
3126 crashing under python 2.3. I think this fixes
3123 http://www.scipy.net/roundup/ipython/issue17.
3127 http://www.scipy.net/roundup/ipython/issue17.
3124
3128
3125 2004-07-26 *** Released version 0.6.2
3129 2004-07-26 *** Released version 0.6.2
3126
3130
3127 2004-07-26 Fernando Perez <fperez@colorado.edu>
3131 2004-07-26 Fernando Perez <fperez@colorado.edu>
3128
3132
3129 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3133 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3130 fail for any number.
3134 fail for any number.
3131 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3135 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3132 empty bookmarks.
3136 empty bookmarks.
3133
3137
3134 2004-07-26 *** Released version 0.6.1
3138 2004-07-26 *** Released version 0.6.1
3135
3139
3136 2004-07-26 Fernando Perez <fperez@colorado.edu>
3140 2004-07-26 Fernando Perez <fperez@colorado.edu>
3137
3141
3138 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3142 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3139
3143
3140 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3144 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3141 escaping '()[]{}' in filenames.
3145 escaping '()[]{}' in filenames.
3142
3146
3143 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3147 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3144 Python 2.2 users who lack a proper shlex.split.
3148 Python 2.2 users who lack a proper shlex.split.
3145
3149
3146 2004-07-19 Fernando Perez <fperez@colorado.edu>
3150 2004-07-19 Fernando Perez <fperez@colorado.edu>
3147
3151
3148 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3152 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3149 for reading readline's init file. I follow the normal chain:
3153 for reading readline's init file. I follow the normal chain:
3150 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3154 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3151 report by Mike Heeter. This closes
3155 report by Mike Heeter. This closes
3152 http://www.scipy.net/roundup/ipython/issue16.
3156 http://www.scipy.net/roundup/ipython/issue16.
3153
3157
3154 2004-07-18 Fernando Perez <fperez@colorado.edu>
3158 2004-07-18 Fernando Perez <fperez@colorado.edu>
3155
3159
3156 * IPython/iplib.py (__init__): Add better handling of '\' under
3160 * IPython/iplib.py (__init__): Add better handling of '\' under
3157 Win32 for filenames. After a patch by Ville.
3161 Win32 for filenames. After a patch by Ville.
3158
3162
3159 2004-07-17 Fernando Perez <fperez@colorado.edu>
3163 2004-07-17 Fernando Perez <fperez@colorado.edu>
3160
3164
3161 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3165 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3162 autocalling would be triggered for 'foo is bar' if foo is
3166 autocalling would be triggered for 'foo is bar' if foo is
3163 callable. I also cleaned up the autocall detection code to use a
3167 callable. I also cleaned up the autocall detection code to use a
3164 regexp, which is faster. Bug reported by Alexander Schmolck.
3168 regexp, which is faster. Bug reported by Alexander Schmolck.
3165
3169
3166 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3170 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3167 '?' in them would confuse the help system. Reported by Alex
3171 '?' in them would confuse the help system. Reported by Alex
3168 Schmolck.
3172 Schmolck.
3169
3173
3170 2004-07-16 Fernando Perez <fperez@colorado.edu>
3174 2004-07-16 Fernando Perez <fperez@colorado.edu>
3171
3175
3172 * IPython/GnuplotInteractive.py (__all__): added plot2.
3176 * IPython/GnuplotInteractive.py (__all__): added plot2.
3173
3177
3174 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3178 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3175 plotting dictionaries, lists or tuples of 1d arrays.
3179 plotting dictionaries, lists or tuples of 1d arrays.
3176
3180
3177 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3181 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3178 optimizations.
3182 optimizations.
3179
3183
3180 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3184 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3181 the information which was there from Janko's original IPP code:
3185 the information which was there from Janko's original IPP code:
3182
3186
3183 03.05.99 20:53 porto.ifm.uni-kiel.de
3187 03.05.99 20:53 porto.ifm.uni-kiel.de
3184 --Started changelog.
3188 --Started changelog.
3185 --make clear do what it say it does
3189 --make clear do what it say it does
3186 --added pretty output of lines from inputcache
3190 --added pretty output of lines from inputcache
3187 --Made Logger a mixin class, simplifies handling of switches
3191 --Made Logger a mixin class, simplifies handling of switches
3188 --Added own completer class. .string<TAB> expands to last history
3192 --Added own completer class. .string<TAB> expands to last history
3189 line which starts with string. The new expansion is also present
3193 line which starts with string. The new expansion is also present
3190 with Ctrl-r from the readline library. But this shows, who this
3194 with Ctrl-r from the readline library. But this shows, who this
3191 can be done for other cases.
3195 can be done for other cases.
3192 --Added convention that all shell functions should accept a
3196 --Added convention that all shell functions should accept a
3193 parameter_string This opens the door for different behaviour for
3197 parameter_string This opens the door for different behaviour for
3194 each function. @cd is a good example of this.
3198 each function. @cd is a good example of this.
3195
3199
3196 04.05.99 12:12 porto.ifm.uni-kiel.de
3200 04.05.99 12:12 porto.ifm.uni-kiel.de
3197 --added logfile rotation
3201 --added logfile rotation
3198 --added new mainloop method which freezes first the namespace
3202 --added new mainloop method which freezes first the namespace
3199
3203
3200 07.05.99 21:24 porto.ifm.uni-kiel.de
3204 07.05.99 21:24 porto.ifm.uni-kiel.de
3201 --added the docreader classes. Now there is a help system.
3205 --added the docreader classes. Now there is a help system.
3202 -This is only a first try. Currently it's not easy to put new
3206 -This is only a first try. Currently it's not easy to put new
3203 stuff in the indices. But this is the way to go. Info would be
3207 stuff in the indices. But this is the way to go. Info would be
3204 better, but HTML is every where and not everybody has an info
3208 better, but HTML is every where and not everybody has an info
3205 system installed and it's not so easy to change html-docs to info.
3209 system installed and it's not so easy to change html-docs to info.
3206 --added global logfile option
3210 --added global logfile option
3207 --there is now a hook for object inspection method pinfo needs to
3211 --there is now a hook for object inspection method pinfo needs to
3208 be provided for this. Can be reached by two '??'.
3212 be provided for this. Can be reached by two '??'.
3209
3213
3210 08.05.99 20:51 porto.ifm.uni-kiel.de
3214 08.05.99 20:51 porto.ifm.uni-kiel.de
3211 --added a README
3215 --added a README
3212 --bug in rc file. Something has changed so functions in the rc
3216 --bug in rc file. Something has changed so functions in the rc
3213 file need to reference the shell and not self. Not clear if it's a
3217 file need to reference the shell and not self. Not clear if it's a
3214 bug or feature.
3218 bug or feature.
3215 --changed rc file for new behavior
3219 --changed rc file for new behavior
3216
3220
3217 2004-07-15 Fernando Perez <fperez@colorado.edu>
3221 2004-07-15 Fernando Perez <fperez@colorado.edu>
3218
3222
3219 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3223 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3220 cache was falling out of sync in bizarre manners when multi-line
3224 cache was falling out of sync in bizarre manners when multi-line
3221 input was present. Minor optimizations and cleanup.
3225 input was present. Minor optimizations and cleanup.
3222
3226
3223 (Logger): Remove old Changelog info for cleanup. This is the
3227 (Logger): Remove old Changelog info for cleanup. This is the
3224 information which was there from Janko's original code:
3228 information which was there from Janko's original code:
3225
3229
3226 Changes to Logger: - made the default log filename a parameter
3230 Changes to Logger: - made the default log filename a parameter
3227
3231
3228 - put a check for lines beginning with !@? in log(). Needed
3232 - put a check for lines beginning with !@? in log(). Needed
3229 (even if the handlers properly log their lines) for mid-session
3233 (even if the handlers properly log their lines) for mid-session
3230 logging activation to work properly. Without this, lines logged
3234 logging activation to work properly. Without this, lines logged
3231 in mid session, which get read from the cache, would end up
3235 in mid session, which get read from the cache, would end up
3232 'bare' (with !@? in the open) in the log. Now they are caught
3236 'bare' (with !@? in the open) in the log. Now they are caught
3233 and prepended with a #.
3237 and prepended with a #.
3234
3238
3235 * IPython/iplib.py (InteractiveShell.init_readline): added check
3239 * IPython/iplib.py (InteractiveShell.init_readline): added check
3236 in case MagicCompleter fails to be defined, so we don't crash.
3240 in case MagicCompleter fails to be defined, so we don't crash.
3237
3241
3238 2004-07-13 Fernando Perez <fperez@colorado.edu>
3242 2004-07-13 Fernando Perez <fperez@colorado.edu>
3239
3243
3240 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3244 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3241 of EPS if the requested filename ends in '.eps'.
3245 of EPS if the requested filename ends in '.eps'.
3242
3246
3243 2004-07-04 Fernando Perez <fperez@colorado.edu>
3247 2004-07-04 Fernando Perez <fperez@colorado.edu>
3244
3248
3245 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3249 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3246 escaping of quotes when calling the shell.
3250 escaping of quotes when calling the shell.
3247
3251
3248 2004-07-02 Fernando Perez <fperez@colorado.edu>
3252 2004-07-02 Fernando Perez <fperez@colorado.edu>
3249
3253
3250 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3254 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3251 gettext not working because we were clobbering '_'. Fixes
3255 gettext not working because we were clobbering '_'. Fixes
3252 http://www.scipy.net/roundup/ipython/issue6.
3256 http://www.scipy.net/roundup/ipython/issue6.
3253
3257
3254 2004-07-01 Fernando Perez <fperez@colorado.edu>
3258 2004-07-01 Fernando Perez <fperez@colorado.edu>
3255
3259
3256 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3260 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3257 into @cd. Patch by Ville.
3261 into @cd. Patch by Ville.
3258
3262
3259 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3263 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3260 new function to store things after ipmaker runs. Patch by Ville.
3264 new function to store things after ipmaker runs. Patch by Ville.
3261 Eventually this will go away once ipmaker is removed and the class
3265 Eventually this will go away once ipmaker is removed and the class
3262 gets cleaned up, but for now it's ok. Key functionality here is
3266 gets cleaned up, but for now it's ok. Key functionality here is
3263 the addition of the persistent storage mechanism, a dict for
3267 the addition of the persistent storage mechanism, a dict for
3264 keeping data across sessions (for now just bookmarks, but more can
3268 keeping data across sessions (for now just bookmarks, but more can
3265 be implemented later).
3269 be implemented later).
3266
3270
3267 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3271 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3268 persistent across sections. Patch by Ville, I modified it
3272 persistent across sections. Patch by Ville, I modified it
3269 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3273 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3270 added a '-l' option to list all bookmarks.
3274 added a '-l' option to list all bookmarks.
3271
3275
3272 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3276 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3273 center for cleanup. Registered with atexit.register(). I moved
3277 center for cleanup. Registered with atexit.register(). I moved
3274 here the old exit_cleanup(). After a patch by Ville.
3278 here the old exit_cleanup(). After a patch by Ville.
3275
3279
3276 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3280 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3277 characters in the hacked shlex_split for python 2.2.
3281 characters in the hacked shlex_split for python 2.2.
3278
3282
3279 * IPython/iplib.py (file_matches): more fixes to filenames with
3283 * IPython/iplib.py (file_matches): more fixes to filenames with
3280 whitespace in them. It's not perfect, but limitations in python's
3284 whitespace in them. It's not perfect, but limitations in python's
3281 readline make it impossible to go further.
3285 readline make it impossible to go further.
3282
3286
3283 2004-06-29 Fernando Perez <fperez@colorado.edu>
3287 2004-06-29 Fernando Perez <fperez@colorado.edu>
3284
3288
3285 * IPython/iplib.py (file_matches): escape whitespace correctly in
3289 * IPython/iplib.py (file_matches): escape whitespace correctly in
3286 filename completions. Bug reported by Ville.
3290 filename completions. Bug reported by Ville.
3287
3291
3288 2004-06-28 Fernando Perez <fperez@colorado.edu>
3292 2004-06-28 Fernando Perez <fperez@colorado.edu>
3289
3293
3290 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3294 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3291 the history file will be called 'history-PROFNAME' (or just
3295 the history file will be called 'history-PROFNAME' (or just
3292 'history' if no profile is loaded). I was getting annoyed at
3296 'history' if no profile is loaded). I was getting annoyed at
3293 getting my Numerical work history clobbered by pysh sessions.
3297 getting my Numerical work history clobbered by pysh sessions.
3294
3298
3295 * IPython/iplib.py (InteractiveShell.__init__): Internal
3299 * IPython/iplib.py (InteractiveShell.__init__): Internal
3296 getoutputerror() function so that we can honor the system_verbose
3300 getoutputerror() function so that we can honor the system_verbose
3297 flag for _all_ system calls. I also added escaping of #
3301 flag for _all_ system calls. I also added escaping of #
3298 characters here to avoid confusing Itpl.
3302 characters here to avoid confusing Itpl.
3299
3303
3300 * IPython/Magic.py (shlex_split): removed call to shell in
3304 * IPython/Magic.py (shlex_split): removed call to shell in
3301 parse_options and replaced it with shlex.split(). The annoying
3305 parse_options and replaced it with shlex.split(). The annoying
3302 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3306 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3303 to backport it from 2.3, with several frail hacks (the shlex
3307 to backport it from 2.3, with several frail hacks (the shlex
3304 module is rather limited in 2.2). Thanks to a suggestion by Ville
3308 module is rather limited in 2.2). Thanks to a suggestion by Ville
3305 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3309 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3306 problem.
3310 problem.
3307
3311
3308 (Magic.magic_system_verbose): new toggle to print the actual
3312 (Magic.magic_system_verbose): new toggle to print the actual
3309 system calls made by ipython. Mainly for debugging purposes.
3313 system calls made by ipython. Mainly for debugging purposes.
3310
3314
3311 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3315 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3312 doesn't support persistence. Reported (and fix suggested) by
3316 doesn't support persistence. Reported (and fix suggested) by
3313 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3317 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3314
3318
3315 2004-06-26 Fernando Perez <fperez@colorado.edu>
3319 2004-06-26 Fernando Perez <fperez@colorado.edu>
3316
3320
3317 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3321 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3318 continue prompts.
3322 continue prompts.
3319
3323
3320 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3324 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3321 function (basically a big docstring) and a few more things here to
3325 function (basically a big docstring) and a few more things here to
3322 speedup startup. pysh.py is now very lightweight. We want because
3326 speedup startup. pysh.py is now very lightweight. We want because
3323 it gets execfile'd, while InterpreterExec gets imported, so
3327 it gets execfile'd, while InterpreterExec gets imported, so
3324 byte-compilation saves time.
3328 byte-compilation saves time.
3325
3329
3326 2004-06-25 Fernando Perez <fperez@colorado.edu>
3330 2004-06-25 Fernando Perez <fperez@colorado.edu>
3327
3331
3328 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3332 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3329 -NUM', which was recently broken.
3333 -NUM', which was recently broken.
3330
3334
3331 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3335 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3332 in multi-line input (but not !!, which doesn't make sense there).
3336 in multi-line input (but not !!, which doesn't make sense there).
3333
3337
3334 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3338 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3335 It's just too useful, and people can turn it off in the less
3339 It's just too useful, and people can turn it off in the less
3336 common cases where it's a problem.
3340 common cases where it's a problem.
3337
3341
3338 2004-06-24 Fernando Perez <fperez@colorado.edu>
3342 2004-06-24 Fernando Perez <fperez@colorado.edu>
3339
3343
3340 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3344 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3341 special syntaxes (like alias calling) is now allied in multi-line
3345 special syntaxes (like alias calling) is now allied in multi-line
3342 input. This is still _very_ experimental, but it's necessary for
3346 input. This is still _very_ experimental, but it's necessary for
3343 efficient shell usage combining python looping syntax with system
3347 efficient shell usage combining python looping syntax with system
3344 calls. For now it's restricted to aliases, I don't think it
3348 calls. For now it's restricted to aliases, I don't think it
3345 really even makes sense to have this for magics.
3349 really even makes sense to have this for magics.
3346
3350
3347 2004-06-23 Fernando Perez <fperez@colorado.edu>
3351 2004-06-23 Fernando Perez <fperez@colorado.edu>
3348
3352
3349 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3353 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3350 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3354 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3351
3355
3352 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3356 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3353 extensions under Windows (after code sent by Gary Bishop). The
3357 extensions under Windows (after code sent by Gary Bishop). The
3354 extensions considered 'executable' are stored in IPython's rc
3358 extensions considered 'executable' are stored in IPython's rc
3355 structure as win_exec_ext.
3359 structure as win_exec_ext.
3356
3360
3357 * IPython/genutils.py (shell): new function, like system() but
3361 * IPython/genutils.py (shell): new function, like system() but
3358 without return value. Very useful for interactive shell work.
3362 without return value. Very useful for interactive shell work.
3359
3363
3360 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3364 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3361 delete aliases.
3365 delete aliases.
3362
3366
3363 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3367 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3364 sure that the alias table doesn't contain python keywords.
3368 sure that the alias table doesn't contain python keywords.
3365
3369
3366 2004-06-21 Fernando Perez <fperez@colorado.edu>
3370 2004-06-21 Fernando Perez <fperez@colorado.edu>
3367
3371
3368 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3372 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3369 non-existent items are found in $PATH. Reported by Thorsten.
3373 non-existent items are found in $PATH. Reported by Thorsten.
3370
3374
3371 2004-06-20 Fernando Perez <fperez@colorado.edu>
3375 2004-06-20 Fernando Perez <fperez@colorado.edu>
3372
3376
3373 * IPython/iplib.py (complete): modified the completer so that the
3377 * IPython/iplib.py (complete): modified the completer so that the
3374 order of priorities can be easily changed at runtime.
3378 order of priorities can be easily changed at runtime.
3375
3379
3376 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3380 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3377 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3381 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3378
3382
3379 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3383 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3380 expand Python variables prepended with $ in all system calls. The
3384 expand Python variables prepended with $ in all system calls. The
3381 same was done to InteractiveShell.handle_shell_escape. Now all
3385 same was done to InteractiveShell.handle_shell_escape. Now all
3382 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3386 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3383 expansion of python variables and expressions according to the
3387 expansion of python variables and expressions according to the
3384 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3388 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3385
3389
3386 Though PEP-215 has been rejected, a similar (but simpler) one
3390 Though PEP-215 has been rejected, a similar (but simpler) one
3387 seems like it will go into Python 2.4, PEP-292 -
3391 seems like it will go into Python 2.4, PEP-292 -
3388 http://www.python.org/peps/pep-0292.html.
3392 http://www.python.org/peps/pep-0292.html.
3389
3393
3390 I'll keep the full syntax of PEP-215, since IPython has since the
3394 I'll keep the full syntax of PEP-215, since IPython has since the
3391 start used Ka-Ping Yee's reference implementation discussed there
3395 start used Ka-Ping Yee's reference implementation discussed there
3392 (Itpl), and I actually like the powerful semantics it offers.
3396 (Itpl), and I actually like the powerful semantics it offers.
3393
3397
3394 In order to access normal shell variables, the $ has to be escaped
3398 In order to access normal shell variables, the $ has to be escaped
3395 via an extra $. For example:
3399 via an extra $. For example:
3396
3400
3397 In [7]: PATH='a python variable'
3401 In [7]: PATH='a python variable'
3398
3402
3399 In [8]: !echo $PATH
3403 In [8]: !echo $PATH
3400 a python variable
3404 a python variable
3401
3405
3402 In [9]: !echo $$PATH
3406 In [9]: !echo $$PATH
3403 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3407 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3404
3408
3405 (Magic.parse_options): escape $ so the shell doesn't evaluate
3409 (Magic.parse_options): escape $ so the shell doesn't evaluate
3406 things prematurely.
3410 things prematurely.
3407
3411
3408 * IPython/iplib.py (InteractiveShell.call_alias): added the
3412 * IPython/iplib.py (InteractiveShell.call_alias): added the
3409 ability for aliases to expand python variables via $.
3413 ability for aliases to expand python variables via $.
3410
3414
3411 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3415 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3412 system, now there's a @rehash/@rehashx pair of magics. These work
3416 system, now there's a @rehash/@rehashx pair of magics. These work
3413 like the csh rehash command, and can be invoked at any time. They
3417 like the csh rehash command, and can be invoked at any time. They
3414 build a table of aliases to everything in the user's $PATH
3418 build a table of aliases to everything in the user's $PATH
3415 (@rehash uses everything, @rehashx is slower but only adds
3419 (@rehash uses everything, @rehashx is slower but only adds
3416 executable files). With this, the pysh.py-based shell profile can
3420 executable files). With this, the pysh.py-based shell profile can
3417 now simply call rehash upon startup, and full access to all
3421 now simply call rehash upon startup, and full access to all
3418 programs in the user's path is obtained.
3422 programs in the user's path is obtained.
3419
3423
3420 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3424 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3421 functionality is now fully in place. I removed the old dynamic
3425 functionality is now fully in place. I removed the old dynamic
3422 code generation based approach, in favor of a much lighter one
3426 code generation based approach, in favor of a much lighter one
3423 based on a simple dict. The advantage is that this allows me to
3427 based on a simple dict. The advantage is that this allows me to
3424 now have thousands of aliases with negligible cost (unthinkable
3428 now have thousands of aliases with negligible cost (unthinkable
3425 with the old system).
3429 with the old system).
3426
3430
3427 2004-06-19 Fernando Perez <fperez@colorado.edu>
3431 2004-06-19 Fernando Perez <fperez@colorado.edu>
3428
3432
3429 * IPython/iplib.py (__init__): extended MagicCompleter class to
3433 * IPython/iplib.py (__init__): extended MagicCompleter class to
3430 also complete (last in priority) on user aliases.
3434 also complete (last in priority) on user aliases.
3431
3435
3432 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3436 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3433 call to eval.
3437 call to eval.
3434 (ItplNS.__init__): Added a new class which functions like Itpl,
3438 (ItplNS.__init__): Added a new class which functions like Itpl,
3435 but allows configuring the namespace for the evaluation to occur
3439 but allows configuring the namespace for the evaluation to occur
3436 in.
3440 in.
3437
3441
3438 2004-06-18 Fernando Perez <fperez@colorado.edu>
3442 2004-06-18 Fernando Perez <fperez@colorado.edu>
3439
3443
3440 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3444 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3441 better message when 'exit' or 'quit' are typed (a common newbie
3445 better message when 'exit' or 'quit' are typed (a common newbie
3442 confusion).
3446 confusion).
3443
3447
3444 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3448 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3445 check for Windows users.
3449 check for Windows users.
3446
3450
3447 * IPython/iplib.py (InteractiveShell.user_setup): removed
3451 * IPython/iplib.py (InteractiveShell.user_setup): removed
3448 disabling of colors for Windows. I'll test at runtime and issue a
3452 disabling of colors for Windows. I'll test at runtime and issue a
3449 warning if Gary's readline isn't found, as to nudge users to
3453 warning if Gary's readline isn't found, as to nudge users to
3450 download it.
3454 download it.
3451
3455
3452 2004-06-16 Fernando Perez <fperez@colorado.edu>
3456 2004-06-16 Fernando Perez <fperez@colorado.edu>
3453
3457
3454 * IPython/genutils.py (Stream.__init__): changed to print errors
3458 * IPython/genutils.py (Stream.__init__): changed to print errors
3455 to sys.stderr. I had a circular dependency here. Now it's
3459 to sys.stderr. I had a circular dependency here. Now it's
3456 possible to run ipython as IDLE's shell (consider this pre-alpha,
3460 possible to run ipython as IDLE's shell (consider this pre-alpha,
3457 since true stdout things end up in the starting terminal instead
3461 since true stdout things end up in the starting terminal instead
3458 of IDLE's out).
3462 of IDLE's out).
3459
3463
3460 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3464 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3461 users who haven't # updated their prompt_in2 definitions. Remove
3465 users who haven't # updated their prompt_in2 definitions. Remove
3462 eventually.
3466 eventually.
3463 (multiple_replace): added credit to original ASPN recipe.
3467 (multiple_replace): added credit to original ASPN recipe.
3464
3468
3465 2004-06-15 Fernando Perez <fperez@colorado.edu>
3469 2004-06-15 Fernando Perez <fperez@colorado.edu>
3466
3470
3467 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3471 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3468 list of auto-defined aliases.
3472 list of auto-defined aliases.
3469
3473
3470 2004-06-13 Fernando Perez <fperez@colorado.edu>
3474 2004-06-13 Fernando Perez <fperez@colorado.edu>
3471
3475
3472 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3476 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3473 install was really requested (so setup.py can be used for other
3477 install was really requested (so setup.py can be used for other
3474 things under Windows).
3478 things under Windows).
3475
3479
3476 2004-06-10 Fernando Perez <fperez@colorado.edu>
3480 2004-06-10 Fernando Perez <fperez@colorado.edu>
3477
3481
3478 * IPython/Logger.py (Logger.create_log): Manually remove any old
3482 * IPython/Logger.py (Logger.create_log): Manually remove any old
3479 backup, since os.remove may fail under Windows. Fixes bug
3483 backup, since os.remove may fail under Windows. Fixes bug
3480 reported by Thorsten.
3484 reported by Thorsten.
3481
3485
3482 2004-06-09 Fernando Perez <fperez@colorado.edu>
3486 2004-06-09 Fernando Perez <fperez@colorado.edu>
3483
3487
3484 * examples/example-embed.py: fixed all references to %n (replaced
3488 * examples/example-embed.py: fixed all references to %n (replaced
3485 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3489 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3486 for all examples and the manual as well.
3490 for all examples and the manual as well.
3487
3491
3488 2004-06-08 Fernando Perez <fperez@colorado.edu>
3492 2004-06-08 Fernando Perez <fperez@colorado.edu>
3489
3493
3490 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3494 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3491 alignment and color management. All 3 prompt subsystems now
3495 alignment and color management. All 3 prompt subsystems now
3492 inherit from BasePrompt.
3496 inherit from BasePrompt.
3493
3497
3494 * tools/release: updates for windows installer build and tag rpms
3498 * tools/release: updates for windows installer build and tag rpms
3495 with python version (since paths are fixed).
3499 with python version (since paths are fixed).
3496
3500
3497 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3501 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3498 which will become eventually obsolete. Also fixed the default
3502 which will become eventually obsolete. Also fixed the default
3499 prompt_in2 to use \D, so at least new users start with the correct
3503 prompt_in2 to use \D, so at least new users start with the correct
3500 defaults.
3504 defaults.
3501 WARNING: Users with existing ipythonrc files will need to apply
3505 WARNING: Users with existing ipythonrc files will need to apply
3502 this fix manually!
3506 this fix manually!
3503
3507
3504 * setup.py: make windows installer (.exe). This is finally the
3508 * setup.py: make windows installer (.exe). This is finally the
3505 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3509 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3506 which I hadn't included because it required Python 2.3 (or recent
3510 which I hadn't included because it required Python 2.3 (or recent
3507 distutils).
3511 distutils).
3508
3512
3509 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3513 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3510 usage of new '\D' escape.
3514 usage of new '\D' escape.
3511
3515
3512 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3516 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3513 lacks os.getuid())
3517 lacks os.getuid())
3514 (CachedOutput.set_colors): Added the ability to turn coloring
3518 (CachedOutput.set_colors): Added the ability to turn coloring
3515 on/off with @colors even for manually defined prompt colors. It
3519 on/off with @colors even for manually defined prompt colors. It
3516 uses a nasty global, but it works safely and via the generic color
3520 uses a nasty global, but it works safely and via the generic color
3517 handling mechanism.
3521 handling mechanism.
3518 (Prompt2.__init__): Introduced new escape '\D' for continuation
3522 (Prompt2.__init__): Introduced new escape '\D' for continuation
3519 prompts. It represents the counter ('\#') as dots.
3523 prompts. It represents the counter ('\#') as dots.
3520 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3524 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3521 need to update their ipythonrc files and replace '%n' with '\D' in
3525 need to update their ipythonrc files and replace '%n' with '\D' in
3522 their prompt_in2 settings everywhere. Sorry, but there's
3526 their prompt_in2 settings everywhere. Sorry, but there's
3523 otherwise no clean way to get all prompts to properly align. The
3527 otherwise no clean way to get all prompts to properly align. The
3524 ipythonrc shipped with IPython has been updated.
3528 ipythonrc shipped with IPython has been updated.
3525
3529
3526 2004-06-07 Fernando Perez <fperez@colorado.edu>
3530 2004-06-07 Fernando Perez <fperez@colorado.edu>
3527
3531
3528 * setup.py (isfile): Pass local_icons option to latex2html, so the
3532 * setup.py (isfile): Pass local_icons option to latex2html, so the
3529 resulting HTML file is self-contained. Thanks to
3533 resulting HTML file is self-contained. Thanks to
3530 dryice-AT-liu.com.cn for the tip.
3534 dryice-AT-liu.com.cn for the tip.
3531
3535
3532 * pysh.py: I created a new profile 'shell', which implements a
3536 * pysh.py: I created a new profile 'shell', which implements a
3533 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3537 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3534 system shell, nor will it become one anytime soon. It's mainly
3538 system shell, nor will it become one anytime soon. It's mainly
3535 meant to illustrate the use of the new flexible bash-like prompts.
3539 meant to illustrate the use of the new flexible bash-like prompts.
3536 I guess it could be used by hardy souls for true shell management,
3540 I guess it could be used by hardy souls for true shell management,
3537 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3541 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3538 profile. This uses the InterpreterExec extension provided by
3542 profile. This uses the InterpreterExec extension provided by
3539 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3543 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3540
3544
3541 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3545 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3542 auto-align itself with the length of the previous input prompt
3546 auto-align itself with the length of the previous input prompt
3543 (taking into account the invisible color escapes).
3547 (taking into account the invisible color escapes).
3544 (CachedOutput.__init__): Large restructuring of this class. Now
3548 (CachedOutput.__init__): Large restructuring of this class. Now
3545 all three prompts (primary1, primary2, output) are proper objects,
3549 all three prompts (primary1, primary2, output) are proper objects,
3546 managed by the 'parent' CachedOutput class. The code is still a
3550 managed by the 'parent' CachedOutput class. The code is still a
3547 bit hackish (all prompts share state via a pointer to the cache),
3551 bit hackish (all prompts share state via a pointer to the cache),
3548 but it's overall far cleaner than before.
3552 but it's overall far cleaner than before.
3549
3553
3550 * IPython/genutils.py (getoutputerror): modified to add verbose,
3554 * IPython/genutils.py (getoutputerror): modified to add verbose,
3551 debug and header options. This makes the interface of all getout*
3555 debug and header options. This makes the interface of all getout*
3552 functions uniform.
3556 functions uniform.
3553 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3557 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3554
3558
3555 * IPython/Magic.py (Magic.default_option): added a function to
3559 * IPython/Magic.py (Magic.default_option): added a function to
3556 allow registering default options for any magic command. This
3560 allow registering default options for any magic command. This
3557 makes it easy to have profiles which customize the magics globally
3561 makes it easy to have profiles which customize the magics globally
3558 for a certain use. The values set through this function are
3562 for a certain use. The values set through this function are
3559 picked up by the parse_options() method, which all magics should
3563 picked up by the parse_options() method, which all magics should
3560 use to parse their options.
3564 use to parse their options.
3561
3565
3562 * IPython/genutils.py (warn): modified the warnings framework to
3566 * IPython/genutils.py (warn): modified the warnings framework to
3563 use the Term I/O class. I'm trying to slowly unify all of
3567 use the Term I/O class. I'm trying to slowly unify all of
3564 IPython's I/O operations to pass through Term.
3568 IPython's I/O operations to pass through Term.
3565
3569
3566 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3570 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3567 the secondary prompt to correctly match the length of the primary
3571 the secondary prompt to correctly match the length of the primary
3568 one for any prompt. Now multi-line code will properly line up
3572 one for any prompt. Now multi-line code will properly line up
3569 even for path dependent prompts, such as the new ones available
3573 even for path dependent prompts, such as the new ones available
3570 via the prompt_specials.
3574 via the prompt_specials.
3571
3575
3572 2004-06-06 Fernando Perez <fperez@colorado.edu>
3576 2004-06-06 Fernando Perez <fperez@colorado.edu>
3573
3577
3574 * IPython/Prompts.py (prompt_specials): Added the ability to have
3578 * IPython/Prompts.py (prompt_specials): Added the ability to have
3575 bash-like special sequences in the prompts, which get
3579 bash-like special sequences in the prompts, which get
3576 automatically expanded. Things like hostname, current working
3580 automatically expanded. Things like hostname, current working
3577 directory and username are implemented already, but it's easy to
3581 directory and username are implemented already, but it's easy to
3578 add more in the future. Thanks to a patch by W.J. van der Laan
3582 add more in the future. Thanks to a patch by W.J. van der Laan
3579 <gnufnork-AT-hetdigitalegat.nl>
3583 <gnufnork-AT-hetdigitalegat.nl>
3580 (prompt_specials): Added color support for prompt strings, so
3584 (prompt_specials): Added color support for prompt strings, so
3581 users can define arbitrary color setups for their prompts.
3585 users can define arbitrary color setups for their prompts.
3582
3586
3583 2004-06-05 Fernando Perez <fperez@colorado.edu>
3587 2004-06-05 Fernando Perez <fperez@colorado.edu>
3584
3588
3585 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3589 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3586 code to load Gary Bishop's readline and configure it
3590 code to load Gary Bishop's readline and configure it
3587 automatically. Thanks to Gary for help on this.
3591 automatically. Thanks to Gary for help on this.
3588
3592
3589 2004-06-01 Fernando Perez <fperez@colorado.edu>
3593 2004-06-01 Fernando Perez <fperez@colorado.edu>
3590
3594
3591 * IPython/Logger.py (Logger.create_log): fix bug for logging
3595 * IPython/Logger.py (Logger.create_log): fix bug for logging
3592 with no filename (previous fix was incomplete).
3596 with no filename (previous fix was incomplete).
3593
3597
3594 2004-05-25 Fernando Perez <fperez@colorado.edu>
3598 2004-05-25 Fernando Perez <fperez@colorado.edu>
3595
3599
3596 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3600 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3597 parens would get passed to the shell.
3601 parens would get passed to the shell.
3598
3602
3599 2004-05-20 Fernando Perez <fperez@colorado.edu>
3603 2004-05-20 Fernando Perez <fperez@colorado.edu>
3600
3604
3601 * IPython/Magic.py (Magic.magic_prun): changed default profile
3605 * IPython/Magic.py (Magic.magic_prun): changed default profile
3602 sort order to 'time' (the more common profiling need).
3606 sort order to 'time' (the more common profiling need).
3603
3607
3604 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3608 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3605 so that source code shown is guaranteed in sync with the file on
3609 so that source code shown is guaranteed in sync with the file on
3606 disk (also changed in psource). Similar fix to the one for
3610 disk (also changed in psource). Similar fix to the one for
3607 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3611 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3608 <yann.ledu-AT-noos.fr>.
3612 <yann.ledu-AT-noos.fr>.
3609
3613
3610 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3614 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3611 with a single option would not be correctly parsed. Closes
3615 with a single option would not be correctly parsed. Closes
3612 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3616 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3613 introduced in 0.6.0 (on 2004-05-06).
3617 introduced in 0.6.0 (on 2004-05-06).
3614
3618
3615 2004-05-13 *** Released version 0.6.0
3619 2004-05-13 *** Released version 0.6.0
3616
3620
3617 2004-05-13 Fernando Perez <fperez@colorado.edu>
3621 2004-05-13 Fernando Perez <fperez@colorado.edu>
3618
3622
3619 * debian/: Added debian/ directory to CVS, so that debian support
3623 * debian/: Added debian/ directory to CVS, so that debian support
3620 is publicly accessible. The debian package is maintained by Jack
3624 is publicly accessible. The debian package is maintained by Jack
3621 Moffit <jack-AT-xiph.org>.
3625 Moffit <jack-AT-xiph.org>.
3622
3626
3623 * Documentation: included the notes about an ipython-based system
3627 * Documentation: included the notes about an ipython-based system
3624 shell (the hypothetical 'pysh') into the new_design.pdf document,
3628 shell (the hypothetical 'pysh') into the new_design.pdf document,
3625 so that these ideas get distributed to users along with the
3629 so that these ideas get distributed to users along with the
3626 official documentation.
3630 official documentation.
3627
3631
3628 2004-05-10 Fernando Perez <fperez@colorado.edu>
3632 2004-05-10 Fernando Perez <fperez@colorado.edu>
3629
3633
3630 * IPython/Logger.py (Logger.create_log): fix recently introduced
3634 * IPython/Logger.py (Logger.create_log): fix recently introduced
3631 bug (misindented line) where logstart would fail when not given an
3635 bug (misindented line) where logstart would fail when not given an
3632 explicit filename.
3636 explicit filename.
3633
3637
3634 2004-05-09 Fernando Perez <fperez@colorado.edu>
3638 2004-05-09 Fernando Perez <fperez@colorado.edu>
3635
3639
3636 * IPython/Magic.py (Magic.parse_options): skip system call when
3640 * IPython/Magic.py (Magic.parse_options): skip system call when
3637 there are no options to look for. Faster, cleaner for the common
3641 there are no options to look for. Faster, cleaner for the common
3638 case.
3642 case.
3639
3643
3640 * Documentation: many updates to the manual: describing Windows
3644 * Documentation: many updates to the manual: describing Windows
3641 support better, Gnuplot updates, credits, misc small stuff. Also
3645 support better, Gnuplot updates, credits, misc small stuff. Also
3642 updated the new_design doc a bit.
3646 updated the new_design doc a bit.
3643
3647
3644 2004-05-06 *** Released version 0.6.0.rc1
3648 2004-05-06 *** Released version 0.6.0.rc1
3645
3649
3646 2004-05-06 Fernando Perez <fperez@colorado.edu>
3650 2004-05-06 Fernando Perez <fperez@colorado.edu>
3647
3651
3648 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3652 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3649 operations to use the vastly more efficient list/''.join() method.
3653 operations to use the vastly more efficient list/''.join() method.
3650 (FormattedTB.text): Fix
3654 (FormattedTB.text): Fix
3651 http://www.scipy.net/roundup/ipython/issue12 - exception source
3655 http://www.scipy.net/roundup/ipython/issue12 - exception source
3652 extract not updated after reload. Thanks to Mike Salib
3656 extract not updated after reload. Thanks to Mike Salib
3653 <msalib-AT-mit.edu> for pinning the source of the problem.
3657 <msalib-AT-mit.edu> for pinning the source of the problem.
3654 Fortunately, the solution works inside ipython and doesn't require
3658 Fortunately, the solution works inside ipython and doesn't require
3655 any changes to python proper.
3659 any changes to python proper.
3656
3660
3657 * IPython/Magic.py (Magic.parse_options): Improved to process the
3661 * IPython/Magic.py (Magic.parse_options): Improved to process the
3658 argument list as a true shell would (by actually using the
3662 argument list as a true shell would (by actually using the
3659 underlying system shell). This way, all @magics automatically get
3663 underlying system shell). This way, all @magics automatically get
3660 shell expansion for variables. Thanks to a comment by Alex
3664 shell expansion for variables. Thanks to a comment by Alex
3661 Schmolck.
3665 Schmolck.
3662
3666
3663 2004-04-04 Fernando Perez <fperez@colorado.edu>
3667 2004-04-04 Fernando Perez <fperez@colorado.edu>
3664
3668
3665 * IPython/iplib.py (InteractiveShell.interact): Added a special
3669 * IPython/iplib.py (InteractiveShell.interact): Added a special
3666 trap for a debugger quit exception, which is basically impossible
3670 trap for a debugger quit exception, which is basically impossible
3667 to handle by normal mechanisms, given what pdb does to the stack.
3671 to handle by normal mechanisms, given what pdb does to the stack.
3668 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3672 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3669
3673
3670 2004-04-03 Fernando Perez <fperez@colorado.edu>
3674 2004-04-03 Fernando Perez <fperez@colorado.edu>
3671
3675
3672 * IPython/genutils.py (Term): Standardized the names of the Term
3676 * IPython/genutils.py (Term): Standardized the names of the Term
3673 class streams to cin/cout/cerr, following C++ naming conventions
3677 class streams to cin/cout/cerr, following C++ naming conventions
3674 (I can't use in/out/err because 'in' is not a valid attribute
3678 (I can't use in/out/err because 'in' is not a valid attribute
3675 name).
3679 name).
3676
3680
3677 * IPython/iplib.py (InteractiveShell.interact): don't increment
3681 * IPython/iplib.py (InteractiveShell.interact): don't increment
3678 the prompt if there's no user input. By Daniel 'Dang' Griffith
3682 the prompt if there's no user input. By Daniel 'Dang' Griffith
3679 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3683 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3680 Francois Pinard.
3684 Francois Pinard.
3681
3685
3682 2004-04-02 Fernando Perez <fperez@colorado.edu>
3686 2004-04-02 Fernando Perez <fperez@colorado.edu>
3683
3687
3684 * IPython/genutils.py (Stream.__init__): Modified to survive at
3688 * IPython/genutils.py (Stream.__init__): Modified to survive at
3685 least importing in contexts where stdin/out/err aren't true file
3689 least importing in contexts where stdin/out/err aren't true file
3686 objects, such as PyCrust (they lack fileno() and mode). However,
3690 objects, such as PyCrust (they lack fileno() and mode). However,
3687 the recovery facilities which rely on these things existing will
3691 the recovery facilities which rely on these things existing will
3688 not work.
3692 not work.
3689
3693
3690 2004-04-01 Fernando Perez <fperez@colorado.edu>
3694 2004-04-01 Fernando Perez <fperez@colorado.edu>
3691
3695
3692 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3696 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3693 use the new getoutputerror() function, so it properly
3697 use the new getoutputerror() function, so it properly
3694 distinguishes stdout/err.
3698 distinguishes stdout/err.
3695
3699
3696 * IPython/genutils.py (getoutputerror): added a function to
3700 * IPython/genutils.py (getoutputerror): added a function to
3697 capture separately the standard output and error of a command.
3701 capture separately the standard output and error of a command.
3698 After a comment from dang on the mailing lists. This code is
3702 After a comment from dang on the mailing lists. This code is
3699 basically a modified version of commands.getstatusoutput(), from
3703 basically a modified version of commands.getstatusoutput(), from
3700 the standard library.
3704 the standard library.
3701
3705
3702 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3706 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3703 '!!' as a special syntax (shorthand) to access @sx.
3707 '!!' as a special syntax (shorthand) to access @sx.
3704
3708
3705 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3709 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3706 command and return its output as a list split on '\n'.
3710 command and return its output as a list split on '\n'.
3707
3711
3708 2004-03-31 Fernando Perez <fperez@colorado.edu>
3712 2004-03-31 Fernando Perez <fperez@colorado.edu>
3709
3713
3710 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3714 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3711 method to dictionaries used as FakeModule instances if they lack
3715 method to dictionaries used as FakeModule instances if they lack
3712 it. At least pydoc in python2.3 breaks for runtime-defined
3716 it. At least pydoc in python2.3 breaks for runtime-defined
3713 functions without this hack. At some point I need to _really_
3717 functions without this hack. At some point I need to _really_
3714 understand what FakeModule is doing, because it's a gross hack.
3718 understand what FakeModule is doing, because it's a gross hack.
3715 But it solves Arnd's problem for now...
3719 But it solves Arnd's problem for now...
3716
3720
3717 2004-02-27 Fernando Perez <fperez@colorado.edu>
3721 2004-02-27 Fernando Perez <fperez@colorado.edu>
3718
3722
3719 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3723 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3720 mode would behave erratically. Also increased the number of
3724 mode would behave erratically. Also increased the number of
3721 possible logs in rotate mod to 999. Thanks to Rod Holland
3725 possible logs in rotate mod to 999. Thanks to Rod Holland
3722 <rhh@StructureLABS.com> for the report and fixes.
3726 <rhh@StructureLABS.com> for the report and fixes.
3723
3727
3724 2004-02-26 Fernando Perez <fperez@colorado.edu>
3728 2004-02-26 Fernando Perez <fperez@colorado.edu>
3725
3729
3726 * IPython/genutils.py (page): Check that the curses module really
3730 * IPython/genutils.py (page): Check that the curses module really
3727 has the initscr attribute before trying to use it. For some
3731 has the initscr attribute before trying to use it. For some
3728 reason, the Solaris curses module is missing this. I think this
3732 reason, the Solaris curses module is missing this. I think this
3729 should be considered a Solaris python bug, but I'm not sure.
3733 should be considered a Solaris python bug, but I'm not sure.
3730
3734
3731 2004-01-17 Fernando Perez <fperez@colorado.edu>
3735 2004-01-17 Fernando Perez <fperez@colorado.edu>
3732
3736
3733 * IPython/genutils.py (Stream.__init__): Changes to try to make
3737 * IPython/genutils.py (Stream.__init__): Changes to try to make
3734 ipython robust against stdin/out/err being closed by the user.
3738 ipython robust against stdin/out/err being closed by the user.
3735 This is 'user error' (and blocks a normal python session, at least
3739 This is 'user error' (and blocks a normal python session, at least
3736 the stdout case). However, Ipython should be able to survive such
3740 the stdout case). However, Ipython should be able to survive such
3737 instances of abuse as gracefully as possible. To simplify the
3741 instances of abuse as gracefully as possible. To simplify the
3738 coding and maintain compatibility with Gary Bishop's Term
3742 coding and maintain compatibility with Gary Bishop's Term
3739 contributions, I've made use of classmethods for this. I think
3743 contributions, I've made use of classmethods for this. I think
3740 this introduces a dependency on python 2.2.
3744 this introduces a dependency on python 2.2.
3741
3745
3742 2004-01-13 Fernando Perez <fperez@colorado.edu>
3746 2004-01-13 Fernando Perez <fperez@colorado.edu>
3743
3747
3744 * IPython/numutils.py (exp_safe): simplified the code a bit and
3748 * IPython/numutils.py (exp_safe): simplified the code a bit and
3745 removed the need for importing the kinds module altogether.
3749 removed the need for importing the kinds module altogether.
3746
3750
3747 2004-01-06 Fernando Perez <fperez@colorado.edu>
3751 2004-01-06 Fernando Perez <fperez@colorado.edu>
3748
3752
3749 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3753 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3750 a magic function instead, after some community feedback. No
3754 a magic function instead, after some community feedback. No
3751 special syntax will exist for it, but its name is deliberately
3755 special syntax will exist for it, but its name is deliberately
3752 very short.
3756 very short.
3753
3757
3754 2003-12-20 Fernando Perez <fperez@colorado.edu>
3758 2003-12-20 Fernando Perez <fperez@colorado.edu>
3755
3759
3756 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3760 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3757 new functionality, to automagically assign the result of a shell
3761 new functionality, to automagically assign the result of a shell
3758 command to a variable. I'll solicit some community feedback on
3762 command to a variable. I'll solicit some community feedback on
3759 this before making it permanent.
3763 this before making it permanent.
3760
3764
3761 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3765 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3762 requested about callables for which inspect couldn't obtain a
3766 requested about callables for which inspect couldn't obtain a
3763 proper argspec. Thanks to a crash report sent by Etienne
3767 proper argspec. Thanks to a crash report sent by Etienne
3764 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3768 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3765
3769
3766 2003-12-09 Fernando Perez <fperez@colorado.edu>
3770 2003-12-09 Fernando Perez <fperez@colorado.edu>
3767
3771
3768 * IPython/genutils.py (page): patch for the pager to work across
3772 * IPython/genutils.py (page): patch for the pager to work across
3769 various versions of Windows. By Gary Bishop.
3773 various versions of Windows. By Gary Bishop.
3770
3774
3771 2003-12-04 Fernando Perez <fperez@colorado.edu>
3775 2003-12-04 Fernando Perez <fperez@colorado.edu>
3772
3776
3773 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3777 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3774 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3778 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3775 While I tested this and it looks ok, there may still be corner
3779 While I tested this and it looks ok, there may still be corner
3776 cases I've missed.
3780 cases I've missed.
3777
3781
3778 2003-12-01 Fernando Perez <fperez@colorado.edu>
3782 2003-12-01 Fernando Perez <fperez@colorado.edu>
3779
3783
3780 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3784 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3781 where a line like 'p,q=1,2' would fail because the automagic
3785 where a line like 'p,q=1,2' would fail because the automagic
3782 system would be triggered for @p.
3786 system would be triggered for @p.
3783
3787
3784 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3788 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3785 cleanups, code unmodified.
3789 cleanups, code unmodified.
3786
3790
3787 * IPython/genutils.py (Term): added a class for IPython to handle
3791 * IPython/genutils.py (Term): added a class for IPython to handle
3788 output. In most cases it will just be a proxy for stdout/err, but
3792 output. In most cases it will just be a proxy for stdout/err, but
3789 having this allows modifications to be made for some platforms,
3793 having this allows modifications to be made for some platforms,
3790 such as handling color escapes under Windows. All of this code
3794 such as handling color escapes under Windows. All of this code
3791 was contributed by Gary Bishop, with minor modifications by me.
3795 was contributed by Gary Bishop, with minor modifications by me.
3792 The actual changes affect many files.
3796 The actual changes affect many files.
3793
3797
3794 2003-11-30 Fernando Perez <fperez@colorado.edu>
3798 2003-11-30 Fernando Perez <fperez@colorado.edu>
3795
3799
3796 * IPython/iplib.py (file_matches): new completion code, courtesy
3800 * IPython/iplib.py (file_matches): new completion code, courtesy
3797 of Jeff Collins. This enables filename completion again under
3801 of Jeff Collins. This enables filename completion again under
3798 python 2.3, which disabled it at the C level.
3802 python 2.3, which disabled it at the C level.
3799
3803
3800 2003-11-11 Fernando Perez <fperez@colorado.edu>
3804 2003-11-11 Fernando Perez <fperez@colorado.edu>
3801
3805
3802 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3806 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3803 for Numeric.array(map(...)), but often convenient.
3807 for Numeric.array(map(...)), but often convenient.
3804
3808
3805 2003-11-05 Fernando Perez <fperez@colorado.edu>
3809 2003-11-05 Fernando Perez <fperez@colorado.edu>
3806
3810
3807 * IPython/numutils.py (frange): Changed a call from int() to
3811 * IPython/numutils.py (frange): Changed a call from int() to
3808 int(round()) to prevent a problem reported with arange() in the
3812 int(round()) to prevent a problem reported with arange() in the
3809 numpy list.
3813 numpy list.
3810
3814
3811 2003-10-06 Fernando Perez <fperez@colorado.edu>
3815 2003-10-06 Fernando Perez <fperez@colorado.edu>
3812
3816
3813 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3817 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3814 prevent crashes if sys lacks an argv attribute (it happens with
3818 prevent crashes if sys lacks an argv attribute (it happens with
3815 embedded interpreters which build a bare-bones sys module).
3819 embedded interpreters which build a bare-bones sys module).
3816 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3820 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3817
3821
3818 2003-09-24 Fernando Perez <fperez@colorado.edu>
3822 2003-09-24 Fernando Perez <fperez@colorado.edu>
3819
3823
3820 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3824 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3821 to protect against poorly written user objects where __getattr__
3825 to protect against poorly written user objects where __getattr__
3822 raises exceptions other than AttributeError. Thanks to a bug
3826 raises exceptions other than AttributeError. Thanks to a bug
3823 report by Oliver Sander <osander-AT-gmx.de>.
3827 report by Oliver Sander <osander-AT-gmx.de>.
3824
3828
3825 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3829 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3826 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3830 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3827
3831
3828 2003-09-09 Fernando Perez <fperez@colorado.edu>
3832 2003-09-09 Fernando Perez <fperez@colorado.edu>
3829
3833
3830 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3834 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3831 unpacking a list whith a callable as first element would
3835 unpacking a list whith a callable as first element would
3832 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3836 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3833 Collins.
3837 Collins.
3834
3838
3835 2003-08-25 *** Released version 0.5.0
3839 2003-08-25 *** Released version 0.5.0
3836
3840
3837 2003-08-22 Fernando Perez <fperez@colorado.edu>
3841 2003-08-22 Fernando Perez <fperez@colorado.edu>
3838
3842
3839 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3843 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3840 improperly defined user exceptions. Thanks to feedback from Mark
3844 improperly defined user exceptions. Thanks to feedback from Mark
3841 Russell <mrussell-AT-verio.net>.
3845 Russell <mrussell-AT-verio.net>.
3842
3846
3843 2003-08-20 Fernando Perez <fperez@colorado.edu>
3847 2003-08-20 Fernando Perez <fperez@colorado.edu>
3844
3848
3845 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3849 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3846 printing so that it would print multi-line string forms starting
3850 printing so that it would print multi-line string forms starting
3847 with a new line. This way the formatting is better respected for
3851 with a new line. This way the formatting is better respected for
3848 objects which work hard to make nice string forms.
3852 objects which work hard to make nice string forms.
3849
3853
3850 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3854 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3851 autocall would overtake data access for objects with both
3855 autocall would overtake data access for objects with both
3852 __getitem__ and __call__.
3856 __getitem__ and __call__.
3853
3857
3854 2003-08-19 *** Released version 0.5.0-rc1
3858 2003-08-19 *** Released version 0.5.0-rc1
3855
3859
3856 2003-08-19 Fernando Perez <fperez@colorado.edu>
3860 2003-08-19 Fernando Perez <fperez@colorado.edu>
3857
3861
3858 * IPython/deep_reload.py (load_tail): single tiny change here
3862 * IPython/deep_reload.py (load_tail): single tiny change here
3859 seems to fix the long-standing bug of dreload() failing to work
3863 seems to fix the long-standing bug of dreload() failing to work
3860 for dotted names. But this module is pretty tricky, so I may have
3864 for dotted names. But this module is pretty tricky, so I may have
3861 missed some subtlety. Needs more testing!.
3865 missed some subtlety. Needs more testing!.
3862
3866
3863 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3867 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3864 exceptions which have badly implemented __str__ methods.
3868 exceptions which have badly implemented __str__ methods.
3865 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3869 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3866 which I've been getting reports about from Python 2.3 users. I
3870 which I've been getting reports about from Python 2.3 users. I
3867 wish I had a simple test case to reproduce the problem, so I could
3871 wish I had a simple test case to reproduce the problem, so I could
3868 either write a cleaner workaround or file a bug report if
3872 either write a cleaner workaround or file a bug report if
3869 necessary.
3873 necessary.
3870
3874
3871 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3875 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3872 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3876 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3873 a bug report by Tjabo Kloppenburg.
3877 a bug report by Tjabo Kloppenburg.
3874
3878
3875 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3879 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3876 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3880 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3877 seems rather unstable. Thanks to a bug report by Tjabo
3881 seems rather unstable. Thanks to a bug report by Tjabo
3878 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3882 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3879
3883
3880 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3884 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3881 this out soon because of the critical fixes in the inner loop for
3885 this out soon because of the critical fixes in the inner loop for
3882 generators.
3886 generators.
3883
3887
3884 * IPython/Magic.py (Magic.getargspec): removed. This (and
3888 * IPython/Magic.py (Magic.getargspec): removed. This (and
3885 _get_def) have been obsoleted by OInspect for a long time, I
3889 _get_def) have been obsoleted by OInspect for a long time, I
3886 hadn't noticed that they were dead code.
3890 hadn't noticed that they were dead code.
3887 (Magic._ofind): restored _ofind functionality for a few literals
3891 (Magic._ofind): restored _ofind functionality for a few literals
3888 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3892 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3889 for things like "hello".capitalize?, since that would require a
3893 for things like "hello".capitalize?, since that would require a
3890 potentially dangerous eval() again.
3894 potentially dangerous eval() again.
3891
3895
3892 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3896 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3893 logic a bit more to clean up the escapes handling and minimize the
3897 logic a bit more to clean up the escapes handling and minimize the
3894 use of _ofind to only necessary cases. The interactive 'feel' of
3898 use of _ofind to only necessary cases. The interactive 'feel' of
3895 IPython should have improved quite a bit with the changes in
3899 IPython should have improved quite a bit with the changes in
3896 _prefilter and _ofind (besides being far safer than before).
3900 _prefilter and _ofind (besides being far safer than before).
3897
3901
3898 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3902 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3899 obscure, never reported). Edit would fail to find the object to
3903 obscure, never reported). Edit would fail to find the object to
3900 edit under some circumstances.
3904 edit under some circumstances.
3901 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3905 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3902 which were causing double-calling of generators. Those eval calls
3906 which were causing double-calling of generators. Those eval calls
3903 were _very_ dangerous, since code with side effects could be
3907 were _very_ dangerous, since code with side effects could be
3904 triggered. As they say, 'eval is evil'... These were the
3908 triggered. As they say, 'eval is evil'... These were the
3905 nastiest evals in IPython. Besides, _ofind is now far simpler,
3909 nastiest evals in IPython. Besides, _ofind is now far simpler,
3906 and it should also be quite a bit faster. Its use of inspect is
3910 and it should also be quite a bit faster. Its use of inspect is
3907 also safer, so perhaps some of the inspect-related crashes I've
3911 also safer, so perhaps some of the inspect-related crashes I've
3908 seen lately with Python 2.3 might be taken care of. That will
3912 seen lately with Python 2.3 might be taken care of. That will
3909 need more testing.
3913 need more testing.
3910
3914
3911 2003-08-17 Fernando Perez <fperez@colorado.edu>
3915 2003-08-17 Fernando Perez <fperez@colorado.edu>
3912
3916
3913 * IPython/iplib.py (InteractiveShell._prefilter): significant
3917 * IPython/iplib.py (InteractiveShell._prefilter): significant
3914 simplifications to the logic for handling user escapes. Faster
3918 simplifications to the logic for handling user escapes. Faster
3915 and simpler code.
3919 and simpler code.
3916
3920
3917 2003-08-14 Fernando Perez <fperez@colorado.edu>
3921 2003-08-14 Fernando Perez <fperez@colorado.edu>
3918
3922
3919 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3923 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3920 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3924 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3921 but it should be quite a bit faster. And the recursive version
3925 but it should be quite a bit faster. And the recursive version
3922 generated O(log N) intermediate storage for all rank>1 arrays,
3926 generated O(log N) intermediate storage for all rank>1 arrays,
3923 even if they were contiguous.
3927 even if they were contiguous.
3924 (l1norm): Added this function.
3928 (l1norm): Added this function.
3925 (norm): Added this function for arbitrary norms (including
3929 (norm): Added this function for arbitrary norms (including
3926 l-infinity). l1 and l2 are still special cases for convenience
3930 l-infinity). l1 and l2 are still special cases for convenience
3927 and speed.
3931 and speed.
3928
3932
3929 2003-08-03 Fernando Perez <fperez@colorado.edu>
3933 2003-08-03 Fernando Perez <fperez@colorado.edu>
3930
3934
3931 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3935 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3932 exceptions, which now raise PendingDeprecationWarnings in Python
3936 exceptions, which now raise PendingDeprecationWarnings in Python
3933 2.3. There were some in Magic and some in Gnuplot2.
3937 2.3. There were some in Magic and some in Gnuplot2.
3934
3938
3935 2003-06-30 Fernando Perez <fperez@colorado.edu>
3939 2003-06-30 Fernando Perez <fperez@colorado.edu>
3936
3940
3937 * IPython/genutils.py (page): modified to call curses only for
3941 * IPython/genutils.py (page): modified to call curses only for
3938 terminals where TERM=='xterm'. After problems under many other
3942 terminals where TERM=='xterm'. After problems under many other
3939 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3943 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3940
3944
3941 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3945 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3942 would be triggered when readline was absent. This was just an old
3946 would be triggered when readline was absent. This was just an old
3943 debugging statement I'd forgotten to take out.
3947 debugging statement I'd forgotten to take out.
3944
3948
3945 2003-06-20 Fernando Perez <fperez@colorado.edu>
3949 2003-06-20 Fernando Perez <fperez@colorado.edu>
3946
3950
3947 * IPython/genutils.py (clock): modified to return only user time
3951 * IPython/genutils.py (clock): modified to return only user time
3948 (not counting system time), after a discussion on scipy. While
3952 (not counting system time), after a discussion on scipy. While
3949 system time may be a useful quantity occasionally, it may much
3953 system time may be a useful quantity occasionally, it may much
3950 more easily be skewed by occasional swapping or other similar
3954 more easily be skewed by occasional swapping or other similar
3951 activity.
3955 activity.
3952
3956
3953 2003-06-05 Fernando Perez <fperez@colorado.edu>
3957 2003-06-05 Fernando Perez <fperez@colorado.edu>
3954
3958
3955 * IPython/numutils.py (identity): new function, for building
3959 * IPython/numutils.py (identity): new function, for building
3956 arbitrary rank Kronecker deltas (mostly backwards compatible with
3960 arbitrary rank Kronecker deltas (mostly backwards compatible with
3957 Numeric.identity)
3961 Numeric.identity)
3958
3962
3959 2003-06-03 Fernando Perez <fperez@colorado.edu>
3963 2003-06-03 Fernando Perez <fperez@colorado.edu>
3960
3964
3961 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3965 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3962 arguments passed to magics with spaces, to allow trailing '\' to
3966 arguments passed to magics with spaces, to allow trailing '\' to
3963 work normally (mainly for Windows users).
3967 work normally (mainly for Windows users).
3964
3968
3965 2003-05-29 Fernando Perez <fperez@colorado.edu>
3969 2003-05-29 Fernando Perez <fperez@colorado.edu>
3966
3970
3967 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3971 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3968 instead of pydoc.help. This fixes a bizarre behavior where
3972 instead of pydoc.help. This fixes a bizarre behavior where
3969 printing '%s' % locals() would trigger the help system. Now
3973 printing '%s' % locals() would trigger the help system. Now
3970 ipython behaves like normal python does.
3974 ipython behaves like normal python does.
3971
3975
3972 Note that if one does 'from pydoc import help', the bizarre
3976 Note that if one does 'from pydoc import help', the bizarre
3973 behavior returns, but this will also happen in normal python, so
3977 behavior returns, but this will also happen in normal python, so
3974 it's not an ipython bug anymore (it has to do with how pydoc.help
3978 it's not an ipython bug anymore (it has to do with how pydoc.help
3975 is implemented).
3979 is implemented).
3976
3980
3977 2003-05-22 Fernando Perez <fperez@colorado.edu>
3981 2003-05-22 Fernando Perez <fperez@colorado.edu>
3978
3982
3979 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3983 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3980 return [] instead of None when nothing matches, also match to end
3984 return [] instead of None when nothing matches, also match to end
3981 of line. Patch by Gary Bishop.
3985 of line. Patch by Gary Bishop.
3982
3986
3983 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3987 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3984 protection as before, for files passed on the command line. This
3988 protection as before, for files passed on the command line. This
3985 prevents the CrashHandler from kicking in if user files call into
3989 prevents the CrashHandler from kicking in if user files call into
3986 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3990 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3987 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3991 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3988
3992
3989 2003-05-20 *** Released version 0.4.0
3993 2003-05-20 *** Released version 0.4.0
3990
3994
3991 2003-05-20 Fernando Perez <fperez@colorado.edu>
3995 2003-05-20 Fernando Perez <fperez@colorado.edu>
3992
3996
3993 * setup.py: added support for manpages. It's a bit hackish b/c of
3997 * setup.py: added support for manpages. It's a bit hackish b/c of
3994 a bug in the way the bdist_rpm distutils target handles gzipped
3998 a bug in the way the bdist_rpm distutils target handles gzipped
3995 manpages, but it works. After a patch by Jack.
3999 manpages, but it works. After a patch by Jack.
3996
4000
3997 2003-05-19 Fernando Perez <fperez@colorado.edu>
4001 2003-05-19 Fernando Perez <fperez@colorado.edu>
3998
4002
3999 * IPython/numutils.py: added a mockup of the kinds module, since
4003 * IPython/numutils.py: added a mockup of the kinds module, since
4000 it was recently removed from Numeric. This way, numutils will
4004 it was recently removed from Numeric. This way, numutils will
4001 work for all users even if they are missing kinds.
4005 work for all users even if they are missing kinds.
4002
4006
4003 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4007 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4004 failure, which can occur with SWIG-wrapped extensions. After a
4008 failure, which can occur with SWIG-wrapped extensions. After a
4005 crash report from Prabhu.
4009 crash report from Prabhu.
4006
4010
4007 2003-05-16 Fernando Perez <fperez@colorado.edu>
4011 2003-05-16 Fernando Perez <fperez@colorado.edu>
4008
4012
4009 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4013 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4010 protect ipython from user code which may call directly
4014 protect ipython from user code which may call directly
4011 sys.excepthook (this looks like an ipython crash to the user, even
4015 sys.excepthook (this looks like an ipython crash to the user, even
4012 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4016 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4013 This is especially important to help users of WxWindows, but may
4017 This is especially important to help users of WxWindows, but may
4014 also be useful in other cases.
4018 also be useful in other cases.
4015
4019
4016 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4020 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4017 an optional tb_offset to be specified, and to preserve exception
4021 an optional tb_offset to be specified, and to preserve exception
4018 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4022 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4019
4023
4020 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4024 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4021
4025
4022 2003-05-15 Fernando Perez <fperez@colorado.edu>
4026 2003-05-15 Fernando Perez <fperez@colorado.edu>
4023
4027
4024 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4028 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4025 installing for a new user under Windows.
4029 installing for a new user under Windows.
4026
4030
4027 2003-05-12 Fernando Perez <fperez@colorado.edu>
4031 2003-05-12 Fernando Perez <fperez@colorado.edu>
4028
4032
4029 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4033 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4030 handler for Emacs comint-based lines. Currently it doesn't do
4034 handler for Emacs comint-based lines. Currently it doesn't do
4031 much (but importantly, it doesn't update the history cache). In
4035 much (but importantly, it doesn't update the history cache). In
4032 the future it may be expanded if Alex needs more functionality
4036 the future it may be expanded if Alex needs more functionality
4033 there.
4037 there.
4034
4038
4035 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4039 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4036 info to crash reports.
4040 info to crash reports.
4037
4041
4038 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4042 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4039 just like Python's -c. Also fixed crash with invalid -color
4043 just like Python's -c. Also fixed crash with invalid -color
4040 option value at startup. Thanks to Will French
4044 option value at startup. Thanks to Will French
4041 <wfrench-AT-bestweb.net> for the bug report.
4045 <wfrench-AT-bestweb.net> for the bug report.
4042
4046
4043 2003-05-09 Fernando Perez <fperez@colorado.edu>
4047 2003-05-09 Fernando Perez <fperez@colorado.edu>
4044
4048
4045 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4049 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4046 to EvalDict (it's a mapping, after all) and simplified its code
4050 to EvalDict (it's a mapping, after all) and simplified its code
4047 quite a bit, after a nice discussion on c.l.py where Gustavo
4051 quite a bit, after a nice discussion on c.l.py where Gustavo
4048 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4052 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4049
4053
4050 2003-04-30 Fernando Perez <fperez@colorado.edu>
4054 2003-04-30 Fernando Perez <fperez@colorado.edu>
4051
4055
4052 * IPython/genutils.py (timings_out): modified it to reduce its
4056 * IPython/genutils.py (timings_out): modified it to reduce its
4053 overhead in the common reps==1 case.
4057 overhead in the common reps==1 case.
4054
4058
4055 2003-04-29 Fernando Perez <fperez@colorado.edu>
4059 2003-04-29 Fernando Perez <fperez@colorado.edu>
4056
4060
4057 * IPython/genutils.py (timings_out): Modified to use the resource
4061 * IPython/genutils.py (timings_out): Modified to use the resource
4058 module, which avoids the wraparound problems of time.clock().
4062 module, which avoids the wraparound problems of time.clock().
4059
4063
4060 2003-04-17 *** Released version 0.2.15pre4
4064 2003-04-17 *** Released version 0.2.15pre4
4061
4065
4062 2003-04-17 Fernando Perez <fperez@colorado.edu>
4066 2003-04-17 Fernando Perez <fperez@colorado.edu>
4063
4067
4064 * setup.py (scriptfiles): Split windows-specific stuff over to a
4068 * setup.py (scriptfiles): Split windows-specific stuff over to a
4065 separate file, in an attempt to have a Windows GUI installer.
4069 separate file, in an attempt to have a Windows GUI installer.
4066 That didn't work, but part of the groundwork is done.
4070 That didn't work, but part of the groundwork is done.
4067
4071
4068 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4072 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4069 indent/unindent with 4 spaces. Particularly useful in combination
4073 indent/unindent with 4 spaces. Particularly useful in combination
4070 with the new auto-indent option.
4074 with the new auto-indent option.
4071
4075
4072 2003-04-16 Fernando Perez <fperez@colorado.edu>
4076 2003-04-16 Fernando Perez <fperez@colorado.edu>
4073
4077
4074 * IPython/Magic.py: various replacements of self.rc for
4078 * IPython/Magic.py: various replacements of self.rc for
4075 self.shell.rc. A lot more remains to be done to fully disentangle
4079 self.shell.rc. A lot more remains to be done to fully disentangle
4076 this class from the main Shell class.
4080 this class from the main Shell class.
4077
4081
4078 * IPython/GnuplotRuntime.py: added checks for mouse support so
4082 * IPython/GnuplotRuntime.py: added checks for mouse support so
4079 that we don't try to enable it if the current gnuplot doesn't
4083 that we don't try to enable it if the current gnuplot doesn't
4080 really support it. Also added checks so that we don't try to
4084 really support it. Also added checks so that we don't try to
4081 enable persist under Windows (where Gnuplot doesn't recognize the
4085 enable persist under Windows (where Gnuplot doesn't recognize the
4082 option).
4086 option).
4083
4087
4084 * IPython/iplib.py (InteractiveShell.interact): Added optional
4088 * IPython/iplib.py (InteractiveShell.interact): Added optional
4085 auto-indenting code, after a patch by King C. Shu
4089 auto-indenting code, after a patch by King C. Shu
4086 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4090 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4087 get along well with pasting indented code. If I ever figure out
4091 get along well with pasting indented code. If I ever figure out
4088 how to make that part go well, it will become on by default.
4092 how to make that part go well, it will become on by default.
4089
4093
4090 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4094 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4091 crash ipython if there was an unmatched '%' in the user's prompt
4095 crash ipython if there was an unmatched '%' in the user's prompt
4092 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4096 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4093
4097
4094 * IPython/iplib.py (InteractiveShell.interact): removed the
4098 * IPython/iplib.py (InteractiveShell.interact): removed the
4095 ability to ask the user whether he wants to crash or not at the
4099 ability to ask the user whether he wants to crash or not at the
4096 'last line' exception handler. Calling functions at that point
4100 'last line' exception handler. Calling functions at that point
4097 changes the stack, and the error reports would have incorrect
4101 changes the stack, and the error reports would have incorrect
4098 tracebacks.
4102 tracebacks.
4099
4103
4100 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4104 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4101 pass through a peger a pretty-printed form of any object. After a
4105 pass through a peger a pretty-printed form of any object. After a
4102 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4106 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4103
4107
4104 2003-04-14 Fernando Perez <fperez@colorado.edu>
4108 2003-04-14 Fernando Perez <fperez@colorado.edu>
4105
4109
4106 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4110 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4107 all files in ~ would be modified at first install (instead of
4111 all files in ~ would be modified at first install (instead of
4108 ~/.ipython). This could be potentially disastrous, as the
4112 ~/.ipython). This could be potentially disastrous, as the
4109 modification (make line-endings native) could damage binary files.
4113 modification (make line-endings native) could damage binary files.
4110
4114
4111 2003-04-10 Fernando Perez <fperez@colorado.edu>
4115 2003-04-10 Fernando Perez <fperez@colorado.edu>
4112
4116
4113 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4117 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4114 handle only lines which are invalid python. This now means that
4118 handle only lines which are invalid python. This now means that
4115 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4119 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4116 for the bug report.
4120 for the bug report.
4117
4121
4118 2003-04-01 Fernando Perez <fperez@colorado.edu>
4122 2003-04-01 Fernando Perez <fperez@colorado.edu>
4119
4123
4120 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4124 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4121 where failing to set sys.last_traceback would crash pdb.pm().
4125 where failing to set sys.last_traceback would crash pdb.pm().
4122 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4126 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4123 report.
4127 report.
4124
4128
4125 2003-03-25 Fernando Perez <fperez@colorado.edu>
4129 2003-03-25 Fernando Perez <fperez@colorado.edu>
4126
4130
4127 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4131 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4128 before printing it (it had a lot of spurious blank lines at the
4132 before printing it (it had a lot of spurious blank lines at the
4129 end).
4133 end).
4130
4134
4131 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4135 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4132 output would be sent 21 times! Obviously people don't use this
4136 output would be sent 21 times! Obviously people don't use this
4133 too often, or I would have heard about it.
4137 too often, or I would have heard about it.
4134
4138
4135 2003-03-24 Fernando Perez <fperez@colorado.edu>
4139 2003-03-24 Fernando Perez <fperez@colorado.edu>
4136
4140
4137 * setup.py (scriptfiles): renamed the data_files parameter from
4141 * setup.py (scriptfiles): renamed the data_files parameter from
4138 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4142 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4139 for the patch.
4143 for the patch.
4140
4144
4141 2003-03-20 Fernando Perez <fperez@colorado.edu>
4145 2003-03-20 Fernando Perez <fperez@colorado.edu>
4142
4146
4143 * IPython/genutils.py (error): added error() and fatal()
4147 * IPython/genutils.py (error): added error() and fatal()
4144 functions.
4148 functions.
4145
4149
4146 2003-03-18 *** Released version 0.2.15pre3
4150 2003-03-18 *** Released version 0.2.15pre3
4147
4151
4148 2003-03-18 Fernando Perez <fperez@colorado.edu>
4152 2003-03-18 Fernando Perez <fperez@colorado.edu>
4149
4153
4150 * setupext/install_data_ext.py
4154 * setupext/install_data_ext.py
4151 (install_data_ext.initialize_options): Class contributed by Jack
4155 (install_data_ext.initialize_options): Class contributed by Jack
4152 Moffit for fixing the old distutils hack. He is sending this to
4156 Moffit for fixing the old distutils hack. He is sending this to
4153 the distutils folks so in the future we may not need it as a
4157 the distutils folks so in the future we may not need it as a
4154 private fix.
4158 private fix.
4155
4159
4156 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4160 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4157 changes for Debian packaging. See his patch for full details.
4161 changes for Debian packaging. See his patch for full details.
4158 The old distutils hack of making the ipythonrc* files carry a
4162 The old distutils hack of making the ipythonrc* files carry a
4159 bogus .py extension is gone, at last. Examples were moved to a
4163 bogus .py extension is gone, at last. Examples were moved to a
4160 separate subdir under doc/, and the separate executable scripts
4164 separate subdir under doc/, and the separate executable scripts
4161 now live in their own directory. Overall a great cleanup. The
4165 now live in their own directory. Overall a great cleanup. The
4162 manual was updated to use the new files, and setup.py has been
4166 manual was updated to use the new files, and setup.py has been
4163 fixed for this setup.
4167 fixed for this setup.
4164
4168
4165 * IPython/PyColorize.py (Parser.usage): made non-executable and
4169 * IPython/PyColorize.py (Parser.usage): made non-executable and
4166 created a pycolor wrapper around it to be included as a script.
4170 created a pycolor wrapper around it to be included as a script.
4167
4171
4168 2003-03-12 *** Released version 0.2.15pre2
4172 2003-03-12 *** Released version 0.2.15pre2
4169
4173
4170 2003-03-12 Fernando Perez <fperez@colorado.edu>
4174 2003-03-12 Fernando Perez <fperez@colorado.edu>
4171
4175
4172 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4176 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4173 long-standing problem with garbage characters in some terminals.
4177 long-standing problem with garbage characters in some terminals.
4174 The issue was really that the \001 and \002 escapes must _only_ be
4178 The issue was really that the \001 and \002 escapes must _only_ be
4175 passed to input prompts (which call readline), but _never_ to
4179 passed to input prompts (which call readline), but _never_ to
4176 normal text to be printed on screen. I changed ColorANSI to have
4180 normal text to be printed on screen. I changed ColorANSI to have
4177 two classes: TermColors and InputTermColors, each with the
4181 two classes: TermColors and InputTermColors, each with the
4178 appropriate escapes for input prompts or normal text. The code in
4182 appropriate escapes for input prompts or normal text. The code in
4179 Prompts.py got slightly more complicated, but this very old and
4183 Prompts.py got slightly more complicated, but this very old and
4180 annoying bug is finally fixed.
4184 annoying bug is finally fixed.
4181
4185
4182 All the credit for nailing down the real origin of this problem
4186 All the credit for nailing down the real origin of this problem
4183 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4187 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4184 *Many* thanks to him for spending quite a bit of effort on this.
4188 *Many* thanks to him for spending quite a bit of effort on this.
4185
4189
4186 2003-03-05 *** Released version 0.2.15pre1
4190 2003-03-05 *** Released version 0.2.15pre1
4187
4191
4188 2003-03-03 Fernando Perez <fperez@colorado.edu>
4192 2003-03-03 Fernando Perez <fperez@colorado.edu>
4189
4193
4190 * IPython/FakeModule.py: Moved the former _FakeModule to a
4194 * IPython/FakeModule.py: Moved the former _FakeModule to a
4191 separate file, because it's also needed by Magic (to fix a similar
4195 separate file, because it's also needed by Magic (to fix a similar
4192 pickle-related issue in @run).
4196 pickle-related issue in @run).
4193
4197
4194 2003-03-02 Fernando Perez <fperez@colorado.edu>
4198 2003-03-02 Fernando Perez <fperez@colorado.edu>
4195
4199
4196 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4200 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4197 the autocall option at runtime.
4201 the autocall option at runtime.
4198 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4202 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4199 across Magic.py to start separating Magic from InteractiveShell.
4203 across Magic.py to start separating Magic from InteractiveShell.
4200 (Magic._ofind): Fixed to return proper namespace for dotted
4204 (Magic._ofind): Fixed to return proper namespace for dotted
4201 names. Before, a dotted name would always return 'not currently
4205 names. Before, a dotted name would always return 'not currently
4202 defined', because it would find the 'parent'. s.x would be found,
4206 defined', because it would find the 'parent'. s.x would be found,
4203 but since 'x' isn't defined by itself, it would get confused.
4207 but since 'x' isn't defined by itself, it would get confused.
4204 (Magic.magic_run): Fixed pickling problems reported by Ralf
4208 (Magic.magic_run): Fixed pickling problems reported by Ralf
4205 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4209 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4206 that I'd used when Mike Heeter reported similar issues at the
4210 that I'd used when Mike Heeter reported similar issues at the
4207 top-level, but now for @run. It boils down to injecting the
4211 top-level, but now for @run. It boils down to injecting the
4208 namespace where code is being executed with something that looks
4212 namespace where code is being executed with something that looks
4209 enough like a module to fool pickle.dump(). Since a pickle stores
4213 enough like a module to fool pickle.dump(). Since a pickle stores
4210 a named reference to the importing module, we need this for
4214 a named reference to the importing module, we need this for
4211 pickles to save something sensible.
4215 pickles to save something sensible.
4212
4216
4213 * IPython/ipmaker.py (make_IPython): added an autocall option.
4217 * IPython/ipmaker.py (make_IPython): added an autocall option.
4214
4218
4215 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4219 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4216 the auto-eval code. Now autocalling is an option, and the code is
4220 the auto-eval code. Now autocalling is an option, and the code is
4217 also vastly safer. There is no more eval() involved at all.
4221 also vastly safer. There is no more eval() involved at all.
4218
4222
4219 2003-03-01 Fernando Perez <fperez@colorado.edu>
4223 2003-03-01 Fernando Perez <fperez@colorado.edu>
4220
4224
4221 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4225 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4222 dict with named keys instead of a tuple.
4226 dict with named keys instead of a tuple.
4223
4227
4224 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4228 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4225
4229
4226 * setup.py (make_shortcut): Fixed message about directories
4230 * setup.py (make_shortcut): Fixed message about directories
4227 created during Windows installation (the directories were ok, just
4231 created during Windows installation (the directories were ok, just
4228 the printed message was misleading). Thanks to Chris Liechti
4232 the printed message was misleading). Thanks to Chris Liechti
4229 <cliechti-AT-gmx.net> for the heads up.
4233 <cliechti-AT-gmx.net> for the heads up.
4230
4234
4231 2003-02-21 Fernando Perez <fperez@colorado.edu>
4235 2003-02-21 Fernando Perez <fperez@colorado.edu>
4232
4236
4233 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4237 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4234 of ValueError exception when checking for auto-execution. This
4238 of ValueError exception when checking for auto-execution. This
4235 one is raised by things like Numeric arrays arr.flat when the
4239 one is raised by things like Numeric arrays arr.flat when the
4236 array is non-contiguous.
4240 array is non-contiguous.
4237
4241
4238 2003-01-31 Fernando Perez <fperez@colorado.edu>
4242 2003-01-31 Fernando Perez <fperez@colorado.edu>
4239
4243
4240 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4244 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4241 not return any value at all (even though the command would get
4245 not return any value at all (even though the command would get
4242 executed).
4246 executed).
4243 (xsys): Flush stdout right after printing the command to ensure
4247 (xsys): Flush stdout right after printing the command to ensure
4244 proper ordering of commands and command output in the total
4248 proper ordering of commands and command output in the total
4245 output.
4249 output.
4246 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4250 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4247 system/getoutput as defaults. The old ones are kept for
4251 system/getoutput as defaults. The old ones are kept for
4248 compatibility reasons, so no code which uses this library needs
4252 compatibility reasons, so no code which uses this library needs
4249 changing.
4253 changing.
4250
4254
4251 2003-01-27 *** Released version 0.2.14
4255 2003-01-27 *** Released version 0.2.14
4252
4256
4253 2003-01-25 Fernando Perez <fperez@colorado.edu>
4257 2003-01-25 Fernando Perez <fperez@colorado.edu>
4254
4258
4255 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4259 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4256 functions defined in previous edit sessions could not be re-edited
4260 functions defined in previous edit sessions could not be re-edited
4257 (because the temp files were immediately removed). Now temp files
4261 (because the temp files were immediately removed). Now temp files
4258 are removed only at IPython's exit.
4262 are removed only at IPython's exit.
4259 (Magic.magic_run): Improved @run to perform shell-like expansions
4263 (Magic.magic_run): Improved @run to perform shell-like expansions
4260 on its arguments (~users and $VARS). With this, @run becomes more
4264 on its arguments (~users and $VARS). With this, @run becomes more
4261 like a normal command-line.
4265 like a normal command-line.
4262
4266
4263 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4267 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4264 bugs related to embedding and cleaned up that code. A fairly
4268 bugs related to embedding and cleaned up that code. A fairly
4265 important one was the impossibility to access the global namespace
4269 important one was the impossibility to access the global namespace
4266 through the embedded IPython (only local variables were visible).
4270 through the embedded IPython (only local variables were visible).
4267
4271
4268 2003-01-14 Fernando Perez <fperez@colorado.edu>
4272 2003-01-14 Fernando Perez <fperez@colorado.edu>
4269
4273
4270 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4274 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4271 auto-calling to be a bit more conservative. Now it doesn't get
4275 auto-calling to be a bit more conservative. Now it doesn't get
4272 triggered if any of '!=()<>' are in the rest of the input line, to
4276 triggered if any of '!=()<>' are in the rest of the input line, to
4273 allow comparing callables. Thanks to Alex for the heads up.
4277 allow comparing callables. Thanks to Alex for the heads up.
4274
4278
4275 2003-01-07 Fernando Perez <fperez@colorado.edu>
4279 2003-01-07 Fernando Perez <fperez@colorado.edu>
4276
4280
4277 * IPython/genutils.py (page): fixed estimation of the number of
4281 * IPython/genutils.py (page): fixed estimation of the number of
4278 lines in a string to be paged to simply count newlines. This
4282 lines in a string to be paged to simply count newlines. This
4279 prevents over-guessing due to embedded escape sequences. A better
4283 prevents over-guessing due to embedded escape sequences. A better
4280 long-term solution would involve stripping out the control chars
4284 long-term solution would involve stripping out the control chars
4281 for the count, but it's potentially so expensive I just don't
4285 for the count, but it's potentially so expensive I just don't
4282 think it's worth doing.
4286 think it's worth doing.
4283
4287
4284 2002-12-19 *** Released version 0.2.14pre50
4288 2002-12-19 *** Released version 0.2.14pre50
4285
4289
4286 2002-12-19 Fernando Perez <fperez@colorado.edu>
4290 2002-12-19 Fernando Perez <fperez@colorado.edu>
4287
4291
4288 * tools/release (version): Changed release scripts to inform
4292 * tools/release (version): Changed release scripts to inform
4289 Andrea and build a NEWS file with a list of recent changes.
4293 Andrea and build a NEWS file with a list of recent changes.
4290
4294
4291 * IPython/ColorANSI.py (__all__): changed terminal detection
4295 * IPython/ColorANSI.py (__all__): changed terminal detection
4292 code. Seems to work better for xterms without breaking
4296 code. Seems to work better for xterms without breaking
4293 konsole. Will need more testing to determine if WinXP and Mac OSX
4297 konsole. Will need more testing to determine if WinXP and Mac OSX
4294 also work ok.
4298 also work ok.
4295
4299
4296 2002-12-18 *** Released version 0.2.14pre49
4300 2002-12-18 *** Released version 0.2.14pre49
4297
4301
4298 2002-12-18 Fernando Perez <fperez@colorado.edu>
4302 2002-12-18 Fernando Perez <fperez@colorado.edu>
4299
4303
4300 * Docs: added new info about Mac OSX, from Andrea.
4304 * Docs: added new info about Mac OSX, from Andrea.
4301
4305
4302 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4306 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4303 allow direct plotting of python strings whose format is the same
4307 allow direct plotting of python strings whose format is the same
4304 of gnuplot data files.
4308 of gnuplot data files.
4305
4309
4306 2002-12-16 Fernando Perez <fperez@colorado.edu>
4310 2002-12-16 Fernando Perez <fperez@colorado.edu>
4307
4311
4308 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4312 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4309 value of exit question to be acknowledged.
4313 value of exit question to be acknowledged.
4310
4314
4311 2002-12-03 Fernando Perez <fperez@colorado.edu>
4315 2002-12-03 Fernando Perez <fperez@colorado.edu>
4312
4316
4313 * IPython/ipmaker.py: removed generators, which had been added
4317 * IPython/ipmaker.py: removed generators, which had been added
4314 by mistake in an earlier debugging run. This was causing trouble
4318 by mistake in an earlier debugging run. This was causing trouble
4315 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4319 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4316 for pointing this out.
4320 for pointing this out.
4317
4321
4318 2002-11-17 Fernando Perez <fperez@colorado.edu>
4322 2002-11-17 Fernando Perez <fperez@colorado.edu>
4319
4323
4320 * Manual: updated the Gnuplot section.
4324 * Manual: updated the Gnuplot section.
4321
4325
4322 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4326 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4323 a much better split of what goes in Runtime and what goes in
4327 a much better split of what goes in Runtime and what goes in
4324 Interactive.
4328 Interactive.
4325
4329
4326 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4330 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4327 being imported from iplib.
4331 being imported from iplib.
4328
4332
4329 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4333 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4330 for command-passing. Now the global Gnuplot instance is called
4334 for command-passing. Now the global Gnuplot instance is called
4331 'gp' instead of 'g', which was really a far too fragile and
4335 'gp' instead of 'g', which was really a far too fragile and
4332 common name.
4336 common name.
4333
4337
4334 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4338 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4335 bounding boxes generated by Gnuplot for square plots.
4339 bounding boxes generated by Gnuplot for square plots.
4336
4340
4337 * IPython/genutils.py (popkey): new function added. I should
4341 * IPython/genutils.py (popkey): new function added. I should
4338 suggest this on c.l.py as a dict method, it seems useful.
4342 suggest this on c.l.py as a dict method, it seems useful.
4339
4343
4340 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4344 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4341 to transparently handle PostScript generation. MUCH better than
4345 to transparently handle PostScript generation. MUCH better than
4342 the previous plot_eps/replot_eps (which I removed now). The code
4346 the previous plot_eps/replot_eps (which I removed now). The code
4343 is also fairly clean and well documented now (including
4347 is also fairly clean and well documented now (including
4344 docstrings).
4348 docstrings).
4345
4349
4346 2002-11-13 Fernando Perez <fperez@colorado.edu>
4350 2002-11-13 Fernando Perez <fperez@colorado.edu>
4347
4351
4348 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4352 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4349 (inconsistent with options).
4353 (inconsistent with options).
4350
4354
4351 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4355 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4352 manually disabled, I don't know why. Fixed it.
4356 manually disabled, I don't know why. Fixed it.
4353 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4357 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4354 eps output.
4358 eps output.
4355
4359
4356 2002-11-12 Fernando Perez <fperez@colorado.edu>
4360 2002-11-12 Fernando Perez <fperez@colorado.edu>
4357
4361
4358 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4362 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4359 don't propagate up to caller. Fixes crash reported by François
4363 don't propagate up to caller. Fixes crash reported by François
4360 Pinard.
4364 Pinard.
4361
4365
4362 2002-11-09 Fernando Perez <fperez@colorado.edu>
4366 2002-11-09 Fernando Perez <fperez@colorado.edu>
4363
4367
4364 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4368 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4365 history file for new users.
4369 history file for new users.
4366 (make_IPython): fixed bug where initial install would leave the
4370 (make_IPython): fixed bug where initial install would leave the
4367 user running in the .ipython dir.
4371 user running in the .ipython dir.
4368 (make_IPython): fixed bug where config dir .ipython would be
4372 (make_IPython): fixed bug where config dir .ipython would be
4369 created regardless of the given -ipythondir option. Thanks to Cory
4373 created regardless of the given -ipythondir option. Thanks to Cory
4370 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4374 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4371
4375
4372 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4376 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4373 type confirmations. Will need to use it in all of IPython's code
4377 type confirmations. Will need to use it in all of IPython's code
4374 consistently.
4378 consistently.
4375
4379
4376 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4380 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4377 context to print 31 lines instead of the default 5. This will make
4381 context to print 31 lines instead of the default 5. This will make
4378 the crash reports extremely detailed in case the problem is in
4382 the crash reports extremely detailed in case the problem is in
4379 libraries I don't have access to.
4383 libraries I don't have access to.
4380
4384
4381 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4385 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4382 line of defense' code to still crash, but giving users fair
4386 line of defense' code to still crash, but giving users fair
4383 warning. I don't want internal errors to go unreported: if there's
4387 warning. I don't want internal errors to go unreported: if there's
4384 an internal problem, IPython should crash and generate a full
4388 an internal problem, IPython should crash and generate a full
4385 report.
4389 report.
4386
4390
4387 2002-11-08 Fernando Perez <fperez@colorado.edu>
4391 2002-11-08 Fernando Perez <fperez@colorado.edu>
4388
4392
4389 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4393 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4390 otherwise uncaught exceptions which can appear if people set
4394 otherwise uncaught exceptions which can appear if people set
4391 sys.stdout to something badly broken. Thanks to a crash report
4395 sys.stdout to something badly broken. Thanks to a crash report
4392 from henni-AT-mail.brainbot.com.
4396 from henni-AT-mail.brainbot.com.
4393
4397
4394 2002-11-04 Fernando Perez <fperez@colorado.edu>
4398 2002-11-04 Fernando Perez <fperez@colorado.edu>
4395
4399
4396 * IPython/iplib.py (InteractiveShell.interact): added
4400 * IPython/iplib.py (InteractiveShell.interact): added
4397 __IPYTHON__active to the builtins. It's a flag which goes on when
4401 __IPYTHON__active to the builtins. It's a flag which goes on when
4398 the interaction starts and goes off again when it stops. This
4402 the interaction starts and goes off again when it stops. This
4399 allows embedding code to detect being inside IPython. Before this
4403 allows embedding code to detect being inside IPython. Before this
4400 was done via __IPYTHON__, but that only shows that an IPython
4404 was done via __IPYTHON__, but that only shows that an IPython
4401 instance has been created.
4405 instance has been created.
4402
4406
4403 * IPython/Magic.py (Magic.magic_env): I realized that in a
4407 * IPython/Magic.py (Magic.magic_env): I realized that in a
4404 UserDict, instance.data holds the data as a normal dict. So I
4408 UserDict, instance.data holds the data as a normal dict. So I
4405 modified @env to return os.environ.data instead of rebuilding a
4409 modified @env to return os.environ.data instead of rebuilding a
4406 dict by hand.
4410 dict by hand.
4407
4411
4408 2002-11-02 Fernando Perez <fperez@colorado.edu>
4412 2002-11-02 Fernando Perez <fperez@colorado.edu>
4409
4413
4410 * IPython/genutils.py (warn): changed so that level 1 prints no
4414 * IPython/genutils.py (warn): changed so that level 1 prints no
4411 header. Level 2 is now the default (with 'WARNING' header, as
4415 header. Level 2 is now the default (with 'WARNING' header, as
4412 before). I think I tracked all places where changes were needed in
4416 before). I think I tracked all places where changes were needed in
4413 IPython, but outside code using the old level numbering may have
4417 IPython, but outside code using the old level numbering may have
4414 broken.
4418 broken.
4415
4419
4416 * IPython/iplib.py (InteractiveShell.runcode): added this to
4420 * IPython/iplib.py (InteractiveShell.runcode): added this to
4417 handle the tracebacks in SystemExit traps correctly. The previous
4421 handle the tracebacks in SystemExit traps correctly. The previous
4418 code (through interact) was printing more of the stack than
4422 code (through interact) was printing more of the stack than
4419 necessary, showing IPython internal code to the user.
4423 necessary, showing IPython internal code to the user.
4420
4424
4421 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4425 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4422 default. Now that the default at the confirmation prompt is yes,
4426 default. Now that the default at the confirmation prompt is yes,
4423 it's not so intrusive. François' argument that ipython sessions
4427 it's not so intrusive. François' argument that ipython sessions
4424 tend to be complex enough not to lose them from an accidental C-d,
4428 tend to be complex enough not to lose them from an accidental C-d,
4425 is a valid one.
4429 is a valid one.
4426
4430
4427 * IPython/iplib.py (InteractiveShell.interact): added a
4431 * IPython/iplib.py (InteractiveShell.interact): added a
4428 showtraceback() call to the SystemExit trap, and modified the exit
4432 showtraceback() call to the SystemExit trap, and modified the exit
4429 confirmation to have yes as the default.
4433 confirmation to have yes as the default.
4430
4434
4431 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4435 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4432 this file. It's been gone from the code for a long time, this was
4436 this file. It's been gone from the code for a long time, this was
4433 simply leftover junk.
4437 simply leftover junk.
4434
4438
4435 2002-11-01 Fernando Perez <fperez@colorado.edu>
4439 2002-11-01 Fernando Perez <fperez@colorado.edu>
4436
4440
4437 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4441 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4438 added. If set, IPython now traps EOF and asks for
4442 added. If set, IPython now traps EOF and asks for
4439 confirmation. After a request by François Pinard.
4443 confirmation. After a request by François Pinard.
4440
4444
4441 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4445 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4442 of @abort, and with a new (better) mechanism for handling the
4446 of @abort, and with a new (better) mechanism for handling the
4443 exceptions.
4447 exceptions.
4444
4448
4445 2002-10-27 Fernando Perez <fperez@colorado.edu>
4449 2002-10-27 Fernando Perez <fperez@colorado.edu>
4446
4450
4447 * IPython/usage.py (__doc__): updated the --help information and
4451 * IPython/usage.py (__doc__): updated the --help information and
4448 the ipythonrc file to indicate that -log generates
4452 the ipythonrc file to indicate that -log generates
4449 ./ipython.log. Also fixed the corresponding info in @logstart.
4453 ./ipython.log. Also fixed the corresponding info in @logstart.
4450 This and several other fixes in the manuals thanks to reports by
4454 This and several other fixes in the manuals thanks to reports by
4451 François Pinard <pinard-AT-iro.umontreal.ca>.
4455 François Pinard <pinard-AT-iro.umontreal.ca>.
4452
4456
4453 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4457 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4454 refer to @logstart (instead of @log, which doesn't exist).
4458 refer to @logstart (instead of @log, which doesn't exist).
4455
4459
4456 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4460 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4457 AttributeError crash. Thanks to Christopher Armstrong
4461 AttributeError crash. Thanks to Christopher Armstrong
4458 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4462 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4459 introduced recently (in 0.2.14pre37) with the fix to the eval
4463 introduced recently (in 0.2.14pre37) with the fix to the eval
4460 problem mentioned below.
4464 problem mentioned below.
4461
4465
4462 2002-10-17 Fernando Perez <fperez@colorado.edu>
4466 2002-10-17 Fernando Perez <fperez@colorado.edu>
4463
4467
4464 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4468 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4465 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4469 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4466
4470
4467 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4471 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4468 this function to fix a problem reported by Alex Schmolck. He saw
4472 this function to fix a problem reported by Alex Schmolck. He saw
4469 it with list comprehensions and generators, which were getting
4473 it with list comprehensions and generators, which were getting
4470 called twice. The real problem was an 'eval' call in testing for
4474 called twice. The real problem was an 'eval' call in testing for
4471 automagic which was evaluating the input line silently.
4475 automagic which was evaluating the input line silently.
4472
4476
4473 This is a potentially very nasty bug, if the input has side
4477 This is a potentially very nasty bug, if the input has side
4474 effects which must not be repeated. The code is much cleaner now,
4478 effects which must not be repeated. The code is much cleaner now,
4475 without any blanket 'except' left and with a regexp test for
4479 without any blanket 'except' left and with a regexp test for
4476 actual function names.
4480 actual function names.
4477
4481
4478 But an eval remains, which I'm not fully comfortable with. I just
4482 But an eval remains, which I'm not fully comfortable with. I just
4479 don't know how to find out if an expression could be a callable in
4483 don't know how to find out if an expression could be a callable in
4480 the user's namespace without doing an eval on the string. However
4484 the user's namespace without doing an eval on the string. However
4481 that string is now much more strictly checked so that no code
4485 that string is now much more strictly checked so that no code
4482 slips by, so the eval should only happen for things that can
4486 slips by, so the eval should only happen for things that can
4483 really be only function/method names.
4487 really be only function/method names.
4484
4488
4485 2002-10-15 Fernando Perez <fperez@colorado.edu>
4489 2002-10-15 Fernando Perez <fperez@colorado.edu>
4486
4490
4487 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4491 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4488 OSX information to main manual, removed README_Mac_OSX file from
4492 OSX information to main manual, removed README_Mac_OSX file from
4489 distribution. Also updated credits for recent additions.
4493 distribution. Also updated credits for recent additions.
4490
4494
4491 2002-10-10 Fernando Perez <fperez@colorado.edu>
4495 2002-10-10 Fernando Perez <fperez@colorado.edu>
4492
4496
4493 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4497 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4494 terminal-related issues. Many thanks to Andrea Riciputi
4498 terminal-related issues. Many thanks to Andrea Riciputi
4495 <andrea.riciputi-AT-libero.it> for writing it.
4499 <andrea.riciputi-AT-libero.it> for writing it.
4496
4500
4497 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4501 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4498 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4502 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4499
4503
4500 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4504 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4501 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4505 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4502 <syver-en-AT-online.no> who both submitted patches for this problem.
4506 <syver-en-AT-online.no> who both submitted patches for this problem.
4503
4507
4504 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4508 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4505 global embedding to make sure that things don't overwrite user
4509 global embedding to make sure that things don't overwrite user
4506 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4510 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4507
4511
4508 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4512 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4509 compatibility. Thanks to Hayden Callow
4513 compatibility. Thanks to Hayden Callow
4510 <h.callow-AT-elec.canterbury.ac.nz>
4514 <h.callow-AT-elec.canterbury.ac.nz>
4511
4515
4512 2002-10-04 Fernando Perez <fperez@colorado.edu>
4516 2002-10-04 Fernando Perez <fperez@colorado.edu>
4513
4517
4514 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4518 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4515 Gnuplot.File objects.
4519 Gnuplot.File objects.
4516
4520
4517 2002-07-23 Fernando Perez <fperez@colorado.edu>
4521 2002-07-23 Fernando Perez <fperez@colorado.edu>
4518
4522
4519 * IPython/genutils.py (timing): Added timings() and timing() for
4523 * IPython/genutils.py (timing): Added timings() and timing() for
4520 quick access to the most commonly needed data, the execution
4524 quick access to the most commonly needed data, the execution
4521 times. Old timing() renamed to timings_out().
4525 times. Old timing() renamed to timings_out().
4522
4526
4523 2002-07-18 Fernando Perez <fperez@colorado.edu>
4527 2002-07-18 Fernando Perez <fperez@colorado.edu>
4524
4528
4525 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4529 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4526 bug with nested instances disrupting the parent's tab completion.
4530 bug with nested instances disrupting the parent's tab completion.
4527
4531
4528 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4532 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4529 all_completions code to begin the emacs integration.
4533 all_completions code to begin the emacs integration.
4530
4534
4531 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4535 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4532 argument to allow titling individual arrays when plotting.
4536 argument to allow titling individual arrays when plotting.
4533
4537
4534 2002-07-15 Fernando Perez <fperez@colorado.edu>
4538 2002-07-15 Fernando Perez <fperez@colorado.edu>
4535
4539
4536 * setup.py (make_shortcut): changed to retrieve the value of
4540 * setup.py (make_shortcut): changed to retrieve the value of
4537 'Program Files' directory from the registry (this value changes in
4541 'Program Files' directory from the registry (this value changes in
4538 non-english versions of Windows). Thanks to Thomas Fanslau
4542 non-english versions of Windows). Thanks to Thomas Fanslau
4539 <tfanslau-AT-gmx.de> for the report.
4543 <tfanslau-AT-gmx.de> for the report.
4540
4544
4541 2002-07-10 Fernando Perez <fperez@colorado.edu>
4545 2002-07-10 Fernando Perez <fperez@colorado.edu>
4542
4546
4543 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4547 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4544 a bug in pdb, which crashes if a line with only whitespace is
4548 a bug in pdb, which crashes if a line with only whitespace is
4545 entered. Bug report submitted to sourceforge.
4549 entered. Bug report submitted to sourceforge.
4546
4550
4547 2002-07-09 Fernando Perez <fperez@colorado.edu>
4551 2002-07-09 Fernando Perez <fperez@colorado.edu>
4548
4552
4549 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4553 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4550 reporting exceptions (it's a bug in inspect.py, I just set a
4554 reporting exceptions (it's a bug in inspect.py, I just set a
4551 workaround).
4555 workaround).
4552
4556
4553 2002-07-08 Fernando Perez <fperez@colorado.edu>
4557 2002-07-08 Fernando Perez <fperez@colorado.edu>
4554
4558
4555 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4559 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4556 __IPYTHON__ in __builtins__ to show up in user_ns.
4560 __IPYTHON__ in __builtins__ to show up in user_ns.
4557
4561
4558 2002-07-03 Fernando Perez <fperez@colorado.edu>
4562 2002-07-03 Fernando Perez <fperez@colorado.edu>
4559
4563
4560 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4564 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4561 name from @gp_set_instance to @gp_set_default.
4565 name from @gp_set_instance to @gp_set_default.
4562
4566
4563 * IPython/ipmaker.py (make_IPython): default editor value set to
4567 * IPython/ipmaker.py (make_IPython): default editor value set to
4564 '0' (a string), to match the rc file. Otherwise will crash when
4568 '0' (a string), to match the rc file. Otherwise will crash when
4565 .strip() is called on it.
4569 .strip() is called on it.
4566
4570
4567
4571
4568 2002-06-28 Fernando Perez <fperez@colorado.edu>
4572 2002-06-28 Fernando Perez <fperez@colorado.edu>
4569
4573
4570 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4574 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4571 of files in current directory when a file is executed via
4575 of files in current directory when a file is executed via
4572 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4576 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4573
4577
4574 * setup.py (manfiles): fix for rpm builds, submitted by RA
4578 * setup.py (manfiles): fix for rpm builds, submitted by RA
4575 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4579 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4576
4580
4577 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4581 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4578 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4582 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4579 string!). A. Schmolck caught this one.
4583 string!). A. Schmolck caught this one.
4580
4584
4581 2002-06-27 Fernando Perez <fperez@colorado.edu>
4585 2002-06-27 Fernando Perez <fperez@colorado.edu>
4582
4586
4583 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4587 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4584 defined files at the cmd line. __name__ wasn't being set to
4588 defined files at the cmd line. __name__ wasn't being set to
4585 __main__.
4589 __main__.
4586
4590
4587 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4591 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4588 regular lists and tuples besides Numeric arrays.
4592 regular lists and tuples besides Numeric arrays.
4589
4593
4590 * IPython/Prompts.py (CachedOutput.__call__): Added output
4594 * IPython/Prompts.py (CachedOutput.__call__): Added output
4591 supression for input ending with ';'. Similar to Mathematica and
4595 supression for input ending with ';'. Similar to Mathematica and
4592 Matlab. The _* vars and Out[] list are still updated, just like
4596 Matlab. The _* vars and Out[] list are still updated, just like
4593 Mathematica behaves.
4597 Mathematica behaves.
4594
4598
4595 2002-06-25 Fernando Perez <fperez@colorado.edu>
4599 2002-06-25 Fernando Perez <fperez@colorado.edu>
4596
4600
4597 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4601 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4598 .ini extensions for profiels under Windows.
4602 .ini extensions for profiels under Windows.
4599
4603
4600 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4604 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4601 string form. Fix contributed by Alexander Schmolck
4605 string form. Fix contributed by Alexander Schmolck
4602 <a.schmolck-AT-gmx.net>
4606 <a.schmolck-AT-gmx.net>
4603
4607
4604 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4608 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4605 pre-configured Gnuplot instance.
4609 pre-configured Gnuplot instance.
4606
4610
4607 2002-06-21 Fernando Perez <fperez@colorado.edu>
4611 2002-06-21 Fernando Perez <fperez@colorado.edu>
4608
4612
4609 * IPython/numutils.py (exp_safe): new function, works around the
4613 * IPython/numutils.py (exp_safe): new function, works around the
4610 underflow problems in Numeric.
4614 underflow problems in Numeric.
4611 (log2): New fn. Safe log in base 2: returns exact integer answer
4615 (log2): New fn. Safe log in base 2: returns exact integer answer
4612 for exact integer powers of 2.
4616 for exact integer powers of 2.
4613
4617
4614 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4618 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4615 properly.
4619 properly.
4616
4620
4617 2002-06-20 Fernando Perez <fperez@colorado.edu>
4621 2002-06-20 Fernando Perez <fperez@colorado.edu>
4618
4622
4619 * IPython/genutils.py (timing): new function like
4623 * IPython/genutils.py (timing): new function like
4620 Mathematica's. Similar to time_test, but returns more info.
4624 Mathematica's. Similar to time_test, but returns more info.
4621
4625
4622 2002-06-18 Fernando Perez <fperez@colorado.edu>
4626 2002-06-18 Fernando Perez <fperez@colorado.edu>
4623
4627
4624 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4628 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4625 according to Mike Heeter's suggestions.
4629 according to Mike Heeter's suggestions.
4626
4630
4627 2002-06-16 Fernando Perez <fperez@colorado.edu>
4631 2002-06-16 Fernando Perez <fperez@colorado.edu>
4628
4632
4629 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4633 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4630 system. GnuplotMagic is gone as a user-directory option. New files
4634 system. GnuplotMagic is gone as a user-directory option. New files
4631 make it easier to use all the gnuplot stuff both from external
4635 make it easier to use all the gnuplot stuff both from external
4632 programs as well as from IPython. Had to rewrite part of
4636 programs as well as from IPython. Had to rewrite part of
4633 hardcopy() b/c of a strange bug: often the ps files simply don't
4637 hardcopy() b/c of a strange bug: often the ps files simply don't
4634 get created, and require a repeat of the command (often several
4638 get created, and require a repeat of the command (often several
4635 times).
4639 times).
4636
4640
4637 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4641 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4638 resolve output channel at call time, so that if sys.stderr has
4642 resolve output channel at call time, so that if sys.stderr has
4639 been redirected by user this gets honored.
4643 been redirected by user this gets honored.
4640
4644
4641 2002-06-13 Fernando Perez <fperez@colorado.edu>
4645 2002-06-13 Fernando Perez <fperez@colorado.edu>
4642
4646
4643 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4647 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4644 IPShell. Kept a copy with the old names to avoid breaking people's
4648 IPShell. Kept a copy with the old names to avoid breaking people's
4645 embedded code.
4649 embedded code.
4646
4650
4647 * IPython/ipython: simplified it to the bare minimum after
4651 * IPython/ipython: simplified it to the bare minimum after
4648 Holger's suggestions. Added info about how to use it in
4652 Holger's suggestions. Added info about how to use it in
4649 PYTHONSTARTUP.
4653 PYTHONSTARTUP.
4650
4654
4651 * IPython/Shell.py (IPythonShell): changed the options passing
4655 * IPython/Shell.py (IPythonShell): changed the options passing
4652 from a string with funky %s replacements to a straight list. Maybe
4656 from a string with funky %s replacements to a straight list. Maybe
4653 a bit more typing, but it follows sys.argv conventions, so there's
4657 a bit more typing, but it follows sys.argv conventions, so there's
4654 less special-casing to remember.
4658 less special-casing to remember.
4655
4659
4656 2002-06-12 Fernando Perez <fperez@colorado.edu>
4660 2002-06-12 Fernando Perez <fperez@colorado.edu>
4657
4661
4658 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4662 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4659 command. Thanks to a suggestion by Mike Heeter.
4663 command. Thanks to a suggestion by Mike Heeter.
4660 (Magic.magic_pfile): added behavior to look at filenames if given
4664 (Magic.magic_pfile): added behavior to look at filenames if given
4661 arg is not a defined object.
4665 arg is not a defined object.
4662 (Magic.magic_save): New @save function to save code snippets. Also
4666 (Magic.magic_save): New @save function to save code snippets. Also
4663 a Mike Heeter idea.
4667 a Mike Heeter idea.
4664
4668
4665 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4669 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4666 plot() and replot(). Much more convenient now, especially for
4670 plot() and replot(). Much more convenient now, especially for
4667 interactive use.
4671 interactive use.
4668
4672
4669 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4673 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4670 filenames.
4674 filenames.
4671
4675
4672 2002-06-02 Fernando Perez <fperez@colorado.edu>
4676 2002-06-02 Fernando Perez <fperez@colorado.edu>
4673
4677
4674 * IPython/Struct.py (Struct.__init__): modified to admit
4678 * IPython/Struct.py (Struct.__init__): modified to admit
4675 initialization via another struct.
4679 initialization via another struct.
4676
4680
4677 * IPython/genutils.py (SystemExec.__init__): New stateful
4681 * IPython/genutils.py (SystemExec.__init__): New stateful
4678 interface to xsys and bq. Useful for writing system scripts.
4682 interface to xsys and bq. Useful for writing system scripts.
4679
4683
4680 2002-05-30 Fernando Perez <fperez@colorado.edu>
4684 2002-05-30 Fernando Perez <fperez@colorado.edu>
4681
4685
4682 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4686 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4683 documents. This will make the user download smaller (it's getting
4687 documents. This will make the user download smaller (it's getting
4684 too big).
4688 too big).
4685
4689
4686 2002-05-29 Fernando Perez <fperez@colorado.edu>
4690 2002-05-29 Fernando Perez <fperez@colorado.edu>
4687
4691
4688 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4692 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4689 fix problems with shelve and pickle. Seems to work, but I don't
4693 fix problems with shelve and pickle. Seems to work, but I don't
4690 know if corner cases break it. Thanks to Mike Heeter
4694 know if corner cases break it. Thanks to Mike Heeter
4691 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4695 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4692
4696
4693 2002-05-24 Fernando Perez <fperez@colorado.edu>
4697 2002-05-24 Fernando Perez <fperez@colorado.edu>
4694
4698
4695 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4699 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4696 macros having broken.
4700 macros having broken.
4697
4701
4698 2002-05-21 Fernando Perez <fperez@colorado.edu>
4702 2002-05-21 Fernando Perez <fperez@colorado.edu>
4699
4703
4700 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4704 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4701 introduced logging bug: all history before logging started was
4705 introduced logging bug: all history before logging started was
4702 being written one character per line! This came from the redesign
4706 being written one character per line! This came from the redesign
4703 of the input history as a special list which slices to strings,
4707 of the input history as a special list which slices to strings,
4704 not to lists.
4708 not to lists.
4705
4709
4706 2002-05-20 Fernando Perez <fperez@colorado.edu>
4710 2002-05-20 Fernando Perez <fperez@colorado.edu>
4707
4711
4708 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4712 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4709 be an attribute of all classes in this module. The design of these
4713 be an attribute of all classes in this module. The design of these
4710 classes needs some serious overhauling.
4714 classes needs some serious overhauling.
4711
4715
4712 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4716 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4713 which was ignoring '_' in option names.
4717 which was ignoring '_' in option names.
4714
4718
4715 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4719 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4716 'Verbose_novars' to 'Context' and made it the new default. It's a
4720 'Verbose_novars' to 'Context' and made it the new default. It's a
4717 bit more readable and also safer than verbose.
4721 bit more readable and also safer than verbose.
4718
4722
4719 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4723 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4720 triple-quoted strings.
4724 triple-quoted strings.
4721
4725
4722 * IPython/OInspect.py (__all__): new module exposing the object
4726 * IPython/OInspect.py (__all__): new module exposing the object
4723 introspection facilities. Now the corresponding magics are dummy
4727 introspection facilities. Now the corresponding magics are dummy
4724 wrappers around this. Having this module will make it much easier
4728 wrappers around this. Having this module will make it much easier
4725 to put these functions into our modified pdb.
4729 to put these functions into our modified pdb.
4726 This new object inspector system uses the new colorizing module,
4730 This new object inspector system uses the new colorizing module,
4727 so source code and other things are nicely syntax highlighted.
4731 so source code and other things are nicely syntax highlighted.
4728
4732
4729 2002-05-18 Fernando Perez <fperez@colorado.edu>
4733 2002-05-18 Fernando Perez <fperez@colorado.edu>
4730
4734
4731 * IPython/ColorANSI.py: Split the coloring tools into a separate
4735 * IPython/ColorANSI.py: Split the coloring tools into a separate
4732 module so I can use them in other code easier (they were part of
4736 module so I can use them in other code easier (they were part of
4733 ultraTB).
4737 ultraTB).
4734
4738
4735 2002-05-17 Fernando Perez <fperez@colorado.edu>
4739 2002-05-17 Fernando Perez <fperez@colorado.edu>
4736
4740
4737 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4741 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4738 fixed it to set the global 'g' also to the called instance, as
4742 fixed it to set the global 'g' also to the called instance, as
4739 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4743 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4740 user's 'g' variables).
4744 user's 'g' variables).
4741
4745
4742 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4746 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4743 global variables (aliases to _ih,_oh) so that users which expect
4747 global variables (aliases to _ih,_oh) so that users which expect
4744 In[5] or Out[7] to work aren't unpleasantly surprised.
4748 In[5] or Out[7] to work aren't unpleasantly surprised.
4745 (InputList.__getslice__): new class to allow executing slices of
4749 (InputList.__getslice__): new class to allow executing slices of
4746 input history directly. Very simple class, complements the use of
4750 input history directly. Very simple class, complements the use of
4747 macros.
4751 macros.
4748
4752
4749 2002-05-16 Fernando Perez <fperez@colorado.edu>
4753 2002-05-16 Fernando Perez <fperez@colorado.edu>
4750
4754
4751 * setup.py (docdirbase): make doc directory be just doc/IPython
4755 * setup.py (docdirbase): make doc directory be just doc/IPython
4752 without version numbers, it will reduce clutter for users.
4756 without version numbers, it will reduce clutter for users.
4753
4757
4754 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4758 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4755 execfile call to prevent possible memory leak. See for details:
4759 execfile call to prevent possible memory leak. See for details:
4756 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4760 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4757
4761
4758 2002-05-15 Fernando Perez <fperez@colorado.edu>
4762 2002-05-15 Fernando Perez <fperez@colorado.edu>
4759
4763
4760 * IPython/Magic.py (Magic.magic_psource): made the object
4764 * IPython/Magic.py (Magic.magic_psource): made the object
4761 introspection names be more standard: pdoc, pdef, pfile and
4765 introspection names be more standard: pdoc, pdef, pfile and
4762 psource. They all print/page their output, and it makes
4766 psource. They all print/page their output, and it makes
4763 remembering them easier. Kept old names for compatibility as
4767 remembering them easier. Kept old names for compatibility as
4764 aliases.
4768 aliases.
4765
4769
4766 2002-05-14 Fernando Perez <fperez@colorado.edu>
4770 2002-05-14 Fernando Perez <fperez@colorado.edu>
4767
4771
4768 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4772 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4769 what the mouse problem was. The trick is to use gnuplot with temp
4773 what the mouse problem was. The trick is to use gnuplot with temp
4770 files and NOT with pipes (for data communication), because having
4774 files and NOT with pipes (for data communication), because having
4771 both pipes and the mouse on is bad news.
4775 both pipes and the mouse on is bad news.
4772
4776
4773 2002-05-13 Fernando Perez <fperez@colorado.edu>
4777 2002-05-13 Fernando Perez <fperez@colorado.edu>
4774
4778
4775 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4779 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4776 bug. Information would be reported about builtins even when
4780 bug. Information would be reported about builtins even when
4777 user-defined functions overrode them.
4781 user-defined functions overrode them.
4778
4782
4779 2002-05-11 Fernando Perez <fperez@colorado.edu>
4783 2002-05-11 Fernando Perez <fperez@colorado.edu>
4780
4784
4781 * IPython/__init__.py (__all__): removed FlexCompleter from
4785 * IPython/__init__.py (__all__): removed FlexCompleter from
4782 __all__ so that things don't fail in platforms without readline.
4786 __all__ so that things don't fail in platforms without readline.
4783
4787
4784 2002-05-10 Fernando Perez <fperez@colorado.edu>
4788 2002-05-10 Fernando Perez <fperez@colorado.edu>
4785
4789
4786 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4790 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4787 it requires Numeric, effectively making Numeric a dependency for
4791 it requires Numeric, effectively making Numeric a dependency for
4788 IPython.
4792 IPython.
4789
4793
4790 * Released 0.2.13
4794 * Released 0.2.13
4791
4795
4792 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4796 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4793 profiler interface. Now all the major options from the profiler
4797 profiler interface. Now all the major options from the profiler
4794 module are directly supported in IPython, both for single
4798 module are directly supported in IPython, both for single
4795 expressions (@prun) and for full programs (@run -p).
4799 expressions (@prun) and for full programs (@run -p).
4796
4800
4797 2002-05-09 Fernando Perez <fperez@colorado.edu>
4801 2002-05-09 Fernando Perez <fperez@colorado.edu>
4798
4802
4799 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4803 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4800 magic properly formatted for screen.
4804 magic properly formatted for screen.
4801
4805
4802 * setup.py (make_shortcut): Changed things to put pdf version in
4806 * setup.py (make_shortcut): Changed things to put pdf version in
4803 doc/ instead of doc/manual (had to change lyxport a bit).
4807 doc/ instead of doc/manual (had to change lyxport a bit).
4804
4808
4805 * IPython/Magic.py (Profile.string_stats): made profile runs go
4809 * IPython/Magic.py (Profile.string_stats): made profile runs go
4806 through pager (they are long and a pager allows searching, saving,
4810 through pager (they are long and a pager allows searching, saving,
4807 etc.)
4811 etc.)
4808
4812
4809 2002-05-08 Fernando Perez <fperez@colorado.edu>
4813 2002-05-08 Fernando Perez <fperez@colorado.edu>
4810
4814
4811 * Released 0.2.12
4815 * Released 0.2.12
4812
4816
4813 2002-05-06 Fernando Perez <fperez@colorado.edu>
4817 2002-05-06 Fernando Perez <fperez@colorado.edu>
4814
4818
4815 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4819 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4816 introduced); 'hist n1 n2' was broken.
4820 introduced); 'hist n1 n2' was broken.
4817 (Magic.magic_pdb): added optional on/off arguments to @pdb
4821 (Magic.magic_pdb): added optional on/off arguments to @pdb
4818 (Magic.magic_run): added option -i to @run, which executes code in
4822 (Magic.magic_run): added option -i to @run, which executes code in
4819 the IPython namespace instead of a clean one. Also added @irun as
4823 the IPython namespace instead of a clean one. Also added @irun as
4820 an alias to @run -i.
4824 an alias to @run -i.
4821
4825
4822 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4826 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4823 fixed (it didn't really do anything, the namespaces were wrong).
4827 fixed (it didn't really do anything, the namespaces were wrong).
4824
4828
4825 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4829 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4826
4830
4827 * IPython/__init__.py (__all__): Fixed package namespace, now
4831 * IPython/__init__.py (__all__): Fixed package namespace, now
4828 'import IPython' does give access to IPython.<all> as
4832 'import IPython' does give access to IPython.<all> as
4829 expected. Also renamed __release__ to Release.
4833 expected. Also renamed __release__ to Release.
4830
4834
4831 * IPython/Debugger.py (__license__): created new Pdb class which
4835 * IPython/Debugger.py (__license__): created new Pdb class which
4832 functions like a drop-in for the normal pdb.Pdb but does NOT
4836 functions like a drop-in for the normal pdb.Pdb but does NOT
4833 import readline by default. This way it doesn't muck up IPython's
4837 import readline by default. This way it doesn't muck up IPython's
4834 readline handling, and now tab-completion finally works in the
4838 readline handling, and now tab-completion finally works in the
4835 debugger -- sort of. It completes things globally visible, but the
4839 debugger -- sort of. It completes things globally visible, but the
4836 completer doesn't track the stack as pdb walks it. That's a bit
4840 completer doesn't track the stack as pdb walks it. That's a bit
4837 tricky, and I'll have to implement it later.
4841 tricky, and I'll have to implement it later.
4838
4842
4839 2002-05-05 Fernando Perez <fperez@colorado.edu>
4843 2002-05-05 Fernando Perez <fperez@colorado.edu>
4840
4844
4841 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4845 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4842 magic docstrings when printed via ? (explicit \'s were being
4846 magic docstrings when printed via ? (explicit \'s were being
4843 printed).
4847 printed).
4844
4848
4845 * IPython/ipmaker.py (make_IPython): fixed namespace
4849 * IPython/ipmaker.py (make_IPython): fixed namespace
4846 identification bug. Now variables loaded via logs or command-line
4850 identification bug. Now variables loaded via logs or command-line
4847 files are recognized in the interactive namespace by @who.
4851 files are recognized in the interactive namespace by @who.
4848
4852
4849 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4853 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4850 log replay system stemming from the string form of Structs.
4854 log replay system stemming from the string form of Structs.
4851
4855
4852 * IPython/Magic.py (Macro.__init__): improved macros to properly
4856 * IPython/Magic.py (Macro.__init__): improved macros to properly
4853 handle magic commands in them.
4857 handle magic commands in them.
4854 (Magic.magic_logstart): usernames are now expanded so 'logstart
4858 (Magic.magic_logstart): usernames are now expanded so 'logstart
4855 ~/mylog' now works.
4859 ~/mylog' now works.
4856
4860
4857 * IPython/iplib.py (complete): fixed bug where paths starting with
4861 * IPython/iplib.py (complete): fixed bug where paths starting with
4858 '/' would be completed as magic names.
4862 '/' would be completed as magic names.
4859
4863
4860 2002-05-04 Fernando Perez <fperez@colorado.edu>
4864 2002-05-04 Fernando Perez <fperez@colorado.edu>
4861
4865
4862 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4866 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4863 allow running full programs under the profiler's control.
4867 allow running full programs under the profiler's control.
4864
4868
4865 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4869 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4866 mode to report exceptions verbosely but without formatting
4870 mode to report exceptions verbosely but without formatting
4867 variables. This addresses the issue of ipython 'freezing' (it's
4871 variables. This addresses the issue of ipython 'freezing' (it's
4868 not frozen, but caught in an expensive formatting loop) when huge
4872 not frozen, but caught in an expensive formatting loop) when huge
4869 variables are in the context of an exception.
4873 variables are in the context of an exception.
4870 (VerboseTB.text): Added '--->' markers at line where exception was
4874 (VerboseTB.text): Added '--->' markers at line where exception was
4871 triggered. Much clearer to read, especially in NoColor modes.
4875 triggered. Much clearer to read, especially in NoColor modes.
4872
4876
4873 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4877 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4874 implemented in reverse when changing to the new parse_options().
4878 implemented in reverse when changing to the new parse_options().
4875
4879
4876 2002-05-03 Fernando Perez <fperez@colorado.edu>
4880 2002-05-03 Fernando Perez <fperez@colorado.edu>
4877
4881
4878 * IPython/Magic.py (Magic.parse_options): new function so that
4882 * IPython/Magic.py (Magic.parse_options): new function so that
4879 magics can parse options easier.
4883 magics can parse options easier.
4880 (Magic.magic_prun): new function similar to profile.run(),
4884 (Magic.magic_prun): new function similar to profile.run(),
4881 suggested by Chris Hart.
4885 suggested by Chris Hart.
4882 (Magic.magic_cd): fixed behavior so that it only changes if
4886 (Magic.magic_cd): fixed behavior so that it only changes if
4883 directory actually is in history.
4887 directory actually is in history.
4884
4888
4885 * IPython/usage.py (__doc__): added information about potential
4889 * IPython/usage.py (__doc__): added information about potential
4886 slowness of Verbose exception mode when there are huge data
4890 slowness of Verbose exception mode when there are huge data
4887 structures to be formatted (thanks to Archie Paulson).
4891 structures to be formatted (thanks to Archie Paulson).
4888
4892
4889 * IPython/ipmaker.py (make_IPython): Changed default logging
4893 * IPython/ipmaker.py (make_IPython): Changed default logging
4890 (when simply called with -log) to use curr_dir/ipython.log in
4894 (when simply called with -log) to use curr_dir/ipython.log in
4891 rotate mode. Fixed crash which was occuring with -log before
4895 rotate mode. Fixed crash which was occuring with -log before
4892 (thanks to Jim Boyle).
4896 (thanks to Jim Boyle).
4893
4897
4894 2002-05-01 Fernando Perez <fperez@colorado.edu>
4898 2002-05-01 Fernando Perez <fperez@colorado.edu>
4895
4899
4896 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4900 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4897 was nasty -- though somewhat of a corner case).
4901 was nasty -- though somewhat of a corner case).
4898
4902
4899 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4903 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4900 text (was a bug).
4904 text (was a bug).
4901
4905
4902 2002-04-30 Fernando Perez <fperez@colorado.edu>
4906 2002-04-30 Fernando Perez <fperez@colorado.edu>
4903
4907
4904 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4908 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4905 a print after ^D or ^C from the user so that the In[] prompt
4909 a print after ^D or ^C from the user so that the In[] prompt
4906 doesn't over-run the gnuplot one.
4910 doesn't over-run the gnuplot one.
4907
4911
4908 2002-04-29 Fernando Perez <fperez@colorado.edu>
4912 2002-04-29 Fernando Perez <fperez@colorado.edu>
4909
4913
4910 * Released 0.2.10
4914 * Released 0.2.10
4911
4915
4912 * IPython/__release__.py (version): get date dynamically.
4916 * IPython/__release__.py (version): get date dynamically.
4913
4917
4914 * Misc. documentation updates thanks to Arnd's comments. Also ran
4918 * Misc. documentation updates thanks to Arnd's comments. Also ran
4915 a full spellcheck on the manual (hadn't been done in a while).
4919 a full spellcheck on the manual (hadn't been done in a while).
4916
4920
4917 2002-04-27 Fernando Perez <fperez@colorado.edu>
4921 2002-04-27 Fernando Perez <fperez@colorado.edu>
4918
4922
4919 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4923 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4920 starting a log in mid-session would reset the input history list.
4924 starting a log in mid-session would reset the input history list.
4921
4925
4922 2002-04-26 Fernando Perez <fperez@colorado.edu>
4926 2002-04-26 Fernando Perez <fperez@colorado.edu>
4923
4927
4924 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4928 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4925 all files were being included in an update. Now anything in
4929 all files were being included in an update. Now anything in
4926 UserConfig that matches [A-Za-z]*.py will go (this excludes
4930 UserConfig that matches [A-Za-z]*.py will go (this excludes
4927 __init__.py)
4931 __init__.py)
4928
4932
4929 2002-04-25 Fernando Perez <fperez@colorado.edu>
4933 2002-04-25 Fernando Perez <fperez@colorado.edu>
4930
4934
4931 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4935 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4932 to __builtins__ so that any form of embedded or imported code can
4936 to __builtins__ so that any form of embedded or imported code can
4933 test for being inside IPython.
4937 test for being inside IPython.
4934
4938
4935 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4939 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4936 changed to GnuplotMagic because it's now an importable module,
4940 changed to GnuplotMagic because it's now an importable module,
4937 this makes the name follow that of the standard Gnuplot module.
4941 this makes the name follow that of the standard Gnuplot module.
4938 GnuplotMagic can now be loaded at any time in mid-session.
4942 GnuplotMagic can now be loaded at any time in mid-session.
4939
4943
4940 2002-04-24 Fernando Perez <fperez@colorado.edu>
4944 2002-04-24 Fernando Perez <fperez@colorado.edu>
4941
4945
4942 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4946 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4943 the globals (IPython has its own namespace) and the
4947 the globals (IPython has its own namespace) and the
4944 PhysicalQuantity stuff is much better anyway.
4948 PhysicalQuantity stuff is much better anyway.
4945
4949
4946 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4950 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4947 embedding example to standard user directory for
4951 embedding example to standard user directory for
4948 distribution. Also put it in the manual.
4952 distribution. Also put it in the manual.
4949
4953
4950 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4954 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4951 instance as first argument (so it doesn't rely on some obscure
4955 instance as first argument (so it doesn't rely on some obscure
4952 hidden global).
4956 hidden global).
4953
4957
4954 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4958 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4955 delimiters. While it prevents ().TAB from working, it allows
4959 delimiters. While it prevents ().TAB from working, it allows
4956 completions in open (... expressions. This is by far a more common
4960 completions in open (... expressions. This is by far a more common
4957 case.
4961 case.
4958
4962
4959 2002-04-23 Fernando Perez <fperez@colorado.edu>
4963 2002-04-23 Fernando Perez <fperez@colorado.edu>
4960
4964
4961 * IPython/Extensions/InterpreterPasteInput.py: new
4965 * IPython/Extensions/InterpreterPasteInput.py: new
4962 syntax-processing module for pasting lines with >>> or ... at the
4966 syntax-processing module for pasting lines with >>> or ... at the
4963 start.
4967 start.
4964
4968
4965 * IPython/Extensions/PhysicalQ_Interactive.py
4969 * IPython/Extensions/PhysicalQ_Interactive.py
4966 (PhysicalQuantityInteractive.__int__): fixed to work with either
4970 (PhysicalQuantityInteractive.__int__): fixed to work with either
4967 Numeric or math.
4971 Numeric or math.
4968
4972
4969 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4973 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4970 provided profiles. Now we have:
4974 provided profiles. Now we have:
4971 -math -> math module as * and cmath with its own namespace.
4975 -math -> math module as * and cmath with its own namespace.
4972 -numeric -> Numeric as *, plus gnuplot & grace
4976 -numeric -> Numeric as *, plus gnuplot & grace
4973 -physics -> same as before
4977 -physics -> same as before
4974
4978
4975 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4979 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4976 user-defined magics wouldn't be found by @magic if they were
4980 user-defined magics wouldn't be found by @magic if they were
4977 defined as class methods. Also cleaned up the namespace search
4981 defined as class methods. Also cleaned up the namespace search
4978 logic and the string building (to use %s instead of many repeated
4982 logic and the string building (to use %s instead of many repeated
4979 string adds).
4983 string adds).
4980
4984
4981 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4985 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4982 of user-defined magics to operate with class methods (cleaner, in
4986 of user-defined magics to operate with class methods (cleaner, in
4983 line with the gnuplot code).
4987 line with the gnuplot code).
4984
4988
4985 2002-04-22 Fernando Perez <fperez@colorado.edu>
4989 2002-04-22 Fernando Perez <fperez@colorado.edu>
4986
4990
4987 * setup.py: updated dependency list so that manual is updated when
4991 * setup.py: updated dependency list so that manual is updated when
4988 all included files change.
4992 all included files change.
4989
4993
4990 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4994 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4991 the delimiter removal option (the fix is ugly right now).
4995 the delimiter removal option (the fix is ugly right now).
4992
4996
4993 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4997 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4994 all of the math profile (quicker loading, no conflict between
4998 all of the math profile (quicker loading, no conflict between
4995 g-9.8 and g-gnuplot).
4999 g-9.8 and g-gnuplot).
4996
5000
4997 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5001 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4998 name of post-mortem files to IPython_crash_report.txt.
5002 name of post-mortem files to IPython_crash_report.txt.
4999
5003
5000 * Cleanup/update of the docs. Added all the new readline info and
5004 * Cleanup/update of the docs. Added all the new readline info and
5001 formatted all lists as 'real lists'.
5005 formatted all lists as 'real lists'.
5002
5006
5003 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5007 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5004 tab-completion options, since the full readline parse_and_bind is
5008 tab-completion options, since the full readline parse_and_bind is
5005 now accessible.
5009 now accessible.
5006
5010
5007 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5011 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5008 handling of readline options. Now users can specify any string to
5012 handling of readline options. Now users can specify any string to
5009 be passed to parse_and_bind(), as well as the delimiters to be
5013 be passed to parse_and_bind(), as well as the delimiters to be
5010 removed.
5014 removed.
5011 (InteractiveShell.__init__): Added __name__ to the global
5015 (InteractiveShell.__init__): Added __name__ to the global
5012 namespace so that things like Itpl which rely on its existence
5016 namespace so that things like Itpl which rely on its existence
5013 don't crash.
5017 don't crash.
5014 (InteractiveShell._prefilter): Defined the default with a _ so
5018 (InteractiveShell._prefilter): Defined the default with a _ so
5015 that prefilter() is easier to override, while the default one
5019 that prefilter() is easier to override, while the default one
5016 remains available.
5020 remains available.
5017
5021
5018 2002-04-18 Fernando Perez <fperez@colorado.edu>
5022 2002-04-18 Fernando Perez <fperez@colorado.edu>
5019
5023
5020 * Added information about pdb in the docs.
5024 * Added information about pdb in the docs.
5021
5025
5022 2002-04-17 Fernando Perez <fperez@colorado.edu>
5026 2002-04-17 Fernando Perez <fperez@colorado.edu>
5023
5027
5024 * IPython/ipmaker.py (make_IPython): added rc_override option to
5028 * IPython/ipmaker.py (make_IPython): added rc_override option to
5025 allow passing config options at creation time which may override
5029 allow passing config options at creation time which may override
5026 anything set in the config files or command line. This is
5030 anything set in the config files or command line. This is
5027 particularly useful for configuring embedded instances.
5031 particularly useful for configuring embedded instances.
5028
5032
5029 2002-04-15 Fernando Perez <fperez@colorado.edu>
5033 2002-04-15 Fernando Perez <fperez@colorado.edu>
5030
5034
5031 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5035 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5032 crash embedded instances because of the input cache falling out of
5036 crash embedded instances because of the input cache falling out of
5033 sync with the output counter.
5037 sync with the output counter.
5034
5038
5035 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5039 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5036 mode which calls pdb after an uncaught exception in IPython itself.
5040 mode which calls pdb after an uncaught exception in IPython itself.
5037
5041
5038 2002-04-14 Fernando Perez <fperez@colorado.edu>
5042 2002-04-14 Fernando Perez <fperez@colorado.edu>
5039
5043
5040 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5044 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5041 readline, fix it back after each call.
5045 readline, fix it back after each call.
5042
5046
5043 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5047 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5044 method to force all access via __call__(), which guarantees that
5048 method to force all access via __call__(), which guarantees that
5045 traceback references are properly deleted.
5049 traceback references are properly deleted.
5046
5050
5047 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5051 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5048 improve printing when pprint is in use.
5052 improve printing when pprint is in use.
5049
5053
5050 2002-04-13 Fernando Perez <fperez@colorado.edu>
5054 2002-04-13 Fernando Perez <fperez@colorado.edu>
5051
5055
5052 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5056 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5053 exceptions aren't caught anymore. If the user triggers one, he
5057 exceptions aren't caught anymore. If the user triggers one, he
5054 should know why he's doing it and it should go all the way up,
5058 should know why he's doing it and it should go all the way up,
5055 just like any other exception. So now @abort will fully kill the
5059 just like any other exception. So now @abort will fully kill the
5056 embedded interpreter and the embedding code (unless that happens
5060 embedded interpreter and the embedding code (unless that happens
5057 to catch SystemExit).
5061 to catch SystemExit).
5058
5062
5059 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5063 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5060 and a debugger() method to invoke the interactive pdb debugger
5064 and a debugger() method to invoke the interactive pdb debugger
5061 after printing exception information. Also added the corresponding
5065 after printing exception information. Also added the corresponding
5062 -pdb option and @pdb magic to control this feature, and updated
5066 -pdb option and @pdb magic to control this feature, and updated
5063 the docs. After a suggestion from Christopher Hart
5067 the docs. After a suggestion from Christopher Hart
5064 (hart-AT-caltech.edu).
5068 (hart-AT-caltech.edu).
5065
5069
5066 2002-04-12 Fernando Perez <fperez@colorado.edu>
5070 2002-04-12 Fernando Perez <fperez@colorado.edu>
5067
5071
5068 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5072 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5069 the exception handlers defined by the user (not the CrashHandler)
5073 the exception handlers defined by the user (not the CrashHandler)
5070 so that user exceptions don't trigger an ipython bug report.
5074 so that user exceptions don't trigger an ipython bug report.
5071
5075
5072 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5076 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5073 configurable (it should have always been so).
5077 configurable (it should have always been so).
5074
5078
5075 2002-03-26 Fernando Perez <fperez@colorado.edu>
5079 2002-03-26 Fernando Perez <fperez@colorado.edu>
5076
5080
5077 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5081 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5078 and there to fix embedding namespace issues. This should all be
5082 and there to fix embedding namespace issues. This should all be
5079 done in a more elegant way.
5083 done in a more elegant way.
5080
5084
5081 2002-03-25 Fernando Perez <fperez@colorado.edu>
5085 2002-03-25 Fernando Perez <fperez@colorado.edu>
5082
5086
5083 * IPython/genutils.py (get_home_dir): Try to make it work under
5087 * IPython/genutils.py (get_home_dir): Try to make it work under
5084 win9x also.
5088 win9x also.
5085
5089
5086 2002-03-20 Fernando Perez <fperez@colorado.edu>
5090 2002-03-20 Fernando Perez <fperez@colorado.edu>
5087
5091
5088 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5092 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5089 sys.displayhook untouched upon __init__.
5093 sys.displayhook untouched upon __init__.
5090
5094
5091 2002-03-19 Fernando Perez <fperez@colorado.edu>
5095 2002-03-19 Fernando Perez <fperez@colorado.edu>
5092
5096
5093 * Released 0.2.9 (for embedding bug, basically).
5097 * Released 0.2.9 (for embedding bug, basically).
5094
5098
5095 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5099 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5096 exceptions so that enclosing shell's state can be restored.
5100 exceptions so that enclosing shell's state can be restored.
5097
5101
5098 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5102 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5099 naming conventions in the .ipython/ dir.
5103 naming conventions in the .ipython/ dir.
5100
5104
5101 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5105 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5102 from delimiters list so filenames with - in them get expanded.
5106 from delimiters list so filenames with - in them get expanded.
5103
5107
5104 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5108 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5105 sys.displayhook not being properly restored after an embedded call.
5109 sys.displayhook not being properly restored after an embedded call.
5106
5110
5107 2002-03-18 Fernando Perez <fperez@colorado.edu>
5111 2002-03-18 Fernando Perez <fperez@colorado.edu>
5108
5112
5109 * Released 0.2.8
5113 * Released 0.2.8
5110
5114
5111 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5115 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5112 some files weren't being included in a -upgrade.
5116 some files weren't being included in a -upgrade.
5113 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5117 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5114 on' so that the first tab completes.
5118 on' so that the first tab completes.
5115 (InteractiveShell.handle_magic): fixed bug with spaces around
5119 (InteractiveShell.handle_magic): fixed bug with spaces around
5116 quotes breaking many magic commands.
5120 quotes breaking many magic commands.
5117
5121
5118 * setup.py: added note about ignoring the syntax error messages at
5122 * setup.py: added note about ignoring the syntax error messages at
5119 installation.
5123 installation.
5120
5124
5121 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5125 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5122 streamlining the gnuplot interface, now there's only one magic @gp.
5126 streamlining the gnuplot interface, now there's only one magic @gp.
5123
5127
5124 2002-03-17 Fernando Perez <fperez@colorado.edu>
5128 2002-03-17 Fernando Perez <fperez@colorado.edu>
5125
5129
5126 * IPython/UserConfig/magic_gnuplot.py: new name for the
5130 * IPython/UserConfig/magic_gnuplot.py: new name for the
5127 example-magic_pm.py file. Much enhanced system, now with a shell
5131 example-magic_pm.py file. Much enhanced system, now with a shell
5128 for communicating directly with gnuplot, one command at a time.
5132 for communicating directly with gnuplot, one command at a time.
5129
5133
5130 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5134 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5131 setting __name__=='__main__'.
5135 setting __name__=='__main__'.
5132
5136
5133 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5137 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5134 mini-shell for accessing gnuplot from inside ipython. Should
5138 mini-shell for accessing gnuplot from inside ipython. Should
5135 extend it later for grace access too. Inspired by Arnd's
5139 extend it later for grace access too. Inspired by Arnd's
5136 suggestion.
5140 suggestion.
5137
5141
5138 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5142 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5139 calling magic functions with () in their arguments. Thanks to Arnd
5143 calling magic functions with () in their arguments. Thanks to Arnd
5140 Baecker for pointing this to me.
5144 Baecker for pointing this to me.
5141
5145
5142 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5146 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5143 infinitely for integer or complex arrays (only worked with floats).
5147 infinitely for integer or complex arrays (only worked with floats).
5144
5148
5145 2002-03-16 Fernando Perez <fperez@colorado.edu>
5149 2002-03-16 Fernando Perez <fperez@colorado.edu>
5146
5150
5147 * setup.py: Merged setup and setup_windows into a single script
5151 * setup.py: Merged setup and setup_windows into a single script
5148 which properly handles things for windows users.
5152 which properly handles things for windows users.
5149
5153
5150 2002-03-15 Fernando Perez <fperez@colorado.edu>
5154 2002-03-15 Fernando Perez <fperez@colorado.edu>
5151
5155
5152 * Big change to the manual: now the magics are all automatically
5156 * Big change to the manual: now the magics are all automatically
5153 documented. This information is generated from their docstrings
5157 documented. This information is generated from their docstrings
5154 and put in a latex file included by the manual lyx file. This way
5158 and put in a latex file included by the manual lyx file. This way
5155 we get always up to date information for the magics. The manual
5159 we get always up to date information for the magics. The manual
5156 now also has proper version information, also auto-synced.
5160 now also has proper version information, also auto-synced.
5157
5161
5158 For this to work, an undocumented --magic_docstrings option was added.
5162 For this to work, an undocumented --magic_docstrings option was added.
5159
5163
5160 2002-03-13 Fernando Perez <fperez@colorado.edu>
5164 2002-03-13 Fernando Perez <fperez@colorado.edu>
5161
5165
5162 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5166 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5163 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5167 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5164
5168
5165 2002-03-12 Fernando Perez <fperez@colorado.edu>
5169 2002-03-12 Fernando Perez <fperez@colorado.edu>
5166
5170
5167 * IPython/ultraTB.py (TermColors): changed color escapes again to
5171 * IPython/ultraTB.py (TermColors): changed color escapes again to
5168 fix the (old, reintroduced) line-wrapping bug. Basically, if
5172 fix the (old, reintroduced) line-wrapping bug. Basically, if
5169 \001..\002 aren't given in the color escapes, lines get wrapped
5173 \001..\002 aren't given in the color escapes, lines get wrapped
5170 weirdly. But giving those screws up old xterms and emacs terms. So
5174 weirdly. But giving those screws up old xterms and emacs terms. So
5171 I added some logic for emacs terms to be ok, but I can't identify old
5175 I added some logic for emacs terms to be ok, but I can't identify old
5172 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5176 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5173
5177
5174 2002-03-10 Fernando Perez <fperez@colorado.edu>
5178 2002-03-10 Fernando Perez <fperez@colorado.edu>
5175
5179
5176 * IPython/usage.py (__doc__): Various documentation cleanups and
5180 * IPython/usage.py (__doc__): Various documentation cleanups and
5177 updates, both in usage docstrings and in the manual.
5181 updates, both in usage docstrings and in the manual.
5178
5182
5179 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5183 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5180 handling of caching. Set minimum acceptabe value for having a
5184 handling of caching. Set minimum acceptabe value for having a
5181 cache at 20 values.
5185 cache at 20 values.
5182
5186
5183 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5187 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5184 install_first_time function to a method, renamed it and added an
5188 install_first_time function to a method, renamed it and added an
5185 'upgrade' mode. Now people can update their config directory with
5189 'upgrade' mode. Now people can update their config directory with
5186 a simple command line switch (-upgrade, also new).
5190 a simple command line switch (-upgrade, also new).
5187
5191
5188 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5192 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5189 @file (convenient for automagic users under Python >= 2.2).
5193 @file (convenient for automagic users under Python >= 2.2).
5190 Removed @files (it seemed more like a plural than an abbrev. of
5194 Removed @files (it seemed more like a plural than an abbrev. of
5191 'file show').
5195 'file show').
5192
5196
5193 * IPython/iplib.py (install_first_time): Fixed crash if there were
5197 * IPython/iplib.py (install_first_time): Fixed crash if there were
5194 backup files ('~') in .ipython/ install directory.
5198 backup files ('~') in .ipython/ install directory.
5195
5199
5196 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5200 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5197 system. Things look fine, but these changes are fairly
5201 system. Things look fine, but these changes are fairly
5198 intrusive. Test them for a few days.
5202 intrusive. Test them for a few days.
5199
5203
5200 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5204 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5201 the prompts system. Now all in/out prompt strings are user
5205 the prompts system. Now all in/out prompt strings are user
5202 controllable. This is particularly useful for embedding, as one
5206 controllable. This is particularly useful for embedding, as one
5203 can tag embedded instances with particular prompts.
5207 can tag embedded instances with particular prompts.
5204
5208
5205 Also removed global use of sys.ps1/2, which now allows nested
5209 Also removed global use of sys.ps1/2, which now allows nested
5206 embeddings without any problems. Added command-line options for
5210 embeddings without any problems. Added command-line options for
5207 the prompt strings.
5211 the prompt strings.
5208
5212
5209 2002-03-08 Fernando Perez <fperez@colorado.edu>
5213 2002-03-08 Fernando Perez <fperez@colorado.edu>
5210
5214
5211 * IPython/UserConfig/example-embed-short.py (ipshell): added
5215 * IPython/UserConfig/example-embed-short.py (ipshell): added
5212 example file with the bare minimum code for embedding.
5216 example file with the bare minimum code for embedding.
5213
5217
5214 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5218 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5215 functionality for the embeddable shell to be activated/deactivated
5219 functionality for the embeddable shell to be activated/deactivated
5216 either globally or at each call.
5220 either globally or at each call.
5217
5221
5218 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5222 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5219 rewriting the prompt with '--->' for auto-inputs with proper
5223 rewriting the prompt with '--->' for auto-inputs with proper
5220 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5224 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5221 this is handled by the prompts class itself, as it should.
5225 this is handled by the prompts class itself, as it should.
5222
5226
5223 2002-03-05 Fernando Perez <fperez@colorado.edu>
5227 2002-03-05 Fernando Perez <fperez@colorado.edu>
5224
5228
5225 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5229 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5226 @logstart to avoid name clashes with the math log function.
5230 @logstart to avoid name clashes with the math log function.
5227
5231
5228 * Big updates to X/Emacs section of the manual.
5232 * Big updates to X/Emacs section of the manual.
5229
5233
5230 * Removed ipython_emacs. Milan explained to me how to pass
5234 * Removed ipython_emacs. Milan explained to me how to pass
5231 arguments to ipython through Emacs. Some day I'm going to end up
5235 arguments to ipython through Emacs. Some day I'm going to end up
5232 learning some lisp...
5236 learning some lisp...
5233
5237
5234 2002-03-04 Fernando Perez <fperez@colorado.edu>
5238 2002-03-04 Fernando Perez <fperez@colorado.edu>
5235
5239
5236 * IPython/ipython_emacs: Created script to be used as the
5240 * IPython/ipython_emacs: Created script to be used as the
5237 py-python-command Emacs variable so we can pass IPython
5241 py-python-command Emacs variable so we can pass IPython
5238 parameters. I can't figure out how to tell Emacs directly to pass
5242 parameters. I can't figure out how to tell Emacs directly to pass
5239 parameters to IPython, so a dummy shell script will do it.
5243 parameters to IPython, so a dummy shell script will do it.
5240
5244
5241 Other enhancements made for things to work better under Emacs'
5245 Other enhancements made for things to work better under Emacs'
5242 various types of terminals. Many thanks to Milan Zamazal
5246 various types of terminals. Many thanks to Milan Zamazal
5243 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5247 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5244
5248
5245 2002-03-01 Fernando Perez <fperez@colorado.edu>
5249 2002-03-01 Fernando Perez <fperez@colorado.edu>
5246
5250
5247 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5251 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5248 that loading of readline is now optional. This gives better
5252 that loading of readline is now optional. This gives better
5249 control to emacs users.
5253 control to emacs users.
5250
5254
5251 * IPython/ultraTB.py (__date__): Modified color escape sequences
5255 * IPython/ultraTB.py (__date__): Modified color escape sequences
5252 and now things work fine under xterm and in Emacs' term buffers
5256 and now things work fine under xterm and in Emacs' term buffers
5253 (though not shell ones). Well, in emacs you get colors, but all
5257 (though not shell ones). Well, in emacs you get colors, but all
5254 seem to be 'light' colors (no difference between dark and light
5258 seem to be 'light' colors (no difference between dark and light
5255 ones). But the garbage chars are gone, and also in xterms. It
5259 ones). But the garbage chars are gone, and also in xterms. It
5256 seems that now I'm using 'cleaner' ansi sequences.
5260 seems that now I'm using 'cleaner' ansi sequences.
5257
5261
5258 2002-02-21 Fernando Perez <fperez@colorado.edu>
5262 2002-02-21 Fernando Perez <fperez@colorado.edu>
5259
5263
5260 * Released 0.2.7 (mainly to publish the scoping fix).
5264 * Released 0.2.7 (mainly to publish the scoping fix).
5261
5265
5262 * IPython/Logger.py (Logger.logstate): added. A corresponding
5266 * IPython/Logger.py (Logger.logstate): added. A corresponding
5263 @logstate magic was created.
5267 @logstate magic was created.
5264
5268
5265 * IPython/Magic.py: fixed nested scoping problem under Python
5269 * IPython/Magic.py: fixed nested scoping problem under Python
5266 2.1.x (automagic wasn't working).
5270 2.1.x (automagic wasn't working).
5267
5271
5268 2002-02-20 Fernando Perez <fperez@colorado.edu>
5272 2002-02-20 Fernando Perez <fperez@colorado.edu>
5269
5273
5270 * Released 0.2.6.
5274 * Released 0.2.6.
5271
5275
5272 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5276 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5273 option so that logs can come out without any headers at all.
5277 option so that logs can come out without any headers at all.
5274
5278
5275 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5279 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5276 SciPy.
5280 SciPy.
5277
5281
5278 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5282 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5279 that embedded IPython calls don't require vars() to be explicitly
5283 that embedded IPython calls don't require vars() to be explicitly
5280 passed. Now they are extracted from the caller's frame (code
5284 passed. Now they are extracted from the caller's frame (code
5281 snatched from Eric Jones' weave). Added better documentation to
5285 snatched from Eric Jones' weave). Added better documentation to
5282 the section on embedding and the example file.
5286 the section on embedding and the example file.
5283
5287
5284 * IPython/genutils.py (page): Changed so that under emacs, it just
5288 * IPython/genutils.py (page): Changed so that under emacs, it just
5285 prints the string. You can then page up and down in the emacs
5289 prints the string. You can then page up and down in the emacs
5286 buffer itself. This is how the builtin help() works.
5290 buffer itself. This is how the builtin help() works.
5287
5291
5288 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5292 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5289 macro scoping: macros need to be executed in the user's namespace
5293 macro scoping: macros need to be executed in the user's namespace
5290 to work as if they had been typed by the user.
5294 to work as if they had been typed by the user.
5291
5295
5292 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5296 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5293 execute automatically (no need to type 'exec...'). They then
5297 execute automatically (no need to type 'exec...'). They then
5294 behave like 'true macros'. The printing system was also modified
5298 behave like 'true macros'. The printing system was also modified
5295 for this to work.
5299 for this to work.
5296
5300
5297 2002-02-19 Fernando Perez <fperez@colorado.edu>
5301 2002-02-19 Fernando Perez <fperez@colorado.edu>
5298
5302
5299 * IPython/genutils.py (page_file): new function for paging files
5303 * IPython/genutils.py (page_file): new function for paging files
5300 in an OS-independent way. Also necessary for file viewing to work
5304 in an OS-independent way. Also necessary for file viewing to work
5301 well inside Emacs buffers.
5305 well inside Emacs buffers.
5302 (page): Added checks for being in an emacs buffer.
5306 (page): Added checks for being in an emacs buffer.
5303 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5307 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5304 same bug in iplib.
5308 same bug in iplib.
5305
5309
5306 2002-02-18 Fernando Perez <fperez@colorado.edu>
5310 2002-02-18 Fernando Perez <fperez@colorado.edu>
5307
5311
5308 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5312 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5309 of readline so that IPython can work inside an Emacs buffer.
5313 of readline so that IPython can work inside an Emacs buffer.
5310
5314
5311 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5315 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5312 method signatures (they weren't really bugs, but it looks cleaner
5316 method signatures (they weren't really bugs, but it looks cleaner
5313 and keeps PyChecker happy).
5317 and keeps PyChecker happy).
5314
5318
5315 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5319 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5316 for implementing various user-defined hooks. Currently only
5320 for implementing various user-defined hooks. Currently only
5317 display is done.
5321 display is done.
5318
5322
5319 * IPython/Prompts.py (CachedOutput._display): changed display
5323 * IPython/Prompts.py (CachedOutput._display): changed display
5320 functions so that they can be dynamically changed by users easily.
5324 functions so that they can be dynamically changed by users easily.
5321
5325
5322 * IPython/Extensions/numeric_formats.py (num_display): added an
5326 * IPython/Extensions/numeric_formats.py (num_display): added an
5323 extension for printing NumPy arrays in flexible manners. It
5327 extension for printing NumPy arrays in flexible manners. It
5324 doesn't do anything yet, but all the structure is in
5328 doesn't do anything yet, but all the structure is in
5325 place. Ultimately the plan is to implement output format control
5329 place. Ultimately the plan is to implement output format control
5326 like in Octave.
5330 like in Octave.
5327
5331
5328 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5332 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5329 methods are found at run-time by all the automatic machinery.
5333 methods are found at run-time by all the automatic machinery.
5330
5334
5331 2002-02-17 Fernando Perez <fperez@colorado.edu>
5335 2002-02-17 Fernando Perez <fperez@colorado.edu>
5332
5336
5333 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5337 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5334 whole file a little.
5338 whole file a little.
5335
5339
5336 * ToDo: closed this document. Now there's a new_design.lyx
5340 * ToDo: closed this document. Now there's a new_design.lyx
5337 document for all new ideas. Added making a pdf of it for the
5341 document for all new ideas. Added making a pdf of it for the
5338 end-user distro.
5342 end-user distro.
5339
5343
5340 * IPython/Logger.py (Logger.switch_log): Created this to replace
5344 * IPython/Logger.py (Logger.switch_log): Created this to replace
5341 logon() and logoff(). It also fixes a nasty crash reported by
5345 logon() and logoff(). It also fixes a nasty crash reported by
5342 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5346 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5343
5347
5344 * IPython/iplib.py (complete): got auto-completion to work with
5348 * IPython/iplib.py (complete): got auto-completion to work with
5345 automagic (I had wanted this for a long time).
5349 automagic (I had wanted this for a long time).
5346
5350
5347 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5351 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5348 to @file, since file() is now a builtin and clashes with automagic
5352 to @file, since file() is now a builtin and clashes with automagic
5349 for @file.
5353 for @file.
5350
5354
5351 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5355 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5352 of this was previously in iplib, which had grown to more than 2000
5356 of this was previously in iplib, which had grown to more than 2000
5353 lines, way too long. No new functionality, but it makes managing
5357 lines, way too long. No new functionality, but it makes managing
5354 the code a bit easier.
5358 the code a bit easier.
5355
5359
5356 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5360 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5357 information to crash reports.
5361 information to crash reports.
5358
5362
5359 2002-02-12 Fernando Perez <fperez@colorado.edu>
5363 2002-02-12 Fernando Perez <fperez@colorado.edu>
5360
5364
5361 * Released 0.2.5.
5365 * Released 0.2.5.
5362
5366
5363 2002-02-11 Fernando Perez <fperez@colorado.edu>
5367 2002-02-11 Fernando Perez <fperez@colorado.edu>
5364
5368
5365 * Wrote a relatively complete Windows installer. It puts
5369 * Wrote a relatively complete Windows installer. It puts
5366 everything in place, creates Start Menu entries and fixes the
5370 everything in place, creates Start Menu entries and fixes the
5367 color issues. Nothing fancy, but it works.
5371 color issues. Nothing fancy, but it works.
5368
5372
5369 2002-02-10 Fernando Perez <fperez@colorado.edu>
5373 2002-02-10 Fernando Perez <fperez@colorado.edu>
5370
5374
5371 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5375 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5372 os.path.expanduser() call so that we can type @run ~/myfile.py and
5376 os.path.expanduser() call so that we can type @run ~/myfile.py and
5373 have thigs work as expected.
5377 have thigs work as expected.
5374
5378
5375 * IPython/genutils.py (page): fixed exception handling so things
5379 * IPython/genutils.py (page): fixed exception handling so things
5376 work both in Unix and Windows correctly. Quitting a pager triggers
5380 work both in Unix and Windows correctly. Quitting a pager triggers
5377 an IOError/broken pipe in Unix, and in windows not finding a pager
5381 an IOError/broken pipe in Unix, and in windows not finding a pager
5378 is also an IOError, so I had to actually look at the return value
5382 is also an IOError, so I had to actually look at the return value
5379 of the exception, not just the exception itself. Should be ok now.
5383 of the exception, not just the exception itself. Should be ok now.
5380
5384
5381 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5385 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5382 modified to allow case-insensitive color scheme changes.
5386 modified to allow case-insensitive color scheme changes.
5383
5387
5384 2002-02-09 Fernando Perez <fperez@colorado.edu>
5388 2002-02-09 Fernando Perez <fperez@colorado.edu>
5385
5389
5386 * IPython/genutils.py (native_line_ends): new function to leave
5390 * IPython/genutils.py (native_line_ends): new function to leave
5387 user config files with os-native line-endings.
5391 user config files with os-native line-endings.
5388
5392
5389 * README and manual updates.
5393 * README and manual updates.
5390
5394
5391 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5395 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5392 instead of StringType to catch Unicode strings.
5396 instead of StringType to catch Unicode strings.
5393
5397
5394 * IPython/genutils.py (filefind): fixed bug for paths with
5398 * IPython/genutils.py (filefind): fixed bug for paths with
5395 embedded spaces (very common in Windows).
5399 embedded spaces (very common in Windows).
5396
5400
5397 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5401 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5398 files under Windows, so that they get automatically associated
5402 files under Windows, so that they get automatically associated
5399 with a text editor. Windows makes it a pain to handle
5403 with a text editor. Windows makes it a pain to handle
5400 extension-less files.
5404 extension-less files.
5401
5405
5402 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5406 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5403 warning about readline only occur for Posix. In Windows there's no
5407 warning about readline only occur for Posix. In Windows there's no
5404 way to get readline, so why bother with the warning.
5408 way to get readline, so why bother with the warning.
5405
5409
5406 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5410 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5407 for __str__ instead of dir(self), since dir() changed in 2.2.
5411 for __str__ instead of dir(self), since dir() changed in 2.2.
5408
5412
5409 * Ported to Windows! Tested on XP, I suspect it should work fine
5413 * Ported to Windows! Tested on XP, I suspect it should work fine
5410 on NT/2000, but I don't think it will work on 98 et al. That
5414 on NT/2000, but I don't think it will work on 98 et al. That
5411 series of Windows is such a piece of junk anyway that I won't try
5415 series of Windows is such a piece of junk anyway that I won't try
5412 porting it there. The XP port was straightforward, showed a few
5416 porting it there. The XP port was straightforward, showed a few
5413 bugs here and there (fixed all), in particular some string
5417 bugs here and there (fixed all), in particular some string
5414 handling stuff which required considering Unicode strings (which
5418 handling stuff which required considering Unicode strings (which
5415 Windows uses). This is good, but hasn't been too tested :) No
5419 Windows uses). This is good, but hasn't been too tested :) No
5416 fancy installer yet, I'll put a note in the manual so people at
5420 fancy installer yet, I'll put a note in the manual so people at
5417 least make manually a shortcut.
5421 least make manually a shortcut.
5418
5422
5419 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5423 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5420 into a single one, "colors". This now controls both prompt and
5424 into a single one, "colors". This now controls both prompt and
5421 exception color schemes, and can be changed both at startup
5425 exception color schemes, and can be changed both at startup
5422 (either via command-line switches or via ipythonrc files) and at
5426 (either via command-line switches or via ipythonrc files) and at
5423 runtime, with @colors.
5427 runtime, with @colors.
5424 (Magic.magic_run): renamed @prun to @run and removed the old
5428 (Magic.magic_run): renamed @prun to @run and removed the old
5425 @run. The two were too similar to warrant keeping both.
5429 @run. The two were too similar to warrant keeping both.
5426
5430
5427 2002-02-03 Fernando Perez <fperez@colorado.edu>
5431 2002-02-03 Fernando Perez <fperez@colorado.edu>
5428
5432
5429 * IPython/iplib.py (install_first_time): Added comment on how to
5433 * IPython/iplib.py (install_first_time): Added comment on how to
5430 configure the color options for first-time users. Put a <return>
5434 configure the color options for first-time users. Put a <return>
5431 request at the end so that small-terminal users get a chance to
5435 request at the end so that small-terminal users get a chance to
5432 read the startup info.
5436 read the startup info.
5433
5437
5434 2002-01-23 Fernando Perez <fperez@colorado.edu>
5438 2002-01-23 Fernando Perez <fperez@colorado.edu>
5435
5439
5436 * IPython/iplib.py (CachedOutput.update): Changed output memory
5440 * IPython/iplib.py (CachedOutput.update): Changed output memory
5437 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5441 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5438 input history we still use _i. Did this b/c these variable are
5442 input history we still use _i. Did this b/c these variable are
5439 very commonly used in interactive work, so the less we need to
5443 very commonly used in interactive work, so the less we need to
5440 type the better off we are.
5444 type the better off we are.
5441 (Magic.magic_prun): updated @prun to better handle the namespaces
5445 (Magic.magic_prun): updated @prun to better handle the namespaces
5442 the file will run in, including a fix for __name__ not being set
5446 the file will run in, including a fix for __name__ not being set
5443 before.
5447 before.
5444
5448
5445 2002-01-20 Fernando Perez <fperez@colorado.edu>
5449 2002-01-20 Fernando Perez <fperez@colorado.edu>
5446
5450
5447 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5451 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5448 extra garbage for Python 2.2. Need to look more carefully into
5452 extra garbage for Python 2.2. Need to look more carefully into
5449 this later.
5453 this later.
5450
5454
5451 2002-01-19 Fernando Perez <fperez@colorado.edu>
5455 2002-01-19 Fernando Perez <fperez@colorado.edu>
5452
5456
5453 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5457 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5454 display SyntaxError exceptions properly formatted when they occur
5458 display SyntaxError exceptions properly formatted when they occur
5455 (they can be triggered by imported code).
5459 (they can be triggered by imported code).
5456
5460
5457 2002-01-18 Fernando Perez <fperez@colorado.edu>
5461 2002-01-18 Fernando Perez <fperez@colorado.edu>
5458
5462
5459 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5463 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5460 SyntaxError exceptions are reported nicely formatted, instead of
5464 SyntaxError exceptions are reported nicely formatted, instead of
5461 spitting out only offset information as before.
5465 spitting out only offset information as before.
5462 (Magic.magic_prun): Added the @prun function for executing
5466 (Magic.magic_prun): Added the @prun function for executing
5463 programs with command line args inside IPython.
5467 programs with command line args inside IPython.
5464
5468
5465 2002-01-16 Fernando Perez <fperez@colorado.edu>
5469 2002-01-16 Fernando Perez <fperez@colorado.edu>
5466
5470
5467 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5471 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5468 to *not* include the last item given in a range. This brings their
5472 to *not* include the last item given in a range. This brings their
5469 behavior in line with Python's slicing:
5473 behavior in line with Python's slicing:
5470 a[n1:n2] -> a[n1]...a[n2-1]
5474 a[n1:n2] -> a[n1]...a[n2-1]
5471 It may be a bit less convenient, but I prefer to stick to Python's
5475 It may be a bit less convenient, but I prefer to stick to Python's
5472 conventions *everywhere*, so users never have to wonder.
5476 conventions *everywhere*, so users never have to wonder.
5473 (Magic.magic_macro): Added @macro function to ease the creation of
5477 (Magic.magic_macro): Added @macro function to ease the creation of
5474 macros.
5478 macros.
5475
5479
5476 2002-01-05 Fernando Perez <fperez@colorado.edu>
5480 2002-01-05 Fernando Perez <fperez@colorado.edu>
5477
5481
5478 * Released 0.2.4.
5482 * Released 0.2.4.
5479
5483
5480 * IPython/iplib.py (Magic.magic_pdef):
5484 * IPython/iplib.py (Magic.magic_pdef):
5481 (InteractiveShell.safe_execfile): report magic lines and error
5485 (InteractiveShell.safe_execfile): report magic lines and error
5482 lines without line numbers so one can easily copy/paste them for
5486 lines without line numbers so one can easily copy/paste them for
5483 re-execution.
5487 re-execution.
5484
5488
5485 * Updated manual with recent changes.
5489 * Updated manual with recent changes.
5486
5490
5487 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5491 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5488 docstring printing when class? is called. Very handy for knowing
5492 docstring printing when class? is called. Very handy for knowing
5489 how to create class instances (as long as __init__ is well
5493 how to create class instances (as long as __init__ is well
5490 documented, of course :)
5494 documented, of course :)
5491 (Magic.magic_doc): print both class and constructor docstrings.
5495 (Magic.magic_doc): print both class and constructor docstrings.
5492 (Magic.magic_pdef): give constructor info if passed a class and
5496 (Magic.magic_pdef): give constructor info if passed a class and
5493 __call__ info for callable object instances.
5497 __call__ info for callable object instances.
5494
5498
5495 2002-01-04 Fernando Perez <fperez@colorado.edu>
5499 2002-01-04 Fernando Perez <fperez@colorado.edu>
5496
5500
5497 * Made deep_reload() off by default. It doesn't always work
5501 * Made deep_reload() off by default. It doesn't always work
5498 exactly as intended, so it's probably safer to have it off. It's
5502 exactly as intended, so it's probably safer to have it off. It's
5499 still available as dreload() anyway, so nothing is lost.
5503 still available as dreload() anyway, so nothing is lost.
5500
5504
5501 2002-01-02 Fernando Perez <fperez@colorado.edu>
5505 2002-01-02 Fernando Perez <fperez@colorado.edu>
5502
5506
5503 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5507 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5504 so I wanted an updated release).
5508 so I wanted an updated release).
5505
5509
5506 2001-12-27 Fernando Perez <fperez@colorado.edu>
5510 2001-12-27 Fernando Perez <fperez@colorado.edu>
5507
5511
5508 * IPython/iplib.py (InteractiveShell.interact): Added the original
5512 * IPython/iplib.py (InteractiveShell.interact): Added the original
5509 code from 'code.py' for this module in order to change the
5513 code from 'code.py' for this module in order to change the
5510 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5514 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5511 the history cache would break when the user hit Ctrl-C, and
5515 the history cache would break when the user hit Ctrl-C, and
5512 interact() offers no way to add any hooks to it.
5516 interact() offers no way to add any hooks to it.
5513
5517
5514 2001-12-23 Fernando Perez <fperez@colorado.edu>
5518 2001-12-23 Fernando Perez <fperez@colorado.edu>
5515
5519
5516 * setup.py: added check for 'MANIFEST' before trying to remove
5520 * setup.py: added check for 'MANIFEST' before trying to remove
5517 it. Thanks to Sean Reifschneider.
5521 it. Thanks to Sean Reifschneider.
5518
5522
5519 2001-12-22 Fernando Perez <fperez@colorado.edu>
5523 2001-12-22 Fernando Perez <fperez@colorado.edu>
5520
5524
5521 * Released 0.2.2.
5525 * Released 0.2.2.
5522
5526
5523 * Finished (reasonably) writing the manual. Later will add the
5527 * Finished (reasonably) writing the manual. Later will add the
5524 python-standard navigation stylesheets, but for the time being
5528 python-standard navigation stylesheets, but for the time being
5525 it's fairly complete. Distribution will include html and pdf
5529 it's fairly complete. Distribution will include html and pdf
5526 versions.
5530 versions.
5527
5531
5528 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5532 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5529 (MayaVi author).
5533 (MayaVi author).
5530
5534
5531 2001-12-21 Fernando Perez <fperez@colorado.edu>
5535 2001-12-21 Fernando Perez <fperez@colorado.edu>
5532
5536
5533 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5537 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5534 good public release, I think (with the manual and the distutils
5538 good public release, I think (with the manual and the distutils
5535 installer). The manual can use some work, but that can go
5539 installer). The manual can use some work, but that can go
5536 slowly. Otherwise I think it's quite nice for end users. Next
5540 slowly. Otherwise I think it's quite nice for end users. Next
5537 summer, rewrite the guts of it...
5541 summer, rewrite the guts of it...
5538
5542
5539 * Changed format of ipythonrc files to use whitespace as the
5543 * Changed format of ipythonrc files to use whitespace as the
5540 separator instead of an explicit '='. Cleaner.
5544 separator instead of an explicit '='. Cleaner.
5541
5545
5542 2001-12-20 Fernando Perez <fperez@colorado.edu>
5546 2001-12-20 Fernando Perez <fperez@colorado.edu>
5543
5547
5544 * Started a manual in LyX. For now it's just a quick merge of the
5548 * Started a manual in LyX. For now it's just a quick merge of the
5545 various internal docstrings and READMEs. Later it may grow into a
5549 various internal docstrings and READMEs. Later it may grow into a
5546 nice, full-blown manual.
5550 nice, full-blown manual.
5547
5551
5548 * Set up a distutils based installer. Installation should now be
5552 * Set up a distutils based installer. Installation should now be
5549 trivially simple for end-users.
5553 trivially simple for end-users.
5550
5554
5551 2001-12-11 Fernando Perez <fperez@colorado.edu>
5555 2001-12-11 Fernando Perez <fperez@colorado.edu>
5552
5556
5553 * Released 0.2.0. First public release, announced it at
5557 * Released 0.2.0. First public release, announced it at
5554 comp.lang.python. From now on, just bugfixes...
5558 comp.lang.python. From now on, just bugfixes...
5555
5559
5556 * Went through all the files, set copyright/license notices and
5560 * Went through all the files, set copyright/license notices and
5557 cleaned up things. Ready for release.
5561 cleaned up things. Ready for release.
5558
5562
5559 2001-12-10 Fernando Perez <fperez@colorado.edu>
5563 2001-12-10 Fernando Perez <fperez@colorado.edu>
5560
5564
5561 * Changed the first-time installer not to use tarfiles. It's more
5565 * Changed the first-time installer not to use tarfiles. It's more
5562 robust now and less unix-dependent. Also makes it easier for
5566 robust now and less unix-dependent. Also makes it easier for
5563 people to later upgrade versions.
5567 people to later upgrade versions.
5564
5568
5565 * Changed @exit to @abort to reflect the fact that it's pretty
5569 * Changed @exit to @abort to reflect the fact that it's pretty
5566 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5570 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5567 becomes significant only when IPyhton is embedded: in that case,
5571 becomes significant only when IPyhton is embedded: in that case,
5568 C-D closes IPython only, but @abort kills the enclosing program
5572 C-D closes IPython only, but @abort kills the enclosing program
5569 too (unless it had called IPython inside a try catching
5573 too (unless it had called IPython inside a try catching
5570 SystemExit).
5574 SystemExit).
5571
5575
5572 * Created Shell module which exposes the actuall IPython Shell
5576 * Created Shell module which exposes the actuall IPython Shell
5573 classes, currently the normal and the embeddable one. This at
5577 classes, currently the normal and the embeddable one. This at
5574 least offers a stable interface we won't need to change when
5578 least offers a stable interface we won't need to change when
5575 (later) the internals are rewritten. That rewrite will be confined
5579 (later) the internals are rewritten. That rewrite will be confined
5576 to iplib and ipmaker, but the Shell interface should remain as is.
5580 to iplib and ipmaker, but the Shell interface should remain as is.
5577
5581
5578 * Added embed module which offers an embeddable IPShell object,
5582 * Added embed module which offers an embeddable IPShell object,
5579 useful to fire up IPython *inside* a running program. Great for
5583 useful to fire up IPython *inside* a running program. Great for
5580 debugging or dynamical data analysis.
5584 debugging or dynamical data analysis.
5581
5585
5582 2001-12-08 Fernando Perez <fperez@colorado.edu>
5586 2001-12-08 Fernando Perez <fperez@colorado.edu>
5583
5587
5584 * Fixed small bug preventing seeing info from methods of defined
5588 * Fixed small bug preventing seeing info from methods of defined
5585 objects (incorrect namespace in _ofind()).
5589 objects (incorrect namespace in _ofind()).
5586
5590
5587 * Documentation cleanup. Moved the main usage docstrings to a
5591 * Documentation cleanup. Moved the main usage docstrings to a
5588 separate file, usage.py (cleaner to maintain, and hopefully in the
5592 separate file, usage.py (cleaner to maintain, and hopefully in the
5589 future some perlpod-like way of producing interactive, man and
5593 future some perlpod-like way of producing interactive, man and
5590 html docs out of it will be found).
5594 html docs out of it will be found).
5591
5595
5592 * Added @profile to see your profile at any time.
5596 * Added @profile to see your profile at any time.
5593
5597
5594 * Added @p as an alias for 'print'. It's especially convenient if
5598 * Added @p as an alias for 'print'. It's especially convenient if
5595 using automagic ('p x' prints x).
5599 using automagic ('p x' prints x).
5596
5600
5597 * Small cleanups and fixes after a pychecker run.
5601 * Small cleanups and fixes after a pychecker run.
5598
5602
5599 * Changed the @cd command to handle @cd - and @cd -<n> for
5603 * Changed the @cd command to handle @cd - and @cd -<n> for
5600 visiting any directory in _dh.
5604 visiting any directory in _dh.
5601
5605
5602 * Introduced _dh, a history of visited directories. @dhist prints
5606 * Introduced _dh, a history of visited directories. @dhist prints
5603 it out with numbers.
5607 it out with numbers.
5604
5608
5605 2001-12-07 Fernando Perez <fperez@colorado.edu>
5609 2001-12-07 Fernando Perez <fperez@colorado.edu>
5606
5610
5607 * Released 0.1.22
5611 * Released 0.1.22
5608
5612
5609 * Made initialization a bit more robust against invalid color
5613 * Made initialization a bit more robust against invalid color
5610 options in user input (exit, not traceback-crash).
5614 options in user input (exit, not traceback-crash).
5611
5615
5612 * Changed the bug crash reporter to write the report only in the
5616 * Changed the bug crash reporter to write the report only in the
5613 user's .ipython directory. That way IPython won't litter people's
5617 user's .ipython directory. That way IPython won't litter people's
5614 hard disks with crash files all over the place. Also print on
5618 hard disks with crash files all over the place. Also print on
5615 screen the necessary mail command.
5619 screen the necessary mail command.
5616
5620
5617 * With the new ultraTB, implemented LightBG color scheme for light
5621 * With the new ultraTB, implemented LightBG color scheme for light
5618 background terminals. A lot of people like white backgrounds, so I
5622 background terminals. A lot of people like white backgrounds, so I
5619 guess we should at least give them something readable.
5623 guess we should at least give them something readable.
5620
5624
5621 2001-12-06 Fernando Perez <fperez@colorado.edu>
5625 2001-12-06 Fernando Perez <fperez@colorado.edu>
5622
5626
5623 * Modified the structure of ultraTB. Now there's a proper class
5627 * Modified the structure of ultraTB. Now there's a proper class
5624 for tables of color schemes which allow adding schemes easily and
5628 for tables of color schemes which allow adding schemes easily and
5625 switching the active scheme without creating a new instance every
5629 switching the active scheme without creating a new instance every
5626 time (which was ridiculous). The syntax for creating new schemes
5630 time (which was ridiculous). The syntax for creating new schemes
5627 is also cleaner. I think ultraTB is finally done, with a clean
5631 is also cleaner. I think ultraTB is finally done, with a clean
5628 class structure. Names are also much cleaner (now there's proper
5632 class structure. Names are also much cleaner (now there's proper
5629 color tables, no need for every variable to also have 'color' in
5633 color tables, no need for every variable to also have 'color' in
5630 its name).
5634 its name).
5631
5635
5632 * Broke down genutils into separate files. Now genutils only
5636 * Broke down genutils into separate files. Now genutils only
5633 contains utility functions, and classes have been moved to their
5637 contains utility functions, and classes have been moved to their
5634 own files (they had enough independent functionality to warrant
5638 own files (they had enough independent functionality to warrant
5635 it): ConfigLoader, OutputTrap, Struct.
5639 it): ConfigLoader, OutputTrap, Struct.
5636
5640
5637 2001-12-05 Fernando Perez <fperez@colorado.edu>
5641 2001-12-05 Fernando Perez <fperez@colorado.edu>
5638
5642
5639 * IPython turns 21! Released version 0.1.21, as a candidate for
5643 * IPython turns 21! Released version 0.1.21, as a candidate for
5640 public consumption. If all goes well, release in a few days.
5644 public consumption. If all goes well, release in a few days.
5641
5645
5642 * Fixed path bug (files in Extensions/ directory wouldn't be found
5646 * Fixed path bug (files in Extensions/ directory wouldn't be found
5643 unless IPython/ was explicitly in sys.path).
5647 unless IPython/ was explicitly in sys.path).
5644
5648
5645 * Extended the FlexCompleter class as MagicCompleter to allow
5649 * Extended the FlexCompleter class as MagicCompleter to allow
5646 completion of @-starting lines.
5650 completion of @-starting lines.
5647
5651
5648 * Created __release__.py file as a central repository for release
5652 * Created __release__.py file as a central repository for release
5649 info that other files can read from.
5653 info that other files can read from.
5650
5654
5651 * Fixed small bug in logging: when logging was turned on in
5655 * Fixed small bug in logging: when logging was turned on in
5652 mid-session, old lines with special meanings (!@?) were being
5656 mid-session, old lines with special meanings (!@?) were being
5653 logged without the prepended comment, which is necessary since
5657 logged without the prepended comment, which is necessary since
5654 they are not truly valid python syntax. This should make session
5658 they are not truly valid python syntax. This should make session
5655 restores produce less errors.
5659 restores produce less errors.
5656
5660
5657 * The namespace cleanup forced me to make a FlexCompleter class
5661 * The namespace cleanup forced me to make a FlexCompleter class
5658 which is nothing but a ripoff of rlcompleter, but with selectable
5662 which is nothing but a ripoff of rlcompleter, but with selectable
5659 namespace (rlcompleter only works in __main__.__dict__). I'll try
5663 namespace (rlcompleter only works in __main__.__dict__). I'll try
5660 to submit a note to the authors to see if this change can be
5664 to submit a note to the authors to see if this change can be
5661 incorporated in future rlcompleter releases (Dec.6: done)
5665 incorporated in future rlcompleter releases (Dec.6: done)
5662
5666
5663 * More fixes to namespace handling. It was a mess! Now all
5667 * More fixes to namespace handling. It was a mess! Now all
5664 explicit references to __main__.__dict__ are gone (except when
5668 explicit references to __main__.__dict__ are gone (except when
5665 really needed) and everything is handled through the namespace
5669 really needed) and everything is handled through the namespace
5666 dicts in the IPython instance. We seem to be getting somewhere
5670 dicts in the IPython instance. We seem to be getting somewhere
5667 with this, finally...
5671 with this, finally...
5668
5672
5669 * Small documentation updates.
5673 * Small documentation updates.
5670
5674
5671 * Created the Extensions directory under IPython (with an
5675 * Created the Extensions directory under IPython (with an
5672 __init__.py). Put the PhysicalQ stuff there. This directory should
5676 __init__.py). Put the PhysicalQ stuff there. This directory should
5673 be used for all special-purpose extensions.
5677 be used for all special-purpose extensions.
5674
5678
5675 * File renaming:
5679 * File renaming:
5676 ipythonlib --> ipmaker
5680 ipythonlib --> ipmaker
5677 ipplib --> iplib
5681 ipplib --> iplib
5678 This makes a bit more sense in terms of what these files actually do.
5682 This makes a bit more sense in terms of what these files actually do.
5679
5683
5680 * Moved all the classes and functions in ipythonlib to ipplib, so
5684 * Moved all the classes and functions in ipythonlib to ipplib, so
5681 now ipythonlib only has make_IPython(). This will ease up its
5685 now ipythonlib only has make_IPython(). This will ease up its
5682 splitting in smaller functional chunks later.
5686 splitting in smaller functional chunks later.
5683
5687
5684 * Cleaned up (done, I think) output of @whos. Better column
5688 * Cleaned up (done, I think) output of @whos. Better column
5685 formatting, and now shows str(var) for as much as it can, which is
5689 formatting, and now shows str(var) for as much as it can, which is
5686 typically what one gets with a 'print var'.
5690 typically what one gets with a 'print var'.
5687
5691
5688 2001-12-04 Fernando Perez <fperez@colorado.edu>
5692 2001-12-04 Fernando Perez <fperez@colorado.edu>
5689
5693
5690 * Fixed namespace problems. Now builtin/IPyhton/user names get
5694 * Fixed namespace problems. Now builtin/IPyhton/user names get
5691 properly reported in their namespace. Internal namespace handling
5695 properly reported in their namespace. Internal namespace handling
5692 is finally getting decent (not perfect yet, but much better than
5696 is finally getting decent (not perfect yet, but much better than
5693 the ad-hoc mess we had).
5697 the ad-hoc mess we had).
5694
5698
5695 * Removed -exit option. If people just want to run a python
5699 * Removed -exit option. If people just want to run a python
5696 script, that's what the normal interpreter is for. Less
5700 script, that's what the normal interpreter is for. Less
5697 unnecessary options, less chances for bugs.
5701 unnecessary options, less chances for bugs.
5698
5702
5699 * Added a crash handler which generates a complete post-mortem if
5703 * Added a crash handler which generates a complete post-mortem if
5700 IPython crashes. This will help a lot in tracking bugs down the
5704 IPython crashes. This will help a lot in tracking bugs down the
5701 road.
5705 road.
5702
5706
5703 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5707 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5704 which were boud to functions being reassigned would bypass the
5708 which were boud to functions being reassigned would bypass the
5705 logger, breaking the sync of _il with the prompt counter. This
5709 logger, breaking the sync of _il with the prompt counter. This
5706 would then crash IPython later when a new line was logged.
5710 would then crash IPython later when a new line was logged.
5707
5711
5708 2001-12-02 Fernando Perez <fperez@colorado.edu>
5712 2001-12-02 Fernando Perez <fperez@colorado.edu>
5709
5713
5710 * Made IPython a package. This means people don't have to clutter
5714 * Made IPython a package. This means people don't have to clutter
5711 their sys.path with yet another directory. Changed the INSTALL
5715 their sys.path with yet another directory. Changed the INSTALL
5712 file accordingly.
5716 file accordingly.
5713
5717
5714 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5718 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5715 sorts its output (so @who shows it sorted) and @whos formats the
5719 sorts its output (so @who shows it sorted) and @whos formats the
5716 table according to the width of the first column. Nicer, easier to
5720 table according to the width of the first column. Nicer, easier to
5717 read. Todo: write a generic table_format() which takes a list of
5721 read. Todo: write a generic table_format() which takes a list of
5718 lists and prints it nicely formatted, with optional row/column
5722 lists and prints it nicely formatted, with optional row/column
5719 separators and proper padding and justification.
5723 separators and proper padding and justification.
5720
5724
5721 * Released 0.1.20
5725 * Released 0.1.20
5722
5726
5723 * Fixed bug in @log which would reverse the inputcache list (a
5727 * Fixed bug in @log which would reverse the inputcache list (a
5724 copy operation was missing).
5728 copy operation was missing).
5725
5729
5726 * Code cleanup. @config was changed to use page(). Better, since
5730 * Code cleanup. @config was changed to use page(). Better, since
5727 its output is always quite long.
5731 its output is always quite long.
5728
5732
5729 * Itpl is back as a dependency. I was having too many problems
5733 * Itpl is back as a dependency. I was having too many problems
5730 getting the parametric aliases to work reliably, and it's just
5734 getting the parametric aliases to work reliably, and it's just
5731 easier to code weird string operations with it than playing %()s
5735 easier to code weird string operations with it than playing %()s
5732 games. It's only ~6k, so I don't think it's too big a deal.
5736 games. It's only ~6k, so I don't think it's too big a deal.
5733
5737
5734 * Found (and fixed) a very nasty bug with history. !lines weren't
5738 * Found (and fixed) a very nasty bug with history. !lines weren't
5735 getting cached, and the out of sync caches would crash
5739 getting cached, and the out of sync caches would crash
5736 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5740 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5737 division of labor a bit better. Bug fixed, cleaner structure.
5741 division of labor a bit better. Bug fixed, cleaner structure.
5738
5742
5739 2001-12-01 Fernando Perez <fperez@colorado.edu>
5743 2001-12-01 Fernando Perez <fperez@colorado.edu>
5740
5744
5741 * Released 0.1.19
5745 * Released 0.1.19
5742
5746
5743 * Added option -n to @hist to prevent line number printing. Much
5747 * Added option -n to @hist to prevent line number printing. Much
5744 easier to copy/paste code this way.
5748 easier to copy/paste code this way.
5745
5749
5746 * Created global _il to hold the input list. Allows easy
5750 * Created global _il to hold the input list. Allows easy
5747 re-execution of blocks of code by slicing it (inspired by Janko's
5751 re-execution of blocks of code by slicing it (inspired by Janko's
5748 comment on 'macros').
5752 comment on 'macros').
5749
5753
5750 * Small fixes and doc updates.
5754 * Small fixes and doc updates.
5751
5755
5752 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5756 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5753 much too fragile with automagic. Handles properly multi-line
5757 much too fragile with automagic. Handles properly multi-line
5754 statements and takes parameters.
5758 statements and takes parameters.
5755
5759
5756 2001-11-30 Fernando Perez <fperez@colorado.edu>
5760 2001-11-30 Fernando Perez <fperez@colorado.edu>
5757
5761
5758 * Version 0.1.18 released.
5762 * Version 0.1.18 released.
5759
5763
5760 * Fixed nasty namespace bug in initial module imports.
5764 * Fixed nasty namespace bug in initial module imports.
5761
5765
5762 * Added copyright/license notes to all code files (except
5766 * Added copyright/license notes to all code files (except
5763 DPyGetOpt). For the time being, LGPL. That could change.
5767 DPyGetOpt). For the time being, LGPL. That could change.
5764
5768
5765 * Rewrote a much nicer README, updated INSTALL, cleaned up
5769 * Rewrote a much nicer README, updated INSTALL, cleaned up
5766 ipythonrc-* samples.
5770 ipythonrc-* samples.
5767
5771
5768 * Overall code/documentation cleanup. Basically ready for
5772 * Overall code/documentation cleanup. Basically ready for
5769 release. Only remaining thing: licence decision (LGPL?).
5773 release. Only remaining thing: licence decision (LGPL?).
5770
5774
5771 * Converted load_config to a class, ConfigLoader. Now recursion
5775 * Converted load_config to a class, ConfigLoader. Now recursion
5772 control is better organized. Doesn't include the same file twice.
5776 control is better organized. Doesn't include the same file twice.
5773
5777
5774 2001-11-29 Fernando Perez <fperez@colorado.edu>
5778 2001-11-29 Fernando Perez <fperez@colorado.edu>
5775
5779
5776 * Got input history working. Changed output history variables from
5780 * Got input history working. Changed output history variables from
5777 _p to _o so that _i is for input and _o for output. Just cleaner
5781 _p to _o so that _i is for input and _o for output. Just cleaner
5778 convention.
5782 convention.
5779
5783
5780 * Implemented parametric aliases. This pretty much allows the
5784 * Implemented parametric aliases. This pretty much allows the
5781 alias system to offer full-blown shell convenience, I think.
5785 alias system to offer full-blown shell convenience, I think.
5782
5786
5783 * Version 0.1.17 released, 0.1.18 opened.
5787 * Version 0.1.17 released, 0.1.18 opened.
5784
5788
5785 * dot_ipython/ipythonrc (alias): added documentation.
5789 * dot_ipython/ipythonrc (alias): added documentation.
5786 (xcolor): Fixed small bug (xcolors -> xcolor)
5790 (xcolor): Fixed small bug (xcolors -> xcolor)
5787
5791
5788 * Changed the alias system. Now alias is a magic command to define
5792 * Changed the alias system. Now alias is a magic command to define
5789 aliases just like the shell. Rationale: the builtin magics should
5793 aliases just like the shell. Rationale: the builtin magics should
5790 be there for things deeply connected to IPython's
5794 be there for things deeply connected to IPython's
5791 architecture. And this is a much lighter system for what I think
5795 architecture. And this is a much lighter system for what I think
5792 is the really important feature: allowing users to define quickly
5796 is the really important feature: allowing users to define quickly
5793 magics that will do shell things for them, so they can customize
5797 magics that will do shell things for them, so they can customize
5794 IPython easily to match their work habits. If someone is really
5798 IPython easily to match their work habits. If someone is really
5795 desperate to have another name for a builtin alias, they can
5799 desperate to have another name for a builtin alias, they can
5796 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5800 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5797 works.
5801 works.
5798
5802
5799 2001-11-28 Fernando Perez <fperez@colorado.edu>
5803 2001-11-28 Fernando Perez <fperez@colorado.edu>
5800
5804
5801 * Changed @file so that it opens the source file at the proper
5805 * Changed @file so that it opens the source file at the proper
5802 line. Since it uses less, if your EDITOR environment is
5806 line. Since it uses less, if your EDITOR environment is
5803 configured, typing v will immediately open your editor of choice
5807 configured, typing v will immediately open your editor of choice
5804 right at the line where the object is defined. Not as quick as
5808 right at the line where the object is defined. Not as quick as
5805 having a direct @edit command, but for all intents and purposes it
5809 having a direct @edit command, but for all intents and purposes it
5806 works. And I don't have to worry about writing @edit to deal with
5810 works. And I don't have to worry about writing @edit to deal with
5807 all the editors, less does that.
5811 all the editors, less does that.
5808
5812
5809 * Version 0.1.16 released, 0.1.17 opened.
5813 * Version 0.1.16 released, 0.1.17 opened.
5810
5814
5811 * Fixed some nasty bugs in the page/page_dumb combo that could
5815 * Fixed some nasty bugs in the page/page_dumb combo that could
5812 crash IPython.
5816 crash IPython.
5813
5817
5814 2001-11-27 Fernando Perez <fperez@colorado.edu>
5818 2001-11-27 Fernando Perez <fperez@colorado.edu>
5815
5819
5816 * Version 0.1.15 released, 0.1.16 opened.
5820 * Version 0.1.15 released, 0.1.16 opened.
5817
5821
5818 * Finally got ? and ?? to work for undefined things: now it's
5822 * Finally got ? and ?? to work for undefined things: now it's
5819 possible to type {}.get? and get information about the get method
5823 possible to type {}.get? and get information about the get method
5820 of dicts, or os.path? even if only os is defined (so technically
5824 of dicts, or os.path? even if only os is defined (so technically
5821 os.path isn't). Works at any level. For example, after import os,
5825 os.path isn't). Works at any level. For example, after import os,
5822 os?, os.path?, os.path.abspath? all work. This is great, took some
5826 os?, os.path?, os.path.abspath? all work. This is great, took some
5823 work in _ofind.
5827 work in _ofind.
5824
5828
5825 * Fixed more bugs with logging. The sanest way to do it was to add
5829 * Fixed more bugs with logging. The sanest way to do it was to add
5826 to @log a 'mode' parameter. Killed two in one shot (this mode
5830 to @log a 'mode' parameter. Killed two in one shot (this mode
5827 option was a request of Janko's). I think it's finally clean
5831 option was a request of Janko's). I think it's finally clean
5828 (famous last words).
5832 (famous last words).
5829
5833
5830 * Added a page_dumb() pager which does a decent job of paging on
5834 * Added a page_dumb() pager which does a decent job of paging on
5831 screen, if better things (like less) aren't available. One less
5835 screen, if better things (like less) aren't available. One less
5832 unix dependency (someday maybe somebody will port this to
5836 unix dependency (someday maybe somebody will port this to
5833 windows).
5837 windows).
5834
5838
5835 * Fixed problem in magic_log: would lock of logging out if log
5839 * Fixed problem in magic_log: would lock of logging out if log
5836 creation failed (because it would still think it had succeeded).
5840 creation failed (because it would still think it had succeeded).
5837
5841
5838 * Improved the page() function using curses to auto-detect screen
5842 * Improved the page() function using curses to auto-detect screen
5839 size. Now it can make a much better decision on whether to print
5843 size. Now it can make a much better decision on whether to print
5840 or page a string. Option screen_length was modified: a value 0
5844 or page a string. Option screen_length was modified: a value 0
5841 means auto-detect, and that's the default now.
5845 means auto-detect, and that's the default now.
5842
5846
5843 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5847 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5844 go out. I'll test it for a few days, then talk to Janko about
5848 go out. I'll test it for a few days, then talk to Janko about
5845 licences and announce it.
5849 licences and announce it.
5846
5850
5847 * Fixed the length of the auto-generated ---> prompt which appears
5851 * Fixed the length of the auto-generated ---> prompt which appears
5848 for auto-parens and auto-quotes. Getting this right isn't trivial,
5852 for auto-parens and auto-quotes. Getting this right isn't trivial,
5849 with all the color escapes, different prompt types and optional
5853 with all the color escapes, different prompt types and optional
5850 separators. But it seems to be working in all the combinations.
5854 separators. But it seems to be working in all the combinations.
5851
5855
5852 2001-11-26 Fernando Perez <fperez@colorado.edu>
5856 2001-11-26 Fernando Perez <fperez@colorado.edu>
5853
5857
5854 * Wrote a regexp filter to get option types from the option names
5858 * Wrote a regexp filter to get option types from the option names
5855 string. This eliminates the need to manually keep two duplicate
5859 string. This eliminates the need to manually keep two duplicate
5856 lists.
5860 lists.
5857
5861
5858 * Removed the unneeded check_option_names. Now options are handled
5862 * Removed the unneeded check_option_names. Now options are handled
5859 in a much saner manner and it's easy to visually check that things
5863 in a much saner manner and it's easy to visually check that things
5860 are ok.
5864 are ok.
5861
5865
5862 * Updated version numbers on all files I modified to carry a
5866 * Updated version numbers on all files I modified to carry a
5863 notice so Janko and Nathan have clear version markers.
5867 notice so Janko and Nathan have clear version markers.
5864
5868
5865 * Updated docstring for ultraTB with my changes. I should send
5869 * Updated docstring for ultraTB with my changes. I should send
5866 this to Nathan.
5870 this to Nathan.
5867
5871
5868 * Lots of small fixes. Ran everything through pychecker again.
5872 * Lots of small fixes. Ran everything through pychecker again.
5869
5873
5870 * Made loading of deep_reload an cmd line option. If it's not too
5874 * Made loading of deep_reload an cmd line option. If it's not too
5871 kosher, now people can just disable it. With -nodeep_reload it's
5875 kosher, now people can just disable it. With -nodeep_reload it's
5872 still available as dreload(), it just won't overwrite reload().
5876 still available as dreload(), it just won't overwrite reload().
5873
5877
5874 * Moved many options to the no| form (-opt and -noopt
5878 * Moved many options to the no| form (-opt and -noopt
5875 accepted). Cleaner.
5879 accepted). Cleaner.
5876
5880
5877 * Changed magic_log so that if called with no parameters, it uses
5881 * Changed magic_log so that if called with no parameters, it uses
5878 'rotate' mode. That way auto-generated logs aren't automatically
5882 'rotate' mode. That way auto-generated logs aren't automatically
5879 over-written. For normal logs, now a backup is made if it exists
5883 over-written. For normal logs, now a backup is made if it exists
5880 (only 1 level of backups). A new 'backup' mode was added to the
5884 (only 1 level of backups). A new 'backup' mode was added to the
5881 Logger class to support this. This was a request by Janko.
5885 Logger class to support this. This was a request by Janko.
5882
5886
5883 * Added @logoff/@logon to stop/restart an active log.
5887 * Added @logoff/@logon to stop/restart an active log.
5884
5888
5885 * Fixed a lot of bugs in log saving/replay. It was pretty
5889 * Fixed a lot of bugs in log saving/replay. It was pretty
5886 broken. Now special lines (!@,/) appear properly in the command
5890 broken. Now special lines (!@,/) appear properly in the command
5887 history after a log replay.
5891 history after a log replay.
5888
5892
5889 * Tried and failed to implement full session saving via pickle. My
5893 * Tried and failed to implement full session saving via pickle. My
5890 idea was to pickle __main__.__dict__, but modules can't be
5894 idea was to pickle __main__.__dict__, but modules can't be
5891 pickled. This would be a better alternative to replaying logs, but
5895 pickled. This would be a better alternative to replaying logs, but
5892 seems quite tricky to get to work. Changed -session to be called
5896 seems quite tricky to get to work. Changed -session to be called
5893 -logplay, which more accurately reflects what it does. And if we
5897 -logplay, which more accurately reflects what it does. And if we
5894 ever get real session saving working, -session is now available.
5898 ever get real session saving working, -session is now available.
5895
5899
5896 * Implemented color schemes for prompts also. As for tracebacks,
5900 * Implemented color schemes for prompts also. As for tracebacks,
5897 currently only NoColor and Linux are supported. But now the
5901 currently only NoColor and Linux are supported. But now the
5898 infrastructure is in place, based on a generic ColorScheme
5902 infrastructure is in place, based on a generic ColorScheme
5899 class. So writing and activating new schemes both for the prompts
5903 class. So writing and activating new schemes both for the prompts
5900 and the tracebacks should be straightforward.
5904 and the tracebacks should be straightforward.
5901
5905
5902 * Version 0.1.13 released, 0.1.14 opened.
5906 * Version 0.1.13 released, 0.1.14 opened.
5903
5907
5904 * Changed handling of options for output cache. Now counter is
5908 * Changed handling of options for output cache. Now counter is
5905 hardwired starting at 1 and one specifies the maximum number of
5909 hardwired starting at 1 and one specifies the maximum number of
5906 entries *in the outcache* (not the max prompt counter). This is
5910 entries *in the outcache* (not the max prompt counter). This is
5907 much better, since many statements won't increase the cache
5911 much better, since many statements won't increase the cache
5908 count. It also eliminated some confusing options, now there's only
5912 count. It also eliminated some confusing options, now there's only
5909 one: cache_size.
5913 one: cache_size.
5910
5914
5911 * Added 'alias' magic function and magic_alias option in the
5915 * Added 'alias' magic function and magic_alias option in the
5912 ipythonrc file. Now the user can easily define whatever names he
5916 ipythonrc file. Now the user can easily define whatever names he
5913 wants for the magic functions without having to play weird
5917 wants for the magic functions without having to play weird
5914 namespace games. This gives IPython a real shell-like feel.
5918 namespace games. This gives IPython a real shell-like feel.
5915
5919
5916 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5920 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5917 @ or not).
5921 @ or not).
5918
5922
5919 This was one of the last remaining 'visible' bugs (that I know
5923 This was one of the last remaining 'visible' bugs (that I know
5920 of). I think if I can clean up the session loading so it works
5924 of). I think if I can clean up the session loading so it works
5921 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5925 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5922 about licensing).
5926 about licensing).
5923
5927
5924 2001-11-25 Fernando Perez <fperez@colorado.edu>
5928 2001-11-25 Fernando Perez <fperez@colorado.edu>
5925
5929
5926 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5930 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5927 there's a cleaner distinction between what ? and ?? show.
5931 there's a cleaner distinction between what ? and ?? show.
5928
5932
5929 * Added screen_length option. Now the user can define his own
5933 * Added screen_length option. Now the user can define his own
5930 screen size for page() operations.
5934 screen size for page() operations.
5931
5935
5932 * Implemented magic shell-like functions with automatic code
5936 * Implemented magic shell-like functions with automatic code
5933 generation. Now adding another function is just a matter of adding
5937 generation. Now adding another function is just a matter of adding
5934 an entry to a dict, and the function is dynamically generated at
5938 an entry to a dict, and the function is dynamically generated at
5935 run-time. Python has some really cool features!
5939 run-time. Python has some really cool features!
5936
5940
5937 * Renamed many options to cleanup conventions a little. Now all
5941 * Renamed many options to cleanup conventions a little. Now all
5938 are lowercase, and only underscores where needed. Also in the code
5942 are lowercase, and only underscores where needed. Also in the code
5939 option name tables are clearer.
5943 option name tables are clearer.
5940
5944
5941 * Changed prompts a little. Now input is 'In [n]:' instead of
5945 * Changed prompts a little. Now input is 'In [n]:' instead of
5942 'In[n]:='. This allows it the numbers to be aligned with the
5946 'In[n]:='. This allows it the numbers to be aligned with the
5943 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5947 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5944 Python (it was a Mathematica thing). The '...' continuation prompt
5948 Python (it was a Mathematica thing). The '...' continuation prompt
5945 was also changed a little to align better.
5949 was also changed a little to align better.
5946
5950
5947 * Fixed bug when flushing output cache. Not all _p<n> variables
5951 * Fixed bug when flushing output cache. Not all _p<n> variables
5948 exist, so their deletion needs to be wrapped in a try:
5952 exist, so their deletion needs to be wrapped in a try:
5949
5953
5950 * Figured out how to properly use inspect.formatargspec() (it
5954 * Figured out how to properly use inspect.formatargspec() (it
5951 requires the args preceded by *). So I removed all the code from
5955 requires the args preceded by *). So I removed all the code from
5952 _get_pdef in Magic, which was just replicating that.
5956 _get_pdef in Magic, which was just replicating that.
5953
5957
5954 * Added test to prefilter to allow redefining magic function names
5958 * Added test to prefilter to allow redefining magic function names
5955 as variables. This is ok, since the @ form is always available,
5959 as variables. This is ok, since the @ form is always available,
5956 but whe should allow the user to define a variable called 'ls' if
5960 but whe should allow the user to define a variable called 'ls' if
5957 he needs it.
5961 he needs it.
5958
5962
5959 * Moved the ToDo information from README into a separate ToDo.
5963 * Moved the ToDo information from README into a separate ToDo.
5960
5964
5961 * General code cleanup and small bugfixes. I think it's close to a
5965 * General code cleanup and small bugfixes. I think it's close to a
5962 state where it can be released, obviously with a big 'beta'
5966 state where it can be released, obviously with a big 'beta'
5963 warning on it.
5967 warning on it.
5964
5968
5965 * Got the magic function split to work. Now all magics are defined
5969 * Got the magic function split to work. Now all magics are defined
5966 in a separate class. It just organizes things a bit, and now
5970 in a separate class. It just organizes things a bit, and now
5967 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5971 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5968 was too long).
5972 was too long).
5969
5973
5970 * Changed @clear to @reset to avoid potential confusions with
5974 * Changed @clear to @reset to avoid potential confusions with
5971 the shell command clear. Also renamed @cl to @clear, which does
5975 the shell command clear. Also renamed @cl to @clear, which does
5972 exactly what people expect it to from their shell experience.
5976 exactly what people expect it to from their shell experience.
5973
5977
5974 Added a check to the @reset command (since it's so
5978 Added a check to the @reset command (since it's so
5975 destructive, it's probably a good idea to ask for confirmation).
5979 destructive, it's probably a good idea to ask for confirmation).
5976 But now reset only works for full namespace resetting. Since the
5980 But now reset only works for full namespace resetting. Since the
5977 del keyword is already there for deleting a few specific
5981 del keyword is already there for deleting a few specific
5978 variables, I don't see the point of having a redundant magic
5982 variables, I don't see the point of having a redundant magic
5979 function for the same task.
5983 function for the same task.
5980
5984
5981 2001-11-24 Fernando Perez <fperez@colorado.edu>
5985 2001-11-24 Fernando Perez <fperez@colorado.edu>
5982
5986
5983 * Updated the builtin docs (esp. the ? ones).
5987 * Updated the builtin docs (esp. the ? ones).
5984
5988
5985 * Ran all the code through pychecker. Not terribly impressed with
5989 * Ran all the code through pychecker. Not terribly impressed with
5986 it: lots of spurious warnings and didn't really find anything of
5990 it: lots of spurious warnings and didn't really find anything of
5987 substance (just a few modules being imported and not used).
5991 substance (just a few modules being imported and not used).
5988
5992
5989 * Implemented the new ultraTB functionality into IPython. New
5993 * Implemented the new ultraTB functionality into IPython. New
5990 option: xcolors. This chooses color scheme. xmode now only selects
5994 option: xcolors. This chooses color scheme. xmode now only selects
5991 between Plain and Verbose. Better orthogonality.
5995 between Plain and Verbose. Better orthogonality.
5992
5996
5993 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5997 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5994 mode and color scheme for the exception handlers. Now it's
5998 mode and color scheme for the exception handlers. Now it's
5995 possible to have the verbose traceback with no coloring.
5999 possible to have the verbose traceback with no coloring.
5996
6000
5997 2001-11-23 Fernando Perez <fperez@colorado.edu>
6001 2001-11-23 Fernando Perez <fperez@colorado.edu>
5998
6002
5999 * Version 0.1.12 released, 0.1.13 opened.
6003 * Version 0.1.12 released, 0.1.13 opened.
6000
6004
6001 * Removed option to set auto-quote and auto-paren escapes by
6005 * Removed option to set auto-quote and auto-paren escapes by
6002 user. The chances of breaking valid syntax are just too high. If
6006 user. The chances of breaking valid syntax are just too high. If
6003 someone *really* wants, they can always dig into the code.
6007 someone *really* wants, they can always dig into the code.
6004
6008
6005 * Made prompt separators configurable.
6009 * Made prompt separators configurable.
6006
6010
6007 2001-11-22 Fernando Perez <fperez@colorado.edu>
6011 2001-11-22 Fernando Perez <fperez@colorado.edu>
6008
6012
6009 * Small bugfixes in many places.
6013 * Small bugfixes in many places.
6010
6014
6011 * Removed the MyCompleter class from ipplib. It seemed redundant
6015 * Removed the MyCompleter class from ipplib. It seemed redundant
6012 with the C-p,C-n history search functionality. Less code to
6016 with the C-p,C-n history search functionality. Less code to
6013 maintain.
6017 maintain.
6014
6018
6015 * Moved all the original ipython.py code into ipythonlib.py. Right
6019 * Moved all the original ipython.py code into ipythonlib.py. Right
6016 now it's just one big dump into a function called make_IPython, so
6020 now it's just one big dump into a function called make_IPython, so
6017 no real modularity has been gained. But at least it makes the
6021 no real modularity has been gained. But at least it makes the
6018 wrapper script tiny, and since ipythonlib is a module, it gets
6022 wrapper script tiny, and since ipythonlib is a module, it gets
6019 compiled and startup is much faster.
6023 compiled and startup is much faster.
6020
6024
6021 This is a reasobably 'deep' change, so we should test it for a
6025 This is a reasobably 'deep' change, so we should test it for a
6022 while without messing too much more with the code.
6026 while without messing too much more with the code.
6023
6027
6024 2001-11-21 Fernando Perez <fperez@colorado.edu>
6028 2001-11-21 Fernando Perez <fperez@colorado.edu>
6025
6029
6026 * Version 0.1.11 released, 0.1.12 opened for further work.
6030 * Version 0.1.11 released, 0.1.12 opened for further work.
6027
6031
6028 * Removed dependency on Itpl. It was only needed in one place. It
6032 * Removed dependency on Itpl. It was only needed in one place. It
6029 would be nice if this became part of python, though. It makes life
6033 would be nice if this became part of python, though. It makes life
6030 *a lot* easier in some cases.
6034 *a lot* easier in some cases.
6031
6035
6032 * Simplified the prefilter code a bit. Now all handlers are
6036 * Simplified the prefilter code a bit. Now all handlers are
6033 expected to explicitly return a value (at least a blank string).
6037 expected to explicitly return a value (at least a blank string).
6034
6038
6035 * Heavy edits in ipplib. Removed the help system altogether. Now
6039 * Heavy edits in ipplib. Removed the help system altogether. Now
6036 obj?/?? is used for inspecting objects, a magic @doc prints
6040 obj?/?? is used for inspecting objects, a magic @doc prints
6037 docstrings, and full-blown Python help is accessed via the 'help'
6041 docstrings, and full-blown Python help is accessed via the 'help'
6038 keyword. This cleans up a lot of code (less to maintain) and does
6042 keyword. This cleans up a lot of code (less to maintain) and does
6039 the job. Since 'help' is now a standard Python component, might as
6043 the job. Since 'help' is now a standard Python component, might as
6040 well use it and remove duplicate functionality.
6044 well use it and remove duplicate functionality.
6041
6045
6042 Also removed the option to use ipplib as a standalone program. By
6046 Also removed the option to use ipplib as a standalone program. By
6043 now it's too dependent on other parts of IPython to function alone.
6047 now it's too dependent on other parts of IPython to function alone.
6044
6048
6045 * Fixed bug in genutils.pager. It would crash if the pager was
6049 * Fixed bug in genutils.pager. It would crash if the pager was
6046 exited immediately after opening (broken pipe).
6050 exited immediately after opening (broken pipe).
6047
6051
6048 * Trimmed down the VerboseTB reporting a little. The header is
6052 * Trimmed down the VerboseTB reporting a little. The header is
6049 much shorter now and the repeated exception arguments at the end
6053 much shorter now and the repeated exception arguments at the end
6050 have been removed. For interactive use the old header seemed a bit
6054 have been removed. For interactive use the old header seemed a bit
6051 excessive.
6055 excessive.
6052
6056
6053 * Fixed small bug in output of @whos for variables with multi-word
6057 * Fixed small bug in output of @whos for variables with multi-word
6054 types (only first word was displayed).
6058 types (only first word was displayed).
6055
6059
6056 2001-11-17 Fernando Perez <fperez@colorado.edu>
6060 2001-11-17 Fernando Perez <fperez@colorado.edu>
6057
6061
6058 * Version 0.1.10 released, 0.1.11 opened for further work.
6062 * Version 0.1.10 released, 0.1.11 opened for further work.
6059
6063
6060 * Modified dirs and friends. dirs now *returns* the stack (not
6064 * Modified dirs and friends. dirs now *returns* the stack (not
6061 prints), so one can manipulate it as a variable. Convenient to
6065 prints), so one can manipulate it as a variable. Convenient to
6062 travel along many directories.
6066 travel along many directories.
6063
6067
6064 * Fixed bug in magic_pdef: would only work with functions with
6068 * Fixed bug in magic_pdef: would only work with functions with
6065 arguments with default values.
6069 arguments with default values.
6066
6070
6067 2001-11-14 Fernando Perez <fperez@colorado.edu>
6071 2001-11-14 Fernando Perez <fperez@colorado.edu>
6068
6072
6069 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6073 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6070 example with IPython. Various other minor fixes and cleanups.
6074 example with IPython. Various other minor fixes and cleanups.
6071
6075
6072 * Version 0.1.9 released, 0.1.10 opened for further work.
6076 * Version 0.1.9 released, 0.1.10 opened for further work.
6073
6077
6074 * Added sys.path to the list of directories searched in the
6078 * Added sys.path to the list of directories searched in the
6075 execfile= option. It used to be the current directory and the
6079 execfile= option. It used to be the current directory and the
6076 user's IPYTHONDIR only.
6080 user's IPYTHONDIR only.
6077
6081
6078 2001-11-13 Fernando Perez <fperez@colorado.edu>
6082 2001-11-13 Fernando Perez <fperez@colorado.edu>
6079
6083
6080 * Reinstated the raw_input/prefilter separation that Janko had
6084 * Reinstated the raw_input/prefilter separation that Janko had
6081 initially. This gives a more convenient setup for extending the
6085 initially. This gives a more convenient setup for extending the
6082 pre-processor from the outside: raw_input always gets a string,
6086 pre-processor from the outside: raw_input always gets a string,
6083 and prefilter has to process it. We can then redefine prefilter
6087 and prefilter has to process it. We can then redefine prefilter
6084 from the outside and implement extensions for special
6088 from the outside and implement extensions for special
6085 purposes.
6089 purposes.
6086
6090
6087 Today I got one for inputting PhysicalQuantity objects
6091 Today I got one for inputting PhysicalQuantity objects
6088 (from Scientific) without needing any function calls at
6092 (from Scientific) without needing any function calls at
6089 all. Extremely convenient, and it's all done as a user-level
6093 all. Extremely convenient, and it's all done as a user-level
6090 extension (no IPython code was touched). Now instead of:
6094 extension (no IPython code was touched). Now instead of:
6091 a = PhysicalQuantity(4.2,'m/s**2')
6095 a = PhysicalQuantity(4.2,'m/s**2')
6092 one can simply say
6096 one can simply say
6093 a = 4.2 m/s**2
6097 a = 4.2 m/s**2
6094 or even
6098 or even
6095 a = 4.2 m/s^2
6099 a = 4.2 m/s^2
6096
6100
6097 I use this, but it's also a proof of concept: IPython really is
6101 I use this, but it's also a proof of concept: IPython really is
6098 fully user-extensible, even at the level of the parsing of the
6102 fully user-extensible, even at the level of the parsing of the
6099 command line. It's not trivial, but it's perfectly doable.
6103 command line. It's not trivial, but it's perfectly doable.
6100
6104
6101 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6105 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6102 the problem of modules being loaded in the inverse order in which
6106 the problem of modules being loaded in the inverse order in which
6103 they were defined in
6107 they were defined in
6104
6108
6105 * Version 0.1.8 released, 0.1.9 opened for further work.
6109 * Version 0.1.8 released, 0.1.9 opened for further work.
6106
6110
6107 * Added magics pdef, source and file. They respectively show the
6111 * Added magics pdef, source and file. They respectively show the
6108 definition line ('prototype' in C), source code and full python
6112 definition line ('prototype' in C), source code and full python
6109 file for any callable object. The object inspector oinfo uses
6113 file for any callable object. The object inspector oinfo uses
6110 these to show the same information.
6114 these to show the same information.
6111
6115
6112 * Version 0.1.7 released, 0.1.8 opened for further work.
6116 * Version 0.1.7 released, 0.1.8 opened for further work.
6113
6117
6114 * Separated all the magic functions into a class called Magic. The
6118 * Separated all the magic functions into a class called Magic. The
6115 InteractiveShell class was becoming too big for Xemacs to handle
6119 InteractiveShell class was becoming too big for Xemacs to handle
6116 (de-indenting a line would lock it up for 10 seconds while it
6120 (de-indenting a line would lock it up for 10 seconds while it
6117 backtracked on the whole class!)
6121 backtracked on the whole class!)
6118
6122
6119 FIXME: didn't work. It can be done, but right now namespaces are
6123 FIXME: didn't work. It can be done, but right now namespaces are
6120 all messed up. Do it later (reverted it for now, so at least
6124 all messed up. Do it later (reverted it for now, so at least
6121 everything works as before).
6125 everything works as before).
6122
6126
6123 * Got the object introspection system (magic_oinfo) working! I
6127 * Got the object introspection system (magic_oinfo) working! I
6124 think this is pretty much ready for release to Janko, so he can
6128 think this is pretty much ready for release to Janko, so he can
6125 test it for a while and then announce it. Pretty much 100% of what
6129 test it for a while and then announce it. Pretty much 100% of what
6126 I wanted for the 'phase 1' release is ready. Happy, tired.
6130 I wanted for the 'phase 1' release is ready. Happy, tired.
6127
6131
6128 2001-11-12 Fernando Perez <fperez@colorado.edu>
6132 2001-11-12 Fernando Perez <fperez@colorado.edu>
6129
6133
6130 * Version 0.1.6 released, 0.1.7 opened for further work.
6134 * Version 0.1.6 released, 0.1.7 opened for further work.
6131
6135
6132 * Fixed bug in printing: it used to test for truth before
6136 * Fixed bug in printing: it used to test for truth before
6133 printing, so 0 wouldn't print. Now checks for None.
6137 printing, so 0 wouldn't print. Now checks for None.
6134
6138
6135 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6139 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6136 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6140 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6137 reaches by hand into the outputcache. Think of a better way to do
6141 reaches by hand into the outputcache. Think of a better way to do
6138 this later.
6142 this later.
6139
6143
6140 * Various small fixes thanks to Nathan's comments.
6144 * Various small fixes thanks to Nathan's comments.
6141
6145
6142 * Changed magic_pprint to magic_Pprint. This way it doesn't
6146 * Changed magic_pprint to magic_Pprint. This way it doesn't
6143 collide with pprint() and the name is consistent with the command
6147 collide with pprint() and the name is consistent with the command
6144 line option.
6148 line option.
6145
6149
6146 * Changed prompt counter behavior to be fully like
6150 * Changed prompt counter behavior to be fully like
6147 Mathematica's. That is, even input that doesn't return a result
6151 Mathematica's. That is, even input that doesn't return a result
6148 raises the prompt counter. The old behavior was kind of confusing
6152 raises the prompt counter. The old behavior was kind of confusing
6149 (getting the same prompt number several times if the operation
6153 (getting the same prompt number several times if the operation
6150 didn't return a result).
6154 didn't return a result).
6151
6155
6152 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6156 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6153
6157
6154 * Fixed -Classic mode (wasn't working anymore).
6158 * Fixed -Classic mode (wasn't working anymore).
6155
6159
6156 * Added colored prompts using Nathan's new code. Colors are
6160 * Added colored prompts using Nathan's new code. Colors are
6157 currently hardwired, they can be user-configurable. For
6161 currently hardwired, they can be user-configurable. For
6158 developers, they can be chosen in file ipythonlib.py, at the
6162 developers, they can be chosen in file ipythonlib.py, at the
6159 beginning of the CachedOutput class def.
6163 beginning of the CachedOutput class def.
6160
6164
6161 2001-11-11 Fernando Perez <fperez@colorado.edu>
6165 2001-11-11 Fernando Perez <fperez@colorado.edu>
6162
6166
6163 * Version 0.1.5 released, 0.1.6 opened for further work.
6167 * Version 0.1.5 released, 0.1.6 opened for further work.
6164
6168
6165 * Changed magic_env to *return* the environment as a dict (not to
6169 * Changed magic_env to *return* the environment as a dict (not to
6166 print it). This way it prints, but it can also be processed.
6170 print it). This way it prints, but it can also be processed.
6167
6171
6168 * Added Verbose exception reporting to interactive
6172 * Added Verbose exception reporting to interactive
6169 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6173 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6170 traceback. Had to make some changes to the ultraTB file. This is
6174 traceback. Had to make some changes to the ultraTB file. This is
6171 probably the last 'big' thing in my mental todo list. This ties
6175 probably the last 'big' thing in my mental todo list. This ties
6172 in with the next entry:
6176 in with the next entry:
6173
6177
6174 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6178 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6175 has to specify is Plain, Color or Verbose for all exception
6179 has to specify is Plain, Color or Verbose for all exception
6176 handling.
6180 handling.
6177
6181
6178 * Removed ShellServices option. All this can really be done via
6182 * Removed ShellServices option. All this can really be done via
6179 the magic system. It's easier to extend, cleaner and has automatic
6183 the magic system. It's easier to extend, cleaner and has automatic
6180 namespace protection and documentation.
6184 namespace protection and documentation.
6181
6185
6182 2001-11-09 Fernando Perez <fperez@colorado.edu>
6186 2001-11-09 Fernando Perez <fperez@colorado.edu>
6183
6187
6184 * Fixed bug in output cache flushing (missing parameter to
6188 * Fixed bug in output cache flushing (missing parameter to
6185 __init__). Other small bugs fixed (found using pychecker).
6189 __init__). Other small bugs fixed (found using pychecker).
6186
6190
6187 * Version 0.1.4 opened for bugfixing.
6191 * Version 0.1.4 opened for bugfixing.
6188
6192
6189 2001-11-07 Fernando Perez <fperez@colorado.edu>
6193 2001-11-07 Fernando Perez <fperez@colorado.edu>
6190
6194
6191 * Version 0.1.3 released, mainly because of the raw_input bug.
6195 * Version 0.1.3 released, mainly because of the raw_input bug.
6192
6196
6193 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6197 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6194 and when testing for whether things were callable, a call could
6198 and when testing for whether things were callable, a call could
6195 actually be made to certain functions. They would get called again
6199 actually be made to certain functions. They would get called again
6196 once 'really' executed, with a resulting double call. A disaster
6200 once 'really' executed, with a resulting double call. A disaster
6197 in many cases (list.reverse() would never work!).
6201 in many cases (list.reverse() would never work!).
6198
6202
6199 * Removed prefilter() function, moved its code to raw_input (which
6203 * Removed prefilter() function, moved its code to raw_input (which
6200 after all was just a near-empty caller for prefilter). This saves
6204 after all was just a near-empty caller for prefilter). This saves
6201 a function call on every prompt, and simplifies the class a tiny bit.
6205 a function call on every prompt, and simplifies the class a tiny bit.
6202
6206
6203 * Fix _ip to __ip name in magic example file.
6207 * Fix _ip to __ip name in magic example file.
6204
6208
6205 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6209 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6206 work with non-gnu versions of tar.
6210 work with non-gnu versions of tar.
6207
6211
6208 2001-11-06 Fernando Perez <fperez@colorado.edu>
6212 2001-11-06 Fernando Perez <fperez@colorado.edu>
6209
6213
6210 * Version 0.1.2. Just to keep track of the recent changes.
6214 * Version 0.1.2. Just to keep track of the recent changes.
6211
6215
6212 * Fixed nasty bug in output prompt routine. It used to check 'if
6216 * Fixed nasty bug in output prompt routine. It used to check 'if
6213 arg != None...'. Problem is, this fails if arg implements a
6217 arg != None...'. Problem is, this fails if arg implements a
6214 special comparison (__cmp__) which disallows comparing to
6218 special comparison (__cmp__) which disallows comparing to
6215 None. Found it when trying to use the PhysicalQuantity module from
6219 None. Found it when trying to use the PhysicalQuantity module from
6216 ScientificPython.
6220 ScientificPython.
6217
6221
6218 2001-11-05 Fernando Perez <fperez@colorado.edu>
6222 2001-11-05 Fernando Perez <fperez@colorado.edu>
6219
6223
6220 * Also added dirs. Now the pushd/popd/dirs family functions
6224 * Also added dirs. Now the pushd/popd/dirs family functions
6221 basically like the shell, with the added convenience of going home
6225 basically like the shell, with the added convenience of going home
6222 when called with no args.
6226 when called with no args.
6223
6227
6224 * pushd/popd slightly modified to mimic shell behavior more
6228 * pushd/popd slightly modified to mimic shell behavior more
6225 closely.
6229 closely.
6226
6230
6227 * Added env,pushd,popd from ShellServices as magic functions. I
6231 * Added env,pushd,popd from ShellServices as magic functions. I
6228 think the cleanest will be to port all desired functions from
6232 think the cleanest will be to port all desired functions from
6229 ShellServices as magics and remove ShellServices altogether. This
6233 ShellServices as magics and remove ShellServices altogether. This
6230 will provide a single, clean way of adding functionality
6234 will provide a single, clean way of adding functionality
6231 (shell-type or otherwise) to IP.
6235 (shell-type or otherwise) to IP.
6232
6236
6233 2001-11-04 Fernando Perez <fperez@colorado.edu>
6237 2001-11-04 Fernando Perez <fperez@colorado.edu>
6234
6238
6235 * Added .ipython/ directory to sys.path. This way users can keep
6239 * Added .ipython/ directory to sys.path. This way users can keep
6236 customizations there and access them via import.
6240 customizations there and access them via import.
6237
6241
6238 2001-11-03 Fernando Perez <fperez@colorado.edu>
6242 2001-11-03 Fernando Perez <fperez@colorado.edu>
6239
6243
6240 * Opened version 0.1.1 for new changes.
6244 * Opened version 0.1.1 for new changes.
6241
6245
6242 * Changed version number to 0.1.0: first 'public' release, sent to
6246 * Changed version number to 0.1.0: first 'public' release, sent to
6243 Nathan and Janko.
6247 Nathan and Janko.
6244
6248
6245 * Lots of small fixes and tweaks.
6249 * Lots of small fixes and tweaks.
6246
6250
6247 * Minor changes to whos format. Now strings are shown, snipped if
6251 * Minor changes to whos format. Now strings are shown, snipped if
6248 too long.
6252 too long.
6249
6253
6250 * Changed ShellServices to work on __main__ so they show up in @who
6254 * Changed ShellServices to work on __main__ so they show up in @who
6251
6255
6252 * Help also works with ? at the end of a line:
6256 * Help also works with ? at the end of a line:
6253 ?sin and sin?
6257 ?sin and sin?
6254 both produce the same effect. This is nice, as often I use the
6258 both produce the same effect. This is nice, as often I use the
6255 tab-complete to find the name of a method, but I used to then have
6259 tab-complete to find the name of a method, but I used to then have
6256 to go to the beginning of the line to put a ? if I wanted more
6260 to go to the beginning of the line to put a ? if I wanted more
6257 info. Now I can just add the ? and hit return. Convenient.
6261 info. Now I can just add the ? and hit return. Convenient.
6258
6262
6259 2001-11-02 Fernando Perez <fperez@colorado.edu>
6263 2001-11-02 Fernando Perez <fperez@colorado.edu>
6260
6264
6261 * Python version check (>=2.1) added.
6265 * Python version check (>=2.1) added.
6262
6266
6263 * Added LazyPython documentation. At this point the docs are quite
6267 * Added LazyPython documentation. At this point the docs are quite
6264 a mess. A cleanup is in order.
6268 a mess. A cleanup is in order.
6265
6269
6266 * Auto-installer created. For some bizarre reason, the zipfiles
6270 * Auto-installer created. For some bizarre reason, the zipfiles
6267 module isn't working on my system. So I made a tar version
6271 module isn't working on my system. So I made a tar version
6268 (hopefully the command line options in various systems won't kill
6272 (hopefully the command line options in various systems won't kill
6269 me).
6273 me).
6270
6274
6271 * Fixes to Struct in genutils. Now all dictionary-like methods are
6275 * Fixes to Struct in genutils. Now all dictionary-like methods are
6272 protected (reasonably).
6276 protected (reasonably).
6273
6277
6274 * Added pager function to genutils and changed ? to print usage
6278 * Added pager function to genutils and changed ? to print usage
6275 note through it (it was too long).
6279 note through it (it was too long).
6276
6280
6277 * Added the LazyPython functionality. Works great! I changed the
6281 * Added the LazyPython functionality. Works great! I changed the
6278 auto-quote escape to ';', it's on home row and next to '. But
6282 auto-quote escape to ';', it's on home row and next to '. But
6279 both auto-quote and auto-paren (still /) escapes are command-line
6283 both auto-quote and auto-paren (still /) escapes are command-line
6280 parameters.
6284 parameters.
6281
6285
6282
6286
6283 2001-11-01 Fernando Perez <fperez@colorado.edu>
6287 2001-11-01 Fernando Perez <fperez@colorado.edu>
6284
6288
6285 * Version changed to 0.0.7. Fairly large change: configuration now
6289 * Version changed to 0.0.7. Fairly large change: configuration now
6286 is all stored in a directory, by default .ipython. There, all
6290 is all stored in a directory, by default .ipython. There, all
6287 config files have normal looking names (not .names)
6291 config files have normal looking names (not .names)
6288
6292
6289 * Version 0.0.6 Released first to Lucas and Archie as a test
6293 * Version 0.0.6 Released first to Lucas and Archie as a test
6290 run. Since it's the first 'semi-public' release, change version to
6294 run. Since it's the first 'semi-public' release, change version to
6291 > 0.0.6 for any changes now.
6295 > 0.0.6 for any changes now.
6292
6296
6293 * Stuff I had put in the ipplib.py changelog:
6297 * Stuff I had put in the ipplib.py changelog:
6294
6298
6295 Changes to InteractiveShell:
6299 Changes to InteractiveShell:
6296
6300
6297 - Made the usage message a parameter.
6301 - Made the usage message a parameter.
6298
6302
6299 - Require the name of the shell variable to be given. It's a bit
6303 - Require the name of the shell variable to be given. It's a bit
6300 of a hack, but allows the name 'shell' not to be hardwired in the
6304 of a hack, but allows the name 'shell' not to be hardwired in the
6301 magic (@) handler, which is problematic b/c it requires
6305 magic (@) handler, which is problematic b/c it requires
6302 polluting the global namespace with 'shell'. This in turn is
6306 polluting the global namespace with 'shell'. This in turn is
6303 fragile: if a user redefines a variable called shell, things
6307 fragile: if a user redefines a variable called shell, things
6304 break.
6308 break.
6305
6309
6306 - magic @: all functions available through @ need to be defined
6310 - magic @: all functions available through @ need to be defined
6307 as magic_<name>, even though they can be called simply as
6311 as magic_<name>, even though they can be called simply as
6308 @<name>. This allows the special command @magic to gather
6312 @<name>. This allows the special command @magic to gather
6309 information automatically about all existing magic functions,
6313 information automatically about all existing magic functions,
6310 even if they are run-time user extensions, by parsing the shell
6314 even if they are run-time user extensions, by parsing the shell
6311 instance __dict__ looking for special magic_ names.
6315 instance __dict__ looking for special magic_ names.
6312
6316
6313 - mainloop: added *two* local namespace parameters. This allows
6317 - mainloop: added *two* local namespace parameters. This allows
6314 the class to differentiate between parameters which were there
6318 the class to differentiate between parameters which were there
6315 before and after command line initialization was processed. This
6319 before and after command line initialization was processed. This
6316 way, later @who can show things loaded at startup by the
6320 way, later @who can show things loaded at startup by the
6317 user. This trick was necessary to make session saving/reloading
6321 user. This trick was necessary to make session saving/reloading
6318 really work: ideally after saving/exiting/reloading a session,
6322 really work: ideally after saving/exiting/reloading a session,
6319 *everything* should look the same, including the output of @who. I
6323 *everything* should look the same, including the output of @who. I
6320 was only able to make this work with this double namespace
6324 was only able to make this work with this double namespace
6321 trick.
6325 trick.
6322
6326
6323 - added a header to the logfile which allows (almost) full
6327 - added a header to the logfile which allows (almost) full
6324 session restoring.
6328 session restoring.
6325
6329
6326 - prepend lines beginning with @ or !, with a and log
6330 - prepend lines beginning with @ or !, with a and log
6327 them. Why? !lines: may be useful to know what you did @lines:
6331 them. Why? !lines: may be useful to know what you did @lines:
6328 they may affect session state. So when restoring a session, at
6332 they may affect session state. So when restoring a session, at
6329 least inform the user of their presence. I couldn't quite get
6333 least inform the user of their presence. I couldn't quite get
6330 them to properly re-execute, but at least the user is warned.
6334 them to properly re-execute, but at least the user is warned.
6331
6335
6332 * Started ChangeLog.
6336 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now