##// END OF EJS Templates
- Improvements to demo classes and some magic fixes.
fperez -
Show More
@@ -1,3071 +1,3084 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 2066 2007-01-31 18:56:06Z fperez $"""
4 $Id: Magic.py 2104 2007-02-20 10:25:51Z 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 for part in oname_rest:
213 for part in oname_rest:
214 try:
214 try:
215 parent = obj
215 parent = obj
216 obj = getattr(obj,part)
216 obj = getattr(obj,part)
217 except:
217 except:
218 # Blanket except b/c some badly implemented objects
218 # Blanket except b/c some badly implemented objects
219 # allow __getattr__ to raise exceptions other than
219 # allow __getattr__ to raise exceptions other than
220 # AttributeError, which then crashes IPython.
220 # AttributeError, which then crashes IPython.
221 break
221 break
222 else:
222 else:
223 # If we finish the for loop (no break), we got all members
223 # If we finish the for loop (no break), we got all members
224 found = 1
224 found = 1
225 ospace = nsname
225 ospace = nsname
226 if ns == alias_ns:
226 if ns == alias_ns:
227 isalias = 1
227 isalias = 1
228 break # namespace loop
228 break # namespace loop
229
229
230 # Try to see if it's magic
230 # Try to see if it's magic
231 if not found:
231 if not found:
232 if oname.startswith(self.shell.ESC_MAGIC):
232 if oname.startswith(self.shell.ESC_MAGIC):
233 oname = oname[1:]
233 oname = oname[1:]
234 obj = getattr(self,'magic_'+oname,None)
234 obj = getattr(self,'magic_'+oname,None)
235 if obj is not None:
235 if obj is not None:
236 found = 1
236 found = 1
237 ospace = 'IPython internal'
237 ospace = 'IPython internal'
238 ismagic = 1
238 ismagic = 1
239
239
240 # Last try: special-case some literals like '', [], {}, etc:
240 # Last try: special-case some literals like '', [], {}, etc:
241 if not found and oname_head in ["''",'""','[]','{}','()']:
241 if not found and oname_head in ["''",'""','[]','{}','()']:
242 obj = eval(oname_head)
242 obj = eval(oname_head)
243 found = 1
243 found = 1
244 ospace = 'Interactive'
244 ospace = 'Interactive'
245
245
246 return {'found':found, 'obj':obj, 'namespace':ospace,
246 return {'found':found, 'obj':obj, 'namespace':ospace,
247 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
247 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
248
248
249 def arg_err(self,func):
249 def arg_err(self,func):
250 """Print docstring if incorrect arguments were passed"""
250 """Print docstring if incorrect arguments were passed"""
251 print 'Error in arguments:'
251 print 'Error in arguments:'
252 print OInspect.getdoc(func)
252 print OInspect.getdoc(func)
253
253
254 def format_latex(self,strng):
254 def format_latex(self,strng):
255 """Format a string for latex inclusion."""
255 """Format a string for latex inclusion."""
256
256
257 # Characters that need to be escaped for latex:
257 # Characters that need to be escaped for latex:
258 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
258 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
259 # Magic command names as headers:
259 # Magic command names as headers:
260 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
260 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
261 re.MULTILINE)
261 re.MULTILINE)
262 # Magic commands
262 # Magic commands
263 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
263 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
264 re.MULTILINE)
264 re.MULTILINE)
265 # Paragraph continue
265 # Paragraph continue
266 par_re = re.compile(r'\\$',re.MULTILINE)
266 par_re = re.compile(r'\\$',re.MULTILINE)
267
267
268 # The "\n" symbol
268 # The "\n" symbol
269 newline_re = re.compile(r'\\n')
269 newline_re = re.compile(r'\\n')
270
270
271 # Now build the string for output:
271 # Now build the string for output:
272 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
272 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
273 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
273 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
274 strng)
274 strng)
275 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
275 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
276 strng = par_re.sub(r'\\\\',strng)
276 strng = par_re.sub(r'\\\\',strng)
277 strng = escape_re.sub(r'\\\1',strng)
277 strng = escape_re.sub(r'\\\1',strng)
278 strng = newline_re.sub(r'\\textbackslash{}n',strng)
278 strng = newline_re.sub(r'\\textbackslash{}n',strng)
279 return strng
279 return strng
280
280
281 def format_screen(self,strng):
281 def format_screen(self,strng):
282 """Format a string for screen printing.
282 """Format a string for screen printing.
283
283
284 This removes some latex-type format codes."""
284 This removes some latex-type format codes."""
285 # Paragraph continue
285 # Paragraph continue
286 par_re = re.compile(r'\\$',re.MULTILINE)
286 par_re = re.compile(r'\\$',re.MULTILINE)
287 strng = par_re.sub('',strng)
287 strng = par_re.sub('',strng)
288 return strng
288 return strng
289
289
290 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
290 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
291 """Parse options passed to an argument string.
291 """Parse options passed to an argument string.
292
292
293 The interface is similar to that of getopt(), but it returns back a
293 The interface is similar to that of getopt(), but it returns back a
294 Struct with the options as keys and the stripped argument string still
294 Struct with the options as keys and the stripped argument string still
295 as a string.
295 as a string.
296
296
297 arg_str is quoted as a true sys.argv vector by using shlex.split.
297 arg_str is quoted as a true sys.argv vector by using shlex.split.
298 This allows us to easily expand variables, glob files, quote
298 This allows us to easily expand variables, glob files, quote
299 arguments, etc.
299 arguments, etc.
300
300
301 Options:
301 Options:
302 -mode: default 'string'. If given as 'list', the argument string is
302 -mode: default 'string'. If given as 'list', the argument string is
303 returned as a list (split on whitespace) instead of a string.
303 returned as a list (split on whitespace) instead of a string.
304
304
305 -list_all: put all option values in lists. Normally only options
305 -list_all: put all option values in lists. Normally only options
306 appearing more than once are put in a list.
306 appearing more than once are put in a list.
307
307
308 -posix (True): whether to split the input line in POSIX mode or not,
308 -posix (True): whether to split the input line in POSIX mode or not,
309 as per the conventions outlined in the shlex module from the
309 as per the conventions outlined in the shlex module from the
310 standard library."""
310 standard library."""
311
311
312 # inject default options at the beginning of the input line
312 # inject default options at the beginning of the input line
313 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
313 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
314 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
314 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
315
315
316 mode = kw.get('mode','string')
316 mode = kw.get('mode','string')
317 if mode not in ['string','list']:
317 if mode not in ['string','list']:
318 raise ValueError,'incorrect mode given: %s' % mode
318 raise ValueError,'incorrect mode given: %s' % mode
319 # Get options
319 # Get options
320 list_all = kw.get('list_all',0)
320 list_all = kw.get('list_all',0)
321 posix = kw.get('posix',True)
321 posix = kw.get('posix',True)
322
322
323 # Check if we have more than one argument to warrant extra processing:
323 # Check if we have more than one argument to warrant extra processing:
324 odict = {} # Dictionary with options
324 odict = {} # Dictionary with options
325 args = arg_str.split()
325 args = arg_str.split()
326 if len(args) >= 1:
326 if len(args) >= 1:
327 # If the list of inputs only has 0 or 1 thing in it, there's no
327 # If the list of inputs only has 0 or 1 thing in it, there's no
328 # need to look for options
328 # need to look for options
329 argv = arg_split(arg_str,posix)
329 argv = arg_split(arg_str,posix)
330 # Do regular option processing
330 # Do regular option processing
331 try:
331 try:
332 opts,args = getopt(argv,opt_str,*long_opts)
332 opts,args = getopt(argv,opt_str,*long_opts)
333 except GetoptError,e:
333 except GetoptError,e:
334 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
334 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
335 " ".join(long_opts)))
335 " ".join(long_opts)))
336 for o,a in opts:
336 for o,a in opts:
337 if o.startswith('--'):
337 if o.startswith('--'):
338 o = o[2:]
338 o = o[2:]
339 else:
339 else:
340 o = o[1:]
340 o = o[1:]
341 try:
341 try:
342 odict[o].append(a)
342 odict[o].append(a)
343 except AttributeError:
343 except AttributeError:
344 odict[o] = [odict[o],a]
344 odict[o] = [odict[o],a]
345 except KeyError:
345 except KeyError:
346 if list_all:
346 if list_all:
347 odict[o] = [a]
347 odict[o] = [a]
348 else:
348 else:
349 odict[o] = a
349 odict[o] = a
350
350
351 # Prepare opts,args for return
351 # Prepare opts,args for return
352 opts = Struct(odict)
352 opts = Struct(odict)
353 if mode == 'string':
353 if mode == 'string':
354 args = ' '.join(args)
354 args = ' '.join(args)
355
355
356 return opts,args
356 return opts,args
357
357
358 #......................................................................
358 #......................................................................
359 # And now the actual magic functions
359 # And now the actual magic functions
360
360
361 # Functions for IPython shell work (vars,funcs, config, etc)
361 # Functions for IPython shell work (vars,funcs, config, etc)
362 def magic_lsmagic(self, parameter_s = ''):
362 def magic_lsmagic(self, parameter_s = ''):
363 """List currently available magic functions."""
363 """List currently available magic functions."""
364 mesc = self.shell.ESC_MAGIC
364 mesc = self.shell.ESC_MAGIC
365 print 'Available magic functions:\n'+mesc+\
365 print 'Available magic functions:\n'+mesc+\
366 (' '+mesc).join(self.lsmagic())
366 (' '+mesc).join(self.lsmagic())
367 print '\n' + Magic.auto_status[self.shell.rc.automagic]
367 print '\n' + Magic.auto_status[self.shell.rc.automagic]
368 return None
368 return None
369
369
370 def magic_magic(self, parameter_s = ''):
370 def magic_magic(self, parameter_s = ''):
371 """Print information about the magic function system."""
371 """Print information about the magic function system."""
372
372
373 mode = ''
373 mode = ''
374 try:
374 try:
375 if parameter_s.split()[0] == '-latex':
375 if parameter_s.split()[0] == '-latex':
376 mode = 'latex'
376 mode = 'latex'
377 if parameter_s.split()[0] == '-brief':
377 if parameter_s.split()[0] == '-brief':
378 mode = 'brief'
378 mode = 'brief'
379 except:
379 except:
380 pass
380 pass
381
381
382 magic_docs = []
382 magic_docs = []
383 for fname in self.lsmagic():
383 for fname in self.lsmagic():
384 mname = 'magic_' + fname
384 mname = 'magic_' + fname
385 for space in (Magic,self,self.__class__):
385 for space in (Magic,self,self.__class__):
386 try:
386 try:
387 fn = space.__dict__[mname]
387 fn = space.__dict__[mname]
388 except KeyError:
388 except KeyError:
389 pass
389 pass
390 else:
390 else:
391 break
391 break
392 if mode == 'brief':
392 if mode == 'brief':
393 # only first line
393 # only first line
394 fndoc = fn.__doc__.split('\n',1)[0]
394 fndoc = fn.__doc__.split('\n',1)[0]
395 else:
395 else:
396 fndoc = fn.__doc__
396 fndoc = fn.__doc__
397
397
398 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
398 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
399 fname,fndoc))
399 fname,fndoc))
400 magic_docs = ''.join(magic_docs)
400 magic_docs = ''.join(magic_docs)
401
401
402 if mode == 'latex':
402 if mode == 'latex':
403 print self.format_latex(magic_docs)
403 print self.format_latex(magic_docs)
404 return
404 return
405 else:
405 else:
406 magic_docs = self.format_screen(magic_docs)
406 magic_docs = self.format_screen(magic_docs)
407 if mode == 'brief':
407 if mode == 'brief':
408 return magic_docs
408 return magic_docs
409
409
410 outmsg = """
410 outmsg = """
411 IPython's 'magic' functions
411 IPython's 'magic' functions
412 ===========================
412 ===========================
413
413
414 The magic function system provides a series of functions which allow you to
414 The magic function system provides a series of functions which allow you to
415 control the behavior of IPython itself, plus a lot of system-type
415 control the behavior of IPython itself, plus a lot of system-type
416 features. All these functions are prefixed with a % character, but parameters
416 features. All these functions are prefixed with a % character, but parameters
417 are given without parentheses or quotes.
417 are given without parentheses or quotes.
418
418
419 NOTE: If you have 'automagic' enabled (via the command line option or with the
419 NOTE: If you have 'automagic' enabled (via the command line option or with the
420 %automagic function), you don't need to type in the % explicitly. By default,
420 %automagic function), you don't need to type in the % explicitly. By default,
421 IPython ships with automagic on, so you should only rarely need the % escape.
421 IPython ships with automagic on, so you should only rarely need the % escape.
422
422
423 Example: typing '%cd mydir' (without the quotes) changes you working directory
423 Example: typing '%cd mydir' (without the quotes) changes you working directory
424 to 'mydir', if it exists.
424 to 'mydir', if it exists.
425
425
426 You can define your own magic functions to extend the system. See the supplied
426 You can define your own magic functions to extend the system. See the supplied
427 ipythonrc and example-magic.py files for details (in your ipython
427 ipythonrc and example-magic.py files for details (in your ipython
428 configuration directory, typically $HOME/.ipython/).
428 configuration directory, typically $HOME/.ipython/).
429
429
430 You can also define your own aliased names for magic functions. In your
430 You can also define your own aliased names for magic functions. In your
431 ipythonrc file, placing a line like:
431 ipythonrc file, placing a line like:
432
432
433 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
433 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
434
434
435 will define %pf as a new name for %profile.
435 will define %pf as a new name for %profile.
436
436
437 You can also call magics in code using the ipmagic() function, which IPython
437 You can also call magics in code using the ipmagic() function, which IPython
438 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
438 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
439
439
440 For a list of the available magic functions, use %lsmagic. For a description
440 For a list of the available magic functions, use %lsmagic. For a description
441 of any of them, type %magic_name?, e.g. '%cd?'.
441 of any of them, type %magic_name?, e.g. '%cd?'.
442
442
443 Currently the magic system has the following functions:\n"""
443 Currently the magic system has the following functions:\n"""
444
444
445 mesc = self.shell.ESC_MAGIC
445 mesc = self.shell.ESC_MAGIC
446 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
446 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
447 "\n\n%s%s\n\n%s" % (outmsg,
447 "\n\n%s%s\n\n%s" % (outmsg,
448 magic_docs,mesc,mesc,
448 magic_docs,mesc,mesc,
449 (' '+mesc).join(self.lsmagic()),
449 (' '+mesc).join(self.lsmagic()),
450 Magic.auto_status[self.shell.rc.automagic] ) )
450 Magic.auto_status[self.shell.rc.automagic] ) )
451
451
452 page(outmsg,screen_lines=self.shell.rc.screen_length)
452 page(outmsg,screen_lines=self.shell.rc.screen_length)
453
453
454 def magic_automagic(self, parameter_s = ''):
454 def magic_automagic(self, parameter_s = ''):
455 """Make magic functions callable without having to type the initial %.
455 """Make magic functions callable without having to type the initial %.
456
456
457 Toggles on/off (when off, you must call it as %automagic, of
457 Without argumentsl toggles on/off (when off, you must call it as
458 course). Note that magic functions have lowest priority, so if there's
458 %automagic, of course). With arguments it sets the value, and you can
459 a variable whose name collides with that of a magic fn, automagic
459 use any of (case insensitive):
460 won't work for that function (you get the variable instead). However,
460
461 if you delete the variable (del var), the previously shadowed magic
461 - on,1,True: to activate
462 function becomes visible to automagic again."""
462
463 - off,0,False: to deactivate.
464
465 Note that magic functions have lowest priority, so if there's a
466 variable whose name collides with that of a magic fn, automagic won't
467 work for that function (you get the variable instead). However, if you
468 delete the variable (del var), the previously shadowed magic function
469 becomes visible to automagic again."""
463
470
464 rc = self.shell.rc
471 rc = self.shell.rc
472 arg = parameter_s.lower()
473 if parameter_s in ('on','1','true'):
474 rc.automagic = True
475 elif parameter_s in ('off','0','false'):
476 rc.automagic = False
477 else:
465 rc.automagic = not rc.automagic
478 rc.automagic = not rc.automagic
466 print '\n' + Magic.auto_status[rc.automagic]
479 print '\n' + Magic.auto_status[rc.automagic]
467
480
468 def magic_autocall(self, parameter_s = ''):
481 def magic_autocall(self, parameter_s = ''):
469 """Make functions callable without having to type parentheses.
482 """Make functions callable without having to type parentheses.
470
483
471 Usage:
484 Usage:
472
485
473 %autocall [mode]
486 %autocall [mode]
474
487
475 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
488 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
476 value is toggled on and off (remembering the previous state)."""
489 value is toggled on and off (remembering the previous state)."""
477
490
478 rc = self.shell.rc
491 rc = self.shell.rc
479
492
480 if parameter_s:
493 if parameter_s:
481 arg = int(parameter_s)
494 arg = int(parameter_s)
482 else:
495 else:
483 arg = 'toggle'
496 arg = 'toggle'
484
497
485 if not arg in (0,1,2,'toggle'):
498 if not arg in (0,1,2,'toggle'):
486 error('Valid modes: (0->Off, 1->Smart, 2->Full')
499 error('Valid modes: (0->Off, 1->Smart, 2->Full')
487 return
500 return
488
501
489 if arg in (0,1,2):
502 if arg in (0,1,2):
490 rc.autocall = arg
503 rc.autocall = arg
491 else: # toggle
504 else: # toggle
492 if rc.autocall:
505 if rc.autocall:
493 self._magic_state.autocall_save = rc.autocall
506 self._magic_state.autocall_save = rc.autocall
494 rc.autocall = 0
507 rc.autocall = 0
495 else:
508 else:
496 try:
509 try:
497 rc.autocall = self._magic_state.autocall_save
510 rc.autocall = self._magic_state.autocall_save
498 except AttributeError:
511 except AttributeError:
499 rc.autocall = self._magic_state.autocall_save = 1
512 rc.autocall = self._magic_state.autocall_save = 1
500
513
501 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
514 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
502
515
503 def magic_autoindent(self, parameter_s = ''):
516 def magic_autoindent(self, parameter_s = ''):
504 """Toggle autoindent on/off (if available)."""
517 """Toggle autoindent on/off (if available)."""
505
518
506 self.shell.set_autoindent()
519 self.shell.set_autoindent()
507 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
520 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
508
521
509 def magic_system_verbose(self, parameter_s = ''):
522 def magic_system_verbose(self, parameter_s = ''):
510 """Set verbose printing of system calls.
523 """Set verbose printing of system calls.
511
524
512 If called without an argument, act as a toggle"""
525 If called without an argument, act as a toggle"""
513
526
514 if parameter_s:
527 if parameter_s:
515 val = bool(eval(parameter_s))
528 val = bool(eval(parameter_s))
516 else:
529 else:
517 val = None
530 val = None
518
531
519 self.shell.rc_set_toggle('system_verbose',val)
532 self.shell.rc_set_toggle('system_verbose',val)
520 print "System verbose printing is:",\
533 print "System verbose printing is:",\
521 ['OFF','ON'][self.shell.rc.system_verbose]
534 ['OFF','ON'][self.shell.rc.system_verbose]
522
535
523 def magic_history(self, parameter_s = ''):
536 def magic_history(self, parameter_s = ''):
524 """Print input history (_i<n> variables), with most recent last.
537 """Print input history (_i<n> variables), with most recent last.
525
538
526 %history -> print at most 40 inputs (some may be multi-line)\\
539 %history -> print at most 40 inputs (some may be multi-line)\\
527 %history n -> print at most n inputs\\
540 %history n -> print at most n inputs\\
528 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
541 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
529
542
530 Each input's number <n> is shown, and is accessible as the
543 Each input's number <n> is shown, and is accessible as the
531 automatically generated variable _i<n>. Multi-line statements are
544 automatically generated variable _i<n>. Multi-line statements are
532 printed starting at a new line for easy copy/paste.
545 printed starting at a new line for easy copy/paste.
533
546
534
547
535 Options:
548 Options:
536
549
537 -n: do NOT print line numbers. This is useful if you want to get a
550 -n: do NOT print line numbers. This is useful if you want to get a
538 printout of many lines which can be directly pasted into a text
551 printout of many lines which can be directly pasted into a text
539 editor.
552 editor.
540
553
541 This feature is only available if numbered prompts are in use.
554 This feature is only available if numbered prompts are in use.
542
555
543 -r: print the 'raw' history. IPython filters your input and
556 -r: print the 'raw' history. IPython filters your input and
544 converts it all into valid Python source before executing it (things
557 converts it all into valid Python source before executing it (things
545 like magics or aliases are turned into function calls, for
558 like magics or aliases are turned into function calls, for
546 example). With this option, you'll see the unfiltered history
559 example). With this option, you'll see the unfiltered history
547 instead of the filtered version: '%cd /' will be seen as '%cd /'
560 instead of the filtered version: '%cd /' will be seen as '%cd /'
548 instead of '_ip.magic("%cd /")'.
561 instead of '_ip.magic("%cd /")'.
549 """
562 """
550
563
551 shell = self.shell
564 shell = self.shell
552 if not shell.outputcache.do_full_cache:
565 if not shell.outputcache.do_full_cache:
553 print 'This feature is only available if numbered prompts are in use.'
566 print 'This feature is only available if numbered prompts are in use.'
554 return
567 return
555 opts,args = self.parse_options(parameter_s,'nr',mode='list')
568 opts,args = self.parse_options(parameter_s,'nr',mode='list')
556
569
557 if opts.has_key('r'):
570 if opts.has_key('r'):
558 input_hist = shell.input_hist_raw
571 input_hist = shell.input_hist_raw
559 else:
572 else:
560 input_hist = shell.input_hist
573 input_hist = shell.input_hist
561
574
562 default_length = 40
575 default_length = 40
563 if len(args) == 0:
576 if len(args) == 0:
564 final = len(input_hist)
577 final = len(input_hist)
565 init = max(1,final-default_length)
578 init = max(1,final-default_length)
566 elif len(args) == 1:
579 elif len(args) == 1:
567 final = len(input_hist)
580 final = len(input_hist)
568 init = max(1,final-int(args[0]))
581 init = max(1,final-int(args[0]))
569 elif len(args) == 2:
582 elif len(args) == 2:
570 init,final = map(int,args)
583 init,final = map(int,args)
571 else:
584 else:
572 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
585 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
573 print self.magic_hist.__doc__
586 print self.magic_hist.__doc__
574 return
587 return
575 width = len(str(final))
588 width = len(str(final))
576 line_sep = ['','\n']
589 line_sep = ['','\n']
577 print_nums = not opts.has_key('n')
590 print_nums = not opts.has_key('n')
578 for in_num in range(init,final):
591 for in_num in range(init,final):
579 inline = input_hist[in_num]
592 inline = input_hist[in_num]
580 multiline = int(inline.count('\n') > 1)
593 multiline = int(inline.count('\n') > 1)
581 if print_nums:
594 if print_nums:
582 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
595 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
583 print inline,
596 print inline,
584
597
585 def magic_hist(self, parameter_s=''):
598 def magic_hist(self, parameter_s=''):
586 """Alternate name for %history."""
599 """Alternate name for %history."""
587 return self.magic_history(parameter_s)
600 return self.magic_history(parameter_s)
588
601
589 def magic_p(self, parameter_s=''):
602 def magic_p(self, parameter_s=''):
590 """Just a short alias for Python's 'print'."""
603 """Just a short alias for Python's 'print'."""
591 exec 'print ' + parameter_s in self.shell.user_ns
604 exec 'print ' + parameter_s in self.shell.user_ns
592
605
593 def magic_r(self, parameter_s=''):
606 def magic_r(self, parameter_s=''):
594 """Repeat previous input.
607 """Repeat previous input.
595
608
596 If given an argument, repeats the previous command which starts with
609 If given an argument, repeats the previous command which starts with
597 the same string, otherwise it just repeats the previous input.
610 the same string, otherwise it just repeats the previous input.
598
611
599 Shell escaped commands (with ! as first character) are not recognized
612 Shell escaped commands (with ! as first character) are not recognized
600 by this system, only pure python code and magic commands.
613 by this system, only pure python code and magic commands.
601 """
614 """
602
615
603 start = parameter_s.strip()
616 start = parameter_s.strip()
604 esc_magic = self.shell.ESC_MAGIC
617 esc_magic = self.shell.ESC_MAGIC
605 # Identify magic commands even if automagic is on (which means
618 # Identify magic commands even if automagic is on (which means
606 # the in-memory version is different from that typed by the user).
619 # the in-memory version is different from that typed by the user).
607 if self.shell.rc.automagic:
620 if self.shell.rc.automagic:
608 start_magic = esc_magic+start
621 start_magic = esc_magic+start
609 else:
622 else:
610 start_magic = start
623 start_magic = start
611 # Look through the input history in reverse
624 # Look through the input history in reverse
612 for n in range(len(self.shell.input_hist)-2,0,-1):
625 for n in range(len(self.shell.input_hist)-2,0,-1):
613 input = self.shell.input_hist[n]
626 input = self.shell.input_hist[n]
614 # skip plain 'r' lines so we don't recurse to infinity
627 # skip plain 'r' lines so we don't recurse to infinity
615 if input != '_ip.magic("r")\n' and \
628 if input != '_ip.magic("r")\n' and \
616 (input.startswith(start) or input.startswith(start_magic)):
629 (input.startswith(start) or input.startswith(start_magic)):
617 #print 'match',`input` # dbg
630 #print 'match',`input` # dbg
618 print 'Executing:',input,
631 print 'Executing:',input,
619 self.shell.runlines(input)
632 self.shell.runlines(input)
620 return
633 return
621 print 'No previous input matching `%s` found.' % start
634 print 'No previous input matching `%s` found.' % start
622
635
623 def magic_page(self, parameter_s=''):
636 def magic_page(self, parameter_s=''):
624 """Pretty print the object and display it through a pager.
637 """Pretty print the object and display it through a pager.
625
638
626 %page [options] OBJECT
639 %page [options] OBJECT
627
640
628 If no object is given, use _ (last output).
641 If no object is given, use _ (last output).
629
642
630 Options:
643 Options:
631
644
632 -r: page str(object), don't pretty-print it."""
645 -r: page str(object), don't pretty-print it."""
633
646
634 # After a function contributed by Olivier Aubert, slightly modified.
647 # After a function contributed by Olivier Aubert, slightly modified.
635
648
636 # Process options/args
649 # Process options/args
637 opts,args = self.parse_options(parameter_s,'r')
650 opts,args = self.parse_options(parameter_s,'r')
638 raw = 'r' in opts
651 raw = 'r' in opts
639
652
640 oname = args and args or '_'
653 oname = args and args or '_'
641 info = self._ofind(oname)
654 info = self._ofind(oname)
642 if info['found']:
655 if info['found']:
643 txt = (raw and str or pformat)( info['obj'] )
656 txt = (raw and str or pformat)( info['obj'] )
644 page(txt)
657 page(txt)
645 else:
658 else:
646 print 'Object `%s` not found' % oname
659 print 'Object `%s` not found' % oname
647
660
648 def magic_profile(self, parameter_s=''):
661 def magic_profile(self, parameter_s=''):
649 """Print your currently active IPyhton profile."""
662 """Print your currently active IPyhton profile."""
650 if self.shell.rc.profile:
663 if self.shell.rc.profile:
651 printpl('Current IPython profile: $self.shell.rc.profile.')
664 printpl('Current IPython profile: $self.shell.rc.profile.')
652 else:
665 else:
653 print 'No profile active.'
666 print 'No profile active.'
654
667
655 def _inspect(self,meth,oname,namespaces=None,**kw):
668 def _inspect(self,meth,oname,namespaces=None,**kw):
656 """Generic interface to the inspector system.
669 """Generic interface to the inspector system.
657
670
658 This function is meant to be called by pdef, pdoc & friends."""
671 This function is meant to be called by pdef, pdoc & friends."""
659
672
660 oname = oname.strip()
673 oname = oname.strip()
661 info = Struct(self._ofind(oname, namespaces))
674 info = Struct(self._ofind(oname, namespaces))
662
675
663 if info.found:
676 if info.found:
664 # Get the docstring of the class property if it exists.
677 # Get the docstring of the class property if it exists.
665 path = oname.split('.')
678 path = oname.split('.')
666 root = '.'.join(path[:-1])
679 root = '.'.join(path[:-1])
667 if info.parent is not None:
680 if info.parent is not None:
668 try:
681 try:
669 target = getattr(info.parent, '__class__')
682 target = getattr(info.parent, '__class__')
670 # The object belongs to a class instance.
683 # The object belongs to a class instance.
671 try:
684 try:
672 target = getattr(target, path[-1])
685 target = getattr(target, path[-1])
673 # The class defines the object.
686 # The class defines the object.
674 if isinstance(target, property):
687 if isinstance(target, property):
675 oname = root + '.__class__.' + path[-1]
688 oname = root + '.__class__.' + path[-1]
676 info = Struct(self._ofind(oname))
689 info = Struct(self._ofind(oname))
677 except AttributeError: pass
690 except AttributeError: pass
678 except AttributeError: pass
691 except AttributeError: pass
679
692
680 pmethod = getattr(self.shell.inspector,meth)
693 pmethod = getattr(self.shell.inspector,meth)
681 formatter = info.ismagic and self.format_screen or None
694 formatter = info.ismagic and self.format_screen or None
682 if meth == 'pdoc':
695 if meth == 'pdoc':
683 pmethod(info.obj,oname,formatter)
696 pmethod(info.obj,oname,formatter)
684 elif meth == 'pinfo':
697 elif meth == 'pinfo':
685 pmethod(info.obj,oname,formatter,info,**kw)
698 pmethod(info.obj,oname,formatter,info,**kw)
686 else:
699 else:
687 pmethod(info.obj,oname)
700 pmethod(info.obj,oname)
688 else:
701 else:
689 print 'Object `%s` not found.' % oname
702 print 'Object `%s` not found.' % oname
690 return 'not found' # so callers can take other action
703 return 'not found' # so callers can take other action
691
704
692 def magic_pdef(self, parameter_s='', namespaces=None):
705 def magic_pdef(self, parameter_s='', namespaces=None):
693 """Print the definition header for any callable object.
706 """Print the definition header for any callable object.
694
707
695 If the object is a class, print the constructor information."""
708 If the object is a class, print the constructor information."""
696 self._inspect('pdef',parameter_s, namespaces)
709 self._inspect('pdef',parameter_s, namespaces)
697
710
698 def magic_pdoc(self, parameter_s='', namespaces=None):
711 def magic_pdoc(self, parameter_s='', namespaces=None):
699 """Print the docstring for an object.
712 """Print the docstring for an object.
700
713
701 If the given object is a class, it will print both the class and the
714 If the given object is a class, it will print both the class and the
702 constructor docstrings."""
715 constructor docstrings."""
703 self._inspect('pdoc',parameter_s, namespaces)
716 self._inspect('pdoc',parameter_s, namespaces)
704
717
705 def magic_psource(self, parameter_s='', namespaces=None):
718 def magic_psource(self, parameter_s='', namespaces=None):
706 """Print (or run through pager) the source code for an object."""
719 """Print (or run through pager) the source code for an object."""
707 self._inspect('psource',parameter_s, namespaces)
720 self._inspect('psource',parameter_s, namespaces)
708
721
709 def magic_pfile(self, parameter_s=''):
722 def magic_pfile(self, parameter_s=''):
710 """Print (or run through pager) the file where an object is defined.
723 """Print (or run through pager) the file where an object is defined.
711
724
712 The file opens at the line where the object definition begins. IPython
725 The file opens at the line where the object definition begins. IPython
713 will honor the environment variable PAGER if set, and otherwise will
726 will honor the environment variable PAGER if set, and otherwise will
714 do its best to print the file in a convenient form.
727 do its best to print the file in a convenient form.
715
728
716 If the given argument is not an object currently defined, IPython will
729 If the given argument is not an object currently defined, IPython will
717 try to interpret it as a filename (automatically adding a .py extension
730 try to interpret it as a filename (automatically adding a .py extension
718 if needed). You can thus use %pfile as a syntax highlighting code
731 if needed). You can thus use %pfile as a syntax highlighting code
719 viewer."""
732 viewer."""
720
733
721 # first interpret argument as an object name
734 # first interpret argument as an object name
722 out = self._inspect('pfile',parameter_s)
735 out = self._inspect('pfile',parameter_s)
723 # if not, try the input as a filename
736 # if not, try the input as a filename
724 if out == 'not found':
737 if out == 'not found':
725 try:
738 try:
726 filename = get_py_filename(parameter_s)
739 filename = get_py_filename(parameter_s)
727 except IOError,msg:
740 except IOError,msg:
728 print msg
741 print msg
729 return
742 return
730 page(self.shell.inspector.format(file(filename).read()))
743 page(self.shell.inspector.format(file(filename).read()))
731
744
732 def magic_pinfo(self, parameter_s='', namespaces=None):
745 def magic_pinfo(self, parameter_s='', namespaces=None):
733 """Provide detailed information about an object.
746 """Provide detailed information about an object.
734
747
735 '%pinfo object' is just a synonym for object? or ?object."""
748 '%pinfo object' is just a synonym for object? or ?object."""
736
749
737 #print 'pinfo par: <%s>' % parameter_s # dbg
750 #print 'pinfo par: <%s>' % parameter_s # dbg
738
751
739 # detail_level: 0 -> obj? , 1 -> obj??
752 # detail_level: 0 -> obj? , 1 -> obj??
740 detail_level = 0
753 detail_level = 0
741 # We need to detect if we got called as 'pinfo pinfo foo', which can
754 # We need to detect if we got called as 'pinfo pinfo foo', which can
742 # happen if the user types 'pinfo foo?' at the cmd line.
755 # happen if the user types 'pinfo foo?' at the cmd line.
743 pinfo,qmark1,oname,qmark2 = \
756 pinfo,qmark1,oname,qmark2 = \
744 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
757 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
745 if pinfo or qmark1 or qmark2:
758 if pinfo or qmark1 or qmark2:
746 detail_level = 1
759 detail_level = 1
747 if "*" in oname:
760 if "*" in oname:
748 self.magic_psearch(oname)
761 self.magic_psearch(oname)
749 else:
762 else:
750 self._inspect('pinfo', oname, detail_level=detail_level,
763 self._inspect('pinfo', oname, detail_level=detail_level,
751 namespaces=namespaces)
764 namespaces=namespaces)
752
765
753 def magic_psearch(self, parameter_s=''):
766 def magic_psearch(self, parameter_s=''):
754 """Search for object in namespaces by wildcard.
767 """Search for object in namespaces by wildcard.
755
768
756 %psearch [options] PATTERN [OBJECT TYPE]
769 %psearch [options] PATTERN [OBJECT TYPE]
757
770
758 Note: ? can be used as a synonym for %psearch, at the beginning or at
771 Note: ? can be used as a synonym for %psearch, at the beginning or at
759 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
772 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
760 rest of the command line must be unchanged (options come first), so
773 rest of the command line must be unchanged (options come first), so
761 for example the following forms are equivalent
774 for example the following forms are equivalent
762
775
763 %psearch -i a* function
776 %psearch -i a* function
764 -i a* function?
777 -i a* function?
765 ?-i a* function
778 ?-i a* function
766
779
767 Arguments:
780 Arguments:
768
781
769 PATTERN
782 PATTERN
770
783
771 where PATTERN is a string containing * as a wildcard similar to its
784 where PATTERN is a string containing * as a wildcard similar to its
772 use in a shell. The pattern is matched in all namespaces on the
785 use in a shell. The pattern is matched in all namespaces on the
773 search path. By default objects starting with a single _ are not
786 search path. By default objects starting with a single _ are not
774 matched, many IPython generated objects have a single
787 matched, many IPython generated objects have a single
775 underscore. The default is case insensitive matching. Matching is
788 underscore. The default is case insensitive matching. Matching is
776 also done on the attributes of objects and not only on the objects
789 also done on the attributes of objects and not only on the objects
777 in a module.
790 in a module.
778
791
779 [OBJECT TYPE]
792 [OBJECT TYPE]
780
793
781 Is the name of a python type from the types module. The name is
794 Is the name of a python type from the types module. The name is
782 given in lowercase without the ending type, ex. StringType is
795 given in lowercase without the ending type, ex. StringType is
783 written string. By adding a type here only objects matching the
796 written string. By adding a type here only objects matching the
784 given type are matched. Using all here makes the pattern match all
797 given type are matched. Using all here makes the pattern match all
785 types (this is the default).
798 types (this is the default).
786
799
787 Options:
800 Options:
788
801
789 -a: makes the pattern match even objects whose names start with a
802 -a: makes the pattern match even objects whose names start with a
790 single underscore. These names are normally ommitted from the
803 single underscore. These names are normally ommitted from the
791 search.
804 search.
792
805
793 -i/-c: make the pattern case insensitive/sensitive. If neither of
806 -i/-c: make the pattern case insensitive/sensitive. If neither of
794 these options is given, the default is read from your ipythonrc
807 these options is given, the default is read from your ipythonrc
795 file. The option name which sets this value is
808 file. The option name which sets this value is
796 'wildcards_case_sensitive'. If this option is not specified in your
809 'wildcards_case_sensitive'. If this option is not specified in your
797 ipythonrc file, IPython's internal default is to do a case sensitive
810 ipythonrc file, IPython's internal default is to do a case sensitive
798 search.
811 search.
799
812
800 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
813 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
801 specifiy can be searched in any of the following namespaces:
814 specifiy can be searched in any of the following namespaces:
802 'builtin', 'user', 'user_global','internal', 'alias', where
815 'builtin', 'user', 'user_global','internal', 'alias', where
803 'builtin' and 'user' are the search defaults. Note that you should
816 'builtin' and 'user' are the search defaults. Note that you should
804 not use quotes when specifying namespaces.
817 not use quotes when specifying namespaces.
805
818
806 'Builtin' contains the python module builtin, 'user' contains all
819 'Builtin' contains the python module builtin, 'user' contains all
807 user data, 'alias' only contain the shell aliases and no python
820 user data, 'alias' only contain the shell aliases and no python
808 objects, 'internal' contains objects used by IPython. The
821 objects, 'internal' contains objects used by IPython. The
809 'user_global' namespace is only used by embedded IPython instances,
822 'user_global' namespace is only used by embedded IPython instances,
810 and it contains module-level globals. You can add namespaces to the
823 and it contains module-level globals. You can add namespaces to the
811 search with -s or exclude them with -e (these options can be given
824 search with -s or exclude them with -e (these options can be given
812 more than once).
825 more than once).
813
826
814 Examples:
827 Examples:
815
828
816 %psearch a* -> objects beginning with an a
829 %psearch a* -> objects beginning with an a
817 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
830 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
818 %psearch a* function -> all functions beginning with an a
831 %psearch a* function -> all functions beginning with an a
819 %psearch re.e* -> objects beginning with an e in module re
832 %psearch re.e* -> objects beginning with an e in module re
820 %psearch r*.e* -> objects that start with e in modules starting in r
833 %psearch r*.e* -> objects that start with e in modules starting in r
821 %psearch r*.* string -> all strings in modules beginning with r
834 %psearch r*.* string -> all strings in modules beginning with r
822
835
823 Case sensitve search:
836 Case sensitve search:
824
837
825 %psearch -c a* list all object beginning with lower case a
838 %psearch -c a* list all object beginning with lower case a
826
839
827 Show objects beginning with a single _:
840 Show objects beginning with a single _:
828
841
829 %psearch -a _* list objects beginning with a single underscore"""
842 %psearch -a _* list objects beginning with a single underscore"""
830
843
831 # default namespaces to be searched
844 # default namespaces to be searched
832 def_search = ['user','builtin']
845 def_search = ['user','builtin']
833
846
834 # Process options/args
847 # Process options/args
835 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
848 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
836 opt = opts.get
849 opt = opts.get
837 shell = self.shell
850 shell = self.shell
838 psearch = shell.inspector.psearch
851 psearch = shell.inspector.psearch
839
852
840 # select case options
853 # select case options
841 if opts.has_key('i'):
854 if opts.has_key('i'):
842 ignore_case = True
855 ignore_case = True
843 elif opts.has_key('c'):
856 elif opts.has_key('c'):
844 ignore_case = False
857 ignore_case = False
845 else:
858 else:
846 ignore_case = not shell.rc.wildcards_case_sensitive
859 ignore_case = not shell.rc.wildcards_case_sensitive
847
860
848 # Build list of namespaces to search from user options
861 # Build list of namespaces to search from user options
849 def_search.extend(opt('s',[]))
862 def_search.extend(opt('s',[]))
850 ns_exclude = ns_exclude=opt('e',[])
863 ns_exclude = ns_exclude=opt('e',[])
851 ns_search = [nm for nm in def_search if nm not in ns_exclude]
864 ns_search = [nm for nm in def_search if nm not in ns_exclude]
852
865
853 # Call the actual search
866 # Call the actual search
854 try:
867 try:
855 psearch(args,shell.ns_table,ns_search,
868 psearch(args,shell.ns_table,ns_search,
856 show_all=opt('a'),ignore_case=ignore_case)
869 show_all=opt('a'),ignore_case=ignore_case)
857 except:
870 except:
858 shell.showtraceback()
871 shell.showtraceback()
859
872
860 def magic_who_ls(self, parameter_s=''):
873 def magic_who_ls(self, parameter_s=''):
861 """Return a sorted list of all interactive variables.
874 """Return a sorted list of all interactive variables.
862
875
863 If arguments are given, only variables of types matching these
876 If arguments are given, only variables of types matching these
864 arguments are returned."""
877 arguments are returned."""
865
878
866 user_ns = self.shell.user_ns
879 user_ns = self.shell.user_ns
867 internal_ns = self.shell.internal_ns
880 internal_ns = self.shell.internal_ns
868 user_config_ns = self.shell.user_config_ns
881 user_config_ns = self.shell.user_config_ns
869 out = []
882 out = []
870 typelist = parameter_s.split()
883 typelist = parameter_s.split()
871
884
872 for i in user_ns:
885 for i in user_ns:
873 if not (i.startswith('_') or i.startswith('_i')) \
886 if not (i.startswith('_') or i.startswith('_i')) \
874 and not (i in internal_ns or i in user_config_ns):
887 and not (i in internal_ns or i in user_config_ns):
875 if typelist:
888 if typelist:
876 if type(user_ns[i]).__name__ in typelist:
889 if type(user_ns[i]).__name__ in typelist:
877 out.append(i)
890 out.append(i)
878 else:
891 else:
879 out.append(i)
892 out.append(i)
880 out.sort()
893 out.sort()
881 return out
894 return out
882
895
883 def magic_who(self, parameter_s=''):
896 def magic_who(self, parameter_s=''):
884 """Print all interactive variables, with some minimal formatting.
897 """Print all interactive variables, with some minimal formatting.
885
898
886 If any arguments are given, only variables whose type matches one of
899 If any arguments are given, only variables whose type matches one of
887 these are printed. For example:
900 these are printed. For example:
888
901
889 %who function str
902 %who function str
890
903
891 will only list functions and strings, excluding all other types of
904 will only list functions and strings, excluding all other types of
892 variables. To find the proper type names, simply use type(var) at a
905 variables. To find the proper type names, simply use type(var) at a
893 command line to see how python prints type names. For example:
906 command line to see how python prints type names. For example:
894
907
895 In [1]: type('hello')\\
908 In [1]: type('hello')\\
896 Out[1]: <type 'str'>
909 Out[1]: <type 'str'>
897
910
898 indicates that the type name for strings is 'str'.
911 indicates that the type name for strings is 'str'.
899
912
900 %who always excludes executed names loaded through your configuration
913 %who always excludes executed names loaded through your configuration
901 file and things which are internal to IPython.
914 file and things which are internal to IPython.
902
915
903 This is deliberate, as typically you may load many modules and the
916 This is deliberate, as typically you may load many modules and the
904 purpose of %who is to show you only what you've manually defined."""
917 purpose of %who is to show you only what you've manually defined."""
905
918
906 varlist = self.magic_who_ls(parameter_s)
919 varlist = self.magic_who_ls(parameter_s)
907 if not varlist:
920 if not varlist:
908 print 'Interactive namespace is empty.'
921 print 'Interactive namespace is empty.'
909 return
922 return
910
923
911 # if we have variables, move on...
924 # if we have variables, move on...
912
925
913 # stupid flushing problem: when prompts have no separators, stdout is
926 # stupid flushing problem: when prompts have no separators, stdout is
914 # getting lost. I'm starting to think this is a python bug. I'm having
927 # getting lost. I'm starting to think this is a python bug. I'm having
915 # to force a flush with a print because even a sys.stdout.flush
928 # to force a flush with a print because even a sys.stdout.flush
916 # doesn't seem to do anything!
929 # doesn't seem to do anything!
917
930
918 count = 0
931 count = 0
919 for i in varlist:
932 for i in varlist:
920 print i+'\t',
933 print i+'\t',
921 count += 1
934 count += 1
922 if count > 8:
935 if count > 8:
923 count = 0
936 count = 0
924 print
937 print
925 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
938 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
926
939
927 print # well, this does force a flush at the expense of an extra \n
940 print # well, this does force a flush at the expense of an extra \n
928
941
929 def magic_whos(self, parameter_s=''):
942 def magic_whos(self, parameter_s=''):
930 """Like %who, but gives some extra information about each variable.
943 """Like %who, but gives some extra information about each variable.
931
944
932 The same type filtering of %who can be applied here.
945 The same type filtering of %who can be applied here.
933
946
934 For all variables, the type is printed. Additionally it prints:
947 For all variables, the type is printed. Additionally it prints:
935
948
936 - For {},[],(): their length.
949 - For {},[],(): their length.
937
950
938 - For Numeric arrays, a summary with shape, number of elements,
951 - For Numeric arrays, a summary with shape, number of elements,
939 typecode and size in memory.
952 typecode and size in memory.
940
953
941 - Everything else: a string representation, snipping their middle if
954 - Everything else: a string representation, snipping their middle if
942 too long."""
955 too long."""
943
956
944 varnames = self.magic_who_ls(parameter_s)
957 varnames = self.magic_who_ls(parameter_s)
945 if not varnames:
958 if not varnames:
946 print 'Interactive namespace is empty.'
959 print 'Interactive namespace is empty.'
947 return
960 return
948
961
949 # if we have variables, move on...
962 # if we have variables, move on...
950
963
951 # for these types, show len() instead of data:
964 # for these types, show len() instead of data:
952 seq_types = [types.DictType,types.ListType,types.TupleType]
965 seq_types = [types.DictType,types.ListType,types.TupleType]
953
966
954 # for Numeric arrays, display summary info
967 # for Numeric arrays, display summary info
955 try:
968 try:
956 import Numeric
969 import Numeric
957 except ImportError:
970 except ImportError:
958 array_type = None
971 array_type = None
959 else:
972 else:
960 array_type = Numeric.ArrayType.__name__
973 array_type = Numeric.ArrayType.__name__
961
974
962 # Find all variable names and types so we can figure out column sizes
975 # Find all variable names and types so we can figure out column sizes
963
976
964 def get_vars(i):
977 def get_vars(i):
965 return self.shell.user_ns[i]
978 return self.shell.user_ns[i]
966
979
967 # some types are well known and can be shorter
980 # some types are well known and can be shorter
968 abbrevs = {'IPython.macro.Macro' : 'Macro'}
981 abbrevs = {'IPython.macro.Macro' : 'Macro'}
969 def type_name(v):
982 def type_name(v):
970 tn = type(v).__name__
983 tn = type(v).__name__
971 return abbrevs.get(tn,tn)
984 return abbrevs.get(tn,tn)
972
985
973 varlist = map(get_vars,varnames)
986 varlist = map(get_vars,varnames)
974
987
975 typelist = []
988 typelist = []
976 for vv in varlist:
989 for vv in varlist:
977 tt = type_name(vv)
990 tt = type_name(vv)
978
991
979 if tt=='instance':
992 if tt=='instance':
980 typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__)))
993 typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__)))
981 else:
994 else:
982 typelist.append(tt)
995 typelist.append(tt)
983
996
984 # column labels and # of spaces as separator
997 # column labels and # of spaces as separator
985 varlabel = 'Variable'
998 varlabel = 'Variable'
986 typelabel = 'Type'
999 typelabel = 'Type'
987 datalabel = 'Data/Info'
1000 datalabel = 'Data/Info'
988 colsep = 3
1001 colsep = 3
989 # variable format strings
1002 # variable format strings
990 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
1003 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
991 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
1004 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
992 aformat = "%s: %s elems, type `%s`, %s bytes"
1005 aformat = "%s: %s elems, type `%s`, %s bytes"
993 # find the size of the columns to format the output nicely
1006 # find the size of the columns to format the output nicely
994 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
1007 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
995 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
1008 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
996 # table header
1009 # table header
997 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
1010 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
998 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
1011 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
999 # and the table itself
1012 # and the table itself
1000 kb = 1024
1013 kb = 1024
1001 Mb = 1048576 # kb**2
1014 Mb = 1048576 # kb**2
1002 for vname,var,vtype in zip(varnames,varlist,typelist):
1015 for vname,var,vtype in zip(varnames,varlist,typelist):
1003 print itpl(vformat),
1016 print itpl(vformat),
1004 if vtype in seq_types:
1017 if vtype in seq_types:
1005 print len(var)
1018 print len(var)
1006 elif vtype==array_type:
1019 elif vtype==array_type:
1007 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1020 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1008 vsize = Numeric.size(var)
1021 vsize = Numeric.size(var)
1009 vbytes = vsize*var.itemsize()
1022 vbytes = vsize*var.itemsize()
1010 if vbytes < 100000:
1023 if vbytes < 100000:
1011 print aformat % (vshape,vsize,var.typecode(),vbytes)
1024 print aformat % (vshape,vsize,var.typecode(),vbytes)
1012 else:
1025 else:
1013 print aformat % (vshape,vsize,var.typecode(),vbytes),
1026 print aformat % (vshape,vsize,var.typecode(),vbytes),
1014 if vbytes < Mb:
1027 if vbytes < Mb:
1015 print '(%s kb)' % (vbytes/kb,)
1028 print '(%s kb)' % (vbytes/kb,)
1016 else:
1029 else:
1017 print '(%s Mb)' % (vbytes/Mb,)
1030 print '(%s Mb)' % (vbytes/Mb,)
1018 else:
1031 else:
1019 vstr = str(var).replace('\n','\\n')
1032 vstr = str(var).replace('\n','\\n')
1020 if len(vstr) < 50:
1033 if len(vstr) < 50:
1021 print vstr
1034 print vstr
1022 else:
1035 else:
1023 printpl(vfmt_short)
1036 printpl(vfmt_short)
1024
1037
1025 def magic_reset(self, parameter_s=''):
1038 def magic_reset(self, parameter_s=''):
1026 """Resets the namespace by removing all names defined by the user.
1039 """Resets the namespace by removing all names defined by the user.
1027
1040
1028 Input/Output history are left around in case you need them."""
1041 Input/Output history are left around in case you need them."""
1029
1042
1030 ans = self.shell.ask_yes_no(
1043 ans = self.shell.ask_yes_no(
1031 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1044 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1032 if not ans:
1045 if not ans:
1033 print 'Nothing done.'
1046 print 'Nothing done.'
1034 return
1047 return
1035 user_ns = self.shell.user_ns
1048 user_ns = self.shell.user_ns
1036 for i in self.magic_who_ls():
1049 for i in self.magic_who_ls():
1037 del(user_ns[i])
1050 del(user_ns[i])
1038
1051
1039 def magic_logstart(self,parameter_s=''):
1052 def magic_logstart(self,parameter_s=''):
1040 """Start logging anywhere in a session.
1053 """Start logging anywhere in a session.
1041
1054
1042 %logstart [-o|-r|-t] [log_name [log_mode]]
1055 %logstart [-o|-r|-t] [log_name [log_mode]]
1043
1056
1044 If no name is given, it defaults to a file named 'ipython_log.py' in your
1057 If no name is given, it defaults to a file named 'ipython_log.py' in your
1045 current directory, in 'rotate' mode (see below).
1058 current directory, in 'rotate' mode (see below).
1046
1059
1047 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1060 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1048 history up to that point and then continues logging.
1061 history up to that point and then continues logging.
1049
1062
1050 %logstart takes a second optional parameter: logging mode. This can be one
1063 %logstart takes a second optional parameter: logging mode. This can be one
1051 of (note that the modes are given unquoted):\\
1064 of (note that the modes are given unquoted):\\
1052 append: well, that says it.\\
1065 append: well, that says it.\\
1053 backup: rename (if exists) to name~ and start name.\\
1066 backup: rename (if exists) to name~ and start name.\\
1054 global: single logfile in your home dir, appended to.\\
1067 global: single logfile in your home dir, appended to.\\
1055 over : overwrite existing log.\\
1068 over : overwrite existing log.\\
1056 rotate: create rotating logs name.1~, name.2~, etc.
1069 rotate: create rotating logs name.1~, name.2~, etc.
1057
1070
1058 Options:
1071 Options:
1059
1072
1060 -o: log also IPython's output. In this mode, all commands which
1073 -o: log also IPython's output. In this mode, all commands which
1061 generate an Out[NN] prompt are recorded to the logfile, right after
1074 generate an Out[NN] prompt are recorded to the logfile, right after
1062 their corresponding input line. The output lines are always
1075 their corresponding input line. The output lines are always
1063 prepended with a '#[Out]# ' marker, so that the log remains valid
1076 prepended with a '#[Out]# ' marker, so that the log remains valid
1064 Python code.
1077 Python code.
1065
1078
1066 Since this marker is always the same, filtering only the output from
1079 Since this marker is always the same, filtering only the output from
1067 a log is very easy, using for example a simple awk call:
1080 a log is very easy, using for example a simple awk call:
1068
1081
1069 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1082 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1070
1083
1071 -r: log 'raw' input. Normally, IPython's logs contain the processed
1084 -r: log 'raw' input. Normally, IPython's logs contain the processed
1072 input, so that user lines are logged in their final form, converted
1085 input, so that user lines are logged in their final form, converted
1073 into valid Python. For example, %Exit is logged as
1086 into valid Python. For example, %Exit is logged as
1074 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1087 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1075 exactly as typed, with no transformations applied.
1088 exactly as typed, with no transformations applied.
1076
1089
1077 -t: put timestamps before each input line logged (these are put in
1090 -t: put timestamps before each input line logged (these are put in
1078 comments)."""
1091 comments)."""
1079
1092
1080 opts,par = self.parse_options(parameter_s,'ort')
1093 opts,par = self.parse_options(parameter_s,'ort')
1081 log_output = 'o' in opts
1094 log_output = 'o' in opts
1082 log_raw_input = 'r' in opts
1095 log_raw_input = 'r' in opts
1083 timestamp = 't' in opts
1096 timestamp = 't' in opts
1084
1097
1085 rc = self.shell.rc
1098 rc = self.shell.rc
1086 logger = self.shell.logger
1099 logger = self.shell.logger
1087
1100
1088 # if no args are given, the defaults set in the logger constructor by
1101 # if no args are given, the defaults set in the logger constructor by
1089 # ipytohn remain valid
1102 # ipytohn remain valid
1090 if par:
1103 if par:
1091 try:
1104 try:
1092 logfname,logmode = par.split()
1105 logfname,logmode = par.split()
1093 except:
1106 except:
1094 logfname = par
1107 logfname = par
1095 logmode = 'backup'
1108 logmode = 'backup'
1096 else:
1109 else:
1097 logfname = logger.logfname
1110 logfname = logger.logfname
1098 logmode = logger.logmode
1111 logmode = logger.logmode
1099 # put logfname into rc struct as if it had been called on the command
1112 # put logfname into rc struct as if it had been called on the command
1100 # line, so it ends up saved in the log header Save it in case we need
1113 # line, so it ends up saved in the log header Save it in case we need
1101 # to restore it...
1114 # to restore it...
1102 old_logfile = rc.opts.get('logfile','')
1115 old_logfile = rc.opts.get('logfile','')
1103 if logfname:
1116 if logfname:
1104 logfname = os.path.expanduser(logfname)
1117 logfname = os.path.expanduser(logfname)
1105 rc.opts.logfile = logfname
1118 rc.opts.logfile = logfname
1106 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1119 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1107 try:
1120 try:
1108 started = logger.logstart(logfname,loghead,logmode,
1121 started = logger.logstart(logfname,loghead,logmode,
1109 log_output,timestamp,log_raw_input)
1122 log_output,timestamp,log_raw_input)
1110 except:
1123 except:
1111 rc.opts.logfile = old_logfile
1124 rc.opts.logfile = old_logfile
1112 warn("Couldn't start log: %s" % sys.exc_info()[1])
1125 warn("Couldn't start log: %s" % sys.exc_info()[1])
1113 else:
1126 else:
1114 # log input history up to this point, optionally interleaving
1127 # log input history up to this point, optionally interleaving
1115 # output if requested
1128 # output if requested
1116
1129
1117 if timestamp:
1130 if timestamp:
1118 # disable timestamping for the previous history, since we've
1131 # disable timestamping for the previous history, since we've
1119 # lost those already (no time machine here).
1132 # lost those already (no time machine here).
1120 logger.timestamp = False
1133 logger.timestamp = False
1121
1134
1122 if log_raw_input:
1135 if log_raw_input:
1123 input_hist = self.shell.input_hist_raw
1136 input_hist = self.shell.input_hist_raw
1124 else:
1137 else:
1125 input_hist = self.shell.input_hist
1138 input_hist = self.shell.input_hist
1126
1139
1127 if log_output:
1140 if log_output:
1128 log_write = logger.log_write
1141 log_write = logger.log_write
1129 output_hist = self.shell.output_hist
1142 output_hist = self.shell.output_hist
1130 for n in range(1,len(input_hist)-1):
1143 for n in range(1,len(input_hist)-1):
1131 log_write(input_hist[n].rstrip())
1144 log_write(input_hist[n].rstrip())
1132 if n in output_hist:
1145 if n in output_hist:
1133 log_write(repr(output_hist[n]),'output')
1146 log_write(repr(output_hist[n]),'output')
1134 else:
1147 else:
1135 logger.log_write(input_hist[1:])
1148 logger.log_write(input_hist[1:])
1136 if timestamp:
1149 if timestamp:
1137 # re-enable timestamping
1150 # re-enable timestamping
1138 logger.timestamp = True
1151 logger.timestamp = True
1139
1152
1140 print ('Activating auto-logging. '
1153 print ('Activating auto-logging. '
1141 'Current session state plus future input saved.')
1154 'Current session state plus future input saved.')
1142 logger.logstate()
1155 logger.logstate()
1143
1156
1144 def magic_logoff(self,parameter_s=''):
1157 def magic_logoff(self,parameter_s=''):
1145 """Temporarily stop logging.
1158 """Temporarily stop logging.
1146
1159
1147 You must have previously started logging."""
1160 You must have previously started logging."""
1148 self.shell.logger.switch_log(0)
1161 self.shell.logger.switch_log(0)
1149
1162
1150 def magic_logon(self,parameter_s=''):
1163 def magic_logon(self,parameter_s=''):
1151 """Restart logging.
1164 """Restart logging.
1152
1165
1153 This function is for restarting logging which you've temporarily
1166 This function is for restarting logging which you've temporarily
1154 stopped with %logoff. For starting logging for the first time, you
1167 stopped with %logoff. For starting logging for the first time, you
1155 must use the %logstart function, which allows you to specify an
1168 must use the %logstart function, which allows you to specify an
1156 optional log filename."""
1169 optional log filename."""
1157
1170
1158 self.shell.logger.switch_log(1)
1171 self.shell.logger.switch_log(1)
1159
1172
1160 def magic_logstate(self,parameter_s=''):
1173 def magic_logstate(self,parameter_s=''):
1161 """Print the status of the logging system."""
1174 """Print the status of the logging system."""
1162
1175
1163 self.shell.logger.logstate()
1176 self.shell.logger.logstate()
1164
1177
1165 def magic_pdb(self, parameter_s=''):
1178 def magic_pdb(self, parameter_s=''):
1166 """Control the automatic calling of the pdb interactive debugger.
1179 """Control the automatic calling of the pdb interactive debugger.
1167
1180
1168 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1181 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1169 argument it works as a toggle.
1182 argument it works as a toggle.
1170
1183
1171 When an exception is triggered, IPython can optionally call the
1184 When an exception is triggered, IPython can optionally call the
1172 interactive pdb debugger after the traceback printout. %pdb toggles
1185 interactive pdb debugger after the traceback printout. %pdb toggles
1173 this feature on and off.
1186 this feature on and off.
1174
1187
1175 The initial state of this feature is set in your ipythonrc
1188 The initial state of this feature is set in your ipythonrc
1176 configuration file (the variable is called 'pdb').
1189 configuration file (the variable is called 'pdb').
1177
1190
1178 If you want to just activate the debugger AFTER an exception has fired,
1191 If you want to just activate the debugger AFTER an exception has fired,
1179 without having to type '%pdb on' and rerunning your code, you can use
1192 without having to type '%pdb on' and rerunning your code, you can use
1180 the %debug magic."""
1193 the %debug magic."""
1181
1194
1182 par = parameter_s.strip().lower()
1195 par = parameter_s.strip().lower()
1183
1196
1184 if par:
1197 if par:
1185 try:
1198 try:
1186 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1199 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1187 except KeyError:
1200 except KeyError:
1188 print ('Incorrect argument. Use on/1, off/0, '
1201 print ('Incorrect argument. Use on/1, off/0, '
1189 'or nothing for a toggle.')
1202 'or nothing for a toggle.')
1190 return
1203 return
1191 else:
1204 else:
1192 # toggle
1205 # toggle
1193 new_pdb = not self.shell.call_pdb
1206 new_pdb = not self.shell.call_pdb
1194
1207
1195 # set on the shell
1208 # set on the shell
1196 self.shell.call_pdb = new_pdb
1209 self.shell.call_pdb = new_pdb
1197 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1210 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1198
1211
1199 def magic_debug(self, parameter_s=''):
1212 def magic_debug(self, parameter_s=''):
1200 """Activate the interactive debugger in post-mortem mode.
1213 """Activate the interactive debugger in post-mortem mode.
1201
1214
1202 If an exception has just occurred, this lets you inspect its stack
1215 If an exception has just occurred, this lets you inspect its stack
1203 frames interactively. Note that this will always work only on the last
1216 frames interactively. Note that this will always work only on the last
1204 traceback that occurred, so you must call this quickly after an
1217 traceback that occurred, so you must call this quickly after an
1205 exception that you wish to inspect has fired, because if another one
1218 exception that you wish to inspect has fired, because if another one
1206 occurs, it clobbers the previous one.
1219 occurs, it clobbers the previous one.
1207
1220
1208 If you want IPython to automatically do this on every exception, see
1221 If you want IPython to automatically do this on every exception, see
1209 the %pdb magic for more details.
1222 the %pdb magic for more details.
1210 """
1223 """
1211
1224
1212 self.shell.debugger(force=True)
1225 self.shell.debugger(force=True)
1213
1226
1214 def magic_prun(self, parameter_s ='',user_mode=1,
1227 def magic_prun(self, parameter_s ='',user_mode=1,
1215 opts=None,arg_lst=None,prog_ns=None):
1228 opts=None,arg_lst=None,prog_ns=None):
1216
1229
1217 """Run a statement through the python code profiler.
1230 """Run a statement through the python code profiler.
1218
1231
1219 Usage:\\
1232 Usage:\\
1220 %prun [options] statement
1233 %prun [options] statement
1221
1234
1222 The given statement (which doesn't require quote marks) is run via the
1235 The given statement (which doesn't require quote marks) is run via the
1223 python profiler in a manner similar to the profile.run() function.
1236 python profiler in a manner similar to the profile.run() function.
1224 Namespaces are internally managed to work correctly; profile.run
1237 Namespaces are internally managed to work correctly; profile.run
1225 cannot be used in IPython because it makes certain assumptions about
1238 cannot be used in IPython because it makes certain assumptions about
1226 namespaces which do not hold under IPython.
1239 namespaces which do not hold under IPython.
1227
1240
1228 Options:
1241 Options:
1229
1242
1230 -l <limit>: you can place restrictions on what or how much of the
1243 -l <limit>: you can place restrictions on what or how much of the
1231 profile gets printed. The limit value can be:
1244 profile gets printed. The limit value can be:
1232
1245
1233 * A string: only information for function names containing this string
1246 * A string: only information for function names containing this string
1234 is printed.
1247 is printed.
1235
1248
1236 * An integer: only these many lines are printed.
1249 * An integer: only these many lines are printed.
1237
1250
1238 * A float (between 0 and 1): this fraction of the report is printed
1251 * A float (between 0 and 1): this fraction of the report is printed
1239 (for example, use a limit of 0.4 to see the topmost 40% only).
1252 (for example, use a limit of 0.4 to see the topmost 40% only).
1240
1253
1241 You can combine several limits with repeated use of the option. For
1254 You can combine several limits with repeated use of the option. For
1242 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1255 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1243 information about class constructors.
1256 information about class constructors.
1244
1257
1245 -r: return the pstats.Stats object generated by the profiling. This
1258 -r: return the pstats.Stats object generated by the profiling. This
1246 object has all the information about the profile in it, and you can
1259 object has all the information about the profile in it, and you can
1247 later use it for further analysis or in other functions.
1260 later use it for further analysis or in other functions.
1248
1261
1249 -s <key>: sort profile by given key. You can provide more than one key
1262 -s <key>: sort profile by given key. You can provide more than one key
1250 by using the option several times: '-s key1 -s key2 -s key3...'. The
1263 by using the option several times: '-s key1 -s key2 -s key3...'. The
1251 default sorting key is 'time'.
1264 default sorting key is 'time'.
1252
1265
1253 The following is copied verbatim from the profile documentation
1266 The following is copied verbatim from the profile documentation
1254 referenced below:
1267 referenced below:
1255
1268
1256 When more than one key is provided, additional keys are used as
1269 When more than one key is provided, additional keys are used as
1257 secondary criteria when the there is equality in all keys selected
1270 secondary criteria when the there is equality in all keys selected
1258 before them.
1271 before them.
1259
1272
1260 Abbreviations can be used for any key names, as long as the
1273 Abbreviations can be used for any key names, as long as the
1261 abbreviation is unambiguous. The following are the keys currently
1274 abbreviation is unambiguous. The following are the keys currently
1262 defined:
1275 defined:
1263
1276
1264 Valid Arg Meaning\\
1277 Valid Arg Meaning\\
1265 "calls" call count\\
1278 "calls" call count\\
1266 "cumulative" cumulative time\\
1279 "cumulative" cumulative time\\
1267 "file" file name\\
1280 "file" file name\\
1268 "module" file name\\
1281 "module" file name\\
1269 "pcalls" primitive call count\\
1282 "pcalls" primitive call count\\
1270 "line" line number\\
1283 "line" line number\\
1271 "name" function name\\
1284 "name" function name\\
1272 "nfl" name/file/line\\
1285 "nfl" name/file/line\\
1273 "stdname" standard name\\
1286 "stdname" standard name\\
1274 "time" internal time
1287 "time" internal time
1275
1288
1276 Note that all sorts on statistics are in descending order (placing
1289 Note that all sorts on statistics are in descending order (placing
1277 most time consuming items first), where as name, file, and line number
1290 most time consuming items first), where as name, file, and line number
1278 searches are in ascending order (i.e., alphabetical). The subtle
1291 searches are in ascending order (i.e., alphabetical). The subtle
1279 distinction between "nfl" and "stdname" is that the standard name is a
1292 distinction between "nfl" and "stdname" is that the standard name is a
1280 sort of the name as printed, which means that the embedded line
1293 sort of the name as printed, which means that the embedded line
1281 numbers get compared in an odd way. For example, lines 3, 20, and 40
1294 numbers get compared in an odd way. For example, lines 3, 20, and 40
1282 would (if the file names were the same) appear in the string order
1295 would (if the file names were the same) appear in the string order
1283 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1296 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1284 line numbers. In fact, sort_stats("nfl") is the same as
1297 line numbers. In fact, sort_stats("nfl") is the same as
1285 sort_stats("name", "file", "line").
1298 sort_stats("name", "file", "line").
1286
1299
1287 -T <filename>: save profile results as shown on screen to a text
1300 -T <filename>: save profile results as shown on screen to a text
1288 file. The profile is still shown on screen.
1301 file. The profile is still shown on screen.
1289
1302
1290 -D <filename>: save (via dump_stats) profile statistics to given
1303 -D <filename>: save (via dump_stats) profile statistics to given
1291 filename. This data is in a format understod by the pstats module, and
1304 filename. This data is in a format understod by the pstats module, and
1292 is generated by a call to the dump_stats() method of profile
1305 is generated by a call to the dump_stats() method of profile
1293 objects. The profile is still shown on screen.
1306 objects. The profile is still shown on screen.
1294
1307
1295 If you want to run complete programs under the profiler's control, use
1308 If you want to run complete programs under the profiler's control, use
1296 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1309 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1297 contains profiler specific options as described here.
1310 contains profiler specific options as described here.
1298
1311
1299 You can read the complete documentation for the profile module with:\\
1312 You can read the complete documentation for the profile module with:\\
1300 In [1]: import profile; profile.help() """
1313 In [1]: import profile; profile.help() """
1301
1314
1302 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1315 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1303 # protect user quote marks
1316 # protect user quote marks
1304 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1317 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1305
1318
1306 if user_mode: # regular user call
1319 if user_mode: # regular user call
1307 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1320 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1308 list_all=1)
1321 list_all=1)
1309 namespace = self.shell.user_ns
1322 namespace = self.shell.user_ns
1310 else: # called to run a program by %run -p
1323 else: # called to run a program by %run -p
1311 try:
1324 try:
1312 filename = get_py_filename(arg_lst[0])
1325 filename = get_py_filename(arg_lst[0])
1313 except IOError,msg:
1326 except IOError,msg:
1314 error(msg)
1327 error(msg)
1315 return
1328 return
1316
1329
1317 arg_str = 'execfile(filename,prog_ns)'
1330 arg_str = 'execfile(filename,prog_ns)'
1318 namespace = locals()
1331 namespace = locals()
1319
1332
1320 opts.merge(opts_def)
1333 opts.merge(opts_def)
1321
1334
1322 prof = profile.Profile()
1335 prof = profile.Profile()
1323 try:
1336 try:
1324 prof = prof.runctx(arg_str,namespace,namespace)
1337 prof = prof.runctx(arg_str,namespace,namespace)
1325 sys_exit = ''
1338 sys_exit = ''
1326 except SystemExit:
1339 except SystemExit:
1327 sys_exit = """*** SystemExit exception caught in code being profiled."""
1340 sys_exit = """*** SystemExit exception caught in code being profiled."""
1328
1341
1329 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1342 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1330
1343
1331 lims = opts.l
1344 lims = opts.l
1332 if lims:
1345 if lims:
1333 lims = [] # rebuild lims with ints/floats/strings
1346 lims = [] # rebuild lims with ints/floats/strings
1334 for lim in opts.l:
1347 for lim in opts.l:
1335 try:
1348 try:
1336 lims.append(int(lim))
1349 lims.append(int(lim))
1337 except ValueError:
1350 except ValueError:
1338 try:
1351 try:
1339 lims.append(float(lim))
1352 lims.append(float(lim))
1340 except ValueError:
1353 except ValueError:
1341 lims.append(lim)
1354 lims.append(lim)
1342
1355
1343 # trap output
1356 # trap output
1344 sys_stdout = sys.stdout
1357 sys_stdout = sys.stdout
1345 stdout_trap = StringIO()
1358 stdout_trap = StringIO()
1346 try:
1359 try:
1347 sys.stdout = stdout_trap
1360 sys.stdout = stdout_trap
1348 stats.print_stats(*lims)
1361 stats.print_stats(*lims)
1349 finally:
1362 finally:
1350 sys.stdout = sys_stdout
1363 sys.stdout = sys_stdout
1351 output = stdout_trap.getvalue()
1364 output = stdout_trap.getvalue()
1352 output = output.rstrip()
1365 output = output.rstrip()
1353
1366
1354 page(output,screen_lines=self.shell.rc.screen_length)
1367 page(output,screen_lines=self.shell.rc.screen_length)
1355 print sys_exit,
1368 print sys_exit,
1356
1369
1357 dump_file = opts.D[0]
1370 dump_file = opts.D[0]
1358 text_file = opts.T[0]
1371 text_file = opts.T[0]
1359 if dump_file:
1372 if dump_file:
1360 prof.dump_stats(dump_file)
1373 prof.dump_stats(dump_file)
1361 print '\n*** Profile stats marshalled to file',\
1374 print '\n*** Profile stats marshalled to file',\
1362 `dump_file`+'.',sys_exit
1375 `dump_file`+'.',sys_exit
1363 if text_file:
1376 if text_file:
1364 file(text_file,'w').write(output)
1377 file(text_file,'w').write(output)
1365 print '\n*** Profile printout saved to text file',\
1378 print '\n*** Profile printout saved to text file',\
1366 `text_file`+'.',sys_exit
1379 `text_file`+'.',sys_exit
1367
1380
1368 if opts.has_key('r'):
1381 if opts.has_key('r'):
1369 return stats
1382 return stats
1370 else:
1383 else:
1371 return None
1384 return None
1372
1385
1373 def magic_run(self, parameter_s ='',runner=None):
1386 def magic_run(self, parameter_s ='',runner=None):
1374 """Run the named file inside IPython as a program.
1387 """Run the named file inside IPython as a program.
1375
1388
1376 Usage:\\
1389 Usage:\\
1377 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1390 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1378
1391
1379 Parameters after the filename are passed as command-line arguments to
1392 Parameters after the filename are passed as command-line arguments to
1380 the program (put in sys.argv). Then, control returns to IPython's
1393 the program (put in sys.argv). Then, control returns to IPython's
1381 prompt.
1394 prompt.
1382
1395
1383 This is similar to running at a system prompt:\\
1396 This is similar to running at a system prompt:\\
1384 $ python file args\\
1397 $ python file args\\
1385 but with the advantage of giving you IPython's tracebacks, and of
1398 but with the advantage of giving you IPython's tracebacks, and of
1386 loading all variables into your interactive namespace for further use
1399 loading all variables into your interactive namespace for further use
1387 (unless -p is used, see below).
1400 (unless -p is used, see below).
1388
1401
1389 The file is executed in a namespace initially consisting only of
1402 The file is executed in a namespace initially consisting only of
1390 __name__=='__main__' and sys.argv constructed as indicated. It thus
1403 __name__=='__main__' and sys.argv constructed as indicated. It thus
1391 sees its environment as if it were being run as a stand-alone
1404 sees its environment as if it were being run as a stand-alone
1392 program. But after execution, the IPython interactive namespace gets
1405 program. But after execution, the IPython interactive namespace gets
1393 updated with all variables defined in the program (except for __name__
1406 updated with all variables defined in the program (except for __name__
1394 and sys.argv). This allows for very convenient loading of code for
1407 and sys.argv). This allows for very convenient loading of code for
1395 interactive work, while giving each program a 'clean sheet' to run in.
1408 interactive work, while giving each program a 'clean sheet' to run in.
1396
1409
1397 Options:
1410 Options:
1398
1411
1399 -n: __name__ is NOT set to '__main__', but to the running file's name
1412 -n: __name__ is NOT set to '__main__', but to the running file's name
1400 without extension (as python does under import). This allows running
1413 without extension (as python does under import). This allows running
1401 scripts and reloading the definitions in them without calling code
1414 scripts and reloading the definitions in them without calling code
1402 protected by an ' if __name__ == "__main__" ' clause.
1415 protected by an ' if __name__ == "__main__" ' clause.
1403
1416
1404 -i: run the file in IPython's namespace instead of an empty one. This
1417 -i: run the file in IPython's namespace instead of an empty one. This
1405 is useful if you are experimenting with code written in a text editor
1418 is useful if you are experimenting with code written in a text editor
1406 which depends on variables defined interactively.
1419 which depends on variables defined interactively.
1407
1420
1408 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1421 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1409 being run. This is particularly useful if IPython is being used to
1422 being run. This is particularly useful if IPython is being used to
1410 run unittests, which always exit with a sys.exit() call. In such
1423 run unittests, which always exit with a sys.exit() call. In such
1411 cases you are interested in the output of the test results, not in
1424 cases you are interested in the output of the test results, not in
1412 seeing a traceback of the unittest module.
1425 seeing a traceback of the unittest module.
1413
1426
1414 -t: print timing information at the end of the run. IPython will give
1427 -t: print timing information at the end of the run. IPython will give
1415 you an estimated CPU time consumption for your script, which under
1428 you an estimated CPU time consumption for your script, which under
1416 Unix uses the resource module to avoid the wraparound problems of
1429 Unix uses the resource module to avoid the wraparound problems of
1417 time.clock(). Under Unix, an estimate of time spent on system tasks
1430 time.clock(). Under Unix, an estimate of time spent on system tasks
1418 is also given (for Windows platforms this is reported as 0.0).
1431 is also given (for Windows platforms this is reported as 0.0).
1419
1432
1420 If -t is given, an additional -N<N> option can be given, where <N>
1433 If -t is given, an additional -N<N> option can be given, where <N>
1421 must be an integer indicating how many times you want the script to
1434 must be an integer indicating how many times you want the script to
1422 run. The final timing report will include total and per run results.
1435 run. The final timing report will include total and per run results.
1423
1436
1424 For example (testing the script uniq_stable.py):
1437 For example (testing the script uniq_stable.py):
1425
1438
1426 In [1]: run -t uniq_stable
1439 In [1]: run -t uniq_stable
1427
1440
1428 IPython CPU timings (estimated):\\
1441 IPython CPU timings (estimated):\\
1429 User : 0.19597 s.\\
1442 User : 0.19597 s.\\
1430 System: 0.0 s.\\
1443 System: 0.0 s.\\
1431
1444
1432 In [2]: run -t -N5 uniq_stable
1445 In [2]: run -t -N5 uniq_stable
1433
1446
1434 IPython CPU timings (estimated):\\
1447 IPython CPU timings (estimated):\\
1435 Total runs performed: 5\\
1448 Total runs performed: 5\\
1436 Times : Total Per run\\
1449 Times : Total Per run\\
1437 User : 0.910862 s, 0.1821724 s.\\
1450 User : 0.910862 s, 0.1821724 s.\\
1438 System: 0.0 s, 0.0 s.
1451 System: 0.0 s, 0.0 s.
1439
1452
1440 -d: run your program under the control of pdb, the Python debugger.
1453 -d: run your program under the control of pdb, the Python debugger.
1441 This allows you to execute your program step by step, watch variables,
1454 This allows you to execute your program step by step, watch variables,
1442 etc. Internally, what IPython does is similar to calling:
1455 etc. Internally, what IPython does is similar to calling:
1443
1456
1444 pdb.run('execfile("YOURFILENAME")')
1457 pdb.run('execfile("YOURFILENAME")')
1445
1458
1446 with a breakpoint set on line 1 of your file. You can change the line
1459 with a breakpoint set on line 1 of your file. You can change the line
1447 number for this automatic breakpoint to be <N> by using the -bN option
1460 number for this automatic breakpoint to be <N> by using the -bN option
1448 (where N must be an integer). For example:
1461 (where N must be an integer). For example:
1449
1462
1450 %run -d -b40 myscript
1463 %run -d -b40 myscript
1451
1464
1452 will set the first breakpoint at line 40 in myscript.py. Note that
1465 will set the first breakpoint at line 40 in myscript.py. Note that
1453 the first breakpoint must be set on a line which actually does
1466 the first breakpoint must be set on a line which actually does
1454 something (not a comment or docstring) for it to stop execution.
1467 something (not a comment or docstring) for it to stop execution.
1455
1468
1456 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1469 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1457 first enter 'c' (without qoutes) to start execution up to the first
1470 first enter 'c' (without qoutes) to start execution up to the first
1458 breakpoint.
1471 breakpoint.
1459
1472
1460 Entering 'help' gives information about the use of the debugger. You
1473 Entering 'help' gives information about the use of the debugger. You
1461 can easily see pdb's full documentation with "import pdb;pdb.help()"
1474 can easily see pdb's full documentation with "import pdb;pdb.help()"
1462 at a prompt.
1475 at a prompt.
1463
1476
1464 -p: run program under the control of the Python profiler module (which
1477 -p: run program under the control of the Python profiler module (which
1465 prints a detailed report of execution times, function calls, etc).
1478 prints a detailed report of execution times, function calls, etc).
1466
1479
1467 You can pass other options after -p which affect the behavior of the
1480 You can pass other options after -p which affect the behavior of the
1468 profiler itself. See the docs for %prun for details.
1481 profiler itself. See the docs for %prun for details.
1469
1482
1470 In this mode, the program's variables do NOT propagate back to the
1483 In this mode, the program's variables do NOT propagate back to the
1471 IPython interactive namespace (because they remain in the namespace
1484 IPython interactive namespace (because they remain in the namespace
1472 where the profiler executes them).
1485 where the profiler executes them).
1473
1486
1474 Internally this triggers a call to %prun, see its documentation for
1487 Internally this triggers a call to %prun, see its documentation for
1475 details on the options available specifically for profiling.
1488 details on the options available specifically for profiling.
1476
1489
1477 There is one special usage for which the text above doesn't apply:
1490 There is one special usage for which the text above doesn't apply:
1478 if the filename ends with .ipy, the file is run as ipython script,
1491 if the filename ends with .ipy, the file is run as ipython script,
1479 just as if the commands were written on IPython prompt.
1492 just as if the commands were written on IPython prompt.
1480 """
1493 """
1481
1494
1482 # get arguments and set sys.argv for program to be run.
1495 # get arguments and set sys.argv for program to be run.
1483 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1496 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1484 mode='list',list_all=1)
1497 mode='list',list_all=1)
1485
1498
1486 try:
1499 try:
1487 filename = get_py_filename(arg_lst[0])
1500 filename = get_py_filename(arg_lst[0])
1488 except IndexError:
1501 except IndexError:
1489 warn('you must provide at least a filename.')
1502 warn('you must provide at least a filename.')
1490 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1503 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1491 return
1504 return
1492 except IOError,msg:
1505 except IOError,msg:
1493 error(msg)
1506 error(msg)
1494 return
1507 return
1495
1508
1496 if filename.lower().endswith('.ipy'):
1509 if filename.lower().endswith('.ipy'):
1497 self.api.runlines(open(filename).read())
1510 self.api.runlines(open(filename).read())
1498 return
1511 return
1499
1512
1500 # Control the response to exit() calls made by the script being run
1513 # Control the response to exit() calls made by the script being run
1501 exit_ignore = opts.has_key('e')
1514 exit_ignore = opts.has_key('e')
1502
1515
1503 # Make sure that the running script gets a proper sys.argv as if it
1516 # Make sure that the running script gets a proper sys.argv as if it
1504 # were run from a system shell.
1517 # were run from a system shell.
1505 save_argv = sys.argv # save it for later restoring
1518 save_argv = sys.argv # save it for later restoring
1506 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1519 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1507
1520
1508 if opts.has_key('i'):
1521 if opts.has_key('i'):
1509 prog_ns = self.shell.user_ns
1522 prog_ns = self.shell.user_ns
1510 __name__save = self.shell.user_ns['__name__']
1523 __name__save = self.shell.user_ns['__name__']
1511 prog_ns['__name__'] = '__main__'
1524 prog_ns['__name__'] = '__main__'
1512 else:
1525 else:
1513 if opts.has_key('n'):
1526 if opts.has_key('n'):
1514 name = os.path.splitext(os.path.basename(filename))[0]
1527 name = os.path.splitext(os.path.basename(filename))[0]
1515 else:
1528 else:
1516 name = '__main__'
1529 name = '__main__'
1517 prog_ns = {'__name__':name}
1530 prog_ns = {'__name__':name}
1518
1531
1519 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1532 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1520 # set the __file__ global in the script's namespace
1533 # set the __file__ global in the script's namespace
1521 prog_ns['__file__'] = filename
1534 prog_ns['__file__'] = filename
1522
1535
1523 # pickle fix. See iplib for an explanation. But we need to make sure
1536 # pickle fix. See iplib for an explanation. But we need to make sure
1524 # that, if we overwrite __main__, we replace it at the end
1537 # that, if we overwrite __main__, we replace it at the end
1525 if prog_ns['__name__'] == '__main__':
1538 if prog_ns['__name__'] == '__main__':
1526 restore_main = sys.modules['__main__']
1539 restore_main = sys.modules['__main__']
1527 else:
1540 else:
1528 restore_main = False
1541 restore_main = False
1529
1542
1530 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1543 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1531
1544
1532 stats = None
1545 stats = None
1533 try:
1546 try:
1534 if self.shell.has_readline:
1547 if self.shell.has_readline:
1535 self.shell.savehist()
1548 self.shell.savehist()
1536
1549
1537 if opts.has_key('p'):
1550 if opts.has_key('p'):
1538 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1551 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1539 else:
1552 else:
1540 if opts.has_key('d'):
1553 if opts.has_key('d'):
1541 deb = Debugger.Pdb(self.shell.rc.colors)
1554 deb = Debugger.Pdb(self.shell.rc.colors)
1542 # reset Breakpoint state, which is moronically kept
1555 # reset Breakpoint state, which is moronically kept
1543 # in a class
1556 # in a class
1544 bdb.Breakpoint.next = 1
1557 bdb.Breakpoint.next = 1
1545 bdb.Breakpoint.bplist = {}
1558 bdb.Breakpoint.bplist = {}
1546 bdb.Breakpoint.bpbynumber = [None]
1559 bdb.Breakpoint.bpbynumber = [None]
1547 # Set an initial breakpoint to stop execution
1560 # Set an initial breakpoint to stop execution
1548 maxtries = 10
1561 maxtries = 10
1549 bp = int(opts.get('b',[1])[0])
1562 bp = int(opts.get('b',[1])[0])
1550 checkline = deb.checkline(filename,bp)
1563 checkline = deb.checkline(filename,bp)
1551 if not checkline:
1564 if not checkline:
1552 for bp in range(bp+1,bp+maxtries+1):
1565 for bp in range(bp+1,bp+maxtries+1):
1553 if deb.checkline(filename,bp):
1566 if deb.checkline(filename,bp):
1554 break
1567 break
1555 else:
1568 else:
1556 msg = ("\nI failed to find a valid line to set "
1569 msg = ("\nI failed to find a valid line to set "
1557 "a breakpoint\n"
1570 "a breakpoint\n"
1558 "after trying up to line: %s.\n"
1571 "after trying up to line: %s.\n"
1559 "Please set a valid breakpoint manually "
1572 "Please set a valid breakpoint manually "
1560 "with the -b option." % bp)
1573 "with the -b option." % bp)
1561 error(msg)
1574 error(msg)
1562 return
1575 return
1563 # if we find a good linenumber, set the breakpoint
1576 # if we find a good linenumber, set the breakpoint
1564 deb.do_break('%s:%s' % (filename,bp))
1577 deb.do_break('%s:%s' % (filename,bp))
1565 # Start file run
1578 # Start file run
1566 print "NOTE: Enter 'c' at the",
1579 print "NOTE: Enter 'c' at the",
1567 print "%s prompt to start your script." % deb.prompt
1580 print "%s prompt to start your script." % deb.prompt
1568 try:
1581 try:
1569 deb.run('execfile("%s")' % filename,prog_ns)
1582 deb.run('execfile("%s")' % filename,prog_ns)
1570
1583
1571 except:
1584 except:
1572 etype, value, tb = sys.exc_info()
1585 etype, value, tb = sys.exc_info()
1573 # Skip three frames in the traceback: the %run one,
1586 # Skip three frames in the traceback: the %run one,
1574 # one inside bdb.py, and the command-line typed by the
1587 # one inside bdb.py, and the command-line typed by the
1575 # user (run by exec in pdb itself).
1588 # user (run by exec in pdb itself).
1576 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1589 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1577 else:
1590 else:
1578 if runner is None:
1591 if runner is None:
1579 runner = self.shell.safe_execfile
1592 runner = self.shell.safe_execfile
1580 if opts.has_key('t'):
1593 if opts.has_key('t'):
1581 try:
1594 try:
1582 nruns = int(opts['N'][0])
1595 nruns = int(opts['N'][0])
1583 if nruns < 1:
1596 if nruns < 1:
1584 error('Number of runs must be >=1')
1597 error('Number of runs must be >=1')
1585 return
1598 return
1586 except (KeyError):
1599 except (KeyError):
1587 nruns = 1
1600 nruns = 1
1588 if nruns == 1:
1601 if nruns == 1:
1589 t0 = clock2()
1602 t0 = clock2()
1590 runner(filename,prog_ns,prog_ns,
1603 runner(filename,prog_ns,prog_ns,
1591 exit_ignore=exit_ignore)
1604 exit_ignore=exit_ignore)
1592 t1 = clock2()
1605 t1 = clock2()
1593 t_usr = t1[0]-t0[0]
1606 t_usr = t1[0]-t0[0]
1594 t_sys = t1[1]-t1[1]
1607 t_sys = t1[1]-t1[1]
1595 print "\nIPython CPU timings (estimated):"
1608 print "\nIPython CPU timings (estimated):"
1596 print " User : %10s s." % t_usr
1609 print " User : %10s s." % t_usr
1597 print " System: %10s s." % t_sys
1610 print " System: %10s s." % t_sys
1598 else:
1611 else:
1599 runs = range(nruns)
1612 runs = range(nruns)
1600 t0 = clock2()
1613 t0 = clock2()
1601 for nr in runs:
1614 for nr in runs:
1602 runner(filename,prog_ns,prog_ns,
1615 runner(filename,prog_ns,prog_ns,
1603 exit_ignore=exit_ignore)
1616 exit_ignore=exit_ignore)
1604 t1 = clock2()
1617 t1 = clock2()
1605 t_usr = t1[0]-t0[0]
1618 t_usr = t1[0]-t0[0]
1606 t_sys = t1[1]-t1[1]
1619 t_sys = t1[1]-t1[1]
1607 print "\nIPython CPU timings (estimated):"
1620 print "\nIPython CPU timings (estimated):"
1608 print "Total runs performed:",nruns
1621 print "Total runs performed:",nruns
1609 print " Times : %10s %10s" % ('Total','Per run')
1622 print " Times : %10s %10s" % ('Total','Per run')
1610 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1623 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1611 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1624 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1612
1625
1613 else:
1626 else:
1614 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1627 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1615 if opts.has_key('i'):
1628 if opts.has_key('i'):
1616 self.shell.user_ns['__name__'] = __name__save
1629 self.shell.user_ns['__name__'] = __name__save
1617 else:
1630 else:
1618 # update IPython interactive namespace
1631 # update IPython interactive namespace
1619 del prog_ns['__name__']
1632 del prog_ns['__name__']
1620 self.shell.user_ns.update(prog_ns)
1633 self.shell.user_ns.update(prog_ns)
1621 finally:
1634 finally:
1622 sys.argv = save_argv
1635 sys.argv = save_argv
1623 if restore_main:
1636 if restore_main:
1624 sys.modules['__main__'] = restore_main
1637 sys.modules['__main__'] = restore_main
1625 if self.shell.has_readline:
1638 if self.shell.has_readline:
1626 self.shell.readline.read_history_file(self.shell.histfile)
1639 self.shell.readline.read_history_file(self.shell.histfile)
1627
1640
1628 return stats
1641 return stats
1629
1642
1630 def magic_runlog(self, parameter_s =''):
1643 def magic_runlog(self, parameter_s =''):
1631 """Run files as logs.
1644 """Run files as logs.
1632
1645
1633 Usage:\\
1646 Usage:\\
1634 %runlog file1 file2 ...
1647 %runlog file1 file2 ...
1635
1648
1636 Run the named files (treating them as log files) in sequence inside
1649 Run the named files (treating them as log files) in sequence inside
1637 the interpreter, and return to the prompt. This is much slower than
1650 the interpreter, and return to the prompt. This is much slower than
1638 %run because each line is executed in a try/except block, but it
1651 %run because each line is executed in a try/except block, but it
1639 allows running files with syntax errors in them.
1652 allows running files with syntax errors in them.
1640
1653
1641 Normally IPython will guess when a file is one of its own logfiles, so
1654 Normally IPython will guess when a file is one of its own logfiles, so
1642 you can typically use %run even for logs. This shorthand allows you to
1655 you can typically use %run even for logs. This shorthand allows you to
1643 force any file to be treated as a log file."""
1656 force any file to be treated as a log file."""
1644
1657
1645 for f in parameter_s.split():
1658 for f in parameter_s.split():
1646 self.shell.safe_execfile(f,self.shell.user_ns,
1659 self.shell.safe_execfile(f,self.shell.user_ns,
1647 self.shell.user_ns,islog=1)
1660 self.shell.user_ns,islog=1)
1648
1661
1649 def magic_timeit(self, parameter_s =''):
1662 def magic_timeit(self, parameter_s =''):
1650 """Time execution of a Python statement or expression
1663 """Time execution of a Python statement or expression
1651
1664
1652 Usage:\\
1665 Usage:\\
1653 %timeit [-n<N> -r<R> [-t|-c]] statement
1666 %timeit [-n<N> -r<R> [-t|-c]] statement
1654
1667
1655 Time execution of a Python statement or expression using the timeit
1668 Time execution of a Python statement or expression using the timeit
1656 module.
1669 module.
1657
1670
1658 Options:
1671 Options:
1659 -n<N>: execute the given statement <N> times in a loop. If this value
1672 -n<N>: execute the given statement <N> times in a loop. If this value
1660 is not given, a fitting value is chosen.
1673 is not given, a fitting value is chosen.
1661
1674
1662 -r<R>: repeat the loop iteration <R> times and take the best result.
1675 -r<R>: repeat the loop iteration <R> times and take the best result.
1663 Default: 3
1676 Default: 3
1664
1677
1665 -t: use time.time to measure the time, which is the default on Unix.
1678 -t: use time.time to measure the time, which is the default on Unix.
1666 This function measures wall time.
1679 This function measures wall time.
1667
1680
1668 -c: use time.clock to measure the time, which is the default on
1681 -c: use time.clock to measure the time, which is the default on
1669 Windows and measures wall time. On Unix, resource.getrusage is used
1682 Windows and measures wall time. On Unix, resource.getrusage is used
1670 instead and returns the CPU user time.
1683 instead and returns the CPU user time.
1671
1684
1672 -p<P>: use a precision of <P> digits to display the timing result.
1685 -p<P>: use a precision of <P> digits to display the timing result.
1673 Default: 3
1686 Default: 3
1674
1687
1675
1688
1676 Examples:\\
1689 Examples:\\
1677 In [1]: %timeit pass
1690 In [1]: %timeit pass
1678 10000000 loops, best of 3: 53.3 ns per loop
1691 10000000 loops, best of 3: 53.3 ns per loop
1679
1692
1680 In [2]: u = None
1693 In [2]: u = None
1681
1694
1682 In [3]: %timeit u is None
1695 In [3]: %timeit u is None
1683 10000000 loops, best of 3: 184 ns per loop
1696 10000000 loops, best of 3: 184 ns per loop
1684
1697
1685 In [4]: %timeit -r 4 u == None
1698 In [4]: %timeit -r 4 u == None
1686 1000000 loops, best of 4: 242 ns per loop
1699 1000000 loops, best of 4: 242 ns per loop
1687
1700
1688 In [5]: import time
1701 In [5]: import time
1689
1702
1690 In [6]: %timeit -n1 time.sleep(2)
1703 In [6]: %timeit -n1 time.sleep(2)
1691 1 loops, best of 3: 2 s per loop
1704 1 loops, best of 3: 2 s per loop
1692
1705
1693
1706
1694 The times reported by %timeit will be slightly higher than those
1707 The times reported by %timeit will be slightly higher than those
1695 reported by the timeit.py script when variables are accessed. This is
1708 reported by the timeit.py script when variables are accessed. This is
1696 due to the fact that %timeit executes the statement in the namespace
1709 due to the fact that %timeit executes the statement in the namespace
1697 of the shell, compared with timeit.py, which uses a single setup
1710 of the shell, compared with timeit.py, which uses a single setup
1698 statement to import function or create variables. Generally, the bias
1711 statement to import function or create variables. Generally, the bias
1699 does not matter as long as results from timeit.py are not mixed with
1712 does not matter as long as results from timeit.py are not mixed with
1700 those from %timeit."""
1713 those from %timeit."""
1701
1714
1702 import timeit
1715 import timeit
1703 import math
1716 import math
1704
1717
1705 units = ["s", "ms", "\xc2\xb5s", "ns"]
1718 units = ["s", "ms", "\xc2\xb5s", "ns"]
1706 scaling = [1, 1e3, 1e6, 1e9]
1719 scaling = [1, 1e3, 1e6, 1e9]
1707
1720
1708 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1721 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1709 posix=False)
1722 posix=False)
1710 if stmt == "":
1723 if stmt == "":
1711 return
1724 return
1712 timefunc = timeit.default_timer
1725 timefunc = timeit.default_timer
1713 number = int(getattr(opts, "n", 0))
1726 number = int(getattr(opts, "n", 0))
1714 repeat = int(getattr(opts, "r", timeit.default_repeat))
1727 repeat = int(getattr(opts, "r", timeit.default_repeat))
1715 precision = int(getattr(opts, "p", 3))
1728 precision = int(getattr(opts, "p", 3))
1716 if hasattr(opts, "t"):
1729 if hasattr(opts, "t"):
1717 timefunc = time.time
1730 timefunc = time.time
1718 if hasattr(opts, "c"):
1731 if hasattr(opts, "c"):
1719 timefunc = clock
1732 timefunc = clock
1720
1733
1721 timer = timeit.Timer(timer=timefunc)
1734 timer = timeit.Timer(timer=timefunc)
1722 # this code has tight coupling to the inner workings of timeit.Timer,
1735 # this code has tight coupling to the inner workings of timeit.Timer,
1723 # but is there a better way to achieve that the code stmt has access
1736 # but is there a better way to achieve that the code stmt has access
1724 # to the shell namespace?
1737 # to the shell namespace?
1725
1738
1726 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1739 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1727 'setup': "pass"}
1740 'setup': "pass"}
1728 code = compile(src, "<magic-timeit>", "exec")
1741 code = compile(src, "<magic-timeit>", "exec")
1729 ns = {}
1742 ns = {}
1730 exec code in self.shell.user_ns, ns
1743 exec code in self.shell.user_ns, ns
1731 timer.inner = ns["inner"]
1744 timer.inner = ns["inner"]
1732
1745
1733 if number == 0:
1746 if number == 0:
1734 # determine number so that 0.2 <= total time < 2.0
1747 # determine number so that 0.2 <= total time < 2.0
1735 number = 1
1748 number = 1
1736 for i in range(1, 10):
1749 for i in range(1, 10):
1737 number *= 10
1750 number *= 10
1738 if timer.timeit(number) >= 0.2:
1751 if timer.timeit(number) >= 0.2:
1739 break
1752 break
1740
1753
1741 best = min(timer.repeat(repeat, number)) / number
1754 best = min(timer.repeat(repeat, number)) / number
1742
1755
1743 if best > 0.0:
1756 if best > 0.0:
1744 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1757 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1745 else:
1758 else:
1746 order = 3
1759 order = 3
1747 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1760 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1748 precision,
1761 precision,
1749 best * scaling[order],
1762 best * scaling[order],
1750 units[order])
1763 units[order])
1751
1764
1752 def magic_time(self,parameter_s = ''):
1765 def magic_time(self,parameter_s = ''):
1753 """Time execution of a Python statement or expression.
1766 """Time execution of a Python statement or expression.
1754
1767
1755 The CPU and wall clock times are printed, and the value of the
1768 The CPU and wall clock times are printed, and the value of the
1756 expression (if any) is returned. Note that under Win32, system time
1769 expression (if any) is returned. Note that under Win32, system time
1757 is always reported as 0, since it can not be measured.
1770 is always reported as 0, since it can not be measured.
1758
1771
1759 This function provides very basic timing functionality. In Python
1772 This function provides very basic timing functionality. In Python
1760 2.3, the timeit module offers more control and sophistication, so this
1773 2.3, the timeit module offers more control and sophistication, so this
1761 could be rewritten to use it (patches welcome).
1774 could be rewritten to use it (patches welcome).
1762
1775
1763 Some examples:
1776 Some examples:
1764
1777
1765 In [1]: time 2**128
1778 In [1]: time 2**128
1766 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1779 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1767 Wall time: 0.00
1780 Wall time: 0.00
1768 Out[1]: 340282366920938463463374607431768211456L
1781 Out[1]: 340282366920938463463374607431768211456L
1769
1782
1770 In [2]: n = 1000000
1783 In [2]: n = 1000000
1771
1784
1772 In [3]: time sum(range(n))
1785 In [3]: time sum(range(n))
1773 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1786 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1774 Wall time: 1.37
1787 Wall time: 1.37
1775 Out[3]: 499999500000L
1788 Out[3]: 499999500000L
1776
1789
1777 In [4]: time print 'hello world'
1790 In [4]: time print 'hello world'
1778 hello world
1791 hello world
1779 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1792 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1780 Wall time: 0.00
1793 Wall time: 0.00
1781 """
1794 """
1782
1795
1783 # fail immediately if the given expression can't be compiled
1796 # fail immediately if the given expression can't be compiled
1784 try:
1797 try:
1785 mode = 'eval'
1798 mode = 'eval'
1786 code = compile(parameter_s,'<timed eval>',mode)
1799 code = compile(parameter_s,'<timed eval>',mode)
1787 except SyntaxError:
1800 except SyntaxError:
1788 mode = 'exec'
1801 mode = 'exec'
1789 code = compile(parameter_s,'<timed exec>',mode)
1802 code = compile(parameter_s,'<timed exec>',mode)
1790 # skew measurement as little as possible
1803 # skew measurement as little as possible
1791 glob = self.shell.user_ns
1804 glob = self.shell.user_ns
1792 clk = clock2
1805 clk = clock2
1793 wtime = time.time
1806 wtime = time.time
1794 # time execution
1807 # time execution
1795 wall_st = wtime()
1808 wall_st = wtime()
1796 if mode=='eval':
1809 if mode=='eval':
1797 st = clk()
1810 st = clk()
1798 out = eval(code,glob)
1811 out = eval(code,glob)
1799 end = clk()
1812 end = clk()
1800 else:
1813 else:
1801 st = clk()
1814 st = clk()
1802 exec code in glob
1815 exec code in glob
1803 end = clk()
1816 end = clk()
1804 out = None
1817 out = None
1805 wall_end = wtime()
1818 wall_end = wtime()
1806 # Compute actual times and report
1819 # Compute actual times and report
1807 wall_time = wall_end-wall_st
1820 wall_time = wall_end-wall_st
1808 cpu_user = end[0]-st[0]
1821 cpu_user = end[0]-st[0]
1809 cpu_sys = end[1]-st[1]
1822 cpu_sys = end[1]-st[1]
1810 cpu_tot = cpu_user+cpu_sys
1823 cpu_tot = cpu_user+cpu_sys
1811 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1824 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1812 (cpu_user,cpu_sys,cpu_tot)
1825 (cpu_user,cpu_sys,cpu_tot)
1813 print "Wall time: %.2f" % wall_time
1826 print "Wall time: %.2f" % wall_time
1814 return out
1827 return out
1815
1828
1816 def magic_macro(self,parameter_s = ''):
1829 def magic_macro(self,parameter_s = ''):
1817 """Define a set of input lines as a macro for future re-execution.
1830 """Define a set of input lines as a macro for future re-execution.
1818
1831
1819 Usage:\\
1832 Usage:\\
1820 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1833 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1821
1834
1822 Options:
1835 Options:
1823
1836
1824 -r: use 'raw' input. By default, the 'processed' history is used,
1837 -r: use 'raw' input. By default, the 'processed' history is used,
1825 so that magics are loaded in their transformed version to valid
1838 so that magics are loaded in their transformed version to valid
1826 Python. If this option is given, the raw input as typed as the
1839 Python. If this option is given, the raw input as typed as the
1827 command line is used instead.
1840 command line is used instead.
1828
1841
1829 This will define a global variable called `name` which is a string
1842 This will define a global variable called `name` which is a string
1830 made of joining the slices and lines you specify (n1,n2,... numbers
1843 made of joining the slices and lines you specify (n1,n2,... numbers
1831 above) from your input history into a single string. This variable
1844 above) from your input history into a single string. This variable
1832 acts like an automatic function which re-executes those lines as if
1845 acts like an automatic function which re-executes those lines as if
1833 you had typed them. You just type 'name' at the prompt and the code
1846 you had typed them. You just type 'name' at the prompt and the code
1834 executes.
1847 executes.
1835
1848
1836 The notation for indicating number ranges is: n1-n2 means 'use line
1849 The notation for indicating number ranges is: n1-n2 means 'use line
1837 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1850 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1838 using the lines numbered 5,6 and 7.
1851 using the lines numbered 5,6 and 7.
1839
1852
1840 Note: as a 'hidden' feature, you can also use traditional python slice
1853 Note: as a 'hidden' feature, you can also use traditional python slice
1841 notation, where N:M means numbers N through M-1.
1854 notation, where N:M means numbers N through M-1.
1842
1855
1843 For example, if your history contains (%hist prints it):
1856 For example, if your history contains (%hist prints it):
1844
1857
1845 44: x=1\\
1858 44: x=1\\
1846 45: y=3\\
1859 45: y=3\\
1847 46: z=x+y\\
1860 46: z=x+y\\
1848 47: print x\\
1861 47: print x\\
1849 48: a=5\\
1862 48: a=5\\
1850 49: print 'x',x,'y',y\\
1863 49: print 'x',x,'y',y\\
1851
1864
1852 you can create a macro with lines 44 through 47 (included) and line 49
1865 you can create a macro with lines 44 through 47 (included) and line 49
1853 called my_macro with:
1866 called my_macro with:
1854
1867
1855 In [51]: %macro my_macro 44-47 49
1868 In [51]: %macro my_macro 44-47 49
1856
1869
1857 Now, typing `my_macro` (without quotes) will re-execute all this code
1870 Now, typing `my_macro` (without quotes) will re-execute all this code
1858 in one pass.
1871 in one pass.
1859
1872
1860 You don't need to give the line-numbers in order, and any given line
1873 You don't need to give the line-numbers in order, and any given line
1861 number can appear multiple times. You can assemble macros with any
1874 number can appear multiple times. You can assemble macros with any
1862 lines from your input history in any order.
1875 lines from your input history in any order.
1863
1876
1864 The macro is a simple object which holds its value in an attribute,
1877 The macro is a simple object which holds its value in an attribute,
1865 but IPython's display system checks for macros and executes them as
1878 but IPython's display system checks for macros and executes them as
1866 code instead of printing them when you type their name.
1879 code instead of printing them when you type their name.
1867
1880
1868 You can view a macro's contents by explicitly printing it with:
1881 You can view a macro's contents by explicitly printing it with:
1869
1882
1870 'print macro_name'.
1883 'print macro_name'.
1871
1884
1872 For one-off cases which DON'T contain magic function calls in them you
1885 For one-off cases which DON'T contain magic function calls in them you
1873 can obtain similar results by explicitly executing slices from your
1886 can obtain similar results by explicitly executing slices from your
1874 input history with:
1887 input history with:
1875
1888
1876 In [60]: exec In[44:48]+In[49]"""
1889 In [60]: exec In[44:48]+In[49]"""
1877
1890
1878 opts,args = self.parse_options(parameter_s,'r',mode='list')
1891 opts,args = self.parse_options(parameter_s,'r',mode='list')
1879 name,ranges = args[0], args[1:]
1892 name,ranges = args[0], args[1:]
1880 #print 'rng',ranges # dbg
1893 #print 'rng',ranges # dbg
1881 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1894 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1882 macro = Macro(lines)
1895 macro = Macro(lines)
1883 self.shell.user_ns.update({name:macro})
1896 self.shell.user_ns.update({name:macro})
1884 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1897 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1885 print 'Macro contents:'
1898 print 'Macro contents:'
1886 print macro,
1899 print macro,
1887
1900
1888 def magic_save(self,parameter_s = ''):
1901 def magic_save(self,parameter_s = ''):
1889 """Save a set of lines to a given filename.
1902 """Save a set of lines to a given filename.
1890
1903
1891 Usage:\\
1904 Usage:\\
1892 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1905 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1893
1906
1894 Options:
1907 Options:
1895
1908
1896 -r: use 'raw' input. By default, the 'processed' history is used,
1909 -r: use 'raw' input. By default, the 'processed' history is used,
1897 so that magics are loaded in their transformed version to valid
1910 so that magics are loaded in their transformed version to valid
1898 Python. If this option is given, the raw input as typed as the
1911 Python. If this option is given, the raw input as typed as the
1899 command line is used instead.
1912 command line is used instead.
1900
1913
1901 This function uses the same syntax as %macro for line extraction, but
1914 This function uses the same syntax as %macro for line extraction, but
1902 instead of creating a macro it saves the resulting string to the
1915 instead of creating a macro it saves the resulting string to the
1903 filename you specify.
1916 filename you specify.
1904
1917
1905 It adds a '.py' extension to the file if you don't do so yourself, and
1918 It adds a '.py' extension to the file if you don't do so yourself, and
1906 it asks for confirmation before overwriting existing files."""
1919 it asks for confirmation before overwriting existing files."""
1907
1920
1908 opts,args = self.parse_options(parameter_s,'r',mode='list')
1921 opts,args = self.parse_options(parameter_s,'r',mode='list')
1909 fname,ranges = args[0], args[1:]
1922 fname,ranges = args[0], args[1:]
1910 if not fname.endswith('.py'):
1923 if not fname.endswith('.py'):
1911 fname += '.py'
1924 fname += '.py'
1912 if os.path.isfile(fname):
1925 if os.path.isfile(fname):
1913 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1926 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1914 if ans.lower() not in ['y','yes']:
1927 if ans.lower() not in ['y','yes']:
1915 print 'Operation cancelled.'
1928 print 'Operation cancelled.'
1916 return
1929 return
1917 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1930 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1918 f = file(fname,'w')
1931 f = file(fname,'w')
1919 f.write(cmds)
1932 f.write(cmds)
1920 f.close()
1933 f.close()
1921 print 'The following commands were written to file `%s`:' % fname
1934 print 'The following commands were written to file `%s`:' % fname
1922 print cmds
1935 print cmds
1923
1936
1924 def _edit_macro(self,mname,macro):
1937 def _edit_macro(self,mname,macro):
1925 """open an editor with the macro data in a file"""
1938 """open an editor with the macro data in a file"""
1926 filename = self.shell.mktempfile(macro.value)
1939 filename = self.shell.mktempfile(macro.value)
1927 self.shell.hooks.editor(filename)
1940 self.shell.hooks.editor(filename)
1928
1941
1929 # and make a new macro object, to replace the old one
1942 # and make a new macro object, to replace the old one
1930 mfile = open(filename)
1943 mfile = open(filename)
1931 mvalue = mfile.read()
1944 mvalue = mfile.read()
1932 mfile.close()
1945 mfile.close()
1933 self.shell.user_ns[mname] = Macro(mvalue)
1946 self.shell.user_ns[mname] = Macro(mvalue)
1934
1947
1935 def magic_ed(self,parameter_s=''):
1948 def magic_ed(self,parameter_s=''):
1936 """Alias to %edit."""
1949 """Alias to %edit."""
1937 return self.magic_edit(parameter_s)
1950 return self.magic_edit(parameter_s)
1938
1951
1939 def magic_edit(self,parameter_s='',last_call=['','']):
1952 def magic_edit(self,parameter_s='',last_call=['','']):
1940 """Bring up an editor and execute the resulting code.
1953 """Bring up an editor and execute the resulting code.
1941
1954
1942 Usage:
1955 Usage:
1943 %edit [options] [args]
1956 %edit [options] [args]
1944
1957
1945 %edit runs IPython's editor hook. The default version of this hook is
1958 %edit runs IPython's editor hook. The default version of this hook is
1946 set to call the __IPYTHON__.rc.editor command. This is read from your
1959 set to call the __IPYTHON__.rc.editor command. This is read from your
1947 environment variable $EDITOR. If this isn't found, it will default to
1960 environment variable $EDITOR. If this isn't found, it will default to
1948 vi under Linux/Unix and to notepad under Windows. See the end of this
1961 vi under Linux/Unix and to notepad under Windows. See the end of this
1949 docstring for how to change the editor hook.
1962 docstring for how to change the editor hook.
1950
1963
1951 You can also set the value of this editor via the command line option
1964 You can also set the value of this editor via the command line option
1952 '-editor' or in your ipythonrc file. This is useful if you wish to use
1965 '-editor' or in your ipythonrc file. This is useful if you wish to use
1953 specifically for IPython an editor different from your typical default
1966 specifically for IPython an editor different from your typical default
1954 (and for Windows users who typically don't set environment variables).
1967 (and for Windows users who typically don't set environment variables).
1955
1968
1956 This command allows you to conveniently edit multi-line code right in
1969 This command allows you to conveniently edit multi-line code right in
1957 your IPython session.
1970 your IPython session.
1958
1971
1959 If called without arguments, %edit opens up an empty editor with a
1972 If called without arguments, %edit opens up an empty editor with a
1960 temporary file and will execute the contents of this file when you
1973 temporary file and will execute the contents of this file when you
1961 close it (don't forget to save it!).
1974 close it (don't forget to save it!).
1962
1975
1963
1976
1964 Options:
1977 Options:
1965
1978
1966 -n <number>: open the editor at a specified line number. By default,
1979 -n <number>: open the editor at a specified line number. By default,
1967 the IPython editor hook uses the unix syntax 'editor +N filename', but
1980 the IPython editor hook uses the unix syntax 'editor +N filename', but
1968 you can configure this by providing your own modified hook if your
1981 you can configure this by providing your own modified hook if your
1969 favorite editor supports line-number specifications with a different
1982 favorite editor supports line-number specifications with a different
1970 syntax.
1983 syntax.
1971
1984
1972 -p: this will call the editor with the same data as the previous time
1985 -p: this will call the editor with the same data as the previous time
1973 it was used, regardless of how long ago (in your current session) it
1986 it was used, regardless of how long ago (in your current session) it
1974 was.
1987 was.
1975
1988
1976 -r: use 'raw' input. This option only applies to input taken from the
1989 -r: use 'raw' input. This option only applies to input taken from the
1977 user's history. By default, the 'processed' history is used, so that
1990 user's history. By default, the 'processed' history is used, so that
1978 magics are loaded in their transformed version to valid Python. If
1991 magics are loaded in their transformed version to valid Python. If
1979 this option is given, the raw input as typed as the command line is
1992 this option is given, the raw input as typed as the command line is
1980 used instead. When you exit the editor, it will be executed by
1993 used instead. When you exit the editor, it will be executed by
1981 IPython's own processor.
1994 IPython's own processor.
1982
1995
1983 -x: do not execute the edited code immediately upon exit. This is
1996 -x: do not execute the edited code immediately upon exit. This is
1984 mainly useful if you are editing programs which need to be called with
1997 mainly useful if you are editing programs which need to be called with
1985 command line arguments, which you can then do using %run.
1998 command line arguments, which you can then do using %run.
1986
1999
1987
2000
1988 Arguments:
2001 Arguments:
1989
2002
1990 If arguments are given, the following possibilites exist:
2003 If arguments are given, the following possibilites exist:
1991
2004
1992 - The arguments are numbers or pairs of colon-separated numbers (like
2005 - The arguments are numbers or pairs of colon-separated numbers (like
1993 1 4:8 9). These are interpreted as lines of previous input to be
2006 1 4:8 9). These are interpreted as lines of previous input to be
1994 loaded into the editor. The syntax is the same of the %macro command.
2007 loaded into the editor. The syntax is the same of the %macro command.
1995
2008
1996 - If the argument doesn't start with a number, it is evaluated as a
2009 - If the argument doesn't start with a number, it is evaluated as a
1997 variable and its contents loaded into the editor. You can thus edit
2010 variable and its contents loaded into the editor. You can thus edit
1998 any string which contains python code (including the result of
2011 any string which contains python code (including the result of
1999 previous edits).
2012 previous edits).
2000
2013
2001 - If the argument is the name of an object (other than a string),
2014 - If the argument is the name of an object (other than a string),
2002 IPython will try to locate the file where it was defined and open the
2015 IPython will try to locate the file where it was defined and open the
2003 editor at the point where it is defined. You can use `%edit function`
2016 editor at the point where it is defined. You can use `%edit function`
2004 to load an editor exactly at the point where 'function' is defined,
2017 to load an editor exactly at the point where 'function' is defined,
2005 edit it and have the file be executed automatically.
2018 edit it and have the file be executed automatically.
2006
2019
2007 If the object is a macro (see %macro for details), this opens up your
2020 If the object is a macro (see %macro for details), this opens up your
2008 specified editor with a temporary file containing the macro's data.
2021 specified editor with a temporary file containing the macro's data.
2009 Upon exit, the macro is reloaded with the contents of the file.
2022 Upon exit, the macro is reloaded with the contents of the file.
2010
2023
2011 Note: opening at an exact line is only supported under Unix, and some
2024 Note: opening at an exact line is only supported under Unix, and some
2012 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2025 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2013 '+NUMBER' parameter necessary for this feature. Good editors like
2026 '+NUMBER' parameter necessary for this feature. Good editors like
2014 (X)Emacs, vi, jed, pico and joe all do.
2027 (X)Emacs, vi, jed, pico and joe all do.
2015
2028
2016 - If the argument is not found as a variable, IPython will look for a
2029 - If the argument is not found as a variable, IPython will look for a
2017 file with that name (adding .py if necessary) and load it into the
2030 file with that name (adding .py if necessary) and load it into the
2018 editor. It will execute its contents with execfile() when you exit,
2031 editor. It will execute its contents with execfile() when you exit,
2019 loading any code in the file into your interactive namespace.
2032 loading any code in the file into your interactive namespace.
2020
2033
2021 After executing your code, %edit will return as output the code you
2034 After executing your code, %edit will return as output the code you
2022 typed in the editor (except when it was an existing file). This way
2035 typed in the editor (except when it was an existing file). This way
2023 you can reload the code in further invocations of %edit as a variable,
2036 you can reload the code in further invocations of %edit as a variable,
2024 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2037 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2025 the output.
2038 the output.
2026
2039
2027 Note that %edit is also available through the alias %ed.
2040 Note that %edit is also available through the alias %ed.
2028
2041
2029 This is an example of creating a simple function inside the editor and
2042 This is an example of creating a simple function inside the editor and
2030 then modifying it. First, start up the editor:
2043 then modifying it. First, start up the editor:
2031
2044
2032 In [1]: ed\\
2045 In [1]: ed\\
2033 Editing... done. Executing edited code...\\
2046 Editing... done. Executing edited code...\\
2034 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2047 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2035
2048
2036 We can then call the function foo():
2049 We can then call the function foo():
2037
2050
2038 In [2]: foo()\\
2051 In [2]: foo()\\
2039 foo() was defined in an editing session
2052 foo() was defined in an editing session
2040
2053
2041 Now we edit foo. IPython automatically loads the editor with the
2054 Now we edit foo. IPython automatically loads the editor with the
2042 (temporary) file where foo() was previously defined:
2055 (temporary) file where foo() was previously defined:
2043
2056
2044 In [3]: ed foo\\
2057 In [3]: ed foo\\
2045 Editing... done. Executing edited code...
2058 Editing... done. Executing edited code...
2046
2059
2047 And if we call foo() again we get the modified version:
2060 And if we call foo() again we get the modified version:
2048
2061
2049 In [4]: foo()\\
2062 In [4]: foo()\\
2050 foo() has now been changed!
2063 foo() has now been changed!
2051
2064
2052 Here is an example of how to edit a code snippet successive
2065 Here is an example of how to edit a code snippet successive
2053 times. First we call the editor:
2066 times. First we call the editor:
2054
2067
2055 In [8]: ed\\
2068 In [8]: ed\\
2056 Editing... done. Executing edited code...\\
2069 Editing... done. Executing edited code...\\
2057 hello\\
2070 hello\\
2058 Out[8]: "print 'hello'\\n"
2071 Out[8]: "print 'hello'\\n"
2059
2072
2060 Now we call it again with the previous output (stored in _):
2073 Now we call it again with the previous output (stored in _):
2061
2074
2062 In [9]: ed _\\
2075 In [9]: ed _\\
2063 Editing... done. Executing edited code...\\
2076 Editing... done. Executing edited code...\\
2064 hello world\\
2077 hello world\\
2065 Out[9]: "print 'hello world'\\n"
2078 Out[9]: "print 'hello world'\\n"
2066
2079
2067 Now we call it with the output #8 (stored in _8, also as Out[8]):
2080 Now we call it with the output #8 (stored in _8, also as Out[8]):
2068
2081
2069 In [10]: ed _8\\
2082 In [10]: ed _8\\
2070 Editing... done. Executing edited code...\\
2083 Editing... done. Executing edited code...\\
2071 hello again\\
2084 hello again\\
2072 Out[10]: "print 'hello again'\\n"
2085 Out[10]: "print 'hello again'\\n"
2073
2086
2074
2087
2075 Changing the default editor hook:
2088 Changing the default editor hook:
2076
2089
2077 If you wish to write your own editor hook, you can put it in a
2090 If you wish to write your own editor hook, you can put it in a
2078 configuration file which you load at startup time. The default hook
2091 configuration file which you load at startup time. The default hook
2079 is defined in the IPython.hooks module, and you can use that as a
2092 is defined in the IPython.hooks module, and you can use that as a
2080 starting example for further modifications. That file also has
2093 starting example for further modifications. That file also has
2081 general instructions on how to set a new hook for use once you've
2094 general instructions on how to set a new hook for use once you've
2082 defined it."""
2095 defined it."""
2083
2096
2084 # FIXME: This function has become a convoluted mess. It needs a
2097 # FIXME: This function has become a convoluted mess. It needs a
2085 # ground-up rewrite with clean, simple logic.
2098 # ground-up rewrite with clean, simple logic.
2086
2099
2087 def make_filename(arg):
2100 def make_filename(arg):
2088 "Make a filename from the given args"
2101 "Make a filename from the given args"
2089 try:
2102 try:
2090 filename = get_py_filename(arg)
2103 filename = get_py_filename(arg)
2091 except IOError:
2104 except IOError:
2092 if args.endswith('.py'):
2105 if args.endswith('.py'):
2093 filename = arg
2106 filename = arg
2094 else:
2107 else:
2095 filename = None
2108 filename = None
2096 return filename
2109 return filename
2097
2110
2098 # custom exceptions
2111 # custom exceptions
2099 class DataIsObject(Exception): pass
2112 class DataIsObject(Exception): pass
2100
2113
2101 opts,args = self.parse_options(parameter_s,'prxn:')
2114 opts,args = self.parse_options(parameter_s,'prxn:')
2102 # Set a few locals from the options for convenience:
2115 # Set a few locals from the options for convenience:
2103 opts_p = opts.has_key('p')
2116 opts_p = opts.has_key('p')
2104 opts_r = opts.has_key('r')
2117 opts_r = opts.has_key('r')
2105
2118
2106 # Default line number value
2119 # Default line number value
2107 lineno = opts.get('n',None)
2120 lineno = opts.get('n',None)
2108
2121
2109 if opts_p:
2122 if opts_p:
2110 args = '_%s' % last_call[0]
2123 args = '_%s' % last_call[0]
2111 if not self.shell.user_ns.has_key(args):
2124 if not self.shell.user_ns.has_key(args):
2112 args = last_call[1]
2125 args = last_call[1]
2113
2126
2114 # use last_call to remember the state of the previous call, but don't
2127 # use last_call to remember the state of the previous call, but don't
2115 # let it be clobbered by successive '-p' calls.
2128 # let it be clobbered by successive '-p' calls.
2116 try:
2129 try:
2117 last_call[0] = self.shell.outputcache.prompt_count
2130 last_call[0] = self.shell.outputcache.prompt_count
2118 if not opts_p:
2131 if not opts_p:
2119 last_call[1] = parameter_s
2132 last_call[1] = parameter_s
2120 except:
2133 except:
2121 pass
2134 pass
2122
2135
2123 # by default this is done with temp files, except when the given
2136 # by default this is done with temp files, except when the given
2124 # arg is a filename
2137 # arg is a filename
2125 use_temp = 1
2138 use_temp = 1
2126
2139
2127 if re.match(r'\d',args):
2140 if re.match(r'\d',args):
2128 # Mode where user specifies ranges of lines, like in %macro.
2141 # Mode where user specifies ranges of lines, like in %macro.
2129 # This means that you can't edit files whose names begin with
2142 # This means that you can't edit files whose names begin with
2130 # numbers this way. Tough.
2143 # numbers this way. Tough.
2131 ranges = args.split()
2144 ranges = args.split()
2132 data = ''.join(self.extract_input_slices(ranges,opts_r))
2145 data = ''.join(self.extract_input_slices(ranges,opts_r))
2133 elif args.endswith('.py'):
2146 elif args.endswith('.py'):
2134 filename = make_filename(args)
2147 filename = make_filename(args)
2135 data = ''
2148 data = ''
2136 use_temp = 0
2149 use_temp = 0
2137 elif args:
2150 elif args:
2138 try:
2151 try:
2139 # Load the parameter given as a variable. If not a string,
2152 # Load the parameter given as a variable. If not a string,
2140 # process it as an object instead (below)
2153 # process it as an object instead (below)
2141
2154
2142 #print '*** args',args,'type',type(args) # dbg
2155 #print '*** args',args,'type',type(args) # dbg
2143 data = eval(args,self.shell.user_ns)
2156 data = eval(args,self.shell.user_ns)
2144 if not type(data) in StringTypes:
2157 if not type(data) in StringTypes:
2145 raise DataIsObject
2158 raise DataIsObject
2146
2159
2147 except (NameError,SyntaxError):
2160 except (NameError,SyntaxError):
2148 # given argument is not a variable, try as a filename
2161 # given argument is not a variable, try as a filename
2149 filename = make_filename(args)
2162 filename = make_filename(args)
2150 if filename is None:
2163 if filename is None:
2151 warn("Argument given (%s) can't be found as a variable "
2164 warn("Argument given (%s) can't be found as a variable "
2152 "or as a filename." % args)
2165 "or as a filename." % args)
2153 return
2166 return
2154
2167
2155 data = ''
2168 data = ''
2156 use_temp = 0
2169 use_temp = 0
2157 except DataIsObject:
2170 except DataIsObject:
2158
2171
2159 # macros have a special edit function
2172 # macros have a special edit function
2160 if isinstance(data,Macro):
2173 if isinstance(data,Macro):
2161 self._edit_macro(args,data)
2174 self._edit_macro(args,data)
2162 return
2175 return
2163
2176
2164 # For objects, try to edit the file where they are defined
2177 # For objects, try to edit the file where they are defined
2165 try:
2178 try:
2166 filename = inspect.getabsfile(data)
2179 filename = inspect.getabsfile(data)
2167 datafile = 1
2180 datafile = 1
2168 except TypeError:
2181 except TypeError:
2169 filename = make_filename(args)
2182 filename = make_filename(args)
2170 datafile = 1
2183 datafile = 1
2171 warn('Could not find file where `%s` is defined.\n'
2184 warn('Could not find file where `%s` is defined.\n'
2172 'Opening a file named `%s`' % (args,filename))
2185 'Opening a file named `%s`' % (args,filename))
2173 # Now, make sure we can actually read the source (if it was in
2186 # Now, make sure we can actually read the source (if it was in
2174 # a temp file it's gone by now).
2187 # a temp file it's gone by now).
2175 if datafile:
2188 if datafile:
2176 try:
2189 try:
2177 if lineno is None:
2190 if lineno is None:
2178 lineno = inspect.getsourcelines(data)[1]
2191 lineno = inspect.getsourcelines(data)[1]
2179 except IOError:
2192 except IOError:
2180 filename = make_filename(args)
2193 filename = make_filename(args)
2181 if filename is None:
2194 if filename is None:
2182 warn('The file `%s` where `%s` was defined cannot '
2195 warn('The file `%s` where `%s` was defined cannot '
2183 'be read.' % (filename,data))
2196 'be read.' % (filename,data))
2184 return
2197 return
2185 use_temp = 0
2198 use_temp = 0
2186 else:
2199 else:
2187 data = ''
2200 data = ''
2188
2201
2189 if use_temp:
2202 if use_temp:
2190 filename = self.shell.mktempfile(data)
2203 filename = self.shell.mktempfile(data)
2191 print 'IPython will make a temporary file named:',filename
2204 print 'IPython will make a temporary file named:',filename
2192
2205
2193 # do actual editing here
2206 # do actual editing here
2194 print 'Editing...',
2207 print 'Editing...',
2195 sys.stdout.flush()
2208 sys.stdout.flush()
2196 self.shell.hooks.editor(filename,lineno)
2209 self.shell.hooks.editor(filename,lineno)
2197 if opts.has_key('x'): # -x prevents actual execution
2210 if opts.has_key('x'): # -x prevents actual execution
2198 print
2211 print
2199 else:
2212 else:
2200 print 'done. Executing edited code...'
2213 print 'done. Executing edited code...'
2201 if opts_r:
2214 if opts_r:
2202 self.shell.runlines(file_read(filename))
2215 self.shell.runlines(file_read(filename))
2203 else:
2216 else:
2204 self.shell.safe_execfile(filename,self.shell.user_ns)
2217 self.shell.safe_execfile(filename,self.shell.user_ns)
2205 if use_temp:
2218 if use_temp:
2206 try:
2219 try:
2207 return open(filename).read()
2220 return open(filename).read()
2208 except IOError,msg:
2221 except IOError,msg:
2209 if msg.filename == filename:
2222 if msg.filename == filename:
2210 warn('File not found. Did you forget to save?')
2223 warn('File not found. Did you forget to save?')
2211 return
2224 return
2212 else:
2225 else:
2213 self.shell.showtraceback()
2226 self.shell.showtraceback()
2214
2227
2215 def magic_xmode(self,parameter_s = ''):
2228 def magic_xmode(self,parameter_s = ''):
2216 """Switch modes for the exception handlers.
2229 """Switch modes for the exception handlers.
2217
2230
2218 Valid modes: Plain, Context and Verbose.
2231 Valid modes: Plain, Context and Verbose.
2219
2232
2220 If called without arguments, acts as a toggle."""
2233 If called without arguments, acts as a toggle."""
2221
2234
2222 def xmode_switch_err(name):
2235 def xmode_switch_err(name):
2223 warn('Error changing %s exception modes.\n%s' %
2236 warn('Error changing %s exception modes.\n%s' %
2224 (name,sys.exc_info()[1]))
2237 (name,sys.exc_info()[1]))
2225
2238
2226 shell = self.shell
2239 shell = self.shell
2227 new_mode = parameter_s.strip().capitalize()
2240 new_mode = parameter_s.strip().capitalize()
2228 try:
2241 try:
2229 shell.InteractiveTB.set_mode(mode=new_mode)
2242 shell.InteractiveTB.set_mode(mode=new_mode)
2230 print 'Exception reporting mode:',shell.InteractiveTB.mode
2243 print 'Exception reporting mode:',shell.InteractiveTB.mode
2231 except:
2244 except:
2232 xmode_switch_err('user')
2245 xmode_switch_err('user')
2233
2246
2234 # threaded shells use a special handler in sys.excepthook
2247 # threaded shells use a special handler in sys.excepthook
2235 if shell.isthreaded:
2248 if shell.isthreaded:
2236 try:
2249 try:
2237 shell.sys_excepthook.set_mode(mode=new_mode)
2250 shell.sys_excepthook.set_mode(mode=new_mode)
2238 except:
2251 except:
2239 xmode_switch_err('threaded')
2252 xmode_switch_err('threaded')
2240
2253
2241 def magic_colors(self,parameter_s = ''):
2254 def magic_colors(self,parameter_s = ''):
2242 """Switch color scheme for prompts, info system and exception handlers.
2255 """Switch color scheme for prompts, info system and exception handlers.
2243
2256
2244 Currently implemented schemes: NoColor, Linux, LightBG.
2257 Currently implemented schemes: NoColor, Linux, LightBG.
2245
2258
2246 Color scheme names are not case-sensitive."""
2259 Color scheme names are not case-sensitive."""
2247
2260
2248 def color_switch_err(name):
2261 def color_switch_err(name):
2249 warn('Error changing %s color schemes.\n%s' %
2262 warn('Error changing %s color schemes.\n%s' %
2250 (name,sys.exc_info()[1]))
2263 (name,sys.exc_info()[1]))
2251
2264
2252
2265
2253 new_scheme = parameter_s.strip()
2266 new_scheme = parameter_s.strip()
2254 if not new_scheme:
2267 if not new_scheme:
2255 print 'You must specify a color scheme.'
2268 print 'You must specify a color scheme.'
2256 return
2269 return
2257 import IPython.rlineimpl as readline
2270 import IPython.rlineimpl as readline
2258 if not readline.have_readline:
2271 if not readline.have_readline:
2259 msg = """\
2272 msg = """\
2260 Proper color support under MS Windows requires the pyreadline library.
2273 Proper color support under MS Windows requires the pyreadline library.
2261 You can find it at:
2274 You can find it at:
2262 http://ipython.scipy.org/moin/PyReadline/Intro
2275 http://ipython.scipy.org/moin/PyReadline/Intro
2263 Gary's readline needs the ctypes module, from:
2276 Gary's readline needs the ctypes module, from:
2264 http://starship.python.net/crew/theller/ctypes
2277 http://starship.python.net/crew/theller/ctypes
2265 (Note that ctypes is already part of Python versions 2.5 and newer).
2278 (Note that ctypes is already part of Python versions 2.5 and newer).
2266
2279
2267 Defaulting color scheme to 'NoColor'"""
2280 Defaulting color scheme to 'NoColor'"""
2268 new_scheme = 'NoColor'
2281 new_scheme = 'NoColor'
2269 warn(msg)
2282 warn(msg)
2270 # local shortcut
2283 # local shortcut
2271 shell = self.shell
2284 shell = self.shell
2272
2285
2273 # Set prompt colors
2286 # Set prompt colors
2274 try:
2287 try:
2275 shell.outputcache.set_colors(new_scheme)
2288 shell.outputcache.set_colors(new_scheme)
2276 except:
2289 except:
2277 color_switch_err('prompt')
2290 color_switch_err('prompt')
2278 else:
2291 else:
2279 shell.rc.colors = \
2292 shell.rc.colors = \
2280 shell.outputcache.color_table.active_scheme_name
2293 shell.outputcache.color_table.active_scheme_name
2281 # Set exception colors
2294 # Set exception colors
2282 try:
2295 try:
2283 shell.InteractiveTB.set_colors(scheme = new_scheme)
2296 shell.InteractiveTB.set_colors(scheme = new_scheme)
2284 shell.SyntaxTB.set_colors(scheme = new_scheme)
2297 shell.SyntaxTB.set_colors(scheme = new_scheme)
2285 except:
2298 except:
2286 color_switch_err('exception')
2299 color_switch_err('exception')
2287
2300
2288 # threaded shells use a verbose traceback in sys.excepthook
2301 # threaded shells use a verbose traceback in sys.excepthook
2289 if shell.isthreaded:
2302 if shell.isthreaded:
2290 try:
2303 try:
2291 shell.sys_excepthook.set_colors(scheme=new_scheme)
2304 shell.sys_excepthook.set_colors(scheme=new_scheme)
2292 except:
2305 except:
2293 color_switch_err('system exception handler')
2306 color_switch_err('system exception handler')
2294
2307
2295 # Set info (for 'object?') colors
2308 # Set info (for 'object?') colors
2296 if shell.rc.color_info:
2309 if shell.rc.color_info:
2297 try:
2310 try:
2298 shell.inspector.set_active_scheme(new_scheme)
2311 shell.inspector.set_active_scheme(new_scheme)
2299 except:
2312 except:
2300 color_switch_err('object inspector')
2313 color_switch_err('object inspector')
2301 else:
2314 else:
2302 shell.inspector.set_active_scheme('NoColor')
2315 shell.inspector.set_active_scheme('NoColor')
2303
2316
2304 def magic_color_info(self,parameter_s = ''):
2317 def magic_color_info(self,parameter_s = ''):
2305 """Toggle color_info.
2318 """Toggle color_info.
2306
2319
2307 The color_info configuration parameter controls whether colors are
2320 The color_info configuration parameter controls whether colors are
2308 used for displaying object details (by things like %psource, %pfile or
2321 used for displaying object details (by things like %psource, %pfile or
2309 the '?' system). This function toggles this value with each call.
2322 the '?' system). This function toggles this value with each call.
2310
2323
2311 Note that unless you have a fairly recent pager (less works better
2324 Note that unless you have a fairly recent pager (less works better
2312 than more) in your system, using colored object information displays
2325 than more) in your system, using colored object information displays
2313 will not work properly. Test it and see."""
2326 will not work properly. Test it and see."""
2314
2327
2315 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2328 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2316 self.magic_colors(self.shell.rc.colors)
2329 self.magic_colors(self.shell.rc.colors)
2317 print 'Object introspection functions have now coloring:',
2330 print 'Object introspection functions have now coloring:',
2318 print ['OFF','ON'][self.shell.rc.color_info]
2331 print ['OFF','ON'][self.shell.rc.color_info]
2319
2332
2320 def magic_Pprint(self, parameter_s=''):
2333 def magic_Pprint(self, parameter_s=''):
2321 """Toggle pretty printing on/off."""
2334 """Toggle pretty printing on/off."""
2322
2335
2323 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2336 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2324 print 'Pretty printing has been turned', \
2337 print 'Pretty printing has been turned', \
2325 ['OFF','ON'][self.shell.rc.pprint]
2338 ['OFF','ON'][self.shell.rc.pprint]
2326
2339
2327 def magic_exit(self, parameter_s=''):
2340 def magic_exit(self, parameter_s=''):
2328 """Exit IPython, confirming if configured to do so.
2341 """Exit IPython, confirming if configured to do so.
2329
2342
2330 You can configure whether IPython asks for confirmation upon exit by
2343 You can configure whether IPython asks for confirmation upon exit by
2331 setting the confirm_exit flag in the ipythonrc file."""
2344 setting the confirm_exit flag in the ipythonrc file."""
2332
2345
2333 self.shell.exit()
2346 self.shell.exit()
2334
2347
2335 def magic_quit(self, parameter_s=''):
2348 def magic_quit(self, parameter_s=''):
2336 """Exit IPython, confirming if configured to do so (like %exit)"""
2349 """Exit IPython, confirming if configured to do so (like %exit)"""
2337
2350
2338 self.shell.exit()
2351 self.shell.exit()
2339
2352
2340 def magic_Exit(self, parameter_s=''):
2353 def magic_Exit(self, parameter_s=''):
2341 """Exit IPython without confirmation."""
2354 """Exit IPython without confirmation."""
2342
2355
2343 self.shell.exit_now = True
2356 self.shell.exit_now = True
2344
2357
2345 def magic_Quit(self, parameter_s=''):
2358 def magic_Quit(self, parameter_s=''):
2346 """Exit IPython without confirmation (like %Exit)."""
2359 """Exit IPython without confirmation (like %Exit)."""
2347
2360
2348 self.shell.exit_now = True
2361 self.shell.exit_now = True
2349
2362
2350 #......................................................................
2363 #......................................................................
2351 # Functions to implement unix shell-type things
2364 # Functions to implement unix shell-type things
2352
2365
2353 def magic_alias(self, parameter_s = ''):
2366 def magic_alias(self, parameter_s = ''):
2354 """Define an alias for a system command.
2367 """Define an alias for a system command.
2355
2368
2356 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2369 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2357
2370
2358 Then, typing 'alias_name params' will execute the system command 'cmd
2371 Then, typing 'alias_name params' will execute the system command 'cmd
2359 params' (from your underlying operating system).
2372 params' (from your underlying operating system).
2360
2373
2361 Aliases have lower precedence than magic functions and Python normal
2374 Aliases have lower precedence than magic functions and Python normal
2362 variables, so if 'foo' is both a Python variable and an alias, the
2375 variables, so if 'foo' is both a Python variable and an alias, the
2363 alias can not be executed until 'del foo' removes the Python variable.
2376 alias can not be executed until 'del foo' removes the Python variable.
2364
2377
2365 You can use the %l specifier in an alias definition to represent the
2378 You can use the %l specifier in an alias definition to represent the
2366 whole line when the alias is called. For example:
2379 whole line when the alias is called. For example:
2367
2380
2368 In [2]: alias all echo "Input in brackets: <%l>"\\
2381 In [2]: alias all echo "Input in brackets: <%l>"\\
2369 In [3]: all hello world\\
2382 In [3]: all hello world\\
2370 Input in brackets: <hello world>
2383 Input in brackets: <hello world>
2371
2384
2372 You can also define aliases with parameters using %s specifiers (one
2385 You can also define aliases with parameters using %s specifiers (one
2373 per parameter):
2386 per parameter):
2374
2387
2375 In [1]: alias parts echo first %s second %s\\
2388 In [1]: alias parts echo first %s second %s\\
2376 In [2]: %parts A B\\
2389 In [2]: %parts A B\\
2377 first A second B\\
2390 first A second B\\
2378 In [3]: %parts A\\
2391 In [3]: %parts A\\
2379 Incorrect number of arguments: 2 expected.\\
2392 Incorrect number of arguments: 2 expected.\\
2380 parts is an alias to: 'echo first %s second %s'
2393 parts is an alias to: 'echo first %s second %s'
2381
2394
2382 Note that %l and %s are mutually exclusive. You can only use one or
2395 Note that %l and %s are mutually exclusive. You can only use one or
2383 the other in your aliases.
2396 the other in your aliases.
2384
2397
2385 Aliases expand Python variables just like system calls using ! or !!
2398 Aliases expand Python variables just like system calls using ! or !!
2386 do: all expressions prefixed with '$' get expanded. For details of
2399 do: all expressions prefixed with '$' get expanded. For details of
2387 the semantic rules, see PEP-215:
2400 the semantic rules, see PEP-215:
2388 http://www.python.org/peps/pep-0215.html. This is the library used by
2401 http://www.python.org/peps/pep-0215.html. This is the library used by
2389 IPython for variable expansion. If you want to access a true shell
2402 IPython for variable expansion. If you want to access a true shell
2390 variable, an extra $ is necessary to prevent its expansion by IPython:
2403 variable, an extra $ is necessary to prevent its expansion by IPython:
2391
2404
2392 In [6]: alias show echo\\
2405 In [6]: alias show echo\\
2393 In [7]: PATH='A Python string'\\
2406 In [7]: PATH='A Python string'\\
2394 In [8]: show $PATH\\
2407 In [8]: show $PATH\\
2395 A Python string\\
2408 A Python string\\
2396 In [9]: show $$PATH\\
2409 In [9]: show $$PATH\\
2397 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2410 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2398
2411
2399 You can use the alias facility to acess all of $PATH. See the %rehash
2412 You can use the alias facility to acess all of $PATH. See the %rehash
2400 and %rehashx functions, which automatically create aliases for the
2413 and %rehashx functions, which automatically create aliases for the
2401 contents of your $PATH.
2414 contents of your $PATH.
2402
2415
2403 If called with no parameters, %alias prints the current alias table."""
2416 If called with no parameters, %alias prints the current alias table."""
2404
2417
2405 par = parameter_s.strip()
2418 par = parameter_s.strip()
2406 if not par:
2419 if not par:
2407 stored = self.db.get('stored_aliases', {} )
2420 stored = self.db.get('stored_aliases', {} )
2408 atab = self.shell.alias_table
2421 atab = self.shell.alias_table
2409 aliases = atab.keys()
2422 aliases = atab.keys()
2410 aliases.sort()
2423 aliases.sort()
2411 res = []
2424 res = []
2412 showlast = []
2425 showlast = []
2413 for alias in aliases:
2426 for alias in aliases:
2414 tgt = atab[alias][1]
2427 tgt = atab[alias][1]
2415 # 'interesting' aliases
2428 # 'interesting' aliases
2416 if (alias in stored or
2429 if (alias in stored or
2417 alias != os.path.splitext(tgt)[0] or
2430 alias != os.path.splitext(tgt)[0] or
2418 ' ' in tgt):
2431 ' ' in tgt):
2419 showlast.append((alias, tgt))
2432 showlast.append((alias, tgt))
2420 else:
2433 else:
2421 res.append((alias, tgt ))
2434 res.append((alias, tgt ))
2422
2435
2423 # show most interesting aliases last
2436 # show most interesting aliases last
2424 res.extend(showlast)
2437 res.extend(showlast)
2425 print "Total number of aliases:",len(aliases)
2438 print "Total number of aliases:",len(aliases)
2426 return res
2439 return res
2427 try:
2440 try:
2428 alias,cmd = par.split(None,1)
2441 alias,cmd = par.split(None,1)
2429 except:
2442 except:
2430 print OInspect.getdoc(self.magic_alias)
2443 print OInspect.getdoc(self.magic_alias)
2431 else:
2444 else:
2432 nargs = cmd.count('%s')
2445 nargs = cmd.count('%s')
2433 if nargs>0 and cmd.find('%l')>=0:
2446 if nargs>0 and cmd.find('%l')>=0:
2434 error('The %s and %l specifiers are mutually exclusive '
2447 error('The %s and %l specifiers are mutually exclusive '
2435 'in alias definitions.')
2448 'in alias definitions.')
2436 else: # all looks OK
2449 else: # all looks OK
2437 self.shell.alias_table[alias] = (nargs,cmd)
2450 self.shell.alias_table[alias] = (nargs,cmd)
2438 self.shell.alias_table_validate(verbose=0)
2451 self.shell.alias_table_validate(verbose=0)
2439 # end magic_alias
2452 # end magic_alias
2440
2453
2441 def magic_unalias(self, parameter_s = ''):
2454 def magic_unalias(self, parameter_s = ''):
2442 """Remove an alias"""
2455 """Remove an alias"""
2443
2456
2444 aname = parameter_s.strip()
2457 aname = parameter_s.strip()
2445 if aname in self.shell.alias_table:
2458 if aname in self.shell.alias_table:
2446 del self.shell.alias_table[aname]
2459 del self.shell.alias_table[aname]
2447 stored = self.db.get('stored_aliases', {} )
2460 stored = self.db.get('stored_aliases', {} )
2448 if aname in stored:
2461 if aname in stored:
2449 print "Removing %stored alias",aname
2462 print "Removing %stored alias",aname
2450 del stored[aname]
2463 del stored[aname]
2451 self.db['stored_aliases'] = stored
2464 self.db['stored_aliases'] = stored
2452
2465
2453 def magic_rehash(self, parameter_s = ''):
2466 def magic_rehash(self, parameter_s = ''):
2454 """Update the alias table with all entries in $PATH.
2467 """Update the alias table with all entries in $PATH.
2455
2468
2456 This version does no checks on execute permissions or whether the
2469 This version does no checks on execute permissions or whether the
2457 contents of $PATH are truly files (instead of directories or something
2470 contents of $PATH are truly files (instead of directories or something
2458 else). For such a safer (but slower) version, use %rehashx."""
2471 else). For such a safer (but slower) version, use %rehashx."""
2459
2472
2460 # This function (and rehashx) manipulate the alias_table directly
2473 # This function (and rehashx) manipulate the alias_table directly
2461 # rather than calling magic_alias, for speed reasons. A rehash on a
2474 # rather than calling magic_alias, for speed reasons. A rehash on a
2462 # typical Linux box involves several thousand entries, so efficiency
2475 # typical Linux box involves several thousand entries, so efficiency
2463 # here is a top concern.
2476 # here is a top concern.
2464
2477
2465 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2478 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2466 alias_table = self.shell.alias_table
2479 alias_table = self.shell.alias_table
2467 for pdir in path:
2480 for pdir in path:
2468 for ff in os.listdir(pdir):
2481 for ff in os.listdir(pdir):
2469 # each entry in the alias table must be (N,name), where
2482 # each entry in the alias table must be (N,name), where
2470 # N is the number of positional arguments of the alias.
2483 # N is the number of positional arguments of the alias.
2471 alias_table[ff] = (0,ff)
2484 alias_table[ff] = (0,ff)
2472 # Make sure the alias table doesn't contain keywords or builtins
2485 # Make sure the alias table doesn't contain keywords or builtins
2473 self.shell.alias_table_validate()
2486 self.shell.alias_table_validate()
2474 # Call again init_auto_alias() so we get 'rm -i' and other modified
2487 # Call again init_auto_alias() so we get 'rm -i' and other modified
2475 # aliases since %rehash will probably clobber them
2488 # aliases since %rehash will probably clobber them
2476 self.shell.init_auto_alias()
2489 self.shell.init_auto_alias()
2477
2490
2478 def magic_rehashx(self, parameter_s = ''):
2491 def magic_rehashx(self, parameter_s = ''):
2479 """Update the alias table with all executable files in $PATH.
2492 """Update the alias table with all executable files in $PATH.
2480
2493
2481 This version explicitly checks that every entry in $PATH is a file
2494 This version explicitly checks that every entry in $PATH is a file
2482 with execute access (os.X_OK), so it is much slower than %rehash.
2495 with execute access (os.X_OK), so it is much slower than %rehash.
2483
2496
2484 Under Windows, it checks executability as a match agains a
2497 Under Windows, it checks executability as a match agains a
2485 '|'-separated string of extensions, stored in the IPython config
2498 '|'-separated string of extensions, stored in the IPython config
2486 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2499 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2487
2500
2488 path = [os.path.abspath(os.path.expanduser(p)) for p in
2501 path = [os.path.abspath(os.path.expanduser(p)) for p in
2489 os.environ['PATH'].split(os.pathsep)]
2502 os.environ['PATH'].split(os.pathsep)]
2490 path = filter(os.path.isdir,path)
2503 path = filter(os.path.isdir,path)
2491
2504
2492 alias_table = self.shell.alias_table
2505 alias_table = self.shell.alias_table
2493 syscmdlist = []
2506 syscmdlist = []
2494 if os.name == 'posix':
2507 if os.name == 'posix':
2495 isexec = lambda fname:os.path.isfile(fname) and \
2508 isexec = lambda fname:os.path.isfile(fname) and \
2496 os.access(fname,os.X_OK)
2509 os.access(fname,os.X_OK)
2497 else:
2510 else:
2498
2511
2499 try:
2512 try:
2500 winext = os.environ['pathext'].replace(';','|').replace('.','')
2513 winext = os.environ['pathext'].replace(';','|').replace('.','')
2501 except KeyError:
2514 except KeyError:
2502 winext = 'exe|com|bat|py'
2515 winext = 'exe|com|bat|py'
2503 if 'py' not in winext:
2516 if 'py' not in winext:
2504 winext += '|py'
2517 winext += '|py'
2505 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2518 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2506 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2519 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2507 savedir = os.getcwd()
2520 savedir = os.getcwd()
2508 try:
2521 try:
2509 # write the whole loop for posix/Windows so we don't have an if in
2522 # write the whole loop for posix/Windows so we don't have an if in
2510 # the innermost part
2523 # the innermost part
2511 if os.name == 'posix':
2524 if os.name == 'posix':
2512 for pdir in path:
2525 for pdir in path:
2513 os.chdir(pdir)
2526 os.chdir(pdir)
2514 for ff in os.listdir(pdir):
2527 for ff in os.listdir(pdir):
2515 if isexec(ff) and ff not in self.shell.no_alias:
2528 if isexec(ff) and ff not in self.shell.no_alias:
2516 # each entry in the alias table must be (N,name),
2529 # each entry in the alias table must be (N,name),
2517 # where N is the number of positional arguments of the
2530 # where N is the number of positional arguments of the
2518 # alias.
2531 # alias.
2519 alias_table[ff] = (0,ff)
2532 alias_table[ff] = (0,ff)
2520 syscmdlist.append(ff)
2533 syscmdlist.append(ff)
2521 else:
2534 else:
2522 for pdir in path:
2535 for pdir in path:
2523 os.chdir(pdir)
2536 os.chdir(pdir)
2524 for ff in os.listdir(pdir):
2537 for ff in os.listdir(pdir):
2525 base, ext = os.path.splitext(ff)
2538 base, ext = os.path.splitext(ff)
2526 if isexec(ff) and base not in self.shell.no_alias:
2539 if isexec(ff) and base not in self.shell.no_alias:
2527 if ext.lower() == '.exe':
2540 if ext.lower() == '.exe':
2528 ff = base
2541 ff = base
2529 alias_table[base] = (0,ff)
2542 alias_table[base] = (0,ff)
2530 syscmdlist.append(ff)
2543 syscmdlist.append(ff)
2531 # Make sure the alias table doesn't contain keywords or builtins
2544 # Make sure the alias table doesn't contain keywords or builtins
2532 self.shell.alias_table_validate()
2545 self.shell.alias_table_validate()
2533 # Call again init_auto_alias() so we get 'rm -i' and other
2546 # Call again init_auto_alias() so we get 'rm -i' and other
2534 # modified aliases since %rehashx will probably clobber them
2547 # modified aliases since %rehashx will probably clobber them
2535 self.shell.init_auto_alias()
2548 self.shell.init_auto_alias()
2536 db = self.getapi().db
2549 db = self.getapi().db
2537 db['syscmdlist'] = syscmdlist
2550 db['syscmdlist'] = syscmdlist
2538 finally:
2551 finally:
2539 os.chdir(savedir)
2552 os.chdir(savedir)
2540
2553
2541 def magic_pwd(self, parameter_s = ''):
2554 def magic_pwd(self, parameter_s = ''):
2542 """Return the current working directory path."""
2555 """Return the current working directory path."""
2543 return os.getcwd()
2556 return os.getcwd()
2544
2557
2545 def magic_cd(self, parameter_s=''):
2558 def magic_cd(self, parameter_s=''):
2546 """Change the current working directory.
2559 """Change the current working directory.
2547
2560
2548 This command automatically maintains an internal list of directories
2561 This command automatically maintains an internal list of directories
2549 you visit during your IPython session, in the variable _dh. The
2562 you visit during your IPython session, in the variable _dh. The
2550 command %dhist shows this history nicely formatted. You can also
2563 command %dhist shows this history nicely formatted. You can also
2551 do 'cd -<tab>' to see directory history conveniently.
2564 do 'cd -<tab>' to see directory history conveniently.
2552
2565
2553 Usage:
2566 Usage:
2554
2567
2555 cd 'dir': changes to directory 'dir'.
2568 cd 'dir': changes to directory 'dir'.
2556
2569
2557 cd -: changes to the last visited directory.
2570 cd -: changes to the last visited directory.
2558
2571
2559 cd -<n>: changes to the n-th directory in the directory history.
2572 cd -<n>: changes to the n-th directory in the directory history.
2560
2573
2561 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2574 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2562 (note: cd <bookmark_name> is enough if there is no
2575 (note: cd <bookmark_name> is enough if there is no
2563 directory <bookmark_name>, but a bookmark with the name exists.)
2576 directory <bookmark_name>, but a bookmark with the name exists.)
2564 'cd -b <tab>' allows you to tab-complete bookmark names.
2577 'cd -b <tab>' allows you to tab-complete bookmark names.
2565
2578
2566 Options:
2579 Options:
2567
2580
2568 -q: quiet. Do not print the working directory after the cd command is
2581 -q: quiet. Do not print the working directory after the cd command is
2569 executed. By default IPython's cd command does print this directory,
2582 executed. By default IPython's cd command does print this directory,
2570 since the default prompts do not display path information.
2583 since the default prompts do not display path information.
2571
2584
2572 Note that !cd doesn't work for this purpose because the shell where
2585 Note that !cd doesn't work for this purpose because the shell where
2573 !command runs is immediately discarded after executing 'command'."""
2586 !command runs is immediately discarded after executing 'command'."""
2574
2587
2575 parameter_s = parameter_s.strip()
2588 parameter_s = parameter_s.strip()
2576 #bkms = self.shell.persist.get("bookmarks",{})
2589 #bkms = self.shell.persist.get("bookmarks",{})
2577
2590
2578 numcd = re.match(r'(-)(\d+)$',parameter_s)
2591 numcd = re.match(r'(-)(\d+)$',parameter_s)
2579 # jump in directory history by number
2592 # jump in directory history by number
2580 if numcd:
2593 if numcd:
2581 nn = int(numcd.group(2))
2594 nn = int(numcd.group(2))
2582 try:
2595 try:
2583 ps = self.shell.user_ns['_dh'][nn]
2596 ps = self.shell.user_ns['_dh'][nn]
2584 except IndexError:
2597 except IndexError:
2585 print 'The requested directory does not exist in history.'
2598 print 'The requested directory does not exist in history.'
2586 return
2599 return
2587 else:
2600 else:
2588 opts = {}
2601 opts = {}
2589 else:
2602 else:
2590 #turn all non-space-escaping backslashes to slashes,
2603 #turn all non-space-escaping backslashes to slashes,
2591 # for c:\windows\directory\names\
2604 # for c:\windows\directory\names\
2592 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2605 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2593 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2606 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2594 # jump to previous
2607 # jump to previous
2595 if ps == '-':
2608 if ps == '-':
2596 try:
2609 try:
2597 ps = self.shell.user_ns['_dh'][-2]
2610 ps = self.shell.user_ns['_dh'][-2]
2598 except IndexError:
2611 except IndexError:
2599 print 'No previous directory to change to.'
2612 print 'No previous directory to change to.'
2600 return
2613 return
2601 # jump to bookmark if needed
2614 # jump to bookmark if needed
2602 else:
2615 else:
2603 if not os.path.isdir(ps) or opts.has_key('b'):
2616 if not os.path.isdir(ps) or opts.has_key('b'):
2604 bkms = self.db.get('bookmarks', {})
2617 bkms = self.db.get('bookmarks', {})
2605
2618
2606 if bkms.has_key(ps):
2619 if bkms.has_key(ps):
2607 target = bkms[ps]
2620 target = bkms[ps]
2608 print '(bookmark:%s) -> %s' % (ps,target)
2621 print '(bookmark:%s) -> %s' % (ps,target)
2609 ps = target
2622 ps = target
2610 else:
2623 else:
2611 if opts.has_key('b'):
2624 if opts.has_key('b'):
2612 error("Bookmark '%s' not found. "
2625 error("Bookmark '%s' not found. "
2613 "Use '%%bookmark -l' to see your bookmarks." % ps)
2626 "Use '%%bookmark -l' to see your bookmarks." % ps)
2614 return
2627 return
2615
2628
2616 # at this point ps should point to the target dir
2629 # at this point ps should point to the target dir
2617 if ps:
2630 if ps:
2618 try:
2631 try:
2619 os.chdir(os.path.expanduser(ps))
2632 os.chdir(os.path.expanduser(ps))
2620 if self.shell.rc.term_title:
2633 if self.shell.rc.term_title:
2621 #print 'set term title:',self.shell.rc.term_title # dbg
2634 #print 'set term title:',self.shell.rc.term_title # dbg
2622 ttitle = ("IPy:" + (
2635 ttitle = ("IPy:" + (
2623 os.getcwd() == '/' and '/' or \
2636 os.getcwd() == '/' and '/' or \
2624 os.path.basename(os.getcwd())))
2637 os.path.basename(os.getcwd())))
2625 platutils.set_term_title(ttitle)
2638 platutils.set_term_title(ttitle)
2626 except OSError:
2639 except OSError:
2627 print sys.exc_info()[1]
2640 print sys.exc_info()[1]
2628 else:
2641 else:
2629 self.shell.user_ns['_dh'].append(os.getcwd())
2642 self.shell.user_ns['_dh'].append(os.getcwd())
2630 else:
2643 else:
2631 os.chdir(self.shell.home_dir)
2644 os.chdir(self.shell.home_dir)
2632 if self.shell.rc.term_title:
2645 if self.shell.rc.term_title:
2633 platutils.set_term_title("IPy:~")
2646 platutils.set_term_title("IPy:~")
2634 self.shell.user_ns['_dh'].append(os.getcwd())
2647 self.shell.user_ns['_dh'].append(os.getcwd())
2635 if not 'q' in opts:
2648 if not 'q' in opts:
2636 print self.shell.user_ns['_dh'][-1]
2649 print self.shell.user_ns['_dh'][-1]
2637
2650
2638 def magic_dhist(self, parameter_s=''):
2651 def magic_dhist(self, parameter_s=''):
2639 """Print your history of visited directories.
2652 """Print your history of visited directories.
2640
2653
2641 %dhist -> print full history\\
2654 %dhist -> print full history\\
2642 %dhist n -> print last n entries only\\
2655 %dhist n -> print last n entries only\\
2643 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2656 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2644
2657
2645 This history is automatically maintained by the %cd command, and
2658 This history is automatically maintained by the %cd command, and
2646 always available as the global list variable _dh. You can use %cd -<n>
2659 always available as the global list variable _dh. You can use %cd -<n>
2647 to go to directory number <n>."""
2660 to go to directory number <n>."""
2648
2661
2649 dh = self.shell.user_ns['_dh']
2662 dh = self.shell.user_ns['_dh']
2650 if parameter_s:
2663 if parameter_s:
2651 try:
2664 try:
2652 args = map(int,parameter_s.split())
2665 args = map(int,parameter_s.split())
2653 except:
2666 except:
2654 self.arg_err(Magic.magic_dhist)
2667 self.arg_err(Magic.magic_dhist)
2655 return
2668 return
2656 if len(args) == 1:
2669 if len(args) == 1:
2657 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2670 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2658 elif len(args) == 2:
2671 elif len(args) == 2:
2659 ini,fin = args
2672 ini,fin = args
2660 else:
2673 else:
2661 self.arg_err(Magic.magic_dhist)
2674 self.arg_err(Magic.magic_dhist)
2662 return
2675 return
2663 else:
2676 else:
2664 ini,fin = 0,len(dh)
2677 ini,fin = 0,len(dh)
2665 nlprint(dh,
2678 nlprint(dh,
2666 header = 'Directory history (kept in _dh)',
2679 header = 'Directory history (kept in _dh)',
2667 start=ini,stop=fin)
2680 start=ini,stop=fin)
2668
2681
2669 def magic_env(self, parameter_s=''):
2682 def magic_env(self, parameter_s=''):
2670 """List environment variables."""
2683 """List environment variables."""
2671
2684
2672 return os.environ.data
2685 return os.environ.data
2673
2686
2674 def magic_pushd(self, parameter_s=''):
2687 def magic_pushd(self, parameter_s=''):
2675 """Place the current dir on stack and change directory.
2688 """Place the current dir on stack and change directory.
2676
2689
2677 Usage:\\
2690 Usage:\\
2678 %pushd ['dirname']
2691 %pushd ['dirname']
2679
2692
2680 %pushd with no arguments does a %pushd to your home directory.
2693 %pushd with no arguments does a %pushd to your home directory.
2681 """
2694 """
2682 if parameter_s == '': parameter_s = '~'
2695 if parameter_s == '': parameter_s = '~'
2683 dir_s = self.shell.dir_stack
2696 dir_s = self.shell.dir_stack
2684 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2697 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2685 os.path.expanduser(self.shell.dir_stack[0]):
2698 os.path.expanduser(self.shell.dir_stack[0]):
2686 try:
2699 try:
2687 self.magic_cd(parameter_s)
2700 self.magic_cd(parameter_s)
2688 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2701 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2689 self.magic_dirs()
2702 self.magic_dirs()
2690 except:
2703 except:
2691 print 'Invalid directory'
2704 print 'Invalid directory'
2692 else:
2705 else:
2693 print 'You are already there!'
2706 print 'You are already there!'
2694
2707
2695 def magic_popd(self, parameter_s=''):
2708 def magic_popd(self, parameter_s=''):
2696 """Change to directory popped off the top of the stack.
2709 """Change to directory popped off the top of the stack.
2697 """
2710 """
2698 if len (self.shell.dir_stack) > 1:
2711 if len (self.shell.dir_stack) > 1:
2699 self.shell.dir_stack.pop(0)
2712 self.shell.dir_stack.pop(0)
2700 self.magic_cd(self.shell.dir_stack[0])
2713 self.magic_cd(self.shell.dir_stack[0])
2701 print self.shell.dir_stack[0]
2714 print self.shell.dir_stack[0]
2702 else:
2715 else:
2703 print "You can't remove the starting directory from the stack:",\
2716 print "You can't remove the starting directory from the stack:",\
2704 self.shell.dir_stack
2717 self.shell.dir_stack
2705
2718
2706 def magic_dirs(self, parameter_s=''):
2719 def magic_dirs(self, parameter_s=''):
2707 """Return the current directory stack."""
2720 """Return the current directory stack."""
2708
2721
2709 return self.shell.dir_stack[:]
2722 return self.shell.dir_stack[:]
2710
2723
2711 def magic_sc(self, parameter_s=''):
2724 def magic_sc(self, parameter_s=''):
2712 """Shell capture - execute a shell command and capture its output.
2725 """Shell capture - execute a shell command and capture its output.
2713
2726
2714 DEPRECATED. Suboptimal, retained for backwards compatibility.
2727 DEPRECATED. Suboptimal, retained for backwards compatibility.
2715
2728
2716 You should use the form 'var = !command' instead. Example:
2729 You should use the form 'var = !command' instead. Example:
2717
2730
2718 "%sc -l myfiles = ls ~" should now be written as
2731 "%sc -l myfiles = ls ~" should now be written as
2719
2732
2720 "myfiles = !ls ~"
2733 "myfiles = !ls ~"
2721
2734
2722 myfiles.s, myfiles.l and myfiles.n still apply as documented
2735 myfiles.s, myfiles.l and myfiles.n still apply as documented
2723 below.
2736 below.
2724
2737
2725 --
2738 --
2726 %sc [options] varname=command
2739 %sc [options] varname=command
2727
2740
2728 IPython will run the given command using commands.getoutput(), and
2741 IPython will run the given command using commands.getoutput(), and
2729 will then update the user's interactive namespace with a variable
2742 will then update the user's interactive namespace with a variable
2730 called varname, containing the value of the call. Your command can
2743 called varname, containing the value of the call. Your command can
2731 contain shell wildcards, pipes, etc.
2744 contain shell wildcards, pipes, etc.
2732
2745
2733 The '=' sign in the syntax is mandatory, and the variable name you
2746 The '=' sign in the syntax is mandatory, and the variable name you
2734 supply must follow Python's standard conventions for valid names.
2747 supply must follow Python's standard conventions for valid names.
2735
2748
2736 (A special format without variable name exists for internal use)
2749 (A special format without variable name exists for internal use)
2737
2750
2738 Options:
2751 Options:
2739
2752
2740 -l: list output. Split the output on newlines into a list before
2753 -l: list output. Split the output on newlines into a list before
2741 assigning it to the given variable. By default the output is stored
2754 assigning it to the given variable. By default the output is stored
2742 as a single string.
2755 as a single string.
2743
2756
2744 -v: verbose. Print the contents of the variable.
2757 -v: verbose. Print the contents of the variable.
2745
2758
2746 In most cases you should not need to split as a list, because the
2759 In most cases you should not need to split as a list, because the
2747 returned value is a special type of string which can automatically
2760 returned value is a special type of string which can automatically
2748 provide its contents either as a list (split on newlines) or as a
2761 provide its contents either as a list (split on newlines) or as a
2749 space-separated string. These are convenient, respectively, either
2762 space-separated string. These are convenient, respectively, either
2750 for sequential processing or to be passed to a shell command.
2763 for sequential processing or to be passed to a shell command.
2751
2764
2752 For example:
2765 For example:
2753
2766
2754 # Capture into variable a
2767 # Capture into variable a
2755 In [9]: sc a=ls *py
2768 In [9]: sc a=ls *py
2756
2769
2757 # a is a string with embedded newlines
2770 # a is a string with embedded newlines
2758 In [10]: a
2771 In [10]: a
2759 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2772 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2760
2773
2761 # which can be seen as a list:
2774 # which can be seen as a list:
2762 In [11]: a.l
2775 In [11]: a.l
2763 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2776 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2764
2777
2765 # or as a whitespace-separated string:
2778 # or as a whitespace-separated string:
2766 In [12]: a.s
2779 In [12]: a.s
2767 Out[12]: 'setup.py win32_manual_post_install.py'
2780 Out[12]: 'setup.py win32_manual_post_install.py'
2768
2781
2769 # a.s is useful to pass as a single command line:
2782 # a.s is useful to pass as a single command line:
2770 In [13]: !wc -l $a.s
2783 In [13]: !wc -l $a.s
2771 146 setup.py
2784 146 setup.py
2772 130 win32_manual_post_install.py
2785 130 win32_manual_post_install.py
2773 276 total
2786 276 total
2774
2787
2775 # while the list form is useful to loop over:
2788 # while the list form is useful to loop over:
2776 In [14]: for f in a.l:
2789 In [14]: for f in a.l:
2777 ....: !wc -l $f
2790 ....: !wc -l $f
2778 ....:
2791 ....:
2779 146 setup.py
2792 146 setup.py
2780 130 win32_manual_post_install.py
2793 130 win32_manual_post_install.py
2781
2794
2782 Similiarly, the lists returned by the -l option are also special, in
2795 Similiarly, the lists returned by the -l option are also special, in
2783 the sense that you can equally invoke the .s attribute on them to
2796 the sense that you can equally invoke the .s attribute on them to
2784 automatically get a whitespace-separated string from their contents:
2797 automatically get a whitespace-separated string from their contents:
2785
2798
2786 In [1]: sc -l b=ls *py
2799 In [1]: sc -l b=ls *py
2787
2800
2788 In [2]: b
2801 In [2]: b
2789 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2802 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2790
2803
2791 In [3]: b.s
2804 In [3]: b.s
2792 Out[3]: 'setup.py win32_manual_post_install.py'
2805 Out[3]: 'setup.py win32_manual_post_install.py'
2793
2806
2794 In summary, both the lists and strings used for ouptut capture have
2807 In summary, both the lists and strings used for ouptut capture have
2795 the following special attributes:
2808 the following special attributes:
2796
2809
2797 .l (or .list) : value as list.
2810 .l (or .list) : value as list.
2798 .n (or .nlstr): value as newline-separated string.
2811 .n (or .nlstr): value as newline-separated string.
2799 .s (or .spstr): value as space-separated string.
2812 .s (or .spstr): value as space-separated string.
2800 """
2813 """
2801
2814
2802 opts,args = self.parse_options(parameter_s,'lv')
2815 opts,args = self.parse_options(parameter_s,'lv')
2803 # Try to get a variable name and command to run
2816 # Try to get a variable name and command to run
2804 try:
2817 try:
2805 # the variable name must be obtained from the parse_options
2818 # the variable name must be obtained from the parse_options
2806 # output, which uses shlex.split to strip options out.
2819 # output, which uses shlex.split to strip options out.
2807 var,_ = args.split('=',1)
2820 var,_ = args.split('=',1)
2808 var = var.strip()
2821 var = var.strip()
2809 # But the the command has to be extracted from the original input
2822 # But the the command has to be extracted from the original input
2810 # parameter_s, not on what parse_options returns, to avoid the
2823 # parameter_s, not on what parse_options returns, to avoid the
2811 # quote stripping which shlex.split performs on it.
2824 # quote stripping which shlex.split performs on it.
2812 _,cmd = parameter_s.split('=',1)
2825 _,cmd = parameter_s.split('=',1)
2813 except ValueError:
2826 except ValueError:
2814 var,cmd = '',''
2827 var,cmd = '',''
2815 # If all looks ok, proceed
2828 # If all looks ok, proceed
2816 out,err = self.shell.getoutputerror(cmd)
2829 out,err = self.shell.getoutputerror(cmd)
2817 if err:
2830 if err:
2818 print >> Term.cerr,err
2831 print >> Term.cerr,err
2819 if opts.has_key('l'):
2832 if opts.has_key('l'):
2820 out = SList(out.split('\n'))
2833 out = SList(out.split('\n'))
2821 else:
2834 else:
2822 out = LSString(out)
2835 out = LSString(out)
2823 if opts.has_key('v'):
2836 if opts.has_key('v'):
2824 print '%s ==\n%s' % (var,pformat(out))
2837 print '%s ==\n%s' % (var,pformat(out))
2825 if var:
2838 if var:
2826 self.shell.user_ns.update({var:out})
2839 self.shell.user_ns.update({var:out})
2827 else:
2840 else:
2828 return out
2841 return out
2829
2842
2830 def magic_sx(self, parameter_s=''):
2843 def magic_sx(self, parameter_s=''):
2831 """Shell execute - run a shell command and capture its output.
2844 """Shell execute - run a shell command and capture its output.
2832
2845
2833 %sx command
2846 %sx command
2834
2847
2835 IPython will run the given command using commands.getoutput(), and
2848 IPython will run the given command using commands.getoutput(), and
2836 return the result formatted as a list (split on '\\n'). Since the
2849 return the result formatted as a list (split on '\\n'). Since the
2837 output is _returned_, it will be stored in ipython's regular output
2850 output is _returned_, it will be stored in ipython's regular output
2838 cache Out[N] and in the '_N' automatic variables.
2851 cache Out[N] and in the '_N' automatic variables.
2839
2852
2840 Notes:
2853 Notes:
2841
2854
2842 1) If an input line begins with '!!', then %sx is automatically
2855 1) If an input line begins with '!!', then %sx is automatically
2843 invoked. That is, while:
2856 invoked. That is, while:
2844 !ls
2857 !ls
2845 causes ipython to simply issue system('ls'), typing
2858 causes ipython to simply issue system('ls'), typing
2846 !!ls
2859 !!ls
2847 is a shorthand equivalent to:
2860 is a shorthand equivalent to:
2848 %sx ls
2861 %sx ls
2849
2862
2850 2) %sx differs from %sc in that %sx automatically splits into a list,
2863 2) %sx differs from %sc in that %sx automatically splits into a list,
2851 like '%sc -l'. The reason for this is to make it as easy as possible
2864 like '%sc -l'. The reason for this is to make it as easy as possible
2852 to process line-oriented shell output via further python commands.
2865 to process line-oriented shell output via further python commands.
2853 %sc is meant to provide much finer control, but requires more
2866 %sc is meant to provide much finer control, but requires more
2854 typing.
2867 typing.
2855
2868
2856 3) Just like %sc -l, this is a list with special attributes:
2869 3) Just like %sc -l, this is a list with special attributes:
2857
2870
2858 .l (or .list) : value as list.
2871 .l (or .list) : value as list.
2859 .n (or .nlstr): value as newline-separated string.
2872 .n (or .nlstr): value as newline-separated string.
2860 .s (or .spstr): value as whitespace-separated string.
2873 .s (or .spstr): value as whitespace-separated string.
2861
2874
2862 This is very useful when trying to use such lists as arguments to
2875 This is very useful when trying to use such lists as arguments to
2863 system commands."""
2876 system commands."""
2864
2877
2865 if parameter_s:
2878 if parameter_s:
2866 out,err = self.shell.getoutputerror(parameter_s)
2879 out,err = self.shell.getoutputerror(parameter_s)
2867 if err:
2880 if err:
2868 print >> Term.cerr,err
2881 print >> Term.cerr,err
2869 return SList(out.split('\n'))
2882 return SList(out.split('\n'))
2870
2883
2871 def magic_bg(self, parameter_s=''):
2884 def magic_bg(self, parameter_s=''):
2872 """Run a job in the background, in a separate thread.
2885 """Run a job in the background, in a separate thread.
2873
2886
2874 For example,
2887 For example,
2875
2888
2876 %bg myfunc(x,y,z=1)
2889 %bg myfunc(x,y,z=1)
2877
2890
2878 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2891 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2879 execution starts, a message will be printed indicating the job
2892 execution starts, a message will be printed indicating the job
2880 number. If your job number is 5, you can use
2893 number. If your job number is 5, you can use
2881
2894
2882 myvar = jobs.result(5) or myvar = jobs[5].result
2895 myvar = jobs.result(5) or myvar = jobs[5].result
2883
2896
2884 to assign this result to variable 'myvar'.
2897 to assign this result to variable 'myvar'.
2885
2898
2886 IPython has a job manager, accessible via the 'jobs' object. You can
2899 IPython has a job manager, accessible via the 'jobs' object. You can
2887 type jobs? to get more information about it, and use jobs.<TAB> to see
2900 type jobs? to get more information about it, and use jobs.<TAB> to see
2888 its attributes. All attributes not starting with an underscore are
2901 its attributes. All attributes not starting with an underscore are
2889 meant for public use.
2902 meant for public use.
2890
2903
2891 In particular, look at the jobs.new() method, which is used to create
2904 In particular, look at the jobs.new() method, which is used to create
2892 new jobs. This magic %bg function is just a convenience wrapper
2905 new jobs. This magic %bg function is just a convenience wrapper
2893 around jobs.new(), for expression-based jobs. If you want to create a
2906 around jobs.new(), for expression-based jobs. If you want to create a
2894 new job with an explicit function object and arguments, you must call
2907 new job with an explicit function object and arguments, you must call
2895 jobs.new() directly.
2908 jobs.new() directly.
2896
2909
2897 The jobs.new docstring also describes in detail several important
2910 The jobs.new docstring also describes in detail several important
2898 caveats associated with a thread-based model for background job
2911 caveats associated with a thread-based model for background job
2899 execution. Type jobs.new? for details.
2912 execution. Type jobs.new? for details.
2900
2913
2901 You can check the status of all jobs with jobs.status().
2914 You can check the status of all jobs with jobs.status().
2902
2915
2903 The jobs variable is set by IPython into the Python builtin namespace.
2916 The jobs variable is set by IPython into the Python builtin namespace.
2904 If you ever declare a variable named 'jobs', you will shadow this
2917 If you ever declare a variable named 'jobs', you will shadow this
2905 name. You can either delete your global jobs variable to regain
2918 name. You can either delete your global jobs variable to regain
2906 access to the job manager, or make a new name and assign it manually
2919 access to the job manager, or make a new name and assign it manually
2907 to the manager (stored in IPython's namespace). For example, to
2920 to the manager (stored in IPython's namespace). For example, to
2908 assign the job manager to the Jobs name, use:
2921 assign the job manager to the Jobs name, use:
2909
2922
2910 Jobs = __builtins__.jobs"""
2923 Jobs = __builtins__.jobs"""
2911
2924
2912 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2925 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2913
2926
2914
2927
2915 def magic_bookmark(self, parameter_s=''):
2928 def magic_bookmark(self, parameter_s=''):
2916 """Manage IPython's bookmark system.
2929 """Manage IPython's bookmark system.
2917
2930
2918 %bookmark <name> - set bookmark to current dir
2931 %bookmark <name> - set bookmark to current dir
2919 %bookmark <name> <dir> - set bookmark to <dir>
2932 %bookmark <name> <dir> - set bookmark to <dir>
2920 %bookmark -l - list all bookmarks
2933 %bookmark -l - list all bookmarks
2921 %bookmark -d <name> - remove bookmark
2934 %bookmark -d <name> - remove bookmark
2922 %bookmark -r - remove all bookmarks
2935 %bookmark -r - remove all bookmarks
2923
2936
2924 You can later on access a bookmarked folder with:
2937 You can later on access a bookmarked folder with:
2925 %cd -b <name>
2938 %cd -b <name>
2926 or simply '%cd <name>' if there is no directory called <name> AND
2939 or simply '%cd <name>' if there is no directory called <name> AND
2927 there is such a bookmark defined.
2940 there is such a bookmark defined.
2928
2941
2929 Your bookmarks persist through IPython sessions, but they are
2942 Your bookmarks persist through IPython sessions, but they are
2930 associated with each profile."""
2943 associated with each profile."""
2931
2944
2932 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2945 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2933 if len(args) > 2:
2946 if len(args) > 2:
2934 error('You can only give at most two arguments')
2947 error('You can only give at most two arguments')
2935 return
2948 return
2936
2949
2937 bkms = self.db.get('bookmarks',{})
2950 bkms = self.db.get('bookmarks',{})
2938
2951
2939 if opts.has_key('d'):
2952 if opts.has_key('d'):
2940 try:
2953 try:
2941 todel = args[0]
2954 todel = args[0]
2942 except IndexError:
2955 except IndexError:
2943 error('You must provide a bookmark to delete')
2956 error('You must provide a bookmark to delete')
2944 else:
2957 else:
2945 try:
2958 try:
2946 del bkms[todel]
2959 del bkms[todel]
2947 except:
2960 except:
2948 error("Can't delete bookmark '%s'" % todel)
2961 error("Can't delete bookmark '%s'" % todel)
2949 elif opts.has_key('r'):
2962 elif opts.has_key('r'):
2950 bkms = {}
2963 bkms = {}
2951 elif opts.has_key('l'):
2964 elif opts.has_key('l'):
2952 bks = bkms.keys()
2965 bks = bkms.keys()
2953 bks.sort()
2966 bks.sort()
2954 if bks:
2967 if bks:
2955 size = max(map(len,bks))
2968 size = max(map(len,bks))
2956 else:
2969 else:
2957 size = 0
2970 size = 0
2958 fmt = '%-'+str(size)+'s -> %s'
2971 fmt = '%-'+str(size)+'s -> %s'
2959 print 'Current bookmarks:'
2972 print 'Current bookmarks:'
2960 for bk in bks:
2973 for bk in bks:
2961 print fmt % (bk,bkms[bk])
2974 print fmt % (bk,bkms[bk])
2962 else:
2975 else:
2963 if not args:
2976 if not args:
2964 error("You must specify the bookmark name")
2977 error("You must specify the bookmark name")
2965 elif len(args)==1:
2978 elif len(args)==1:
2966 bkms[args[0]] = os.getcwd()
2979 bkms[args[0]] = os.getcwd()
2967 elif len(args)==2:
2980 elif len(args)==2:
2968 bkms[args[0]] = args[1]
2981 bkms[args[0]] = args[1]
2969 self.db['bookmarks'] = bkms
2982 self.db['bookmarks'] = bkms
2970
2983
2971 def magic_pycat(self, parameter_s=''):
2984 def magic_pycat(self, parameter_s=''):
2972 """Show a syntax-highlighted file through a pager.
2985 """Show a syntax-highlighted file through a pager.
2973
2986
2974 This magic is similar to the cat utility, but it will assume the file
2987 This magic is similar to the cat utility, but it will assume the file
2975 to be Python source and will show it with syntax highlighting. """
2988 to be Python source and will show it with syntax highlighting. """
2976
2989
2977 try:
2990 try:
2978 filename = get_py_filename(parameter_s)
2991 filename = get_py_filename(parameter_s)
2979 cont = file_read(filename)
2992 cont = file_read(filename)
2980 except IOError:
2993 except IOError:
2981 try:
2994 try:
2982 cont = eval(parameter_s,self.user_ns)
2995 cont = eval(parameter_s,self.user_ns)
2983 except NameError:
2996 except NameError:
2984 cont = None
2997 cont = None
2985 if cont is None:
2998 if cont is None:
2986 print "Error: no such file or variable"
2999 print "Error: no such file or variable"
2987 return
3000 return
2988
3001
2989 page(self.shell.pycolorize(cont),
3002 page(self.shell.pycolorize(cont),
2990 screen_lines=self.shell.rc.screen_length)
3003 screen_lines=self.shell.rc.screen_length)
2991
3004
2992 def magic_cpaste(self, parameter_s=''):
3005 def magic_cpaste(self, parameter_s=''):
2993 """Allows you to paste & execute a pre-formatted code block from clipboard
3006 """Allows you to paste & execute a pre-formatted code block from clipboard
2994
3007
2995 You must terminate the block with '--' (two minus-signs) alone on the
3008 You must terminate the block with '--' (two minus-signs) alone on the
2996 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3009 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2997 is the new sentinel for this operation)
3010 is the new sentinel for this operation)
2998
3011
2999 The block is dedented prior to execution to enable execution of
3012 The block is dedented prior to execution to enable execution of
3000 method definitions. '>' characters at the beginning of a line is
3013 method definitions. '>' characters at the beginning of a line is
3001 ignored, to allow pasting directly from e-mails. The executed block
3014 ignored, to allow pasting directly from e-mails. The executed block
3002 is also assigned to variable named 'pasted_block' for later editing
3015 is also assigned to variable named 'pasted_block' for later editing
3003 with '%edit pasted_block'.
3016 with '%edit pasted_block'.
3004
3017
3005 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3018 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3006 This assigns the pasted block to variable 'foo' as string, without
3019 This assigns the pasted block to variable 'foo' as string, without
3007 dedenting or executing it.
3020 dedenting or executing it.
3008
3021
3009 Do not be alarmed by garbled output on Windows (it's a readline bug).
3022 Do not be alarmed by garbled output on Windows (it's a readline bug).
3010 Just press enter and type -- (and press enter again) and the block
3023 Just press enter and type -- (and press enter again) and the block
3011 will be what was just pasted.
3024 will be what was just pasted.
3012
3025
3013 IPython statements (magics, shell escapes) are not supported (yet).
3026 IPython statements (magics, shell escapes) are not supported (yet).
3014 """
3027 """
3015 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3028 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3016 par = args.strip()
3029 par = args.strip()
3017 sentinel = opts.get('s','--')
3030 sentinel = opts.get('s','--')
3018
3031
3019 from IPython import iplib
3032 from IPython import iplib
3020 lines = []
3033 lines = []
3021 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3034 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3022 while 1:
3035 while 1:
3023 l = iplib.raw_input_original(':')
3036 l = iplib.raw_input_original(':')
3024 if l ==sentinel:
3037 if l ==sentinel:
3025 break
3038 break
3026 lines.append(l.lstrip('>'))
3039 lines.append(l.lstrip('>'))
3027 block = "\n".join(lines) + '\n'
3040 block = "\n".join(lines) + '\n'
3028 #print "block:\n",block
3041 #print "block:\n",block
3029 if not par:
3042 if not par:
3030 b = textwrap.dedent(block)
3043 b = textwrap.dedent(block)
3031 exec b in self.user_ns
3044 exec b in self.user_ns
3032 self.user_ns['pasted_block'] = b
3045 self.user_ns['pasted_block'] = b
3033 else:
3046 else:
3034 self.user_ns[par] = block
3047 self.user_ns[par] = block
3035 print "Block assigned to '%s'" % par
3048 print "Block assigned to '%s'" % par
3036
3049
3037 def magic_quickref(self,arg):
3050 def magic_quickref(self,arg):
3038 """ Show a quick reference sheet """
3051 """ Show a quick reference sheet """
3039 import IPython.usage
3052 import IPython.usage
3040 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3053 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3041
3054
3042 page(qr)
3055 page(qr)
3043
3056
3044 def magic_upgrade(self,arg):
3057 def magic_upgrade(self,arg):
3045 """ Upgrade your IPython installation
3058 """ Upgrade your IPython installation
3046
3059
3047 This will copy the config files that don't yet exist in your
3060 This will copy the config files that don't yet exist in your
3048 ipython dir from the system config dir. Use this after upgrading
3061 ipython dir from the system config dir. Use this after upgrading
3049 IPython if you don't wish to delete your .ipython dir.
3062 IPython if you don't wish to delete your .ipython dir.
3050
3063
3051 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3064 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3052 new users)
3065 new users)
3053
3066
3054 """
3067 """
3055 ip = self.getapi()
3068 ip = self.getapi()
3056 ipinstallation = path(IPython.__file__).dirname()
3069 ipinstallation = path(IPython.__file__).dirname()
3057 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3070 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3058 src_config = ipinstallation / 'UserConfig'
3071 src_config = ipinstallation / 'UserConfig'
3059 userdir = path(ip.options.ipythondir)
3072 userdir = path(ip.options.ipythondir)
3060 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3073 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3061 print ">",cmd
3074 print ">",cmd
3062 shell(cmd)
3075 shell(cmd)
3063 if arg == '-nolegacy':
3076 if arg == '-nolegacy':
3064 legacy = userdir.files('ipythonrc*')
3077 legacy = userdir.files('ipythonrc*')
3065 print "Nuking legacy files:",legacy
3078 print "Nuking legacy files:",legacy
3066
3079
3067 [p.remove() for p in legacy]
3080 [p.remove() for p in legacy]
3068 suffix = (sys.platform == 'win32' and '.ini' or '')
3081 suffix = (sys.platform == 'win32' and '.ini' or '')
3069 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3082 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3070
3083
3071 # end Magic
3084 # end Magic
@@ -1,467 +1,526 b''
1 """Module for interactive demos using IPython.
1 """Module for interactive demos using IPython.
2
2
3 This module implements a few classes for running Python scripts interactively
3 This module implements a few classes for running Python scripts interactively
4 in IPython for demonstrations. With very simple markup (a few tags in
4 in IPython for demonstrations. With very simple markup (a few tags in
5 comments), you can control points where the script stops executing and returns
5 comments), you can control points where the script stops executing and returns
6 control to IPython.
6 control to IPython.
7
7
8
8
9 Provided classes
9 Provided classes
10 ================
10 ================
11
11
12 The classes are (see their docstrings for further details):
12 The classes are (see their docstrings for further details):
13
13
14 - Demo: pure python demos
14 - Demo: pure python demos
15
15
16 - IPythonDemo: demos with input to be processed by IPython as if it had been
16 - IPythonDemo: demos with input to be processed by IPython as if it had been
17 typed interactively (so magics work, as well as any other special syntax you
17 typed interactively (so magics work, as well as any other special syntax you
18 may have added via input prefilters).
18 may have added via input prefilters).
19
19
20 - LineDemo: single-line version of the Demo class. These demos are executed
20 - LineDemo: single-line version of the Demo class. These demos are executed
21 one line at a time, and require no markup.
21 one line at a time, and require no markup.
22
22
23 - IPythonLineDemo: IPython version of the LineDemo class (the demo is
23 - IPythonLineDemo: IPython version of the LineDemo class (the demo is
24 executed a line at a time, but processed via IPython).
24 executed a line at a time, but processed via IPython).
25
25
26 - ClearMixin: mixin to make Demo classes with less visual clutter. It
27 declares an empty marquee and a pre_cmd that clears the screen before each
28 block (see Subclassing below).
29
30 - ClearDemo, ClearIPDemo: mixin-enabled versions of the Demo and IPythonDemo
31 classes.
32
26
33
27 Subclassing
34 Subclassing
28 ===========
35 ===========
29
36
30 The classes here all include a few methods meant to make customization by
37 The classes here all include a few methods meant to make customization by
31 subclassing more convenient. Their docstrings below have some more details:
38 subclassing more convenient. Their docstrings below have some more details:
32
39
33 - marquee(): generates a marquee to provide visible on-screen markers at each
40 - marquee(): generates a marquee to provide visible on-screen markers at each
34 block start and end.
41 block start and end.
35
42
36 - pre_cmd(): run right before the execution of each block.
43 - pre_cmd(): run right before the execution of each block.
37
44
38 - pre_cmd(): run right after the execution of each block. If the block
45 - post_cmd(): run right after the execution of each block. If the block
39 raises an exception, this is NOT called.
46 raises an exception, this is NOT called.
40
47
41
48
42 Operation
49 Operation
43 =========
50 =========
44
51
45 The file is run in its own empty namespace (though you can pass it a string of
52 The file is run in its own empty namespace (though you can pass it a string of
46 arguments as if in a command line environment, and it will see those as
53 arguments as if in a command line environment, and it will see those as
47 sys.argv). But at each stop, the global IPython namespace is updated with the
54 sys.argv). But at each stop, the global IPython namespace is updated with the
48 current internal demo namespace, so you can work interactively with the data
55 current internal demo namespace, so you can work interactively with the data
49 accumulated so far.
56 accumulated so far.
50
57
51 By default, each block of code is printed (with syntax highlighting) before
58 By default, each block of code is printed (with syntax highlighting) before
52 executing it and you have to confirm execution. This is intended to show the
59 executing it and you have to confirm execution. This is intended to show the
53 code to an audience first so you can discuss it, and only proceed with
60 code to an audience first so you can discuss it, and only proceed with
54 execution once you agree. There are a few tags which allow you to modify this
61 execution once you agree. There are a few tags which allow you to modify this
55 behavior.
62 behavior.
56
63
57 The supported tags are:
64 The supported tags are:
58
65
59 # <demo> --- stop ---
66 # <demo> stop
60
67
61 Defines block boundaries, the points where IPython stops execution of the
68 Defines block boundaries, the points where IPython stops execution of the
62 file and returns to the interactive prompt.
69 file and returns to the interactive prompt.
63
70
71 You can optionally mark the stop tag with extra dashes before and after the
72 word 'stop', to help visually distinguish the blocks in a text editor:
73
74 # <demo> --- stop ---
75
76
64 # <demo> silent
77 # <demo> silent
65
78
66 Make a block execute silently (and hence automatically). Typically used in
79 Make a block execute silently (and hence automatically). Typically used in
67 cases where you have some boilerplate or initialization code which you need
80 cases where you have some boilerplate or initialization code which you need
68 executed but do not want to be seen in the demo.
81 executed but do not want to be seen in the demo.
69
82
70 # <demo> auto
83 # <demo> auto
71
84
72 Make a block execute automatically, but still being printed. Useful for
85 Make a block execute automatically, but still being printed. Useful for
73 simple code which does not warrant discussion, since it avoids the extra
86 simple code which does not warrant discussion, since it avoids the extra
74 manual confirmation.
87 manual confirmation.
75
88
76 # <demo> auto_all
89 # <demo> auto_all
77
90
78 This tag can _only_ be in the first block, and if given it overrides the
91 This tag can _only_ be in the first block, and if given it overrides the
79 individual auto tags to make the whole demo fully automatic (no block asks
92 individual auto tags to make the whole demo fully automatic (no block asks
80 for confirmation). It can also be given at creation time (or the attribute
93 for confirmation). It can also be given at creation time (or the attribute
81 set later) to override what's in the file.
94 set later) to override what's in the file.
82
95
83 While _any_ python file can be run as a Demo instance, if there are no stop
96 While _any_ python file can be run as a Demo instance, if there are no stop
84 tags the whole file will run in a single block (no different that calling
97 tags the whole file will run in a single block (no different that calling
85 first %pycat and then %run). The minimal markup to make this useful is to
98 first %pycat and then %run). The minimal markup to make this useful is to
86 place a set of stop tags; the other tags are only there to let you fine-tune
99 place a set of stop tags; the other tags are only there to let you fine-tune
87 the execution.
100 the execution.
88
101
89 This is probably best explained with the simple example file below. You can
102 This is probably best explained with the simple example file below. You can
90 copy this into a file named ex_demo.py, and try running it via:
103 copy this into a file named ex_demo.py, and try running it via:
91
104
92 from IPython.demo import Demo
105 from IPython.demo import Demo
93 d = Demo('ex_demo.py')
106 d = Demo('ex_demo.py')
94 d() <--- Call the d object (omit the parens if you have autocall set to 2).
107 d() <--- Call the d object (omit the parens if you have autocall set to 2).
95
108
96 Each time you call the demo object, it runs the next block. The demo object
109 Each time you call the demo object, it runs the next block. The demo object
97 has a few useful methods for navigation, like again(), edit(), jump(), seek()
110 has a few useful methods for navigation, like again(), edit(), jump(), seek()
98 and back(). It can be reset for a new run via reset() or reloaded from disk
111 and back(). It can be reset for a new run via reset() or reloaded from disk
99 (in case you've edited the source) via reload(). See their docstrings below.
112 (in case you've edited the source) via reload(). See their docstrings below.
100
113
101
114
102 Example
115 Example
103 =======
116 =======
104
117
105 The following is a very simple example of a valid demo file.
118 The following is a very simple example of a valid demo file.
106
119
107 #################### EXAMPLE DEMO <ex_demo.py> ###############################
120 #################### EXAMPLE DEMO <ex_demo.py> ###############################
108 '''A simple interactive demo to illustrate the use of IPython's Demo class.'''
121 '''A simple interactive demo to illustrate the use of IPython's Demo class.'''
109
122
110 print 'Hello, welcome to an interactive IPython demo.'
123 print 'Hello, welcome to an interactive IPython demo.'
111
124
112 # The mark below defines a block boundary, which is a point where IPython will
125 # The mark below defines a block boundary, which is a point where IPython will
113 # stop execution and return to the interactive prompt.
126 # stop execution and return to the interactive prompt. The dashes are actually
114 # Note that in actual interactive execution,
127 # optional and used only as a visual aid to clearly separate blocks while
115 # <demo> --- stop ---
128 editing the demo code.
129 # <demo> stop
116
130
117 x = 1
131 x = 1
118 y = 2
132 y = 2
119
133
120 # <demo> --- stop ---
134 # <demo> stop
121
135
122 # the mark below makes this block as silent
136 # the mark below makes this block as silent
123 # <demo> silent
137 # <demo> silent
124
138
125 print 'This is a silent block, which gets executed but not printed.'
139 print 'This is a silent block, which gets executed but not printed.'
126
140
127 # <demo> --- stop ---
141 # <demo> stop
128 # <demo> auto
142 # <demo> auto
129 print 'This is an automatic block.'
143 print 'This is an automatic block.'
130 print 'It is executed without asking for confirmation, but printed.'
144 print 'It is executed without asking for confirmation, but printed.'
131 z = x+y
145 z = x+y
132
146
133 print 'z=',x
147 print 'z=',x
134
148
135 # <demo> --- stop ---
149 # <demo> stop
136 # This is just another normal block.
150 # This is just another normal block.
137 print 'z is now:', z
151 print 'z is now:', z
138
152
139 print 'bye!'
153 print 'bye!'
140 ################### END EXAMPLE DEMO <ex_demo.py> ############################
154 ################### END EXAMPLE DEMO <ex_demo.py> ############################
141 """
155 """
142
156
143 #*****************************************************************************
157 #*****************************************************************************
144 # Copyright (C) 2005-2006 Fernando Perez. <Fernando.Perez@colorado.edu>
158 # Copyright (C) 2005-2006 Fernando Perez. <Fernando.Perez@colorado.edu>
145 #
159 #
146 # Distributed under the terms of the BSD License. The full license is in
160 # Distributed under the terms of the BSD License. The full license is in
147 # the file COPYING, distributed as part of this software.
161 # the file COPYING, distributed as part of this software.
148 #
162 #
149 #*****************************************************************************
163 #*****************************************************************************
150
164
151 import exceptions
165 import exceptions
152 import os
166 import os
153 import re
167 import re
154 import shlex
168 import shlex
155 import sys
169 import sys
156
170
157 from IPython.PyColorize import Parser
171 from IPython.PyColorize import Parser
158 from IPython.genutils import marquee, file_read, file_readlines
172 from IPython.genutils import marquee, file_read, file_readlines
159
173
160 __all__ = ['Demo','IPythonDemo','LineDemo','IPythonLineDemo','DemoError']
174 __all__ = ['Demo','IPythonDemo','LineDemo','IPythonLineDemo','DemoError']
161
175
162 class DemoError(exceptions.Exception): pass
176 class DemoError(exceptions.Exception): pass
163
177
164 def re_mark(mark):
178 def re_mark(mark):
165 return re.compile(r'^\s*#\s+<demo>\s+%s\s*$' % mark,re.MULTILINE)
179 return re.compile(r'^\s*#\s+<demo>\s+%s\s*$' % mark,re.MULTILINE)
166
180
167 class Demo:
181 class Demo(object):
168
182
169 re_stop = re_mark('---\s?stop\s?---')
183 re_stop = re_mark('-?\s?stop\s?-?')
170 re_silent = re_mark('silent')
184 re_silent = re_mark('silent')
171 re_auto = re_mark('auto')
185 re_auto = re_mark('auto')
172 re_auto_all = re_mark('auto_all')
186 re_auto_all = re_mark('auto_all')
173
187
174 def __init__(self,fname,arg_str='',auto_all=None):
188 def __init__(self,fname,arg_str='',auto_all=None):
175 """Make a new demo object. To run the demo, simply call the object.
189 """Make a new demo object. To run the demo, simply call the object.
176
190
177 See the module docstring for full details and an example (you can use
191 See the module docstring for full details and an example (you can use
178 IPython.Demo? in IPython to see it).
192 IPython.Demo? in IPython to see it).
179
193
180 Inputs:
194 Inputs:
181
195
182 - fname = filename.
196 - fname = filename.
183
197
184 Optional inputs:
198 Optional inputs:
185
199
186 - arg_str(''): a string of arguments, internally converted to a list
200 - arg_str(''): a string of arguments, internally converted to a list
187 just like sys.argv, so the demo script can see a similar
201 just like sys.argv, so the demo script can see a similar
188 environment.
202 environment.
189
203
190 - auto_all(None): global flag to run all blocks automatically without
204 - auto_all(None): global flag to run all blocks automatically without
191 confirmation. This attribute overrides the block-level tags and
205 confirmation. This attribute overrides the block-level tags and
192 applies to the whole demo. It is an attribute of the object, and
206 applies to the whole demo. It is an attribute of the object, and
193 can be changed at runtime simply by reassigning it to a boolean
207 can be changed at runtime simply by reassigning it to a boolean
194 value.
208 value.
195 """
209 """
196
210
197 self.fname = fname
211 self.fname = fname
198 self.sys_argv = [fname] + shlex.split(arg_str)
212 self.sys_argv = [fname] + shlex.split(arg_str)
199 self.auto_all = auto_all
213 self.auto_all = auto_all
200
214
201 # get a few things from ipython. While it's a bit ugly design-wise,
215 # get a few things from ipython. While it's a bit ugly design-wise,
202 # it ensures that things like color scheme and the like are always in
216 # it ensures that things like color scheme and the like are always in
203 # sync with the ipython mode being used. This class is only meant to
217 # sync with the ipython mode being used. This class is only meant to
204 # be used inside ipython anyways, so it's OK.
218 # be used inside ipython anyways, so it's OK.
205 self.ip_ns = __IPYTHON__.user_ns
219 self.ip_ns = __IPYTHON__.user_ns
206 self.ip_colorize = __IPYTHON__.pycolorize
220 self.ip_colorize = __IPYTHON__.pycolorize
207 self.ip_showtb = __IPYTHON__.showtraceback
221 self.ip_showtb = __IPYTHON__.showtraceback
208 self.ip_runlines = __IPYTHON__.runlines
222 self.ip_runlines = __IPYTHON__.runlines
209 self.shell = __IPYTHON__
223 self.shell = __IPYTHON__
210
224
211 # load user data and initialize data structures
225 # load user data and initialize data structures
212 self.reload()
226 self.reload()
213
227
214 def reload(self):
228 def reload(self):
215 """Reload source from disk and initialize state."""
229 """Reload source from disk and initialize state."""
216 # read data and parse into blocks
230 # read data and parse into blocks
217 self.src = file_read(self.fname)
231 self.src = file_read(self.fname)
218 src_b = [b.strip() for b in self.re_stop.split(self.src) if b]
232 src_b = [b.strip() for b in self.re_stop.split(self.src) if b]
219 self._silent = [bool(self.re_silent.findall(b)) for b in src_b]
233 self._silent = [bool(self.re_silent.findall(b)) for b in src_b]
220 self._auto = [bool(self.re_auto.findall(b)) for b in src_b]
234 self._auto = [bool(self.re_auto.findall(b)) for b in src_b]
221
235
222 # if auto_all is not given (def. None), we read it from the file
236 # if auto_all is not given (def. None), we read it from the file
223 if self.auto_all is None:
237 if self.auto_all is None:
224 self.auto_all = bool(self.re_auto_all.findall(src_b[0]))
238 self.auto_all = bool(self.re_auto_all.findall(src_b[0]))
225 else:
239 else:
226 self.auto_all = bool(self.auto_all)
240 self.auto_all = bool(self.auto_all)
227
241
228 # Clean the sources from all markup so it doesn't get displayed when
242 # Clean the sources from all markup so it doesn't get displayed when
229 # running the demo
243 # running the demo
230 src_blocks = []
244 src_blocks = []
231 auto_strip = lambda s: self.re_auto.sub('',s)
245 auto_strip = lambda s: self.re_auto.sub('',s)
232 for i,b in enumerate(src_b):
246 for i,b in enumerate(src_b):
233 if self._auto[i]:
247 if self._auto[i]:
234 src_blocks.append(auto_strip(b))
248 src_blocks.append(auto_strip(b))
235 else:
249 else:
236 src_blocks.append(b)
250 src_blocks.append(b)
237 # remove the auto_all marker
251 # remove the auto_all marker
238 src_blocks[0] = self.re_auto_all.sub('',src_blocks[0])
252 src_blocks[0] = self.re_auto_all.sub('',src_blocks[0])
239
253
240 self.nblocks = len(src_blocks)
254 self.nblocks = len(src_blocks)
241 self.src_blocks = src_blocks
255 self.src_blocks = src_blocks
242
256
243 # also build syntax-highlighted source
257 # also build syntax-highlighted source
244 self.src_blocks_colored = map(self.ip_colorize,self.src_blocks)
258 self.src_blocks_colored = map(self.ip_colorize,self.src_blocks)
245
259
246 # ensure clean namespace and seek offset
260 # ensure clean namespace and seek offset
247 self.reset()
261 self.reset()
248
262
249 def reset(self):
263 def reset(self):
250 """Reset the namespace and seek pointer to restart the demo"""
264 """Reset the namespace and seek pointer to restart the demo"""
251 self.user_ns = {}
265 self.user_ns = {}
252 self.finished = False
266 self.finished = False
253 self.block_index = 0
267 self.block_index = 0
254
268
255 def _validate_index(self,index):
269 def _validate_index(self,index):
256 if index<0 or index>=self.nblocks:
270 if index<0 or index>=self.nblocks:
257 raise ValueError('invalid block index %s' % index)
271 raise ValueError('invalid block index %s' % index)
258
272
259 def _get_index(self,index):
273 def _get_index(self,index):
260 """Get the current block index, validating and checking status.
274 """Get the current block index, validating and checking status.
261
275
262 Returns None if the demo is finished"""
276 Returns None if the demo is finished"""
263
277
264 if index is None:
278 if index is None:
265 if self.finished:
279 if self.finished:
266 print 'Demo finished. Use reset() if you want to rerun it.'
280 print 'Demo finished. Use reset() if you want to rerun it.'
267 return None
281 return None
268 index = self.block_index
282 index = self.block_index
269 else:
283 else:
270 self._validate_index(index)
284 self._validate_index(index)
271 return index
285 return index
272
286
273 def seek(self,index):
287 def seek(self,index):
274 """Move the current seek pointer to the given block"""
288 """Move the current seek pointer to the given block.
289
290 You can use negative indices to seek from the end, with identical
291 semantics to those of Python lists."""
292 if index<0:
293 index = self.nblocks + index
275 self._validate_index(index)
294 self._validate_index(index)
276 self.block_index = index
295 self.block_index = index
277 self.finished = False
296 self.finished = False
278
297
279 def back(self,num=1):
298 def back(self,num=1):
280 """Move the seek pointer back num blocks (default is 1)."""
299 """Move the seek pointer back num blocks (default is 1)."""
281 self.seek(self.block_index-num)
300 self.seek(self.block_index-num)
282
301
283 def jump(self,num):
302 def jump(self,num=1):
284 """Jump a given number of blocks relative to the current one."""
303 """Jump a given number of blocks relative to the current one.
304
305 The offset can be positive or negative, defaults to 1."""
285 self.seek(self.block_index+num)
306 self.seek(self.block_index+num)
286
307
287 def again(self):
308 def again(self):
288 """Move the seek pointer back one block and re-execute."""
309 """Move the seek pointer back one block and re-execute."""
289 self.back(1)
310 self.back(1)
290 self()
311 self()
291
312
292 def edit(self,index=None):
313 def edit(self,index=None):
293 """Edit a block.
314 """Edit a block.
294
315
295 If no number is given, use the last block executed.
316 If no number is given, use the last block executed.
296
317
297 This edits the in-memory copy of the demo, it does NOT modify the
318 This edits the in-memory copy of the demo, it does NOT modify the
298 original source file. If you want to do that, simply open the file in
319 original source file. If you want to do that, simply open the file in
299 an editor and use reload() when you make changes to the file. This
320 an editor and use reload() when you make changes to the file. This
300 method is meant to let you change a block during a demonstration for
321 method is meant to let you change a block during a demonstration for
301 explanatory purposes, without damaging your original script."""
322 explanatory purposes, without damaging your original script."""
302
323
303 index = self._get_index(index)
324 index = self._get_index(index)
304 if index is None:
325 if index is None:
305 return
326 return
306 # decrease the index by one (unless we're at the very beginning), so
327 # decrease the index by one (unless we're at the very beginning), so
307 # that the default demo.edit() call opens up the sblock we've last run
328 # that the default demo.edit() call opens up the sblock we've last run
308 if index>0:
329 if index>0:
309 index -= 1
330 index -= 1
310
331
311 filename = self.shell.mktempfile(self.src_blocks[index])
332 filename = self.shell.mktempfile(self.src_blocks[index])
312 self.shell.hooks.editor(filename,1)
333 self.shell.hooks.editor(filename,1)
313 new_block = file_read(filename)
334 new_block = file_read(filename)
314 # update the source and colored block
335 # update the source and colored block
315 self.src_blocks[index] = new_block
336 self.src_blocks[index] = new_block
316 self.src_blocks_colored[index] = self.ip_colorize(new_block)
337 self.src_blocks_colored[index] = self.ip_colorize(new_block)
317 self.block_index = index
338 self.block_index = index
318 # call to run with the newly edited index
339 # call to run with the newly edited index
319 self()
340 self()
320
341
321 def show(self,index=None):
342 def show(self,index=None):
322 """Show a single block on screen"""
343 """Show a single block on screen"""
323
344
324 index = self._get_index(index)
345 index = self._get_index(index)
325 if index is None:
346 if index is None:
326 return
347 return
327
348
328 print self.marquee('<%s> block # %s (%s remaining)' %
349 print self.marquee('<%s> block # %s (%s remaining)' %
329 (self.fname,index,self.nblocks-index-1))
350 (self.fname,index,self.nblocks-index-1))
330 print self.src_blocks_colored[index],
351 sys.stdout.write(self.src_blocks_colored[index])
331 sys.stdout.flush()
352 sys.stdout.flush()
332
353
333 def show_all(self):
354 def show_all(self):
334 """Show entire demo on screen, block by block"""
355 """Show entire demo on screen, block by block"""
335
356
336 fname = self.fname
357 fname = self.fname
337 nblocks = self.nblocks
358 nblocks = self.nblocks
338 silent = self._silent
359 silent = self._silent
339 marquee = self.marquee
360 marquee = self.marquee
340 for index,block in enumerate(self.src_blocks_colored):
361 for index,block in enumerate(self.src_blocks_colored):
341 if silent[index]:
362 if silent[index]:
342 print marquee('<%s> SILENT block # %s (%s remaining)' %
363 print marquee('<%s> SILENT block # %s (%s remaining)' %
343 (fname,index,nblocks-index-1))
364 (fname,index,nblocks-index-1))
344 else:
365 else:
345 print marquee('<%s> block # %s (%s remaining)' %
366 print marquee('<%s> block # %s (%s remaining)' %
346 (fname,index,nblocks-index-1))
367 (fname,index,nblocks-index-1))
347 print block,
368 print block,
348 sys.stdout.flush()
369 sys.stdout.flush()
349
370
350 def runlines(self,source):
371 def runlines(self,source):
351 """Execute a string with one or more lines of code"""
372 """Execute a string with one or more lines of code"""
352
373
353 exec source in self.user_ns
374 exec source in self.user_ns
354
375
355 def __call__(self,index=None):
376 def __call__(self,index=None):
356 """run a block of the demo.
377 """run a block of the demo.
357
378
358 If index is given, it should be an integer >=1 and <= nblocks. This
379 If index is given, it should be an integer >=1 and <= nblocks. This
359 means that the calling convention is one off from typical Python
380 means that the calling convention is one off from typical Python
360 lists. The reason for the inconsistency is that the demo always
381 lists. The reason for the inconsistency is that the demo always
361 prints 'Block n/N, and N is the total, so it would be very odd to use
382 prints 'Block n/N, and N is the total, so it would be very odd to use
362 zero-indexing here."""
383 zero-indexing here."""
363
384
364 index = self._get_index(index)
385 index = self._get_index(index)
365 if index is None:
386 if index is None:
366 return
387 return
367 try:
388 try:
368 marquee = self.marquee
389 marquee = self.marquee
369 next_block = self.src_blocks[index]
390 next_block = self.src_blocks[index]
370 self.block_index += 1
391 self.block_index += 1
371 if self._silent[index]:
392 if self._silent[index]:
372 print marquee('Executing silent block # %s (%s remaining)' %
393 print marquee('Executing silent block # %s (%s remaining)' %
373 (index,self.nblocks-index-1))
394 (index,self.nblocks-index-1))
374 else:
395 else:
375 self.pre_cmd()
396 self.pre_cmd()
376 self.show(index)
397 self.show(index)
377 if self.auto_all or self._auto[index]:
398 if self.auto_all or self._auto[index]:
378 print marquee('output')
399 print marquee('output:')
379 else:
400 else:
380 print marquee('Press <q> to quit, <Enter> to execute...'),
401 print marquee('Press <q> to quit, <Enter> to execute...'),
381 ans = raw_input().strip()
402 ans = raw_input().strip()
382 if ans:
403 if ans:
383 print marquee('Block NOT executed')
404 print marquee('Block NOT executed')
384 return
405 return
385 try:
406 try:
386 save_argv = sys.argv
407 save_argv = sys.argv
387 sys.argv = self.sys_argv
408 sys.argv = self.sys_argv
388 self.runlines(next_block)
409 self.runlines(next_block)
389 self.post_cmd()
410 self.post_cmd()
390 finally:
411 finally:
391 sys.argv = save_argv
412 sys.argv = save_argv
392
413
393 except:
414 except:
394 self.ip_showtb(filename=self.fname)
415 self.ip_showtb(filename=self.fname)
395 else:
416 else:
396 self.ip_ns.update(self.user_ns)
417 self.ip_ns.update(self.user_ns)
397
418
398 if self.block_index == self.nblocks:
419 if self.block_index == self.nblocks:
420 mq1 = self.marquee('END OF DEMO')
421 if mq1:
422 # avoid spurious prints if empty marquees are used
399 print
423 print
400 print self.marquee(' END OF DEMO ')
424 print mq1
401 print self.marquee('Use reset() if you want to rerun it.')
425 print self.marquee('Use reset() if you want to rerun it.')
402 self.finished = True
426 self.finished = True
403
427
404 # These methods are meant to be overridden by subclasses who may wish to
428 # These methods are meant to be overridden by subclasses who may wish to
405 # customize the behavior of of their demos.
429 # customize the behavior of of their demos.
406 def marquee(self,txt='',width=78,mark='*'):
430 def marquee(self,txt='',width=78,mark='*'):
407 """Return the input string centered in a 'marquee'."""
431 """Return the input string centered in a 'marquee'."""
408 return marquee(txt,width,mark)
432 return marquee(txt,width,mark)
409
433
410 def pre_cmd(self):
434 def pre_cmd(self):
411 """Method called before executing each block."""
435 """Method called before executing each block."""
412 pass
436 pass
413
437
414 def post_cmd(self):
438 def post_cmd(self):
415 """Method called after executing each block."""
439 """Method called after executing each block."""
416 pass
440 pass
417
441
418
442
419 class IPythonDemo(Demo):
443 class IPythonDemo(Demo):
420 """Class for interactive demos with IPython's input processing applied.
444 """Class for interactive demos with IPython's input processing applied.
421
445
422 This subclasses Demo, but instead of executing each block by the Python
446 This subclasses Demo, but instead of executing each block by the Python
423 interpreter (via exec), it actually calls IPython on it, so that any input
447 interpreter (via exec), it actually calls IPython on it, so that any input
424 filters which may be in place are applied to the input block.
448 filters which may be in place are applied to the input block.
425
449
426 If you have an interactive environment which exposes special input
450 If you have an interactive environment which exposes special input
427 processing, you can use this class instead to write demo scripts which
451 processing, you can use this class instead to write demo scripts which
428 operate exactly as if you had typed them interactively. The default Demo
452 operate exactly as if you had typed them interactively. The default Demo
429 class requires the input to be valid, pure Python code.
453 class requires the input to be valid, pure Python code.
430 """
454 """
431
455
432 def runlines(self,source):
456 def runlines(self,source):
433 """Execute a string with one or more lines of code"""
457 """Execute a string with one or more lines of code"""
434
458
435 self.shell.runlines(source)
459 self.shell.runlines(source)
436
460
437 class LineDemo(Demo):
461 class LineDemo(Demo):
438 """Demo where each line is executed as a separate block.
462 """Demo where each line is executed as a separate block.
439
463
440 The input script should be valid Python code.
464 The input script should be valid Python code.
441
465
442 This class doesn't require any markup at all, and it's meant for simple
466 This class doesn't require any markup at all, and it's meant for simple
443 scripts (with no nesting or any kind of indentation) which consist of
467 scripts (with no nesting or any kind of indentation) which consist of
444 multiple lines of input to be executed, one at a time, as if they had been
468 multiple lines of input to be executed, one at a time, as if they had been
445 typed in the interactive prompt."""
469 typed in the interactive prompt."""
446
470
447 def reload(self):
471 def reload(self):
448 """Reload source from disk and initialize state."""
472 """Reload source from disk and initialize state."""
449 # read data and parse into blocks
473 # read data and parse into blocks
450 src_b = [l for l in file_readlines(self.fname) if l.strip()]
474 src_b = [l for l in file_readlines(self.fname) if l.strip()]
451 nblocks = len(src_b)
475 nblocks = len(src_b)
452 self.src = os.linesep.join(file_readlines(self.fname))
476 self.src = os.linesep.join(file_readlines(self.fname))
453 self._silent = [False]*nblocks
477 self._silent = [False]*nblocks
454 self._auto = [True]*nblocks
478 self._auto = [True]*nblocks
455 self.auto_all = True
479 self.auto_all = True
456 self.nblocks = nblocks
480 self.nblocks = nblocks
457 self.src_blocks = src_b
481 self.src_blocks = src_b
458
482
459 # also build syntax-highlighted source
483 # also build syntax-highlighted source
460 self.src_blocks_colored = map(self.ip_colorize,self.src_blocks)
484 self.src_blocks_colored = map(self.ip_colorize,self.src_blocks)
461
485
462 # ensure clean namespace and seek offset
486 # ensure clean namespace and seek offset
463 self.reset()
487 self.reset()
464
488
489
465 class IPythonLineDemo(IPythonDemo,LineDemo):
490 class IPythonLineDemo(IPythonDemo,LineDemo):
466 """Variant of the LineDemo class whose input is processed by IPython."""
491 """Variant of the LineDemo class whose input is processed by IPython."""
467 pass
492 pass
493
494
495 class ClearMixin(object):
496 """Use this mixin to make Demo classes with less visual clutter.
497
498 Demos using this mixin will clear the screen before every block and use
499 blank marquees.
500
501 Note that in order for the methods defined here to actually override those
502 of the classes it's mixed with, it must go /first/ in the inheritance
503 tree. For example:
504
505 class ClearIPDemo(ClearMixin,IPythonDemo): pass
506
507 will provide an IPythonDemo class with the mixin's features.
508 """
509
510 def marquee(self,txt='',width=78,mark='*'):
511 """Blank marquee that returns '' no matter what the input."""
512 return ''
513
514 def pre_cmd(self):
515 """Method called before executing each block.
516
517 This one simply clears the screen."""
518 os.system('clear')
519
520
521 class ClearDemo(ClearMixin,Demo):
522 pass
523
524
525 class ClearIPDemo(ClearMixin,IPythonDemo):
526 pass
@@ -1,6220 +1,6228 b''
1 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
4 stop marks.
5 (ClearingMixin): a simple mixin to easily make a Demo class clear
6 the screen in between blocks and have empty marquees. The
7 ClearDemo and ClearIPDemo classes that use it are included.
8
1 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
9 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
2
10
3 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
11 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
4 protect against exceptions at Python shutdown time. Patch
12 protect against exceptions at Python shutdown time. Patch
5 sumbmitted to upstream.
13 sumbmitted to upstream.
6
14
7 2007-02-14 Walter Doerwald <walter@livinglogic.de>
15 2007-02-14 Walter Doerwald <walter@livinglogic.de>
8
16
9 * IPython/Extensions/ibrowse.py: If entering the first object level
17 * IPython/Extensions/ibrowse.py: If entering the first object level
10 (i.e. the object for which the browser has been started) fails,
18 (i.e. the object for which the browser has been started) fails,
11 now the error is raised directly (aborting the browser) instead of
19 now the error is raised directly (aborting the browser) instead of
12 running into an empty levels list later.
20 running into an empty levels list later.
13
21
14 2007-02-03 Walter Doerwald <walter@livinglogic.de>
22 2007-02-03 Walter Doerwald <walter@livinglogic.de>
15
23
16 * IPython/Extensions/ipipe.py: Add an xrepr implementation
24 * IPython/Extensions/ipipe.py: Add an xrepr implementation
17 for the noitem object.
25 for the noitem object.
18
26
19 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
27 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
20
28
21 * IPython/completer.py (Completer.attr_matches): Fix small
29 * IPython/completer.py (Completer.attr_matches): Fix small
22 tab-completion bug with Enthought Traits objects with units.
30 tab-completion bug with Enthought Traits objects with units.
23 Thanks to a bug report by Tom Denniston
31 Thanks to a bug report by Tom Denniston
24 <tom.denniston-AT-alum.dartmouth.org>.
32 <tom.denniston-AT-alum.dartmouth.org>.
25
33
26 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
34 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
27
35
28 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
36 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
29 bug where only .ipy or .py would be completed. Once the first
37 bug where only .ipy or .py would be completed. Once the first
30 argument to %run has been given, all completions are valid because
38 argument to %run has been given, all completions are valid because
31 they are the arguments to the script, which may well be non-python
39 they are the arguments to the script, which may well be non-python
32 filenames.
40 filenames.
33
41
34 * IPython/irunner.py (InteractiveRunner.run_source): major updates
42 * IPython/irunner.py (InteractiveRunner.run_source): major updates
35 to irunner to allow it to correctly support real doctesting of
43 to irunner to allow it to correctly support real doctesting of
36 out-of-process ipython code.
44 out-of-process ipython code.
37
45
38 * IPython/Magic.py (magic_cd): Make the setting of the terminal
46 * IPython/Magic.py (magic_cd): Make the setting of the terminal
39 title an option (-noterm_title) because it completely breaks
47 title an option (-noterm_title) because it completely breaks
40 doctesting.
48 doctesting.
41
49
42 * IPython/demo.py: fix IPythonDemo class that was not actually working.
50 * IPython/demo.py: fix IPythonDemo class that was not actually working.
43
51
44 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
52 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
45
53
46 * IPython/irunner.py (main): fix small bug where extensions were
54 * IPython/irunner.py (main): fix small bug where extensions were
47 not being correctly recognized.
55 not being correctly recognized.
48
56
49 2007-01-23 Walter Doerwald <walter@livinglogic.de>
57 2007-01-23 Walter Doerwald <walter@livinglogic.de>
50
58
51 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
59 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
52 a string containing a single line yields the string itself as the
60 a string containing a single line yields the string itself as the
53 only item.
61 only item.
54
62
55 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
63 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
56 object if it's the same as the one on the last level (This avoids
64 object if it's the same as the one on the last level (This avoids
57 infinite recursion for one line strings).
65 infinite recursion for one line strings).
58
66
59 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
67 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
60
68
61 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
69 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
62 all output streams before printing tracebacks. This ensures that
70 all output streams before printing tracebacks. This ensures that
63 user output doesn't end up interleaved with traceback output.
71 user output doesn't end up interleaved with traceback output.
64
72
65 2007-01-10 Ville Vainio <vivainio@gmail.com>
73 2007-01-10 Ville Vainio <vivainio@gmail.com>
66
74
67 * Extensions/envpersist.py: Turbocharged %env that remembers
75 * Extensions/envpersist.py: Turbocharged %env that remembers
68 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
76 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
69 "%env VISUAL=jed".
77 "%env VISUAL=jed".
70
78
71 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
79 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
72
80
73 * IPython/iplib.py (showtraceback): ensure that we correctly call
81 * IPython/iplib.py (showtraceback): ensure that we correctly call
74 custom handlers in all cases (some with pdb were slipping through,
82 custom handlers in all cases (some with pdb were slipping through,
75 but I'm not exactly sure why).
83 but I'm not exactly sure why).
76
84
77 * IPython/Debugger.py (Tracer.__init__): added new class to
85 * IPython/Debugger.py (Tracer.__init__): added new class to
78 support set_trace-like usage of IPython's enhanced debugger.
86 support set_trace-like usage of IPython's enhanced debugger.
79
87
80 2006-12-24 Ville Vainio <vivainio@gmail.com>
88 2006-12-24 Ville Vainio <vivainio@gmail.com>
81
89
82 * ipmaker.py: more informative message when ipy_user_conf
90 * ipmaker.py: more informative message when ipy_user_conf
83 import fails (suggest running %upgrade).
91 import fails (suggest running %upgrade).
84
92
85 * tools/run_ipy_in_profiler.py: Utility to see where
93 * tools/run_ipy_in_profiler.py: Utility to see where
86 the time during IPython startup is spent.
94 the time during IPython startup is spent.
87
95
88 2006-12-20 Ville Vainio <vivainio@gmail.com>
96 2006-12-20 Ville Vainio <vivainio@gmail.com>
89
97
90 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
98 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
91
99
92 * ipapi.py: Add new ipapi method, expand_alias.
100 * ipapi.py: Add new ipapi method, expand_alias.
93
101
94 * Release.py: Bump up version to 0.7.4.svn
102 * Release.py: Bump up version to 0.7.4.svn
95
103
96 2006-12-17 Ville Vainio <vivainio@gmail.com>
104 2006-12-17 Ville Vainio <vivainio@gmail.com>
97
105
98 * Extensions/jobctrl.py: Fixed &cmd arg arg...
106 * Extensions/jobctrl.py: Fixed &cmd arg arg...
99 to work properly on posix too
107 to work properly on posix too
100
108
101 * Release.py: Update revnum (version is still just 0.7.3).
109 * Release.py: Update revnum (version is still just 0.7.3).
102
110
103 2006-12-15 Ville Vainio <vivainio@gmail.com>
111 2006-12-15 Ville Vainio <vivainio@gmail.com>
104
112
105 * scripts/ipython_win_post_install: create ipython.py in
113 * scripts/ipython_win_post_install: create ipython.py in
106 prefix + "/scripts".
114 prefix + "/scripts".
107
115
108 * Release.py: Update version to 0.7.3.
116 * Release.py: Update version to 0.7.3.
109
117
110 2006-12-14 Ville Vainio <vivainio@gmail.com>
118 2006-12-14 Ville Vainio <vivainio@gmail.com>
111
119
112 * scripts/ipython_win_post_install: Overwrite old shortcuts
120 * scripts/ipython_win_post_install: Overwrite old shortcuts
113 if they already exist
121 if they already exist
114
122
115 * Release.py: release 0.7.3rc2
123 * Release.py: release 0.7.3rc2
116
124
117 2006-12-13 Ville Vainio <vivainio@gmail.com>
125 2006-12-13 Ville Vainio <vivainio@gmail.com>
118
126
119 * Branch and update Release.py for 0.7.3rc1
127 * Branch and update Release.py for 0.7.3rc1
120
128
121 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
129 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
122
130
123 * IPython/Shell.py (IPShellWX): update for current WX naming
131 * IPython/Shell.py (IPShellWX): update for current WX naming
124 conventions, to avoid a deprecation warning with current WX
132 conventions, to avoid a deprecation warning with current WX
125 versions. Thanks to a report by Danny Shevitz.
133 versions. Thanks to a report by Danny Shevitz.
126
134
127 2006-12-12 Ville Vainio <vivainio@gmail.com>
135 2006-12-12 Ville Vainio <vivainio@gmail.com>
128
136
129 * ipmaker.py: apply david cournapeau's patch to make
137 * ipmaker.py: apply david cournapeau's patch to make
130 import_some work properly even when ipythonrc does
138 import_some work properly even when ipythonrc does
131 import_some on empty list (it was an old bug!).
139 import_some on empty list (it was an old bug!).
132
140
133 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
141 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
134 Add deprecation note to ipythonrc and a url to wiki
142 Add deprecation note to ipythonrc and a url to wiki
135 in ipy_user_conf.py
143 in ipy_user_conf.py
136
144
137
145
138 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
146 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
139 as if it was typed on IPython command prompt, i.e.
147 as if it was typed on IPython command prompt, i.e.
140 as IPython script.
148 as IPython script.
141
149
142 * example-magic.py, magic_grepl.py: remove outdated examples
150 * example-magic.py, magic_grepl.py: remove outdated examples
143
151
144 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
152 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
145
153
146 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
154 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
147 is called before any exception has occurred.
155 is called before any exception has occurred.
148
156
149 2006-12-08 Ville Vainio <vivainio@gmail.com>
157 2006-12-08 Ville Vainio <vivainio@gmail.com>
150
158
151 * Extensions/ipy_stock_completers.py: fix cd completer
159 * Extensions/ipy_stock_completers.py: fix cd completer
152 to translate /'s to \'s again.
160 to translate /'s to \'s again.
153
161
154 * completer.py: prevent traceback on file completions w/
162 * completer.py: prevent traceback on file completions w/
155 backslash.
163 backslash.
156
164
157 * Release.py: Update release number to 0.7.3b3 for release
165 * Release.py: Update release number to 0.7.3b3 for release
158
166
159 2006-12-07 Ville Vainio <vivainio@gmail.com>
167 2006-12-07 Ville Vainio <vivainio@gmail.com>
160
168
161 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
169 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
162 while executing external code. Provides more shell-like behaviour
170 while executing external code. Provides more shell-like behaviour
163 and overall better response to ctrl + C / ctrl + break.
171 and overall better response to ctrl + C / ctrl + break.
164
172
165 * tools/make_tarball.py: new script to create tarball straight from svn
173 * tools/make_tarball.py: new script to create tarball straight from svn
166 (setup.py sdist doesn't work on win32).
174 (setup.py sdist doesn't work on win32).
167
175
168 * Extensions/ipy_stock_completers.py: fix cd completer to give up
176 * Extensions/ipy_stock_completers.py: fix cd completer to give up
169 on dirnames with spaces and use the default completer instead.
177 on dirnames with spaces and use the default completer instead.
170
178
171 * Revision.py: Change version to 0.7.3b2 for release.
179 * Revision.py: Change version to 0.7.3b2 for release.
172
180
173 2006-12-05 Ville Vainio <vivainio@gmail.com>
181 2006-12-05 Ville Vainio <vivainio@gmail.com>
174
182
175 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
183 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
176 pydb patch 4 (rm debug printing, py 2.5 checking)
184 pydb patch 4 (rm debug printing, py 2.5 checking)
177
185
178 2006-11-30 Walter Doerwald <walter@livinglogic.de>
186 2006-11-30 Walter Doerwald <walter@livinglogic.de>
179 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
187 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
180 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
188 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
181 "refreshfind" (mapped to "R") does the same but tries to go back to the same
189 "refreshfind" (mapped to "R") does the same but tries to go back to the same
182 object the cursor was on before the refresh. The command "markrange" is
190 object the cursor was on before the refresh. The command "markrange" is
183 mapped to "%" now.
191 mapped to "%" now.
184 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
192 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
185
193
186 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
194 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
187
195
188 * IPython/Magic.py (magic_debug): new %debug magic to activate the
196 * IPython/Magic.py (magic_debug): new %debug magic to activate the
189 interactive debugger on the last traceback, without having to call
197 interactive debugger on the last traceback, without having to call
190 %pdb and rerun your code. Made minor changes in various modules,
198 %pdb and rerun your code. Made minor changes in various modules,
191 should automatically recognize pydb if available.
199 should automatically recognize pydb if available.
192
200
193 2006-11-28 Ville Vainio <vivainio@gmail.com>
201 2006-11-28 Ville Vainio <vivainio@gmail.com>
194
202
195 * completer.py: If the text start with !, show file completions
203 * completer.py: If the text start with !, show file completions
196 properly. This helps when trying to complete command name
204 properly. This helps when trying to complete command name
197 for shell escapes.
205 for shell escapes.
198
206
199 2006-11-27 Ville Vainio <vivainio@gmail.com>
207 2006-11-27 Ville Vainio <vivainio@gmail.com>
200
208
201 * ipy_stock_completers.py: bzr completer submitted by Stefan van
209 * ipy_stock_completers.py: bzr completer submitted by Stefan van
202 der Walt. Clean up svn and hg completers by using a common
210 der Walt. Clean up svn and hg completers by using a common
203 vcs_completer.
211 vcs_completer.
204
212
205 2006-11-26 Ville Vainio <vivainio@gmail.com>
213 2006-11-26 Ville Vainio <vivainio@gmail.com>
206
214
207 * Remove ipconfig and %config; you should use _ip.options structure
215 * Remove ipconfig and %config; you should use _ip.options structure
208 directly instead!
216 directly instead!
209
217
210 * genutils.py: add wrap_deprecated function for deprecating callables
218 * genutils.py: add wrap_deprecated function for deprecating callables
211
219
212 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
220 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
213 _ip.system instead. ipalias is redundant.
221 _ip.system instead. ipalias is redundant.
214
222
215 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
223 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
216 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
224 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
217 explicit.
225 explicit.
218
226
219 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
227 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
220 completer. Try it by entering 'hg ' and pressing tab.
228 completer. Try it by entering 'hg ' and pressing tab.
221
229
222 * macro.py: Give Macro a useful __repr__ method
230 * macro.py: Give Macro a useful __repr__ method
223
231
224 * Magic.py: %whos abbreviates the typename of Macro for brevity.
232 * Magic.py: %whos abbreviates the typename of Macro for brevity.
225
233
226 2006-11-24 Walter Doerwald <walter@livinglogic.de>
234 2006-11-24 Walter Doerwald <walter@livinglogic.de>
227 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
235 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
228 we don't get a duplicate ipipe module, where registration of the xrepr
236 we don't get a duplicate ipipe module, where registration of the xrepr
229 implementation for Text is useless.
237 implementation for Text is useless.
230
238
231 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
239 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
232
240
233 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
241 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
234
242
235 2006-11-24 Ville Vainio <vivainio@gmail.com>
243 2006-11-24 Ville Vainio <vivainio@gmail.com>
236
244
237 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
245 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
238 try to use "cProfile" instead of the slower pure python
246 try to use "cProfile" instead of the slower pure python
239 "profile"
247 "profile"
240
248
241 2006-11-23 Ville Vainio <vivainio@gmail.com>
249 2006-11-23 Ville Vainio <vivainio@gmail.com>
242
250
243 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
251 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
244 Qt+IPython+Designer link in documentation.
252 Qt+IPython+Designer link in documentation.
245
253
246 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
254 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
247 correct Pdb object to %pydb.
255 correct Pdb object to %pydb.
248
256
249
257
250 2006-11-22 Walter Doerwald <walter@livinglogic.de>
258 2006-11-22 Walter Doerwald <walter@livinglogic.de>
251 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
259 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
252 generic xrepr(), otherwise the list implementation would kick in.
260 generic xrepr(), otherwise the list implementation would kick in.
253
261
254 2006-11-21 Ville Vainio <vivainio@gmail.com>
262 2006-11-21 Ville Vainio <vivainio@gmail.com>
255
263
256 * upgrade_dir.py: Now actually overwrites a nonmodified user file
264 * upgrade_dir.py: Now actually overwrites a nonmodified user file
257 with one from UserConfig.
265 with one from UserConfig.
258
266
259 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
267 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
260 it was missing which broke the sh profile.
268 it was missing which broke the sh profile.
261
269
262 * completer.py: file completer now uses explicit '/' instead
270 * completer.py: file completer now uses explicit '/' instead
263 of os.path.join, expansion of 'foo' was broken on win32
271 of os.path.join, expansion of 'foo' was broken on win32
264 if there was one directory with name 'foobar'.
272 if there was one directory with name 'foobar'.
265
273
266 * A bunch of patches from Kirill Smelkov:
274 * A bunch of patches from Kirill Smelkov:
267
275
268 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
276 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
269
277
270 * [patch 7/9] Implement %page -r (page in raw mode) -
278 * [patch 7/9] Implement %page -r (page in raw mode) -
271
279
272 * [patch 5/9] ScientificPython webpage has moved
280 * [patch 5/9] ScientificPython webpage has moved
273
281
274 * [patch 4/9] The manual mentions %ds, should be %dhist
282 * [patch 4/9] The manual mentions %ds, should be %dhist
275
283
276 * [patch 3/9] Kill old bits from %prun doc.
284 * [patch 3/9] Kill old bits from %prun doc.
277
285
278 * [patch 1/9] Fix typos here and there.
286 * [patch 1/9] Fix typos here and there.
279
287
280 2006-11-08 Ville Vainio <vivainio@gmail.com>
288 2006-11-08 Ville Vainio <vivainio@gmail.com>
281
289
282 * completer.py (attr_matches): catch all exceptions raised
290 * completer.py (attr_matches): catch all exceptions raised
283 by eval of expr with dots.
291 by eval of expr with dots.
284
292
285 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
293 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
286
294
287 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
295 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
288 input if it starts with whitespace. This allows you to paste
296 input if it starts with whitespace. This allows you to paste
289 indented input from any editor without manually having to type in
297 indented input from any editor without manually having to type in
290 the 'if 1:', which is convenient when working interactively.
298 the 'if 1:', which is convenient when working interactively.
291 Slightly modifed version of a patch by Bo Peng
299 Slightly modifed version of a patch by Bo Peng
292 <bpeng-AT-rice.edu>.
300 <bpeng-AT-rice.edu>.
293
301
294 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
302 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
295
303
296 * IPython/irunner.py (main): modified irunner so it automatically
304 * IPython/irunner.py (main): modified irunner so it automatically
297 recognizes the right runner to use based on the extension (.py for
305 recognizes the right runner to use based on the extension (.py for
298 python, .ipy for ipython and .sage for sage).
306 python, .ipy for ipython and .sage for sage).
299
307
300 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
308 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
301 visible in ipapi as ip.config(), to programatically control the
309 visible in ipapi as ip.config(), to programatically control the
302 internal rc object. There's an accompanying %config magic for
310 internal rc object. There's an accompanying %config magic for
303 interactive use, which has been enhanced to match the
311 interactive use, which has been enhanced to match the
304 funtionality in ipconfig.
312 funtionality in ipconfig.
305
313
306 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
314 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
307 so it's not just a toggle, it now takes an argument. Add support
315 so it's not just a toggle, it now takes an argument. Add support
308 for a customizable header when making system calls, as the new
316 for a customizable header when making system calls, as the new
309 system_header variable in the ipythonrc file.
317 system_header variable in the ipythonrc file.
310
318
311 2006-11-03 Walter Doerwald <walter@livinglogic.de>
319 2006-11-03 Walter Doerwald <walter@livinglogic.de>
312
320
313 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
321 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
314 generic functions (using Philip J. Eby's simplegeneric package).
322 generic functions (using Philip J. Eby's simplegeneric package).
315 This makes it possible to customize the display of third-party classes
323 This makes it possible to customize the display of third-party classes
316 without having to monkeypatch them. xiter() no longer supports a mode
324 without having to monkeypatch them. xiter() no longer supports a mode
317 argument and the XMode class has been removed. The same functionality can
325 argument and the XMode class has been removed. The same functionality can
318 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
326 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
319 One consequence of the switch to generic functions is that xrepr() and
327 One consequence of the switch to generic functions is that xrepr() and
320 xattrs() implementation must define the default value for the mode
328 xattrs() implementation must define the default value for the mode
321 argument themselves and xattrs() implementations must return real
329 argument themselves and xattrs() implementations must return real
322 descriptors.
330 descriptors.
323
331
324 * IPython/external: This new subpackage will contain all third-party
332 * IPython/external: This new subpackage will contain all third-party
325 packages that are bundled with IPython. (The first one is simplegeneric).
333 packages that are bundled with IPython. (The first one is simplegeneric).
326
334
327 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
335 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
328 directory which as been dropped in r1703.
336 directory which as been dropped in r1703.
329
337
330 * IPython/Extensions/ipipe.py (iless): Fixed.
338 * IPython/Extensions/ipipe.py (iless): Fixed.
331
339
332 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
340 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
333
341
334 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
342 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
335
343
336 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
344 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
337 handling in variable expansion so that shells and magics recognize
345 handling in variable expansion so that shells and magics recognize
338 function local scopes correctly. Bug reported by Brian.
346 function local scopes correctly. Bug reported by Brian.
339
347
340 * scripts/ipython: remove the very first entry in sys.path which
348 * scripts/ipython: remove the very first entry in sys.path which
341 Python auto-inserts for scripts, so that sys.path under IPython is
349 Python auto-inserts for scripts, so that sys.path under IPython is
342 as similar as possible to that under plain Python.
350 as similar as possible to that under plain Python.
343
351
344 * IPython/completer.py (IPCompleter.file_matches): Fix
352 * IPython/completer.py (IPCompleter.file_matches): Fix
345 tab-completion so that quotes are not closed unless the completion
353 tab-completion so that quotes are not closed unless the completion
346 is unambiguous. After a request by Stefan. Minor cleanups in
354 is unambiguous. After a request by Stefan. Minor cleanups in
347 ipy_stock_completers.
355 ipy_stock_completers.
348
356
349 2006-11-02 Ville Vainio <vivainio@gmail.com>
357 2006-11-02 Ville Vainio <vivainio@gmail.com>
350
358
351 * ipy_stock_completers.py: Add %run and %cd completers.
359 * ipy_stock_completers.py: Add %run and %cd completers.
352
360
353 * completer.py: Try running custom completer for both
361 * completer.py: Try running custom completer for both
354 "foo" and "%foo" if the command is just "foo". Ignore case
362 "foo" and "%foo" if the command is just "foo". Ignore case
355 when filtering possible completions.
363 when filtering possible completions.
356
364
357 * UserConfig/ipy_user_conf.py: install stock completers as default
365 * UserConfig/ipy_user_conf.py: install stock completers as default
358
366
359 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
367 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
360 simplified readline history save / restore through a wrapper
368 simplified readline history save / restore through a wrapper
361 function
369 function
362
370
363
371
364 2006-10-31 Ville Vainio <vivainio@gmail.com>
372 2006-10-31 Ville Vainio <vivainio@gmail.com>
365
373
366 * strdispatch.py, completer.py, ipy_stock_completers.py:
374 * strdispatch.py, completer.py, ipy_stock_completers.py:
367 Allow str_key ("command") in completer hooks. Implement
375 Allow str_key ("command") in completer hooks. Implement
368 trivial completer for 'import' (stdlib modules only). Rename
376 trivial completer for 'import' (stdlib modules only). Rename
369 ipy_linux_package_managers.py to ipy_stock_completers.py.
377 ipy_linux_package_managers.py to ipy_stock_completers.py.
370 SVN completer.
378 SVN completer.
371
379
372 * Extensions/ledit.py: %magic line editor for easily and
380 * Extensions/ledit.py: %magic line editor for easily and
373 incrementally manipulating lists of strings. The magic command
381 incrementally manipulating lists of strings. The magic command
374 name is %led.
382 name is %led.
375
383
376 2006-10-30 Ville Vainio <vivainio@gmail.com>
384 2006-10-30 Ville Vainio <vivainio@gmail.com>
377
385
378 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
386 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
379 Bernsteins's patches for pydb integration.
387 Bernsteins's patches for pydb integration.
380 http://bashdb.sourceforge.net/pydb/
388 http://bashdb.sourceforge.net/pydb/
381
389
382 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
390 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
383 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
391 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
384 custom completer hook to allow the users to implement their own
392 custom completer hook to allow the users to implement their own
385 completers. See ipy_linux_package_managers.py for example. The
393 completers. See ipy_linux_package_managers.py for example. The
386 hook name is 'complete_command'.
394 hook name is 'complete_command'.
387
395
388 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
396 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
389
397
390 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
398 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
391 Numeric leftovers.
399 Numeric leftovers.
392
400
393 * ipython.el (py-execute-region): apply Stefan's patch to fix
401 * ipython.el (py-execute-region): apply Stefan's patch to fix
394 garbled results if the python shell hasn't been previously started.
402 garbled results if the python shell hasn't been previously started.
395
403
396 * IPython/genutils.py (arg_split): moved to genutils, since it's a
404 * IPython/genutils.py (arg_split): moved to genutils, since it's a
397 pretty generic function and useful for other things.
405 pretty generic function and useful for other things.
398
406
399 * IPython/OInspect.py (getsource): Add customizable source
407 * IPython/OInspect.py (getsource): Add customizable source
400 extractor. After a request/patch form W. Stein (SAGE).
408 extractor. After a request/patch form W. Stein (SAGE).
401
409
402 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
410 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
403 window size to a more reasonable value from what pexpect does,
411 window size to a more reasonable value from what pexpect does,
404 since their choice causes wrapping bugs with long input lines.
412 since their choice causes wrapping bugs with long input lines.
405
413
406 2006-10-28 Ville Vainio <vivainio@gmail.com>
414 2006-10-28 Ville Vainio <vivainio@gmail.com>
407
415
408 * Magic.py (%run): Save and restore the readline history from
416 * Magic.py (%run): Save and restore the readline history from
409 file around %run commands to prevent side effects from
417 file around %run commands to prevent side effects from
410 %runned programs that might use readline (e.g. pydb).
418 %runned programs that might use readline (e.g. pydb).
411
419
412 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
420 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
413 invoking the pydb enhanced debugger.
421 invoking the pydb enhanced debugger.
414
422
415 2006-10-23 Walter Doerwald <walter@livinglogic.de>
423 2006-10-23 Walter Doerwald <walter@livinglogic.de>
416
424
417 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
425 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
418 call the base class method and propagate the return value to
426 call the base class method and propagate the return value to
419 ifile. This is now done by path itself.
427 ifile. This is now done by path itself.
420
428
421 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
429 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
422
430
423 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
431 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
424 api: set_crash_handler(), to expose the ability to change the
432 api: set_crash_handler(), to expose the ability to change the
425 internal crash handler.
433 internal crash handler.
426
434
427 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
435 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
428 the various parameters of the crash handler so that apps using
436 the various parameters of the crash handler so that apps using
429 IPython as their engine can customize crash handling. Ipmlemented
437 IPython as their engine can customize crash handling. Ipmlemented
430 at the request of SAGE.
438 at the request of SAGE.
431
439
432 2006-10-14 Ville Vainio <vivainio@gmail.com>
440 2006-10-14 Ville Vainio <vivainio@gmail.com>
433
441
434 * Magic.py, ipython.el: applied first "safe" part of Rocky
442 * Magic.py, ipython.el: applied first "safe" part of Rocky
435 Bernstein's patch set for pydb integration.
443 Bernstein's patch set for pydb integration.
436
444
437 * Magic.py (%unalias, %alias): %store'd aliases can now be
445 * Magic.py (%unalias, %alias): %store'd aliases can now be
438 removed with '%unalias'. %alias w/o args now shows most
446 removed with '%unalias'. %alias w/o args now shows most
439 interesting (stored / manually defined) aliases last
447 interesting (stored / manually defined) aliases last
440 where they catch the eye w/o scrolling.
448 where they catch the eye w/o scrolling.
441
449
442 * Magic.py (%rehashx), ext_rehashdir.py: files with
450 * Magic.py (%rehashx), ext_rehashdir.py: files with
443 'py' extension are always considered executable, even
451 'py' extension are always considered executable, even
444 when not in PATHEXT environment variable.
452 when not in PATHEXT environment variable.
445
453
446 2006-10-12 Ville Vainio <vivainio@gmail.com>
454 2006-10-12 Ville Vainio <vivainio@gmail.com>
447
455
448 * jobctrl.py: Add new "jobctrl" extension for spawning background
456 * jobctrl.py: Add new "jobctrl" extension for spawning background
449 processes with "&find /". 'import jobctrl' to try it out. Requires
457 processes with "&find /". 'import jobctrl' to try it out. Requires
450 'subprocess' module, standard in python 2.4+.
458 'subprocess' module, standard in python 2.4+.
451
459
452 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
460 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
453 so if foo -> bar and bar -> baz, then foo -> baz.
461 so if foo -> bar and bar -> baz, then foo -> baz.
454
462
455 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
463 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
456
464
457 * IPython/Magic.py (Magic.parse_options): add a new posix option
465 * IPython/Magic.py (Magic.parse_options): add a new posix option
458 to allow parsing of input args in magics that doesn't strip quotes
466 to allow parsing of input args in magics that doesn't strip quotes
459 (if posix=False). This also closes %timeit bug reported by
467 (if posix=False). This also closes %timeit bug reported by
460 Stefan.
468 Stefan.
461
469
462 2006-10-03 Ville Vainio <vivainio@gmail.com>
470 2006-10-03 Ville Vainio <vivainio@gmail.com>
463
471
464 * iplib.py (raw_input, interact): Return ValueError catching for
472 * iplib.py (raw_input, interact): Return ValueError catching for
465 raw_input. Fixes infinite loop for sys.stdin.close() or
473 raw_input. Fixes infinite loop for sys.stdin.close() or
466 sys.stdout.close().
474 sys.stdout.close().
467
475
468 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
476 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
469
477
470 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
478 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
471 to help in handling doctests. irunner is now pretty useful for
479 to help in handling doctests. irunner is now pretty useful for
472 running standalone scripts and simulate a full interactive session
480 running standalone scripts and simulate a full interactive session
473 in a format that can be then pasted as a doctest.
481 in a format that can be then pasted as a doctest.
474
482
475 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
483 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
476 on top of the default (useless) ones. This also fixes the nasty
484 on top of the default (useless) ones. This also fixes the nasty
477 way in which 2.5's Quitter() exits (reverted [1785]).
485 way in which 2.5's Quitter() exits (reverted [1785]).
478
486
479 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
487 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
480 2.5.
488 2.5.
481
489
482 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
490 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
483 color scheme is updated as well when color scheme is changed
491 color scheme is updated as well when color scheme is changed
484 interactively.
492 interactively.
485
493
486 2006-09-27 Ville Vainio <vivainio@gmail.com>
494 2006-09-27 Ville Vainio <vivainio@gmail.com>
487
495
488 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
496 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
489 infinite loop and just exit. It's a hack, but will do for a while.
497 infinite loop and just exit. It's a hack, but will do for a while.
490
498
491 2006-08-25 Walter Doerwald <walter@livinglogic.de>
499 2006-08-25 Walter Doerwald <walter@livinglogic.de>
492
500
493 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
501 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
494 the constructor, this makes it possible to get a list of only directories
502 the constructor, this makes it possible to get a list of only directories
495 or only files.
503 or only files.
496
504
497 2006-08-12 Ville Vainio <vivainio@gmail.com>
505 2006-08-12 Ville Vainio <vivainio@gmail.com>
498
506
499 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
507 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
500 they broke unittest
508 they broke unittest
501
509
502 2006-08-11 Ville Vainio <vivainio@gmail.com>
510 2006-08-11 Ville Vainio <vivainio@gmail.com>
503
511
504 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
512 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
505 by resolving issue properly, i.e. by inheriting FakeModule
513 by resolving issue properly, i.e. by inheriting FakeModule
506 from types.ModuleType. Pickling ipython interactive data
514 from types.ModuleType. Pickling ipython interactive data
507 should still work as usual (testing appreciated).
515 should still work as usual (testing appreciated).
508
516
509 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
517 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
510
518
511 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
519 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
512 running under python 2.3 with code from 2.4 to fix a bug with
520 running under python 2.3 with code from 2.4 to fix a bug with
513 help(). Reported by the Debian maintainers, Norbert Tretkowski
521 help(). Reported by the Debian maintainers, Norbert Tretkowski
514 <norbert-AT-tretkowski.de> and Alexandre Fayolle
522 <norbert-AT-tretkowski.de> and Alexandre Fayolle
515 <afayolle-AT-debian.org>.
523 <afayolle-AT-debian.org>.
516
524
517 2006-08-04 Walter Doerwald <walter@livinglogic.de>
525 2006-08-04 Walter Doerwald <walter@livinglogic.de>
518
526
519 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
527 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
520 (which was displaying "quit" twice).
528 (which was displaying "quit" twice).
521
529
522 2006-07-28 Walter Doerwald <walter@livinglogic.de>
530 2006-07-28 Walter Doerwald <walter@livinglogic.de>
523
531
524 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
532 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
525 the mode argument).
533 the mode argument).
526
534
527 2006-07-27 Walter Doerwald <walter@livinglogic.de>
535 2006-07-27 Walter Doerwald <walter@livinglogic.de>
528
536
529 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
537 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
530 not running under IPython.
538 not running under IPython.
531
539
532 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
540 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
533 and make it iterable (iterating over the attribute itself). Add two new
541 and make it iterable (iterating over the attribute itself). Add two new
534 magic strings for __xattrs__(): If the string starts with "-", the attribute
542 magic strings for __xattrs__(): If the string starts with "-", the attribute
535 will not be displayed in ibrowse's detail view (but it can still be
543 will not be displayed in ibrowse's detail view (but it can still be
536 iterated over). This makes it possible to add attributes that are large
544 iterated over). This makes it possible to add attributes that are large
537 lists or generator methods to the detail view. Replace magic attribute names
545 lists or generator methods to the detail view. Replace magic attribute names
538 and _attrname() and _getattr() with "descriptors": For each type of magic
546 and _attrname() and _getattr() with "descriptors": For each type of magic
539 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
547 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
540 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
548 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
541 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
549 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
542 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
550 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
543 are still supported.
551 are still supported.
544
552
545 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
553 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
546 fails in ibrowse.fetch(), the exception object is added as the last item
554 fails in ibrowse.fetch(), the exception object is added as the last item
547 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
555 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
548 a generator throws an exception midway through execution.
556 a generator throws an exception midway through execution.
549
557
550 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
558 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
551 encoding into methods.
559 encoding into methods.
552
560
553 2006-07-26 Ville Vainio <vivainio@gmail.com>
561 2006-07-26 Ville Vainio <vivainio@gmail.com>
554
562
555 * iplib.py: history now stores multiline input as single
563 * iplib.py: history now stores multiline input as single
556 history entries. Patch by Jorgen Cederlof.
564 history entries. Patch by Jorgen Cederlof.
557
565
558 2006-07-18 Walter Doerwald <walter@livinglogic.de>
566 2006-07-18 Walter Doerwald <walter@livinglogic.de>
559
567
560 * IPython/Extensions/ibrowse.py: Make cursor visible over
568 * IPython/Extensions/ibrowse.py: Make cursor visible over
561 non existing attributes.
569 non existing attributes.
562
570
563 2006-07-14 Walter Doerwald <walter@livinglogic.de>
571 2006-07-14 Walter Doerwald <walter@livinglogic.de>
564
572
565 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
573 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
566 error output of the running command doesn't mess up the screen.
574 error output of the running command doesn't mess up the screen.
567
575
568 2006-07-13 Walter Doerwald <walter@livinglogic.de>
576 2006-07-13 Walter Doerwald <walter@livinglogic.de>
569
577
570 * IPython/Extensions/ipipe.py (isort): Make isort usable without
578 * IPython/Extensions/ipipe.py (isort): Make isort usable without
571 argument. This sorts the items themselves.
579 argument. This sorts the items themselves.
572
580
573 2006-07-12 Walter Doerwald <walter@livinglogic.de>
581 2006-07-12 Walter Doerwald <walter@livinglogic.de>
574
582
575 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
583 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
576 Compile expression strings into code objects. This should speed
584 Compile expression strings into code objects. This should speed
577 up ifilter and friends somewhat.
585 up ifilter and friends somewhat.
578
586
579 2006-07-08 Ville Vainio <vivainio@gmail.com>
587 2006-07-08 Ville Vainio <vivainio@gmail.com>
580
588
581 * Magic.py: %cpaste now strips > from the beginning of lines
589 * Magic.py: %cpaste now strips > from the beginning of lines
582 to ease pasting quoted code from emails. Contributed by
590 to ease pasting quoted code from emails. Contributed by
583 Stefan van der Walt.
591 Stefan van der Walt.
584
592
585 2006-06-29 Ville Vainio <vivainio@gmail.com>
593 2006-06-29 Ville Vainio <vivainio@gmail.com>
586
594
587 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
595 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
588 mode, patch contributed by Darren Dale. NEEDS TESTING!
596 mode, patch contributed by Darren Dale. NEEDS TESTING!
589
597
590 2006-06-28 Walter Doerwald <walter@livinglogic.de>
598 2006-06-28 Walter Doerwald <walter@livinglogic.de>
591
599
592 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
600 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
593 a blue background. Fix fetching new display rows when the browser
601 a blue background. Fix fetching new display rows when the browser
594 scrolls more than a screenful (e.g. by using the goto command).
602 scrolls more than a screenful (e.g. by using the goto command).
595
603
596 2006-06-27 Ville Vainio <vivainio@gmail.com>
604 2006-06-27 Ville Vainio <vivainio@gmail.com>
597
605
598 * Magic.py (_inspect, _ofind) Apply David Huard's
606 * Magic.py (_inspect, _ofind) Apply David Huard's
599 patch for displaying the correct docstring for 'property'
607 patch for displaying the correct docstring for 'property'
600 attributes.
608 attributes.
601
609
602 2006-06-23 Walter Doerwald <walter@livinglogic.de>
610 2006-06-23 Walter Doerwald <walter@livinglogic.de>
603
611
604 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
612 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
605 commands into the methods implementing them.
613 commands into the methods implementing them.
606
614
607 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
615 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
608
616
609 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
617 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
610 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
618 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
611 autoindent support was authored by Jin Liu.
619 autoindent support was authored by Jin Liu.
612
620
613 2006-06-22 Walter Doerwald <walter@livinglogic.de>
621 2006-06-22 Walter Doerwald <walter@livinglogic.de>
614
622
615 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
623 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
616 for keymaps with a custom class that simplifies handling.
624 for keymaps with a custom class that simplifies handling.
617
625
618 2006-06-19 Walter Doerwald <walter@livinglogic.de>
626 2006-06-19 Walter Doerwald <walter@livinglogic.de>
619
627
620 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
628 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
621 resizing. This requires Python 2.5 to work.
629 resizing. This requires Python 2.5 to work.
622
630
623 2006-06-16 Walter Doerwald <walter@livinglogic.de>
631 2006-06-16 Walter Doerwald <walter@livinglogic.de>
624
632
625 * IPython/Extensions/ibrowse.py: Add two new commands to
633 * IPython/Extensions/ibrowse.py: Add two new commands to
626 ibrowse: "hideattr" (mapped to "h") hides the attribute under
634 ibrowse: "hideattr" (mapped to "h") hides the attribute under
627 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
635 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
628 attributes again. Remapped the help command to "?". Display
636 attributes again. Remapped the help command to "?". Display
629 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
637 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
630 as keys for the "home" and "end" commands. Add three new commands
638 as keys for the "home" and "end" commands. Add three new commands
631 to the input mode for "find" and friends: "delend" (CTRL-K)
639 to the input mode for "find" and friends: "delend" (CTRL-K)
632 deletes to the end of line. "incsearchup" searches upwards in the
640 deletes to the end of line. "incsearchup" searches upwards in the
633 command history for an input that starts with the text before the cursor.
641 command history for an input that starts with the text before the cursor.
634 "incsearchdown" does the same downwards. Removed a bogus mapping of
642 "incsearchdown" does the same downwards. Removed a bogus mapping of
635 the x key to "delete".
643 the x key to "delete".
636
644
637 2006-06-15 Ville Vainio <vivainio@gmail.com>
645 2006-06-15 Ville Vainio <vivainio@gmail.com>
638
646
639 * iplib.py, hooks.py: Added new generate_prompt hook that can be
647 * iplib.py, hooks.py: Added new generate_prompt hook that can be
640 used to create prompts dynamically, instead of the "old" way of
648 used to create prompts dynamically, instead of the "old" way of
641 assigning "magic" strings to prompt_in1 and prompt_in2. The old
649 assigning "magic" strings to prompt_in1 and prompt_in2. The old
642 way still works (it's invoked by the default hook), of course.
650 way still works (it's invoked by the default hook), of course.
643
651
644 * Prompts.py: added generate_output_prompt hook for altering output
652 * Prompts.py: added generate_output_prompt hook for altering output
645 prompt
653 prompt
646
654
647 * Release.py: Changed version string to 0.7.3.svn.
655 * Release.py: Changed version string to 0.7.3.svn.
648
656
649 2006-06-15 Walter Doerwald <walter@livinglogic.de>
657 2006-06-15 Walter Doerwald <walter@livinglogic.de>
650
658
651 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
659 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
652 the call to fetch() always tries to fetch enough data for at least one
660 the call to fetch() always tries to fetch enough data for at least one
653 full screen. This makes it possible to simply call moveto(0,0,True) in
661 full screen. This makes it possible to simply call moveto(0,0,True) in
654 the constructor. Fix typos and removed the obsolete goto attribute.
662 the constructor. Fix typos and removed the obsolete goto attribute.
655
663
656 2006-06-12 Ville Vainio <vivainio@gmail.com>
664 2006-06-12 Ville Vainio <vivainio@gmail.com>
657
665
658 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
666 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
659 allowing $variable interpolation within multiline statements,
667 allowing $variable interpolation within multiline statements,
660 though so far only with "sh" profile for a testing period.
668 though so far only with "sh" profile for a testing period.
661 The patch also enables splitting long commands with \ but it
669 The patch also enables splitting long commands with \ but it
662 doesn't work properly yet.
670 doesn't work properly yet.
663
671
664 2006-06-12 Walter Doerwald <walter@livinglogic.de>
672 2006-06-12 Walter Doerwald <walter@livinglogic.de>
665
673
666 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
674 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
667 input history and the position of the cursor in the input history for
675 input history and the position of the cursor in the input history for
668 the find, findbackwards and goto command.
676 the find, findbackwards and goto command.
669
677
670 2006-06-10 Walter Doerwald <walter@livinglogic.de>
678 2006-06-10 Walter Doerwald <walter@livinglogic.de>
671
679
672 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
680 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
673 implements the basic functionality of browser commands that require
681 implements the basic functionality of browser commands that require
674 input. Reimplement the goto, find and findbackwards commands as
682 input. Reimplement the goto, find and findbackwards commands as
675 subclasses of _CommandInput. Add an input history and keymaps to those
683 subclasses of _CommandInput. Add an input history and keymaps to those
676 commands. Add "\r" as a keyboard shortcut for the enterdefault and
684 commands. Add "\r" as a keyboard shortcut for the enterdefault and
677 execute commands.
685 execute commands.
678
686
679 2006-06-07 Ville Vainio <vivainio@gmail.com>
687 2006-06-07 Ville Vainio <vivainio@gmail.com>
680
688
681 * iplib.py: ipython mybatch.ipy exits ipython immediately after
689 * iplib.py: ipython mybatch.ipy exits ipython immediately after
682 running the batch files instead of leaving the session open.
690 running the batch files instead of leaving the session open.
683
691
684 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
692 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
685
693
686 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
694 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
687 the original fix was incomplete. Patch submitted by W. Maier.
695 the original fix was incomplete. Patch submitted by W. Maier.
688
696
689 2006-06-07 Ville Vainio <vivainio@gmail.com>
697 2006-06-07 Ville Vainio <vivainio@gmail.com>
690
698
691 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
699 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
692 Confirmation prompts can be supressed by 'quiet' option.
700 Confirmation prompts can be supressed by 'quiet' option.
693 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
701 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
694
702
695 2006-06-06 *** Released version 0.7.2
703 2006-06-06 *** Released version 0.7.2
696
704
697 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
705 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
698
706
699 * IPython/Release.py (version): Made 0.7.2 final for release.
707 * IPython/Release.py (version): Made 0.7.2 final for release.
700 Repo tagged and release cut.
708 Repo tagged and release cut.
701
709
702 2006-06-05 Ville Vainio <vivainio@gmail.com>
710 2006-06-05 Ville Vainio <vivainio@gmail.com>
703
711
704 * Magic.py (magic_rehashx): Honor no_alias list earlier in
712 * Magic.py (magic_rehashx): Honor no_alias list earlier in
705 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
713 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
706
714
707 * upgrade_dir.py: try import 'path' module a bit harder
715 * upgrade_dir.py: try import 'path' module a bit harder
708 (for %upgrade)
716 (for %upgrade)
709
717
710 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
718 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
711
719
712 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
720 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
713 instead of looping 20 times.
721 instead of looping 20 times.
714
722
715 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
723 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
716 correctly at initialization time. Bug reported by Krishna Mohan
724 correctly at initialization time. Bug reported by Krishna Mohan
717 Gundu <gkmohan-AT-gmail.com> on the user list.
725 Gundu <gkmohan-AT-gmail.com> on the user list.
718
726
719 * IPython/Release.py (version): Mark 0.7.2 version to start
727 * IPython/Release.py (version): Mark 0.7.2 version to start
720 testing for release on 06/06.
728 testing for release on 06/06.
721
729
722 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
730 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
723
731
724 * scripts/irunner: thin script interface so users don't have to
732 * scripts/irunner: thin script interface so users don't have to
725 find the module and call it as an executable, since modules rarely
733 find the module and call it as an executable, since modules rarely
726 live in people's PATH.
734 live in people's PATH.
727
735
728 * IPython/irunner.py (InteractiveRunner.__init__): added
736 * IPython/irunner.py (InteractiveRunner.__init__): added
729 delaybeforesend attribute to control delays with newer versions of
737 delaybeforesend attribute to control delays with newer versions of
730 pexpect. Thanks to detailed help from pexpect's author, Noah
738 pexpect. Thanks to detailed help from pexpect's author, Noah
731 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
739 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
732 correctly (it works in NoColor mode).
740 correctly (it works in NoColor mode).
733
741
734 * IPython/iplib.py (handle_normal): fix nasty crash reported on
742 * IPython/iplib.py (handle_normal): fix nasty crash reported on
735 SAGE list, from improper log() calls.
743 SAGE list, from improper log() calls.
736
744
737 2006-05-31 Ville Vainio <vivainio@gmail.com>
745 2006-05-31 Ville Vainio <vivainio@gmail.com>
738
746
739 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
747 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
740 with args in parens to work correctly with dirs that have spaces.
748 with args in parens to work correctly with dirs that have spaces.
741
749
742 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
750 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
743
751
744 * IPython/Logger.py (Logger.logstart): add option to log raw input
752 * IPython/Logger.py (Logger.logstart): add option to log raw input
745 instead of the processed one. A -r flag was added to the
753 instead of the processed one. A -r flag was added to the
746 %logstart magic used for controlling logging.
754 %logstart magic used for controlling logging.
747
755
748 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
756 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
749
757
750 * IPython/iplib.py (InteractiveShell.__init__): add check for the
758 * IPython/iplib.py (InteractiveShell.__init__): add check for the
751 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
759 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
752 recognize the option. After a bug report by Will Maier. This
760 recognize the option. After a bug report by Will Maier. This
753 closes #64 (will do it after confirmation from W. Maier).
761 closes #64 (will do it after confirmation from W. Maier).
754
762
755 * IPython/irunner.py: New module to run scripts as if manually
763 * IPython/irunner.py: New module to run scripts as if manually
756 typed into an interactive environment, based on pexpect. After a
764 typed into an interactive environment, based on pexpect. After a
757 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
765 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
758 ipython-user list. Simple unittests in the tests/ directory.
766 ipython-user list. Simple unittests in the tests/ directory.
759
767
760 * tools/release: add Will Maier, OpenBSD port maintainer, to
768 * tools/release: add Will Maier, OpenBSD port maintainer, to
761 recepients list. We are now officially part of the OpenBSD ports:
769 recepients list. We are now officially part of the OpenBSD ports:
762 http://www.openbsd.org/ports.html ! Many thanks to Will for the
770 http://www.openbsd.org/ports.html ! Many thanks to Will for the
763 work.
771 work.
764
772
765 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
773 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
766
774
767 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
775 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
768 so that it doesn't break tkinter apps.
776 so that it doesn't break tkinter apps.
769
777
770 * IPython/iplib.py (_prefilter): fix bug where aliases would
778 * IPython/iplib.py (_prefilter): fix bug where aliases would
771 shadow variables when autocall was fully off. Reported by SAGE
779 shadow variables when autocall was fully off. Reported by SAGE
772 author William Stein.
780 author William Stein.
773
781
774 * IPython/OInspect.py (Inspector.__init__): add a flag to control
782 * IPython/OInspect.py (Inspector.__init__): add a flag to control
775 at what detail level strings are computed when foo? is requested.
783 at what detail level strings are computed when foo? is requested.
776 This allows users to ask for example that the string form of an
784 This allows users to ask for example that the string form of an
777 object is only computed when foo?? is called, or even never, by
785 object is only computed when foo?? is called, or even never, by
778 setting the object_info_string_level >= 2 in the configuration
786 setting the object_info_string_level >= 2 in the configuration
779 file. This new option has been added and documented. After a
787 file. This new option has been added and documented. After a
780 request by SAGE to be able to control the printing of very large
788 request by SAGE to be able to control the printing of very large
781 objects more easily.
789 objects more easily.
782
790
783 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
791 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
784
792
785 * IPython/ipmaker.py (make_IPython): remove the ipython call path
793 * IPython/ipmaker.py (make_IPython): remove the ipython call path
786 from sys.argv, to be 100% consistent with how Python itself works
794 from sys.argv, to be 100% consistent with how Python itself works
787 (as seen for example with python -i file.py). After a bug report
795 (as seen for example with python -i file.py). After a bug report
788 by Jeffrey Collins.
796 by Jeffrey Collins.
789
797
790 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
798 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
791 nasty bug which was preventing custom namespaces with -pylab,
799 nasty bug which was preventing custom namespaces with -pylab,
792 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
800 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
793 compatibility (long gone from mpl).
801 compatibility (long gone from mpl).
794
802
795 * IPython/ipapi.py (make_session): name change: create->make. We
803 * IPython/ipapi.py (make_session): name change: create->make. We
796 use make in other places (ipmaker,...), it's shorter and easier to
804 use make in other places (ipmaker,...), it's shorter and easier to
797 type and say, etc. I'm trying to clean things before 0.7.2 so
805 type and say, etc. I'm trying to clean things before 0.7.2 so
798 that I can keep things stable wrt to ipapi in the chainsaw branch.
806 that I can keep things stable wrt to ipapi in the chainsaw branch.
799
807
800 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
808 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
801 python-mode recognizes our debugger mode. Add support for
809 python-mode recognizes our debugger mode. Add support for
802 autoindent inside (X)emacs. After a patch sent in by Jin Liu
810 autoindent inside (X)emacs. After a patch sent in by Jin Liu
803 <m.liu.jin-AT-gmail.com> originally written by
811 <m.liu.jin-AT-gmail.com> originally written by
804 doxgen-AT-newsmth.net (with minor modifications for xemacs
812 doxgen-AT-newsmth.net (with minor modifications for xemacs
805 compatibility)
813 compatibility)
806
814
807 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
815 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
808 tracebacks when walking the stack so that the stack tracking system
816 tracebacks when walking the stack so that the stack tracking system
809 in emacs' python-mode can identify the frames correctly.
817 in emacs' python-mode can identify the frames correctly.
810
818
811 * IPython/ipmaker.py (make_IPython): make the internal (and
819 * IPython/ipmaker.py (make_IPython): make the internal (and
812 default config) autoedit_syntax value false by default. Too many
820 default config) autoedit_syntax value false by default. Too many
813 users have complained to me (both on and off-list) about problems
821 users have complained to me (both on and off-list) about problems
814 with this option being on by default, so I'm making it default to
822 with this option being on by default, so I'm making it default to
815 off. It can still be enabled by anyone via the usual mechanisms.
823 off. It can still be enabled by anyone via the usual mechanisms.
816
824
817 * IPython/completer.py (Completer.attr_matches): add support for
825 * IPython/completer.py (Completer.attr_matches): add support for
818 PyCrust-style _getAttributeNames magic method. Patch contributed
826 PyCrust-style _getAttributeNames magic method. Patch contributed
819 by <mscott-AT-goldenspud.com>. Closes #50.
827 by <mscott-AT-goldenspud.com>. Closes #50.
820
828
821 * IPython/iplib.py (InteractiveShell.__init__): remove the
829 * IPython/iplib.py (InteractiveShell.__init__): remove the
822 deletion of exit/quit from __builtin__, which can break
830 deletion of exit/quit from __builtin__, which can break
823 third-party tools like the Zope debugging console. The
831 third-party tools like the Zope debugging console. The
824 %exit/%quit magics remain. In general, it's probably a good idea
832 %exit/%quit magics remain. In general, it's probably a good idea
825 not to delete anything from __builtin__, since we never know what
833 not to delete anything from __builtin__, since we never know what
826 that will break. In any case, python now (for 2.5) will support
834 that will break. In any case, python now (for 2.5) will support
827 'real' exit/quit, so this issue is moot. Closes #55.
835 'real' exit/quit, so this issue is moot. Closes #55.
828
836
829 * IPython/genutils.py (with_obj): rename the 'with' function to
837 * IPython/genutils.py (with_obj): rename the 'with' function to
830 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
838 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
831 becomes a language keyword. Closes #53.
839 becomes a language keyword. Closes #53.
832
840
833 * IPython/FakeModule.py (FakeModule.__init__): add a proper
841 * IPython/FakeModule.py (FakeModule.__init__): add a proper
834 __file__ attribute to this so it fools more things into thinking
842 __file__ attribute to this so it fools more things into thinking
835 it is a real module. Closes #59.
843 it is a real module. Closes #59.
836
844
837 * IPython/Magic.py (magic_edit): add -n option to open the editor
845 * IPython/Magic.py (magic_edit): add -n option to open the editor
838 at a specific line number. After a patch by Stefan van der Walt.
846 at a specific line number. After a patch by Stefan van der Walt.
839
847
840 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
848 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
841
849
842 * IPython/iplib.py (edit_syntax_error): fix crash when for some
850 * IPython/iplib.py (edit_syntax_error): fix crash when for some
843 reason the file could not be opened. After automatic crash
851 reason the file could not be opened. After automatic crash
844 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
852 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
845 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
853 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
846 (_should_recompile): Don't fire editor if using %bg, since there
854 (_should_recompile): Don't fire editor if using %bg, since there
847 is no file in the first place. From the same report as above.
855 is no file in the first place. From the same report as above.
848 (raw_input): protect against faulty third-party prefilters. After
856 (raw_input): protect against faulty third-party prefilters. After
849 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
857 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
850 while running under SAGE.
858 while running under SAGE.
851
859
852 2006-05-23 Ville Vainio <vivainio@gmail.com>
860 2006-05-23 Ville Vainio <vivainio@gmail.com>
853
861
854 * ipapi.py: Stripped down ip.to_user_ns() to work only as
862 * ipapi.py: Stripped down ip.to_user_ns() to work only as
855 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
863 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
856 now returns None (again), unless dummy is specifically allowed by
864 now returns None (again), unless dummy is specifically allowed by
857 ipapi.get(allow_dummy=True).
865 ipapi.get(allow_dummy=True).
858
866
859 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
867 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
860
868
861 * IPython: remove all 2.2-compatibility objects and hacks from
869 * IPython: remove all 2.2-compatibility objects and hacks from
862 everywhere, since we only support 2.3 at this point. Docs
870 everywhere, since we only support 2.3 at this point. Docs
863 updated.
871 updated.
864
872
865 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
873 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
866 Anything requiring extra validation can be turned into a Python
874 Anything requiring extra validation can be turned into a Python
867 property in the future. I used a property for the db one b/c
875 property in the future. I used a property for the db one b/c
868 there was a nasty circularity problem with the initialization
876 there was a nasty circularity problem with the initialization
869 order, which right now I don't have time to clean up.
877 order, which right now I don't have time to clean up.
870
878
871 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
879 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
872 another locking bug reported by Jorgen. I'm not 100% sure though,
880 another locking bug reported by Jorgen. I'm not 100% sure though,
873 so more testing is needed...
881 so more testing is needed...
874
882
875 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
883 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
876
884
877 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
885 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
878 local variables from any routine in user code (typically executed
886 local variables from any routine in user code (typically executed
879 with %run) directly into the interactive namespace. Very useful
887 with %run) directly into the interactive namespace. Very useful
880 when doing complex debugging.
888 when doing complex debugging.
881 (IPythonNotRunning): Changed the default None object to a dummy
889 (IPythonNotRunning): Changed the default None object to a dummy
882 whose attributes can be queried as well as called without
890 whose attributes can be queried as well as called without
883 exploding, to ease writing code which works transparently both in
891 exploding, to ease writing code which works transparently both in
884 and out of ipython and uses some of this API.
892 and out of ipython and uses some of this API.
885
893
886 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
894 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
887
895
888 * IPython/hooks.py (result_display): Fix the fact that our display
896 * IPython/hooks.py (result_display): Fix the fact that our display
889 hook was using str() instead of repr(), as the default python
897 hook was using str() instead of repr(), as the default python
890 console does. This had gone unnoticed b/c it only happened if
898 console does. This had gone unnoticed b/c it only happened if
891 %Pprint was off, but the inconsistency was there.
899 %Pprint was off, but the inconsistency was there.
892
900
893 2006-05-15 Ville Vainio <vivainio@gmail.com>
901 2006-05-15 Ville Vainio <vivainio@gmail.com>
894
902
895 * Oinspect.py: Only show docstring for nonexisting/binary files
903 * Oinspect.py: Only show docstring for nonexisting/binary files
896 when doing object??, closing ticket #62
904 when doing object??, closing ticket #62
897
905
898 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
906 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
899
907
900 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
908 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
901 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
909 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
902 was being released in a routine which hadn't checked if it had
910 was being released in a routine which hadn't checked if it had
903 been the one to acquire it.
911 been the one to acquire it.
904
912
905 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
913 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
906
914
907 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
915 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
908
916
909 2006-04-11 Ville Vainio <vivainio@gmail.com>
917 2006-04-11 Ville Vainio <vivainio@gmail.com>
910
918
911 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
919 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
912 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
920 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
913 prefilters, allowing stuff like magics and aliases in the file.
921 prefilters, allowing stuff like magics and aliases in the file.
914
922
915 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
923 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
916 added. Supported now are "%clear in" and "%clear out" (clear input and
924 added. Supported now are "%clear in" and "%clear out" (clear input and
917 output history, respectively). Also fixed CachedOutput.flush to
925 output history, respectively). Also fixed CachedOutput.flush to
918 properly flush the output cache.
926 properly flush the output cache.
919
927
920 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
928 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
921 half-success (and fail explicitly).
929 half-success (and fail explicitly).
922
930
923 2006-03-28 Ville Vainio <vivainio@gmail.com>
931 2006-03-28 Ville Vainio <vivainio@gmail.com>
924
932
925 * iplib.py: Fix quoting of aliases so that only argless ones
933 * iplib.py: Fix quoting of aliases so that only argless ones
926 are quoted
934 are quoted
927
935
928 2006-03-28 Ville Vainio <vivainio@gmail.com>
936 2006-03-28 Ville Vainio <vivainio@gmail.com>
929
937
930 * iplib.py: Quote aliases with spaces in the name.
938 * iplib.py: Quote aliases with spaces in the name.
931 "c:\program files\blah\bin" is now legal alias target.
939 "c:\program files\blah\bin" is now legal alias target.
932
940
933 * ext_rehashdir.py: Space no longer allowed as arg
941 * ext_rehashdir.py: Space no longer allowed as arg
934 separator, since space is legal in path names.
942 separator, since space is legal in path names.
935
943
936 2006-03-16 Ville Vainio <vivainio@gmail.com>
944 2006-03-16 Ville Vainio <vivainio@gmail.com>
937
945
938 * upgrade_dir.py: Take path.py from Extensions, correcting
946 * upgrade_dir.py: Take path.py from Extensions, correcting
939 %upgrade magic
947 %upgrade magic
940
948
941 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
949 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
942
950
943 * hooks.py: Only enclose editor binary in quotes if legal and
951 * hooks.py: Only enclose editor binary in quotes if legal and
944 necessary (space in the name, and is an existing file). Fixes a bug
952 necessary (space in the name, and is an existing file). Fixes a bug
945 reported by Zachary Pincus.
953 reported by Zachary Pincus.
946
954
947 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
955 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
948
956
949 * Manual: thanks to a tip on proper color handling for Emacs, by
957 * Manual: thanks to a tip on proper color handling for Emacs, by
950 Eric J Haywiser <ejh1-AT-MIT.EDU>.
958 Eric J Haywiser <ejh1-AT-MIT.EDU>.
951
959
952 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
960 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
953 by applying the provided patch. Thanks to Liu Jin
961 by applying the provided patch. Thanks to Liu Jin
954 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
962 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
955 XEmacs/Linux, I'm trusting the submitter that it actually helps
963 XEmacs/Linux, I'm trusting the submitter that it actually helps
956 under win32/GNU Emacs. Will revisit if any problems are reported.
964 under win32/GNU Emacs. Will revisit if any problems are reported.
957
965
958 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
966 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
959
967
960 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
968 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
961 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
969 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
962
970
963 2006-03-12 Ville Vainio <vivainio@gmail.com>
971 2006-03-12 Ville Vainio <vivainio@gmail.com>
964
972
965 * Magic.py (magic_timeit): Added %timeit magic, contributed by
973 * Magic.py (magic_timeit): Added %timeit magic, contributed by
966 Torsten Marek.
974 Torsten Marek.
967
975
968 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
976 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
969
977
970 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
978 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
971 line ranges works again.
979 line ranges works again.
972
980
973 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
981 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
974
982
975 * IPython/iplib.py (showtraceback): add back sys.last_traceback
983 * IPython/iplib.py (showtraceback): add back sys.last_traceback
976 and friends, after a discussion with Zach Pincus on ipython-user.
984 and friends, after a discussion with Zach Pincus on ipython-user.
977 I'm not 100% sure, but after thinking about it quite a bit, it may
985 I'm not 100% sure, but after thinking about it quite a bit, it may
978 be OK. Testing with the multithreaded shells didn't reveal any
986 be OK. Testing with the multithreaded shells didn't reveal any
979 problems, but let's keep an eye out.
987 problems, but let's keep an eye out.
980
988
981 In the process, I fixed a few things which were calling
989 In the process, I fixed a few things which were calling
982 self.InteractiveTB() directly (like safe_execfile), which is a
990 self.InteractiveTB() directly (like safe_execfile), which is a
983 mistake: ALL exception reporting should be done by calling
991 mistake: ALL exception reporting should be done by calling
984 self.showtraceback(), which handles state and tab-completion and
992 self.showtraceback(), which handles state and tab-completion and
985 more.
993 more.
986
994
987 2006-03-01 Ville Vainio <vivainio@gmail.com>
995 2006-03-01 Ville Vainio <vivainio@gmail.com>
988
996
989 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
997 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
990 To use, do "from ipipe import *".
998 To use, do "from ipipe import *".
991
999
992 2006-02-24 Ville Vainio <vivainio@gmail.com>
1000 2006-02-24 Ville Vainio <vivainio@gmail.com>
993
1001
994 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1002 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
995 "cleanly" and safely than the older upgrade mechanism.
1003 "cleanly" and safely than the older upgrade mechanism.
996
1004
997 2006-02-21 Ville Vainio <vivainio@gmail.com>
1005 2006-02-21 Ville Vainio <vivainio@gmail.com>
998
1006
999 * Magic.py: %save works again.
1007 * Magic.py: %save works again.
1000
1008
1001 2006-02-15 Ville Vainio <vivainio@gmail.com>
1009 2006-02-15 Ville Vainio <vivainio@gmail.com>
1002
1010
1003 * Magic.py: %Pprint works again
1011 * Magic.py: %Pprint works again
1004
1012
1005 * Extensions/ipy_sane_defaults.py: Provide everything provided
1013 * Extensions/ipy_sane_defaults.py: Provide everything provided
1006 in default ipythonrc, to make it possible to have a completely empty
1014 in default ipythonrc, to make it possible to have a completely empty
1007 ipythonrc (and thus completely rc-file free configuration)
1015 ipythonrc (and thus completely rc-file free configuration)
1008
1016
1009 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1017 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1010
1018
1011 * IPython/hooks.py (editor): quote the call to the editor command,
1019 * IPython/hooks.py (editor): quote the call to the editor command,
1012 to allow commands with spaces in them. Problem noted by watching
1020 to allow commands with spaces in them. Problem noted by watching
1013 Ian Oswald's video about textpad under win32 at
1021 Ian Oswald's video about textpad under win32 at
1014 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1022 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1015
1023
1016 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1024 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1017 describing magics (we haven't used @ for a loong time).
1025 describing magics (we haven't used @ for a loong time).
1018
1026
1019 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1027 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1020 contributed by marienz to close
1028 contributed by marienz to close
1021 http://www.scipy.net/roundup/ipython/issue53.
1029 http://www.scipy.net/roundup/ipython/issue53.
1022
1030
1023 2006-02-10 Ville Vainio <vivainio@gmail.com>
1031 2006-02-10 Ville Vainio <vivainio@gmail.com>
1024
1032
1025 * genutils.py: getoutput now works in win32 too
1033 * genutils.py: getoutput now works in win32 too
1026
1034
1027 * completer.py: alias and magic completion only invoked
1035 * completer.py: alias and magic completion only invoked
1028 at the first "item" in the line, to avoid "cd %store"
1036 at the first "item" in the line, to avoid "cd %store"
1029 nonsense.
1037 nonsense.
1030
1038
1031 2006-02-09 Ville Vainio <vivainio@gmail.com>
1039 2006-02-09 Ville Vainio <vivainio@gmail.com>
1032
1040
1033 * test/*: Added a unit testing framework (finally).
1041 * test/*: Added a unit testing framework (finally).
1034 '%run runtests.py' to run test_*.
1042 '%run runtests.py' to run test_*.
1035
1043
1036 * ipapi.py: Exposed runlines and set_custom_exc
1044 * ipapi.py: Exposed runlines and set_custom_exc
1037
1045
1038 2006-02-07 Ville Vainio <vivainio@gmail.com>
1046 2006-02-07 Ville Vainio <vivainio@gmail.com>
1039
1047
1040 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1048 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1041 instead use "f(1 2)" as before.
1049 instead use "f(1 2)" as before.
1042
1050
1043 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1051 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1044
1052
1045 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1053 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1046 facilities, for demos processed by the IPython input filter
1054 facilities, for demos processed by the IPython input filter
1047 (IPythonDemo), and for running a script one-line-at-a-time as a
1055 (IPythonDemo), and for running a script one-line-at-a-time as a
1048 demo, both for pure Python (LineDemo) and for IPython-processed
1056 demo, both for pure Python (LineDemo) and for IPython-processed
1049 input (IPythonLineDemo). After a request by Dave Kohel, from the
1057 input (IPythonLineDemo). After a request by Dave Kohel, from the
1050 SAGE team.
1058 SAGE team.
1051 (Demo.edit): added an edit() method to the demo objects, to edit
1059 (Demo.edit): added an edit() method to the demo objects, to edit
1052 the in-memory copy of the last executed block.
1060 the in-memory copy of the last executed block.
1053
1061
1054 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1062 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1055 processing to %edit, %macro and %save. These commands can now be
1063 processing to %edit, %macro and %save. These commands can now be
1056 invoked on the unprocessed input as it was typed by the user
1064 invoked on the unprocessed input as it was typed by the user
1057 (without any prefilters applied). After requests by the SAGE team
1065 (without any prefilters applied). After requests by the SAGE team
1058 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1066 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1059
1067
1060 2006-02-01 Ville Vainio <vivainio@gmail.com>
1068 2006-02-01 Ville Vainio <vivainio@gmail.com>
1061
1069
1062 * setup.py, eggsetup.py: easy_install ipython==dev works
1070 * setup.py, eggsetup.py: easy_install ipython==dev works
1063 correctly now (on Linux)
1071 correctly now (on Linux)
1064
1072
1065 * ipy_user_conf,ipmaker: user config changes, removed spurious
1073 * ipy_user_conf,ipmaker: user config changes, removed spurious
1066 warnings
1074 warnings
1067
1075
1068 * iplib: if rc.banner is string, use it as is.
1076 * iplib: if rc.banner is string, use it as is.
1069
1077
1070 * Magic: %pycat accepts a string argument and pages it's contents.
1078 * Magic: %pycat accepts a string argument and pages it's contents.
1071
1079
1072
1080
1073 2006-01-30 Ville Vainio <vivainio@gmail.com>
1081 2006-01-30 Ville Vainio <vivainio@gmail.com>
1074
1082
1075 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1083 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1076 Now %store and bookmarks work through PickleShare, meaning that
1084 Now %store and bookmarks work through PickleShare, meaning that
1077 concurrent access is possible and all ipython sessions see the
1085 concurrent access is possible and all ipython sessions see the
1078 same database situation all the time, instead of snapshot of
1086 same database situation all the time, instead of snapshot of
1079 the situation when the session was started. Hence, %bookmark
1087 the situation when the session was started. Hence, %bookmark
1080 results are immediately accessible from othes sessions. The database
1088 results are immediately accessible from othes sessions. The database
1081 is also available for use by user extensions. See:
1089 is also available for use by user extensions. See:
1082 http://www.python.org/pypi/pickleshare
1090 http://www.python.org/pypi/pickleshare
1083
1091
1084 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1092 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1085
1093
1086 * aliases can now be %store'd
1094 * aliases can now be %store'd
1087
1095
1088 * path.py moved to Extensions so that pickleshare does not need
1096 * path.py moved to Extensions so that pickleshare does not need
1089 IPython-specific import. Extensions added to pythonpath right
1097 IPython-specific import. Extensions added to pythonpath right
1090 at __init__.
1098 at __init__.
1091
1099
1092 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1100 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1093 called with _ip.system and the pre-transformed command string.
1101 called with _ip.system and the pre-transformed command string.
1094
1102
1095 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1103 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1096
1104
1097 * IPython/iplib.py (interact): Fix that we were not catching
1105 * IPython/iplib.py (interact): Fix that we were not catching
1098 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1106 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1099 logic here had to change, but it's fixed now.
1107 logic here had to change, but it's fixed now.
1100
1108
1101 2006-01-29 Ville Vainio <vivainio@gmail.com>
1109 2006-01-29 Ville Vainio <vivainio@gmail.com>
1102
1110
1103 * iplib.py: Try to import pyreadline on Windows.
1111 * iplib.py: Try to import pyreadline on Windows.
1104
1112
1105 2006-01-27 Ville Vainio <vivainio@gmail.com>
1113 2006-01-27 Ville Vainio <vivainio@gmail.com>
1106
1114
1107 * iplib.py: Expose ipapi as _ip in builtin namespace.
1115 * iplib.py: Expose ipapi as _ip in builtin namespace.
1108 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1116 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1109 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1117 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1110 syntax now produce _ip.* variant of the commands.
1118 syntax now produce _ip.* variant of the commands.
1111
1119
1112 * "_ip.options().autoedit_syntax = 2" automatically throws
1120 * "_ip.options().autoedit_syntax = 2" automatically throws
1113 user to editor for syntax error correction without prompting.
1121 user to editor for syntax error correction without prompting.
1114
1122
1115 2006-01-27 Ville Vainio <vivainio@gmail.com>
1123 2006-01-27 Ville Vainio <vivainio@gmail.com>
1116
1124
1117 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1125 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1118 'ipython' at argv[0]) executed through command line.
1126 'ipython' at argv[0]) executed through command line.
1119 NOTE: this DEPRECATES calling ipython with multiple scripts
1127 NOTE: this DEPRECATES calling ipython with multiple scripts
1120 ("ipython a.py b.py c.py")
1128 ("ipython a.py b.py c.py")
1121
1129
1122 * iplib.py, hooks.py: Added configurable input prefilter,
1130 * iplib.py, hooks.py: Added configurable input prefilter,
1123 named 'input_prefilter'. See ext_rescapture.py for example
1131 named 'input_prefilter'. See ext_rescapture.py for example
1124 usage.
1132 usage.
1125
1133
1126 * ext_rescapture.py, Magic.py: Better system command output capture
1134 * ext_rescapture.py, Magic.py: Better system command output capture
1127 through 'var = !ls' (deprecates user-visible %sc). Same notation
1135 through 'var = !ls' (deprecates user-visible %sc). Same notation
1128 applies for magics, 'var = %alias' assigns alias list to var.
1136 applies for magics, 'var = %alias' assigns alias list to var.
1129
1137
1130 * ipapi.py: added meta() for accessing extension-usable data store.
1138 * ipapi.py: added meta() for accessing extension-usable data store.
1131
1139
1132 * iplib.py: added InteractiveShell.getapi(). New magics should be
1140 * iplib.py: added InteractiveShell.getapi(). New magics should be
1133 written doing self.getapi() instead of using the shell directly.
1141 written doing self.getapi() instead of using the shell directly.
1134
1142
1135 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1143 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1136 %store foo >> ~/myfoo.txt to store variables to files (in clean
1144 %store foo >> ~/myfoo.txt to store variables to files (in clean
1137 textual form, not a restorable pickle).
1145 textual form, not a restorable pickle).
1138
1146
1139 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1147 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1140
1148
1141 * usage.py, Magic.py: added %quickref
1149 * usage.py, Magic.py: added %quickref
1142
1150
1143 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1151 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1144
1152
1145 * GetoptErrors when invoking magics etc. with wrong args
1153 * GetoptErrors when invoking magics etc. with wrong args
1146 are now more helpful:
1154 are now more helpful:
1147 GetoptError: option -l not recognized (allowed: "qb" )
1155 GetoptError: option -l not recognized (allowed: "qb" )
1148
1156
1149 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1157 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1150
1158
1151 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1159 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1152 computationally intensive blocks don't appear to stall the demo.
1160 computationally intensive blocks don't appear to stall the demo.
1153
1161
1154 2006-01-24 Ville Vainio <vivainio@gmail.com>
1162 2006-01-24 Ville Vainio <vivainio@gmail.com>
1155
1163
1156 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1164 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1157 value to manipulate resulting history entry.
1165 value to manipulate resulting history entry.
1158
1166
1159 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1167 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1160 to instance methods of IPApi class, to make extending an embedded
1168 to instance methods of IPApi class, to make extending an embedded
1161 IPython feasible. See ext_rehashdir.py for example usage.
1169 IPython feasible. See ext_rehashdir.py for example usage.
1162
1170
1163 * Merged 1071-1076 from branches/0.7.1
1171 * Merged 1071-1076 from branches/0.7.1
1164
1172
1165
1173
1166 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1174 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1167
1175
1168 * tools/release (daystamp): Fix build tools to use the new
1176 * tools/release (daystamp): Fix build tools to use the new
1169 eggsetup.py script to build lightweight eggs.
1177 eggsetup.py script to build lightweight eggs.
1170
1178
1171 * Applied changesets 1062 and 1064 before 0.7.1 release.
1179 * Applied changesets 1062 and 1064 before 0.7.1 release.
1172
1180
1173 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1181 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1174 see the raw input history (without conversions like %ls ->
1182 see the raw input history (without conversions like %ls ->
1175 ipmagic("ls")). After a request from W. Stein, SAGE
1183 ipmagic("ls")). After a request from W. Stein, SAGE
1176 (http://modular.ucsd.edu/sage) developer. This information is
1184 (http://modular.ucsd.edu/sage) developer. This information is
1177 stored in the input_hist_raw attribute of the IPython instance, so
1185 stored in the input_hist_raw attribute of the IPython instance, so
1178 developers can access it if needed (it's an InputList instance).
1186 developers can access it if needed (it's an InputList instance).
1179
1187
1180 * Versionstring = 0.7.2.svn
1188 * Versionstring = 0.7.2.svn
1181
1189
1182 * eggsetup.py: A separate script for constructing eggs, creates
1190 * eggsetup.py: A separate script for constructing eggs, creates
1183 proper launch scripts even on Windows (an .exe file in
1191 proper launch scripts even on Windows (an .exe file in
1184 \python24\scripts).
1192 \python24\scripts).
1185
1193
1186 * ipapi.py: launch_new_instance, launch entry point needed for the
1194 * ipapi.py: launch_new_instance, launch entry point needed for the
1187 egg.
1195 egg.
1188
1196
1189 2006-01-23 Ville Vainio <vivainio@gmail.com>
1197 2006-01-23 Ville Vainio <vivainio@gmail.com>
1190
1198
1191 * Added %cpaste magic for pasting python code
1199 * Added %cpaste magic for pasting python code
1192
1200
1193 2006-01-22 Ville Vainio <vivainio@gmail.com>
1201 2006-01-22 Ville Vainio <vivainio@gmail.com>
1194
1202
1195 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1203 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1196
1204
1197 * Versionstring = 0.7.2.svn
1205 * Versionstring = 0.7.2.svn
1198
1206
1199 * eggsetup.py: A separate script for constructing eggs, creates
1207 * eggsetup.py: A separate script for constructing eggs, creates
1200 proper launch scripts even on Windows (an .exe file in
1208 proper launch scripts even on Windows (an .exe file in
1201 \python24\scripts).
1209 \python24\scripts).
1202
1210
1203 * ipapi.py: launch_new_instance, launch entry point needed for the
1211 * ipapi.py: launch_new_instance, launch entry point needed for the
1204 egg.
1212 egg.
1205
1213
1206 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1214 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1207
1215
1208 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1216 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1209 %pfile foo would print the file for foo even if it was a binary.
1217 %pfile foo would print the file for foo even if it was a binary.
1210 Now, extensions '.so' and '.dll' are skipped.
1218 Now, extensions '.so' and '.dll' are skipped.
1211
1219
1212 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1220 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1213 bug, where macros would fail in all threaded modes. I'm not 100%
1221 bug, where macros would fail in all threaded modes. I'm not 100%
1214 sure, so I'm going to put out an rc instead of making a release
1222 sure, so I'm going to put out an rc instead of making a release
1215 today, and wait for feedback for at least a few days.
1223 today, and wait for feedback for at least a few days.
1216
1224
1217 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1225 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1218 it...) the handling of pasting external code with autoindent on.
1226 it...) the handling of pasting external code with autoindent on.
1219 To get out of a multiline input, the rule will appear for most
1227 To get out of a multiline input, the rule will appear for most
1220 users unchanged: two blank lines or change the indent level
1228 users unchanged: two blank lines or change the indent level
1221 proposed by IPython. But there is a twist now: you can
1229 proposed by IPython. But there is a twist now: you can
1222 add/subtract only *one or two spaces*. If you add/subtract three
1230 add/subtract only *one or two spaces*. If you add/subtract three
1223 or more (unless you completely delete the line), IPython will
1231 or more (unless you completely delete the line), IPython will
1224 accept that line, and you'll need to enter a second one of pure
1232 accept that line, and you'll need to enter a second one of pure
1225 whitespace. I know it sounds complicated, but I can't find a
1233 whitespace. I know it sounds complicated, but I can't find a
1226 different solution that covers all the cases, with the right
1234 different solution that covers all the cases, with the right
1227 heuristics. Hopefully in actual use, nobody will really notice
1235 heuristics. Hopefully in actual use, nobody will really notice
1228 all these strange rules and things will 'just work'.
1236 all these strange rules and things will 'just work'.
1229
1237
1230 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1238 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1231
1239
1232 * IPython/iplib.py (interact): catch exceptions which can be
1240 * IPython/iplib.py (interact): catch exceptions which can be
1233 triggered asynchronously by signal handlers. Thanks to an
1241 triggered asynchronously by signal handlers. Thanks to an
1234 automatic crash report, submitted by Colin Kingsley
1242 automatic crash report, submitted by Colin Kingsley
1235 <tercel-AT-gentoo.org>.
1243 <tercel-AT-gentoo.org>.
1236
1244
1237 2006-01-20 Ville Vainio <vivainio@gmail.com>
1245 2006-01-20 Ville Vainio <vivainio@gmail.com>
1238
1246
1239 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1247 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1240 (%rehashdir, very useful, try it out) of how to extend ipython
1248 (%rehashdir, very useful, try it out) of how to extend ipython
1241 with new magics. Also added Extensions dir to pythonpath to make
1249 with new magics. Also added Extensions dir to pythonpath to make
1242 importing extensions easy.
1250 importing extensions easy.
1243
1251
1244 * %store now complains when trying to store interactively declared
1252 * %store now complains when trying to store interactively declared
1245 classes / instances of those classes.
1253 classes / instances of those classes.
1246
1254
1247 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1255 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1248 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1256 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1249 if they exist, and ipy_user_conf.py with some defaults is created for
1257 if they exist, and ipy_user_conf.py with some defaults is created for
1250 the user.
1258 the user.
1251
1259
1252 * Startup rehashing done by the config file, not InterpreterExec.
1260 * Startup rehashing done by the config file, not InterpreterExec.
1253 This means system commands are available even without selecting the
1261 This means system commands are available even without selecting the
1254 pysh profile. It's the sensible default after all.
1262 pysh profile. It's the sensible default after all.
1255
1263
1256 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1264 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1257
1265
1258 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1266 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1259 multiline code with autoindent on working. But I am really not
1267 multiline code with autoindent on working. But I am really not
1260 sure, so this needs more testing. Will commit a debug-enabled
1268 sure, so this needs more testing. Will commit a debug-enabled
1261 version for now, while I test it some more, so that Ville and
1269 version for now, while I test it some more, so that Ville and
1262 others may also catch any problems. Also made
1270 others may also catch any problems. Also made
1263 self.indent_current_str() a method, to ensure that there's no
1271 self.indent_current_str() a method, to ensure that there's no
1264 chance of the indent space count and the corresponding string
1272 chance of the indent space count and the corresponding string
1265 falling out of sync. All code needing the string should just call
1273 falling out of sync. All code needing the string should just call
1266 the method.
1274 the method.
1267
1275
1268 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1276 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1269
1277
1270 * IPython/Magic.py (magic_edit): fix check for when users don't
1278 * IPython/Magic.py (magic_edit): fix check for when users don't
1271 save their output files, the try/except was in the wrong section.
1279 save their output files, the try/except was in the wrong section.
1272
1280
1273 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1281 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1274
1282
1275 * IPython/Magic.py (magic_run): fix __file__ global missing from
1283 * IPython/Magic.py (magic_run): fix __file__ global missing from
1276 script's namespace when executed via %run. After a report by
1284 script's namespace when executed via %run. After a report by
1277 Vivian.
1285 Vivian.
1278
1286
1279 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1287 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1280 when using python 2.4. The parent constructor changed in 2.4, and
1288 when using python 2.4. The parent constructor changed in 2.4, and
1281 we need to track it directly (we can't call it, as it messes up
1289 we need to track it directly (we can't call it, as it messes up
1282 readline and tab-completion inside our pdb would stop working).
1290 readline and tab-completion inside our pdb would stop working).
1283 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1291 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1284
1292
1285 2006-01-16 Ville Vainio <vivainio@gmail.com>
1293 2006-01-16 Ville Vainio <vivainio@gmail.com>
1286
1294
1287 * Ipython/magic.py: Reverted back to old %edit functionality
1295 * Ipython/magic.py: Reverted back to old %edit functionality
1288 that returns file contents on exit.
1296 that returns file contents on exit.
1289
1297
1290 * IPython/path.py: Added Jason Orendorff's "path" module to
1298 * IPython/path.py: Added Jason Orendorff's "path" module to
1291 IPython tree, http://www.jorendorff.com/articles/python/path/.
1299 IPython tree, http://www.jorendorff.com/articles/python/path/.
1292 You can get path objects conveniently through %sc, and !!, e.g.:
1300 You can get path objects conveniently through %sc, and !!, e.g.:
1293 sc files=ls
1301 sc files=ls
1294 for p in files.paths: # or files.p
1302 for p in files.paths: # or files.p
1295 print p,p.mtime
1303 print p,p.mtime
1296
1304
1297 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1305 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1298 now work again without considering the exclusion regexp -
1306 now work again without considering the exclusion regexp -
1299 hence, things like ',foo my/path' turn to 'foo("my/path")'
1307 hence, things like ',foo my/path' turn to 'foo("my/path")'
1300 instead of syntax error.
1308 instead of syntax error.
1301
1309
1302
1310
1303 2006-01-14 Ville Vainio <vivainio@gmail.com>
1311 2006-01-14 Ville Vainio <vivainio@gmail.com>
1304
1312
1305 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1313 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1306 ipapi decorators for python 2.4 users, options() provides access to rc
1314 ipapi decorators for python 2.4 users, options() provides access to rc
1307 data.
1315 data.
1308
1316
1309 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1317 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1310 as path separators (even on Linux ;-). Space character after
1318 as path separators (even on Linux ;-). Space character after
1311 backslash (as yielded by tab completer) is still space;
1319 backslash (as yielded by tab completer) is still space;
1312 "%cd long\ name" works as expected.
1320 "%cd long\ name" works as expected.
1313
1321
1314 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1322 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1315 as "chain of command", with priority. API stays the same,
1323 as "chain of command", with priority. API stays the same,
1316 TryNext exception raised by a hook function signals that
1324 TryNext exception raised by a hook function signals that
1317 current hook failed and next hook should try handling it, as
1325 current hook failed and next hook should try handling it, as
1318 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1326 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1319 requested configurable display hook, which is now implemented.
1327 requested configurable display hook, which is now implemented.
1320
1328
1321 2006-01-13 Ville Vainio <vivainio@gmail.com>
1329 2006-01-13 Ville Vainio <vivainio@gmail.com>
1322
1330
1323 * IPython/platutils*.py: platform specific utility functions,
1331 * IPython/platutils*.py: platform specific utility functions,
1324 so far only set_term_title is implemented (change terminal
1332 so far only set_term_title is implemented (change terminal
1325 label in windowing systems). %cd now changes the title to
1333 label in windowing systems). %cd now changes the title to
1326 current dir.
1334 current dir.
1327
1335
1328 * IPython/Release.py: Added myself to "authors" list,
1336 * IPython/Release.py: Added myself to "authors" list,
1329 had to create new files.
1337 had to create new files.
1330
1338
1331 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1339 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1332 shell escape; not a known bug but had potential to be one in the
1340 shell escape; not a known bug but had potential to be one in the
1333 future.
1341 future.
1334
1342
1335 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1343 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1336 extension API for IPython! See the module for usage example. Fix
1344 extension API for IPython! See the module for usage example. Fix
1337 OInspect for docstring-less magic functions.
1345 OInspect for docstring-less magic functions.
1338
1346
1339
1347
1340 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1348 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1341
1349
1342 * IPython/iplib.py (raw_input): temporarily deactivate all
1350 * IPython/iplib.py (raw_input): temporarily deactivate all
1343 attempts at allowing pasting of code with autoindent on. It
1351 attempts at allowing pasting of code with autoindent on. It
1344 introduced bugs (reported by Prabhu) and I can't seem to find a
1352 introduced bugs (reported by Prabhu) and I can't seem to find a
1345 robust combination which works in all cases. Will have to revisit
1353 robust combination which works in all cases. Will have to revisit
1346 later.
1354 later.
1347
1355
1348 * IPython/genutils.py: remove isspace() function. We've dropped
1356 * IPython/genutils.py: remove isspace() function. We've dropped
1349 2.2 compatibility, so it's OK to use the string method.
1357 2.2 compatibility, so it's OK to use the string method.
1350
1358
1351 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1359 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1352
1360
1353 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1361 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1354 matching what NOT to autocall on, to include all python binary
1362 matching what NOT to autocall on, to include all python binary
1355 operators (including things like 'and', 'or', 'is' and 'in').
1363 operators (including things like 'and', 'or', 'is' and 'in').
1356 Prompted by a bug report on 'foo & bar', but I realized we had
1364 Prompted by a bug report on 'foo & bar', but I realized we had
1357 many more potential bug cases with other operators. The regexp is
1365 many more potential bug cases with other operators. The regexp is
1358 self.re_exclude_auto, it's fairly commented.
1366 self.re_exclude_auto, it's fairly commented.
1359
1367
1360 2006-01-12 Ville Vainio <vivainio@gmail.com>
1368 2006-01-12 Ville Vainio <vivainio@gmail.com>
1361
1369
1362 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1370 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1363 Prettified and hardened string/backslash quoting with ipsystem(),
1371 Prettified and hardened string/backslash quoting with ipsystem(),
1364 ipalias() and ipmagic(). Now even \ characters are passed to
1372 ipalias() and ipmagic(). Now even \ characters are passed to
1365 %magics, !shell escapes and aliases exactly as they are in the
1373 %magics, !shell escapes and aliases exactly as they are in the
1366 ipython command line. Should improve backslash experience,
1374 ipython command line. Should improve backslash experience,
1367 particularly in Windows (path delimiter for some commands that
1375 particularly in Windows (path delimiter for some commands that
1368 won't understand '/'), but Unix benefits as well (regexps). %cd
1376 won't understand '/'), but Unix benefits as well (regexps). %cd
1369 magic still doesn't support backslash path delimiters, though. Also
1377 magic still doesn't support backslash path delimiters, though. Also
1370 deleted all pretense of supporting multiline command strings in
1378 deleted all pretense of supporting multiline command strings in
1371 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1379 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1372
1380
1373 * doc/build_doc_instructions.txt added. Documentation on how to
1381 * doc/build_doc_instructions.txt added. Documentation on how to
1374 use doc/update_manual.py, added yesterday. Both files contributed
1382 use doc/update_manual.py, added yesterday. Both files contributed
1375 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1383 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1376 doc/*.sh for deprecation at a later date.
1384 doc/*.sh for deprecation at a later date.
1377
1385
1378 * /ipython.py Added ipython.py to root directory for
1386 * /ipython.py Added ipython.py to root directory for
1379 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1387 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1380 ipython.py) and development convenience (no need to keep doing
1388 ipython.py) and development convenience (no need to keep doing
1381 "setup.py install" between changes).
1389 "setup.py install" between changes).
1382
1390
1383 * Made ! and !! shell escapes work (again) in multiline expressions:
1391 * Made ! and !! shell escapes work (again) in multiline expressions:
1384 if 1:
1392 if 1:
1385 !ls
1393 !ls
1386 !!ls
1394 !!ls
1387
1395
1388 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1396 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1389
1397
1390 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1398 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1391 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1399 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1392 module in case-insensitive installation. Was causing crashes
1400 module in case-insensitive installation. Was causing crashes
1393 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1401 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1394
1402
1395 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1403 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1396 <marienz-AT-gentoo.org>, closes
1404 <marienz-AT-gentoo.org>, closes
1397 http://www.scipy.net/roundup/ipython/issue51.
1405 http://www.scipy.net/roundup/ipython/issue51.
1398
1406
1399 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1407 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1400
1408
1401 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1409 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1402 problem of excessive CPU usage under *nix and keyboard lag under
1410 problem of excessive CPU usage under *nix and keyboard lag under
1403 win32.
1411 win32.
1404
1412
1405 2006-01-10 *** Released version 0.7.0
1413 2006-01-10 *** Released version 0.7.0
1406
1414
1407 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1415 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1408
1416
1409 * IPython/Release.py (revision): tag version number to 0.7.0,
1417 * IPython/Release.py (revision): tag version number to 0.7.0,
1410 ready for release.
1418 ready for release.
1411
1419
1412 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1420 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1413 it informs the user of the name of the temp. file used. This can
1421 it informs the user of the name of the temp. file used. This can
1414 help if you decide later to reuse that same file, so you know
1422 help if you decide later to reuse that same file, so you know
1415 where to copy the info from.
1423 where to copy the info from.
1416
1424
1417 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1425 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1418
1426
1419 * setup_bdist_egg.py: little script to build an egg. Added
1427 * setup_bdist_egg.py: little script to build an egg. Added
1420 support in the release tools as well.
1428 support in the release tools as well.
1421
1429
1422 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1430 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1423
1431
1424 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1432 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1425 version selection (new -wxversion command line and ipythonrc
1433 version selection (new -wxversion command line and ipythonrc
1426 parameter). Patch contributed by Arnd Baecker
1434 parameter). Patch contributed by Arnd Baecker
1427 <arnd.baecker-AT-web.de>.
1435 <arnd.baecker-AT-web.de>.
1428
1436
1429 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1437 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1430 embedded instances, for variables defined at the interactive
1438 embedded instances, for variables defined at the interactive
1431 prompt of the embedded ipython. Reported by Arnd.
1439 prompt of the embedded ipython. Reported by Arnd.
1432
1440
1433 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1441 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1434 it can be used as a (stateful) toggle, or with a direct parameter.
1442 it can be used as a (stateful) toggle, or with a direct parameter.
1435
1443
1436 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1444 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1437 could be triggered in certain cases and cause the traceback
1445 could be triggered in certain cases and cause the traceback
1438 printer not to work.
1446 printer not to work.
1439
1447
1440 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1448 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1441
1449
1442 * IPython/iplib.py (_should_recompile): Small fix, closes
1450 * IPython/iplib.py (_should_recompile): Small fix, closes
1443 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1451 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1444
1452
1445 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1453 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1446
1454
1447 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1455 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1448 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1456 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1449 Moad for help with tracking it down.
1457 Moad for help with tracking it down.
1450
1458
1451 * IPython/iplib.py (handle_auto): fix autocall handling for
1459 * IPython/iplib.py (handle_auto): fix autocall handling for
1452 objects which support BOTH __getitem__ and __call__ (so that f [x]
1460 objects which support BOTH __getitem__ and __call__ (so that f [x]
1453 is left alone, instead of becoming f([x]) automatically).
1461 is left alone, instead of becoming f([x]) automatically).
1454
1462
1455 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1463 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1456 Ville's patch.
1464 Ville's patch.
1457
1465
1458 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1466 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1459
1467
1460 * IPython/iplib.py (handle_auto): changed autocall semantics to
1468 * IPython/iplib.py (handle_auto): changed autocall semantics to
1461 include 'smart' mode, where the autocall transformation is NOT
1469 include 'smart' mode, where the autocall transformation is NOT
1462 applied if there are no arguments on the line. This allows you to
1470 applied if there are no arguments on the line. This allows you to
1463 just type 'foo' if foo is a callable to see its internal form,
1471 just type 'foo' if foo is a callable to see its internal form,
1464 instead of having it called with no arguments (typically a
1472 instead of having it called with no arguments (typically a
1465 mistake). The old 'full' autocall still exists: for that, you
1473 mistake). The old 'full' autocall still exists: for that, you
1466 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1474 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1467
1475
1468 * IPython/completer.py (Completer.attr_matches): add
1476 * IPython/completer.py (Completer.attr_matches): add
1469 tab-completion support for Enthoughts' traits. After a report by
1477 tab-completion support for Enthoughts' traits. After a report by
1470 Arnd and a patch by Prabhu.
1478 Arnd and a patch by Prabhu.
1471
1479
1472 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1480 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1473
1481
1474 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1482 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1475 Schmolck's patch to fix inspect.getinnerframes().
1483 Schmolck's patch to fix inspect.getinnerframes().
1476
1484
1477 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1485 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1478 for embedded instances, regarding handling of namespaces and items
1486 for embedded instances, regarding handling of namespaces and items
1479 added to the __builtin__ one. Multiple embedded instances and
1487 added to the __builtin__ one. Multiple embedded instances and
1480 recursive embeddings should work better now (though I'm not sure
1488 recursive embeddings should work better now (though I'm not sure
1481 I've got all the corner cases fixed, that code is a bit of a brain
1489 I've got all the corner cases fixed, that code is a bit of a brain
1482 twister).
1490 twister).
1483
1491
1484 * IPython/Magic.py (magic_edit): added support to edit in-memory
1492 * IPython/Magic.py (magic_edit): added support to edit in-memory
1485 macros (automatically creates the necessary temp files). %edit
1493 macros (automatically creates the necessary temp files). %edit
1486 also doesn't return the file contents anymore, it's just noise.
1494 also doesn't return the file contents anymore, it's just noise.
1487
1495
1488 * IPython/completer.py (Completer.attr_matches): revert change to
1496 * IPython/completer.py (Completer.attr_matches): revert change to
1489 complete only on attributes listed in __all__. I realized it
1497 complete only on attributes listed in __all__. I realized it
1490 cripples the tab-completion system as a tool for exploring the
1498 cripples the tab-completion system as a tool for exploring the
1491 internals of unknown libraries (it renders any non-__all__
1499 internals of unknown libraries (it renders any non-__all__
1492 attribute off-limits). I got bit by this when trying to see
1500 attribute off-limits). I got bit by this when trying to see
1493 something inside the dis module.
1501 something inside the dis module.
1494
1502
1495 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1503 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1496
1504
1497 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1505 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1498 namespace for users and extension writers to hold data in. This
1506 namespace for users and extension writers to hold data in. This
1499 follows the discussion in
1507 follows the discussion in
1500 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1508 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1501
1509
1502 * IPython/completer.py (IPCompleter.complete): small patch to help
1510 * IPython/completer.py (IPCompleter.complete): small patch to help
1503 tab-completion under Emacs, after a suggestion by John Barnard
1511 tab-completion under Emacs, after a suggestion by John Barnard
1504 <barnarj-AT-ccf.org>.
1512 <barnarj-AT-ccf.org>.
1505
1513
1506 * IPython/Magic.py (Magic.extract_input_slices): added support for
1514 * IPython/Magic.py (Magic.extract_input_slices): added support for
1507 the slice notation in magics to use N-M to represent numbers N...M
1515 the slice notation in magics to use N-M to represent numbers N...M
1508 (closed endpoints). This is used by %macro and %save.
1516 (closed endpoints). This is used by %macro and %save.
1509
1517
1510 * IPython/completer.py (Completer.attr_matches): for modules which
1518 * IPython/completer.py (Completer.attr_matches): for modules which
1511 define __all__, complete only on those. After a patch by Jeffrey
1519 define __all__, complete only on those. After a patch by Jeffrey
1512 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1520 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1513 speed up this routine.
1521 speed up this routine.
1514
1522
1515 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1523 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1516 don't know if this is the end of it, but the behavior now is
1524 don't know if this is the end of it, but the behavior now is
1517 certainly much more correct. Note that coupled with macros,
1525 certainly much more correct. Note that coupled with macros,
1518 slightly surprising (at first) behavior may occur: a macro will in
1526 slightly surprising (at first) behavior may occur: a macro will in
1519 general expand to multiple lines of input, so upon exiting, the
1527 general expand to multiple lines of input, so upon exiting, the
1520 in/out counters will both be bumped by the corresponding amount
1528 in/out counters will both be bumped by the corresponding amount
1521 (as if the macro's contents had been typed interactively). Typing
1529 (as if the macro's contents had been typed interactively). Typing
1522 %hist will reveal the intermediate (silently processed) lines.
1530 %hist will reveal the intermediate (silently processed) lines.
1523
1531
1524 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1532 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1525 pickle to fail (%run was overwriting __main__ and not restoring
1533 pickle to fail (%run was overwriting __main__ and not restoring
1526 it, but pickle relies on __main__ to operate).
1534 it, but pickle relies on __main__ to operate).
1527
1535
1528 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1536 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1529 using properties, but forgot to make the main InteractiveShell
1537 using properties, but forgot to make the main InteractiveShell
1530 class a new-style class. Properties fail silently, and
1538 class a new-style class. Properties fail silently, and
1531 mysteriously, with old-style class (getters work, but
1539 mysteriously, with old-style class (getters work, but
1532 setters don't do anything).
1540 setters don't do anything).
1533
1541
1534 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1542 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1535
1543
1536 * IPython/Magic.py (magic_history): fix history reporting bug (I
1544 * IPython/Magic.py (magic_history): fix history reporting bug (I
1537 know some nasties are still there, I just can't seem to find a
1545 know some nasties are still there, I just can't seem to find a
1538 reproducible test case to track them down; the input history is
1546 reproducible test case to track them down; the input history is
1539 falling out of sync...)
1547 falling out of sync...)
1540
1548
1541 * IPython/iplib.py (handle_shell_escape): fix bug where both
1549 * IPython/iplib.py (handle_shell_escape): fix bug where both
1542 aliases and system accesses where broken for indented code (such
1550 aliases and system accesses where broken for indented code (such
1543 as loops).
1551 as loops).
1544
1552
1545 * IPython/genutils.py (shell): fix small but critical bug for
1553 * IPython/genutils.py (shell): fix small but critical bug for
1546 win32 system access.
1554 win32 system access.
1547
1555
1548 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1556 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1549
1557
1550 * IPython/iplib.py (showtraceback): remove use of the
1558 * IPython/iplib.py (showtraceback): remove use of the
1551 sys.last_{type/value/traceback} structures, which are non
1559 sys.last_{type/value/traceback} structures, which are non
1552 thread-safe.
1560 thread-safe.
1553 (_prefilter): change control flow to ensure that we NEVER
1561 (_prefilter): change control flow to ensure that we NEVER
1554 introspect objects when autocall is off. This will guarantee that
1562 introspect objects when autocall is off. This will guarantee that
1555 having an input line of the form 'x.y', where access to attribute
1563 having an input line of the form 'x.y', where access to attribute
1556 'y' has side effects, doesn't trigger the side effect TWICE. It
1564 'y' has side effects, doesn't trigger the side effect TWICE. It
1557 is important to note that, with autocall on, these side effects
1565 is important to note that, with autocall on, these side effects
1558 can still happen.
1566 can still happen.
1559 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1567 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1560 trio. IPython offers these three kinds of special calls which are
1568 trio. IPython offers these three kinds of special calls which are
1561 not python code, and it's a good thing to have their call method
1569 not python code, and it's a good thing to have their call method
1562 be accessible as pure python functions (not just special syntax at
1570 be accessible as pure python functions (not just special syntax at
1563 the command line). It gives us a better internal implementation
1571 the command line). It gives us a better internal implementation
1564 structure, as well as exposing these for user scripting more
1572 structure, as well as exposing these for user scripting more
1565 cleanly.
1573 cleanly.
1566
1574
1567 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1575 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1568 file. Now that they'll be more likely to be used with the
1576 file. Now that they'll be more likely to be used with the
1569 persistance system (%store), I want to make sure their module path
1577 persistance system (%store), I want to make sure their module path
1570 doesn't change in the future, so that we don't break things for
1578 doesn't change in the future, so that we don't break things for
1571 users' persisted data.
1579 users' persisted data.
1572
1580
1573 * IPython/iplib.py (autoindent_update): move indentation
1581 * IPython/iplib.py (autoindent_update): move indentation
1574 management into the _text_ processing loop, not the keyboard
1582 management into the _text_ processing loop, not the keyboard
1575 interactive one. This is necessary to correctly process non-typed
1583 interactive one. This is necessary to correctly process non-typed
1576 multiline input (such as macros).
1584 multiline input (such as macros).
1577
1585
1578 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1586 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1579 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1587 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1580 which was producing problems in the resulting manual.
1588 which was producing problems in the resulting manual.
1581 (magic_whos): improve reporting of instances (show their class,
1589 (magic_whos): improve reporting of instances (show their class,
1582 instead of simply printing 'instance' which isn't terribly
1590 instead of simply printing 'instance' which isn't terribly
1583 informative).
1591 informative).
1584
1592
1585 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1593 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1586 (minor mods) to support network shares under win32.
1594 (minor mods) to support network shares under win32.
1587
1595
1588 * IPython/winconsole.py (get_console_size): add new winconsole
1596 * IPython/winconsole.py (get_console_size): add new winconsole
1589 module and fixes to page_dumb() to improve its behavior under
1597 module and fixes to page_dumb() to improve its behavior under
1590 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1598 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1591
1599
1592 * IPython/Magic.py (Macro): simplified Macro class to just
1600 * IPython/Magic.py (Macro): simplified Macro class to just
1593 subclass list. We've had only 2.2 compatibility for a very long
1601 subclass list. We've had only 2.2 compatibility for a very long
1594 time, yet I was still avoiding subclassing the builtin types. No
1602 time, yet I was still avoiding subclassing the builtin types. No
1595 more (I'm also starting to use properties, though I won't shift to
1603 more (I'm also starting to use properties, though I won't shift to
1596 2.3-specific features quite yet).
1604 2.3-specific features quite yet).
1597 (magic_store): added Ville's patch for lightweight variable
1605 (magic_store): added Ville's patch for lightweight variable
1598 persistence, after a request on the user list by Matt Wilkie
1606 persistence, after a request on the user list by Matt Wilkie
1599 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1607 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1600 details.
1608 details.
1601
1609
1602 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1610 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1603 changed the default logfile name from 'ipython.log' to
1611 changed the default logfile name from 'ipython.log' to
1604 'ipython_log.py'. These logs are real python files, and now that
1612 'ipython_log.py'. These logs are real python files, and now that
1605 we have much better multiline support, people are more likely to
1613 we have much better multiline support, people are more likely to
1606 want to use them as such. Might as well name them correctly.
1614 want to use them as such. Might as well name them correctly.
1607
1615
1608 * IPython/Magic.py: substantial cleanup. While we can't stop
1616 * IPython/Magic.py: substantial cleanup. While we can't stop
1609 using magics as mixins, due to the existing customizations 'out
1617 using magics as mixins, due to the existing customizations 'out
1610 there' which rely on the mixin naming conventions, at least I
1618 there' which rely on the mixin naming conventions, at least I
1611 cleaned out all cross-class name usage. So once we are OK with
1619 cleaned out all cross-class name usage. So once we are OK with
1612 breaking compatibility, the two systems can be separated.
1620 breaking compatibility, the two systems can be separated.
1613
1621
1614 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1622 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1615 anymore, and the class is a fair bit less hideous as well. New
1623 anymore, and the class is a fair bit less hideous as well. New
1616 features were also introduced: timestamping of input, and logging
1624 features were also introduced: timestamping of input, and logging
1617 of output results. These are user-visible with the -t and -o
1625 of output results. These are user-visible with the -t and -o
1618 options to %logstart. Closes
1626 options to %logstart. Closes
1619 http://www.scipy.net/roundup/ipython/issue11 and a request by
1627 http://www.scipy.net/roundup/ipython/issue11 and a request by
1620 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1628 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1621
1629
1622 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1630 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1623
1631
1624 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1632 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1625 better handle backslashes in paths. See the thread 'More Windows
1633 better handle backslashes in paths. See the thread 'More Windows
1626 questions part 2 - \/ characters revisited' on the iypthon user
1634 questions part 2 - \/ characters revisited' on the iypthon user
1627 list:
1635 list:
1628 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1636 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1629
1637
1630 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1638 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1631
1639
1632 (InteractiveShell.__init__): change threaded shells to not use the
1640 (InteractiveShell.__init__): change threaded shells to not use the
1633 ipython crash handler. This was causing more problems than not,
1641 ipython crash handler. This was causing more problems than not,
1634 as exceptions in the main thread (GUI code, typically) would
1642 as exceptions in the main thread (GUI code, typically) would
1635 always show up as a 'crash', when they really weren't.
1643 always show up as a 'crash', when they really weren't.
1636
1644
1637 The colors and exception mode commands (%colors/%xmode) have been
1645 The colors and exception mode commands (%colors/%xmode) have been
1638 synchronized to also take this into account, so users can get
1646 synchronized to also take this into account, so users can get
1639 verbose exceptions for their threaded code as well. I also added
1647 verbose exceptions for their threaded code as well. I also added
1640 support for activating pdb inside this exception handler as well,
1648 support for activating pdb inside this exception handler as well,
1641 so now GUI authors can use IPython's enhanced pdb at runtime.
1649 so now GUI authors can use IPython's enhanced pdb at runtime.
1642
1650
1643 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1651 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1644 true by default, and add it to the shipped ipythonrc file. Since
1652 true by default, and add it to the shipped ipythonrc file. Since
1645 this asks the user before proceeding, I think it's OK to make it
1653 this asks the user before proceeding, I think it's OK to make it
1646 true by default.
1654 true by default.
1647
1655
1648 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1656 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1649 of the previous special-casing of input in the eval loop. I think
1657 of the previous special-casing of input in the eval loop. I think
1650 this is cleaner, as they really are commands and shouldn't have
1658 this is cleaner, as they really are commands and shouldn't have
1651 a special role in the middle of the core code.
1659 a special role in the middle of the core code.
1652
1660
1653 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1661 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1654
1662
1655 * IPython/iplib.py (edit_syntax_error): added support for
1663 * IPython/iplib.py (edit_syntax_error): added support for
1656 automatically reopening the editor if the file had a syntax error
1664 automatically reopening the editor if the file had a syntax error
1657 in it. Thanks to scottt who provided the patch at:
1665 in it. Thanks to scottt who provided the patch at:
1658 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1666 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1659 version committed).
1667 version committed).
1660
1668
1661 * IPython/iplib.py (handle_normal): add suport for multi-line
1669 * IPython/iplib.py (handle_normal): add suport for multi-line
1662 input with emtpy lines. This fixes
1670 input with emtpy lines. This fixes
1663 http://www.scipy.net/roundup/ipython/issue43 and a similar
1671 http://www.scipy.net/roundup/ipython/issue43 and a similar
1664 discussion on the user list.
1672 discussion on the user list.
1665
1673
1666 WARNING: a behavior change is necessarily introduced to support
1674 WARNING: a behavior change is necessarily introduced to support
1667 blank lines: now a single blank line with whitespace does NOT
1675 blank lines: now a single blank line with whitespace does NOT
1668 break the input loop, which means that when autoindent is on, by
1676 break the input loop, which means that when autoindent is on, by
1669 default hitting return on the next (indented) line does NOT exit.
1677 default hitting return on the next (indented) line does NOT exit.
1670
1678
1671 Instead, to exit a multiline input you can either have:
1679 Instead, to exit a multiline input you can either have:
1672
1680
1673 - TWO whitespace lines (just hit return again), or
1681 - TWO whitespace lines (just hit return again), or
1674 - a single whitespace line of a different length than provided
1682 - a single whitespace line of a different length than provided
1675 by the autoindent (add or remove a space).
1683 by the autoindent (add or remove a space).
1676
1684
1677 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1685 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1678 module to better organize all readline-related functionality.
1686 module to better organize all readline-related functionality.
1679 I've deleted FlexCompleter and put all completion clases here.
1687 I've deleted FlexCompleter and put all completion clases here.
1680
1688
1681 * IPython/iplib.py (raw_input): improve indentation management.
1689 * IPython/iplib.py (raw_input): improve indentation management.
1682 It is now possible to paste indented code with autoindent on, and
1690 It is now possible to paste indented code with autoindent on, and
1683 the code is interpreted correctly (though it still looks bad on
1691 the code is interpreted correctly (though it still looks bad on
1684 screen, due to the line-oriented nature of ipython).
1692 screen, due to the line-oriented nature of ipython).
1685 (MagicCompleter.complete): change behavior so that a TAB key on an
1693 (MagicCompleter.complete): change behavior so that a TAB key on an
1686 otherwise empty line actually inserts a tab, instead of completing
1694 otherwise empty line actually inserts a tab, instead of completing
1687 on the entire global namespace. This makes it easier to use the
1695 on the entire global namespace. This makes it easier to use the
1688 TAB key for indentation. After a request by Hans Meine
1696 TAB key for indentation. After a request by Hans Meine
1689 <hans_meine-AT-gmx.net>
1697 <hans_meine-AT-gmx.net>
1690 (_prefilter): add support so that typing plain 'exit' or 'quit'
1698 (_prefilter): add support so that typing plain 'exit' or 'quit'
1691 does a sensible thing. Originally I tried to deviate as little as
1699 does a sensible thing. Originally I tried to deviate as little as
1692 possible from the default python behavior, but even that one may
1700 possible from the default python behavior, but even that one may
1693 change in this direction (thread on python-dev to that effect).
1701 change in this direction (thread on python-dev to that effect).
1694 Regardless, ipython should do the right thing even if CPython's
1702 Regardless, ipython should do the right thing even if CPython's
1695 '>>>' prompt doesn't.
1703 '>>>' prompt doesn't.
1696 (InteractiveShell): removed subclassing code.InteractiveConsole
1704 (InteractiveShell): removed subclassing code.InteractiveConsole
1697 class. By now we'd overridden just about all of its methods: I've
1705 class. By now we'd overridden just about all of its methods: I've
1698 copied the remaining two over, and now ipython is a standalone
1706 copied the remaining two over, and now ipython is a standalone
1699 class. This will provide a clearer picture for the chainsaw
1707 class. This will provide a clearer picture for the chainsaw
1700 branch refactoring.
1708 branch refactoring.
1701
1709
1702 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1710 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1703
1711
1704 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1712 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1705 failures for objects which break when dir() is called on them.
1713 failures for objects which break when dir() is called on them.
1706
1714
1707 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1715 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1708 distinct local and global namespaces in the completer API. This
1716 distinct local and global namespaces in the completer API. This
1709 change allows us to properly handle completion with distinct
1717 change allows us to properly handle completion with distinct
1710 scopes, including in embedded instances (this had never really
1718 scopes, including in embedded instances (this had never really
1711 worked correctly).
1719 worked correctly).
1712
1720
1713 Note: this introduces a change in the constructor for
1721 Note: this introduces a change in the constructor for
1714 MagicCompleter, as a new global_namespace parameter is now the
1722 MagicCompleter, as a new global_namespace parameter is now the
1715 second argument (the others were bumped one position).
1723 second argument (the others were bumped one position).
1716
1724
1717 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1725 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1718
1726
1719 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1727 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1720 embedded instances (which can be done now thanks to Vivian's
1728 embedded instances (which can be done now thanks to Vivian's
1721 frame-handling fixes for pdb).
1729 frame-handling fixes for pdb).
1722 (InteractiveShell.__init__): Fix namespace handling problem in
1730 (InteractiveShell.__init__): Fix namespace handling problem in
1723 embedded instances. We were overwriting __main__ unconditionally,
1731 embedded instances. We were overwriting __main__ unconditionally,
1724 and this should only be done for 'full' (non-embedded) IPython;
1732 and this should only be done for 'full' (non-embedded) IPython;
1725 embedded instances must respect the caller's __main__. Thanks to
1733 embedded instances must respect the caller's __main__. Thanks to
1726 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1734 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1727
1735
1728 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1736 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1729
1737
1730 * setup.py: added download_url to setup(). This registers the
1738 * setup.py: added download_url to setup(). This registers the
1731 download address at PyPI, which is not only useful to humans
1739 download address at PyPI, which is not only useful to humans
1732 browsing the site, but is also picked up by setuptools (the Eggs
1740 browsing the site, but is also picked up by setuptools (the Eggs
1733 machinery). Thanks to Ville and R. Kern for the info/discussion
1741 machinery). Thanks to Ville and R. Kern for the info/discussion
1734 on this.
1742 on this.
1735
1743
1736 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1744 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1737
1745
1738 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1746 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1739 This brings a lot of nice functionality to the pdb mode, which now
1747 This brings a lot of nice functionality to the pdb mode, which now
1740 has tab-completion, syntax highlighting, and better stack handling
1748 has tab-completion, syntax highlighting, and better stack handling
1741 than before. Many thanks to Vivian De Smedt
1749 than before. Many thanks to Vivian De Smedt
1742 <vivian-AT-vdesmedt.com> for the original patches.
1750 <vivian-AT-vdesmedt.com> for the original patches.
1743
1751
1744 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1752 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1745
1753
1746 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1754 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1747 sequence to consistently accept the banner argument. The
1755 sequence to consistently accept the banner argument. The
1748 inconsistency was tripping SAGE, thanks to Gary Zablackis
1756 inconsistency was tripping SAGE, thanks to Gary Zablackis
1749 <gzabl-AT-yahoo.com> for the report.
1757 <gzabl-AT-yahoo.com> for the report.
1750
1758
1751 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1759 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1752
1760
1753 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1761 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1754 Fix bug where a naked 'alias' call in the ipythonrc file would
1762 Fix bug where a naked 'alias' call in the ipythonrc file would
1755 cause a crash. Bug reported by Jorgen Stenarson.
1763 cause a crash. Bug reported by Jorgen Stenarson.
1756
1764
1757 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1765 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1758
1766
1759 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1767 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1760 startup time.
1768 startup time.
1761
1769
1762 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1770 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1763 instances had introduced a bug with globals in normal code. Now
1771 instances had introduced a bug with globals in normal code. Now
1764 it's working in all cases.
1772 it's working in all cases.
1765
1773
1766 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1774 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1767 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1775 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1768 has been introduced to set the default case sensitivity of the
1776 has been introduced to set the default case sensitivity of the
1769 searches. Users can still select either mode at runtime on a
1777 searches. Users can still select either mode at runtime on a
1770 per-search basis.
1778 per-search basis.
1771
1779
1772 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1780 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1773
1781
1774 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1782 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1775 attributes in wildcard searches for subclasses. Modified version
1783 attributes in wildcard searches for subclasses. Modified version
1776 of a patch by Jorgen.
1784 of a patch by Jorgen.
1777
1785
1778 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1786 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1779
1787
1780 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1788 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1781 embedded instances. I added a user_global_ns attribute to the
1789 embedded instances. I added a user_global_ns attribute to the
1782 InteractiveShell class to handle this.
1790 InteractiveShell class to handle this.
1783
1791
1784 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1792 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1785
1793
1786 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1794 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1787 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1795 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1788 (reported under win32, but may happen also in other platforms).
1796 (reported under win32, but may happen also in other platforms).
1789 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1797 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1790
1798
1791 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1799 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1792
1800
1793 * IPython/Magic.py (magic_psearch): new support for wildcard
1801 * IPython/Magic.py (magic_psearch): new support for wildcard
1794 patterns. Now, typing ?a*b will list all names which begin with a
1802 patterns. Now, typing ?a*b will list all names which begin with a
1795 and end in b, for example. The %psearch magic has full
1803 and end in b, for example. The %psearch magic has full
1796 docstrings. Many thanks to JΓΆrgen Stenarson
1804 docstrings. Many thanks to JΓΆrgen Stenarson
1797 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1805 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1798 implementing this functionality.
1806 implementing this functionality.
1799
1807
1800 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1808 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1801
1809
1802 * Manual: fixed long-standing annoyance of double-dashes (as in
1810 * Manual: fixed long-standing annoyance of double-dashes (as in
1803 --prefix=~, for example) being stripped in the HTML version. This
1811 --prefix=~, for example) being stripped in the HTML version. This
1804 is a latex2html bug, but a workaround was provided. Many thanks
1812 is a latex2html bug, but a workaround was provided. Many thanks
1805 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1813 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1806 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1814 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1807 rolling. This seemingly small issue had tripped a number of users
1815 rolling. This seemingly small issue had tripped a number of users
1808 when first installing, so I'm glad to see it gone.
1816 when first installing, so I'm glad to see it gone.
1809
1817
1810 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1818 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1811
1819
1812 * IPython/Extensions/numeric_formats.py: fix missing import,
1820 * IPython/Extensions/numeric_formats.py: fix missing import,
1813 reported by Stephen Walton.
1821 reported by Stephen Walton.
1814
1822
1815 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1823 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1816
1824
1817 * IPython/demo.py: finish demo module, fully documented now.
1825 * IPython/demo.py: finish demo module, fully documented now.
1818
1826
1819 * IPython/genutils.py (file_read): simple little utility to read a
1827 * IPython/genutils.py (file_read): simple little utility to read a
1820 file and ensure it's closed afterwards.
1828 file and ensure it's closed afterwards.
1821
1829
1822 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1830 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1823
1831
1824 * IPython/demo.py (Demo.__init__): added support for individually
1832 * IPython/demo.py (Demo.__init__): added support for individually
1825 tagging blocks for automatic execution.
1833 tagging blocks for automatic execution.
1826
1834
1827 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1835 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1828 syntax-highlighted python sources, requested by John.
1836 syntax-highlighted python sources, requested by John.
1829
1837
1830 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1838 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1831
1839
1832 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1840 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1833 finishing.
1841 finishing.
1834
1842
1835 * IPython/genutils.py (shlex_split): moved from Magic to here,
1843 * IPython/genutils.py (shlex_split): moved from Magic to here,
1836 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1844 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1837
1845
1838 * IPython/demo.py (Demo.__init__): added support for silent
1846 * IPython/demo.py (Demo.__init__): added support for silent
1839 blocks, improved marks as regexps, docstrings written.
1847 blocks, improved marks as regexps, docstrings written.
1840 (Demo.__init__): better docstring, added support for sys.argv.
1848 (Demo.__init__): better docstring, added support for sys.argv.
1841
1849
1842 * IPython/genutils.py (marquee): little utility used by the demo
1850 * IPython/genutils.py (marquee): little utility used by the demo
1843 code, handy in general.
1851 code, handy in general.
1844
1852
1845 * IPython/demo.py (Demo.__init__): new class for interactive
1853 * IPython/demo.py (Demo.__init__): new class for interactive
1846 demos. Not documented yet, I just wrote it in a hurry for
1854 demos. Not documented yet, I just wrote it in a hurry for
1847 scipy'05. Will docstring later.
1855 scipy'05. Will docstring later.
1848
1856
1849 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1857 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1850
1858
1851 * IPython/Shell.py (sigint_handler): Drastic simplification which
1859 * IPython/Shell.py (sigint_handler): Drastic simplification which
1852 also seems to make Ctrl-C work correctly across threads! This is
1860 also seems to make Ctrl-C work correctly across threads! This is
1853 so simple, that I can't beleive I'd missed it before. Needs more
1861 so simple, that I can't beleive I'd missed it before. Needs more
1854 testing, though.
1862 testing, though.
1855 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1863 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1856 like this before...
1864 like this before...
1857
1865
1858 * IPython/genutils.py (get_home_dir): add protection against
1866 * IPython/genutils.py (get_home_dir): add protection against
1859 non-dirs in win32 registry.
1867 non-dirs in win32 registry.
1860
1868
1861 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1869 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1862 bug where dict was mutated while iterating (pysh crash).
1870 bug where dict was mutated while iterating (pysh crash).
1863
1871
1864 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1872 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1865
1873
1866 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1874 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1867 spurious newlines added by this routine. After a report by
1875 spurious newlines added by this routine. After a report by
1868 F. Mantegazza.
1876 F. Mantegazza.
1869
1877
1870 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1878 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1871
1879
1872 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1880 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1873 calls. These were a leftover from the GTK 1.x days, and can cause
1881 calls. These were a leftover from the GTK 1.x days, and can cause
1874 problems in certain cases (after a report by John Hunter).
1882 problems in certain cases (after a report by John Hunter).
1875
1883
1876 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1884 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1877 os.getcwd() fails at init time. Thanks to patch from David Remahl
1885 os.getcwd() fails at init time. Thanks to patch from David Remahl
1878 <chmod007-AT-mac.com>.
1886 <chmod007-AT-mac.com>.
1879 (InteractiveShell.__init__): prevent certain special magics from
1887 (InteractiveShell.__init__): prevent certain special magics from
1880 being shadowed by aliases. Closes
1888 being shadowed by aliases. Closes
1881 http://www.scipy.net/roundup/ipython/issue41.
1889 http://www.scipy.net/roundup/ipython/issue41.
1882
1890
1883 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1891 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1884
1892
1885 * IPython/iplib.py (InteractiveShell.complete): Added new
1893 * IPython/iplib.py (InteractiveShell.complete): Added new
1886 top-level completion method to expose the completion mechanism
1894 top-level completion method to expose the completion mechanism
1887 beyond readline-based environments.
1895 beyond readline-based environments.
1888
1896
1889 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1897 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1890
1898
1891 * tools/ipsvnc (svnversion): fix svnversion capture.
1899 * tools/ipsvnc (svnversion): fix svnversion capture.
1892
1900
1893 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1901 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1894 attribute to self, which was missing. Before, it was set by a
1902 attribute to self, which was missing. Before, it was set by a
1895 routine which in certain cases wasn't being called, so the
1903 routine which in certain cases wasn't being called, so the
1896 instance could end up missing the attribute. This caused a crash.
1904 instance could end up missing the attribute. This caused a crash.
1897 Closes http://www.scipy.net/roundup/ipython/issue40.
1905 Closes http://www.scipy.net/roundup/ipython/issue40.
1898
1906
1899 2005-08-16 Fernando Perez <fperez@colorado.edu>
1907 2005-08-16 Fernando Perez <fperez@colorado.edu>
1900
1908
1901 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1909 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1902 contains non-string attribute. Closes
1910 contains non-string attribute. Closes
1903 http://www.scipy.net/roundup/ipython/issue38.
1911 http://www.scipy.net/roundup/ipython/issue38.
1904
1912
1905 2005-08-14 Fernando Perez <fperez@colorado.edu>
1913 2005-08-14 Fernando Perez <fperez@colorado.edu>
1906
1914
1907 * tools/ipsvnc: Minor improvements, to add changeset info.
1915 * tools/ipsvnc: Minor improvements, to add changeset info.
1908
1916
1909 2005-08-12 Fernando Perez <fperez@colorado.edu>
1917 2005-08-12 Fernando Perez <fperez@colorado.edu>
1910
1918
1911 * IPython/iplib.py (runsource): remove self.code_to_run_src
1919 * IPython/iplib.py (runsource): remove self.code_to_run_src
1912 attribute. I realized this is nothing more than
1920 attribute. I realized this is nothing more than
1913 '\n'.join(self.buffer), and having the same data in two different
1921 '\n'.join(self.buffer), and having the same data in two different
1914 places is just asking for synchronization bugs. This may impact
1922 places is just asking for synchronization bugs. This may impact
1915 people who have custom exception handlers, so I need to warn
1923 people who have custom exception handlers, so I need to warn
1916 ipython-dev about it (F. Mantegazza may use them).
1924 ipython-dev about it (F. Mantegazza may use them).
1917
1925
1918 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1926 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1919
1927
1920 * IPython/genutils.py: fix 2.2 compatibility (generators)
1928 * IPython/genutils.py: fix 2.2 compatibility (generators)
1921
1929
1922 2005-07-18 Fernando Perez <fperez@colorado.edu>
1930 2005-07-18 Fernando Perez <fperez@colorado.edu>
1923
1931
1924 * IPython/genutils.py (get_home_dir): fix to help users with
1932 * IPython/genutils.py (get_home_dir): fix to help users with
1925 invalid $HOME under win32.
1933 invalid $HOME under win32.
1926
1934
1927 2005-07-17 Fernando Perez <fperez@colorado.edu>
1935 2005-07-17 Fernando Perez <fperez@colorado.edu>
1928
1936
1929 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1937 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1930 some old hacks and clean up a bit other routines; code should be
1938 some old hacks and clean up a bit other routines; code should be
1931 simpler and a bit faster.
1939 simpler and a bit faster.
1932
1940
1933 * IPython/iplib.py (interact): removed some last-resort attempts
1941 * IPython/iplib.py (interact): removed some last-resort attempts
1934 to survive broken stdout/stderr. That code was only making it
1942 to survive broken stdout/stderr. That code was only making it
1935 harder to abstract out the i/o (necessary for gui integration),
1943 harder to abstract out the i/o (necessary for gui integration),
1936 and the crashes it could prevent were extremely rare in practice
1944 and the crashes it could prevent were extremely rare in practice
1937 (besides being fully user-induced in a pretty violent manner).
1945 (besides being fully user-induced in a pretty violent manner).
1938
1946
1939 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1947 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1940 Nothing major yet, but the code is simpler to read; this should
1948 Nothing major yet, but the code is simpler to read; this should
1941 make it easier to do more serious modifications in the future.
1949 make it easier to do more serious modifications in the future.
1942
1950
1943 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1951 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1944 which broke in .15 (thanks to a report by Ville).
1952 which broke in .15 (thanks to a report by Ville).
1945
1953
1946 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1954 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1947 be quite correct, I know next to nothing about unicode). This
1955 be quite correct, I know next to nothing about unicode). This
1948 will allow unicode strings to be used in prompts, amongst other
1956 will allow unicode strings to be used in prompts, amongst other
1949 cases. It also will prevent ipython from crashing when unicode
1957 cases. It also will prevent ipython from crashing when unicode
1950 shows up unexpectedly in many places. If ascii encoding fails, we
1958 shows up unexpectedly in many places. If ascii encoding fails, we
1951 assume utf_8. Currently the encoding is not a user-visible
1959 assume utf_8. Currently the encoding is not a user-visible
1952 setting, though it could be made so if there is demand for it.
1960 setting, though it could be made so if there is demand for it.
1953
1961
1954 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1962 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1955
1963
1956 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1964 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1957
1965
1958 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1966 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1959
1967
1960 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1968 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1961 code can work transparently for 2.2/2.3.
1969 code can work transparently for 2.2/2.3.
1962
1970
1963 2005-07-16 Fernando Perez <fperez@colorado.edu>
1971 2005-07-16 Fernando Perez <fperez@colorado.edu>
1964
1972
1965 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1973 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1966 out of the color scheme table used for coloring exception
1974 out of the color scheme table used for coloring exception
1967 tracebacks. This allows user code to add new schemes at runtime.
1975 tracebacks. This allows user code to add new schemes at runtime.
1968 This is a minimally modified version of the patch at
1976 This is a minimally modified version of the patch at
1969 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1977 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1970 for the contribution.
1978 for the contribution.
1971
1979
1972 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1980 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1973 slightly modified version of the patch in
1981 slightly modified version of the patch in
1974 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1982 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1975 to remove the previous try/except solution (which was costlier).
1983 to remove the previous try/except solution (which was costlier).
1976 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1984 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1977
1985
1978 2005-06-08 Fernando Perez <fperez@colorado.edu>
1986 2005-06-08 Fernando Perez <fperez@colorado.edu>
1979
1987
1980 * IPython/iplib.py (write/write_err): Add methods to abstract all
1988 * IPython/iplib.py (write/write_err): Add methods to abstract all
1981 I/O a bit more.
1989 I/O a bit more.
1982
1990
1983 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1991 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1984 warning, reported by Aric Hagberg, fix by JD Hunter.
1992 warning, reported by Aric Hagberg, fix by JD Hunter.
1985
1993
1986 2005-06-02 *** Released version 0.6.15
1994 2005-06-02 *** Released version 0.6.15
1987
1995
1988 2005-06-01 Fernando Perez <fperez@colorado.edu>
1996 2005-06-01 Fernando Perez <fperez@colorado.edu>
1989
1997
1990 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1998 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1991 tab-completion of filenames within open-quoted strings. Note that
1999 tab-completion of filenames within open-quoted strings. Note that
1992 this requires that in ~/.ipython/ipythonrc, users change the
2000 this requires that in ~/.ipython/ipythonrc, users change the
1993 readline delimiters configuration to read:
2001 readline delimiters configuration to read:
1994
2002
1995 readline_remove_delims -/~
2003 readline_remove_delims -/~
1996
2004
1997
2005
1998 2005-05-31 *** Released version 0.6.14
2006 2005-05-31 *** Released version 0.6.14
1999
2007
2000 2005-05-29 Fernando Perez <fperez@colorado.edu>
2008 2005-05-29 Fernando Perez <fperez@colorado.edu>
2001
2009
2002 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2010 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2003 with files not on the filesystem. Reported by Eliyahu Sandler
2011 with files not on the filesystem. Reported by Eliyahu Sandler
2004 <eli@gondolin.net>
2012 <eli@gondolin.net>
2005
2013
2006 2005-05-22 Fernando Perez <fperez@colorado.edu>
2014 2005-05-22 Fernando Perez <fperez@colorado.edu>
2007
2015
2008 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2016 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2009 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2017 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2010
2018
2011 2005-05-19 Fernando Perez <fperez@colorado.edu>
2019 2005-05-19 Fernando Perez <fperez@colorado.edu>
2012
2020
2013 * IPython/iplib.py (safe_execfile): close a file which could be
2021 * IPython/iplib.py (safe_execfile): close a file which could be
2014 left open (causing problems in win32, which locks open files).
2022 left open (causing problems in win32, which locks open files).
2015 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2023 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2016
2024
2017 2005-05-18 Fernando Perez <fperez@colorado.edu>
2025 2005-05-18 Fernando Perez <fperez@colorado.edu>
2018
2026
2019 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2027 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2020 keyword arguments correctly to safe_execfile().
2028 keyword arguments correctly to safe_execfile().
2021
2029
2022 2005-05-13 Fernando Perez <fperez@colorado.edu>
2030 2005-05-13 Fernando Perez <fperez@colorado.edu>
2023
2031
2024 * ipython.1: Added info about Qt to manpage, and threads warning
2032 * ipython.1: Added info about Qt to manpage, and threads warning
2025 to usage page (invoked with --help).
2033 to usage page (invoked with --help).
2026
2034
2027 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2035 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2028 new matcher (it goes at the end of the priority list) to do
2036 new matcher (it goes at the end of the priority list) to do
2029 tab-completion on named function arguments. Submitted by George
2037 tab-completion on named function arguments. Submitted by George
2030 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2038 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2031 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2039 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2032 for more details.
2040 for more details.
2033
2041
2034 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2042 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2035 SystemExit exceptions in the script being run. Thanks to a report
2043 SystemExit exceptions in the script being run. Thanks to a report
2036 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2044 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2037 producing very annoying behavior when running unit tests.
2045 producing very annoying behavior when running unit tests.
2038
2046
2039 2005-05-12 Fernando Perez <fperez@colorado.edu>
2047 2005-05-12 Fernando Perez <fperez@colorado.edu>
2040
2048
2041 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2049 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2042 which I'd broken (again) due to a changed regexp. In the process,
2050 which I'd broken (again) due to a changed regexp. In the process,
2043 added ';' as an escape to auto-quote the whole line without
2051 added ';' as an escape to auto-quote the whole line without
2044 splitting its arguments. Thanks to a report by Jerry McRae
2052 splitting its arguments. Thanks to a report by Jerry McRae
2045 <qrs0xyc02-AT-sneakemail.com>.
2053 <qrs0xyc02-AT-sneakemail.com>.
2046
2054
2047 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2055 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2048 possible crashes caused by a TokenError. Reported by Ed Schofield
2056 possible crashes caused by a TokenError. Reported by Ed Schofield
2049 <schofield-AT-ftw.at>.
2057 <schofield-AT-ftw.at>.
2050
2058
2051 2005-05-06 Fernando Perez <fperez@colorado.edu>
2059 2005-05-06 Fernando Perez <fperez@colorado.edu>
2052
2060
2053 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2061 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2054
2062
2055 2005-04-29 Fernando Perez <fperez@colorado.edu>
2063 2005-04-29 Fernando Perez <fperez@colorado.edu>
2056
2064
2057 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2065 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2058 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2066 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2059 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2067 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2060 which provides support for Qt interactive usage (similar to the
2068 which provides support for Qt interactive usage (similar to the
2061 existing one for WX and GTK). This had been often requested.
2069 existing one for WX and GTK). This had been often requested.
2062
2070
2063 2005-04-14 *** Released version 0.6.13
2071 2005-04-14 *** Released version 0.6.13
2064
2072
2065 2005-04-08 Fernando Perez <fperez@colorado.edu>
2073 2005-04-08 Fernando Perez <fperez@colorado.edu>
2066
2074
2067 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2075 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2068 from _ofind, which gets called on almost every input line. Now,
2076 from _ofind, which gets called on almost every input line. Now,
2069 we only try to get docstrings if they are actually going to be
2077 we only try to get docstrings if they are actually going to be
2070 used (the overhead of fetching unnecessary docstrings can be
2078 used (the overhead of fetching unnecessary docstrings can be
2071 noticeable for certain objects, such as Pyro proxies).
2079 noticeable for certain objects, such as Pyro proxies).
2072
2080
2073 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2081 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2074 for completers. For some reason I had been passing them the state
2082 for completers. For some reason I had been passing them the state
2075 variable, which completers never actually need, and was in
2083 variable, which completers never actually need, and was in
2076 conflict with the rlcompleter API. Custom completers ONLY need to
2084 conflict with the rlcompleter API. Custom completers ONLY need to
2077 take the text parameter.
2085 take the text parameter.
2078
2086
2079 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2087 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2080 work correctly in pysh. I've also moved all the logic which used
2088 work correctly in pysh. I've also moved all the logic which used
2081 to be in pysh.py here, which will prevent problems with future
2089 to be in pysh.py here, which will prevent problems with future
2082 upgrades. However, this time I must warn users to update their
2090 upgrades. However, this time I must warn users to update their
2083 pysh profile to include the line
2091 pysh profile to include the line
2084
2092
2085 import_all IPython.Extensions.InterpreterExec
2093 import_all IPython.Extensions.InterpreterExec
2086
2094
2087 because otherwise things won't work for them. They MUST also
2095 because otherwise things won't work for them. They MUST also
2088 delete pysh.py and the line
2096 delete pysh.py and the line
2089
2097
2090 execfile pysh.py
2098 execfile pysh.py
2091
2099
2092 from their ipythonrc-pysh.
2100 from their ipythonrc-pysh.
2093
2101
2094 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2102 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2095 robust in the face of objects whose dir() returns non-strings
2103 robust in the face of objects whose dir() returns non-strings
2096 (which it shouldn't, but some broken libs like ITK do). Thanks to
2104 (which it shouldn't, but some broken libs like ITK do). Thanks to
2097 a patch by John Hunter (implemented differently, though). Also
2105 a patch by John Hunter (implemented differently, though). Also
2098 minor improvements by using .extend instead of + on lists.
2106 minor improvements by using .extend instead of + on lists.
2099
2107
2100 * pysh.py:
2108 * pysh.py:
2101
2109
2102 2005-04-06 Fernando Perez <fperez@colorado.edu>
2110 2005-04-06 Fernando Perez <fperez@colorado.edu>
2103
2111
2104 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2112 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2105 by default, so that all users benefit from it. Those who don't
2113 by default, so that all users benefit from it. Those who don't
2106 want it can still turn it off.
2114 want it can still turn it off.
2107
2115
2108 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2116 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2109 config file, I'd forgotten about this, so users were getting it
2117 config file, I'd forgotten about this, so users were getting it
2110 off by default.
2118 off by default.
2111
2119
2112 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2120 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2113 consistency. Now magics can be called in multiline statements,
2121 consistency. Now magics can be called in multiline statements,
2114 and python variables can be expanded in magic calls via $var.
2122 and python variables can be expanded in magic calls via $var.
2115 This makes the magic system behave just like aliases or !system
2123 This makes the magic system behave just like aliases or !system
2116 calls.
2124 calls.
2117
2125
2118 2005-03-28 Fernando Perez <fperez@colorado.edu>
2126 2005-03-28 Fernando Perez <fperez@colorado.edu>
2119
2127
2120 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2128 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2121 expensive string additions for building command. Add support for
2129 expensive string additions for building command. Add support for
2122 trailing ';' when autocall is used.
2130 trailing ';' when autocall is used.
2123
2131
2124 2005-03-26 Fernando Perez <fperez@colorado.edu>
2132 2005-03-26 Fernando Perez <fperez@colorado.edu>
2125
2133
2126 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2134 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2127 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2135 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2128 ipython.el robust against prompts with any number of spaces
2136 ipython.el robust against prompts with any number of spaces
2129 (including 0) after the ':' character.
2137 (including 0) after the ':' character.
2130
2138
2131 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2139 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2132 continuation prompt, which misled users to think the line was
2140 continuation prompt, which misled users to think the line was
2133 already indented. Closes debian Bug#300847, reported to me by
2141 already indented. Closes debian Bug#300847, reported to me by
2134 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2142 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2135
2143
2136 2005-03-23 Fernando Perez <fperez@colorado.edu>
2144 2005-03-23 Fernando Perez <fperez@colorado.edu>
2137
2145
2138 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2146 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2139 properly aligned if they have embedded newlines.
2147 properly aligned if they have embedded newlines.
2140
2148
2141 * IPython/iplib.py (runlines): Add a public method to expose
2149 * IPython/iplib.py (runlines): Add a public method to expose
2142 IPython's code execution machinery, so that users can run strings
2150 IPython's code execution machinery, so that users can run strings
2143 as if they had been typed at the prompt interactively.
2151 as if they had been typed at the prompt interactively.
2144 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2152 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2145 methods which can call the system shell, but with python variable
2153 methods which can call the system shell, but with python variable
2146 expansion. The three such methods are: __IPYTHON__.system,
2154 expansion. The three such methods are: __IPYTHON__.system,
2147 .getoutput and .getoutputerror. These need to be documented in a
2155 .getoutput and .getoutputerror. These need to be documented in a
2148 'public API' section (to be written) of the manual.
2156 'public API' section (to be written) of the manual.
2149
2157
2150 2005-03-20 Fernando Perez <fperez@colorado.edu>
2158 2005-03-20 Fernando Perez <fperez@colorado.edu>
2151
2159
2152 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2160 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2153 for custom exception handling. This is quite powerful, and it
2161 for custom exception handling. This is quite powerful, and it
2154 allows for user-installable exception handlers which can trap
2162 allows for user-installable exception handlers which can trap
2155 custom exceptions at runtime and treat them separately from
2163 custom exceptions at runtime and treat them separately from
2156 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2164 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2157 Mantegazza <mantegazza-AT-ill.fr>.
2165 Mantegazza <mantegazza-AT-ill.fr>.
2158 (InteractiveShell.set_custom_completer): public API function to
2166 (InteractiveShell.set_custom_completer): public API function to
2159 add new completers at runtime.
2167 add new completers at runtime.
2160
2168
2161 2005-03-19 Fernando Perez <fperez@colorado.edu>
2169 2005-03-19 Fernando Perez <fperez@colorado.edu>
2162
2170
2163 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2171 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2164 allow objects which provide their docstrings via non-standard
2172 allow objects which provide their docstrings via non-standard
2165 mechanisms (like Pyro proxies) to still be inspected by ipython's
2173 mechanisms (like Pyro proxies) to still be inspected by ipython's
2166 ? system.
2174 ? system.
2167
2175
2168 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2176 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2169 automatic capture system. I tried quite hard to make it work
2177 automatic capture system. I tried quite hard to make it work
2170 reliably, and simply failed. I tried many combinations with the
2178 reliably, and simply failed. I tried many combinations with the
2171 subprocess module, but eventually nothing worked in all needed
2179 subprocess module, but eventually nothing worked in all needed
2172 cases (not blocking stdin for the child, duplicating stdout
2180 cases (not blocking stdin for the child, duplicating stdout
2173 without blocking, etc). The new %sc/%sx still do capture to these
2181 without blocking, etc). The new %sc/%sx still do capture to these
2174 magical list/string objects which make shell use much more
2182 magical list/string objects which make shell use much more
2175 conveninent, so not all is lost.
2183 conveninent, so not all is lost.
2176
2184
2177 XXX - FIX MANUAL for the change above!
2185 XXX - FIX MANUAL for the change above!
2178
2186
2179 (runsource): I copied code.py's runsource() into ipython to modify
2187 (runsource): I copied code.py's runsource() into ipython to modify
2180 it a bit. Now the code object and source to be executed are
2188 it a bit. Now the code object and source to be executed are
2181 stored in ipython. This makes this info accessible to third-party
2189 stored in ipython. This makes this info accessible to third-party
2182 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2190 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2183 Mantegazza <mantegazza-AT-ill.fr>.
2191 Mantegazza <mantegazza-AT-ill.fr>.
2184
2192
2185 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2193 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2186 history-search via readline (like C-p/C-n). I'd wanted this for a
2194 history-search via readline (like C-p/C-n). I'd wanted this for a
2187 long time, but only recently found out how to do it. For users
2195 long time, but only recently found out how to do it. For users
2188 who already have their ipythonrc files made and want this, just
2196 who already have their ipythonrc files made and want this, just
2189 add:
2197 add:
2190
2198
2191 readline_parse_and_bind "\e[A": history-search-backward
2199 readline_parse_and_bind "\e[A": history-search-backward
2192 readline_parse_and_bind "\e[B": history-search-forward
2200 readline_parse_and_bind "\e[B": history-search-forward
2193
2201
2194 2005-03-18 Fernando Perez <fperez@colorado.edu>
2202 2005-03-18 Fernando Perez <fperez@colorado.edu>
2195
2203
2196 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2204 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2197 LSString and SList classes which allow transparent conversions
2205 LSString and SList classes which allow transparent conversions
2198 between list mode and whitespace-separated string.
2206 between list mode and whitespace-separated string.
2199 (magic_r): Fix recursion problem in %r.
2207 (magic_r): Fix recursion problem in %r.
2200
2208
2201 * IPython/genutils.py (LSString): New class to be used for
2209 * IPython/genutils.py (LSString): New class to be used for
2202 automatic storage of the results of all alias/system calls in _o
2210 automatic storage of the results of all alias/system calls in _o
2203 and _e (stdout/err). These provide a .l/.list attribute which
2211 and _e (stdout/err). These provide a .l/.list attribute which
2204 does automatic splitting on newlines. This means that for most
2212 does automatic splitting on newlines. This means that for most
2205 uses, you'll never need to do capturing of output with %sc/%sx
2213 uses, you'll never need to do capturing of output with %sc/%sx
2206 anymore, since ipython keeps this always done for you. Note that
2214 anymore, since ipython keeps this always done for you. Note that
2207 only the LAST results are stored, the _o/e variables are
2215 only the LAST results are stored, the _o/e variables are
2208 overwritten on each call. If you need to save their contents
2216 overwritten on each call. If you need to save their contents
2209 further, simply bind them to any other name.
2217 further, simply bind them to any other name.
2210
2218
2211 2005-03-17 Fernando Perez <fperez@colorado.edu>
2219 2005-03-17 Fernando Perez <fperez@colorado.edu>
2212
2220
2213 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2221 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2214 prompt namespace handling.
2222 prompt namespace handling.
2215
2223
2216 2005-03-16 Fernando Perez <fperez@colorado.edu>
2224 2005-03-16 Fernando Perez <fperez@colorado.edu>
2217
2225
2218 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2226 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2219 classic prompts to be '>>> ' (final space was missing, and it
2227 classic prompts to be '>>> ' (final space was missing, and it
2220 trips the emacs python mode).
2228 trips the emacs python mode).
2221 (BasePrompt.__str__): Added safe support for dynamic prompt
2229 (BasePrompt.__str__): Added safe support for dynamic prompt
2222 strings. Now you can set your prompt string to be '$x', and the
2230 strings. Now you can set your prompt string to be '$x', and the
2223 value of x will be printed from your interactive namespace. The
2231 value of x will be printed from your interactive namespace. The
2224 interpolation syntax includes the full Itpl support, so
2232 interpolation syntax includes the full Itpl support, so
2225 ${foo()+x+bar()} is a valid prompt string now, and the function
2233 ${foo()+x+bar()} is a valid prompt string now, and the function
2226 calls will be made at runtime.
2234 calls will be made at runtime.
2227
2235
2228 2005-03-15 Fernando Perez <fperez@colorado.edu>
2236 2005-03-15 Fernando Perez <fperez@colorado.edu>
2229
2237
2230 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2238 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2231 avoid name clashes in pylab. %hist still works, it just forwards
2239 avoid name clashes in pylab. %hist still works, it just forwards
2232 the call to %history.
2240 the call to %history.
2233
2241
2234 2005-03-02 *** Released version 0.6.12
2242 2005-03-02 *** Released version 0.6.12
2235
2243
2236 2005-03-02 Fernando Perez <fperez@colorado.edu>
2244 2005-03-02 Fernando Perez <fperez@colorado.edu>
2237
2245
2238 * IPython/iplib.py (handle_magic): log magic calls properly as
2246 * IPython/iplib.py (handle_magic): log magic calls properly as
2239 ipmagic() function calls.
2247 ipmagic() function calls.
2240
2248
2241 * IPython/Magic.py (magic_time): Improved %time to support
2249 * IPython/Magic.py (magic_time): Improved %time to support
2242 statements and provide wall-clock as well as CPU time.
2250 statements and provide wall-clock as well as CPU time.
2243
2251
2244 2005-02-27 Fernando Perez <fperez@colorado.edu>
2252 2005-02-27 Fernando Perez <fperez@colorado.edu>
2245
2253
2246 * IPython/hooks.py: New hooks module, to expose user-modifiable
2254 * IPython/hooks.py: New hooks module, to expose user-modifiable
2247 IPython functionality in a clean manner. For now only the editor
2255 IPython functionality in a clean manner. For now only the editor
2248 hook is actually written, and other thigns which I intend to turn
2256 hook is actually written, and other thigns which I intend to turn
2249 into proper hooks aren't yet there. The display and prefilter
2257 into proper hooks aren't yet there. The display and prefilter
2250 stuff, for example, should be hooks. But at least now the
2258 stuff, for example, should be hooks. But at least now the
2251 framework is in place, and the rest can be moved here with more
2259 framework is in place, and the rest can be moved here with more
2252 time later. IPython had had a .hooks variable for a long time for
2260 time later. IPython had had a .hooks variable for a long time for
2253 this purpose, but I'd never actually used it for anything.
2261 this purpose, but I'd never actually used it for anything.
2254
2262
2255 2005-02-26 Fernando Perez <fperez@colorado.edu>
2263 2005-02-26 Fernando Perez <fperez@colorado.edu>
2256
2264
2257 * IPython/ipmaker.py (make_IPython): make the default ipython
2265 * IPython/ipmaker.py (make_IPython): make the default ipython
2258 directory be called _ipython under win32, to follow more the
2266 directory be called _ipython under win32, to follow more the
2259 naming peculiarities of that platform (where buggy software like
2267 naming peculiarities of that platform (where buggy software like
2260 Visual Sourcesafe breaks with .named directories). Reported by
2268 Visual Sourcesafe breaks with .named directories). Reported by
2261 Ville Vainio.
2269 Ville Vainio.
2262
2270
2263 2005-02-23 Fernando Perez <fperez@colorado.edu>
2271 2005-02-23 Fernando Perez <fperez@colorado.edu>
2264
2272
2265 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2273 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2266 auto_aliases for win32 which were causing problems. Users can
2274 auto_aliases for win32 which were causing problems. Users can
2267 define the ones they personally like.
2275 define the ones they personally like.
2268
2276
2269 2005-02-21 Fernando Perez <fperez@colorado.edu>
2277 2005-02-21 Fernando Perez <fperez@colorado.edu>
2270
2278
2271 * IPython/Magic.py (magic_time): new magic to time execution of
2279 * IPython/Magic.py (magic_time): new magic to time execution of
2272 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2280 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2273
2281
2274 2005-02-19 Fernando Perez <fperez@colorado.edu>
2282 2005-02-19 Fernando Perez <fperez@colorado.edu>
2275
2283
2276 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2284 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2277 into keys (for prompts, for example).
2285 into keys (for prompts, for example).
2278
2286
2279 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2287 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2280 prompts in case users want them. This introduces a small behavior
2288 prompts in case users want them. This introduces a small behavior
2281 change: ipython does not automatically add a space to all prompts
2289 change: ipython does not automatically add a space to all prompts
2282 anymore. To get the old prompts with a space, users should add it
2290 anymore. To get the old prompts with a space, users should add it
2283 manually to their ipythonrc file, so for example prompt_in1 should
2291 manually to their ipythonrc file, so for example prompt_in1 should
2284 now read 'In [\#]: ' instead of 'In [\#]:'.
2292 now read 'In [\#]: ' instead of 'In [\#]:'.
2285 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2293 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2286 file) to control left-padding of secondary prompts.
2294 file) to control left-padding of secondary prompts.
2287
2295
2288 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2296 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2289 the profiler can't be imported. Fix for Debian, which removed
2297 the profiler can't be imported. Fix for Debian, which removed
2290 profile.py because of License issues. I applied a slightly
2298 profile.py because of License issues. I applied a slightly
2291 modified version of the original Debian patch at
2299 modified version of the original Debian patch at
2292 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2300 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2293
2301
2294 2005-02-17 Fernando Perez <fperez@colorado.edu>
2302 2005-02-17 Fernando Perez <fperez@colorado.edu>
2295
2303
2296 * IPython/genutils.py (native_line_ends): Fix bug which would
2304 * IPython/genutils.py (native_line_ends): Fix bug which would
2297 cause improper line-ends under win32 b/c I was not opening files
2305 cause improper line-ends under win32 b/c I was not opening files
2298 in binary mode. Bug report and fix thanks to Ville.
2306 in binary mode. Bug report and fix thanks to Ville.
2299
2307
2300 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2308 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2301 trying to catch spurious foo[1] autocalls. My fix actually broke
2309 trying to catch spurious foo[1] autocalls. My fix actually broke
2302 ',/' autoquote/call with explicit escape (bad regexp).
2310 ',/' autoquote/call with explicit escape (bad regexp).
2303
2311
2304 2005-02-15 *** Released version 0.6.11
2312 2005-02-15 *** Released version 0.6.11
2305
2313
2306 2005-02-14 Fernando Perez <fperez@colorado.edu>
2314 2005-02-14 Fernando Perez <fperez@colorado.edu>
2307
2315
2308 * IPython/background_jobs.py: New background job management
2316 * IPython/background_jobs.py: New background job management
2309 subsystem. This is implemented via a new set of classes, and
2317 subsystem. This is implemented via a new set of classes, and
2310 IPython now provides a builtin 'jobs' object for background job
2318 IPython now provides a builtin 'jobs' object for background job
2311 execution. A convenience %bg magic serves as a lightweight
2319 execution. A convenience %bg magic serves as a lightweight
2312 frontend for starting the more common type of calls. This was
2320 frontend for starting the more common type of calls. This was
2313 inspired by discussions with B. Granger and the BackgroundCommand
2321 inspired by discussions with B. Granger and the BackgroundCommand
2314 class described in the book Python Scripting for Computational
2322 class described in the book Python Scripting for Computational
2315 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2323 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2316 (although ultimately no code from this text was used, as IPython's
2324 (although ultimately no code from this text was used, as IPython's
2317 system is a separate implementation).
2325 system is a separate implementation).
2318
2326
2319 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2327 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2320 to control the completion of single/double underscore names
2328 to control the completion of single/double underscore names
2321 separately. As documented in the example ipytonrc file, the
2329 separately. As documented in the example ipytonrc file, the
2322 readline_omit__names variable can now be set to 2, to omit even
2330 readline_omit__names variable can now be set to 2, to omit even
2323 single underscore names. Thanks to a patch by Brian Wong
2331 single underscore names. Thanks to a patch by Brian Wong
2324 <BrianWong-AT-AirgoNetworks.Com>.
2332 <BrianWong-AT-AirgoNetworks.Com>.
2325 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2333 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2326 be autocalled as foo([1]) if foo were callable. A problem for
2334 be autocalled as foo([1]) if foo were callable. A problem for
2327 things which are both callable and implement __getitem__.
2335 things which are both callable and implement __getitem__.
2328 (init_readline): Fix autoindentation for win32. Thanks to a patch
2336 (init_readline): Fix autoindentation for win32. Thanks to a patch
2329 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2337 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2330
2338
2331 2005-02-12 Fernando Perez <fperez@colorado.edu>
2339 2005-02-12 Fernando Perez <fperez@colorado.edu>
2332
2340
2333 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2341 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2334 which I had written long ago to sort out user error messages which
2342 which I had written long ago to sort out user error messages which
2335 may occur during startup. This seemed like a good idea initially,
2343 may occur during startup. This seemed like a good idea initially,
2336 but it has proven a disaster in retrospect. I don't want to
2344 but it has proven a disaster in retrospect. I don't want to
2337 change much code for now, so my fix is to set the internal 'debug'
2345 change much code for now, so my fix is to set the internal 'debug'
2338 flag to true everywhere, whose only job was precisely to control
2346 flag to true everywhere, whose only job was precisely to control
2339 this subsystem. This closes issue 28 (as well as avoiding all
2347 this subsystem. This closes issue 28 (as well as avoiding all
2340 sorts of strange hangups which occur from time to time).
2348 sorts of strange hangups which occur from time to time).
2341
2349
2342 2005-02-07 Fernando Perez <fperez@colorado.edu>
2350 2005-02-07 Fernando Perez <fperez@colorado.edu>
2343
2351
2344 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2352 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2345 previous call produced a syntax error.
2353 previous call produced a syntax error.
2346
2354
2347 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2355 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2348 classes without constructor.
2356 classes without constructor.
2349
2357
2350 2005-02-06 Fernando Perez <fperez@colorado.edu>
2358 2005-02-06 Fernando Perez <fperez@colorado.edu>
2351
2359
2352 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2360 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2353 completions with the results of each matcher, so we return results
2361 completions with the results of each matcher, so we return results
2354 to the user from all namespaces. This breaks with ipython
2362 to the user from all namespaces. This breaks with ipython
2355 tradition, but I think it's a nicer behavior. Now you get all
2363 tradition, but I think it's a nicer behavior. Now you get all
2356 possible completions listed, from all possible namespaces (python,
2364 possible completions listed, from all possible namespaces (python,
2357 filesystem, magics...) After a request by John Hunter
2365 filesystem, magics...) After a request by John Hunter
2358 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2366 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2359
2367
2360 2005-02-05 Fernando Perez <fperez@colorado.edu>
2368 2005-02-05 Fernando Perez <fperez@colorado.edu>
2361
2369
2362 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2370 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2363 the call had quote characters in it (the quotes were stripped).
2371 the call had quote characters in it (the quotes were stripped).
2364
2372
2365 2005-01-31 Fernando Perez <fperez@colorado.edu>
2373 2005-01-31 Fernando Perez <fperez@colorado.edu>
2366
2374
2367 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2375 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2368 Itpl.itpl() to make the code more robust against psyco
2376 Itpl.itpl() to make the code more robust against psyco
2369 optimizations.
2377 optimizations.
2370
2378
2371 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2379 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2372 of causing an exception. Quicker, cleaner.
2380 of causing an exception. Quicker, cleaner.
2373
2381
2374 2005-01-28 Fernando Perez <fperez@colorado.edu>
2382 2005-01-28 Fernando Perez <fperez@colorado.edu>
2375
2383
2376 * scripts/ipython_win_post_install.py (install): hardcode
2384 * scripts/ipython_win_post_install.py (install): hardcode
2377 sys.prefix+'python.exe' as the executable path. It turns out that
2385 sys.prefix+'python.exe' as the executable path. It turns out that
2378 during the post-installation run, sys.executable resolves to the
2386 during the post-installation run, sys.executable resolves to the
2379 name of the binary installer! I should report this as a distutils
2387 name of the binary installer! I should report this as a distutils
2380 bug, I think. I updated the .10 release with this tiny fix, to
2388 bug, I think. I updated the .10 release with this tiny fix, to
2381 avoid annoying the lists further.
2389 avoid annoying the lists further.
2382
2390
2383 2005-01-27 *** Released version 0.6.10
2391 2005-01-27 *** Released version 0.6.10
2384
2392
2385 2005-01-27 Fernando Perez <fperez@colorado.edu>
2393 2005-01-27 Fernando Perez <fperez@colorado.edu>
2386
2394
2387 * IPython/numutils.py (norm): Added 'inf' as optional name for
2395 * IPython/numutils.py (norm): Added 'inf' as optional name for
2388 L-infinity norm, included references to mathworld.com for vector
2396 L-infinity norm, included references to mathworld.com for vector
2389 norm definitions.
2397 norm definitions.
2390 (amin/amax): added amin/amax for array min/max. Similar to what
2398 (amin/amax): added amin/amax for array min/max. Similar to what
2391 pylab ships with after the recent reorganization of names.
2399 pylab ships with after the recent reorganization of names.
2392 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2400 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2393
2401
2394 * ipython.el: committed Alex's recent fixes and improvements.
2402 * ipython.el: committed Alex's recent fixes and improvements.
2395 Tested with python-mode from CVS, and it looks excellent. Since
2403 Tested with python-mode from CVS, and it looks excellent. Since
2396 python-mode hasn't released anything in a while, I'm temporarily
2404 python-mode hasn't released anything in a while, I'm temporarily
2397 putting a copy of today's CVS (v 4.70) of python-mode in:
2405 putting a copy of today's CVS (v 4.70) of python-mode in:
2398 http://ipython.scipy.org/tmp/python-mode.el
2406 http://ipython.scipy.org/tmp/python-mode.el
2399
2407
2400 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2408 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2401 sys.executable for the executable name, instead of assuming it's
2409 sys.executable for the executable name, instead of assuming it's
2402 called 'python.exe' (the post-installer would have produced broken
2410 called 'python.exe' (the post-installer would have produced broken
2403 setups on systems with a differently named python binary).
2411 setups on systems with a differently named python binary).
2404
2412
2405 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2413 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2406 references to os.linesep, to make the code more
2414 references to os.linesep, to make the code more
2407 platform-independent. This is also part of the win32 coloring
2415 platform-independent. This is also part of the win32 coloring
2408 fixes.
2416 fixes.
2409
2417
2410 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2418 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2411 lines, which actually cause coloring bugs because the length of
2419 lines, which actually cause coloring bugs because the length of
2412 the line is very difficult to correctly compute with embedded
2420 the line is very difficult to correctly compute with embedded
2413 escapes. This was the source of all the coloring problems under
2421 escapes. This was the source of all the coloring problems under
2414 Win32. I think that _finally_, Win32 users have a properly
2422 Win32. I think that _finally_, Win32 users have a properly
2415 working ipython in all respects. This would never have happened
2423 working ipython in all respects. This would never have happened
2416 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2424 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2417
2425
2418 2005-01-26 *** Released version 0.6.9
2426 2005-01-26 *** Released version 0.6.9
2419
2427
2420 2005-01-25 Fernando Perez <fperez@colorado.edu>
2428 2005-01-25 Fernando Perez <fperez@colorado.edu>
2421
2429
2422 * setup.py: finally, we have a true Windows installer, thanks to
2430 * setup.py: finally, we have a true Windows installer, thanks to
2423 the excellent work of Viktor Ransmayr
2431 the excellent work of Viktor Ransmayr
2424 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2432 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2425 Windows users. The setup routine is quite a bit cleaner thanks to
2433 Windows users. The setup routine is quite a bit cleaner thanks to
2426 this, and the post-install script uses the proper functions to
2434 this, and the post-install script uses the proper functions to
2427 allow a clean de-installation using the standard Windows Control
2435 allow a clean de-installation using the standard Windows Control
2428 Panel.
2436 Panel.
2429
2437
2430 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2438 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2431 environment variable under all OSes (including win32) if
2439 environment variable under all OSes (including win32) if
2432 available. This will give consistency to win32 users who have set
2440 available. This will give consistency to win32 users who have set
2433 this variable for any reason. If os.environ['HOME'] fails, the
2441 this variable for any reason. If os.environ['HOME'] fails, the
2434 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2442 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2435
2443
2436 2005-01-24 Fernando Perez <fperez@colorado.edu>
2444 2005-01-24 Fernando Perez <fperez@colorado.edu>
2437
2445
2438 * IPython/numutils.py (empty_like): add empty_like(), similar to
2446 * IPython/numutils.py (empty_like): add empty_like(), similar to
2439 zeros_like() but taking advantage of the new empty() Numeric routine.
2447 zeros_like() but taking advantage of the new empty() Numeric routine.
2440
2448
2441 2005-01-23 *** Released version 0.6.8
2449 2005-01-23 *** Released version 0.6.8
2442
2450
2443 2005-01-22 Fernando Perez <fperez@colorado.edu>
2451 2005-01-22 Fernando Perez <fperez@colorado.edu>
2444
2452
2445 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2453 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2446 automatic show() calls. After discussing things with JDH, it
2454 automatic show() calls. After discussing things with JDH, it
2447 turns out there are too many corner cases where this can go wrong.
2455 turns out there are too many corner cases where this can go wrong.
2448 It's best not to try to be 'too smart', and simply have ipython
2456 It's best not to try to be 'too smart', and simply have ipython
2449 reproduce as much as possible the default behavior of a normal
2457 reproduce as much as possible the default behavior of a normal
2450 python shell.
2458 python shell.
2451
2459
2452 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2460 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2453 line-splitting regexp and _prefilter() to avoid calling getattr()
2461 line-splitting regexp and _prefilter() to avoid calling getattr()
2454 on assignments. This closes
2462 on assignments. This closes
2455 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2463 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2456 readline uses getattr(), so a simple <TAB> keypress is still
2464 readline uses getattr(), so a simple <TAB> keypress is still
2457 enough to trigger getattr() calls on an object.
2465 enough to trigger getattr() calls on an object.
2458
2466
2459 2005-01-21 Fernando Perez <fperez@colorado.edu>
2467 2005-01-21 Fernando Perez <fperez@colorado.edu>
2460
2468
2461 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2469 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2462 docstring under pylab so it doesn't mask the original.
2470 docstring under pylab so it doesn't mask the original.
2463
2471
2464 2005-01-21 *** Released version 0.6.7
2472 2005-01-21 *** Released version 0.6.7
2465
2473
2466 2005-01-21 Fernando Perez <fperez@colorado.edu>
2474 2005-01-21 Fernando Perez <fperez@colorado.edu>
2467
2475
2468 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2476 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2469 signal handling for win32 users in multithreaded mode.
2477 signal handling for win32 users in multithreaded mode.
2470
2478
2471 2005-01-17 Fernando Perez <fperez@colorado.edu>
2479 2005-01-17 Fernando Perez <fperez@colorado.edu>
2472
2480
2473 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2481 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2474 instances with no __init__. After a crash report by Norbert Nemec
2482 instances with no __init__. After a crash report by Norbert Nemec
2475 <Norbert-AT-nemec-online.de>.
2483 <Norbert-AT-nemec-online.de>.
2476
2484
2477 2005-01-14 Fernando Perez <fperez@colorado.edu>
2485 2005-01-14 Fernando Perez <fperez@colorado.edu>
2478
2486
2479 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2487 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2480 names for verbose exceptions, when multiple dotted names and the
2488 names for verbose exceptions, when multiple dotted names and the
2481 'parent' object were present on the same line.
2489 'parent' object were present on the same line.
2482
2490
2483 2005-01-11 Fernando Perez <fperez@colorado.edu>
2491 2005-01-11 Fernando Perez <fperez@colorado.edu>
2484
2492
2485 * IPython/genutils.py (flag_calls): new utility to trap and flag
2493 * IPython/genutils.py (flag_calls): new utility to trap and flag
2486 calls in functions. I need it to clean up matplotlib support.
2494 calls in functions. I need it to clean up matplotlib support.
2487 Also removed some deprecated code in genutils.
2495 Also removed some deprecated code in genutils.
2488
2496
2489 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2497 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2490 that matplotlib scripts called with %run, which don't call show()
2498 that matplotlib scripts called with %run, which don't call show()
2491 themselves, still have their plotting windows open.
2499 themselves, still have their plotting windows open.
2492
2500
2493 2005-01-05 Fernando Perez <fperez@colorado.edu>
2501 2005-01-05 Fernando Perez <fperez@colorado.edu>
2494
2502
2495 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2503 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2496 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2504 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2497
2505
2498 2004-12-19 Fernando Perez <fperez@colorado.edu>
2506 2004-12-19 Fernando Perez <fperez@colorado.edu>
2499
2507
2500 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2508 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2501 parent_runcode, which was an eyesore. The same result can be
2509 parent_runcode, which was an eyesore. The same result can be
2502 obtained with Python's regular superclass mechanisms.
2510 obtained with Python's regular superclass mechanisms.
2503
2511
2504 2004-12-17 Fernando Perez <fperez@colorado.edu>
2512 2004-12-17 Fernando Perez <fperez@colorado.edu>
2505
2513
2506 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2514 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2507 reported by Prabhu.
2515 reported by Prabhu.
2508 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2516 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2509 sys.stderr) instead of explicitly calling sys.stderr. This helps
2517 sys.stderr) instead of explicitly calling sys.stderr. This helps
2510 maintain our I/O abstractions clean, for future GUI embeddings.
2518 maintain our I/O abstractions clean, for future GUI embeddings.
2511
2519
2512 * IPython/genutils.py (info): added new utility for sys.stderr
2520 * IPython/genutils.py (info): added new utility for sys.stderr
2513 unified info message handling (thin wrapper around warn()).
2521 unified info message handling (thin wrapper around warn()).
2514
2522
2515 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2523 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2516 composite (dotted) names on verbose exceptions.
2524 composite (dotted) names on verbose exceptions.
2517 (VerboseTB.nullrepr): harden against another kind of errors which
2525 (VerboseTB.nullrepr): harden against another kind of errors which
2518 Python's inspect module can trigger, and which were crashing
2526 Python's inspect module can trigger, and which were crashing
2519 IPython. Thanks to a report by Marco Lombardi
2527 IPython. Thanks to a report by Marco Lombardi
2520 <mlombard-AT-ma010192.hq.eso.org>.
2528 <mlombard-AT-ma010192.hq.eso.org>.
2521
2529
2522 2004-12-13 *** Released version 0.6.6
2530 2004-12-13 *** Released version 0.6.6
2523
2531
2524 2004-12-12 Fernando Perez <fperez@colorado.edu>
2532 2004-12-12 Fernando Perez <fperez@colorado.edu>
2525
2533
2526 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2534 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2527 generated by pygtk upon initialization if it was built without
2535 generated by pygtk upon initialization if it was built without
2528 threads (for matplotlib users). After a crash reported by
2536 threads (for matplotlib users). After a crash reported by
2529 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2537 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2530
2538
2531 * IPython/ipmaker.py (make_IPython): fix small bug in the
2539 * IPython/ipmaker.py (make_IPython): fix small bug in the
2532 import_some parameter for multiple imports.
2540 import_some parameter for multiple imports.
2533
2541
2534 * IPython/iplib.py (ipmagic): simplified the interface of
2542 * IPython/iplib.py (ipmagic): simplified the interface of
2535 ipmagic() to take a single string argument, just as it would be
2543 ipmagic() to take a single string argument, just as it would be
2536 typed at the IPython cmd line.
2544 typed at the IPython cmd line.
2537 (ipalias): Added new ipalias() with an interface identical to
2545 (ipalias): Added new ipalias() with an interface identical to
2538 ipmagic(). This completes exposing a pure python interface to the
2546 ipmagic(). This completes exposing a pure python interface to the
2539 alias and magic system, which can be used in loops or more complex
2547 alias and magic system, which can be used in loops or more complex
2540 code where IPython's automatic line mangling is not active.
2548 code where IPython's automatic line mangling is not active.
2541
2549
2542 * IPython/genutils.py (timing): changed interface of timing to
2550 * IPython/genutils.py (timing): changed interface of timing to
2543 simply run code once, which is the most common case. timings()
2551 simply run code once, which is the most common case. timings()
2544 remains unchanged, for the cases where you want multiple runs.
2552 remains unchanged, for the cases where you want multiple runs.
2545
2553
2546 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2554 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2547 bug where Python2.2 crashes with exec'ing code which does not end
2555 bug where Python2.2 crashes with exec'ing code which does not end
2548 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2556 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2549 before.
2557 before.
2550
2558
2551 2004-12-10 Fernando Perez <fperez@colorado.edu>
2559 2004-12-10 Fernando Perez <fperez@colorado.edu>
2552
2560
2553 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2561 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2554 -t to -T, to accomodate the new -t flag in %run (the %run and
2562 -t to -T, to accomodate the new -t flag in %run (the %run and
2555 %prun options are kind of intermixed, and it's not easy to change
2563 %prun options are kind of intermixed, and it's not easy to change
2556 this with the limitations of python's getopt).
2564 this with the limitations of python's getopt).
2557
2565
2558 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2566 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2559 the execution of scripts. It's not as fine-tuned as timeit.py,
2567 the execution of scripts. It's not as fine-tuned as timeit.py,
2560 but it works from inside ipython (and under 2.2, which lacks
2568 but it works from inside ipython (and under 2.2, which lacks
2561 timeit.py). Optionally a number of runs > 1 can be given for
2569 timeit.py). Optionally a number of runs > 1 can be given for
2562 timing very short-running code.
2570 timing very short-running code.
2563
2571
2564 * IPython/genutils.py (uniq_stable): new routine which returns a
2572 * IPython/genutils.py (uniq_stable): new routine which returns a
2565 list of unique elements in any iterable, but in stable order of
2573 list of unique elements in any iterable, but in stable order of
2566 appearance. I needed this for the ultraTB fixes, and it's a handy
2574 appearance. I needed this for the ultraTB fixes, and it's a handy
2567 utility.
2575 utility.
2568
2576
2569 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2577 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2570 dotted names in Verbose exceptions. This had been broken since
2578 dotted names in Verbose exceptions. This had been broken since
2571 the very start, now x.y will properly be printed in a Verbose
2579 the very start, now x.y will properly be printed in a Verbose
2572 traceback, instead of x being shown and y appearing always as an
2580 traceback, instead of x being shown and y appearing always as an
2573 'undefined global'. Getting this to work was a bit tricky,
2581 'undefined global'. Getting this to work was a bit tricky,
2574 because by default python tokenizers are stateless. Saved by
2582 because by default python tokenizers are stateless. Saved by
2575 python's ability to easily add a bit of state to an arbitrary
2583 python's ability to easily add a bit of state to an arbitrary
2576 function (without needing to build a full-blown callable object).
2584 function (without needing to build a full-blown callable object).
2577
2585
2578 Also big cleanup of this code, which had horrendous runtime
2586 Also big cleanup of this code, which had horrendous runtime
2579 lookups of zillions of attributes for colorization. Moved all
2587 lookups of zillions of attributes for colorization. Moved all
2580 this code into a few templates, which make it cleaner and quicker.
2588 this code into a few templates, which make it cleaner and quicker.
2581
2589
2582 Printout quality was also improved for Verbose exceptions: one
2590 Printout quality was also improved for Verbose exceptions: one
2583 variable per line, and memory addresses are printed (this can be
2591 variable per line, and memory addresses are printed (this can be
2584 quite handy in nasty debugging situations, which is what Verbose
2592 quite handy in nasty debugging situations, which is what Verbose
2585 is for).
2593 is for).
2586
2594
2587 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2595 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2588 the command line as scripts to be loaded by embedded instances.
2596 the command line as scripts to be loaded by embedded instances.
2589 Doing so has the potential for an infinite recursion if there are
2597 Doing so has the potential for an infinite recursion if there are
2590 exceptions thrown in the process. This fixes a strange crash
2598 exceptions thrown in the process. This fixes a strange crash
2591 reported by Philippe MULLER <muller-AT-irit.fr>.
2599 reported by Philippe MULLER <muller-AT-irit.fr>.
2592
2600
2593 2004-12-09 Fernando Perez <fperez@colorado.edu>
2601 2004-12-09 Fernando Perez <fperez@colorado.edu>
2594
2602
2595 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2603 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2596 to reflect new names in matplotlib, which now expose the
2604 to reflect new names in matplotlib, which now expose the
2597 matlab-compatible interface via a pylab module instead of the
2605 matlab-compatible interface via a pylab module instead of the
2598 'matlab' name. The new code is backwards compatible, so users of
2606 'matlab' name. The new code is backwards compatible, so users of
2599 all matplotlib versions are OK. Patch by J. Hunter.
2607 all matplotlib versions are OK. Patch by J. Hunter.
2600
2608
2601 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2609 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2602 of __init__ docstrings for instances (class docstrings are already
2610 of __init__ docstrings for instances (class docstrings are already
2603 automatically printed). Instances with customized docstrings
2611 automatically printed). Instances with customized docstrings
2604 (indep. of the class) are also recognized and all 3 separate
2612 (indep. of the class) are also recognized and all 3 separate
2605 docstrings are printed (instance, class, constructor). After some
2613 docstrings are printed (instance, class, constructor). After some
2606 comments/suggestions by J. Hunter.
2614 comments/suggestions by J. Hunter.
2607
2615
2608 2004-12-05 Fernando Perez <fperez@colorado.edu>
2616 2004-12-05 Fernando Perez <fperez@colorado.edu>
2609
2617
2610 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2618 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2611 warnings when tab-completion fails and triggers an exception.
2619 warnings when tab-completion fails and triggers an exception.
2612
2620
2613 2004-12-03 Fernando Perez <fperez@colorado.edu>
2621 2004-12-03 Fernando Perez <fperez@colorado.edu>
2614
2622
2615 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2623 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2616 be triggered when using 'run -p'. An incorrect option flag was
2624 be triggered when using 'run -p'. An incorrect option flag was
2617 being set ('d' instead of 'D').
2625 being set ('d' instead of 'D').
2618 (manpage): fix missing escaped \- sign.
2626 (manpage): fix missing escaped \- sign.
2619
2627
2620 2004-11-30 *** Released version 0.6.5
2628 2004-11-30 *** Released version 0.6.5
2621
2629
2622 2004-11-30 Fernando Perez <fperez@colorado.edu>
2630 2004-11-30 Fernando Perez <fperez@colorado.edu>
2623
2631
2624 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2632 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2625 setting with -d option.
2633 setting with -d option.
2626
2634
2627 * setup.py (docfiles): Fix problem where the doc glob I was using
2635 * setup.py (docfiles): Fix problem where the doc glob I was using
2628 was COMPLETELY BROKEN. It was giving the right files by pure
2636 was COMPLETELY BROKEN. It was giving the right files by pure
2629 accident, but failed once I tried to include ipython.el. Note:
2637 accident, but failed once I tried to include ipython.el. Note:
2630 glob() does NOT allow you to do exclusion on multiple endings!
2638 glob() does NOT allow you to do exclusion on multiple endings!
2631
2639
2632 2004-11-29 Fernando Perez <fperez@colorado.edu>
2640 2004-11-29 Fernando Perez <fperez@colorado.edu>
2633
2641
2634 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2642 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2635 the manpage as the source. Better formatting & consistency.
2643 the manpage as the source. Better formatting & consistency.
2636
2644
2637 * IPython/Magic.py (magic_run): Added new -d option, to run
2645 * IPython/Magic.py (magic_run): Added new -d option, to run
2638 scripts under the control of the python pdb debugger. Note that
2646 scripts under the control of the python pdb debugger. Note that
2639 this required changing the %prun option -d to -D, to avoid a clash
2647 this required changing the %prun option -d to -D, to avoid a clash
2640 (since %run must pass options to %prun, and getopt is too dumb to
2648 (since %run must pass options to %prun, and getopt is too dumb to
2641 handle options with string values with embedded spaces). Thanks
2649 handle options with string values with embedded spaces). Thanks
2642 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2650 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2643 (magic_who_ls): added type matching to %who and %whos, so that one
2651 (magic_who_ls): added type matching to %who and %whos, so that one
2644 can filter their output to only include variables of certain
2652 can filter their output to only include variables of certain
2645 types. Another suggestion by Matthew.
2653 types. Another suggestion by Matthew.
2646 (magic_whos): Added memory summaries in kb and Mb for arrays.
2654 (magic_whos): Added memory summaries in kb and Mb for arrays.
2647 (magic_who): Improve formatting (break lines every 9 vars).
2655 (magic_who): Improve formatting (break lines every 9 vars).
2648
2656
2649 2004-11-28 Fernando Perez <fperez@colorado.edu>
2657 2004-11-28 Fernando Perez <fperez@colorado.edu>
2650
2658
2651 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2659 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2652 cache when empty lines were present.
2660 cache when empty lines were present.
2653
2661
2654 2004-11-24 Fernando Perez <fperez@colorado.edu>
2662 2004-11-24 Fernando Perez <fperez@colorado.edu>
2655
2663
2656 * IPython/usage.py (__doc__): document the re-activated threading
2664 * IPython/usage.py (__doc__): document the re-activated threading
2657 options for WX and GTK.
2665 options for WX and GTK.
2658
2666
2659 2004-11-23 Fernando Perez <fperez@colorado.edu>
2667 2004-11-23 Fernando Perez <fperez@colorado.edu>
2660
2668
2661 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2669 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2662 the -wthread and -gthread options, along with a new -tk one to try
2670 the -wthread and -gthread options, along with a new -tk one to try
2663 and coordinate Tk threading with wx/gtk. The tk support is very
2671 and coordinate Tk threading with wx/gtk. The tk support is very
2664 platform dependent, since it seems to require Tcl and Tk to be
2672 platform dependent, since it seems to require Tcl and Tk to be
2665 built with threads (Fedora1/2 appears NOT to have it, but in
2673 built with threads (Fedora1/2 appears NOT to have it, but in
2666 Prabhu's Debian boxes it works OK). But even with some Tk
2674 Prabhu's Debian boxes it works OK). But even with some Tk
2667 limitations, this is a great improvement.
2675 limitations, this is a great improvement.
2668
2676
2669 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2677 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2670 info in user prompts. Patch by Prabhu.
2678 info in user prompts. Patch by Prabhu.
2671
2679
2672 2004-11-18 Fernando Perez <fperez@colorado.edu>
2680 2004-11-18 Fernando Perez <fperez@colorado.edu>
2673
2681
2674 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2682 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2675 EOFErrors and bail, to avoid infinite loops if a non-terminating
2683 EOFErrors and bail, to avoid infinite loops if a non-terminating
2676 file is fed into ipython. Patch submitted in issue 19 by user,
2684 file is fed into ipython. Patch submitted in issue 19 by user,
2677 many thanks.
2685 many thanks.
2678
2686
2679 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2687 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2680 autoquote/parens in continuation prompts, which can cause lots of
2688 autoquote/parens in continuation prompts, which can cause lots of
2681 problems. Closes roundup issue 20.
2689 problems. Closes roundup issue 20.
2682
2690
2683 2004-11-17 Fernando Perez <fperez@colorado.edu>
2691 2004-11-17 Fernando Perez <fperez@colorado.edu>
2684
2692
2685 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2693 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2686 reported as debian bug #280505. I'm not sure my local changelog
2694 reported as debian bug #280505. I'm not sure my local changelog
2687 entry has the proper debian format (Jack?).
2695 entry has the proper debian format (Jack?).
2688
2696
2689 2004-11-08 *** Released version 0.6.4
2697 2004-11-08 *** Released version 0.6.4
2690
2698
2691 2004-11-08 Fernando Perez <fperez@colorado.edu>
2699 2004-11-08 Fernando Perez <fperez@colorado.edu>
2692
2700
2693 * IPython/iplib.py (init_readline): Fix exit message for Windows
2701 * IPython/iplib.py (init_readline): Fix exit message for Windows
2694 when readline is active. Thanks to a report by Eric Jones
2702 when readline is active. Thanks to a report by Eric Jones
2695 <eric-AT-enthought.com>.
2703 <eric-AT-enthought.com>.
2696
2704
2697 2004-11-07 Fernando Perez <fperez@colorado.edu>
2705 2004-11-07 Fernando Perez <fperez@colorado.edu>
2698
2706
2699 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2707 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2700 sometimes seen by win2k/cygwin users.
2708 sometimes seen by win2k/cygwin users.
2701
2709
2702 2004-11-06 Fernando Perez <fperez@colorado.edu>
2710 2004-11-06 Fernando Perez <fperez@colorado.edu>
2703
2711
2704 * IPython/iplib.py (interact): Change the handling of %Exit from
2712 * IPython/iplib.py (interact): Change the handling of %Exit from
2705 trying to propagate a SystemExit to an internal ipython flag.
2713 trying to propagate a SystemExit to an internal ipython flag.
2706 This is less elegant than using Python's exception mechanism, but
2714 This is less elegant than using Python's exception mechanism, but
2707 I can't get that to work reliably with threads, so under -pylab
2715 I can't get that to work reliably with threads, so under -pylab
2708 %Exit was hanging IPython. Cross-thread exception handling is
2716 %Exit was hanging IPython. Cross-thread exception handling is
2709 really a bitch. Thaks to a bug report by Stephen Walton
2717 really a bitch. Thaks to a bug report by Stephen Walton
2710 <stephen.walton-AT-csun.edu>.
2718 <stephen.walton-AT-csun.edu>.
2711
2719
2712 2004-11-04 Fernando Perez <fperez@colorado.edu>
2720 2004-11-04 Fernando Perez <fperez@colorado.edu>
2713
2721
2714 * IPython/iplib.py (raw_input_original): store a pointer to the
2722 * IPython/iplib.py (raw_input_original): store a pointer to the
2715 true raw_input to harden against code which can modify it
2723 true raw_input to harden against code which can modify it
2716 (wx.py.PyShell does this and would otherwise crash ipython).
2724 (wx.py.PyShell does this and would otherwise crash ipython).
2717 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2725 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2718
2726
2719 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2727 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2720 Ctrl-C problem, which does not mess up the input line.
2728 Ctrl-C problem, which does not mess up the input line.
2721
2729
2722 2004-11-03 Fernando Perez <fperez@colorado.edu>
2730 2004-11-03 Fernando Perez <fperez@colorado.edu>
2723
2731
2724 * IPython/Release.py: Changed licensing to BSD, in all files.
2732 * IPython/Release.py: Changed licensing to BSD, in all files.
2725 (name): lowercase name for tarball/RPM release.
2733 (name): lowercase name for tarball/RPM release.
2726
2734
2727 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2735 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2728 use throughout ipython.
2736 use throughout ipython.
2729
2737
2730 * IPython/Magic.py (Magic._ofind): Switch to using the new
2738 * IPython/Magic.py (Magic._ofind): Switch to using the new
2731 OInspect.getdoc() function.
2739 OInspect.getdoc() function.
2732
2740
2733 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2741 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2734 of the line currently being canceled via Ctrl-C. It's extremely
2742 of the line currently being canceled via Ctrl-C. It's extremely
2735 ugly, but I don't know how to do it better (the problem is one of
2743 ugly, but I don't know how to do it better (the problem is one of
2736 handling cross-thread exceptions).
2744 handling cross-thread exceptions).
2737
2745
2738 2004-10-28 Fernando Perez <fperez@colorado.edu>
2746 2004-10-28 Fernando Perez <fperez@colorado.edu>
2739
2747
2740 * IPython/Shell.py (signal_handler): add signal handlers to trap
2748 * IPython/Shell.py (signal_handler): add signal handlers to trap
2741 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2749 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2742 report by Francesc Alted.
2750 report by Francesc Alted.
2743
2751
2744 2004-10-21 Fernando Perez <fperez@colorado.edu>
2752 2004-10-21 Fernando Perez <fperez@colorado.edu>
2745
2753
2746 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2754 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2747 to % for pysh syntax extensions.
2755 to % for pysh syntax extensions.
2748
2756
2749 2004-10-09 Fernando Perez <fperez@colorado.edu>
2757 2004-10-09 Fernando Perez <fperez@colorado.edu>
2750
2758
2751 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2759 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2752 arrays to print a more useful summary, without calling str(arr).
2760 arrays to print a more useful summary, without calling str(arr).
2753 This avoids the problem of extremely lengthy computations which
2761 This avoids the problem of extremely lengthy computations which
2754 occur if arr is large, and appear to the user as a system lockup
2762 occur if arr is large, and appear to the user as a system lockup
2755 with 100% cpu activity. After a suggestion by Kristian Sandberg
2763 with 100% cpu activity. After a suggestion by Kristian Sandberg
2756 <Kristian.Sandberg@colorado.edu>.
2764 <Kristian.Sandberg@colorado.edu>.
2757 (Magic.__init__): fix bug in global magic escapes not being
2765 (Magic.__init__): fix bug in global magic escapes not being
2758 correctly set.
2766 correctly set.
2759
2767
2760 2004-10-08 Fernando Perez <fperez@colorado.edu>
2768 2004-10-08 Fernando Perez <fperez@colorado.edu>
2761
2769
2762 * IPython/Magic.py (__license__): change to absolute imports of
2770 * IPython/Magic.py (__license__): change to absolute imports of
2763 ipython's own internal packages, to start adapting to the absolute
2771 ipython's own internal packages, to start adapting to the absolute
2764 import requirement of PEP-328.
2772 import requirement of PEP-328.
2765
2773
2766 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2774 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2767 files, and standardize author/license marks through the Release
2775 files, and standardize author/license marks through the Release
2768 module instead of having per/file stuff (except for files with
2776 module instead of having per/file stuff (except for files with
2769 particular licenses, like the MIT/PSF-licensed codes).
2777 particular licenses, like the MIT/PSF-licensed codes).
2770
2778
2771 * IPython/Debugger.py: remove dead code for python 2.1
2779 * IPython/Debugger.py: remove dead code for python 2.1
2772
2780
2773 2004-10-04 Fernando Perez <fperez@colorado.edu>
2781 2004-10-04 Fernando Perez <fperez@colorado.edu>
2774
2782
2775 * IPython/iplib.py (ipmagic): New function for accessing magics
2783 * IPython/iplib.py (ipmagic): New function for accessing magics
2776 via a normal python function call.
2784 via a normal python function call.
2777
2785
2778 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2786 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2779 from '@' to '%', to accomodate the new @decorator syntax of python
2787 from '@' to '%', to accomodate the new @decorator syntax of python
2780 2.4.
2788 2.4.
2781
2789
2782 2004-09-29 Fernando Perez <fperez@colorado.edu>
2790 2004-09-29 Fernando Perez <fperez@colorado.edu>
2783
2791
2784 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2792 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2785 matplotlib.use to prevent running scripts which try to switch
2793 matplotlib.use to prevent running scripts which try to switch
2786 interactive backends from within ipython. This will just crash
2794 interactive backends from within ipython. This will just crash
2787 the python interpreter, so we can't allow it (but a detailed error
2795 the python interpreter, so we can't allow it (but a detailed error
2788 is given to the user).
2796 is given to the user).
2789
2797
2790 2004-09-28 Fernando Perez <fperez@colorado.edu>
2798 2004-09-28 Fernando Perez <fperez@colorado.edu>
2791
2799
2792 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2800 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2793 matplotlib-related fixes so that using @run with non-matplotlib
2801 matplotlib-related fixes so that using @run with non-matplotlib
2794 scripts doesn't pop up spurious plot windows. This requires
2802 scripts doesn't pop up spurious plot windows. This requires
2795 matplotlib >= 0.63, where I had to make some changes as well.
2803 matplotlib >= 0.63, where I had to make some changes as well.
2796
2804
2797 * IPython/ipmaker.py (make_IPython): update version requirement to
2805 * IPython/ipmaker.py (make_IPython): update version requirement to
2798 python 2.2.
2806 python 2.2.
2799
2807
2800 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2808 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2801 banner arg for embedded customization.
2809 banner arg for embedded customization.
2802
2810
2803 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2811 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2804 explicit uses of __IP as the IPython's instance name. Now things
2812 explicit uses of __IP as the IPython's instance name. Now things
2805 are properly handled via the shell.name value. The actual code
2813 are properly handled via the shell.name value. The actual code
2806 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2814 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2807 is much better than before. I'll clean things completely when the
2815 is much better than before. I'll clean things completely when the
2808 magic stuff gets a real overhaul.
2816 magic stuff gets a real overhaul.
2809
2817
2810 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2818 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2811 minor changes to debian dir.
2819 minor changes to debian dir.
2812
2820
2813 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2821 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2814 pointer to the shell itself in the interactive namespace even when
2822 pointer to the shell itself in the interactive namespace even when
2815 a user-supplied dict is provided. This is needed for embedding
2823 a user-supplied dict is provided. This is needed for embedding
2816 purposes (found by tests with Michel Sanner).
2824 purposes (found by tests with Michel Sanner).
2817
2825
2818 2004-09-27 Fernando Perez <fperez@colorado.edu>
2826 2004-09-27 Fernando Perez <fperez@colorado.edu>
2819
2827
2820 * IPython/UserConfig/ipythonrc: remove []{} from
2828 * IPython/UserConfig/ipythonrc: remove []{} from
2821 readline_remove_delims, so that things like [modname.<TAB> do
2829 readline_remove_delims, so that things like [modname.<TAB> do
2822 proper completion. This disables [].TAB, but that's a less common
2830 proper completion. This disables [].TAB, but that's a less common
2823 case than module names in list comprehensions, for example.
2831 case than module names in list comprehensions, for example.
2824 Thanks to a report by Andrea Riciputi.
2832 Thanks to a report by Andrea Riciputi.
2825
2833
2826 2004-09-09 Fernando Perez <fperez@colorado.edu>
2834 2004-09-09 Fernando Perez <fperez@colorado.edu>
2827
2835
2828 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2836 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2829 blocking problems in win32 and osx. Fix by John.
2837 blocking problems in win32 and osx. Fix by John.
2830
2838
2831 2004-09-08 Fernando Perez <fperez@colorado.edu>
2839 2004-09-08 Fernando Perez <fperez@colorado.edu>
2832
2840
2833 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2841 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2834 for Win32 and OSX. Fix by John Hunter.
2842 for Win32 and OSX. Fix by John Hunter.
2835
2843
2836 2004-08-30 *** Released version 0.6.3
2844 2004-08-30 *** Released version 0.6.3
2837
2845
2838 2004-08-30 Fernando Perez <fperez@colorado.edu>
2846 2004-08-30 Fernando Perez <fperez@colorado.edu>
2839
2847
2840 * setup.py (isfile): Add manpages to list of dependent files to be
2848 * setup.py (isfile): Add manpages to list of dependent files to be
2841 updated.
2849 updated.
2842
2850
2843 2004-08-27 Fernando Perez <fperez@colorado.edu>
2851 2004-08-27 Fernando Perez <fperez@colorado.edu>
2844
2852
2845 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2853 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2846 for now. They don't really work with standalone WX/GTK code
2854 for now. They don't really work with standalone WX/GTK code
2847 (though matplotlib IS working fine with both of those backends).
2855 (though matplotlib IS working fine with both of those backends).
2848 This will neeed much more testing. I disabled most things with
2856 This will neeed much more testing. I disabled most things with
2849 comments, so turning it back on later should be pretty easy.
2857 comments, so turning it back on later should be pretty easy.
2850
2858
2851 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2859 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2852 autocalling of expressions like r'foo', by modifying the line
2860 autocalling of expressions like r'foo', by modifying the line
2853 split regexp. Closes
2861 split regexp. Closes
2854 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2862 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2855 Riley <ipythonbugs-AT-sabi.net>.
2863 Riley <ipythonbugs-AT-sabi.net>.
2856 (InteractiveShell.mainloop): honor --nobanner with banner
2864 (InteractiveShell.mainloop): honor --nobanner with banner
2857 extensions.
2865 extensions.
2858
2866
2859 * IPython/Shell.py: Significant refactoring of all classes, so
2867 * IPython/Shell.py: Significant refactoring of all classes, so
2860 that we can really support ALL matplotlib backends and threading
2868 that we can really support ALL matplotlib backends and threading
2861 models (John spotted a bug with Tk which required this). Now we
2869 models (John spotted a bug with Tk which required this). Now we
2862 should support single-threaded, WX-threads and GTK-threads, both
2870 should support single-threaded, WX-threads and GTK-threads, both
2863 for generic code and for matplotlib.
2871 for generic code and for matplotlib.
2864
2872
2865 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2873 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2866 -pylab, to simplify things for users. Will also remove the pylab
2874 -pylab, to simplify things for users. Will also remove the pylab
2867 profile, since now all of matplotlib configuration is directly
2875 profile, since now all of matplotlib configuration is directly
2868 handled here. This also reduces startup time.
2876 handled here. This also reduces startup time.
2869
2877
2870 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2878 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2871 shell wasn't being correctly called. Also in IPShellWX.
2879 shell wasn't being correctly called. Also in IPShellWX.
2872
2880
2873 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2881 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2874 fine-tune banner.
2882 fine-tune banner.
2875
2883
2876 * IPython/numutils.py (spike): Deprecate these spike functions,
2884 * IPython/numutils.py (spike): Deprecate these spike functions,
2877 delete (long deprecated) gnuplot_exec handler.
2885 delete (long deprecated) gnuplot_exec handler.
2878
2886
2879 2004-08-26 Fernando Perez <fperez@colorado.edu>
2887 2004-08-26 Fernando Perez <fperez@colorado.edu>
2880
2888
2881 * ipython.1: Update for threading options, plus some others which
2889 * ipython.1: Update for threading options, plus some others which
2882 were missing.
2890 were missing.
2883
2891
2884 * IPython/ipmaker.py (__call__): Added -wthread option for
2892 * IPython/ipmaker.py (__call__): Added -wthread option for
2885 wxpython thread handling. Make sure threading options are only
2893 wxpython thread handling. Make sure threading options are only
2886 valid at the command line.
2894 valid at the command line.
2887
2895
2888 * scripts/ipython: moved shell selection into a factory function
2896 * scripts/ipython: moved shell selection into a factory function
2889 in Shell.py, to keep the starter script to a minimum.
2897 in Shell.py, to keep the starter script to a minimum.
2890
2898
2891 2004-08-25 Fernando Perez <fperez@colorado.edu>
2899 2004-08-25 Fernando Perez <fperez@colorado.edu>
2892
2900
2893 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2901 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2894 John. Along with some recent changes he made to matplotlib, the
2902 John. Along with some recent changes he made to matplotlib, the
2895 next versions of both systems should work very well together.
2903 next versions of both systems should work very well together.
2896
2904
2897 2004-08-24 Fernando Perez <fperez@colorado.edu>
2905 2004-08-24 Fernando Perez <fperez@colorado.edu>
2898
2906
2899 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2907 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2900 tried to switch the profiling to using hotshot, but I'm getting
2908 tried to switch the profiling to using hotshot, but I'm getting
2901 strange errors from prof.runctx() there. I may be misreading the
2909 strange errors from prof.runctx() there. I may be misreading the
2902 docs, but it looks weird. For now the profiling code will
2910 docs, but it looks weird. For now the profiling code will
2903 continue to use the standard profiler.
2911 continue to use the standard profiler.
2904
2912
2905 2004-08-23 Fernando Perez <fperez@colorado.edu>
2913 2004-08-23 Fernando Perez <fperez@colorado.edu>
2906
2914
2907 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2915 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2908 threaded shell, by John Hunter. It's not quite ready yet, but
2916 threaded shell, by John Hunter. It's not quite ready yet, but
2909 close.
2917 close.
2910
2918
2911 2004-08-22 Fernando Perez <fperez@colorado.edu>
2919 2004-08-22 Fernando Perez <fperez@colorado.edu>
2912
2920
2913 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2921 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2914 in Magic and ultraTB.
2922 in Magic and ultraTB.
2915
2923
2916 * ipython.1: document threading options in manpage.
2924 * ipython.1: document threading options in manpage.
2917
2925
2918 * scripts/ipython: Changed name of -thread option to -gthread,
2926 * scripts/ipython: Changed name of -thread option to -gthread,
2919 since this is GTK specific. I want to leave the door open for a
2927 since this is GTK specific. I want to leave the door open for a
2920 -wthread option for WX, which will most likely be necessary. This
2928 -wthread option for WX, which will most likely be necessary. This
2921 change affects usage and ipmaker as well.
2929 change affects usage and ipmaker as well.
2922
2930
2923 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2931 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2924 handle the matplotlib shell issues. Code by John Hunter
2932 handle the matplotlib shell issues. Code by John Hunter
2925 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2933 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2926 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2934 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2927 broken (and disabled for end users) for now, but it puts the
2935 broken (and disabled for end users) for now, but it puts the
2928 infrastructure in place.
2936 infrastructure in place.
2929
2937
2930 2004-08-21 Fernando Perez <fperez@colorado.edu>
2938 2004-08-21 Fernando Perez <fperez@colorado.edu>
2931
2939
2932 * ipythonrc-pylab: Add matplotlib support.
2940 * ipythonrc-pylab: Add matplotlib support.
2933
2941
2934 * matplotlib_config.py: new files for matplotlib support, part of
2942 * matplotlib_config.py: new files for matplotlib support, part of
2935 the pylab profile.
2943 the pylab profile.
2936
2944
2937 * IPython/usage.py (__doc__): documented the threading options.
2945 * IPython/usage.py (__doc__): documented the threading options.
2938
2946
2939 2004-08-20 Fernando Perez <fperez@colorado.edu>
2947 2004-08-20 Fernando Perez <fperez@colorado.edu>
2940
2948
2941 * ipython: Modified the main calling routine to handle the -thread
2949 * ipython: Modified the main calling routine to handle the -thread
2942 and -mpthread options. This needs to be done as a top-level hack,
2950 and -mpthread options. This needs to be done as a top-level hack,
2943 because it determines which class to instantiate for IPython
2951 because it determines which class to instantiate for IPython
2944 itself.
2952 itself.
2945
2953
2946 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2954 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2947 classes to support multithreaded GTK operation without blocking,
2955 classes to support multithreaded GTK operation without blocking,
2948 and matplotlib with all backends. This is a lot of still very
2956 and matplotlib with all backends. This is a lot of still very
2949 experimental code, and threads are tricky. So it may still have a
2957 experimental code, and threads are tricky. So it may still have a
2950 few rough edges... This code owes a lot to
2958 few rough edges... This code owes a lot to
2951 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2959 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2952 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2960 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2953 to John Hunter for all the matplotlib work.
2961 to John Hunter for all the matplotlib work.
2954
2962
2955 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2963 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2956 options for gtk thread and matplotlib support.
2964 options for gtk thread and matplotlib support.
2957
2965
2958 2004-08-16 Fernando Perez <fperez@colorado.edu>
2966 2004-08-16 Fernando Perez <fperez@colorado.edu>
2959
2967
2960 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2968 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2961 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2969 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2962 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2970 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2963
2971
2964 2004-08-11 Fernando Perez <fperez@colorado.edu>
2972 2004-08-11 Fernando Perez <fperez@colorado.edu>
2965
2973
2966 * setup.py (isfile): Fix build so documentation gets updated for
2974 * setup.py (isfile): Fix build so documentation gets updated for
2967 rpms (it was only done for .tgz builds).
2975 rpms (it was only done for .tgz builds).
2968
2976
2969 2004-08-10 Fernando Perez <fperez@colorado.edu>
2977 2004-08-10 Fernando Perez <fperez@colorado.edu>
2970
2978
2971 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2979 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2972
2980
2973 * iplib.py : Silence syntax error exceptions in tab-completion.
2981 * iplib.py : Silence syntax error exceptions in tab-completion.
2974
2982
2975 2004-08-05 Fernando Perez <fperez@colorado.edu>
2983 2004-08-05 Fernando Perez <fperez@colorado.edu>
2976
2984
2977 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2985 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2978 'color off' mark for continuation prompts. This was causing long
2986 'color off' mark for continuation prompts. This was causing long
2979 continuation lines to mis-wrap.
2987 continuation lines to mis-wrap.
2980
2988
2981 2004-08-01 Fernando Perez <fperez@colorado.edu>
2989 2004-08-01 Fernando Perez <fperez@colorado.edu>
2982
2990
2983 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2991 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2984 for building ipython to be a parameter. All this is necessary
2992 for building ipython to be a parameter. All this is necessary
2985 right now to have a multithreaded version, but this insane
2993 right now to have a multithreaded version, but this insane
2986 non-design will be cleaned up soon. For now, it's a hack that
2994 non-design will be cleaned up soon. For now, it's a hack that
2987 works.
2995 works.
2988
2996
2989 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2997 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2990 args in various places. No bugs so far, but it's a dangerous
2998 args in various places. No bugs so far, but it's a dangerous
2991 practice.
2999 practice.
2992
3000
2993 2004-07-31 Fernando Perez <fperez@colorado.edu>
3001 2004-07-31 Fernando Perez <fperez@colorado.edu>
2994
3002
2995 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3003 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2996 fix completion of files with dots in their names under most
3004 fix completion of files with dots in their names under most
2997 profiles (pysh was OK because the completion order is different).
3005 profiles (pysh was OK because the completion order is different).
2998
3006
2999 2004-07-27 Fernando Perez <fperez@colorado.edu>
3007 2004-07-27 Fernando Perez <fperez@colorado.edu>
3000
3008
3001 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3009 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3002 keywords manually, b/c the one in keyword.py was removed in python
3010 keywords manually, b/c the one in keyword.py was removed in python
3003 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3011 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3004 This is NOT a bug under python 2.3 and earlier.
3012 This is NOT a bug under python 2.3 and earlier.
3005
3013
3006 2004-07-26 Fernando Perez <fperez@colorado.edu>
3014 2004-07-26 Fernando Perez <fperez@colorado.edu>
3007
3015
3008 * IPython/ultraTB.py (VerboseTB.text): Add another
3016 * IPython/ultraTB.py (VerboseTB.text): Add another
3009 linecache.checkcache() call to try to prevent inspect.py from
3017 linecache.checkcache() call to try to prevent inspect.py from
3010 crashing under python 2.3. I think this fixes
3018 crashing under python 2.3. I think this fixes
3011 http://www.scipy.net/roundup/ipython/issue17.
3019 http://www.scipy.net/roundup/ipython/issue17.
3012
3020
3013 2004-07-26 *** Released version 0.6.2
3021 2004-07-26 *** Released version 0.6.2
3014
3022
3015 2004-07-26 Fernando Perez <fperez@colorado.edu>
3023 2004-07-26 Fernando Perez <fperez@colorado.edu>
3016
3024
3017 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3025 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3018 fail for any number.
3026 fail for any number.
3019 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3027 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3020 empty bookmarks.
3028 empty bookmarks.
3021
3029
3022 2004-07-26 *** Released version 0.6.1
3030 2004-07-26 *** Released version 0.6.1
3023
3031
3024 2004-07-26 Fernando Perez <fperez@colorado.edu>
3032 2004-07-26 Fernando Perez <fperez@colorado.edu>
3025
3033
3026 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3034 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3027
3035
3028 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3036 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3029 escaping '()[]{}' in filenames.
3037 escaping '()[]{}' in filenames.
3030
3038
3031 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3039 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3032 Python 2.2 users who lack a proper shlex.split.
3040 Python 2.2 users who lack a proper shlex.split.
3033
3041
3034 2004-07-19 Fernando Perez <fperez@colorado.edu>
3042 2004-07-19 Fernando Perez <fperez@colorado.edu>
3035
3043
3036 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3044 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3037 for reading readline's init file. I follow the normal chain:
3045 for reading readline's init file. I follow the normal chain:
3038 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3046 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3039 report by Mike Heeter. This closes
3047 report by Mike Heeter. This closes
3040 http://www.scipy.net/roundup/ipython/issue16.
3048 http://www.scipy.net/roundup/ipython/issue16.
3041
3049
3042 2004-07-18 Fernando Perez <fperez@colorado.edu>
3050 2004-07-18 Fernando Perez <fperez@colorado.edu>
3043
3051
3044 * IPython/iplib.py (__init__): Add better handling of '\' under
3052 * IPython/iplib.py (__init__): Add better handling of '\' under
3045 Win32 for filenames. After a patch by Ville.
3053 Win32 for filenames. After a patch by Ville.
3046
3054
3047 2004-07-17 Fernando Perez <fperez@colorado.edu>
3055 2004-07-17 Fernando Perez <fperez@colorado.edu>
3048
3056
3049 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3057 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3050 autocalling would be triggered for 'foo is bar' if foo is
3058 autocalling would be triggered for 'foo is bar' if foo is
3051 callable. I also cleaned up the autocall detection code to use a
3059 callable. I also cleaned up the autocall detection code to use a
3052 regexp, which is faster. Bug reported by Alexander Schmolck.
3060 regexp, which is faster. Bug reported by Alexander Schmolck.
3053
3061
3054 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3062 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3055 '?' in them would confuse the help system. Reported by Alex
3063 '?' in them would confuse the help system. Reported by Alex
3056 Schmolck.
3064 Schmolck.
3057
3065
3058 2004-07-16 Fernando Perez <fperez@colorado.edu>
3066 2004-07-16 Fernando Perez <fperez@colorado.edu>
3059
3067
3060 * IPython/GnuplotInteractive.py (__all__): added plot2.
3068 * IPython/GnuplotInteractive.py (__all__): added plot2.
3061
3069
3062 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3070 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3063 plotting dictionaries, lists or tuples of 1d arrays.
3071 plotting dictionaries, lists or tuples of 1d arrays.
3064
3072
3065 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3073 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3066 optimizations.
3074 optimizations.
3067
3075
3068 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3076 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3069 the information which was there from Janko's original IPP code:
3077 the information which was there from Janko's original IPP code:
3070
3078
3071 03.05.99 20:53 porto.ifm.uni-kiel.de
3079 03.05.99 20:53 porto.ifm.uni-kiel.de
3072 --Started changelog.
3080 --Started changelog.
3073 --make clear do what it say it does
3081 --make clear do what it say it does
3074 --added pretty output of lines from inputcache
3082 --added pretty output of lines from inputcache
3075 --Made Logger a mixin class, simplifies handling of switches
3083 --Made Logger a mixin class, simplifies handling of switches
3076 --Added own completer class. .string<TAB> expands to last history
3084 --Added own completer class. .string<TAB> expands to last history
3077 line which starts with string. The new expansion is also present
3085 line which starts with string. The new expansion is also present
3078 with Ctrl-r from the readline library. But this shows, who this
3086 with Ctrl-r from the readline library. But this shows, who this
3079 can be done for other cases.
3087 can be done for other cases.
3080 --Added convention that all shell functions should accept a
3088 --Added convention that all shell functions should accept a
3081 parameter_string This opens the door for different behaviour for
3089 parameter_string This opens the door for different behaviour for
3082 each function. @cd is a good example of this.
3090 each function. @cd is a good example of this.
3083
3091
3084 04.05.99 12:12 porto.ifm.uni-kiel.de
3092 04.05.99 12:12 porto.ifm.uni-kiel.de
3085 --added logfile rotation
3093 --added logfile rotation
3086 --added new mainloop method which freezes first the namespace
3094 --added new mainloop method which freezes first the namespace
3087
3095
3088 07.05.99 21:24 porto.ifm.uni-kiel.de
3096 07.05.99 21:24 porto.ifm.uni-kiel.de
3089 --added the docreader classes. Now there is a help system.
3097 --added the docreader classes. Now there is a help system.
3090 -This is only a first try. Currently it's not easy to put new
3098 -This is only a first try. Currently it's not easy to put new
3091 stuff in the indices. But this is the way to go. Info would be
3099 stuff in the indices. But this is the way to go. Info would be
3092 better, but HTML is every where and not everybody has an info
3100 better, but HTML is every where and not everybody has an info
3093 system installed and it's not so easy to change html-docs to info.
3101 system installed and it's not so easy to change html-docs to info.
3094 --added global logfile option
3102 --added global logfile option
3095 --there is now a hook for object inspection method pinfo needs to
3103 --there is now a hook for object inspection method pinfo needs to
3096 be provided for this. Can be reached by two '??'.
3104 be provided for this. Can be reached by two '??'.
3097
3105
3098 08.05.99 20:51 porto.ifm.uni-kiel.de
3106 08.05.99 20:51 porto.ifm.uni-kiel.de
3099 --added a README
3107 --added a README
3100 --bug in rc file. Something has changed so functions in the rc
3108 --bug in rc file. Something has changed so functions in the rc
3101 file need to reference the shell and not self. Not clear if it's a
3109 file need to reference the shell and not self. Not clear if it's a
3102 bug or feature.
3110 bug or feature.
3103 --changed rc file for new behavior
3111 --changed rc file for new behavior
3104
3112
3105 2004-07-15 Fernando Perez <fperez@colorado.edu>
3113 2004-07-15 Fernando Perez <fperez@colorado.edu>
3106
3114
3107 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3115 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3108 cache was falling out of sync in bizarre manners when multi-line
3116 cache was falling out of sync in bizarre manners when multi-line
3109 input was present. Minor optimizations and cleanup.
3117 input was present. Minor optimizations and cleanup.
3110
3118
3111 (Logger): Remove old Changelog info for cleanup. This is the
3119 (Logger): Remove old Changelog info for cleanup. This is the
3112 information which was there from Janko's original code:
3120 information which was there from Janko's original code:
3113
3121
3114 Changes to Logger: - made the default log filename a parameter
3122 Changes to Logger: - made the default log filename a parameter
3115
3123
3116 - put a check for lines beginning with !@? in log(). Needed
3124 - put a check for lines beginning with !@? in log(). Needed
3117 (even if the handlers properly log their lines) for mid-session
3125 (even if the handlers properly log their lines) for mid-session
3118 logging activation to work properly. Without this, lines logged
3126 logging activation to work properly. Without this, lines logged
3119 in mid session, which get read from the cache, would end up
3127 in mid session, which get read from the cache, would end up
3120 'bare' (with !@? in the open) in the log. Now they are caught
3128 'bare' (with !@? in the open) in the log. Now they are caught
3121 and prepended with a #.
3129 and prepended with a #.
3122
3130
3123 * IPython/iplib.py (InteractiveShell.init_readline): added check
3131 * IPython/iplib.py (InteractiveShell.init_readline): added check
3124 in case MagicCompleter fails to be defined, so we don't crash.
3132 in case MagicCompleter fails to be defined, so we don't crash.
3125
3133
3126 2004-07-13 Fernando Perez <fperez@colorado.edu>
3134 2004-07-13 Fernando Perez <fperez@colorado.edu>
3127
3135
3128 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3136 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3129 of EPS if the requested filename ends in '.eps'.
3137 of EPS if the requested filename ends in '.eps'.
3130
3138
3131 2004-07-04 Fernando Perez <fperez@colorado.edu>
3139 2004-07-04 Fernando Perez <fperez@colorado.edu>
3132
3140
3133 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3141 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3134 escaping of quotes when calling the shell.
3142 escaping of quotes when calling the shell.
3135
3143
3136 2004-07-02 Fernando Perez <fperez@colorado.edu>
3144 2004-07-02 Fernando Perez <fperez@colorado.edu>
3137
3145
3138 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3146 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3139 gettext not working because we were clobbering '_'. Fixes
3147 gettext not working because we were clobbering '_'. Fixes
3140 http://www.scipy.net/roundup/ipython/issue6.
3148 http://www.scipy.net/roundup/ipython/issue6.
3141
3149
3142 2004-07-01 Fernando Perez <fperez@colorado.edu>
3150 2004-07-01 Fernando Perez <fperez@colorado.edu>
3143
3151
3144 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3152 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3145 into @cd. Patch by Ville.
3153 into @cd. Patch by Ville.
3146
3154
3147 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3155 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3148 new function to store things after ipmaker runs. Patch by Ville.
3156 new function to store things after ipmaker runs. Patch by Ville.
3149 Eventually this will go away once ipmaker is removed and the class
3157 Eventually this will go away once ipmaker is removed and the class
3150 gets cleaned up, but for now it's ok. Key functionality here is
3158 gets cleaned up, but for now it's ok. Key functionality here is
3151 the addition of the persistent storage mechanism, a dict for
3159 the addition of the persistent storage mechanism, a dict for
3152 keeping data across sessions (for now just bookmarks, but more can
3160 keeping data across sessions (for now just bookmarks, but more can
3153 be implemented later).
3161 be implemented later).
3154
3162
3155 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3163 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3156 persistent across sections. Patch by Ville, I modified it
3164 persistent across sections. Patch by Ville, I modified it
3157 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3165 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3158 added a '-l' option to list all bookmarks.
3166 added a '-l' option to list all bookmarks.
3159
3167
3160 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3168 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3161 center for cleanup. Registered with atexit.register(). I moved
3169 center for cleanup. Registered with atexit.register(). I moved
3162 here the old exit_cleanup(). After a patch by Ville.
3170 here the old exit_cleanup(). After a patch by Ville.
3163
3171
3164 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3172 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3165 characters in the hacked shlex_split for python 2.2.
3173 characters in the hacked shlex_split for python 2.2.
3166
3174
3167 * IPython/iplib.py (file_matches): more fixes to filenames with
3175 * IPython/iplib.py (file_matches): more fixes to filenames with
3168 whitespace in them. It's not perfect, but limitations in python's
3176 whitespace in them. It's not perfect, but limitations in python's
3169 readline make it impossible to go further.
3177 readline make it impossible to go further.
3170
3178
3171 2004-06-29 Fernando Perez <fperez@colorado.edu>
3179 2004-06-29 Fernando Perez <fperez@colorado.edu>
3172
3180
3173 * IPython/iplib.py (file_matches): escape whitespace correctly in
3181 * IPython/iplib.py (file_matches): escape whitespace correctly in
3174 filename completions. Bug reported by Ville.
3182 filename completions. Bug reported by Ville.
3175
3183
3176 2004-06-28 Fernando Perez <fperez@colorado.edu>
3184 2004-06-28 Fernando Perez <fperez@colorado.edu>
3177
3185
3178 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3186 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3179 the history file will be called 'history-PROFNAME' (or just
3187 the history file will be called 'history-PROFNAME' (or just
3180 'history' if no profile is loaded). I was getting annoyed at
3188 'history' if no profile is loaded). I was getting annoyed at
3181 getting my Numerical work history clobbered by pysh sessions.
3189 getting my Numerical work history clobbered by pysh sessions.
3182
3190
3183 * IPython/iplib.py (InteractiveShell.__init__): Internal
3191 * IPython/iplib.py (InteractiveShell.__init__): Internal
3184 getoutputerror() function so that we can honor the system_verbose
3192 getoutputerror() function so that we can honor the system_verbose
3185 flag for _all_ system calls. I also added escaping of #
3193 flag for _all_ system calls. I also added escaping of #
3186 characters here to avoid confusing Itpl.
3194 characters here to avoid confusing Itpl.
3187
3195
3188 * IPython/Magic.py (shlex_split): removed call to shell in
3196 * IPython/Magic.py (shlex_split): removed call to shell in
3189 parse_options and replaced it with shlex.split(). The annoying
3197 parse_options and replaced it with shlex.split(). The annoying
3190 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3198 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3191 to backport it from 2.3, with several frail hacks (the shlex
3199 to backport it from 2.3, with several frail hacks (the shlex
3192 module is rather limited in 2.2). Thanks to a suggestion by Ville
3200 module is rather limited in 2.2). Thanks to a suggestion by Ville
3193 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3201 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3194 problem.
3202 problem.
3195
3203
3196 (Magic.magic_system_verbose): new toggle to print the actual
3204 (Magic.magic_system_verbose): new toggle to print the actual
3197 system calls made by ipython. Mainly for debugging purposes.
3205 system calls made by ipython. Mainly for debugging purposes.
3198
3206
3199 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3207 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3200 doesn't support persistence. Reported (and fix suggested) by
3208 doesn't support persistence. Reported (and fix suggested) by
3201 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3209 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3202
3210
3203 2004-06-26 Fernando Perez <fperez@colorado.edu>
3211 2004-06-26 Fernando Perez <fperez@colorado.edu>
3204
3212
3205 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3213 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3206 continue prompts.
3214 continue prompts.
3207
3215
3208 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3216 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3209 function (basically a big docstring) and a few more things here to
3217 function (basically a big docstring) and a few more things here to
3210 speedup startup. pysh.py is now very lightweight. We want because
3218 speedup startup. pysh.py is now very lightweight. We want because
3211 it gets execfile'd, while InterpreterExec gets imported, so
3219 it gets execfile'd, while InterpreterExec gets imported, so
3212 byte-compilation saves time.
3220 byte-compilation saves time.
3213
3221
3214 2004-06-25 Fernando Perez <fperez@colorado.edu>
3222 2004-06-25 Fernando Perez <fperez@colorado.edu>
3215
3223
3216 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3224 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3217 -NUM', which was recently broken.
3225 -NUM', which was recently broken.
3218
3226
3219 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3227 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3220 in multi-line input (but not !!, which doesn't make sense there).
3228 in multi-line input (but not !!, which doesn't make sense there).
3221
3229
3222 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3230 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3223 It's just too useful, and people can turn it off in the less
3231 It's just too useful, and people can turn it off in the less
3224 common cases where it's a problem.
3232 common cases where it's a problem.
3225
3233
3226 2004-06-24 Fernando Perez <fperez@colorado.edu>
3234 2004-06-24 Fernando Perez <fperez@colorado.edu>
3227
3235
3228 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3236 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3229 special syntaxes (like alias calling) is now allied in multi-line
3237 special syntaxes (like alias calling) is now allied in multi-line
3230 input. This is still _very_ experimental, but it's necessary for
3238 input. This is still _very_ experimental, but it's necessary for
3231 efficient shell usage combining python looping syntax with system
3239 efficient shell usage combining python looping syntax with system
3232 calls. For now it's restricted to aliases, I don't think it
3240 calls. For now it's restricted to aliases, I don't think it
3233 really even makes sense to have this for magics.
3241 really even makes sense to have this for magics.
3234
3242
3235 2004-06-23 Fernando Perez <fperez@colorado.edu>
3243 2004-06-23 Fernando Perez <fperez@colorado.edu>
3236
3244
3237 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3245 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3238 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3246 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3239
3247
3240 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3248 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3241 extensions under Windows (after code sent by Gary Bishop). The
3249 extensions under Windows (after code sent by Gary Bishop). The
3242 extensions considered 'executable' are stored in IPython's rc
3250 extensions considered 'executable' are stored in IPython's rc
3243 structure as win_exec_ext.
3251 structure as win_exec_ext.
3244
3252
3245 * IPython/genutils.py (shell): new function, like system() but
3253 * IPython/genutils.py (shell): new function, like system() but
3246 without return value. Very useful for interactive shell work.
3254 without return value. Very useful for interactive shell work.
3247
3255
3248 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3256 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3249 delete aliases.
3257 delete aliases.
3250
3258
3251 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3259 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3252 sure that the alias table doesn't contain python keywords.
3260 sure that the alias table doesn't contain python keywords.
3253
3261
3254 2004-06-21 Fernando Perez <fperez@colorado.edu>
3262 2004-06-21 Fernando Perez <fperez@colorado.edu>
3255
3263
3256 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3264 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3257 non-existent items are found in $PATH. Reported by Thorsten.
3265 non-existent items are found in $PATH. Reported by Thorsten.
3258
3266
3259 2004-06-20 Fernando Perez <fperez@colorado.edu>
3267 2004-06-20 Fernando Perez <fperez@colorado.edu>
3260
3268
3261 * IPython/iplib.py (complete): modified the completer so that the
3269 * IPython/iplib.py (complete): modified the completer so that the
3262 order of priorities can be easily changed at runtime.
3270 order of priorities can be easily changed at runtime.
3263
3271
3264 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3272 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3265 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3273 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3266
3274
3267 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3275 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3268 expand Python variables prepended with $ in all system calls. The
3276 expand Python variables prepended with $ in all system calls. The
3269 same was done to InteractiveShell.handle_shell_escape. Now all
3277 same was done to InteractiveShell.handle_shell_escape. Now all
3270 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3278 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3271 expansion of python variables and expressions according to the
3279 expansion of python variables and expressions according to the
3272 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3280 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3273
3281
3274 Though PEP-215 has been rejected, a similar (but simpler) one
3282 Though PEP-215 has been rejected, a similar (but simpler) one
3275 seems like it will go into Python 2.4, PEP-292 -
3283 seems like it will go into Python 2.4, PEP-292 -
3276 http://www.python.org/peps/pep-0292.html.
3284 http://www.python.org/peps/pep-0292.html.
3277
3285
3278 I'll keep the full syntax of PEP-215, since IPython has since the
3286 I'll keep the full syntax of PEP-215, since IPython has since the
3279 start used Ka-Ping Yee's reference implementation discussed there
3287 start used Ka-Ping Yee's reference implementation discussed there
3280 (Itpl), and I actually like the powerful semantics it offers.
3288 (Itpl), and I actually like the powerful semantics it offers.
3281
3289
3282 In order to access normal shell variables, the $ has to be escaped
3290 In order to access normal shell variables, the $ has to be escaped
3283 via an extra $. For example:
3291 via an extra $. For example:
3284
3292
3285 In [7]: PATH='a python variable'
3293 In [7]: PATH='a python variable'
3286
3294
3287 In [8]: !echo $PATH
3295 In [8]: !echo $PATH
3288 a python variable
3296 a python variable
3289
3297
3290 In [9]: !echo $$PATH
3298 In [9]: !echo $$PATH
3291 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3299 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3292
3300
3293 (Magic.parse_options): escape $ so the shell doesn't evaluate
3301 (Magic.parse_options): escape $ so the shell doesn't evaluate
3294 things prematurely.
3302 things prematurely.
3295
3303
3296 * IPython/iplib.py (InteractiveShell.call_alias): added the
3304 * IPython/iplib.py (InteractiveShell.call_alias): added the
3297 ability for aliases to expand python variables via $.
3305 ability for aliases to expand python variables via $.
3298
3306
3299 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3307 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3300 system, now there's a @rehash/@rehashx pair of magics. These work
3308 system, now there's a @rehash/@rehashx pair of magics. These work
3301 like the csh rehash command, and can be invoked at any time. They
3309 like the csh rehash command, and can be invoked at any time. They
3302 build a table of aliases to everything in the user's $PATH
3310 build a table of aliases to everything in the user's $PATH
3303 (@rehash uses everything, @rehashx is slower but only adds
3311 (@rehash uses everything, @rehashx is slower but only adds
3304 executable files). With this, the pysh.py-based shell profile can
3312 executable files). With this, the pysh.py-based shell profile can
3305 now simply call rehash upon startup, and full access to all
3313 now simply call rehash upon startup, and full access to all
3306 programs in the user's path is obtained.
3314 programs in the user's path is obtained.
3307
3315
3308 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3316 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3309 functionality is now fully in place. I removed the old dynamic
3317 functionality is now fully in place. I removed the old dynamic
3310 code generation based approach, in favor of a much lighter one
3318 code generation based approach, in favor of a much lighter one
3311 based on a simple dict. The advantage is that this allows me to
3319 based on a simple dict. The advantage is that this allows me to
3312 now have thousands of aliases with negligible cost (unthinkable
3320 now have thousands of aliases with negligible cost (unthinkable
3313 with the old system).
3321 with the old system).
3314
3322
3315 2004-06-19 Fernando Perez <fperez@colorado.edu>
3323 2004-06-19 Fernando Perez <fperez@colorado.edu>
3316
3324
3317 * IPython/iplib.py (__init__): extended MagicCompleter class to
3325 * IPython/iplib.py (__init__): extended MagicCompleter class to
3318 also complete (last in priority) on user aliases.
3326 also complete (last in priority) on user aliases.
3319
3327
3320 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3328 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3321 call to eval.
3329 call to eval.
3322 (ItplNS.__init__): Added a new class which functions like Itpl,
3330 (ItplNS.__init__): Added a new class which functions like Itpl,
3323 but allows configuring the namespace for the evaluation to occur
3331 but allows configuring the namespace for the evaluation to occur
3324 in.
3332 in.
3325
3333
3326 2004-06-18 Fernando Perez <fperez@colorado.edu>
3334 2004-06-18 Fernando Perez <fperez@colorado.edu>
3327
3335
3328 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3336 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3329 better message when 'exit' or 'quit' are typed (a common newbie
3337 better message when 'exit' or 'quit' are typed (a common newbie
3330 confusion).
3338 confusion).
3331
3339
3332 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3340 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3333 check for Windows users.
3341 check for Windows users.
3334
3342
3335 * IPython/iplib.py (InteractiveShell.user_setup): removed
3343 * IPython/iplib.py (InteractiveShell.user_setup): removed
3336 disabling of colors for Windows. I'll test at runtime and issue a
3344 disabling of colors for Windows. I'll test at runtime and issue a
3337 warning if Gary's readline isn't found, as to nudge users to
3345 warning if Gary's readline isn't found, as to nudge users to
3338 download it.
3346 download it.
3339
3347
3340 2004-06-16 Fernando Perez <fperez@colorado.edu>
3348 2004-06-16 Fernando Perez <fperez@colorado.edu>
3341
3349
3342 * IPython/genutils.py (Stream.__init__): changed to print errors
3350 * IPython/genutils.py (Stream.__init__): changed to print errors
3343 to sys.stderr. I had a circular dependency here. Now it's
3351 to sys.stderr. I had a circular dependency here. Now it's
3344 possible to run ipython as IDLE's shell (consider this pre-alpha,
3352 possible to run ipython as IDLE's shell (consider this pre-alpha,
3345 since true stdout things end up in the starting terminal instead
3353 since true stdout things end up in the starting terminal instead
3346 of IDLE's out).
3354 of IDLE's out).
3347
3355
3348 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3356 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3349 users who haven't # updated their prompt_in2 definitions. Remove
3357 users who haven't # updated their prompt_in2 definitions. Remove
3350 eventually.
3358 eventually.
3351 (multiple_replace): added credit to original ASPN recipe.
3359 (multiple_replace): added credit to original ASPN recipe.
3352
3360
3353 2004-06-15 Fernando Perez <fperez@colorado.edu>
3361 2004-06-15 Fernando Perez <fperez@colorado.edu>
3354
3362
3355 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3363 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3356 list of auto-defined aliases.
3364 list of auto-defined aliases.
3357
3365
3358 2004-06-13 Fernando Perez <fperez@colorado.edu>
3366 2004-06-13 Fernando Perez <fperez@colorado.edu>
3359
3367
3360 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3368 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3361 install was really requested (so setup.py can be used for other
3369 install was really requested (so setup.py can be used for other
3362 things under Windows).
3370 things under Windows).
3363
3371
3364 2004-06-10 Fernando Perez <fperez@colorado.edu>
3372 2004-06-10 Fernando Perez <fperez@colorado.edu>
3365
3373
3366 * IPython/Logger.py (Logger.create_log): Manually remove any old
3374 * IPython/Logger.py (Logger.create_log): Manually remove any old
3367 backup, since os.remove may fail under Windows. Fixes bug
3375 backup, since os.remove may fail under Windows. Fixes bug
3368 reported by Thorsten.
3376 reported by Thorsten.
3369
3377
3370 2004-06-09 Fernando Perez <fperez@colorado.edu>
3378 2004-06-09 Fernando Perez <fperez@colorado.edu>
3371
3379
3372 * examples/example-embed.py: fixed all references to %n (replaced
3380 * examples/example-embed.py: fixed all references to %n (replaced
3373 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3381 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3374 for all examples and the manual as well.
3382 for all examples and the manual as well.
3375
3383
3376 2004-06-08 Fernando Perez <fperez@colorado.edu>
3384 2004-06-08 Fernando Perez <fperez@colorado.edu>
3377
3385
3378 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3386 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3379 alignment and color management. All 3 prompt subsystems now
3387 alignment and color management. All 3 prompt subsystems now
3380 inherit from BasePrompt.
3388 inherit from BasePrompt.
3381
3389
3382 * tools/release: updates for windows installer build and tag rpms
3390 * tools/release: updates for windows installer build and tag rpms
3383 with python version (since paths are fixed).
3391 with python version (since paths are fixed).
3384
3392
3385 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3393 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3386 which will become eventually obsolete. Also fixed the default
3394 which will become eventually obsolete. Also fixed the default
3387 prompt_in2 to use \D, so at least new users start with the correct
3395 prompt_in2 to use \D, so at least new users start with the correct
3388 defaults.
3396 defaults.
3389 WARNING: Users with existing ipythonrc files will need to apply
3397 WARNING: Users with existing ipythonrc files will need to apply
3390 this fix manually!
3398 this fix manually!
3391
3399
3392 * setup.py: make windows installer (.exe). This is finally the
3400 * setup.py: make windows installer (.exe). This is finally the
3393 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3401 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3394 which I hadn't included because it required Python 2.3 (or recent
3402 which I hadn't included because it required Python 2.3 (or recent
3395 distutils).
3403 distutils).
3396
3404
3397 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3405 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3398 usage of new '\D' escape.
3406 usage of new '\D' escape.
3399
3407
3400 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3408 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3401 lacks os.getuid())
3409 lacks os.getuid())
3402 (CachedOutput.set_colors): Added the ability to turn coloring
3410 (CachedOutput.set_colors): Added the ability to turn coloring
3403 on/off with @colors even for manually defined prompt colors. It
3411 on/off with @colors even for manually defined prompt colors. It
3404 uses a nasty global, but it works safely and via the generic color
3412 uses a nasty global, but it works safely and via the generic color
3405 handling mechanism.
3413 handling mechanism.
3406 (Prompt2.__init__): Introduced new escape '\D' for continuation
3414 (Prompt2.__init__): Introduced new escape '\D' for continuation
3407 prompts. It represents the counter ('\#') as dots.
3415 prompts. It represents the counter ('\#') as dots.
3408 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3416 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3409 need to update their ipythonrc files and replace '%n' with '\D' in
3417 need to update their ipythonrc files and replace '%n' with '\D' in
3410 their prompt_in2 settings everywhere. Sorry, but there's
3418 their prompt_in2 settings everywhere. Sorry, but there's
3411 otherwise no clean way to get all prompts to properly align. The
3419 otherwise no clean way to get all prompts to properly align. The
3412 ipythonrc shipped with IPython has been updated.
3420 ipythonrc shipped with IPython has been updated.
3413
3421
3414 2004-06-07 Fernando Perez <fperez@colorado.edu>
3422 2004-06-07 Fernando Perez <fperez@colorado.edu>
3415
3423
3416 * setup.py (isfile): Pass local_icons option to latex2html, so the
3424 * setup.py (isfile): Pass local_icons option to latex2html, so the
3417 resulting HTML file is self-contained. Thanks to
3425 resulting HTML file is self-contained. Thanks to
3418 dryice-AT-liu.com.cn for the tip.
3426 dryice-AT-liu.com.cn for the tip.
3419
3427
3420 * pysh.py: I created a new profile 'shell', which implements a
3428 * pysh.py: I created a new profile 'shell', which implements a
3421 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3429 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3422 system shell, nor will it become one anytime soon. It's mainly
3430 system shell, nor will it become one anytime soon. It's mainly
3423 meant to illustrate the use of the new flexible bash-like prompts.
3431 meant to illustrate the use of the new flexible bash-like prompts.
3424 I guess it could be used by hardy souls for true shell management,
3432 I guess it could be used by hardy souls for true shell management,
3425 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3433 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3426 profile. This uses the InterpreterExec extension provided by
3434 profile. This uses the InterpreterExec extension provided by
3427 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3435 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3428
3436
3429 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3437 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3430 auto-align itself with the length of the previous input prompt
3438 auto-align itself with the length of the previous input prompt
3431 (taking into account the invisible color escapes).
3439 (taking into account the invisible color escapes).
3432 (CachedOutput.__init__): Large restructuring of this class. Now
3440 (CachedOutput.__init__): Large restructuring of this class. Now
3433 all three prompts (primary1, primary2, output) are proper objects,
3441 all three prompts (primary1, primary2, output) are proper objects,
3434 managed by the 'parent' CachedOutput class. The code is still a
3442 managed by the 'parent' CachedOutput class. The code is still a
3435 bit hackish (all prompts share state via a pointer to the cache),
3443 bit hackish (all prompts share state via a pointer to the cache),
3436 but it's overall far cleaner than before.
3444 but it's overall far cleaner than before.
3437
3445
3438 * IPython/genutils.py (getoutputerror): modified to add verbose,
3446 * IPython/genutils.py (getoutputerror): modified to add verbose,
3439 debug and header options. This makes the interface of all getout*
3447 debug and header options. This makes the interface of all getout*
3440 functions uniform.
3448 functions uniform.
3441 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3449 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3442
3450
3443 * IPython/Magic.py (Magic.default_option): added a function to
3451 * IPython/Magic.py (Magic.default_option): added a function to
3444 allow registering default options for any magic command. This
3452 allow registering default options for any magic command. This
3445 makes it easy to have profiles which customize the magics globally
3453 makes it easy to have profiles which customize the magics globally
3446 for a certain use. The values set through this function are
3454 for a certain use. The values set through this function are
3447 picked up by the parse_options() method, which all magics should
3455 picked up by the parse_options() method, which all magics should
3448 use to parse their options.
3456 use to parse their options.
3449
3457
3450 * IPython/genutils.py (warn): modified the warnings framework to
3458 * IPython/genutils.py (warn): modified the warnings framework to
3451 use the Term I/O class. I'm trying to slowly unify all of
3459 use the Term I/O class. I'm trying to slowly unify all of
3452 IPython's I/O operations to pass through Term.
3460 IPython's I/O operations to pass through Term.
3453
3461
3454 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3462 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3455 the secondary prompt to correctly match the length of the primary
3463 the secondary prompt to correctly match the length of the primary
3456 one for any prompt. Now multi-line code will properly line up
3464 one for any prompt. Now multi-line code will properly line up
3457 even for path dependent prompts, such as the new ones available
3465 even for path dependent prompts, such as the new ones available
3458 via the prompt_specials.
3466 via the prompt_specials.
3459
3467
3460 2004-06-06 Fernando Perez <fperez@colorado.edu>
3468 2004-06-06 Fernando Perez <fperez@colorado.edu>
3461
3469
3462 * IPython/Prompts.py (prompt_specials): Added the ability to have
3470 * IPython/Prompts.py (prompt_specials): Added the ability to have
3463 bash-like special sequences in the prompts, which get
3471 bash-like special sequences in the prompts, which get
3464 automatically expanded. Things like hostname, current working
3472 automatically expanded. Things like hostname, current working
3465 directory and username are implemented already, but it's easy to
3473 directory and username are implemented already, but it's easy to
3466 add more in the future. Thanks to a patch by W.J. van der Laan
3474 add more in the future. Thanks to a patch by W.J. van der Laan
3467 <gnufnork-AT-hetdigitalegat.nl>
3475 <gnufnork-AT-hetdigitalegat.nl>
3468 (prompt_specials): Added color support for prompt strings, so
3476 (prompt_specials): Added color support for prompt strings, so
3469 users can define arbitrary color setups for their prompts.
3477 users can define arbitrary color setups for their prompts.
3470
3478
3471 2004-06-05 Fernando Perez <fperez@colorado.edu>
3479 2004-06-05 Fernando Perez <fperez@colorado.edu>
3472
3480
3473 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3481 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3474 code to load Gary Bishop's readline and configure it
3482 code to load Gary Bishop's readline and configure it
3475 automatically. Thanks to Gary for help on this.
3483 automatically. Thanks to Gary for help on this.
3476
3484
3477 2004-06-01 Fernando Perez <fperez@colorado.edu>
3485 2004-06-01 Fernando Perez <fperez@colorado.edu>
3478
3486
3479 * IPython/Logger.py (Logger.create_log): fix bug for logging
3487 * IPython/Logger.py (Logger.create_log): fix bug for logging
3480 with no filename (previous fix was incomplete).
3488 with no filename (previous fix was incomplete).
3481
3489
3482 2004-05-25 Fernando Perez <fperez@colorado.edu>
3490 2004-05-25 Fernando Perez <fperez@colorado.edu>
3483
3491
3484 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3492 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3485 parens would get passed to the shell.
3493 parens would get passed to the shell.
3486
3494
3487 2004-05-20 Fernando Perez <fperez@colorado.edu>
3495 2004-05-20 Fernando Perez <fperez@colorado.edu>
3488
3496
3489 * IPython/Magic.py (Magic.magic_prun): changed default profile
3497 * IPython/Magic.py (Magic.magic_prun): changed default profile
3490 sort order to 'time' (the more common profiling need).
3498 sort order to 'time' (the more common profiling need).
3491
3499
3492 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3500 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3493 so that source code shown is guaranteed in sync with the file on
3501 so that source code shown is guaranteed in sync with the file on
3494 disk (also changed in psource). Similar fix to the one for
3502 disk (also changed in psource). Similar fix to the one for
3495 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3503 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3496 <yann.ledu-AT-noos.fr>.
3504 <yann.ledu-AT-noos.fr>.
3497
3505
3498 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3506 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3499 with a single option would not be correctly parsed. Closes
3507 with a single option would not be correctly parsed. Closes
3500 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3508 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3501 introduced in 0.6.0 (on 2004-05-06).
3509 introduced in 0.6.0 (on 2004-05-06).
3502
3510
3503 2004-05-13 *** Released version 0.6.0
3511 2004-05-13 *** Released version 0.6.0
3504
3512
3505 2004-05-13 Fernando Perez <fperez@colorado.edu>
3513 2004-05-13 Fernando Perez <fperez@colorado.edu>
3506
3514
3507 * debian/: Added debian/ directory to CVS, so that debian support
3515 * debian/: Added debian/ directory to CVS, so that debian support
3508 is publicly accessible. The debian package is maintained by Jack
3516 is publicly accessible. The debian package is maintained by Jack
3509 Moffit <jack-AT-xiph.org>.
3517 Moffit <jack-AT-xiph.org>.
3510
3518
3511 * Documentation: included the notes about an ipython-based system
3519 * Documentation: included the notes about an ipython-based system
3512 shell (the hypothetical 'pysh') into the new_design.pdf document,
3520 shell (the hypothetical 'pysh') into the new_design.pdf document,
3513 so that these ideas get distributed to users along with the
3521 so that these ideas get distributed to users along with the
3514 official documentation.
3522 official documentation.
3515
3523
3516 2004-05-10 Fernando Perez <fperez@colorado.edu>
3524 2004-05-10 Fernando Perez <fperez@colorado.edu>
3517
3525
3518 * IPython/Logger.py (Logger.create_log): fix recently introduced
3526 * IPython/Logger.py (Logger.create_log): fix recently introduced
3519 bug (misindented line) where logstart would fail when not given an
3527 bug (misindented line) where logstart would fail when not given an
3520 explicit filename.
3528 explicit filename.
3521
3529
3522 2004-05-09 Fernando Perez <fperez@colorado.edu>
3530 2004-05-09 Fernando Perez <fperez@colorado.edu>
3523
3531
3524 * IPython/Magic.py (Magic.parse_options): skip system call when
3532 * IPython/Magic.py (Magic.parse_options): skip system call when
3525 there are no options to look for. Faster, cleaner for the common
3533 there are no options to look for. Faster, cleaner for the common
3526 case.
3534 case.
3527
3535
3528 * Documentation: many updates to the manual: describing Windows
3536 * Documentation: many updates to the manual: describing Windows
3529 support better, Gnuplot updates, credits, misc small stuff. Also
3537 support better, Gnuplot updates, credits, misc small stuff. Also
3530 updated the new_design doc a bit.
3538 updated the new_design doc a bit.
3531
3539
3532 2004-05-06 *** Released version 0.6.0.rc1
3540 2004-05-06 *** Released version 0.6.0.rc1
3533
3541
3534 2004-05-06 Fernando Perez <fperez@colorado.edu>
3542 2004-05-06 Fernando Perez <fperez@colorado.edu>
3535
3543
3536 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3544 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3537 operations to use the vastly more efficient list/''.join() method.
3545 operations to use the vastly more efficient list/''.join() method.
3538 (FormattedTB.text): Fix
3546 (FormattedTB.text): Fix
3539 http://www.scipy.net/roundup/ipython/issue12 - exception source
3547 http://www.scipy.net/roundup/ipython/issue12 - exception source
3540 extract not updated after reload. Thanks to Mike Salib
3548 extract not updated after reload. Thanks to Mike Salib
3541 <msalib-AT-mit.edu> for pinning the source of the problem.
3549 <msalib-AT-mit.edu> for pinning the source of the problem.
3542 Fortunately, the solution works inside ipython and doesn't require
3550 Fortunately, the solution works inside ipython and doesn't require
3543 any changes to python proper.
3551 any changes to python proper.
3544
3552
3545 * IPython/Magic.py (Magic.parse_options): Improved to process the
3553 * IPython/Magic.py (Magic.parse_options): Improved to process the
3546 argument list as a true shell would (by actually using the
3554 argument list as a true shell would (by actually using the
3547 underlying system shell). This way, all @magics automatically get
3555 underlying system shell). This way, all @magics automatically get
3548 shell expansion for variables. Thanks to a comment by Alex
3556 shell expansion for variables. Thanks to a comment by Alex
3549 Schmolck.
3557 Schmolck.
3550
3558
3551 2004-04-04 Fernando Perez <fperez@colorado.edu>
3559 2004-04-04 Fernando Perez <fperez@colorado.edu>
3552
3560
3553 * IPython/iplib.py (InteractiveShell.interact): Added a special
3561 * IPython/iplib.py (InteractiveShell.interact): Added a special
3554 trap for a debugger quit exception, which is basically impossible
3562 trap for a debugger quit exception, which is basically impossible
3555 to handle by normal mechanisms, given what pdb does to the stack.
3563 to handle by normal mechanisms, given what pdb does to the stack.
3556 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3564 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3557
3565
3558 2004-04-03 Fernando Perez <fperez@colorado.edu>
3566 2004-04-03 Fernando Perez <fperez@colorado.edu>
3559
3567
3560 * IPython/genutils.py (Term): Standardized the names of the Term
3568 * IPython/genutils.py (Term): Standardized the names of the Term
3561 class streams to cin/cout/cerr, following C++ naming conventions
3569 class streams to cin/cout/cerr, following C++ naming conventions
3562 (I can't use in/out/err because 'in' is not a valid attribute
3570 (I can't use in/out/err because 'in' is not a valid attribute
3563 name).
3571 name).
3564
3572
3565 * IPython/iplib.py (InteractiveShell.interact): don't increment
3573 * IPython/iplib.py (InteractiveShell.interact): don't increment
3566 the prompt if there's no user input. By Daniel 'Dang' Griffith
3574 the prompt if there's no user input. By Daniel 'Dang' Griffith
3567 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3575 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3568 Francois Pinard.
3576 Francois Pinard.
3569
3577
3570 2004-04-02 Fernando Perez <fperez@colorado.edu>
3578 2004-04-02 Fernando Perez <fperez@colorado.edu>
3571
3579
3572 * IPython/genutils.py (Stream.__init__): Modified to survive at
3580 * IPython/genutils.py (Stream.__init__): Modified to survive at
3573 least importing in contexts where stdin/out/err aren't true file
3581 least importing in contexts where stdin/out/err aren't true file
3574 objects, such as PyCrust (they lack fileno() and mode). However,
3582 objects, such as PyCrust (they lack fileno() and mode). However,
3575 the recovery facilities which rely on these things existing will
3583 the recovery facilities which rely on these things existing will
3576 not work.
3584 not work.
3577
3585
3578 2004-04-01 Fernando Perez <fperez@colorado.edu>
3586 2004-04-01 Fernando Perez <fperez@colorado.edu>
3579
3587
3580 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3588 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3581 use the new getoutputerror() function, so it properly
3589 use the new getoutputerror() function, so it properly
3582 distinguishes stdout/err.
3590 distinguishes stdout/err.
3583
3591
3584 * IPython/genutils.py (getoutputerror): added a function to
3592 * IPython/genutils.py (getoutputerror): added a function to
3585 capture separately the standard output and error of a command.
3593 capture separately the standard output and error of a command.
3586 After a comment from dang on the mailing lists. This code is
3594 After a comment from dang on the mailing lists. This code is
3587 basically a modified version of commands.getstatusoutput(), from
3595 basically a modified version of commands.getstatusoutput(), from
3588 the standard library.
3596 the standard library.
3589
3597
3590 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3598 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3591 '!!' as a special syntax (shorthand) to access @sx.
3599 '!!' as a special syntax (shorthand) to access @sx.
3592
3600
3593 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3601 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3594 command and return its output as a list split on '\n'.
3602 command and return its output as a list split on '\n'.
3595
3603
3596 2004-03-31 Fernando Perez <fperez@colorado.edu>
3604 2004-03-31 Fernando Perez <fperez@colorado.edu>
3597
3605
3598 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3606 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3599 method to dictionaries used as FakeModule instances if they lack
3607 method to dictionaries used as FakeModule instances if they lack
3600 it. At least pydoc in python2.3 breaks for runtime-defined
3608 it. At least pydoc in python2.3 breaks for runtime-defined
3601 functions without this hack. At some point I need to _really_
3609 functions without this hack. At some point I need to _really_
3602 understand what FakeModule is doing, because it's a gross hack.
3610 understand what FakeModule is doing, because it's a gross hack.
3603 But it solves Arnd's problem for now...
3611 But it solves Arnd's problem for now...
3604
3612
3605 2004-02-27 Fernando Perez <fperez@colorado.edu>
3613 2004-02-27 Fernando Perez <fperez@colorado.edu>
3606
3614
3607 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3615 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3608 mode would behave erratically. Also increased the number of
3616 mode would behave erratically. Also increased the number of
3609 possible logs in rotate mod to 999. Thanks to Rod Holland
3617 possible logs in rotate mod to 999. Thanks to Rod Holland
3610 <rhh@StructureLABS.com> for the report and fixes.
3618 <rhh@StructureLABS.com> for the report and fixes.
3611
3619
3612 2004-02-26 Fernando Perez <fperez@colorado.edu>
3620 2004-02-26 Fernando Perez <fperez@colorado.edu>
3613
3621
3614 * IPython/genutils.py (page): Check that the curses module really
3622 * IPython/genutils.py (page): Check that the curses module really
3615 has the initscr attribute before trying to use it. For some
3623 has the initscr attribute before trying to use it. For some
3616 reason, the Solaris curses module is missing this. I think this
3624 reason, the Solaris curses module is missing this. I think this
3617 should be considered a Solaris python bug, but I'm not sure.
3625 should be considered a Solaris python bug, but I'm not sure.
3618
3626
3619 2004-01-17 Fernando Perez <fperez@colorado.edu>
3627 2004-01-17 Fernando Perez <fperez@colorado.edu>
3620
3628
3621 * IPython/genutils.py (Stream.__init__): Changes to try to make
3629 * IPython/genutils.py (Stream.__init__): Changes to try to make
3622 ipython robust against stdin/out/err being closed by the user.
3630 ipython robust against stdin/out/err being closed by the user.
3623 This is 'user error' (and blocks a normal python session, at least
3631 This is 'user error' (and blocks a normal python session, at least
3624 the stdout case). However, Ipython should be able to survive such
3632 the stdout case). However, Ipython should be able to survive such
3625 instances of abuse as gracefully as possible. To simplify the
3633 instances of abuse as gracefully as possible. To simplify the
3626 coding and maintain compatibility with Gary Bishop's Term
3634 coding and maintain compatibility with Gary Bishop's Term
3627 contributions, I've made use of classmethods for this. I think
3635 contributions, I've made use of classmethods for this. I think
3628 this introduces a dependency on python 2.2.
3636 this introduces a dependency on python 2.2.
3629
3637
3630 2004-01-13 Fernando Perez <fperez@colorado.edu>
3638 2004-01-13 Fernando Perez <fperez@colorado.edu>
3631
3639
3632 * IPython/numutils.py (exp_safe): simplified the code a bit and
3640 * IPython/numutils.py (exp_safe): simplified the code a bit and
3633 removed the need for importing the kinds module altogether.
3641 removed the need for importing the kinds module altogether.
3634
3642
3635 2004-01-06 Fernando Perez <fperez@colorado.edu>
3643 2004-01-06 Fernando Perez <fperez@colorado.edu>
3636
3644
3637 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3645 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3638 a magic function instead, after some community feedback. No
3646 a magic function instead, after some community feedback. No
3639 special syntax will exist for it, but its name is deliberately
3647 special syntax will exist for it, but its name is deliberately
3640 very short.
3648 very short.
3641
3649
3642 2003-12-20 Fernando Perez <fperez@colorado.edu>
3650 2003-12-20 Fernando Perez <fperez@colorado.edu>
3643
3651
3644 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3652 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3645 new functionality, to automagically assign the result of a shell
3653 new functionality, to automagically assign the result of a shell
3646 command to a variable. I'll solicit some community feedback on
3654 command to a variable. I'll solicit some community feedback on
3647 this before making it permanent.
3655 this before making it permanent.
3648
3656
3649 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3657 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3650 requested about callables for which inspect couldn't obtain a
3658 requested about callables for which inspect couldn't obtain a
3651 proper argspec. Thanks to a crash report sent by Etienne
3659 proper argspec. Thanks to a crash report sent by Etienne
3652 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3660 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3653
3661
3654 2003-12-09 Fernando Perez <fperez@colorado.edu>
3662 2003-12-09 Fernando Perez <fperez@colorado.edu>
3655
3663
3656 * IPython/genutils.py (page): patch for the pager to work across
3664 * IPython/genutils.py (page): patch for the pager to work across
3657 various versions of Windows. By Gary Bishop.
3665 various versions of Windows. By Gary Bishop.
3658
3666
3659 2003-12-04 Fernando Perez <fperez@colorado.edu>
3667 2003-12-04 Fernando Perez <fperez@colorado.edu>
3660
3668
3661 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3669 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3662 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3670 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3663 While I tested this and it looks ok, there may still be corner
3671 While I tested this and it looks ok, there may still be corner
3664 cases I've missed.
3672 cases I've missed.
3665
3673
3666 2003-12-01 Fernando Perez <fperez@colorado.edu>
3674 2003-12-01 Fernando Perez <fperez@colorado.edu>
3667
3675
3668 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3676 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3669 where a line like 'p,q=1,2' would fail because the automagic
3677 where a line like 'p,q=1,2' would fail because the automagic
3670 system would be triggered for @p.
3678 system would be triggered for @p.
3671
3679
3672 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3680 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3673 cleanups, code unmodified.
3681 cleanups, code unmodified.
3674
3682
3675 * IPython/genutils.py (Term): added a class for IPython to handle
3683 * IPython/genutils.py (Term): added a class for IPython to handle
3676 output. In most cases it will just be a proxy for stdout/err, but
3684 output. In most cases it will just be a proxy for stdout/err, but
3677 having this allows modifications to be made for some platforms,
3685 having this allows modifications to be made for some platforms,
3678 such as handling color escapes under Windows. All of this code
3686 such as handling color escapes under Windows. All of this code
3679 was contributed by Gary Bishop, with minor modifications by me.
3687 was contributed by Gary Bishop, with minor modifications by me.
3680 The actual changes affect many files.
3688 The actual changes affect many files.
3681
3689
3682 2003-11-30 Fernando Perez <fperez@colorado.edu>
3690 2003-11-30 Fernando Perez <fperez@colorado.edu>
3683
3691
3684 * IPython/iplib.py (file_matches): new completion code, courtesy
3692 * IPython/iplib.py (file_matches): new completion code, courtesy
3685 of Jeff Collins. This enables filename completion again under
3693 of Jeff Collins. This enables filename completion again under
3686 python 2.3, which disabled it at the C level.
3694 python 2.3, which disabled it at the C level.
3687
3695
3688 2003-11-11 Fernando Perez <fperez@colorado.edu>
3696 2003-11-11 Fernando Perez <fperez@colorado.edu>
3689
3697
3690 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3698 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3691 for Numeric.array(map(...)), but often convenient.
3699 for Numeric.array(map(...)), but often convenient.
3692
3700
3693 2003-11-05 Fernando Perez <fperez@colorado.edu>
3701 2003-11-05 Fernando Perez <fperez@colorado.edu>
3694
3702
3695 * IPython/numutils.py (frange): Changed a call from int() to
3703 * IPython/numutils.py (frange): Changed a call from int() to
3696 int(round()) to prevent a problem reported with arange() in the
3704 int(round()) to prevent a problem reported with arange() in the
3697 numpy list.
3705 numpy list.
3698
3706
3699 2003-10-06 Fernando Perez <fperez@colorado.edu>
3707 2003-10-06 Fernando Perez <fperez@colorado.edu>
3700
3708
3701 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3709 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3702 prevent crashes if sys lacks an argv attribute (it happens with
3710 prevent crashes if sys lacks an argv attribute (it happens with
3703 embedded interpreters which build a bare-bones sys module).
3711 embedded interpreters which build a bare-bones sys module).
3704 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3712 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3705
3713
3706 2003-09-24 Fernando Perez <fperez@colorado.edu>
3714 2003-09-24 Fernando Perez <fperez@colorado.edu>
3707
3715
3708 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3716 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3709 to protect against poorly written user objects where __getattr__
3717 to protect against poorly written user objects where __getattr__
3710 raises exceptions other than AttributeError. Thanks to a bug
3718 raises exceptions other than AttributeError. Thanks to a bug
3711 report by Oliver Sander <osander-AT-gmx.de>.
3719 report by Oliver Sander <osander-AT-gmx.de>.
3712
3720
3713 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3721 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3714 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3722 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3715
3723
3716 2003-09-09 Fernando Perez <fperez@colorado.edu>
3724 2003-09-09 Fernando Perez <fperez@colorado.edu>
3717
3725
3718 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3726 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3719 unpacking a list whith a callable as first element would
3727 unpacking a list whith a callable as first element would
3720 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3728 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3721 Collins.
3729 Collins.
3722
3730
3723 2003-08-25 *** Released version 0.5.0
3731 2003-08-25 *** Released version 0.5.0
3724
3732
3725 2003-08-22 Fernando Perez <fperez@colorado.edu>
3733 2003-08-22 Fernando Perez <fperez@colorado.edu>
3726
3734
3727 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3735 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3728 improperly defined user exceptions. Thanks to feedback from Mark
3736 improperly defined user exceptions. Thanks to feedback from Mark
3729 Russell <mrussell-AT-verio.net>.
3737 Russell <mrussell-AT-verio.net>.
3730
3738
3731 2003-08-20 Fernando Perez <fperez@colorado.edu>
3739 2003-08-20 Fernando Perez <fperez@colorado.edu>
3732
3740
3733 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3741 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3734 printing so that it would print multi-line string forms starting
3742 printing so that it would print multi-line string forms starting
3735 with a new line. This way the formatting is better respected for
3743 with a new line. This way the formatting is better respected for
3736 objects which work hard to make nice string forms.
3744 objects which work hard to make nice string forms.
3737
3745
3738 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3746 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3739 autocall would overtake data access for objects with both
3747 autocall would overtake data access for objects with both
3740 __getitem__ and __call__.
3748 __getitem__ and __call__.
3741
3749
3742 2003-08-19 *** Released version 0.5.0-rc1
3750 2003-08-19 *** Released version 0.5.0-rc1
3743
3751
3744 2003-08-19 Fernando Perez <fperez@colorado.edu>
3752 2003-08-19 Fernando Perez <fperez@colorado.edu>
3745
3753
3746 * IPython/deep_reload.py (load_tail): single tiny change here
3754 * IPython/deep_reload.py (load_tail): single tiny change here
3747 seems to fix the long-standing bug of dreload() failing to work
3755 seems to fix the long-standing bug of dreload() failing to work
3748 for dotted names. But this module is pretty tricky, so I may have
3756 for dotted names. But this module is pretty tricky, so I may have
3749 missed some subtlety. Needs more testing!.
3757 missed some subtlety. Needs more testing!.
3750
3758
3751 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3759 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3752 exceptions which have badly implemented __str__ methods.
3760 exceptions which have badly implemented __str__ methods.
3753 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3761 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3754 which I've been getting reports about from Python 2.3 users. I
3762 which I've been getting reports about from Python 2.3 users. I
3755 wish I had a simple test case to reproduce the problem, so I could
3763 wish I had a simple test case to reproduce the problem, so I could
3756 either write a cleaner workaround or file a bug report if
3764 either write a cleaner workaround or file a bug report if
3757 necessary.
3765 necessary.
3758
3766
3759 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3767 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3760 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3768 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3761 a bug report by Tjabo Kloppenburg.
3769 a bug report by Tjabo Kloppenburg.
3762
3770
3763 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3771 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3764 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3772 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3765 seems rather unstable. Thanks to a bug report by Tjabo
3773 seems rather unstable. Thanks to a bug report by Tjabo
3766 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3774 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3767
3775
3768 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3776 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3769 this out soon because of the critical fixes in the inner loop for
3777 this out soon because of the critical fixes in the inner loop for
3770 generators.
3778 generators.
3771
3779
3772 * IPython/Magic.py (Magic.getargspec): removed. This (and
3780 * IPython/Magic.py (Magic.getargspec): removed. This (and
3773 _get_def) have been obsoleted by OInspect for a long time, I
3781 _get_def) have been obsoleted by OInspect for a long time, I
3774 hadn't noticed that they were dead code.
3782 hadn't noticed that they were dead code.
3775 (Magic._ofind): restored _ofind functionality for a few literals
3783 (Magic._ofind): restored _ofind functionality for a few literals
3776 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3784 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3777 for things like "hello".capitalize?, since that would require a
3785 for things like "hello".capitalize?, since that would require a
3778 potentially dangerous eval() again.
3786 potentially dangerous eval() again.
3779
3787
3780 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3788 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3781 logic a bit more to clean up the escapes handling and minimize the
3789 logic a bit more to clean up the escapes handling and minimize the
3782 use of _ofind to only necessary cases. The interactive 'feel' of
3790 use of _ofind to only necessary cases. The interactive 'feel' of
3783 IPython should have improved quite a bit with the changes in
3791 IPython should have improved quite a bit with the changes in
3784 _prefilter and _ofind (besides being far safer than before).
3792 _prefilter and _ofind (besides being far safer than before).
3785
3793
3786 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3794 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3787 obscure, never reported). Edit would fail to find the object to
3795 obscure, never reported). Edit would fail to find the object to
3788 edit under some circumstances.
3796 edit under some circumstances.
3789 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3797 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3790 which were causing double-calling of generators. Those eval calls
3798 which were causing double-calling of generators. Those eval calls
3791 were _very_ dangerous, since code with side effects could be
3799 were _very_ dangerous, since code with side effects could be
3792 triggered. As they say, 'eval is evil'... These were the
3800 triggered. As they say, 'eval is evil'... These were the
3793 nastiest evals in IPython. Besides, _ofind is now far simpler,
3801 nastiest evals in IPython. Besides, _ofind is now far simpler,
3794 and it should also be quite a bit faster. Its use of inspect is
3802 and it should also be quite a bit faster. Its use of inspect is
3795 also safer, so perhaps some of the inspect-related crashes I've
3803 also safer, so perhaps some of the inspect-related crashes I've
3796 seen lately with Python 2.3 might be taken care of. That will
3804 seen lately with Python 2.3 might be taken care of. That will
3797 need more testing.
3805 need more testing.
3798
3806
3799 2003-08-17 Fernando Perez <fperez@colorado.edu>
3807 2003-08-17 Fernando Perez <fperez@colorado.edu>
3800
3808
3801 * IPython/iplib.py (InteractiveShell._prefilter): significant
3809 * IPython/iplib.py (InteractiveShell._prefilter): significant
3802 simplifications to the logic for handling user escapes. Faster
3810 simplifications to the logic for handling user escapes. Faster
3803 and simpler code.
3811 and simpler code.
3804
3812
3805 2003-08-14 Fernando Perez <fperez@colorado.edu>
3813 2003-08-14 Fernando Perez <fperez@colorado.edu>
3806
3814
3807 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3815 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3808 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3816 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3809 but it should be quite a bit faster. And the recursive version
3817 but it should be quite a bit faster. And the recursive version
3810 generated O(log N) intermediate storage for all rank>1 arrays,
3818 generated O(log N) intermediate storage for all rank>1 arrays,
3811 even if they were contiguous.
3819 even if they were contiguous.
3812 (l1norm): Added this function.
3820 (l1norm): Added this function.
3813 (norm): Added this function for arbitrary norms (including
3821 (norm): Added this function for arbitrary norms (including
3814 l-infinity). l1 and l2 are still special cases for convenience
3822 l-infinity). l1 and l2 are still special cases for convenience
3815 and speed.
3823 and speed.
3816
3824
3817 2003-08-03 Fernando Perez <fperez@colorado.edu>
3825 2003-08-03 Fernando Perez <fperez@colorado.edu>
3818
3826
3819 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3827 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3820 exceptions, which now raise PendingDeprecationWarnings in Python
3828 exceptions, which now raise PendingDeprecationWarnings in Python
3821 2.3. There were some in Magic and some in Gnuplot2.
3829 2.3. There were some in Magic and some in Gnuplot2.
3822
3830
3823 2003-06-30 Fernando Perez <fperez@colorado.edu>
3831 2003-06-30 Fernando Perez <fperez@colorado.edu>
3824
3832
3825 * IPython/genutils.py (page): modified to call curses only for
3833 * IPython/genutils.py (page): modified to call curses only for
3826 terminals where TERM=='xterm'. After problems under many other
3834 terminals where TERM=='xterm'. After problems under many other
3827 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3835 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3828
3836
3829 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3837 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3830 would be triggered when readline was absent. This was just an old
3838 would be triggered when readline was absent. This was just an old
3831 debugging statement I'd forgotten to take out.
3839 debugging statement I'd forgotten to take out.
3832
3840
3833 2003-06-20 Fernando Perez <fperez@colorado.edu>
3841 2003-06-20 Fernando Perez <fperez@colorado.edu>
3834
3842
3835 * IPython/genutils.py (clock): modified to return only user time
3843 * IPython/genutils.py (clock): modified to return only user time
3836 (not counting system time), after a discussion on scipy. While
3844 (not counting system time), after a discussion on scipy. While
3837 system time may be a useful quantity occasionally, it may much
3845 system time may be a useful quantity occasionally, it may much
3838 more easily be skewed by occasional swapping or other similar
3846 more easily be skewed by occasional swapping or other similar
3839 activity.
3847 activity.
3840
3848
3841 2003-06-05 Fernando Perez <fperez@colorado.edu>
3849 2003-06-05 Fernando Perez <fperez@colorado.edu>
3842
3850
3843 * IPython/numutils.py (identity): new function, for building
3851 * IPython/numutils.py (identity): new function, for building
3844 arbitrary rank Kronecker deltas (mostly backwards compatible with
3852 arbitrary rank Kronecker deltas (mostly backwards compatible with
3845 Numeric.identity)
3853 Numeric.identity)
3846
3854
3847 2003-06-03 Fernando Perez <fperez@colorado.edu>
3855 2003-06-03 Fernando Perez <fperez@colorado.edu>
3848
3856
3849 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3857 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3850 arguments passed to magics with spaces, to allow trailing '\' to
3858 arguments passed to magics with spaces, to allow trailing '\' to
3851 work normally (mainly for Windows users).
3859 work normally (mainly for Windows users).
3852
3860
3853 2003-05-29 Fernando Perez <fperez@colorado.edu>
3861 2003-05-29 Fernando Perez <fperez@colorado.edu>
3854
3862
3855 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3863 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3856 instead of pydoc.help. This fixes a bizarre behavior where
3864 instead of pydoc.help. This fixes a bizarre behavior where
3857 printing '%s' % locals() would trigger the help system. Now
3865 printing '%s' % locals() would trigger the help system. Now
3858 ipython behaves like normal python does.
3866 ipython behaves like normal python does.
3859
3867
3860 Note that if one does 'from pydoc import help', the bizarre
3868 Note that if one does 'from pydoc import help', the bizarre
3861 behavior returns, but this will also happen in normal python, so
3869 behavior returns, but this will also happen in normal python, so
3862 it's not an ipython bug anymore (it has to do with how pydoc.help
3870 it's not an ipython bug anymore (it has to do with how pydoc.help
3863 is implemented).
3871 is implemented).
3864
3872
3865 2003-05-22 Fernando Perez <fperez@colorado.edu>
3873 2003-05-22 Fernando Perez <fperez@colorado.edu>
3866
3874
3867 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3875 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3868 return [] instead of None when nothing matches, also match to end
3876 return [] instead of None when nothing matches, also match to end
3869 of line. Patch by Gary Bishop.
3877 of line. Patch by Gary Bishop.
3870
3878
3871 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3879 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3872 protection as before, for files passed on the command line. This
3880 protection as before, for files passed on the command line. This
3873 prevents the CrashHandler from kicking in if user files call into
3881 prevents the CrashHandler from kicking in if user files call into
3874 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3882 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3875 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3883 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3876
3884
3877 2003-05-20 *** Released version 0.4.0
3885 2003-05-20 *** Released version 0.4.0
3878
3886
3879 2003-05-20 Fernando Perez <fperez@colorado.edu>
3887 2003-05-20 Fernando Perez <fperez@colorado.edu>
3880
3888
3881 * setup.py: added support for manpages. It's a bit hackish b/c of
3889 * setup.py: added support for manpages. It's a bit hackish b/c of
3882 a bug in the way the bdist_rpm distutils target handles gzipped
3890 a bug in the way the bdist_rpm distutils target handles gzipped
3883 manpages, but it works. After a patch by Jack.
3891 manpages, but it works. After a patch by Jack.
3884
3892
3885 2003-05-19 Fernando Perez <fperez@colorado.edu>
3893 2003-05-19 Fernando Perez <fperez@colorado.edu>
3886
3894
3887 * IPython/numutils.py: added a mockup of the kinds module, since
3895 * IPython/numutils.py: added a mockup of the kinds module, since
3888 it was recently removed from Numeric. This way, numutils will
3896 it was recently removed from Numeric. This way, numutils will
3889 work for all users even if they are missing kinds.
3897 work for all users even if they are missing kinds.
3890
3898
3891 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3899 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3892 failure, which can occur with SWIG-wrapped extensions. After a
3900 failure, which can occur with SWIG-wrapped extensions. After a
3893 crash report from Prabhu.
3901 crash report from Prabhu.
3894
3902
3895 2003-05-16 Fernando Perez <fperez@colorado.edu>
3903 2003-05-16 Fernando Perez <fperez@colorado.edu>
3896
3904
3897 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3905 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3898 protect ipython from user code which may call directly
3906 protect ipython from user code which may call directly
3899 sys.excepthook (this looks like an ipython crash to the user, even
3907 sys.excepthook (this looks like an ipython crash to the user, even
3900 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3908 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3901 This is especially important to help users of WxWindows, but may
3909 This is especially important to help users of WxWindows, but may
3902 also be useful in other cases.
3910 also be useful in other cases.
3903
3911
3904 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3912 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3905 an optional tb_offset to be specified, and to preserve exception
3913 an optional tb_offset to be specified, and to preserve exception
3906 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3914 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3907
3915
3908 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3916 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3909
3917
3910 2003-05-15 Fernando Perez <fperez@colorado.edu>
3918 2003-05-15 Fernando Perez <fperez@colorado.edu>
3911
3919
3912 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3920 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3913 installing for a new user under Windows.
3921 installing for a new user under Windows.
3914
3922
3915 2003-05-12 Fernando Perez <fperez@colorado.edu>
3923 2003-05-12 Fernando Perez <fperez@colorado.edu>
3916
3924
3917 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3925 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3918 handler for Emacs comint-based lines. Currently it doesn't do
3926 handler for Emacs comint-based lines. Currently it doesn't do
3919 much (but importantly, it doesn't update the history cache). In
3927 much (but importantly, it doesn't update the history cache). In
3920 the future it may be expanded if Alex needs more functionality
3928 the future it may be expanded if Alex needs more functionality
3921 there.
3929 there.
3922
3930
3923 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3931 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3924 info to crash reports.
3932 info to crash reports.
3925
3933
3926 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3934 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3927 just like Python's -c. Also fixed crash with invalid -color
3935 just like Python's -c. Also fixed crash with invalid -color
3928 option value at startup. Thanks to Will French
3936 option value at startup. Thanks to Will French
3929 <wfrench-AT-bestweb.net> for the bug report.
3937 <wfrench-AT-bestweb.net> for the bug report.
3930
3938
3931 2003-05-09 Fernando Perez <fperez@colorado.edu>
3939 2003-05-09 Fernando Perez <fperez@colorado.edu>
3932
3940
3933 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3941 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3934 to EvalDict (it's a mapping, after all) and simplified its code
3942 to EvalDict (it's a mapping, after all) and simplified its code
3935 quite a bit, after a nice discussion on c.l.py where Gustavo
3943 quite a bit, after a nice discussion on c.l.py where Gustavo
3936 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3944 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3937
3945
3938 2003-04-30 Fernando Perez <fperez@colorado.edu>
3946 2003-04-30 Fernando Perez <fperez@colorado.edu>
3939
3947
3940 * IPython/genutils.py (timings_out): modified it to reduce its
3948 * IPython/genutils.py (timings_out): modified it to reduce its
3941 overhead in the common reps==1 case.
3949 overhead in the common reps==1 case.
3942
3950
3943 2003-04-29 Fernando Perez <fperez@colorado.edu>
3951 2003-04-29 Fernando Perez <fperez@colorado.edu>
3944
3952
3945 * IPython/genutils.py (timings_out): Modified to use the resource
3953 * IPython/genutils.py (timings_out): Modified to use the resource
3946 module, which avoids the wraparound problems of time.clock().
3954 module, which avoids the wraparound problems of time.clock().
3947
3955
3948 2003-04-17 *** Released version 0.2.15pre4
3956 2003-04-17 *** Released version 0.2.15pre4
3949
3957
3950 2003-04-17 Fernando Perez <fperez@colorado.edu>
3958 2003-04-17 Fernando Perez <fperez@colorado.edu>
3951
3959
3952 * setup.py (scriptfiles): Split windows-specific stuff over to a
3960 * setup.py (scriptfiles): Split windows-specific stuff over to a
3953 separate file, in an attempt to have a Windows GUI installer.
3961 separate file, in an attempt to have a Windows GUI installer.
3954 That didn't work, but part of the groundwork is done.
3962 That didn't work, but part of the groundwork is done.
3955
3963
3956 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3964 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3957 indent/unindent with 4 spaces. Particularly useful in combination
3965 indent/unindent with 4 spaces. Particularly useful in combination
3958 with the new auto-indent option.
3966 with the new auto-indent option.
3959
3967
3960 2003-04-16 Fernando Perez <fperez@colorado.edu>
3968 2003-04-16 Fernando Perez <fperez@colorado.edu>
3961
3969
3962 * IPython/Magic.py: various replacements of self.rc for
3970 * IPython/Magic.py: various replacements of self.rc for
3963 self.shell.rc. A lot more remains to be done to fully disentangle
3971 self.shell.rc. A lot more remains to be done to fully disentangle
3964 this class from the main Shell class.
3972 this class from the main Shell class.
3965
3973
3966 * IPython/GnuplotRuntime.py: added checks for mouse support so
3974 * IPython/GnuplotRuntime.py: added checks for mouse support so
3967 that we don't try to enable it if the current gnuplot doesn't
3975 that we don't try to enable it if the current gnuplot doesn't
3968 really support it. Also added checks so that we don't try to
3976 really support it. Also added checks so that we don't try to
3969 enable persist under Windows (where Gnuplot doesn't recognize the
3977 enable persist under Windows (where Gnuplot doesn't recognize the
3970 option).
3978 option).
3971
3979
3972 * IPython/iplib.py (InteractiveShell.interact): Added optional
3980 * IPython/iplib.py (InteractiveShell.interact): Added optional
3973 auto-indenting code, after a patch by King C. Shu
3981 auto-indenting code, after a patch by King C. Shu
3974 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3982 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3975 get along well with pasting indented code. If I ever figure out
3983 get along well with pasting indented code. If I ever figure out
3976 how to make that part go well, it will become on by default.
3984 how to make that part go well, it will become on by default.
3977
3985
3978 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3986 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3979 crash ipython if there was an unmatched '%' in the user's prompt
3987 crash ipython if there was an unmatched '%' in the user's prompt
3980 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3988 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3981
3989
3982 * IPython/iplib.py (InteractiveShell.interact): removed the
3990 * IPython/iplib.py (InteractiveShell.interact): removed the
3983 ability to ask the user whether he wants to crash or not at the
3991 ability to ask the user whether he wants to crash or not at the
3984 'last line' exception handler. Calling functions at that point
3992 'last line' exception handler. Calling functions at that point
3985 changes the stack, and the error reports would have incorrect
3993 changes the stack, and the error reports would have incorrect
3986 tracebacks.
3994 tracebacks.
3987
3995
3988 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3996 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3989 pass through a peger a pretty-printed form of any object. After a
3997 pass through a peger a pretty-printed form of any object. After a
3990 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3998 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3991
3999
3992 2003-04-14 Fernando Perez <fperez@colorado.edu>
4000 2003-04-14 Fernando Perez <fperez@colorado.edu>
3993
4001
3994 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4002 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3995 all files in ~ would be modified at first install (instead of
4003 all files in ~ would be modified at first install (instead of
3996 ~/.ipython). This could be potentially disastrous, as the
4004 ~/.ipython). This could be potentially disastrous, as the
3997 modification (make line-endings native) could damage binary files.
4005 modification (make line-endings native) could damage binary files.
3998
4006
3999 2003-04-10 Fernando Perez <fperez@colorado.edu>
4007 2003-04-10 Fernando Perez <fperez@colorado.edu>
4000
4008
4001 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4009 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4002 handle only lines which are invalid python. This now means that
4010 handle only lines which are invalid python. This now means that
4003 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4011 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4004 for the bug report.
4012 for the bug report.
4005
4013
4006 2003-04-01 Fernando Perez <fperez@colorado.edu>
4014 2003-04-01 Fernando Perez <fperez@colorado.edu>
4007
4015
4008 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4016 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4009 where failing to set sys.last_traceback would crash pdb.pm().
4017 where failing to set sys.last_traceback would crash pdb.pm().
4010 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4018 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4011 report.
4019 report.
4012
4020
4013 2003-03-25 Fernando Perez <fperez@colorado.edu>
4021 2003-03-25 Fernando Perez <fperez@colorado.edu>
4014
4022
4015 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4023 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4016 before printing it (it had a lot of spurious blank lines at the
4024 before printing it (it had a lot of spurious blank lines at the
4017 end).
4025 end).
4018
4026
4019 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4027 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4020 output would be sent 21 times! Obviously people don't use this
4028 output would be sent 21 times! Obviously people don't use this
4021 too often, or I would have heard about it.
4029 too often, or I would have heard about it.
4022
4030
4023 2003-03-24 Fernando Perez <fperez@colorado.edu>
4031 2003-03-24 Fernando Perez <fperez@colorado.edu>
4024
4032
4025 * setup.py (scriptfiles): renamed the data_files parameter from
4033 * setup.py (scriptfiles): renamed the data_files parameter from
4026 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4034 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4027 for the patch.
4035 for the patch.
4028
4036
4029 2003-03-20 Fernando Perez <fperez@colorado.edu>
4037 2003-03-20 Fernando Perez <fperez@colorado.edu>
4030
4038
4031 * IPython/genutils.py (error): added error() and fatal()
4039 * IPython/genutils.py (error): added error() and fatal()
4032 functions.
4040 functions.
4033
4041
4034 2003-03-18 *** Released version 0.2.15pre3
4042 2003-03-18 *** Released version 0.2.15pre3
4035
4043
4036 2003-03-18 Fernando Perez <fperez@colorado.edu>
4044 2003-03-18 Fernando Perez <fperez@colorado.edu>
4037
4045
4038 * setupext/install_data_ext.py
4046 * setupext/install_data_ext.py
4039 (install_data_ext.initialize_options): Class contributed by Jack
4047 (install_data_ext.initialize_options): Class contributed by Jack
4040 Moffit for fixing the old distutils hack. He is sending this to
4048 Moffit for fixing the old distutils hack. He is sending this to
4041 the distutils folks so in the future we may not need it as a
4049 the distutils folks so in the future we may not need it as a
4042 private fix.
4050 private fix.
4043
4051
4044 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4052 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4045 changes for Debian packaging. See his patch for full details.
4053 changes for Debian packaging. See his patch for full details.
4046 The old distutils hack of making the ipythonrc* files carry a
4054 The old distutils hack of making the ipythonrc* files carry a
4047 bogus .py extension is gone, at last. Examples were moved to a
4055 bogus .py extension is gone, at last. Examples were moved to a
4048 separate subdir under doc/, and the separate executable scripts
4056 separate subdir under doc/, and the separate executable scripts
4049 now live in their own directory. Overall a great cleanup. The
4057 now live in their own directory. Overall a great cleanup. The
4050 manual was updated to use the new files, and setup.py has been
4058 manual was updated to use the new files, and setup.py has been
4051 fixed for this setup.
4059 fixed for this setup.
4052
4060
4053 * IPython/PyColorize.py (Parser.usage): made non-executable and
4061 * IPython/PyColorize.py (Parser.usage): made non-executable and
4054 created a pycolor wrapper around it to be included as a script.
4062 created a pycolor wrapper around it to be included as a script.
4055
4063
4056 2003-03-12 *** Released version 0.2.15pre2
4064 2003-03-12 *** Released version 0.2.15pre2
4057
4065
4058 2003-03-12 Fernando Perez <fperez@colorado.edu>
4066 2003-03-12 Fernando Perez <fperez@colorado.edu>
4059
4067
4060 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4068 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4061 long-standing problem with garbage characters in some terminals.
4069 long-standing problem with garbage characters in some terminals.
4062 The issue was really that the \001 and \002 escapes must _only_ be
4070 The issue was really that the \001 and \002 escapes must _only_ be
4063 passed to input prompts (which call readline), but _never_ to
4071 passed to input prompts (which call readline), but _never_ to
4064 normal text to be printed on screen. I changed ColorANSI to have
4072 normal text to be printed on screen. I changed ColorANSI to have
4065 two classes: TermColors and InputTermColors, each with the
4073 two classes: TermColors and InputTermColors, each with the
4066 appropriate escapes for input prompts or normal text. The code in
4074 appropriate escapes for input prompts or normal text. The code in
4067 Prompts.py got slightly more complicated, but this very old and
4075 Prompts.py got slightly more complicated, but this very old and
4068 annoying bug is finally fixed.
4076 annoying bug is finally fixed.
4069
4077
4070 All the credit for nailing down the real origin of this problem
4078 All the credit for nailing down the real origin of this problem
4071 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4079 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4072 *Many* thanks to him for spending quite a bit of effort on this.
4080 *Many* thanks to him for spending quite a bit of effort on this.
4073
4081
4074 2003-03-05 *** Released version 0.2.15pre1
4082 2003-03-05 *** Released version 0.2.15pre1
4075
4083
4076 2003-03-03 Fernando Perez <fperez@colorado.edu>
4084 2003-03-03 Fernando Perez <fperez@colorado.edu>
4077
4085
4078 * IPython/FakeModule.py: Moved the former _FakeModule to a
4086 * IPython/FakeModule.py: Moved the former _FakeModule to a
4079 separate file, because it's also needed by Magic (to fix a similar
4087 separate file, because it's also needed by Magic (to fix a similar
4080 pickle-related issue in @run).
4088 pickle-related issue in @run).
4081
4089
4082 2003-03-02 Fernando Perez <fperez@colorado.edu>
4090 2003-03-02 Fernando Perez <fperez@colorado.edu>
4083
4091
4084 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4092 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4085 the autocall option at runtime.
4093 the autocall option at runtime.
4086 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4094 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4087 across Magic.py to start separating Magic from InteractiveShell.
4095 across Magic.py to start separating Magic from InteractiveShell.
4088 (Magic._ofind): Fixed to return proper namespace for dotted
4096 (Magic._ofind): Fixed to return proper namespace for dotted
4089 names. Before, a dotted name would always return 'not currently
4097 names. Before, a dotted name would always return 'not currently
4090 defined', because it would find the 'parent'. s.x would be found,
4098 defined', because it would find the 'parent'. s.x would be found,
4091 but since 'x' isn't defined by itself, it would get confused.
4099 but since 'x' isn't defined by itself, it would get confused.
4092 (Magic.magic_run): Fixed pickling problems reported by Ralf
4100 (Magic.magic_run): Fixed pickling problems reported by Ralf
4093 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4101 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4094 that I'd used when Mike Heeter reported similar issues at the
4102 that I'd used when Mike Heeter reported similar issues at the
4095 top-level, but now for @run. It boils down to injecting the
4103 top-level, but now for @run. It boils down to injecting the
4096 namespace where code is being executed with something that looks
4104 namespace where code is being executed with something that looks
4097 enough like a module to fool pickle.dump(). Since a pickle stores
4105 enough like a module to fool pickle.dump(). Since a pickle stores
4098 a named reference to the importing module, we need this for
4106 a named reference to the importing module, we need this for
4099 pickles to save something sensible.
4107 pickles to save something sensible.
4100
4108
4101 * IPython/ipmaker.py (make_IPython): added an autocall option.
4109 * IPython/ipmaker.py (make_IPython): added an autocall option.
4102
4110
4103 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4111 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4104 the auto-eval code. Now autocalling is an option, and the code is
4112 the auto-eval code. Now autocalling is an option, and the code is
4105 also vastly safer. There is no more eval() involved at all.
4113 also vastly safer. There is no more eval() involved at all.
4106
4114
4107 2003-03-01 Fernando Perez <fperez@colorado.edu>
4115 2003-03-01 Fernando Perez <fperez@colorado.edu>
4108
4116
4109 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4117 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4110 dict with named keys instead of a tuple.
4118 dict with named keys instead of a tuple.
4111
4119
4112 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4120 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4113
4121
4114 * setup.py (make_shortcut): Fixed message about directories
4122 * setup.py (make_shortcut): Fixed message about directories
4115 created during Windows installation (the directories were ok, just
4123 created during Windows installation (the directories were ok, just
4116 the printed message was misleading). Thanks to Chris Liechti
4124 the printed message was misleading). Thanks to Chris Liechti
4117 <cliechti-AT-gmx.net> for the heads up.
4125 <cliechti-AT-gmx.net> for the heads up.
4118
4126
4119 2003-02-21 Fernando Perez <fperez@colorado.edu>
4127 2003-02-21 Fernando Perez <fperez@colorado.edu>
4120
4128
4121 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4129 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4122 of ValueError exception when checking for auto-execution. This
4130 of ValueError exception when checking for auto-execution. This
4123 one is raised by things like Numeric arrays arr.flat when the
4131 one is raised by things like Numeric arrays arr.flat when the
4124 array is non-contiguous.
4132 array is non-contiguous.
4125
4133
4126 2003-01-31 Fernando Perez <fperez@colorado.edu>
4134 2003-01-31 Fernando Perez <fperez@colorado.edu>
4127
4135
4128 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4136 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4129 not return any value at all (even though the command would get
4137 not return any value at all (even though the command would get
4130 executed).
4138 executed).
4131 (xsys): Flush stdout right after printing the command to ensure
4139 (xsys): Flush stdout right after printing the command to ensure
4132 proper ordering of commands and command output in the total
4140 proper ordering of commands and command output in the total
4133 output.
4141 output.
4134 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4142 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4135 system/getoutput as defaults. The old ones are kept for
4143 system/getoutput as defaults. The old ones are kept for
4136 compatibility reasons, so no code which uses this library needs
4144 compatibility reasons, so no code which uses this library needs
4137 changing.
4145 changing.
4138
4146
4139 2003-01-27 *** Released version 0.2.14
4147 2003-01-27 *** Released version 0.2.14
4140
4148
4141 2003-01-25 Fernando Perez <fperez@colorado.edu>
4149 2003-01-25 Fernando Perez <fperez@colorado.edu>
4142
4150
4143 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4151 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4144 functions defined in previous edit sessions could not be re-edited
4152 functions defined in previous edit sessions could not be re-edited
4145 (because the temp files were immediately removed). Now temp files
4153 (because the temp files were immediately removed). Now temp files
4146 are removed only at IPython's exit.
4154 are removed only at IPython's exit.
4147 (Magic.magic_run): Improved @run to perform shell-like expansions
4155 (Magic.magic_run): Improved @run to perform shell-like expansions
4148 on its arguments (~users and $VARS). With this, @run becomes more
4156 on its arguments (~users and $VARS). With this, @run becomes more
4149 like a normal command-line.
4157 like a normal command-line.
4150
4158
4151 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4159 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4152 bugs related to embedding and cleaned up that code. A fairly
4160 bugs related to embedding and cleaned up that code. A fairly
4153 important one was the impossibility to access the global namespace
4161 important one was the impossibility to access the global namespace
4154 through the embedded IPython (only local variables were visible).
4162 through the embedded IPython (only local variables were visible).
4155
4163
4156 2003-01-14 Fernando Perez <fperez@colorado.edu>
4164 2003-01-14 Fernando Perez <fperez@colorado.edu>
4157
4165
4158 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4166 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4159 auto-calling to be a bit more conservative. Now it doesn't get
4167 auto-calling to be a bit more conservative. Now it doesn't get
4160 triggered if any of '!=()<>' are in the rest of the input line, to
4168 triggered if any of '!=()<>' are in the rest of the input line, to
4161 allow comparing callables. Thanks to Alex for the heads up.
4169 allow comparing callables. Thanks to Alex for the heads up.
4162
4170
4163 2003-01-07 Fernando Perez <fperez@colorado.edu>
4171 2003-01-07 Fernando Perez <fperez@colorado.edu>
4164
4172
4165 * IPython/genutils.py (page): fixed estimation of the number of
4173 * IPython/genutils.py (page): fixed estimation of the number of
4166 lines in a string to be paged to simply count newlines. This
4174 lines in a string to be paged to simply count newlines. This
4167 prevents over-guessing due to embedded escape sequences. A better
4175 prevents over-guessing due to embedded escape sequences. A better
4168 long-term solution would involve stripping out the control chars
4176 long-term solution would involve stripping out the control chars
4169 for the count, but it's potentially so expensive I just don't
4177 for the count, but it's potentially so expensive I just don't
4170 think it's worth doing.
4178 think it's worth doing.
4171
4179
4172 2002-12-19 *** Released version 0.2.14pre50
4180 2002-12-19 *** Released version 0.2.14pre50
4173
4181
4174 2002-12-19 Fernando Perez <fperez@colorado.edu>
4182 2002-12-19 Fernando Perez <fperez@colorado.edu>
4175
4183
4176 * tools/release (version): Changed release scripts to inform
4184 * tools/release (version): Changed release scripts to inform
4177 Andrea and build a NEWS file with a list of recent changes.
4185 Andrea and build a NEWS file with a list of recent changes.
4178
4186
4179 * IPython/ColorANSI.py (__all__): changed terminal detection
4187 * IPython/ColorANSI.py (__all__): changed terminal detection
4180 code. Seems to work better for xterms without breaking
4188 code. Seems to work better for xterms without breaking
4181 konsole. Will need more testing to determine if WinXP and Mac OSX
4189 konsole. Will need more testing to determine if WinXP and Mac OSX
4182 also work ok.
4190 also work ok.
4183
4191
4184 2002-12-18 *** Released version 0.2.14pre49
4192 2002-12-18 *** Released version 0.2.14pre49
4185
4193
4186 2002-12-18 Fernando Perez <fperez@colorado.edu>
4194 2002-12-18 Fernando Perez <fperez@colorado.edu>
4187
4195
4188 * Docs: added new info about Mac OSX, from Andrea.
4196 * Docs: added new info about Mac OSX, from Andrea.
4189
4197
4190 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4198 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4191 allow direct plotting of python strings whose format is the same
4199 allow direct plotting of python strings whose format is the same
4192 of gnuplot data files.
4200 of gnuplot data files.
4193
4201
4194 2002-12-16 Fernando Perez <fperez@colorado.edu>
4202 2002-12-16 Fernando Perez <fperez@colorado.edu>
4195
4203
4196 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4204 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4197 value of exit question to be acknowledged.
4205 value of exit question to be acknowledged.
4198
4206
4199 2002-12-03 Fernando Perez <fperez@colorado.edu>
4207 2002-12-03 Fernando Perez <fperez@colorado.edu>
4200
4208
4201 * IPython/ipmaker.py: removed generators, which had been added
4209 * IPython/ipmaker.py: removed generators, which had been added
4202 by mistake in an earlier debugging run. This was causing trouble
4210 by mistake in an earlier debugging run. This was causing trouble
4203 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4211 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4204 for pointing this out.
4212 for pointing this out.
4205
4213
4206 2002-11-17 Fernando Perez <fperez@colorado.edu>
4214 2002-11-17 Fernando Perez <fperez@colorado.edu>
4207
4215
4208 * Manual: updated the Gnuplot section.
4216 * Manual: updated the Gnuplot section.
4209
4217
4210 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4218 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4211 a much better split of what goes in Runtime and what goes in
4219 a much better split of what goes in Runtime and what goes in
4212 Interactive.
4220 Interactive.
4213
4221
4214 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4222 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4215 being imported from iplib.
4223 being imported from iplib.
4216
4224
4217 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4225 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4218 for command-passing. Now the global Gnuplot instance is called
4226 for command-passing. Now the global Gnuplot instance is called
4219 'gp' instead of 'g', which was really a far too fragile and
4227 'gp' instead of 'g', which was really a far too fragile and
4220 common name.
4228 common name.
4221
4229
4222 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4230 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4223 bounding boxes generated by Gnuplot for square plots.
4231 bounding boxes generated by Gnuplot for square plots.
4224
4232
4225 * IPython/genutils.py (popkey): new function added. I should
4233 * IPython/genutils.py (popkey): new function added. I should
4226 suggest this on c.l.py as a dict method, it seems useful.
4234 suggest this on c.l.py as a dict method, it seems useful.
4227
4235
4228 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4236 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4229 to transparently handle PostScript generation. MUCH better than
4237 to transparently handle PostScript generation. MUCH better than
4230 the previous plot_eps/replot_eps (which I removed now). The code
4238 the previous plot_eps/replot_eps (which I removed now). The code
4231 is also fairly clean and well documented now (including
4239 is also fairly clean and well documented now (including
4232 docstrings).
4240 docstrings).
4233
4241
4234 2002-11-13 Fernando Perez <fperez@colorado.edu>
4242 2002-11-13 Fernando Perez <fperez@colorado.edu>
4235
4243
4236 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4244 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4237 (inconsistent with options).
4245 (inconsistent with options).
4238
4246
4239 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4247 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4240 manually disabled, I don't know why. Fixed it.
4248 manually disabled, I don't know why. Fixed it.
4241 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4249 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4242 eps output.
4250 eps output.
4243
4251
4244 2002-11-12 Fernando Perez <fperez@colorado.edu>
4252 2002-11-12 Fernando Perez <fperez@colorado.edu>
4245
4253
4246 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4254 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4247 don't propagate up to caller. Fixes crash reported by François
4255 don't propagate up to caller. Fixes crash reported by François
4248 Pinard.
4256 Pinard.
4249
4257
4250 2002-11-09 Fernando Perez <fperez@colorado.edu>
4258 2002-11-09 Fernando Perez <fperez@colorado.edu>
4251
4259
4252 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4260 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4253 history file for new users.
4261 history file for new users.
4254 (make_IPython): fixed bug where initial install would leave the
4262 (make_IPython): fixed bug where initial install would leave the
4255 user running in the .ipython dir.
4263 user running in the .ipython dir.
4256 (make_IPython): fixed bug where config dir .ipython would be
4264 (make_IPython): fixed bug where config dir .ipython would be
4257 created regardless of the given -ipythondir option. Thanks to Cory
4265 created regardless of the given -ipythondir option. Thanks to Cory
4258 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4266 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4259
4267
4260 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4268 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4261 type confirmations. Will need to use it in all of IPython's code
4269 type confirmations. Will need to use it in all of IPython's code
4262 consistently.
4270 consistently.
4263
4271
4264 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4272 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4265 context to print 31 lines instead of the default 5. This will make
4273 context to print 31 lines instead of the default 5. This will make
4266 the crash reports extremely detailed in case the problem is in
4274 the crash reports extremely detailed in case the problem is in
4267 libraries I don't have access to.
4275 libraries I don't have access to.
4268
4276
4269 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4277 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4270 line of defense' code to still crash, but giving users fair
4278 line of defense' code to still crash, but giving users fair
4271 warning. I don't want internal errors to go unreported: if there's
4279 warning. I don't want internal errors to go unreported: if there's
4272 an internal problem, IPython should crash and generate a full
4280 an internal problem, IPython should crash and generate a full
4273 report.
4281 report.
4274
4282
4275 2002-11-08 Fernando Perez <fperez@colorado.edu>
4283 2002-11-08 Fernando Perez <fperez@colorado.edu>
4276
4284
4277 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4285 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4278 otherwise uncaught exceptions which can appear if people set
4286 otherwise uncaught exceptions which can appear if people set
4279 sys.stdout to something badly broken. Thanks to a crash report
4287 sys.stdout to something badly broken. Thanks to a crash report
4280 from henni-AT-mail.brainbot.com.
4288 from henni-AT-mail.brainbot.com.
4281
4289
4282 2002-11-04 Fernando Perez <fperez@colorado.edu>
4290 2002-11-04 Fernando Perez <fperez@colorado.edu>
4283
4291
4284 * IPython/iplib.py (InteractiveShell.interact): added
4292 * IPython/iplib.py (InteractiveShell.interact): added
4285 __IPYTHON__active to the builtins. It's a flag which goes on when
4293 __IPYTHON__active to the builtins. It's a flag which goes on when
4286 the interaction starts and goes off again when it stops. This
4294 the interaction starts and goes off again when it stops. This
4287 allows embedding code to detect being inside IPython. Before this
4295 allows embedding code to detect being inside IPython. Before this
4288 was done via __IPYTHON__, but that only shows that an IPython
4296 was done via __IPYTHON__, but that only shows that an IPython
4289 instance has been created.
4297 instance has been created.
4290
4298
4291 * IPython/Magic.py (Magic.magic_env): I realized that in a
4299 * IPython/Magic.py (Magic.magic_env): I realized that in a
4292 UserDict, instance.data holds the data as a normal dict. So I
4300 UserDict, instance.data holds the data as a normal dict. So I
4293 modified @env to return os.environ.data instead of rebuilding a
4301 modified @env to return os.environ.data instead of rebuilding a
4294 dict by hand.
4302 dict by hand.
4295
4303
4296 2002-11-02 Fernando Perez <fperez@colorado.edu>
4304 2002-11-02 Fernando Perez <fperez@colorado.edu>
4297
4305
4298 * IPython/genutils.py (warn): changed so that level 1 prints no
4306 * IPython/genutils.py (warn): changed so that level 1 prints no
4299 header. Level 2 is now the default (with 'WARNING' header, as
4307 header. Level 2 is now the default (with 'WARNING' header, as
4300 before). I think I tracked all places where changes were needed in
4308 before). I think I tracked all places where changes were needed in
4301 IPython, but outside code using the old level numbering may have
4309 IPython, but outside code using the old level numbering may have
4302 broken.
4310 broken.
4303
4311
4304 * IPython/iplib.py (InteractiveShell.runcode): added this to
4312 * IPython/iplib.py (InteractiveShell.runcode): added this to
4305 handle the tracebacks in SystemExit traps correctly. The previous
4313 handle the tracebacks in SystemExit traps correctly. The previous
4306 code (through interact) was printing more of the stack than
4314 code (through interact) was printing more of the stack than
4307 necessary, showing IPython internal code to the user.
4315 necessary, showing IPython internal code to the user.
4308
4316
4309 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4317 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4310 default. Now that the default at the confirmation prompt is yes,
4318 default. Now that the default at the confirmation prompt is yes,
4311 it's not so intrusive. François' argument that ipython sessions
4319 it's not so intrusive. François' argument that ipython sessions
4312 tend to be complex enough not to lose them from an accidental C-d,
4320 tend to be complex enough not to lose them from an accidental C-d,
4313 is a valid one.
4321 is a valid one.
4314
4322
4315 * IPython/iplib.py (InteractiveShell.interact): added a
4323 * IPython/iplib.py (InteractiveShell.interact): added a
4316 showtraceback() call to the SystemExit trap, and modified the exit
4324 showtraceback() call to the SystemExit trap, and modified the exit
4317 confirmation to have yes as the default.
4325 confirmation to have yes as the default.
4318
4326
4319 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4327 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4320 this file. It's been gone from the code for a long time, this was
4328 this file. It's been gone from the code for a long time, this was
4321 simply leftover junk.
4329 simply leftover junk.
4322
4330
4323 2002-11-01 Fernando Perez <fperez@colorado.edu>
4331 2002-11-01 Fernando Perez <fperez@colorado.edu>
4324
4332
4325 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4333 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4326 added. If set, IPython now traps EOF and asks for
4334 added. If set, IPython now traps EOF and asks for
4327 confirmation. After a request by François Pinard.
4335 confirmation. After a request by François Pinard.
4328
4336
4329 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4337 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4330 of @abort, and with a new (better) mechanism for handling the
4338 of @abort, and with a new (better) mechanism for handling the
4331 exceptions.
4339 exceptions.
4332
4340
4333 2002-10-27 Fernando Perez <fperez@colorado.edu>
4341 2002-10-27 Fernando Perez <fperez@colorado.edu>
4334
4342
4335 * IPython/usage.py (__doc__): updated the --help information and
4343 * IPython/usage.py (__doc__): updated the --help information and
4336 the ipythonrc file to indicate that -log generates
4344 the ipythonrc file to indicate that -log generates
4337 ./ipython.log. Also fixed the corresponding info in @logstart.
4345 ./ipython.log. Also fixed the corresponding info in @logstart.
4338 This and several other fixes in the manuals thanks to reports by
4346 This and several other fixes in the manuals thanks to reports by
4339 François Pinard <pinard-AT-iro.umontreal.ca>.
4347 François Pinard <pinard-AT-iro.umontreal.ca>.
4340
4348
4341 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4349 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4342 refer to @logstart (instead of @log, which doesn't exist).
4350 refer to @logstart (instead of @log, which doesn't exist).
4343
4351
4344 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4352 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4345 AttributeError crash. Thanks to Christopher Armstrong
4353 AttributeError crash. Thanks to Christopher Armstrong
4346 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4354 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4347 introduced recently (in 0.2.14pre37) with the fix to the eval
4355 introduced recently (in 0.2.14pre37) with the fix to the eval
4348 problem mentioned below.
4356 problem mentioned below.
4349
4357
4350 2002-10-17 Fernando Perez <fperez@colorado.edu>
4358 2002-10-17 Fernando Perez <fperez@colorado.edu>
4351
4359
4352 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4360 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4353 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4361 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4354
4362
4355 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4363 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4356 this function to fix a problem reported by Alex Schmolck. He saw
4364 this function to fix a problem reported by Alex Schmolck. He saw
4357 it with list comprehensions and generators, which were getting
4365 it with list comprehensions and generators, which were getting
4358 called twice. The real problem was an 'eval' call in testing for
4366 called twice. The real problem was an 'eval' call in testing for
4359 automagic which was evaluating the input line silently.
4367 automagic which was evaluating the input line silently.
4360
4368
4361 This is a potentially very nasty bug, if the input has side
4369 This is a potentially very nasty bug, if the input has side
4362 effects which must not be repeated. The code is much cleaner now,
4370 effects which must not be repeated. The code is much cleaner now,
4363 without any blanket 'except' left and with a regexp test for
4371 without any blanket 'except' left and with a regexp test for
4364 actual function names.
4372 actual function names.
4365
4373
4366 But an eval remains, which I'm not fully comfortable with. I just
4374 But an eval remains, which I'm not fully comfortable with. I just
4367 don't know how to find out if an expression could be a callable in
4375 don't know how to find out if an expression could be a callable in
4368 the user's namespace without doing an eval on the string. However
4376 the user's namespace without doing an eval on the string. However
4369 that string is now much more strictly checked so that no code
4377 that string is now much more strictly checked so that no code
4370 slips by, so the eval should only happen for things that can
4378 slips by, so the eval should only happen for things that can
4371 really be only function/method names.
4379 really be only function/method names.
4372
4380
4373 2002-10-15 Fernando Perez <fperez@colorado.edu>
4381 2002-10-15 Fernando Perez <fperez@colorado.edu>
4374
4382
4375 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4383 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4376 OSX information to main manual, removed README_Mac_OSX file from
4384 OSX information to main manual, removed README_Mac_OSX file from
4377 distribution. Also updated credits for recent additions.
4385 distribution. Also updated credits for recent additions.
4378
4386
4379 2002-10-10 Fernando Perez <fperez@colorado.edu>
4387 2002-10-10 Fernando Perez <fperez@colorado.edu>
4380
4388
4381 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4389 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4382 terminal-related issues. Many thanks to Andrea Riciputi
4390 terminal-related issues. Many thanks to Andrea Riciputi
4383 <andrea.riciputi-AT-libero.it> for writing it.
4391 <andrea.riciputi-AT-libero.it> for writing it.
4384
4392
4385 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4393 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4386 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4394 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4387
4395
4388 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4396 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4389 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4397 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4390 <syver-en-AT-online.no> who both submitted patches for this problem.
4398 <syver-en-AT-online.no> who both submitted patches for this problem.
4391
4399
4392 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4400 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4393 global embedding to make sure that things don't overwrite user
4401 global embedding to make sure that things don't overwrite user
4394 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4402 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4395
4403
4396 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4404 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4397 compatibility. Thanks to Hayden Callow
4405 compatibility. Thanks to Hayden Callow
4398 <h.callow-AT-elec.canterbury.ac.nz>
4406 <h.callow-AT-elec.canterbury.ac.nz>
4399
4407
4400 2002-10-04 Fernando Perez <fperez@colorado.edu>
4408 2002-10-04 Fernando Perez <fperez@colorado.edu>
4401
4409
4402 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4410 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4403 Gnuplot.File objects.
4411 Gnuplot.File objects.
4404
4412
4405 2002-07-23 Fernando Perez <fperez@colorado.edu>
4413 2002-07-23 Fernando Perez <fperez@colorado.edu>
4406
4414
4407 * IPython/genutils.py (timing): Added timings() and timing() for
4415 * IPython/genutils.py (timing): Added timings() and timing() for
4408 quick access to the most commonly needed data, the execution
4416 quick access to the most commonly needed data, the execution
4409 times. Old timing() renamed to timings_out().
4417 times. Old timing() renamed to timings_out().
4410
4418
4411 2002-07-18 Fernando Perez <fperez@colorado.edu>
4419 2002-07-18 Fernando Perez <fperez@colorado.edu>
4412
4420
4413 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4421 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4414 bug with nested instances disrupting the parent's tab completion.
4422 bug with nested instances disrupting the parent's tab completion.
4415
4423
4416 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4424 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4417 all_completions code to begin the emacs integration.
4425 all_completions code to begin the emacs integration.
4418
4426
4419 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4427 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4420 argument to allow titling individual arrays when plotting.
4428 argument to allow titling individual arrays when plotting.
4421
4429
4422 2002-07-15 Fernando Perez <fperez@colorado.edu>
4430 2002-07-15 Fernando Perez <fperez@colorado.edu>
4423
4431
4424 * setup.py (make_shortcut): changed to retrieve the value of
4432 * setup.py (make_shortcut): changed to retrieve the value of
4425 'Program Files' directory from the registry (this value changes in
4433 'Program Files' directory from the registry (this value changes in
4426 non-english versions of Windows). Thanks to Thomas Fanslau
4434 non-english versions of Windows). Thanks to Thomas Fanslau
4427 <tfanslau-AT-gmx.de> for the report.
4435 <tfanslau-AT-gmx.de> for the report.
4428
4436
4429 2002-07-10 Fernando Perez <fperez@colorado.edu>
4437 2002-07-10 Fernando Perez <fperez@colorado.edu>
4430
4438
4431 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4439 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4432 a bug in pdb, which crashes if a line with only whitespace is
4440 a bug in pdb, which crashes if a line with only whitespace is
4433 entered. Bug report submitted to sourceforge.
4441 entered. Bug report submitted to sourceforge.
4434
4442
4435 2002-07-09 Fernando Perez <fperez@colorado.edu>
4443 2002-07-09 Fernando Perez <fperez@colorado.edu>
4436
4444
4437 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4445 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4438 reporting exceptions (it's a bug in inspect.py, I just set a
4446 reporting exceptions (it's a bug in inspect.py, I just set a
4439 workaround).
4447 workaround).
4440
4448
4441 2002-07-08 Fernando Perez <fperez@colorado.edu>
4449 2002-07-08 Fernando Perez <fperez@colorado.edu>
4442
4450
4443 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4451 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4444 __IPYTHON__ in __builtins__ to show up in user_ns.
4452 __IPYTHON__ in __builtins__ to show up in user_ns.
4445
4453
4446 2002-07-03 Fernando Perez <fperez@colorado.edu>
4454 2002-07-03 Fernando Perez <fperez@colorado.edu>
4447
4455
4448 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4456 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4449 name from @gp_set_instance to @gp_set_default.
4457 name from @gp_set_instance to @gp_set_default.
4450
4458
4451 * IPython/ipmaker.py (make_IPython): default editor value set to
4459 * IPython/ipmaker.py (make_IPython): default editor value set to
4452 '0' (a string), to match the rc file. Otherwise will crash when
4460 '0' (a string), to match the rc file. Otherwise will crash when
4453 .strip() is called on it.
4461 .strip() is called on it.
4454
4462
4455
4463
4456 2002-06-28 Fernando Perez <fperez@colorado.edu>
4464 2002-06-28 Fernando Perez <fperez@colorado.edu>
4457
4465
4458 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4466 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4459 of files in current directory when a file is executed via
4467 of files in current directory when a file is executed via
4460 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4468 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4461
4469
4462 * setup.py (manfiles): fix for rpm builds, submitted by RA
4470 * setup.py (manfiles): fix for rpm builds, submitted by RA
4463 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4471 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4464
4472
4465 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4473 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4466 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4474 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4467 string!). A. Schmolck caught this one.
4475 string!). A. Schmolck caught this one.
4468
4476
4469 2002-06-27 Fernando Perez <fperez@colorado.edu>
4477 2002-06-27 Fernando Perez <fperez@colorado.edu>
4470
4478
4471 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4479 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4472 defined files at the cmd line. __name__ wasn't being set to
4480 defined files at the cmd line. __name__ wasn't being set to
4473 __main__.
4481 __main__.
4474
4482
4475 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4483 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4476 regular lists and tuples besides Numeric arrays.
4484 regular lists and tuples besides Numeric arrays.
4477
4485
4478 * IPython/Prompts.py (CachedOutput.__call__): Added output
4486 * IPython/Prompts.py (CachedOutput.__call__): Added output
4479 supression for input ending with ';'. Similar to Mathematica and
4487 supression for input ending with ';'. Similar to Mathematica and
4480 Matlab. The _* vars and Out[] list are still updated, just like
4488 Matlab. The _* vars and Out[] list are still updated, just like
4481 Mathematica behaves.
4489 Mathematica behaves.
4482
4490
4483 2002-06-25 Fernando Perez <fperez@colorado.edu>
4491 2002-06-25 Fernando Perez <fperez@colorado.edu>
4484
4492
4485 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4493 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4486 .ini extensions for profiels under Windows.
4494 .ini extensions for profiels under Windows.
4487
4495
4488 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4496 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4489 string form. Fix contributed by Alexander Schmolck
4497 string form. Fix contributed by Alexander Schmolck
4490 <a.schmolck-AT-gmx.net>
4498 <a.schmolck-AT-gmx.net>
4491
4499
4492 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4500 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4493 pre-configured Gnuplot instance.
4501 pre-configured Gnuplot instance.
4494
4502
4495 2002-06-21 Fernando Perez <fperez@colorado.edu>
4503 2002-06-21 Fernando Perez <fperez@colorado.edu>
4496
4504
4497 * IPython/numutils.py (exp_safe): new function, works around the
4505 * IPython/numutils.py (exp_safe): new function, works around the
4498 underflow problems in Numeric.
4506 underflow problems in Numeric.
4499 (log2): New fn. Safe log in base 2: returns exact integer answer
4507 (log2): New fn. Safe log in base 2: returns exact integer answer
4500 for exact integer powers of 2.
4508 for exact integer powers of 2.
4501
4509
4502 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4510 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4503 properly.
4511 properly.
4504
4512
4505 2002-06-20 Fernando Perez <fperez@colorado.edu>
4513 2002-06-20 Fernando Perez <fperez@colorado.edu>
4506
4514
4507 * IPython/genutils.py (timing): new function like
4515 * IPython/genutils.py (timing): new function like
4508 Mathematica's. Similar to time_test, but returns more info.
4516 Mathematica's. Similar to time_test, but returns more info.
4509
4517
4510 2002-06-18 Fernando Perez <fperez@colorado.edu>
4518 2002-06-18 Fernando Perez <fperez@colorado.edu>
4511
4519
4512 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4520 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4513 according to Mike Heeter's suggestions.
4521 according to Mike Heeter's suggestions.
4514
4522
4515 2002-06-16 Fernando Perez <fperez@colorado.edu>
4523 2002-06-16 Fernando Perez <fperez@colorado.edu>
4516
4524
4517 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4525 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4518 system. GnuplotMagic is gone as a user-directory option. New files
4526 system. GnuplotMagic is gone as a user-directory option. New files
4519 make it easier to use all the gnuplot stuff both from external
4527 make it easier to use all the gnuplot stuff both from external
4520 programs as well as from IPython. Had to rewrite part of
4528 programs as well as from IPython. Had to rewrite part of
4521 hardcopy() b/c of a strange bug: often the ps files simply don't
4529 hardcopy() b/c of a strange bug: often the ps files simply don't
4522 get created, and require a repeat of the command (often several
4530 get created, and require a repeat of the command (often several
4523 times).
4531 times).
4524
4532
4525 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4533 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4526 resolve output channel at call time, so that if sys.stderr has
4534 resolve output channel at call time, so that if sys.stderr has
4527 been redirected by user this gets honored.
4535 been redirected by user this gets honored.
4528
4536
4529 2002-06-13 Fernando Perez <fperez@colorado.edu>
4537 2002-06-13 Fernando Perez <fperez@colorado.edu>
4530
4538
4531 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4539 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4532 IPShell. Kept a copy with the old names to avoid breaking people's
4540 IPShell. Kept a copy with the old names to avoid breaking people's
4533 embedded code.
4541 embedded code.
4534
4542
4535 * IPython/ipython: simplified it to the bare minimum after
4543 * IPython/ipython: simplified it to the bare minimum after
4536 Holger's suggestions. Added info about how to use it in
4544 Holger's suggestions. Added info about how to use it in
4537 PYTHONSTARTUP.
4545 PYTHONSTARTUP.
4538
4546
4539 * IPython/Shell.py (IPythonShell): changed the options passing
4547 * IPython/Shell.py (IPythonShell): changed the options passing
4540 from a string with funky %s replacements to a straight list. Maybe
4548 from a string with funky %s replacements to a straight list. Maybe
4541 a bit more typing, but it follows sys.argv conventions, so there's
4549 a bit more typing, but it follows sys.argv conventions, so there's
4542 less special-casing to remember.
4550 less special-casing to remember.
4543
4551
4544 2002-06-12 Fernando Perez <fperez@colorado.edu>
4552 2002-06-12 Fernando Perez <fperez@colorado.edu>
4545
4553
4546 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4554 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4547 command. Thanks to a suggestion by Mike Heeter.
4555 command. Thanks to a suggestion by Mike Heeter.
4548 (Magic.magic_pfile): added behavior to look at filenames if given
4556 (Magic.magic_pfile): added behavior to look at filenames if given
4549 arg is not a defined object.
4557 arg is not a defined object.
4550 (Magic.magic_save): New @save function to save code snippets. Also
4558 (Magic.magic_save): New @save function to save code snippets. Also
4551 a Mike Heeter idea.
4559 a Mike Heeter idea.
4552
4560
4553 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4561 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4554 plot() and replot(). Much more convenient now, especially for
4562 plot() and replot(). Much more convenient now, especially for
4555 interactive use.
4563 interactive use.
4556
4564
4557 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4565 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4558 filenames.
4566 filenames.
4559
4567
4560 2002-06-02 Fernando Perez <fperez@colorado.edu>
4568 2002-06-02 Fernando Perez <fperez@colorado.edu>
4561
4569
4562 * IPython/Struct.py (Struct.__init__): modified to admit
4570 * IPython/Struct.py (Struct.__init__): modified to admit
4563 initialization via another struct.
4571 initialization via another struct.
4564
4572
4565 * IPython/genutils.py (SystemExec.__init__): New stateful
4573 * IPython/genutils.py (SystemExec.__init__): New stateful
4566 interface to xsys and bq. Useful for writing system scripts.
4574 interface to xsys and bq. Useful for writing system scripts.
4567
4575
4568 2002-05-30 Fernando Perez <fperez@colorado.edu>
4576 2002-05-30 Fernando Perez <fperez@colorado.edu>
4569
4577
4570 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4578 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4571 documents. This will make the user download smaller (it's getting
4579 documents. This will make the user download smaller (it's getting
4572 too big).
4580 too big).
4573
4581
4574 2002-05-29 Fernando Perez <fperez@colorado.edu>
4582 2002-05-29 Fernando Perez <fperez@colorado.edu>
4575
4583
4576 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4584 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4577 fix problems with shelve and pickle. Seems to work, but I don't
4585 fix problems with shelve and pickle. Seems to work, but I don't
4578 know if corner cases break it. Thanks to Mike Heeter
4586 know if corner cases break it. Thanks to Mike Heeter
4579 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4587 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4580
4588
4581 2002-05-24 Fernando Perez <fperez@colorado.edu>
4589 2002-05-24 Fernando Perez <fperez@colorado.edu>
4582
4590
4583 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4591 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4584 macros having broken.
4592 macros having broken.
4585
4593
4586 2002-05-21 Fernando Perez <fperez@colorado.edu>
4594 2002-05-21 Fernando Perez <fperez@colorado.edu>
4587
4595
4588 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4596 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4589 introduced logging bug: all history before logging started was
4597 introduced logging bug: all history before logging started was
4590 being written one character per line! This came from the redesign
4598 being written one character per line! This came from the redesign
4591 of the input history as a special list which slices to strings,
4599 of the input history as a special list which slices to strings,
4592 not to lists.
4600 not to lists.
4593
4601
4594 2002-05-20 Fernando Perez <fperez@colorado.edu>
4602 2002-05-20 Fernando Perez <fperez@colorado.edu>
4595
4603
4596 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4604 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4597 be an attribute of all classes in this module. The design of these
4605 be an attribute of all classes in this module. The design of these
4598 classes needs some serious overhauling.
4606 classes needs some serious overhauling.
4599
4607
4600 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4608 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4601 which was ignoring '_' in option names.
4609 which was ignoring '_' in option names.
4602
4610
4603 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4611 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4604 'Verbose_novars' to 'Context' and made it the new default. It's a
4612 'Verbose_novars' to 'Context' and made it the new default. It's a
4605 bit more readable and also safer than verbose.
4613 bit more readable and also safer than verbose.
4606
4614
4607 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4615 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4608 triple-quoted strings.
4616 triple-quoted strings.
4609
4617
4610 * IPython/OInspect.py (__all__): new module exposing the object
4618 * IPython/OInspect.py (__all__): new module exposing the object
4611 introspection facilities. Now the corresponding magics are dummy
4619 introspection facilities. Now the corresponding magics are dummy
4612 wrappers around this. Having this module will make it much easier
4620 wrappers around this. Having this module will make it much easier
4613 to put these functions into our modified pdb.
4621 to put these functions into our modified pdb.
4614 This new object inspector system uses the new colorizing module,
4622 This new object inspector system uses the new colorizing module,
4615 so source code and other things are nicely syntax highlighted.
4623 so source code and other things are nicely syntax highlighted.
4616
4624
4617 2002-05-18 Fernando Perez <fperez@colorado.edu>
4625 2002-05-18 Fernando Perez <fperez@colorado.edu>
4618
4626
4619 * IPython/ColorANSI.py: Split the coloring tools into a separate
4627 * IPython/ColorANSI.py: Split the coloring tools into a separate
4620 module so I can use them in other code easier (they were part of
4628 module so I can use them in other code easier (they were part of
4621 ultraTB).
4629 ultraTB).
4622
4630
4623 2002-05-17 Fernando Perez <fperez@colorado.edu>
4631 2002-05-17 Fernando Perez <fperez@colorado.edu>
4624
4632
4625 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4633 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4626 fixed it to set the global 'g' also to the called instance, as
4634 fixed it to set the global 'g' also to the called instance, as
4627 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4635 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4628 user's 'g' variables).
4636 user's 'g' variables).
4629
4637
4630 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4638 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4631 global variables (aliases to _ih,_oh) so that users which expect
4639 global variables (aliases to _ih,_oh) so that users which expect
4632 In[5] or Out[7] to work aren't unpleasantly surprised.
4640 In[5] or Out[7] to work aren't unpleasantly surprised.
4633 (InputList.__getslice__): new class to allow executing slices of
4641 (InputList.__getslice__): new class to allow executing slices of
4634 input history directly. Very simple class, complements the use of
4642 input history directly. Very simple class, complements the use of
4635 macros.
4643 macros.
4636
4644
4637 2002-05-16 Fernando Perez <fperez@colorado.edu>
4645 2002-05-16 Fernando Perez <fperez@colorado.edu>
4638
4646
4639 * setup.py (docdirbase): make doc directory be just doc/IPython
4647 * setup.py (docdirbase): make doc directory be just doc/IPython
4640 without version numbers, it will reduce clutter for users.
4648 without version numbers, it will reduce clutter for users.
4641
4649
4642 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4650 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4643 execfile call to prevent possible memory leak. See for details:
4651 execfile call to prevent possible memory leak. See for details:
4644 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4652 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4645
4653
4646 2002-05-15 Fernando Perez <fperez@colorado.edu>
4654 2002-05-15 Fernando Perez <fperez@colorado.edu>
4647
4655
4648 * IPython/Magic.py (Magic.magic_psource): made the object
4656 * IPython/Magic.py (Magic.magic_psource): made the object
4649 introspection names be more standard: pdoc, pdef, pfile and
4657 introspection names be more standard: pdoc, pdef, pfile and
4650 psource. They all print/page their output, and it makes
4658 psource. They all print/page their output, and it makes
4651 remembering them easier. Kept old names for compatibility as
4659 remembering them easier. Kept old names for compatibility as
4652 aliases.
4660 aliases.
4653
4661
4654 2002-05-14 Fernando Perez <fperez@colorado.edu>
4662 2002-05-14 Fernando Perez <fperez@colorado.edu>
4655
4663
4656 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4664 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4657 what the mouse problem was. The trick is to use gnuplot with temp
4665 what the mouse problem was. The trick is to use gnuplot with temp
4658 files and NOT with pipes (for data communication), because having
4666 files and NOT with pipes (for data communication), because having
4659 both pipes and the mouse on is bad news.
4667 both pipes and the mouse on is bad news.
4660
4668
4661 2002-05-13 Fernando Perez <fperez@colorado.edu>
4669 2002-05-13 Fernando Perez <fperez@colorado.edu>
4662
4670
4663 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4671 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4664 bug. Information would be reported about builtins even when
4672 bug. Information would be reported about builtins even when
4665 user-defined functions overrode them.
4673 user-defined functions overrode them.
4666
4674
4667 2002-05-11 Fernando Perez <fperez@colorado.edu>
4675 2002-05-11 Fernando Perez <fperez@colorado.edu>
4668
4676
4669 * IPython/__init__.py (__all__): removed FlexCompleter from
4677 * IPython/__init__.py (__all__): removed FlexCompleter from
4670 __all__ so that things don't fail in platforms without readline.
4678 __all__ so that things don't fail in platforms without readline.
4671
4679
4672 2002-05-10 Fernando Perez <fperez@colorado.edu>
4680 2002-05-10 Fernando Perez <fperez@colorado.edu>
4673
4681
4674 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4682 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4675 it requires Numeric, effectively making Numeric a dependency for
4683 it requires Numeric, effectively making Numeric a dependency for
4676 IPython.
4684 IPython.
4677
4685
4678 * Released 0.2.13
4686 * Released 0.2.13
4679
4687
4680 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4688 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4681 profiler interface. Now all the major options from the profiler
4689 profiler interface. Now all the major options from the profiler
4682 module are directly supported in IPython, both for single
4690 module are directly supported in IPython, both for single
4683 expressions (@prun) and for full programs (@run -p).
4691 expressions (@prun) and for full programs (@run -p).
4684
4692
4685 2002-05-09 Fernando Perez <fperez@colorado.edu>
4693 2002-05-09 Fernando Perez <fperez@colorado.edu>
4686
4694
4687 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4695 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4688 magic properly formatted for screen.
4696 magic properly formatted for screen.
4689
4697
4690 * setup.py (make_shortcut): Changed things to put pdf version in
4698 * setup.py (make_shortcut): Changed things to put pdf version in
4691 doc/ instead of doc/manual (had to change lyxport a bit).
4699 doc/ instead of doc/manual (had to change lyxport a bit).
4692
4700
4693 * IPython/Magic.py (Profile.string_stats): made profile runs go
4701 * IPython/Magic.py (Profile.string_stats): made profile runs go
4694 through pager (they are long and a pager allows searching, saving,
4702 through pager (they are long and a pager allows searching, saving,
4695 etc.)
4703 etc.)
4696
4704
4697 2002-05-08 Fernando Perez <fperez@colorado.edu>
4705 2002-05-08 Fernando Perez <fperez@colorado.edu>
4698
4706
4699 * Released 0.2.12
4707 * Released 0.2.12
4700
4708
4701 2002-05-06 Fernando Perez <fperez@colorado.edu>
4709 2002-05-06 Fernando Perez <fperez@colorado.edu>
4702
4710
4703 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4711 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4704 introduced); 'hist n1 n2' was broken.
4712 introduced); 'hist n1 n2' was broken.
4705 (Magic.magic_pdb): added optional on/off arguments to @pdb
4713 (Magic.magic_pdb): added optional on/off arguments to @pdb
4706 (Magic.magic_run): added option -i to @run, which executes code in
4714 (Magic.magic_run): added option -i to @run, which executes code in
4707 the IPython namespace instead of a clean one. Also added @irun as
4715 the IPython namespace instead of a clean one. Also added @irun as
4708 an alias to @run -i.
4716 an alias to @run -i.
4709
4717
4710 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4718 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4711 fixed (it didn't really do anything, the namespaces were wrong).
4719 fixed (it didn't really do anything, the namespaces were wrong).
4712
4720
4713 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4721 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4714
4722
4715 * IPython/__init__.py (__all__): Fixed package namespace, now
4723 * IPython/__init__.py (__all__): Fixed package namespace, now
4716 'import IPython' does give access to IPython.<all> as
4724 'import IPython' does give access to IPython.<all> as
4717 expected. Also renamed __release__ to Release.
4725 expected. Also renamed __release__ to Release.
4718
4726
4719 * IPython/Debugger.py (__license__): created new Pdb class which
4727 * IPython/Debugger.py (__license__): created new Pdb class which
4720 functions like a drop-in for the normal pdb.Pdb but does NOT
4728 functions like a drop-in for the normal pdb.Pdb but does NOT
4721 import readline by default. This way it doesn't muck up IPython's
4729 import readline by default. This way it doesn't muck up IPython's
4722 readline handling, and now tab-completion finally works in the
4730 readline handling, and now tab-completion finally works in the
4723 debugger -- sort of. It completes things globally visible, but the
4731 debugger -- sort of. It completes things globally visible, but the
4724 completer doesn't track the stack as pdb walks it. That's a bit
4732 completer doesn't track the stack as pdb walks it. That's a bit
4725 tricky, and I'll have to implement it later.
4733 tricky, and I'll have to implement it later.
4726
4734
4727 2002-05-05 Fernando Perez <fperez@colorado.edu>
4735 2002-05-05 Fernando Perez <fperez@colorado.edu>
4728
4736
4729 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4737 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4730 magic docstrings when printed via ? (explicit \'s were being
4738 magic docstrings when printed via ? (explicit \'s were being
4731 printed).
4739 printed).
4732
4740
4733 * IPython/ipmaker.py (make_IPython): fixed namespace
4741 * IPython/ipmaker.py (make_IPython): fixed namespace
4734 identification bug. Now variables loaded via logs or command-line
4742 identification bug. Now variables loaded via logs or command-line
4735 files are recognized in the interactive namespace by @who.
4743 files are recognized in the interactive namespace by @who.
4736
4744
4737 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4745 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4738 log replay system stemming from the string form of Structs.
4746 log replay system stemming from the string form of Structs.
4739
4747
4740 * IPython/Magic.py (Macro.__init__): improved macros to properly
4748 * IPython/Magic.py (Macro.__init__): improved macros to properly
4741 handle magic commands in them.
4749 handle magic commands in them.
4742 (Magic.magic_logstart): usernames are now expanded so 'logstart
4750 (Magic.magic_logstart): usernames are now expanded so 'logstart
4743 ~/mylog' now works.
4751 ~/mylog' now works.
4744
4752
4745 * IPython/iplib.py (complete): fixed bug where paths starting with
4753 * IPython/iplib.py (complete): fixed bug where paths starting with
4746 '/' would be completed as magic names.
4754 '/' would be completed as magic names.
4747
4755
4748 2002-05-04 Fernando Perez <fperez@colorado.edu>
4756 2002-05-04 Fernando Perez <fperez@colorado.edu>
4749
4757
4750 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4758 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4751 allow running full programs under the profiler's control.
4759 allow running full programs under the profiler's control.
4752
4760
4753 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4761 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4754 mode to report exceptions verbosely but without formatting
4762 mode to report exceptions verbosely but without formatting
4755 variables. This addresses the issue of ipython 'freezing' (it's
4763 variables. This addresses the issue of ipython 'freezing' (it's
4756 not frozen, but caught in an expensive formatting loop) when huge
4764 not frozen, but caught in an expensive formatting loop) when huge
4757 variables are in the context of an exception.
4765 variables are in the context of an exception.
4758 (VerboseTB.text): Added '--->' markers at line where exception was
4766 (VerboseTB.text): Added '--->' markers at line where exception was
4759 triggered. Much clearer to read, especially in NoColor modes.
4767 triggered. Much clearer to read, especially in NoColor modes.
4760
4768
4761 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4769 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4762 implemented in reverse when changing to the new parse_options().
4770 implemented in reverse when changing to the new parse_options().
4763
4771
4764 2002-05-03 Fernando Perez <fperez@colorado.edu>
4772 2002-05-03 Fernando Perez <fperez@colorado.edu>
4765
4773
4766 * IPython/Magic.py (Magic.parse_options): new function so that
4774 * IPython/Magic.py (Magic.parse_options): new function so that
4767 magics can parse options easier.
4775 magics can parse options easier.
4768 (Magic.magic_prun): new function similar to profile.run(),
4776 (Magic.magic_prun): new function similar to profile.run(),
4769 suggested by Chris Hart.
4777 suggested by Chris Hart.
4770 (Magic.magic_cd): fixed behavior so that it only changes if
4778 (Magic.magic_cd): fixed behavior so that it only changes if
4771 directory actually is in history.
4779 directory actually is in history.
4772
4780
4773 * IPython/usage.py (__doc__): added information about potential
4781 * IPython/usage.py (__doc__): added information about potential
4774 slowness of Verbose exception mode when there are huge data
4782 slowness of Verbose exception mode when there are huge data
4775 structures to be formatted (thanks to Archie Paulson).
4783 structures to be formatted (thanks to Archie Paulson).
4776
4784
4777 * IPython/ipmaker.py (make_IPython): Changed default logging
4785 * IPython/ipmaker.py (make_IPython): Changed default logging
4778 (when simply called with -log) to use curr_dir/ipython.log in
4786 (when simply called with -log) to use curr_dir/ipython.log in
4779 rotate mode. Fixed crash which was occuring with -log before
4787 rotate mode. Fixed crash which was occuring with -log before
4780 (thanks to Jim Boyle).
4788 (thanks to Jim Boyle).
4781
4789
4782 2002-05-01 Fernando Perez <fperez@colorado.edu>
4790 2002-05-01 Fernando Perez <fperez@colorado.edu>
4783
4791
4784 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4792 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4785 was nasty -- though somewhat of a corner case).
4793 was nasty -- though somewhat of a corner case).
4786
4794
4787 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4795 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4788 text (was a bug).
4796 text (was a bug).
4789
4797
4790 2002-04-30 Fernando Perez <fperez@colorado.edu>
4798 2002-04-30 Fernando Perez <fperez@colorado.edu>
4791
4799
4792 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4800 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4793 a print after ^D or ^C from the user so that the In[] prompt
4801 a print after ^D or ^C from the user so that the In[] prompt
4794 doesn't over-run the gnuplot one.
4802 doesn't over-run the gnuplot one.
4795
4803
4796 2002-04-29 Fernando Perez <fperez@colorado.edu>
4804 2002-04-29 Fernando Perez <fperez@colorado.edu>
4797
4805
4798 * Released 0.2.10
4806 * Released 0.2.10
4799
4807
4800 * IPython/__release__.py (version): get date dynamically.
4808 * IPython/__release__.py (version): get date dynamically.
4801
4809
4802 * Misc. documentation updates thanks to Arnd's comments. Also ran
4810 * Misc. documentation updates thanks to Arnd's comments. Also ran
4803 a full spellcheck on the manual (hadn't been done in a while).
4811 a full spellcheck on the manual (hadn't been done in a while).
4804
4812
4805 2002-04-27 Fernando Perez <fperez@colorado.edu>
4813 2002-04-27 Fernando Perez <fperez@colorado.edu>
4806
4814
4807 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4815 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4808 starting a log in mid-session would reset the input history list.
4816 starting a log in mid-session would reset the input history list.
4809
4817
4810 2002-04-26 Fernando Perez <fperez@colorado.edu>
4818 2002-04-26 Fernando Perez <fperez@colorado.edu>
4811
4819
4812 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4820 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4813 all files were being included in an update. Now anything in
4821 all files were being included in an update. Now anything in
4814 UserConfig that matches [A-Za-z]*.py will go (this excludes
4822 UserConfig that matches [A-Za-z]*.py will go (this excludes
4815 __init__.py)
4823 __init__.py)
4816
4824
4817 2002-04-25 Fernando Perez <fperez@colorado.edu>
4825 2002-04-25 Fernando Perez <fperez@colorado.edu>
4818
4826
4819 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4827 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4820 to __builtins__ so that any form of embedded or imported code can
4828 to __builtins__ so that any form of embedded or imported code can
4821 test for being inside IPython.
4829 test for being inside IPython.
4822
4830
4823 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4831 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4824 changed to GnuplotMagic because it's now an importable module,
4832 changed to GnuplotMagic because it's now an importable module,
4825 this makes the name follow that of the standard Gnuplot module.
4833 this makes the name follow that of the standard Gnuplot module.
4826 GnuplotMagic can now be loaded at any time in mid-session.
4834 GnuplotMagic can now be loaded at any time in mid-session.
4827
4835
4828 2002-04-24 Fernando Perez <fperez@colorado.edu>
4836 2002-04-24 Fernando Perez <fperez@colorado.edu>
4829
4837
4830 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4838 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4831 the globals (IPython has its own namespace) and the
4839 the globals (IPython has its own namespace) and the
4832 PhysicalQuantity stuff is much better anyway.
4840 PhysicalQuantity stuff is much better anyway.
4833
4841
4834 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4842 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4835 embedding example to standard user directory for
4843 embedding example to standard user directory for
4836 distribution. Also put it in the manual.
4844 distribution. Also put it in the manual.
4837
4845
4838 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4846 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4839 instance as first argument (so it doesn't rely on some obscure
4847 instance as first argument (so it doesn't rely on some obscure
4840 hidden global).
4848 hidden global).
4841
4849
4842 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4850 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4843 delimiters. While it prevents ().TAB from working, it allows
4851 delimiters. While it prevents ().TAB from working, it allows
4844 completions in open (... expressions. This is by far a more common
4852 completions in open (... expressions. This is by far a more common
4845 case.
4853 case.
4846
4854
4847 2002-04-23 Fernando Perez <fperez@colorado.edu>
4855 2002-04-23 Fernando Perez <fperez@colorado.edu>
4848
4856
4849 * IPython/Extensions/InterpreterPasteInput.py: new
4857 * IPython/Extensions/InterpreterPasteInput.py: new
4850 syntax-processing module for pasting lines with >>> or ... at the
4858 syntax-processing module for pasting lines with >>> or ... at the
4851 start.
4859 start.
4852
4860
4853 * IPython/Extensions/PhysicalQ_Interactive.py
4861 * IPython/Extensions/PhysicalQ_Interactive.py
4854 (PhysicalQuantityInteractive.__int__): fixed to work with either
4862 (PhysicalQuantityInteractive.__int__): fixed to work with either
4855 Numeric or math.
4863 Numeric or math.
4856
4864
4857 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4865 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4858 provided profiles. Now we have:
4866 provided profiles. Now we have:
4859 -math -> math module as * and cmath with its own namespace.
4867 -math -> math module as * and cmath with its own namespace.
4860 -numeric -> Numeric as *, plus gnuplot & grace
4868 -numeric -> Numeric as *, plus gnuplot & grace
4861 -physics -> same as before
4869 -physics -> same as before
4862
4870
4863 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4871 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4864 user-defined magics wouldn't be found by @magic if they were
4872 user-defined magics wouldn't be found by @magic if they were
4865 defined as class methods. Also cleaned up the namespace search
4873 defined as class methods. Also cleaned up the namespace search
4866 logic and the string building (to use %s instead of many repeated
4874 logic and the string building (to use %s instead of many repeated
4867 string adds).
4875 string adds).
4868
4876
4869 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4877 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4870 of user-defined magics to operate with class methods (cleaner, in
4878 of user-defined magics to operate with class methods (cleaner, in
4871 line with the gnuplot code).
4879 line with the gnuplot code).
4872
4880
4873 2002-04-22 Fernando Perez <fperez@colorado.edu>
4881 2002-04-22 Fernando Perez <fperez@colorado.edu>
4874
4882
4875 * setup.py: updated dependency list so that manual is updated when
4883 * setup.py: updated dependency list so that manual is updated when
4876 all included files change.
4884 all included files change.
4877
4885
4878 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4886 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4879 the delimiter removal option (the fix is ugly right now).
4887 the delimiter removal option (the fix is ugly right now).
4880
4888
4881 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4889 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4882 all of the math profile (quicker loading, no conflict between
4890 all of the math profile (quicker loading, no conflict between
4883 g-9.8 and g-gnuplot).
4891 g-9.8 and g-gnuplot).
4884
4892
4885 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4893 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4886 name of post-mortem files to IPython_crash_report.txt.
4894 name of post-mortem files to IPython_crash_report.txt.
4887
4895
4888 * Cleanup/update of the docs. Added all the new readline info and
4896 * Cleanup/update of the docs. Added all the new readline info and
4889 formatted all lists as 'real lists'.
4897 formatted all lists as 'real lists'.
4890
4898
4891 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4899 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4892 tab-completion options, since the full readline parse_and_bind is
4900 tab-completion options, since the full readline parse_and_bind is
4893 now accessible.
4901 now accessible.
4894
4902
4895 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4903 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4896 handling of readline options. Now users can specify any string to
4904 handling of readline options. Now users can specify any string to
4897 be passed to parse_and_bind(), as well as the delimiters to be
4905 be passed to parse_and_bind(), as well as the delimiters to be
4898 removed.
4906 removed.
4899 (InteractiveShell.__init__): Added __name__ to the global
4907 (InteractiveShell.__init__): Added __name__ to the global
4900 namespace so that things like Itpl which rely on its existence
4908 namespace so that things like Itpl which rely on its existence
4901 don't crash.
4909 don't crash.
4902 (InteractiveShell._prefilter): Defined the default with a _ so
4910 (InteractiveShell._prefilter): Defined the default with a _ so
4903 that prefilter() is easier to override, while the default one
4911 that prefilter() is easier to override, while the default one
4904 remains available.
4912 remains available.
4905
4913
4906 2002-04-18 Fernando Perez <fperez@colorado.edu>
4914 2002-04-18 Fernando Perez <fperez@colorado.edu>
4907
4915
4908 * Added information about pdb in the docs.
4916 * Added information about pdb in the docs.
4909
4917
4910 2002-04-17 Fernando Perez <fperez@colorado.edu>
4918 2002-04-17 Fernando Perez <fperez@colorado.edu>
4911
4919
4912 * IPython/ipmaker.py (make_IPython): added rc_override option to
4920 * IPython/ipmaker.py (make_IPython): added rc_override option to
4913 allow passing config options at creation time which may override
4921 allow passing config options at creation time which may override
4914 anything set in the config files or command line. This is
4922 anything set in the config files or command line. This is
4915 particularly useful for configuring embedded instances.
4923 particularly useful for configuring embedded instances.
4916
4924
4917 2002-04-15 Fernando Perez <fperez@colorado.edu>
4925 2002-04-15 Fernando Perez <fperez@colorado.edu>
4918
4926
4919 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4927 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4920 crash embedded instances because of the input cache falling out of
4928 crash embedded instances because of the input cache falling out of
4921 sync with the output counter.
4929 sync with the output counter.
4922
4930
4923 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4931 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4924 mode which calls pdb after an uncaught exception in IPython itself.
4932 mode which calls pdb after an uncaught exception in IPython itself.
4925
4933
4926 2002-04-14 Fernando Perez <fperez@colorado.edu>
4934 2002-04-14 Fernando Perez <fperez@colorado.edu>
4927
4935
4928 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4936 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4929 readline, fix it back after each call.
4937 readline, fix it back after each call.
4930
4938
4931 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4939 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4932 method to force all access via __call__(), which guarantees that
4940 method to force all access via __call__(), which guarantees that
4933 traceback references are properly deleted.
4941 traceback references are properly deleted.
4934
4942
4935 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4943 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4936 improve printing when pprint is in use.
4944 improve printing when pprint is in use.
4937
4945
4938 2002-04-13 Fernando Perez <fperez@colorado.edu>
4946 2002-04-13 Fernando Perez <fperez@colorado.edu>
4939
4947
4940 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4948 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4941 exceptions aren't caught anymore. If the user triggers one, he
4949 exceptions aren't caught anymore. If the user triggers one, he
4942 should know why he's doing it and it should go all the way up,
4950 should know why he's doing it and it should go all the way up,
4943 just like any other exception. So now @abort will fully kill the
4951 just like any other exception. So now @abort will fully kill the
4944 embedded interpreter and the embedding code (unless that happens
4952 embedded interpreter and the embedding code (unless that happens
4945 to catch SystemExit).
4953 to catch SystemExit).
4946
4954
4947 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4955 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4948 and a debugger() method to invoke the interactive pdb debugger
4956 and a debugger() method to invoke the interactive pdb debugger
4949 after printing exception information. Also added the corresponding
4957 after printing exception information. Also added the corresponding
4950 -pdb option and @pdb magic to control this feature, and updated
4958 -pdb option and @pdb magic to control this feature, and updated
4951 the docs. After a suggestion from Christopher Hart
4959 the docs. After a suggestion from Christopher Hart
4952 (hart-AT-caltech.edu).
4960 (hart-AT-caltech.edu).
4953
4961
4954 2002-04-12 Fernando Perez <fperez@colorado.edu>
4962 2002-04-12 Fernando Perez <fperez@colorado.edu>
4955
4963
4956 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4964 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4957 the exception handlers defined by the user (not the CrashHandler)
4965 the exception handlers defined by the user (not the CrashHandler)
4958 so that user exceptions don't trigger an ipython bug report.
4966 so that user exceptions don't trigger an ipython bug report.
4959
4967
4960 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4968 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4961 configurable (it should have always been so).
4969 configurable (it should have always been so).
4962
4970
4963 2002-03-26 Fernando Perez <fperez@colorado.edu>
4971 2002-03-26 Fernando Perez <fperez@colorado.edu>
4964
4972
4965 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4973 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4966 and there to fix embedding namespace issues. This should all be
4974 and there to fix embedding namespace issues. This should all be
4967 done in a more elegant way.
4975 done in a more elegant way.
4968
4976
4969 2002-03-25 Fernando Perez <fperez@colorado.edu>
4977 2002-03-25 Fernando Perez <fperez@colorado.edu>
4970
4978
4971 * IPython/genutils.py (get_home_dir): Try to make it work under
4979 * IPython/genutils.py (get_home_dir): Try to make it work under
4972 win9x also.
4980 win9x also.
4973
4981
4974 2002-03-20 Fernando Perez <fperez@colorado.edu>
4982 2002-03-20 Fernando Perez <fperez@colorado.edu>
4975
4983
4976 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4984 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4977 sys.displayhook untouched upon __init__.
4985 sys.displayhook untouched upon __init__.
4978
4986
4979 2002-03-19 Fernando Perez <fperez@colorado.edu>
4987 2002-03-19 Fernando Perez <fperez@colorado.edu>
4980
4988
4981 * Released 0.2.9 (for embedding bug, basically).
4989 * Released 0.2.9 (for embedding bug, basically).
4982
4990
4983 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4991 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4984 exceptions so that enclosing shell's state can be restored.
4992 exceptions so that enclosing shell's state can be restored.
4985
4993
4986 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4994 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4987 naming conventions in the .ipython/ dir.
4995 naming conventions in the .ipython/ dir.
4988
4996
4989 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4997 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4990 from delimiters list so filenames with - in them get expanded.
4998 from delimiters list so filenames with - in them get expanded.
4991
4999
4992 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5000 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4993 sys.displayhook not being properly restored after an embedded call.
5001 sys.displayhook not being properly restored after an embedded call.
4994
5002
4995 2002-03-18 Fernando Perez <fperez@colorado.edu>
5003 2002-03-18 Fernando Perez <fperez@colorado.edu>
4996
5004
4997 * Released 0.2.8
5005 * Released 0.2.8
4998
5006
4999 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5007 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5000 some files weren't being included in a -upgrade.
5008 some files weren't being included in a -upgrade.
5001 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5009 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5002 on' so that the first tab completes.
5010 on' so that the first tab completes.
5003 (InteractiveShell.handle_magic): fixed bug with spaces around
5011 (InteractiveShell.handle_magic): fixed bug with spaces around
5004 quotes breaking many magic commands.
5012 quotes breaking many magic commands.
5005
5013
5006 * setup.py: added note about ignoring the syntax error messages at
5014 * setup.py: added note about ignoring the syntax error messages at
5007 installation.
5015 installation.
5008
5016
5009 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5017 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5010 streamlining the gnuplot interface, now there's only one magic @gp.
5018 streamlining the gnuplot interface, now there's only one magic @gp.
5011
5019
5012 2002-03-17 Fernando Perez <fperez@colorado.edu>
5020 2002-03-17 Fernando Perez <fperez@colorado.edu>
5013
5021
5014 * IPython/UserConfig/magic_gnuplot.py: new name for the
5022 * IPython/UserConfig/magic_gnuplot.py: new name for the
5015 example-magic_pm.py file. Much enhanced system, now with a shell
5023 example-magic_pm.py file. Much enhanced system, now with a shell
5016 for communicating directly with gnuplot, one command at a time.
5024 for communicating directly with gnuplot, one command at a time.
5017
5025
5018 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5026 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5019 setting __name__=='__main__'.
5027 setting __name__=='__main__'.
5020
5028
5021 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5029 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5022 mini-shell for accessing gnuplot from inside ipython. Should
5030 mini-shell for accessing gnuplot from inside ipython. Should
5023 extend it later for grace access too. Inspired by Arnd's
5031 extend it later for grace access too. Inspired by Arnd's
5024 suggestion.
5032 suggestion.
5025
5033
5026 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5034 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5027 calling magic functions with () in their arguments. Thanks to Arnd
5035 calling magic functions with () in their arguments. Thanks to Arnd
5028 Baecker for pointing this to me.
5036 Baecker for pointing this to me.
5029
5037
5030 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5038 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5031 infinitely for integer or complex arrays (only worked with floats).
5039 infinitely for integer or complex arrays (only worked with floats).
5032
5040
5033 2002-03-16 Fernando Perez <fperez@colorado.edu>
5041 2002-03-16 Fernando Perez <fperez@colorado.edu>
5034
5042
5035 * setup.py: Merged setup and setup_windows into a single script
5043 * setup.py: Merged setup and setup_windows into a single script
5036 which properly handles things for windows users.
5044 which properly handles things for windows users.
5037
5045
5038 2002-03-15 Fernando Perez <fperez@colorado.edu>
5046 2002-03-15 Fernando Perez <fperez@colorado.edu>
5039
5047
5040 * Big change to the manual: now the magics are all automatically
5048 * Big change to the manual: now the magics are all automatically
5041 documented. This information is generated from their docstrings
5049 documented. This information is generated from their docstrings
5042 and put in a latex file included by the manual lyx file. This way
5050 and put in a latex file included by the manual lyx file. This way
5043 we get always up to date information for the magics. The manual
5051 we get always up to date information for the magics. The manual
5044 now also has proper version information, also auto-synced.
5052 now also has proper version information, also auto-synced.
5045
5053
5046 For this to work, an undocumented --magic_docstrings option was added.
5054 For this to work, an undocumented --magic_docstrings option was added.
5047
5055
5048 2002-03-13 Fernando Perez <fperez@colorado.edu>
5056 2002-03-13 Fernando Perez <fperez@colorado.edu>
5049
5057
5050 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5058 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5051 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5059 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5052
5060
5053 2002-03-12 Fernando Perez <fperez@colorado.edu>
5061 2002-03-12 Fernando Perez <fperez@colorado.edu>
5054
5062
5055 * IPython/ultraTB.py (TermColors): changed color escapes again to
5063 * IPython/ultraTB.py (TermColors): changed color escapes again to
5056 fix the (old, reintroduced) line-wrapping bug. Basically, if
5064 fix the (old, reintroduced) line-wrapping bug. Basically, if
5057 \001..\002 aren't given in the color escapes, lines get wrapped
5065 \001..\002 aren't given in the color escapes, lines get wrapped
5058 weirdly. But giving those screws up old xterms and emacs terms. So
5066 weirdly. But giving those screws up old xterms and emacs terms. So
5059 I added some logic for emacs terms to be ok, but I can't identify old
5067 I added some logic for emacs terms to be ok, but I can't identify old
5060 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5068 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5061
5069
5062 2002-03-10 Fernando Perez <fperez@colorado.edu>
5070 2002-03-10 Fernando Perez <fperez@colorado.edu>
5063
5071
5064 * IPython/usage.py (__doc__): Various documentation cleanups and
5072 * IPython/usage.py (__doc__): Various documentation cleanups and
5065 updates, both in usage docstrings and in the manual.
5073 updates, both in usage docstrings and in the manual.
5066
5074
5067 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5075 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5068 handling of caching. Set minimum acceptabe value for having a
5076 handling of caching. Set minimum acceptabe value for having a
5069 cache at 20 values.
5077 cache at 20 values.
5070
5078
5071 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5079 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5072 install_first_time function to a method, renamed it and added an
5080 install_first_time function to a method, renamed it and added an
5073 'upgrade' mode. Now people can update their config directory with
5081 'upgrade' mode. Now people can update their config directory with
5074 a simple command line switch (-upgrade, also new).
5082 a simple command line switch (-upgrade, also new).
5075
5083
5076 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5084 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5077 @file (convenient for automagic users under Python >= 2.2).
5085 @file (convenient for automagic users under Python >= 2.2).
5078 Removed @files (it seemed more like a plural than an abbrev. of
5086 Removed @files (it seemed more like a plural than an abbrev. of
5079 'file show').
5087 'file show').
5080
5088
5081 * IPython/iplib.py (install_first_time): Fixed crash if there were
5089 * IPython/iplib.py (install_first_time): Fixed crash if there were
5082 backup files ('~') in .ipython/ install directory.
5090 backup files ('~') in .ipython/ install directory.
5083
5091
5084 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5092 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5085 system. Things look fine, but these changes are fairly
5093 system. Things look fine, but these changes are fairly
5086 intrusive. Test them for a few days.
5094 intrusive. Test them for a few days.
5087
5095
5088 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5096 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5089 the prompts system. Now all in/out prompt strings are user
5097 the prompts system. Now all in/out prompt strings are user
5090 controllable. This is particularly useful for embedding, as one
5098 controllable. This is particularly useful for embedding, as one
5091 can tag embedded instances with particular prompts.
5099 can tag embedded instances with particular prompts.
5092
5100
5093 Also removed global use of sys.ps1/2, which now allows nested
5101 Also removed global use of sys.ps1/2, which now allows nested
5094 embeddings without any problems. Added command-line options for
5102 embeddings without any problems. Added command-line options for
5095 the prompt strings.
5103 the prompt strings.
5096
5104
5097 2002-03-08 Fernando Perez <fperez@colorado.edu>
5105 2002-03-08 Fernando Perez <fperez@colorado.edu>
5098
5106
5099 * IPython/UserConfig/example-embed-short.py (ipshell): added
5107 * IPython/UserConfig/example-embed-short.py (ipshell): added
5100 example file with the bare minimum code for embedding.
5108 example file with the bare minimum code for embedding.
5101
5109
5102 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5110 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5103 functionality for the embeddable shell to be activated/deactivated
5111 functionality for the embeddable shell to be activated/deactivated
5104 either globally or at each call.
5112 either globally or at each call.
5105
5113
5106 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5114 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5107 rewriting the prompt with '--->' for auto-inputs with proper
5115 rewriting the prompt with '--->' for auto-inputs with proper
5108 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5116 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5109 this is handled by the prompts class itself, as it should.
5117 this is handled by the prompts class itself, as it should.
5110
5118
5111 2002-03-05 Fernando Perez <fperez@colorado.edu>
5119 2002-03-05 Fernando Perez <fperez@colorado.edu>
5112
5120
5113 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5121 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5114 @logstart to avoid name clashes with the math log function.
5122 @logstart to avoid name clashes with the math log function.
5115
5123
5116 * Big updates to X/Emacs section of the manual.
5124 * Big updates to X/Emacs section of the manual.
5117
5125
5118 * Removed ipython_emacs. Milan explained to me how to pass
5126 * Removed ipython_emacs. Milan explained to me how to pass
5119 arguments to ipython through Emacs. Some day I'm going to end up
5127 arguments to ipython through Emacs. Some day I'm going to end up
5120 learning some lisp...
5128 learning some lisp...
5121
5129
5122 2002-03-04 Fernando Perez <fperez@colorado.edu>
5130 2002-03-04 Fernando Perez <fperez@colorado.edu>
5123
5131
5124 * IPython/ipython_emacs: Created script to be used as the
5132 * IPython/ipython_emacs: Created script to be used as the
5125 py-python-command Emacs variable so we can pass IPython
5133 py-python-command Emacs variable so we can pass IPython
5126 parameters. I can't figure out how to tell Emacs directly to pass
5134 parameters. I can't figure out how to tell Emacs directly to pass
5127 parameters to IPython, so a dummy shell script will do it.
5135 parameters to IPython, so a dummy shell script will do it.
5128
5136
5129 Other enhancements made for things to work better under Emacs'
5137 Other enhancements made for things to work better under Emacs'
5130 various types of terminals. Many thanks to Milan Zamazal
5138 various types of terminals. Many thanks to Milan Zamazal
5131 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5139 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5132
5140
5133 2002-03-01 Fernando Perez <fperez@colorado.edu>
5141 2002-03-01 Fernando Perez <fperez@colorado.edu>
5134
5142
5135 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5143 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5136 that loading of readline is now optional. This gives better
5144 that loading of readline is now optional. This gives better
5137 control to emacs users.
5145 control to emacs users.
5138
5146
5139 * IPython/ultraTB.py (__date__): Modified color escape sequences
5147 * IPython/ultraTB.py (__date__): Modified color escape sequences
5140 and now things work fine under xterm and in Emacs' term buffers
5148 and now things work fine under xterm and in Emacs' term buffers
5141 (though not shell ones). Well, in emacs you get colors, but all
5149 (though not shell ones). Well, in emacs you get colors, but all
5142 seem to be 'light' colors (no difference between dark and light
5150 seem to be 'light' colors (no difference between dark and light
5143 ones). But the garbage chars are gone, and also in xterms. It
5151 ones). But the garbage chars are gone, and also in xterms. It
5144 seems that now I'm using 'cleaner' ansi sequences.
5152 seems that now I'm using 'cleaner' ansi sequences.
5145
5153
5146 2002-02-21 Fernando Perez <fperez@colorado.edu>
5154 2002-02-21 Fernando Perez <fperez@colorado.edu>
5147
5155
5148 * Released 0.2.7 (mainly to publish the scoping fix).
5156 * Released 0.2.7 (mainly to publish the scoping fix).
5149
5157
5150 * IPython/Logger.py (Logger.logstate): added. A corresponding
5158 * IPython/Logger.py (Logger.logstate): added. A corresponding
5151 @logstate magic was created.
5159 @logstate magic was created.
5152
5160
5153 * IPython/Magic.py: fixed nested scoping problem under Python
5161 * IPython/Magic.py: fixed nested scoping problem under Python
5154 2.1.x (automagic wasn't working).
5162 2.1.x (automagic wasn't working).
5155
5163
5156 2002-02-20 Fernando Perez <fperez@colorado.edu>
5164 2002-02-20 Fernando Perez <fperez@colorado.edu>
5157
5165
5158 * Released 0.2.6.
5166 * Released 0.2.6.
5159
5167
5160 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5168 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5161 option so that logs can come out without any headers at all.
5169 option so that logs can come out without any headers at all.
5162
5170
5163 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5171 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5164 SciPy.
5172 SciPy.
5165
5173
5166 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5174 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5167 that embedded IPython calls don't require vars() to be explicitly
5175 that embedded IPython calls don't require vars() to be explicitly
5168 passed. Now they are extracted from the caller's frame (code
5176 passed. Now they are extracted from the caller's frame (code
5169 snatched from Eric Jones' weave). Added better documentation to
5177 snatched from Eric Jones' weave). Added better documentation to
5170 the section on embedding and the example file.
5178 the section on embedding and the example file.
5171
5179
5172 * IPython/genutils.py (page): Changed so that under emacs, it just
5180 * IPython/genutils.py (page): Changed so that under emacs, it just
5173 prints the string. You can then page up and down in the emacs
5181 prints the string. You can then page up and down in the emacs
5174 buffer itself. This is how the builtin help() works.
5182 buffer itself. This is how the builtin help() works.
5175
5183
5176 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5184 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5177 macro scoping: macros need to be executed in the user's namespace
5185 macro scoping: macros need to be executed in the user's namespace
5178 to work as if they had been typed by the user.
5186 to work as if they had been typed by the user.
5179
5187
5180 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5188 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5181 execute automatically (no need to type 'exec...'). They then
5189 execute automatically (no need to type 'exec...'). They then
5182 behave like 'true macros'. The printing system was also modified
5190 behave like 'true macros'. The printing system was also modified
5183 for this to work.
5191 for this to work.
5184
5192
5185 2002-02-19 Fernando Perez <fperez@colorado.edu>
5193 2002-02-19 Fernando Perez <fperez@colorado.edu>
5186
5194
5187 * IPython/genutils.py (page_file): new function for paging files
5195 * IPython/genutils.py (page_file): new function for paging files
5188 in an OS-independent way. Also necessary for file viewing to work
5196 in an OS-independent way. Also necessary for file viewing to work
5189 well inside Emacs buffers.
5197 well inside Emacs buffers.
5190 (page): Added checks for being in an emacs buffer.
5198 (page): Added checks for being in an emacs buffer.
5191 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5199 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5192 same bug in iplib.
5200 same bug in iplib.
5193
5201
5194 2002-02-18 Fernando Perez <fperez@colorado.edu>
5202 2002-02-18 Fernando Perez <fperez@colorado.edu>
5195
5203
5196 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5204 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5197 of readline so that IPython can work inside an Emacs buffer.
5205 of readline so that IPython can work inside an Emacs buffer.
5198
5206
5199 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5207 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5200 method signatures (they weren't really bugs, but it looks cleaner
5208 method signatures (they weren't really bugs, but it looks cleaner
5201 and keeps PyChecker happy).
5209 and keeps PyChecker happy).
5202
5210
5203 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5211 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5204 for implementing various user-defined hooks. Currently only
5212 for implementing various user-defined hooks. Currently only
5205 display is done.
5213 display is done.
5206
5214
5207 * IPython/Prompts.py (CachedOutput._display): changed display
5215 * IPython/Prompts.py (CachedOutput._display): changed display
5208 functions so that they can be dynamically changed by users easily.
5216 functions so that they can be dynamically changed by users easily.
5209
5217
5210 * IPython/Extensions/numeric_formats.py (num_display): added an
5218 * IPython/Extensions/numeric_formats.py (num_display): added an
5211 extension for printing NumPy arrays in flexible manners. It
5219 extension for printing NumPy arrays in flexible manners. It
5212 doesn't do anything yet, but all the structure is in
5220 doesn't do anything yet, but all the structure is in
5213 place. Ultimately the plan is to implement output format control
5221 place. Ultimately the plan is to implement output format control
5214 like in Octave.
5222 like in Octave.
5215
5223
5216 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5224 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5217 methods are found at run-time by all the automatic machinery.
5225 methods are found at run-time by all the automatic machinery.
5218
5226
5219 2002-02-17 Fernando Perez <fperez@colorado.edu>
5227 2002-02-17 Fernando Perez <fperez@colorado.edu>
5220
5228
5221 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5229 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5222 whole file a little.
5230 whole file a little.
5223
5231
5224 * ToDo: closed this document. Now there's a new_design.lyx
5232 * ToDo: closed this document. Now there's a new_design.lyx
5225 document for all new ideas. Added making a pdf of it for the
5233 document for all new ideas. Added making a pdf of it for the
5226 end-user distro.
5234 end-user distro.
5227
5235
5228 * IPython/Logger.py (Logger.switch_log): Created this to replace
5236 * IPython/Logger.py (Logger.switch_log): Created this to replace
5229 logon() and logoff(). It also fixes a nasty crash reported by
5237 logon() and logoff(). It also fixes a nasty crash reported by
5230 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5238 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5231
5239
5232 * IPython/iplib.py (complete): got auto-completion to work with
5240 * IPython/iplib.py (complete): got auto-completion to work with
5233 automagic (I had wanted this for a long time).
5241 automagic (I had wanted this for a long time).
5234
5242
5235 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5243 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5236 to @file, since file() is now a builtin and clashes with automagic
5244 to @file, since file() is now a builtin and clashes with automagic
5237 for @file.
5245 for @file.
5238
5246
5239 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5247 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5240 of this was previously in iplib, which had grown to more than 2000
5248 of this was previously in iplib, which had grown to more than 2000
5241 lines, way too long. No new functionality, but it makes managing
5249 lines, way too long. No new functionality, but it makes managing
5242 the code a bit easier.
5250 the code a bit easier.
5243
5251
5244 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5252 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5245 information to crash reports.
5253 information to crash reports.
5246
5254
5247 2002-02-12 Fernando Perez <fperez@colorado.edu>
5255 2002-02-12 Fernando Perez <fperez@colorado.edu>
5248
5256
5249 * Released 0.2.5.
5257 * Released 0.2.5.
5250
5258
5251 2002-02-11 Fernando Perez <fperez@colorado.edu>
5259 2002-02-11 Fernando Perez <fperez@colorado.edu>
5252
5260
5253 * Wrote a relatively complete Windows installer. It puts
5261 * Wrote a relatively complete Windows installer. It puts
5254 everything in place, creates Start Menu entries and fixes the
5262 everything in place, creates Start Menu entries and fixes the
5255 color issues. Nothing fancy, but it works.
5263 color issues. Nothing fancy, but it works.
5256
5264
5257 2002-02-10 Fernando Perez <fperez@colorado.edu>
5265 2002-02-10 Fernando Perez <fperez@colorado.edu>
5258
5266
5259 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5267 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5260 os.path.expanduser() call so that we can type @run ~/myfile.py and
5268 os.path.expanduser() call so that we can type @run ~/myfile.py and
5261 have thigs work as expected.
5269 have thigs work as expected.
5262
5270
5263 * IPython/genutils.py (page): fixed exception handling so things
5271 * IPython/genutils.py (page): fixed exception handling so things
5264 work both in Unix and Windows correctly. Quitting a pager triggers
5272 work both in Unix and Windows correctly. Quitting a pager triggers
5265 an IOError/broken pipe in Unix, and in windows not finding a pager
5273 an IOError/broken pipe in Unix, and in windows not finding a pager
5266 is also an IOError, so I had to actually look at the return value
5274 is also an IOError, so I had to actually look at the return value
5267 of the exception, not just the exception itself. Should be ok now.
5275 of the exception, not just the exception itself. Should be ok now.
5268
5276
5269 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5277 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5270 modified to allow case-insensitive color scheme changes.
5278 modified to allow case-insensitive color scheme changes.
5271
5279
5272 2002-02-09 Fernando Perez <fperez@colorado.edu>
5280 2002-02-09 Fernando Perez <fperez@colorado.edu>
5273
5281
5274 * IPython/genutils.py (native_line_ends): new function to leave
5282 * IPython/genutils.py (native_line_ends): new function to leave
5275 user config files with os-native line-endings.
5283 user config files with os-native line-endings.
5276
5284
5277 * README and manual updates.
5285 * README and manual updates.
5278
5286
5279 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5287 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5280 instead of StringType to catch Unicode strings.
5288 instead of StringType to catch Unicode strings.
5281
5289
5282 * IPython/genutils.py (filefind): fixed bug for paths with
5290 * IPython/genutils.py (filefind): fixed bug for paths with
5283 embedded spaces (very common in Windows).
5291 embedded spaces (very common in Windows).
5284
5292
5285 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5293 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5286 files under Windows, so that they get automatically associated
5294 files under Windows, so that they get automatically associated
5287 with a text editor. Windows makes it a pain to handle
5295 with a text editor. Windows makes it a pain to handle
5288 extension-less files.
5296 extension-less files.
5289
5297
5290 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5298 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5291 warning about readline only occur for Posix. In Windows there's no
5299 warning about readline only occur for Posix. In Windows there's no
5292 way to get readline, so why bother with the warning.
5300 way to get readline, so why bother with the warning.
5293
5301
5294 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5302 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5295 for __str__ instead of dir(self), since dir() changed in 2.2.
5303 for __str__ instead of dir(self), since dir() changed in 2.2.
5296
5304
5297 * Ported to Windows! Tested on XP, I suspect it should work fine
5305 * Ported to Windows! Tested on XP, I suspect it should work fine
5298 on NT/2000, but I don't think it will work on 98 et al. That
5306 on NT/2000, but I don't think it will work on 98 et al. That
5299 series of Windows is such a piece of junk anyway that I won't try
5307 series of Windows is such a piece of junk anyway that I won't try
5300 porting it there. The XP port was straightforward, showed a few
5308 porting it there. The XP port was straightforward, showed a few
5301 bugs here and there (fixed all), in particular some string
5309 bugs here and there (fixed all), in particular some string
5302 handling stuff which required considering Unicode strings (which
5310 handling stuff which required considering Unicode strings (which
5303 Windows uses). This is good, but hasn't been too tested :) No
5311 Windows uses). This is good, but hasn't been too tested :) No
5304 fancy installer yet, I'll put a note in the manual so people at
5312 fancy installer yet, I'll put a note in the manual so people at
5305 least make manually a shortcut.
5313 least make manually a shortcut.
5306
5314
5307 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5315 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5308 into a single one, "colors". This now controls both prompt and
5316 into a single one, "colors". This now controls both prompt and
5309 exception color schemes, and can be changed both at startup
5317 exception color schemes, and can be changed both at startup
5310 (either via command-line switches or via ipythonrc files) and at
5318 (either via command-line switches or via ipythonrc files) and at
5311 runtime, with @colors.
5319 runtime, with @colors.
5312 (Magic.magic_run): renamed @prun to @run and removed the old
5320 (Magic.magic_run): renamed @prun to @run and removed the old
5313 @run. The two were too similar to warrant keeping both.
5321 @run. The two were too similar to warrant keeping both.
5314
5322
5315 2002-02-03 Fernando Perez <fperez@colorado.edu>
5323 2002-02-03 Fernando Perez <fperez@colorado.edu>
5316
5324
5317 * IPython/iplib.py (install_first_time): Added comment on how to
5325 * IPython/iplib.py (install_first_time): Added comment on how to
5318 configure the color options for first-time users. Put a <return>
5326 configure the color options for first-time users. Put a <return>
5319 request at the end so that small-terminal users get a chance to
5327 request at the end so that small-terminal users get a chance to
5320 read the startup info.
5328 read the startup info.
5321
5329
5322 2002-01-23 Fernando Perez <fperez@colorado.edu>
5330 2002-01-23 Fernando Perez <fperez@colorado.edu>
5323
5331
5324 * IPython/iplib.py (CachedOutput.update): Changed output memory
5332 * IPython/iplib.py (CachedOutput.update): Changed output memory
5325 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5333 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5326 input history we still use _i. Did this b/c these variable are
5334 input history we still use _i. Did this b/c these variable are
5327 very commonly used in interactive work, so the less we need to
5335 very commonly used in interactive work, so the less we need to
5328 type the better off we are.
5336 type the better off we are.
5329 (Magic.magic_prun): updated @prun to better handle the namespaces
5337 (Magic.magic_prun): updated @prun to better handle the namespaces
5330 the file will run in, including a fix for __name__ not being set
5338 the file will run in, including a fix for __name__ not being set
5331 before.
5339 before.
5332
5340
5333 2002-01-20 Fernando Perez <fperez@colorado.edu>
5341 2002-01-20 Fernando Perez <fperez@colorado.edu>
5334
5342
5335 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5343 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5336 extra garbage for Python 2.2. Need to look more carefully into
5344 extra garbage for Python 2.2. Need to look more carefully into
5337 this later.
5345 this later.
5338
5346
5339 2002-01-19 Fernando Perez <fperez@colorado.edu>
5347 2002-01-19 Fernando Perez <fperez@colorado.edu>
5340
5348
5341 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5349 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5342 display SyntaxError exceptions properly formatted when they occur
5350 display SyntaxError exceptions properly formatted when they occur
5343 (they can be triggered by imported code).
5351 (they can be triggered by imported code).
5344
5352
5345 2002-01-18 Fernando Perez <fperez@colorado.edu>
5353 2002-01-18 Fernando Perez <fperez@colorado.edu>
5346
5354
5347 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5355 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5348 SyntaxError exceptions are reported nicely formatted, instead of
5356 SyntaxError exceptions are reported nicely formatted, instead of
5349 spitting out only offset information as before.
5357 spitting out only offset information as before.
5350 (Magic.magic_prun): Added the @prun function for executing
5358 (Magic.magic_prun): Added the @prun function for executing
5351 programs with command line args inside IPython.
5359 programs with command line args inside IPython.
5352
5360
5353 2002-01-16 Fernando Perez <fperez@colorado.edu>
5361 2002-01-16 Fernando Perez <fperez@colorado.edu>
5354
5362
5355 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5363 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5356 to *not* include the last item given in a range. This brings their
5364 to *not* include the last item given in a range. This brings their
5357 behavior in line with Python's slicing:
5365 behavior in line with Python's slicing:
5358 a[n1:n2] -> a[n1]...a[n2-1]
5366 a[n1:n2] -> a[n1]...a[n2-1]
5359 It may be a bit less convenient, but I prefer to stick to Python's
5367 It may be a bit less convenient, but I prefer to stick to Python's
5360 conventions *everywhere*, so users never have to wonder.
5368 conventions *everywhere*, so users never have to wonder.
5361 (Magic.magic_macro): Added @macro function to ease the creation of
5369 (Magic.magic_macro): Added @macro function to ease the creation of
5362 macros.
5370 macros.
5363
5371
5364 2002-01-05 Fernando Perez <fperez@colorado.edu>
5372 2002-01-05 Fernando Perez <fperez@colorado.edu>
5365
5373
5366 * Released 0.2.4.
5374 * Released 0.2.4.
5367
5375
5368 * IPython/iplib.py (Magic.magic_pdef):
5376 * IPython/iplib.py (Magic.magic_pdef):
5369 (InteractiveShell.safe_execfile): report magic lines and error
5377 (InteractiveShell.safe_execfile): report magic lines and error
5370 lines without line numbers so one can easily copy/paste them for
5378 lines without line numbers so one can easily copy/paste them for
5371 re-execution.
5379 re-execution.
5372
5380
5373 * Updated manual with recent changes.
5381 * Updated manual with recent changes.
5374
5382
5375 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5383 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5376 docstring printing when class? is called. Very handy for knowing
5384 docstring printing when class? is called. Very handy for knowing
5377 how to create class instances (as long as __init__ is well
5385 how to create class instances (as long as __init__ is well
5378 documented, of course :)
5386 documented, of course :)
5379 (Magic.magic_doc): print both class and constructor docstrings.
5387 (Magic.magic_doc): print both class and constructor docstrings.
5380 (Magic.magic_pdef): give constructor info if passed a class and
5388 (Magic.magic_pdef): give constructor info if passed a class and
5381 __call__ info for callable object instances.
5389 __call__ info for callable object instances.
5382
5390
5383 2002-01-04 Fernando Perez <fperez@colorado.edu>
5391 2002-01-04 Fernando Perez <fperez@colorado.edu>
5384
5392
5385 * Made deep_reload() off by default. It doesn't always work
5393 * Made deep_reload() off by default. It doesn't always work
5386 exactly as intended, so it's probably safer to have it off. It's
5394 exactly as intended, so it's probably safer to have it off. It's
5387 still available as dreload() anyway, so nothing is lost.
5395 still available as dreload() anyway, so nothing is lost.
5388
5396
5389 2002-01-02 Fernando Perez <fperez@colorado.edu>
5397 2002-01-02 Fernando Perez <fperez@colorado.edu>
5390
5398
5391 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5399 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5392 so I wanted an updated release).
5400 so I wanted an updated release).
5393
5401
5394 2001-12-27 Fernando Perez <fperez@colorado.edu>
5402 2001-12-27 Fernando Perez <fperez@colorado.edu>
5395
5403
5396 * IPython/iplib.py (InteractiveShell.interact): Added the original
5404 * IPython/iplib.py (InteractiveShell.interact): Added the original
5397 code from 'code.py' for this module in order to change the
5405 code from 'code.py' for this module in order to change the
5398 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5406 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5399 the history cache would break when the user hit Ctrl-C, and
5407 the history cache would break when the user hit Ctrl-C, and
5400 interact() offers no way to add any hooks to it.
5408 interact() offers no way to add any hooks to it.
5401
5409
5402 2001-12-23 Fernando Perez <fperez@colorado.edu>
5410 2001-12-23 Fernando Perez <fperez@colorado.edu>
5403
5411
5404 * setup.py: added check for 'MANIFEST' before trying to remove
5412 * setup.py: added check for 'MANIFEST' before trying to remove
5405 it. Thanks to Sean Reifschneider.
5413 it. Thanks to Sean Reifschneider.
5406
5414
5407 2001-12-22 Fernando Perez <fperez@colorado.edu>
5415 2001-12-22 Fernando Perez <fperez@colorado.edu>
5408
5416
5409 * Released 0.2.2.
5417 * Released 0.2.2.
5410
5418
5411 * Finished (reasonably) writing the manual. Later will add the
5419 * Finished (reasonably) writing the manual. Later will add the
5412 python-standard navigation stylesheets, but for the time being
5420 python-standard navigation stylesheets, but for the time being
5413 it's fairly complete. Distribution will include html and pdf
5421 it's fairly complete. Distribution will include html and pdf
5414 versions.
5422 versions.
5415
5423
5416 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5424 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5417 (MayaVi author).
5425 (MayaVi author).
5418
5426
5419 2001-12-21 Fernando Perez <fperez@colorado.edu>
5427 2001-12-21 Fernando Perez <fperez@colorado.edu>
5420
5428
5421 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5429 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5422 good public release, I think (with the manual and the distutils
5430 good public release, I think (with the manual and the distutils
5423 installer). The manual can use some work, but that can go
5431 installer). The manual can use some work, but that can go
5424 slowly. Otherwise I think it's quite nice for end users. Next
5432 slowly. Otherwise I think it's quite nice for end users. Next
5425 summer, rewrite the guts of it...
5433 summer, rewrite the guts of it...
5426
5434
5427 * Changed format of ipythonrc files to use whitespace as the
5435 * Changed format of ipythonrc files to use whitespace as the
5428 separator instead of an explicit '='. Cleaner.
5436 separator instead of an explicit '='. Cleaner.
5429
5437
5430 2001-12-20 Fernando Perez <fperez@colorado.edu>
5438 2001-12-20 Fernando Perez <fperez@colorado.edu>
5431
5439
5432 * Started a manual in LyX. For now it's just a quick merge of the
5440 * Started a manual in LyX. For now it's just a quick merge of the
5433 various internal docstrings and READMEs. Later it may grow into a
5441 various internal docstrings and READMEs. Later it may grow into a
5434 nice, full-blown manual.
5442 nice, full-blown manual.
5435
5443
5436 * Set up a distutils based installer. Installation should now be
5444 * Set up a distutils based installer. Installation should now be
5437 trivially simple for end-users.
5445 trivially simple for end-users.
5438
5446
5439 2001-12-11 Fernando Perez <fperez@colorado.edu>
5447 2001-12-11 Fernando Perez <fperez@colorado.edu>
5440
5448
5441 * Released 0.2.0. First public release, announced it at
5449 * Released 0.2.0. First public release, announced it at
5442 comp.lang.python. From now on, just bugfixes...
5450 comp.lang.python. From now on, just bugfixes...
5443
5451
5444 * Went through all the files, set copyright/license notices and
5452 * Went through all the files, set copyright/license notices and
5445 cleaned up things. Ready for release.
5453 cleaned up things. Ready for release.
5446
5454
5447 2001-12-10 Fernando Perez <fperez@colorado.edu>
5455 2001-12-10 Fernando Perez <fperez@colorado.edu>
5448
5456
5449 * Changed the first-time installer not to use tarfiles. It's more
5457 * Changed the first-time installer not to use tarfiles. It's more
5450 robust now and less unix-dependent. Also makes it easier for
5458 robust now and less unix-dependent. Also makes it easier for
5451 people to later upgrade versions.
5459 people to later upgrade versions.
5452
5460
5453 * Changed @exit to @abort to reflect the fact that it's pretty
5461 * Changed @exit to @abort to reflect the fact that it's pretty
5454 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5462 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5455 becomes significant only when IPyhton is embedded: in that case,
5463 becomes significant only when IPyhton is embedded: in that case,
5456 C-D closes IPython only, but @abort kills the enclosing program
5464 C-D closes IPython only, but @abort kills the enclosing program
5457 too (unless it had called IPython inside a try catching
5465 too (unless it had called IPython inside a try catching
5458 SystemExit).
5466 SystemExit).
5459
5467
5460 * Created Shell module which exposes the actuall IPython Shell
5468 * Created Shell module which exposes the actuall IPython Shell
5461 classes, currently the normal and the embeddable one. This at
5469 classes, currently the normal and the embeddable one. This at
5462 least offers a stable interface we won't need to change when
5470 least offers a stable interface we won't need to change when
5463 (later) the internals are rewritten. That rewrite will be confined
5471 (later) the internals are rewritten. That rewrite will be confined
5464 to iplib and ipmaker, but the Shell interface should remain as is.
5472 to iplib and ipmaker, but the Shell interface should remain as is.
5465
5473
5466 * Added embed module which offers an embeddable IPShell object,
5474 * Added embed module which offers an embeddable IPShell object,
5467 useful to fire up IPython *inside* a running program. Great for
5475 useful to fire up IPython *inside* a running program. Great for
5468 debugging or dynamical data analysis.
5476 debugging or dynamical data analysis.
5469
5477
5470 2001-12-08 Fernando Perez <fperez@colorado.edu>
5478 2001-12-08 Fernando Perez <fperez@colorado.edu>
5471
5479
5472 * Fixed small bug preventing seeing info from methods of defined
5480 * Fixed small bug preventing seeing info from methods of defined
5473 objects (incorrect namespace in _ofind()).
5481 objects (incorrect namespace in _ofind()).
5474
5482
5475 * Documentation cleanup. Moved the main usage docstrings to a
5483 * Documentation cleanup. Moved the main usage docstrings to a
5476 separate file, usage.py (cleaner to maintain, and hopefully in the
5484 separate file, usage.py (cleaner to maintain, and hopefully in the
5477 future some perlpod-like way of producing interactive, man and
5485 future some perlpod-like way of producing interactive, man and
5478 html docs out of it will be found).
5486 html docs out of it will be found).
5479
5487
5480 * Added @profile to see your profile at any time.
5488 * Added @profile to see your profile at any time.
5481
5489
5482 * Added @p as an alias for 'print'. It's especially convenient if
5490 * Added @p as an alias for 'print'. It's especially convenient if
5483 using automagic ('p x' prints x).
5491 using automagic ('p x' prints x).
5484
5492
5485 * Small cleanups and fixes after a pychecker run.
5493 * Small cleanups and fixes after a pychecker run.
5486
5494
5487 * Changed the @cd command to handle @cd - and @cd -<n> for
5495 * Changed the @cd command to handle @cd - and @cd -<n> for
5488 visiting any directory in _dh.
5496 visiting any directory in _dh.
5489
5497
5490 * Introduced _dh, a history of visited directories. @dhist prints
5498 * Introduced _dh, a history of visited directories. @dhist prints
5491 it out with numbers.
5499 it out with numbers.
5492
5500
5493 2001-12-07 Fernando Perez <fperez@colorado.edu>
5501 2001-12-07 Fernando Perez <fperez@colorado.edu>
5494
5502
5495 * Released 0.1.22
5503 * Released 0.1.22
5496
5504
5497 * Made initialization a bit more robust against invalid color
5505 * Made initialization a bit more robust against invalid color
5498 options in user input (exit, not traceback-crash).
5506 options in user input (exit, not traceback-crash).
5499
5507
5500 * Changed the bug crash reporter to write the report only in the
5508 * Changed the bug crash reporter to write the report only in the
5501 user's .ipython directory. That way IPython won't litter people's
5509 user's .ipython directory. That way IPython won't litter people's
5502 hard disks with crash files all over the place. Also print on
5510 hard disks with crash files all over the place. Also print on
5503 screen the necessary mail command.
5511 screen the necessary mail command.
5504
5512
5505 * With the new ultraTB, implemented LightBG color scheme for light
5513 * With the new ultraTB, implemented LightBG color scheme for light
5506 background terminals. A lot of people like white backgrounds, so I
5514 background terminals. A lot of people like white backgrounds, so I
5507 guess we should at least give them something readable.
5515 guess we should at least give them something readable.
5508
5516
5509 2001-12-06 Fernando Perez <fperez@colorado.edu>
5517 2001-12-06 Fernando Perez <fperez@colorado.edu>
5510
5518
5511 * Modified the structure of ultraTB. Now there's a proper class
5519 * Modified the structure of ultraTB. Now there's a proper class
5512 for tables of color schemes which allow adding schemes easily and
5520 for tables of color schemes which allow adding schemes easily and
5513 switching the active scheme without creating a new instance every
5521 switching the active scheme without creating a new instance every
5514 time (which was ridiculous). The syntax for creating new schemes
5522 time (which was ridiculous). The syntax for creating new schemes
5515 is also cleaner. I think ultraTB is finally done, with a clean
5523 is also cleaner. I think ultraTB is finally done, with a clean
5516 class structure. Names are also much cleaner (now there's proper
5524 class structure. Names are also much cleaner (now there's proper
5517 color tables, no need for every variable to also have 'color' in
5525 color tables, no need for every variable to also have 'color' in
5518 its name).
5526 its name).
5519
5527
5520 * Broke down genutils into separate files. Now genutils only
5528 * Broke down genutils into separate files. Now genutils only
5521 contains utility functions, and classes have been moved to their
5529 contains utility functions, and classes have been moved to their
5522 own files (they had enough independent functionality to warrant
5530 own files (they had enough independent functionality to warrant
5523 it): ConfigLoader, OutputTrap, Struct.
5531 it): ConfigLoader, OutputTrap, Struct.
5524
5532
5525 2001-12-05 Fernando Perez <fperez@colorado.edu>
5533 2001-12-05 Fernando Perez <fperez@colorado.edu>
5526
5534
5527 * IPython turns 21! Released version 0.1.21, as a candidate for
5535 * IPython turns 21! Released version 0.1.21, as a candidate for
5528 public consumption. If all goes well, release in a few days.
5536 public consumption. If all goes well, release in a few days.
5529
5537
5530 * Fixed path bug (files in Extensions/ directory wouldn't be found
5538 * Fixed path bug (files in Extensions/ directory wouldn't be found
5531 unless IPython/ was explicitly in sys.path).
5539 unless IPython/ was explicitly in sys.path).
5532
5540
5533 * Extended the FlexCompleter class as MagicCompleter to allow
5541 * Extended the FlexCompleter class as MagicCompleter to allow
5534 completion of @-starting lines.
5542 completion of @-starting lines.
5535
5543
5536 * Created __release__.py file as a central repository for release
5544 * Created __release__.py file as a central repository for release
5537 info that other files can read from.
5545 info that other files can read from.
5538
5546
5539 * Fixed small bug in logging: when logging was turned on in
5547 * Fixed small bug in logging: when logging was turned on in
5540 mid-session, old lines with special meanings (!@?) were being
5548 mid-session, old lines with special meanings (!@?) were being
5541 logged without the prepended comment, which is necessary since
5549 logged without the prepended comment, which is necessary since
5542 they are not truly valid python syntax. This should make session
5550 they are not truly valid python syntax. This should make session
5543 restores produce less errors.
5551 restores produce less errors.
5544
5552
5545 * The namespace cleanup forced me to make a FlexCompleter class
5553 * The namespace cleanup forced me to make a FlexCompleter class
5546 which is nothing but a ripoff of rlcompleter, but with selectable
5554 which is nothing but a ripoff of rlcompleter, but with selectable
5547 namespace (rlcompleter only works in __main__.__dict__). I'll try
5555 namespace (rlcompleter only works in __main__.__dict__). I'll try
5548 to submit a note to the authors to see if this change can be
5556 to submit a note to the authors to see if this change can be
5549 incorporated in future rlcompleter releases (Dec.6: done)
5557 incorporated in future rlcompleter releases (Dec.6: done)
5550
5558
5551 * More fixes to namespace handling. It was a mess! Now all
5559 * More fixes to namespace handling. It was a mess! Now all
5552 explicit references to __main__.__dict__ are gone (except when
5560 explicit references to __main__.__dict__ are gone (except when
5553 really needed) and everything is handled through the namespace
5561 really needed) and everything is handled through the namespace
5554 dicts in the IPython instance. We seem to be getting somewhere
5562 dicts in the IPython instance. We seem to be getting somewhere
5555 with this, finally...
5563 with this, finally...
5556
5564
5557 * Small documentation updates.
5565 * Small documentation updates.
5558
5566
5559 * Created the Extensions directory under IPython (with an
5567 * Created the Extensions directory under IPython (with an
5560 __init__.py). Put the PhysicalQ stuff there. This directory should
5568 __init__.py). Put the PhysicalQ stuff there. This directory should
5561 be used for all special-purpose extensions.
5569 be used for all special-purpose extensions.
5562
5570
5563 * File renaming:
5571 * File renaming:
5564 ipythonlib --> ipmaker
5572 ipythonlib --> ipmaker
5565 ipplib --> iplib
5573 ipplib --> iplib
5566 This makes a bit more sense in terms of what these files actually do.
5574 This makes a bit more sense in terms of what these files actually do.
5567
5575
5568 * Moved all the classes and functions in ipythonlib to ipplib, so
5576 * Moved all the classes and functions in ipythonlib to ipplib, so
5569 now ipythonlib only has make_IPython(). This will ease up its
5577 now ipythonlib only has make_IPython(). This will ease up its
5570 splitting in smaller functional chunks later.
5578 splitting in smaller functional chunks later.
5571
5579
5572 * Cleaned up (done, I think) output of @whos. Better column
5580 * Cleaned up (done, I think) output of @whos. Better column
5573 formatting, and now shows str(var) for as much as it can, which is
5581 formatting, and now shows str(var) for as much as it can, which is
5574 typically what one gets with a 'print var'.
5582 typically what one gets with a 'print var'.
5575
5583
5576 2001-12-04 Fernando Perez <fperez@colorado.edu>
5584 2001-12-04 Fernando Perez <fperez@colorado.edu>
5577
5585
5578 * Fixed namespace problems. Now builtin/IPyhton/user names get
5586 * Fixed namespace problems. Now builtin/IPyhton/user names get
5579 properly reported in their namespace. Internal namespace handling
5587 properly reported in their namespace. Internal namespace handling
5580 is finally getting decent (not perfect yet, but much better than
5588 is finally getting decent (not perfect yet, but much better than
5581 the ad-hoc mess we had).
5589 the ad-hoc mess we had).
5582
5590
5583 * Removed -exit option. If people just want to run a python
5591 * Removed -exit option. If people just want to run a python
5584 script, that's what the normal interpreter is for. Less
5592 script, that's what the normal interpreter is for. Less
5585 unnecessary options, less chances for bugs.
5593 unnecessary options, less chances for bugs.
5586
5594
5587 * Added a crash handler which generates a complete post-mortem if
5595 * Added a crash handler which generates a complete post-mortem if
5588 IPython crashes. This will help a lot in tracking bugs down the
5596 IPython crashes. This will help a lot in tracking bugs down the
5589 road.
5597 road.
5590
5598
5591 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5599 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5592 which were boud to functions being reassigned would bypass the
5600 which were boud to functions being reassigned would bypass the
5593 logger, breaking the sync of _il with the prompt counter. This
5601 logger, breaking the sync of _il with the prompt counter. This
5594 would then crash IPython later when a new line was logged.
5602 would then crash IPython later when a new line was logged.
5595
5603
5596 2001-12-02 Fernando Perez <fperez@colorado.edu>
5604 2001-12-02 Fernando Perez <fperez@colorado.edu>
5597
5605
5598 * Made IPython a package. This means people don't have to clutter
5606 * Made IPython a package. This means people don't have to clutter
5599 their sys.path with yet another directory. Changed the INSTALL
5607 their sys.path with yet another directory. Changed the INSTALL
5600 file accordingly.
5608 file accordingly.
5601
5609
5602 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5610 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5603 sorts its output (so @who shows it sorted) and @whos formats the
5611 sorts its output (so @who shows it sorted) and @whos formats the
5604 table according to the width of the first column. Nicer, easier to
5612 table according to the width of the first column. Nicer, easier to
5605 read. Todo: write a generic table_format() which takes a list of
5613 read. Todo: write a generic table_format() which takes a list of
5606 lists and prints it nicely formatted, with optional row/column
5614 lists and prints it nicely formatted, with optional row/column
5607 separators and proper padding and justification.
5615 separators and proper padding and justification.
5608
5616
5609 * Released 0.1.20
5617 * Released 0.1.20
5610
5618
5611 * Fixed bug in @log which would reverse the inputcache list (a
5619 * Fixed bug in @log which would reverse the inputcache list (a
5612 copy operation was missing).
5620 copy operation was missing).
5613
5621
5614 * Code cleanup. @config was changed to use page(). Better, since
5622 * Code cleanup. @config was changed to use page(). Better, since
5615 its output is always quite long.
5623 its output is always quite long.
5616
5624
5617 * Itpl is back as a dependency. I was having too many problems
5625 * Itpl is back as a dependency. I was having too many problems
5618 getting the parametric aliases to work reliably, and it's just
5626 getting the parametric aliases to work reliably, and it's just
5619 easier to code weird string operations with it than playing %()s
5627 easier to code weird string operations with it than playing %()s
5620 games. It's only ~6k, so I don't think it's too big a deal.
5628 games. It's only ~6k, so I don't think it's too big a deal.
5621
5629
5622 * Found (and fixed) a very nasty bug with history. !lines weren't
5630 * Found (and fixed) a very nasty bug with history. !lines weren't
5623 getting cached, and the out of sync caches would crash
5631 getting cached, and the out of sync caches would crash
5624 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5632 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5625 division of labor a bit better. Bug fixed, cleaner structure.
5633 division of labor a bit better. Bug fixed, cleaner structure.
5626
5634
5627 2001-12-01 Fernando Perez <fperez@colorado.edu>
5635 2001-12-01 Fernando Perez <fperez@colorado.edu>
5628
5636
5629 * Released 0.1.19
5637 * Released 0.1.19
5630
5638
5631 * Added option -n to @hist to prevent line number printing. Much
5639 * Added option -n to @hist to prevent line number printing. Much
5632 easier to copy/paste code this way.
5640 easier to copy/paste code this way.
5633
5641
5634 * Created global _il to hold the input list. Allows easy
5642 * Created global _il to hold the input list. Allows easy
5635 re-execution of blocks of code by slicing it (inspired by Janko's
5643 re-execution of blocks of code by slicing it (inspired by Janko's
5636 comment on 'macros').
5644 comment on 'macros').
5637
5645
5638 * Small fixes and doc updates.
5646 * Small fixes and doc updates.
5639
5647
5640 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5648 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5641 much too fragile with automagic. Handles properly multi-line
5649 much too fragile with automagic. Handles properly multi-line
5642 statements and takes parameters.
5650 statements and takes parameters.
5643
5651
5644 2001-11-30 Fernando Perez <fperez@colorado.edu>
5652 2001-11-30 Fernando Perez <fperez@colorado.edu>
5645
5653
5646 * Version 0.1.18 released.
5654 * Version 0.1.18 released.
5647
5655
5648 * Fixed nasty namespace bug in initial module imports.
5656 * Fixed nasty namespace bug in initial module imports.
5649
5657
5650 * Added copyright/license notes to all code files (except
5658 * Added copyright/license notes to all code files (except
5651 DPyGetOpt). For the time being, LGPL. That could change.
5659 DPyGetOpt). For the time being, LGPL. That could change.
5652
5660
5653 * Rewrote a much nicer README, updated INSTALL, cleaned up
5661 * Rewrote a much nicer README, updated INSTALL, cleaned up
5654 ipythonrc-* samples.
5662 ipythonrc-* samples.
5655
5663
5656 * Overall code/documentation cleanup. Basically ready for
5664 * Overall code/documentation cleanup. Basically ready for
5657 release. Only remaining thing: licence decision (LGPL?).
5665 release. Only remaining thing: licence decision (LGPL?).
5658
5666
5659 * Converted load_config to a class, ConfigLoader. Now recursion
5667 * Converted load_config to a class, ConfigLoader. Now recursion
5660 control is better organized. Doesn't include the same file twice.
5668 control is better organized. Doesn't include the same file twice.
5661
5669
5662 2001-11-29 Fernando Perez <fperez@colorado.edu>
5670 2001-11-29 Fernando Perez <fperez@colorado.edu>
5663
5671
5664 * Got input history working. Changed output history variables from
5672 * Got input history working. Changed output history variables from
5665 _p to _o so that _i is for input and _o for output. Just cleaner
5673 _p to _o so that _i is for input and _o for output. Just cleaner
5666 convention.
5674 convention.
5667
5675
5668 * Implemented parametric aliases. This pretty much allows the
5676 * Implemented parametric aliases. This pretty much allows the
5669 alias system to offer full-blown shell convenience, I think.
5677 alias system to offer full-blown shell convenience, I think.
5670
5678
5671 * Version 0.1.17 released, 0.1.18 opened.
5679 * Version 0.1.17 released, 0.1.18 opened.
5672
5680
5673 * dot_ipython/ipythonrc (alias): added documentation.
5681 * dot_ipython/ipythonrc (alias): added documentation.
5674 (xcolor): Fixed small bug (xcolors -> xcolor)
5682 (xcolor): Fixed small bug (xcolors -> xcolor)
5675
5683
5676 * Changed the alias system. Now alias is a magic command to define
5684 * Changed the alias system. Now alias is a magic command to define
5677 aliases just like the shell. Rationale: the builtin magics should
5685 aliases just like the shell. Rationale: the builtin magics should
5678 be there for things deeply connected to IPython's
5686 be there for things deeply connected to IPython's
5679 architecture. And this is a much lighter system for what I think
5687 architecture. And this is a much lighter system for what I think
5680 is the really important feature: allowing users to define quickly
5688 is the really important feature: allowing users to define quickly
5681 magics that will do shell things for them, so they can customize
5689 magics that will do shell things for them, so they can customize
5682 IPython easily to match their work habits. If someone is really
5690 IPython easily to match their work habits. If someone is really
5683 desperate to have another name for a builtin alias, they can
5691 desperate to have another name for a builtin alias, they can
5684 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5692 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5685 works.
5693 works.
5686
5694
5687 2001-11-28 Fernando Perez <fperez@colorado.edu>
5695 2001-11-28 Fernando Perez <fperez@colorado.edu>
5688
5696
5689 * Changed @file so that it opens the source file at the proper
5697 * Changed @file so that it opens the source file at the proper
5690 line. Since it uses less, if your EDITOR environment is
5698 line. Since it uses less, if your EDITOR environment is
5691 configured, typing v will immediately open your editor of choice
5699 configured, typing v will immediately open your editor of choice
5692 right at the line where the object is defined. Not as quick as
5700 right at the line where the object is defined. Not as quick as
5693 having a direct @edit command, but for all intents and purposes it
5701 having a direct @edit command, but for all intents and purposes it
5694 works. And I don't have to worry about writing @edit to deal with
5702 works. And I don't have to worry about writing @edit to deal with
5695 all the editors, less does that.
5703 all the editors, less does that.
5696
5704
5697 * Version 0.1.16 released, 0.1.17 opened.
5705 * Version 0.1.16 released, 0.1.17 opened.
5698
5706
5699 * Fixed some nasty bugs in the page/page_dumb combo that could
5707 * Fixed some nasty bugs in the page/page_dumb combo that could
5700 crash IPython.
5708 crash IPython.
5701
5709
5702 2001-11-27 Fernando Perez <fperez@colorado.edu>
5710 2001-11-27 Fernando Perez <fperez@colorado.edu>
5703
5711
5704 * Version 0.1.15 released, 0.1.16 opened.
5712 * Version 0.1.15 released, 0.1.16 opened.
5705
5713
5706 * Finally got ? and ?? to work for undefined things: now it's
5714 * Finally got ? and ?? to work for undefined things: now it's
5707 possible to type {}.get? and get information about the get method
5715 possible to type {}.get? and get information about the get method
5708 of dicts, or os.path? even if only os is defined (so technically
5716 of dicts, or os.path? even if only os is defined (so technically
5709 os.path isn't). Works at any level. For example, after import os,
5717 os.path isn't). Works at any level. For example, after import os,
5710 os?, os.path?, os.path.abspath? all work. This is great, took some
5718 os?, os.path?, os.path.abspath? all work. This is great, took some
5711 work in _ofind.
5719 work in _ofind.
5712
5720
5713 * Fixed more bugs with logging. The sanest way to do it was to add
5721 * Fixed more bugs with logging. The sanest way to do it was to add
5714 to @log a 'mode' parameter. Killed two in one shot (this mode
5722 to @log a 'mode' parameter. Killed two in one shot (this mode
5715 option was a request of Janko's). I think it's finally clean
5723 option was a request of Janko's). I think it's finally clean
5716 (famous last words).
5724 (famous last words).
5717
5725
5718 * Added a page_dumb() pager which does a decent job of paging on
5726 * Added a page_dumb() pager which does a decent job of paging on
5719 screen, if better things (like less) aren't available. One less
5727 screen, if better things (like less) aren't available. One less
5720 unix dependency (someday maybe somebody will port this to
5728 unix dependency (someday maybe somebody will port this to
5721 windows).
5729 windows).
5722
5730
5723 * Fixed problem in magic_log: would lock of logging out if log
5731 * Fixed problem in magic_log: would lock of logging out if log
5724 creation failed (because it would still think it had succeeded).
5732 creation failed (because it would still think it had succeeded).
5725
5733
5726 * Improved the page() function using curses to auto-detect screen
5734 * Improved the page() function using curses to auto-detect screen
5727 size. Now it can make a much better decision on whether to print
5735 size. Now it can make a much better decision on whether to print
5728 or page a string. Option screen_length was modified: a value 0
5736 or page a string. Option screen_length was modified: a value 0
5729 means auto-detect, and that's the default now.
5737 means auto-detect, and that's the default now.
5730
5738
5731 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5739 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5732 go out. I'll test it for a few days, then talk to Janko about
5740 go out. I'll test it for a few days, then talk to Janko about
5733 licences and announce it.
5741 licences and announce it.
5734
5742
5735 * Fixed the length of the auto-generated ---> prompt which appears
5743 * Fixed the length of the auto-generated ---> prompt which appears
5736 for auto-parens and auto-quotes. Getting this right isn't trivial,
5744 for auto-parens and auto-quotes. Getting this right isn't trivial,
5737 with all the color escapes, different prompt types and optional
5745 with all the color escapes, different prompt types and optional
5738 separators. But it seems to be working in all the combinations.
5746 separators. But it seems to be working in all the combinations.
5739
5747
5740 2001-11-26 Fernando Perez <fperez@colorado.edu>
5748 2001-11-26 Fernando Perez <fperez@colorado.edu>
5741
5749
5742 * Wrote a regexp filter to get option types from the option names
5750 * Wrote a regexp filter to get option types from the option names
5743 string. This eliminates the need to manually keep two duplicate
5751 string. This eliminates the need to manually keep two duplicate
5744 lists.
5752 lists.
5745
5753
5746 * Removed the unneeded check_option_names. Now options are handled
5754 * Removed the unneeded check_option_names. Now options are handled
5747 in a much saner manner and it's easy to visually check that things
5755 in a much saner manner and it's easy to visually check that things
5748 are ok.
5756 are ok.
5749
5757
5750 * Updated version numbers on all files I modified to carry a
5758 * Updated version numbers on all files I modified to carry a
5751 notice so Janko and Nathan have clear version markers.
5759 notice so Janko and Nathan have clear version markers.
5752
5760
5753 * Updated docstring for ultraTB with my changes. I should send
5761 * Updated docstring for ultraTB with my changes. I should send
5754 this to Nathan.
5762 this to Nathan.
5755
5763
5756 * Lots of small fixes. Ran everything through pychecker again.
5764 * Lots of small fixes. Ran everything through pychecker again.
5757
5765
5758 * Made loading of deep_reload an cmd line option. If it's not too
5766 * Made loading of deep_reload an cmd line option. If it's not too
5759 kosher, now people can just disable it. With -nodeep_reload it's
5767 kosher, now people can just disable it. With -nodeep_reload it's
5760 still available as dreload(), it just won't overwrite reload().
5768 still available as dreload(), it just won't overwrite reload().
5761
5769
5762 * Moved many options to the no| form (-opt and -noopt
5770 * Moved many options to the no| form (-opt and -noopt
5763 accepted). Cleaner.
5771 accepted). Cleaner.
5764
5772
5765 * Changed magic_log so that if called with no parameters, it uses
5773 * Changed magic_log so that if called with no parameters, it uses
5766 'rotate' mode. That way auto-generated logs aren't automatically
5774 'rotate' mode. That way auto-generated logs aren't automatically
5767 over-written. For normal logs, now a backup is made if it exists
5775 over-written. For normal logs, now a backup is made if it exists
5768 (only 1 level of backups). A new 'backup' mode was added to the
5776 (only 1 level of backups). A new 'backup' mode was added to the
5769 Logger class to support this. This was a request by Janko.
5777 Logger class to support this. This was a request by Janko.
5770
5778
5771 * Added @logoff/@logon to stop/restart an active log.
5779 * Added @logoff/@logon to stop/restart an active log.
5772
5780
5773 * Fixed a lot of bugs in log saving/replay. It was pretty
5781 * Fixed a lot of bugs in log saving/replay. It was pretty
5774 broken. Now special lines (!@,/) appear properly in the command
5782 broken. Now special lines (!@,/) appear properly in the command
5775 history after a log replay.
5783 history after a log replay.
5776
5784
5777 * Tried and failed to implement full session saving via pickle. My
5785 * Tried and failed to implement full session saving via pickle. My
5778 idea was to pickle __main__.__dict__, but modules can't be
5786 idea was to pickle __main__.__dict__, but modules can't be
5779 pickled. This would be a better alternative to replaying logs, but
5787 pickled. This would be a better alternative to replaying logs, but
5780 seems quite tricky to get to work. Changed -session to be called
5788 seems quite tricky to get to work. Changed -session to be called
5781 -logplay, which more accurately reflects what it does. And if we
5789 -logplay, which more accurately reflects what it does. And if we
5782 ever get real session saving working, -session is now available.
5790 ever get real session saving working, -session is now available.
5783
5791
5784 * Implemented color schemes for prompts also. As for tracebacks,
5792 * Implemented color schemes for prompts also. As for tracebacks,
5785 currently only NoColor and Linux are supported. But now the
5793 currently only NoColor and Linux are supported. But now the
5786 infrastructure is in place, based on a generic ColorScheme
5794 infrastructure is in place, based on a generic ColorScheme
5787 class. So writing and activating new schemes both for the prompts
5795 class. So writing and activating new schemes both for the prompts
5788 and the tracebacks should be straightforward.
5796 and the tracebacks should be straightforward.
5789
5797
5790 * Version 0.1.13 released, 0.1.14 opened.
5798 * Version 0.1.13 released, 0.1.14 opened.
5791
5799
5792 * Changed handling of options for output cache. Now counter is
5800 * Changed handling of options for output cache. Now counter is
5793 hardwired starting at 1 and one specifies the maximum number of
5801 hardwired starting at 1 and one specifies the maximum number of
5794 entries *in the outcache* (not the max prompt counter). This is
5802 entries *in the outcache* (not the max prompt counter). This is
5795 much better, since many statements won't increase the cache
5803 much better, since many statements won't increase the cache
5796 count. It also eliminated some confusing options, now there's only
5804 count. It also eliminated some confusing options, now there's only
5797 one: cache_size.
5805 one: cache_size.
5798
5806
5799 * Added 'alias' magic function and magic_alias option in the
5807 * Added 'alias' magic function and magic_alias option in the
5800 ipythonrc file. Now the user can easily define whatever names he
5808 ipythonrc file. Now the user can easily define whatever names he
5801 wants for the magic functions without having to play weird
5809 wants for the magic functions without having to play weird
5802 namespace games. This gives IPython a real shell-like feel.
5810 namespace games. This gives IPython a real shell-like feel.
5803
5811
5804 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5812 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5805 @ or not).
5813 @ or not).
5806
5814
5807 This was one of the last remaining 'visible' bugs (that I know
5815 This was one of the last remaining 'visible' bugs (that I know
5808 of). I think if I can clean up the session loading so it works
5816 of). I think if I can clean up the session loading so it works
5809 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5817 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5810 about licensing).
5818 about licensing).
5811
5819
5812 2001-11-25 Fernando Perez <fperez@colorado.edu>
5820 2001-11-25 Fernando Perez <fperez@colorado.edu>
5813
5821
5814 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5822 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5815 there's a cleaner distinction between what ? and ?? show.
5823 there's a cleaner distinction between what ? and ?? show.
5816
5824
5817 * Added screen_length option. Now the user can define his own
5825 * Added screen_length option. Now the user can define his own
5818 screen size for page() operations.
5826 screen size for page() operations.
5819
5827
5820 * Implemented magic shell-like functions with automatic code
5828 * Implemented magic shell-like functions with automatic code
5821 generation. Now adding another function is just a matter of adding
5829 generation. Now adding another function is just a matter of adding
5822 an entry to a dict, and the function is dynamically generated at
5830 an entry to a dict, and the function is dynamically generated at
5823 run-time. Python has some really cool features!
5831 run-time. Python has some really cool features!
5824
5832
5825 * Renamed many options to cleanup conventions a little. Now all
5833 * Renamed many options to cleanup conventions a little. Now all
5826 are lowercase, and only underscores where needed. Also in the code
5834 are lowercase, and only underscores where needed. Also in the code
5827 option name tables are clearer.
5835 option name tables are clearer.
5828
5836
5829 * Changed prompts a little. Now input is 'In [n]:' instead of
5837 * Changed prompts a little. Now input is 'In [n]:' instead of
5830 'In[n]:='. This allows it the numbers to be aligned with the
5838 'In[n]:='. This allows it the numbers to be aligned with the
5831 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5839 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5832 Python (it was a Mathematica thing). The '...' continuation prompt
5840 Python (it was a Mathematica thing). The '...' continuation prompt
5833 was also changed a little to align better.
5841 was also changed a little to align better.
5834
5842
5835 * Fixed bug when flushing output cache. Not all _p<n> variables
5843 * Fixed bug when flushing output cache. Not all _p<n> variables
5836 exist, so their deletion needs to be wrapped in a try:
5844 exist, so their deletion needs to be wrapped in a try:
5837
5845
5838 * Figured out how to properly use inspect.formatargspec() (it
5846 * Figured out how to properly use inspect.formatargspec() (it
5839 requires the args preceded by *). So I removed all the code from
5847 requires the args preceded by *). So I removed all the code from
5840 _get_pdef in Magic, which was just replicating that.
5848 _get_pdef in Magic, which was just replicating that.
5841
5849
5842 * Added test to prefilter to allow redefining magic function names
5850 * Added test to prefilter to allow redefining magic function names
5843 as variables. This is ok, since the @ form is always available,
5851 as variables. This is ok, since the @ form is always available,
5844 but whe should allow the user to define a variable called 'ls' if
5852 but whe should allow the user to define a variable called 'ls' if
5845 he needs it.
5853 he needs it.
5846
5854
5847 * Moved the ToDo information from README into a separate ToDo.
5855 * Moved the ToDo information from README into a separate ToDo.
5848
5856
5849 * General code cleanup and small bugfixes. I think it's close to a
5857 * General code cleanup and small bugfixes. I think it's close to a
5850 state where it can be released, obviously with a big 'beta'
5858 state where it can be released, obviously with a big 'beta'
5851 warning on it.
5859 warning on it.
5852
5860
5853 * Got the magic function split to work. Now all magics are defined
5861 * Got the magic function split to work. Now all magics are defined
5854 in a separate class. It just organizes things a bit, and now
5862 in a separate class. It just organizes things a bit, and now
5855 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5863 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5856 was too long).
5864 was too long).
5857
5865
5858 * Changed @clear to @reset to avoid potential confusions with
5866 * Changed @clear to @reset to avoid potential confusions with
5859 the shell command clear. Also renamed @cl to @clear, which does
5867 the shell command clear. Also renamed @cl to @clear, which does
5860 exactly what people expect it to from their shell experience.
5868 exactly what people expect it to from their shell experience.
5861
5869
5862 Added a check to the @reset command (since it's so
5870 Added a check to the @reset command (since it's so
5863 destructive, it's probably a good idea to ask for confirmation).
5871 destructive, it's probably a good idea to ask for confirmation).
5864 But now reset only works for full namespace resetting. Since the
5872 But now reset only works for full namespace resetting. Since the
5865 del keyword is already there for deleting a few specific
5873 del keyword is already there for deleting a few specific
5866 variables, I don't see the point of having a redundant magic
5874 variables, I don't see the point of having a redundant magic
5867 function for the same task.
5875 function for the same task.
5868
5876
5869 2001-11-24 Fernando Perez <fperez@colorado.edu>
5877 2001-11-24 Fernando Perez <fperez@colorado.edu>
5870
5878
5871 * Updated the builtin docs (esp. the ? ones).
5879 * Updated the builtin docs (esp. the ? ones).
5872
5880
5873 * Ran all the code through pychecker. Not terribly impressed with
5881 * Ran all the code through pychecker. Not terribly impressed with
5874 it: lots of spurious warnings and didn't really find anything of
5882 it: lots of spurious warnings and didn't really find anything of
5875 substance (just a few modules being imported and not used).
5883 substance (just a few modules being imported and not used).
5876
5884
5877 * Implemented the new ultraTB functionality into IPython. New
5885 * Implemented the new ultraTB functionality into IPython. New
5878 option: xcolors. This chooses color scheme. xmode now only selects
5886 option: xcolors. This chooses color scheme. xmode now only selects
5879 between Plain and Verbose. Better orthogonality.
5887 between Plain and Verbose. Better orthogonality.
5880
5888
5881 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5889 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5882 mode and color scheme for the exception handlers. Now it's
5890 mode and color scheme for the exception handlers. Now it's
5883 possible to have the verbose traceback with no coloring.
5891 possible to have the verbose traceback with no coloring.
5884
5892
5885 2001-11-23 Fernando Perez <fperez@colorado.edu>
5893 2001-11-23 Fernando Perez <fperez@colorado.edu>
5886
5894
5887 * Version 0.1.12 released, 0.1.13 opened.
5895 * Version 0.1.12 released, 0.1.13 opened.
5888
5896
5889 * Removed option to set auto-quote and auto-paren escapes by
5897 * Removed option to set auto-quote and auto-paren escapes by
5890 user. The chances of breaking valid syntax are just too high. If
5898 user. The chances of breaking valid syntax are just too high. If
5891 someone *really* wants, they can always dig into the code.
5899 someone *really* wants, they can always dig into the code.
5892
5900
5893 * Made prompt separators configurable.
5901 * Made prompt separators configurable.
5894
5902
5895 2001-11-22 Fernando Perez <fperez@colorado.edu>
5903 2001-11-22 Fernando Perez <fperez@colorado.edu>
5896
5904
5897 * Small bugfixes in many places.
5905 * Small bugfixes in many places.
5898
5906
5899 * Removed the MyCompleter class from ipplib. It seemed redundant
5907 * Removed the MyCompleter class from ipplib. It seemed redundant
5900 with the C-p,C-n history search functionality. Less code to
5908 with the C-p,C-n history search functionality. Less code to
5901 maintain.
5909 maintain.
5902
5910
5903 * Moved all the original ipython.py code into ipythonlib.py. Right
5911 * Moved all the original ipython.py code into ipythonlib.py. Right
5904 now it's just one big dump into a function called make_IPython, so
5912 now it's just one big dump into a function called make_IPython, so
5905 no real modularity has been gained. But at least it makes the
5913 no real modularity has been gained. But at least it makes the
5906 wrapper script tiny, and since ipythonlib is a module, it gets
5914 wrapper script tiny, and since ipythonlib is a module, it gets
5907 compiled and startup is much faster.
5915 compiled and startup is much faster.
5908
5916
5909 This is a reasobably 'deep' change, so we should test it for a
5917 This is a reasobably 'deep' change, so we should test it for a
5910 while without messing too much more with the code.
5918 while without messing too much more with the code.
5911
5919
5912 2001-11-21 Fernando Perez <fperez@colorado.edu>
5920 2001-11-21 Fernando Perez <fperez@colorado.edu>
5913
5921
5914 * Version 0.1.11 released, 0.1.12 opened for further work.
5922 * Version 0.1.11 released, 0.1.12 opened for further work.
5915
5923
5916 * Removed dependency on Itpl. It was only needed in one place. It
5924 * Removed dependency on Itpl. It was only needed in one place. It
5917 would be nice if this became part of python, though. It makes life
5925 would be nice if this became part of python, though. It makes life
5918 *a lot* easier in some cases.
5926 *a lot* easier in some cases.
5919
5927
5920 * Simplified the prefilter code a bit. Now all handlers are
5928 * Simplified the prefilter code a bit. Now all handlers are
5921 expected to explicitly return a value (at least a blank string).
5929 expected to explicitly return a value (at least a blank string).
5922
5930
5923 * Heavy edits in ipplib. Removed the help system altogether. Now
5931 * Heavy edits in ipplib. Removed the help system altogether. Now
5924 obj?/?? is used for inspecting objects, a magic @doc prints
5932 obj?/?? is used for inspecting objects, a magic @doc prints
5925 docstrings, and full-blown Python help is accessed via the 'help'
5933 docstrings, and full-blown Python help is accessed via the 'help'
5926 keyword. This cleans up a lot of code (less to maintain) and does
5934 keyword. This cleans up a lot of code (less to maintain) and does
5927 the job. Since 'help' is now a standard Python component, might as
5935 the job. Since 'help' is now a standard Python component, might as
5928 well use it and remove duplicate functionality.
5936 well use it and remove duplicate functionality.
5929
5937
5930 Also removed the option to use ipplib as a standalone program. By
5938 Also removed the option to use ipplib as a standalone program. By
5931 now it's too dependent on other parts of IPython to function alone.
5939 now it's too dependent on other parts of IPython to function alone.
5932
5940
5933 * Fixed bug in genutils.pager. It would crash if the pager was
5941 * Fixed bug in genutils.pager. It would crash if the pager was
5934 exited immediately after opening (broken pipe).
5942 exited immediately after opening (broken pipe).
5935
5943
5936 * Trimmed down the VerboseTB reporting a little. The header is
5944 * Trimmed down the VerboseTB reporting a little. The header is
5937 much shorter now and the repeated exception arguments at the end
5945 much shorter now and the repeated exception arguments at the end
5938 have been removed. For interactive use the old header seemed a bit
5946 have been removed. For interactive use the old header seemed a bit
5939 excessive.
5947 excessive.
5940
5948
5941 * Fixed small bug in output of @whos for variables with multi-word
5949 * Fixed small bug in output of @whos for variables with multi-word
5942 types (only first word was displayed).
5950 types (only first word was displayed).
5943
5951
5944 2001-11-17 Fernando Perez <fperez@colorado.edu>
5952 2001-11-17 Fernando Perez <fperez@colorado.edu>
5945
5953
5946 * Version 0.1.10 released, 0.1.11 opened for further work.
5954 * Version 0.1.10 released, 0.1.11 opened for further work.
5947
5955
5948 * Modified dirs and friends. dirs now *returns* the stack (not
5956 * Modified dirs and friends. dirs now *returns* the stack (not
5949 prints), so one can manipulate it as a variable. Convenient to
5957 prints), so one can manipulate it as a variable. Convenient to
5950 travel along many directories.
5958 travel along many directories.
5951
5959
5952 * Fixed bug in magic_pdef: would only work with functions with
5960 * Fixed bug in magic_pdef: would only work with functions with
5953 arguments with default values.
5961 arguments with default values.
5954
5962
5955 2001-11-14 Fernando Perez <fperez@colorado.edu>
5963 2001-11-14 Fernando Perez <fperez@colorado.edu>
5956
5964
5957 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5965 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5958 example with IPython. Various other minor fixes and cleanups.
5966 example with IPython. Various other minor fixes and cleanups.
5959
5967
5960 * Version 0.1.9 released, 0.1.10 opened for further work.
5968 * Version 0.1.9 released, 0.1.10 opened for further work.
5961
5969
5962 * Added sys.path to the list of directories searched in the
5970 * Added sys.path to the list of directories searched in the
5963 execfile= option. It used to be the current directory and the
5971 execfile= option. It used to be the current directory and the
5964 user's IPYTHONDIR only.
5972 user's IPYTHONDIR only.
5965
5973
5966 2001-11-13 Fernando Perez <fperez@colorado.edu>
5974 2001-11-13 Fernando Perez <fperez@colorado.edu>
5967
5975
5968 * Reinstated the raw_input/prefilter separation that Janko had
5976 * Reinstated the raw_input/prefilter separation that Janko had
5969 initially. This gives a more convenient setup for extending the
5977 initially. This gives a more convenient setup for extending the
5970 pre-processor from the outside: raw_input always gets a string,
5978 pre-processor from the outside: raw_input always gets a string,
5971 and prefilter has to process it. We can then redefine prefilter
5979 and prefilter has to process it. We can then redefine prefilter
5972 from the outside and implement extensions for special
5980 from the outside and implement extensions for special
5973 purposes.
5981 purposes.
5974
5982
5975 Today I got one for inputting PhysicalQuantity objects
5983 Today I got one for inputting PhysicalQuantity objects
5976 (from Scientific) without needing any function calls at
5984 (from Scientific) without needing any function calls at
5977 all. Extremely convenient, and it's all done as a user-level
5985 all. Extremely convenient, and it's all done as a user-level
5978 extension (no IPython code was touched). Now instead of:
5986 extension (no IPython code was touched). Now instead of:
5979 a = PhysicalQuantity(4.2,'m/s**2')
5987 a = PhysicalQuantity(4.2,'m/s**2')
5980 one can simply say
5988 one can simply say
5981 a = 4.2 m/s**2
5989 a = 4.2 m/s**2
5982 or even
5990 or even
5983 a = 4.2 m/s^2
5991 a = 4.2 m/s^2
5984
5992
5985 I use this, but it's also a proof of concept: IPython really is
5993 I use this, but it's also a proof of concept: IPython really is
5986 fully user-extensible, even at the level of the parsing of the
5994 fully user-extensible, even at the level of the parsing of the
5987 command line. It's not trivial, but it's perfectly doable.
5995 command line. It's not trivial, but it's perfectly doable.
5988
5996
5989 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5997 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5990 the problem of modules being loaded in the inverse order in which
5998 the problem of modules being loaded in the inverse order in which
5991 they were defined in
5999 they were defined in
5992
6000
5993 * Version 0.1.8 released, 0.1.9 opened for further work.
6001 * Version 0.1.8 released, 0.1.9 opened for further work.
5994
6002
5995 * Added magics pdef, source and file. They respectively show the
6003 * Added magics pdef, source and file. They respectively show the
5996 definition line ('prototype' in C), source code and full python
6004 definition line ('prototype' in C), source code and full python
5997 file for any callable object. The object inspector oinfo uses
6005 file for any callable object. The object inspector oinfo uses
5998 these to show the same information.
6006 these to show the same information.
5999
6007
6000 * Version 0.1.7 released, 0.1.8 opened for further work.
6008 * Version 0.1.7 released, 0.1.8 opened for further work.
6001
6009
6002 * Separated all the magic functions into a class called Magic. The
6010 * Separated all the magic functions into a class called Magic. The
6003 InteractiveShell class was becoming too big for Xemacs to handle
6011 InteractiveShell class was becoming too big for Xemacs to handle
6004 (de-indenting a line would lock it up for 10 seconds while it
6012 (de-indenting a line would lock it up for 10 seconds while it
6005 backtracked on the whole class!)
6013 backtracked on the whole class!)
6006
6014
6007 FIXME: didn't work. It can be done, but right now namespaces are
6015 FIXME: didn't work. It can be done, but right now namespaces are
6008 all messed up. Do it later (reverted it for now, so at least
6016 all messed up. Do it later (reverted it for now, so at least
6009 everything works as before).
6017 everything works as before).
6010
6018
6011 * Got the object introspection system (magic_oinfo) working! I
6019 * Got the object introspection system (magic_oinfo) working! I
6012 think this is pretty much ready for release to Janko, so he can
6020 think this is pretty much ready for release to Janko, so he can
6013 test it for a while and then announce it. Pretty much 100% of what
6021 test it for a while and then announce it. Pretty much 100% of what
6014 I wanted for the 'phase 1' release is ready. Happy, tired.
6022 I wanted for the 'phase 1' release is ready. Happy, tired.
6015
6023
6016 2001-11-12 Fernando Perez <fperez@colorado.edu>
6024 2001-11-12 Fernando Perez <fperez@colorado.edu>
6017
6025
6018 * Version 0.1.6 released, 0.1.7 opened for further work.
6026 * Version 0.1.6 released, 0.1.7 opened for further work.
6019
6027
6020 * Fixed bug in printing: it used to test for truth before
6028 * Fixed bug in printing: it used to test for truth before
6021 printing, so 0 wouldn't print. Now checks for None.
6029 printing, so 0 wouldn't print. Now checks for None.
6022
6030
6023 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6031 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6024 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6032 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6025 reaches by hand into the outputcache. Think of a better way to do
6033 reaches by hand into the outputcache. Think of a better way to do
6026 this later.
6034 this later.
6027
6035
6028 * Various small fixes thanks to Nathan's comments.
6036 * Various small fixes thanks to Nathan's comments.
6029
6037
6030 * Changed magic_pprint to magic_Pprint. This way it doesn't
6038 * Changed magic_pprint to magic_Pprint. This way it doesn't
6031 collide with pprint() and the name is consistent with the command
6039 collide with pprint() and the name is consistent with the command
6032 line option.
6040 line option.
6033
6041
6034 * Changed prompt counter behavior to be fully like
6042 * Changed prompt counter behavior to be fully like
6035 Mathematica's. That is, even input that doesn't return a result
6043 Mathematica's. That is, even input that doesn't return a result
6036 raises the prompt counter. The old behavior was kind of confusing
6044 raises the prompt counter. The old behavior was kind of confusing
6037 (getting the same prompt number several times if the operation
6045 (getting the same prompt number several times if the operation
6038 didn't return a result).
6046 didn't return a result).
6039
6047
6040 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6048 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6041
6049
6042 * Fixed -Classic mode (wasn't working anymore).
6050 * Fixed -Classic mode (wasn't working anymore).
6043
6051
6044 * Added colored prompts using Nathan's new code. Colors are
6052 * Added colored prompts using Nathan's new code. Colors are
6045 currently hardwired, they can be user-configurable. For
6053 currently hardwired, they can be user-configurable. For
6046 developers, they can be chosen in file ipythonlib.py, at the
6054 developers, they can be chosen in file ipythonlib.py, at the
6047 beginning of the CachedOutput class def.
6055 beginning of the CachedOutput class def.
6048
6056
6049 2001-11-11 Fernando Perez <fperez@colorado.edu>
6057 2001-11-11 Fernando Perez <fperez@colorado.edu>
6050
6058
6051 * Version 0.1.5 released, 0.1.6 opened for further work.
6059 * Version 0.1.5 released, 0.1.6 opened for further work.
6052
6060
6053 * Changed magic_env to *return* the environment as a dict (not to
6061 * Changed magic_env to *return* the environment as a dict (not to
6054 print it). This way it prints, but it can also be processed.
6062 print it). This way it prints, but it can also be processed.
6055
6063
6056 * Added Verbose exception reporting to interactive
6064 * Added Verbose exception reporting to interactive
6057 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6065 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6058 traceback. Had to make some changes to the ultraTB file. This is
6066 traceback. Had to make some changes to the ultraTB file. This is
6059 probably the last 'big' thing in my mental todo list. This ties
6067 probably the last 'big' thing in my mental todo list. This ties
6060 in with the next entry:
6068 in with the next entry:
6061
6069
6062 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6070 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6063 has to specify is Plain, Color or Verbose for all exception
6071 has to specify is Plain, Color or Verbose for all exception
6064 handling.
6072 handling.
6065
6073
6066 * Removed ShellServices option. All this can really be done via
6074 * Removed ShellServices option. All this can really be done via
6067 the magic system. It's easier to extend, cleaner and has automatic
6075 the magic system. It's easier to extend, cleaner and has automatic
6068 namespace protection and documentation.
6076 namespace protection and documentation.
6069
6077
6070 2001-11-09 Fernando Perez <fperez@colorado.edu>
6078 2001-11-09 Fernando Perez <fperez@colorado.edu>
6071
6079
6072 * Fixed bug in output cache flushing (missing parameter to
6080 * Fixed bug in output cache flushing (missing parameter to
6073 __init__). Other small bugs fixed (found using pychecker).
6081 __init__). Other small bugs fixed (found using pychecker).
6074
6082
6075 * Version 0.1.4 opened for bugfixing.
6083 * Version 0.1.4 opened for bugfixing.
6076
6084
6077 2001-11-07 Fernando Perez <fperez@colorado.edu>
6085 2001-11-07 Fernando Perez <fperez@colorado.edu>
6078
6086
6079 * Version 0.1.3 released, mainly because of the raw_input bug.
6087 * Version 0.1.3 released, mainly because of the raw_input bug.
6080
6088
6081 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6089 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6082 and when testing for whether things were callable, a call could
6090 and when testing for whether things were callable, a call could
6083 actually be made to certain functions. They would get called again
6091 actually be made to certain functions. They would get called again
6084 once 'really' executed, with a resulting double call. A disaster
6092 once 'really' executed, with a resulting double call. A disaster
6085 in many cases (list.reverse() would never work!).
6093 in many cases (list.reverse() would never work!).
6086
6094
6087 * Removed prefilter() function, moved its code to raw_input (which
6095 * Removed prefilter() function, moved its code to raw_input (which
6088 after all was just a near-empty caller for prefilter). This saves
6096 after all was just a near-empty caller for prefilter). This saves
6089 a function call on every prompt, and simplifies the class a tiny bit.
6097 a function call on every prompt, and simplifies the class a tiny bit.
6090
6098
6091 * Fix _ip to __ip name in magic example file.
6099 * Fix _ip to __ip name in magic example file.
6092
6100
6093 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6101 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6094 work with non-gnu versions of tar.
6102 work with non-gnu versions of tar.
6095
6103
6096 2001-11-06 Fernando Perez <fperez@colorado.edu>
6104 2001-11-06 Fernando Perez <fperez@colorado.edu>
6097
6105
6098 * Version 0.1.2. Just to keep track of the recent changes.
6106 * Version 0.1.2. Just to keep track of the recent changes.
6099
6107
6100 * Fixed nasty bug in output prompt routine. It used to check 'if
6108 * Fixed nasty bug in output prompt routine. It used to check 'if
6101 arg != None...'. Problem is, this fails if arg implements a
6109 arg != None...'. Problem is, this fails if arg implements a
6102 special comparison (__cmp__) which disallows comparing to
6110 special comparison (__cmp__) which disallows comparing to
6103 None. Found it when trying to use the PhysicalQuantity module from
6111 None. Found it when trying to use the PhysicalQuantity module from
6104 ScientificPython.
6112 ScientificPython.
6105
6113
6106 2001-11-05 Fernando Perez <fperez@colorado.edu>
6114 2001-11-05 Fernando Perez <fperez@colorado.edu>
6107
6115
6108 * Also added dirs. Now the pushd/popd/dirs family functions
6116 * Also added dirs. Now the pushd/popd/dirs family functions
6109 basically like the shell, with the added convenience of going home
6117 basically like the shell, with the added convenience of going home
6110 when called with no args.
6118 when called with no args.
6111
6119
6112 * pushd/popd slightly modified to mimic shell behavior more
6120 * pushd/popd slightly modified to mimic shell behavior more
6113 closely.
6121 closely.
6114
6122
6115 * Added env,pushd,popd from ShellServices as magic functions. I
6123 * Added env,pushd,popd from ShellServices as magic functions. I
6116 think the cleanest will be to port all desired functions from
6124 think the cleanest will be to port all desired functions from
6117 ShellServices as magics and remove ShellServices altogether. This
6125 ShellServices as magics and remove ShellServices altogether. This
6118 will provide a single, clean way of adding functionality
6126 will provide a single, clean way of adding functionality
6119 (shell-type or otherwise) to IP.
6127 (shell-type or otherwise) to IP.
6120
6128
6121 2001-11-04 Fernando Perez <fperez@colorado.edu>
6129 2001-11-04 Fernando Perez <fperez@colorado.edu>
6122
6130
6123 * Added .ipython/ directory to sys.path. This way users can keep
6131 * Added .ipython/ directory to sys.path. This way users can keep
6124 customizations there and access them via import.
6132 customizations there and access them via import.
6125
6133
6126 2001-11-03 Fernando Perez <fperez@colorado.edu>
6134 2001-11-03 Fernando Perez <fperez@colorado.edu>
6127
6135
6128 * Opened version 0.1.1 for new changes.
6136 * Opened version 0.1.1 for new changes.
6129
6137
6130 * Changed version number to 0.1.0: first 'public' release, sent to
6138 * Changed version number to 0.1.0: first 'public' release, sent to
6131 Nathan and Janko.
6139 Nathan and Janko.
6132
6140
6133 * Lots of small fixes and tweaks.
6141 * Lots of small fixes and tweaks.
6134
6142
6135 * Minor changes to whos format. Now strings are shown, snipped if
6143 * Minor changes to whos format. Now strings are shown, snipped if
6136 too long.
6144 too long.
6137
6145
6138 * Changed ShellServices to work on __main__ so they show up in @who
6146 * Changed ShellServices to work on __main__ so they show up in @who
6139
6147
6140 * Help also works with ? at the end of a line:
6148 * Help also works with ? at the end of a line:
6141 ?sin and sin?
6149 ?sin and sin?
6142 both produce the same effect. This is nice, as often I use the
6150 both produce the same effect. This is nice, as often I use the
6143 tab-complete to find the name of a method, but I used to then have
6151 tab-complete to find the name of a method, but I used to then have
6144 to go to the beginning of the line to put a ? if I wanted more
6152 to go to the beginning of the line to put a ? if I wanted more
6145 info. Now I can just add the ? and hit return. Convenient.
6153 info. Now I can just add the ? and hit return. Convenient.
6146
6154
6147 2001-11-02 Fernando Perez <fperez@colorado.edu>
6155 2001-11-02 Fernando Perez <fperez@colorado.edu>
6148
6156
6149 * Python version check (>=2.1) added.
6157 * Python version check (>=2.1) added.
6150
6158
6151 * Added LazyPython documentation. At this point the docs are quite
6159 * Added LazyPython documentation. At this point the docs are quite
6152 a mess. A cleanup is in order.
6160 a mess. A cleanup is in order.
6153
6161
6154 * Auto-installer created. For some bizarre reason, the zipfiles
6162 * Auto-installer created. For some bizarre reason, the zipfiles
6155 module isn't working on my system. So I made a tar version
6163 module isn't working on my system. So I made a tar version
6156 (hopefully the command line options in various systems won't kill
6164 (hopefully the command line options in various systems won't kill
6157 me).
6165 me).
6158
6166
6159 * Fixes to Struct in genutils. Now all dictionary-like methods are
6167 * Fixes to Struct in genutils. Now all dictionary-like methods are
6160 protected (reasonably).
6168 protected (reasonably).
6161
6169
6162 * Added pager function to genutils and changed ? to print usage
6170 * Added pager function to genutils and changed ? to print usage
6163 note through it (it was too long).
6171 note through it (it was too long).
6164
6172
6165 * Added the LazyPython functionality. Works great! I changed the
6173 * Added the LazyPython functionality. Works great! I changed the
6166 auto-quote escape to ';', it's on home row and next to '. But
6174 auto-quote escape to ';', it's on home row and next to '. But
6167 both auto-quote and auto-paren (still /) escapes are command-line
6175 both auto-quote and auto-paren (still /) escapes are command-line
6168 parameters.
6176 parameters.
6169
6177
6170
6178
6171 2001-11-01 Fernando Perez <fperez@colorado.edu>
6179 2001-11-01 Fernando Perez <fperez@colorado.edu>
6172
6180
6173 * Version changed to 0.0.7. Fairly large change: configuration now
6181 * Version changed to 0.0.7. Fairly large change: configuration now
6174 is all stored in a directory, by default .ipython. There, all
6182 is all stored in a directory, by default .ipython. There, all
6175 config files have normal looking names (not .names)
6183 config files have normal looking names (not .names)
6176
6184
6177 * Version 0.0.6 Released first to Lucas and Archie as a test
6185 * Version 0.0.6 Released first to Lucas and Archie as a test
6178 run. Since it's the first 'semi-public' release, change version to
6186 run. Since it's the first 'semi-public' release, change version to
6179 > 0.0.6 for any changes now.
6187 > 0.0.6 for any changes now.
6180
6188
6181 * Stuff I had put in the ipplib.py changelog:
6189 * Stuff I had put in the ipplib.py changelog:
6182
6190
6183 Changes to InteractiveShell:
6191 Changes to InteractiveShell:
6184
6192
6185 - Made the usage message a parameter.
6193 - Made the usage message a parameter.
6186
6194
6187 - Require the name of the shell variable to be given. It's a bit
6195 - Require the name of the shell variable to be given. It's a bit
6188 of a hack, but allows the name 'shell' not to be hardwired in the
6196 of a hack, but allows the name 'shell' not to be hardwired in the
6189 magic (@) handler, which is problematic b/c it requires
6197 magic (@) handler, which is problematic b/c it requires
6190 polluting the global namespace with 'shell'. This in turn is
6198 polluting the global namespace with 'shell'. This in turn is
6191 fragile: if a user redefines a variable called shell, things
6199 fragile: if a user redefines a variable called shell, things
6192 break.
6200 break.
6193
6201
6194 - magic @: all functions available through @ need to be defined
6202 - magic @: all functions available through @ need to be defined
6195 as magic_<name>, even though they can be called simply as
6203 as magic_<name>, even though they can be called simply as
6196 @<name>. This allows the special command @magic to gather
6204 @<name>. This allows the special command @magic to gather
6197 information automatically about all existing magic functions,
6205 information automatically about all existing magic functions,
6198 even if they are run-time user extensions, by parsing the shell
6206 even if they are run-time user extensions, by parsing the shell
6199 instance __dict__ looking for special magic_ names.
6207 instance __dict__ looking for special magic_ names.
6200
6208
6201 - mainloop: added *two* local namespace parameters. This allows
6209 - mainloop: added *two* local namespace parameters. This allows
6202 the class to differentiate between parameters which were there
6210 the class to differentiate between parameters which were there
6203 before and after command line initialization was processed. This
6211 before and after command line initialization was processed. This
6204 way, later @who can show things loaded at startup by the
6212 way, later @who can show things loaded at startup by the
6205 user. This trick was necessary to make session saving/reloading
6213 user. This trick was necessary to make session saving/reloading
6206 really work: ideally after saving/exiting/reloading a session,
6214 really work: ideally after saving/exiting/reloading a session,
6207 *everything* should look the same, including the output of @who. I
6215 *everything* should look the same, including the output of @who. I
6208 was only able to make this work with this double namespace
6216 was only able to make this work with this double namespace
6209 trick.
6217 trick.
6210
6218
6211 - added a header to the logfile which allows (almost) full
6219 - added a header to the logfile which allows (almost) full
6212 session restoring.
6220 session restoring.
6213
6221
6214 - prepend lines beginning with @ or !, with a and log
6222 - prepend lines beginning with @ or !, with a and log
6215 them. Why? !lines: may be useful to know what you did @lines:
6223 them. Why? !lines: may be useful to know what you did @lines:
6216 they may affect session state. So when restoring a session, at
6224 they may affect session state. So when restoring a session, at
6217 least inform the user of their presence. I couldn't quite get
6225 least inform the user of their presence. I couldn't quite get
6218 them to properly re-execute, but at least the user is warned.
6226 them to properly re-execute, but at least the user is warned.
6219
6227
6220 * Started ChangeLog.
6228 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now