##// END OF EJS Templates
Finish doc/build tools cleanup....
Fernando Perez -
Show More
@@ -1,3311 +1,3319 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 2996 2008-01-30 06:31:39Z fperez $"""
4 $Id: Magic.py 2996 2008-01-30 06:31:39Z 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 from sets import Set
38 from sets import Set
39
39
40 # cProfile was added in Python2.5
40 # cProfile was added in Python2.5
41 try:
41 try:
42 import cProfile as profile
42 import cProfile as profile
43 import pstats
43 import pstats
44 except ImportError:
44 except ImportError:
45 # profile isn't bundled by default in Debian for license reasons
45 # profile isn't bundled by default in Debian for license reasons
46 try:
46 try:
47 import profile,pstats
47 import profile,pstats
48 except ImportError:
48 except ImportError:
49 profile = pstats = None
49 profile = pstats = None
50
50
51 # Homebrewed
51 # Homebrewed
52 import IPython
52 import IPython
53 from IPython import Debugger, OInspect, wildcard
53 from IPython import Debugger, OInspect, wildcard
54 from IPython.FakeModule import FakeModule
54 from IPython.FakeModule import FakeModule
55 from IPython.Itpl import Itpl, itpl, printpl,itplns
55 from IPython.Itpl import Itpl, itpl, printpl,itplns
56 from IPython.PyColorize import Parser
56 from IPython.PyColorize import Parser
57 from IPython.ipstruct import Struct
57 from IPython.ipstruct import Struct
58 from IPython.macro import Macro
58 from IPython.macro import Macro
59 from IPython.genutils import *
59 from IPython.genutils import *
60 from IPython import platutils
60 from IPython import platutils
61 import IPython.generics
61 import IPython.generics
62 import IPython.ipapi
62 import IPython.ipapi
63 from IPython.ipapi import UsageError
63 from IPython.ipapi import UsageError
64 #***************************************************************************
64 #***************************************************************************
65 # Utility functions
65 # Utility functions
66 def on_off(tag):
66 def on_off(tag):
67 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
67 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
68 return ['OFF','ON'][tag]
68 return ['OFF','ON'][tag]
69
69
70 class Bunch: pass
70 class Bunch: pass
71
71
72 def compress_dhist(dh):
72 def compress_dhist(dh):
73 head, tail = dh[:-10], dh[-10:]
73 head, tail = dh[:-10], dh[-10:]
74
74
75 newhead = []
75 newhead = []
76 done = Set()
76 done = Set()
77 for h in head:
77 for h in head:
78 if h in done:
78 if h in done:
79 continue
79 continue
80 newhead.append(h)
80 newhead.append(h)
81 done.add(h)
81 done.add(h)
82
82
83 return newhead + tail
83 return newhead + tail
84
84
85
85
86 #***************************************************************************
86 #***************************************************************************
87 # Main class implementing Magic functionality
87 # Main class implementing Magic functionality
88 class Magic:
88 class Magic:
89 """Magic functions for InteractiveShell.
89 """Magic functions for InteractiveShell.
90
90
91 Shell functions which can be reached as %function_name. All magic
91 Shell functions which can be reached as %function_name. All magic
92 functions should accept a string, which they can parse for their own
92 functions should accept a string, which they can parse for their own
93 needs. This can make some functions easier to type, eg `%cd ../`
93 needs. This can make some functions easier to type, eg `%cd ../`
94 vs. `%cd("../")`
94 vs. `%cd("../")`
95
95
96 ALL definitions MUST begin with the prefix magic_. The user won't need it
96 ALL definitions MUST begin with the prefix magic_. The user won't need it
97 at the command line, but it is is needed in the definition. """
97 at the command line, but it is is needed in the definition. """
98
98
99 # class globals
99 # class globals
100 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
100 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
101 'Automagic is ON, % prefix NOT needed for magic functions.']
101 'Automagic is ON, % prefix NOT needed for magic functions.']
102
102
103 #......................................................................
103 #......................................................................
104 # some utility functions
104 # some utility functions
105
105
106 def __init__(self,shell):
106 def __init__(self,shell):
107
107
108 self.options_table = {}
108 self.options_table = {}
109 if profile is None:
109 if profile is None:
110 self.magic_prun = self.profile_missing_notice
110 self.magic_prun = self.profile_missing_notice
111 self.shell = shell
111 self.shell = shell
112
112
113 # namespace for holding state we may need
113 # namespace for holding state we may need
114 self._magic_state = Bunch()
114 self._magic_state = Bunch()
115
115
116 def profile_missing_notice(self, *args, **kwargs):
116 def profile_missing_notice(self, *args, **kwargs):
117 error("""\
117 error("""\
118 The profile module could not be found. It has been removed from the standard
118 The profile module could not be found. It has been removed from the standard
119 python packages because of its non-free license. To use profiling, install the
119 python packages because of its non-free license. To use profiling, install the
120 python-profiler package from non-free.""")
120 python-profiler package from non-free.""")
121
121
122 def default_option(self,fn,optstr):
122 def default_option(self,fn,optstr):
123 """Make an entry in the options_table for fn, with value optstr"""
123 """Make an entry in the options_table for fn, with value optstr"""
124
124
125 if fn not in self.lsmagic():
125 if fn not in self.lsmagic():
126 error("%s is not a magic function" % fn)
126 error("%s is not a magic function" % fn)
127 self.options_table[fn] = optstr
127 self.options_table[fn] = optstr
128
128
129 def lsmagic(self):
129 def lsmagic(self):
130 """Return a list of currently available magic functions.
130 """Return a list of currently available magic functions.
131
131
132 Gives a list of the bare names after mangling (['ls','cd', ...], not
132 Gives a list of the bare names after mangling (['ls','cd', ...], not
133 ['magic_ls','magic_cd',...]"""
133 ['magic_ls','magic_cd',...]"""
134
134
135 # FIXME. This needs a cleanup, in the way the magics list is built.
135 # FIXME. This needs a cleanup, in the way the magics list is built.
136
136
137 # magics in class definition
137 # magics in class definition
138 class_magic = lambda fn: fn.startswith('magic_') and \
138 class_magic = lambda fn: fn.startswith('magic_') and \
139 callable(Magic.__dict__[fn])
139 callable(Magic.__dict__[fn])
140 # in instance namespace (run-time user additions)
140 # in instance namespace (run-time user additions)
141 inst_magic = lambda fn: fn.startswith('magic_') and \
141 inst_magic = lambda fn: fn.startswith('magic_') and \
142 callable(self.__dict__[fn])
142 callable(self.__dict__[fn])
143 # and bound magics by user (so they can access self):
143 # and bound magics by user (so they can access self):
144 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
144 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
145 callable(self.__class__.__dict__[fn])
145 callable(self.__class__.__dict__[fn])
146 magics = filter(class_magic,Magic.__dict__.keys()) + \
146 magics = filter(class_magic,Magic.__dict__.keys()) + \
147 filter(inst_magic,self.__dict__.keys()) + \
147 filter(inst_magic,self.__dict__.keys()) + \
148 filter(inst_bound_magic,self.__class__.__dict__.keys())
148 filter(inst_bound_magic,self.__class__.__dict__.keys())
149 out = []
149 out = []
150 for fn in Set(magics):
150 for fn in Set(magics):
151 out.append(fn.replace('magic_','',1))
151 out.append(fn.replace('magic_','',1))
152 out.sort()
152 out.sort()
153 return out
153 return out
154
154
155 def extract_input_slices(self,slices,raw=False):
155 def extract_input_slices(self,slices,raw=False):
156 """Return as a string a set of input history slices.
156 """Return as a string a set of input history slices.
157
157
158 Inputs:
158 Inputs:
159
159
160 - slices: the set of slices is given as a list of strings (like
160 - slices: the set of slices is given as a list of strings (like
161 ['1','4:8','9'], since this function is for use by magic functions
161 ['1','4:8','9'], since this function is for use by magic functions
162 which get their arguments as strings.
162 which get their arguments as strings.
163
163
164 Optional inputs:
164 Optional inputs:
165
165
166 - raw(False): by default, the processed input is used. If this is
166 - raw(False): by default, the processed input is used. If this is
167 true, the raw input history is used instead.
167 true, the raw input history is used instead.
168
168
169 Note that slices can be called with two notations:
169 Note that slices can be called with two notations:
170
170
171 N:M -> standard python form, means including items N...(M-1).
171 N:M -> standard python form, means including items N...(M-1).
172
172
173 N-M -> include items N..M (closed endpoint)."""
173 N-M -> include items N..M (closed endpoint)."""
174
174
175 if raw:
175 if raw:
176 hist = self.shell.input_hist_raw
176 hist = self.shell.input_hist_raw
177 else:
177 else:
178 hist = self.shell.input_hist
178 hist = self.shell.input_hist
179
179
180 cmds = []
180 cmds = []
181 for chunk in slices:
181 for chunk in slices:
182 if ':' in chunk:
182 if ':' in chunk:
183 ini,fin = map(int,chunk.split(':'))
183 ini,fin = map(int,chunk.split(':'))
184 elif '-' in chunk:
184 elif '-' in chunk:
185 ini,fin = map(int,chunk.split('-'))
185 ini,fin = map(int,chunk.split('-'))
186 fin += 1
186 fin += 1
187 else:
187 else:
188 ini = int(chunk)
188 ini = int(chunk)
189 fin = ini+1
189 fin = ini+1
190 cmds.append(hist[ini:fin])
190 cmds.append(hist[ini:fin])
191 return cmds
191 return cmds
192
192
193 def _ofind(self, oname, namespaces=None):
193 def _ofind(self, oname, namespaces=None):
194 """Find an object in the available namespaces.
194 """Find an object in the available namespaces.
195
195
196 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
196 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
197
197
198 Has special code to detect magic functions.
198 Has special code to detect magic functions.
199 """
199 """
200
200
201 oname = oname.strip()
201 oname = oname.strip()
202
202
203 alias_ns = None
203 alias_ns = None
204 if namespaces is None:
204 if namespaces is None:
205 # Namespaces to search in:
205 # Namespaces to search in:
206 # Put them in a list. The order is important so that we
206 # Put them in a list. The order is important so that we
207 # find things in the same order that Python finds them.
207 # find things in the same order that Python finds them.
208 namespaces = [ ('Interactive', self.shell.user_ns),
208 namespaces = [ ('Interactive', self.shell.user_ns),
209 ('IPython internal', self.shell.internal_ns),
209 ('IPython internal', self.shell.internal_ns),
210 ('Python builtin', __builtin__.__dict__),
210 ('Python builtin', __builtin__.__dict__),
211 ('Alias', self.shell.alias_table),
211 ('Alias', self.shell.alias_table),
212 ]
212 ]
213 alias_ns = self.shell.alias_table
213 alias_ns = self.shell.alias_table
214
214
215 # initialize results to 'null'
215 # initialize results to 'null'
216 found = 0; obj = None; ospace = None; ds = None;
216 found = 0; obj = None; ospace = None; ds = None;
217 ismagic = 0; isalias = 0; parent = None
217 ismagic = 0; isalias = 0; parent = None
218
218
219 # Look for the given name by splitting it in parts. If the head is
219 # Look for the given name by splitting it in parts. If the head is
220 # found, then we look for all the remaining parts as members, and only
220 # found, then we look for all the remaining parts as members, and only
221 # declare success if we can find them all.
221 # declare success if we can find them all.
222 oname_parts = oname.split('.')
222 oname_parts = oname.split('.')
223 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
223 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
224 for nsname,ns in namespaces:
224 for nsname,ns in namespaces:
225 try:
225 try:
226 obj = ns[oname_head]
226 obj = ns[oname_head]
227 except KeyError:
227 except KeyError:
228 continue
228 continue
229 else:
229 else:
230 #print 'oname_rest:', oname_rest # dbg
230 #print 'oname_rest:', oname_rest # dbg
231 for part in oname_rest:
231 for part in oname_rest:
232 try:
232 try:
233 parent = obj
233 parent = obj
234 obj = getattr(obj,part)
234 obj = getattr(obj,part)
235 except:
235 except:
236 # Blanket except b/c some badly implemented objects
236 # Blanket except b/c some badly implemented objects
237 # allow __getattr__ to raise exceptions other than
237 # allow __getattr__ to raise exceptions other than
238 # AttributeError, which then crashes IPython.
238 # AttributeError, which then crashes IPython.
239 break
239 break
240 else:
240 else:
241 # If we finish the for loop (no break), we got all members
241 # If we finish the for loop (no break), we got all members
242 found = 1
242 found = 1
243 ospace = nsname
243 ospace = nsname
244 if ns == alias_ns:
244 if ns == alias_ns:
245 isalias = 1
245 isalias = 1
246 break # namespace loop
246 break # namespace loop
247
247
248 # Try to see if it's magic
248 # Try to see if it's magic
249 if not found:
249 if not found:
250 if oname.startswith(self.shell.ESC_MAGIC):
250 if oname.startswith(self.shell.ESC_MAGIC):
251 oname = oname[1:]
251 oname = oname[1:]
252 obj = getattr(self,'magic_'+oname,None)
252 obj = getattr(self,'magic_'+oname,None)
253 if obj is not None:
253 if obj is not None:
254 found = 1
254 found = 1
255 ospace = 'IPython internal'
255 ospace = 'IPython internal'
256 ismagic = 1
256 ismagic = 1
257
257
258 # Last try: special-case some literals like '', [], {}, etc:
258 # Last try: special-case some literals like '', [], {}, etc:
259 if not found and oname_head in ["''",'""','[]','{}','()']:
259 if not found and oname_head in ["''",'""','[]','{}','()']:
260 obj = eval(oname_head)
260 obj = eval(oname_head)
261 found = 1
261 found = 1
262 ospace = 'Interactive'
262 ospace = 'Interactive'
263
263
264 return {'found':found, 'obj':obj, 'namespace':ospace,
264 return {'found':found, 'obj':obj, 'namespace':ospace,
265 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
265 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
266
266
267 def arg_err(self,func):
267 def arg_err(self,func):
268 """Print docstring if incorrect arguments were passed"""
268 """Print docstring if incorrect arguments were passed"""
269 print 'Error in arguments:'
269 print 'Error in arguments:'
270 print OInspect.getdoc(func)
270 print OInspect.getdoc(func)
271
271
272 def format_latex(self,strng):
272 def format_latex(self,strng):
273 """Format a string for latex inclusion."""
273 """Format a string for latex inclusion."""
274
274
275 # Characters that need to be escaped for latex:
275 # Characters that need to be escaped for latex:
276 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
276 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
277 # Magic command names as headers:
277 # Magic command names as headers:
278 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
278 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
279 re.MULTILINE)
279 re.MULTILINE)
280 # Magic commands
280 # Magic commands
281 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
281 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
282 re.MULTILINE)
282 re.MULTILINE)
283 # Paragraph continue
283 # Paragraph continue
284 par_re = re.compile(r'\\$',re.MULTILINE)
284 par_re = re.compile(r'\\$',re.MULTILINE)
285
285
286 # The "\n" symbol
286 # The "\n" symbol
287 newline_re = re.compile(r'\\n')
287 newline_re = re.compile(r'\\n')
288
288
289 # Now build the string for output:
289 # Now build the string for output:
290 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
290 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
291 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
291 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
292 strng)
292 strng)
293 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
293 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
294 strng = par_re.sub(r'\\\\',strng)
294 strng = par_re.sub(r'\\\\',strng)
295 strng = escape_re.sub(r'\\\1',strng)
295 strng = escape_re.sub(r'\\\1',strng)
296 strng = newline_re.sub(r'\\textbackslash{}n',strng)
296 strng = newline_re.sub(r'\\textbackslash{}n',strng)
297 return strng
297 return strng
298
298
299 def format_screen(self,strng):
299 def format_screen(self,strng):
300 """Format a string for screen printing.
300 """Format a string for screen printing.
301
301
302 This removes some latex-type format codes."""
302 This removes some latex-type format codes."""
303 # Paragraph continue
303 # Paragraph continue
304 par_re = re.compile(r'\\$',re.MULTILINE)
304 par_re = re.compile(r'\\$',re.MULTILINE)
305 strng = par_re.sub('',strng)
305 strng = par_re.sub('',strng)
306 return strng
306 return strng
307
307
308 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
308 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
309 """Parse options passed to an argument string.
309 """Parse options passed to an argument string.
310
310
311 The interface is similar to that of getopt(), but it returns back a
311 The interface is similar to that of getopt(), but it returns back a
312 Struct with the options as keys and the stripped argument string still
312 Struct with the options as keys and the stripped argument string still
313 as a string.
313 as a string.
314
314
315 arg_str is quoted as a true sys.argv vector by using shlex.split.
315 arg_str is quoted as a true sys.argv vector by using shlex.split.
316 This allows us to easily expand variables, glob files, quote
316 This allows us to easily expand variables, glob files, quote
317 arguments, etc.
317 arguments, etc.
318
318
319 Options:
319 Options:
320 -mode: default 'string'. If given as 'list', the argument string is
320 -mode: default 'string'. If given as 'list', the argument string is
321 returned as a list (split on whitespace) instead of a string.
321 returned as a list (split on whitespace) instead of a string.
322
322
323 -list_all: put all option values in lists. Normally only options
323 -list_all: put all option values in lists. Normally only options
324 appearing more than once are put in a list.
324 appearing more than once are put in a list.
325
325
326 -posix (True): whether to split the input line in POSIX mode or not,
326 -posix (True): whether to split the input line in POSIX mode or not,
327 as per the conventions outlined in the shlex module from the
327 as per the conventions outlined in the shlex module from the
328 standard library."""
328 standard library."""
329
329
330 # inject default options at the beginning of the input line
330 # inject default options at the beginning of the input line
331 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
331 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
332 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
332 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
333
333
334 mode = kw.get('mode','string')
334 mode = kw.get('mode','string')
335 if mode not in ['string','list']:
335 if mode not in ['string','list']:
336 raise ValueError,'incorrect mode given: %s' % mode
336 raise ValueError,'incorrect mode given: %s' % mode
337 # Get options
337 # Get options
338 list_all = kw.get('list_all',0)
338 list_all = kw.get('list_all',0)
339 posix = kw.get('posix',True)
339 posix = kw.get('posix',True)
340
340
341 # Check if we have more than one argument to warrant extra processing:
341 # Check if we have more than one argument to warrant extra processing:
342 odict = {} # Dictionary with options
342 odict = {} # Dictionary with options
343 args = arg_str.split()
343 args = arg_str.split()
344 if len(args) >= 1:
344 if len(args) >= 1:
345 # If the list of inputs only has 0 or 1 thing in it, there's no
345 # If the list of inputs only has 0 or 1 thing in it, there's no
346 # need to look for options
346 # need to look for options
347 argv = arg_split(arg_str,posix)
347 argv = arg_split(arg_str,posix)
348 # Do regular option processing
348 # Do regular option processing
349 try:
349 try:
350 opts,args = getopt(argv,opt_str,*long_opts)
350 opts,args = getopt(argv,opt_str,*long_opts)
351 except GetoptError,e:
351 except GetoptError,e:
352 raise UsageError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
352 raise UsageError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
353 " ".join(long_opts)))
353 " ".join(long_opts)))
354 for o,a in opts:
354 for o,a in opts:
355 if o.startswith('--'):
355 if o.startswith('--'):
356 o = o[2:]
356 o = o[2:]
357 else:
357 else:
358 o = o[1:]
358 o = o[1:]
359 try:
359 try:
360 odict[o].append(a)
360 odict[o].append(a)
361 except AttributeError:
361 except AttributeError:
362 odict[o] = [odict[o],a]
362 odict[o] = [odict[o],a]
363 except KeyError:
363 except KeyError:
364 if list_all:
364 if list_all:
365 odict[o] = [a]
365 odict[o] = [a]
366 else:
366 else:
367 odict[o] = a
367 odict[o] = a
368
368
369 # Prepare opts,args for return
369 # Prepare opts,args for return
370 opts = Struct(odict)
370 opts = Struct(odict)
371 if mode == 'string':
371 if mode == 'string':
372 args = ' '.join(args)
372 args = ' '.join(args)
373
373
374 return opts,args
374 return opts,args
375
375
376 #......................................................................
376 #......................................................................
377 # And now the actual magic functions
377 # And now the actual magic functions
378
378
379 # Functions for IPython shell work (vars,funcs, config, etc)
379 # Functions for IPython shell work (vars,funcs, config, etc)
380 def magic_lsmagic(self, parameter_s = ''):
380 def magic_lsmagic(self, parameter_s = ''):
381 """List currently available magic functions."""
381 """List currently available magic functions."""
382 mesc = self.shell.ESC_MAGIC
382 mesc = self.shell.ESC_MAGIC
383 print 'Available magic functions:\n'+mesc+\
383 print 'Available magic functions:\n'+mesc+\
384 (' '+mesc).join(self.lsmagic())
384 (' '+mesc).join(self.lsmagic())
385 print '\n' + Magic.auto_status[self.shell.rc.automagic]
385 print '\n' + Magic.auto_status[self.shell.rc.automagic]
386 return None
386 return None
387
387
388 def magic_magic(self, parameter_s = ''):
388 def magic_magic(self, parameter_s = ''):
389 """Print information about the magic function system.
389 """Print information about the magic function system.
390
390
391 Supported formats: -latex, -brief, -rest
391 Supported formats: -latex, -brief, -rest
392 """
392 """
393
393
394 mode = ''
394 mode = ''
395 try:
395 try:
396 if parameter_s.split()[0] == '-latex':
396 if parameter_s.split()[0] == '-latex':
397 mode = 'latex'
397 mode = 'latex'
398 if parameter_s.split()[0] == '-brief':
398 if parameter_s.split()[0] == '-brief':
399 mode = 'brief'
399 mode = 'brief'
400 if parameter_s.split()[0] == '-rest':
400 if parameter_s.split()[0] == '-rest':
401 mode = 'rest'
401 mode = 'rest'
402 rest_docs = []
402 rest_docs = []
403 except:
403 except:
404 pass
404 pass
405
405
406 magic_docs = []
406 magic_docs = []
407 for fname in self.lsmagic():
407 for fname in self.lsmagic():
408 mname = 'magic_' + fname
408 mname = 'magic_' + fname
409 for space in (Magic,self,self.__class__):
409 for space in (Magic,self,self.__class__):
410 try:
410 try:
411 fn = space.__dict__[mname]
411 fn = space.__dict__[mname]
412 except KeyError:
412 except KeyError:
413 pass
413 pass
414 else:
414 else:
415 break
415 break
416 if mode == 'brief':
416 if mode == 'brief':
417 # only first line
417 # only first line
418 if fn.__doc__:
418 if fn.__doc__:
419 fndoc = fn.__doc__.split('\n',1)[0]
419 fndoc = fn.__doc__.split('\n',1)[0]
420 else:
420 else:
421 fndoc = 'No documentation'
421 fndoc = 'No documentation'
422 else:
422 else:
423 fndoc = fn.__doc__.rstrip()
423 fndoc = fn.__doc__.rstrip()
424
424
425 if mode == 'rest':
425 if mode == 'rest':
426 rest_docs.append('**%s%s**::\n\n\t%s\n\n' %(self.shell.ESC_MAGIC,
426 rest_docs.append('**%s%s**::\n\n\t%s\n\n' %(self.shell.ESC_MAGIC,
427 fname,fndoc))
427 fname,fndoc))
428
428
429 else:
429 else:
430 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
430 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
431 fname,fndoc))
431 fname,fndoc))
432
432
433 magic_docs = ''.join(magic_docs)
433 magic_docs = ''.join(magic_docs)
434
434
435 if mode == 'rest':
435 if mode == 'rest':
436 return "".join(rest_docs)
436 return "".join(rest_docs)
437
437
438 if mode == 'latex':
438 if mode == 'latex':
439 print self.format_latex(magic_docs)
439 print self.format_latex(magic_docs)
440 return
440 return
441 else:
441 else:
442 magic_docs = self.format_screen(magic_docs)
442 magic_docs = self.format_screen(magic_docs)
443 if mode == 'brief':
443 if mode == 'brief':
444 return magic_docs
444 return magic_docs
445
445
446 outmsg = """
446 outmsg = """
447 IPython's 'magic' functions
447 IPython's 'magic' functions
448 ===========================
448 ===========================
449
449
450 The magic function system provides a series of functions which allow you to
450 The magic function system provides a series of functions which allow you to
451 control the behavior of IPython itself, plus a lot of system-type
451 control the behavior of IPython itself, plus a lot of system-type
452 features. All these functions are prefixed with a % character, but parameters
452 features. All these functions are prefixed with a % character, but parameters
453 are given without parentheses or quotes.
453 are given without parentheses or quotes.
454
454
455 NOTE: If you have 'automagic' enabled (via the command line option or with the
455 NOTE: If you have 'automagic' enabled (via the command line option or with the
456 %automagic function), you don't need to type in the % explicitly. By default,
456 %automagic function), you don't need to type in the % explicitly. By default,
457 IPython ships with automagic on, so you should only rarely need the % escape.
457 IPython ships with automagic on, so you should only rarely need the % escape.
458
458
459 Example: typing '%cd mydir' (without the quotes) changes you working directory
459 Example: typing '%cd mydir' (without the quotes) changes you working directory
460 to 'mydir', if it exists.
460 to 'mydir', if it exists.
461
461
462 You can define your own magic functions to extend the system. See the supplied
462 You can define your own magic functions to extend the system. See the supplied
463 ipythonrc and example-magic.py files for details (in your ipython
463 ipythonrc and example-magic.py files for details (in your ipython
464 configuration directory, typically $HOME/.ipython/).
464 configuration directory, typically $HOME/.ipython/).
465
465
466 You can also define your own aliased names for magic functions. In your
466 You can also define your own aliased names for magic functions. In your
467 ipythonrc file, placing a line like:
467 ipythonrc file, placing a line like:
468
468
469 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
469 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
470
470
471 will define %pf as a new name for %profile.
471 will define %pf as a new name for %profile.
472
472
473 You can also call magics in code using the ipmagic() function, which IPython
473 You can also call magics in code using the ipmagic() function, which IPython
474 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
474 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
475
475
476 For a list of the available magic functions, use %lsmagic. For a description
476 For a list of the available magic functions, use %lsmagic. For a description
477 of any of them, type %magic_name?, e.g. '%cd?'.
477 of any of them, type %magic_name?, e.g. '%cd?'.
478
478
479 Currently the magic system has the following functions:\n"""
479 Currently the magic system has the following functions:\n"""
480
480
481 mesc = self.shell.ESC_MAGIC
481 mesc = self.shell.ESC_MAGIC
482 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
482 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
483 "\n\n%s%s\n\n%s" % (outmsg,
483 "\n\n%s%s\n\n%s" % (outmsg,
484 magic_docs,mesc,mesc,
484 magic_docs,mesc,mesc,
485 (' '+mesc).join(self.lsmagic()),
485 (' '+mesc).join(self.lsmagic()),
486 Magic.auto_status[self.shell.rc.automagic] ) )
486 Magic.auto_status[self.shell.rc.automagic] ) )
487
487
488 page(outmsg,screen_lines=self.shell.rc.screen_length)
488 page(outmsg,screen_lines=self.shell.rc.screen_length)
489
489
490
490
491 def magic_autoindent(self, parameter_s = ''):
491 def magic_autoindent(self, parameter_s = ''):
492 """Toggle autoindent on/off (if available)."""
492 """Toggle autoindent on/off (if available)."""
493
493
494 self.shell.set_autoindent()
494 self.shell.set_autoindent()
495 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
495 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
496
496
497
497
498 def magic_automagic(self, parameter_s = ''):
498 def magic_automagic(self, parameter_s = ''):
499 """Make magic functions callable without having to type the initial %.
499 """Make magic functions callable without having to type the initial %.
500
500
501 Without argumentsl toggles on/off (when off, you must call it as
501 Without argumentsl toggles on/off (when off, you must call it as
502 %automagic, of course). With arguments it sets the value, and you can
502 %automagic, of course). With arguments it sets the value, and you can
503 use any of (case insensitive):
503 use any of (case insensitive):
504
504
505 - on,1,True: to activate
505 - on,1,True: to activate
506
506
507 - off,0,False: to deactivate.
507 - off,0,False: to deactivate.
508
508
509 Note that magic functions have lowest priority, so if there's a
509 Note that magic functions have lowest priority, so if there's a
510 variable whose name collides with that of a magic fn, automagic won't
510 variable whose name collides with that of a magic fn, automagic won't
511 work for that function (you get the variable instead). However, if you
511 work for that function (you get the variable instead). However, if you
512 delete the variable (del var), the previously shadowed magic function
512 delete the variable (del var), the previously shadowed magic function
513 becomes visible to automagic again."""
513 becomes visible to automagic again."""
514
514
515 rc = self.shell.rc
515 rc = self.shell.rc
516 arg = parameter_s.lower()
516 arg = parameter_s.lower()
517 if parameter_s in ('on','1','true'):
517 if parameter_s in ('on','1','true'):
518 rc.automagic = True
518 rc.automagic = True
519 elif parameter_s in ('off','0','false'):
519 elif parameter_s in ('off','0','false'):
520 rc.automagic = False
520 rc.automagic = False
521 else:
521 else:
522 rc.automagic = not rc.automagic
522 rc.automagic = not rc.automagic
523 print '\n' + Magic.auto_status[rc.automagic]
523 print '\n' + Magic.auto_status[rc.automagic]
524
524
525
525
526 def magic_autocall(self, parameter_s = ''):
526 def magic_autocall(self, parameter_s = ''):
527 """Make functions callable without having to type parentheses.
527 """Make functions callable without having to type parentheses.
528
528
529 Usage:
529 Usage:
530
530
531 %autocall [mode]
531 %autocall [mode]
532
532
533 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
533 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
534 value is toggled on and off (remembering the previous state).
534 value is toggled on and off (remembering the previous state).
535
535
536 In more detail, these values mean:
536 In more detail, these values mean:
537
537
538 0 -> fully disabled
538 0 -> fully disabled
539
539
540 1 -> active, but do not apply if there are no arguments on the line.
540 1 -> active, but do not apply if there are no arguments on the line.
541
541
542 In this mode, you get:
542 In this mode, you get:
543
543
544 In [1]: callable
544 In [1]: callable
545 Out[1]: <built-in function callable>
545 Out[1]: <built-in function callable>
546
546
547 In [2]: callable 'hello'
547 In [2]: callable 'hello'
548 ------> callable('hello')
548 ------> callable('hello')
549 Out[2]: False
549 Out[2]: False
550
550
551 2 -> Active always. Even if no arguments are present, the callable
551 2 -> Active always. Even if no arguments are present, the callable
552 object is called:
552 object is called:
553
553
554 In [4]: callable
554 In [4]: callable
555 ------> callable()
555 ------> callable()
556
556
557 Note that even with autocall off, you can still use '/' at the start of
557 Note that even with autocall off, you can still use '/' at the start of
558 a line to treat the first argument on the command line as a function
558 a line to treat the first argument on the command line as a function
559 and add parentheses to it:
559 and add parentheses to it:
560
560
561 In [8]: /str 43
561 In [8]: /str 43
562 ------> str(43)
562 ------> str(43)
563 Out[8]: '43'
563 Out[8]: '43'
564 """
564 """
565
565
566 rc = self.shell.rc
566 rc = self.shell.rc
567
567
568 if parameter_s:
568 if parameter_s:
569 arg = int(parameter_s)
569 arg = int(parameter_s)
570 else:
570 else:
571 arg = 'toggle'
571 arg = 'toggle'
572
572
573 if not arg in (0,1,2,'toggle'):
573 if not arg in (0,1,2,'toggle'):
574 error('Valid modes: (0->Off, 1->Smart, 2->Full')
574 error('Valid modes: (0->Off, 1->Smart, 2->Full')
575 return
575 return
576
576
577 if arg in (0,1,2):
577 if arg in (0,1,2):
578 rc.autocall = arg
578 rc.autocall = arg
579 else: # toggle
579 else: # toggle
580 if rc.autocall:
580 if rc.autocall:
581 self._magic_state.autocall_save = rc.autocall
581 self._magic_state.autocall_save = rc.autocall
582 rc.autocall = 0
582 rc.autocall = 0
583 else:
583 else:
584 try:
584 try:
585 rc.autocall = self._magic_state.autocall_save
585 rc.autocall = self._magic_state.autocall_save
586 except AttributeError:
586 except AttributeError:
587 rc.autocall = self._magic_state.autocall_save = 1
587 rc.autocall = self._magic_state.autocall_save = 1
588
588
589 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
589 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
590
590
591 def magic_system_verbose(self, parameter_s = ''):
591 def magic_system_verbose(self, parameter_s = ''):
592 """Set verbose printing of system calls.
592 """Set verbose printing of system calls.
593
593
594 If called without an argument, act as a toggle"""
594 If called without an argument, act as a toggle"""
595
595
596 if parameter_s:
596 if parameter_s:
597 val = bool(eval(parameter_s))
597 val = bool(eval(parameter_s))
598 else:
598 else:
599 val = None
599 val = None
600
600
601 self.shell.rc_set_toggle('system_verbose',val)
601 self.shell.rc_set_toggle('system_verbose',val)
602 print "System verbose printing is:",\
602 print "System verbose printing is:",\
603 ['OFF','ON'][self.shell.rc.system_verbose]
603 ['OFF','ON'][self.shell.rc.system_verbose]
604
604
605
605
606 def magic_page(self, parameter_s=''):
606 def magic_page(self, parameter_s=''):
607 """Pretty print the object and display it through a pager.
607 """Pretty print the object and display it through a pager.
608
608
609 %page [options] OBJECT
609 %page [options] OBJECT
610
610
611 If no object is given, use _ (last output).
611 If no object is given, use _ (last output).
612
612
613 Options:
613 Options:
614
614
615 -r: page str(object), don't pretty-print it."""
615 -r: page str(object), don't pretty-print it."""
616
616
617 # After a function contributed by Olivier Aubert, slightly modified.
617 # After a function contributed by Olivier Aubert, slightly modified.
618
618
619 # Process options/args
619 # Process options/args
620 opts,args = self.parse_options(parameter_s,'r')
620 opts,args = self.parse_options(parameter_s,'r')
621 raw = 'r' in opts
621 raw = 'r' in opts
622
622
623 oname = args and args or '_'
623 oname = args and args or '_'
624 info = self._ofind(oname)
624 info = self._ofind(oname)
625 if info['found']:
625 if info['found']:
626 txt = (raw and str or pformat)( info['obj'] )
626 txt = (raw and str or pformat)( info['obj'] )
627 page(txt)
627 page(txt)
628 else:
628 else:
629 print 'Object `%s` not found' % oname
629 print 'Object `%s` not found' % oname
630
630
631 def magic_profile(self, parameter_s=''):
631 def magic_profile(self, parameter_s=''):
632 """Print your currently active IPyhton profile."""
632 """Print your currently active IPyhton profile."""
633 if self.shell.rc.profile:
633 if self.shell.rc.profile:
634 printpl('Current IPython profile: $self.shell.rc.profile.')
634 printpl('Current IPython profile: $self.shell.rc.profile.')
635 else:
635 else:
636 print 'No profile active.'
636 print 'No profile active.'
637
637
638 def magic_pinfo(self, parameter_s='', namespaces=None):
638 def magic_pinfo(self, parameter_s='', namespaces=None):
639 """Provide detailed information about an object.
639 """Provide detailed information about an object.
640
640
641 '%pinfo object' is just a synonym for object? or ?object."""
641 '%pinfo object' is just a synonym for object? or ?object."""
642
642
643 #print 'pinfo par: <%s>' % parameter_s # dbg
643 #print 'pinfo par: <%s>' % parameter_s # dbg
644
644
645
645
646 # detail_level: 0 -> obj? , 1 -> obj??
646 # detail_level: 0 -> obj? , 1 -> obj??
647 detail_level = 0
647 detail_level = 0
648 # We need to detect if we got called as 'pinfo pinfo foo', which can
648 # We need to detect if we got called as 'pinfo pinfo foo', which can
649 # happen if the user types 'pinfo foo?' at the cmd line.
649 # happen if the user types 'pinfo foo?' at the cmd line.
650 pinfo,qmark1,oname,qmark2 = \
650 pinfo,qmark1,oname,qmark2 = \
651 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
651 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
652 if pinfo or qmark1 or qmark2:
652 if pinfo or qmark1 or qmark2:
653 detail_level = 1
653 detail_level = 1
654 if "*" in oname:
654 if "*" in oname:
655 self.magic_psearch(oname)
655 self.magic_psearch(oname)
656 else:
656 else:
657 self._inspect('pinfo', oname, detail_level=detail_level,
657 self._inspect('pinfo', oname, detail_level=detail_level,
658 namespaces=namespaces)
658 namespaces=namespaces)
659
659
660 def magic_pdef(self, parameter_s='', namespaces=None):
660 def magic_pdef(self, parameter_s='', namespaces=None):
661 """Print the definition header for any callable object.
661 """Print the definition header for any callable object.
662
662
663 If the object is a class, print the constructor information."""
663 If the object is a class, print the constructor information."""
664 self._inspect('pdef',parameter_s, namespaces)
664 self._inspect('pdef',parameter_s, namespaces)
665
665
666 def magic_pdoc(self, parameter_s='', namespaces=None):
666 def magic_pdoc(self, parameter_s='', namespaces=None):
667 """Print the docstring for an object.
667 """Print the docstring for an object.
668
668
669 If the given object is a class, it will print both the class and the
669 If the given object is a class, it will print both the class and the
670 constructor docstrings."""
670 constructor docstrings."""
671 self._inspect('pdoc',parameter_s, namespaces)
671 self._inspect('pdoc',parameter_s, namespaces)
672
672
673 def magic_psource(self, parameter_s='', namespaces=None):
673 def magic_psource(self, parameter_s='', namespaces=None):
674 """Print (or run through pager) the source code for an object."""
674 """Print (or run through pager) the source code for an object."""
675 self._inspect('psource',parameter_s, namespaces)
675 self._inspect('psource',parameter_s, namespaces)
676
676
677 def magic_pfile(self, parameter_s=''):
677 def magic_pfile(self, parameter_s=''):
678 """Print (or run through pager) the file where an object is defined.
678 """Print (or run through pager) the file where an object is defined.
679
679
680 The file opens at the line where the object definition begins. IPython
680 The file opens at the line where the object definition begins. IPython
681 will honor the environment variable PAGER if set, and otherwise will
681 will honor the environment variable PAGER if set, and otherwise will
682 do its best to print the file in a convenient form.
682 do its best to print the file in a convenient form.
683
683
684 If the given argument is not an object currently defined, IPython will
684 If the given argument is not an object currently defined, IPython will
685 try to interpret it as a filename (automatically adding a .py extension
685 try to interpret it as a filename (automatically adding a .py extension
686 if needed). You can thus use %pfile as a syntax highlighting code
686 if needed). You can thus use %pfile as a syntax highlighting code
687 viewer."""
687 viewer."""
688
688
689 # first interpret argument as an object name
689 # first interpret argument as an object name
690 out = self._inspect('pfile',parameter_s)
690 out = self._inspect('pfile',parameter_s)
691 # if not, try the input as a filename
691 # if not, try the input as a filename
692 if out == 'not found':
692 if out == 'not found':
693 try:
693 try:
694 filename = get_py_filename(parameter_s)
694 filename = get_py_filename(parameter_s)
695 except IOError,msg:
695 except IOError,msg:
696 print msg
696 print msg
697 return
697 return
698 page(self.shell.inspector.format(file(filename).read()))
698 page(self.shell.inspector.format(file(filename).read()))
699
699
700 def _inspect(self,meth,oname,namespaces=None,**kw):
700 def _inspect(self,meth,oname,namespaces=None,**kw):
701 """Generic interface to the inspector system.
701 """Generic interface to the inspector system.
702
702
703 This function is meant to be called by pdef, pdoc & friends."""
703 This function is meant to be called by pdef, pdoc & friends."""
704
704
705 #oname = oname.strip()
705 #oname = oname.strip()
706 #print '1- oname: <%r>' % oname # dbg
706 #print '1- oname: <%r>' % oname # dbg
707 try:
707 try:
708 oname = oname.strip().encode('ascii')
708 oname = oname.strip().encode('ascii')
709 #print '2- oname: <%r>' % oname # dbg
709 #print '2- oname: <%r>' % oname # dbg
710 except UnicodeEncodeError:
710 except UnicodeEncodeError:
711 print 'Python identifiers can only contain ascii characters.'
711 print 'Python identifiers can only contain ascii characters.'
712 return 'not found'
712 return 'not found'
713
713
714 info = Struct(self._ofind(oname, namespaces))
714 info = Struct(self._ofind(oname, namespaces))
715
715
716 if info.found:
716 if info.found:
717 try:
717 try:
718 IPython.generics.inspect_object(info.obj)
718 IPython.generics.inspect_object(info.obj)
719 return
719 return
720 except IPython.ipapi.TryNext:
720 except IPython.ipapi.TryNext:
721 pass
721 pass
722 # Get the docstring of the class property if it exists.
722 # Get the docstring of the class property if it exists.
723 path = oname.split('.')
723 path = oname.split('.')
724 root = '.'.join(path[:-1])
724 root = '.'.join(path[:-1])
725 if info.parent is not None:
725 if info.parent is not None:
726 try:
726 try:
727 target = getattr(info.parent, '__class__')
727 target = getattr(info.parent, '__class__')
728 # The object belongs to a class instance.
728 # The object belongs to a class instance.
729 try:
729 try:
730 target = getattr(target, path[-1])
730 target = getattr(target, path[-1])
731 # The class defines the object.
731 # The class defines the object.
732 if isinstance(target, property):
732 if isinstance(target, property):
733 oname = root + '.__class__.' + path[-1]
733 oname = root + '.__class__.' + path[-1]
734 info = Struct(self._ofind(oname))
734 info = Struct(self._ofind(oname))
735 except AttributeError: pass
735 except AttributeError: pass
736 except AttributeError: pass
736 except AttributeError: pass
737
737
738 pmethod = getattr(self.shell.inspector,meth)
738 pmethod = getattr(self.shell.inspector,meth)
739 formatter = info.ismagic and self.format_screen or None
739 formatter = info.ismagic and self.format_screen or None
740 if meth == 'pdoc':
740 if meth == 'pdoc':
741 pmethod(info.obj,oname,formatter)
741 pmethod(info.obj,oname,formatter)
742 elif meth == 'pinfo':
742 elif meth == 'pinfo':
743 pmethod(info.obj,oname,formatter,info,**kw)
743 pmethod(info.obj,oname,formatter,info,**kw)
744 else:
744 else:
745 pmethod(info.obj,oname)
745 pmethod(info.obj,oname)
746 else:
746 else:
747 print 'Object `%s` not found.' % oname
747 print 'Object `%s` not found.' % oname
748 return 'not found' # so callers can take other action
748 return 'not found' # so callers can take other action
749
749
750 def magic_psearch(self, parameter_s=''):
750 def magic_psearch(self, parameter_s=''):
751 """Search for object in namespaces by wildcard.
751 """Search for object in namespaces by wildcard.
752
752
753 %psearch [options] PATTERN [OBJECT TYPE]
753 %psearch [options] PATTERN [OBJECT TYPE]
754
754
755 Note: ? can be used as a synonym for %psearch, at the beginning or at
755 Note: ? can be used as a synonym for %psearch, at the beginning or at
756 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
756 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
757 rest of the command line must be unchanged (options come first), so
757 rest of the command line must be unchanged (options come first), so
758 for example the following forms are equivalent
758 for example the following forms are equivalent
759
759
760 %psearch -i a* function
760 %psearch -i a* function
761 -i a* function?
761 -i a* function?
762 ?-i a* function
762 ?-i a* function
763
763
764 Arguments:
764 Arguments:
765
765
766 PATTERN
766 PATTERN
767
767
768 where PATTERN is a string containing * as a wildcard similar to its
768 where PATTERN is a string containing * as a wildcard similar to its
769 use in a shell. The pattern is matched in all namespaces on the
769 use in a shell. The pattern is matched in all namespaces on the
770 search path. By default objects starting with a single _ are not
770 search path. By default objects starting with a single _ are not
771 matched, many IPython generated objects have a single
771 matched, many IPython generated objects have a single
772 underscore. The default is case insensitive matching. Matching is
772 underscore. The default is case insensitive matching. Matching is
773 also done on the attributes of objects and not only on the objects
773 also done on the attributes of objects and not only on the objects
774 in a module.
774 in a module.
775
775
776 [OBJECT TYPE]
776 [OBJECT TYPE]
777
777
778 Is the name of a python type from the types module. The name is
778 Is the name of a python type from the types module. The name is
779 given in lowercase without the ending type, ex. StringType is
779 given in lowercase without the ending type, ex. StringType is
780 written string. By adding a type here only objects matching the
780 written string. By adding a type here only objects matching the
781 given type are matched. Using all here makes the pattern match all
781 given type are matched. Using all here makes the pattern match all
782 types (this is the default).
782 types (this is the default).
783
783
784 Options:
784 Options:
785
785
786 -a: makes the pattern match even objects whose names start with a
786 -a: makes the pattern match even objects whose names start with a
787 single underscore. These names are normally ommitted from the
787 single underscore. These names are normally ommitted from the
788 search.
788 search.
789
789
790 -i/-c: make the pattern case insensitive/sensitive. If neither of
790 -i/-c: make the pattern case insensitive/sensitive. If neither of
791 these options is given, the default is read from your ipythonrc
791 these options is given, the default is read from your ipythonrc
792 file. The option name which sets this value is
792 file. The option name which sets this value is
793 'wildcards_case_sensitive'. If this option is not specified in your
793 'wildcards_case_sensitive'. If this option is not specified in your
794 ipythonrc file, IPython's internal default is to do a case sensitive
794 ipythonrc file, IPython's internal default is to do a case sensitive
795 search.
795 search.
796
796
797 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
797 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
798 specifiy can be searched in any of the following namespaces:
798 specifiy can be searched in any of the following namespaces:
799 'builtin', 'user', 'user_global','internal', 'alias', where
799 'builtin', 'user', 'user_global','internal', 'alias', where
800 'builtin' and 'user' are the search defaults. Note that you should
800 'builtin' and 'user' are the search defaults. Note that you should
801 not use quotes when specifying namespaces.
801 not use quotes when specifying namespaces.
802
802
803 'Builtin' contains the python module builtin, 'user' contains all
803 'Builtin' contains the python module builtin, 'user' contains all
804 user data, 'alias' only contain the shell aliases and no python
804 user data, 'alias' only contain the shell aliases and no python
805 objects, 'internal' contains objects used by IPython. The
805 objects, 'internal' contains objects used by IPython. The
806 'user_global' namespace is only used by embedded IPython instances,
806 'user_global' namespace is only used by embedded IPython instances,
807 and it contains module-level globals. You can add namespaces to the
807 and it contains module-level globals. You can add namespaces to the
808 search with -s or exclude them with -e (these options can be given
808 search with -s or exclude them with -e (these options can be given
809 more than once).
809 more than once).
810
810
811 Examples:
811 Examples:
812
812
813 %psearch a* -> objects beginning with an a
813 %psearch a* -> objects beginning with an a
814 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
814 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
815 %psearch a* function -> all functions beginning with an a
815 %psearch a* function -> all functions beginning with an a
816 %psearch re.e* -> objects beginning with an e in module re
816 %psearch re.e* -> objects beginning with an e in module re
817 %psearch r*.e* -> objects that start with e in modules starting in r
817 %psearch r*.e* -> objects that start with e in modules starting in r
818 %psearch r*.* string -> all strings in modules beginning with r
818 %psearch r*.* string -> all strings in modules beginning with r
819
819
820 Case sensitve search:
820 Case sensitve search:
821
821
822 %psearch -c a* list all object beginning with lower case a
822 %psearch -c a* list all object beginning with lower case a
823
823
824 Show objects beginning with a single _:
824 Show objects beginning with a single _:
825
825
826 %psearch -a _* list objects beginning with a single underscore"""
826 %psearch -a _* list objects beginning with a single underscore"""
827 try:
827 try:
828 parameter_s = parameter_s.encode('ascii')
828 parameter_s = parameter_s.encode('ascii')
829 except UnicodeEncodeError:
829 except UnicodeEncodeError:
830 print 'Python identifiers can only contain ascii characters.'
830 print 'Python identifiers can only contain ascii characters.'
831 return
831 return
832
832
833 # default namespaces to be searched
833 # default namespaces to be searched
834 def_search = ['user','builtin']
834 def_search = ['user','builtin']
835
835
836 # Process options/args
836 # Process options/args
837 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
837 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
838 opt = opts.get
838 opt = opts.get
839 shell = self.shell
839 shell = self.shell
840 psearch = shell.inspector.psearch
840 psearch = shell.inspector.psearch
841
841
842 # select case options
842 # select case options
843 if opts.has_key('i'):
843 if opts.has_key('i'):
844 ignore_case = True
844 ignore_case = True
845 elif opts.has_key('c'):
845 elif opts.has_key('c'):
846 ignore_case = False
846 ignore_case = False
847 else:
847 else:
848 ignore_case = not shell.rc.wildcards_case_sensitive
848 ignore_case = not shell.rc.wildcards_case_sensitive
849
849
850 # Build list of namespaces to search from user options
850 # Build list of namespaces to search from user options
851 def_search.extend(opt('s',[]))
851 def_search.extend(opt('s',[]))
852 ns_exclude = ns_exclude=opt('e',[])
852 ns_exclude = ns_exclude=opt('e',[])
853 ns_search = [nm for nm in def_search if nm not in ns_exclude]
853 ns_search = [nm for nm in def_search if nm not in ns_exclude]
854
854
855 # Call the actual search
855 # Call the actual search
856 try:
856 try:
857 psearch(args,shell.ns_table,ns_search,
857 psearch(args,shell.ns_table,ns_search,
858 show_all=opt('a'),ignore_case=ignore_case)
858 show_all=opt('a'),ignore_case=ignore_case)
859 except:
859 except:
860 shell.showtraceback()
860 shell.showtraceback()
861
861
862 def magic_who_ls(self, parameter_s=''):
862 def magic_who_ls(self, parameter_s=''):
863 """Return a sorted list of all interactive variables.
863 """Return a sorted list of all interactive variables.
864
864
865 If arguments are given, only variables of types matching these
865 If arguments are given, only variables of types matching these
866 arguments are returned."""
866 arguments are returned."""
867
867
868 user_ns = self.shell.user_ns
868 user_ns = self.shell.user_ns
869 internal_ns = self.shell.internal_ns
869 internal_ns = self.shell.internal_ns
870 user_config_ns = self.shell.user_config_ns
870 user_config_ns = self.shell.user_config_ns
871 out = []
871 out = []
872 typelist = parameter_s.split()
872 typelist = parameter_s.split()
873
873
874 for i in user_ns:
874 for i in user_ns:
875 if not (i.startswith('_') or i.startswith('_i')) \
875 if not (i.startswith('_') or i.startswith('_i')) \
876 and not (i in internal_ns or i in user_config_ns):
876 and not (i in internal_ns or i in user_config_ns):
877 if typelist:
877 if typelist:
878 if type(user_ns[i]).__name__ in typelist:
878 if type(user_ns[i]).__name__ in typelist:
879 out.append(i)
879 out.append(i)
880 else:
880 else:
881 out.append(i)
881 out.append(i)
882 out.sort()
882 out.sort()
883 return out
883 return out
884
884
885 def magic_who(self, parameter_s=''):
885 def magic_who(self, parameter_s=''):
886 """Print all interactive variables, with some minimal formatting.
886 """Print all interactive variables, with some minimal formatting.
887
887
888 If any arguments are given, only variables whose type matches one of
888 If any arguments are given, only variables whose type matches one of
889 these are printed. For example:
889 these are printed. For example:
890
890
891 %who function str
891 %who function str
892
892
893 will only list functions and strings, excluding all other types of
893 will only list functions and strings, excluding all other types of
894 variables. To find the proper type names, simply use type(var) at a
894 variables. To find the proper type names, simply use type(var) at a
895 command line to see how python prints type names. For example:
895 command line to see how python prints type names. For example:
896
896
897 In [1]: type('hello')\\
897 In [1]: type('hello')\\
898 Out[1]: <type 'str'>
898 Out[1]: <type 'str'>
899
899
900 indicates that the type name for strings is 'str'.
900 indicates that the type name for strings is 'str'.
901
901
902 %who always excludes executed names loaded through your configuration
902 %who always excludes executed names loaded through your configuration
903 file and things which are internal to IPython.
903 file and things which are internal to IPython.
904
904
905 This is deliberate, as typically you may load many modules and the
905 This is deliberate, as typically you may load many modules and the
906 purpose of %who is to show you only what you've manually defined."""
906 purpose of %who is to show you only what you've manually defined."""
907
907
908 varlist = self.magic_who_ls(parameter_s)
908 varlist = self.magic_who_ls(parameter_s)
909 if not varlist:
909 if not varlist:
910 if parameter_s:
910 if parameter_s:
911 print 'No variables match your requested type.'
911 print 'No variables match your requested type.'
912 else:
912 else:
913 print 'Interactive namespace is empty.'
913 print 'Interactive namespace is empty.'
914 return
914 return
915
915
916 # if we have variables, move on...
916 # if we have variables, move on...
917 count = 0
917 count = 0
918 for i in varlist:
918 for i in varlist:
919 print i+'\t',
919 print i+'\t',
920 count += 1
920 count += 1
921 if count > 8:
921 if count > 8:
922 count = 0
922 count = 0
923 print
923 print
924 print
924 print
925
925
926 def magic_whos(self, parameter_s=''):
926 def magic_whos(self, parameter_s=''):
927 """Like %who, but gives some extra information about each variable.
927 """Like %who, but gives some extra information about each variable.
928
928
929 The same type filtering of %who can be applied here.
929 The same type filtering of %who can be applied here.
930
930
931 For all variables, the type is printed. Additionally it prints:
931 For all variables, the type is printed. Additionally it prints:
932
932
933 - For {},[],(): their length.
933 - For {},[],(): their length.
934
934
935 - For numpy and Numeric arrays, a summary with shape, number of
935 - For numpy and Numeric arrays, a summary with shape, number of
936 elements, typecode and size in memory.
936 elements, typecode and size in memory.
937
937
938 - Everything else: a string representation, snipping their middle if
938 - Everything else: a string representation, snipping their middle if
939 too long."""
939 too long."""
940
940
941 varnames = self.magic_who_ls(parameter_s)
941 varnames = self.magic_who_ls(parameter_s)
942 if not varnames:
942 if not varnames:
943 if parameter_s:
943 if parameter_s:
944 print 'No variables match your requested type.'
944 print 'No variables match your requested type.'
945 else:
945 else:
946 print 'Interactive namespace is empty.'
946 print 'Interactive namespace is empty.'
947 return
947 return
948
948
949 # if we have variables, move on...
949 # if we have variables, move on...
950
950
951 # for these types, show len() instead of data:
951 # for these types, show len() instead of data:
952 seq_types = [types.DictType,types.ListType,types.TupleType]
952 seq_types = [types.DictType,types.ListType,types.TupleType]
953
953
954 # for numpy/Numeric arrays, display summary info
954 # for numpy/Numeric arrays, display summary info
955 try:
955 try:
956 import numpy
956 import numpy
957 except ImportError:
957 except ImportError:
958 ndarray_type = None
958 ndarray_type = None
959 else:
959 else:
960 ndarray_type = numpy.ndarray.__name__
960 ndarray_type = numpy.ndarray.__name__
961 try:
961 try:
962 import Numeric
962 import Numeric
963 except ImportError:
963 except ImportError:
964 array_type = None
964 array_type = None
965 else:
965 else:
966 array_type = Numeric.ArrayType.__name__
966 array_type = Numeric.ArrayType.__name__
967
967
968 # Find all variable names and types so we can figure out column sizes
968 # Find all variable names and types so we can figure out column sizes
969 def get_vars(i):
969 def get_vars(i):
970 return self.shell.user_ns[i]
970 return self.shell.user_ns[i]
971
971
972 # some types are well known and can be shorter
972 # some types are well known and can be shorter
973 abbrevs = {'IPython.macro.Macro' : 'Macro'}
973 abbrevs = {'IPython.macro.Macro' : 'Macro'}
974 def type_name(v):
974 def type_name(v):
975 tn = type(v).__name__
975 tn = type(v).__name__
976 return abbrevs.get(tn,tn)
976 return abbrevs.get(tn,tn)
977
977
978 varlist = map(get_vars,varnames)
978 varlist = map(get_vars,varnames)
979
979
980 typelist = []
980 typelist = []
981 for vv in varlist:
981 for vv in varlist:
982 tt = type_name(vv)
982 tt = type_name(vv)
983
983
984 if tt=='instance':
984 if tt=='instance':
985 typelist.append( abbrevs.get(str(vv.__class__),
985 typelist.append( abbrevs.get(str(vv.__class__),
986 str(vv.__class__)))
986 str(vv.__class__)))
987 else:
987 else:
988 typelist.append(tt)
988 typelist.append(tt)
989
989
990 # column labels and # of spaces as separator
990 # column labels and # of spaces as separator
991 varlabel = 'Variable'
991 varlabel = 'Variable'
992 typelabel = 'Type'
992 typelabel = 'Type'
993 datalabel = 'Data/Info'
993 datalabel = 'Data/Info'
994 colsep = 3
994 colsep = 3
995 # variable format strings
995 # variable format strings
996 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
996 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
997 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
997 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
998 aformat = "%s: %s elems, type `%s`, %s bytes"
998 aformat = "%s: %s elems, type `%s`, %s bytes"
999 # find the size of the columns to format the output nicely
999 # find the size of the columns to format the output nicely
1000 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
1000 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
1001 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
1001 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
1002 # table header
1002 # table header
1003 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
1003 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
1004 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
1004 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
1005 # and the table itself
1005 # and the table itself
1006 kb = 1024
1006 kb = 1024
1007 Mb = 1048576 # kb**2
1007 Mb = 1048576 # kb**2
1008 for vname,var,vtype in zip(varnames,varlist,typelist):
1008 for vname,var,vtype in zip(varnames,varlist,typelist):
1009 print itpl(vformat),
1009 print itpl(vformat),
1010 if vtype in seq_types:
1010 if vtype in seq_types:
1011 print len(var)
1011 print len(var)
1012 elif vtype in [array_type,ndarray_type]:
1012 elif vtype in [array_type,ndarray_type]:
1013 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1013 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1014 if vtype==ndarray_type:
1014 if vtype==ndarray_type:
1015 # numpy
1015 # numpy
1016 vsize = var.size
1016 vsize = var.size
1017 vbytes = vsize*var.itemsize
1017 vbytes = vsize*var.itemsize
1018 vdtype = var.dtype
1018 vdtype = var.dtype
1019 else:
1019 else:
1020 # Numeric
1020 # Numeric
1021 vsize = Numeric.size(var)
1021 vsize = Numeric.size(var)
1022 vbytes = vsize*var.itemsize()
1022 vbytes = vsize*var.itemsize()
1023 vdtype = var.typecode()
1023 vdtype = var.typecode()
1024
1024
1025 if vbytes < 100000:
1025 if vbytes < 100000:
1026 print aformat % (vshape,vsize,vdtype,vbytes)
1026 print aformat % (vshape,vsize,vdtype,vbytes)
1027 else:
1027 else:
1028 print aformat % (vshape,vsize,vdtype,vbytes),
1028 print aformat % (vshape,vsize,vdtype,vbytes),
1029 if vbytes < Mb:
1029 if vbytes < Mb:
1030 print '(%s kb)' % (vbytes/kb,)
1030 print '(%s kb)' % (vbytes/kb,)
1031 else:
1031 else:
1032 print '(%s Mb)' % (vbytes/Mb,)
1032 print '(%s Mb)' % (vbytes/Mb,)
1033 else:
1033 else:
1034 try:
1034 try:
1035 vstr = str(var)
1035 vstr = str(var)
1036 except UnicodeEncodeError:
1036 except UnicodeEncodeError:
1037 vstr = unicode(var).encode(sys.getdefaultencoding(),
1037 vstr = unicode(var).encode(sys.getdefaultencoding(),
1038 'backslashreplace')
1038 'backslashreplace')
1039 vstr = vstr.replace('\n','\\n')
1039 vstr = vstr.replace('\n','\\n')
1040 if len(vstr) < 50:
1040 if len(vstr) < 50:
1041 print vstr
1041 print vstr
1042 else:
1042 else:
1043 printpl(vfmt_short)
1043 printpl(vfmt_short)
1044
1044
1045 def magic_reset(self, parameter_s=''):
1045 def magic_reset(self, parameter_s=''):
1046 """Resets the namespace by removing all names defined by the user.
1046 """Resets the namespace by removing all names defined by the user.
1047
1047
1048 Input/Output history are left around in case you need them."""
1048 Input/Output history are left around in case you need them."""
1049
1049
1050 ans = self.shell.ask_yes_no(
1050 ans = self.shell.ask_yes_no(
1051 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1051 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1052 if not ans:
1052 if not ans:
1053 print 'Nothing done.'
1053 print 'Nothing done.'
1054 return
1054 return
1055 user_ns = self.shell.user_ns
1055 user_ns = self.shell.user_ns
1056 for i in self.magic_who_ls():
1056 for i in self.magic_who_ls():
1057 del(user_ns[i])
1057 del(user_ns[i])
1058
1058
1059 # Also flush the private list of module references kept for script
1059 # Also flush the private list of module references kept for script
1060 # execution protection
1060 # execution protection
1061 self.shell._user_main_modules[:] = []
1061 self.shell._user_main_modules[:] = []
1062
1062
1063 def magic_logstart(self,parameter_s=''):
1063 def magic_logstart(self,parameter_s=''):
1064 """Start logging anywhere in a session.
1064 """Start logging anywhere in a session.
1065
1065
1066 %logstart [-o|-r|-t] [log_name [log_mode]]
1066 %logstart [-o|-r|-t] [log_name [log_mode]]
1067
1067
1068 If no name is given, it defaults to a file named 'ipython_log.py' in your
1068 If no name is given, it defaults to a file named 'ipython_log.py' in your
1069 current directory, in 'rotate' mode (see below).
1069 current directory, in 'rotate' mode (see below).
1070
1070
1071 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1071 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1072 history up to that point and then continues logging.
1072 history up to that point and then continues logging.
1073
1073
1074 %logstart takes a second optional parameter: logging mode. This can be one
1074 %logstart takes a second optional parameter: logging mode. This can be one
1075 of (note that the modes are given unquoted):\\
1075 of (note that the modes are given unquoted):\\
1076 append: well, that says it.\\
1076 append: well, that says it.\\
1077 backup: rename (if exists) to name~ and start name.\\
1077 backup: rename (if exists) to name~ and start name.\\
1078 global: single logfile in your home dir, appended to.\\
1078 global: single logfile in your home dir, appended to.\\
1079 over : overwrite existing log.\\
1079 over : overwrite existing log.\\
1080 rotate: create rotating logs name.1~, name.2~, etc.
1080 rotate: create rotating logs name.1~, name.2~, etc.
1081
1081
1082 Options:
1082 Options:
1083
1083
1084 -o: log also IPython's output. In this mode, all commands which
1084 -o: log also IPython's output. In this mode, all commands which
1085 generate an Out[NN] prompt are recorded to the logfile, right after
1085 generate an Out[NN] prompt are recorded to the logfile, right after
1086 their corresponding input line. The output lines are always
1086 their corresponding input line. The output lines are always
1087 prepended with a '#[Out]# ' marker, so that the log remains valid
1087 prepended with a '#[Out]# ' marker, so that the log remains valid
1088 Python code.
1088 Python code.
1089
1089
1090 Since this marker is always the same, filtering only the output from
1090 Since this marker is always the same, filtering only the output from
1091 a log is very easy, using for example a simple awk call:
1091 a log is very easy, using for example a simple awk call:
1092
1092
1093 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1093 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1094
1094
1095 -r: log 'raw' input. Normally, IPython's logs contain the processed
1095 -r: log 'raw' input. Normally, IPython's logs contain the processed
1096 input, so that user lines are logged in their final form, converted
1096 input, so that user lines are logged in their final form, converted
1097 into valid Python. For example, %Exit is logged as
1097 into valid Python. For example, %Exit is logged as
1098 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1098 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1099 exactly as typed, with no transformations applied.
1099 exactly as typed, with no transformations applied.
1100
1100
1101 -t: put timestamps before each input line logged (these are put in
1101 -t: put timestamps before each input line logged (these are put in
1102 comments)."""
1102 comments)."""
1103
1103
1104 opts,par = self.parse_options(parameter_s,'ort')
1104 opts,par = self.parse_options(parameter_s,'ort')
1105 log_output = 'o' in opts
1105 log_output = 'o' in opts
1106 log_raw_input = 'r' in opts
1106 log_raw_input = 'r' in opts
1107 timestamp = 't' in opts
1107 timestamp = 't' in opts
1108
1108
1109 rc = self.shell.rc
1109 rc = self.shell.rc
1110 logger = self.shell.logger
1110 logger = self.shell.logger
1111
1111
1112 # if no args are given, the defaults set in the logger constructor by
1112 # if no args are given, the defaults set in the logger constructor by
1113 # ipytohn remain valid
1113 # ipytohn remain valid
1114 if par:
1114 if par:
1115 try:
1115 try:
1116 logfname,logmode = par.split()
1116 logfname,logmode = par.split()
1117 except:
1117 except:
1118 logfname = par
1118 logfname = par
1119 logmode = 'backup'
1119 logmode = 'backup'
1120 else:
1120 else:
1121 logfname = logger.logfname
1121 logfname = logger.logfname
1122 logmode = logger.logmode
1122 logmode = logger.logmode
1123 # put logfname into rc struct as if it had been called on the command
1123 # put logfname into rc struct as if it had been called on the command
1124 # line, so it ends up saved in the log header Save it in case we need
1124 # line, so it ends up saved in the log header Save it in case we need
1125 # to restore it...
1125 # to restore it...
1126 old_logfile = rc.opts.get('logfile','')
1126 old_logfile = rc.opts.get('logfile','')
1127 if logfname:
1127 if logfname:
1128 logfname = os.path.expanduser(logfname)
1128 logfname = os.path.expanduser(logfname)
1129 rc.opts.logfile = logfname
1129 rc.opts.logfile = logfname
1130 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1130 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1131 try:
1131 try:
1132 started = logger.logstart(logfname,loghead,logmode,
1132 started = logger.logstart(logfname,loghead,logmode,
1133 log_output,timestamp,log_raw_input)
1133 log_output,timestamp,log_raw_input)
1134 except:
1134 except:
1135 rc.opts.logfile = old_logfile
1135 rc.opts.logfile = old_logfile
1136 warn("Couldn't start log: %s" % sys.exc_info()[1])
1136 warn("Couldn't start log: %s" % sys.exc_info()[1])
1137 else:
1137 else:
1138 # log input history up to this point, optionally interleaving
1138 # log input history up to this point, optionally interleaving
1139 # output if requested
1139 # output if requested
1140
1140
1141 if timestamp:
1141 if timestamp:
1142 # disable timestamping for the previous history, since we've
1142 # disable timestamping for the previous history, since we've
1143 # lost those already (no time machine here).
1143 # lost those already (no time machine here).
1144 logger.timestamp = False
1144 logger.timestamp = False
1145
1145
1146 if log_raw_input:
1146 if log_raw_input:
1147 input_hist = self.shell.input_hist_raw
1147 input_hist = self.shell.input_hist_raw
1148 else:
1148 else:
1149 input_hist = self.shell.input_hist
1149 input_hist = self.shell.input_hist
1150
1150
1151 if log_output:
1151 if log_output:
1152 log_write = logger.log_write
1152 log_write = logger.log_write
1153 output_hist = self.shell.output_hist
1153 output_hist = self.shell.output_hist
1154 for n in range(1,len(input_hist)-1):
1154 for n in range(1,len(input_hist)-1):
1155 log_write(input_hist[n].rstrip())
1155 log_write(input_hist[n].rstrip())
1156 if n in output_hist:
1156 if n in output_hist:
1157 log_write(repr(output_hist[n]),'output')
1157 log_write(repr(output_hist[n]),'output')
1158 else:
1158 else:
1159 logger.log_write(input_hist[1:])
1159 logger.log_write(input_hist[1:])
1160 if timestamp:
1160 if timestamp:
1161 # re-enable timestamping
1161 # re-enable timestamping
1162 logger.timestamp = True
1162 logger.timestamp = True
1163
1163
1164 print ('Activating auto-logging. '
1164 print ('Activating auto-logging. '
1165 'Current session state plus future input saved.')
1165 'Current session state plus future input saved.')
1166 logger.logstate()
1166 logger.logstate()
1167
1167
1168 def magic_logstop(self,parameter_s=''):
1168 def magic_logstop(self,parameter_s=''):
1169 """Fully stop logging and close log file.
1169 """Fully stop logging and close log file.
1170
1170
1171 In order to start logging again, a new %logstart call needs to be made,
1171 In order to start logging again, a new %logstart call needs to be made,
1172 possibly (though not necessarily) with a new filename, mode and other
1172 possibly (though not necessarily) with a new filename, mode and other
1173 options."""
1173 options."""
1174 self.logger.logstop()
1174 self.logger.logstop()
1175
1175
1176 def magic_logoff(self,parameter_s=''):
1176 def magic_logoff(self,parameter_s=''):
1177 """Temporarily stop logging.
1177 """Temporarily stop logging.
1178
1178
1179 You must have previously started logging."""
1179 You must have previously started logging."""
1180 self.shell.logger.switch_log(0)
1180 self.shell.logger.switch_log(0)
1181
1181
1182 def magic_logon(self,parameter_s=''):
1182 def magic_logon(self,parameter_s=''):
1183 """Restart logging.
1183 """Restart logging.
1184
1184
1185 This function is for restarting logging which you've temporarily
1185 This function is for restarting logging which you've temporarily
1186 stopped with %logoff. For starting logging for the first time, you
1186 stopped with %logoff. For starting logging for the first time, you
1187 must use the %logstart function, which allows you to specify an
1187 must use the %logstart function, which allows you to specify an
1188 optional log filename."""
1188 optional log filename."""
1189
1189
1190 self.shell.logger.switch_log(1)
1190 self.shell.logger.switch_log(1)
1191
1191
1192 def magic_logstate(self,parameter_s=''):
1192 def magic_logstate(self,parameter_s=''):
1193 """Print the status of the logging system."""
1193 """Print the status of the logging system."""
1194
1194
1195 self.shell.logger.logstate()
1195 self.shell.logger.logstate()
1196
1196
1197 def magic_pdb(self, parameter_s=''):
1197 def magic_pdb(self, parameter_s=''):
1198 """Control the automatic calling of the pdb interactive debugger.
1198 """Control the automatic calling of the pdb interactive debugger.
1199
1199
1200 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1200 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1201 argument it works as a toggle.
1201 argument it works as a toggle.
1202
1202
1203 When an exception is triggered, IPython can optionally call the
1203 When an exception is triggered, IPython can optionally call the
1204 interactive pdb debugger after the traceback printout. %pdb toggles
1204 interactive pdb debugger after the traceback printout. %pdb toggles
1205 this feature on and off.
1205 this feature on and off.
1206
1206
1207 The initial state of this feature is set in your ipythonrc
1207 The initial state of this feature is set in your ipythonrc
1208 configuration file (the variable is called 'pdb').
1208 configuration file (the variable is called 'pdb').
1209
1209
1210 If you want to just activate the debugger AFTER an exception has fired,
1210 If you want to just activate the debugger AFTER an exception has fired,
1211 without having to type '%pdb on' and rerunning your code, you can use
1211 without having to type '%pdb on' and rerunning your code, you can use
1212 the %debug magic."""
1212 the %debug magic."""
1213
1213
1214 par = parameter_s.strip().lower()
1214 par = parameter_s.strip().lower()
1215
1215
1216 if par:
1216 if par:
1217 try:
1217 try:
1218 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1218 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1219 except KeyError:
1219 except KeyError:
1220 print ('Incorrect argument. Use on/1, off/0, '
1220 print ('Incorrect argument. Use on/1, off/0, '
1221 'or nothing for a toggle.')
1221 'or nothing for a toggle.')
1222 return
1222 return
1223 else:
1223 else:
1224 # toggle
1224 # toggle
1225 new_pdb = not self.shell.call_pdb
1225 new_pdb = not self.shell.call_pdb
1226
1226
1227 # set on the shell
1227 # set on the shell
1228 self.shell.call_pdb = new_pdb
1228 self.shell.call_pdb = new_pdb
1229 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1229 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1230
1230
1231 def magic_debug(self, parameter_s=''):
1231 def magic_debug(self, parameter_s=''):
1232 """Activate the interactive debugger in post-mortem mode.
1232 """Activate the interactive debugger in post-mortem mode.
1233
1233
1234 If an exception has just occurred, this lets you inspect its stack
1234 If an exception has just occurred, this lets you inspect its stack
1235 frames interactively. Note that this will always work only on the last
1235 frames interactively. Note that this will always work only on the last
1236 traceback that occurred, so you must call this quickly after an
1236 traceback that occurred, so you must call this quickly after an
1237 exception that you wish to inspect has fired, because if another one
1237 exception that you wish to inspect has fired, because if another one
1238 occurs, it clobbers the previous one.
1238 occurs, it clobbers the previous one.
1239
1239
1240 If you want IPython to automatically do this on every exception, see
1240 If you want IPython to automatically do this on every exception, see
1241 the %pdb magic for more details.
1241 the %pdb magic for more details.
1242 """
1242 """
1243
1243
1244 self.shell.debugger(force=True)
1244 self.shell.debugger(force=True)
1245
1245
1246 def magic_prun(self, parameter_s ='',user_mode=1,
1246 def magic_prun(self, parameter_s ='',user_mode=1,
1247 opts=None,arg_lst=None,prog_ns=None):
1247 opts=None,arg_lst=None,prog_ns=None):
1248
1248
1249 """Run a statement through the python code profiler.
1249 """Run a statement through the python code profiler.
1250
1250
1251 Usage:\\
1251 Usage:\\
1252 %prun [options] statement
1252 %prun [options] statement
1253
1253
1254 The given statement (which doesn't require quote marks) is run via the
1254 The given statement (which doesn't require quote marks) is run via the
1255 python profiler in a manner similar to the profile.run() function.
1255 python profiler in a manner similar to the profile.run() function.
1256 Namespaces are internally managed to work correctly; profile.run
1256 Namespaces are internally managed to work correctly; profile.run
1257 cannot be used in IPython because it makes certain assumptions about
1257 cannot be used in IPython because it makes certain assumptions about
1258 namespaces which do not hold under IPython.
1258 namespaces which do not hold under IPython.
1259
1259
1260 Options:
1260 Options:
1261
1261
1262 -l <limit>: you can place restrictions on what or how much of the
1262 -l <limit>: you can place restrictions on what or how much of the
1263 profile gets printed. The limit value can be:
1263 profile gets printed. The limit value can be:
1264
1264
1265 * A string: only information for function names containing this string
1265 * A string: only information for function names containing this string
1266 is printed.
1266 is printed.
1267
1267
1268 * An integer: only these many lines are printed.
1268 * An integer: only these many lines are printed.
1269
1269
1270 * A float (between 0 and 1): this fraction of the report is printed
1270 * A float (between 0 and 1): this fraction of the report is printed
1271 (for example, use a limit of 0.4 to see the topmost 40% only).
1271 (for example, use a limit of 0.4 to see the topmost 40% only).
1272
1272
1273 You can combine several limits with repeated use of the option. For
1273 You can combine several limits with repeated use of the option. For
1274 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1274 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1275 information about class constructors.
1275 information about class constructors.
1276
1276
1277 -r: return the pstats.Stats object generated by the profiling. This
1277 -r: return the pstats.Stats object generated by the profiling. This
1278 object has all the information about the profile in it, and you can
1278 object has all the information about the profile in it, and you can
1279 later use it for further analysis or in other functions.
1279 later use it for further analysis or in other functions.
1280
1280
1281 -s <key>: sort profile by given key. You can provide more than one key
1281 -s <key>: sort profile by given key. You can provide more than one key
1282 by using the option several times: '-s key1 -s key2 -s key3...'. The
1282 by using the option several times: '-s key1 -s key2 -s key3...'. The
1283 default sorting key is 'time'.
1283 default sorting key is 'time'.
1284
1284
1285 The following is copied verbatim from the profile documentation
1285 The following is copied verbatim from the profile documentation
1286 referenced below:
1286 referenced below:
1287
1287
1288 When more than one key is provided, additional keys are used as
1288 When more than one key is provided, additional keys are used as
1289 secondary criteria when the there is equality in all keys selected
1289 secondary criteria when the there is equality in all keys selected
1290 before them.
1290 before them.
1291
1291
1292 Abbreviations can be used for any key names, as long as the
1292 Abbreviations can be used for any key names, as long as the
1293 abbreviation is unambiguous. The following are the keys currently
1293 abbreviation is unambiguous. The following are the keys currently
1294 defined:
1294 defined:
1295
1295
1296 Valid Arg Meaning\\
1296 Valid Arg Meaning\\
1297 "calls" call count\\
1297 "calls" call count\\
1298 "cumulative" cumulative time\\
1298 "cumulative" cumulative time\\
1299 "file" file name\\
1299 "file" file name\\
1300 "module" file name\\
1300 "module" file name\\
1301 "pcalls" primitive call count\\
1301 "pcalls" primitive call count\\
1302 "line" line number\\
1302 "line" line number\\
1303 "name" function name\\
1303 "name" function name\\
1304 "nfl" name/file/line\\
1304 "nfl" name/file/line\\
1305 "stdname" standard name\\
1305 "stdname" standard name\\
1306 "time" internal time
1306 "time" internal time
1307
1307
1308 Note that all sorts on statistics are in descending order (placing
1308 Note that all sorts on statistics are in descending order (placing
1309 most time consuming items first), where as name, file, and line number
1309 most time consuming items first), where as name, file, and line number
1310 searches are in ascending order (i.e., alphabetical). The subtle
1310 searches are in ascending order (i.e., alphabetical). The subtle
1311 distinction between "nfl" and "stdname" is that the standard name is a
1311 distinction between "nfl" and "stdname" is that the standard name is a
1312 sort of the name as printed, which means that the embedded line
1312 sort of the name as printed, which means that the embedded line
1313 numbers get compared in an odd way. For example, lines 3, 20, and 40
1313 numbers get compared in an odd way. For example, lines 3, 20, and 40
1314 would (if the file names were the same) appear in the string order
1314 would (if the file names were the same) appear in the string order
1315 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1315 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1316 line numbers. In fact, sort_stats("nfl") is the same as
1316 line numbers. In fact, sort_stats("nfl") is the same as
1317 sort_stats("name", "file", "line").
1317 sort_stats("name", "file", "line").
1318
1318
1319 -T <filename>: save profile results as shown on screen to a text
1319 -T <filename>: save profile results as shown on screen to a text
1320 file. The profile is still shown on screen.
1320 file. The profile is still shown on screen.
1321
1321
1322 -D <filename>: save (via dump_stats) profile statistics to given
1322 -D <filename>: save (via dump_stats) profile statistics to given
1323 filename. This data is in a format understod by the pstats module, and
1323 filename. This data is in a format understod by the pstats module, and
1324 is generated by a call to the dump_stats() method of profile
1324 is generated by a call to the dump_stats() method of profile
1325 objects. The profile is still shown on screen.
1325 objects. The profile is still shown on screen.
1326
1326
1327 If you want to run complete programs under the profiler's control, use
1327 If you want to run complete programs under the profiler's control, use
1328 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1328 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1329 contains profiler specific options as described here.
1329 contains profiler specific options as described here.
1330
1330
1331 You can read the complete documentation for the profile module with:\\
1331 You can read the complete documentation for the profile module with:\\
1332 In [1]: import profile; profile.help() """
1332 In [1]: import profile; profile.help() """
1333
1333
1334 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1334 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1335 # protect user quote marks
1335 # protect user quote marks
1336 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1336 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1337
1337
1338 if user_mode: # regular user call
1338 if user_mode: # regular user call
1339 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1339 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1340 list_all=1)
1340 list_all=1)
1341 namespace = self.shell.user_ns
1341 namespace = self.shell.user_ns
1342 else: # called to run a program by %run -p
1342 else: # called to run a program by %run -p
1343 try:
1343 try:
1344 filename = get_py_filename(arg_lst[0])
1344 filename = get_py_filename(arg_lst[0])
1345 except IOError,msg:
1345 except IOError,msg:
1346 error(msg)
1346 error(msg)
1347 return
1347 return
1348
1348
1349 arg_str = 'execfile(filename,prog_ns)'
1349 arg_str = 'execfile(filename,prog_ns)'
1350 namespace = locals()
1350 namespace = locals()
1351
1351
1352 opts.merge(opts_def)
1352 opts.merge(opts_def)
1353
1353
1354 prof = profile.Profile()
1354 prof = profile.Profile()
1355 try:
1355 try:
1356 prof = prof.runctx(arg_str,namespace,namespace)
1356 prof = prof.runctx(arg_str,namespace,namespace)
1357 sys_exit = ''
1357 sys_exit = ''
1358 except SystemExit:
1358 except SystemExit:
1359 sys_exit = """*** SystemExit exception caught in code being profiled."""
1359 sys_exit = """*** SystemExit exception caught in code being profiled."""
1360
1360
1361 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1361 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1362
1362
1363 lims = opts.l
1363 lims = opts.l
1364 if lims:
1364 if lims:
1365 lims = [] # rebuild lims with ints/floats/strings
1365 lims = [] # rebuild lims with ints/floats/strings
1366 for lim in opts.l:
1366 for lim in opts.l:
1367 try:
1367 try:
1368 lims.append(int(lim))
1368 lims.append(int(lim))
1369 except ValueError:
1369 except ValueError:
1370 try:
1370 try:
1371 lims.append(float(lim))
1371 lims.append(float(lim))
1372 except ValueError:
1372 except ValueError:
1373 lims.append(lim)
1373 lims.append(lim)
1374
1374
1375 # Trap output.
1375 # Trap output.
1376 stdout_trap = StringIO()
1376 stdout_trap = StringIO()
1377
1377
1378 if hasattr(stats,'stream'):
1378 if hasattr(stats,'stream'):
1379 # In newer versions of python, the stats object has a 'stream'
1379 # In newer versions of python, the stats object has a 'stream'
1380 # attribute to write into.
1380 # attribute to write into.
1381 stats.stream = stdout_trap
1381 stats.stream = stdout_trap
1382 stats.print_stats(*lims)
1382 stats.print_stats(*lims)
1383 else:
1383 else:
1384 # For older versions, we manually redirect stdout during printing
1384 # For older versions, we manually redirect stdout during printing
1385 sys_stdout = sys.stdout
1385 sys_stdout = sys.stdout
1386 try:
1386 try:
1387 sys.stdout = stdout_trap
1387 sys.stdout = stdout_trap
1388 stats.print_stats(*lims)
1388 stats.print_stats(*lims)
1389 finally:
1389 finally:
1390 sys.stdout = sys_stdout
1390 sys.stdout = sys_stdout
1391
1391
1392 output = stdout_trap.getvalue()
1392 output = stdout_trap.getvalue()
1393 output = output.rstrip()
1393 output = output.rstrip()
1394
1394
1395 page(output,screen_lines=self.shell.rc.screen_length)
1395 page(output,screen_lines=self.shell.rc.screen_length)
1396 print sys_exit,
1396 print sys_exit,
1397
1397
1398 dump_file = opts.D[0]
1398 dump_file = opts.D[0]
1399 text_file = opts.T[0]
1399 text_file = opts.T[0]
1400 if dump_file:
1400 if dump_file:
1401 prof.dump_stats(dump_file)
1401 prof.dump_stats(dump_file)
1402 print '\n*** Profile stats marshalled to file',\
1402 print '\n*** Profile stats marshalled to file',\
1403 `dump_file`+'.',sys_exit
1403 `dump_file`+'.',sys_exit
1404 if text_file:
1404 if text_file:
1405 pfile = file(text_file,'w')
1405 pfile = file(text_file,'w')
1406 pfile.write(output)
1406 pfile.write(output)
1407 pfile.close()
1407 pfile.close()
1408 print '\n*** Profile printout saved to text file',\
1408 print '\n*** Profile printout saved to text file',\
1409 `text_file`+'.',sys_exit
1409 `text_file`+'.',sys_exit
1410
1410
1411 if opts.has_key('r'):
1411 if opts.has_key('r'):
1412 return stats
1412 return stats
1413 else:
1413 else:
1414 return None
1414 return None
1415
1415
1416 def magic_run(self, parameter_s ='',runner=None):
1416 def magic_run(self, parameter_s ='',runner=None):
1417 """Run the named file inside IPython as a program.
1417 """Run the named file inside IPython as a program.
1418
1418
1419 Usage:\\
1419 Usage:\\
1420 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1420 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1421
1421
1422 Parameters after the filename are passed as command-line arguments to
1422 Parameters after the filename are passed as command-line arguments to
1423 the program (put in sys.argv). Then, control returns to IPython's
1423 the program (put in sys.argv). Then, control returns to IPython's
1424 prompt.
1424 prompt.
1425
1425
1426 This is similar to running at a system prompt:\\
1426 This is similar to running at a system prompt:\\
1427 $ python file args\\
1427 $ python file args\\
1428 but with the advantage of giving you IPython's tracebacks, and of
1428 but with the advantage of giving you IPython's tracebacks, and of
1429 loading all variables into your interactive namespace for further use
1429 loading all variables into your interactive namespace for further use
1430 (unless -p is used, see below).
1430 (unless -p is used, see below).
1431
1431
1432 The file is executed in a namespace initially consisting only of
1432 The file is executed in a namespace initially consisting only of
1433 __name__=='__main__' and sys.argv constructed as indicated. It thus
1433 __name__=='__main__' and sys.argv constructed as indicated. It thus
1434 sees its environment as if it were being run as a stand-alone program
1434 sees its environment as if it were being run as a stand-alone program
1435 (except for sharing global objects such as previously imported
1435 (except for sharing global objects such as previously imported
1436 modules). But after execution, the IPython interactive namespace gets
1436 modules). But after execution, the IPython interactive namespace gets
1437 updated with all variables defined in the program (except for __name__
1437 updated with all variables defined in the program (except for __name__
1438 and sys.argv). This allows for very convenient loading of code for
1438 and sys.argv). This allows for very convenient loading of code for
1439 interactive work, while giving each program a 'clean sheet' to run in.
1439 interactive work, while giving each program a 'clean sheet' to run in.
1440
1440
1441 Options:
1441 Options:
1442
1442
1443 -n: __name__ is NOT set to '__main__', but to the running file's name
1443 -n: __name__ is NOT set to '__main__', but to the running file's name
1444 without extension (as python does under import). This allows running
1444 without extension (as python does under import). This allows running
1445 scripts and reloading the definitions in them without calling code
1445 scripts and reloading the definitions in them without calling code
1446 protected by an ' if __name__ == "__main__" ' clause.
1446 protected by an ' if __name__ == "__main__" ' clause.
1447
1447
1448 -i: run the file in IPython's namespace instead of an empty one. This
1448 -i: run the file in IPython's namespace instead of an empty one. This
1449 is useful if you are experimenting with code written in a text editor
1449 is useful if you are experimenting with code written in a text editor
1450 which depends on variables defined interactively.
1450 which depends on variables defined interactively.
1451
1451
1452 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1452 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1453 being run. This is particularly useful if IPython is being used to
1453 being run. This is particularly useful if IPython is being used to
1454 run unittests, which always exit with a sys.exit() call. In such
1454 run unittests, which always exit with a sys.exit() call. In such
1455 cases you are interested in the output of the test results, not in
1455 cases you are interested in the output of the test results, not in
1456 seeing a traceback of the unittest module.
1456 seeing a traceback of the unittest module.
1457
1457
1458 -t: print timing information at the end of the run. IPython will give
1458 -t: print timing information at the end of the run. IPython will give
1459 you an estimated CPU time consumption for your script, which under
1459 you an estimated CPU time consumption for your script, which under
1460 Unix uses the resource module to avoid the wraparound problems of
1460 Unix uses the resource module to avoid the wraparound problems of
1461 time.clock(). Under Unix, an estimate of time spent on system tasks
1461 time.clock(). Under Unix, an estimate of time spent on system tasks
1462 is also given (for Windows platforms this is reported as 0.0).
1462 is also given (for Windows platforms this is reported as 0.0).
1463
1463
1464 If -t is given, an additional -N<N> option can be given, where <N>
1464 If -t is given, an additional -N<N> option can be given, where <N>
1465 must be an integer indicating how many times you want the script to
1465 must be an integer indicating how many times you want the script to
1466 run. The final timing report will include total and per run results.
1466 run. The final timing report will include total and per run results.
1467
1467
1468 For example (testing the script uniq_stable.py):
1468 For example (testing the script uniq_stable.py):
1469
1469
1470 In [1]: run -t uniq_stable
1470 In [1]: run -t uniq_stable
1471
1471
1472 IPython CPU timings (estimated):\\
1472 IPython CPU timings (estimated):\\
1473 User : 0.19597 s.\\
1473 User : 0.19597 s.\\
1474 System: 0.0 s.\\
1474 System: 0.0 s.\\
1475
1475
1476 In [2]: run -t -N5 uniq_stable
1476 In [2]: run -t -N5 uniq_stable
1477
1477
1478 IPython CPU timings (estimated):\\
1478 IPython CPU timings (estimated):\\
1479 Total runs performed: 5\\
1479 Total runs performed: 5\\
1480 Times : Total Per run\\
1480 Times : Total Per run\\
1481 User : 0.910862 s, 0.1821724 s.\\
1481 User : 0.910862 s, 0.1821724 s.\\
1482 System: 0.0 s, 0.0 s.
1482 System: 0.0 s, 0.0 s.
1483
1483
1484 -d: run your program under the control of pdb, the Python debugger.
1484 -d: run your program under the control of pdb, the Python debugger.
1485 This allows you to execute your program step by step, watch variables,
1485 This allows you to execute your program step by step, watch variables,
1486 etc. Internally, what IPython does is similar to calling:
1486 etc. Internally, what IPython does is similar to calling:
1487
1487
1488 pdb.run('execfile("YOURFILENAME")')
1488 pdb.run('execfile("YOURFILENAME")')
1489
1489
1490 with a breakpoint set on line 1 of your file. You can change the line
1490 with a breakpoint set on line 1 of your file. You can change the line
1491 number for this automatic breakpoint to be <N> by using the -bN option
1491 number for this automatic breakpoint to be <N> by using the -bN option
1492 (where N must be an integer). For example:
1492 (where N must be an integer). For example:
1493
1493
1494 %run -d -b40 myscript
1494 %run -d -b40 myscript
1495
1495
1496 will set the first breakpoint at line 40 in myscript.py. Note that
1496 will set the first breakpoint at line 40 in myscript.py. Note that
1497 the first breakpoint must be set on a line which actually does
1497 the first breakpoint must be set on a line which actually does
1498 something (not a comment or docstring) for it to stop execution.
1498 something (not a comment or docstring) for it to stop execution.
1499
1499
1500 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1500 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1501 first enter 'c' (without qoutes) to start execution up to the first
1501 first enter 'c' (without qoutes) to start execution up to the first
1502 breakpoint.
1502 breakpoint.
1503
1503
1504 Entering 'help' gives information about the use of the debugger. You
1504 Entering 'help' gives information about the use of the debugger. You
1505 can easily see pdb's full documentation with "import pdb;pdb.help()"
1505 can easily see pdb's full documentation with "import pdb;pdb.help()"
1506 at a prompt.
1506 at a prompt.
1507
1507
1508 -p: run program under the control of the Python profiler module (which
1508 -p: run program under the control of the Python profiler module (which
1509 prints a detailed report of execution times, function calls, etc).
1509 prints a detailed report of execution times, function calls, etc).
1510
1510
1511 You can pass other options after -p which affect the behavior of the
1511 You can pass other options after -p which affect the behavior of the
1512 profiler itself. See the docs for %prun for details.
1512 profiler itself. See the docs for %prun for details.
1513
1513
1514 In this mode, the program's variables do NOT propagate back to the
1514 In this mode, the program's variables do NOT propagate back to the
1515 IPython interactive namespace (because they remain in the namespace
1515 IPython interactive namespace (because they remain in the namespace
1516 where the profiler executes them).
1516 where the profiler executes them).
1517
1517
1518 Internally this triggers a call to %prun, see its documentation for
1518 Internally this triggers a call to %prun, see its documentation for
1519 details on the options available specifically for profiling.
1519 details on the options available specifically for profiling.
1520
1520
1521 There is one special usage for which the text above doesn't apply:
1521 There is one special usage for which the text above doesn't apply:
1522 if the filename ends with .ipy, the file is run as ipython script,
1522 if the filename ends with .ipy, the file is run as ipython script,
1523 just as if the commands were written on IPython prompt.
1523 just as if the commands were written on IPython prompt.
1524 """
1524 """
1525
1525
1526 # get arguments and set sys.argv for program to be run.
1526 # get arguments and set sys.argv for program to be run.
1527 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1527 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1528 mode='list',list_all=1)
1528 mode='list',list_all=1)
1529
1529
1530 try:
1530 try:
1531 filename = get_py_filename(arg_lst[0])
1531 filename = get_py_filename(arg_lst[0])
1532 except IndexError:
1532 except IndexError:
1533 warn('you must provide at least a filename.')
1533 warn('you must provide at least a filename.')
1534 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1534 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1535 return
1535 return
1536 except IOError,msg:
1536 except IOError,msg:
1537 error(msg)
1537 error(msg)
1538 return
1538 return
1539
1539
1540 if filename.lower().endswith('.ipy'):
1540 if filename.lower().endswith('.ipy'):
1541 self.api.runlines(open(filename).read())
1541 self.api.runlines(open(filename).read())
1542 return
1542 return
1543
1543
1544 # Control the response to exit() calls made by the script being run
1544 # Control the response to exit() calls made by the script being run
1545 exit_ignore = opts.has_key('e')
1545 exit_ignore = opts.has_key('e')
1546
1546
1547 # Make sure that the running script gets a proper sys.argv as if it
1547 # Make sure that the running script gets a proper sys.argv as if it
1548 # were run from a system shell.
1548 # were run from a system shell.
1549 save_argv = sys.argv # save it for later restoring
1549 save_argv = sys.argv # save it for later restoring
1550 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1550 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1551
1551
1552 if opts.has_key('i'):
1552 if opts.has_key('i'):
1553 # Run in user's interactive namespace
1553 # Run in user's interactive namespace
1554 prog_ns = self.shell.user_ns
1554 prog_ns = self.shell.user_ns
1555 __name__save = self.shell.user_ns['__name__']
1555 __name__save = self.shell.user_ns['__name__']
1556 prog_ns['__name__'] = '__main__'
1556 prog_ns['__name__'] = '__main__'
1557 main_mod = FakeModule(prog_ns)
1557 main_mod = FakeModule(prog_ns)
1558 else:
1558 else:
1559 # Run in a fresh, empty namespace
1559 # Run in a fresh, empty namespace
1560 if opts.has_key('n'):
1560 if opts.has_key('n'):
1561 name = os.path.splitext(os.path.basename(filename))[0]
1561 name = os.path.splitext(os.path.basename(filename))[0]
1562 else:
1562 else:
1563 name = '__main__'
1563 name = '__main__'
1564 main_mod = FakeModule()
1564 main_mod = FakeModule()
1565 prog_ns = main_mod.__dict__
1565 prog_ns = main_mod.__dict__
1566 prog_ns['__name__'] = name
1566 prog_ns['__name__'] = name
1567 # The shell MUST hold a reference to main_mod so after %run exits,
1567 # The shell MUST hold a reference to main_mod so after %run exits,
1568 # the python deletion mechanism doesn't zero it out (leaving
1568 # the python deletion mechanism doesn't zero it out (leaving
1569 # dangling references)
1569 # dangling references)
1570 self.shell._user_main_modules.append(main_mod)
1570 self.shell._user_main_modules.append(main_mod)
1571
1571
1572 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1572 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1573 # set the __file__ global in the script's namespace
1573 # set the __file__ global in the script's namespace
1574 prog_ns['__file__'] = filename
1574 prog_ns['__file__'] = filename
1575
1575
1576 # pickle fix. See iplib for an explanation. But we need to make sure
1576 # pickle fix. See iplib for an explanation. But we need to make sure
1577 # that, if we overwrite __main__, we replace it at the end
1577 # that, if we overwrite __main__, we replace it at the end
1578 if prog_ns['__name__'] == '__main__':
1578 if prog_ns['__name__'] == '__main__':
1579 restore_main = sys.modules['__main__']
1579 restore_main = sys.modules['__main__']
1580 else:
1580 else:
1581 restore_main = False
1581 restore_main = False
1582
1582
1583 sys.modules[prog_ns['__name__']] = main_mod
1583 sys.modules[prog_ns['__name__']] = main_mod
1584
1584
1585 stats = None
1585 stats = None
1586 try:
1586 try:
1587 self.shell.savehist()
1587 self.shell.savehist()
1588
1588
1589 if opts.has_key('p'):
1589 if opts.has_key('p'):
1590 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1590 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1591 else:
1591 else:
1592 if opts.has_key('d'):
1592 if opts.has_key('d'):
1593 deb = Debugger.Pdb(self.shell.rc.colors)
1593 deb = Debugger.Pdb(self.shell.rc.colors)
1594 # reset Breakpoint state, which is moronically kept
1594 # reset Breakpoint state, which is moronically kept
1595 # in a class
1595 # in a class
1596 bdb.Breakpoint.next = 1
1596 bdb.Breakpoint.next = 1
1597 bdb.Breakpoint.bplist = {}
1597 bdb.Breakpoint.bplist = {}
1598 bdb.Breakpoint.bpbynumber = [None]
1598 bdb.Breakpoint.bpbynumber = [None]
1599 # Set an initial breakpoint to stop execution
1599 # Set an initial breakpoint to stop execution
1600 maxtries = 10
1600 maxtries = 10
1601 bp = int(opts.get('b',[1])[0])
1601 bp = int(opts.get('b',[1])[0])
1602 checkline = deb.checkline(filename,bp)
1602 checkline = deb.checkline(filename,bp)
1603 if not checkline:
1603 if not checkline:
1604 for bp in range(bp+1,bp+maxtries+1):
1604 for bp in range(bp+1,bp+maxtries+1):
1605 if deb.checkline(filename,bp):
1605 if deb.checkline(filename,bp):
1606 break
1606 break
1607 else:
1607 else:
1608 msg = ("\nI failed to find a valid line to set "
1608 msg = ("\nI failed to find a valid line to set "
1609 "a breakpoint\n"
1609 "a breakpoint\n"
1610 "after trying up to line: %s.\n"
1610 "after trying up to line: %s.\n"
1611 "Please set a valid breakpoint manually "
1611 "Please set a valid breakpoint manually "
1612 "with the -b option." % bp)
1612 "with the -b option." % bp)
1613 error(msg)
1613 error(msg)
1614 return
1614 return
1615 # if we find a good linenumber, set the breakpoint
1615 # if we find a good linenumber, set the breakpoint
1616 deb.do_break('%s:%s' % (filename,bp))
1616 deb.do_break('%s:%s' % (filename,bp))
1617 # Start file run
1617 # Start file run
1618 print "NOTE: Enter 'c' at the",
1618 print "NOTE: Enter 'c' at the",
1619 print "%s prompt to start your script." % deb.prompt
1619 print "%s prompt to start your script." % deb.prompt
1620 try:
1620 try:
1621 deb.run('execfile("%s")' % filename,prog_ns)
1621 deb.run('execfile("%s")' % filename,prog_ns)
1622
1622
1623 except:
1623 except:
1624 etype, value, tb = sys.exc_info()
1624 etype, value, tb = sys.exc_info()
1625 # Skip three frames in the traceback: the %run one,
1625 # Skip three frames in the traceback: the %run one,
1626 # one inside bdb.py, and the command-line typed by the
1626 # one inside bdb.py, and the command-line typed by the
1627 # user (run by exec in pdb itself).
1627 # user (run by exec in pdb itself).
1628 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1628 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1629 else:
1629 else:
1630 if runner is None:
1630 if runner is None:
1631 runner = self.shell.safe_execfile
1631 runner = self.shell.safe_execfile
1632 if opts.has_key('t'):
1632 if opts.has_key('t'):
1633 # timed execution
1633 # timed execution
1634 try:
1634 try:
1635 nruns = int(opts['N'][0])
1635 nruns = int(opts['N'][0])
1636 if nruns < 1:
1636 if nruns < 1:
1637 error('Number of runs must be >=1')
1637 error('Number of runs must be >=1')
1638 return
1638 return
1639 except (KeyError):
1639 except (KeyError):
1640 nruns = 1
1640 nruns = 1
1641 if nruns == 1:
1641 if nruns == 1:
1642 t0 = clock2()
1642 t0 = clock2()
1643 runner(filename,prog_ns,prog_ns,
1643 runner(filename,prog_ns,prog_ns,
1644 exit_ignore=exit_ignore)
1644 exit_ignore=exit_ignore)
1645 t1 = clock2()
1645 t1 = clock2()
1646 t_usr = t1[0]-t0[0]
1646 t_usr = t1[0]-t0[0]
1647 t_sys = t1[1]-t1[1]
1647 t_sys = t1[1]-t1[1]
1648 print "\nIPython CPU timings (estimated):"
1648 print "\nIPython CPU timings (estimated):"
1649 print " User : %10s s." % t_usr
1649 print " User : %10s s." % t_usr
1650 print " System: %10s s." % t_sys
1650 print " System: %10s s." % t_sys
1651 else:
1651 else:
1652 runs = range(nruns)
1652 runs = range(nruns)
1653 t0 = clock2()
1653 t0 = clock2()
1654 for nr in runs:
1654 for nr in runs:
1655 runner(filename,prog_ns,prog_ns,
1655 runner(filename,prog_ns,prog_ns,
1656 exit_ignore=exit_ignore)
1656 exit_ignore=exit_ignore)
1657 t1 = clock2()
1657 t1 = clock2()
1658 t_usr = t1[0]-t0[0]
1658 t_usr = t1[0]-t0[0]
1659 t_sys = t1[1]-t1[1]
1659 t_sys = t1[1]-t1[1]
1660 print "\nIPython CPU timings (estimated):"
1660 print "\nIPython CPU timings (estimated):"
1661 print "Total runs performed:",nruns
1661 print "Total runs performed:",nruns
1662 print " Times : %10s %10s" % ('Total','Per run')
1662 print " Times : %10s %10s" % ('Total','Per run')
1663 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1663 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1664 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1664 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1665
1665
1666 else:
1666 else:
1667 # regular execution
1667 # regular execution
1668 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1668 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1669 if opts.has_key('i'):
1669 if opts.has_key('i'):
1670 self.shell.user_ns['__name__'] = __name__save
1670 self.shell.user_ns['__name__'] = __name__save
1671 else:
1671 else:
1672 # update IPython interactive namespace
1672 # update IPython interactive namespace
1673 del prog_ns['__name__']
1673 del prog_ns['__name__']
1674 self.shell.user_ns.update(prog_ns)
1674 self.shell.user_ns.update(prog_ns)
1675 finally:
1675 finally:
1676 sys.argv = save_argv
1676 sys.argv = save_argv
1677 if restore_main:
1677 if restore_main:
1678 sys.modules['__main__'] = restore_main
1678 sys.modules['__main__'] = restore_main
1679 self.shell.reloadhist()
1679 self.shell.reloadhist()
1680
1680
1681 return stats
1681 return stats
1682
1682
1683 def magic_runlog(self, parameter_s =''):
1683 def magic_runlog(self, parameter_s =''):
1684 """Run files as logs.
1684 """Run files as logs.
1685
1685
1686 Usage:\\
1686 Usage:\\
1687 %runlog file1 file2 ...
1687 %runlog file1 file2 ...
1688
1688
1689 Run the named files (treating them as log files) in sequence inside
1689 Run the named files (treating them as log files) in sequence inside
1690 the interpreter, and return to the prompt. This is much slower than
1690 the interpreter, and return to the prompt. This is much slower than
1691 %run because each line is executed in a try/except block, but it
1691 %run because each line is executed in a try/except block, but it
1692 allows running files with syntax errors in them.
1692 allows running files with syntax errors in them.
1693
1693
1694 Normally IPython will guess when a file is one of its own logfiles, so
1694 Normally IPython will guess when a file is one of its own logfiles, so
1695 you can typically use %run even for logs. This shorthand allows you to
1695 you can typically use %run even for logs. This shorthand allows you to
1696 force any file to be treated as a log file."""
1696 force any file to be treated as a log file."""
1697
1697
1698 for f in parameter_s.split():
1698 for f in parameter_s.split():
1699 self.shell.safe_execfile(f,self.shell.user_ns,
1699 self.shell.safe_execfile(f,self.shell.user_ns,
1700 self.shell.user_ns,islog=1)
1700 self.shell.user_ns,islog=1)
1701
1701
1702 def magic_timeit(self, parameter_s =''):
1702 def magic_timeit(self, parameter_s =''):
1703 """Time execution of a Python statement or expression
1703 """Time execution of a Python statement or expression
1704
1704
1705 Usage:\\
1705 Usage:\\
1706 %timeit [-n<N> -r<R> [-t|-c]] statement
1706 %timeit [-n<N> -r<R> [-t|-c]] statement
1707
1707
1708 Time execution of a Python statement or expression using the timeit
1708 Time execution of a Python statement or expression using the timeit
1709 module.
1709 module.
1710
1710
1711 Options:
1711 Options:
1712 -n<N>: execute the given statement <N> times in a loop. If this value
1712 -n<N>: execute the given statement <N> times in a loop. If this value
1713 is not given, a fitting value is chosen.
1713 is not given, a fitting value is chosen.
1714
1714
1715 -r<R>: repeat the loop iteration <R> times and take the best result.
1715 -r<R>: repeat the loop iteration <R> times and take the best result.
1716 Default: 3
1716 Default: 3
1717
1717
1718 -t: use time.time to measure the time, which is the default on Unix.
1718 -t: use time.time to measure the time, which is the default on Unix.
1719 This function measures wall time.
1719 This function measures wall time.
1720
1720
1721 -c: use time.clock to measure the time, which is the default on
1721 -c: use time.clock to measure the time, which is the default on
1722 Windows and measures wall time. On Unix, resource.getrusage is used
1722 Windows and measures wall time. On Unix, resource.getrusage is used
1723 instead and returns the CPU user time.
1723 instead and returns the CPU user time.
1724
1724
1725 -p<P>: use a precision of <P> digits to display the timing result.
1725 -p<P>: use a precision of <P> digits to display the timing result.
1726 Default: 3
1726 Default: 3
1727
1727
1728
1728
1729 Examples:\\
1729 Examples:\\
1730 In [1]: %timeit pass
1730 In [1]: %timeit pass
1731 10000000 loops, best of 3: 53.3 ns per loop
1731 10000000 loops, best of 3: 53.3 ns per loop
1732
1732
1733 In [2]: u = None
1733 In [2]: u = None
1734
1734
1735 In [3]: %timeit u is None
1735 In [3]: %timeit u is None
1736 10000000 loops, best of 3: 184 ns per loop
1736 10000000 loops, best of 3: 184 ns per loop
1737
1737
1738 In [4]: %timeit -r 4 u == None
1738 In [4]: %timeit -r 4 u == None
1739 1000000 loops, best of 4: 242 ns per loop
1739 1000000 loops, best of 4: 242 ns per loop
1740
1740
1741 In [5]: import time
1741 In [5]: import time
1742
1742
1743 In [6]: %timeit -n1 time.sleep(2)
1743 In [6]: %timeit -n1 time.sleep(2)
1744 1 loops, best of 3: 2 s per loop
1744 1 loops, best of 3: 2 s per loop
1745
1745
1746
1746
1747 The times reported by %timeit will be slightly higher than those
1747 The times reported by %timeit will be slightly higher than those
1748 reported by the timeit.py script when variables are accessed. This is
1748 reported by the timeit.py script when variables are accessed. This is
1749 due to the fact that %timeit executes the statement in the namespace
1749 due to the fact that %timeit executes the statement in the namespace
1750 of the shell, compared with timeit.py, which uses a single setup
1750 of the shell, compared with timeit.py, which uses a single setup
1751 statement to import function or create variables. Generally, the bias
1751 statement to import function or create variables. Generally, the bias
1752 does not matter as long as results from timeit.py are not mixed with
1752 does not matter as long as results from timeit.py are not mixed with
1753 those from %timeit."""
1753 those from %timeit."""
1754
1754
1755 import timeit
1755 import timeit
1756 import math
1756 import math
1757
1757
1758 units = ["s", "ms", "\xc2\xb5s", "ns"]
1758 units = ["s", "ms", "\xc2\xb5s", "ns"]
1759 scaling = [1, 1e3, 1e6, 1e9]
1759 scaling = [1, 1e3, 1e6, 1e9]
1760
1760
1761 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1761 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1762 posix=False)
1762 posix=False)
1763 if stmt == "":
1763 if stmt == "":
1764 return
1764 return
1765 timefunc = timeit.default_timer
1765 timefunc = timeit.default_timer
1766 number = int(getattr(opts, "n", 0))
1766 number = int(getattr(opts, "n", 0))
1767 repeat = int(getattr(opts, "r", timeit.default_repeat))
1767 repeat = int(getattr(opts, "r", timeit.default_repeat))
1768 precision = int(getattr(opts, "p", 3))
1768 precision = int(getattr(opts, "p", 3))
1769 if hasattr(opts, "t"):
1769 if hasattr(opts, "t"):
1770 timefunc = time.time
1770 timefunc = time.time
1771 if hasattr(opts, "c"):
1771 if hasattr(opts, "c"):
1772 timefunc = clock
1772 timefunc = clock
1773
1773
1774 timer = timeit.Timer(timer=timefunc)
1774 timer = timeit.Timer(timer=timefunc)
1775 # this code has tight coupling to the inner workings of timeit.Timer,
1775 # this code has tight coupling to the inner workings of timeit.Timer,
1776 # but is there a better way to achieve that the code stmt has access
1776 # but is there a better way to achieve that the code stmt has access
1777 # to the shell namespace?
1777 # to the shell namespace?
1778
1778
1779 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1779 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1780 'setup': "pass"}
1780 'setup': "pass"}
1781 # Track compilation time so it can be reported if too long
1781 # Track compilation time so it can be reported if too long
1782 # Minimum time above which compilation time will be reported
1782 # Minimum time above which compilation time will be reported
1783 tc_min = 0.1
1783 tc_min = 0.1
1784
1784
1785 t0 = clock()
1785 t0 = clock()
1786 code = compile(src, "<magic-timeit>", "exec")
1786 code = compile(src, "<magic-timeit>", "exec")
1787 tc = clock()-t0
1787 tc = clock()-t0
1788
1788
1789 ns = {}
1789 ns = {}
1790 exec code in self.shell.user_ns, ns
1790 exec code in self.shell.user_ns, ns
1791 timer.inner = ns["inner"]
1791 timer.inner = ns["inner"]
1792
1792
1793 if number == 0:
1793 if number == 0:
1794 # determine number so that 0.2 <= total time < 2.0
1794 # determine number so that 0.2 <= total time < 2.0
1795 number = 1
1795 number = 1
1796 for i in range(1, 10):
1796 for i in range(1, 10):
1797 number *= 10
1797 number *= 10
1798 if timer.timeit(number) >= 0.2:
1798 if timer.timeit(number) >= 0.2:
1799 break
1799 break
1800
1800
1801 best = min(timer.repeat(repeat, number)) / number
1801 best = min(timer.repeat(repeat, number)) / number
1802
1802
1803 if best > 0.0:
1803 if best > 0.0:
1804 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1804 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1805 else:
1805 else:
1806 order = 3
1806 order = 3
1807 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1807 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1808 precision,
1808 precision,
1809 best * scaling[order],
1809 best * scaling[order],
1810 units[order])
1810 units[order])
1811 if tc > tc_min:
1811 if tc > tc_min:
1812 print "Compiler time: %.2f s" % tc
1812 print "Compiler time: %.2f s" % tc
1813
1813
1814 def magic_time(self,parameter_s = ''):
1814 def magic_time(self,parameter_s = ''):
1815 """Time execution of a Python statement or expression.
1815 """Time execution of a Python statement or expression.
1816
1816
1817 The CPU and wall clock times are printed, and the value of the
1817 The CPU and wall clock times are printed, and the value of the
1818 expression (if any) is returned. Note that under Win32, system time
1818 expression (if any) is returned. Note that under Win32, system time
1819 is always reported as 0, since it can not be measured.
1819 is always reported as 0, since it can not be measured.
1820
1820
1821 This function provides very basic timing functionality. In Python
1821 This function provides very basic timing functionality. In Python
1822 2.3, the timeit module offers more control and sophistication, so this
1822 2.3, the timeit module offers more control and sophistication, so this
1823 could be rewritten to use it (patches welcome).
1823 could be rewritten to use it (patches welcome).
1824
1824
1825 Some examples:
1825 Some examples:
1826
1826
1827 In [1]: time 2**128
1827 In [1]: time 2**128
1828 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1828 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1829 Wall time: 0.00
1829 Wall time: 0.00
1830 Out[1]: 340282366920938463463374607431768211456L
1830 Out[1]: 340282366920938463463374607431768211456L
1831
1831
1832 In [2]: n = 1000000
1832 In [2]: n = 1000000
1833
1833
1834 In [3]: time sum(range(n))
1834 In [3]: time sum(range(n))
1835 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1835 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1836 Wall time: 1.37
1836 Wall time: 1.37
1837 Out[3]: 499999500000L
1837 Out[3]: 499999500000L
1838
1838
1839 In [4]: time print 'hello world'
1839 In [4]: time print 'hello world'
1840 hello world
1840 hello world
1841 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1841 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1842 Wall time: 0.00
1842 Wall time: 0.00
1843
1843
1844 Note that the time needed by Python to compile the given expression
1844 Note that the time needed by Python to compile the given expression
1845 will be reported if it is more than 0.1s. In this example, the
1845 will be reported if it is more than 0.1s. In this example, the
1846 actual exponentiation is done by Python at compilation time, so while
1846 actual exponentiation is done by Python at compilation time, so while
1847 the expression can take a noticeable amount of time to compute, that
1847 the expression can take a noticeable amount of time to compute, that
1848 time is purely due to the compilation:
1848 time is purely due to the compilation:
1849
1849
1850 In [5]: time 3**9999;
1850 In [5]: time 3**9999;
1851 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1851 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1852 Wall time: 0.00 s
1852 Wall time: 0.00 s
1853
1853
1854 In [6]: time 3**999999;
1854 In [6]: time 3**999999;
1855 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1855 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1856 Wall time: 0.00 s
1856 Wall time: 0.00 s
1857 Compiler : 0.78 s
1857 Compiler : 0.78 s
1858 """
1858 """
1859
1859
1860 # fail immediately if the given expression can't be compiled
1860 # fail immediately if the given expression can't be compiled
1861
1861
1862 expr = self.shell.prefilter(parameter_s,False)
1862 expr = self.shell.prefilter(parameter_s,False)
1863
1863
1864 # Minimum time above which compilation time will be reported
1864 # Minimum time above which compilation time will be reported
1865 tc_min = 0.1
1865 tc_min = 0.1
1866
1866
1867 try:
1867 try:
1868 mode = 'eval'
1868 mode = 'eval'
1869 t0 = clock()
1869 t0 = clock()
1870 code = compile(expr,'<timed eval>',mode)
1870 code = compile(expr,'<timed eval>',mode)
1871 tc = clock()-t0
1871 tc = clock()-t0
1872 except SyntaxError:
1872 except SyntaxError:
1873 mode = 'exec'
1873 mode = 'exec'
1874 t0 = clock()
1874 t0 = clock()
1875 code = compile(expr,'<timed exec>',mode)
1875 code = compile(expr,'<timed exec>',mode)
1876 tc = clock()-t0
1876 tc = clock()-t0
1877 # skew measurement as little as possible
1877 # skew measurement as little as possible
1878 glob = self.shell.user_ns
1878 glob = self.shell.user_ns
1879 clk = clock2
1879 clk = clock2
1880 wtime = time.time
1880 wtime = time.time
1881 # time execution
1881 # time execution
1882 wall_st = wtime()
1882 wall_st = wtime()
1883 if mode=='eval':
1883 if mode=='eval':
1884 st = clk()
1884 st = clk()
1885 out = eval(code,glob)
1885 out = eval(code,glob)
1886 end = clk()
1886 end = clk()
1887 else:
1887 else:
1888 st = clk()
1888 st = clk()
1889 exec code in glob
1889 exec code in glob
1890 end = clk()
1890 end = clk()
1891 out = None
1891 out = None
1892 wall_end = wtime()
1892 wall_end = wtime()
1893 # Compute actual times and report
1893 # Compute actual times and report
1894 wall_time = wall_end-wall_st
1894 wall_time = wall_end-wall_st
1895 cpu_user = end[0]-st[0]
1895 cpu_user = end[0]-st[0]
1896 cpu_sys = end[1]-st[1]
1896 cpu_sys = end[1]-st[1]
1897 cpu_tot = cpu_user+cpu_sys
1897 cpu_tot = cpu_user+cpu_sys
1898 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1898 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1899 (cpu_user,cpu_sys,cpu_tot)
1899 (cpu_user,cpu_sys,cpu_tot)
1900 print "Wall time: %.2f s" % wall_time
1900 print "Wall time: %.2f s" % wall_time
1901 if tc > tc_min:
1901 if tc > tc_min:
1902 print "Compiler : %.2f s" % tc
1902 print "Compiler : %.2f s" % tc
1903 return out
1903 return out
1904
1904
1905 def magic_macro(self,parameter_s = ''):
1905 def magic_macro(self,parameter_s = ''):
1906 """Define a set of input lines as a macro for future re-execution.
1906 """Define a set of input lines as a macro for future re-execution.
1907
1907
1908 Usage:\\
1908 Usage:\\
1909 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1909 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1910
1910
1911 Options:
1911 Options:
1912
1912
1913 -r: use 'raw' input. By default, the 'processed' history is used,
1913 -r: use 'raw' input. By default, the 'processed' history is used,
1914 so that magics are loaded in their transformed version to valid
1914 so that magics are loaded in their transformed version to valid
1915 Python. If this option is given, the raw input as typed as the
1915 Python. If this option is given, the raw input as typed as the
1916 command line is used instead.
1916 command line is used instead.
1917
1917
1918 This will define a global variable called `name` which is a string
1918 This will define a global variable called `name` which is a string
1919 made of joining the slices and lines you specify (n1,n2,... numbers
1919 made of joining the slices and lines you specify (n1,n2,... numbers
1920 above) from your input history into a single string. This variable
1920 above) from your input history into a single string. This variable
1921 acts like an automatic function which re-executes those lines as if
1921 acts like an automatic function which re-executes those lines as if
1922 you had typed them. You just type 'name' at the prompt and the code
1922 you had typed them. You just type 'name' at the prompt and the code
1923 executes.
1923 executes.
1924
1924
1925 The notation for indicating number ranges is: n1-n2 means 'use line
1925 The notation for indicating number ranges is: n1-n2 means 'use line
1926 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1926 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1927 using the lines numbered 5,6 and 7.
1927 using the lines numbered 5,6 and 7.
1928
1928
1929 Note: as a 'hidden' feature, you can also use traditional python slice
1929 Note: as a 'hidden' feature, you can also use traditional python slice
1930 notation, where N:M means numbers N through M-1.
1930 notation, where N:M means numbers N through M-1.
1931
1931
1932 For example, if your history contains (%hist prints it):
1932 For example, if your history contains (%hist prints it):
1933
1933
1934 44: x=1\\
1934 44: x=1\\
1935 45: y=3\\
1935 45: y=3\\
1936 46: z=x+y\\
1936 46: z=x+y\\
1937 47: print x\\
1937 47: print x\\
1938 48: a=5\\
1938 48: a=5\\
1939 49: print 'x',x,'y',y\\
1939 49: print 'x',x,'y',y\\
1940
1940
1941 you can create a macro with lines 44 through 47 (included) and line 49
1941 you can create a macro with lines 44 through 47 (included) and line 49
1942 called my_macro with:
1942 called my_macro with:
1943
1943
1944 In [51]: %macro my_macro 44-47 49
1944 In [51]: %macro my_macro 44-47 49
1945
1945
1946 Now, typing `my_macro` (without quotes) will re-execute all this code
1946 Now, typing `my_macro` (without quotes) will re-execute all this code
1947 in one pass.
1947 in one pass.
1948
1948
1949 You don't need to give the line-numbers in order, and any given line
1949 You don't need to give the line-numbers in order, and any given line
1950 number can appear multiple times. You can assemble macros with any
1950 number can appear multiple times. You can assemble macros with any
1951 lines from your input history in any order.
1951 lines from your input history in any order.
1952
1952
1953 The macro is a simple object which holds its value in an attribute,
1953 The macro is a simple object which holds its value in an attribute,
1954 but IPython's display system checks for macros and executes them as
1954 but IPython's display system checks for macros and executes them as
1955 code instead of printing them when you type their name.
1955 code instead of printing them when you type their name.
1956
1956
1957 You can view a macro's contents by explicitly printing it with:
1957 You can view a macro's contents by explicitly printing it with:
1958
1958
1959 'print macro_name'.
1959 'print macro_name'.
1960
1960
1961 For one-off cases which DON'T contain magic function calls in them you
1961 For one-off cases which DON'T contain magic function calls in them you
1962 can obtain similar results by explicitly executing slices from your
1962 can obtain similar results by explicitly executing slices from your
1963 input history with:
1963 input history with:
1964
1964
1965 In [60]: exec In[44:48]+In[49]"""
1965 In [60]: exec In[44:48]+In[49]"""
1966
1966
1967 opts,args = self.parse_options(parameter_s,'r',mode='list')
1967 opts,args = self.parse_options(parameter_s,'r',mode='list')
1968 if not args:
1968 if not args:
1969 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1969 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1970 macs.sort()
1970 macs.sort()
1971 return macs
1971 return macs
1972 if len(args) == 1:
1972 if len(args) == 1:
1973 raise UsageError(
1973 raise UsageError(
1974 "%macro insufficient args; usage '%macro name n1-n2 n3-4...")
1974 "%macro insufficient args; usage '%macro name n1-n2 n3-4...")
1975 name,ranges = args[0], args[1:]
1975 name,ranges = args[0], args[1:]
1976
1976
1977 #print 'rng',ranges # dbg
1977 #print 'rng',ranges # dbg
1978 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1978 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1979 macro = Macro(lines)
1979 macro = Macro(lines)
1980 self.shell.user_ns.update({name:macro})
1980 self.shell.user_ns.update({name:macro})
1981 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1981 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1982 print 'Macro contents:'
1982 print 'Macro contents:'
1983 print macro,
1983 print macro,
1984
1984
1985 def magic_save(self,parameter_s = ''):
1985 def magic_save(self,parameter_s = ''):
1986 """Save a set of lines to a given filename.
1986 """Save a set of lines to a given filename.
1987
1987
1988 Usage:\\
1988 Usage:\\
1989 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1989 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1990
1990
1991 Options:
1991 Options:
1992
1992
1993 -r: use 'raw' input. By default, the 'processed' history is used,
1993 -r: use 'raw' input. By default, the 'processed' history is used,
1994 so that magics are loaded in their transformed version to valid
1994 so that magics are loaded in their transformed version to valid
1995 Python. If this option is given, the raw input as typed as the
1995 Python. If this option is given, the raw input as typed as the
1996 command line is used instead.
1996 command line is used instead.
1997
1997
1998 This function uses the same syntax as %macro for line extraction, but
1998 This function uses the same syntax as %macro for line extraction, but
1999 instead of creating a macro it saves the resulting string to the
1999 instead of creating a macro it saves the resulting string to the
2000 filename you specify.
2000 filename you specify.
2001
2001
2002 It adds a '.py' extension to the file if you don't do so yourself, and
2002 It adds a '.py' extension to the file if you don't do so yourself, and
2003 it asks for confirmation before overwriting existing files."""
2003 it asks for confirmation before overwriting existing files."""
2004
2004
2005 opts,args = self.parse_options(parameter_s,'r',mode='list')
2005 opts,args = self.parse_options(parameter_s,'r',mode='list')
2006 fname,ranges = args[0], args[1:]
2006 fname,ranges = args[0], args[1:]
2007 if not fname.endswith('.py'):
2007 if not fname.endswith('.py'):
2008 fname += '.py'
2008 fname += '.py'
2009 if os.path.isfile(fname):
2009 if os.path.isfile(fname):
2010 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
2010 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
2011 if ans.lower() not in ['y','yes']:
2011 if ans.lower() not in ['y','yes']:
2012 print 'Operation cancelled.'
2012 print 'Operation cancelled.'
2013 return
2013 return
2014 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
2014 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
2015 f = file(fname,'w')
2015 f = file(fname,'w')
2016 f.write(cmds)
2016 f.write(cmds)
2017 f.close()
2017 f.close()
2018 print 'The following commands were written to file `%s`:' % fname
2018 print 'The following commands were written to file `%s`:' % fname
2019 print cmds
2019 print cmds
2020
2020
2021 def _edit_macro(self,mname,macro):
2021 def _edit_macro(self,mname,macro):
2022 """open an editor with the macro data in a file"""
2022 """open an editor with the macro data in a file"""
2023 filename = self.shell.mktempfile(macro.value)
2023 filename = self.shell.mktempfile(macro.value)
2024 self.shell.hooks.editor(filename)
2024 self.shell.hooks.editor(filename)
2025
2025
2026 # and make a new macro object, to replace the old one
2026 # and make a new macro object, to replace the old one
2027 mfile = open(filename)
2027 mfile = open(filename)
2028 mvalue = mfile.read()
2028 mvalue = mfile.read()
2029 mfile.close()
2029 mfile.close()
2030 self.shell.user_ns[mname] = Macro(mvalue)
2030 self.shell.user_ns[mname] = Macro(mvalue)
2031
2031
2032 def magic_ed(self,parameter_s=''):
2032 def magic_ed(self,parameter_s=''):
2033 """Alias to %edit."""
2033 """Alias to %edit."""
2034 return self.magic_edit(parameter_s)
2034 return self.magic_edit(parameter_s)
2035
2035
2036 def magic_edit(self,parameter_s='',last_call=['','']):
2036 def magic_edit(self,parameter_s='',last_call=['','']):
2037 """Bring up an editor and execute the resulting code.
2037 """Bring up an editor and execute the resulting code.
2038
2038
2039 Usage:
2039 Usage:
2040 %edit [options] [args]
2040 %edit [options] [args]
2041
2041
2042 %edit runs IPython's editor hook. The default version of this hook is
2042 %edit runs IPython's editor hook. The default version of this hook is
2043 set to call the __IPYTHON__.rc.editor command. This is read from your
2043 set to call the __IPYTHON__.rc.editor command. This is read from your
2044 environment variable $EDITOR. If this isn't found, it will default to
2044 environment variable $EDITOR. If this isn't found, it will default to
2045 vi under Linux/Unix and to notepad under Windows. See the end of this
2045 vi under Linux/Unix and to notepad under Windows. See the end of this
2046 docstring for how to change the editor hook.
2046 docstring for how to change the editor hook.
2047
2047
2048 You can also set the value of this editor via the command line option
2048 You can also set the value of this editor via the command line option
2049 '-editor' or in your ipythonrc file. This is useful if you wish to use
2049 '-editor' or in your ipythonrc file. This is useful if you wish to use
2050 specifically for IPython an editor different from your typical default
2050 specifically for IPython an editor different from your typical default
2051 (and for Windows users who typically don't set environment variables).
2051 (and for Windows users who typically don't set environment variables).
2052
2052
2053 This command allows you to conveniently edit multi-line code right in
2053 This command allows you to conveniently edit multi-line code right in
2054 your IPython session.
2054 your IPython session.
2055
2055
2056 If called without arguments, %edit opens up an empty editor with a
2056 If called without arguments, %edit opens up an empty editor with a
2057 temporary file and will execute the contents of this file when you
2057 temporary file and will execute the contents of this file when you
2058 close it (don't forget to save it!).
2058 close it (don't forget to save it!).
2059
2059
2060
2060
2061 Options:
2061 Options:
2062
2062
2063 -n <number>: open the editor at a specified line number. By default,
2063 -n <number>: open the editor at a specified line number. By default,
2064 the IPython editor hook uses the unix syntax 'editor +N filename', but
2064 the IPython editor hook uses the unix syntax 'editor +N filename', but
2065 you can configure this by providing your own modified hook if your
2065 you can configure this by providing your own modified hook if your
2066 favorite editor supports line-number specifications with a different
2066 favorite editor supports line-number specifications with a different
2067 syntax.
2067 syntax.
2068
2068
2069 -p: this will call the editor with the same data as the previous time
2069 -p: this will call the editor with the same data as the previous time
2070 it was used, regardless of how long ago (in your current session) it
2070 it was used, regardless of how long ago (in your current session) it
2071 was.
2071 was.
2072
2072
2073 -r: use 'raw' input. This option only applies to input taken from the
2073 -r: use 'raw' input. This option only applies to input taken from the
2074 user's history. By default, the 'processed' history is used, so that
2074 user's history. By default, the 'processed' history is used, so that
2075 magics are loaded in their transformed version to valid Python. If
2075 magics are loaded in their transformed version to valid Python. If
2076 this option is given, the raw input as typed as the command line is
2076 this option is given, the raw input as typed as the command line is
2077 used instead. When you exit the editor, it will be executed by
2077 used instead. When you exit the editor, it will be executed by
2078 IPython's own processor.
2078 IPython's own processor.
2079
2079
2080 -x: do not execute the edited code immediately upon exit. This is
2080 -x: do not execute the edited code immediately upon exit. This is
2081 mainly useful if you are editing programs which need to be called with
2081 mainly useful if you are editing programs which need to be called with
2082 command line arguments, which you can then do using %run.
2082 command line arguments, which you can then do using %run.
2083
2083
2084
2084
2085 Arguments:
2085 Arguments:
2086
2086
2087 If arguments are given, the following possibilites exist:
2087 If arguments are given, the following possibilites exist:
2088
2088
2089 - The arguments are numbers or pairs of colon-separated numbers (like
2089 - The arguments are numbers or pairs of colon-separated numbers (like
2090 1 4:8 9). These are interpreted as lines of previous input to be
2090 1 4:8 9). These are interpreted as lines of previous input to be
2091 loaded into the editor. The syntax is the same of the %macro command.
2091 loaded into the editor. The syntax is the same of the %macro command.
2092
2092
2093 - If the argument doesn't start with a number, it is evaluated as a
2093 - If the argument doesn't start with a number, it is evaluated as a
2094 variable and its contents loaded into the editor. You can thus edit
2094 variable and its contents loaded into the editor. You can thus edit
2095 any string which contains python code (including the result of
2095 any string which contains python code (including the result of
2096 previous edits).
2096 previous edits).
2097
2097
2098 - If the argument is the name of an object (other than a string),
2098 - If the argument is the name of an object (other than a string),
2099 IPython will try to locate the file where it was defined and open the
2099 IPython will try to locate the file where it was defined and open the
2100 editor at the point where it is defined. You can use `%edit function`
2100 editor at the point where it is defined. You can use `%edit function`
2101 to load an editor exactly at the point where 'function' is defined,
2101 to load an editor exactly at the point where 'function' is defined,
2102 edit it and have the file be executed automatically.
2102 edit it and have the file be executed automatically.
2103
2103
2104 If the object is a macro (see %macro for details), this opens up your
2104 If the object is a macro (see %macro for details), this opens up your
2105 specified editor with a temporary file containing the macro's data.
2105 specified editor with a temporary file containing the macro's data.
2106 Upon exit, the macro is reloaded with the contents of the file.
2106 Upon exit, the macro is reloaded with the contents of the file.
2107
2107
2108 Note: opening at an exact line is only supported under Unix, and some
2108 Note: opening at an exact line is only supported under Unix, and some
2109 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2109 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2110 '+NUMBER' parameter necessary for this feature. Good editors like
2110 '+NUMBER' parameter necessary for this feature. Good editors like
2111 (X)Emacs, vi, jed, pico and joe all do.
2111 (X)Emacs, vi, jed, pico and joe all do.
2112
2112
2113 - If the argument is not found as a variable, IPython will look for a
2113 - If the argument is not found as a variable, IPython will look for a
2114 file with that name (adding .py if necessary) and load it into the
2114 file with that name (adding .py if necessary) and load it into the
2115 editor. It will execute its contents with execfile() when you exit,
2115 editor. It will execute its contents with execfile() when you exit,
2116 loading any code in the file into your interactive namespace.
2116 loading any code in the file into your interactive namespace.
2117
2117
2118 After executing your code, %edit will return as output the code you
2118 After executing your code, %edit will return as output the code you
2119 typed in the editor (except when it was an existing file). This way
2119 typed in the editor (except when it was an existing file). This way
2120 you can reload the code in further invocations of %edit as a variable,
2120 you can reload the code in further invocations of %edit as a variable,
2121 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2121 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2122 the output.
2122 the output.
2123
2123
2124 Note that %edit is also available through the alias %ed.
2124 Note that %edit is also available through the alias %ed.
2125
2125
2126 This is an example of creating a simple function inside the editor and
2126 This is an example of creating a simple function inside the editor and
2127 then modifying it. First, start up the editor:
2127 then modifying it. First, start up the editor:
2128
2128
2129 In [1]: ed\\
2129 In [1]: ed\\
2130 Editing... done. Executing edited code...\\
2130 Editing... done. Executing edited code...\\
2131 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2131 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2132
2132
2133 We can then call the function foo():
2133 We can then call the function foo():
2134
2134
2135 In [2]: foo()\\
2135 In [2]: foo()\\
2136 foo() was defined in an editing session
2136 foo() was defined in an editing session
2137
2137
2138 Now we edit foo. IPython automatically loads the editor with the
2138 Now we edit foo. IPython automatically loads the editor with the
2139 (temporary) file where foo() was previously defined:
2139 (temporary) file where foo() was previously defined:
2140
2140
2141 In [3]: ed foo\\
2141 In [3]: ed foo\\
2142 Editing... done. Executing edited code...
2142 Editing... done. Executing edited code...
2143
2143
2144 And if we call foo() again we get the modified version:
2144 And if we call foo() again we get the modified version:
2145
2145
2146 In [4]: foo()\\
2146 In [4]: foo()\\
2147 foo() has now been changed!
2147 foo() has now been changed!
2148
2148
2149 Here is an example of how to edit a code snippet successive
2149 Here is an example of how to edit a code snippet successive
2150 times. First we call the editor:
2150 times. First we call the editor:
2151
2151
2152 In [8]: ed\\
2152 In [8]: ed\\
2153 Editing... done. Executing edited code...\\
2153 Editing... done. Executing edited code...\\
2154 hello\\
2154 hello\\
2155 Out[8]: "print 'hello'\\n"
2155 Out[8]: "print 'hello'\\n"
2156
2156
2157 Now we call it again with the previous output (stored in _):
2157 Now we call it again with the previous output (stored in _):
2158
2158
2159 In [9]: ed _\\
2159 In [9]: ed _\\
2160 Editing... done. Executing edited code...\\
2160 Editing... done. Executing edited code...\\
2161 hello world\\
2161 hello world\\
2162 Out[9]: "print 'hello world'\\n"
2162 Out[9]: "print 'hello world'\\n"
2163
2163
2164 Now we call it with the output #8 (stored in _8, also as Out[8]):
2164 Now we call it with the output #8 (stored in _8, also as Out[8]):
2165
2165
2166 In [10]: ed _8\\
2166 In [10]: ed _8\\
2167 Editing... done. Executing edited code...\\
2167 Editing... done. Executing edited code...\\
2168 hello again\\
2168 hello again\\
2169 Out[10]: "print 'hello again'\\n"
2169 Out[10]: "print 'hello again'\\n"
2170
2170
2171
2171
2172 Changing the default editor hook:
2172 Changing the default editor hook:
2173
2173
2174 If you wish to write your own editor hook, you can put it in a
2174 If you wish to write your own editor hook, you can put it in a
2175 configuration file which you load at startup time. The default hook
2175 configuration file which you load at startup time. The default hook
2176 is defined in the IPython.hooks module, and you can use that as a
2176 is defined in the IPython.hooks module, and you can use that as a
2177 starting example for further modifications. That file also has
2177 starting example for further modifications. That file also has
2178 general instructions on how to set a new hook for use once you've
2178 general instructions on how to set a new hook for use once you've
2179 defined it."""
2179 defined it."""
2180
2180
2181 # FIXME: This function has become a convoluted mess. It needs a
2181 # FIXME: This function has become a convoluted mess. It needs a
2182 # ground-up rewrite with clean, simple logic.
2182 # ground-up rewrite with clean, simple logic.
2183
2183
2184 def make_filename(arg):
2184 def make_filename(arg):
2185 "Make a filename from the given args"
2185 "Make a filename from the given args"
2186 try:
2186 try:
2187 filename = get_py_filename(arg)
2187 filename = get_py_filename(arg)
2188 except IOError:
2188 except IOError:
2189 if args.endswith('.py'):
2189 if args.endswith('.py'):
2190 filename = arg
2190 filename = arg
2191 else:
2191 else:
2192 filename = None
2192 filename = None
2193 return filename
2193 return filename
2194
2194
2195 # custom exceptions
2195 # custom exceptions
2196 class DataIsObject(Exception): pass
2196 class DataIsObject(Exception): pass
2197
2197
2198 opts,args = self.parse_options(parameter_s,'prxn:')
2198 opts,args = self.parse_options(parameter_s,'prxn:')
2199 # Set a few locals from the options for convenience:
2199 # Set a few locals from the options for convenience:
2200 opts_p = opts.has_key('p')
2200 opts_p = opts.has_key('p')
2201 opts_r = opts.has_key('r')
2201 opts_r = opts.has_key('r')
2202
2202
2203 # Default line number value
2203 # Default line number value
2204 lineno = opts.get('n',None)
2204 lineno = opts.get('n',None)
2205
2205
2206 if opts_p:
2206 if opts_p:
2207 args = '_%s' % last_call[0]
2207 args = '_%s' % last_call[0]
2208 if not self.shell.user_ns.has_key(args):
2208 if not self.shell.user_ns.has_key(args):
2209 args = last_call[1]
2209 args = last_call[1]
2210
2210
2211 # use last_call to remember the state of the previous call, but don't
2211 # use last_call to remember the state of the previous call, but don't
2212 # let it be clobbered by successive '-p' calls.
2212 # let it be clobbered by successive '-p' calls.
2213 try:
2213 try:
2214 last_call[0] = self.shell.outputcache.prompt_count
2214 last_call[0] = self.shell.outputcache.prompt_count
2215 if not opts_p:
2215 if not opts_p:
2216 last_call[1] = parameter_s
2216 last_call[1] = parameter_s
2217 except:
2217 except:
2218 pass
2218 pass
2219
2219
2220 # by default this is done with temp files, except when the given
2220 # by default this is done with temp files, except when the given
2221 # arg is a filename
2221 # arg is a filename
2222 use_temp = 1
2222 use_temp = 1
2223
2223
2224 if re.match(r'\d',args):
2224 if re.match(r'\d',args):
2225 # Mode where user specifies ranges of lines, like in %macro.
2225 # Mode where user specifies ranges of lines, like in %macro.
2226 # This means that you can't edit files whose names begin with
2226 # This means that you can't edit files whose names begin with
2227 # numbers this way. Tough.
2227 # numbers this way. Tough.
2228 ranges = args.split()
2228 ranges = args.split()
2229 data = ''.join(self.extract_input_slices(ranges,opts_r))
2229 data = ''.join(self.extract_input_slices(ranges,opts_r))
2230 elif args.endswith('.py'):
2230 elif args.endswith('.py'):
2231 filename = make_filename(args)
2231 filename = make_filename(args)
2232 data = ''
2232 data = ''
2233 use_temp = 0
2233 use_temp = 0
2234 elif args:
2234 elif args:
2235 try:
2235 try:
2236 # Load the parameter given as a variable. If not a string,
2236 # Load the parameter given as a variable. If not a string,
2237 # process it as an object instead (below)
2237 # process it as an object instead (below)
2238
2238
2239 #print '*** args',args,'type',type(args) # dbg
2239 #print '*** args',args,'type',type(args) # dbg
2240 data = eval(args,self.shell.user_ns)
2240 data = eval(args,self.shell.user_ns)
2241 if not type(data) in StringTypes:
2241 if not type(data) in StringTypes:
2242 raise DataIsObject
2242 raise DataIsObject
2243
2243
2244 except (NameError,SyntaxError):
2244 except (NameError,SyntaxError):
2245 # given argument is not a variable, try as a filename
2245 # given argument is not a variable, try as a filename
2246 filename = make_filename(args)
2246 filename = make_filename(args)
2247 if filename is None:
2247 if filename is None:
2248 warn("Argument given (%s) can't be found as a variable "
2248 warn("Argument given (%s) can't be found as a variable "
2249 "or as a filename." % args)
2249 "or as a filename." % args)
2250 return
2250 return
2251
2251
2252 data = ''
2252 data = ''
2253 use_temp = 0
2253 use_temp = 0
2254 except DataIsObject:
2254 except DataIsObject:
2255
2255
2256 # macros have a special edit function
2256 # macros have a special edit function
2257 if isinstance(data,Macro):
2257 if isinstance(data,Macro):
2258 self._edit_macro(args,data)
2258 self._edit_macro(args,data)
2259 return
2259 return
2260
2260
2261 # For objects, try to edit the file where they are defined
2261 # For objects, try to edit the file where they are defined
2262 try:
2262 try:
2263 filename = inspect.getabsfile(data)
2263 filename = inspect.getabsfile(data)
2264 if 'fakemodule' in filename.lower() and inspect.isclass(data):
2264 if 'fakemodule' in filename.lower() and inspect.isclass(data):
2265 # class created by %edit? Try to find source
2265 # class created by %edit? Try to find source
2266 # by looking for method definitions instead, the
2266 # by looking for method definitions instead, the
2267 # __module__ in those classes is FakeModule.
2267 # __module__ in those classes is FakeModule.
2268 attrs = [getattr(data, aname) for aname in dir(data)]
2268 attrs = [getattr(data, aname) for aname in dir(data)]
2269 for attr in attrs:
2269 for attr in attrs:
2270 if not inspect.ismethod(attr):
2270 if not inspect.ismethod(attr):
2271 continue
2271 continue
2272 filename = inspect.getabsfile(attr)
2272 filename = inspect.getabsfile(attr)
2273 if filename and 'fakemodule' not in filename.lower():
2273 if filename and 'fakemodule' not in filename.lower():
2274 # change the attribute to be the edit target instead
2274 # change the attribute to be the edit target instead
2275 data = attr
2275 data = attr
2276 break
2276 break
2277
2277
2278 datafile = 1
2278 datafile = 1
2279 except TypeError:
2279 except TypeError:
2280 filename = make_filename(args)
2280 filename = make_filename(args)
2281 datafile = 1
2281 datafile = 1
2282 warn('Could not find file where `%s` is defined.\n'
2282 warn('Could not find file where `%s` is defined.\n'
2283 'Opening a file named `%s`' % (args,filename))
2283 'Opening a file named `%s`' % (args,filename))
2284 # Now, make sure we can actually read the source (if it was in
2284 # Now, make sure we can actually read the source (if it was in
2285 # a temp file it's gone by now).
2285 # a temp file it's gone by now).
2286 if datafile:
2286 if datafile:
2287 try:
2287 try:
2288 if lineno is None:
2288 if lineno is None:
2289 lineno = inspect.getsourcelines(data)[1]
2289 lineno = inspect.getsourcelines(data)[1]
2290 except IOError:
2290 except IOError:
2291 filename = make_filename(args)
2291 filename = make_filename(args)
2292 if filename is None:
2292 if filename is None:
2293 warn('The file `%s` where `%s` was defined cannot '
2293 warn('The file `%s` where `%s` was defined cannot '
2294 'be read.' % (filename,data))
2294 'be read.' % (filename,data))
2295 return
2295 return
2296 use_temp = 0
2296 use_temp = 0
2297 else:
2297 else:
2298 data = ''
2298 data = ''
2299
2299
2300 if use_temp:
2300 if use_temp:
2301 filename = self.shell.mktempfile(data)
2301 filename = self.shell.mktempfile(data)
2302 print 'IPython will make a temporary file named:',filename
2302 print 'IPython will make a temporary file named:',filename
2303
2303
2304 # do actual editing here
2304 # do actual editing here
2305 print 'Editing...',
2305 print 'Editing...',
2306 sys.stdout.flush()
2306 sys.stdout.flush()
2307 self.shell.hooks.editor(filename,lineno)
2307 self.shell.hooks.editor(filename,lineno)
2308 if opts.has_key('x'): # -x prevents actual execution
2308 if opts.has_key('x'): # -x prevents actual execution
2309 print
2309 print
2310 else:
2310 else:
2311 print 'done. Executing edited code...'
2311 print 'done. Executing edited code...'
2312 if opts_r:
2312 if opts_r:
2313 self.shell.runlines(file_read(filename))
2313 self.shell.runlines(file_read(filename))
2314 else:
2314 else:
2315 self.shell.safe_execfile(filename,self.shell.user_ns,
2315 self.shell.safe_execfile(filename,self.shell.user_ns,
2316 self.shell.user_ns)
2316 self.shell.user_ns)
2317 if use_temp:
2317 if use_temp:
2318 try:
2318 try:
2319 return open(filename).read()
2319 return open(filename).read()
2320 except IOError,msg:
2320 except IOError,msg:
2321 if msg.filename == filename:
2321 if msg.filename == filename:
2322 warn('File not found. Did you forget to save?')
2322 warn('File not found. Did you forget to save?')
2323 return
2323 return
2324 else:
2324 else:
2325 self.shell.showtraceback()
2325 self.shell.showtraceback()
2326
2326
2327 def magic_xmode(self,parameter_s = ''):
2327 def magic_xmode(self,parameter_s = ''):
2328 """Switch modes for the exception handlers.
2328 """Switch modes for the exception handlers.
2329
2329
2330 Valid modes: Plain, Context and Verbose.
2330 Valid modes: Plain, Context and Verbose.
2331
2331
2332 If called without arguments, acts as a toggle."""
2332 If called without arguments, acts as a toggle."""
2333
2333
2334 def xmode_switch_err(name):
2334 def xmode_switch_err(name):
2335 warn('Error changing %s exception modes.\n%s' %
2335 warn('Error changing %s exception modes.\n%s' %
2336 (name,sys.exc_info()[1]))
2336 (name,sys.exc_info()[1]))
2337
2337
2338 shell = self.shell
2338 shell = self.shell
2339 new_mode = parameter_s.strip().capitalize()
2339 new_mode = parameter_s.strip().capitalize()
2340 try:
2340 try:
2341 shell.InteractiveTB.set_mode(mode=new_mode)
2341 shell.InteractiveTB.set_mode(mode=new_mode)
2342 print 'Exception reporting mode:',shell.InteractiveTB.mode
2342 print 'Exception reporting mode:',shell.InteractiveTB.mode
2343 except:
2343 except:
2344 xmode_switch_err('user')
2344 xmode_switch_err('user')
2345
2345
2346 # threaded shells use a special handler in sys.excepthook
2346 # threaded shells use a special handler in sys.excepthook
2347 if shell.isthreaded:
2347 if shell.isthreaded:
2348 try:
2348 try:
2349 shell.sys_excepthook.set_mode(mode=new_mode)
2349 shell.sys_excepthook.set_mode(mode=new_mode)
2350 except:
2350 except:
2351 xmode_switch_err('threaded')
2351 xmode_switch_err('threaded')
2352
2352
2353 def magic_colors(self,parameter_s = ''):
2353 def magic_colors(self,parameter_s = ''):
2354 """Switch color scheme for prompts, info system and exception handlers.
2354 """Switch color scheme for prompts, info system and exception handlers.
2355
2355
2356 Currently implemented schemes: NoColor, Linux, LightBG.
2356 Currently implemented schemes: NoColor, Linux, LightBG.
2357
2357
2358 Color scheme names are not case-sensitive."""
2358 Color scheme names are not case-sensitive."""
2359
2359
2360 def color_switch_err(name):
2360 def color_switch_err(name):
2361 warn('Error changing %s color schemes.\n%s' %
2361 warn('Error changing %s color schemes.\n%s' %
2362 (name,sys.exc_info()[1]))
2362 (name,sys.exc_info()[1]))
2363
2363
2364
2364
2365 new_scheme = parameter_s.strip()
2365 new_scheme = parameter_s.strip()
2366 if not new_scheme:
2366 if not new_scheme:
2367 raise UsageError(
2367 raise UsageError(
2368 "%colors: you must specify a color scheme. See '%colors?'")
2368 "%colors: you must specify a color scheme. See '%colors?'")
2369 return
2369 return
2370 # local shortcut
2370 # local shortcut
2371 shell = self.shell
2371 shell = self.shell
2372
2372
2373 import IPython.rlineimpl as readline
2373 import IPython.rlineimpl as readline
2374
2374
2375 if not readline.have_readline and sys.platform == "win32":
2375 if not readline.have_readline and sys.platform == "win32":
2376 msg = """\
2376 msg = """\
2377 Proper color support under MS Windows requires the pyreadline library.
2377 Proper color support under MS Windows requires the pyreadline library.
2378 You can find it at:
2378 You can find it at:
2379 http://ipython.scipy.org/moin/PyReadline/Intro
2379 http://ipython.scipy.org/moin/PyReadline/Intro
2380 Gary's readline needs the ctypes module, from:
2380 Gary's readline needs the ctypes module, from:
2381 http://starship.python.net/crew/theller/ctypes
2381 http://starship.python.net/crew/theller/ctypes
2382 (Note that ctypes is already part of Python versions 2.5 and newer).
2382 (Note that ctypes is already part of Python versions 2.5 and newer).
2383
2383
2384 Defaulting color scheme to 'NoColor'"""
2384 Defaulting color scheme to 'NoColor'"""
2385 new_scheme = 'NoColor'
2385 new_scheme = 'NoColor'
2386 warn(msg)
2386 warn(msg)
2387
2387
2388 # readline option is 0
2388 # readline option is 0
2389 if not shell.has_readline:
2389 if not shell.has_readline:
2390 new_scheme = 'NoColor'
2390 new_scheme = 'NoColor'
2391
2391
2392 # Set prompt colors
2392 # Set prompt colors
2393 try:
2393 try:
2394 shell.outputcache.set_colors(new_scheme)
2394 shell.outputcache.set_colors(new_scheme)
2395 except:
2395 except:
2396 color_switch_err('prompt')
2396 color_switch_err('prompt')
2397 else:
2397 else:
2398 shell.rc.colors = \
2398 shell.rc.colors = \
2399 shell.outputcache.color_table.active_scheme_name
2399 shell.outputcache.color_table.active_scheme_name
2400 # Set exception colors
2400 # Set exception colors
2401 try:
2401 try:
2402 shell.InteractiveTB.set_colors(scheme = new_scheme)
2402 shell.InteractiveTB.set_colors(scheme = new_scheme)
2403 shell.SyntaxTB.set_colors(scheme = new_scheme)
2403 shell.SyntaxTB.set_colors(scheme = new_scheme)
2404 except:
2404 except:
2405 color_switch_err('exception')
2405 color_switch_err('exception')
2406
2406
2407 # threaded shells use a verbose traceback in sys.excepthook
2407 # threaded shells use a verbose traceback in sys.excepthook
2408 if shell.isthreaded:
2408 if shell.isthreaded:
2409 try:
2409 try:
2410 shell.sys_excepthook.set_colors(scheme=new_scheme)
2410 shell.sys_excepthook.set_colors(scheme=new_scheme)
2411 except:
2411 except:
2412 color_switch_err('system exception handler')
2412 color_switch_err('system exception handler')
2413
2413
2414 # Set info (for 'object?') colors
2414 # Set info (for 'object?') colors
2415 if shell.rc.color_info:
2415 if shell.rc.color_info:
2416 try:
2416 try:
2417 shell.inspector.set_active_scheme(new_scheme)
2417 shell.inspector.set_active_scheme(new_scheme)
2418 except:
2418 except:
2419 color_switch_err('object inspector')
2419 color_switch_err('object inspector')
2420 else:
2420 else:
2421 shell.inspector.set_active_scheme('NoColor')
2421 shell.inspector.set_active_scheme('NoColor')
2422
2422
2423 def magic_color_info(self,parameter_s = ''):
2423 def magic_color_info(self,parameter_s = ''):
2424 """Toggle color_info.
2424 """Toggle color_info.
2425
2425
2426 The color_info configuration parameter controls whether colors are
2426 The color_info configuration parameter controls whether colors are
2427 used for displaying object details (by things like %psource, %pfile or
2427 used for displaying object details (by things like %psource, %pfile or
2428 the '?' system). This function toggles this value with each call.
2428 the '?' system). This function toggles this value with each call.
2429
2429
2430 Note that unless you have a fairly recent pager (less works better
2430 Note that unless you have a fairly recent pager (less works better
2431 than more) in your system, using colored object information displays
2431 than more) in your system, using colored object information displays
2432 will not work properly. Test it and see."""
2432 will not work properly. Test it and see."""
2433
2433
2434 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2434 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2435 self.magic_colors(self.shell.rc.colors)
2435 self.magic_colors(self.shell.rc.colors)
2436 print 'Object introspection functions have now coloring:',
2436 print 'Object introspection functions have now coloring:',
2437 print ['OFF','ON'][self.shell.rc.color_info]
2437 print ['OFF','ON'][self.shell.rc.color_info]
2438
2438
2439 def magic_Pprint(self, parameter_s=''):
2439 def magic_Pprint(self, parameter_s=''):
2440 """Toggle pretty printing on/off."""
2440 """Toggle pretty printing on/off."""
2441
2441
2442 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2442 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2443 print 'Pretty printing has been turned', \
2443 print 'Pretty printing has been turned', \
2444 ['OFF','ON'][self.shell.rc.pprint]
2444 ['OFF','ON'][self.shell.rc.pprint]
2445
2445
2446 def magic_exit(self, parameter_s=''):
2446 def magic_exit(self, parameter_s=''):
2447 """Exit IPython, confirming if configured to do so.
2447 """Exit IPython, confirming if configured to do so.
2448
2448
2449 You can configure whether IPython asks for confirmation upon exit by
2449 You can configure whether IPython asks for confirmation upon exit by
2450 setting the confirm_exit flag in the ipythonrc file."""
2450 setting the confirm_exit flag in the ipythonrc file."""
2451
2451
2452 self.shell.exit()
2452 self.shell.exit()
2453
2453
2454 def magic_quit(self, parameter_s=''):
2454 def magic_quit(self, parameter_s=''):
2455 """Exit IPython, confirming if configured to do so (like %exit)"""
2455 """Exit IPython, confirming if configured to do so (like %exit)"""
2456
2456
2457 self.shell.exit()
2457 self.shell.exit()
2458
2458
2459 def magic_Exit(self, parameter_s=''):
2459 def magic_Exit(self, parameter_s=''):
2460 """Exit IPython without confirmation."""
2460 """Exit IPython without confirmation."""
2461
2461
2462 self.shell.exit_now = True
2462 self.shell.exit_now = True
2463
2463
2464 #......................................................................
2464 #......................................................................
2465 # Functions to implement unix shell-type things
2465 # Functions to implement unix shell-type things
2466
2466
2467 def magic_alias(self, parameter_s = ''):
2467 def magic_alias(self, parameter_s = ''):
2468 """Define an alias for a system command.
2468 """Define an alias for a system command.
2469
2469
2470 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2470 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2471
2471
2472 Then, typing 'alias_name params' will execute the system command 'cmd
2472 Then, typing 'alias_name params' will execute the system command 'cmd
2473 params' (from your underlying operating system).
2473 params' (from your underlying operating system).
2474
2474
2475 Aliases have lower precedence than magic functions and Python normal
2475 Aliases have lower precedence than magic functions and Python normal
2476 variables, so if 'foo' is both a Python variable and an alias, the
2476 variables, so if 'foo' is both a Python variable and an alias, the
2477 alias can not be executed until 'del foo' removes the Python variable.
2477 alias can not be executed until 'del foo' removes the Python variable.
2478
2478
2479 You can use the %l specifier in an alias definition to represent the
2479 You can use the %l specifier in an alias definition to represent the
2480 whole line when the alias is called. For example:
2480 whole line when the alias is called. For example:
2481
2481
2482 In [2]: alias all echo "Input in brackets: <%l>"\\
2482 In [2]: alias all echo "Input in brackets: <%l>"\\
2483 In [3]: all hello world\\
2483 In [3]: all hello world\\
2484 Input in brackets: <hello world>
2484 Input in brackets: <hello world>
2485
2485
2486 You can also define aliases with parameters using %s specifiers (one
2486 You can also define aliases with parameters using %s specifiers (one
2487 per parameter):
2487 per parameter):
2488
2488
2489 In [1]: alias parts echo first %s second %s\\
2489 In [1]: alias parts echo first %s second %s\\
2490 In [2]: %parts A B\\
2490 In [2]: %parts A B\\
2491 first A second B\\
2491 first A second B\\
2492 In [3]: %parts A\\
2492 In [3]: %parts A\\
2493 Incorrect number of arguments: 2 expected.\\
2493 Incorrect number of arguments: 2 expected.\\
2494 parts is an alias to: 'echo first %s second %s'
2494 parts is an alias to: 'echo first %s second %s'
2495
2495
2496 Note that %l and %s are mutually exclusive. You can only use one or
2496 Note that %l and %s are mutually exclusive. You can only use one or
2497 the other in your aliases.
2497 the other in your aliases.
2498
2498
2499 Aliases expand Python variables just like system calls using ! or !!
2499 Aliases expand Python variables just like system calls using ! or !!
2500 do: all expressions prefixed with '$' get expanded. For details of
2500 do: all expressions prefixed with '$' get expanded. For details of
2501 the semantic rules, see PEP-215:
2501 the semantic rules, see PEP-215:
2502 http://www.python.org/peps/pep-0215.html. This is the library used by
2502 http://www.python.org/peps/pep-0215.html. This is the library used by
2503 IPython for variable expansion. If you want to access a true shell
2503 IPython for variable expansion. If you want to access a true shell
2504 variable, an extra $ is necessary to prevent its expansion by IPython:
2504 variable, an extra $ is necessary to prevent its expansion by IPython:
2505
2505
2506 In [6]: alias show echo\\
2506 In [6]: alias show echo\\
2507 In [7]: PATH='A Python string'\\
2507 In [7]: PATH='A Python string'\\
2508 In [8]: show $PATH\\
2508 In [8]: show $PATH\\
2509 A Python string\\
2509 A Python string\\
2510 In [9]: show $$PATH\\
2510 In [9]: show $$PATH\\
2511 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2511 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2512
2512
2513 You can use the alias facility to acess all of $PATH. See the %rehash
2513 You can use the alias facility to acess all of $PATH. See the %rehash
2514 and %rehashx functions, which automatically create aliases for the
2514 and %rehashx functions, which automatically create aliases for the
2515 contents of your $PATH.
2515 contents of your $PATH.
2516
2516
2517 If called with no parameters, %alias prints the current alias table."""
2517 If called with no parameters, %alias prints the current alias table."""
2518
2518
2519 par = parameter_s.strip()
2519 par = parameter_s.strip()
2520 if not par:
2520 if not par:
2521 stored = self.db.get('stored_aliases', {} )
2521 stored = self.db.get('stored_aliases', {} )
2522 atab = self.shell.alias_table
2522 atab = self.shell.alias_table
2523 aliases = atab.keys()
2523 aliases = atab.keys()
2524 aliases.sort()
2524 aliases.sort()
2525 res = []
2525 res = []
2526 showlast = []
2526 showlast = []
2527 for alias in aliases:
2527 for alias in aliases:
2528 special = False
2528 special = False
2529 try:
2529 try:
2530 tgt = atab[alias][1]
2530 tgt = atab[alias][1]
2531 except (TypeError, AttributeError):
2531 except (TypeError, AttributeError):
2532 # unsubscriptable? probably a callable
2532 # unsubscriptable? probably a callable
2533 tgt = atab[alias]
2533 tgt = atab[alias]
2534 special = True
2534 special = True
2535 # 'interesting' aliases
2535 # 'interesting' aliases
2536 if (alias in stored or
2536 if (alias in stored or
2537 special or
2537 special or
2538 alias.lower() != os.path.splitext(tgt)[0].lower() or
2538 alias.lower() != os.path.splitext(tgt)[0].lower() or
2539 ' ' in tgt):
2539 ' ' in tgt):
2540 showlast.append((alias, tgt))
2540 showlast.append((alias, tgt))
2541 else:
2541 else:
2542 res.append((alias, tgt ))
2542 res.append((alias, tgt ))
2543
2543
2544 # show most interesting aliases last
2544 # show most interesting aliases last
2545 res.extend(showlast)
2545 res.extend(showlast)
2546 print "Total number of aliases:",len(aliases)
2546 print "Total number of aliases:",len(aliases)
2547 return res
2547 return res
2548 try:
2548 try:
2549 alias,cmd = par.split(None,1)
2549 alias,cmd = par.split(None,1)
2550 except:
2550 except:
2551 print OInspect.getdoc(self.magic_alias)
2551 print OInspect.getdoc(self.magic_alias)
2552 else:
2552 else:
2553 nargs = cmd.count('%s')
2553 nargs = cmd.count('%s')
2554 if nargs>0 and cmd.find('%l')>=0:
2554 if nargs>0 and cmd.find('%l')>=0:
2555 error('The %s and %l specifiers are mutually exclusive '
2555 error('The %s and %l specifiers are mutually exclusive '
2556 'in alias definitions.')
2556 'in alias definitions.')
2557 else: # all looks OK
2557 else: # all looks OK
2558 self.shell.alias_table[alias] = (nargs,cmd)
2558 self.shell.alias_table[alias] = (nargs,cmd)
2559 self.shell.alias_table_validate(verbose=0)
2559 self.shell.alias_table_validate(verbose=0)
2560 # end magic_alias
2560 # end magic_alias
2561
2561
2562 def magic_unalias(self, parameter_s = ''):
2562 def magic_unalias(self, parameter_s = ''):
2563 """Remove an alias"""
2563 """Remove an alias"""
2564
2564
2565 aname = parameter_s.strip()
2565 aname = parameter_s.strip()
2566 if aname in self.shell.alias_table:
2566 if aname in self.shell.alias_table:
2567 del self.shell.alias_table[aname]
2567 del self.shell.alias_table[aname]
2568 stored = self.db.get('stored_aliases', {} )
2568 stored = self.db.get('stored_aliases', {} )
2569 if aname in stored:
2569 if aname in stored:
2570 print "Removing %stored alias",aname
2570 print "Removing %stored alias",aname
2571 del stored[aname]
2571 del stored[aname]
2572 self.db['stored_aliases'] = stored
2572 self.db['stored_aliases'] = stored
2573
2573
2574
2574
2575 def magic_rehashx(self, parameter_s = ''):
2575 def magic_rehashx(self, parameter_s = ''):
2576 """Update the alias table with all executable files in $PATH.
2576 """Update the alias table with all executable files in $PATH.
2577
2577
2578 This version explicitly checks that every entry in $PATH is a file
2578 This version explicitly checks that every entry in $PATH is a file
2579 with execute access (os.X_OK), so it is much slower than %rehash.
2579 with execute access (os.X_OK), so it is much slower than %rehash.
2580
2580
2581 Under Windows, it checks executability as a match agains a
2581 Under Windows, it checks executability as a match agains a
2582 '|'-separated string of extensions, stored in the IPython config
2582 '|'-separated string of extensions, stored in the IPython config
2583 variable win_exec_ext. This defaults to 'exe|com|bat'.
2583 variable win_exec_ext. This defaults to 'exe|com|bat'.
2584
2584
2585 This function also resets the root module cache of module completer,
2585 This function also resets the root module cache of module completer,
2586 used on slow filesystems.
2586 used on slow filesystems.
2587 """
2587 """
2588
2588
2589
2589
2590 ip = self.api
2590 ip = self.api
2591
2591
2592 # for the benefit of module completer in ipy_completers.py
2592 # for the benefit of module completer in ipy_completers.py
2593 del ip.db['rootmodules']
2593 del ip.db['rootmodules']
2594
2594
2595 path = [os.path.abspath(os.path.expanduser(p)) for p in
2595 path = [os.path.abspath(os.path.expanduser(p)) for p in
2596 os.environ.get('PATH','').split(os.pathsep)]
2596 os.environ.get('PATH','').split(os.pathsep)]
2597 path = filter(os.path.isdir,path)
2597 path = filter(os.path.isdir,path)
2598
2598
2599 alias_table = self.shell.alias_table
2599 alias_table = self.shell.alias_table
2600 syscmdlist = []
2600 syscmdlist = []
2601 if os.name == 'posix':
2601 if os.name == 'posix':
2602 isexec = lambda fname:os.path.isfile(fname) and \
2602 isexec = lambda fname:os.path.isfile(fname) and \
2603 os.access(fname,os.X_OK)
2603 os.access(fname,os.X_OK)
2604 else:
2604 else:
2605
2605
2606 try:
2606 try:
2607 winext = os.environ['pathext'].replace(';','|').replace('.','')
2607 winext = os.environ['pathext'].replace(';','|').replace('.','')
2608 except KeyError:
2608 except KeyError:
2609 winext = 'exe|com|bat|py'
2609 winext = 'exe|com|bat|py'
2610 if 'py' not in winext:
2610 if 'py' not in winext:
2611 winext += '|py'
2611 winext += '|py'
2612 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2612 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2613 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2613 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2614 savedir = os.getcwd()
2614 savedir = os.getcwd()
2615 try:
2615 try:
2616 # write the whole loop for posix/Windows so we don't have an if in
2616 # write the whole loop for posix/Windows so we don't have an if in
2617 # the innermost part
2617 # the innermost part
2618 if os.name == 'posix':
2618 if os.name == 'posix':
2619 for pdir in path:
2619 for pdir in path:
2620 os.chdir(pdir)
2620 os.chdir(pdir)
2621 for ff in os.listdir(pdir):
2621 for ff in os.listdir(pdir):
2622 if isexec(ff) and ff not in self.shell.no_alias:
2622 if isexec(ff) and ff not in self.shell.no_alias:
2623 # each entry in the alias table must be (N,name),
2623 # each entry in the alias table must be (N,name),
2624 # where N is the number of positional arguments of the
2624 # where N is the number of positional arguments of the
2625 # alias.
2625 # alias.
2626 alias_table[ff] = (0,ff)
2626 alias_table[ff] = (0,ff)
2627 syscmdlist.append(ff)
2627 syscmdlist.append(ff)
2628 else:
2628 else:
2629 for pdir in path:
2629 for pdir in path:
2630 os.chdir(pdir)
2630 os.chdir(pdir)
2631 for ff in os.listdir(pdir):
2631 for ff in os.listdir(pdir):
2632 base, ext = os.path.splitext(ff)
2632 base, ext = os.path.splitext(ff)
2633 if isexec(ff) and base.lower() not in self.shell.no_alias:
2633 if isexec(ff) and base.lower() not in self.shell.no_alias:
2634 if ext.lower() == '.exe':
2634 if ext.lower() == '.exe':
2635 ff = base
2635 ff = base
2636 alias_table[base.lower()] = (0,ff)
2636 alias_table[base.lower()] = (0,ff)
2637 syscmdlist.append(ff)
2637 syscmdlist.append(ff)
2638 # Make sure the alias table doesn't contain keywords or builtins
2638 # Make sure the alias table doesn't contain keywords or builtins
2639 self.shell.alias_table_validate()
2639 self.shell.alias_table_validate()
2640 # Call again init_auto_alias() so we get 'rm -i' and other
2640 # Call again init_auto_alias() so we get 'rm -i' and other
2641 # modified aliases since %rehashx will probably clobber them
2641 # modified aliases since %rehashx will probably clobber them
2642
2642
2643 # no, we don't want them. if %rehashx clobbers them, good,
2643 # no, we don't want them. if %rehashx clobbers them, good,
2644 # we'll probably get better versions
2644 # we'll probably get better versions
2645 # self.shell.init_auto_alias()
2645 # self.shell.init_auto_alias()
2646 db = ip.db
2646 db = ip.db
2647 db['syscmdlist'] = syscmdlist
2647 db['syscmdlist'] = syscmdlist
2648 finally:
2648 finally:
2649 os.chdir(savedir)
2649 os.chdir(savedir)
2650
2650
2651 def magic_pwd(self, parameter_s = ''):
2651 def magic_pwd(self, parameter_s = ''):
2652 """Return the current working directory path."""
2652 """Return the current working directory path."""
2653 return os.getcwd()
2653 return os.getcwd()
2654
2654
2655 def magic_cd(self, parameter_s=''):
2655 def magic_cd(self, parameter_s=''):
2656 """Change the current working directory.
2656 """Change the current working directory.
2657
2657
2658 This command automatically maintains an internal list of directories
2658 This command automatically maintains an internal list of directories
2659 you visit during your IPython session, in the variable _dh. The
2659 you visit during your IPython session, in the variable _dh. The
2660 command %dhist shows this history nicely formatted. You can also
2660 command %dhist shows this history nicely formatted. You can also
2661 do 'cd -<tab>' to see directory history conveniently.
2661 do 'cd -<tab>' to see directory history conveniently.
2662
2662
2663 Usage:
2663 Usage:
2664
2664
2665 cd 'dir': changes to directory 'dir'.
2665 cd 'dir': changes to directory 'dir'.
2666
2666
2667 cd -: changes to the last visited directory.
2667 cd -: changes to the last visited directory.
2668
2668
2669 cd -<n>: changes to the n-th directory in the directory history.
2669 cd -<n>: changes to the n-th directory in the directory history.
2670
2670
2671 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2671 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2672 (note: cd <bookmark_name> is enough if there is no
2672 (note: cd <bookmark_name> is enough if there is no
2673 directory <bookmark_name>, but a bookmark with the name exists.)
2673 directory <bookmark_name>, but a bookmark with the name exists.)
2674 'cd -b <tab>' allows you to tab-complete bookmark names.
2674 'cd -b <tab>' allows you to tab-complete bookmark names.
2675
2675
2676 Options:
2676 Options:
2677
2677
2678 -q: quiet. Do not print the working directory after the cd command is
2678 -q: quiet. Do not print the working directory after the cd command is
2679 executed. By default IPython's cd command does print this directory,
2679 executed. By default IPython's cd command does print this directory,
2680 since the default prompts do not display path information.
2680 since the default prompts do not display path information.
2681
2681
2682 Note that !cd doesn't work for this purpose because the shell where
2682 Note that !cd doesn't work for this purpose because the shell where
2683 !command runs is immediately discarded after executing 'command'."""
2683 !command runs is immediately discarded after executing 'command'."""
2684
2684
2685 parameter_s = parameter_s.strip()
2685 parameter_s = parameter_s.strip()
2686 #bkms = self.shell.persist.get("bookmarks",{})
2686 #bkms = self.shell.persist.get("bookmarks",{})
2687
2687
2688 oldcwd = os.getcwd()
2688 oldcwd = os.getcwd()
2689 numcd = re.match(r'(-)(\d+)$',parameter_s)
2689 numcd = re.match(r'(-)(\d+)$',parameter_s)
2690 # jump in directory history by number
2690 # jump in directory history by number
2691 if numcd:
2691 if numcd:
2692 nn = int(numcd.group(2))
2692 nn = int(numcd.group(2))
2693 try:
2693 try:
2694 ps = self.shell.user_ns['_dh'][nn]
2694 ps = self.shell.user_ns['_dh'][nn]
2695 except IndexError:
2695 except IndexError:
2696 print 'The requested directory does not exist in history.'
2696 print 'The requested directory does not exist in history.'
2697 return
2697 return
2698 else:
2698 else:
2699 opts = {}
2699 opts = {}
2700 else:
2700 else:
2701 #turn all non-space-escaping backslashes to slashes,
2701 #turn all non-space-escaping backslashes to slashes,
2702 # for c:\windows\directory\names\
2702 # for c:\windows\directory\names\
2703 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2703 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2704 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2704 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2705 # jump to previous
2705 # jump to previous
2706 if ps == '-':
2706 if ps == '-':
2707 try:
2707 try:
2708 ps = self.shell.user_ns['_dh'][-2]
2708 ps = self.shell.user_ns['_dh'][-2]
2709 except IndexError:
2709 except IndexError:
2710 raise UsageError('%cd -: No previous directory to change to.')
2710 raise UsageError('%cd -: No previous directory to change to.')
2711 # jump to bookmark if needed
2711 # jump to bookmark if needed
2712 else:
2712 else:
2713 if not os.path.isdir(ps) or opts.has_key('b'):
2713 if not os.path.isdir(ps) or opts.has_key('b'):
2714 bkms = self.db.get('bookmarks', {})
2714 bkms = self.db.get('bookmarks', {})
2715
2715
2716 if bkms.has_key(ps):
2716 if bkms.has_key(ps):
2717 target = bkms[ps]
2717 target = bkms[ps]
2718 print '(bookmark:%s) -> %s' % (ps,target)
2718 print '(bookmark:%s) -> %s' % (ps,target)
2719 ps = target
2719 ps = target
2720 else:
2720 else:
2721 if opts.has_key('b'):
2721 if opts.has_key('b'):
2722 raise UsageError("Bookmark '%s' not found. "
2722 raise UsageError("Bookmark '%s' not found. "
2723 "Use '%%bookmark -l' to see your bookmarks." % ps)
2723 "Use '%%bookmark -l' to see your bookmarks." % ps)
2724
2724
2725 # at this point ps should point to the target dir
2725 # at this point ps should point to the target dir
2726 if ps:
2726 if ps:
2727 try:
2727 try:
2728 os.chdir(os.path.expanduser(ps))
2728 os.chdir(os.path.expanduser(ps))
2729 if self.shell.rc.term_title:
2729 if self.shell.rc.term_title:
2730 #print 'set term title:',self.shell.rc.term_title # dbg
2730 #print 'set term title:',self.shell.rc.term_title # dbg
2731 ttitle = 'IPy ' + abbrev_cwd()
2731 ttitle = 'IPy ' + abbrev_cwd()
2732 platutils.set_term_title(ttitle)
2732 platutils.set_term_title(ttitle)
2733 except OSError:
2733 except OSError:
2734 print sys.exc_info()[1]
2734 print sys.exc_info()[1]
2735 else:
2735 else:
2736 cwd = os.getcwd()
2736 cwd = os.getcwd()
2737 dhist = self.shell.user_ns['_dh']
2737 dhist = self.shell.user_ns['_dh']
2738 if oldcwd != cwd:
2738 if oldcwd != cwd:
2739 dhist.append(cwd)
2739 dhist.append(cwd)
2740 self.db['dhist'] = compress_dhist(dhist)[-100:]
2740 self.db['dhist'] = compress_dhist(dhist)[-100:]
2741
2741
2742 else:
2742 else:
2743 os.chdir(self.shell.home_dir)
2743 os.chdir(self.shell.home_dir)
2744 if self.shell.rc.term_title:
2744 if self.shell.rc.term_title:
2745 platutils.set_term_title("IPy ~")
2745 platutils.set_term_title("IPy ~")
2746 cwd = os.getcwd()
2746 cwd = os.getcwd()
2747 dhist = self.shell.user_ns['_dh']
2747 dhist = self.shell.user_ns['_dh']
2748
2748
2749 if oldcwd != cwd:
2749 if oldcwd != cwd:
2750 dhist.append(cwd)
2750 dhist.append(cwd)
2751 self.db['dhist'] = compress_dhist(dhist)[-100:]
2751 self.db['dhist'] = compress_dhist(dhist)[-100:]
2752 if not 'q' in opts and self.shell.user_ns['_dh']:
2752 if not 'q' in opts and self.shell.user_ns['_dh']:
2753 print self.shell.user_ns['_dh'][-1]
2753 print self.shell.user_ns['_dh'][-1]
2754
2754
2755
2755
2756 def magic_env(self, parameter_s=''):
2756 def magic_env(self, parameter_s=''):
2757 """List environment variables."""
2757 """List environment variables."""
2758
2758
2759 return os.environ.data
2759 return os.environ.data
2760
2760
2761 def magic_pushd(self, parameter_s=''):
2761 def magic_pushd(self, parameter_s=''):
2762 """Place the current dir on stack and change directory.
2762 """Place the current dir on stack and change directory.
2763
2763
2764 Usage:\\
2764 Usage:\\
2765 %pushd ['dirname']
2765 %pushd ['dirname']
2766 """
2766 """
2767
2767
2768 dir_s = self.shell.dir_stack
2768 dir_s = self.shell.dir_stack
2769 tgt = os.path.expanduser(parameter_s)
2769 tgt = os.path.expanduser(parameter_s)
2770 cwd = os.getcwd().replace(self.home_dir,'~')
2770 cwd = os.getcwd().replace(self.home_dir,'~')
2771 if tgt:
2771 if tgt:
2772 self.magic_cd(parameter_s)
2772 self.magic_cd(parameter_s)
2773 dir_s.insert(0,cwd)
2773 dir_s.insert(0,cwd)
2774 return self.magic_dirs()
2774 return self.magic_dirs()
2775
2775
2776 def magic_popd(self, parameter_s=''):
2776 def magic_popd(self, parameter_s=''):
2777 """Change to directory popped off the top of the stack.
2777 """Change to directory popped off the top of the stack.
2778 """
2778 """
2779 if not self.shell.dir_stack:
2779 if not self.shell.dir_stack:
2780 raise UsageError("%popd on empty stack")
2780 raise UsageError("%popd on empty stack")
2781 top = self.shell.dir_stack.pop(0)
2781 top = self.shell.dir_stack.pop(0)
2782 self.magic_cd(top)
2782 self.magic_cd(top)
2783 print "popd ->",top
2783 print "popd ->",top
2784
2784
2785 def magic_dirs(self, parameter_s=''):
2785 def magic_dirs(self, parameter_s=''):
2786 """Return the current directory stack."""
2786 """Return the current directory stack."""
2787
2787
2788 return self.shell.dir_stack
2788 return self.shell.dir_stack
2789
2789
2790 def magic_dhist(self, parameter_s=''):
2790 def magic_dhist(self, parameter_s=''):
2791 """Print your history of visited directories.
2791 """Print your history of visited directories.
2792
2792
2793 %dhist -> print full history\\
2793 %dhist -> print full history\\
2794 %dhist n -> print last n entries only\\
2794 %dhist n -> print last n entries only\\
2795 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2795 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2796
2796
2797 This history is automatically maintained by the %cd command, and
2797 This history is automatically maintained by the %cd command, and
2798 always available as the global list variable _dh. You can use %cd -<n>
2798 always available as the global list variable _dh. You can use %cd -<n>
2799 to go to directory number <n>.
2799 to go to directory number <n>.
2800
2800
2801 Note that most of time, you should view directory history by entering
2801 Note that most of time, you should view directory history by entering
2802 cd -<TAB>.
2802 cd -<TAB>.
2803
2803
2804 """
2804 """
2805
2805
2806 dh = self.shell.user_ns['_dh']
2806 dh = self.shell.user_ns['_dh']
2807 if parameter_s:
2807 if parameter_s:
2808 try:
2808 try:
2809 args = map(int,parameter_s.split())
2809 args = map(int,parameter_s.split())
2810 except:
2810 except:
2811 self.arg_err(Magic.magic_dhist)
2811 self.arg_err(Magic.magic_dhist)
2812 return
2812 return
2813 if len(args) == 1:
2813 if len(args) == 1:
2814 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2814 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2815 elif len(args) == 2:
2815 elif len(args) == 2:
2816 ini,fin = args
2816 ini,fin = args
2817 else:
2817 else:
2818 self.arg_err(Magic.magic_dhist)
2818 self.arg_err(Magic.magic_dhist)
2819 return
2819 return
2820 else:
2820 else:
2821 ini,fin = 0,len(dh)
2821 ini,fin = 0,len(dh)
2822 nlprint(dh,
2822 nlprint(dh,
2823 header = 'Directory history (kept in _dh)',
2823 header = 'Directory history (kept in _dh)',
2824 start=ini,stop=fin)
2824 start=ini,stop=fin)
2825
2825
2826
2826
2827 def magic_sc(self, parameter_s=''):
2827 def magic_sc(self, parameter_s=''):
2828 """Shell capture - execute a shell command and capture its output.
2828 """Shell capture - execute a shell command and capture its output.
2829
2829
2830 DEPRECATED. Suboptimal, retained for backwards compatibility.
2830 DEPRECATED. Suboptimal, retained for backwards compatibility.
2831
2831
2832 You should use the form 'var = !command' instead. Example:
2832 You should use the form 'var = !command' instead. Example:
2833
2833
2834 "%sc -l myfiles = ls ~" should now be written as
2834 "%sc -l myfiles = ls ~" should now be written as
2835
2835
2836 "myfiles = !ls ~"
2836 "myfiles = !ls ~"
2837
2837
2838 myfiles.s, myfiles.l and myfiles.n still apply as documented
2838 myfiles.s, myfiles.l and myfiles.n still apply as documented
2839 below.
2839 below.
2840
2840
2841 --
2841 --
2842 %sc [options] varname=command
2842 %sc [options] varname=command
2843
2843
2844 IPython will run the given command using commands.getoutput(), and
2844 IPython will run the given command using commands.getoutput(), and
2845 will then update the user's interactive namespace with a variable
2845 will then update the user's interactive namespace with a variable
2846 called varname, containing the value of the call. Your command can
2846 called varname, containing the value of the call. Your command can
2847 contain shell wildcards, pipes, etc.
2847 contain shell wildcards, pipes, etc.
2848
2848
2849 The '=' sign in the syntax is mandatory, and the variable name you
2849 The '=' sign in the syntax is mandatory, and the variable name you
2850 supply must follow Python's standard conventions for valid names.
2850 supply must follow Python's standard conventions for valid names.
2851
2851
2852 (A special format without variable name exists for internal use)
2852 (A special format without variable name exists for internal use)
2853
2853
2854 Options:
2854 Options:
2855
2855
2856 -l: list output. Split the output on newlines into a list before
2856 -l: list output. Split the output on newlines into a list before
2857 assigning it to the given variable. By default the output is stored
2857 assigning it to the given variable. By default the output is stored
2858 as a single string.
2858 as a single string.
2859
2859
2860 -v: verbose. Print the contents of the variable.
2860 -v: verbose. Print the contents of the variable.
2861
2861
2862 In most cases you should not need to split as a list, because the
2862 In most cases you should not need to split as a list, because the
2863 returned value is a special type of string which can automatically
2863 returned value is a special type of string which can automatically
2864 provide its contents either as a list (split on newlines) or as a
2864 provide its contents either as a list (split on newlines) or as a
2865 space-separated string. These are convenient, respectively, either
2865 space-separated string. These are convenient, respectively, either
2866 for sequential processing or to be passed to a shell command.
2866 for sequential processing or to be passed to a shell command.
2867
2867
2868 For example:
2868 For example:
2869
2869
2870 # Capture into variable a
2870 # Capture into variable a
2871 In [9]: sc a=ls *py
2871 In [9]: sc a=ls *py
2872
2872
2873 # a is a string with embedded newlines
2873 # a is a string with embedded newlines
2874 In [10]: a
2874 In [10]: a
2875 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2875 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2876
2876
2877 # which can be seen as a list:
2877 # which can be seen as a list:
2878 In [11]: a.l
2878 In [11]: a.l
2879 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2879 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2880
2880
2881 # or as a whitespace-separated string:
2881 # or as a whitespace-separated string:
2882 In [12]: a.s
2882 In [12]: a.s
2883 Out[12]: 'setup.py win32_manual_post_install.py'
2883 Out[12]: 'setup.py win32_manual_post_install.py'
2884
2884
2885 # a.s is useful to pass as a single command line:
2885 # a.s is useful to pass as a single command line:
2886 In [13]: !wc -l $a.s
2886 In [13]: !wc -l $a.s
2887 146 setup.py
2887 146 setup.py
2888 130 win32_manual_post_install.py
2888 130 win32_manual_post_install.py
2889 276 total
2889 276 total
2890
2890
2891 # while the list form is useful to loop over:
2891 # while the list form is useful to loop over:
2892 In [14]: for f in a.l:
2892 In [14]: for f in a.l:
2893 ....: !wc -l $f
2893 ....: !wc -l $f
2894 ....:
2894 ....:
2895 146 setup.py
2895 146 setup.py
2896 130 win32_manual_post_install.py
2896 130 win32_manual_post_install.py
2897
2897
2898 Similiarly, the lists returned by the -l option are also special, in
2898 Similiarly, the lists returned by the -l option are also special, in
2899 the sense that you can equally invoke the .s attribute on them to
2899 the sense that you can equally invoke the .s attribute on them to
2900 automatically get a whitespace-separated string from their contents:
2900 automatically get a whitespace-separated string from their contents:
2901
2901
2902 In [1]: sc -l b=ls *py
2902 In [1]: sc -l b=ls *py
2903
2903
2904 In [2]: b
2904 In [2]: b
2905 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2905 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2906
2906
2907 In [3]: b.s
2907 In [3]: b.s
2908 Out[3]: 'setup.py win32_manual_post_install.py'
2908 Out[3]: 'setup.py win32_manual_post_install.py'
2909
2909
2910 In summary, both the lists and strings used for ouptut capture have
2910 In summary, both the lists and strings used for ouptut capture have
2911 the following special attributes:
2911 the following special attributes:
2912
2912
2913 .l (or .list) : value as list.
2913 .l (or .list) : value as list.
2914 .n (or .nlstr): value as newline-separated string.
2914 .n (or .nlstr): value as newline-separated string.
2915 .s (or .spstr): value as space-separated string.
2915 .s (or .spstr): value as space-separated string.
2916 """
2916 """
2917
2917
2918 opts,args = self.parse_options(parameter_s,'lv')
2918 opts,args = self.parse_options(parameter_s,'lv')
2919 # Try to get a variable name and command to run
2919 # Try to get a variable name and command to run
2920 try:
2920 try:
2921 # the variable name must be obtained from the parse_options
2921 # the variable name must be obtained from the parse_options
2922 # output, which uses shlex.split to strip options out.
2922 # output, which uses shlex.split to strip options out.
2923 var,_ = args.split('=',1)
2923 var,_ = args.split('=',1)
2924 var = var.strip()
2924 var = var.strip()
2925 # But the the command has to be extracted from the original input
2925 # But the the command has to be extracted from the original input
2926 # parameter_s, not on what parse_options returns, to avoid the
2926 # parameter_s, not on what parse_options returns, to avoid the
2927 # quote stripping which shlex.split performs on it.
2927 # quote stripping which shlex.split performs on it.
2928 _,cmd = parameter_s.split('=',1)
2928 _,cmd = parameter_s.split('=',1)
2929 except ValueError:
2929 except ValueError:
2930 var,cmd = '',''
2930 var,cmd = '',''
2931 # If all looks ok, proceed
2931 # If all looks ok, proceed
2932 out,err = self.shell.getoutputerror(cmd)
2932 out,err = self.shell.getoutputerror(cmd)
2933 if err:
2933 if err:
2934 print >> Term.cerr,err
2934 print >> Term.cerr,err
2935 if opts.has_key('l'):
2935 if opts.has_key('l'):
2936 out = SList(out.split('\n'))
2936 out = SList(out.split('\n'))
2937 else:
2937 else:
2938 out = LSString(out)
2938 out = LSString(out)
2939 if opts.has_key('v'):
2939 if opts.has_key('v'):
2940 print '%s ==\n%s' % (var,pformat(out))
2940 print '%s ==\n%s' % (var,pformat(out))
2941 if var:
2941 if var:
2942 self.shell.user_ns.update({var:out})
2942 self.shell.user_ns.update({var:out})
2943 else:
2943 else:
2944 return out
2944 return out
2945
2945
2946 def magic_sx(self, parameter_s=''):
2946 def magic_sx(self, parameter_s=''):
2947 """Shell execute - run a shell command and capture its output.
2947 """Shell execute - run a shell command and capture its output.
2948
2948
2949 %sx command
2949 %sx command
2950
2950
2951 IPython will run the given command using commands.getoutput(), and
2951 IPython will run the given command using commands.getoutput(), and
2952 return the result formatted as a list (split on '\\n'). Since the
2952 return the result formatted as a list (split on '\\n'). Since the
2953 output is _returned_, it will be stored in ipython's regular output
2953 output is _returned_, it will be stored in ipython's regular output
2954 cache Out[N] and in the '_N' automatic variables.
2954 cache Out[N] and in the '_N' automatic variables.
2955
2955
2956 Notes:
2956 Notes:
2957
2957
2958 1) If an input line begins with '!!', then %sx is automatically
2958 1) If an input line begins with '!!', then %sx is automatically
2959 invoked. That is, while:
2959 invoked. That is, while:
2960 !ls
2960 !ls
2961 causes ipython to simply issue system('ls'), typing
2961 causes ipython to simply issue system('ls'), typing
2962 !!ls
2962 !!ls
2963 is a shorthand equivalent to:
2963 is a shorthand equivalent to:
2964 %sx ls
2964 %sx ls
2965
2965
2966 2) %sx differs from %sc in that %sx automatically splits into a list,
2966 2) %sx differs from %sc in that %sx automatically splits into a list,
2967 like '%sc -l'. The reason for this is to make it as easy as possible
2967 like '%sc -l'. The reason for this is to make it as easy as possible
2968 to process line-oriented shell output via further python commands.
2968 to process line-oriented shell output via further python commands.
2969 %sc is meant to provide much finer control, but requires more
2969 %sc is meant to provide much finer control, but requires more
2970 typing.
2970 typing.
2971
2971
2972 3) Just like %sc -l, this is a list with special attributes:
2972 3) Just like %sc -l, this is a list with special attributes:
2973
2973
2974 .l (or .list) : value as list.
2974 .l (or .list) : value as list.
2975 .n (or .nlstr): value as newline-separated string.
2975 .n (or .nlstr): value as newline-separated string.
2976 .s (or .spstr): value as whitespace-separated string.
2976 .s (or .spstr): value as whitespace-separated string.
2977
2977
2978 This is very useful when trying to use such lists as arguments to
2978 This is very useful when trying to use such lists as arguments to
2979 system commands."""
2979 system commands."""
2980
2980
2981 if parameter_s:
2981 if parameter_s:
2982 out,err = self.shell.getoutputerror(parameter_s)
2982 out,err = self.shell.getoutputerror(parameter_s)
2983 if err:
2983 if err:
2984 print >> Term.cerr,err
2984 print >> Term.cerr,err
2985 return SList(out.split('\n'))
2985 return SList(out.split('\n'))
2986
2986
2987 def magic_bg(self, parameter_s=''):
2987 def magic_bg(self, parameter_s=''):
2988 """Run a job in the background, in a separate thread.
2988 """Run a job in the background, in a separate thread.
2989
2989
2990 For example,
2990 For example,
2991
2991
2992 %bg myfunc(x,y,z=1)
2992 %bg myfunc(x,y,z=1)
2993
2993
2994 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2994 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2995 execution starts, a message will be printed indicating the job
2995 execution starts, a message will be printed indicating the job
2996 number. If your job number is 5, you can use
2996 number. If your job number is 5, you can use
2997
2997
2998 myvar = jobs.result(5) or myvar = jobs[5].result
2998 myvar = jobs.result(5) or myvar = jobs[5].result
2999
2999
3000 to assign this result to variable 'myvar'.
3000 to assign this result to variable 'myvar'.
3001
3001
3002 IPython has a job manager, accessible via the 'jobs' object. You can
3002 IPython has a job manager, accessible via the 'jobs' object. You can
3003 type jobs? to get more information about it, and use jobs.<TAB> to see
3003 type jobs? to get more information about it, and use jobs.<TAB> to see
3004 its attributes. All attributes not starting with an underscore are
3004 its attributes. All attributes not starting with an underscore are
3005 meant for public use.
3005 meant for public use.
3006
3006
3007 In particular, look at the jobs.new() method, which is used to create
3007 In particular, look at the jobs.new() method, which is used to create
3008 new jobs. This magic %bg function is just a convenience wrapper
3008 new jobs. This magic %bg function is just a convenience wrapper
3009 around jobs.new(), for expression-based jobs. If you want to create a
3009 around jobs.new(), for expression-based jobs. If you want to create a
3010 new job with an explicit function object and arguments, you must call
3010 new job with an explicit function object and arguments, you must call
3011 jobs.new() directly.
3011 jobs.new() directly.
3012
3012
3013 The jobs.new docstring also describes in detail several important
3013 The jobs.new docstring also describes in detail several important
3014 caveats associated with a thread-based model for background job
3014 caveats associated with a thread-based model for background job
3015 execution. Type jobs.new? for details.
3015 execution. Type jobs.new? for details.
3016
3016
3017 You can check the status of all jobs with jobs.status().
3017 You can check the status of all jobs with jobs.status().
3018
3018
3019 The jobs variable is set by IPython into the Python builtin namespace.
3019 The jobs variable is set by IPython into the Python builtin namespace.
3020 If you ever declare a variable named 'jobs', you will shadow this
3020 If you ever declare a variable named 'jobs', you will shadow this
3021 name. You can either delete your global jobs variable to regain
3021 name. You can either delete your global jobs variable to regain
3022 access to the job manager, or make a new name and assign it manually
3022 access to the job manager, or make a new name and assign it manually
3023 to the manager (stored in IPython's namespace). For example, to
3023 to the manager (stored in IPython's namespace). For example, to
3024 assign the job manager to the Jobs name, use:
3024 assign the job manager to the Jobs name, use:
3025
3025
3026 Jobs = __builtins__.jobs"""
3026 Jobs = __builtins__.jobs"""
3027
3027
3028 self.shell.jobs.new(parameter_s,self.shell.user_ns)
3028 self.shell.jobs.new(parameter_s,self.shell.user_ns)
3029
3029
3030 def magic_r(self, parameter_s=''):
3030 def magic_r(self, parameter_s=''):
3031 """Repeat previous input.
3031 """Repeat previous input.
3032
3032
3033 Note: Consider using the more powerfull %rep instead!
3033 Note: Consider using the more powerfull %rep instead!
3034
3034
3035 If given an argument, repeats the previous command which starts with
3035 If given an argument, repeats the previous command which starts with
3036 the same string, otherwise it just repeats the previous input.
3036 the same string, otherwise it just repeats the previous input.
3037
3037
3038 Shell escaped commands (with ! as first character) are not recognized
3038 Shell escaped commands (with ! as first character) are not recognized
3039 by this system, only pure python code and magic commands.
3039 by this system, only pure python code and magic commands.
3040 """
3040 """
3041
3041
3042 start = parameter_s.strip()
3042 start = parameter_s.strip()
3043 esc_magic = self.shell.ESC_MAGIC
3043 esc_magic = self.shell.ESC_MAGIC
3044 # Identify magic commands even if automagic is on (which means
3044 # Identify magic commands even if automagic is on (which means
3045 # the in-memory version is different from that typed by the user).
3045 # the in-memory version is different from that typed by the user).
3046 if self.shell.rc.automagic:
3046 if self.shell.rc.automagic:
3047 start_magic = esc_magic+start
3047 start_magic = esc_magic+start
3048 else:
3048 else:
3049 start_magic = start
3049 start_magic = start
3050 # Look through the input history in reverse
3050 # Look through the input history in reverse
3051 for n in range(len(self.shell.input_hist)-2,0,-1):
3051 for n in range(len(self.shell.input_hist)-2,0,-1):
3052 input = self.shell.input_hist[n]
3052 input = self.shell.input_hist[n]
3053 # skip plain 'r' lines so we don't recurse to infinity
3053 # skip plain 'r' lines so we don't recurse to infinity
3054 if input != '_ip.magic("r")\n' and \
3054 if input != '_ip.magic("r")\n' and \
3055 (input.startswith(start) or input.startswith(start_magic)):
3055 (input.startswith(start) or input.startswith(start_magic)):
3056 #print 'match',`input` # dbg
3056 #print 'match',`input` # dbg
3057 print 'Executing:',input,
3057 print 'Executing:',input,
3058 self.shell.runlines(input)
3058 self.shell.runlines(input)
3059 return
3059 return
3060 print 'No previous input matching `%s` found.' % start
3060 print 'No previous input matching `%s` found.' % start
3061
3061
3062
3062
3063 def magic_bookmark(self, parameter_s=''):
3063 def magic_bookmark(self, parameter_s=''):
3064 """Manage IPython's bookmark system.
3064 """Manage IPython's bookmark system.
3065
3065
3066 %bookmark <name> - set bookmark to current dir
3066 %bookmark <name> - set bookmark to current dir
3067 %bookmark <name> <dir> - set bookmark to <dir>
3067 %bookmark <name> <dir> - set bookmark to <dir>
3068 %bookmark -l - list all bookmarks
3068 %bookmark -l - list all bookmarks
3069 %bookmark -d <name> - remove bookmark
3069 %bookmark -d <name> - remove bookmark
3070 %bookmark -r - remove all bookmarks
3070 %bookmark -r - remove all bookmarks
3071
3071
3072 You can later on access a bookmarked folder with:
3072 You can later on access a bookmarked folder with:
3073 %cd -b <name>
3073 %cd -b <name>
3074 or simply '%cd <name>' if there is no directory called <name> AND
3074 or simply '%cd <name>' if there is no directory called <name> AND
3075 there is such a bookmark defined.
3075 there is such a bookmark defined.
3076
3076
3077 Your bookmarks persist through IPython sessions, but they are
3077 Your bookmarks persist through IPython sessions, but they are
3078 associated with each profile."""
3078 associated with each profile."""
3079
3079
3080 opts,args = self.parse_options(parameter_s,'drl',mode='list')
3080 opts,args = self.parse_options(parameter_s,'drl',mode='list')
3081 if len(args) > 2:
3081 if len(args) > 2:
3082 raise UsageError("%bookmark: too many arguments")
3082 raise UsageError("%bookmark: too many arguments")
3083
3083
3084 bkms = self.db.get('bookmarks',{})
3084 bkms = self.db.get('bookmarks',{})
3085
3085
3086 if opts.has_key('d'):
3086 if opts.has_key('d'):
3087 try:
3087 try:
3088 todel = args[0]
3088 todel = args[0]
3089 except IndexError:
3089 except IndexError:
3090 raise UsageError(
3090 raise UsageError(
3091 "%bookmark -d: must provide a bookmark to delete")
3091 "%bookmark -d: must provide a bookmark to delete")
3092 else:
3092 else:
3093 try:
3093 try:
3094 del bkms[todel]
3094 del bkms[todel]
3095 except KeyError:
3095 except KeyError:
3096 raise UsageError(
3096 raise UsageError(
3097 "%%bookmark -d: Can't delete bookmark '%s'" % todel)
3097 "%%bookmark -d: Can't delete bookmark '%s'" % todel)
3098
3098
3099 elif opts.has_key('r'):
3099 elif opts.has_key('r'):
3100 bkms = {}
3100 bkms = {}
3101 elif opts.has_key('l'):
3101 elif opts.has_key('l'):
3102 bks = bkms.keys()
3102 bks = bkms.keys()
3103 bks.sort()
3103 bks.sort()
3104 if bks:
3104 if bks:
3105 size = max(map(len,bks))
3105 size = max(map(len,bks))
3106 else:
3106 else:
3107 size = 0
3107 size = 0
3108 fmt = '%-'+str(size)+'s -> %s'
3108 fmt = '%-'+str(size)+'s -> %s'
3109 print 'Current bookmarks:'
3109 print 'Current bookmarks:'
3110 for bk in bks:
3110 for bk in bks:
3111 print fmt % (bk,bkms[bk])
3111 print fmt % (bk,bkms[bk])
3112 else:
3112 else:
3113 if not args:
3113 if not args:
3114 raise UsageError("%bookmark: You must specify the bookmark name")
3114 raise UsageError("%bookmark: You must specify the bookmark name")
3115 elif len(args)==1:
3115 elif len(args)==1:
3116 bkms[args[0]] = os.getcwd()
3116 bkms[args[0]] = os.getcwd()
3117 elif len(args)==2:
3117 elif len(args)==2:
3118 bkms[args[0]] = args[1]
3118 bkms[args[0]] = args[1]
3119 self.db['bookmarks'] = bkms
3119 self.db['bookmarks'] = bkms
3120
3120
3121 def magic_pycat(self, parameter_s=''):
3121 def magic_pycat(self, parameter_s=''):
3122 """Show a syntax-highlighted file through a pager.
3122 """Show a syntax-highlighted file through a pager.
3123
3123
3124 This magic is similar to the cat utility, but it will assume the file
3124 This magic is similar to the cat utility, but it will assume the file
3125 to be Python source and will show it with syntax highlighting. """
3125 to be Python source and will show it with syntax highlighting. """
3126
3126
3127 try:
3127 try:
3128 filename = get_py_filename(parameter_s)
3128 filename = get_py_filename(parameter_s)
3129 cont = file_read(filename)
3129 cont = file_read(filename)
3130 except IOError:
3130 except IOError:
3131 try:
3131 try:
3132 cont = eval(parameter_s,self.user_ns)
3132 cont = eval(parameter_s,self.user_ns)
3133 except NameError:
3133 except NameError:
3134 cont = None
3134 cont = None
3135 if cont is None:
3135 if cont is None:
3136 print "Error: no such file or variable"
3136 print "Error: no such file or variable"
3137 return
3137 return
3138
3138
3139 page(self.shell.pycolorize(cont),
3139 page(self.shell.pycolorize(cont),
3140 screen_lines=self.shell.rc.screen_length)
3140 screen_lines=self.shell.rc.screen_length)
3141
3141
3142 def magic_cpaste(self, parameter_s=''):
3142 def magic_cpaste(self, parameter_s=''):
3143 """Allows you to paste & execute a pre-formatted code block from clipboard
3143 """Allows you to paste & execute a pre-formatted code block from clipboard.
3144
3144
3145 You must terminate the block with '--' (two minus-signs) alone on the
3145 You must terminate the block with '--' (two minus-signs) alone on the
3146 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3146 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3147 is the new sentinel for this operation)
3147 is the new sentinel for this operation)
3148
3148
3149 The block is dedented prior to execution to enable execution of method
3149 The block is dedented prior to execution to enable execution of method
3150 definitions. '>' and '+' characters at the beginning of a line are
3150 definitions. '>' and '+' characters at the beginning of a line are
3151 ignored, to allow pasting directly from e-mails, diff files and doctests.
3151 ignored, to allow pasting directly from e-mails, diff files and
3152 The executed block is also assigned to variable named 'pasted_block' for
3152 doctests (the '...' continuation prompt is also stripped). The
3153 executed block is also assigned to variable named 'pasted_block' for
3153 later editing with '%edit pasted_block'.
3154 later editing with '%edit pasted_block'.
3154
3155
3155 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3156 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3156 This assigns the pasted block to variable 'foo' as string, without
3157 This assigns the pasted block to variable 'foo' as string, without
3157 dedenting or executing it (preceding >>> and + is still stripped)
3158 dedenting or executing it (preceding >>> and + is still stripped)
3158
3159
3159 Do not be alarmed by garbled output on Windows (it's a readline bug).
3160 Do not be alarmed by garbled output on Windows (it's a readline bug).
3160 Just press enter and type -- (and press enter again) and the block
3161 Just press enter and type -- (and press enter again) and the block
3161 will be what was just pasted.
3162 will be what was just pasted.
3162
3163
3163 IPython statements (magics, shell escapes) are not supported (yet).
3164 IPython statements (magics, shell escapes) are not supported (yet).
3164 """
3165 """
3165 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3166 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3166 par = args.strip()
3167 par = args.strip()
3167 sentinel = opts.get('s','--')
3168 sentinel = opts.get('s','--')
3168
3169
3169 strip_from_start = [re.compile(e) for e in
3170 # Regular expressions that declare text we strip from the input:
3170 [r'^\s*(\s?>)+',r'^\s*In \[\d+\]:',r'^\++']]
3171 strip_re = [r'^\s*In \[\d+\]:', # IPython input prompt
3172 r'^\s*(\s?>)+', # Python input prompt
3173 r'^\s*\.{3,}', # Continuation prompts
3174 r'^\++',
3175 ]
3176
3177 strip_from_start = map(re.compile,strip_re)
3178
3171 from IPython import iplib
3179 from IPython import iplib
3172 lines = []
3180 lines = []
3173 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3181 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3174 while 1:
3182 while 1:
3175 l = iplib.raw_input_original(':')
3183 l = iplib.raw_input_original(':')
3176 if l ==sentinel:
3184 if l ==sentinel:
3177 break
3185 break
3178
3186
3179 for pat in strip_from_start:
3187 for pat in strip_from_start:
3180 l = pat.sub('',l)
3188 l = pat.sub('',l)
3181 lines.append(l)
3189 lines.append(l)
3182
3190
3183 block = "\n".join(lines) + '\n'
3191 block = "\n".join(lines) + '\n'
3184 #print "block:\n",block
3192 #print "block:\n",block
3185 if not par:
3193 if not par:
3186 b = textwrap.dedent(block)
3194 b = textwrap.dedent(block)
3187 exec b in self.user_ns
3195 exec b in self.user_ns
3188 self.user_ns['pasted_block'] = b
3196 self.user_ns['pasted_block'] = b
3189 else:
3197 else:
3190 self.user_ns[par] = block
3198 self.user_ns[par] = block
3191 print "Block assigned to '%s'" % par
3199 print "Block assigned to '%s'" % par
3192
3200
3193 def magic_quickref(self,arg):
3201 def magic_quickref(self,arg):
3194 """ Show a quick reference sheet """
3202 """ Show a quick reference sheet """
3195 import IPython.usage
3203 import IPython.usage
3196 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3204 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3197
3205
3198 page(qr)
3206 page(qr)
3199
3207
3200 def magic_upgrade(self,arg):
3208 def magic_upgrade(self,arg):
3201 """ Upgrade your IPython installation
3209 """ Upgrade your IPython installation
3202
3210
3203 This will copy the config files that don't yet exist in your
3211 This will copy the config files that don't yet exist in your
3204 ipython dir from the system config dir. Use this after upgrading
3212 ipython dir from the system config dir. Use this after upgrading
3205 IPython if you don't wish to delete your .ipython dir.
3213 IPython if you don't wish to delete your .ipython dir.
3206
3214
3207 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3215 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3208 new users)
3216 new users)
3209
3217
3210 """
3218 """
3211 ip = self.getapi()
3219 ip = self.getapi()
3212 ipinstallation = path(IPython.__file__).dirname()
3220 ipinstallation = path(IPython.__file__).dirname()
3213 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3221 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3214 src_config = ipinstallation / 'UserConfig'
3222 src_config = ipinstallation / 'UserConfig'
3215 userdir = path(ip.options.ipythondir)
3223 userdir = path(ip.options.ipythondir)
3216 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3224 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3217 print ">",cmd
3225 print ">",cmd
3218 shell(cmd)
3226 shell(cmd)
3219 if arg == '-nolegacy':
3227 if arg == '-nolegacy':
3220 legacy = userdir.files('ipythonrc*')
3228 legacy = userdir.files('ipythonrc*')
3221 print "Nuking legacy files:",legacy
3229 print "Nuking legacy files:",legacy
3222
3230
3223 [p.remove() for p in legacy]
3231 [p.remove() for p in legacy]
3224 suffix = (sys.platform == 'win32' and '.ini' or '')
3232 suffix = (sys.platform == 'win32' and '.ini' or '')
3225 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3233 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3226
3234
3227
3235
3228 def magic_doctest_mode(self,parameter_s=''):
3236 def magic_doctest_mode(self,parameter_s=''):
3229 """Toggle doctest mode on and off.
3237 """Toggle doctest mode on and off.
3230
3238
3231 This mode allows you to toggle the prompt behavior between normal
3239 This mode allows you to toggle the prompt behavior between normal
3232 IPython prompts and ones that are as similar to the default IPython
3240 IPython prompts and ones that are as similar to the default IPython
3233 interpreter as possible.
3241 interpreter as possible.
3234
3242
3235 It also supports the pasting of code snippets that have leading '>>>'
3243 It also supports the pasting of code snippets that have leading '>>>'
3236 and '...' prompts in them. This means that you can paste doctests from
3244 and '...' prompts in them. This means that you can paste doctests from
3237 files or docstrings (even if they have leading whitespace), and the
3245 files or docstrings (even if they have leading whitespace), and the
3238 code will execute correctly. You can then use '%history -tn' to see
3246 code will execute correctly. You can then use '%history -tn' to see
3239 the translated history without line numbers; this will give you the
3247 the translated history without line numbers; this will give you the
3240 input after removal of all the leading prompts and whitespace, which
3248 input after removal of all the leading prompts and whitespace, which
3241 can be pasted back into an editor.
3249 can be pasted back into an editor.
3242
3250
3243 With these features, you can switch into this mode easily whenever you
3251 With these features, you can switch into this mode easily whenever you
3244 need to do testing and changes to doctests, without having to leave
3252 need to do testing and changes to doctests, without having to leave
3245 your existing IPython session.
3253 your existing IPython session.
3246 """
3254 """
3247
3255
3248 # XXX - Fix this to have cleaner activate/deactivate calls.
3256 # XXX - Fix this to have cleaner activate/deactivate calls.
3249 from IPython.Extensions import InterpreterPasteInput as ipaste
3257 from IPython.Extensions import InterpreterPasteInput as ipaste
3250 from IPython.ipstruct import Struct
3258 from IPython.ipstruct import Struct
3251
3259
3252 # Shorthands
3260 # Shorthands
3253 shell = self.shell
3261 shell = self.shell
3254 oc = shell.outputcache
3262 oc = shell.outputcache
3255 rc = shell.rc
3263 rc = shell.rc
3256 meta = shell.meta
3264 meta = shell.meta
3257 # dstore is a data store kept in the instance metadata bag to track any
3265 # dstore is a data store kept in the instance metadata bag to track any
3258 # changes we make, so we can undo them later.
3266 # changes we make, so we can undo them later.
3259 dstore = meta.setdefault('doctest_mode',Struct())
3267 dstore = meta.setdefault('doctest_mode',Struct())
3260 save_dstore = dstore.setdefault
3268 save_dstore = dstore.setdefault
3261
3269
3262 # save a few values we'll need to recover later
3270 # save a few values we'll need to recover later
3263 mode = save_dstore('mode',False)
3271 mode = save_dstore('mode',False)
3264 save_dstore('rc_pprint',rc.pprint)
3272 save_dstore('rc_pprint',rc.pprint)
3265 save_dstore('xmode',shell.InteractiveTB.mode)
3273 save_dstore('xmode',shell.InteractiveTB.mode)
3266 save_dstore('rc_separate_out',rc.separate_out)
3274 save_dstore('rc_separate_out',rc.separate_out)
3267 save_dstore('rc_separate_out2',rc.separate_out2)
3275 save_dstore('rc_separate_out2',rc.separate_out2)
3268 save_dstore('rc_prompts_pad_left',rc.prompts_pad_left)
3276 save_dstore('rc_prompts_pad_left',rc.prompts_pad_left)
3269
3277
3270 if mode == False:
3278 if mode == False:
3271 # turn on
3279 # turn on
3272 ipaste.activate_prefilter()
3280 ipaste.activate_prefilter()
3273
3281
3274 oc.prompt1.p_template = '>>> '
3282 oc.prompt1.p_template = '>>> '
3275 oc.prompt2.p_template = '... '
3283 oc.prompt2.p_template = '... '
3276 oc.prompt_out.p_template = ''
3284 oc.prompt_out.p_template = ''
3277
3285
3278 oc.output_sep = ''
3286 oc.output_sep = ''
3279 oc.output_sep2 = ''
3287 oc.output_sep2 = ''
3280
3288
3281 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3289 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3282 oc.prompt_out.pad_left = False
3290 oc.prompt_out.pad_left = False
3283
3291
3284 rc.pprint = False
3292 rc.pprint = False
3285
3293
3286 shell.magic_xmode('Plain')
3294 shell.magic_xmode('Plain')
3287
3295
3288 else:
3296 else:
3289 # turn off
3297 # turn off
3290 ipaste.deactivate_prefilter()
3298 ipaste.deactivate_prefilter()
3291
3299
3292 oc.prompt1.p_template = rc.prompt_in1
3300 oc.prompt1.p_template = rc.prompt_in1
3293 oc.prompt2.p_template = rc.prompt_in2
3301 oc.prompt2.p_template = rc.prompt_in2
3294 oc.prompt_out.p_template = rc.prompt_out
3302 oc.prompt_out.p_template = rc.prompt_out
3295
3303
3296 oc.output_sep = dstore.rc_separate_out
3304 oc.output_sep = dstore.rc_separate_out
3297 oc.output_sep2 = dstore.rc_separate_out2
3305 oc.output_sep2 = dstore.rc_separate_out2
3298
3306
3299 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3307 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3300 oc.prompt_out.pad_left = dstore.rc_prompts_pad_left
3308 oc.prompt_out.pad_left = dstore.rc_prompts_pad_left
3301
3309
3302 rc.pprint = dstore.rc_pprint
3310 rc.pprint = dstore.rc_pprint
3303
3311
3304 shell.magic_xmode(dstore.xmode)
3312 shell.magic_xmode(dstore.xmode)
3305
3313
3306 # Store new mode and inform
3314 # Store new mode and inform
3307 dstore.mode = bool(1-int(mode))
3315 dstore.mode = bool(1-int(mode))
3308 print 'Doctest mode is:',
3316 print 'Doctest mode is:',
3309 print ['OFF','ON'][dstore.mode]
3317 print ['OFF','ON'][dstore.mode]
3310
3318
3311 # end Magic
3319 # end Magic
@@ -1,89 +1,89 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Release data for the IPython project.
2 """Release data for the IPython project.
3
3
4 $Id: Release.py 3002 2008-02-01 07:17:00Z fperez $"""
4 $Id: Release.py 3002 2008-02-01 07:17:00Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
7 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
8 #
8 #
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
10 # <n8gray@caltech.edu>
10 # <n8gray@caltech.edu>
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
14 #*****************************************************************************
14 #*****************************************************************************
15
15
16 # Name of the package for release purposes. This is the name which labels
16 # Name of the package for release purposes. This is the name which labels
17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
18 name = 'ipython'
18 name = 'ipython'
19
19
20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
21 # the new substring. We have to avoid using either dashes or underscores,
21 # the new substring. We have to avoid using either dashes or underscores,
22 # because bdist_rpm does not accept dashes (an RPM) convention, and
22 # because bdist_rpm does not accept dashes (an RPM) convention, and
23 # bdist_deb does not accept underscores (a Debian convention).
23 # bdist_deb does not accept underscores (a Debian convention).
24
24
25 revision = '83'
25 revision = '84'
26 branch = 'ipython'
26 branch = 'ipython'
27
27
28 if branch == 'ipython':
28 if branch == 'ipython':
29 version = '0.8.3.bzr.r' + revision
29 version = '0.8.3.bzr.r' + revision
30 else:
30 else:
31 version = '0.8.3.bzr.r%s.%s' % (revision,branch)
31 version = '0.8.3.bzr.r%s.%s' % (revision,branch)
32
32
33 version = '0.8.3'
33 version = '0.8.3'
34
34
35 description = "An enhanced interactive Python shell."
35 description = "An enhanced interactive Python shell."
36
36
37 long_description = \
37 long_description = \
38 """
38 """
39 IPython provides a replacement for the interactive Python interpreter with
39 IPython provides a replacement for the interactive Python interpreter with
40 extra functionality.
40 extra functionality.
41
41
42 Main features:
42 Main features:
43
43
44 * Comprehensive object introspection.
44 * Comprehensive object introspection.
45
45
46 * Input history, persistent across sessions.
46 * Input history, persistent across sessions.
47
47
48 * Caching of output results during a session with automatically generated
48 * Caching of output results during a session with automatically generated
49 references.
49 references.
50
50
51 * Readline based name completion.
51 * Readline based name completion.
52
52
53 * Extensible system of 'magic' commands for controlling the environment and
53 * Extensible system of 'magic' commands for controlling the environment and
54 performing many tasks related either to IPython or the operating system.
54 performing many tasks related either to IPython or the operating system.
55
55
56 * Configuration system with easy switching between different setups (simpler
56 * Configuration system with easy switching between different setups (simpler
57 than changing $PYTHONSTARTUP environment variables every time).
57 than changing $PYTHONSTARTUP environment variables every time).
58
58
59 * Session logging and reloading.
59 * Session logging and reloading.
60
60
61 * Extensible syntax processing for special purpose situations.
61 * Extensible syntax processing for special purpose situations.
62
62
63 * Access to the system shell with user-extensible alias system.
63 * Access to the system shell with user-extensible alias system.
64
64
65 * Easily embeddable in other Python programs.
65 * Easily embeddable in other Python programs.
66
66
67 * Integrated access to the pdb debugger and the Python profiler.
67 * Integrated access to the pdb debugger and the Python profiler.
68
68
69 The latest development version is always available at the IPython subversion
69 The latest development version is always available at the IPython subversion
70 repository_.
70 repository_.
71
71
72 .. _repository: http://ipython.scipy.org/svn/ipython/ipython/trunk#egg=ipython-dev
72 .. _repository: http://ipython.scipy.org/svn/ipython/ipython/trunk#egg=ipython-dev
73 """
73 """
74
74
75 license = 'BSD'
75 license = 'BSD'
76
76
77 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
77 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
78 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
78 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
79 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'),
79 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu'),
80 'Ville' : ('Ville Vainio','vivainio@gmail.com')
80 'Ville' : ('Ville Vainio','vivainio@gmail.com')
81 }
81 }
82
82
83 url = 'http://ipython.scipy.org'
83 url = 'http://ipython.scipy.org'
84
84
85 download_url = 'http://ipython.scipy.org/dist'
85 download_url = 'http://ipython.scipy.org/dist'
86
86
87 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
87 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
88
88
89 keywords = ['Interactive','Interpreter','Shell']
89 keywords = ['Interactive','Interpreter','Shell']
@@ -1,1045 +1,1045 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 ultraTB.py -- Spice up your tracebacks!
3 ultraTB.py -- Spice up your tracebacks!
4
4
5 * ColorTB
5 * ColorTB
6 I've always found it a bit hard to visually parse tracebacks in Python. The
6 I've always found it a bit hard to visually parse tracebacks in Python. The
7 ColorTB class is a solution to that problem. It colors the different parts of a
7 ColorTB class is a solution to that problem. It colors the different parts of a
8 traceback in a manner similar to what you would expect from a syntax-highlighting
8 traceback in a manner similar to what you would expect from a syntax-highlighting
9 text editor.
9 text editor.
10
10
11 Installation instructions for ColorTB:
11 Installation instructions for ColorTB:
12 import sys,ultraTB
12 import sys,ultraTB
13 sys.excepthook = ultraTB.ColorTB()
13 sys.excepthook = ultraTB.ColorTB()
14
14
15 * VerboseTB
15 * VerboseTB
16 I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds
16 I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds
17 of useful info when a traceback occurs. Ping originally had it spit out HTML
17 of useful info when a traceback occurs. Ping originally had it spit out HTML
18 and intended it for CGI programmers, but why should they have all the fun? I
18 and intended it for CGI programmers, but why should they have all the fun? I
19 altered it to spit out colored text to the terminal. It's a bit overwhelming,
19 altered it to spit out colored text to the terminal. It's a bit overwhelming,
20 but kind of neat, and maybe useful for long-running programs that you believe
20 but kind of neat, and maybe useful for long-running programs that you believe
21 are bug-free. If a crash *does* occur in that type of program you want details.
21 are bug-free. If a crash *does* occur in that type of program you want details.
22 Give it a shot--you'll love it or you'll hate it.
22 Give it a shot--you'll love it or you'll hate it.
23
23
24 Note:
24 Note:
25
25
26 The Verbose mode prints the variables currently visible where the exception
26 The Verbose mode prints the variables currently visible where the exception
27 happened (shortening their strings if too long). This can potentially be
27 happened (shortening their strings if too long). This can potentially be
28 very slow, if you happen to have a huge data structure whose string
28 very slow, if you happen to have a huge data structure whose string
29 representation is complex to compute. Your computer may appear to freeze for
29 representation is complex to compute. Your computer may appear to freeze for
30 a while with cpu usage at 100%. If this occurs, you can cancel the traceback
30 a while with cpu usage at 100%. If this occurs, you can cancel the traceback
31 with Ctrl-C (maybe hitting it more than once).
31 with Ctrl-C (maybe hitting it more than once).
32
32
33 If you encounter this kind of situation often, you may want to use the
33 If you encounter this kind of situation often, you may want to use the
34 Verbose_novars mode instead of the regular Verbose, which avoids formatting
34 Verbose_novars mode instead of the regular Verbose, which avoids formatting
35 variables (but otherwise includes the information and context given by
35 variables (but otherwise includes the information and context given by
36 Verbose).
36 Verbose).
37
37
38
38
39 Installation instructions for ColorTB:
39 Installation instructions for ColorTB:
40 import sys,ultraTB
40 import sys,ultraTB
41 sys.excepthook = ultraTB.VerboseTB()
41 sys.excepthook = ultraTB.VerboseTB()
42
42
43 Note: Much of the code in this module was lifted verbatim from the standard
43 Note: Much of the code in this module was lifted verbatim from the standard
44 library module 'traceback.py' and Ka-Ping Yee's 'cgitb.py'.
44 library module 'traceback.py' and Ka-Ping Yee's 'cgitb.py'.
45
45
46 * Color schemes
46 * Color schemes
47 The colors are defined in the class TBTools through the use of the
47 The colors are defined in the class TBTools through the use of the
48 ColorSchemeTable class. Currently the following exist:
48 ColorSchemeTable class. Currently the following exist:
49
49
50 - NoColor: allows all of this module to be used in any terminal (the color
50 - NoColor: allows all of this module to be used in any terminal (the color
51 escapes are just dummy blank strings).
51 escapes are just dummy blank strings).
52
52
53 - Linux: is meant to look good in a terminal like the Linux console (black
53 - Linux: is meant to look good in a terminal like the Linux console (black
54 or very dark background).
54 or very dark background).
55
55
56 - LightBG: similar to Linux but swaps dark/light colors to be more readable
56 - LightBG: similar to Linux but swaps dark/light colors to be more readable
57 in light background terminals.
57 in light background terminals.
58
58
59 You can implement other color schemes easily, the syntax is fairly
59 You can implement other color schemes easily, the syntax is fairly
60 self-explanatory. Please send back new schemes you develop to the author for
60 self-explanatory. Please send back new schemes you develop to the author for
61 possible inclusion in future releases.
61 possible inclusion in future releases.
62
62
63 $Id: ultraTB.py 2908 2007-12-30 21:07:46Z vivainio $"""
63 $Id: ultraTB.py 2908 2007-12-30 21:07:46Z vivainio $"""
64
64
65 #*****************************************************************************
65 #*****************************************************************************
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
67 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
67 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
68 #
68 #
69 # Distributed under the terms of the BSD License. The full license is in
69 # Distributed under the terms of the BSD License. The full license is in
70 # the file COPYING, distributed as part of this software.
70 # the file COPYING, distributed as part of this software.
71 #*****************************************************************************
71 #*****************************************************************************
72
72
73 from IPython import Release
73 from IPython import Release
74 __author__ = '%s <%s>\n%s <%s>' % (Release.authors['Nathan']+
74 __author__ = '%s <%s>\n%s <%s>' % (Release.authors['Nathan']+
75 Release.authors['Fernando'])
75 Release.authors['Fernando'])
76 __license__ = Release.license
76 __license__ = Release.license
77
77
78 # Required modules
78 # Required modules
79 import inspect
79 import inspect
80 import keyword
80 import keyword
81 import linecache
81 import linecache
82 import os
82 import os
83 import pydoc
83 import pydoc
84 import re
84 import re
85 import string
85 import string
86 import sys
86 import sys
87 import time
87 import time
88 import tokenize
88 import tokenize
89 import traceback
89 import traceback
90 import types
90 import types
91
91
92 # For purposes of monkeypatching inspect to fix a bug in it.
92 # For purposes of monkeypatching inspect to fix a bug in it.
93 from inspect import getsourcefile, getfile, getmodule,\
93 from inspect import getsourcefile, getfile, getmodule,\
94 ismodule, isclass, ismethod, isfunction, istraceback, isframe, iscode
94 ismodule, isclass, ismethod, isfunction, istraceback, isframe, iscode
95
95
96
96
97 # IPython's own modules
97 # IPython's own modules
98 # Modified pdb which doesn't damage IPython's readline handling
98 # Modified pdb which doesn't damage IPython's readline handling
99 from IPython import Debugger, PyColorize
99 from IPython import Debugger, PyColorize
100 from IPython.ipstruct import Struct
100 from IPython.ipstruct import Struct
101 from IPython.excolors import ExceptionColors
101 from IPython.excolors import ExceptionColors
102 from IPython.genutils import Term,uniq_stable,error,info
102 from IPython.genutils import Term,uniq_stable,error,info
103
103
104 # Globals
104 # Globals
105 # amount of space to put line numbers before verbose tracebacks
105 # amount of space to put line numbers before verbose tracebacks
106 INDENT_SIZE = 8
106 INDENT_SIZE = 8
107
107
108 # Default color scheme. This is used, for example, by the traceback
108 # Default color scheme. This is used, for example, by the traceback
109 # formatter. When running in an actual IPython instance, the user's rc.colors
109 # formatter. When running in an actual IPython instance, the user's rc.colors
110 # value is used, but havinga module global makes this functionality available
110 # value is used, but havinga module global makes this functionality available
111 # to users of ultraTB who are NOT running inside ipython.
111 # to users of ultraTB who are NOT running inside ipython.
112 DEFAULT_SCHEME = 'NoColor'
112 DEFAULT_SCHEME = 'NoColor'
113
113
114 #---------------------------------------------------------------------------
114 #---------------------------------------------------------------------------
115 # Code begins
115 # Code begins
116
116
117 # Utility functions
117 # Utility functions
118 def inspect_error():
118 def inspect_error():
119 """Print a message about internal inspect errors.
119 """Print a message about internal inspect errors.
120
120
121 These are unfortunately quite common."""
121 These are unfortunately quite common."""
122
122
123 error('Internal Python error in the inspect module.\n'
123 error('Internal Python error in the inspect module.\n'
124 'Below is the traceback from this internal error.\n')
124 'Below is the traceback from this internal error.\n')
125
125
126
126
127 def findsource(object):
127 def findsource(object):
128 """Return the entire source file and starting line number for an object.
128 """Return the entire source file and starting line number for an object.
129
129
130 The argument may be a module, class, method, function, traceback, frame,
130 The argument may be a module, class, method, function, traceback, frame,
131 or code object. The source code is returned as a list of all the lines
131 or code object. The source code is returned as a list of all the lines
132 in the file and the line number indexes a line in that list. An IOError
132 in the file and the line number indexes a line in that list. An IOError
133 is raised if the source code cannot be retrieved.
133 is raised if the source code cannot be retrieved.
134
134
135 FIXED version with which we monkeypatch the stdlib to work around a bug."""
135 FIXED version with which we monkeypatch the stdlib to work around a bug."""
136
136
137 file = getsourcefile(object) or getfile(object)
137 file = getsourcefile(object) or getfile(object)
138 # If the object is a frame, then trying to get the globals dict from its
138 # If the object is a frame, then trying to get the globals dict from its
139 # module won't work. Instead, the frame object itself has the globals
139 # module won't work. Instead, the frame object itself has the globals
140 # dictionary.
140 # dictionary.
141 globals_dict = None
141 globals_dict = None
142 if inspect.isframe(object):
142 if inspect.isframe(object):
143 # XXX: can this ever be false?
143 # XXX: can this ever be false?
144 globals_dict = object.f_globals
144 globals_dict = object.f_globals
145 else:
145 else:
146 module = getmodule(object, file)
146 module = getmodule(object, file)
147 if module:
147 if module:
148 globals_dict = module.__dict__
148 globals_dict = module.__dict__
149 lines = linecache.getlines(file, globals_dict)
149 lines = linecache.getlines(file, globals_dict)
150 if not lines:
150 if not lines:
151 raise IOError('could not get source code')
151 raise IOError('could not get source code')
152
152
153 if ismodule(object):
153 if ismodule(object):
154 return lines, 0
154 return lines, 0
155
155
156 if isclass(object):
156 if isclass(object):
157 name = object.__name__
157 name = object.__name__
158 pat = re.compile(r'^(\s*)class\s*' + name + r'\b')
158 pat = re.compile(r'^(\s*)class\s*' + name + r'\b')
159 # make some effort to find the best matching class definition:
159 # make some effort to find the best matching class definition:
160 # use the one with the least indentation, which is the one
160 # use the one with the least indentation, which is the one
161 # that's most probably not inside a function definition.
161 # that's most probably not inside a function definition.
162 candidates = []
162 candidates = []
163 for i in range(len(lines)):
163 for i in range(len(lines)):
164 match = pat.match(lines[i])
164 match = pat.match(lines[i])
165 if match:
165 if match:
166 # if it's at toplevel, it's already the best one
166 # if it's at toplevel, it's already the best one
167 if lines[i][0] == 'c':
167 if lines[i][0] == 'c':
168 return lines, i
168 return lines, i
169 # else add whitespace to candidate list
169 # else add whitespace to candidate list
170 candidates.append((match.group(1), i))
170 candidates.append((match.group(1), i))
171 if candidates:
171 if candidates:
172 # this will sort by whitespace, and by line number,
172 # this will sort by whitespace, and by line number,
173 # less whitespace first
173 # less whitespace first
174 candidates.sort()
174 candidates.sort()
175 return lines, candidates[0][1]
175 return lines, candidates[0][1]
176 else:
176 else:
177 raise IOError('could not find class definition')
177 raise IOError('could not find class definition')
178
178
179 if ismethod(object):
179 if ismethod(object):
180 object = object.im_func
180 object = object.im_func
181 if isfunction(object):
181 if isfunction(object):
182 object = object.func_code
182 object = object.func_code
183 if istraceback(object):
183 if istraceback(object):
184 object = object.tb_frame
184 object = object.tb_frame
185 if isframe(object):
185 if isframe(object):
186 object = object.f_code
186 object = object.f_code
187 if iscode(object):
187 if iscode(object):
188 if not hasattr(object, 'co_firstlineno'):
188 if not hasattr(object, 'co_firstlineno'):
189 raise IOError('could not find function definition')
189 raise IOError('could not find function definition')
190 pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)')
190 pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)')
191 pmatch = pat.match
191 pmatch = pat.match
192 # fperez - fix: sometimes, co_firstlineno can give a number larger than
192 # fperez - fix: sometimes, co_firstlineno can give a number larger than
193 # the length of lines, which causes an error. Safeguard against that.
193 # the length of lines, which causes an error. Safeguard against that.
194 lnum = min(object.co_firstlineno,len(lines))-1
194 lnum = min(object.co_firstlineno,len(lines))-1
195 while lnum > 0:
195 while lnum > 0:
196 if pmatch(lines[lnum]): break
196 if pmatch(lines[lnum]): break
197 lnum -= 1
197 lnum -= 1
198
198
199 return lines, lnum
199 return lines, lnum
200 raise IOError('could not find code object')
200 raise IOError('could not find code object')
201
201
202 # Monkeypatch inspect to apply our bugfix. This code only works with py25
202 # Monkeypatch inspect to apply our bugfix. This code only works with py25
203 if sys.version_info[:2] >= (2,5):
203 if sys.version_info[:2] >= (2,5):
204 inspect.findsource = findsource
204 inspect.findsource = findsource
205
205
206 def fix_frame_records_filenames(records):
206 def fix_frame_records_filenames(records):
207 """Try to fix the filenames in each record from inspect.getinnerframes().
207 """Try to fix the filenames in each record from inspect.getinnerframes().
208
208
209 Particularly, modules loaded from within zip files have useless filenames
209 Particularly, modules loaded from within zip files have useless filenames
210 attached to their code object, and inspect.getinnerframes() just uses it.
210 attached to their code object, and inspect.getinnerframes() just uses it.
211 """
211 """
212 fixed_records = []
212 fixed_records = []
213 for frame, filename, line_no, func_name, lines, index in records:
213 for frame, filename, line_no, func_name, lines, index in records:
214 # Look inside the frame's globals dictionary for __file__, which should
214 # Look inside the frame's globals dictionary for __file__, which should
215 # be better.
215 # be better.
216 better_fn = frame.f_globals.get('__file__', None)
216 better_fn = frame.f_globals.get('__file__', None)
217 if isinstance(better_fn, str):
217 if isinstance(better_fn, str):
218 # Check the type just in case someone did something weird with
218 # Check the type just in case someone did something weird with
219 # __file__. It might also be None if the error occurred during
219 # __file__. It might also be None if the error occurred during
220 # import.
220 # import.
221 filename = better_fn
221 filename = better_fn
222 fixed_records.append((frame, filename, line_no, func_name, lines, index))
222 fixed_records.append((frame, filename, line_no, func_name, lines, index))
223 return fixed_records
223 return fixed_records
224
224
225
225
226 def _fixed_getinnerframes(etb, context=1,tb_offset=0):
226 def _fixed_getinnerframes(etb, context=1,tb_offset=0):
227 import linecache
227 import linecache
228 LNUM_POS, LINES_POS, INDEX_POS = 2, 4, 5
228 LNUM_POS, LINES_POS, INDEX_POS = 2, 4, 5
229
229
230 records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
230 records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
231
231
232 # If the error is at the console, don't build any context, since it would
232 # If the error is at the console, don't build any context, since it would
233 # otherwise produce 5 blank lines printed out (there is no file at the
233 # otherwise produce 5 blank lines printed out (there is no file at the
234 # console)
234 # console)
235 rec_check = records[tb_offset:]
235 rec_check = records[tb_offset:]
236 try:
236 try:
237 rname = rec_check[0][1]
237 rname = rec_check[0][1]
238 if rname == '<ipython console>' or rname.endswith('<string>'):
238 if rname == '<ipython console>' or rname.endswith('<string>'):
239 return rec_check
239 return rec_check
240 except IndexError:
240 except IndexError:
241 pass
241 pass
242
242
243 aux = traceback.extract_tb(etb)
243 aux = traceback.extract_tb(etb)
244 assert len(records) == len(aux)
244 assert len(records) == len(aux)
245 for i, (file, lnum, _, _) in zip(range(len(records)), aux):
245 for i, (file, lnum, _, _) in zip(range(len(records)), aux):
246 maybeStart = lnum-1 - context//2
246 maybeStart = lnum-1 - context//2
247 start = max(maybeStart, 0)
247 start = max(maybeStart, 0)
248 end = start + context
248 end = start + context
249 lines = linecache.getlines(file)[start:end]
249 lines = linecache.getlines(file)[start:end]
250 # pad with empty lines if necessary
250 # pad with empty lines if necessary
251 if maybeStart < 0:
251 if maybeStart < 0:
252 lines = (['\n'] * -maybeStart) + lines
252 lines = (['\n'] * -maybeStart) + lines
253 if len(lines) < context:
253 if len(lines) < context:
254 lines += ['\n'] * (context - len(lines))
254 lines += ['\n'] * (context - len(lines))
255 buf = list(records[i])
255 buf = list(records[i])
256 buf[LNUM_POS] = lnum
256 buf[LNUM_POS] = lnum
257 buf[INDEX_POS] = lnum - 1 - start
257 buf[INDEX_POS] = lnum - 1 - start
258 buf[LINES_POS] = lines
258 buf[LINES_POS] = lines
259 records[i] = tuple(buf)
259 records[i] = tuple(buf)
260 return records[tb_offset:]
260 return records[tb_offset:]
261
261
262 # Helper function -- largely belongs to VerboseTB, but we need the same
262 # Helper function -- largely belongs to VerboseTB, but we need the same
263 # functionality to produce a pseudo verbose TB for SyntaxErrors, so that they
263 # functionality to produce a pseudo verbose TB for SyntaxErrors, so that they
264 # can be recognized properly by ipython.el's py-traceback-line-re
264 # can be recognized properly by ipython.el's py-traceback-line-re
265 # (SyntaxErrors have to be treated specially because they have no traceback)
265 # (SyntaxErrors have to be treated specially because they have no traceback)
266
266
267 _parser = PyColorize.Parser()
267 _parser = PyColorize.Parser()
268
268
269 def _formatTracebackLines(lnum, index, lines, Colors, lvals=None,scheme=None):
269 def _formatTracebackLines(lnum, index, lines, Colors, lvals=None,scheme=None):
270 numbers_width = INDENT_SIZE - 1
270 numbers_width = INDENT_SIZE - 1
271 res = []
271 res = []
272 i = lnum - index
272 i = lnum - index
273
273
274 # This lets us get fully syntax-highlighted tracebacks.
274 # This lets us get fully syntax-highlighted tracebacks.
275 if scheme is None:
275 if scheme is None:
276 try:
276 try:
277 scheme = __IPYTHON__.rc.colors
277 scheme = __IPYTHON__.rc.colors
278 except:
278 except:
279 scheme = DEFAULT_SCHEME
279 scheme = DEFAULT_SCHEME
280 _line_format = _parser.format2
280 _line_format = _parser.format2
281
281
282 for line in lines:
282 for line in lines:
283 new_line, err = _line_format(line,'str',scheme)
283 new_line, err = _line_format(line,'str',scheme)
284 if not err: line = new_line
284 if not err: line = new_line
285
285
286 if i == lnum:
286 if i == lnum:
287 # This is the line with the error
287 # This is the line with the error
288 pad = numbers_width - len(str(i))
288 pad = numbers_width - len(str(i))
289 if pad >= 3:
289 if pad >= 3:
290 marker = '-'*(pad-3) + '-> '
290 marker = '-'*(pad-3) + '-> '
291 elif pad == 2:
291 elif pad == 2:
292 marker = '> '
292 marker = '> '
293 elif pad == 1:
293 elif pad == 1:
294 marker = '>'
294 marker = '>'
295 else:
295 else:
296 marker = ''
296 marker = ''
297 num = marker + str(i)
297 num = marker + str(i)
298 line = '%s%s%s %s%s' %(Colors.linenoEm, num,
298 line = '%s%s%s %s%s' %(Colors.linenoEm, num,
299 Colors.line, line, Colors.Normal)
299 Colors.line, line, Colors.Normal)
300 else:
300 else:
301 num = '%*s' % (numbers_width,i)
301 num = '%*s' % (numbers_width,i)
302 line = '%s%s%s %s' %(Colors.lineno, num,
302 line = '%s%s%s %s' %(Colors.lineno, num,
303 Colors.Normal, line)
303 Colors.Normal, line)
304
304
305 res.append(line)
305 res.append(line)
306 if lvals and i == lnum:
306 if lvals and i == lnum:
307 res.append(lvals + '\n')
307 res.append(lvals + '\n')
308 i = i + 1
308 i = i + 1
309 return res
309 return res
310
310
311
311
312 #---------------------------------------------------------------------------
312 #---------------------------------------------------------------------------
313 # Module classes
313 # Module classes
314 class TBTools:
314 class TBTools:
315 """Basic tools used by all traceback printer classes."""
315 """Basic tools used by all traceback printer classes."""
316
316
317 def __init__(self,color_scheme = 'NoColor',call_pdb=False):
317 def __init__(self,color_scheme = 'NoColor',call_pdb=False):
318 # Whether to call the interactive pdb debugger after printing
318 # Whether to call the interactive pdb debugger after printing
319 # tracebacks or not
319 # tracebacks or not
320 self.call_pdb = call_pdb
320 self.call_pdb = call_pdb
321
321
322 # Create color table
322 # Create color table
323 self.color_scheme_table = ExceptionColors
323 self.color_scheme_table = ExceptionColors
324
324
325 self.set_colors(color_scheme)
325 self.set_colors(color_scheme)
326 self.old_scheme = color_scheme # save initial value for toggles
326 self.old_scheme = color_scheme # save initial value for toggles
327
327
328 if call_pdb:
328 if call_pdb:
329 self.pdb = Debugger.Pdb(self.color_scheme_table.active_scheme_name)
329 self.pdb = Debugger.Pdb(self.color_scheme_table.active_scheme_name)
330 else:
330 else:
331 self.pdb = None
331 self.pdb = None
332
332
333 def set_colors(self,*args,**kw):
333 def set_colors(self,*args,**kw):
334 """Shorthand access to the color table scheme selector method."""
334 """Shorthand access to the color table scheme selector method."""
335
335
336 # Set own color table
336 # Set own color table
337 self.color_scheme_table.set_active_scheme(*args,**kw)
337 self.color_scheme_table.set_active_scheme(*args,**kw)
338 # for convenience, set Colors to the active scheme
338 # for convenience, set Colors to the active scheme
339 self.Colors = self.color_scheme_table.active_colors
339 self.Colors = self.color_scheme_table.active_colors
340 # Also set colors of debugger
340 # Also set colors of debugger
341 if hasattr(self,'pdb') and self.pdb is not None:
341 if hasattr(self,'pdb') and self.pdb is not None:
342 self.pdb.set_colors(*args,**kw)
342 self.pdb.set_colors(*args,**kw)
343
343
344 def color_toggle(self):
344 def color_toggle(self):
345 """Toggle between the currently active color scheme and NoColor."""
345 """Toggle between the currently active color scheme and NoColor."""
346
346
347 if self.color_scheme_table.active_scheme_name == 'NoColor':
347 if self.color_scheme_table.active_scheme_name == 'NoColor':
348 self.color_scheme_table.set_active_scheme(self.old_scheme)
348 self.color_scheme_table.set_active_scheme(self.old_scheme)
349 self.Colors = self.color_scheme_table.active_colors
349 self.Colors = self.color_scheme_table.active_colors
350 else:
350 else:
351 self.old_scheme = self.color_scheme_table.active_scheme_name
351 self.old_scheme = self.color_scheme_table.active_scheme_name
352 self.color_scheme_table.set_active_scheme('NoColor')
352 self.color_scheme_table.set_active_scheme('NoColor')
353 self.Colors = self.color_scheme_table.active_colors
353 self.Colors = self.color_scheme_table.active_colors
354
354
355 #---------------------------------------------------------------------------
355 #---------------------------------------------------------------------------
356 class ListTB(TBTools):
356 class ListTB(TBTools):
357 """Print traceback information from a traceback list, with optional color.
357 """Print traceback information from a traceback list, with optional color.
358
358
359 Calling: requires 3 arguments:
359 Calling: requires 3 arguments:
360 (etype, evalue, elist)
360 (etype, evalue, elist)
361 as would be obtained by:
361 as would be obtained by:
362 etype, evalue, tb = sys.exc_info()
362 etype, evalue, tb = sys.exc_info()
363 if tb:
363 if tb:
364 elist = traceback.extract_tb(tb)
364 elist = traceback.extract_tb(tb)
365 else:
365 else:
366 elist = None
366 elist = None
367
367
368 It can thus be used by programs which need to process the traceback before
368 It can thus be used by programs which need to process the traceback before
369 printing (such as console replacements based on the code module from the
369 printing (such as console replacements based on the code module from the
370 standard library).
370 standard library).
371
371
372 Because they are meant to be called without a full traceback (only a
372 Because they are meant to be called without a full traceback (only a
373 list), instances of this class can't call the interactive pdb debugger."""
373 list), instances of this class can't call the interactive pdb debugger."""
374
374
375 def __init__(self,color_scheme = 'NoColor'):
375 def __init__(self,color_scheme = 'NoColor'):
376 TBTools.__init__(self,color_scheme = color_scheme,call_pdb=0)
376 TBTools.__init__(self,color_scheme = color_scheme,call_pdb=0)
377
377
378 def __call__(self, etype, value, elist):
378 def __call__(self, etype, value, elist):
379 Term.cout.flush()
379 Term.cout.flush()
380 Term.cerr.flush()
381 print >> Term.cerr, self.text(etype,value,elist)
380 print >> Term.cerr, self.text(etype,value,elist)
381 Term.cerr.flush()
382
382
383 def text(self,etype, value, elist,context=5):
383 def text(self,etype, value, elist,context=5):
384 """Return a color formatted string with the traceback info."""
384 """Return a color formatted string with the traceback info."""
385
385
386 Colors = self.Colors
386 Colors = self.Colors
387 out_string = ['%s%s%s\n' % (Colors.topline,'-'*60,Colors.Normal)]
387 out_string = ['%s%s%s\n' % (Colors.topline,'-'*60,Colors.Normal)]
388 if elist:
388 if elist:
389 out_string.append('Traceback %s(most recent call last)%s:' % \
389 out_string.append('Traceback %s(most recent call last)%s:' % \
390 (Colors.normalEm, Colors.Normal) + '\n')
390 (Colors.normalEm, Colors.Normal) + '\n')
391 out_string.extend(self._format_list(elist))
391 out_string.extend(self._format_list(elist))
392 lines = self._format_exception_only(etype, value)
392 lines = self._format_exception_only(etype, value)
393 for line in lines[:-1]:
393 for line in lines[:-1]:
394 out_string.append(" "+line)
394 out_string.append(" "+line)
395 out_string.append(lines[-1])
395 out_string.append(lines[-1])
396 return ''.join(out_string)
396 return ''.join(out_string)
397
397
398 def _format_list(self, extracted_list):
398 def _format_list(self, extracted_list):
399 """Format a list of traceback entry tuples for printing.
399 """Format a list of traceback entry tuples for printing.
400
400
401 Given a list of tuples as returned by extract_tb() or
401 Given a list of tuples as returned by extract_tb() or
402 extract_stack(), return a list of strings ready for printing.
402 extract_stack(), return a list of strings ready for printing.
403 Each string in the resulting list corresponds to the item with the
403 Each string in the resulting list corresponds to the item with the
404 same index in the argument list. Each string ends in a newline;
404 same index in the argument list. Each string ends in a newline;
405 the strings may contain internal newlines as well, for those items
405 the strings may contain internal newlines as well, for those items
406 whose source text line is not None.
406 whose source text line is not None.
407
407
408 Lifted almost verbatim from traceback.py
408 Lifted almost verbatim from traceback.py
409 """
409 """
410
410
411 Colors = self.Colors
411 Colors = self.Colors
412 list = []
412 list = []
413 for filename, lineno, name, line in extracted_list[:-1]:
413 for filename, lineno, name, line in extracted_list[:-1]:
414 item = ' File %s"%s"%s, line %s%d%s, in %s%s%s\n' % \
414 item = ' File %s"%s"%s, line %s%d%s, in %s%s%s\n' % \
415 (Colors.filename, filename, Colors.Normal,
415 (Colors.filename, filename, Colors.Normal,
416 Colors.lineno, lineno, Colors.Normal,
416 Colors.lineno, lineno, Colors.Normal,
417 Colors.name, name, Colors.Normal)
417 Colors.name, name, Colors.Normal)
418 if line:
418 if line:
419 item = item + ' %s\n' % line.strip()
419 item = item + ' %s\n' % line.strip()
420 list.append(item)
420 list.append(item)
421 # Emphasize the last entry
421 # Emphasize the last entry
422 filename, lineno, name, line = extracted_list[-1]
422 filename, lineno, name, line = extracted_list[-1]
423 item = '%s File %s"%s"%s, line %s%d%s, in %s%s%s%s\n' % \
423 item = '%s File %s"%s"%s, line %s%d%s, in %s%s%s%s\n' % \
424 (Colors.normalEm,
424 (Colors.normalEm,
425 Colors.filenameEm, filename, Colors.normalEm,
425 Colors.filenameEm, filename, Colors.normalEm,
426 Colors.linenoEm, lineno, Colors.normalEm,
426 Colors.linenoEm, lineno, Colors.normalEm,
427 Colors.nameEm, name, Colors.normalEm,
427 Colors.nameEm, name, Colors.normalEm,
428 Colors.Normal)
428 Colors.Normal)
429 if line:
429 if line:
430 item = item + '%s %s%s\n' % (Colors.line, line.strip(),
430 item = item + '%s %s%s\n' % (Colors.line, line.strip(),
431 Colors.Normal)
431 Colors.Normal)
432 list.append(item)
432 list.append(item)
433 return list
433 return list
434
434
435 def _format_exception_only(self, etype, value):
435 def _format_exception_only(self, etype, value):
436 """Format the exception part of a traceback.
436 """Format the exception part of a traceback.
437
437
438 The arguments are the exception type and value such as given by
438 The arguments are the exception type and value such as given by
439 sys.exc_info()[:2]. The return value is a list of strings, each ending
439 sys.exc_info()[:2]. The return value is a list of strings, each ending
440 in a newline. Normally, the list contains a single string; however,
440 in a newline. Normally, the list contains a single string; however,
441 for SyntaxError exceptions, it contains several lines that (when
441 for SyntaxError exceptions, it contains several lines that (when
442 printed) display detailed information about where the syntax error
442 printed) display detailed information about where the syntax error
443 occurred. The message indicating which exception occurred is the
443 occurred. The message indicating which exception occurred is the
444 always last string in the list.
444 always last string in the list.
445
445
446 Also lifted nearly verbatim from traceback.py
446 Also lifted nearly verbatim from traceback.py
447 """
447 """
448
448
449 Colors = self.Colors
449 Colors = self.Colors
450 list = []
450 list = []
451 try:
451 try:
452 stype = Colors.excName + etype.__name__ + Colors.Normal
452 stype = Colors.excName + etype.__name__ + Colors.Normal
453 except AttributeError:
453 except AttributeError:
454 stype = etype # String exceptions don't get special coloring
454 stype = etype # String exceptions don't get special coloring
455 if value is None:
455 if value is None:
456 list.append( str(stype) + '\n')
456 list.append( str(stype) + '\n')
457 else:
457 else:
458 if etype is SyntaxError:
458 if etype is SyntaxError:
459 try:
459 try:
460 msg, (filename, lineno, offset, line) = value
460 msg, (filename, lineno, offset, line) = value
461 except:
461 except:
462 pass
462 pass
463 else:
463 else:
464 #print 'filename is',filename # dbg
464 #print 'filename is',filename # dbg
465 if not filename: filename = "<string>"
465 if not filename: filename = "<string>"
466 list.append('%s File %s"%s"%s, line %s%d%s\n' % \
466 list.append('%s File %s"%s"%s, line %s%d%s\n' % \
467 (Colors.normalEm,
467 (Colors.normalEm,
468 Colors.filenameEm, filename, Colors.normalEm,
468 Colors.filenameEm, filename, Colors.normalEm,
469 Colors.linenoEm, lineno, Colors.Normal ))
469 Colors.linenoEm, lineno, Colors.Normal ))
470 if line is not None:
470 if line is not None:
471 i = 0
471 i = 0
472 while i < len(line) and line[i].isspace():
472 while i < len(line) and line[i].isspace():
473 i = i+1
473 i = i+1
474 list.append('%s %s%s\n' % (Colors.line,
474 list.append('%s %s%s\n' % (Colors.line,
475 line.strip(),
475 line.strip(),
476 Colors.Normal))
476 Colors.Normal))
477 if offset is not None:
477 if offset is not None:
478 s = ' '
478 s = ' '
479 for c in line[i:offset-1]:
479 for c in line[i:offset-1]:
480 if c.isspace():
480 if c.isspace():
481 s = s + c
481 s = s + c
482 else:
482 else:
483 s = s + ' '
483 s = s + ' '
484 list.append('%s%s^%s\n' % (Colors.caret, s,
484 list.append('%s%s^%s\n' % (Colors.caret, s,
485 Colors.Normal) )
485 Colors.Normal) )
486 value = msg
486 value = msg
487 s = self._some_str(value)
487 s = self._some_str(value)
488 if s:
488 if s:
489 list.append('%s%s:%s %s\n' % (str(stype), Colors.excName,
489 list.append('%s%s:%s %s\n' % (str(stype), Colors.excName,
490 Colors.Normal, s))
490 Colors.Normal, s))
491 else:
491 else:
492 list.append('%s\n' % str(stype))
492 list.append('%s\n' % str(stype))
493 return list
493 return list
494
494
495 def _some_str(self, value):
495 def _some_str(self, value):
496 # Lifted from traceback.py
496 # Lifted from traceback.py
497 try:
497 try:
498 return str(value)
498 return str(value)
499 except:
499 except:
500 return '<unprintable %s object>' % type(value).__name__
500 return '<unprintable %s object>' % type(value).__name__
501
501
502 #----------------------------------------------------------------------------
502 #----------------------------------------------------------------------------
503 class VerboseTB(TBTools):
503 class VerboseTB(TBTools):
504 """A port of Ka-Ping Yee's cgitb.py module that outputs color text instead
504 """A port of Ka-Ping Yee's cgitb.py module that outputs color text instead
505 of HTML. Requires inspect and pydoc. Crazy, man.
505 of HTML. Requires inspect and pydoc. Crazy, man.
506
506
507 Modified version which optionally strips the topmost entries from the
507 Modified version which optionally strips the topmost entries from the
508 traceback, to be used with alternate interpreters (because their own code
508 traceback, to be used with alternate interpreters (because their own code
509 would appear in the traceback)."""
509 would appear in the traceback)."""
510
510
511 def __init__(self,color_scheme = 'Linux',tb_offset=0,long_header=0,
511 def __init__(self,color_scheme = 'Linux',tb_offset=0,long_header=0,
512 call_pdb = 0, include_vars=1):
512 call_pdb = 0, include_vars=1):
513 """Specify traceback offset, headers and color scheme.
513 """Specify traceback offset, headers and color scheme.
514
514
515 Define how many frames to drop from the tracebacks. Calling it with
515 Define how many frames to drop from the tracebacks. Calling it with
516 tb_offset=1 allows use of this handler in interpreters which will have
516 tb_offset=1 allows use of this handler in interpreters which will have
517 their own code at the top of the traceback (VerboseTB will first
517 their own code at the top of the traceback (VerboseTB will first
518 remove that frame before printing the traceback info)."""
518 remove that frame before printing the traceback info)."""
519 TBTools.__init__(self,color_scheme=color_scheme,call_pdb=call_pdb)
519 TBTools.__init__(self,color_scheme=color_scheme,call_pdb=call_pdb)
520 self.tb_offset = tb_offset
520 self.tb_offset = tb_offset
521 self.long_header = long_header
521 self.long_header = long_header
522 self.include_vars = include_vars
522 self.include_vars = include_vars
523
523
524 def text(self, etype, evalue, etb, context=5):
524 def text(self, etype, evalue, etb, context=5):
525 """Return a nice text document describing the traceback."""
525 """Return a nice text document describing the traceback."""
526
526
527 # some locals
527 # some locals
528 try:
528 try:
529 etype = etype.__name__
529 etype = etype.__name__
530 except AttributeError:
530 except AttributeError:
531 pass
531 pass
532 Colors = self.Colors # just a shorthand + quicker name lookup
532 Colors = self.Colors # just a shorthand + quicker name lookup
533 ColorsNormal = Colors.Normal # used a lot
533 ColorsNormal = Colors.Normal # used a lot
534 col_scheme = self.color_scheme_table.active_scheme_name
534 col_scheme = self.color_scheme_table.active_scheme_name
535 indent = ' '*INDENT_SIZE
535 indent = ' '*INDENT_SIZE
536 em_normal = '%s\n%s%s' % (Colors.valEm, indent,ColorsNormal)
536 em_normal = '%s\n%s%s' % (Colors.valEm, indent,ColorsNormal)
537 undefined = '%sundefined%s' % (Colors.em, ColorsNormal)
537 undefined = '%sundefined%s' % (Colors.em, ColorsNormal)
538 exc = '%s%s%s' % (Colors.excName,etype,ColorsNormal)
538 exc = '%s%s%s' % (Colors.excName,etype,ColorsNormal)
539
539
540 # some internal-use functions
540 # some internal-use functions
541 def text_repr(value):
541 def text_repr(value):
542 """Hopefully pretty robust repr equivalent."""
542 """Hopefully pretty robust repr equivalent."""
543 # this is pretty horrible but should always return *something*
543 # this is pretty horrible but should always return *something*
544 try:
544 try:
545 return pydoc.text.repr(value)
545 return pydoc.text.repr(value)
546 except KeyboardInterrupt:
546 except KeyboardInterrupt:
547 raise
547 raise
548 except:
548 except:
549 try:
549 try:
550 return repr(value)
550 return repr(value)
551 except KeyboardInterrupt:
551 except KeyboardInterrupt:
552 raise
552 raise
553 except:
553 except:
554 try:
554 try:
555 # all still in an except block so we catch
555 # all still in an except block so we catch
556 # getattr raising
556 # getattr raising
557 name = getattr(value, '__name__', None)
557 name = getattr(value, '__name__', None)
558 if name:
558 if name:
559 # ick, recursion
559 # ick, recursion
560 return text_repr(name)
560 return text_repr(name)
561 klass = getattr(value, '__class__', None)
561 klass = getattr(value, '__class__', None)
562 if klass:
562 if klass:
563 return '%s instance' % text_repr(klass)
563 return '%s instance' % text_repr(klass)
564 except KeyboardInterrupt:
564 except KeyboardInterrupt:
565 raise
565 raise
566 except:
566 except:
567 return 'UNRECOVERABLE REPR FAILURE'
567 return 'UNRECOVERABLE REPR FAILURE'
568 def eqrepr(value, repr=text_repr): return '=%s' % repr(value)
568 def eqrepr(value, repr=text_repr): return '=%s' % repr(value)
569 def nullrepr(value, repr=text_repr): return ''
569 def nullrepr(value, repr=text_repr): return ''
570
570
571 # meat of the code begins
571 # meat of the code begins
572 try:
572 try:
573 etype = etype.__name__
573 etype = etype.__name__
574 except AttributeError:
574 except AttributeError:
575 pass
575 pass
576
576
577 if self.long_header:
577 if self.long_header:
578 # Header with the exception type, python version, and date
578 # Header with the exception type, python version, and date
579 pyver = 'Python ' + string.split(sys.version)[0] + ': ' + sys.executable
579 pyver = 'Python ' + string.split(sys.version)[0] + ': ' + sys.executable
580 date = time.ctime(time.time())
580 date = time.ctime(time.time())
581
581
582 head = '%s%s%s\n%s%s%s\n%s' % (Colors.topline, '-'*75, ColorsNormal,
582 head = '%s%s%s\n%s%s%s\n%s' % (Colors.topline, '-'*75, ColorsNormal,
583 exc, ' '*(75-len(str(etype))-len(pyver)),
583 exc, ' '*(75-len(str(etype))-len(pyver)),
584 pyver, string.rjust(date, 75) )
584 pyver, string.rjust(date, 75) )
585 head += "\nA problem occured executing Python code. Here is the sequence of function"\
585 head += "\nA problem occured executing Python code. Here is the sequence of function"\
586 "\ncalls leading up to the error, with the most recent (innermost) call last."
586 "\ncalls leading up to the error, with the most recent (innermost) call last."
587 else:
587 else:
588 # Simplified header
588 # Simplified header
589 head = '%s%s%s\n%s%s' % (Colors.topline, '-'*75, ColorsNormal,exc,
589 head = '%s%s%s\n%s%s' % (Colors.topline, '-'*75, ColorsNormal,exc,
590 string.rjust('Traceback (most recent call last)',
590 string.rjust('Traceback (most recent call last)',
591 75 - len(str(etype)) ) )
591 75 - len(str(etype)) ) )
592 frames = []
592 frames = []
593 # Flush cache before calling inspect. This helps alleviate some of the
593 # Flush cache before calling inspect. This helps alleviate some of the
594 # problems with python 2.3's inspect.py.
594 # problems with python 2.3's inspect.py.
595 linecache.checkcache()
595 linecache.checkcache()
596 # Drop topmost frames if requested
596 # Drop topmost frames if requested
597 try:
597 try:
598 # Try the default getinnerframes and Alex's: Alex's fixes some
598 # Try the default getinnerframes and Alex's: Alex's fixes some
599 # problems, but it generates empty tracebacks for console errors
599 # problems, but it generates empty tracebacks for console errors
600 # (5 blanks lines) where none should be returned.
600 # (5 blanks lines) where none should be returned.
601 #records = inspect.getinnerframes(etb, context)[self.tb_offset:]
601 #records = inspect.getinnerframes(etb, context)[self.tb_offset:]
602 #print 'python records:', records # dbg
602 #print 'python records:', records # dbg
603 records = _fixed_getinnerframes(etb, context,self.tb_offset)
603 records = _fixed_getinnerframes(etb, context,self.tb_offset)
604 #print 'alex records:', records # dbg
604 #print 'alex records:', records # dbg
605 except:
605 except:
606
606
607 # FIXME: I've been getting many crash reports from python 2.3
607 # FIXME: I've been getting many crash reports from python 2.3
608 # users, traceable to inspect.py. If I can find a small test-case
608 # users, traceable to inspect.py. If I can find a small test-case
609 # to reproduce this, I should either write a better workaround or
609 # to reproduce this, I should either write a better workaround or
610 # file a bug report against inspect (if that's the real problem).
610 # file a bug report against inspect (if that's the real problem).
611 # So far, I haven't been able to find an isolated example to
611 # So far, I haven't been able to find an isolated example to
612 # reproduce the problem.
612 # reproduce the problem.
613 inspect_error()
613 inspect_error()
614 traceback.print_exc(file=Term.cerr)
614 traceback.print_exc(file=Term.cerr)
615 info('\nUnfortunately, your original traceback can not be constructed.\n')
615 info('\nUnfortunately, your original traceback can not be constructed.\n')
616 return ''
616 return ''
617
617
618 # build some color string templates outside these nested loops
618 # build some color string templates outside these nested loops
619 tpl_link = '%s%%s%s' % (Colors.filenameEm,ColorsNormal)
619 tpl_link = '%s%%s%s' % (Colors.filenameEm,ColorsNormal)
620 tpl_call = 'in %s%%s%s%%s%s' % (Colors.vName, Colors.valEm,
620 tpl_call = 'in %s%%s%s%%s%s' % (Colors.vName, Colors.valEm,
621 ColorsNormal)
621 ColorsNormal)
622 tpl_call_fail = 'in %s%%s%s(***failed resolving arguments***)%s' % \
622 tpl_call_fail = 'in %s%%s%s(***failed resolving arguments***)%s' % \
623 (Colors.vName, Colors.valEm, ColorsNormal)
623 (Colors.vName, Colors.valEm, ColorsNormal)
624 tpl_local_var = '%s%%s%s' % (Colors.vName, ColorsNormal)
624 tpl_local_var = '%s%%s%s' % (Colors.vName, ColorsNormal)
625 tpl_global_var = '%sglobal%s %s%%s%s' % (Colors.em, ColorsNormal,
625 tpl_global_var = '%sglobal%s %s%%s%s' % (Colors.em, ColorsNormal,
626 Colors.vName, ColorsNormal)
626 Colors.vName, ColorsNormal)
627 tpl_name_val = '%%s %s= %%s%s' % (Colors.valEm, ColorsNormal)
627 tpl_name_val = '%%s %s= %%s%s' % (Colors.valEm, ColorsNormal)
628 tpl_line = '%s%%s%s %%s' % (Colors.lineno, ColorsNormal)
628 tpl_line = '%s%%s%s %%s' % (Colors.lineno, ColorsNormal)
629 tpl_line_em = '%s%%s%s %%s%s' % (Colors.linenoEm,Colors.line,
629 tpl_line_em = '%s%%s%s %%s%s' % (Colors.linenoEm,Colors.line,
630 ColorsNormal)
630 ColorsNormal)
631
631
632 # now, loop over all records printing context and info
632 # now, loop over all records printing context and info
633 abspath = os.path.abspath
633 abspath = os.path.abspath
634 for frame, file, lnum, func, lines, index in records:
634 for frame, file, lnum, func, lines, index in records:
635 #print '*** record:',file,lnum,func,lines,index # dbg
635 #print '*** record:',file,lnum,func,lines,index # dbg
636 try:
636 try:
637 file = file and abspath(file) or '?'
637 file = file and abspath(file) or '?'
638 except OSError:
638 except OSError:
639 # if file is '<console>' or something not in the filesystem,
639 # if file is '<console>' or something not in the filesystem,
640 # the abspath call will throw an OSError. Just ignore it and
640 # the abspath call will throw an OSError. Just ignore it and
641 # keep the original file string.
641 # keep the original file string.
642 pass
642 pass
643 link = tpl_link % file
643 link = tpl_link % file
644 try:
644 try:
645 args, varargs, varkw, locals = inspect.getargvalues(frame)
645 args, varargs, varkw, locals = inspect.getargvalues(frame)
646 except:
646 except:
647 # This can happen due to a bug in python2.3. We should be
647 # This can happen due to a bug in python2.3. We should be
648 # able to remove this try/except when 2.4 becomes a
648 # able to remove this try/except when 2.4 becomes a
649 # requirement. Bug details at http://python.org/sf/1005466
649 # requirement. Bug details at http://python.org/sf/1005466
650 inspect_error()
650 inspect_error()
651 traceback.print_exc(file=Term.cerr)
651 traceback.print_exc(file=Term.cerr)
652 info("\nIPython's exception reporting continues...\n")
652 info("\nIPython's exception reporting continues...\n")
653
653
654 if func == '?':
654 if func == '?':
655 call = ''
655 call = ''
656 else:
656 else:
657 # Decide whether to include variable details or not
657 # Decide whether to include variable details or not
658 var_repr = self.include_vars and eqrepr or nullrepr
658 var_repr = self.include_vars and eqrepr or nullrepr
659 try:
659 try:
660 call = tpl_call % (func,inspect.formatargvalues(args,
660 call = tpl_call % (func,inspect.formatargvalues(args,
661 varargs, varkw,
661 varargs, varkw,
662 locals,formatvalue=var_repr))
662 locals,formatvalue=var_repr))
663 except KeyError:
663 except KeyError:
664 # Very odd crash from inspect.formatargvalues(). The
664 # Very odd crash from inspect.formatargvalues(). The
665 # scenario under which it appeared was a call to
665 # scenario under which it appeared was a call to
666 # view(array,scale) in NumTut.view.view(), where scale had
666 # view(array,scale) in NumTut.view.view(), where scale had
667 # been defined as a scalar (it should be a tuple). Somehow
667 # been defined as a scalar (it should be a tuple). Somehow
668 # inspect messes up resolving the argument list of view()
668 # inspect messes up resolving the argument list of view()
669 # and barfs out. At some point I should dig into this one
669 # and barfs out. At some point I should dig into this one
670 # and file a bug report about it.
670 # and file a bug report about it.
671 inspect_error()
671 inspect_error()
672 traceback.print_exc(file=Term.cerr)
672 traceback.print_exc(file=Term.cerr)
673 info("\nIPython's exception reporting continues...\n")
673 info("\nIPython's exception reporting continues...\n")
674 call = tpl_call_fail % func
674 call = tpl_call_fail % func
675
675
676 # Initialize a list of names on the current line, which the
676 # Initialize a list of names on the current line, which the
677 # tokenizer below will populate.
677 # tokenizer below will populate.
678 names = []
678 names = []
679
679
680 def tokeneater(token_type, token, start, end, line):
680 def tokeneater(token_type, token, start, end, line):
681 """Stateful tokeneater which builds dotted names.
681 """Stateful tokeneater which builds dotted names.
682
682
683 The list of names it appends to (from the enclosing scope) can
683 The list of names it appends to (from the enclosing scope) can
684 contain repeated composite names. This is unavoidable, since
684 contain repeated composite names. This is unavoidable, since
685 there is no way to disambguate partial dotted structures until
685 there is no way to disambguate partial dotted structures until
686 the full list is known. The caller is responsible for pruning
686 the full list is known. The caller is responsible for pruning
687 the final list of duplicates before using it."""
687 the final list of duplicates before using it."""
688
688
689 # build composite names
689 # build composite names
690 if token == '.':
690 if token == '.':
691 try:
691 try:
692 names[-1] += '.'
692 names[-1] += '.'
693 # store state so the next token is added for x.y.z names
693 # store state so the next token is added for x.y.z names
694 tokeneater.name_cont = True
694 tokeneater.name_cont = True
695 return
695 return
696 except IndexError:
696 except IndexError:
697 pass
697 pass
698 if token_type == tokenize.NAME and token not in keyword.kwlist:
698 if token_type == tokenize.NAME and token not in keyword.kwlist:
699 if tokeneater.name_cont:
699 if tokeneater.name_cont:
700 # Dotted names
700 # Dotted names
701 names[-1] += token
701 names[-1] += token
702 tokeneater.name_cont = False
702 tokeneater.name_cont = False
703 else:
703 else:
704 # Regular new names. We append everything, the caller
704 # Regular new names. We append everything, the caller
705 # will be responsible for pruning the list later. It's
705 # will be responsible for pruning the list later. It's
706 # very tricky to try to prune as we go, b/c composite
706 # very tricky to try to prune as we go, b/c composite
707 # names can fool us. The pruning at the end is easy
707 # names can fool us. The pruning at the end is easy
708 # to do (or the caller can print a list with repeated
708 # to do (or the caller can print a list with repeated
709 # names if so desired.
709 # names if so desired.
710 names.append(token)
710 names.append(token)
711 elif token_type == tokenize.NEWLINE:
711 elif token_type == tokenize.NEWLINE:
712 raise IndexError
712 raise IndexError
713 # we need to store a bit of state in the tokenizer to build
713 # we need to store a bit of state in the tokenizer to build
714 # dotted names
714 # dotted names
715 tokeneater.name_cont = False
715 tokeneater.name_cont = False
716
716
717 def linereader(file=file, lnum=[lnum], getline=linecache.getline):
717 def linereader(file=file, lnum=[lnum], getline=linecache.getline):
718 line = getline(file, lnum[0])
718 line = getline(file, lnum[0])
719 lnum[0] += 1
719 lnum[0] += 1
720 return line
720 return line
721
721
722 # Build the list of names on this line of code where the exception
722 # Build the list of names on this line of code where the exception
723 # occurred.
723 # occurred.
724 try:
724 try:
725 # This builds the names list in-place by capturing it from the
725 # This builds the names list in-place by capturing it from the
726 # enclosing scope.
726 # enclosing scope.
727 tokenize.tokenize(linereader, tokeneater)
727 tokenize.tokenize(linereader, tokeneater)
728 except IndexError:
728 except IndexError:
729 # signals exit of tokenizer
729 # signals exit of tokenizer
730 pass
730 pass
731 except tokenize.TokenError,msg:
731 except tokenize.TokenError,msg:
732 _m = ("An unexpected error occurred while tokenizing input\n"
732 _m = ("An unexpected error occurred while tokenizing input\n"
733 "The following traceback may be corrupted or invalid\n"
733 "The following traceback may be corrupted or invalid\n"
734 "The error message is: %s\n" % msg)
734 "The error message is: %s\n" % msg)
735 error(_m)
735 error(_m)
736
736
737 # prune names list of duplicates, but keep the right order
737 # prune names list of duplicates, but keep the right order
738 unique_names = uniq_stable(names)
738 unique_names = uniq_stable(names)
739
739
740 # Start loop over vars
740 # Start loop over vars
741 lvals = []
741 lvals = []
742 if self.include_vars:
742 if self.include_vars:
743 for name_full in unique_names:
743 for name_full in unique_names:
744 name_base = name_full.split('.',1)[0]
744 name_base = name_full.split('.',1)[0]
745 if name_base in frame.f_code.co_varnames:
745 if name_base in frame.f_code.co_varnames:
746 if locals.has_key(name_base):
746 if locals.has_key(name_base):
747 try:
747 try:
748 value = repr(eval(name_full,locals))
748 value = repr(eval(name_full,locals))
749 except:
749 except:
750 value = undefined
750 value = undefined
751 else:
751 else:
752 value = undefined
752 value = undefined
753 name = tpl_local_var % name_full
753 name = tpl_local_var % name_full
754 else:
754 else:
755 if frame.f_globals.has_key(name_base):
755 if frame.f_globals.has_key(name_base):
756 try:
756 try:
757 value = repr(eval(name_full,frame.f_globals))
757 value = repr(eval(name_full,frame.f_globals))
758 except:
758 except:
759 value = undefined
759 value = undefined
760 else:
760 else:
761 value = undefined
761 value = undefined
762 name = tpl_global_var % name_full
762 name = tpl_global_var % name_full
763 lvals.append(tpl_name_val % (name,value))
763 lvals.append(tpl_name_val % (name,value))
764 if lvals:
764 if lvals:
765 lvals = '%s%s' % (indent,em_normal.join(lvals))
765 lvals = '%s%s' % (indent,em_normal.join(lvals))
766 else:
766 else:
767 lvals = ''
767 lvals = ''
768
768
769 level = '%s %s\n' % (link,call)
769 level = '%s %s\n' % (link,call)
770
770
771 if index is None:
771 if index is None:
772 frames.append(level)
772 frames.append(level)
773 else:
773 else:
774 frames.append('%s%s' % (level,''.join(
774 frames.append('%s%s' % (level,''.join(
775 _formatTracebackLines(lnum,index,lines,Colors,lvals,
775 _formatTracebackLines(lnum,index,lines,Colors,lvals,
776 col_scheme))))
776 col_scheme))))
777
777
778 # Get (safely) a string form of the exception info
778 # Get (safely) a string form of the exception info
779 try:
779 try:
780 etype_str,evalue_str = map(str,(etype,evalue))
780 etype_str,evalue_str = map(str,(etype,evalue))
781 except:
781 except:
782 # User exception is improperly defined.
782 # User exception is improperly defined.
783 etype,evalue = str,sys.exc_info()[:2]
783 etype,evalue = str,sys.exc_info()[:2]
784 etype_str,evalue_str = map(str,(etype,evalue))
784 etype_str,evalue_str = map(str,(etype,evalue))
785 # ... and format it
785 # ... and format it
786 exception = ['%s%s%s: %s' % (Colors.excName, etype_str,
786 exception = ['%s%s%s: %s' % (Colors.excName, etype_str,
787 ColorsNormal, evalue_str)]
787 ColorsNormal, evalue_str)]
788 if type(evalue) is types.InstanceType:
788 if type(evalue) is types.InstanceType:
789 try:
789 try:
790 names = [w for w in dir(evalue) if isinstance(w, basestring)]
790 names = [w for w in dir(evalue) if isinstance(w, basestring)]
791 except:
791 except:
792 # Every now and then, an object with funny inernals blows up
792 # Every now and then, an object with funny inernals blows up
793 # when dir() is called on it. We do the best we can to report
793 # when dir() is called on it. We do the best we can to report
794 # the problem and continue
794 # the problem and continue
795 _m = '%sException reporting error (object with broken dir())%s:'
795 _m = '%sException reporting error (object with broken dir())%s:'
796 exception.append(_m % (Colors.excName,ColorsNormal))
796 exception.append(_m % (Colors.excName,ColorsNormal))
797 etype_str,evalue_str = map(str,sys.exc_info()[:2])
797 etype_str,evalue_str = map(str,sys.exc_info()[:2])
798 exception.append('%s%s%s: %s' % (Colors.excName,etype_str,
798 exception.append('%s%s%s: %s' % (Colors.excName,etype_str,
799 ColorsNormal, evalue_str))
799 ColorsNormal, evalue_str))
800 names = []
800 names = []
801 for name in names:
801 for name in names:
802 value = text_repr(getattr(evalue, name))
802 value = text_repr(getattr(evalue, name))
803 exception.append('\n%s%s = %s' % (indent, name, value))
803 exception.append('\n%s%s = %s' % (indent, name, value))
804 # return all our info assembled as a single string
804 # return all our info assembled as a single string
805 return '%s\n\n%s\n%s' % (head,'\n'.join(frames),''.join(exception[0]) )
805 return '%s\n\n%s\n%s' % (head,'\n'.join(frames),''.join(exception[0]) )
806
806
807 def debugger(self,force=False):
807 def debugger(self,force=False):
808 """Call up the pdb debugger if desired, always clean up the tb
808 """Call up the pdb debugger if desired, always clean up the tb
809 reference.
809 reference.
810
810
811 Keywords:
811 Keywords:
812
812
813 - force(False): by default, this routine checks the instance call_pdb
813 - force(False): by default, this routine checks the instance call_pdb
814 flag and does not actually invoke the debugger if the flag is false.
814 flag and does not actually invoke the debugger if the flag is false.
815 The 'force' option forces the debugger to activate even if the flag
815 The 'force' option forces the debugger to activate even if the flag
816 is false.
816 is false.
817
817
818 If the call_pdb flag is set, the pdb interactive debugger is
818 If the call_pdb flag is set, the pdb interactive debugger is
819 invoked. In all cases, the self.tb reference to the current traceback
819 invoked. In all cases, the self.tb reference to the current traceback
820 is deleted to prevent lingering references which hamper memory
820 is deleted to prevent lingering references which hamper memory
821 management.
821 management.
822
822
823 Note that each call to pdb() does an 'import readline', so if your app
823 Note that each call to pdb() does an 'import readline', so if your app
824 requires a special setup for the readline completers, you'll have to
824 requires a special setup for the readline completers, you'll have to
825 fix that by hand after invoking the exception handler."""
825 fix that by hand after invoking the exception handler."""
826
826
827 if force or self.call_pdb:
827 if force or self.call_pdb:
828 if self.pdb is None:
828 if self.pdb is None:
829 self.pdb = Debugger.Pdb(
829 self.pdb = Debugger.Pdb(
830 self.color_scheme_table.active_scheme_name)
830 self.color_scheme_table.active_scheme_name)
831 # the system displayhook may have changed, restore the original
831 # the system displayhook may have changed, restore the original
832 # for pdb
832 # for pdb
833 dhook = sys.displayhook
833 dhook = sys.displayhook
834 sys.displayhook = sys.__displayhook__
834 sys.displayhook = sys.__displayhook__
835 self.pdb.reset()
835 self.pdb.reset()
836 # Find the right frame so we don't pop up inside ipython itself
836 # Find the right frame so we don't pop up inside ipython itself
837 if hasattr(self,'tb'):
837 if hasattr(self,'tb'):
838 etb = self.tb
838 etb = self.tb
839 else:
839 else:
840 etb = self.tb = sys.last_traceback
840 etb = self.tb = sys.last_traceback
841 while self.tb.tb_next is not None:
841 while self.tb.tb_next is not None:
842 self.tb = self.tb.tb_next
842 self.tb = self.tb.tb_next
843 try:
843 try:
844 if etb and etb.tb_next:
844 if etb and etb.tb_next:
845 etb = etb.tb_next
845 etb = etb.tb_next
846 self.pdb.botframe = etb.tb_frame
846 self.pdb.botframe = etb.tb_frame
847 self.pdb.interaction(self.tb.tb_frame, self.tb)
847 self.pdb.interaction(self.tb.tb_frame, self.tb)
848 finally:
848 finally:
849 sys.displayhook = dhook
849 sys.displayhook = dhook
850
850
851 if hasattr(self,'tb'):
851 if hasattr(self,'tb'):
852 del self.tb
852 del self.tb
853
853
854 def handler(self, info=None):
854 def handler(self, info=None):
855 (etype, evalue, etb) = info or sys.exc_info()
855 (etype, evalue, etb) = info or sys.exc_info()
856 self.tb = etb
856 self.tb = etb
857 Term.cout.flush()
857 Term.cout.flush()
858 Term.cerr.flush()
859 print >> Term.cerr, self.text(etype, evalue, etb)
858 print >> Term.cerr, self.text(etype, evalue, etb)
859 Term.cerr.flush()
860
860
861 # Changed so an instance can just be called as VerboseTB_inst() and print
861 # Changed so an instance can just be called as VerboseTB_inst() and print
862 # out the right info on its own.
862 # out the right info on its own.
863 def __call__(self, etype=None, evalue=None, etb=None):
863 def __call__(self, etype=None, evalue=None, etb=None):
864 """This hook can replace sys.excepthook (for Python 2.1 or higher)."""
864 """This hook can replace sys.excepthook (for Python 2.1 or higher)."""
865 if etb is None:
865 if etb is None:
866 self.handler()
866 self.handler()
867 else:
867 else:
868 self.handler((etype, evalue, etb))
868 self.handler((etype, evalue, etb))
869 try:
869 try:
870 self.debugger()
870 self.debugger()
871 except KeyboardInterrupt:
871 except KeyboardInterrupt:
872 print "\nKeyboardInterrupt"
872 print "\nKeyboardInterrupt"
873
873
874 #----------------------------------------------------------------------------
874 #----------------------------------------------------------------------------
875 class FormattedTB(VerboseTB,ListTB):
875 class FormattedTB(VerboseTB,ListTB):
876 """Subclass ListTB but allow calling with a traceback.
876 """Subclass ListTB but allow calling with a traceback.
877
877
878 It can thus be used as a sys.excepthook for Python > 2.1.
878 It can thus be used as a sys.excepthook for Python > 2.1.
879
879
880 Also adds 'Context' and 'Verbose' modes, not available in ListTB.
880 Also adds 'Context' and 'Verbose' modes, not available in ListTB.
881
881
882 Allows a tb_offset to be specified. This is useful for situations where
882 Allows a tb_offset to be specified. This is useful for situations where
883 one needs to remove a number of topmost frames from the traceback (such as
883 one needs to remove a number of topmost frames from the traceback (such as
884 occurs with python programs that themselves execute other python code,
884 occurs with python programs that themselves execute other python code,
885 like Python shells). """
885 like Python shells). """
886
886
887 def __init__(self, mode = 'Plain', color_scheme='Linux',
887 def __init__(self, mode = 'Plain', color_scheme='Linux',
888 tb_offset = 0,long_header=0,call_pdb=0,include_vars=0):
888 tb_offset = 0,long_header=0,call_pdb=0,include_vars=0):
889
889
890 # NEVER change the order of this list. Put new modes at the end:
890 # NEVER change the order of this list. Put new modes at the end:
891 self.valid_modes = ['Plain','Context','Verbose']
891 self.valid_modes = ['Plain','Context','Verbose']
892 self.verbose_modes = self.valid_modes[1:3]
892 self.verbose_modes = self.valid_modes[1:3]
893
893
894 VerboseTB.__init__(self,color_scheme,tb_offset,long_header,
894 VerboseTB.__init__(self,color_scheme,tb_offset,long_header,
895 call_pdb=call_pdb,include_vars=include_vars)
895 call_pdb=call_pdb,include_vars=include_vars)
896 self.set_mode(mode)
896 self.set_mode(mode)
897
897
898 def _extract_tb(self,tb):
898 def _extract_tb(self,tb):
899 if tb:
899 if tb:
900 return traceback.extract_tb(tb)
900 return traceback.extract_tb(tb)
901 else:
901 else:
902 return None
902 return None
903
903
904 def text(self, etype, value, tb,context=5,mode=None):
904 def text(self, etype, value, tb,context=5,mode=None):
905 """Return formatted traceback.
905 """Return formatted traceback.
906
906
907 If the optional mode parameter is given, it overrides the current
907 If the optional mode parameter is given, it overrides the current
908 mode."""
908 mode."""
909
909
910 if mode is None:
910 if mode is None:
911 mode = self.mode
911 mode = self.mode
912 if mode in self.verbose_modes:
912 if mode in self.verbose_modes:
913 # verbose modes need a full traceback
913 # verbose modes need a full traceback
914 return VerboseTB.text(self,etype, value, tb,context=5)
914 return VerboseTB.text(self,etype, value, tb,context=5)
915 else:
915 else:
916 # We must check the source cache because otherwise we can print
916 # We must check the source cache because otherwise we can print
917 # out-of-date source code.
917 # out-of-date source code.
918 linecache.checkcache()
918 linecache.checkcache()
919 # Now we can extract and format the exception
919 # Now we can extract and format the exception
920 elist = self._extract_tb(tb)
920 elist = self._extract_tb(tb)
921 if len(elist) > self.tb_offset:
921 if len(elist) > self.tb_offset:
922 del elist[:self.tb_offset]
922 del elist[:self.tb_offset]
923 return ListTB.text(self,etype,value,elist)
923 return ListTB.text(self,etype,value,elist)
924
924
925 def set_mode(self,mode=None):
925 def set_mode(self,mode=None):
926 """Switch to the desired mode.
926 """Switch to the desired mode.
927
927
928 If mode is not specified, cycles through the available modes."""
928 If mode is not specified, cycles through the available modes."""
929
929
930 if not mode:
930 if not mode:
931 new_idx = ( self.valid_modes.index(self.mode) + 1 ) % \
931 new_idx = ( self.valid_modes.index(self.mode) + 1 ) % \
932 len(self.valid_modes)
932 len(self.valid_modes)
933 self.mode = self.valid_modes[new_idx]
933 self.mode = self.valid_modes[new_idx]
934 elif mode not in self.valid_modes:
934 elif mode not in self.valid_modes:
935 raise ValueError, 'Unrecognized mode in FormattedTB: <'+mode+'>\n'\
935 raise ValueError, 'Unrecognized mode in FormattedTB: <'+mode+'>\n'\
936 'Valid modes: '+str(self.valid_modes)
936 'Valid modes: '+str(self.valid_modes)
937 else:
937 else:
938 self.mode = mode
938 self.mode = mode
939 # include variable details only in 'Verbose' mode
939 # include variable details only in 'Verbose' mode
940 self.include_vars = (self.mode == self.valid_modes[2])
940 self.include_vars = (self.mode == self.valid_modes[2])
941
941
942 # some convenient shorcuts
942 # some convenient shorcuts
943 def plain(self):
943 def plain(self):
944 self.set_mode(self.valid_modes[0])
944 self.set_mode(self.valid_modes[0])
945
945
946 def context(self):
946 def context(self):
947 self.set_mode(self.valid_modes[1])
947 self.set_mode(self.valid_modes[1])
948
948
949 def verbose(self):
949 def verbose(self):
950 self.set_mode(self.valid_modes[2])
950 self.set_mode(self.valid_modes[2])
951
951
952 #----------------------------------------------------------------------------
952 #----------------------------------------------------------------------------
953 class AutoFormattedTB(FormattedTB):
953 class AutoFormattedTB(FormattedTB):
954 """A traceback printer which can be called on the fly.
954 """A traceback printer which can be called on the fly.
955
955
956 It will find out about exceptions by itself.
956 It will find out about exceptions by itself.
957
957
958 A brief example:
958 A brief example:
959
959
960 AutoTB = AutoFormattedTB(mode = 'Verbose',color_scheme='Linux')
960 AutoTB = AutoFormattedTB(mode = 'Verbose',color_scheme='Linux')
961 try:
961 try:
962 ...
962 ...
963 except:
963 except:
964 AutoTB() # or AutoTB(out=logfile) where logfile is an open file object
964 AutoTB() # or AutoTB(out=logfile) where logfile is an open file object
965 """
965 """
966 def __call__(self,etype=None,evalue=None,etb=None,
966 def __call__(self,etype=None,evalue=None,etb=None,
967 out=None,tb_offset=None):
967 out=None,tb_offset=None):
968 """Print out a formatted exception traceback.
968 """Print out a formatted exception traceback.
969
969
970 Optional arguments:
970 Optional arguments:
971 - out: an open file-like object to direct output to.
971 - out: an open file-like object to direct output to.
972
972
973 - tb_offset: the number of frames to skip over in the stack, on a
973 - tb_offset: the number of frames to skip over in the stack, on a
974 per-call basis (this overrides temporarily the instance's tb_offset
974 per-call basis (this overrides temporarily the instance's tb_offset
975 given at initialization time. """
975 given at initialization time. """
976
976
977 if out is None:
977 if out is None:
978 out = Term.cerr
978 out = Term.cerr
979 Term.cout.flush()
979 Term.cout.flush()
980 out.flush()
981 if tb_offset is not None:
980 if tb_offset is not None:
982 tb_offset, self.tb_offset = self.tb_offset, tb_offset
981 tb_offset, self.tb_offset = self.tb_offset, tb_offset
983 print >> out, self.text(etype, evalue, etb)
982 print >> out, self.text(etype, evalue, etb)
984 self.tb_offset = tb_offset
983 self.tb_offset = tb_offset
985 else:
984 else:
986 print >> out, self.text(etype, evalue, etb)
985 print >> out, self.text(etype, evalue, etb)
986 out.flush()
987 try:
987 try:
988 self.debugger()
988 self.debugger()
989 except KeyboardInterrupt:
989 except KeyboardInterrupt:
990 print "\nKeyboardInterrupt"
990 print "\nKeyboardInterrupt"
991
991
992 def text(self,etype=None,value=None,tb=None,context=5,mode=None):
992 def text(self,etype=None,value=None,tb=None,context=5,mode=None):
993 if etype is None:
993 if etype is None:
994 etype,value,tb = sys.exc_info()
994 etype,value,tb = sys.exc_info()
995 self.tb = tb
995 self.tb = tb
996 return FormattedTB.text(self,etype,value,tb,context=5,mode=mode)
996 return FormattedTB.text(self,etype,value,tb,context=5,mode=mode)
997
997
998 #---------------------------------------------------------------------------
998 #---------------------------------------------------------------------------
999 # A simple class to preserve Nathan's original functionality.
999 # A simple class to preserve Nathan's original functionality.
1000 class ColorTB(FormattedTB):
1000 class ColorTB(FormattedTB):
1001 """Shorthand to initialize a FormattedTB in Linux colors mode."""
1001 """Shorthand to initialize a FormattedTB in Linux colors mode."""
1002 def __init__(self,color_scheme='Linux',call_pdb=0):
1002 def __init__(self,color_scheme='Linux',call_pdb=0):
1003 FormattedTB.__init__(self,color_scheme=color_scheme,
1003 FormattedTB.__init__(self,color_scheme=color_scheme,
1004 call_pdb=call_pdb)
1004 call_pdb=call_pdb)
1005
1005
1006 #----------------------------------------------------------------------------
1006 #----------------------------------------------------------------------------
1007 # module testing (minimal)
1007 # module testing (minimal)
1008 if __name__ == "__main__":
1008 if __name__ == "__main__":
1009 def spam(c, (d, e)):
1009 def spam(c, (d, e)):
1010 x = c + d
1010 x = c + d
1011 y = c * d
1011 y = c * d
1012 foo(x, y)
1012 foo(x, y)
1013
1013
1014 def foo(a, b, bar=1):
1014 def foo(a, b, bar=1):
1015 eggs(a, b + bar)
1015 eggs(a, b + bar)
1016
1016
1017 def eggs(f, g, z=globals()):
1017 def eggs(f, g, z=globals()):
1018 h = f + g
1018 h = f + g
1019 i = f - g
1019 i = f - g
1020 return h / i
1020 return h / i
1021
1021
1022 print ''
1022 print ''
1023 print '*** Before ***'
1023 print '*** Before ***'
1024 try:
1024 try:
1025 print spam(1, (2, 3))
1025 print spam(1, (2, 3))
1026 except:
1026 except:
1027 traceback.print_exc()
1027 traceback.print_exc()
1028 print ''
1028 print ''
1029
1029
1030 handler = ColorTB()
1030 handler = ColorTB()
1031 print '*** ColorTB ***'
1031 print '*** ColorTB ***'
1032 try:
1032 try:
1033 print spam(1, (2, 3))
1033 print spam(1, (2, 3))
1034 except:
1034 except:
1035 apply(handler, sys.exc_info() )
1035 apply(handler, sys.exc_info() )
1036 print ''
1036 print ''
1037
1037
1038 handler = VerboseTB()
1038 handler = VerboseTB()
1039 print '*** VerboseTB ***'
1039 print '*** VerboseTB ***'
1040 try:
1040 try:
1041 print spam(1, (2, 3))
1041 print spam(1, (2, 3))
1042 except:
1042 except:
1043 apply(handler, sys.exc_info() )
1043 apply(handler, sys.exc_info() )
1044 print ''
1044 print ''
1045
1045
@@ -1,36 +1,31 b''
1 include README_Windows.txt
1 include README_Windows.txt
2 include win32_manual_post_install.py
2 include win32_manual_post_install.py
3 include ipython.py
3 include ipython.py
4
4
5 graft scripts
5 graft scripts
6
6
7 graft setupext
7 graft setupext
8
8
9 graft IPython/UserConfig
9 graft IPython/UserConfig
10
10
11 graft doc
11 graft doc
12 exclude doc/\#*
12 exclude doc/*.1
13 exclude doc/*.1
13 exclude doc/manual_base*
14 exclude doc/ChangeLog.*
14 exclude doc/ChangeLog.*
15 exclude doc/\#*
16 exclude doc/update_magic.sh
17 exclude doc/update_version.sh
15 exclude doc/update_version.sh
18 exclude doc/manual_base*
19 exclude doc/manual/WARNINGS
20 exclude doc/manual/*.aux
21 exclude doc/manual/*.log
22 exclude doc/manual/*.out
23 exclude doc/manual/*.pl
24 exclude doc/manual/*.tex
25 exclude doc/build
26 exclude doc/attic
27
28
29
16
17 # There seems to be no way of excluding whole subdirectories, other than
18 # manually excluding all their subdirs. distutils really is horrible...
19 exclude doc/attic/*
20 exclude doc/build/doctrees/*
21 exclude doc/build/html/_sources/*
22 exclude doc/build/html/_static/*
23 exclude doc/build/html/*
24 exclude doc/build/latex/*
30
25
31 global-exclude *~
26 global-exclude *~
32 global-exclude *.flc
27 global-exclude *.flc
33 global-exclude *.pyc
28 global-exclude *.pyc
34 global-exclude .dircopy.log
29 global-exclude .dircopy.log
35 global-exclude .svn
30 global-exclude .svn
36 global-exclude .bzr
31 global-exclude .bzr
@@ -1,7611 +1,7626 b''
1 2008-05-28 Fernando Perez <Fernando.Perez@berkeley.edu>
2
3 * ../win32_manual_post_install.py (run): Fix the windows installer
4 so the links to the docs are correct.
5
6 * IPython/ultraTB.py: flush stderr after writing to it to fix
7 problems with exception traceback ordering in some platforms.
8 Thanks to a report/fix by Jie Tang <jietang86-AT-gmail.com>.
9
10 * IPython/Magic.py (magic_cpaste): add stripping of continuation
11 prompts, feature requested by Stefan vdW.
12
13 * ../setup.py: updates to build and release tools in preparation
14 for 0.8.3 release.
15
1 2008-05-27 Ville Vainio <vivainio@gmail.com>
16 2008-05-27 Ville Vainio <vivainio@gmail.com>
2
17
3 * iplib.py, ipmaker.py: survive lack of doctest and site._Helper
18 * iplib.py, ipmaker.py: survive lack of doctest and site._Helper
4 for minimal environments (e.g. Maemo sdk python)
19 for minimal environments (e.g. Maemo sdk python)
5
20
6 * Magic.py: cpaste strips whitespace before >>> (allow pasting
21 * Magic.py: cpaste strips whitespace before >>> (allow pasting
7 doctests)
22 doctests)
8
23
9 * ipy_completers.py: cd completer now does recursive path expand
24 * ipy_completers.py: cd completer now does recursive path expand
10 (old behaviour is buggy on some readline versions)
25 (old behaviour is buggy on some readline versions)
11
26
12 2008-05-14 Ville Vainio <vivainio@gmail.com>
27 2008-05-14 Ville Vainio <vivainio@gmail.com>
13
28
14 * Extensions/ipy_greedycompleter.py:
29 * Extensions/ipy_greedycompleter.py:
15 New extension that enables a bit more "relaxed" tab
30 New extension that enables a bit more "relaxed" tab
16 completer that evaluates code without safety checks
31 completer that evaluates code without safety checks
17 (i.e. there can be side effects like function calls)
32 (i.e. there can be side effects like function calls)
18
33
19 2008-04-20 Ville Vainio <vivainio@gmail.com>
34 2008-04-20 Ville Vainio <vivainio@gmail.com>
20
35
21 * Extensions/ipy_lookfor.py: add %lookfor magic command
36 * Extensions/ipy_lookfor.py: add %lookfor magic command
22 (search docstrings for words) by Pauli Virtanen. Close #245.
37 (search docstrings for words) by Pauli Virtanen. Close #245.
23
38
24 * Extension/ipy_jot.py: %jot and %read magics, analogous
39 * Extension/ipy_jot.py: %jot and %read magics, analogous
25 to %store but you can specify some notes. Not read
40 to %store but you can specify some notes. Not read
26 in automatically on startup, you need %read.
41 in automatically on startup, you need %read.
27 Contributed by Yichun Wei.
42 Contributed by Yichun Wei.
28
43
29 2008-04-18 Fernando Perez <Fernando.Perez@berkeley.edu>
44 2008-04-18 Fernando Perez <Fernando.Perez@berkeley.edu>
30
45
31 * IPython/genutils.py (page): apply workaround to curses bug that
46 * IPython/genutils.py (page): apply workaround to curses bug that
32 can leave terminal corrupted after a call to initscr().
47 can leave terminal corrupted after a call to initscr().
33
48
34 2008-04-15 Ville Vainio <vivainio@gmail.com>
49 2008-04-15 Ville Vainio <vivainio@gmail.com>
35
50
36 * genutils.py: SList.grep supports 'field' argument
51 * genutils.py: SList.grep supports 'field' argument
37
52
38 * ipy_completers.py: module completer looks inside
53 * ipy_completers.py: module completer looks inside
39 .egg zip files (patch by mc). Close #196.
54 .egg zip files (patch by mc). Close #196.
40
55
41 2008-04-09 Ville Vainio <vivainio@gmail.com>
56 2008-04-09 Ville Vainio <vivainio@gmail.com>
42
57
43 * deep_reload.py: do not crash on from __future__ import
58 * deep_reload.py: do not crash on from __future__ import
44 absolute_import. Close #244.
59 absolute_import. Close #244.
45
60
46 2008-04-02 Ville Vainio <vivainio@gmail.com>
61 2008-04-02 Ville Vainio <vivainio@gmail.com>
47
62
48 * ipy_winpdb.py: New extension for winpdb integration. %wdb
63 * ipy_winpdb.py: New extension for winpdb integration. %wdb
49 test.py is winpdb equivalent of %run -d test.py. winpdb is a
64 test.py is winpdb equivalent of %run -d test.py. winpdb is a
50 crossplatform remote GUI debugger based on wxpython.
65 crossplatform remote GUI debugger based on wxpython.
51
66
52 2008-03-29 Ville Vainio <vivainio@gmail.com>
67 2008-03-29 Ville Vainio <vivainio@gmail.com>
53
68
54 * ipython.rst, do_sphinx.py: New documentation base, based on
69 * ipython.rst, do_sphinx.py: New documentation base, based on
55 reStucturedText and Sphinx (html/pdf generation). The old Lyx
70 reStucturedText and Sphinx (html/pdf generation). The old Lyx
56 based documentation will not be updated anymore.
71 based documentation will not be updated anymore.
57
72
58 * jobctrl.py: Use shell in Popen for 'start' command (in windows).
73 * jobctrl.py: Use shell in Popen for 'start' command (in windows).
59
74
60 2008-03-24 Ville Vainio <vivainio@gmail.com>
75 2008-03-24 Ville Vainio <vivainio@gmail.com>
61
76
62 * ipython.rst, do_sphinx.py: New documentation base, based on
77 * ipython.rst, do_sphinx.py: New documentation base, based on
63 reStucturedText and Sphinx (html/pdf generation). The old Lyx
78 reStucturedText and Sphinx (html/pdf generation). The old Lyx
64 based documentation will not be updated anymore.
79 based documentation will not be updated anymore.
65
80
66 ipython.rst has up to date documentation on matters that were not
81 ipython.rst has up to date documentation on matters that were not
67 documented at all, and it also removes various
82 documented at all, and it also removes various
68 misdocumented/deprecated features.
83 misdocumented/deprecated features.
69
84
70 2008-03-22 Ville Vainio <vivainio@gmail.com>
85 2008-03-22 Ville Vainio <vivainio@gmail.com>
71
86
72 * Shell.py: Merge mtexp branch:
87 * Shell.py: Merge mtexp branch:
73 https://code.launchpad.net/~ipython/ipython/mtexp
88 https://code.launchpad.net/~ipython/ipython/mtexp
74
89
75 Privides simpler and more robust MTInteractiveShell that won't
90 Privides simpler and more robust MTInteractiveShell that won't
76 deadlock, even when the worker thread (GUI) stops doing runcode()
91 deadlock, even when the worker thread (GUI) stops doing runcode()
77 regularly. r71.
92 regularly. r71.
78
93
79 2008-03-20 Ville Vainio <vivainio@gmail.com>
94 2008-03-20 Ville Vainio <vivainio@gmail.com>
80
95
81 * twshell.py: New shell that runs IPython code in Twisted reactor.
96 * twshell.py: New shell that runs IPython code in Twisted reactor.
82 Launch by doing ipython -twisted. r67.
97 Launch by doing ipython -twisted. r67.
83
98
84 2008-03-19 Ville Vainio <vivainio@gmail.com>
99 2008-03-19 Ville Vainio <vivainio@gmail.com>
85
100
86 * Magic.py: %rehashx works correctly when shadowed system commands
101 * Magic.py: %rehashx works correctly when shadowed system commands
87 have upper case characters (e.g. Print.exe). r64.
102 have upper case characters (e.g. Print.exe). r64.
88
103
89 * ipy_bzr.py, ipy_app_completers.py: new bzr completer that also
104 * ipy_bzr.py, ipy_app_completers.py: new bzr completer that also
90 knows options to commands, based on bzrtools. Uses bzrlib
105 knows options to commands, based on bzrtools. Uses bzrlib
91 directly. r66.
106 directly. r66.
92
107
93 2008-03-16 Ville Vainio <vivainio@gmail.com>
108 2008-03-16 Ville Vainio <vivainio@gmail.com>
94
109
95 * make_tarball.py: Fixed for bzr.
110 * make_tarball.py: Fixed for bzr.
96
111
97 * ipapi.py: Better _ip.runlines() script cleanup. r56,r79.
112 * ipapi.py: Better _ip.runlines() script cleanup. r56,r79.
98
113
99 * ipy_vimserver.py, ipy.vim: New extension for vim server mode,
114 * ipy_vimserver.py, ipy.vim: New extension for vim server mode,
100 by Erich Heine.
115 by Erich Heine.
101
116
102 2008-03-12 Ville Vainio <vivainio@gmail.com>
117 2008-03-12 Ville Vainio <vivainio@gmail.com>
103
118
104 * ipmaker.py: Force (reload?) import of ipy_user_conf and
119 * ipmaker.py: Force (reload?) import of ipy_user_conf and
105 ipy_profile_foo, so that embedded instances can be relaunched and
120 ipy_profile_foo, so that embedded instances can be relaunched and
106 configuration is still done. r50
121 configuration is still done. r50
107
122
108 * ipapi.py, test_embed.py: Allow specifying shell class in
123 * ipapi.py, test_embed.py: Allow specifying shell class in
109 launch_new_instance & make_new instance. Use this in
124 launch_new_instance & make_new instance. Use this in
110 test_embed.py. r51.
125 test_embed.py. r51.
111
126
112 test_embed.py is also a good and simple demo of embedding IPython.
127 test_embed.py is also a good and simple demo of embedding IPython.
113
128
114
129
115 2008-03-10 Ville Vainio <vivainio@gmail.com>
130 2008-03-10 Ville Vainio <vivainio@gmail.com>
116
131
117 * tool/update_revnum.py: Change to bzr revisioning scheme in
132 * tool/update_revnum.py: Change to bzr revisioning scheme in
118 revision numbers.
133 revision numbers.
119
134
120 * Shell.py: Threading improvements:
135 * Shell.py: Threading improvements:
121
136
122 In multithreaded shells, do not hang on macros and o.autoexec
137 In multithreaded shells, do not hang on macros and o.autoexec
123 commands (or anything executed with _ip.runlines()) anymore. Allow
138 commands (or anything executed with _ip.runlines()) anymore. Allow
124 recursive execution of IPython code in
139 recursive execution of IPython code in
125 MTInteractiveShell.runsource by checking if we are already in
140 MTInteractiveShell.runsource by checking if we are already in
126 worker thread, and execute code directly if we are. r48.
141 worker thread, and execute code directly if we are. r48.
127
142
128 MTInteractiveShell.runsource: execute code directly if worker
143 MTInteractiveShell.runsource: execute code directly if worker
129 thread is not running yet (this is the case in config files). r49.
144 thread is not running yet (this is the case in config files). r49.
130
145
131 2008-03-09 Ville Vainio <vivainio@gmail.com>
146 2008-03-09 Ville Vainio <vivainio@gmail.com>
132
147
133 * ipy_profile_sh.py: You can now use $LA or LA() to refer to last
148 * ipy_profile_sh.py: You can now use $LA or LA() to refer to last
134 argument of previous command in sh profile. Similar to bash '!$'.
149 argument of previous command in sh profile. Similar to bash '!$'.
135 LA(3) or $LA(3) stands for last argument of input history command
150 LA(3) or $LA(3) stands for last argument of input history command
136 3.
151 3.
137
152
138 * Shell.py: -pylab names don't clutter %whos listing.
153 * Shell.py: -pylab names don't clutter %whos listing.
139
154
140 2008-03-07 Ville Vainio <vivainio@gmail.com>
155 2008-03-07 Ville Vainio <vivainio@gmail.com>
141
156
142 * ipy_autoreload.py: new extension (by Pauli Virtanen) for
157 * ipy_autoreload.py: new extension (by Pauli Virtanen) for
143 autoreloading modules; try %autoreload and %aimport. Close #154.
158 autoreloading modules; try %autoreload and %aimport. Close #154.
144 Uses the new pre_runcode_hook.
159 Uses the new pre_runcode_hook.
145
160
146 2008-02-24 Ville Vainio <vivainio@gmail.com>
161 2008-02-24 Ville Vainio <vivainio@gmail.com>
147
162
148 * platutils_posix.py: freeze_term_title works
163 * platutils_posix.py: freeze_term_title works
149
164
150 2008-02-21 Ville Vainio <vivainio@gmail.com>
165 2008-02-21 Ville Vainio <vivainio@gmail.com>
151
166
152 * Magic.py: %quickref does not crash with empty docstring
167 * Magic.py: %quickref does not crash with empty docstring
153
168
154 2008-02-20 Ville Vainio <vivainio@gmail.com>
169 2008-02-20 Ville Vainio <vivainio@gmail.com>
155
170
156 * completer.py: do not treat [](){} as protectable chars anymore,
171 * completer.py: do not treat [](){} as protectable chars anymore,
157 close #233.
172 close #233.
158
173
159 * completer.py: do not treat [](){} as protectable chars anymore
174 * completer.py: do not treat [](){} as protectable chars anymore
160
175
161 * magic.py, test_cpaste.py: Allow different prefix for pasting
176 * magic.py, test_cpaste.py: Allow different prefix for pasting
162 from email
177 from email
163
178
164 2008-02-17 Ville Vainio <vivainio@gmail.com>
179 2008-02-17 Ville Vainio <vivainio@gmail.com>
165
180
166 * Switched over to Launchpad/bzr as primary VCS.
181 * Switched over to Launchpad/bzr as primary VCS.
167
182
168 2008-02-14 Ville Vainio <vivainio@gmail.com>
183 2008-02-14 Ville Vainio <vivainio@gmail.com>
169
184
170 * ipapi.py: _ip.runlines() is now much more liberal about
185 * ipapi.py: _ip.runlines() is now much more liberal about
171 indentation - it cleans up the scripts it gets
186 indentation - it cleans up the scripts it gets
172
187
173 2008-02-14 Ville Vainio <vivainio@gmail.com>
188 2008-02-14 Ville Vainio <vivainio@gmail.com>
174
189
175 * Extensions/ipy_leo.py: created 'ILeo' IPython-Leo bridge.
190 * Extensions/ipy_leo.py: created 'ILeo' IPython-Leo bridge.
176 Changes to it (later on) are too numerous to list in ChangeLog
191 Changes to it (later on) are too numerous to list in ChangeLog
177 until it stabilizes
192 until it stabilizes
178
193
179 2008-02-07 Darren Dale <darren.dale@cornell.edu>
194 2008-02-07 Darren Dale <darren.dale@cornell.edu>
180
195
181 * IPython/Shell.py: Call QtCore.pyqtRemoveInputHook() when creating
196 * IPython/Shell.py: Call QtCore.pyqtRemoveInputHook() when creating
182 an IPShellQt4. PyQt4-4.2.1 and later uses PyOS_InputHook to improve
197 an IPShellQt4. PyQt4-4.2.1 and later uses PyOS_InputHook to improve
183 interaction in the interpreter (like Tkinter does), but it seems to
198 interaction in the interpreter (like Tkinter does), but it seems to
184 partially interfere with the IPython implementation and exec_()
199 partially interfere with the IPython implementation and exec_()
185 still seems to block. So we disable the PyQt implementation and
200 still seems to block. So we disable the PyQt implementation and
186 stick with the IPython one for now.
201 stick with the IPython one for now.
187
202
188 2008-02-02 Walter Doerwald <walter@livinglogic.de>
203 2008-02-02 Walter Doerwald <walter@livinglogic.de>
189
204
190 * ipipe.py: A new ipipe table has been added: ialias produces all
205 * ipipe.py: A new ipipe table has been added: ialias produces all
191 entries from IPython's alias table.
206 entries from IPython's alias table.
192
207
193 2008-02-01 Fernando Perez <Fernando.Perez@colorado.edu>
208 2008-02-01 Fernando Perez <Fernando.Perez@colorado.edu>
194
209
195 * IPython/Shell.py (MTInteractiveShell.runcode): Improve handling
210 * IPython/Shell.py (MTInteractiveShell.runcode): Improve handling
196 of KBINT in threaded shells. After code provided by Marc in #212.
211 of KBINT in threaded shells. After code provided by Marc in #212.
197
212
198 2008-01-30 Fernando Perez <Fernando.Perez@colorado.edu>
213 2008-01-30 Fernando Perez <Fernando.Perez@colorado.edu>
199
214
200 * IPython/Shell.py (MTInteractiveShell.__init__): Fixed deadlock
215 * IPython/Shell.py (MTInteractiveShell.__init__): Fixed deadlock
201 that could occur due to a race condition in threaded shells.
216 that could occur due to a race condition in threaded shells.
202 Thanks to code provided by Marc, as #210.
217 Thanks to code provided by Marc, as #210.
203
218
204 2008-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
219 2008-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
205
220
206 * IPython/Magic.py (magic_doctest_mode): respect the user's
221 * IPython/Magic.py (magic_doctest_mode): respect the user's
207 settings for input separators rather than overriding them. After
222 settings for input separators rather than overriding them. After
208 a report by Jeff Kowalczyk <jtk-AT-yahoo.com>
223 a report by Jeff Kowalczyk <jtk-AT-yahoo.com>
209
224
210 * IPython/history.py (magic_history): Add support for declaring an
225 * IPython/history.py (magic_history): Add support for declaring an
211 output file directly from the history command.
226 output file directly from the history command.
212
227
213 2008-01-21 Walter Doerwald <walter@livinglogic.de>
228 2008-01-21 Walter Doerwald <walter@livinglogic.de>
214
229
215 * ipipe.py: Register ipipe's displayhooks via the generic function
230 * ipipe.py: Register ipipe's displayhooks via the generic function
216 generics.result_display() instead of using ipapi.set_hook().
231 generics.result_display() instead of using ipapi.set_hook().
217
232
218 2008-01-19 Walter Doerwald <walter@livinglogic.de>
233 2008-01-19 Walter Doerwald <walter@livinglogic.de>
219
234
220 * ibrowse.py, igrid.py, ipipe.py:
235 * ibrowse.py, igrid.py, ipipe.py:
221 The input object can now be passed to the constructor of the display classes.
236 The input object can now be passed to the constructor of the display classes.
222 This makes it possible to use them with objects that implement __or__.
237 This makes it possible to use them with objects that implement __or__.
223 Use this constructor in the displayhook instead of piping.
238 Use this constructor in the displayhook instead of piping.
224
239
225 * ipipe.py: Importing astyle.py is done as late as possible to
240 * ipipe.py: Importing astyle.py is done as late as possible to
226 avoid problems with circular imports.
241 avoid problems with circular imports.
227
242
228 2008-01-19 Ville Vainio <vivainio@gmail.com>
243 2008-01-19 Ville Vainio <vivainio@gmail.com>
229
244
230 * hooks.py, iplib.py: Added 'shell_hook' to customize how
245 * hooks.py, iplib.py: Added 'shell_hook' to customize how
231 IPython calls shell.
246 IPython calls shell.
232
247
233 * hooks.py, iplib.py: Added 'show_in_pager' hook to specify
248 * hooks.py, iplib.py: Added 'show_in_pager' hook to specify
234 how IPython pages text (%page, %pycat, %pdoc etc.)
249 how IPython pages text (%page, %pycat, %pdoc etc.)
235
250
236 * Extensions/jobctrl.py: Use shell_hook. New magics: '%tasks'
251 * Extensions/jobctrl.py: Use shell_hook. New magics: '%tasks'
237 and '%kill' to kill hanging processes that won't obey ctrl+C.
252 and '%kill' to kill hanging processes that won't obey ctrl+C.
238
253
239 2008-01-16 Ville Vainio <vivainio@gmail.com>
254 2008-01-16 Ville Vainio <vivainio@gmail.com>
240
255
241 * ipy_completers.py: pyw extension support for %run completer.
256 * ipy_completers.py: pyw extension support for %run completer.
242
257
243 2008-01-11 Ville Vainio <vivainio@gmail.com>
258 2008-01-11 Ville Vainio <vivainio@gmail.com>
244
259
245 * iplib.py, ipmaker.py: new rc option - autoexec. It's a list
260 * iplib.py, ipmaker.py: new rc option - autoexec. It's a list
246 of ipython commands to be run when IPython has started up
261 of ipython commands to be run when IPython has started up
247 (just before running the scripts and -c arg on command line).
262 (just before running the scripts and -c arg on command line).
248
263
249 * ipy_user_conf.py: Added an example on how to change term
264 * ipy_user_conf.py: Added an example on how to change term
250 colors in config file (through using autoexec).
265 colors in config file (through using autoexec).
251
266
252 * completer.py, test_completer.py: Ability to specify custom
267 * completer.py, test_completer.py: Ability to specify custom
253 get_endidx to replace readline.get_endidx. For emacs users.
268 get_endidx to replace readline.get_endidx. For emacs users.
254
269
255 2008-01-10 Ville Vainio <vivainio@gmail.com>
270 2008-01-10 Ville Vainio <vivainio@gmail.com>
256
271
257 * Prompts.py (set_p_str): do not crash on illegal prompt strings
272 * Prompts.py (set_p_str): do not crash on illegal prompt strings
258
273
259 2008-01-08 Ville Vainio <vivainio@gmail.com>
274 2008-01-08 Ville Vainio <vivainio@gmail.com>
260
275
261 * '%macro -r' (raw mode) is now default in sh profile.
276 * '%macro -r' (raw mode) is now default in sh profile.
262
277
263 2007-12-31 Ville Vainio <vivainio@gmail.com>
278 2007-12-31 Ville Vainio <vivainio@gmail.com>
264
279
265 * completer.py: custom completer matching is now case sensitive
280 * completer.py: custom completer matching is now case sensitive
266 (#207).
281 (#207).
267
282
268 * ultraTB.py, iplib.py: Add some KeyboardInterrupt catching in
283 * ultraTB.py, iplib.py: Add some KeyboardInterrupt catching in
269 an attempt to prevent occasional crashes.
284 an attempt to prevent occasional crashes.
270
285
271 * CrashHandler.py: Crash log dump now asks user to press enter
286 * CrashHandler.py: Crash log dump now asks user to press enter
272 before exiting.
287 before exiting.
273
288
274 * Store _ip in user_ns instead of __builtin__, enabling safer
289 * Store _ip in user_ns instead of __builtin__, enabling safer
275 coexistence of multiple IPython instances in the same python
290 coexistence of multiple IPython instances in the same python
276 interpreter (#197).
291 interpreter (#197).
277
292
278 * Debugger.py, ipmaker.py: Need to add '-pydb' command line
293 * Debugger.py, ipmaker.py: Need to add '-pydb' command line
279 switch to enable pydb in post-mortem debugging and %run -d.
294 switch to enable pydb in post-mortem debugging and %run -d.
280
295
281 2007-12-28 Ville Vainio <vivainio@gmail.com>
296 2007-12-28 Ville Vainio <vivainio@gmail.com>
282
297
283 * ipy_server.py: TCP socket server for "remote control" of an IPython
298 * ipy_server.py: TCP socket server for "remote control" of an IPython
284 instance.
299 instance.
285
300
286 * Debugger.py: Change to PSF license
301 * Debugger.py: Change to PSF license
287
302
288 * simplegeneric.py: Add license & author notes.
303 * simplegeneric.py: Add license & author notes.
289
304
290 * ipy_fsops.py: Added PathObj and FileObj, an object-oriented way
305 * ipy_fsops.py: Added PathObj and FileObj, an object-oriented way
291 to navigate file system with a custom completer. Run
306 to navigate file system with a custom completer. Run
292 ipy_fsops.test_pathobj() to play with it.
307 ipy_fsops.test_pathobj() to play with it.
293
308
294 2007-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
309 2007-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
295
310
296 * IPython/dtutils.py: Add utilities for interactively running
311 * IPython/dtutils.py: Add utilities for interactively running
297 doctests. Still needs work to more easily handle the namespace of
312 doctests. Still needs work to more easily handle the namespace of
298 the package one may be working on, but the basics are in place.
313 the package one may be working on, but the basics are in place.
299
314
300 2007-12-27 Ville Vainio <vivainio@gmail.com>
315 2007-12-27 Ville Vainio <vivainio@gmail.com>
301
316
302 * ipy_completers.py: Applied arno's patch to get proper list of
317 * ipy_completers.py: Applied arno's patch to get proper list of
303 packages in import completer. Closes #196.
318 packages in import completer. Closes #196.
304
319
305 2007-12-20 Ville Vainio <vivainio@gmail.com>
320 2007-12-20 Ville Vainio <vivainio@gmail.com>
306
321
307 * completer.py, generics.py(complete_object): Allow
322 * completer.py, generics.py(complete_object): Allow
308 custom complers based on python objects via simplegeneric.
323 custom complers based on python objects via simplegeneric.
309 See generics.py / my_demo_complete_object
324 See generics.py / my_demo_complete_object
310
325
311 2007-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
326 2007-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
312
327
313 * IPython/Prompts.py (BasePrompt.__nonzero__): add proper boolean
328 * IPython/Prompts.py (BasePrompt.__nonzero__): add proper boolean
314 behavior to prompt objects, useful for display hooks to adjust
329 behavior to prompt objects, useful for display hooks to adjust
315 themselves depending on whether prompts will be there or not.
330 themselves depending on whether prompts will be there or not.
316
331
317 2007-12-13 Ville Vainio <vivainio@gmail.com>
332 2007-12-13 Ville Vainio <vivainio@gmail.com>
318
333
319 * iplib.py(raw_input): unix readline does not allow unicode in
334 * iplib.py(raw_input): unix readline does not allow unicode in
320 history, encode to normal string. After patch by Tiago.
335 history, encode to normal string. After patch by Tiago.
321 Close #201
336 Close #201
322
337
323 2007-12-12 Ville Vainio <vivainio@gmail.com>
338 2007-12-12 Ville Vainio <vivainio@gmail.com>
324
339
325 * genutils.py (abbrev_cwd): Terminal title now shows 2 levels of
340 * genutils.py (abbrev_cwd): Terminal title now shows 2 levels of
326 current directory.
341 current directory.
327
342
328 2007-12-12 Fernando Perez <Fernando.Perez@colorado.edu>
343 2007-12-12 Fernando Perez <Fernando.Perez@colorado.edu>
329
344
330 * IPython/Shell.py (_select_shell): add support for controlling
345 * IPython/Shell.py (_select_shell): add support for controlling
331 the pylab threading mode directly at the command line, without
346 the pylab threading mode directly at the command line, without
332 having to modify MPL config files. Added unit tests for this
347 having to modify MPL config files. Added unit tests for this
333 feature, though manual/docs update is still pending, will do later.
348 feature, though manual/docs update is still pending, will do later.
334
349
335 2007-12-11 Ville Vainio <vivainio@gmail.com>
350 2007-12-11 Ville Vainio <vivainio@gmail.com>
336
351
337 * ext_rescapture.py: var = !cmd is no longer verbose (to facilitate
352 * ext_rescapture.py: var = !cmd is no longer verbose (to facilitate
338 use in scripts)
353 use in scripts)
339
354
340 2007-12-07 Ville Vainio <vivainio@gmail.com>
355 2007-12-07 Ville Vainio <vivainio@gmail.com>
341
356
342 * iplib.py, ipy_profile_sh.py: Do not escape # on command lines
357 * iplib.py, ipy_profile_sh.py: Do not escape # on command lines
343 anymore (to \#) - even if it is a comment char that is implicitly
358 anymore (to \#) - even if it is a comment char that is implicitly
344 escaped in some unix shells in interactive mode, it is ok to leave
359 escaped in some unix shells in interactive mode, it is ok to leave
345 it in IPython as such.
360 it in IPython as such.
346
361
347
362
348 2007-12-01 Robert Kern <robert.kern@gmail.com>
363 2007-12-01 Robert Kern <robert.kern@gmail.com>
349
364
350 * IPython/ultraTB.py (findsource): Improve the monkeypatch to
365 * IPython/ultraTB.py (findsource): Improve the monkeypatch to
351 inspect.findsource(). It can now find source lines inside zipped
366 inspect.findsource(). It can now find source lines inside zipped
352 packages.
367 packages.
353
368
354 * IPython/ultraTB.py: When constructing tracebacks, try to use __file__
369 * IPython/ultraTB.py: When constructing tracebacks, try to use __file__
355 in the frame's namespace before trusting the filename in the code object
370 in the frame's namespace before trusting the filename in the code object
356 which created the frame.
371 which created the frame.
357
372
358 2007-11-29 *** Released version 0.8.2
373 2007-11-29 *** Released version 0.8.2
359
374
360 2007-11-25 Fernando Perez <Fernando.Perez@colorado.edu>
375 2007-11-25 Fernando Perez <Fernando.Perez@colorado.edu>
361
376
362 * IPython/Logger.py (Logger.logstop): add a proper logstop()
377 * IPython/Logger.py (Logger.logstop): add a proper logstop()
363 method to fully stop the logger, along with a corresponding
378 method to fully stop the logger, along with a corresponding
364 %logstop magic for interactive use.
379 %logstop magic for interactive use.
365
380
366 * IPython/Extensions/ipy_host_completers.py: added new host
381 * IPython/Extensions/ipy_host_completers.py: added new host
367 completers functionality, contributed by Gael Pasgrimaud
382 completers functionality, contributed by Gael Pasgrimaud
368 <gawel-AT-afpy.org>.
383 <gawel-AT-afpy.org>.
369
384
370 2007-11-24 Fernando Perez <Fernando.Perez@colorado.edu>
385 2007-11-24 Fernando Perez <Fernando.Perez@colorado.edu>
371
386
372 * IPython/DPyGetOpt.py (ArgumentError): Apply patch by Paul Mueller
387 * IPython/DPyGetOpt.py (ArgumentError): Apply patch by Paul Mueller
373 <gakusei-AT-dakotacom.net>, to fix deprecated string exceptions in
388 <gakusei-AT-dakotacom.net>, to fix deprecated string exceptions in
374 options handling. Unicode fix in %whos (committed a while ago)
389 options handling. Unicode fix in %whos (committed a while ago)
375 was also contributed by Paul.
390 was also contributed by Paul.
376
391
377 2007-11-23 Darren Dale <darren.dale@cornell.edu>
392 2007-11-23 Darren Dale <darren.dale@cornell.edu>
378 * ipy_traits_completer.py: let traits_completer respect the user's
393 * ipy_traits_completer.py: let traits_completer respect the user's
379 readline_omit__names setting.
394 readline_omit__names setting.
380
395
381 2007-11-08 Ville Vainio <vivainio@gmail.com>
396 2007-11-08 Ville Vainio <vivainio@gmail.com>
382
397
383 * ipy_completers.py (import completer): assume 'xml' module exists.
398 * ipy_completers.py (import completer): assume 'xml' module exists.
384 Do not add every module twice anymore. Closes #196.
399 Do not add every module twice anymore. Closes #196.
385
400
386 * ipy_completers.py, ipy_app_completers.py: Add proper apt-get
401 * ipy_completers.py, ipy_app_completers.py: Add proper apt-get
387 completer that uses apt-cache to search for existing packages.
402 completer that uses apt-cache to search for existing packages.
388
403
389 2007-11-06 Ville Vainio <vivainio@gmail.com>
404 2007-11-06 Ville Vainio <vivainio@gmail.com>
390
405
391 * Prompts.py: Do not update _oh and _123 when do_full_cache is not
406 * Prompts.py: Do not update _oh and _123 when do_full_cache is not
392 true. Closes #194.
407 true. Closes #194.
393
408
394 2007-11-01 Brian Granger <ellisonbg@gmail.com>
409 2007-11-01 Brian Granger <ellisonbg@gmail.com>
395
410
396 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
411 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
397 working with OS X 10.5 libedit implementation of readline.
412 working with OS X 10.5 libedit implementation of readline.
398
413
399 2007-10-24 Ville Vainio <vivainio@gmail.com>
414 2007-10-24 Ville Vainio <vivainio@gmail.com>
400
415
401 * iplib.py(user_setup): To route around buggy installations where
416 * iplib.py(user_setup): To route around buggy installations where
402 UserConfig is not available, create a minimal _ipython.
417 UserConfig is not available, create a minimal _ipython.
403
418
404 * iplib.py: Unicode fixes from Jorgen.
419 * iplib.py: Unicode fixes from Jorgen.
405
420
406 * genutils.py: Slist now has new method 'fields()' for extraction of
421 * genutils.py: Slist now has new method 'fields()' for extraction of
407 whitespace-separated fields from line-oriented data.
422 whitespace-separated fields from line-oriented data.
408
423
409 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
424 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
410
425
411 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
426 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
412 when querying objects with no __class__ attribute (such as
427 when querying objects with no __class__ attribute (such as
413 f2py-generated modules).
428 f2py-generated modules).
414
429
415 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
430 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
416
431
417 * IPython/Magic.py (magic_time): track compilation time and report
432 * IPython/Magic.py (magic_time): track compilation time and report
418 it if longer than 0.1s (fix done to %time and %timeit). After a
433 it if longer than 0.1s (fix done to %time and %timeit). After a
419 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
434 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
420
435
421 2007-09-18 Ville Vainio <vivainio@gmail.com>
436 2007-09-18 Ville Vainio <vivainio@gmail.com>
422
437
423 * genutils.py(make_quoted_expr): Do not use Itpl, it does
438 * genutils.py(make_quoted_expr): Do not use Itpl, it does
424 not support unicode at the moment. Fixes (many) magic calls with
439 not support unicode at the moment. Fixes (many) magic calls with
425 special characters.
440 special characters.
426
441
427 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
442 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
428
443
429 * IPython/genutils.py (doctest_reload): expose the doctest
444 * IPython/genutils.py (doctest_reload): expose the doctest
430 reloader to the user so that people can easily reset doctest while
445 reloader to the user so that people can easily reset doctest while
431 using it interactively. Fixes a problem reported by Jorgen.
446 using it interactively. Fixes a problem reported by Jorgen.
432
447
433 * IPython/iplib.py (InteractiveShell.__init__): protect the
448 * IPython/iplib.py (InteractiveShell.__init__): protect the
434 FakeModule instances used for __main__ in %run calls from
449 FakeModule instances used for __main__ in %run calls from
435 deletion, so that user code defined in them isn't left with
450 deletion, so that user code defined in them isn't left with
436 dangling references due to the Python module deletion machinery.
451 dangling references due to the Python module deletion machinery.
437 This should fix the problems reported by Darren.
452 This should fix the problems reported by Darren.
438
453
439 2007-09-10 Darren Dale <dd55@cornell.edu>
454 2007-09-10 Darren Dale <dd55@cornell.edu>
440
455
441 * Cleanup of IPShellQt and IPShellQt4
456 * Cleanup of IPShellQt and IPShellQt4
442
457
443 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
458 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
444
459
445 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
460 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
446 doctest support.
461 doctest support.
447
462
448 * IPython/iplib.py (safe_execfile): minor docstring improvements.
463 * IPython/iplib.py (safe_execfile): minor docstring improvements.
449
464
450 2007-09-08 Ville Vainio <vivainio@gmail.com>
465 2007-09-08 Ville Vainio <vivainio@gmail.com>
451
466
452 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
467 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
453 directory, not the target directory.
468 directory, not the target directory.
454
469
455 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
470 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
456 exception that won't print the tracebacks. Switched many magics to
471 exception that won't print the tracebacks. Switched many magics to
457 raise them on error situations, also GetoptError is not printed
472 raise them on error situations, also GetoptError is not printed
458 anymore.
473 anymore.
459
474
460 2007-09-07 Ville Vainio <vivainio@gmail.com>
475 2007-09-07 Ville Vainio <vivainio@gmail.com>
461
476
462 * iplib.py: do not auto-alias "dir", it screws up other dir auto
477 * iplib.py: do not auto-alias "dir", it screws up other dir auto
463 aliases.
478 aliases.
464
479
465 * genutils.py: SList.grep() implemented.
480 * genutils.py: SList.grep() implemented.
466
481
467 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
482 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
468 for easy "out of the box" setup of several common editors, so that
483 for easy "out of the box" setup of several common editors, so that
469 e.g. '%edit os.path.isfile' will jump to the correct line
484 e.g. '%edit os.path.isfile' will jump to the correct line
470 automatically. Contributions for command lines of your favourite
485 automatically. Contributions for command lines of your favourite
471 editors welcome.
486 editors welcome.
472
487
473 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
488 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
474
489
475 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
490 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
476 preventing source display in certain cases. In reality I think
491 preventing source display in certain cases. In reality I think
477 the problem is with Ubuntu's Python build, but this change works
492 the problem is with Ubuntu's Python build, but this change works
478 around the issue in some cases (not in all, unfortunately). I'd
493 around the issue in some cases (not in all, unfortunately). I'd
479 filed a Python bug on this with more details, but in the change of
494 filed a Python bug on this with more details, but in the change of
480 bug trackers it seems to have been lost.
495 bug trackers it seems to have been lost.
481
496
482 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
497 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
483 not the same, it's not self-documenting, doesn't allow range
498 not the same, it's not self-documenting, doesn't allow range
484 selection, and sorts alphabetically instead of numerically.
499 selection, and sorts alphabetically instead of numerically.
485 (magic_r): restore %r. No, "up + enter. One char magic" is not
500 (magic_r): restore %r. No, "up + enter. One char magic" is not
486 the same thing, since %r takes parameters to allow fast retrieval
501 the same thing, since %r takes parameters to allow fast retrieval
487 of old commands. I've received emails from users who use this a
502 of old commands. I've received emails from users who use this a
488 LOT, so it stays.
503 LOT, so it stays.
489 (magic_automagic): restore %automagic. "use _ip.option.automagic"
504 (magic_automagic): restore %automagic. "use _ip.option.automagic"
490 is not a valid replacement b/c it doesn't provide an complete
505 is not a valid replacement b/c it doesn't provide an complete
491 explanation (which the automagic docstring does).
506 explanation (which the automagic docstring does).
492 (magic_autocall): restore %autocall, with improved docstring.
507 (magic_autocall): restore %autocall, with improved docstring.
493 Same argument as for others, "use _ip.options.autocall" is not a
508 Same argument as for others, "use _ip.options.autocall" is not a
494 valid replacement.
509 valid replacement.
495 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
510 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
496 tutorials and online docs.
511 tutorials and online docs.
497
512
498 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
513 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
499
514
500 * IPython/usage.py (quick_reference): mention magics in quickref,
515 * IPython/usage.py (quick_reference): mention magics in quickref,
501 modified main banner to mention %quickref.
516 modified main banner to mention %quickref.
502
517
503 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
518 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
504
519
505 2007-09-06 Ville Vainio <vivainio@gmail.com>
520 2007-09-06 Ville Vainio <vivainio@gmail.com>
506
521
507 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
522 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
508 Callable aliases now pass the _ip as first arg. This breaks
523 Callable aliases now pass the _ip as first arg. This breaks
509 compatibility with earlier 0.8.2.svn series! (though they should
524 compatibility with earlier 0.8.2.svn series! (though they should
510 not have been in use yet outside these few extensions)
525 not have been in use yet outside these few extensions)
511
526
512 2007-09-05 Ville Vainio <vivainio@gmail.com>
527 2007-09-05 Ville Vainio <vivainio@gmail.com>
513
528
514 * external/mglob.py: expand('dirname') => ['dirname'], instead
529 * external/mglob.py: expand('dirname') => ['dirname'], instead
515 of ['dirname/foo','dirname/bar', ...].
530 of ['dirname/foo','dirname/bar', ...].
516
531
517 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
532 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
518 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
533 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
519 is useful for others as well).
534 is useful for others as well).
520
535
521 * iplib.py: on callable aliases (as opposed to old style aliases),
536 * iplib.py: on callable aliases (as opposed to old style aliases),
522 do var_expand() immediately, and use make_quoted_expr instead
537 do var_expand() immediately, and use make_quoted_expr instead
523 of hardcoded r"""
538 of hardcoded r"""
524
539
525 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
540 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
526 if not available load ipy_fsops.py for cp, mv, etc. replacements
541 if not available load ipy_fsops.py for cp, mv, etc. replacements
527
542
528 * OInspect.py, ipy_which.py: improve %which and obj? for callable
543 * OInspect.py, ipy_which.py: improve %which and obj? for callable
529 aliases
544 aliases
530
545
531 2007-09-04 Ville Vainio <vivainio@gmail.com>
546 2007-09-04 Ville Vainio <vivainio@gmail.com>
532
547
533 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
548 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
534 Relicensed under BSD with the authors approval.
549 Relicensed under BSD with the authors approval.
535
550
536 * ipmaker.py, usage.py: Remove %magic from default banner, improve
551 * ipmaker.py, usage.py: Remove %magic from default banner, improve
537 %quickref
552 %quickref
538
553
539 2007-09-03 Ville Vainio <vivainio@gmail.com>
554 2007-09-03 Ville Vainio <vivainio@gmail.com>
540
555
541 * Magic.py: %time now passes expression through prefilter,
556 * Magic.py: %time now passes expression through prefilter,
542 allowing IPython syntax.
557 allowing IPython syntax.
543
558
544 2007-09-01 Ville Vainio <vivainio@gmail.com>
559 2007-09-01 Ville Vainio <vivainio@gmail.com>
545
560
546 * ipmaker.py: Always show full traceback when newstyle config fails
561 * ipmaker.py: Always show full traceback when newstyle config fails
547
562
548 2007-08-27 Ville Vainio <vivainio@gmail.com>
563 2007-08-27 Ville Vainio <vivainio@gmail.com>
549
564
550 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
565 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
551
566
552 2007-08-26 Ville Vainio <vivainio@gmail.com>
567 2007-08-26 Ville Vainio <vivainio@gmail.com>
553
568
554 * ipmaker.py: Command line args have the highest priority again
569 * ipmaker.py: Command line args have the highest priority again
555
570
556 * iplib.py, ipmaker.py: -i command line argument now behaves as in
571 * iplib.py, ipmaker.py: -i command line argument now behaves as in
557 normal python, i.e. leaves the IPython session running after -c
572 normal python, i.e. leaves the IPython session running after -c
558 command or running a batch file from command line.
573 command or running a batch file from command line.
559
574
560 2007-08-22 Ville Vainio <vivainio@gmail.com>
575 2007-08-22 Ville Vainio <vivainio@gmail.com>
561
576
562 * iplib.py: no extra empty (last) line in raw hist w/ multiline
577 * iplib.py: no extra empty (last) line in raw hist w/ multiline
563 statements
578 statements
564
579
565 * logger.py: Fix bug where blank lines in history were not
580 * logger.py: Fix bug where blank lines in history were not
566 added until AFTER adding the current line; translated and raw
581 added until AFTER adding the current line; translated and raw
567 history should finally be in sync with prompt now.
582 history should finally be in sync with prompt now.
568
583
569 * ipy_completers.py: quick_completer now makes it easy to create
584 * ipy_completers.py: quick_completer now makes it easy to create
570 trivial custom completers
585 trivial custom completers
571
586
572 * clearcmd.py: shadow history compression & erasing, fixed input hist
587 * clearcmd.py: shadow history compression & erasing, fixed input hist
573 clearing.
588 clearing.
574
589
575 * envpersist.py, history.py: %env (sh profile only), %hist completers
590 * envpersist.py, history.py: %env (sh profile only), %hist completers
576
591
577 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
592 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
578 term title now include the drive letter, and always use / instead of
593 term title now include the drive letter, and always use / instead of
579 os.sep (as per recommended approach for win32 ipython in general).
594 os.sep (as per recommended approach for win32 ipython in general).
580
595
581 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
596 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
582 plain python scripts from ipykit command line by running
597 plain python scripts from ipykit command line by running
583 "py myscript.py", even w/o installed python.
598 "py myscript.py", even w/o installed python.
584
599
585 2007-08-21 Ville Vainio <vivainio@gmail.com>
600 2007-08-21 Ville Vainio <vivainio@gmail.com>
586
601
587 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
602 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
588 (for backwards compatibility)
603 (for backwards compatibility)
589
604
590 * history.py: switch back to %hist -t from %hist -r as default.
605 * history.py: switch back to %hist -t from %hist -r as default.
591 At least until raw history is fixed for good.
606 At least until raw history is fixed for good.
592
607
593 2007-08-20 Ville Vainio <vivainio@gmail.com>
608 2007-08-20 Ville Vainio <vivainio@gmail.com>
594
609
595 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
610 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
596 locate alias redeclarations etc. Also, avoid handling
611 locate alias redeclarations etc. Also, avoid handling
597 _ip.IP.alias_table directly, prefer using _ip.defalias.
612 _ip.IP.alias_table directly, prefer using _ip.defalias.
598
613
599
614
600 2007-08-15 Ville Vainio <vivainio@gmail.com>
615 2007-08-15 Ville Vainio <vivainio@gmail.com>
601
616
602 * prefilter.py: ! is now always served first
617 * prefilter.py: ! is now always served first
603
618
604 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
619 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
605
620
606 * IPython/iplib.py (safe_execfile): fix the SystemExit
621 * IPython/iplib.py (safe_execfile): fix the SystemExit
607 auto-suppression code to work in Python2.4 (the internal structure
622 auto-suppression code to work in Python2.4 (the internal structure
608 of that exception changed and I'd only tested the code with 2.5).
623 of that exception changed and I'd only tested the code with 2.5).
609 Bug reported by a SciPy attendee.
624 Bug reported by a SciPy attendee.
610
625
611 2007-08-13 Ville Vainio <vivainio@gmail.com>
626 2007-08-13 Ville Vainio <vivainio@gmail.com>
612
627
613 * prefilter.py: reverted !c:/bin/foo fix, made % in
628 * prefilter.py: reverted !c:/bin/foo fix, made % in
614 multiline specials work again
629 multiline specials work again
615
630
616 2007-08-13 Ville Vainio <vivainio@gmail.com>
631 2007-08-13 Ville Vainio <vivainio@gmail.com>
617
632
618 * prefilter.py: Take more care to special-case !, so that
633 * prefilter.py: Take more care to special-case !, so that
619 !c:/bin/foo.exe works.
634 !c:/bin/foo.exe works.
620
635
621 * setup.py: if we are building eggs, strip all docs and
636 * setup.py: if we are building eggs, strip all docs and
622 examples (it doesn't make sense to bytecompile examples,
637 examples (it doesn't make sense to bytecompile examples,
623 and docs would be in an awkward place anyway).
638 and docs would be in an awkward place anyway).
624
639
625 * Ryan Krauss' patch fixes start menu shortcuts when IPython
640 * Ryan Krauss' patch fixes start menu shortcuts when IPython
626 is installed into a directory that has spaces in the name.
641 is installed into a directory that has spaces in the name.
627
642
628 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
643 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
629
644
630 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
645 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
631 doctest profile and %doctest_mode, so they actually generate the
646 doctest profile and %doctest_mode, so they actually generate the
632 blank lines needed by doctest to separate individual tests.
647 blank lines needed by doctest to separate individual tests.
633
648
634 * IPython/iplib.py (safe_execfile): modify so that running code
649 * IPython/iplib.py (safe_execfile): modify so that running code
635 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
650 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
636 doesn't get a printed traceback. Any other value in sys.exit(),
651 doesn't get a printed traceback. Any other value in sys.exit(),
637 including the empty call, still generates a traceback. This
652 including the empty call, still generates a traceback. This
638 enables use of %run without having to pass '-e' for codes that
653 enables use of %run without having to pass '-e' for codes that
639 correctly set the exit status flag.
654 correctly set the exit status flag.
640
655
641 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
656 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
642
657
643 * IPython/iplib.py (InteractiveShell.post_config_initialization):
658 * IPython/iplib.py (InteractiveShell.post_config_initialization):
644 fix problems with doctests failing when run inside IPython due to
659 fix problems with doctests failing when run inside IPython due to
645 IPython's modifications of sys.displayhook.
660 IPython's modifications of sys.displayhook.
646
661
647 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
662 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
648
663
649 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
664 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
650 a string with names.
665 a string with names.
651
666
652 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
667 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
653
668
654 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
669 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
655 magic to toggle on/off the doctest pasting support without having
670 magic to toggle on/off the doctest pasting support without having
656 to leave a session to switch to a separate profile.
671 to leave a session to switch to a separate profile.
657
672
658 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
673 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
659
674
660 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
675 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
661 introduce a blank line between inputs, to conform to doctest
676 introduce a blank line between inputs, to conform to doctest
662 requirements.
677 requirements.
663
678
664 * IPython/OInspect.py (Inspector.pinfo): fix another part where
679 * IPython/OInspect.py (Inspector.pinfo): fix another part where
665 auto-generated docstrings for new-style classes were showing up.
680 auto-generated docstrings for new-style classes were showing up.
666
681
667 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
682 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
668
683
669 * api_changes: Add new file to track backward-incompatible
684 * api_changes: Add new file to track backward-incompatible
670 user-visible changes.
685 user-visible changes.
671
686
672 2007-08-06 Ville Vainio <vivainio@gmail.com>
687 2007-08-06 Ville Vainio <vivainio@gmail.com>
673
688
674 * ipmaker.py: fix bug where user_config_ns didn't exist at all
689 * ipmaker.py: fix bug where user_config_ns didn't exist at all
675 before all the config files were handled.
690 before all the config files were handled.
676
691
677 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
692 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
678
693
679 * IPython/irunner.py (RunnerFactory): Add new factory class for
694 * IPython/irunner.py (RunnerFactory): Add new factory class for
680 creating reusable runners based on filenames.
695 creating reusable runners based on filenames.
681
696
682 * IPython/Extensions/ipy_profile_doctest.py: New profile for
697 * IPython/Extensions/ipy_profile_doctest.py: New profile for
683 doctest support. It sets prompts/exceptions as similar to
698 doctest support. It sets prompts/exceptions as similar to
684 standard Python as possible, so that ipython sessions in this
699 standard Python as possible, so that ipython sessions in this
685 profile can be easily pasted as doctests with minimal
700 profile can be easily pasted as doctests with minimal
686 modifications. It also enables pasting of doctests from external
701 modifications. It also enables pasting of doctests from external
687 sources (even if they have leading whitespace), so that you can
702 sources (even if they have leading whitespace), so that you can
688 rerun doctests from existing sources.
703 rerun doctests from existing sources.
689
704
690 * IPython/iplib.py (_prefilter): fix a buglet where after entering
705 * IPython/iplib.py (_prefilter): fix a buglet where after entering
691 some whitespace, the prompt would become a continuation prompt
706 some whitespace, the prompt would become a continuation prompt
692 with no way of exiting it other than Ctrl-C. This fix brings us
707 with no way of exiting it other than Ctrl-C. This fix brings us
693 into conformity with how the default python prompt works.
708 into conformity with how the default python prompt works.
694
709
695 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
710 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
696 Add support for pasting not only lines that start with '>>>', but
711 Add support for pasting not only lines that start with '>>>', but
697 also with ' >>>'. That is, arbitrary whitespace can now precede
712 also with ' >>>'. That is, arbitrary whitespace can now precede
698 the prompts. This makes the system useful for pasting doctests
713 the prompts. This makes the system useful for pasting doctests
699 from docstrings back into a normal session.
714 from docstrings back into a normal session.
700
715
701 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
716 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
702
717
703 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
718 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
704 r1357, which had killed multiple invocations of an embedded
719 r1357, which had killed multiple invocations of an embedded
705 ipython (this means that example-embed has been broken for over 1
720 ipython (this means that example-embed has been broken for over 1
706 year!!!). Rather than possibly breaking the batch stuff for which
721 year!!!). Rather than possibly breaking the batch stuff for which
707 the code in iplib.py/interact was introduced, I worked around the
722 the code in iplib.py/interact was introduced, I worked around the
708 problem in the embedding class in Shell.py. We really need a
723 problem in the embedding class in Shell.py. We really need a
709 bloody test suite for this code, I'm sick of finding stuff that
724 bloody test suite for this code, I'm sick of finding stuff that
710 used to work breaking left and right every time I use an old
725 used to work breaking left and right every time I use an old
711 feature I hadn't touched in a few months.
726 feature I hadn't touched in a few months.
712 (kill_embedded): Add a new magic that only shows up in embedded
727 (kill_embedded): Add a new magic that only shows up in embedded
713 mode, to allow users to permanently deactivate an embedded instance.
728 mode, to allow users to permanently deactivate an embedded instance.
714
729
715 2007-08-01 Ville Vainio <vivainio@gmail.com>
730 2007-08-01 Ville Vainio <vivainio@gmail.com>
716
731
717 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
732 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
718 history gets out of sync on runlines (e.g. when running macros).
733 history gets out of sync on runlines (e.g. when running macros).
719
734
720 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
735 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
721
736
722 * IPython/Magic.py (magic_colors): fix win32-related error message
737 * IPython/Magic.py (magic_colors): fix win32-related error message
723 that could appear under *nix when readline was missing. Patch by
738 that could appear under *nix when readline was missing. Patch by
724 Scott Jackson, closes #175.
739 Scott Jackson, closes #175.
725
740
726 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
741 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
727
742
728 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
743 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
729 completer that it traits-aware, so that traits objects don't show
744 completer that it traits-aware, so that traits objects don't show
730 all of their internal attributes all the time.
745 all of their internal attributes all the time.
731
746
732 * IPython/genutils.py (dir2): moved this code from inside
747 * IPython/genutils.py (dir2): moved this code from inside
733 completer.py to expose it publicly, so I could use it in the
748 completer.py to expose it publicly, so I could use it in the
734 wildcards bugfix.
749 wildcards bugfix.
735
750
736 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
751 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
737 Stefan with Traits.
752 Stefan with Traits.
738
753
739 * IPython/completer.py (Completer.attr_matches): change internal
754 * IPython/completer.py (Completer.attr_matches): change internal
740 var name from 'object' to 'obj', since 'object' is now a builtin
755 var name from 'object' to 'obj', since 'object' is now a builtin
741 and this can lead to weird bugs if reusing this code elsewhere.
756 and this can lead to weird bugs if reusing this code elsewhere.
742
757
743 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
758 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
744
759
745 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
760 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
746 'foo?' and update the code to prevent printing of default
761 'foo?' and update the code to prevent printing of default
747 docstrings that started appearing after I added support for
762 docstrings that started appearing after I added support for
748 new-style classes. The approach I'm using isn't ideal (I just
763 new-style classes. The approach I'm using isn't ideal (I just
749 special-case those strings) but I'm not sure how to more robustly
764 special-case those strings) but I'm not sure how to more robustly
750 differentiate between truly user-written strings and Python's
765 differentiate between truly user-written strings and Python's
751 automatic ones.
766 automatic ones.
752
767
753 2007-07-09 Ville Vainio <vivainio@gmail.com>
768 2007-07-09 Ville Vainio <vivainio@gmail.com>
754
769
755 * completer.py: Applied Matthew Neeley's patch:
770 * completer.py: Applied Matthew Neeley's patch:
756 Dynamic attributes from trait_names and _getAttributeNames are added
771 Dynamic attributes from trait_names and _getAttributeNames are added
757 to the list of tab completions, but when this happens, the attribute
772 to the list of tab completions, but when this happens, the attribute
758 list is turned into a set, so the attributes are unordered when
773 list is turned into a set, so the attributes are unordered when
759 printed, which makes it hard to find the right completion. This patch
774 printed, which makes it hard to find the right completion. This patch
760 turns this set back into a list and sort it.
775 turns this set back into a list and sort it.
761
776
762 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
777 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
763
778
764 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
779 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
765 classes in various inspector functions.
780 classes in various inspector functions.
766
781
767 2007-06-28 Ville Vainio <vivainio@gmail.com>
782 2007-06-28 Ville Vainio <vivainio@gmail.com>
768
783
769 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
784 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
770 Implement "shadow" namespace, and callable aliases that reside there.
785 Implement "shadow" namespace, and callable aliases that reside there.
771 Use them by:
786 Use them by:
772
787
773 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
788 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
774
789
775 foo hello world
790 foo hello world
776 (gets translated to:)
791 (gets translated to:)
777 _sh.foo(r"""hello world""")
792 _sh.foo(r"""hello world""")
778
793
779 In practice, this kind of alias can take the role of a magic function
794 In practice, this kind of alias can take the role of a magic function
780
795
781 * New generic inspect_object, called on obj? and obj??
796 * New generic inspect_object, called on obj? and obj??
782
797
783 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
798 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
784
799
785 * IPython/ultraTB.py (findsource): fix a problem with
800 * IPython/ultraTB.py (findsource): fix a problem with
786 inspect.getfile that can cause crashes during traceback construction.
801 inspect.getfile that can cause crashes during traceback construction.
787
802
788 2007-06-14 Ville Vainio <vivainio@gmail.com>
803 2007-06-14 Ville Vainio <vivainio@gmail.com>
789
804
790 * iplib.py (handle_auto): Try to use ascii for printing "--->"
805 * iplib.py (handle_auto): Try to use ascii for printing "--->"
791 autocall rewrite indication, becausesometimes unicode fails to print
806 autocall rewrite indication, becausesometimes unicode fails to print
792 properly (and you get ' - - - '). Use plain uncoloured ---> for
807 properly (and you get ' - - - '). Use plain uncoloured ---> for
793 unicode.
808 unicode.
794
809
795 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
810 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
796
811
797 . pickleshare 'hash' commands (hget, hset, hcompress,
812 . pickleshare 'hash' commands (hget, hset, hcompress,
798 hdict) for efficient shadow history storage.
813 hdict) for efficient shadow history storage.
799
814
800 2007-06-13 Ville Vainio <vivainio@gmail.com>
815 2007-06-13 Ville Vainio <vivainio@gmail.com>
801
816
802 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
817 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
803 Added kw arg 'interactive', tell whether vars should be visible
818 Added kw arg 'interactive', tell whether vars should be visible
804 with %whos.
819 with %whos.
805
820
806 2007-06-11 Ville Vainio <vivainio@gmail.com>
821 2007-06-11 Ville Vainio <vivainio@gmail.com>
807
822
808 * pspersistence.py, Magic.py, iplib.py: directory history now saved
823 * pspersistence.py, Magic.py, iplib.py: directory history now saved
809 to db
824 to db
810
825
811 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
826 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
812 Also, it exits IPython immediately after evaluating the command (just like
827 Also, it exits IPython immediately after evaluating the command (just like
813 std python)
828 std python)
814
829
815 2007-06-05 Walter Doerwald <walter@livinglogic.de>
830 2007-06-05 Walter Doerwald <walter@livinglogic.de>
816
831
817 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
832 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
818 Python string and captures the output. (Idea and original patch by
833 Python string and captures the output. (Idea and original patch by
819 Stefan van der Walt)
834 Stefan van der Walt)
820
835
821 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
836 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
822
837
823 * IPython/ultraTB.py (VerboseTB.text): update printing of
838 * IPython/ultraTB.py (VerboseTB.text): update printing of
824 exception types for Python 2.5 (now all exceptions in the stdlib
839 exception types for Python 2.5 (now all exceptions in the stdlib
825 are new-style classes).
840 are new-style classes).
826
841
827 2007-05-31 Walter Doerwald <walter@livinglogic.de>
842 2007-05-31 Walter Doerwald <walter@livinglogic.de>
828
843
829 * IPython/Extensions/igrid.py: Add new commands refresh and
844 * IPython/Extensions/igrid.py: Add new commands refresh and
830 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
845 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
831 the iterator once (refresh) or after every x seconds (refresh_timer).
846 the iterator once (refresh) or after every x seconds (refresh_timer).
832 Add a working implementation of "searchexpression", where the text
847 Add a working implementation of "searchexpression", where the text
833 entered is not the text to search for, but an expression that must
848 entered is not the text to search for, but an expression that must
834 be true. Added display of shortcuts to the menu. Added commands "pickinput"
849 be true. Added display of shortcuts to the menu. Added commands "pickinput"
835 and "pickinputattr" that put the object or attribute under the cursor
850 and "pickinputattr" that put the object or attribute under the cursor
836 in the input line. Split the statusbar to be able to display the currently
851 in the input line. Split the statusbar to be able to display the currently
837 active refresh interval. (Patch by Nik Tautenhahn)
852 active refresh interval. (Patch by Nik Tautenhahn)
838
853
839 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
854 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
840
855
841 * fixing set_term_title to use ctypes as default
856 * fixing set_term_title to use ctypes as default
842
857
843 * fixing set_term_title fallback to work when curent dir
858 * fixing set_term_title fallback to work when curent dir
844 is on a windows network share
859 is on a windows network share
845
860
846 2007-05-28 Ville Vainio <vivainio@gmail.com>
861 2007-05-28 Ville Vainio <vivainio@gmail.com>
847
862
848 * %cpaste: strip + with > from left (diffs).
863 * %cpaste: strip + with > from left (diffs).
849
864
850 * iplib.py: Fix crash when readline not installed
865 * iplib.py: Fix crash when readline not installed
851
866
852 2007-05-26 Ville Vainio <vivainio@gmail.com>
867 2007-05-26 Ville Vainio <vivainio@gmail.com>
853
868
854 * generics.py: introduce easy to extend result_display generic
869 * generics.py: introduce easy to extend result_display generic
855 function (using simplegeneric.py).
870 function (using simplegeneric.py).
856
871
857 * Fixed the append functionality of %set.
872 * Fixed the append functionality of %set.
858
873
859 2007-05-25 Ville Vainio <vivainio@gmail.com>
874 2007-05-25 Ville Vainio <vivainio@gmail.com>
860
875
861 * New magic: %rep (fetch / run old commands from history)
876 * New magic: %rep (fetch / run old commands from history)
862
877
863 * New extension: mglob (%mglob magic), for powerful glob / find /filter
878 * New extension: mglob (%mglob magic), for powerful glob / find /filter
864 like functionality
879 like functionality
865
880
866 % maghistory.py: %hist -g PATTERM greps the history for pattern
881 % maghistory.py: %hist -g PATTERM greps the history for pattern
867
882
868 2007-05-24 Walter Doerwald <walter@livinglogic.de>
883 2007-05-24 Walter Doerwald <walter@livinglogic.de>
869
884
870 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
885 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
871 browse the IPython input history
886 browse the IPython input history
872
887
873 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
888 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
874 (mapped to "i") can be used to put the object under the curser in the input
889 (mapped to "i") can be used to put the object under the curser in the input
875 line. pickinputattr (mapped to "I") does the same for the attribute under
890 line. pickinputattr (mapped to "I") does the same for the attribute under
876 the cursor.
891 the cursor.
877
892
878 2007-05-24 Ville Vainio <vivainio@gmail.com>
893 2007-05-24 Ville Vainio <vivainio@gmail.com>
879
894
880 * Grand magic cleansing (changeset [2380]):
895 * Grand magic cleansing (changeset [2380]):
881
896
882 * Introduce ipy_legacy.py where the following magics were
897 * Introduce ipy_legacy.py where the following magics were
883 moved:
898 moved:
884
899
885 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
900 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
886
901
887 If you need them, either use default profile or "import ipy_legacy"
902 If you need them, either use default profile or "import ipy_legacy"
888 in your ipy_user_conf.py
903 in your ipy_user_conf.py
889
904
890 * Move sh and scipy profile to Extensions from UserConfig. this implies
905 * Move sh and scipy profile to Extensions from UserConfig. this implies
891 you should not edit them, but you don't need to run %upgrade when
906 you should not edit them, but you don't need to run %upgrade when
892 upgrading IPython anymore.
907 upgrading IPython anymore.
893
908
894 * %hist/%history now operates in "raw" mode by default. To get the old
909 * %hist/%history now operates in "raw" mode by default. To get the old
895 behaviour, run '%hist -n' (native mode).
910 behaviour, run '%hist -n' (native mode).
896
911
897 * split ipy_stock_completers.py to ipy_stock_completers.py and
912 * split ipy_stock_completers.py to ipy_stock_completers.py and
898 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
913 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
899 installed as default.
914 installed as default.
900
915
901 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
916 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
902 handling.
917 handling.
903
918
904 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
919 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
905 input if readline is available.
920 input if readline is available.
906
921
907 2007-05-23 Ville Vainio <vivainio@gmail.com>
922 2007-05-23 Ville Vainio <vivainio@gmail.com>
908
923
909 * macro.py: %store uses __getstate__ properly
924 * macro.py: %store uses __getstate__ properly
910
925
911 * exesetup.py: added new setup script for creating
926 * exesetup.py: added new setup script for creating
912 standalone IPython executables with py2exe (i.e.
927 standalone IPython executables with py2exe (i.e.
913 no python installation required).
928 no python installation required).
914
929
915 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
930 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
916 its place.
931 its place.
917
932
918 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
933 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
919
934
920 2007-05-21 Ville Vainio <vivainio@gmail.com>
935 2007-05-21 Ville Vainio <vivainio@gmail.com>
921
936
922 * platutil_win32.py (set_term_title): handle
937 * platutil_win32.py (set_term_title): handle
923 failure of 'title' system call properly.
938 failure of 'title' system call properly.
924
939
925 2007-05-17 Walter Doerwald <walter@livinglogic.de>
940 2007-05-17 Walter Doerwald <walter@livinglogic.de>
926
941
927 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
942 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
928 (Bug detected by Paul Mueller).
943 (Bug detected by Paul Mueller).
929
944
930 2007-05-16 Ville Vainio <vivainio@gmail.com>
945 2007-05-16 Ville Vainio <vivainio@gmail.com>
931
946
932 * ipy_profile_sci.py, ipython_win_post_install.py: Create
947 * ipy_profile_sci.py, ipython_win_post_install.py: Create
933 new "sci" profile, effectively a modern version of the old
948 new "sci" profile, effectively a modern version of the old
934 "scipy" profile (which is now slated for deprecation).
949 "scipy" profile (which is now slated for deprecation).
935
950
936 2007-05-15 Ville Vainio <vivainio@gmail.com>
951 2007-05-15 Ville Vainio <vivainio@gmail.com>
937
952
938 * pycolorize.py, pycolor.1: Paul Mueller's patches that
953 * pycolorize.py, pycolor.1: Paul Mueller's patches that
939 make pycolorize read input from stdin when run without arguments.
954 make pycolorize read input from stdin when run without arguments.
940
955
941 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
956 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
942
957
943 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
958 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
944 it in sh profile (instead of ipy_system_conf.py).
959 it in sh profile (instead of ipy_system_conf.py).
945
960
946 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
961 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
947 aliases are now lower case on windows (MyCommand.exe => mycommand).
962 aliases are now lower case on windows (MyCommand.exe => mycommand).
948
963
949 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
964 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
950 Macros are now callable objects that inherit from ipapi.IPyAutocall,
965 Macros are now callable objects that inherit from ipapi.IPyAutocall,
951 i.e. get autocalled regardless of system autocall setting.
966 i.e. get autocalled regardless of system autocall setting.
952
967
953 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
968 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
954
969
955 * IPython/rlineimpl.py: check for clear_history in readline and
970 * IPython/rlineimpl.py: check for clear_history in readline and
956 make it a dummy no-op if not available. This function isn't
971 make it a dummy no-op if not available. This function isn't
957 guaranteed to be in the API and appeared in Python 2.4, so we need
972 guaranteed to be in the API and appeared in Python 2.4, so we need
958 to check it ourselves. Also, clean up this file quite a bit.
973 to check it ourselves. Also, clean up this file quite a bit.
959
974
960 * ipython.1: update man page and full manual with information
975 * ipython.1: update man page and full manual with information
961 about threads (remove outdated warning). Closes #151.
976 about threads (remove outdated warning). Closes #151.
962
977
963 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
978 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
964
979
965 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
980 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
966 in trunk (note that this made it into the 0.8.1 release already,
981 in trunk (note that this made it into the 0.8.1 release already,
967 but the changelogs didn't get coordinated). Many thanks to Gael
982 but the changelogs didn't get coordinated). Many thanks to Gael
968 Varoquaux <gael.varoquaux-AT-normalesup.org>
983 Varoquaux <gael.varoquaux-AT-normalesup.org>
969
984
970 2007-05-09 *** Released version 0.8.1
985 2007-05-09 *** Released version 0.8.1
971
986
972 2007-05-10 Walter Doerwald <walter@livinglogic.de>
987 2007-05-10 Walter Doerwald <walter@livinglogic.de>
973
988
974 * IPython/Extensions/igrid.py: Incorporate html help into
989 * IPython/Extensions/igrid.py: Incorporate html help into
975 the module, so we don't have to search for the file.
990 the module, so we don't have to search for the file.
976
991
977 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
992 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
978
993
979 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
994 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
980
995
981 2007-04-30 Ville Vainio <vivainio@gmail.com>
996 2007-04-30 Ville Vainio <vivainio@gmail.com>
982
997
983 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
998 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
984 user has illegal (non-ascii) home directory name
999 user has illegal (non-ascii) home directory name
985
1000
986 2007-04-27 Ville Vainio <vivainio@gmail.com>
1001 2007-04-27 Ville Vainio <vivainio@gmail.com>
987
1002
988 * platutils_win32.py: implement set_term_title for windows
1003 * platutils_win32.py: implement set_term_title for windows
989
1004
990 * Update version number
1005 * Update version number
991
1006
992 * ipy_profile_sh.py: more informative prompt (2 dir levels)
1007 * ipy_profile_sh.py: more informative prompt (2 dir levels)
993
1008
994 2007-04-26 Walter Doerwald <walter@livinglogic.de>
1009 2007-04-26 Walter Doerwald <walter@livinglogic.de>
995
1010
996 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
1011 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
997 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
1012 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
998 bug discovered by Ville).
1013 bug discovered by Ville).
999
1014
1000 2007-04-26 Ville Vainio <vivainio@gmail.com>
1015 2007-04-26 Ville Vainio <vivainio@gmail.com>
1001
1016
1002 * Extensions/ipy_completers.py: Olivier's module completer now
1017 * Extensions/ipy_completers.py: Olivier's module completer now
1003 saves the list of root modules if it takes > 4 secs on the first run.
1018 saves the list of root modules if it takes > 4 secs on the first run.
1004
1019
1005 * Magic.py (%rehashx): %rehashx now clears the completer cache
1020 * Magic.py (%rehashx): %rehashx now clears the completer cache
1006
1021
1007
1022
1008 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
1023 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
1009
1024
1010 * ipython.el: fix incorrect color scheme, reported by Stefan.
1025 * ipython.el: fix incorrect color scheme, reported by Stefan.
1011 Closes #149.
1026 Closes #149.
1012
1027
1013 * IPython/PyColorize.py (Parser.format2): fix state-handling
1028 * IPython/PyColorize.py (Parser.format2): fix state-handling
1014 logic. I still don't like how that code handles state, but at
1029 logic. I still don't like how that code handles state, but at
1015 least now it should be correct, if inelegant. Closes #146.
1030 least now it should be correct, if inelegant. Closes #146.
1016
1031
1017 2007-04-25 Ville Vainio <vivainio@gmail.com>
1032 2007-04-25 Ville Vainio <vivainio@gmail.com>
1018
1033
1019 * Extensions/ipy_which.py: added extension for %which magic, works
1034 * Extensions/ipy_which.py: added extension for %which magic, works
1020 a lot like unix 'which' but also finds and expands aliases, and
1035 a lot like unix 'which' but also finds and expands aliases, and
1021 allows wildcards.
1036 allows wildcards.
1022
1037
1023 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
1038 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
1024 as opposed to returning nothing.
1039 as opposed to returning nothing.
1025
1040
1026 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
1041 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
1027 ipy_stock_completers on default profile, do import on sh profile.
1042 ipy_stock_completers on default profile, do import on sh profile.
1028
1043
1029 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1044 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1030
1045
1031 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
1046 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
1032 like ipython.py foo.py which raised a IndexError.
1047 like ipython.py foo.py which raised a IndexError.
1033
1048
1034 2007-04-21 Ville Vainio <vivainio@gmail.com>
1049 2007-04-21 Ville Vainio <vivainio@gmail.com>
1035
1050
1036 * Extensions/ipy_extutil.py: added extension to manage other ipython
1051 * Extensions/ipy_extutil.py: added extension to manage other ipython
1037 extensions. Now only supports 'ls' == list extensions.
1052 extensions. Now only supports 'ls' == list extensions.
1038
1053
1039 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
1054 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
1040
1055
1041 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
1056 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
1042 would prevent use of the exception system outside of a running
1057 would prevent use of the exception system outside of a running
1043 IPython instance.
1058 IPython instance.
1044
1059
1045 2007-04-20 Ville Vainio <vivainio@gmail.com>
1060 2007-04-20 Ville Vainio <vivainio@gmail.com>
1046
1061
1047 * Extensions/ipy_render.py: added extension for easy
1062 * Extensions/ipy_render.py: added extension for easy
1048 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
1063 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
1049 'Iptl' template notation,
1064 'Iptl' template notation,
1050
1065
1051 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
1066 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
1052 safer & faster 'import' completer.
1067 safer & faster 'import' completer.
1053
1068
1054 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
1069 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
1055 and _ip.defalias(name, command).
1070 and _ip.defalias(name, command).
1056
1071
1057 * Extensions/ipy_exportdb.py: New extension for exporting all the
1072 * Extensions/ipy_exportdb.py: New extension for exporting all the
1058 %store'd data in a portable format (normal ipapi calls like
1073 %store'd data in a portable format (normal ipapi calls like
1059 defmacro() etc.)
1074 defmacro() etc.)
1060
1075
1061 2007-04-19 Ville Vainio <vivainio@gmail.com>
1076 2007-04-19 Ville Vainio <vivainio@gmail.com>
1062
1077
1063 * upgrade_dir.py: skip junk files like *.pyc
1078 * upgrade_dir.py: skip junk files like *.pyc
1064
1079
1065 * Release.py: version number to 0.8.1
1080 * Release.py: version number to 0.8.1
1066
1081
1067 2007-04-18 Ville Vainio <vivainio@gmail.com>
1082 2007-04-18 Ville Vainio <vivainio@gmail.com>
1068
1083
1069 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
1084 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
1070 and later on win32.
1085 and later on win32.
1071
1086
1072 2007-04-16 Ville Vainio <vivainio@gmail.com>
1087 2007-04-16 Ville Vainio <vivainio@gmail.com>
1073
1088
1074 * iplib.py (showtraceback): Do not crash when running w/o readline.
1089 * iplib.py (showtraceback): Do not crash when running w/o readline.
1075
1090
1076 2007-04-12 Walter Doerwald <walter@livinglogic.de>
1091 2007-04-12 Walter Doerwald <walter@livinglogic.de>
1077
1092
1078 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
1093 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
1079 sorted (case sensitive with files and dirs mixed).
1094 sorted (case sensitive with files and dirs mixed).
1080
1095
1081 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
1096 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
1082
1097
1083 * IPython/Release.py (version): Open trunk for 0.8.1 development.
1098 * IPython/Release.py (version): Open trunk for 0.8.1 development.
1084
1099
1085 2007-04-10 *** Released version 0.8.0
1100 2007-04-10 *** Released version 0.8.0
1086
1101
1087 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
1102 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
1088
1103
1089 * Tag 0.8.0 for release.
1104 * Tag 0.8.0 for release.
1090
1105
1091 * IPython/iplib.py (reloadhist): add API function to cleanly
1106 * IPython/iplib.py (reloadhist): add API function to cleanly
1092 reload the readline history, which was growing inappropriately on
1107 reload the readline history, which was growing inappropriately on
1093 every %run call.
1108 every %run call.
1094
1109
1095 * win32_manual_post_install.py (run): apply last part of Nicolas
1110 * win32_manual_post_install.py (run): apply last part of Nicolas
1096 Pernetty's patch (I'd accidentally applied it in a different
1111 Pernetty's patch (I'd accidentally applied it in a different
1097 directory and this particular file didn't get patched).
1112 directory and this particular file didn't get patched).
1098
1113
1099 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
1114 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
1100
1115
1101 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
1116 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
1102 find the main thread id and use the proper API call. Thanks to
1117 find the main thread id and use the proper API call. Thanks to
1103 Stefan for the fix.
1118 Stefan for the fix.
1104
1119
1105 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
1120 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
1106 unit tests to reflect fixed ticket #52, and add more tests sent by
1121 unit tests to reflect fixed ticket #52, and add more tests sent by
1107 him.
1122 him.
1108
1123
1109 * IPython/iplib.py (raw_input): restore the readline completer
1124 * IPython/iplib.py (raw_input): restore the readline completer
1110 state on every input, in case third-party code messed it up.
1125 state on every input, in case third-party code messed it up.
1111 (_prefilter): revert recent addition of early-escape checks which
1126 (_prefilter): revert recent addition of early-escape checks which
1112 prevent many valid alias calls from working.
1127 prevent many valid alias calls from working.
1113
1128
1114 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
1129 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
1115 flag for sigint handler so we don't run a full signal() call on
1130 flag for sigint handler so we don't run a full signal() call on
1116 each runcode access.
1131 each runcode access.
1117
1132
1118 * IPython/Magic.py (magic_whos): small improvement to diagnostic
1133 * IPython/Magic.py (magic_whos): small improvement to diagnostic
1119 message.
1134 message.
1120
1135
1121 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
1136 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
1122
1137
1123 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
1138 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
1124 asynchronous exceptions working, i.e., Ctrl-C can actually
1139 asynchronous exceptions working, i.e., Ctrl-C can actually
1125 interrupt long-running code in the multithreaded shells.
1140 interrupt long-running code in the multithreaded shells.
1126
1141
1127 This is using Tomer Filiba's great ctypes-based trick:
1142 This is using Tomer Filiba's great ctypes-based trick:
1128 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
1143 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
1129 this in the past, but hadn't been able to make it work before. So
1144 this in the past, but hadn't been able to make it work before. So
1130 far it looks like it's actually running, but this needs more
1145 far it looks like it's actually running, but this needs more
1131 testing. If it really works, I'll be *very* happy, and we'll owe
1146 testing. If it really works, I'll be *very* happy, and we'll owe
1132 a huge thank you to Tomer. My current implementation is ugly,
1147 a huge thank you to Tomer. My current implementation is ugly,
1133 hackish and uses nasty globals, but I don't want to try and clean
1148 hackish and uses nasty globals, but I don't want to try and clean
1134 anything up until we know if it actually works.
1149 anything up until we know if it actually works.
1135
1150
1136 NOTE: this feature needs ctypes to work. ctypes is included in
1151 NOTE: this feature needs ctypes to work. ctypes is included in
1137 Python2.5, but 2.4 users will need to manually install it. This
1152 Python2.5, but 2.4 users will need to manually install it. This
1138 feature makes multi-threaded shells so much more usable that it's
1153 feature makes multi-threaded shells so much more usable that it's
1139 a minor price to pay (ctypes is very easy to install, already a
1154 a minor price to pay (ctypes is very easy to install, already a
1140 requirement for win32 and available in major linux distros).
1155 requirement for win32 and available in major linux distros).
1141
1156
1142 2007-04-04 Ville Vainio <vivainio@gmail.com>
1157 2007-04-04 Ville Vainio <vivainio@gmail.com>
1143
1158
1144 * Extensions/ipy_completers.py, ipy_stock_completers.py:
1159 * Extensions/ipy_completers.py, ipy_stock_completers.py:
1145 Moved implementations of 'bundled' completers to ipy_completers.py,
1160 Moved implementations of 'bundled' completers to ipy_completers.py,
1146 they are only enabled in ipy_stock_completers.py.
1161 they are only enabled in ipy_stock_completers.py.
1147
1162
1148 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
1163 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
1149
1164
1150 * IPython/PyColorize.py (Parser.format2): Fix identation of
1165 * IPython/PyColorize.py (Parser.format2): Fix identation of
1151 colorzied output and return early if color scheme is NoColor, to
1166 colorzied output and return early if color scheme is NoColor, to
1152 avoid unnecessary and expensive tokenization. Closes #131.
1167 avoid unnecessary and expensive tokenization. Closes #131.
1153
1168
1154 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
1169 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
1155
1170
1156 * IPython/Debugger.py: disable the use of pydb version 1.17. It
1171 * IPython/Debugger.py: disable the use of pydb version 1.17. It
1157 has a critical bug (a missing import that makes post-mortem not
1172 has a critical bug (a missing import that makes post-mortem not
1158 work at all). Unfortunately as of this time, this is the version
1173 work at all). Unfortunately as of this time, this is the version
1159 shipped with Ubuntu Edgy, so quite a few people have this one. I
1174 shipped with Ubuntu Edgy, so quite a few people have this one. I
1160 hope Edgy will update to a more recent package.
1175 hope Edgy will update to a more recent package.
1161
1176
1162 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
1177 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
1163
1178
1164 * IPython/iplib.py (_prefilter): close #52, second part of a patch
1179 * IPython/iplib.py (_prefilter): close #52, second part of a patch
1165 set by Stefan (only the first part had been applied before).
1180 set by Stefan (only the first part had been applied before).
1166
1181
1167 * IPython/Extensions/ipy_stock_completers.py (module_completer):
1182 * IPython/Extensions/ipy_stock_completers.py (module_completer):
1168 remove usage of the dangerous pkgutil.walk_packages(). See
1183 remove usage of the dangerous pkgutil.walk_packages(). See
1169 details in comments left in the code.
1184 details in comments left in the code.
1170
1185
1171 * IPython/Magic.py (magic_whos): add support for numpy arrays
1186 * IPython/Magic.py (magic_whos): add support for numpy arrays
1172 similar to what we had for Numeric.
1187 similar to what we had for Numeric.
1173
1188
1174 * IPython/completer.py (IPCompleter.complete): extend the
1189 * IPython/completer.py (IPCompleter.complete): extend the
1175 complete() call API to support completions by other mechanisms
1190 complete() call API to support completions by other mechanisms
1176 than readline. Closes #109.
1191 than readline. Closes #109.
1177
1192
1178 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
1193 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
1179 protect against a bug in Python's execfile(). Closes #123.
1194 protect against a bug in Python's execfile(). Closes #123.
1180
1195
1181 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
1196 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
1182
1197
1183 * IPython/iplib.py (split_user_input): ensure that when splitting
1198 * IPython/iplib.py (split_user_input): ensure that when splitting
1184 user input, the part that can be treated as a python name is pure
1199 user input, the part that can be treated as a python name is pure
1185 ascii (Python identifiers MUST be pure ascii). Part of the
1200 ascii (Python identifiers MUST be pure ascii). Part of the
1186 ongoing Unicode support work.
1201 ongoing Unicode support work.
1187
1202
1188 * IPython/Prompts.py (prompt_specials_color): Add \N for the
1203 * IPython/Prompts.py (prompt_specials_color): Add \N for the
1189 actual prompt number, without any coloring. This allows users to
1204 actual prompt number, without any coloring. This allows users to
1190 produce numbered prompts with their own colors. Added after a
1205 produce numbered prompts with their own colors. Added after a
1191 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
1206 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
1192
1207
1193 2007-03-31 Walter Doerwald <walter@livinglogic.de>
1208 2007-03-31 Walter Doerwald <walter@livinglogic.de>
1194
1209
1195 * IPython/Extensions/igrid.py: Map the return key
1210 * IPython/Extensions/igrid.py: Map the return key
1196 to enter() and shift-return to enterattr().
1211 to enter() and shift-return to enterattr().
1197
1212
1198 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
1213 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
1199
1214
1200 * IPython/Magic.py (magic_psearch): add unicode support by
1215 * IPython/Magic.py (magic_psearch): add unicode support by
1201 encoding to ascii the input, since this routine also only deals
1216 encoding to ascii the input, since this routine also only deals
1202 with valid Python names. Fixes a bug reported by Stefan.
1217 with valid Python names. Fixes a bug reported by Stefan.
1203
1218
1204 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
1219 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
1205
1220
1206 * IPython/Magic.py (_inspect): convert unicode input into ascii
1221 * IPython/Magic.py (_inspect): convert unicode input into ascii
1207 before trying to evaluate it as a Python identifier. This fixes a
1222 before trying to evaluate it as a Python identifier. This fixes a
1208 problem that the new unicode support had introduced when analyzing
1223 problem that the new unicode support had introduced when analyzing
1209 long definition lines for functions.
1224 long definition lines for functions.
1210
1225
1211 2007-03-24 Walter Doerwald <walter@livinglogic.de>
1226 2007-03-24 Walter Doerwald <walter@livinglogic.de>
1212
1227
1213 * IPython/Extensions/igrid.py: Fix picking. Using
1228 * IPython/Extensions/igrid.py: Fix picking. Using
1214 igrid with wxPython 2.6 and -wthread should work now.
1229 igrid with wxPython 2.6 and -wthread should work now.
1215 igrid.display() simply tries to create a frame without
1230 igrid.display() simply tries to create a frame without
1216 an application. Only if this fails an application is created.
1231 an application. Only if this fails an application is created.
1217
1232
1218 2007-03-23 Walter Doerwald <walter@livinglogic.de>
1233 2007-03-23 Walter Doerwald <walter@livinglogic.de>
1219
1234
1220 * IPython/Extensions/path.py: Updated to version 2.2.
1235 * IPython/Extensions/path.py: Updated to version 2.2.
1221
1236
1222 2007-03-23 Ville Vainio <vivainio@gmail.com>
1237 2007-03-23 Ville Vainio <vivainio@gmail.com>
1223
1238
1224 * iplib.py: recursive alias expansion now works better, so that
1239 * iplib.py: recursive alias expansion now works better, so that
1225 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
1240 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
1226 doesn't trip up the process, if 'd' has been aliased to 'ls'.
1241 doesn't trip up the process, if 'd' has been aliased to 'ls'.
1227
1242
1228 * Extensions/ipy_gnuglobal.py added, provides %global magic
1243 * Extensions/ipy_gnuglobal.py added, provides %global magic
1229 for users of http://www.gnu.org/software/global
1244 for users of http://www.gnu.org/software/global
1230
1245
1231 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
1246 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
1232 Closes #52. Patch by Stefan van der Walt.
1247 Closes #52. Patch by Stefan van der Walt.
1233
1248
1234 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
1249 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
1235
1250
1236 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
1251 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
1237 respect the __file__ attribute when using %run. Thanks to a bug
1252 respect the __file__ attribute when using %run. Thanks to a bug
1238 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
1253 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
1239
1254
1240 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
1255 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
1241
1256
1242 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
1257 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
1243 input. Patch sent by Stefan.
1258 input. Patch sent by Stefan.
1244
1259
1245 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1260 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1246 * IPython/Extensions/ipy_stock_completer.py
1261 * IPython/Extensions/ipy_stock_completer.py
1247 shlex_split, fix bug in shlex_split. len function
1262 shlex_split, fix bug in shlex_split. len function
1248 call was missing an if statement. Caused shlex_split to
1263 call was missing an if statement. Caused shlex_split to
1249 sometimes return "" as last element.
1264 sometimes return "" as last element.
1250
1265
1251 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
1266 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
1252
1267
1253 * IPython/completer.py
1268 * IPython/completer.py
1254 (IPCompleter.file_matches.single_dir_expand): fix a problem
1269 (IPCompleter.file_matches.single_dir_expand): fix a problem
1255 reported by Stefan, where directories containign a single subdir
1270 reported by Stefan, where directories containign a single subdir
1256 would be completed too early.
1271 would be completed too early.
1257
1272
1258 * IPython/Shell.py (_load_pylab): Make the execution of 'from
1273 * IPython/Shell.py (_load_pylab): Make the execution of 'from
1259 pylab import *' when -pylab is given be optional. A new flag,
1274 pylab import *' when -pylab is given be optional. A new flag,
1260 pylab_import_all controls this behavior, the default is True for
1275 pylab_import_all controls this behavior, the default is True for
1261 backwards compatibility.
1276 backwards compatibility.
1262
1277
1263 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
1278 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
1264 modified) R. Bernstein's patch for fully syntax highlighted
1279 modified) R. Bernstein's patch for fully syntax highlighted
1265 tracebacks. The functionality is also available under ultraTB for
1280 tracebacks. The functionality is also available under ultraTB for
1266 non-ipython users (someone using ultraTB but outside an ipython
1281 non-ipython users (someone using ultraTB but outside an ipython
1267 session). They can select the color scheme by setting the
1282 session). They can select the color scheme by setting the
1268 module-level global DEFAULT_SCHEME. The highlight functionality
1283 module-level global DEFAULT_SCHEME. The highlight functionality
1269 also works when debugging.
1284 also works when debugging.
1270
1285
1271 * IPython/genutils.py (IOStream.close): small patch by
1286 * IPython/genutils.py (IOStream.close): small patch by
1272 R. Bernstein for improved pydb support.
1287 R. Bernstein for improved pydb support.
1273
1288
1274 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
1289 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
1275 DaveS <davls@telus.net> to improve support of debugging under
1290 DaveS <davls@telus.net> to improve support of debugging under
1276 NTEmacs, including improved pydb behavior.
1291 NTEmacs, including improved pydb behavior.
1277
1292
1278 * IPython/Magic.py (magic_prun): Fix saving of profile info for
1293 * IPython/Magic.py (magic_prun): Fix saving of profile info for
1279 Python 2.5, where the stats object API changed a little. Thanks
1294 Python 2.5, where the stats object API changed a little. Thanks
1280 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
1295 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
1281
1296
1282 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
1297 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
1283 Pernetty's patch to improve support for (X)Emacs under Win32.
1298 Pernetty's patch to improve support for (X)Emacs under Win32.
1284
1299
1285 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
1300 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
1286
1301
1287 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
1302 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
1288 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
1303 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
1289 a report by Nik Tautenhahn.
1304 a report by Nik Tautenhahn.
1290
1305
1291 2007-03-16 Walter Doerwald <walter@livinglogic.de>
1306 2007-03-16 Walter Doerwald <walter@livinglogic.de>
1292
1307
1293 * setup.py: Add the igrid help files to the list of data files
1308 * setup.py: Add the igrid help files to the list of data files
1294 to be installed alongside igrid.
1309 to be installed alongside igrid.
1295 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
1310 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
1296 Show the input object of the igrid browser as the window tile.
1311 Show the input object of the igrid browser as the window tile.
1297 Show the object the cursor is on in the statusbar.
1312 Show the object the cursor is on in the statusbar.
1298
1313
1299 2007-03-15 Ville Vainio <vivainio@gmail.com>
1314 2007-03-15 Ville Vainio <vivainio@gmail.com>
1300
1315
1301 * Extensions/ipy_stock_completers.py: Fixed exception
1316 * Extensions/ipy_stock_completers.py: Fixed exception
1302 on mismatching quotes in %run completer. Patch by
1317 on mismatching quotes in %run completer. Patch by
1303 Jorgen Stenarson. Closes #127.
1318 Jorgen Stenarson. Closes #127.
1304
1319
1305 2007-03-14 Ville Vainio <vivainio@gmail.com>
1320 2007-03-14 Ville Vainio <vivainio@gmail.com>
1306
1321
1307 * Extensions/ext_rehashdir.py: Do not do auto_alias
1322 * Extensions/ext_rehashdir.py: Do not do auto_alias
1308 in %rehashdir, it clobbers %store'd aliases.
1323 in %rehashdir, it clobbers %store'd aliases.
1309
1324
1310 * UserConfig/ipy_profile_sh.py: envpersist.py extension
1325 * UserConfig/ipy_profile_sh.py: envpersist.py extension
1311 (beefed up %env) imported for sh profile.
1326 (beefed up %env) imported for sh profile.
1312
1327
1313 2007-03-10 Walter Doerwald <walter@livinglogic.de>
1328 2007-03-10 Walter Doerwald <walter@livinglogic.de>
1314
1329
1315 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
1330 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
1316 as the default browser.
1331 as the default browser.
1317 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
1332 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
1318 As igrid displays all attributes it ever encounters, fetch() (which has
1333 As igrid displays all attributes it ever encounters, fetch() (which has
1319 been renamed to _fetch()) doesn't have to recalculate the display attributes
1334 been renamed to _fetch()) doesn't have to recalculate the display attributes
1320 every time a new item is fetched. This should speed up scrolling.
1335 every time a new item is fetched. This should speed up scrolling.
1321
1336
1322 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
1337 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
1323
1338
1324 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
1339 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
1325 Schmolck's recently reported tab-completion bug (my previous one
1340 Schmolck's recently reported tab-completion bug (my previous one
1326 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
1341 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
1327
1342
1328 2007-03-09 Walter Doerwald <walter@livinglogic.de>
1343 2007-03-09 Walter Doerwald <walter@livinglogic.de>
1329
1344
1330 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
1345 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
1331 Close help window if exiting igrid.
1346 Close help window if exiting igrid.
1332
1347
1333 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1348 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1334
1349
1335 * IPython/Extensions/ipy_defaults.py: Check if readline is available
1350 * IPython/Extensions/ipy_defaults.py: Check if readline is available
1336 before calling functions from readline.
1351 before calling functions from readline.
1337
1352
1338 2007-03-02 Walter Doerwald <walter@livinglogic.de>
1353 2007-03-02 Walter Doerwald <walter@livinglogic.de>
1339
1354
1340 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
1355 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
1341 igrid is a wxPython-based display object for ipipe. If your system has
1356 igrid is a wxPython-based display object for ipipe. If your system has
1342 wx installed igrid will be the default display. Without wx ipipe falls
1357 wx installed igrid will be the default display. Without wx ipipe falls
1343 back to ibrowse (which needs curses). If no curses is installed ipipe
1358 back to ibrowse (which needs curses). If no curses is installed ipipe
1344 falls back to idump.
1359 falls back to idump.
1345
1360
1346 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
1361 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
1347
1362
1348 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
1363 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
1349 my changes from yesterday, they introduced bugs. Will reactivate
1364 my changes from yesterday, they introduced bugs. Will reactivate
1350 once I get a correct solution, which will be much easier thanks to
1365 once I get a correct solution, which will be much easier thanks to
1351 Dan Milstein's new prefilter test suite.
1366 Dan Milstein's new prefilter test suite.
1352
1367
1353 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
1368 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
1354
1369
1355 * IPython/iplib.py (split_user_input): fix input splitting so we
1370 * IPython/iplib.py (split_user_input): fix input splitting so we
1356 don't attempt attribute accesses on things that can't possibly be
1371 don't attempt attribute accesses on things that can't possibly be
1357 valid Python attributes. After a bug report by Alex Schmolck.
1372 valid Python attributes. After a bug report by Alex Schmolck.
1358 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
1373 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
1359 %magic with explicit % prefix.
1374 %magic with explicit % prefix.
1360
1375
1361 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
1376 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
1362
1377
1363 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
1378 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
1364 avoid a DeprecationWarning from GTK.
1379 avoid a DeprecationWarning from GTK.
1365
1380
1366 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
1381 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
1367
1382
1368 * IPython/genutils.py (clock): I modified clock() to return total
1383 * IPython/genutils.py (clock): I modified clock() to return total
1369 time, user+system. This is a more commonly needed metric. I also
1384 time, user+system. This is a more commonly needed metric. I also
1370 introduced the new clocku/clocks to get only user/system time if
1385 introduced the new clocku/clocks to get only user/system time if
1371 one wants those instead.
1386 one wants those instead.
1372
1387
1373 ***WARNING: API CHANGE*** clock() used to return only user time,
1388 ***WARNING: API CHANGE*** clock() used to return only user time,
1374 so if you want exactly the same results as before, use clocku
1389 so if you want exactly the same results as before, use clocku
1375 instead.
1390 instead.
1376
1391
1377 2007-02-22 Ville Vainio <vivainio@gmail.com>
1392 2007-02-22 Ville Vainio <vivainio@gmail.com>
1378
1393
1379 * IPython/Extensions/ipy_p4.py: Extension for improved
1394 * IPython/Extensions/ipy_p4.py: Extension for improved
1380 p4 (perforce version control system) experience.
1395 p4 (perforce version control system) experience.
1381 Adds %p4 magic with p4 command completion and
1396 Adds %p4 magic with p4 command completion and
1382 automatic -G argument (marshall output as python dict)
1397 automatic -G argument (marshall output as python dict)
1383
1398
1384 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
1399 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
1385
1400
1386 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
1401 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
1387 stop marks.
1402 stop marks.
1388 (ClearingMixin): a simple mixin to easily make a Demo class clear
1403 (ClearingMixin): a simple mixin to easily make a Demo class clear
1389 the screen in between blocks and have empty marquees. The
1404 the screen in between blocks and have empty marquees. The
1390 ClearDemo and ClearIPDemo classes that use it are included.
1405 ClearDemo and ClearIPDemo classes that use it are included.
1391
1406
1392 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
1407 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
1393
1408
1394 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
1409 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
1395 protect against exceptions at Python shutdown time. Patch
1410 protect against exceptions at Python shutdown time. Patch
1396 sumbmitted to upstream.
1411 sumbmitted to upstream.
1397
1412
1398 2007-02-14 Walter Doerwald <walter@livinglogic.de>
1413 2007-02-14 Walter Doerwald <walter@livinglogic.de>
1399
1414
1400 * IPython/Extensions/ibrowse.py: If entering the first object level
1415 * IPython/Extensions/ibrowse.py: If entering the first object level
1401 (i.e. the object for which the browser has been started) fails,
1416 (i.e. the object for which the browser has been started) fails,
1402 now the error is raised directly (aborting the browser) instead of
1417 now the error is raised directly (aborting the browser) instead of
1403 running into an empty levels list later.
1418 running into an empty levels list later.
1404
1419
1405 2007-02-03 Walter Doerwald <walter@livinglogic.de>
1420 2007-02-03 Walter Doerwald <walter@livinglogic.de>
1406
1421
1407 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1422 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1408 for the noitem object.
1423 for the noitem object.
1409
1424
1410 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1425 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1411
1426
1412 * IPython/completer.py (Completer.attr_matches): Fix small
1427 * IPython/completer.py (Completer.attr_matches): Fix small
1413 tab-completion bug with Enthought Traits objects with units.
1428 tab-completion bug with Enthought Traits objects with units.
1414 Thanks to a bug report by Tom Denniston
1429 Thanks to a bug report by Tom Denniston
1415 <tom.denniston-AT-alum.dartmouth.org>.
1430 <tom.denniston-AT-alum.dartmouth.org>.
1416
1431
1417 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1432 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1418
1433
1419 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1434 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1420 bug where only .ipy or .py would be completed. Once the first
1435 bug where only .ipy or .py would be completed. Once the first
1421 argument to %run has been given, all completions are valid because
1436 argument to %run has been given, all completions are valid because
1422 they are the arguments to the script, which may well be non-python
1437 they are the arguments to the script, which may well be non-python
1423 filenames.
1438 filenames.
1424
1439
1425 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1440 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1426 to irunner to allow it to correctly support real doctesting of
1441 to irunner to allow it to correctly support real doctesting of
1427 out-of-process ipython code.
1442 out-of-process ipython code.
1428
1443
1429 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1444 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1430 title an option (-noterm_title) because it completely breaks
1445 title an option (-noterm_title) because it completely breaks
1431 doctesting.
1446 doctesting.
1432
1447
1433 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1448 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1434
1449
1435 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1450 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1436
1451
1437 * IPython/irunner.py (main): fix small bug where extensions were
1452 * IPython/irunner.py (main): fix small bug where extensions were
1438 not being correctly recognized.
1453 not being correctly recognized.
1439
1454
1440 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1455 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1441
1456
1442 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1457 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1443 a string containing a single line yields the string itself as the
1458 a string containing a single line yields the string itself as the
1444 only item.
1459 only item.
1445
1460
1446 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1461 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1447 object if it's the same as the one on the last level (This avoids
1462 object if it's the same as the one on the last level (This avoids
1448 infinite recursion for one line strings).
1463 infinite recursion for one line strings).
1449
1464
1450 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1465 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1451
1466
1452 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1467 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1453 all output streams before printing tracebacks. This ensures that
1468 all output streams before printing tracebacks. This ensures that
1454 user output doesn't end up interleaved with traceback output.
1469 user output doesn't end up interleaved with traceback output.
1455
1470
1456 2007-01-10 Ville Vainio <vivainio@gmail.com>
1471 2007-01-10 Ville Vainio <vivainio@gmail.com>
1457
1472
1458 * Extensions/envpersist.py: Turbocharged %env that remembers
1473 * Extensions/envpersist.py: Turbocharged %env that remembers
1459 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1474 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1460 "%env VISUAL=jed".
1475 "%env VISUAL=jed".
1461
1476
1462 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1477 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1463
1478
1464 * IPython/iplib.py (showtraceback): ensure that we correctly call
1479 * IPython/iplib.py (showtraceback): ensure that we correctly call
1465 custom handlers in all cases (some with pdb were slipping through,
1480 custom handlers in all cases (some with pdb were slipping through,
1466 but I'm not exactly sure why).
1481 but I'm not exactly sure why).
1467
1482
1468 * IPython/Debugger.py (Tracer.__init__): added new class to
1483 * IPython/Debugger.py (Tracer.__init__): added new class to
1469 support set_trace-like usage of IPython's enhanced debugger.
1484 support set_trace-like usage of IPython's enhanced debugger.
1470
1485
1471 2006-12-24 Ville Vainio <vivainio@gmail.com>
1486 2006-12-24 Ville Vainio <vivainio@gmail.com>
1472
1487
1473 * ipmaker.py: more informative message when ipy_user_conf
1488 * ipmaker.py: more informative message when ipy_user_conf
1474 import fails (suggest running %upgrade).
1489 import fails (suggest running %upgrade).
1475
1490
1476 * tools/run_ipy_in_profiler.py: Utility to see where
1491 * tools/run_ipy_in_profiler.py: Utility to see where
1477 the time during IPython startup is spent.
1492 the time during IPython startup is spent.
1478
1493
1479 2006-12-20 Ville Vainio <vivainio@gmail.com>
1494 2006-12-20 Ville Vainio <vivainio@gmail.com>
1480
1495
1481 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1496 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1482
1497
1483 * ipapi.py: Add new ipapi method, expand_alias.
1498 * ipapi.py: Add new ipapi method, expand_alias.
1484
1499
1485 * Release.py: Bump up version to 0.7.4.svn
1500 * Release.py: Bump up version to 0.7.4.svn
1486
1501
1487 2006-12-17 Ville Vainio <vivainio@gmail.com>
1502 2006-12-17 Ville Vainio <vivainio@gmail.com>
1488
1503
1489 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1504 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1490 to work properly on posix too
1505 to work properly on posix too
1491
1506
1492 * Release.py: Update revnum (version is still just 0.7.3).
1507 * Release.py: Update revnum (version is still just 0.7.3).
1493
1508
1494 2006-12-15 Ville Vainio <vivainio@gmail.com>
1509 2006-12-15 Ville Vainio <vivainio@gmail.com>
1495
1510
1496 * scripts/ipython_win_post_install: create ipython.py in
1511 * scripts/ipython_win_post_install: create ipython.py in
1497 prefix + "/scripts".
1512 prefix + "/scripts".
1498
1513
1499 * Release.py: Update version to 0.7.3.
1514 * Release.py: Update version to 0.7.3.
1500
1515
1501 2006-12-14 Ville Vainio <vivainio@gmail.com>
1516 2006-12-14 Ville Vainio <vivainio@gmail.com>
1502
1517
1503 * scripts/ipython_win_post_install: Overwrite old shortcuts
1518 * scripts/ipython_win_post_install: Overwrite old shortcuts
1504 if they already exist
1519 if they already exist
1505
1520
1506 * Release.py: release 0.7.3rc2
1521 * Release.py: release 0.7.3rc2
1507
1522
1508 2006-12-13 Ville Vainio <vivainio@gmail.com>
1523 2006-12-13 Ville Vainio <vivainio@gmail.com>
1509
1524
1510 * Branch and update Release.py for 0.7.3rc1
1525 * Branch and update Release.py for 0.7.3rc1
1511
1526
1512 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1527 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1513
1528
1514 * IPython/Shell.py (IPShellWX): update for current WX naming
1529 * IPython/Shell.py (IPShellWX): update for current WX naming
1515 conventions, to avoid a deprecation warning with current WX
1530 conventions, to avoid a deprecation warning with current WX
1516 versions. Thanks to a report by Danny Shevitz.
1531 versions. Thanks to a report by Danny Shevitz.
1517
1532
1518 2006-12-12 Ville Vainio <vivainio@gmail.com>
1533 2006-12-12 Ville Vainio <vivainio@gmail.com>
1519
1534
1520 * ipmaker.py: apply david cournapeau's patch to make
1535 * ipmaker.py: apply david cournapeau's patch to make
1521 import_some work properly even when ipythonrc does
1536 import_some work properly even when ipythonrc does
1522 import_some on empty list (it was an old bug!).
1537 import_some on empty list (it was an old bug!).
1523
1538
1524 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1539 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1525 Add deprecation note to ipythonrc and a url to wiki
1540 Add deprecation note to ipythonrc and a url to wiki
1526 in ipy_user_conf.py
1541 in ipy_user_conf.py
1527
1542
1528
1543
1529 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1544 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1530 as if it was typed on IPython command prompt, i.e.
1545 as if it was typed on IPython command prompt, i.e.
1531 as IPython script.
1546 as IPython script.
1532
1547
1533 * example-magic.py, magic_grepl.py: remove outdated examples
1548 * example-magic.py, magic_grepl.py: remove outdated examples
1534
1549
1535 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1550 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1536
1551
1537 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1552 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1538 is called before any exception has occurred.
1553 is called before any exception has occurred.
1539
1554
1540 2006-12-08 Ville Vainio <vivainio@gmail.com>
1555 2006-12-08 Ville Vainio <vivainio@gmail.com>
1541
1556
1542 * Extensions/ipy_stock_completers.py: fix cd completer
1557 * Extensions/ipy_stock_completers.py: fix cd completer
1543 to translate /'s to \'s again.
1558 to translate /'s to \'s again.
1544
1559
1545 * completer.py: prevent traceback on file completions w/
1560 * completer.py: prevent traceback on file completions w/
1546 backslash.
1561 backslash.
1547
1562
1548 * Release.py: Update release number to 0.7.3b3 for release
1563 * Release.py: Update release number to 0.7.3b3 for release
1549
1564
1550 2006-12-07 Ville Vainio <vivainio@gmail.com>
1565 2006-12-07 Ville Vainio <vivainio@gmail.com>
1551
1566
1552 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1567 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1553 while executing external code. Provides more shell-like behaviour
1568 while executing external code. Provides more shell-like behaviour
1554 and overall better response to ctrl + C / ctrl + break.
1569 and overall better response to ctrl + C / ctrl + break.
1555
1570
1556 * tools/make_tarball.py: new script to create tarball straight from svn
1571 * tools/make_tarball.py: new script to create tarball straight from svn
1557 (setup.py sdist doesn't work on win32).
1572 (setup.py sdist doesn't work on win32).
1558
1573
1559 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1574 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1560 on dirnames with spaces and use the default completer instead.
1575 on dirnames with spaces and use the default completer instead.
1561
1576
1562 * Revision.py: Change version to 0.7.3b2 for release.
1577 * Revision.py: Change version to 0.7.3b2 for release.
1563
1578
1564 2006-12-05 Ville Vainio <vivainio@gmail.com>
1579 2006-12-05 Ville Vainio <vivainio@gmail.com>
1565
1580
1566 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1581 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1567 pydb patch 4 (rm debug printing, py 2.5 checking)
1582 pydb patch 4 (rm debug printing, py 2.5 checking)
1568
1583
1569 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1584 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1570 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1585 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1571 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1586 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1572 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1587 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1573 object the cursor was on before the refresh. The command "markrange" is
1588 object the cursor was on before the refresh. The command "markrange" is
1574 mapped to "%" now.
1589 mapped to "%" now.
1575 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1590 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1576
1591
1577 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1592 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1578
1593
1579 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1594 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1580 interactive debugger on the last traceback, without having to call
1595 interactive debugger on the last traceback, without having to call
1581 %pdb and rerun your code. Made minor changes in various modules,
1596 %pdb and rerun your code. Made minor changes in various modules,
1582 should automatically recognize pydb if available.
1597 should automatically recognize pydb if available.
1583
1598
1584 2006-11-28 Ville Vainio <vivainio@gmail.com>
1599 2006-11-28 Ville Vainio <vivainio@gmail.com>
1585
1600
1586 * completer.py: If the text start with !, show file completions
1601 * completer.py: If the text start with !, show file completions
1587 properly. This helps when trying to complete command name
1602 properly. This helps when trying to complete command name
1588 for shell escapes.
1603 for shell escapes.
1589
1604
1590 2006-11-27 Ville Vainio <vivainio@gmail.com>
1605 2006-11-27 Ville Vainio <vivainio@gmail.com>
1591
1606
1592 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1607 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1593 der Walt. Clean up svn and hg completers by using a common
1608 der Walt. Clean up svn and hg completers by using a common
1594 vcs_completer.
1609 vcs_completer.
1595
1610
1596 2006-11-26 Ville Vainio <vivainio@gmail.com>
1611 2006-11-26 Ville Vainio <vivainio@gmail.com>
1597
1612
1598 * Remove ipconfig and %config; you should use _ip.options structure
1613 * Remove ipconfig and %config; you should use _ip.options structure
1599 directly instead!
1614 directly instead!
1600
1615
1601 * genutils.py: add wrap_deprecated function for deprecating callables
1616 * genutils.py: add wrap_deprecated function for deprecating callables
1602
1617
1603 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1618 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1604 _ip.system instead. ipalias is redundant.
1619 _ip.system instead. ipalias is redundant.
1605
1620
1606 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1621 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1607 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1622 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1608 explicit.
1623 explicit.
1609
1624
1610 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1625 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1611 completer. Try it by entering 'hg ' and pressing tab.
1626 completer. Try it by entering 'hg ' and pressing tab.
1612
1627
1613 * macro.py: Give Macro a useful __repr__ method
1628 * macro.py: Give Macro a useful __repr__ method
1614
1629
1615 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1630 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1616
1631
1617 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1632 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1618 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1633 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1619 we don't get a duplicate ipipe module, where registration of the xrepr
1634 we don't get a duplicate ipipe module, where registration of the xrepr
1620 implementation for Text is useless.
1635 implementation for Text is useless.
1621
1636
1622 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1637 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1623
1638
1624 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1639 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1625
1640
1626 2006-11-24 Ville Vainio <vivainio@gmail.com>
1641 2006-11-24 Ville Vainio <vivainio@gmail.com>
1627
1642
1628 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1643 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1629 try to use "cProfile" instead of the slower pure python
1644 try to use "cProfile" instead of the slower pure python
1630 "profile"
1645 "profile"
1631
1646
1632 2006-11-23 Ville Vainio <vivainio@gmail.com>
1647 2006-11-23 Ville Vainio <vivainio@gmail.com>
1633
1648
1634 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1649 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1635 Qt+IPython+Designer link in documentation.
1650 Qt+IPython+Designer link in documentation.
1636
1651
1637 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1652 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1638 correct Pdb object to %pydb.
1653 correct Pdb object to %pydb.
1639
1654
1640
1655
1641 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1656 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1642 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1657 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1643 generic xrepr(), otherwise the list implementation would kick in.
1658 generic xrepr(), otherwise the list implementation would kick in.
1644
1659
1645 2006-11-21 Ville Vainio <vivainio@gmail.com>
1660 2006-11-21 Ville Vainio <vivainio@gmail.com>
1646
1661
1647 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1662 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1648 with one from UserConfig.
1663 with one from UserConfig.
1649
1664
1650 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1665 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1651 it was missing which broke the sh profile.
1666 it was missing which broke the sh profile.
1652
1667
1653 * completer.py: file completer now uses explicit '/' instead
1668 * completer.py: file completer now uses explicit '/' instead
1654 of os.path.join, expansion of 'foo' was broken on win32
1669 of os.path.join, expansion of 'foo' was broken on win32
1655 if there was one directory with name 'foobar'.
1670 if there was one directory with name 'foobar'.
1656
1671
1657 * A bunch of patches from Kirill Smelkov:
1672 * A bunch of patches from Kirill Smelkov:
1658
1673
1659 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1674 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1660
1675
1661 * [patch 7/9] Implement %page -r (page in raw mode) -
1676 * [patch 7/9] Implement %page -r (page in raw mode) -
1662
1677
1663 * [patch 5/9] ScientificPython webpage has moved
1678 * [patch 5/9] ScientificPython webpage has moved
1664
1679
1665 * [patch 4/9] The manual mentions %ds, should be %dhist
1680 * [patch 4/9] The manual mentions %ds, should be %dhist
1666
1681
1667 * [patch 3/9] Kill old bits from %prun doc.
1682 * [patch 3/9] Kill old bits from %prun doc.
1668
1683
1669 * [patch 1/9] Fix typos here and there.
1684 * [patch 1/9] Fix typos here and there.
1670
1685
1671 2006-11-08 Ville Vainio <vivainio@gmail.com>
1686 2006-11-08 Ville Vainio <vivainio@gmail.com>
1672
1687
1673 * completer.py (attr_matches): catch all exceptions raised
1688 * completer.py (attr_matches): catch all exceptions raised
1674 by eval of expr with dots.
1689 by eval of expr with dots.
1675
1690
1676 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1691 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1677
1692
1678 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1693 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1679 input if it starts with whitespace. This allows you to paste
1694 input if it starts with whitespace. This allows you to paste
1680 indented input from any editor without manually having to type in
1695 indented input from any editor without manually having to type in
1681 the 'if 1:', which is convenient when working interactively.
1696 the 'if 1:', which is convenient when working interactively.
1682 Slightly modifed version of a patch by Bo Peng
1697 Slightly modifed version of a patch by Bo Peng
1683 <bpeng-AT-rice.edu>.
1698 <bpeng-AT-rice.edu>.
1684
1699
1685 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1700 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1686
1701
1687 * IPython/irunner.py (main): modified irunner so it automatically
1702 * IPython/irunner.py (main): modified irunner so it automatically
1688 recognizes the right runner to use based on the extension (.py for
1703 recognizes the right runner to use based on the extension (.py for
1689 python, .ipy for ipython and .sage for sage).
1704 python, .ipy for ipython and .sage for sage).
1690
1705
1691 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1706 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1692 visible in ipapi as ip.config(), to programatically control the
1707 visible in ipapi as ip.config(), to programatically control the
1693 internal rc object. There's an accompanying %config magic for
1708 internal rc object. There's an accompanying %config magic for
1694 interactive use, which has been enhanced to match the
1709 interactive use, which has been enhanced to match the
1695 funtionality in ipconfig.
1710 funtionality in ipconfig.
1696
1711
1697 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1712 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1698 so it's not just a toggle, it now takes an argument. Add support
1713 so it's not just a toggle, it now takes an argument. Add support
1699 for a customizable header when making system calls, as the new
1714 for a customizable header when making system calls, as the new
1700 system_header variable in the ipythonrc file.
1715 system_header variable in the ipythonrc file.
1701
1716
1702 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1717 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1703
1718
1704 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1719 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1705 generic functions (using Philip J. Eby's simplegeneric package).
1720 generic functions (using Philip J. Eby's simplegeneric package).
1706 This makes it possible to customize the display of third-party classes
1721 This makes it possible to customize the display of third-party classes
1707 without having to monkeypatch them. xiter() no longer supports a mode
1722 without having to monkeypatch them. xiter() no longer supports a mode
1708 argument and the XMode class has been removed. The same functionality can
1723 argument and the XMode class has been removed. The same functionality can
1709 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1724 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1710 One consequence of the switch to generic functions is that xrepr() and
1725 One consequence of the switch to generic functions is that xrepr() and
1711 xattrs() implementation must define the default value for the mode
1726 xattrs() implementation must define the default value for the mode
1712 argument themselves and xattrs() implementations must return real
1727 argument themselves and xattrs() implementations must return real
1713 descriptors.
1728 descriptors.
1714
1729
1715 * IPython/external: This new subpackage will contain all third-party
1730 * IPython/external: This new subpackage will contain all third-party
1716 packages that are bundled with IPython. (The first one is simplegeneric).
1731 packages that are bundled with IPython. (The first one is simplegeneric).
1717
1732
1718 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1733 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1719 directory which as been dropped in r1703.
1734 directory which as been dropped in r1703.
1720
1735
1721 * IPython/Extensions/ipipe.py (iless): Fixed.
1736 * IPython/Extensions/ipipe.py (iless): Fixed.
1722
1737
1723 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1738 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1724
1739
1725 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1740 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1726
1741
1727 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1742 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1728 handling in variable expansion so that shells and magics recognize
1743 handling in variable expansion so that shells and magics recognize
1729 function local scopes correctly. Bug reported by Brian.
1744 function local scopes correctly. Bug reported by Brian.
1730
1745
1731 * scripts/ipython: remove the very first entry in sys.path which
1746 * scripts/ipython: remove the very first entry in sys.path which
1732 Python auto-inserts for scripts, so that sys.path under IPython is
1747 Python auto-inserts for scripts, so that sys.path under IPython is
1733 as similar as possible to that under plain Python.
1748 as similar as possible to that under plain Python.
1734
1749
1735 * IPython/completer.py (IPCompleter.file_matches): Fix
1750 * IPython/completer.py (IPCompleter.file_matches): Fix
1736 tab-completion so that quotes are not closed unless the completion
1751 tab-completion so that quotes are not closed unless the completion
1737 is unambiguous. After a request by Stefan. Minor cleanups in
1752 is unambiguous. After a request by Stefan. Minor cleanups in
1738 ipy_stock_completers.
1753 ipy_stock_completers.
1739
1754
1740 2006-11-02 Ville Vainio <vivainio@gmail.com>
1755 2006-11-02 Ville Vainio <vivainio@gmail.com>
1741
1756
1742 * ipy_stock_completers.py: Add %run and %cd completers.
1757 * ipy_stock_completers.py: Add %run and %cd completers.
1743
1758
1744 * completer.py: Try running custom completer for both
1759 * completer.py: Try running custom completer for both
1745 "foo" and "%foo" if the command is just "foo". Ignore case
1760 "foo" and "%foo" if the command is just "foo". Ignore case
1746 when filtering possible completions.
1761 when filtering possible completions.
1747
1762
1748 * UserConfig/ipy_user_conf.py: install stock completers as default
1763 * UserConfig/ipy_user_conf.py: install stock completers as default
1749
1764
1750 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1765 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1751 simplified readline history save / restore through a wrapper
1766 simplified readline history save / restore through a wrapper
1752 function
1767 function
1753
1768
1754
1769
1755 2006-10-31 Ville Vainio <vivainio@gmail.com>
1770 2006-10-31 Ville Vainio <vivainio@gmail.com>
1756
1771
1757 * strdispatch.py, completer.py, ipy_stock_completers.py:
1772 * strdispatch.py, completer.py, ipy_stock_completers.py:
1758 Allow str_key ("command") in completer hooks. Implement
1773 Allow str_key ("command") in completer hooks. Implement
1759 trivial completer for 'import' (stdlib modules only). Rename
1774 trivial completer for 'import' (stdlib modules only). Rename
1760 ipy_linux_package_managers.py to ipy_stock_completers.py.
1775 ipy_linux_package_managers.py to ipy_stock_completers.py.
1761 SVN completer.
1776 SVN completer.
1762
1777
1763 * Extensions/ledit.py: %magic line editor for easily and
1778 * Extensions/ledit.py: %magic line editor for easily and
1764 incrementally manipulating lists of strings. The magic command
1779 incrementally manipulating lists of strings. The magic command
1765 name is %led.
1780 name is %led.
1766
1781
1767 2006-10-30 Ville Vainio <vivainio@gmail.com>
1782 2006-10-30 Ville Vainio <vivainio@gmail.com>
1768
1783
1769 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1784 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1770 Bernsteins's patches for pydb integration.
1785 Bernsteins's patches for pydb integration.
1771 http://bashdb.sourceforge.net/pydb/
1786 http://bashdb.sourceforge.net/pydb/
1772
1787
1773 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1788 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1774 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1789 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1775 custom completer hook to allow the users to implement their own
1790 custom completer hook to allow the users to implement their own
1776 completers. See ipy_linux_package_managers.py for example. The
1791 completers. See ipy_linux_package_managers.py for example. The
1777 hook name is 'complete_command'.
1792 hook name is 'complete_command'.
1778
1793
1779 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1794 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1780
1795
1781 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1796 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1782 Numeric leftovers.
1797 Numeric leftovers.
1783
1798
1784 * ipython.el (py-execute-region): apply Stefan's patch to fix
1799 * ipython.el (py-execute-region): apply Stefan's patch to fix
1785 garbled results if the python shell hasn't been previously started.
1800 garbled results if the python shell hasn't been previously started.
1786
1801
1787 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1802 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1788 pretty generic function and useful for other things.
1803 pretty generic function and useful for other things.
1789
1804
1790 * IPython/OInspect.py (getsource): Add customizable source
1805 * IPython/OInspect.py (getsource): Add customizable source
1791 extractor. After a request/patch form W. Stein (SAGE).
1806 extractor. After a request/patch form W. Stein (SAGE).
1792
1807
1793 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1808 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1794 window size to a more reasonable value from what pexpect does,
1809 window size to a more reasonable value from what pexpect does,
1795 since their choice causes wrapping bugs with long input lines.
1810 since their choice causes wrapping bugs with long input lines.
1796
1811
1797 2006-10-28 Ville Vainio <vivainio@gmail.com>
1812 2006-10-28 Ville Vainio <vivainio@gmail.com>
1798
1813
1799 * Magic.py (%run): Save and restore the readline history from
1814 * Magic.py (%run): Save and restore the readline history from
1800 file around %run commands to prevent side effects from
1815 file around %run commands to prevent side effects from
1801 %runned programs that might use readline (e.g. pydb).
1816 %runned programs that might use readline (e.g. pydb).
1802
1817
1803 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1818 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1804 invoking the pydb enhanced debugger.
1819 invoking the pydb enhanced debugger.
1805
1820
1806 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1821 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1807
1822
1808 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1823 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1809 call the base class method and propagate the return value to
1824 call the base class method and propagate the return value to
1810 ifile. This is now done by path itself.
1825 ifile. This is now done by path itself.
1811
1826
1812 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1827 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1813
1828
1814 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1829 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1815 api: set_crash_handler(), to expose the ability to change the
1830 api: set_crash_handler(), to expose the ability to change the
1816 internal crash handler.
1831 internal crash handler.
1817
1832
1818 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1833 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1819 the various parameters of the crash handler so that apps using
1834 the various parameters of the crash handler so that apps using
1820 IPython as their engine can customize crash handling. Ipmlemented
1835 IPython as their engine can customize crash handling. Ipmlemented
1821 at the request of SAGE.
1836 at the request of SAGE.
1822
1837
1823 2006-10-14 Ville Vainio <vivainio@gmail.com>
1838 2006-10-14 Ville Vainio <vivainio@gmail.com>
1824
1839
1825 * Magic.py, ipython.el: applied first "safe" part of Rocky
1840 * Magic.py, ipython.el: applied first "safe" part of Rocky
1826 Bernstein's patch set for pydb integration.
1841 Bernstein's patch set for pydb integration.
1827
1842
1828 * Magic.py (%unalias, %alias): %store'd aliases can now be
1843 * Magic.py (%unalias, %alias): %store'd aliases can now be
1829 removed with '%unalias'. %alias w/o args now shows most
1844 removed with '%unalias'. %alias w/o args now shows most
1830 interesting (stored / manually defined) aliases last
1845 interesting (stored / manually defined) aliases last
1831 where they catch the eye w/o scrolling.
1846 where they catch the eye w/o scrolling.
1832
1847
1833 * Magic.py (%rehashx), ext_rehashdir.py: files with
1848 * Magic.py (%rehashx), ext_rehashdir.py: files with
1834 'py' extension are always considered executable, even
1849 'py' extension are always considered executable, even
1835 when not in PATHEXT environment variable.
1850 when not in PATHEXT environment variable.
1836
1851
1837 2006-10-12 Ville Vainio <vivainio@gmail.com>
1852 2006-10-12 Ville Vainio <vivainio@gmail.com>
1838
1853
1839 * jobctrl.py: Add new "jobctrl" extension for spawning background
1854 * jobctrl.py: Add new "jobctrl" extension for spawning background
1840 processes with "&find /". 'import jobctrl' to try it out. Requires
1855 processes with "&find /". 'import jobctrl' to try it out. Requires
1841 'subprocess' module, standard in python 2.4+.
1856 'subprocess' module, standard in python 2.4+.
1842
1857
1843 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1858 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1844 so if foo -> bar and bar -> baz, then foo -> baz.
1859 so if foo -> bar and bar -> baz, then foo -> baz.
1845
1860
1846 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1861 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1847
1862
1848 * IPython/Magic.py (Magic.parse_options): add a new posix option
1863 * IPython/Magic.py (Magic.parse_options): add a new posix option
1849 to allow parsing of input args in magics that doesn't strip quotes
1864 to allow parsing of input args in magics that doesn't strip quotes
1850 (if posix=False). This also closes %timeit bug reported by
1865 (if posix=False). This also closes %timeit bug reported by
1851 Stefan.
1866 Stefan.
1852
1867
1853 2006-10-03 Ville Vainio <vivainio@gmail.com>
1868 2006-10-03 Ville Vainio <vivainio@gmail.com>
1854
1869
1855 * iplib.py (raw_input, interact): Return ValueError catching for
1870 * iplib.py (raw_input, interact): Return ValueError catching for
1856 raw_input. Fixes infinite loop for sys.stdin.close() or
1871 raw_input. Fixes infinite loop for sys.stdin.close() or
1857 sys.stdout.close().
1872 sys.stdout.close().
1858
1873
1859 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1874 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1860
1875
1861 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1876 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1862 to help in handling doctests. irunner is now pretty useful for
1877 to help in handling doctests. irunner is now pretty useful for
1863 running standalone scripts and simulate a full interactive session
1878 running standalone scripts and simulate a full interactive session
1864 in a format that can be then pasted as a doctest.
1879 in a format that can be then pasted as a doctest.
1865
1880
1866 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1881 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1867 on top of the default (useless) ones. This also fixes the nasty
1882 on top of the default (useless) ones. This also fixes the nasty
1868 way in which 2.5's Quitter() exits (reverted [1785]).
1883 way in which 2.5's Quitter() exits (reverted [1785]).
1869
1884
1870 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1885 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1871 2.5.
1886 2.5.
1872
1887
1873 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1888 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1874 color scheme is updated as well when color scheme is changed
1889 color scheme is updated as well when color scheme is changed
1875 interactively.
1890 interactively.
1876
1891
1877 2006-09-27 Ville Vainio <vivainio@gmail.com>
1892 2006-09-27 Ville Vainio <vivainio@gmail.com>
1878
1893
1879 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1894 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1880 infinite loop and just exit. It's a hack, but will do for a while.
1895 infinite loop and just exit. It's a hack, but will do for a while.
1881
1896
1882 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1897 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1883
1898
1884 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1899 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1885 the constructor, this makes it possible to get a list of only directories
1900 the constructor, this makes it possible to get a list of only directories
1886 or only files.
1901 or only files.
1887
1902
1888 2006-08-12 Ville Vainio <vivainio@gmail.com>
1903 2006-08-12 Ville Vainio <vivainio@gmail.com>
1889
1904
1890 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1905 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1891 they broke unittest
1906 they broke unittest
1892
1907
1893 2006-08-11 Ville Vainio <vivainio@gmail.com>
1908 2006-08-11 Ville Vainio <vivainio@gmail.com>
1894
1909
1895 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1910 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1896 by resolving issue properly, i.e. by inheriting FakeModule
1911 by resolving issue properly, i.e. by inheriting FakeModule
1897 from types.ModuleType. Pickling ipython interactive data
1912 from types.ModuleType. Pickling ipython interactive data
1898 should still work as usual (testing appreciated).
1913 should still work as usual (testing appreciated).
1899
1914
1900 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1915 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1901
1916
1902 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1917 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1903 running under python 2.3 with code from 2.4 to fix a bug with
1918 running under python 2.3 with code from 2.4 to fix a bug with
1904 help(). Reported by the Debian maintainers, Norbert Tretkowski
1919 help(). Reported by the Debian maintainers, Norbert Tretkowski
1905 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1920 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1906 <afayolle-AT-debian.org>.
1921 <afayolle-AT-debian.org>.
1907
1922
1908 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1923 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1909
1924
1910 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1925 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1911 (which was displaying "quit" twice).
1926 (which was displaying "quit" twice).
1912
1927
1913 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1928 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1914
1929
1915 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1930 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1916 the mode argument).
1931 the mode argument).
1917
1932
1918 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1933 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1919
1934
1920 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1935 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1921 not running under IPython.
1936 not running under IPython.
1922
1937
1923 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1938 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1924 and make it iterable (iterating over the attribute itself). Add two new
1939 and make it iterable (iterating over the attribute itself). Add two new
1925 magic strings for __xattrs__(): If the string starts with "-", the attribute
1940 magic strings for __xattrs__(): If the string starts with "-", the attribute
1926 will not be displayed in ibrowse's detail view (but it can still be
1941 will not be displayed in ibrowse's detail view (but it can still be
1927 iterated over). This makes it possible to add attributes that are large
1942 iterated over). This makes it possible to add attributes that are large
1928 lists or generator methods to the detail view. Replace magic attribute names
1943 lists or generator methods to the detail view. Replace magic attribute names
1929 and _attrname() and _getattr() with "descriptors": For each type of magic
1944 and _attrname() and _getattr() with "descriptors": For each type of magic
1930 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1945 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1931 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1946 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1932 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1947 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1933 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1948 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1934 are still supported.
1949 are still supported.
1935
1950
1936 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1951 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1937 fails in ibrowse.fetch(), the exception object is added as the last item
1952 fails in ibrowse.fetch(), the exception object is added as the last item
1938 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1953 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1939 a generator throws an exception midway through execution.
1954 a generator throws an exception midway through execution.
1940
1955
1941 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1956 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1942 encoding into methods.
1957 encoding into methods.
1943
1958
1944 2006-07-26 Ville Vainio <vivainio@gmail.com>
1959 2006-07-26 Ville Vainio <vivainio@gmail.com>
1945
1960
1946 * iplib.py: history now stores multiline input as single
1961 * iplib.py: history now stores multiline input as single
1947 history entries. Patch by Jorgen Cederlof.
1962 history entries. Patch by Jorgen Cederlof.
1948
1963
1949 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1964 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1950
1965
1951 * IPython/Extensions/ibrowse.py: Make cursor visible over
1966 * IPython/Extensions/ibrowse.py: Make cursor visible over
1952 non existing attributes.
1967 non existing attributes.
1953
1968
1954 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1969 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1955
1970
1956 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1971 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1957 error output of the running command doesn't mess up the screen.
1972 error output of the running command doesn't mess up the screen.
1958
1973
1959 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1974 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1960
1975
1961 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1976 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1962 argument. This sorts the items themselves.
1977 argument. This sorts the items themselves.
1963
1978
1964 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1979 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1965
1980
1966 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1981 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1967 Compile expression strings into code objects. This should speed
1982 Compile expression strings into code objects. This should speed
1968 up ifilter and friends somewhat.
1983 up ifilter and friends somewhat.
1969
1984
1970 2006-07-08 Ville Vainio <vivainio@gmail.com>
1985 2006-07-08 Ville Vainio <vivainio@gmail.com>
1971
1986
1972 * Magic.py: %cpaste now strips > from the beginning of lines
1987 * Magic.py: %cpaste now strips > from the beginning of lines
1973 to ease pasting quoted code from emails. Contributed by
1988 to ease pasting quoted code from emails. Contributed by
1974 Stefan van der Walt.
1989 Stefan van der Walt.
1975
1990
1976 2006-06-29 Ville Vainio <vivainio@gmail.com>
1991 2006-06-29 Ville Vainio <vivainio@gmail.com>
1977
1992
1978 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1993 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1979 mode, patch contributed by Darren Dale. NEEDS TESTING!
1994 mode, patch contributed by Darren Dale. NEEDS TESTING!
1980
1995
1981 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1996 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1982
1997
1983 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1998 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1984 a blue background. Fix fetching new display rows when the browser
1999 a blue background. Fix fetching new display rows when the browser
1985 scrolls more than a screenful (e.g. by using the goto command).
2000 scrolls more than a screenful (e.g. by using the goto command).
1986
2001
1987 2006-06-27 Ville Vainio <vivainio@gmail.com>
2002 2006-06-27 Ville Vainio <vivainio@gmail.com>
1988
2003
1989 * Magic.py (_inspect, _ofind) Apply David Huard's
2004 * Magic.py (_inspect, _ofind) Apply David Huard's
1990 patch for displaying the correct docstring for 'property'
2005 patch for displaying the correct docstring for 'property'
1991 attributes.
2006 attributes.
1992
2007
1993 2006-06-23 Walter Doerwald <walter@livinglogic.de>
2008 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1994
2009
1995 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
2010 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1996 commands into the methods implementing them.
2011 commands into the methods implementing them.
1997
2012
1998 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
2013 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1999
2014
2000 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
2015 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
2001 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
2016 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
2002 autoindent support was authored by Jin Liu.
2017 autoindent support was authored by Jin Liu.
2003
2018
2004 2006-06-22 Walter Doerwald <walter@livinglogic.de>
2019 2006-06-22 Walter Doerwald <walter@livinglogic.de>
2005
2020
2006 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
2021 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
2007 for keymaps with a custom class that simplifies handling.
2022 for keymaps with a custom class that simplifies handling.
2008
2023
2009 2006-06-19 Walter Doerwald <walter@livinglogic.de>
2024 2006-06-19 Walter Doerwald <walter@livinglogic.de>
2010
2025
2011 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
2026 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
2012 resizing. This requires Python 2.5 to work.
2027 resizing. This requires Python 2.5 to work.
2013
2028
2014 2006-06-16 Walter Doerwald <walter@livinglogic.de>
2029 2006-06-16 Walter Doerwald <walter@livinglogic.de>
2015
2030
2016 * IPython/Extensions/ibrowse.py: Add two new commands to
2031 * IPython/Extensions/ibrowse.py: Add two new commands to
2017 ibrowse: "hideattr" (mapped to "h") hides the attribute under
2032 ibrowse: "hideattr" (mapped to "h") hides the attribute under
2018 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
2033 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
2019 attributes again. Remapped the help command to "?". Display
2034 attributes again. Remapped the help command to "?". Display
2020 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
2035 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
2021 as keys for the "home" and "end" commands. Add three new commands
2036 as keys for the "home" and "end" commands. Add three new commands
2022 to the input mode for "find" and friends: "delend" (CTRL-K)
2037 to the input mode for "find" and friends: "delend" (CTRL-K)
2023 deletes to the end of line. "incsearchup" searches upwards in the
2038 deletes to the end of line. "incsearchup" searches upwards in the
2024 command history for an input that starts with the text before the cursor.
2039 command history for an input that starts with the text before the cursor.
2025 "incsearchdown" does the same downwards. Removed a bogus mapping of
2040 "incsearchdown" does the same downwards. Removed a bogus mapping of
2026 the x key to "delete".
2041 the x key to "delete".
2027
2042
2028 2006-06-15 Ville Vainio <vivainio@gmail.com>
2043 2006-06-15 Ville Vainio <vivainio@gmail.com>
2029
2044
2030 * iplib.py, hooks.py: Added new generate_prompt hook that can be
2045 * iplib.py, hooks.py: Added new generate_prompt hook that can be
2031 used to create prompts dynamically, instead of the "old" way of
2046 used to create prompts dynamically, instead of the "old" way of
2032 assigning "magic" strings to prompt_in1 and prompt_in2. The old
2047 assigning "magic" strings to prompt_in1 and prompt_in2. The old
2033 way still works (it's invoked by the default hook), of course.
2048 way still works (it's invoked by the default hook), of course.
2034
2049
2035 * Prompts.py: added generate_output_prompt hook for altering output
2050 * Prompts.py: added generate_output_prompt hook for altering output
2036 prompt
2051 prompt
2037
2052
2038 * Release.py: Changed version string to 0.7.3.svn.
2053 * Release.py: Changed version string to 0.7.3.svn.
2039
2054
2040 2006-06-15 Walter Doerwald <walter@livinglogic.de>
2055 2006-06-15 Walter Doerwald <walter@livinglogic.de>
2041
2056
2042 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
2057 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
2043 the call to fetch() always tries to fetch enough data for at least one
2058 the call to fetch() always tries to fetch enough data for at least one
2044 full screen. This makes it possible to simply call moveto(0,0,True) in
2059 full screen. This makes it possible to simply call moveto(0,0,True) in
2045 the constructor. Fix typos and removed the obsolete goto attribute.
2060 the constructor. Fix typos and removed the obsolete goto attribute.
2046
2061
2047 2006-06-12 Ville Vainio <vivainio@gmail.com>
2062 2006-06-12 Ville Vainio <vivainio@gmail.com>
2048
2063
2049 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
2064 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
2050 allowing $variable interpolation within multiline statements,
2065 allowing $variable interpolation within multiline statements,
2051 though so far only with "sh" profile for a testing period.
2066 though so far only with "sh" profile for a testing period.
2052 The patch also enables splitting long commands with \ but it
2067 The patch also enables splitting long commands with \ but it
2053 doesn't work properly yet.
2068 doesn't work properly yet.
2054
2069
2055 2006-06-12 Walter Doerwald <walter@livinglogic.de>
2070 2006-06-12 Walter Doerwald <walter@livinglogic.de>
2056
2071
2057 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
2072 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
2058 input history and the position of the cursor in the input history for
2073 input history and the position of the cursor in the input history for
2059 the find, findbackwards and goto command.
2074 the find, findbackwards and goto command.
2060
2075
2061 2006-06-10 Walter Doerwald <walter@livinglogic.de>
2076 2006-06-10 Walter Doerwald <walter@livinglogic.de>
2062
2077
2063 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
2078 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
2064 implements the basic functionality of browser commands that require
2079 implements the basic functionality of browser commands that require
2065 input. Reimplement the goto, find and findbackwards commands as
2080 input. Reimplement the goto, find and findbackwards commands as
2066 subclasses of _CommandInput. Add an input history and keymaps to those
2081 subclasses of _CommandInput. Add an input history and keymaps to those
2067 commands. Add "\r" as a keyboard shortcut for the enterdefault and
2082 commands. Add "\r" as a keyboard shortcut for the enterdefault and
2068 execute commands.
2083 execute commands.
2069
2084
2070 2006-06-07 Ville Vainio <vivainio@gmail.com>
2085 2006-06-07 Ville Vainio <vivainio@gmail.com>
2071
2086
2072 * iplib.py: ipython mybatch.ipy exits ipython immediately after
2087 * iplib.py: ipython mybatch.ipy exits ipython immediately after
2073 running the batch files instead of leaving the session open.
2088 running the batch files instead of leaving the session open.
2074
2089
2075 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
2090 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
2076
2091
2077 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
2092 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
2078 the original fix was incomplete. Patch submitted by W. Maier.
2093 the original fix was incomplete. Patch submitted by W. Maier.
2079
2094
2080 2006-06-07 Ville Vainio <vivainio@gmail.com>
2095 2006-06-07 Ville Vainio <vivainio@gmail.com>
2081
2096
2082 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
2097 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
2083 Confirmation prompts can be supressed by 'quiet' option.
2098 Confirmation prompts can be supressed by 'quiet' option.
2084 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
2099 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
2085
2100
2086 2006-06-06 *** Released version 0.7.2
2101 2006-06-06 *** Released version 0.7.2
2087
2102
2088 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
2103 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
2089
2104
2090 * IPython/Release.py (version): Made 0.7.2 final for release.
2105 * IPython/Release.py (version): Made 0.7.2 final for release.
2091 Repo tagged and release cut.
2106 Repo tagged and release cut.
2092
2107
2093 2006-06-05 Ville Vainio <vivainio@gmail.com>
2108 2006-06-05 Ville Vainio <vivainio@gmail.com>
2094
2109
2095 * Magic.py (magic_rehashx): Honor no_alias list earlier in
2110 * Magic.py (magic_rehashx): Honor no_alias list earlier in
2096 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
2111 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
2097
2112
2098 * upgrade_dir.py: try import 'path' module a bit harder
2113 * upgrade_dir.py: try import 'path' module a bit harder
2099 (for %upgrade)
2114 (for %upgrade)
2100
2115
2101 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
2116 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
2102
2117
2103 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
2118 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
2104 instead of looping 20 times.
2119 instead of looping 20 times.
2105
2120
2106 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
2121 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
2107 correctly at initialization time. Bug reported by Krishna Mohan
2122 correctly at initialization time. Bug reported by Krishna Mohan
2108 Gundu <gkmohan-AT-gmail.com> on the user list.
2123 Gundu <gkmohan-AT-gmail.com> on the user list.
2109
2124
2110 * IPython/Release.py (version): Mark 0.7.2 version to start
2125 * IPython/Release.py (version): Mark 0.7.2 version to start
2111 testing for release on 06/06.
2126 testing for release on 06/06.
2112
2127
2113 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
2128 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
2114
2129
2115 * scripts/irunner: thin script interface so users don't have to
2130 * scripts/irunner: thin script interface so users don't have to
2116 find the module and call it as an executable, since modules rarely
2131 find the module and call it as an executable, since modules rarely
2117 live in people's PATH.
2132 live in people's PATH.
2118
2133
2119 * IPython/irunner.py (InteractiveRunner.__init__): added
2134 * IPython/irunner.py (InteractiveRunner.__init__): added
2120 delaybeforesend attribute to control delays with newer versions of
2135 delaybeforesend attribute to control delays with newer versions of
2121 pexpect. Thanks to detailed help from pexpect's author, Noah
2136 pexpect. Thanks to detailed help from pexpect's author, Noah
2122 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
2137 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
2123 correctly (it works in NoColor mode).
2138 correctly (it works in NoColor mode).
2124
2139
2125 * IPython/iplib.py (handle_normal): fix nasty crash reported on
2140 * IPython/iplib.py (handle_normal): fix nasty crash reported on
2126 SAGE list, from improper log() calls.
2141 SAGE list, from improper log() calls.
2127
2142
2128 2006-05-31 Ville Vainio <vivainio@gmail.com>
2143 2006-05-31 Ville Vainio <vivainio@gmail.com>
2129
2144
2130 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
2145 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
2131 with args in parens to work correctly with dirs that have spaces.
2146 with args in parens to work correctly with dirs that have spaces.
2132
2147
2133 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
2148 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
2134
2149
2135 * IPython/Logger.py (Logger.logstart): add option to log raw input
2150 * IPython/Logger.py (Logger.logstart): add option to log raw input
2136 instead of the processed one. A -r flag was added to the
2151 instead of the processed one. A -r flag was added to the
2137 %logstart magic used for controlling logging.
2152 %logstart magic used for controlling logging.
2138
2153
2139 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
2154 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
2140
2155
2141 * IPython/iplib.py (InteractiveShell.__init__): add check for the
2156 * IPython/iplib.py (InteractiveShell.__init__): add check for the
2142 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
2157 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
2143 recognize the option. After a bug report by Will Maier. This
2158 recognize the option. After a bug report by Will Maier. This
2144 closes #64 (will do it after confirmation from W. Maier).
2159 closes #64 (will do it after confirmation from W. Maier).
2145
2160
2146 * IPython/irunner.py: New module to run scripts as if manually
2161 * IPython/irunner.py: New module to run scripts as if manually
2147 typed into an interactive environment, based on pexpect. After a
2162 typed into an interactive environment, based on pexpect. After a
2148 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
2163 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
2149 ipython-user list. Simple unittests in the tests/ directory.
2164 ipython-user list. Simple unittests in the tests/ directory.
2150
2165
2151 * tools/release: add Will Maier, OpenBSD port maintainer, to
2166 * tools/release: add Will Maier, OpenBSD port maintainer, to
2152 recepients list. We are now officially part of the OpenBSD ports:
2167 recepients list. We are now officially part of the OpenBSD ports:
2153 http://www.openbsd.org/ports.html ! Many thanks to Will for the
2168 http://www.openbsd.org/ports.html ! Many thanks to Will for the
2154 work.
2169 work.
2155
2170
2156 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
2171 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
2157
2172
2158 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
2173 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
2159 so that it doesn't break tkinter apps.
2174 so that it doesn't break tkinter apps.
2160
2175
2161 * IPython/iplib.py (_prefilter): fix bug where aliases would
2176 * IPython/iplib.py (_prefilter): fix bug where aliases would
2162 shadow variables when autocall was fully off. Reported by SAGE
2177 shadow variables when autocall was fully off. Reported by SAGE
2163 author William Stein.
2178 author William Stein.
2164
2179
2165 * IPython/OInspect.py (Inspector.__init__): add a flag to control
2180 * IPython/OInspect.py (Inspector.__init__): add a flag to control
2166 at what detail level strings are computed when foo? is requested.
2181 at what detail level strings are computed when foo? is requested.
2167 This allows users to ask for example that the string form of an
2182 This allows users to ask for example that the string form of an
2168 object is only computed when foo?? is called, or even never, by
2183 object is only computed when foo?? is called, or even never, by
2169 setting the object_info_string_level >= 2 in the configuration
2184 setting the object_info_string_level >= 2 in the configuration
2170 file. This new option has been added and documented. After a
2185 file. This new option has been added and documented. After a
2171 request by SAGE to be able to control the printing of very large
2186 request by SAGE to be able to control the printing of very large
2172 objects more easily.
2187 objects more easily.
2173
2188
2174 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
2189 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
2175
2190
2176 * IPython/ipmaker.py (make_IPython): remove the ipython call path
2191 * IPython/ipmaker.py (make_IPython): remove the ipython call path
2177 from sys.argv, to be 100% consistent with how Python itself works
2192 from sys.argv, to be 100% consistent with how Python itself works
2178 (as seen for example with python -i file.py). After a bug report
2193 (as seen for example with python -i file.py). After a bug report
2179 by Jeffrey Collins.
2194 by Jeffrey Collins.
2180
2195
2181 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
2196 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
2182 nasty bug which was preventing custom namespaces with -pylab,
2197 nasty bug which was preventing custom namespaces with -pylab,
2183 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
2198 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
2184 compatibility (long gone from mpl).
2199 compatibility (long gone from mpl).
2185
2200
2186 * IPython/ipapi.py (make_session): name change: create->make. We
2201 * IPython/ipapi.py (make_session): name change: create->make. We
2187 use make in other places (ipmaker,...), it's shorter and easier to
2202 use make in other places (ipmaker,...), it's shorter and easier to
2188 type and say, etc. I'm trying to clean things before 0.7.2 so
2203 type and say, etc. I'm trying to clean things before 0.7.2 so
2189 that I can keep things stable wrt to ipapi in the chainsaw branch.
2204 that I can keep things stable wrt to ipapi in the chainsaw branch.
2190
2205
2191 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
2206 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
2192 python-mode recognizes our debugger mode. Add support for
2207 python-mode recognizes our debugger mode. Add support for
2193 autoindent inside (X)emacs. After a patch sent in by Jin Liu
2208 autoindent inside (X)emacs. After a patch sent in by Jin Liu
2194 <m.liu.jin-AT-gmail.com> originally written by
2209 <m.liu.jin-AT-gmail.com> originally written by
2195 doxgen-AT-newsmth.net (with minor modifications for xemacs
2210 doxgen-AT-newsmth.net (with minor modifications for xemacs
2196 compatibility)
2211 compatibility)
2197
2212
2198 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
2213 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
2199 tracebacks when walking the stack so that the stack tracking system
2214 tracebacks when walking the stack so that the stack tracking system
2200 in emacs' python-mode can identify the frames correctly.
2215 in emacs' python-mode can identify the frames correctly.
2201
2216
2202 * IPython/ipmaker.py (make_IPython): make the internal (and
2217 * IPython/ipmaker.py (make_IPython): make the internal (and
2203 default config) autoedit_syntax value false by default. Too many
2218 default config) autoedit_syntax value false by default. Too many
2204 users have complained to me (both on and off-list) about problems
2219 users have complained to me (both on and off-list) about problems
2205 with this option being on by default, so I'm making it default to
2220 with this option being on by default, so I'm making it default to
2206 off. It can still be enabled by anyone via the usual mechanisms.
2221 off. It can still be enabled by anyone via the usual mechanisms.
2207
2222
2208 * IPython/completer.py (Completer.attr_matches): add support for
2223 * IPython/completer.py (Completer.attr_matches): add support for
2209 PyCrust-style _getAttributeNames magic method. Patch contributed
2224 PyCrust-style _getAttributeNames magic method. Patch contributed
2210 by <mscott-AT-goldenspud.com>. Closes #50.
2225 by <mscott-AT-goldenspud.com>. Closes #50.
2211
2226
2212 * IPython/iplib.py (InteractiveShell.__init__): remove the
2227 * IPython/iplib.py (InteractiveShell.__init__): remove the
2213 deletion of exit/quit from __builtin__, which can break
2228 deletion of exit/quit from __builtin__, which can break
2214 third-party tools like the Zope debugging console. The
2229 third-party tools like the Zope debugging console. The
2215 %exit/%quit magics remain. In general, it's probably a good idea
2230 %exit/%quit magics remain. In general, it's probably a good idea
2216 not to delete anything from __builtin__, since we never know what
2231 not to delete anything from __builtin__, since we never know what
2217 that will break. In any case, python now (for 2.5) will support
2232 that will break. In any case, python now (for 2.5) will support
2218 'real' exit/quit, so this issue is moot. Closes #55.
2233 'real' exit/quit, so this issue is moot. Closes #55.
2219
2234
2220 * IPython/genutils.py (with_obj): rename the 'with' function to
2235 * IPython/genutils.py (with_obj): rename the 'with' function to
2221 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
2236 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
2222 becomes a language keyword. Closes #53.
2237 becomes a language keyword. Closes #53.
2223
2238
2224 * IPython/FakeModule.py (FakeModule.__init__): add a proper
2239 * IPython/FakeModule.py (FakeModule.__init__): add a proper
2225 __file__ attribute to this so it fools more things into thinking
2240 __file__ attribute to this so it fools more things into thinking
2226 it is a real module. Closes #59.
2241 it is a real module. Closes #59.
2227
2242
2228 * IPython/Magic.py (magic_edit): add -n option to open the editor
2243 * IPython/Magic.py (magic_edit): add -n option to open the editor
2229 at a specific line number. After a patch by Stefan van der Walt.
2244 at a specific line number. After a patch by Stefan van der Walt.
2230
2245
2231 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
2246 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
2232
2247
2233 * IPython/iplib.py (edit_syntax_error): fix crash when for some
2248 * IPython/iplib.py (edit_syntax_error): fix crash when for some
2234 reason the file could not be opened. After automatic crash
2249 reason the file could not be opened. After automatic crash
2235 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
2250 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
2236 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
2251 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
2237 (_should_recompile): Don't fire editor if using %bg, since there
2252 (_should_recompile): Don't fire editor if using %bg, since there
2238 is no file in the first place. From the same report as above.
2253 is no file in the first place. From the same report as above.
2239 (raw_input): protect against faulty third-party prefilters. After
2254 (raw_input): protect against faulty third-party prefilters. After
2240 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
2255 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
2241 while running under SAGE.
2256 while running under SAGE.
2242
2257
2243 2006-05-23 Ville Vainio <vivainio@gmail.com>
2258 2006-05-23 Ville Vainio <vivainio@gmail.com>
2244
2259
2245 * ipapi.py: Stripped down ip.to_user_ns() to work only as
2260 * ipapi.py: Stripped down ip.to_user_ns() to work only as
2246 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
2261 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
2247 now returns None (again), unless dummy is specifically allowed by
2262 now returns None (again), unless dummy is specifically allowed by
2248 ipapi.get(allow_dummy=True).
2263 ipapi.get(allow_dummy=True).
2249
2264
2250 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
2265 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
2251
2266
2252 * IPython: remove all 2.2-compatibility objects and hacks from
2267 * IPython: remove all 2.2-compatibility objects and hacks from
2253 everywhere, since we only support 2.3 at this point. Docs
2268 everywhere, since we only support 2.3 at this point. Docs
2254 updated.
2269 updated.
2255
2270
2256 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
2271 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
2257 Anything requiring extra validation can be turned into a Python
2272 Anything requiring extra validation can be turned into a Python
2258 property in the future. I used a property for the db one b/c
2273 property in the future. I used a property for the db one b/c
2259 there was a nasty circularity problem with the initialization
2274 there was a nasty circularity problem with the initialization
2260 order, which right now I don't have time to clean up.
2275 order, which right now I don't have time to clean up.
2261
2276
2262 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
2277 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
2263 another locking bug reported by Jorgen. I'm not 100% sure though,
2278 another locking bug reported by Jorgen. I'm not 100% sure though,
2264 so more testing is needed...
2279 so more testing is needed...
2265
2280
2266 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
2281 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
2267
2282
2268 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
2283 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
2269 local variables from any routine in user code (typically executed
2284 local variables from any routine in user code (typically executed
2270 with %run) directly into the interactive namespace. Very useful
2285 with %run) directly into the interactive namespace. Very useful
2271 when doing complex debugging.
2286 when doing complex debugging.
2272 (IPythonNotRunning): Changed the default None object to a dummy
2287 (IPythonNotRunning): Changed the default None object to a dummy
2273 whose attributes can be queried as well as called without
2288 whose attributes can be queried as well as called without
2274 exploding, to ease writing code which works transparently both in
2289 exploding, to ease writing code which works transparently both in
2275 and out of ipython and uses some of this API.
2290 and out of ipython and uses some of this API.
2276
2291
2277 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
2292 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
2278
2293
2279 * IPython/hooks.py (result_display): Fix the fact that our display
2294 * IPython/hooks.py (result_display): Fix the fact that our display
2280 hook was using str() instead of repr(), as the default python
2295 hook was using str() instead of repr(), as the default python
2281 console does. This had gone unnoticed b/c it only happened if
2296 console does. This had gone unnoticed b/c it only happened if
2282 %Pprint was off, but the inconsistency was there.
2297 %Pprint was off, but the inconsistency was there.
2283
2298
2284 2006-05-15 Ville Vainio <vivainio@gmail.com>
2299 2006-05-15 Ville Vainio <vivainio@gmail.com>
2285
2300
2286 * Oinspect.py: Only show docstring for nonexisting/binary files
2301 * Oinspect.py: Only show docstring for nonexisting/binary files
2287 when doing object??, closing ticket #62
2302 when doing object??, closing ticket #62
2288
2303
2289 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
2304 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
2290
2305
2291 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
2306 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
2292 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
2307 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
2293 was being released in a routine which hadn't checked if it had
2308 was being released in a routine which hadn't checked if it had
2294 been the one to acquire it.
2309 been the one to acquire it.
2295
2310
2296 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
2311 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
2297
2312
2298 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
2313 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
2299
2314
2300 2006-04-11 Ville Vainio <vivainio@gmail.com>
2315 2006-04-11 Ville Vainio <vivainio@gmail.com>
2301
2316
2302 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
2317 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
2303 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
2318 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
2304 prefilters, allowing stuff like magics and aliases in the file.
2319 prefilters, allowing stuff like magics and aliases in the file.
2305
2320
2306 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
2321 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
2307 added. Supported now are "%clear in" and "%clear out" (clear input and
2322 added. Supported now are "%clear in" and "%clear out" (clear input and
2308 output history, respectively). Also fixed CachedOutput.flush to
2323 output history, respectively). Also fixed CachedOutput.flush to
2309 properly flush the output cache.
2324 properly flush the output cache.
2310
2325
2311 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
2326 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
2312 half-success (and fail explicitly).
2327 half-success (and fail explicitly).
2313
2328
2314 2006-03-28 Ville Vainio <vivainio@gmail.com>
2329 2006-03-28 Ville Vainio <vivainio@gmail.com>
2315
2330
2316 * iplib.py: Fix quoting of aliases so that only argless ones
2331 * iplib.py: Fix quoting of aliases so that only argless ones
2317 are quoted
2332 are quoted
2318
2333
2319 2006-03-28 Ville Vainio <vivainio@gmail.com>
2334 2006-03-28 Ville Vainio <vivainio@gmail.com>
2320
2335
2321 * iplib.py: Quote aliases with spaces in the name.
2336 * iplib.py: Quote aliases with spaces in the name.
2322 "c:\program files\blah\bin" is now legal alias target.
2337 "c:\program files\blah\bin" is now legal alias target.
2323
2338
2324 * ext_rehashdir.py: Space no longer allowed as arg
2339 * ext_rehashdir.py: Space no longer allowed as arg
2325 separator, since space is legal in path names.
2340 separator, since space is legal in path names.
2326
2341
2327 2006-03-16 Ville Vainio <vivainio@gmail.com>
2342 2006-03-16 Ville Vainio <vivainio@gmail.com>
2328
2343
2329 * upgrade_dir.py: Take path.py from Extensions, correcting
2344 * upgrade_dir.py: Take path.py from Extensions, correcting
2330 %upgrade magic
2345 %upgrade magic
2331
2346
2332 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
2347 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
2333
2348
2334 * hooks.py: Only enclose editor binary in quotes if legal and
2349 * hooks.py: Only enclose editor binary in quotes if legal and
2335 necessary (space in the name, and is an existing file). Fixes a bug
2350 necessary (space in the name, and is an existing file). Fixes a bug
2336 reported by Zachary Pincus.
2351 reported by Zachary Pincus.
2337
2352
2338 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
2353 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
2339
2354
2340 * Manual: thanks to a tip on proper color handling for Emacs, by
2355 * Manual: thanks to a tip on proper color handling for Emacs, by
2341 Eric J Haywiser <ejh1-AT-MIT.EDU>.
2356 Eric J Haywiser <ejh1-AT-MIT.EDU>.
2342
2357
2343 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
2358 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
2344 by applying the provided patch. Thanks to Liu Jin
2359 by applying the provided patch. Thanks to Liu Jin
2345 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
2360 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
2346 XEmacs/Linux, I'm trusting the submitter that it actually helps
2361 XEmacs/Linux, I'm trusting the submitter that it actually helps
2347 under win32/GNU Emacs. Will revisit if any problems are reported.
2362 under win32/GNU Emacs. Will revisit if any problems are reported.
2348
2363
2349 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2364 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2350
2365
2351 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
2366 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
2352 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
2367 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
2353
2368
2354 2006-03-12 Ville Vainio <vivainio@gmail.com>
2369 2006-03-12 Ville Vainio <vivainio@gmail.com>
2355
2370
2356 * Magic.py (magic_timeit): Added %timeit magic, contributed by
2371 * Magic.py (magic_timeit): Added %timeit magic, contributed by
2357 Torsten Marek.
2372 Torsten Marek.
2358
2373
2359 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2374 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2360
2375
2361 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
2376 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
2362 line ranges works again.
2377 line ranges works again.
2363
2378
2364 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
2379 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
2365
2380
2366 * IPython/iplib.py (showtraceback): add back sys.last_traceback
2381 * IPython/iplib.py (showtraceback): add back sys.last_traceback
2367 and friends, after a discussion with Zach Pincus on ipython-user.
2382 and friends, after a discussion with Zach Pincus on ipython-user.
2368 I'm not 100% sure, but after thinking about it quite a bit, it may
2383 I'm not 100% sure, but after thinking about it quite a bit, it may
2369 be OK. Testing with the multithreaded shells didn't reveal any
2384 be OK. Testing with the multithreaded shells didn't reveal any
2370 problems, but let's keep an eye out.
2385 problems, but let's keep an eye out.
2371
2386
2372 In the process, I fixed a few things which were calling
2387 In the process, I fixed a few things which were calling
2373 self.InteractiveTB() directly (like safe_execfile), which is a
2388 self.InteractiveTB() directly (like safe_execfile), which is a
2374 mistake: ALL exception reporting should be done by calling
2389 mistake: ALL exception reporting should be done by calling
2375 self.showtraceback(), which handles state and tab-completion and
2390 self.showtraceback(), which handles state and tab-completion and
2376 more.
2391 more.
2377
2392
2378 2006-03-01 Ville Vainio <vivainio@gmail.com>
2393 2006-03-01 Ville Vainio <vivainio@gmail.com>
2379
2394
2380 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
2395 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
2381 To use, do "from ipipe import *".
2396 To use, do "from ipipe import *".
2382
2397
2383 2006-02-24 Ville Vainio <vivainio@gmail.com>
2398 2006-02-24 Ville Vainio <vivainio@gmail.com>
2384
2399
2385 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
2400 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
2386 "cleanly" and safely than the older upgrade mechanism.
2401 "cleanly" and safely than the older upgrade mechanism.
2387
2402
2388 2006-02-21 Ville Vainio <vivainio@gmail.com>
2403 2006-02-21 Ville Vainio <vivainio@gmail.com>
2389
2404
2390 * Magic.py: %save works again.
2405 * Magic.py: %save works again.
2391
2406
2392 2006-02-15 Ville Vainio <vivainio@gmail.com>
2407 2006-02-15 Ville Vainio <vivainio@gmail.com>
2393
2408
2394 * Magic.py: %Pprint works again
2409 * Magic.py: %Pprint works again
2395
2410
2396 * Extensions/ipy_sane_defaults.py: Provide everything provided
2411 * Extensions/ipy_sane_defaults.py: Provide everything provided
2397 in default ipythonrc, to make it possible to have a completely empty
2412 in default ipythonrc, to make it possible to have a completely empty
2398 ipythonrc (and thus completely rc-file free configuration)
2413 ipythonrc (and thus completely rc-file free configuration)
2399
2414
2400 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
2415 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
2401
2416
2402 * IPython/hooks.py (editor): quote the call to the editor command,
2417 * IPython/hooks.py (editor): quote the call to the editor command,
2403 to allow commands with spaces in them. Problem noted by watching
2418 to allow commands with spaces in them. Problem noted by watching
2404 Ian Oswald's video about textpad under win32 at
2419 Ian Oswald's video about textpad under win32 at
2405 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
2420 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
2406
2421
2407 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2422 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2408 describing magics (we haven't used @ for a loong time).
2423 describing magics (we haven't used @ for a loong time).
2409
2424
2410 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2425 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2411 contributed by marienz to close
2426 contributed by marienz to close
2412 http://www.scipy.net/roundup/ipython/issue53.
2427 http://www.scipy.net/roundup/ipython/issue53.
2413
2428
2414 2006-02-10 Ville Vainio <vivainio@gmail.com>
2429 2006-02-10 Ville Vainio <vivainio@gmail.com>
2415
2430
2416 * genutils.py: getoutput now works in win32 too
2431 * genutils.py: getoutput now works in win32 too
2417
2432
2418 * completer.py: alias and magic completion only invoked
2433 * completer.py: alias and magic completion only invoked
2419 at the first "item" in the line, to avoid "cd %store"
2434 at the first "item" in the line, to avoid "cd %store"
2420 nonsense.
2435 nonsense.
2421
2436
2422 2006-02-09 Ville Vainio <vivainio@gmail.com>
2437 2006-02-09 Ville Vainio <vivainio@gmail.com>
2423
2438
2424 * test/*: Added a unit testing framework (finally).
2439 * test/*: Added a unit testing framework (finally).
2425 '%run runtests.py' to run test_*.
2440 '%run runtests.py' to run test_*.
2426
2441
2427 * ipapi.py: Exposed runlines and set_custom_exc
2442 * ipapi.py: Exposed runlines and set_custom_exc
2428
2443
2429 2006-02-07 Ville Vainio <vivainio@gmail.com>
2444 2006-02-07 Ville Vainio <vivainio@gmail.com>
2430
2445
2431 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2446 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2432 instead use "f(1 2)" as before.
2447 instead use "f(1 2)" as before.
2433
2448
2434 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2449 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2435
2450
2436 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2451 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2437 facilities, for demos processed by the IPython input filter
2452 facilities, for demos processed by the IPython input filter
2438 (IPythonDemo), and for running a script one-line-at-a-time as a
2453 (IPythonDemo), and for running a script one-line-at-a-time as a
2439 demo, both for pure Python (LineDemo) and for IPython-processed
2454 demo, both for pure Python (LineDemo) and for IPython-processed
2440 input (IPythonLineDemo). After a request by Dave Kohel, from the
2455 input (IPythonLineDemo). After a request by Dave Kohel, from the
2441 SAGE team.
2456 SAGE team.
2442 (Demo.edit): added an edit() method to the demo objects, to edit
2457 (Demo.edit): added an edit() method to the demo objects, to edit
2443 the in-memory copy of the last executed block.
2458 the in-memory copy of the last executed block.
2444
2459
2445 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2460 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2446 processing to %edit, %macro and %save. These commands can now be
2461 processing to %edit, %macro and %save. These commands can now be
2447 invoked on the unprocessed input as it was typed by the user
2462 invoked on the unprocessed input as it was typed by the user
2448 (without any prefilters applied). After requests by the SAGE team
2463 (without any prefilters applied). After requests by the SAGE team
2449 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2464 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2450
2465
2451 2006-02-01 Ville Vainio <vivainio@gmail.com>
2466 2006-02-01 Ville Vainio <vivainio@gmail.com>
2452
2467
2453 * setup.py, eggsetup.py: easy_install ipython==dev works
2468 * setup.py, eggsetup.py: easy_install ipython==dev works
2454 correctly now (on Linux)
2469 correctly now (on Linux)
2455
2470
2456 * ipy_user_conf,ipmaker: user config changes, removed spurious
2471 * ipy_user_conf,ipmaker: user config changes, removed spurious
2457 warnings
2472 warnings
2458
2473
2459 * iplib: if rc.banner is string, use it as is.
2474 * iplib: if rc.banner is string, use it as is.
2460
2475
2461 * Magic: %pycat accepts a string argument and pages it's contents.
2476 * Magic: %pycat accepts a string argument and pages it's contents.
2462
2477
2463
2478
2464 2006-01-30 Ville Vainio <vivainio@gmail.com>
2479 2006-01-30 Ville Vainio <vivainio@gmail.com>
2465
2480
2466 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2481 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2467 Now %store and bookmarks work through PickleShare, meaning that
2482 Now %store and bookmarks work through PickleShare, meaning that
2468 concurrent access is possible and all ipython sessions see the
2483 concurrent access is possible and all ipython sessions see the
2469 same database situation all the time, instead of snapshot of
2484 same database situation all the time, instead of snapshot of
2470 the situation when the session was started. Hence, %bookmark
2485 the situation when the session was started. Hence, %bookmark
2471 results are immediately accessible from othes sessions. The database
2486 results are immediately accessible from othes sessions. The database
2472 is also available for use by user extensions. See:
2487 is also available for use by user extensions. See:
2473 http://www.python.org/pypi/pickleshare
2488 http://www.python.org/pypi/pickleshare
2474
2489
2475 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2490 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2476
2491
2477 * aliases can now be %store'd
2492 * aliases can now be %store'd
2478
2493
2479 * path.py moved to Extensions so that pickleshare does not need
2494 * path.py moved to Extensions so that pickleshare does not need
2480 IPython-specific import. Extensions added to pythonpath right
2495 IPython-specific import. Extensions added to pythonpath right
2481 at __init__.
2496 at __init__.
2482
2497
2483 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2498 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2484 called with _ip.system and the pre-transformed command string.
2499 called with _ip.system and the pre-transformed command string.
2485
2500
2486 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2501 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2487
2502
2488 * IPython/iplib.py (interact): Fix that we were not catching
2503 * IPython/iplib.py (interact): Fix that we were not catching
2489 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2504 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2490 logic here had to change, but it's fixed now.
2505 logic here had to change, but it's fixed now.
2491
2506
2492 2006-01-29 Ville Vainio <vivainio@gmail.com>
2507 2006-01-29 Ville Vainio <vivainio@gmail.com>
2493
2508
2494 * iplib.py: Try to import pyreadline on Windows.
2509 * iplib.py: Try to import pyreadline on Windows.
2495
2510
2496 2006-01-27 Ville Vainio <vivainio@gmail.com>
2511 2006-01-27 Ville Vainio <vivainio@gmail.com>
2497
2512
2498 * iplib.py: Expose ipapi as _ip in builtin namespace.
2513 * iplib.py: Expose ipapi as _ip in builtin namespace.
2499 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2514 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2500 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2515 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2501 syntax now produce _ip.* variant of the commands.
2516 syntax now produce _ip.* variant of the commands.
2502
2517
2503 * "_ip.options().autoedit_syntax = 2" automatically throws
2518 * "_ip.options().autoedit_syntax = 2" automatically throws
2504 user to editor for syntax error correction without prompting.
2519 user to editor for syntax error correction without prompting.
2505
2520
2506 2006-01-27 Ville Vainio <vivainio@gmail.com>
2521 2006-01-27 Ville Vainio <vivainio@gmail.com>
2507
2522
2508 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2523 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2509 'ipython' at argv[0]) executed through command line.
2524 'ipython' at argv[0]) executed through command line.
2510 NOTE: this DEPRECATES calling ipython with multiple scripts
2525 NOTE: this DEPRECATES calling ipython with multiple scripts
2511 ("ipython a.py b.py c.py")
2526 ("ipython a.py b.py c.py")
2512
2527
2513 * iplib.py, hooks.py: Added configurable input prefilter,
2528 * iplib.py, hooks.py: Added configurable input prefilter,
2514 named 'input_prefilter'. See ext_rescapture.py for example
2529 named 'input_prefilter'. See ext_rescapture.py for example
2515 usage.
2530 usage.
2516
2531
2517 * ext_rescapture.py, Magic.py: Better system command output capture
2532 * ext_rescapture.py, Magic.py: Better system command output capture
2518 through 'var = !ls' (deprecates user-visible %sc). Same notation
2533 through 'var = !ls' (deprecates user-visible %sc). Same notation
2519 applies for magics, 'var = %alias' assigns alias list to var.
2534 applies for magics, 'var = %alias' assigns alias list to var.
2520
2535
2521 * ipapi.py: added meta() for accessing extension-usable data store.
2536 * ipapi.py: added meta() for accessing extension-usable data store.
2522
2537
2523 * iplib.py: added InteractiveShell.getapi(). New magics should be
2538 * iplib.py: added InteractiveShell.getapi(). New magics should be
2524 written doing self.getapi() instead of using the shell directly.
2539 written doing self.getapi() instead of using the shell directly.
2525
2540
2526 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2541 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2527 %store foo >> ~/myfoo.txt to store variables to files (in clean
2542 %store foo >> ~/myfoo.txt to store variables to files (in clean
2528 textual form, not a restorable pickle).
2543 textual form, not a restorable pickle).
2529
2544
2530 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2545 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2531
2546
2532 * usage.py, Magic.py: added %quickref
2547 * usage.py, Magic.py: added %quickref
2533
2548
2534 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2549 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2535
2550
2536 * GetoptErrors when invoking magics etc. with wrong args
2551 * GetoptErrors when invoking magics etc. with wrong args
2537 are now more helpful:
2552 are now more helpful:
2538 GetoptError: option -l not recognized (allowed: "qb" )
2553 GetoptError: option -l not recognized (allowed: "qb" )
2539
2554
2540 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2555 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2541
2556
2542 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2557 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2543 computationally intensive blocks don't appear to stall the demo.
2558 computationally intensive blocks don't appear to stall the demo.
2544
2559
2545 2006-01-24 Ville Vainio <vivainio@gmail.com>
2560 2006-01-24 Ville Vainio <vivainio@gmail.com>
2546
2561
2547 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2562 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2548 value to manipulate resulting history entry.
2563 value to manipulate resulting history entry.
2549
2564
2550 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2565 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2551 to instance methods of IPApi class, to make extending an embedded
2566 to instance methods of IPApi class, to make extending an embedded
2552 IPython feasible. See ext_rehashdir.py for example usage.
2567 IPython feasible. See ext_rehashdir.py for example usage.
2553
2568
2554 * Merged 1071-1076 from branches/0.7.1
2569 * Merged 1071-1076 from branches/0.7.1
2555
2570
2556
2571
2557 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2572 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2558
2573
2559 * tools/release (daystamp): Fix build tools to use the new
2574 * tools/release (daystamp): Fix build tools to use the new
2560 eggsetup.py script to build lightweight eggs.
2575 eggsetup.py script to build lightweight eggs.
2561
2576
2562 * Applied changesets 1062 and 1064 before 0.7.1 release.
2577 * Applied changesets 1062 and 1064 before 0.7.1 release.
2563
2578
2564 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2579 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2565 see the raw input history (without conversions like %ls ->
2580 see the raw input history (without conversions like %ls ->
2566 ipmagic("ls")). After a request from W. Stein, SAGE
2581 ipmagic("ls")). After a request from W. Stein, SAGE
2567 (http://modular.ucsd.edu/sage) developer. This information is
2582 (http://modular.ucsd.edu/sage) developer. This information is
2568 stored in the input_hist_raw attribute of the IPython instance, so
2583 stored in the input_hist_raw attribute of the IPython instance, so
2569 developers can access it if needed (it's an InputList instance).
2584 developers can access it if needed (it's an InputList instance).
2570
2585
2571 * Versionstring = 0.7.2.svn
2586 * Versionstring = 0.7.2.svn
2572
2587
2573 * eggsetup.py: A separate script for constructing eggs, creates
2588 * eggsetup.py: A separate script for constructing eggs, creates
2574 proper launch scripts even on Windows (an .exe file in
2589 proper launch scripts even on Windows (an .exe file in
2575 \python24\scripts).
2590 \python24\scripts).
2576
2591
2577 * ipapi.py: launch_new_instance, launch entry point needed for the
2592 * ipapi.py: launch_new_instance, launch entry point needed for the
2578 egg.
2593 egg.
2579
2594
2580 2006-01-23 Ville Vainio <vivainio@gmail.com>
2595 2006-01-23 Ville Vainio <vivainio@gmail.com>
2581
2596
2582 * Added %cpaste magic for pasting python code
2597 * Added %cpaste magic for pasting python code
2583
2598
2584 2006-01-22 Ville Vainio <vivainio@gmail.com>
2599 2006-01-22 Ville Vainio <vivainio@gmail.com>
2585
2600
2586 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2601 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2587
2602
2588 * Versionstring = 0.7.2.svn
2603 * Versionstring = 0.7.2.svn
2589
2604
2590 * eggsetup.py: A separate script for constructing eggs, creates
2605 * eggsetup.py: A separate script for constructing eggs, creates
2591 proper launch scripts even on Windows (an .exe file in
2606 proper launch scripts even on Windows (an .exe file in
2592 \python24\scripts).
2607 \python24\scripts).
2593
2608
2594 * ipapi.py: launch_new_instance, launch entry point needed for the
2609 * ipapi.py: launch_new_instance, launch entry point needed for the
2595 egg.
2610 egg.
2596
2611
2597 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2612 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2598
2613
2599 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2614 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2600 %pfile foo would print the file for foo even if it was a binary.
2615 %pfile foo would print the file for foo even if it was a binary.
2601 Now, extensions '.so' and '.dll' are skipped.
2616 Now, extensions '.so' and '.dll' are skipped.
2602
2617
2603 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2618 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2604 bug, where macros would fail in all threaded modes. I'm not 100%
2619 bug, where macros would fail in all threaded modes. I'm not 100%
2605 sure, so I'm going to put out an rc instead of making a release
2620 sure, so I'm going to put out an rc instead of making a release
2606 today, and wait for feedback for at least a few days.
2621 today, and wait for feedback for at least a few days.
2607
2622
2608 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2623 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2609 it...) the handling of pasting external code with autoindent on.
2624 it...) the handling of pasting external code with autoindent on.
2610 To get out of a multiline input, the rule will appear for most
2625 To get out of a multiline input, the rule will appear for most
2611 users unchanged: two blank lines or change the indent level
2626 users unchanged: two blank lines or change the indent level
2612 proposed by IPython. But there is a twist now: you can
2627 proposed by IPython. But there is a twist now: you can
2613 add/subtract only *one or two spaces*. If you add/subtract three
2628 add/subtract only *one or two spaces*. If you add/subtract three
2614 or more (unless you completely delete the line), IPython will
2629 or more (unless you completely delete the line), IPython will
2615 accept that line, and you'll need to enter a second one of pure
2630 accept that line, and you'll need to enter a second one of pure
2616 whitespace. I know it sounds complicated, but I can't find a
2631 whitespace. I know it sounds complicated, but I can't find a
2617 different solution that covers all the cases, with the right
2632 different solution that covers all the cases, with the right
2618 heuristics. Hopefully in actual use, nobody will really notice
2633 heuristics. Hopefully in actual use, nobody will really notice
2619 all these strange rules and things will 'just work'.
2634 all these strange rules and things will 'just work'.
2620
2635
2621 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2636 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2622
2637
2623 * IPython/iplib.py (interact): catch exceptions which can be
2638 * IPython/iplib.py (interact): catch exceptions which can be
2624 triggered asynchronously by signal handlers. Thanks to an
2639 triggered asynchronously by signal handlers. Thanks to an
2625 automatic crash report, submitted by Colin Kingsley
2640 automatic crash report, submitted by Colin Kingsley
2626 <tercel-AT-gentoo.org>.
2641 <tercel-AT-gentoo.org>.
2627
2642
2628 2006-01-20 Ville Vainio <vivainio@gmail.com>
2643 2006-01-20 Ville Vainio <vivainio@gmail.com>
2629
2644
2630 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2645 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2631 (%rehashdir, very useful, try it out) of how to extend ipython
2646 (%rehashdir, very useful, try it out) of how to extend ipython
2632 with new magics. Also added Extensions dir to pythonpath to make
2647 with new magics. Also added Extensions dir to pythonpath to make
2633 importing extensions easy.
2648 importing extensions easy.
2634
2649
2635 * %store now complains when trying to store interactively declared
2650 * %store now complains when trying to store interactively declared
2636 classes / instances of those classes.
2651 classes / instances of those classes.
2637
2652
2638 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2653 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2639 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2654 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2640 if they exist, and ipy_user_conf.py with some defaults is created for
2655 if they exist, and ipy_user_conf.py with some defaults is created for
2641 the user.
2656 the user.
2642
2657
2643 * Startup rehashing done by the config file, not InterpreterExec.
2658 * Startup rehashing done by the config file, not InterpreterExec.
2644 This means system commands are available even without selecting the
2659 This means system commands are available even without selecting the
2645 pysh profile. It's the sensible default after all.
2660 pysh profile. It's the sensible default after all.
2646
2661
2647 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2662 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2648
2663
2649 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2664 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2650 multiline code with autoindent on working. But I am really not
2665 multiline code with autoindent on working. But I am really not
2651 sure, so this needs more testing. Will commit a debug-enabled
2666 sure, so this needs more testing. Will commit a debug-enabled
2652 version for now, while I test it some more, so that Ville and
2667 version for now, while I test it some more, so that Ville and
2653 others may also catch any problems. Also made
2668 others may also catch any problems. Also made
2654 self.indent_current_str() a method, to ensure that there's no
2669 self.indent_current_str() a method, to ensure that there's no
2655 chance of the indent space count and the corresponding string
2670 chance of the indent space count and the corresponding string
2656 falling out of sync. All code needing the string should just call
2671 falling out of sync. All code needing the string should just call
2657 the method.
2672 the method.
2658
2673
2659 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2674 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2660
2675
2661 * IPython/Magic.py (magic_edit): fix check for when users don't
2676 * IPython/Magic.py (magic_edit): fix check for when users don't
2662 save their output files, the try/except was in the wrong section.
2677 save their output files, the try/except was in the wrong section.
2663
2678
2664 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2679 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2665
2680
2666 * IPython/Magic.py (magic_run): fix __file__ global missing from
2681 * IPython/Magic.py (magic_run): fix __file__ global missing from
2667 script's namespace when executed via %run. After a report by
2682 script's namespace when executed via %run. After a report by
2668 Vivian.
2683 Vivian.
2669
2684
2670 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2685 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2671 when using python 2.4. The parent constructor changed in 2.4, and
2686 when using python 2.4. The parent constructor changed in 2.4, and
2672 we need to track it directly (we can't call it, as it messes up
2687 we need to track it directly (we can't call it, as it messes up
2673 readline and tab-completion inside our pdb would stop working).
2688 readline and tab-completion inside our pdb would stop working).
2674 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2689 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2675
2690
2676 2006-01-16 Ville Vainio <vivainio@gmail.com>
2691 2006-01-16 Ville Vainio <vivainio@gmail.com>
2677
2692
2678 * Ipython/magic.py: Reverted back to old %edit functionality
2693 * Ipython/magic.py: Reverted back to old %edit functionality
2679 that returns file contents on exit.
2694 that returns file contents on exit.
2680
2695
2681 * IPython/path.py: Added Jason Orendorff's "path" module to
2696 * IPython/path.py: Added Jason Orendorff's "path" module to
2682 IPython tree, http://www.jorendorff.com/articles/python/path/.
2697 IPython tree, http://www.jorendorff.com/articles/python/path/.
2683 You can get path objects conveniently through %sc, and !!, e.g.:
2698 You can get path objects conveniently through %sc, and !!, e.g.:
2684 sc files=ls
2699 sc files=ls
2685 for p in files.paths: # or files.p
2700 for p in files.paths: # or files.p
2686 print p,p.mtime
2701 print p,p.mtime
2687
2702
2688 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2703 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2689 now work again without considering the exclusion regexp -
2704 now work again without considering the exclusion regexp -
2690 hence, things like ',foo my/path' turn to 'foo("my/path")'
2705 hence, things like ',foo my/path' turn to 'foo("my/path")'
2691 instead of syntax error.
2706 instead of syntax error.
2692
2707
2693
2708
2694 2006-01-14 Ville Vainio <vivainio@gmail.com>
2709 2006-01-14 Ville Vainio <vivainio@gmail.com>
2695
2710
2696 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2711 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2697 ipapi decorators for python 2.4 users, options() provides access to rc
2712 ipapi decorators for python 2.4 users, options() provides access to rc
2698 data.
2713 data.
2699
2714
2700 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2715 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2701 as path separators (even on Linux ;-). Space character after
2716 as path separators (even on Linux ;-). Space character after
2702 backslash (as yielded by tab completer) is still space;
2717 backslash (as yielded by tab completer) is still space;
2703 "%cd long\ name" works as expected.
2718 "%cd long\ name" works as expected.
2704
2719
2705 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2720 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2706 as "chain of command", with priority. API stays the same,
2721 as "chain of command", with priority. API stays the same,
2707 TryNext exception raised by a hook function signals that
2722 TryNext exception raised by a hook function signals that
2708 current hook failed and next hook should try handling it, as
2723 current hook failed and next hook should try handling it, as
2709 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
2724 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
2710 requested configurable display hook, which is now implemented.
2725 requested configurable display hook, which is now implemented.
2711
2726
2712 2006-01-13 Ville Vainio <vivainio@gmail.com>
2727 2006-01-13 Ville Vainio <vivainio@gmail.com>
2713
2728
2714 * IPython/platutils*.py: platform specific utility functions,
2729 * IPython/platutils*.py: platform specific utility functions,
2715 so far only set_term_title is implemented (change terminal
2730 so far only set_term_title is implemented (change terminal
2716 label in windowing systems). %cd now changes the title to
2731 label in windowing systems). %cd now changes the title to
2717 current dir.
2732 current dir.
2718
2733
2719 * IPython/Release.py: Added myself to "authors" list,
2734 * IPython/Release.py: Added myself to "authors" list,
2720 had to create new files.
2735 had to create new files.
2721
2736
2722 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2737 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2723 shell escape; not a known bug but had potential to be one in the
2738 shell escape; not a known bug but had potential to be one in the
2724 future.
2739 future.
2725
2740
2726 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2741 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2727 extension API for IPython! See the module for usage example. Fix
2742 extension API for IPython! See the module for usage example. Fix
2728 OInspect for docstring-less magic functions.
2743 OInspect for docstring-less magic functions.
2729
2744
2730
2745
2731 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2746 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2732
2747
2733 * IPython/iplib.py (raw_input): temporarily deactivate all
2748 * IPython/iplib.py (raw_input): temporarily deactivate all
2734 attempts at allowing pasting of code with autoindent on. It
2749 attempts at allowing pasting of code with autoindent on. It
2735 introduced bugs (reported by Prabhu) and I can't seem to find a
2750 introduced bugs (reported by Prabhu) and I can't seem to find a
2736 robust combination which works in all cases. Will have to revisit
2751 robust combination which works in all cases. Will have to revisit
2737 later.
2752 later.
2738
2753
2739 * IPython/genutils.py: remove isspace() function. We've dropped
2754 * IPython/genutils.py: remove isspace() function. We've dropped
2740 2.2 compatibility, so it's OK to use the string method.
2755 2.2 compatibility, so it's OK to use the string method.
2741
2756
2742 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2757 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2743
2758
2744 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2759 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2745 matching what NOT to autocall on, to include all python binary
2760 matching what NOT to autocall on, to include all python binary
2746 operators (including things like 'and', 'or', 'is' and 'in').
2761 operators (including things like 'and', 'or', 'is' and 'in').
2747 Prompted by a bug report on 'foo & bar', but I realized we had
2762 Prompted by a bug report on 'foo & bar', but I realized we had
2748 many more potential bug cases with other operators. The regexp is
2763 many more potential bug cases with other operators. The regexp is
2749 self.re_exclude_auto, it's fairly commented.
2764 self.re_exclude_auto, it's fairly commented.
2750
2765
2751 2006-01-12 Ville Vainio <vivainio@gmail.com>
2766 2006-01-12 Ville Vainio <vivainio@gmail.com>
2752
2767
2753 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2768 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2754 Prettified and hardened string/backslash quoting with ipsystem(),
2769 Prettified and hardened string/backslash quoting with ipsystem(),
2755 ipalias() and ipmagic(). Now even \ characters are passed to
2770 ipalias() and ipmagic(). Now even \ characters are passed to
2756 %magics, !shell escapes and aliases exactly as they are in the
2771 %magics, !shell escapes and aliases exactly as they are in the
2757 ipython command line. Should improve backslash experience,
2772 ipython command line. Should improve backslash experience,
2758 particularly in Windows (path delimiter for some commands that
2773 particularly in Windows (path delimiter for some commands that
2759 won't understand '/'), but Unix benefits as well (regexps). %cd
2774 won't understand '/'), but Unix benefits as well (regexps). %cd
2760 magic still doesn't support backslash path delimiters, though. Also
2775 magic still doesn't support backslash path delimiters, though. Also
2761 deleted all pretense of supporting multiline command strings in
2776 deleted all pretense of supporting multiline command strings in
2762 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2777 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2763
2778
2764 * doc/build_doc_instructions.txt added. Documentation on how to
2779 * doc/build_doc_instructions.txt added. Documentation on how to
2765 use doc/update_manual.py, added yesterday. Both files contributed
2780 use doc/update_manual.py, added yesterday. Both files contributed
2766 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2781 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2767 doc/*.sh for deprecation at a later date.
2782 doc/*.sh for deprecation at a later date.
2768
2783
2769 * /ipython.py Added ipython.py to root directory for
2784 * /ipython.py Added ipython.py to root directory for
2770 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2785 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2771 ipython.py) and development convenience (no need to keep doing
2786 ipython.py) and development convenience (no need to keep doing
2772 "setup.py install" between changes).
2787 "setup.py install" between changes).
2773
2788
2774 * Made ! and !! shell escapes work (again) in multiline expressions:
2789 * Made ! and !! shell escapes work (again) in multiline expressions:
2775 if 1:
2790 if 1:
2776 !ls
2791 !ls
2777 !!ls
2792 !!ls
2778
2793
2779 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2794 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2780
2795
2781 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2796 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2782 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2797 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2783 module in case-insensitive installation. Was causing crashes
2798 module in case-insensitive installation. Was causing crashes
2784 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2799 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2785
2800
2786 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2801 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2787 <marienz-AT-gentoo.org>, closes
2802 <marienz-AT-gentoo.org>, closes
2788 http://www.scipy.net/roundup/ipython/issue51.
2803 http://www.scipy.net/roundup/ipython/issue51.
2789
2804
2790 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2805 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2791
2806
2792 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2807 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2793 problem of excessive CPU usage under *nix and keyboard lag under
2808 problem of excessive CPU usage under *nix and keyboard lag under
2794 win32.
2809 win32.
2795
2810
2796 2006-01-10 *** Released version 0.7.0
2811 2006-01-10 *** Released version 0.7.0
2797
2812
2798 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2813 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2799
2814
2800 * IPython/Release.py (revision): tag version number to 0.7.0,
2815 * IPython/Release.py (revision): tag version number to 0.7.0,
2801 ready for release.
2816 ready for release.
2802
2817
2803 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2818 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2804 it informs the user of the name of the temp. file used. This can
2819 it informs the user of the name of the temp. file used. This can
2805 help if you decide later to reuse that same file, so you know
2820 help if you decide later to reuse that same file, so you know
2806 where to copy the info from.
2821 where to copy the info from.
2807
2822
2808 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2823 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2809
2824
2810 * setup_bdist_egg.py: little script to build an egg. Added
2825 * setup_bdist_egg.py: little script to build an egg. Added
2811 support in the release tools as well.
2826 support in the release tools as well.
2812
2827
2813 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2828 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2814
2829
2815 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2830 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2816 version selection (new -wxversion command line and ipythonrc
2831 version selection (new -wxversion command line and ipythonrc
2817 parameter). Patch contributed by Arnd Baecker
2832 parameter). Patch contributed by Arnd Baecker
2818 <arnd.baecker-AT-web.de>.
2833 <arnd.baecker-AT-web.de>.
2819
2834
2820 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2835 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2821 embedded instances, for variables defined at the interactive
2836 embedded instances, for variables defined at the interactive
2822 prompt of the embedded ipython. Reported by Arnd.
2837 prompt of the embedded ipython. Reported by Arnd.
2823
2838
2824 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2839 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2825 it can be used as a (stateful) toggle, or with a direct parameter.
2840 it can be used as a (stateful) toggle, or with a direct parameter.
2826
2841
2827 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2842 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2828 could be triggered in certain cases and cause the traceback
2843 could be triggered in certain cases and cause the traceback
2829 printer not to work.
2844 printer not to work.
2830
2845
2831 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2846 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2832
2847
2833 * IPython/iplib.py (_should_recompile): Small fix, closes
2848 * IPython/iplib.py (_should_recompile): Small fix, closes
2834 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2849 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2835
2850
2836 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2851 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2837
2852
2838 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2853 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2839 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2854 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2840 Moad for help with tracking it down.
2855 Moad for help with tracking it down.
2841
2856
2842 * IPython/iplib.py (handle_auto): fix autocall handling for
2857 * IPython/iplib.py (handle_auto): fix autocall handling for
2843 objects which support BOTH __getitem__ and __call__ (so that f [x]
2858 objects which support BOTH __getitem__ and __call__ (so that f [x]
2844 is left alone, instead of becoming f([x]) automatically).
2859 is left alone, instead of becoming f([x]) automatically).
2845
2860
2846 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2861 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2847 Ville's patch.
2862 Ville's patch.
2848
2863
2849 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2864 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2850
2865
2851 * IPython/iplib.py (handle_auto): changed autocall semantics to
2866 * IPython/iplib.py (handle_auto): changed autocall semantics to
2852 include 'smart' mode, where the autocall transformation is NOT
2867 include 'smart' mode, where the autocall transformation is NOT
2853 applied if there are no arguments on the line. This allows you to
2868 applied if there are no arguments on the line. This allows you to
2854 just type 'foo' if foo is a callable to see its internal form,
2869 just type 'foo' if foo is a callable to see its internal form,
2855 instead of having it called with no arguments (typically a
2870 instead of having it called with no arguments (typically a
2856 mistake). The old 'full' autocall still exists: for that, you
2871 mistake). The old 'full' autocall still exists: for that, you
2857 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2872 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2858
2873
2859 * IPython/completer.py (Completer.attr_matches): add
2874 * IPython/completer.py (Completer.attr_matches): add
2860 tab-completion support for Enthoughts' traits. After a report by
2875 tab-completion support for Enthoughts' traits. After a report by
2861 Arnd and a patch by Prabhu.
2876 Arnd and a patch by Prabhu.
2862
2877
2863 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2878 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2864
2879
2865 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2880 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2866 Schmolck's patch to fix inspect.getinnerframes().
2881 Schmolck's patch to fix inspect.getinnerframes().
2867
2882
2868 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2883 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2869 for embedded instances, regarding handling of namespaces and items
2884 for embedded instances, regarding handling of namespaces and items
2870 added to the __builtin__ one. Multiple embedded instances and
2885 added to the __builtin__ one. Multiple embedded instances and
2871 recursive embeddings should work better now (though I'm not sure
2886 recursive embeddings should work better now (though I'm not sure
2872 I've got all the corner cases fixed, that code is a bit of a brain
2887 I've got all the corner cases fixed, that code is a bit of a brain
2873 twister).
2888 twister).
2874
2889
2875 * IPython/Magic.py (magic_edit): added support to edit in-memory
2890 * IPython/Magic.py (magic_edit): added support to edit in-memory
2876 macros (automatically creates the necessary temp files). %edit
2891 macros (automatically creates the necessary temp files). %edit
2877 also doesn't return the file contents anymore, it's just noise.
2892 also doesn't return the file contents anymore, it's just noise.
2878
2893
2879 * IPython/completer.py (Completer.attr_matches): revert change to
2894 * IPython/completer.py (Completer.attr_matches): revert change to
2880 complete only on attributes listed in __all__. I realized it
2895 complete only on attributes listed in __all__. I realized it
2881 cripples the tab-completion system as a tool for exploring the
2896 cripples the tab-completion system as a tool for exploring the
2882 internals of unknown libraries (it renders any non-__all__
2897 internals of unknown libraries (it renders any non-__all__
2883 attribute off-limits). I got bit by this when trying to see
2898 attribute off-limits). I got bit by this when trying to see
2884 something inside the dis module.
2899 something inside the dis module.
2885
2900
2886 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2901 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2887
2902
2888 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2903 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2889 namespace for users and extension writers to hold data in. This
2904 namespace for users and extension writers to hold data in. This
2890 follows the discussion in
2905 follows the discussion in
2891 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2906 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2892
2907
2893 * IPython/completer.py (IPCompleter.complete): small patch to help
2908 * IPython/completer.py (IPCompleter.complete): small patch to help
2894 tab-completion under Emacs, after a suggestion by John Barnard
2909 tab-completion under Emacs, after a suggestion by John Barnard
2895 <barnarj-AT-ccf.org>.
2910 <barnarj-AT-ccf.org>.
2896
2911
2897 * IPython/Magic.py (Magic.extract_input_slices): added support for
2912 * IPython/Magic.py (Magic.extract_input_slices): added support for
2898 the slice notation in magics to use N-M to represent numbers N...M
2913 the slice notation in magics to use N-M to represent numbers N...M
2899 (closed endpoints). This is used by %macro and %save.
2914 (closed endpoints). This is used by %macro and %save.
2900
2915
2901 * IPython/completer.py (Completer.attr_matches): for modules which
2916 * IPython/completer.py (Completer.attr_matches): for modules which
2902 define __all__, complete only on those. After a patch by Jeffrey
2917 define __all__, complete only on those. After a patch by Jeffrey
2903 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2918 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2904 speed up this routine.
2919 speed up this routine.
2905
2920
2906 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2921 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2907 don't know if this is the end of it, but the behavior now is
2922 don't know if this is the end of it, but the behavior now is
2908 certainly much more correct. Note that coupled with macros,
2923 certainly much more correct. Note that coupled with macros,
2909 slightly surprising (at first) behavior may occur: a macro will in
2924 slightly surprising (at first) behavior may occur: a macro will in
2910 general expand to multiple lines of input, so upon exiting, the
2925 general expand to multiple lines of input, so upon exiting, the
2911 in/out counters will both be bumped by the corresponding amount
2926 in/out counters will both be bumped by the corresponding amount
2912 (as if the macro's contents had been typed interactively). Typing
2927 (as if the macro's contents had been typed interactively). Typing
2913 %hist will reveal the intermediate (silently processed) lines.
2928 %hist will reveal the intermediate (silently processed) lines.
2914
2929
2915 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2930 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2916 pickle to fail (%run was overwriting __main__ and not restoring
2931 pickle to fail (%run was overwriting __main__ and not restoring
2917 it, but pickle relies on __main__ to operate).
2932 it, but pickle relies on __main__ to operate).
2918
2933
2919 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2934 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2920 using properties, but forgot to make the main InteractiveShell
2935 using properties, but forgot to make the main InteractiveShell
2921 class a new-style class. Properties fail silently, and
2936 class a new-style class. Properties fail silently, and
2922 mysteriously, with old-style class (getters work, but
2937 mysteriously, with old-style class (getters work, but
2923 setters don't do anything).
2938 setters don't do anything).
2924
2939
2925 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2940 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2926
2941
2927 * IPython/Magic.py (magic_history): fix history reporting bug (I
2942 * IPython/Magic.py (magic_history): fix history reporting bug (I
2928 know some nasties are still there, I just can't seem to find a
2943 know some nasties are still there, I just can't seem to find a
2929 reproducible test case to track them down; the input history is
2944 reproducible test case to track them down; the input history is
2930 falling out of sync...)
2945 falling out of sync...)
2931
2946
2932 * IPython/iplib.py (handle_shell_escape): fix bug where both
2947 * IPython/iplib.py (handle_shell_escape): fix bug where both
2933 aliases and system accesses where broken for indented code (such
2948 aliases and system accesses where broken for indented code (such
2934 as loops).
2949 as loops).
2935
2950
2936 * IPython/genutils.py (shell): fix small but critical bug for
2951 * IPython/genutils.py (shell): fix small but critical bug for
2937 win32 system access.
2952 win32 system access.
2938
2953
2939 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2954 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2940
2955
2941 * IPython/iplib.py (showtraceback): remove use of the
2956 * IPython/iplib.py (showtraceback): remove use of the
2942 sys.last_{type/value/traceback} structures, which are non
2957 sys.last_{type/value/traceback} structures, which are non
2943 thread-safe.
2958 thread-safe.
2944 (_prefilter): change control flow to ensure that we NEVER
2959 (_prefilter): change control flow to ensure that we NEVER
2945 introspect objects when autocall is off. This will guarantee that
2960 introspect objects when autocall is off. This will guarantee that
2946 having an input line of the form 'x.y', where access to attribute
2961 having an input line of the form 'x.y', where access to attribute
2947 'y' has side effects, doesn't trigger the side effect TWICE. It
2962 'y' has side effects, doesn't trigger the side effect TWICE. It
2948 is important to note that, with autocall on, these side effects
2963 is important to note that, with autocall on, these side effects
2949 can still happen.
2964 can still happen.
2950 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2965 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2951 trio. IPython offers these three kinds of special calls which are
2966 trio. IPython offers these three kinds of special calls which are
2952 not python code, and it's a good thing to have their call method
2967 not python code, and it's a good thing to have their call method
2953 be accessible as pure python functions (not just special syntax at
2968 be accessible as pure python functions (not just special syntax at
2954 the command line). It gives us a better internal implementation
2969 the command line). It gives us a better internal implementation
2955 structure, as well as exposing these for user scripting more
2970 structure, as well as exposing these for user scripting more
2956 cleanly.
2971 cleanly.
2957
2972
2958 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2973 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2959 file. Now that they'll be more likely to be used with the
2974 file. Now that they'll be more likely to be used with the
2960 persistance system (%store), I want to make sure their module path
2975 persistance system (%store), I want to make sure their module path
2961 doesn't change in the future, so that we don't break things for
2976 doesn't change in the future, so that we don't break things for
2962 users' persisted data.
2977 users' persisted data.
2963
2978
2964 * IPython/iplib.py (autoindent_update): move indentation
2979 * IPython/iplib.py (autoindent_update): move indentation
2965 management into the _text_ processing loop, not the keyboard
2980 management into the _text_ processing loop, not the keyboard
2966 interactive one. This is necessary to correctly process non-typed
2981 interactive one. This is necessary to correctly process non-typed
2967 multiline input (such as macros).
2982 multiline input (such as macros).
2968
2983
2969 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2984 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2970 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2985 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2971 which was producing problems in the resulting manual.
2986 which was producing problems in the resulting manual.
2972 (magic_whos): improve reporting of instances (show their class,
2987 (magic_whos): improve reporting of instances (show their class,
2973 instead of simply printing 'instance' which isn't terribly
2988 instead of simply printing 'instance' which isn't terribly
2974 informative).
2989 informative).
2975
2990
2976 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2991 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2977 (minor mods) to support network shares under win32.
2992 (minor mods) to support network shares under win32.
2978
2993
2979 * IPython/winconsole.py (get_console_size): add new winconsole
2994 * IPython/winconsole.py (get_console_size): add new winconsole
2980 module and fixes to page_dumb() to improve its behavior under
2995 module and fixes to page_dumb() to improve its behavior under
2981 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2996 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2982
2997
2983 * IPython/Magic.py (Macro): simplified Macro class to just
2998 * IPython/Magic.py (Macro): simplified Macro class to just
2984 subclass list. We've had only 2.2 compatibility for a very long
2999 subclass list. We've had only 2.2 compatibility for a very long
2985 time, yet I was still avoiding subclassing the builtin types. No
3000 time, yet I was still avoiding subclassing the builtin types. No
2986 more (I'm also starting to use properties, though I won't shift to
3001 more (I'm also starting to use properties, though I won't shift to
2987 2.3-specific features quite yet).
3002 2.3-specific features quite yet).
2988 (magic_store): added Ville's patch for lightweight variable
3003 (magic_store): added Ville's patch for lightweight variable
2989 persistence, after a request on the user list by Matt Wilkie
3004 persistence, after a request on the user list by Matt Wilkie
2990 <maphew-AT-gmail.com>. The new %store magic's docstring has full
3005 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2991 details.
3006 details.
2992
3007
2993 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3008 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2994 changed the default logfile name from 'ipython.log' to
3009 changed the default logfile name from 'ipython.log' to
2995 'ipython_log.py'. These logs are real python files, and now that
3010 'ipython_log.py'. These logs are real python files, and now that
2996 we have much better multiline support, people are more likely to
3011 we have much better multiline support, people are more likely to
2997 want to use them as such. Might as well name them correctly.
3012 want to use them as such. Might as well name them correctly.
2998
3013
2999 * IPython/Magic.py: substantial cleanup. While we can't stop
3014 * IPython/Magic.py: substantial cleanup. While we can't stop
3000 using magics as mixins, due to the existing customizations 'out
3015 using magics as mixins, due to the existing customizations 'out
3001 there' which rely on the mixin naming conventions, at least I
3016 there' which rely on the mixin naming conventions, at least I
3002 cleaned out all cross-class name usage. So once we are OK with
3017 cleaned out all cross-class name usage. So once we are OK with
3003 breaking compatibility, the two systems can be separated.
3018 breaking compatibility, the two systems can be separated.
3004
3019
3005 * IPython/Logger.py: major cleanup. This one is NOT a mixin
3020 * IPython/Logger.py: major cleanup. This one is NOT a mixin
3006 anymore, and the class is a fair bit less hideous as well. New
3021 anymore, and the class is a fair bit less hideous as well. New
3007 features were also introduced: timestamping of input, and logging
3022 features were also introduced: timestamping of input, and logging
3008 of output results. These are user-visible with the -t and -o
3023 of output results. These are user-visible with the -t and -o
3009 options to %logstart. Closes
3024 options to %logstart. Closes
3010 http://www.scipy.net/roundup/ipython/issue11 and a request by
3025 http://www.scipy.net/roundup/ipython/issue11 and a request by
3011 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
3026 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
3012
3027
3013 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
3028 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
3014
3029
3015 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
3030 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
3016 better handle backslashes in paths. See the thread 'More Windows
3031 better handle backslashes in paths. See the thread 'More Windows
3017 questions part 2 - \/ characters revisited' on the iypthon user
3032 questions part 2 - \/ characters revisited' on the iypthon user
3018 list:
3033 list:
3019 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
3034 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
3020
3035
3021 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
3036 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
3022
3037
3023 (InteractiveShell.__init__): change threaded shells to not use the
3038 (InteractiveShell.__init__): change threaded shells to not use the
3024 ipython crash handler. This was causing more problems than not,
3039 ipython crash handler. This was causing more problems than not,
3025 as exceptions in the main thread (GUI code, typically) would
3040 as exceptions in the main thread (GUI code, typically) would
3026 always show up as a 'crash', when they really weren't.
3041 always show up as a 'crash', when they really weren't.
3027
3042
3028 The colors and exception mode commands (%colors/%xmode) have been
3043 The colors and exception mode commands (%colors/%xmode) have been
3029 synchronized to also take this into account, so users can get
3044 synchronized to also take this into account, so users can get
3030 verbose exceptions for their threaded code as well. I also added
3045 verbose exceptions for their threaded code as well. I also added
3031 support for activating pdb inside this exception handler as well,
3046 support for activating pdb inside this exception handler as well,
3032 so now GUI authors can use IPython's enhanced pdb at runtime.
3047 so now GUI authors can use IPython's enhanced pdb at runtime.
3033
3048
3034 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
3049 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
3035 true by default, and add it to the shipped ipythonrc file. Since
3050 true by default, and add it to the shipped ipythonrc file. Since
3036 this asks the user before proceeding, I think it's OK to make it
3051 this asks the user before proceeding, I think it's OK to make it
3037 true by default.
3052 true by default.
3038
3053
3039 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
3054 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
3040 of the previous special-casing of input in the eval loop. I think
3055 of the previous special-casing of input in the eval loop. I think
3041 this is cleaner, as they really are commands and shouldn't have
3056 this is cleaner, as they really are commands and shouldn't have
3042 a special role in the middle of the core code.
3057 a special role in the middle of the core code.
3043
3058
3044 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
3059 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
3045
3060
3046 * IPython/iplib.py (edit_syntax_error): added support for
3061 * IPython/iplib.py (edit_syntax_error): added support for
3047 automatically reopening the editor if the file had a syntax error
3062 automatically reopening the editor if the file had a syntax error
3048 in it. Thanks to scottt who provided the patch at:
3063 in it. Thanks to scottt who provided the patch at:
3049 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
3064 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
3050 version committed).
3065 version committed).
3051
3066
3052 * IPython/iplib.py (handle_normal): add suport for multi-line
3067 * IPython/iplib.py (handle_normal): add suport for multi-line
3053 input with emtpy lines. This fixes
3068 input with emtpy lines. This fixes
3054 http://www.scipy.net/roundup/ipython/issue43 and a similar
3069 http://www.scipy.net/roundup/ipython/issue43 and a similar
3055 discussion on the user list.
3070 discussion on the user list.
3056
3071
3057 WARNING: a behavior change is necessarily introduced to support
3072 WARNING: a behavior change is necessarily introduced to support
3058 blank lines: now a single blank line with whitespace does NOT
3073 blank lines: now a single blank line with whitespace does NOT
3059 break the input loop, which means that when autoindent is on, by
3074 break the input loop, which means that when autoindent is on, by
3060 default hitting return on the next (indented) line does NOT exit.
3075 default hitting return on the next (indented) line does NOT exit.
3061
3076
3062 Instead, to exit a multiline input you can either have:
3077 Instead, to exit a multiline input you can either have:
3063
3078
3064 - TWO whitespace lines (just hit return again), or
3079 - TWO whitespace lines (just hit return again), or
3065 - a single whitespace line of a different length than provided
3080 - a single whitespace line of a different length than provided
3066 by the autoindent (add or remove a space).
3081 by the autoindent (add or remove a space).
3067
3082
3068 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
3083 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
3069 module to better organize all readline-related functionality.
3084 module to better organize all readline-related functionality.
3070 I've deleted FlexCompleter and put all completion clases here.
3085 I've deleted FlexCompleter and put all completion clases here.
3071
3086
3072 * IPython/iplib.py (raw_input): improve indentation management.
3087 * IPython/iplib.py (raw_input): improve indentation management.
3073 It is now possible to paste indented code with autoindent on, and
3088 It is now possible to paste indented code with autoindent on, and
3074 the code is interpreted correctly (though it still looks bad on
3089 the code is interpreted correctly (though it still looks bad on
3075 screen, due to the line-oriented nature of ipython).
3090 screen, due to the line-oriented nature of ipython).
3076 (MagicCompleter.complete): change behavior so that a TAB key on an
3091 (MagicCompleter.complete): change behavior so that a TAB key on an
3077 otherwise empty line actually inserts a tab, instead of completing
3092 otherwise empty line actually inserts a tab, instead of completing
3078 on the entire global namespace. This makes it easier to use the
3093 on the entire global namespace. This makes it easier to use the
3079 TAB key for indentation. After a request by Hans Meine
3094 TAB key for indentation. After a request by Hans Meine
3080 <hans_meine-AT-gmx.net>
3095 <hans_meine-AT-gmx.net>
3081 (_prefilter): add support so that typing plain 'exit' or 'quit'
3096 (_prefilter): add support so that typing plain 'exit' or 'quit'
3082 does a sensible thing. Originally I tried to deviate as little as
3097 does a sensible thing. Originally I tried to deviate as little as
3083 possible from the default python behavior, but even that one may
3098 possible from the default python behavior, but even that one may
3084 change in this direction (thread on python-dev to that effect).
3099 change in this direction (thread on python-dev to that effect).
3085 Regardless, ipython should do the right thing even if CPython's
3100 Regardless, ipython should do the right thing even if CPython's
3086 '>>>' prompt doesn't.
3101 '>>>' prompt doesn't.
3087 (InteractiveShell): removed subclassing code.InteractiveConsole
3102 (InteractiveShell): removed subclassing code.InteractiveConsole
3088 class. By now we'd overridden just about all of its methods: I've
3103 class. By now we'd overridden just about all of its methods: I've
3089 copied the remaining two over, and now ipython is a standalone
3104 copied the remaining two over, and now ipython is a standalone
3090 class. This will provide a clearer picture for the chainsaw
3105 class. This will provide a clearer picture for the chainsaw
3091 branch refactoring.
3106 branch refactoring.
3092
3107
3093 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
3108 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
3094
3109
3095 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
3110 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
3096 failures for objects which break when dir() is called on them.
3111 failures for objects which break when dir() is called on them.
3097
3112
3098 * IPython/FlexCompleter.py (Completer.__init__): Added support for
3113 * IPython/FlexCompleter.py (Completer.__init__): Added support for
3099 distinct local and global namespaces in the completer API. This
3114 distinct local and global namespaces in the completer API. This
3100 change allows us to properly handle completion with distinct
3115 change allows us to properly handle completion with distinct
3101 scopes, including in embedded instances (this had never really
3116 scopes, including in embedded instances (this had never really
3102 worked correctly).
3117 worked correctly).
3103
3118
3104 Note: this introduces a change in the constructor for
3119 Note: this introduces a change in the constructor for
3105 MagicCompleter, as a new global_namespace parameter is now the
3120 MagicCompleter, as a new global_namespace parameter is now the
3106 second argument (the others were bumped one position).
3121 second argument (the others were bumped one position).
3107
3122
3108 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
3123 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
3109
3124
3110 * IPython/iplib.py (embed_mainloop): fix tab-completion in
3125 * IPython/iplib.py (embed_mainloop): fix tab-completion in
3111 embedded instances (which can be done now thanks to Vivian's
3126 embedded instances (which can be done now thanks to Vivian's
3112 frame-handling fixes for pdb).
3127 frame-handling fixes for pdb).
3113 (InteractiveShell.__init__): Fix namespace handling problem in
3128 (InteractiveShell.__init__): Fix namespace handling problem in
3114 embedded instances. We were overwriting __main__ unconditionally,
3129 embedded instances. We were overwriting __main__ unconditionally,
3115 and this should only be done for 'full' (non-embedded) IPython;
3130 and this should only be done for 'full' (non-embedded) IPython;
3116 embedded instances must respect the caller's __main__. Thanks to
3131 embedded instances must respect the caller's __main__. Thanks to
3117 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
3132 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
3118
3133
3119 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
3134 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
3120
3135
3121 * setup.py: added download_url to setup(). This registers the
3136 * setup.py: added download_url to setup(). This registers the
3122 download address at PyPI, which is not only useful to humans
3137 download address at PyPI, which is not only useful to humans
3123 browsing the site, but is also picked up by setuptools (the Eggs
3138 browsing the site, but is also picked up by setuptools (the Eggs
3124 machinery). Thanks to Ville and R. Kern for the info/discussion
3139 machinery). Thanks to Ville and R. Kern for the info/discussion
3125 on this.
3140 on this.
3126
3141
3127 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
3142 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
3128
3143
3129 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
3144 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
3130 This brings a lot of nice functionality to the pdb mode, which now
3145 This brings a lot of nice functionality to the pdb mode, which now
3131 has tab-completion, syntax highlighting, and better stack handling
3146 has tab-completion, syntax highlighting, and better stack handling
3132 than before. Many thanks to Vivian De Smedt
3147 than before. Many thanks to Vivian De Smedt
3133 <vivian-AT-vdesmedt.com> for the original patches.
3148 <vivian-AT-vdesmedt.com> for the original patches.
3134
3149
3135 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
3150 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
3136
3151
3137 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
3152 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
3138 sequence to consistently accept the banner argument. The
3153 sequence to consistently accept the banner argument. The
3139 inconsistency was tripping SAGE, thanks to Gary Zablackis
3154 inconsistency was tripping SAGE, thanks to Gary Zablackis
3140 <gzabl-AT-yahoo.com> for the report.
3155 <gzabl-AT-yahoo.com> for the report.
3141
3156
3142 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
3157 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
3143
3158
3144 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3159 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3145 Fix bug where a naked 'alias' call in the ipythonrc file would
3160 Fix bug where a naked 'alias' call in the ipythonrc file would
3146 cause a crash. Bug reported by Jorgen Stenarson.
3161 cause a crash. Bug reported by Jorgen Stenarson.
3147
3162
3148 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
3163 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
3149
3164
3150 * IPython/ipmaker.py (make_IPython): cleanups which should improve
3165 * IPython/ipmaker.py (make_IPython): cleanups which should improve
3151 startup time.
3166 startup time.
3152
3167
3153 * IPython/iplib.py (runcode): my globals 'fix' for embedded
3168 * IPython/iplib.py (runcode): my globals 'fix' for embedded
3154 instances had introduced a bug with globals in normal code. Now
3169 instances had introduced a bug with globals in normal code. Now
3155 it's working in all cases.
3170 it's working in all cases.
3156
3171
3157 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
3172 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
3158 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
3173 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
3159 has been introduced to set the default case sensitivity of the
3174 has been introduced to set the default case sensitivity of the
3160 searches. Users can still select either mode at runtime on a
3175 searches. Users can still select either mode at runtime on a
3161 per-search basis.
3176 per-search basis.
3162
3177
3163 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
3178 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
3164
3179
3165 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
3180 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
3166 attributes in wildcard searches for subclasses. Modified version
3181 attributes in wildcard searches for subclasses. Modified version
3167 of a patch by Jorgen.
3182 of a patch by Jorgen.
3168
3183
3169 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
3184 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
3170
3185
3171 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
3186 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
3172 embedded instances. I added a user_global_ns attribute to the
3187 embedded instances. I added a user_global_ns attribute to the
3173 InteractiveShell class to handle this.
3188 InteractiveShell class to handle this.
3174
3189
3175 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
3190 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
3176
3191
3177 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
3192 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
3178 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
3193 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
3179 (reported under win32, but may happen also in other platforms).
3194 (reported under win32, but may happen also in other platforms).
3180 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
3195 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
3181
3196
3182 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
3197 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
3183
3198
3184 * IPython/Magic.py (magic_psearch): new support for wildcard
3199 * IPython/Magic.py (magic_psearch): new support for wildcard
3185 patterns. Now, typing ?a*b will list all names which begin with a
3200 patterns. Now, typing ?a*b will list all names which begin with a
3186 and end in b, for example. The %psearch magic has full
3201 and end in b, for example. The %psearch magic has full
3187 docstrings. Many thanks to Jörgen Stenarson
3202 docstrings. Many thanks to Jörgen Stenarson
3188 <jorgen.stenarson-AT-bostream.nu>, author of the patches
3203 <jorgen.stenarson-AT-bostream.nu>, author of the patches
3189 implementing this functionality.
3204 implementing this functionality.
3190
3205
3191 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
3206 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
3192
3207
3193 * Manual: fixed long-standing annoyance of double-dashes (as in
3208 * Manual: fixed long-standing annoyance of double-dashes (as in
3194 --prefix=~, for example) being stripped in the HTML version. This
3209 --prefix=~, for example) being stripped in the HTML version. This
3195 is a latex2html bug, but a workaround was provided. Many thanks
3210 is a latex2html bug, but a workaround was provided. Many thanks
3196 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
3211 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
3197 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
3212 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
3198 rolling. This seemingly small issue had tripped a number of users
3213 rolling. This seemingly small issue had tripped a number of users
3199 when first installing, so I'm glad to see it gone.
3214 when first installing, so I'm glad to see it gone.
3200
3215
3201 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
3216 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
3202
3217
3203 * IPython/Extensions/numeric_formats.py: fix missing import,
3218 * IPython/Extensions/numeric_formats.py: fix missing import,
3204 reported by Stephen Walton.
3219 reported by Stephen Walton.
3205
3220
3206 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
3221 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
3207
3222
3208 * IPython/demo.py: finish demo module, fully documented now.
3223 * IPython/demo.py: finish demo module, fully documented now.
3209
3224
3210 * IPython/genutils.py (file_read): simple little utility to read a
3225 * IPython/genutils.py (file_read): simple little utility to read a
3211 file and ensure it's closed afterwards.
3226 file and ensure it's closed afterwards.
3212
3227
3213 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
3228 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
3214
3229
3215 * IPython/demo.py (Demo.__init__): added support for individually
3230 * IPython/demo.py (Demo.__init__): added support for individually
3216 tagging blocks for automatic execution.
3231 tagging blocks for automatic execution.
3217
3232
3218 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
3233 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
3219 syntax-highlighted python sources, requested by John.
3234 syntax-highlighted python sources, requested by John.
3220
3235
3221 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
3236 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
3222
3237
3223 * IPython/demo.py (Demo.again): fix bug where again() blocks after
3238 * IPython/demo.py (Demo.again): fix bug where again() blocks after
3224 finishing.
3239 finishing.
3225
3240
3226 * IPython/genutils.py (shlex_split): moved from Magic to here,
3241 * IPython/genutils.py (shlex_split): moved from Magic to here,
3227 where all 2.2 compatibility stuff lives. I needed it for demo.py.
3242 where all 2.2 compatibility stuff lives. I needed it for demo.py.
3228
3243
3229 * IPython/demo.py (Demo.__init__): added support for silent
3244 * IPython/demo.py (Demo.__init__): added support for silent
3230 blocks, improved marks as regexps, docstrings written.
3245 blocks, improved marks as regexps, docstrings written.
3231 (Demo.__init__): better docstring, added support for sys.argv.
3246 (Demo.__init__): better docstring, added support for sys.argv.
3232
3247
3233 * IPython/genutils.py (marquee): little utility used by the demo
3248 * IPython/genutils.py (marquee): little utility used by the demo
3234 code, handy in general.
3249 code, handy in general.
3235
3250
3236 * IPython/demo.py (Demo.__init__): new class for interactive
3251 * IPython/demo.py (Demo.__init__): new class for interactive
3237 demos. Not documented yet, I just wrote it in a hurry for
3252 demos. Not documented yet, I just wrote it in a hurry for
3238 scipy'05. Will docstring later.
3253 scipy'05. Will docstring later.
3239
3254
3240 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
3255 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
3241
3256
3242 * IPython/Shell.py (sigint_handler): Drastic simplification which
3257 * IPython/Shell.py (sigint_handler): Drastic simplification which
3243 also seems to make Ctrl-C work correctly across threads! This is
3258 also seems to make Ctrl-C work correctly across threads! This is
3244 so simple, that I can't beleive I'd missed it before. Needs more
3259 so simple, that I can't beleive I'd missed it before. Needs more
3245 testing, though.
3260 testing, though.
3246 (KBINT): Never mind, revert changes. I'm sure I'd tried something
3261 (KBINT): Never mind, revert changes. I'm sure I'd tried something
3247 like this before...
3262 like this before...
3248
3263
3249 * IPython/genutils.py (get_home_dir): add protection against
3264 * IPython/genutils.py (get_home_dir): add protection against
3250 non-dirs in win32 registry.
3265 non-dirs in win32 registry.
3251
3266
3252 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
3267 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
3253 bug where dict was mutated while iterating (pysh crash).
3268 bug where dict was mutated while iterating (pysh crash).
3254
3269
3255 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
3270 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
3256
3271
3257 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
3272 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
3258 spurious newlines added by this routine. After a report by
3273 spurious newlines added by this routine. After a report by
3259 F. Mantegazza.
3274 F. Mantegazza.
3260
3275
3261 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
3276 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
3262
3277
3263 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
3278 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
3264 calls. These were a leftover from the GTK 1.x days, and can cause
3279 calls. These were a leftover from the GTK 1.x days, and can cause
3265 problems in certain cases (after a report by John Hunter).
3280 problems in certain cases (after a report by John Hunter).
3266
3281
3267 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
3282 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
3268 os.getcwd() fails at init time. Thanks to patch from David Remahl
3283 os.getcwd() fails at init time. Thanks to patch from David Remahl
3269 <chmod007-AT-mac.com>.
3284 <chmod007-AT-mac.com>.
3270 (InteractiveShell.__init__): prevent certain special magics from
3285 (InteractiveShell.__init__): prevent certain special magics from
3271 being shadowed by aliases. Closes
3286 being shadowed by aliases. Closes
3272 http://www.scipy.net/roundup/ipython/issue41.
3287 http://www.scipy.net/roundup/ipython/issue41.
3273
3288
3274 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
3289 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
3275
3290
3276 * IPython/iplib.py (InteractiveShell.complete): Added new
3291 * IPython/iplib.py (InteractiveShell.complete): Added new
3277 top-level completion method to expose the completion mechanism
3292 top-level completion method to expose the completion mechanism
3278 beyond readline-based environments.
3293 beyond readline-based environments.
3279
3294
3280 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
3295 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
3281
3296
3282 * tools/ipsvnc (svnversion): fix svnversion capture.
3297 * tools/ipsvnc (svnversion): fix svnversion capture.
3283
3298
3284 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
3299 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
3285 attribute to self, which was missing. Before, it was set by a
3300 attribute to self, which was missing. Before, it was set by a
3286 routine which in certain cases wasn't being called, so the
3301 routine which in certain cases wasn't being called, so the
3287 instance could end up missing the attribute. This caused a crash.
3302 instance could end up missing the attribute. This caused a crash.
3288 Closes http://www.scipy.net/roundup/ipython/issue40.
3303 Closes http://www.scipy.net/roundup/ipython/issue40.
3289
3304
3290 2005-08-16 Fernando Perez <fperez@colorado.edu>
3305 2005-08-16 Fernando Perez <fperez@colorado.edu>
3291
3306
3292 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
3307 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
3293 contains non-string attribute. Closes
3308 contains non-string attribute. Closes
3294 http://www.scipy.net/roundup/ipython/issue38.
3309 http://www.scipy.net/roundup/ipython/issue38.
3295
3310
3296 2005-08-14 Fernando Perez <fperez@colorado.edu>
3311 2005-08-14 Fernando Perez <fperez@colorado.edu>
3297
3312
3298 * tools/ipsvnc: Minor improvements, to add changeset info.
3313 * tools/ipsvnc: Minor improvements, to add changeset info.
3299
3314
3300 2005-08-12 Fernando Perez <fperez@colorado.edu>
3315 2005-08-12 Fernando Perez <fperez@colorado.edu>
3301
3316
3302 * IPython/iplib.py (runsource): remove self.code_to_run_src
3317 * IPython/iplib.py (runsource): remove self.code_to_run_src
3303 attribute. I realized this is nothing more than
3318 attribute. I realized this is nothing more than
3304 '\n'.join(self.buffer), and having the same data in two different
3319 '\n'.join(self.buffer), and having the same data in two different
3305 places is just asking for synchronization bugs. This may impact
3320 places is just asking for synchronization bugs. This may impact
3306 people who have custom exception handlers, so I need to warn
3321 people who have custom exception handlers, so I need to warn
3307 ipython-dev about it (F. Mantegazza may use them).
3322 ipython-dev about it (F. Mantegazza may use them).
3308
3323
3309 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
3324 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
3310
3325
3311 * IPython/genutils.py: fix 2.2 compatibility (generators)
3326 * IPython/genutils.py: fix 2.2 compatibility (generators)
3312
3327
3313 2005-07-18 Fernando Perez <fperez@colorado.edu>
3328 2005-07-18 Fernando Perez <fperez@colorado.edu>
3314
3329
3315 * IPython/genutils.py (get_home_dir): fix to help users with
3330 * IPython/genutils.py (get_home_dir): fix to help users with
3316 invalid $HOME under win32.
3331 invalid $HOME under win32.
3317
3332
3318 2005-07-17 Fernando Perez <fperez@colorado.edu>
3333 2005-07-17 Fernando Perez <fperez@colorado.edu>
3319
3334
3320 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
3335 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
3321 some old hacks and clean up a bit other routines; code should be
3336 some old hacks and clean up a bit other routines; code should be
3322 simpler and a bit faster.
3337 simpler and a bit faster.
3323
3338
3324 * IPython/iplib.py (interact): removed some last-resort attempts
3339 * IPython/iplib.py (interact): removed some last-resort attempts
3325 to survive broken stdout/stderr. That code was only making it
3340 to survive broken stdout/stderr. That code was only making it
3326 harder to abstract out the i/o (necessary for gui integration),
3341 harder to abstract out the i/o (necessary for gui integration),
3327 and the crashes it could prevent were extremely rare in practice
3342 and the crashes it could prevent were extremely rare in practice
3328 (besides being fully user-induced in a pretty violent manner).
3343 (besides being fully user-induced in a pretty violent manner).
3329
3344
3330 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
3345 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
3331 Nothing major yet, but the code is simpler to read; this should
3346 Nothing major yet, but the code is simpler to read; this should
3332 make it easier to do more serious modifications in the future.
3347 make it easier to do more serious modifications in the future.
3333
3348
3334 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
3349 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
3335 which broke in .15 (thanks to a report by Ville).
3350 which broke in .15 (thanks to a report by Ville).
3336
3351
3337 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
3352 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
3338 be quite correct, I know next to nothing about unicode). This
3353 be quite correct, I know next to nothing about unicode). This
3339 will allow unicode strings to be used in prompts, amongst other
3354 will allow unicode strings to be used in prompts, amongst other
3340 cases. It also will prevent ipython from crashing when unicode
3355 cases. It also will prevent ipython from crashing when unicode
3341 shows up unexpectedly in many places. If ascii encoding fails, we
3356 shows up unexpectedly in many places. If ascii encoding fails, we
3342 assume utf_8. Currently the encoding is not a user-visible
3357 assume utf_8. Currently the encoding is not a user-visible
3343 setting, though it could be made so if there is demand for it.
3358 setting, though it could be made so if there is demand for it.
3344
3359
3345 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
3360 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
3346
3361
3347 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
3362 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
3348
3363
3349 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
3364 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
3350
3365
3351 * IPython/genutils.py: Add 2.2 compatibility here, so all other
3366 * IPython/genutils.py: Add 2.2 compatibility here, so all other
3352 code can work transparently for 2.2/2.3.
3367 code can work transparently for 2.2/2.3.
3353
3368
3354 2005-07-16 Fernando Perez <fperez@colorado.edu>
3369 2005-07-16 Fernando Perez <fperez@colorado.edu>
3355
3370
3356 * IPython/ultraTB.py (ExceptionColors): Make a global variable
3371 * IPython/ultraTB.py (ExceptionColors): Make a global variable
3357 out of the color scheme table used for coloring exception
3372 out of the color scheme table used for coloring exception
3358 tracebacks. This allows user code to add new schemes at runtime.
3373 tracebacks. This allows user code to add new schemes at runtime.
3359 This is a minimally modified version of the patch at
3374 This is a minimally modified version of the patch at
3360 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
3375 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
3361 for the contribution.
3376 for the contribution.
3362
3377
3363 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
3378 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
3364 slightly modified version of the patch in
3379 slightly modified version of the patch in
3365 http://www.scipy.net/roundup/ipython/issue34, which also allows me
3380 http://www.scipy.net/roundup/ipython/issue34, which also allows me
3366 to remove the previous try/except solution (which was costlier).
3381 to remove the previous try/except solution (which was costlier).
3367 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
3382 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
3368
3383
3369 2005-06-08 Fernando Perez <fperez@colorado.edu>
3384 2005-06-08 Fernando Perez <fperez@colorado.edu>
3370
3385
3371 * IPython/iplib.py (write/write_err): Add methods to abstract all
3386 * IPython/iplib.py (write/write_err): Add methods to abstract all
3372 I/O a bit more.
3387 I/O a bit more.
3373
3388
3374 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
3389 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
3375 warning, reported by Aric Hagberg, fix by JD Hunter.
3390 warning, reported by Aric Hagberg, fix by JD Hunter.
3376
3391
3377 2005-06-02 *** Released version 0.6.15
3392 2005-06-02 *** Released version 0.6.15
3378
3393
3379 2005-06-01 Fernando Perez <fperez@colorado.edu>
3394 2005-06-01 Fernando Perez <fperez@colorado.edu>
3380
3395
3381 * IPython/iplib.py (MagicCompleter.file_matches): Fix
3396 * IPython/iplib.py (MagicCompleter.file_matches): Fix
3382 tab-completion of filenames within open-quoted strings. Note that
3397 tab-completion of filenames within open-quoted strings. Note that
3383 this requires that in ~/.ipython/ipythonrc, users change the
3398 this requires that in ~/.ipython/ipythonrc, users change the
3384 readline delimiters configuration to read:
3399 readline delimiters configuration to read:
3385
3400
3386 readline_remove_delims -/~
3401 readline_remove_delims -/~
3387
3402
3388
3403
3389 2005-05-31 *** Released version 0.6.14
3404 2005-05-31 *** Released version 0.6.14
3390
3405
3391 2005-05-29 Fernando Perez <fperez@colorado.edu>
3406 2005-05-29 Fernando Perez <fperez@colorado.edu>
3392
3407
3393 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
3408 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
3394 with files not on the filesystem. Reported by Eliyahu Sandler
3409 with files not on the filesystem. Reported by Eliyahu Sandler
3395 <eli@gondolin.net>
3410 <eli@gondolin.net>
3396
3411
3397 2005-05-22 Fernando Perez <fperez@colorado.edu>
3412 2005-05-22 Fernando Perez <fperez@colorado.edu>
3398
3413
3399 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
3414 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
3400 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
3415 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
3401
3416
3402 2005-05-19 Fernando Perez <fperez@colorado.edu>
3417 2005-05-19 Fernando Perez <fperez@colorado.edu>
3403
3418
3404 * IPython/iplib.py (safe_execfile): close a file which could be
3419 * IPython/iplib.py (safe_execfile): close a file which could be
3405 left open (causing problems in win32, which locks open files).
3420 left open (causing problems in win32, which locks open files).
3406 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
3421 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
3407
3422
3408 2005-05-18 Fernando Perez <fperez@colorado.edu>
3423 2005-05-18 Fernando Perez <fperez@colorado.edu>
3409
3424
3410 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3425 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3411 keyword arguments correctly to safe_execfile().
3426 keyword arguments correctly to safe_execfile().
3412
3427
3413 2005-05-13 Fernando Perez <fperez@colorado.edu>
3428 2005-05-13 Fernando Perez <fperez@colorado.edu>
3414
3429
3415 * ipython.1: Added info about Qt to manpage, and threads warning
3430 * ipython.1: Added info about Qt to manpage, and threads warning
3416 to usage page (invoked with --help).
3431 to usage page (invoked with --help).
3417
3432
3418 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3433 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3419 new matcher (it goes at the end of the priority list) to do
3434 new matcher (it goes at the end of the priority list) to do
3420 tab-completion on named function arguments. Submitted by George
3435 tab-completion on named function arguments. Submitted by George
3421 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3436 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3422 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3437 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3423 for more details.
3438 for more details.
3424
3439
3425 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3440 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3426 SystemExit exceptions in the script being run. Thanks to a report
3441 SystemExit exceptions in the script being run. Thanks to a report
3427 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3442 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3428 producing very annoying behavior when running unit tests.
3443 producing very annoying behavior when running unit tests.
3429
3444
3430 2005-05-12 Fernando Perez <fperez@colorado.edu>
3445 2005-05-12 Fernando Perez <fperez@colorado.edu>
3431
3446
3432 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3447 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3433 which I'd broken (again) due to a changed regexp. In the process,
3448 which I'd broken (again) due to a changed regexp. In the process,
3434 added ';' as an escape to auto-quote the whole line without
3449 added ';' as an escape to auto-quote the whole line without
3435 splitting its arguments. Thanks to a report by Jerry McRae
3450 splitting its arguments. Thanks to a report by Jerry McRae
3436 <qrs0xyc02-AT-sneakemail.com>.
3451 <qrs0xyc02-AT-sneakemail.com>.
3437
3452
3438 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3453 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3439 possible crashes caused by a TokenError. Reported by Ed Schofield
3454 possible crashes caused by a TokenError. Reported by Ed Schofield
3440 <schofield-AT-ftw.at>.
3455 <schofield-AT-ftw.at>.
3441
3456
3442 2005-05-06 Fernando Perez <fperez@colorado.edu>
3457 2005-05-06 Fernando Perez <fperez@colorado.edu>
3443
3458
3444 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3459 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3445
3460
3446 2005-04-29 Fernando Perez <fperez@colorado.edu>
3461 2005-04-29 Fernando Perez <fperez@colorado.edu>
3447
3462
3448 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3463 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3449 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3464 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3450 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3465 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3451 which provides support for Qt interactive usage (similar to the
3466 which provides support for Qt interactive usage (similar to the
3452 existing one for WX and GTK). This had been often requested.
3467 existing one for WX and GTK). This had been often requested.
3453
3468
3454 2005-04-14 *** Released version 0.6.13
3469 2005-04-14 *** Released version 0.6.13
3455
3470
3456 2005-04-08 Fernando Perez <fperez@colorado.edu>
3471 2005-04-08 Fernando Perez <fperez@colorado.edu>
3457
3472
3458 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3473 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3459 from _ofind, which gets called on almost every input line. Now,
3474 from _ofind, which gets called on almost every input line. Now,
3460 we only try to get docstrings if they are actually going to be
3475 we only try to get docstrings if they are actually going to be
3461 used (the overhead of fetching unnecessary docstrings can be
3476 used (the overhead of fetching unnecessary docstrings can be
3462 noticeable for certain objects, such as Pyro proxies).
3477 noticeable for certain objects, such as Pyro proxies).
3463
3478
3464 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3479 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3465 for completers. For some reason I had been passing them the state
3480 for completers. For some reason I had been passing them the state
3466 variable, which completers never actually need, and was in
3481 variable, which completers never actually need, and was in
3467 conflict with the rlcompleter API. Custom completers ONLY need to
3482 conflict with the rlcompleter API. Custom completers ONLY need to
3468 take the text parameter.
3483 take the text parameter.
3469
3484
3470 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3485 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3471 work correctly in pysh. I've also moved all the logic which used
3486 work correctly in pysh. I've also moved all the logic which used
3472 to be in pysh.py here, which will prevent problems with future
3487 to be in pysh.py here, which will prevent problems with future
3473 upgrades. However, this time I must warn users to update their
3488 upgrades. However, this time I must warn users to update their
3474 pysh profile to include the line
3489 pysh profile to include the line
3475
3490
3476 import_all IPython.Extensions.InterpreterExec
3491 import_all IPython.Extensions.InterpreterExec
3477
3492
3478 because otherwise things won't work for them. They MUST also
3493 because otherwise things won't work for them. They MUST also
3479 delete pysh.py and the line
3494 delete pysh.py and the line
3480
3495
3481 execfile pysh.py
3496 execfile pysh.py
3482
3497
3483 from their ipythonrc-pysh.
3498 from their ipythonrc-pysh.
3484
3499
3485 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3500 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3486 robust in the face of objects whose dir() returns non-strings
3501 robust in the face of objects whose dir() returns non-strings
3487 (which it shouldn't, but some broken libs like ITK do). Thanks to
3502 (which it shouldn't, but some broken libs like ITK do). Thanks to
3488 a patch by John Hunter (implemented differently, though). Also
3503 a patch by John Hunter (implemented differently, though). Also
3489 minor improvements by using .extend instead of + on lists.
3504 minor improvements by using .extend instead of + on lists.
3490
3505
3491 * pysh.py:
3506 * pysh.py:
3492
3507
3493 2005-04-06 Fernando Perez <fperez@colorado.edu>
3508 2005-04-06 Fernando Perez <fperez@colorado.edu>
3494
3509
3495 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3510 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3496 by default, so that all users benefit from it. Those who don't
3511 by default, so that all users benefit from it. Those who don't
3497 want it can still turn it off.
3512 want it can still turn it off.
3498
3513
3499 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3514 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3500 config file, I'd forgotten about this, so users were getting it
3515 config file, I'd forgotten about this, so users were getting it
3501 off by default.
3516 off by default.
3502
3517
3503 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3518 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3504 consistency. Now magics can be called in multiline statements,
3519 consistency. Now magics can be called in multiline statements,
3505 and python variables can be expanded in magic calls via $var.
3520 and python variables can be expanded in magic calls via $var.
3506 This makes the magic system behave just like aliases or !system
3521 This makes the magic system behave just like aliases or !system
3507 calls.
3522 calls.
3508
3523
3509 2005-03-28 Fernando Perez <fperez@colorado.edu>
3524 2005-03-28 Fernando Perez <fperez@colorado.edu>
3510
3525
3511 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3526 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3512 expensive string additions for building command. Add support for
3527 expensive string additions for building command. Add support for
3513 trailing ';' when autocall is used.
3528 trailing ';' when autocall is used.
3514
3529
3515 2005-03-26 Fernando Perez <fperez@colorado.edu>
3530 2005-03-26 Fernando Perez <fperez@colorado.edu>
3516
3531
3517 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3532 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3518 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3533 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3519 ipython.el robust against prompts with any number of spaces
3534 ipython.el robust against prompts with any number of spaces
3520 (including 0) after the ':' character.
3535 (including 0) after the ':' character.
3521
3536
3522 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3537 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3523 continuation prompt, which misled users to think the line was
3538 continuation prompt, which misled users to think the line was
3524 already indented. Closes debian Bug#300847, reported to me by
3539 already indented. Closes debian Bug#300847, reported to me by
3525 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3540 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3526
3541
3527 2005-03-23 Fernando Perez <fperez@colorado.edu>
3542 2005-03-23 Fernando Perez <fperez@colorado.edu>
3528
3543
3529 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3544 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3530 properly aligned if they have embedded newlines.
3545 properly aligned if they have embedded newlines.
3531
3546
3532 * IPython/iplib.py (runlines): Add a public method to expose
3547 * IPython/iplib.py (runlines): Add a public method to expose
3533 IPython's code execution machinery, so that users can run strings
3548 IPython's code execution machinery, so that users can run strings
3534 as if they had been typed at the prompt interactively.
3549 as if they had been typed at the prompt interactively.
3535 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3550 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3536 methods which can call the system shell, but with python variable
3551 methods which can call the system shell, but with python variable
3537 expansion. The three such methods are: __IPYTHON__.system,
3552 expansion. The three such methods are: __IPYTHON__.system,
3538 .getoutput and .getoutputerror. These need to be documented in a
3553 .getoutput and .getoutputerror. These need to be documented in a
3539 'public API' section (to be written) of the manual.
3554 'public API' section (to be written) of the manual.
3540
3555
3541 2005-03-20 Fernando Perez <fperez@colorado.edu>
3556 2005-03-20 Fernando Perez <fperez@colorado.edu>
3542
3557
3543 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3558 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3544 for custom exception handling. This is quite powerful, and it
3559 for custom exception handling. This is quite powerful, and it
3545 allows for user-installable exception handlers which can trap
3560 allows for user-installable exception handlers which can trap
3546 custom exceptions at runtime and treat them separately from
3561 custom exceptions at runtime and treat them separately from
3547 IPython's default mechanisms. At the request of Frédéric
3562 IPython's default mechanisms. At the request of Frédéric
3548 Mantegazza <mantegazza-AT-ill.fr>.
3563 Mantegazza <mantegazza-AT-ill.fr>.
3549 (InteractiveShell.set_custom_completer): public API function to
3564 (InteractiveShell.set_custom_completer): public API function to
3550 add new completers at runtime.
3565 add new completers at runtime.
3551
3566
3552 2005-03-19 Fernando Perez <fperez@colorado.edu>
3567 2005-03-19 Fernando Perez <fperez@colorado.edu>
3553
3568
3554 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3569 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3555 allow objects which provide their docstrings via non-standard
3570 allow objects which provide their docstrings via non-standard
3556 mechanisms (like Pyro proxies) to still be inspected by ipython's
3571 mechanisms (like Pyro proxies) to still be inspected by ipython's
3557 ? system.
3572 ? system.
3558
3573
3559 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3574 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3560 automatic capture system. I tried quite hard to make it work
3575 automatic capture system. I tried quite hard to make it work
3561 reliably, and simply failed. I tried many combinations with the
3576 reliably, and simply failed. I tried many combinations with the
3562 subprocess module, but eventually nothing worked in all needed
3577 subprocess module, but eventually nothing worked in all needed
3563 cases (not blocking stdin for the child, duplicating stdout
3578 cases (not blocking stdin for the child, duplicating stdout
3564 without blocking, etc). The new %sc/%sx still do capture to these
3579 without blocking, etc). The new %sc/%sx still do capture to these
3565 magical list/string objects which make shell use much more
3580 magical list/string objects which make shell use much more
3566 conveninent, so not all is lost.
3581 conveninent, so not all is lost.
3567
3582
3568 XXX - FIX MANUAL for the change above!
3583 XXX - FIX MANUAL for the change above!
3569
3584
3570 (runsource): I copied code.py's runsource() into ipython to modify
3585 (runsource): I copied code.py's runsource() into ipython to modify
3571 it a bit. Now the code object and source to be executed are
3586 it a bit. Now the code object and source to be executed are
3572 stored in ipython. This makes this info accessible to third-party
3587 stored in ipython. This makes this info accessible to third-party
3573 tools, like custom exception handlers. After a request by Frédéric
3588 tools, like custom exception handlers. After a request by Frédéric
3574 Mantegazza <mantegazza-AT-ill.fr>.
3589 Mantegazza <mantegazza-AT-ill.fr>.
3575
3590
3576 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3591 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3577 history-search via readline (like C-p/C-n). I'd wanted this for a
3592 history-search via readline (like C-p/C-n). I'd wanted this for a
3578 long time, but only recently found out how to do it. For users
3593 long time, but only recently found out how to do it. For users
3579 who already have their ipythonrc files made and want this, just
3594 who already have their ipythonrc files made and want this, just
3580 add:
3595 add:
3581
3596
3582 readline_parse_and_bind "\e[A": history-search-backward
3597 readline_parse_and_bind "\e[A": history-search-backward
3583 readline_parse_and_bind "\e[B": history-search-forward
3598 readline_parse_and_bind "\e[B": history-search-forward
3584
3599
3585 2005-03-18 Fernando Perez <fperez@colorado.edu>
3600 2005-03-18 Fernando Perez <fperez@colorado.edu>
3586
3601
3587 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3602 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3588 LSString and SList classes which allow transparent conversions
3603 LSString and SList classes which allow transparent conversions
3589 between list mode and whitespace-separated string.
3604 between list mode and whitespace-separated string.
3590 (magic_r): Fix recursion problem in %r.
3605 (magic_r): Fix recursion problem in %r.
3591
3606
3592 * IPython/genutils.py (LSString): New class to be used for
3607 * IPython/genutils.py (LSString): New class to be used for
3593 automatic storage of the results of all alias/system calls in _o
3608 automatic storage of the results of all alias/system calls in _o
3594 and _e (stdout/err). These provide a .l/.list attribute which
3609 and _e (stdout/err). These provide a .l/.list attribute which
3595 does automatic splitting on newlines. This means that for most
3610 does automatic splitting on newlines. This means that for most
3596 uses, you'll never need to do capturing of output with %sc/%sx
3611 uses, you'll never need to do capturing of output with %sc/%sx
3597 anymore, since ipython keeps this always done for you. Note that
3612 anymore, since ipython keeps this always done for you. Note that
3598 only the LAST results are stored, the _o/e variables are
3613 only the LAST results are stored, the _o/e variables are
3599 overwritten on each call. If you need to save their contents
3614 overwritten on each call. If you need to save their contents
3600 further, simply bind them to any other name.
3615 further, simply bind them to any other name.
3601
3616
3602 2005-03-17 Fernando Perez <fperez@colorado.edu>
3617 2005-03-17 Fernando Perez <fperez@colorado.edu>
3603
3618
3604 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3619 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3605 prompt namespace handling.
3620 prompt namespace handling.
3606
3621
3607 2005-03-16 Fernando Perez <fperez@colorado.edu>
3622 2005-03-16 Fernando Perez <fperez@colorado.edu>
3608
3623
3609 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3624 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3610 classic prompts to be '>>> ' (final space was missing, and it
3625 classic prompts to be '>>> ' (final space was missing, and it
3611 trips the emacs python mode).
3626 trips the emacs python mode).
3612 (BasePrompt.__str__): Added safe support for dynamic prompt
3627 (BasePrompt.__str__): Added safe support for dynamic prompt
3613 strings. Now you can set your prompt string to be '$x', and the
3628 strings. Now you can set your prompt string to be '$x', and the
3614 value of x will be printed from your interactive namespace. The
3629 value of x will be printed from your interactive namespace. The
3615 interpolation syntax includes the full Itpl support, so
3630 interpolation syntax includes the full Itpl support, so
3616 ${foo()+x+bar()} is a valid prompt string now, and the function
3631 ${foo()+x+bar()} is a valid prompt string now, and the function
3617 calls will be made at runtime.
3632 calls will be made at runtime.
3618
3633
3619 2005-03-15 Fernando Perez <fperez@colorado.edu>
3634 2005-03-15 Fernando Perez <fperez@colorado.edu>
3620
3635
3621 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3636 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3622 avoid name clashes in pylab. %hist still works, it just forwards
3637 avoid name clashes in pylab. %hist still works, it just forwards
3623 the call to %history.
3638 the call to %history.
3624
3639
3625 2005-03-02 *** Released version 0.6.12
3640 2005-03-02 *** Released version 0.6.12
3626
3641
3627 2005-03-02 Fernando Perez <fperez@colorado.edu>
3642 2005-03-02 Fernando Perez <fperez@colorado.edu>
3628
3643
3629 * IPython/iplib.py (handle_magic): log magic calls properly as
3644 * IPython/iplib.py (handle_magic): log magic calls properly as
3630 ipmagic() function calls.
3645 ipmagic() function calls.
3631
3646
3632 * IPython/Magic.py (magic_time): Improved %time to support
3647 * IPython/Magic.py (magic_time): Improved %time to support
3633 statements and provide wall-clock as well as CPU time.
3648 statements and provide wall-clock as well as CPU time.
3634
3649
3635 2005-02-27 Fernando Perez <fperez@colorado.edu>
3650 2005-02-27 Fernando Perez <fperez@colorado.edu>
3636
3651
3637 * IPython/hooks.py: New hooks module, to expose user-modifiable
3652 * IPython/hooks.py: New hooks module, to expose user-modifiable
3638 IPython functionality in a clean manner. For now only the editor
3653 IPython functionality in a clean manner. For now only the editor
3639 hook is actually written, and other thigns which I intend to turn
3654 hook is actually written, and other thigns which I intend to turn
3640 into proper hooks aren't yet there. The display and prefilter
3655 into proper hooks aren't yet there. The display and prefilter
3641 stuff, for example, should be hooks. But at least now the
3656 stuff, for example, should be hooks. But at least now the
3642 framework is in place, and the rest can be moved here with more
3657 framework is in place, and the rest can be moved here with more
3643 time later. IPython had had a .hooks variable for a long time for
3658 time later. IPython had had a .hooks variable for a long time for
3644 this purpose, but I'd never actually used it for anything.
3659 this purpose, but I'd never actually used it for anything.
3645
3660
3646 2005-02-26 Fernando Perez <fperez@colorado.edu>
3661 2005-02-26 Fernando Perez <fperez@colorado.edu>
3647
3662
3648 * IPython/ipmaker.py (make_IPython): make the default ipython
3663 * IPython/ipmaker.py (make_IPython): make the default ipython
3649 directory be called _ipython under win32, to follow more the
3664 directory be called _ipython under win32, to follow more the
3650 naming peculiarities of that platform (where buggy software like
3665 naming peculiarities of that platform (where buggy software like
3651 Visual Sourcesafe breaks with .named directories). Reported by
3666 Visual Sourcesafe breaks with .named directories). Reported by
3652 Ville Vainio.
3667 Ville Vainio.
3653
3668
3654 2005-02-23 Fernando Perez <fperez@colorado.edu>
3669 2005-02-23 Fernando Perez <fperez@colorado.edu>
3655
3670
3656 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3671 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3657 auto_aliases for win32 which were causing problems. Users can
3672 auto_aliases for win32 which were causing problems. Users can
3658 define the ones they personally like.
3673 define the ones they personally like.
3659
3674
3660 2005-02-21 Fernando Perez <fperez@colorado.edu>
3675 2005-02-21 Fernando Perez <fperez@colorado.edu>
3661
3676
3662 * IPython/Magic.py (magic_time): new magic to time execution of
3677 * IPython/Magic.py (magic_time): new magic to time execution of
3663 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3678 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3664
3679
3665 2005-02-19 Fernando Perez <fperez@colorado.edu>
3680 2005-02-19 Fernando Perez <fperez@colorado.edu>
3666
3681
3667 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3682 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3668 into keys (for prompts, for example).
3683 into keys (for prompts, for example).
3669
3684
3670 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3685 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3671 prompts in case users want them. This introduces a small behavior
3686 prompts in case users want them. This introduces a small behavior
3672 change: ipython does not automatically add a space to all prompts
3687 change: ipython does not automatically add a space to all prompts
3673 anymore. To get the old prompts with a space, users should add it
3688 anymore. To get the old prompts with a space, users should add it
3674 manually to their ipythonrc file, so for example prompt_in1 should
3689 manually to their ipythonrc file, so for example prompt_in1 should
3675 now read 'In [\#]: ' instead of 'In [\#]:'.
3690 now read 'In [\#]: ' instead of 'In [\#]:'.
3676 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3691 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3677 file) to control left-padding of secondary prompts.
3692 file) to control left-padding of secondary prompts.
3678
3693
3679 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3694 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3680 the profiler can't be imported. Fix for Debian, which removed
3695 the profiler can't be imported. Fix for Debian, which removed
3681 profile.py because of License issues. I applied a slightly
3696 profile.py because of License issues. I applied a slightly
3682 modified version of the original Debian patch at
3697 modified version of the original Debian patch at
3683 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3698 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3684
3699
3685 2005-02-17 Fernando Perez <fperez@colorado.edu>
3700 2005-02-17 Fernando Perez <fperez@colorado.edu>
3686
3701
3687 * IPython/genutils.py (native_line_ends): Fix bug which would
3702 * IPython/genutils.py (native_line_ends): Fix bug which would
3688 cause improper line-ends under win32 b/c I was not opening files
3703 cause improper line-ends under win32 b/c I was not opening files
3689 in binary mode. Bug report and fix thanks to Ville.
3704 in binary mode. Bug report and fix thanks to Ville.
3690
3705
3691 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3706 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3692 trying to catch spurious foo[1] autocalls. My fix actually broke
3707 trying to catch spurious foo[1] autocalls. My fix actually broke
3693 ',/' autoquote/call with explicit escape (bad regexp).
3708 ',/' autoquote/call with explicit escape (bad regexp).
3694
3709
3695 2005-02-15 *** Released version 0.6.11
3710 2005-02-15 *** Released version 0.6.11
3696
3711
3697 2005-02-14 Fernando Perez <fperez@colorado.edu>
3712 2005-02-14 Fernando Perez <fperez@colorado.edu>
3698
3713
3699 * IPython/background_jobs.py: New background job management
3714 * IPython/background_jobs.py: New background job management
3700 subsystem. This is implemented via a new set of classes, and
3715 subsystem. This is implemented via a new set of classes, and
3701 IPython now provides a builtin 'jobs' object for background job
3716 IPython now provides a builtin 'jobs' object for background job
3702 execution. A convenience %bg magic serves as a lightweight
3717 execution. A convenience %bg magic serves as a lightweight
3703 frontend for starting the more common type of calls. This was
3718 frontend for starting the more common type of calls. This was
3704 inspired by discussions with B. Granger and the BackgroundCommand
3719 inspired by discussions with B. Granger and the BackgroundCommand
3705 class described in the book Python Scripting for Computational
3720 class described in the book Python Scripting for Computational
3706 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3721 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3707 (although ultimately no code from this text was used, as IPython's
3722 (although ultimately no code from this text was used, as IPython's
3708 system is a separate implementation).
3723 system is a separate implementation).
3709
3724
3710 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3725 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3711 to control the completion of single/double underscore names
3726 to control the completion of single/double underscore names
3712 separately. As documented in the example ipytonrc file, the
3727 separately. As documented in the example ipytonrc file, the
3713 readline_omit__names variable can now be set to 2, to omit even
3728 readline_omit__names variable can now be set to 2, to omit even
3714 single underscore names. Thanks to a patch by Brian Wong
3729 single underscore names. Thanks to a patch by Brian Wong
3715 <BrianWong-AT-AirgoNetworks.Com>.
3730 <BrianWong-AT-AirgoNetworks.Com>.
3716 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3731 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3717 be autocalled as foo([1]) if foo were callable. A problem for
3732 be autocalled as foo([1]) if foo were callable. A problem for
3718 things which are both callable and implement __getitem__.
3733 things which are both callable and implement __getitem__.
3719 (init_readline): Fix autoindentation for win32. Thanks to a patch
3734 (init_readline): Fix autoindentation for win32. Thanks to a patch
3720 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3735 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3721
3736
3722 2005-02-12 Fernando Perez <fperez@colorado.edu>
3737 2005-02-12 Fernando Perez <fperez@colorado.edu>
3723
3738
3724 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3739 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3725 which I had written long ago to sort out user error messages which
3740 which I had written long ago to sort out user error messages which
3726 may occur during startup. This seemed like a good idea initially,
3741 may occur during startup. This seemed like a good idea initially,
3727 but it has proven a disaster in retrospect. I don't want to
3742 but it has proven a disaster in retrospect. I don't want to
3728 change much code for now, so my fix is to set the internal 'debug'
3743 change much code for now, so my fix is to set the internal 'debug'
3729 flag to true everywhere, whose only job was precisely to control
3744 flag to true everywhere, whose only job was precisely to control
3730 this subsystem. This closes issue 28 (as well as avoiding all
3745 this subsystem. This closes issue 28 (as well as avoiding all
3731 sorts of strange hangups which occur from time to time).
3746 sorts of strange hangups which occur from time to time).
3732
3747
3733 2005-02-07 Fernando Perez <fperez@colorado.edu>
3748 2005-02-07 Fernando Perez <fperez@colorado.edu>
3734
3749
3735 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3750 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3736 previous call produced a syntax error.
3751 previous call produced a syntax error.
3737
3752
3738 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3753 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3739 classes without constructor.
3754 classes without constructor.
3740
3755
3741 2005-02-06 Fernando Perez <fperez@colorado.edu>
3756 2005-02-06 Fernando Perez <fperez@colorado.edu>
3742
3757
3743 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3758 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3744 completions with the results of each matcher, so we return results
3759 completions with the results of each matcher, so we return results
3745 to the user from all namespaces. This breaks with ipython
3760 to the user from all namespaces. This breaks with ipython
3746 tradition, but I think it's a nicer behavior. Now you get all
3761 tradition, but I think it's a nicer behavior. Now you get all
3747 possible completions listed, from all possible namespaces (python,
3762 possible completions listed, from all possible namespaces (python,
3748 filesystem, magics...) After a request by John Hunter
3763 filesystem, magics...) After a request by John Hunter
3749 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3764 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3750
3765
3751 2005-02-05 Fernando Perez <fperez@colorado.edu>
3766 2005-02-05 Fernando Perez <fperez@colorado.edu>
3752
3767
3753 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3768 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3754 the call had quote characters in it (the quotes were stripped).
3769 the call had quote characters in it (the quotes were stripped).
3755
3770
3756 2005-01-31 Fernando Perez <fperez@colorado.edu>
3771 2005-01-31 Fernando Perez <fperez@colorado.edu>
3757
3772
3758 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3773 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3759 Itpl.itpl() to make the code more robust against psyco
3774 Itpl.itpl() to make the code more robust against psyco
3760 optimizations.
3775 optimizations.
3761
3776
3762 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3777 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3763 of causing an exception. Quicker, cleaner.
3778 of causing an exception. Quicker, cleaner.
3764
3779
3765 2005-01-28 Fernando Perez <fperez@colorado.edu>
3780 2005-01-28 Fernando Perez <fperez@colorado.edu>
3766
3781
3767 * scripts/ipython_win_post_install.py (install): hardcode
3782 * scripts/ipython_win_post_install.py (install): hardcode
3768 sys.prefix+'python.exe' as the executable path. It turns out that
3783 sys.prefix+'python.exe' as the executable path. It turns out that
3769 during the post-installation run, sys.executable resolves to the
3784 during the post-installation run, sys.executable resolves to the
3770 name of the binary installer! I should report this as a distutils
3785 name of the binary installer! I should report this as a distutils
3771 bug, I think. I updated the .10 release with this tiny fix, to
3786 bug, I think. I updated the .10 release with this tiny fix, to
3772 avoid annoying the lists further.
3787 avoid annoying the lists further.
3773
3788
3774 2005-01-27 *** Released version 0.6.10
3789 2005-01-27 *** Released version 0.6.10
3775
3790
3776 2005-01-27 Fernando Perez <fperez@colorado.edu>
3791 2005-01-27 Fernando Perez <fperez@colorado.edu>
3777
3792
3778 * IPython/numutils.py (norm): Added 'inf' as optional name for
3793 * IPython/numutils.py (norm): Added 'inf' as optional name for
3779 L-infinity norm, included references to mathworld.com for vector
3794 L-infinity norm, included references to mathworld.com for vector
3780 norm definitions.
3795 norm definitions.
3781 (amin/amax): added amin/amax for array min/max. Similar to what
3796 (amin/amax): added amin/amax for array min/max. Similar to what
3782 pylab ships with after the recent reorganization of names.
3797 pylab ships with after the recent reorganization of names.
3783 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3798 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3784
3799
3785 * ipython.el: committed Alex's recent fixes and improvements.
3800 * ipython.el: committed Alex's recent fixes and improvements.
3786 Tested with python-mode from CVS, and it looks excellent. Since
3801 Tested with python-mode from CVS, and it looks excellent. Since
3787 python-mode hasn't released anything in a while, I'm temporarily
3802 python-mode hasn't released anything in a while, I'm temporarily
3788 putting a copy of today's CVS (v 4.70) of python-mode in:
3803 putting a copy of today's CVS (v 4.70) of python-mode in:
3789 http://ipython.scipy.org/tmp/python-mode.el
3804 http://ipython.scipy.org/tmp/python-mode.el
3790
3805
3791 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3806 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3792 sys.executable for the executable name, instead of assuming it's
3807 sys.executable for the executable name, instead of assuming it's
3793 called 'python.exe' (the post-installer would have produced broken
3808 called 'python.exe' (the post-installer would have produced broken
3794 setups on systems with a differently named python binary).
3809 setups on systems with a differently named python binary).
3795
3810
3796 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3811 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3797 references to os.linesep, to make the code more
3812 references to os.linesep, to make the code more
3798 platform-independent. This is also part of the win32 coloring
3813 platform-independent. This is also part of the win32 coloring
3799 fixes.
3814 fixes.
3800
3815
3801 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3816 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3802 lines, which actually cause coloring bugs because the length of
3817 lines, which actually cause coloring bugs because the length of
3803 the line is very difficult to correctly compute with embedded
3818 the line is very difficult to correctly compute with embedded
3804 escapes. This was the source of all the coloring problems under
3819 escapes. This was the source of all the coloring problems under
3805 Win32. I think that _finally_, Win32 users have a properly
3820 Win32. I think that _finally_, Win32 users have a properly
3806 working ipython in all respects. This would never have happened
3821 working ipython in all respects. This would never have happened
3807 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3822 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3808
3823
3809 2005-01-26 *** Released version 0.6.9
3824 2005-01-26 *** Released version 0.6.9
3810
3825
3811 2005-01-25 Fernando Perez <fperez@colorado.edu>
3826 2005-01-25 Fernando Perez <fperez@colorado.edu>
3812
3827
3813 * setup.py: finally, we have a true Windows installer, thanks to
3828 * setup.py: finally, we have a true Windows installer, thanks to
3814 the excellent work of Viktor Ransmayr
3829 the excellent work of Viktor Ransmayr
3815 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3830 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3816 Windows users. The setup routine is quite a bit cleaner thanks to
3831 Windows users. The setup routine is quite a bit cleaner thanks to
3817 this, and the post-install script uses the proper functions to
3832 this, and the post-install script uses the proper functions to
3818 allow a clean de-installation using the standard Windows Control
3833 allow a clean de-installation using the standard Windows Control
3819 Panel.
3834 Panel.
3820
3835
3821 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3836 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3822 environment variable under all OSes (including win32) if
3837 environment variable under all OSes (including win32) if
3823 available. This will give consistency to win32 users who have set
3838 available. This will give consistency to win32 users who have set
3824 this variable for any reason. If os.environ['HOME'] fails, the
3839 this variable for any reason. If os.environ['HOME'] fails, the
3825 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3840 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3826
3841
3827 2005-01-24 Fernando Perez <fperez@colorado.edu>
3842 2005-01-24 Fernando Perez <fperez@colorado.edu>
3828
3843
3829 * IPython/numutils.py (empty_like): add empty_like(), similar to
3844 * IPython/numutils.py (empty_like): add empty_like(), similar to
3830 zeros_like() but taking advantage of the new empty() Numeric routine.
3845 zeros_like() but taking advantage of the new empty() Numeric routine.
3831
3846
3832 2005-01-23 *** Released version 0.6.8
3847 2005-01-23 *** Released version 0.6.8
3833
3848
3834 2005-01-22 Fernando Perez <fperez@colorado.edu>
3849 2005-01-22 Fernando Perez <fperez@colorado.edu>
3835
3850
3836 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3851 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3837 automatic show() calls. After discussing things with JDH, it
3852 automatic show() calls. After discussing things with JDH, it
3838 turns out there are too many corner cases where this can go wrong.
3853 turns out there are too many corner cases where this can go wrong.
3839 It's best not to try to be 'too smart', and simply have ipython
3854 It's best not to try to be 'too smart', and simply have ipython
3840 reproduce as much as possible the default behavior of a normal
3855 reproduce as much as possible the default behavior of a normal
3841 python shell.
3856 python shell.
3842
3857
3843 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3858 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3844 line-splitting regexp and _prefilter() to avoid calling getattr()
3859 line-splitting regexp and _prefilter() to avoid calling getattr()
3845 on assignments. This closes
3860 on assignments. This closes
3846 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3861 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3847 readline uses getattr(), so a simple <TAB> keypress is still
3862 readline uses getattr(), so a simple <TAB> keypress is still
3848 enough to trigger getattr() calls on an object.
3863 enough to trigger getattr() calls on an object.
3849
3864
3850 2005-01-21 Fernando Perez <fperez@colorado.edu>
3865 2005-01-21 Fernando Perez <fperez@colorado.edu>
3851
3866
3852 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3867 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3853 docstring under pylab so it doesn't mask the original.
3868 docstring under pylab so it doesn't mask the original.
3854
3869
3855 2005-01-21 *** Released version 0.6.7
3870 2005-01-21 *** Released version 0.6.7
3856
3871
3857 2005-01-21 Fernando Perez <fperez@colorado.edu>
3872 2005-01-21 Fernando Perez <fperez@colorado.edu>
3858
3873
3859 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3874 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3860 signal handling for win32 users in multithreaded mode.
3875 signal handling for win32 users in multithreaded mode.
3861
3876
3862 2005-01-17 Fernando Perez <fperez@colorado.edu>
3877 2005-01-17 Fernando Perez <fperez@colorado.edu>
3863
3878
3864 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3879 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3865 instances with no __init__. After a crash report by Norbert Nemec
3880 instances with no __init__. After a crash report by Norbert Nemec
3866 <Norbert-AT-nemec-online.de>.
3881 <Norbert-AT-nemec-online.de>.
3867
3882
3868 2005-01-14 Fernando Perez <fperez@colorado.edu>
3883 2005-01-14 Fernando Perez <fperez@colorado.edu>
3869
3884
3870 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3885 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3871 names for verbose exceptions, when multiple dotted names and the
3886 names for verbose exceptions, when multiple dotted names and the
3872 'parent' object were present on the same line.
3887 'parent' object were present on the same line.
3873
3888
3874 2005-01-11 Fernando Perez <fperez@colorado.edu>
3889 2005-01-11 Fernando Perez <fperez@colorado.edu>
3875
3890
3876 * IPython/genutils.py (flag_calls): new utility to trap and flag
3891 * IPython/genutils.py (flag_calls): new utility to trap and flag
3877 calls in functions. I need it to clean up matplotlib support.
3892 calls in functions. I need it to clean up matplotlib support.
3878 Also removed some deprecated code in genutils.
3893 Also removed some deprecated code in genutils.
3879
3894
3880 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3895 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3881 that matplotlib scripts called with %run, which don't call show()
3896 that matplotlib scripts called with %run, which don't call show()
3882 themselves, still have their plotting windows open.
3897 themselves, still have their plotting windows open.
3883
3898
3884 2005-01-05 Fernando Perez <fperez@colorado.edu>
3899 2005-01-05 Fernando Perez <fperez@colorado.edu>
3885
3900
3886 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3901 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3887 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3902 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3888
3903
3889 2004-12-19 Fernando Perez <fperez@colorado.edu>
3904 2004-12-19 Fernando Perez <fperez@colorado.edu>
3890
3905
3891 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3906 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3892 parent_runcode, which was an eyesore. The same result can be
3907 parent_runcode, which was an eyesore. The same result can be
3893 obtained with Python's regular superclass mechanisms.
3908 obtained with Python's regular superclass mechanisms.
3894
3909
3895 2004-12-17 Fernando Perez <fperez@colorado.edu>
3910 2004-12-17 Fernando Perez <fperez@colorado.edu>
3896
3911
3897 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3912 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3898 reported by Prabhu.
3913 reported by Prabhu.
3899 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3914 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3900 sys.stderr) instead of explicitly calling sys.stderr. This helps
3915 sys.stderr) instead of explicitly calling sys.stderr. This helps
3901 maintain our I/O abstractions clean, for future GUI embeddings.
3916 maintain our I/O abstractions clean, for future GUI embeddings.
3902
3917
3903 * IPython/genutils.py (info): added new utility for sys.stderr
3918 * IPython/genutils.py (info): added new utility for sys.stderr
3904 unified info message handling (thin wrapper around warn()).
3919 unified info message handling (thin wrapper around warn()).
3905
3920
3906 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3921 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3907 composite (dotted) names on verbose exceptions.
3922 composite (dotted) names on verbose exceptions.
3908 (VerboseTB.nullrepr): harden against another kind of errors which
3923 (VerboseTB.nullrepr): harden against another kind of errors which
3909 Python's inspect module can trigger, and which were crashing
3924 Python's inspect module can trigger, and which were crashing
3910 IPython. Thanks to a report by Marco Lombardi
3925 IPython. Thanks to a report by Marco Lombardi
3911 <mlombard-AT-ma010192.hq.eso.org>.
3926 <mlombard-AT-ma010192.hq.eso.org>.
3912
3927
3913 2004-12-13 *** Released version 0.6.6
3928 2004-12-13 *** Released version 0.6.6
3914
3929
3915 2004-12-12 Fernando Perez <fperez@colorado.edu>
3930 2004-12-12 Fernando Perez <fperez@colorado.edu>
3916
3931
3917 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3932 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3918 generated by pygtk upon initialization if it was built without
3933 generated by pygtk upon initialization if it was built without
3919 threads (for matplotlib users). After a crash reported by
3934 threads (for matplotlib users). After a crash reported by
3920 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3935 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3921
3936
3922 * IPython/ipmaker.py (make_IPython): fix small bug in the
3937 * IPython/ipmaker.py (make_IPython): fix small bug in the
3923 import_some parameter for multiple imports.
3938 import_some parameter for multiple imports.
3924
3939
3925 * IPython/iplib.py (ipmagic): simplified the interface of
3940 * IPython/iplib.py (ipmagic): simplified the interface of
3926 ipmagic() to take a single string argument, just as it would be
3941 ipmagic() to take a single string argument, just as it would be
3927 typed at the IPython cmd line.
3942 typed at the IPython cmd line.
3928 (ipalias): Added new ipalias() with an interface identical to
3943 (ipalias): Added new ipalias() with an interface identical to
3929 ipmagic(). This completes exposing a pure python interface to the
3944 ipmagic(). This completes exposing a pure python interface to the
3930 alias and magic system, which can be used in loops or more complex
3945 alias and magic system, which can be used in loops or more complex
3931 code where IPython's automatic line mangling is not active.
3946 code where IPython's automatic line mangling is not active.
3932
3947
3933 * IPython/genutils.py (timing): changed interface of timing to
3948 * IPython/genutils.py (timing): changed interface of timing to
3934 simply run code once, which is the most common case. timings()
3949 simply run code once, which is the most common case. timings()
3935 remains unchanged, for the cases where you want multiple runs.
3950 remains unchanged, for the cases where you want multiple runs.
3936
3951
3937 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3952 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3938 bug where Python2.2 crashes with exec'ing code which does not end
3953 bug where Python2.2 crashes with exec'ing code which does not end
3939 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3954 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3940 before.
3955 before.
3941
3956
3942 2004-12-10 Fernando Perez <fperez@colorado.edu>
3957 2004-12-10 Fernando Perez <fperez@colorado.edu>
3943
3958
3944 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3959 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3945 -t to -T, to accomodate the new -t flag in %run (the %run and
3960 -t to -T, to accomodate the new -t flag in %run (the %run and
3946 %prun options are kind of intermixed, and it's not easy to change
3961 %prun options are kind of intermixed, and it's not easy to change
3947 this with the limitations of python's getopt).
3962 this with the limitations of python's getopt).
3948
3963
3949 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3964 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3950 the execution of scripts. It's not as fine-tuned as timeit.py,
3965 the execution of scripts. It's not as fine-tuned as timeit.py,
3951 but it works from inside ipython (and under 2.2, which lacks
3966 but it works from inside ipython (and under 2.2, which lacks
3952 timeit.py). Optionally a number of runs > 1 can be given for
3967 timeit.py). Optionally a number of runs > 1 can be given for
3953 timing very short-running code.
3968 timing very short-running code.
3954
3969
3955 * IPython/genutils.py (uniq_stable): new routine which returns a
3970 * IPython/genutils.py (uniq_stable): new routine which returns a
3956 list of unique elements in any iterable, but in stable order of
3971 list of unique elements in any iterable, but in stable order of
3957 appearance. I needed this for the ultraTB fixes, and it's a handy
3972 appearance. I needed this for the ultraTB fixes, and it's a handy
3958 utility.
3973 utility.
3959
3974
3960 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3975 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3961 dotted names in Verbose exceptions. This had been broken since
3976 dotted names in Verbose exceptions. This had been broken since
3962 the very start, now x.y will properly be printed in a Verbose
3977 the very start, now x.y will properly be printed in a Verbose
3963 traceback, instead of x being shown and y appearing always as an
3978 traceback, instead of x being shown and y appearing always as an
3964 'undefined global'. Getting this to work was a bit tricky,
3979 'undefined global'. Getting this to work was a bit tricky,
3965 because by default python tokenizers are stateless. Saved by
3980 because by default python tokenizers are stateless. Saved by
3966 python's ability to easily add a bit of state to an arbitrary
3981 python's ability to easily add a bit of state to an arbitrary
3967 function (without needing to build a full-blown callable object).
3982 function (without needing to build a full-blown callable object).
3968
3983
3969 Also big cleanup of this code, which had horrendous runtime
3984 Also big cleanup of this code, which had horrendous runtime
3970 lookups of zillions of attributes for colorization. Moved all
3985 lookups of zillions of attributes for colorization. Moved all
3971 this code into a few templates, which make it cleaner and quicker.
3986 this code into a few templates, which make it cleaner and quicker.
3972
3987
3973 Printout quality was also improved for Verbose exceptions: one
3988 Printout quality was also improved for Verbose exceptions: one
3974 variable per line, and memory addresses are printed (this can be
3989 variable per line, and memory addresses are printed (this can be
3975 quite handy in nasty debugging situations, which is what Verbose
3990 quite handy in nasty debugging situations, which is what Verbose
3976 is for).
3991 is for).
3977
3992
3978 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3993 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3979 the command line as scripts to be loaded by embedded instances.
3994 the command line as scripts to be loaded by embedded instances.
3980 Doing so has the potential for an infinite recursion if there are
3995 Doing so has the potential for an infinite recursion if there are
3981 exceptions thrown in the process. This fixes a strange crash
3996 exceptions thrown in the process. This fixes a strange crash
3982 reported by Philippe MULLER <muller-AT-irit.fr>.
3997 reported by Philippe MULLER <muller-AT-irit.fr>.
3983
3998
3984 2004-12-09 Fernando Perez <fperez@colorado.edu>
3999 2004-12-09 Fernando Perez <fperez@colorado.edu>
3985
4000
3986 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
4001 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3987 to reflect new names in matplotlib, which now expose the
4002 to reflect new names in matplotlib, which now expose the
3988 matlab-compatible interface via a pylab module instead of the
4003 matlab-compatible interface via a pylab module instead of the
3989 'matlab' name. The new code is backwards compatible, so users of
4004 'matlab' name. The new code is backwards compatible, so users of
3990 all matplotlib versions are OK. Patch by J. Hunter.
4005 all matplotlib versions are OK. Patch by J. Hunter.
3991
4006
3992 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
4007 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3993 of __init__ docstrings for instances (class docstrings are already
4008 of __init__ docstrings for instances (class docstrings are already
3994 automatically printed). Instances with customized docstrings
4009 automatically printed). Instances with customized docstrings
3995 (indep. of the class) are also recognized and all 3 separate
4010 (indep. of the class) are also recognized and all 3 separate
3996 docstrings are printed (instance, class, constructor). After some
4011 docstrings are printed (instance, class, constructor). After some
3997 comments/suggestions by J. Hunter.
4012 comments/suggestions by J. Hunter.
3998
4013
3999 2004-12-05 Fernando Perez <fperez@colorado.edu>
4014 2004-12-05 Fernando Perez <fperez@colorado.edu>
4000
4015
4001 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
4016 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
4002 warnings when tab-completion fails and triggers an exception.
4017 warnings when tab-completion fails and triggers an exception.
4003
4018
4004 2004-12-03 Fernando Perez <fperez@colorado.edu>
4019 2004-12-03 Fernando Perez <fperez@colorado.edu>
4005
4020
4006 * IPython/Magic.py (magic_prun): Fix bug where an exception would
4021 * IPython/Magic.py (magic_prun): Fix bug where an exception would
4007 be triggered when using 'run -p'. An incorrect option flag was
4022 be triggered when using 'run -p'. An incorrect option flag was
4008 being set ('d' instead of 'D').
4023 being set ('d' instead of 'D').
4009 (manpage): fix missing escaped \- sign.
4024 (manpage): fix missing escaped \- sign.
4010
4025
4011 2004-11-30 *** Released version 0.6.5
4026 2004-11-30 *** Released version 0.6.5
4012
4027
4013 2004-11-30 Fernando Perez <fperez@colorado.edu>
4028 2004-11-30 Fernando Perez <fperez@colorado.edu>
4014
4029
4015 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
4030 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
4016 setting with -d option.
4031 setting with -d option.
4017
4032
4018 * setup.py (docfiles): Fix problem where the doc glob I was using
4033 * setup.py (docfiles): Fix problem where the doc glob I was using
4019 was COMPLETELY BROKEN. It was giving the right files by pure
4034 was COMPLETELY BROKEN. It was giving the right files by pure
4020 accident, but failed once I tried to include ipython.el. Note:
4035 accident, but failed once I tried to include ipython.el. Note:
4021 glob() does NOT allow you to do exclusion on multiple endings!
4036 glob() does NOT allow you to do exclusion on multiple endings!
4022
4037
4023 2004-11-29 Fernando Perez <fperez@colorado.edu>
4038 2004-11-29 Fernando Perez <fperez@colorado.edu>
4024
4039
4025 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
4040 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
4026 the manpage as the source. Better formatting & consistency.
4041 the manpage as the source. Better formatting & consistency.
4027
4042
4028 * IPython/Magic.py (magic_run): Added new -d option, to run
4043 * IPython/Magic.py (magic_run): Added new -d option, to run
4029 scripts under the control of the python pdb debugger. Note that
4044 scripts under the control of the python pdb debugger. Note that
4030 this required changing the %prun option -d to -D, to avoid a clash
4045 this required changing the %prun option -d to -D, to avoid a clash
4031 (since %run must pass options to %prun, and getopt is too dumb to
4046 (since %run must pass options to %prun, and getopt is too dumb to
4032 handle options with string values with embedded spaces). Thanks
4047 handle options with string values with embedded spaces). Thanks
4033 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
4048 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
4034 (magic_who_ls): added type matching to %who and %whos, so that one
4049 (magic_who_ls): added type matching to %who and %whos, so that one
4035 can filter their output to only include variables of certain
4050 can filter their output to only include variables of certain
4036 types. Another suggestion by Matthew.
4051 types. Another suggestion by Matthew.
4037 (magic_whos): Added memory summaries in kb and Mb for arrays.
4052 (magic_whos): Added memory summaries in kb and Mb for arrays.
4038 (magic_who): Improve formatting (break lines every 9 vars).
4053 (magic_who): Improve formatting (break lines every 9 vars).
4039
4054
4040 2004-11-28 Fernando Perez <fperez@colorado.edu>
4055 2004-11-28 Fernando Perez <fperez@colorado.edu>
4041
4056
4042 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
4057 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
4043 cache when empty lines were present.
4058 cache when empty lines were present.
4044
4059
4045 2004-11-24 Fernando Perez <fperez@colorado.edu>
4060 2004-11-24 Fernando Perez <fperez@colorado.edu>
4046
4061
4047 * IPython/usage.py (__doc__): document the re-activated threading
4062 * IPython/usage.py (__doc__): document the re-activated threading
4048 options for WX and GTK.
4063 options for WX and GTK.
4049
4064
4050 2004-11-23 Fernando Perez <fperez@colorado.edu>
4065 2004-11-23 Fernando Perez <fperez@colorado.edu>
4051
4066
4052 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
4067 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
4053 the -wthread and -gthread options, along with a new -tk one to try
4068 the -wthread and -gthread options, along with a new -tk one to try
4054 and coordinate Tk threading with wx/gtk. The tk support is very
4069 and coordinate Tk threading with wx/gtk. The tk support is very
4055 platform dependent, since it seems to require Tcl and Tk to be
4070 platform dependent, since it seems to require Tcl and Tk to be
4056 built with threads (Fedora1/2 appears NOT to have it, but in
4071 built with threads (Fedora1/2 appears NOT to have it, but in
4057 Prabhu's Debian boxes it works OK). But even with some Tk
4072 Prabhu's Debian boxes it works OK). But even with some Tk
4058 limitations, this is a great improvement.
4073 limitations, this is a great improvement.
4059
4074
4060 * IPython/Prompts.py (prompt_specials_color): Added \t for time
4075 * IPython/Prompts.py (prompt_specials_color): Added \t for time
4061 info in user prompts. Patch by Prabhu.
4076 info in user prompts. Patch by Prabhu.
4062
4077
4063 2004-11-18 Fernando Perez <fperez@colorado.edu>
4078 2004-11-18 Fernando Perez <fperez@colorado.edu>
4064
4079
4065 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
4080 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
4066 EOFErrors and bail, to avoid infinite loops if a non-terminating
4081 EOFErrors and bail, to avoid infinite loops if a non-terminating
4067 file is fed into ipython. Patch submitted in issue 19 by user,
4082 file is fed into ipython. Patch submitted in issue 19 by user,
4068 many thanks.
4083 many thanks.
4069
4084
4070 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
4085 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
4071 autoquote/parens in continuation prompts, which can cause lots of
4086 autoquote/parens in continuation prompts, which can cause lots of
4072 problems. Closes roundup issue 20.
4087 problems. Closes roundup issue 20.
4073
4088
4074 2004-11-17 Fernando Perez <fperez@colorado.edu>
4089 2004-11-17 Fernando Perez <fperez@colorado.edu>
4075
4090
4076 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
4091 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
4077 reported as debian bug #280505. I'm not sure my local changelog
4092 reported as debian bug #280505. I'm not sure my local changelog
4078 entry has the proper debian format (Jack?).
4093 entry has the proper debian format (Jack?).
4079
4094
4080 2004-11-08 *** Released version 0.6.4
4095 2004-11-08 *** Released version 0.6.4
4081
4096
4082 2004-11-08 Fernando Perez <fperez@colorado.edu>
4097 2004-11-08 Fernando Perez <fperez@colorado.edu>
4083
4098
4084 * IPython/iplib.py (init_readline): Fix exit message for Windows
4099 * IPython/iplib.py (init_readline): Fix exit message for Windows
4085 when readline is active. Thanks to a report by Eric Jones
4100 when readline is active. Thanks to a report by Eric Jones
4086 <eric-AT-enthought.com>.
4101 <eric-AT-enthought.com>.
4087
4102
4088 2004-11-07 Fernando Perez <fperez@colorado.edu>
4103 2004-11-07 Fernando Perez <fperez@colorado.edu>
4089
4104
4090 * IPython/genutils.py (page): Add a trap for OSError exceptions,
4105 * IPython/genutils.py (page): Add a trap for OSError exceptions,
4091 sometimes seen by win2k/cygwin users.
4106 sometimes seen by win2k/cygwin users.
4092
4107
4093 2004-11-06 Fernando Perez <fperez@colorado.edu>
4108 2004-11-06 Fernando Perez <fperez@colorado.edu>
4094
4109
4095 * IPython/iplib.py (interact): Change the handling of %Exit from
4110 * IPython/iplib.py (interact): Change the handling of %Exit from
4096 trying to propagate a SystemExit to an internal ipython flag.
4111 trying to propagate a SystemExit to an internal ipython flag.
4097 This is less elegant than using Python's exception mechanism, but
4112 This is less elegant than using Python's exception mechanism, but
4098 I can't get that to work reliably with threads, so under -pylab
4113 I can't get that to work reliably with threads, so under -pylab
4099 %Exit was hanging IPython. Cross-thread exception handling is
4114 %Exit was hanging IPython. Cross-thread exception handling is
4100 really a bitch. Thaks to a bug report by Stephen Walton
4115 really a bitch. Thaks to a bug report by Stephen Walton
4101 <stephen.walton-AT-csun.edu>.
4116 <stephen.walton-AT-csun.edu>.
4102
4117
4103 2004-11-04 Fernando Perez <fperez@colorado.edu>
4118 2004-11-04 Fernando Perez <fperez@colorado.edu>
4104
4119
4105 * IPython/iplib.py (raw_input_original): store a pointer to the
4120 * IPython/iplib.py (raw_input_original): store a pointer to the
4106 true raw_input to harden against code which can modify it
4121 true raw_input to harden against code which can modify it
4107 (wx.py.PyShell does this and would otherwise crash ipython).
4122 (wx.py.PyShell does this and would otherwise crash ipython).
4108 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
4123 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
4109
4124
4110 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
4125 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
4111 Ctrl-C problem, which does not mess up the input line.
4126 Ctrl-C problem, which does not mess up the input line.
4112
4127
4113 2004-11-03 Fernando Perez <fperez@colorado.edu>
4128 2004-11-03 Fernando Perez <fperez@colorado.edu>
4114
4129
4115 * IPython/Release.py: Changed licensing to BSD, in all files.
4130 * IPython/Release.py: Changed licensing to BSD, in all files.
4116 (name): lowercase name for tarball/RPM release.
4131 (name): lowercase name for tarball/RPM release.
4117
4132
4118 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
4133 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
4119 use throughout ipython.
4134 use throughout ipython.
4120
4135
4121 * IPython/Magic.py (Magic._ofind): Switch to using the new
4136 * IPython/Magic.py (Magic._ofind): Switch to using the new
4122 OInspect.getdoc() function.
4137 OInspect.getdoc() function.
4123
4138
4124 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
4139 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
4125 of the line currently being canceled via Ctrl-C. It's extremely
4140 of the line currently being canceled via Ctrl-C. It's extremely
4126 ugly, but I don't know how to do it better (the problem is one of
4141 ugly, but I don't know how to do it better (the problem is one of
4127 handling cross-thread exceptions).
4142 handling cross-thread exceptions).
4128
4143
4129 2004-10-28 Fernando Perez <fperez@colorado.edu>
4144 2004-10-28 Fernando Perez <fperez@colorado.edu>
4130
4145
4131 * IPython/Shell.py (signal_handler): add signal handlers to trap
4146 * IPython/Shell.py (signal_handler): add signal handlers to trap
4132 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
4147 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
4133 report by Francesc Alted.
4148 report by Francesc Alted.
4134
4149
4135 2004-10-21 Fernando Perez <fperez@colorado.edu>
4150 2004-10-21 Fernando Perez <fperez@colorado.edu>
4136
4151
4137 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
4152 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
4138 to % for pysh syntax extensions.
4153 to % for pysh syntax extensions.
4139
4154
4140 2004-10-09 Fernando Perez <fperez@colorado.edu>
4155 2004-10-09 Fernando Perez <fperez@colorado.edu>
4141
4156
4142 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
4157 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
4143 arrays to print a more useful summary, without calling str(arr).
4158 arrays to print a more useful summary, without calling str(arr).
4144 This avoids the problem of extremely lengthy computations which
4159 This avoids the problem of extremely lengthy computations which
4145 occur if arr is large, and appear to the user as a system lockup
4160 occur if arr is large, and appear to the user as a system lockup
4146 with 100% cpu activity. After a suggestion by Kristian Sandberg
4161 with 100% cpu activity. After a suggestion by Kristian Sandberg
4147 <Kristian.Sandberg@colorado.edu>.
4162 <Kristian.Sandberg@colorado.edu>.
4148 (Magic.__init__): fix bug in global magic escapes not being
4163 (Magic.__init__): fix bug in global magic escapes not being
4149 correctly set.
4164 correctly set.
4150
4165
4151 2004-10-08 Fernando Perez <fperez@colorado.edu>
4166 2004-10-08 Fernando Perez <fperez@colorado.edu>
4152
4167
4153 * IPython/Magic.py (__license__): change to absolute imports of
4168 * IPython/Magic.py (__license__): change to absolute imports of
4154 ipython's own internal packages, to start adapting to the absolute
4169 ipython's own internal packages, to start adapting to the absolute
4155 import requirement of PEP-328.
4170 import requirement of PEP-328.
4156
4171
4157 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
4172 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
4158 files, and standardize author/license marks through the Release
4173 files, and standardize author/license marks through the Release
4159 module instead of having per/file stuff (except for files with
4174 module instead of having per/file stuff (except for files with
4160 particular licenses, like the MIT/PSF-licensed codes).
4175 particular licenses, like the MIT/PSF-licensed codes).
4161
4176
4162 * IPython/Debugger.py: remove dead code for python 2.1
4177 * IPython/Debugger.py: remove dead code for python 2.1
4163
4178
4164 2004-10-04 Fernando Perez <fperez@colorado.edu>
4179 2004-10-04 Fernando Perez <fperez@colorado.edu>
4165
4180
4166 * IPython/iplib.py (ipmagic): New function for accessing magics
4181 * IPython/iplib.py (ipmagic): New function for accessing magics
4167 via a normal python function call.
4182 via a normal python function call.
4168
4183
4169 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
4184 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
4170 from '@' to '%', to accomodate the new @decorator syntax of python
4185 from '@' to '%', to accomodate the new @decorator syntax of python
4171 2.4.
4186 2.4.
4172
4187
4173 2004-09-29 Fernando Perez <fperez@colorado.edu>
4188 2004-09-29 Fernando Perez <fperez@colorado.edu>
4174
4189
4175 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
4190 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
4176 matplotlib.use to prevent running scripts which try to switch
4191 matplotlib.use to prevent running scripts which try to switch
4177 interactive backends from within ipython. This will just crash
4192 interactive backends from within ipython. This will just crash
4178 the python interpreter, so we can't allow it (but a detailed error
4193 the python interpreter, so we can't allow it (but a detailed error
4179 is given to the user).
4194 is given to the user).
4180
4195
4181 2004-09-28 Fernando Perez <fperez@colorado.edu>
4196 2004-09-28 Fernando Perez <fperez@colorado.edu>
4182
4197
4183 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
4198 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
4184 matplotlib-related fixes so that using @run with non-matplotlib
4199 matplotlib-related fixes so that using @run with non-matplotlib
4185 scripts doesn't pop up spurious plot windows. This requires
4200 scripts doesn't pop up spurious plot windows. This requires
4186 matplotlib >= 0.63, where I had to make some changes as well.
4201 matplotlib >= 0.63, where I had to make some changes as well.
4187
4202
4188 * IPython/ipmaker.py (make_IPython): update version requirement to
4203 * IPython/ipmaker.py (make_IPython): update version requirement to
4189 python 2.2.
4204 python 2.2.
4190
4205
4191 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
4206 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
4192 banner arg for embedded customization.
4207 banner arg for embedded customization.
4193
4208
4194 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
4209 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
4195 explicit uses of __IP as the IPython's instance name. Now things
4210 explicit uses of __IP as the IPython's instance name. Now things
4196 are properly handled via the shell.name value. The actual code
4211 are properly handled via the shell.name value. The actual code
4197 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
4212 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
4198 is much better than before. I'll clean things completely when the
4213 is much better than before. I'll clean things completely when the
4199 magic stuff gets a real overhaul.
4214 magic stuff gets a real overhaul.
4200
4215
4201 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
4216 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
4202 minor changes to debian dir.
4217 minor changes to debian dir.
4203
4218
4204 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
4219 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
4205 pointer to the shell itself in the interactive namespace even when
4220 pointer to the shell itself in the interactive namespace even when
4206 a user-supplied dict is provided. This is needed for embedding
4221 a user-supplied dict is provided. This is needed for embedding
4207 purposes (found by tests with Michel Sanner).
4222 purposes (found by tests with Michel Sanner).
4208
4223
4209 2004-09-27 Fernando Perez <fperez@colorado.edu>
4224 2004-09-27 Fernando Perez <fperez@colorado.edu>
4210
4225
4211 * IPython/UserConfig/ipythonrc: remove []{} from
4226 * IPython/UserConfig/ipythonrc: remove []{} from
4212 readline_remove_delims, so that things like [modname.<TAB> do
4227 readline_remove_delims, so that things like [modname.<TAB> do
4213 proper completion. This disables [].TAB, but that's a less common
4228 proper completion. This disables [].TAB, but that's a less common
4214 case than module names in list comprehensions, for example.
4229 case than module names in list comprehensions, for example.
4215 Thanks to a report by Andrea Riciputi.
4230 Thanks to a report by Andrea Riciputi.
4216
4231
4217 2004-09-09 Fernando Perez <fperez@colorado.edu>
4232 2004-09-09 Fernando Perez <fperez@colorado.edu>
4218
4233
4219 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
4234 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
4220 blocking problems in win32 and osx. Fix by John.
4235 blocking problems in win32 and osx. Fix by John.
4221
4236
4222 2004-09-08 Fernando Perez <fperez@colorado.edu>
4237 2004-09-08 Fernando Perez <fperez@colorado.edu>
4223
4238
4224 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
4239 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
4225 for Win32 and OSX. Fix by John Hunter.
4240 for Win32 and OSX. Fix by John Hunter.
4226
4241
4227 2004-08-30 *** Released version 0.6.3
4242 2004-08-30 *** Released version 0.6.3
4228
4243
4229 2004-08-30 Fernando Perez <fperez@colorado.edu>
4244 2004-08-30 Fernando Perez <fperez@colorado.edu>
4230
4245
4231 * setup.py (isfile): Add manpages to list of dependent files to be
4246 * setup.py (isfile): Add manpages to list of dependent files to be
4232 updated.
4247 updated.
4233
4248
4234 2004-08-27 Fernando Perez <fperez@colorado.edu>
4249 2004-08-27 Fernando Perez <fperez@colorado.edu>
4235
4250
4236 * IPython/Shell.py (start): I've disabled -wthread and -gthread
4251 * IPython/Shell.py (start): I've disabled -wthread and -gthread
4237 for now. They don't really work with standalone WX/GTK code
4252 for now. They don't really work with standalone WX/GTK code
4238 (though matplotlib IS working fine with both of those backends).
4253 (though matplotlib IS working fine with both of those backends).
4239 This will neeed much more testing. I disabled most things with
4254 This will neeed much more testing. I disabled most things with
4240 comments, so turning it back on later should be pretty easy.
4255 comments, so turning it back on later should be pretty easy.
4241
4256
4242 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
4257 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
4243 autocalling of expressions like r'foo', by modifying the line
4258 autocalling of expressions like r'foo', by modifying the line
4244 split regexp. Closes
4259 split regexp. Closes
4245 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
4260 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
4246 Riley <ipythonbugs-AT-sabi.net>.
4261 Riley <ipythonbugs-AT-sabi.net>.
4247 (InteractiveShell.mainloop): honor --nobanner with banner
4262 (InteractiveShell.mainloop): honor --nobanner with banner
4248 extensions.
4263 extensions.
4249
4264
4250 * IPython/Shell.py: Significant refactoring of all classes, so
4265 * IPython/Shell.py: Significant refactoring of all classes, so
4251 that we can really support ALL matplotlib backends and threading
4266 that we can really support ALL matplotlib backends and threading
4252 models (John spotted a bug with Tk which required this). Now we
4267 models (John spotted a bug with Tk which required this). Now we
4253 should support single-threaded, WX-threads and GTK-threads, both
4268 should support single-threaded, WX-threads and GTK-threads, both
4254 for generic code and for matplotlib.
4269 for generic code and for matplotlib.
4255
4270
4256 * IPython/ipmaker.py (__call__): Changed -mpthread option to
4271 * IPython/ipmaker.py (__call__): Changed -mpthread option to
4257 -pylab, to simplify things for users. Will also remove the pylab
4272 -pylab, to simplify things for users. Will also remove the pylab
4258 profile, since now all of matplotlib configuration is directly
4273 profile, since now all of matplotlib configuration is directly
4259 handled here. This also reduces startup time.
4274 handled here. This also reduces startup time.
4260
4275
4261 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
4276 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
4262 shell wasn't being correctly called. Also in IPShellWX.
4277 shell wasn't being correctly called. Also in IPShellWX.
4263
4278
4264 * IPython/iplib.py (InteractiveShell.__init__): Added option to
4279 * IPython/iplib.py (InteractiveShell.__init__): Added option to
4265 fine-tune banner.
4280 fine-tune banner.
4266
4281
4267 * IPython/numutils.py (spike): Deprecate these spike functions,
4282 * IPython/numutils.py (spike): Deprecate these spike functions,
4268 delete (long deprecated) gnuplot_exec handler.
4283 delete (long deprecated) gnuplot_exec handler.
4269
4284
4270 2004-08-26 Fernando Perez <fperez@colorado.edu>
4285 2004-08-26 Fernando Perez <fperez@colorado.edu>
4271
4286
4272 * ipython.1: Update for threading options, plus some others which
4287 * ipython.1: Update for threading options, plus some others which
4273 were missing.
4288 were missing.
4274
4289
4275 * IPython/ipmaker.py (__call__): Added -wthread option for
4290 * IPython/ipmaker.py (__call__): Added -wthread option for
4276 wxpython thread handling. Make sure threading options are only
4291 wxpython thread handling. Make sure threading options are only
4277 valid at the command line.
4292 valid at the command line.
4278
4293
4279 * scripts/ipython: moved shell selection into a factory function
4294 * scripts/ipython: moved shell selection into a factory function
4280 in Shell.py, to keep the starter script to a minimum.
4295 in Shell.py, to keep the starter script to a minimum.
4281
4296
4282 2004-08-25 Fernando Perez <fperez@colorado.edu>
4297 2004-08-25 Fernando Perez <fperez@colorado.edu>
4283
4298
4284 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
4299 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
4285 John. Along with some recent changes he made to matplotlib, the
4300 John. Along with some recent changes he made to matplotlib, the
4286 next versions of both systems should work very well together.
4301 next versions of both systems should work very well together.
4287
4302
4288 2004-08-24 Fernando Perez <fperez@colorado.edu>
4303 2004-08-24 Fernando Perez <fperez@colorado.edu>
4289
4304
4290 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
4305 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
4291 tried to switch the profiling to using hotshot, but I'm getting
4306 tried to switch the profiling to using hotshot, but I'm getting
4292 strange errors from prof.runctx() there. I may be misreading the
4307 strange errors from prof.runctx() there. I may be misreading the
4293 docs, but it looks weird. For now the profiling code will
4308 docs, but it looks weird. For now the profiling code will
4294 continue to use the standard profiler.
4309 continue to use the standard profiler.
4295
4310
4296 2004-08-23 Fernando Perez <fperez@colorado.edu>
4311 2004-08-23 Fernando Perez <fperez@colorado.edu>
4297
4312
4298 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
4313 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
4299 threaded shell, by John Hunter. It's not quite ready yet, but
4314 threaded shell, by John Hunter. It's not quite ready yet, but
4300 close.
4315 close.
4301
4316
4302 2004-08-22 Fernando Perez <fperez@colorado.edu>
4317 2004-08-22 Fernando Perez <fperez@colorado.edu>
4303
4318
4304 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
4319 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
4305 in Magic and ultraTB.
4320 in Magic and ultraTB.
4306
4321
4307 * ipython.1: document threading options in manpage.
4322 * ipython.1: document threading options in manpage.
4308
4323
4309 * scripts/ipython: Changed name of -thread option to -gthread,
4324 * scripts/ipython: Changed name of -thread option to -gthread,
4310 since this is GTK specific. I want to leave the door open for a
4325 since this is GTK specific. I want to leave the door open for a
4311 -wthread option for WX, which will most likely be necessary. This
4326 -wthread option for WX, which will most likely be necessary. This
4312 change affects usage and ipmaker as well.
4327 change affects usage and ipmaker as well.
4313
4328
4314 * IPython/Shell.py (matplotlib_shell): Add a factory function to
4329 * IPython/Shell.py (matplotlib_shell): Add a factory function to
4315 handle the matplotlib shell issues. Code by John Hunter
4330 handle the matplotlib shell issues. Code by John Hunter
4316 <jdhunter-AT-nitace.bsd.uchicago.edu>.
4331 <jdhunter-AT-nitace.bsd.uchicago.edu>.
4317 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
4332 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
4318 broken (and disabled for end users) for now, but it puts the
4333 broken (and disabled for end users) for now, but it puts the
4319 infrastructure in place.
4334 infrastructure in place.
4320
4335
4321 2004-08-21 Fernando Perez <fperez@colorado.edu>
4336 2004-08-21 Fernando Perez <fperez@colorado.edu>
4322
4337
4323 * ipythonrc-pylab: Add matplotlib support.
4338 * ipythonrc-pylab: Add matplotlib support.
4324
4339
4325 * matplotlib_config.py: new files for matplotlib support, part of
4340 * matplotlib_config.py: new files for matplotlib support, part of
4326 the pylab profile.
4341 the pylab profile.
4327
4342
4328 * IPython/usage.py (__doc__): documented the threading options.
4343 * IPython/usage.py (__doc__): documented the threading options.
4329
4344
4330 2004-08-20 Fernando Perez <fperez@colorado.edu>
4345 2004-08-20 Fernando Perez <fperez@colorado.edu>
4331
4346
4332 * ipython: Modified the main calling routine to handle the -thread
4347 * ipython: Modified the main calling routine to handle the -thread
4333 and -mpthread options. This needs to be done as a top-level hack,
4348 and -mpthread options. This needs to be done as a top-level hack,
4334 because it determines which class to instantiate for IPython
4349 because it determines which class to instantiate for IPython
4335 itself.
4350 itself.
4336
4351
4337 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
4352 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
4338 classes to support multithreaded GTK operation without blocking,
4353 classes to support multithreaded GTK operation without blocking,
4339 and matplotlib with all backends. This is a lot of still very
4354 and matplotlib with all backends. This is a lot of still very
4340 experimental code, and threads are tricky. So it may still have a
4355 experimental code, and threads are tricky. So it may still have a
4341 few rough edges... This code owes a lot to
4356 few rough edges... This code owes a lot to
4342 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
4357 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
4343 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
4358 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
4344 to John Hunter for all the matplotlib work.
4359 to John Hunter for all the matplotlib work.
4345
4360
4346 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
4361 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
4347 options for gtk thread and matplotlib support.
4362 options for gtk thread and matplotlib support.
4348
4363
4349 2004-08-16 Fernando Perez <fperez@colorado.edu>
4364 2004-08-16 Fernando Perez <fperez@colorado.edu>
4350
4365
4351 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
4366 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
4352 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
4367 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
4353 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
4368 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
4354
4369
4355 2004-08-11 Fernando Perez <fperez@colorado.edu>
4370 2004-08-11 Fernando Perez <fperez@colorado.edu>
4356
4371
4357 * setup.py (isfile): Fix build so documentation gets updated for
4372 * setup.py (isfile): Fix build so documentation gets updated for
4358 rpms (it was only done for .tgz builds).
4373 rpms (it was only done for .tgz builds).
4359
4374
4360 2004-08-10 Fernando Perez <fperez@colorado.edu>
4375 2004-08-10 Fernando Perez <fperez@colorado.edu>
4361
4376
4362 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
4377 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
4363
4378
4364 * iplib.py : Silence syntax error exceptions in tab-completion.
4379 * iplib.py : Silence syntax error exceptions in tab-completion.
4365
4380
4366 2004-08-05 Fernando Perez <fperez@colorado.edu>
4381 2004-08-05 Fernando Perez <fperez@colorado.edu>
4367
4382
4368 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
4383 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
4369 'color off' mark for continuation prompts. This was causing long
4384 'color off' mark for continuation prompts. This was causing long
4370 continuation lines to mis-wrap.
4385 continuation lines to mis-wrap.
4371
4386
4372 2004-08-01 Fernando Perez <fperez@colorado.edu>
4387 2004-08-01 Fernando Perez <fperez@colorado.edu>
4373
4388
4374 * IPython/ipmaker.py (make_IPython): Allow the shell class used
4389 * IPython/ipmaker.py (make_IPython): Allow the shell class used
4375 for building ipython to be a parameter. All this is necessary
4390 for building ipython to be a parameter. All this is necessary
4376 right now to have a multithreaded version, but this insane
4391 right now to have a multithreaded version, but this insane
4377 non-design will be cleaned up soon. For now, it's a hack that
4392 non-design will be cleaned up soon. For now, it's a hack that
4378 works.
4393 works.
4379
4394
4380 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
4395 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
4381 args in various places. No bugs so far, but it's a dangerous
4396 args in various places. No bugs so far, but it's a dangerous
4382 practice.
4397 practice.
4383
4398
4384 2004-07-31 Fernando Perez <fperez@colorado.edu>
4399 2004-07-31 Fernando Perez <fperez@colorado.edu>
4385
4400
4386 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
4401 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
4387 fix completion of files with dots in their names under most
4402 fix completion of files with dots in their names under most
4388 profiles (pysh was OK because the completion order is different).
4403 profiles (pysh was OK because the completion order is different).
4389
4404
4390 2004-07-27 Fernando Perez <fperez@colorado.edu>
4405 2004-07-27 Fernando Perez <fperez@colorado.edu>
4391
4406
4392 * IPython/iplib.py (InteractiveShell.__init__): build dict of
4407 * IPython/iplib.py (InteractiveShell.__init__): build dict of
4393 keywords manually, b/c the one in keyword.py was removed in python
4408 keywords manually, b/c the one in keyword.py was removed in python
4394 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
4409 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
4395 This is NOT a bug under python 2.3 and earlier.
4410 This is NOT a bug under python 2.3 and earlier.
4396
4411
4397 2004-07-26 Fernando Perez <fperez@colorado.edu>
4412 2004-07-26 Fernando Perez <fperez@colorado.edu>
4398
4413
4399 * IPython/ultraTB.py (VerboseTB.text): Add another
4414 * IPython/ultraTB.py (VerboseTB.text): Add another
4400 linecache.checkcache() call to try to prevent inspect.py from
4415 linecache.checkcache() call to try to prevent inspect.py from
4401 crashing under python 2.3. I think this fixes
4416 crashing under python 2.3. I think this fixes
4402 http://www.scipy.net/roundup/ipython/issue17.
4417 http://www.scipy.net/roundup/ipython/issue17.
4403
4418
4404 2004-07-26 *** Released version 0.6.2
4419 2004-07-26 *** Released version 0.6.2
4405
4420
4406 2004-07-26 Fernando Perez <fperez@colorado.edu>
4421 2004-07-26 Fernando Perez <fperez@colorado.edu>
4407
4422
4408 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4423 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4409 fail for any number.
4424 fail for any number.
4410 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4425 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4411 empty bookmarks.
4426 empty bookmarks.
4412
4427
4413 2004-07-26 *** Released version 0.6.1
4428 2004-07-26 *** Released version 0.6.1
4414
4429
4415 2004-07-26 Fernando Perez <fperez@colorado.edu>
4430 2004-07-26 Fernando Perez <fperez@colorado.edu>
4416
4431
4417 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4432 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4418
4433
4419 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4434 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4420 escaping '()[]{}' in filenames.
4435 escaping '()[]{}' in filenames.
4421
4436
4422 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4437 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4423 Python 2.2 users who lack a proper shlex.split.
4438 Python 2.2 users who lack a proper shlex.split.
4424
4439
4425 2004-07-19 Fernando Perez <fperez@colorado.edu>
4440 2004-07-19 Fernando Perez <fperez@colorado.edu>
4426
4441
4427 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4442 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4428 for reading readline's init file. I follow the normal chain:
4443 for reading readline's init file. I follow the normal chain:
4429 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4444 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4430 report by Mike Heeter. This closes
4445 report by Mike Heeter. This closes
4431 http://www.scipy.net/roundup/ipython/issue16.
4446 http://www.scipy.net/roundup/ipython/issue16.
4432
4447
4433 2004-07-18 Fernando Perez <fperez@colorado.edu>
4448 2004-07-18 Fernando Perez <fperez@colorado.edu>
4434
4449
4435 * IPython/iplib.py (__init__): Add better handling of '\' under
4450 * IPython/iplib.py (__init__): Add better handling of '\' under
4436 Win32 for filenames. After a patch by Ville.
4451 Win32 for filenames. After a patch by Ville.
4437
4452
4438 2004-07-17 Fernando Perez <fperez@colorado.edu>
4453 2004-07-17 Fernando Perez <fperez@colorado.edu>
4439
4454
4440 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4455 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4441 autocalling would be triggered for 'foo is bar' if foo is
4456 autocalling would be triggered for 'foo is bar' if foo is
4442 callable. I also cleaned up the autocall detection code to use a
4457 callable. I also cleaned up the autocall detection code to use a
4443 regexp, which is faster. Bug reported by Alexander Schmolck.
4458 regexp, which is faster. Bug reported by Alexander Schmolck.
4444
4459
4445 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4460 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4446 '?' in them would confuse the help system. Reported by Alex
4461 '?' in them would confuse the help system. Reported by Alex
4447 Schmolck.
4462 Schmolck.
4448
4463
4449 2004-07-16 Fernando Perez <fperez@colorado.edu>
4464 2004-07-16 Fernando Perez <fperez@colorado.edu>
4450
4465
4451 * IPython/GnuplotInteractive.py (__all__): added plot2.
4466 * IPython/GnuplotInteractive.py (__all__): added plot2.
4452
4467
4453 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4468 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4454 plotting dictionaries, lists or tuples of 1d arrays.
4469 plotting dictionaries, lists or tuples of 1d arrays.
4455
4470
4456 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4471 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4457 optimizations.
4472 optimizations.
4458
4473
4459 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4474 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4460 the information which was there from Janko's original IPP code:
4475 the information which was there from Janko's original IPP code:
4461
4476
4462 03.05.99 20:53 porto.ifm.uni-kiel.de
4477 03.05.99 20:53 porto.ifm.uni-kiel.de
4463 --Started changelog.
4478 --Started changelog.
4464 --make clear do what it say it does
4479 --make clear do what it say it does
4465 --added pretty output of lines from inputcache
4480 --added pretty output of lines from inputcache
4466 --Made Logger a mixin class, simplifies handling of switches
4481 --Made Logger a mixin class, simplifies handling of switches
4467 --Added own completer class. .string<TAB> expands to last history
4482 --Added own completer class. .string<TAB> expands to last history
4468 line which starts with string. The new expansion is also present
4483 line which starts with string. The new expansion is also present
4469 with Ctrl-r from the readline library. But this shows, who this
4484 with Ctrl-r from the readline library. But this shows, who this
4470 can be done for other cases.
4485 can be done for other cases.
4471 --Added convention that all shell functions should accept a
4486 --Added convention that all shell functions should accept a
4472 parameter_string This opens the door for different behaviour for
4487 parameter_string This opens the door for different behaviour for
4473 each function. @cd is a good example of this.
4488 each function. @cd is a good example of this.
4474
4489
4475 04.05.99 12:12 porto.ifm.uni-kiel.de
4490 04.05.99 12:12 porto.ifm.uni-kiel.de
4476 --added logfile rotation
4491 --added logfile rotation
4477 --added new mainloop method which freezes first the namespace
4492 --added new mainloop method which freezes first the namespace
4478
4493
4479 07.05.99 21:24 porto.ifm.uni-kiel.de
4494 07.05.99 21:24 porto.ifm.uni-kiel.de
4480 --added the docreader classes. Now there is a help system.
4495 --added the docreader classes. Now there is a help system.
4481 -This is only a first try. Currently it's not easy to put new
4496 -This is only a first try. Currently it's not easy to put new
4482 stuff in the indices. But this is the way to go. Info would be
4497 stuff in the indices. But this is the way to go. Info would be
4483 better, but HTML is every where and not everybody has an info
4498 better, but HTML is every where and not everybody has an info
4484 system installed and it's not so easy to change html-docs to info.
4499 system installed and it's not so easy to change html-docs to info.
4485 --added global logfile option
4500 --added global logfile option
4486 --there is now a hook for object inspection method pinfo needs to
4501 --there is now a hook for object inspection method pinfo needs to
4487 be provided for this. Can be reached by two '??'.
4502 be provided for this. Can be reached by two '??'.
4488
4503
4489 08.05.99 20:51 porto.ifm.uni-kiel.de
4504 08.05.99 20:51 porto.ifm.uni-kiel.de
4490 --added a README
4505 --added a README
4491 --bug in rc file. Something has changed so functions in the rc
4506 --bug in rc file. Something has changed so functions in the rc
4492 file need to reference the shell and not self. Not clear if it's a
4507 file need to reference the shell and not self. Not clear if it's a
4493 bug or feature.
4508 bug or feature.
4494 --changed rc file for new behavior
4509 --changed rc file for new behavior
4495
4510
4496 2004-07-15 Fernando Perez <fperez@colorado.edu>
4511 2004-07-15 Fernando Perez <fperez@colorado.edu>
4497
4512
4498 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4513 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4499 cache was falling out of sync in bizarre manners when multi-line
4514 cache was falling out of sync in bizarre manners when multi-line
4500 input was present. Minor optimizations and cleanup.
4515 input was present. Minor optimizations and cleanup.
4501
4516
4502 (Logger): Remove old Changelog info for cleanup. This is the
4517 (Logger): Remove old Changelog info for cleanup. This is the
4503 information which was there from Janko's original code:
4518 information which was there from Janko's original code:
4504
4519
4505 Changes to Logger: - made the default log filename a parameter
4520 Changes to Logger: - made the default log filename a parameter
4506
4521
4507 - put a check for lines beginning with !@? in log(). Needed
4522 - put a check for lines beginning with !@? in log(). Needed
4508 (even if the handlers properly log their lines) for mid-session
4523 (even if the handlers properly log their lines) for mid-session
4509 logging activation to work properly. Without this, lines logged
4524 logging activation to work properly. Without this, lines logged
4510 in mid session, which get read from the cache, would end up
4525 in mid session, which get read from the cache, would end up
4511 'bare' (with !@? in the open) in the log. Now they are caught
4526 'bare' (with !@? in the open) in the log. Now they are caught
4512 and prepended with a #.
4527 and prepended with a #.
4513
4528
4514 * IPython/iplib.py (InteractiveShell.init_readline): added check
4529 * IPython/iplib.py (InteractiveShell.init_readline): added check
4515 in case MagicCompleter fails to be defined, so we don't crash.
4530 in case MagicCompleter fails to be defined, so we don't crash.
4516
4531
4517 2004-07-13 Fernando Perez <fperez@colorado.edu>
4532 2004-07-13 Fernando Perez <fperez@colorado.edu>
4518
4533
4519 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4534 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4520 of EPS if the requested filename ends in '.eps'.
4535 of EPS if the requested filename ends in '.eps'.
4521
4536
4522 2004-07-04 Fernando Perez <fperez@colorado.edu>
4537 2004-07-04 Fernando Perez <fperez@colorado.edu>
4523
4538
4524 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4539 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4525 escaping of quotes when calling the shell.
4540 escaping of quotes when calling the shell.
4526
4541
4527 2004-07-02 Fernando Perez <fperez@colorado.edu>
4542 2004-07-02 Fernando Perez <fperez@colorado.edu>
4528
4543
4529 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4544 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4530 gettext not working because we were clobbering '_'. Fixes
4545 gettext not working because we were clobbering '_'. Fixes
4531 http://www.scipy.net/roundup/ipython/issue6.
4546 http://www.scipy.net/roundup/ipython/issue6.
4532
4547
4533 2004-07-01 Fernando Perez <fperez@colorado.edu>
4548 2004-07-01 Fernando Perez <fperez@colorado.edu>
4534
4549
4535 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4550 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4536 into @cd. Patch by Ville.
4551 into @cd. Patch by Ville.
4537
4552
4538 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4553 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4539 new function to store things after ipmaker runs. Patch by Ville.
4554 new function to store things after ipmaker runs. Patch by Ville.
4540 Eventually this will go away once ipmaker is removed and the class
4555 Eventually this will go away once ipmaker is removed and the class
4541 gets cleaned up, but for now it's ok. Key functionality here is
4556 gets cleaned up, but for now it's ok. Key functionality here is
4542 the addition of the persistent storage mechanism, a dict for
4557 the addition of the persistent storage mechanism, a dict for
4543 keeping data across sessions (for now just bookmarks, but more can
4558 keeping data across sessions (for now just bookmarks, but more can
4544 be implemented later).
4559 be implemented later).
4545
4560
4546 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4561 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4547 persistent across sections. Patch by Ville, I modified it
4562 persistent across sections. Patch by Ville, I modified it
4548 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4563 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4549 added a '-l' option to list all bookmarks.
4564 added a '-l' option to list all bookmarks.
4550
4565
4551 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4566 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4552 center for cleanup. Registered with atexit.register(). I moved
4567 center for cleanup. Registered with atexit.register(). I moved
4553 here the old exit_cleanup(). After a patch by Ville.
4568 here the old exit_cleanup(). After a patch by Ville.
4554
4569
4555 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4570 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4556 characters in the hacked shlex_split for python 2.2.
4571 characters in the hacked shlex_split for python 2.2.
4557
4572
4558 * IPython/iplib.py (file_matches): more fixes to filenames with
4573 * IPython/iplib.py (file_matches): more fixes to filenames with
4559 whitespace in them. It's not perfect, but limitations in python's
4574 whitespace in them. It's not perfect, but limitations in python's
4560 readline make it impossible to go further.
4575 readline make it impossible to go further.
4561
4576
4562 2004-06-29 Fernando Perez <fperez@colorado.edu>
4577 2004-06-29 Fernando Perez <fperez@colorado.edu>
4563
4578
4564 * IPython/iplib.py (file_matches): escape whitespace correctly in
4579 * IPython/iplib.py (file_matches): escape whitespace correctly in
4565 filename completions. Bug reported by Ville.
4580 filename completions. Bug reported by Ville.
4566
4581
4567 2004-06-28 Fernando Perez <fperez@colorado.edu>
4582 2004-06-28 Fernando Perez <fperez@colorado.edu>
4568
4583
4569 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4584 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4570 the history file will be called 'history-PROFNAME' (or just
4585 the history file will be called 'history-PROFNAME' (or just
4571 'history' if no profile is loaded). I was getting annoyed at
4586 'history' if no profile is loaded). I was getting annoyed at
4572 getting my Numerical work history clobbered by pysh sessions.
4587 getting my Numerical work history clobbered by pysh sessions.
4573
4588
4574 * IPython/iplib.py (InteractiveShell.__init__): Internal
4589 * IPython/iplib.py (InteractiveShell.__init__): Internal
4575 getoutputerror() function so that we can honor the system_verbose
4590 getoutputerror() function so that we can honor the system_verbose
4576 flag for _all_ system calls. I also added escaping of #
4591 flag for _all_ system calls. I also added escaping of #
4577 characters here to avoid confusing Itpl.
4592 characters here to avoid confusing Itpl.
4578
4593
4579 * IPython/Magic.py (shlex_split): removed call to shell in
4594 * IPython/Magic.py (shlex_split): removed call to shell in
4580 parse_options and replaced it with shlex.split(). The annoying
4595 parse_options and replaced it with shlex.split(). The annoying
4581 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4596 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4582 to backport it from 2.3, with several frail hacks (the shlex
4597 to backport it from 2.3, with several frail hacks (the shlex
4583 module is rather limited in 2.2). Thanks to a suggestion by Ville
4598 module is rather limited in 2.2). Thanks to a suggestion by Ville
4584 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4599 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4585 problem.
4600 problem.
4586
4601
4587 (Magic.magic_system_verbose): new toggle to print the actual
4602 (Magic.magic_system_verbose): new toggle to print the actual
4588 system calls made by ipython. Mainly for debugging purposes.
4603 system calls made by ipython. Mainly for debugging purposes.
4589
4604
4590 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4605 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4591 doesn't support persistence. Reported (and fix suggested) by
4606 doesn't support persistence. Reported (and fix suggested) by
4592 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4607 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4593
4608
4594 2004-06-26 Fernando Perez <fperez@colorado.edu>
4609 2004-06-26 Fernando Perez <fperez@colorado.edu>
4595
4610
4596 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4611 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4597 continue prompts.
4612 continue prompts.
4598
4613
4599 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4614 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4600 function (basically a big docstring) and a few more things here to
4615 function (basically a big docstring) and a few more things here to
4601 speedup startup. pysh.py is now very lightweight. We want because
4616 speedup startup. pysh.py is now very lightweight. We want because
4602 it gets execfile'd, while InterpreterExec gets imported, so
4617 it gets execfile'd, while InterpreterExec gets imported, so
4603 byte-compilation saves time.
4618 byte-compilation saves time.
4604
4619
4605 2004-06-25 Fernando Perez <fperez@colorado.edu>
4620 2004-06-25 Fernando Perez <fperez@colorado.edu>
4606
4621
4607 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4622 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4608 -NUM', which was recently broken.
4623 -NUM', which was recently broken.
4609
4624
4610 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4625 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4611 in multi-line input (but not !!, which doesn't make sense there).
4626 in multi-line input (but not !!, which doesn't make sense there).
4612
4627
4613 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4628 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4614 It's just too useful, and people can turn it off in the less
4629 It's just too useful, and people can turn it off in the less
4615 common cases where it's a problem.
4630 common cases where it's a problem.
4616
4631
4617 2004-06-24 Fernando Perez <fperez@colorado.edu>
4632 2004-06-24 Fernando Perez <fperez@colorado.edu>
4618
4633
4619 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4634 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4620 special syntaxes (like alias calling) is now allied in multi-line
4635 special syntaxes (like alias calling) is now allied in multi-line
4621 input. This is still _very_ experimental, but it's necessary for
4636 input. This is still _very_ experimental, but it's necessary for
4622 efficient shell usage combining python looping syntax with system
4637 efficient shell usage combining python looping syntax with system
4623 calls. For now it's restricted to aliases, I don't think it
4638 calls. For now it's restricted to aliases, I don't think it
4624 really even makes sense to have this for magics.
4639 really even makes sense to have this for magics.
4625
4640
4626 2004-06-23 Fernando Perez <fperez@colorado.edu>
4641 2004-06-23 Fernando Perez <fperez@colorado.edu>
4627
4642
4628 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4643 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4629 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4644 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4630
4645
4631 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4646 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4632 extensions under Windows (after code sent by Gary Bishop). The
4647 extensions under Windows (after code sent by Gary Bishop). The
4633 extensions considered 'executable' are stored in IPython's rc
4648 extensions considered 'executable' are stored in IPython's rc
4634 structure as win_exec_ext.
4649 structure as win_exec_ext.
4635
4650
4636 * IPython/genutils.py (shell): new function, like system() but
4651 * IPython/genutils.py (shell): new function, like system() but
4637 without return value. Very useful for interactive shell work.
4652 without return value. Very useful for interactive shell work.
4638
4653
4639 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4654 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4640 delete aliases.
4655 delete aliases.
4641
4656
4642 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4657 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4643 sure that the alias table doesn't contain python keywords.
4658 sure that the alias table doesn't contain python keywords.
4644
4659
4645 2004-06-21 Fernando Perez <fperez@colorado.edu>
4660 2004-06-21 Fernando Perez <fperez@colorado.edu>
4646
4661
4647 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4662 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4648 non-existent items are found in $PATH. Reported by Thorsten.
4663 non-existent items are found in $PATH. Reported by Thorsten.
4649
4664
4650 2004-06-20 Fernando Perez <fperez@colorado.edu>
4665 2004-06-20 Fernando Perez <fperez@colorado.edu>
4651
4666
4652 * IPython/iplib.py (complete): modified the completer so that the
4667 * IPython/iplib.py (complete): modified the completer so that the
4653 order of priorities can be easily changed at runtime.
4668 order of priorities can be easily changed at runtime.
4654
4669
4655 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4670 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4656 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4671 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4657
4672
4658 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4673 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4659 expand Python variables prepended with $ in all system calls. The
4674 expand Python variables prepended with $ in all system calls. The
4660 same was done to InteractiveShell.handle_shell_escape. Now all
4675 same was done to InteractiveShell.handle_shell_escape. Now all
4661 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4676 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4662 expansion of python variables and expressions according to the
4677 expansion of python variables and expressions according to the
4663 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4678 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4664
4679
4665 Though PEP-215 has been rejected, a similar (but simpler) one
4680 Though PEP-215 has been rejected, a similar (but simpler) one
4666 seems like it will go into Python 2.4, PEP-292 -
4681 seems like it will go into Python 2.4, PEP-292 -
4667 http://www.python.org/peps/pep-0292.html.
4682 http://www.python.org/peps/pep-0292.html.
4668
4683
4669 I'll keep the full syntax of PEP-215, since IPython has since the
4684 I'll keep the full syntax of PEP-215, since IPython has since the
4670 start used Ka-Ping Yee's reference implementation discussed there
4685 start used Ka-Ping Yee's reference implementation discussed there
4671 (Itpl), and I actually like the powerful semantics it offers.
4686 (Itpl), and I actually like the powerful semantics it offers.
4672
4687
4673 In order to access normal shell variables, the $ has to be escaped
4688 In order to access normal shell variables, the $ has to be escaped
4674 via an extra $. For example:
4689 via an extra $. For example:
4675
4690
4676 In [7]: PATH='a python variable'
4691 In [7]: PATH='a python variable'
4677
4692
4678 In [8]: !echo $PATH
4693 In [8]: !echo $PATH
4679 a python variable
4694 a python variable
4680
4695
4681 In [9]: !echo $$PATH
4696 In [9]: !echo $$PATH
4682 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4697 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4683
4698
4684 (Magic.parse_options): escape $ so the shell doesn't evaluate
4699 (Magic.parse_options): escape $ so the shell doesn't evaluate
4685 things prematurely.
4700 things prematurely.
4686
4701
4687 * IPython/iplib.py (InteractiveShell.call_alias): added the
4702 * IPython/iplib.py (InteractiveShell.call_alias): added the
4688 ability for aliases to expand python variables via $.
4703 ability for aliases to expand python variables via $.
4689
4704
4690 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4705 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4691 system, now there's a @rehash/@rehashx pair of magics. These work
4706 system, now there's a @rehash/@rehashx pair of magics. These work
4692 like the csh rehash command, and can be invoked at any time. They
4707 like the csh rehash command, and can be invoked at any time. They
4693 build a table of aliases to everything in the user's $PATH
4708 build a table of aliases to everything in the user's $PATH
4694 (@rehash uses everything, @rehashx is slower but only adds
4709 (@rehash uses everything, @rehashx is slower but only adds
4695 executable files). With this, the pysh.py-based shell profile can
4710 executable files). With this, the pysh.py-based shell profile can
4696 now simply call rehash upon startup, and full access to all
4711 now simply call rehash upon startup, and full access to all
4697 programs in the user's path is obtained.
4712 programs in the user's path is obtained.
4698
4713
4699 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4714 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4700 functionality is now fully in place. I removed the old dynamic
4715 functionality is now fully in place. I removed the old dynamic
4701 code generation based approach, in favor of a much lighter one
4716 code generation based approach, in favor of a much lighter one
4702 based on a simple dict. The advantage is that this allows me to
4717 based on a simple dict. The advantage is that this allows me to
4703 now have thousands of aliases with negligible cost (unthinkable
4718 now have thousands of aliases with negligible cost (unthinkable
4704 with the old system).
4719 with the old system).
4705
4720
4706 2004-06-19 Fernando Perez <fperez@colorado.edu>
4721 2004-06-19 Fernando Perez <fperez@colorado.edu>
4707
4722
4708 * IPython/iplib.py (__init__): extended MagicCompleter class to
4723 * IPython/iplib.py (__init__): extended MagicCompleter class to
4709 also complete (last in priority) on user aliases.
4724 also complete (last in priority) on user aliases.
4710
4725
4711 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4726 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4712 call to eval.
4727 call to eval.
4713 (ItplNS.__init__): Added a new class which functions like Itpl,
4728 (ItplNS.__init__): Added a new class which functions like Itpl,
4714 but allows configuring the namespace for the evaluation to occur
4729 but allows configuring the namespace for the evaluation to occur
4715 in.
4730 in.
4716
4731
4717 2004-06-18 Fernando Perez <fperez@colorado.edu>
4732 2004-06-18 Fernando Perez <fperez@colorado.edu>
4718
4733
4719 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4734 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4720 better message when 'exit' or 'quit' are typed (a common newbie
4735 better message when 'exit' or 'quit' are typed (a common newbie
4721 confusion).
4736 confusion).
4722
4737
4723 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4738 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4724 check for Windows users.
4739 check for Windows users.
4725
4740
4726 * IPython/iplib.py (InteractiveShell.user_setup): removed
4741 * IPython/iplib.py (InteractiveShell.user_setup): removed
4727 disabling of colors for Windows. I'll test at runtime and issue a
4742 disabling of colors for Windows. I'll test at runtime and issue a
4728 warning if Gary's readline isn't found, as to nudge users to
4743 warning if Gary's readline isn't found, as to nudge users to
4729 download it.
4744 download it.
4730
4745
4731 2004-06-16 Fernando Perez <fperez@colorado.edu>
4746 2004-06-16 Fernando Perez <fperez@colorado.edu>
4732
4747
4733 * IPython/genutils.py (Stream.__init__): changed to print errors
4748 * IPython/genutils.py (Stream.__init__): changed to print errors
4734 to sys.stderr. I had a circular dependency here. Now it's
4749 to sys.stderr. I had a circular dependency here. Now it's
4735 possible to run ipython as IDLE's shell (consider this pre-alpha,
4750 possible to run ipython as IDLE's shell (consider this pre-alpha,
4736 since true stdout things end up in the starting terminal instead
4751 since true stdout things end up in the starting terminal instead
4737 of IDLE's out).
4752 of IDLE's out).
4738
4753
4739 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4754 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4740 users who haven't # updated their prompt_in2 definitions. Remove
4755 users who haven't # updated their prompt_in2 definitions. Remove
4741 eventually.
4756 eventually.
4742 (multiple_replace): added credit to original ASPN recipe.
4757 (multiple_replace): added credit to original ASPN recipe.
4743
4758
4744 2004-06-15 Fernando Perez <fperez@colorado.edu>
4759 2004-06-15 Fernando Perez <fperez@colorado.edu>
4745
4760
4746 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4761 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4747 list of auto-defined aliases.
4762 list of auto-defined aliases.
4748
4763
4749 2004-06-13 Fernando Perez <fperez@colorado.edu>
4764 2004-06-13 Fernando Perez <fperez@colorado.edu>
4750
4765
4751 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4766 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4752 install was really requested (so setup.py can be used for other
4767 install was really requested (so setup.py can be used for other
4753 things under Windows).
4768 things under Windows).
4754
4769
4755 2004-06-10 Fernando Perez <fperez@colorado.edu>
4770 2004-06-10 Fernando Perez <fperez@colorado.edu>
4756
4771
4757 * IPython/Logger.py (Logger.create_log): Manually remove any old
4772 * IPython/Logger.py (Logger.create_log): Manually remove any old
4758 backup, since os.remove may fail under Windows. Fixes bug
4773 backup, since os.remove may fail under Windows. Fixes bug
4759 reported by Thorsten.
4774 reported by Thorsten.
4760
4775
4761 2004-06-09 Fernando Perez <fperez@colorado.edu>
4776 2004-06-09 Fernando Perez <fperez@colorado.edu>
4762
4777
4763 * examples/example-embed.py: fixed all references to %n (replaced
4778 * examples/example-embed.py: fixed all references to %n (replaced
4764 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4779 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4765 for all examples and the manual as well.
4780 for all examples and the manual as well.
4766
4781
4767 2004-06-08 Fernando Perez <fperez@colorado.edu>
4782 2004-06-08 Fernando Perez <fperez@colorado.edu>
4768
4783
4769 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4784 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4770 alignment and color management. All 3 prompt subsystems now
4785 alignment and color management. All 3 prompt subsystems now
4771 inherit from BasePrompt.
4786 inherit from BasePrompt.
4772
4787
4773 * tools/release: updates for windows installer build and tag rpms
4788 * tools/release: updates for windows installer build and tag rpms
4774 with python version (since paths are fixed).
4789 with python version (since paths are fixed).
4775
4790
4776 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4791 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4777 which will become eventually obsolete. Also fixed the default
4792 which will become eventually obsolete. Also fixed the default
4778 prompt_in2 to use \D, so at least new users start with the correct
4793 prompt_in2 to use \D, so at least new users start with the correct
4779 defaults.
4794 defaults.
4780 WARNING: Users with existing ipythonrc files will need to apply
4795 WARNING: Users with existing ipythonrc files will need to apply
4781 this fix manually!
4796 this fix manually!
4782
4797
4783 * setup.py: make windows installer (.exe). This is finally the
4798 * setup.py: make windows installer (.exe). This is finally the
4784 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4799 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4785 which I hadn't included because it required Python 2.3 (or recent
4800 which I hadn't included because it required Python 2.3 (or recent
4786 distutils).
4801 distutils).
4787
4802
4788 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4803 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4789 usage of new '\D' escape.
4804 usage of new '\D' escape.
4790
4805
4791 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4806 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4792 lacks os.getuid())
4807 lacks os.getuid())
4793 (CachedOutput.set_colors): Added the ability to turn coloring
4808 (CachedOutput.set_colors): Added the ability to turn coloring
4794 on/off with @colors even for manually defined prompt colors. It
4809 on/off with @colors even for manually defined prompt colors. It
4795 uses a nasty global, but it works safely and via the generic color
4810 uses a nasty global, but it works safely and via the generic color
4796 handling mechanism.
4811 handling mechanism.
4797 (Prompt2.__init__): Introduced new escape '\D' for continuation
4812 (Prompt2.__init__): Introduced new escape '\D' for continuation
4798 prompts. It represents the counter ('\#') as dots.
4813 prompts. It represents the counter ('\#') as dots.
4799 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4814 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4800 need to update their ipythonrc files and replace '%n' with '\D' in
4815 need to update their ipythonrc files and replace '%n' with '\D' in
4801 their prompt_in2 settings everywhere. Sorry, but there's
4816 their prompt_in2 settings everywhere. Sorry, but there's
4802 otherwise no clean way to get all prompts to properly align. The
4817 otherwise no clean way to get all prompts to properly align. The
4803 ipythonrc shipped with IPython has been updated.
4818 ipythonrc shipped with IPython has been updated.
4804
4819
4805 2004-06-07 Fernando Perez <fperez@colorado.edu>
4820 2004-06-07 Fernando Perez <fperez@colorado.edu>
4806
4821
4807 * setup.py (isfile): Pass local_icons option to latex2html, so the
4822 * setup.py (isfile): Pass local_icons option to latex2html, so the
4808 resulting HTML file is self-contained. Thanks to
4823 resulting HTML file is self-contained. Thanks to
4809 dryice-AT-liu.com.cn for the tip.
4824 dryice-AT-liu.com.cn for the tip.
4810
4825
4811 * pysh.py: I created a new profile 'shell', which implements a
4826 * pysh.py: I created a new profile 'shell', which implements a
4812 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4827 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4813 system shell, nor will it become one anytime soon. It's mainly
4828 system shell, nor will it become one anytime soon. It's mainly
4814 meant to illustrate the use of the new flexible bash-like prompts.
4829 meant to illustrate the use of the new flexible bash-like prompts.
4815 I guess it could be used by hardy souls for true shell management,
4830 I guess it could be used by hardy souls for true shell management,
4816 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4831 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4817 profile. This uses the InterpreterExec extension provided by
4832 profile. This uses the InterpreterExec extension provided by
4818 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4833 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4819
4834
4820 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4835 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4821 auto-align itself with the length of the previous input prompt
4836 auto-align itself with the length of the previous input prompt
4822 (taking into account the invisible color escapes).
4837 (taking into account the invisible color escapes).
4823 (CachedOutput.__init__): Large restructuring of this class. Now
4838 (CachedOutput.__init__): Large restructuring of this class. Now
4824 all three prompts (primary1, primary2, output) are proper objects,
4839 all three prompts (primary1, primary2, output) are proper objects,
4825 managed by the 'parent' CachedOutput class. The code is still a
4840 managed by the 'parent' CachedOutput class. The code is still a
4826 bit hackish (all prompts share state via a pointer to the cache),
4841 bit hackish (all prompts share state via a pointer to the cache),
4827 but it's overall far cleaner than before.
4842 but it's overall far cleaner than before.
4828
4843
4829 * IPython/genutils.py (getoutputerror): modified to add verbose,
4844 * IPython/genutils.py (getoutputerror): modified to add verbose,
4830 debug and header options. This makes the interface of all getout*
4845 debug and header options. This makes the interface of all getout*
4831 functions uniform.
4846 functions uniform.
4832 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4847 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4833
4848
4834 * IPython/Magic.py (Magic.default_option): added a function to
4849 * IPython/Magic.py (Magic.default_option): added a function to
4835 allow registering default options for any magic command. This
4850 allow registering default options for any magic command. This
4836 makes it easy to have profiles which customize the magics globally
4851 makes it easy to have profiles which customize the magics globally
4837 for a certain use. The values set through this function are
4852 for a certain use. The values set through this function are
4838 picked up by the parse_options() method, which all magics should
4853 picked up by the parse_options() method, which all magics should
4839 use to parse their options.
4854 use to parse their options.
4840
4855
4841 * IPython/genutils.py (warn): modified the warnings framework to
4856 * IPython/genutils.py (warn): modified the warnings framework to
4842 use the Term I/O class. I'm trying to slowly unify all of
4857 use the Term I/O class. I'm trying to slowly unify all of
4843 IPython's I/O operations to pass through Term.
4858 IPython's I/O operations to pass through Term.
4844
4859
4845 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4860 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4846 the secondary prompt to correctly match the length of the primary
4861 the secondary prompt to correctly match the length of the primary
4847 one for any prompt. Now multi-line code will properly line up
4862 one for any prompt. Now multi-line code will properly line up
4848 even for path dependent prompts, such as the new ones available
4863 even for path dependent prompts, such as the new ones available
4849 via the prompt_specials.
4864 via the prompt_specials.
4850
4865
4851 2004-06-06 Fernando Perez <fperez@colorado.edu>
4866 2004-06-06 Fernando Perez <fperez@colorado.edu>
4852
4867
4853 * IPython/Prompts.py (prompt_specials): Added the ability to have
4868 * IPython/Prompts.py (prompt_specials): Added the ability to have
4854 bash-like special sequences in the prompts, which get
4869 bash-like special sequences in the prompts, which get
4855 automatically expanded. Things like hostname, current working
4870 automatically expanded. Things like hostname, current working
4856 directory and username are implemented already, but it's easy to
4871 directory and username are implemented already, but it's easy to
4857 add more in the future. Thanks to a patch by W.J. van der Laan
4872 add more in the future. Thanks to a patch by W.J. van der Laan
4858 <gnufnork-AT-hetdigitalegat.nl>
4873 <gnufnork-AT-hetdigitalegat.nl>
4859 (prompt_specials): Added color support for prompt strings, so
4874 (prompt_specials): Added color support for prompt strings, so
4860 users can define arbitrary color setups for their prompts.
4875 users can define arbitrary color setups for their prompts.
4861
4876
4862 2004-06-05 Fernando Perez <fperez@colorado.edu>
4877 2004-06-05 Fernando Perez <fperez@colorado.edu>
4863
4878
4864 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4879 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4865 code to load Gary Bishop's readline and configure it
4880 code to load Gary Bishop's readline and configure it
4866 automatically. Thanks to Gary for help on this.
4881 automatically. Thanks to Gary for help on this.
4867
4882
4868 2004-06-01 Fernando Perez <fperez@colorado.edu>
4883 2004-06-01 Fernando Perez <fperez@colorado.edu>
4869
4884
4870 * IPython/Logger.py (Logger.create_log): fix bug for logging
4885 * IPython/Logger.py (Logger.create_log): fix bug for logging
4871 with no filename (previous fix was incomplete).
4886 with no filename (previous fix was incomplete).
4872
4887
4873 2004-05-25 Fernando Perez <fperez@colorado.edu>
4888 2004-05-25 Fernando Perez <fperez@colorado.edu>
4874
4889
4875 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4890 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4876 parens would get passed to the shell.
4891 parens would get passed to the shell.
4877
4892
4878 2004-05-20 Fernando Perez <fperez@colorado.edu>
4893 2004-05-20 Fernando Perez <fperez@colorado.edu>
4879
4894
4880 * IPython/Magic.py (Magic.magic_prun): changed default profile
4895 * IPython/Magic.py (Magic.magic_prun): changed default profile
4881 sort order to 'time' (the more common profiling need).
4896 sort order to 'time' (the more common profiling need).
4882
4897
4883 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4898 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4884 so that source code shown is guaranteed in sync with the file on
4899 so that source code shown is guaranteed in sync with the file on
4885 disk (also changed in psource). Similar fix to the one for
4900 disk (also changed in psource). Similar fix to the one for
4886 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4901 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4887 <yann.ledu-AT-noos.fr>.
4902 <yann.ledu-AT-noos.fr>.
4888
4903
4889 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4904 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4890 with a single option would not be correctly parsed. Closes
4905 with a single option would not be correctly parsed. Closes
4891 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4906 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4892 introduced in 0.6.0 (on 2004-05-06).
4907 introduced in 0.6.0 (on 2004-05-06).
4893
4908
4894 2004-05-13 *** Released version 0.6.0
4909 2004-05-13 *** Released version 0.6.0
4895
4910
4896 2004-05-13 Fernando Perez <fperez@colorado.edu>
4911 2004-05-13 Fernando Perez <fperez@colorado.edu>
4897
4912
4898 * debian/: Added debian/ directory to CVS, so that debian support
4913 * debian/: Added debian/ directory to CVS, so that debian support
4899 is publicly accessible. The debian package is maintained by Jack
4914 is publicly accessible. The debian package is maintained by Jack
4900 Moffit <jack-AT-xiph.org>.
4915 Moffit <jack-AT-xiph.org>.
4901
4916
4902 * Documentation: included the notes about an ipython-based system
4917 * Documentation: included the notes about an ipython-based system
4903 shell (the hypothetical 'pysh') into the new_design.pdf document,
4918 shell (the hypothetical 'pysh') into the new_design.pdf document,
4904 so that these ideas get distributed to users along with the
4919 so that these ideas get distributed to users along with the
4905 official documentation.
4920 official documentation.
4906
4921
4907 2004-05-10 Fernando Perez <fperez@colorado.edu>
4922 2004-05-10 Fernando Perez <fperez@colorado.edu>
4908
4923
4909 * IPython/Logger.py (Logger.create_log): fix recently introduced
4924 * IPython/Logger.py (Logger.create_log): fix recently introduced
4910 bug (misindented line) where logstart would fail when not given an
4925 bug (misindented line) where logstart would fail when not given an
4911 explicit filename.
4926 explicit filename.
4912
4927
4913 2004-05-09 Fernando Perez <fperez@colorado.edu>
4928 2004-05-09 Fernando Perez <fperez@colorado.edu>
4914
4929
4915 * IPython/Magic.py (Magic.parse_options): skip system call when
4930 * IPython/Magic.py (Magic.parse_options): skip system call when
4916 there are no options to look for. Faster, cleaner for the common
4931 there are no options to look for. Faster, cleaner for the common
4917 case.
4932 case.
4918
4933
4919 * Documentation: many updates to the manual: describing Windows
4934 * Documentation: many updates to the manual: describing Windows
4920 support better, Gnuplot updates, credits, misc small stuff. Also
4935 support better, Gnuplot updates, credits, misc small stuff. Also
4921 updated the new_design doc a bit.
4936 updated the new_design doc a bit.
4922
4937
4923 2004-05-06 *** Released version 0.6.0.rc1
4938 2004-05-06 *** Released version 0.6.0.rc1
4924
4939
4925 2004-05-06 Fernando Perez <fperez@colorado.edu>
4940 2004-05-06 Fernando Perez <fperez@colorado.edu>
4926
4941
4927 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4942 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4928 operations to use the vastly more efficient list/''.join() method.
4943 operations to use the vastly more efficient list/''.join() method.
4929 (FormattedTB.text): Fix
4944 (FormattedTB.text): Fix
4930 http://www.scipy.net/roundup/ipython/issue12 - exception source
4945 http://www.scipy.net/roundup/ipython/issue12 - exception source
4931 extract not updated after reload. Thanks to Mike Salib
4946 extract not updated after reload. Thanks to Mike Salib
4932 <msalib-AT-mit.edu> for pinning the source of the problem.
4947 <msalib-AT-mit.edu> for pinning the source of the problem.
4933 Fortunately, the solution works inside ipython and doesn't require
4948 Fortunately, the solution works inside ipython and doesn't require
4934 any changes to python proper.
4949 any changes to python proper.
4935
4950
4936 * IPython/Magic.py (Magic.parse_options): Improved to process the
4951 * IPython/Magic.py (Magic.parse_options): Improved to process the
4937 argument list as a true shell would (by actually using the
4952 argument list as a true shell would (by actually using the
4938 underlying system shell). This way, all @magics automatically get
4953 underlying system shell). This way, all @magics automatically get
4939 shell expansion for variables. Thanks to a comment by Alex
4954 shell expansion for variables. Thanks to a comment by Alex
4940 Schmolck.
4955 Schmolck.
4941
4956
4942 2004-04-04 Fernando Perez <fperez@colorado.edu>
4957 2004-04-04 Fernando Perez <fperez@colorado.edu>
4943
4958
4944 * IPython/iplib.py (InteractiveShell.interact): Added a special
4959 * IPython/iplib.py (InteractiveShell.interact): Added a special
4945 trap for a debugger quit exception, which is basically impossible
4960 trap for a debugger quit exception, which is basically impossible
4946 to handle by normal mechanisms, given what pdb does to the stack.
4961 to handle by normal mechanisms, given what pdb does to the stack.
4947 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4962 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4948
4963
4949 2004-04-03 Fernando Perez <fperez@colorado.edu>
4964 2004-04-03 Fernando Perez <fperez@colorado.edu>
4950
4965
4951 * IPython/genutils.py (Term): Standardized the names of the Term
4966 * IPython/genutils.py (Term): Standardized the names of the Term
4952 class streams to cin/cout/cerr, following C++ naming conventions
4967 class streams to cin/cout/cerr, following C++ naming conventions
4953 (I can't use in/out/err because 'in' is not a valid attribute
4968 (I can't use in/out/err because 'in' is not a valid attribute
4954 name).
4969 name).
4955
4970
4956 * IPython/iplib.py (InteractiveShell.interact): don't increment
4971 * IPython/iplib.py (InteractiveShell.interact): don't increment
4957 the prompt if there's no user input. By Daniel 'Dang' Griffith
4972 the prompt if there's no user input. By Daniel 'Dang' Griffith
4958 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4973 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4959 Francois Pinard.
4974 Francois Pinard.
4960
4975
4961 2004-04-02 Fernando Perez <fperez@colorado.edu>
4976 2004-04-02 Fernando Perez <fperez@colorado.edu>
4962
4977
4963 * IPython/genutils.py (Stream.__init__): Modified to survive at
4978 * IPython/genutils.py (Stream.__init__): Modified to survive at
4964 least importing in contexts where stdin/out/err aren't true file
4979 least importing in contexts where stdin/out/err aren't true file
4965 objects, such as PyCrust (they lack fileno() and mode). However,
4980 objects, such as PyCrust (they lack fileno() and mode). However,
4966 the recovery facilities which rely on these things existing will
4981 the recovery facilities which rely on these things existing will
4967 not work.
4982 not work.
4968
4983
4969 2004-04-01 Fernando Perez <fperez@colorado.edu>
4984 2004-04-01 Fernando Perez <fperez@colorado.edu>
4970
4985
4971 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4986 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4972 use the new getoutputerror() function, so it properly
4987 use the new getoutputerror() function, so it properly
4973 distinguishes stdout/err.
4988 distinguishes stdout/err.
4974
4989
4975 * IPython/genutils.py (getoutputerror): added a function to
4990 * IPython/genutils.py (getoutputerror): added a function to
4976 capture separately the standard output and error of a command.
4991 capture separately the standard output and error of a command.
4977 After a comment from dang on the mailing lists. This code is
4992 After a comment from dang on the mailing lists. This code is
4978 basically a modified version of commands.getstatusoutput(), from
4993 basically a modified version of commands.getstatusoutput(), from
4979 the standard library.
4994 the standard library.
4980
4995
4981 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4996 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4982 '!!' as a special syntax (shorthand) to access @sx.
4997 '!!' as a special syntax (shorthand) to access @sx.
4983
4998
4984 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4999 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4985 command and return its output as a list split on '\n'.
5000 command and return its output as a list split on '\n'.
4986
5001
4987 2004-03-31 Fernando Perez <fperez@colorado.edu>
5002 2004-03-31 Fernando Perez <fperez@colorado.edu>
4988
5003
4989 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
5004 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4990 method to dictionaries used as FakeModule instances if they lack
5005 method to dictionaries used as FakeModule instances if they lack
4991 it. At least pydoc in python2.3 breaks for runtime-defined
5006 it. At least pydoc in python2.3 breaks for runtime-defined
4992 functions without this hack. At some point I need to _really_
5007 functions without this hack. At some point I need to _really_
4993 understand what FakeModule is doing, because it's a gross hack.
5008 understand what FakeModule is doing, because it's a gross hack.
4994 But it solves Arnd's problem for now...
5009 But it solves Arnd's problem for now...
4995
5010
4996 2004-02-27 Fernando Perez <fperez@colorado.edu>
5011 2004-02-27 Fernando Perez <fperez@colorado.edu>
4997
5012
4998 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
5013 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4999 mode would behave erratically. Also increased the number of
5014 mode would behave erratically. Also increased the number of
5000 possible logs in rotate mod to 999. Thanks to Rod Holland
5015 possible logs in rotate mod to 999. Thanks to Rod Holland
5001 <rhh@StructureLABS.com> for the report and fixes.
5016 <rhh@StructureLABS.com> for the report and fixes.
5002
5017
5003 2004-02-26 Fernando Perez <fperez@colorado.edu>
5018 2004-02-26 Fernando Perez <fperez@colorado.edu>
5004
5019
5005 * IPython/genutils.py (page): Check that the curses module really
5020 * IPython/genutils.py (page): Check that the curses module really
5006 has the initscr attribute before trying to use it. For some
5021 has the initscr attribute before trying to use it. For some
5007 reason, the Solaris curses module is missing this. I think this
5022 reason, the Solaris curses module is missing this. I think this
5008 should be considered a Solaris python bug, but I'm not sure.
5023 should be considered a Solaris python bug, but I'm not sure.
5009
5024
5010 2004-01-17 Fernando Perez <fperez@colorado.edu>
5025 2004-01-17 Fernando Perez <fperez@colorado.edu>
5011
5026
5012 * IPython/genutils.py (Stream.__init__): Changes to try to make
5027 * IPython/genutils.py (Stream.__init__): Changes to try to make
5013 ipython robust against stdin/out/err being closed by the user.
5028 ipython robust against stdin/out/err being closed by the user.
5014 This is 'user error' (and blocks a normal python session, at least
5029 This is 'user error' (and blocks a normal python session, at least
5015 the stdout case). However, Ipython should be able to survive such
5030 the stdout case). However, Ipython should be able to survive such
5016 instances of abuse as gracefully as possible. To simplify the
5031 instances of abuse as gracefully as possible. To simplify the
5017 coding and maintain compatibility with Gary Bishop's Term
5032 coding and maintain compatibility with Gary Bishop's Term
5018 contributions, I've made use of classmethods for this. I think
5033 contributions, I've made use of classmethods for this. I think
5019 this introduces a dependency on python 2.2.
5034 this introduces a dependency on python 2.2.
5020
5035
5021 2004-01-13 Fernando Perez <fperez@colorado.edu>
5036 2004-01-13 Fernando Perez <fperez@colorado.edu>
5022
5037
5023 * IPython/numutils.py (exp_safe): simplified the code a bit and
5038 * IPython/numutils.py (exp_safe): simplified the code a bit and
5024 removed the need for importing the kinds module altogether.
5039 removed the need for importing the kinds module altogether.
5025
5040
5026 2004-01-06 Fernando Perez <fperez@colorado.edu>
5041 2004-01-06 Fernando Perez <fperez@colorado.edu>
5027
5042
5028 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
5043 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
5029 a magic function instead, after some community feedback. No
5044 a magic function instead, after some community feedback. No
5030 special syntax will exist for it, but its name is deliberately
5045 special syntax will exist for it, but its name is deliberately
5031 very short.
5046 very short.
5032
5047
5033 2003-12-20 Fernando Perez <fperez@colorado.edu>
5048 2003-12-20 Fernando Perez <fperez@colorado.edu>
5034
5049
5035 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
5050 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
5036 new functionality, to automagically assign the result of a shell
5051 new functionality, to automagically assign the result of a shell
5037 command to a variable. I'll solicit some community feedback on
5052 command to a variable. I'll solicit some community feedback on
5038 this before making it permanent.
5053 this before making it permanent.
5039
5054
5040 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
5055 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
5041 requested about callables for which inspect couldn't obtain a
5056 requested about callables for which inspect couldn't obtain a
5042 proper argspec. Thanks to a crash report sent by Etienne
5057 proper argspec. Thanks to a crash report sent by Etienne
5043 Posthumus <etienne-AT-apple01.cs.vu.nl>.
5058 Posthumus <etienne-AT-apple01.cs.vu.nl>.
5044
5059
5045 2003-12-09 Fernando Perez <fperez@colorado.edu>
5060 2003-12-09 Fernando Perez <fperez@colorado.edu>
5046
5061
5047 * IPython/genutils.py (page): patch for the pager to work across
5062 * IPython/genutils.py (page): patch for the pager to work across
5048 various versions of Windows. By Gary Bishop.
5063 various versions of Windows. By Gary Bishop.
5049
5064
5050 2003-12-04 Fernando Perez <fperez@colorado.edu>
5065 2003-12-04 Fernando Perez <fperez@colorado.edu>
5051
5066
5052 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
5067 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
5053 Gnuplot.py version 1.7, whose internal names changed quite a bit.
5068 Gnuplot.py version 1.7, whose internal names changed quite a bit.
5054 While I tested this and it looks ok, there may still be corner
5069 While I tested this and it looks ok, there may still be corner
5055 cases I've missed.
5070 cases I've missed.
5056
5071
5057 2003-12-01 Fernando Perez <fperez@colorado.edu>
5072 2003-12-01 Fernando Perez <fperez@colorado.edu>
5058
5073
5059 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
5074 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
5060 where a line like 'p,q=1,2' would fail because the automagic
5075 where a line like 'p,q=1,2' would fail because the automagic
5061 system would be triggered for @p.
5076 system would be triggered for @p.
5062
5077
5063 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
5078 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
5064 cleanups, code unmodified.
5079 cleanups, code unmodified.
5065
5080
5066 * IPython/genutils.py (Term): added a class for IPython to handle
5081 * IPython/genutils.py (Term): added a class for IPython to handle
5067 output. In most cases it will just be a proxy for stdout/err, but
5082 output. In most cases it will just be a proxy for stdout/err, but
5068 having this allows modifications to be made for some platforms,
5083 having this allows modifications to be made for some platforms,
5069 such as handling color escapes under Windows. All of this code
5084 such as handling color escapes under Windows. All of this code
5070 was contributed by Gary Bishop, with minor modifications by me.
5085 was contributed by Gary Bishop, with minor modifications by me.
5071 The actual changes affect many files.
5086 The actual changes affect many files.
5072
5087
5073 2003-11-30 Fernando Perez <fperez@colorado.edu>
5088 2003-11-30 Fernando Perez <fperez@colorado.edu>
5074
5089
5075 * IPython/iplib.py (file_matches): new completion code, courtesy
5090 * IPython/iplib.py (file_matches): new completion code, courtesy
5076 of Jeff Collins. This enables filename completion again under
5091 of Jeff Collins. This enables filename completion again under
5077 python 2.3, which disabled it at the C level.
5092 python 2.3, which disabled it at the C level.
5078
5093
5079 2003-11-11 Fernando Perez <fperez@colorado.edu>
5094 2003-11-11 Fernando Perez <fperez@colorado.edu>
5080
5095
5081 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
5096 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
5082 for Numeric.array(map(...)), but often convenient.
5097 for Numeric.array(map(...)), but often convenient.
5083
5098
5084 2003-11-05 Fernando Perez <fperez@colorado.edu>
5099 2003-11-05 Fernando Perez <fperez@colorado.edu>
5085
5100
5086 * IPython/numutils.py (frange): Changed a call from int() to
5101 * IPython/numutils.py (frange): Changed a call from int() to
5087 int(round()) to prevent a problem reported with arange() in the
5102 int(round()) to prevent a problem reported with arange() in the
5088 numpy list.
5103 numpy list.
5089
5104
5090 2003-10-06 Fernando Perez <fperez@colorado.edu>
5105 2003-10-06 Fernando Perez <fperez@colorado.edu>
5091
5106
5092 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
5107 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
5093 prevent crashes if sys lacks an argv attribute (it happens with
5108 prevent crashes if sys lacks an argv attribute (it happens with
5094 embedded interpreters which build a bare-bones sys module).
5109 embedded interpreters which build a bare-bones sys module).
5095 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
5110 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
5096
5111
5097 2003-09-24 Fernando Perez <fperez@colorado.edu>
5112 2003-09-24 Fernando Perez <fperez@colorado.edu>
5098
5113
5099 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
5114 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
5100 to protect against poorly written user objects where __getattr__
5115 to protect against poorly written user objects where __getattr__
5101 raises exceptions other than AttributeError. Thanks to a bug
5116 raises exceptions other than AttributeError. Thanks to a bug
5102 report by Oliver Sander <osander-AT-gmx.de>.
5117 report by Oliver Sander <osander-AT-gmx.de>.
5103
5118
5104 * IPython/FakeModule.py (FakeModule.__repr__): this method was
5119 * IPython/FakeModule.py (FakeModule.__repr__): this method was
5105 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
5120 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
5106
5121
5107 2003-09-09 Fernando Perez <fperez@colorado.edu>
5122 2003-09-09 Fernando Perez <fperez@colorado.edu>
5108
5123
5109 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
5124 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
5110 unpacking a list whith a callable as first element would
5125 unpacking a list whith a callable as first element would
5111 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
5126 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
5112 Collins.
5127 Collins.
5113
5128
5114 2003-08-25 *** Released version 0.5.0
5129 2003-08-25 *** Released version 0.5.0
5115
5130
5116 2003-08-22 Fernando Perez <fperez@colorado.edu>
5131 2003-08-22 Fernando Perez <fperez@colorado.edu>
5117
5132
5118 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
5133 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
5119 improperly defined user exceptions. Thanks to feedback from Mark
5134 improperly defined user exceptions. Thanks to feedback from Mark
5120 Russell <mrussell-AT-verio.net>.
5135 Russell <mrussell-AT-verio.net>.
5121
5136
5122 2003-08-20 Fernando Perez <fperez@colorado.edu>
5137 2003-08-20 Fernando Perez <fperez@colorado.edu>
5123
5138
5124 * IPython/OInspect.py (Inspector.pinfo): changed String Form
5139 * IPython/OInspect.py (Inspector.pinfo): changed String Form
5125 printing so that it would print multi-line string forms starting
5140 printing so that it would print multi-line string forms starting
5126 with a new line. This way the formatting is better respected for
5141 with a new line. This way the formatting is better respected for
5127 objects which work hard to make nice string forms.
5142 objects which work hard to make nice string forms.
5128
5143
5129 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
5144 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
5130 autocall would overtake data access for objects with both
5145 autocall would overtake data access for objects with both
5131 __getitem__ and __call__.
5146 __getitem__ and __call__.
5132
5147
5133 2003-08-19 *** Released version 0.5.0-rc1
5148 2003-08-19 *** Released version 0.5.0-rc1
5134
5149
5135 2003-08-19 Fernando Perez <fperez@colorado.edu>
5150 2003-08-19 Fernando Perez <fperez@colorado.edu>
5136
5151
5137 * IPython/deep_reload.py (load_tail): single tiny change here
5152 * IPython/deep_reload.py (load_tail): single tiny change here
5138 seems to fix the long-standing bug of dreload() failing to work
5153 seems to fix the long-standing bug of dreload() failing to work
5139 for dotted names. But this module is pretty tricky, so I may have
5154 for dotted names. But this module is pretty tricky, so I may have
5140 missed some subtlety. Needs more testing!.
5155 missed some subtlety. Needs more testing!.
5141
5156
5142 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
5157 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
5143 exceptions which have badly implemented __str__ methods.
5158 exceptions which have badly implemented __str__ methods.
5144 (VerboseTB.text): harden against inspect.getinnerframes crashing,
5159 (VerboseTB.text): harden against inspect.getinnerframes crashing,
5145 which I've been getting reports about from Python 2.3 users. I
5160 which I've been getting reports about from Python 2.3 users. I
5146 wish I had a simple test case to reproduce the problem, so I could
5161 wish I had a simple test case to reproduce the problem, so I could
5147 either write a cleaner workaround or file a bug report if
5162 either write a cleaner workaround or file a bug report if
5148 necessary.
5163 necessary.
5149
5164
5150 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
5165 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
5151 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
5166 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
5152 a bug report by Tjabo Kloppenburg.
5167 a bug report by Tjabo Kloppenburg.
5153
5168
5154 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
5169 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
5155 crashes. Wrapped the pdb call in a blanket try/except, since pdb
5170 crashes. Wrapped the pdb call in a blanket try/except, since pdb
5156 seems rather unstable. Thanks to a bug report by Tjabo
5171 seems rather unstable. Thanks to a bug report by Tjabo
5157 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
5172 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
5158
5173
5159 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
5174 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
5160 this out soon because of the critical fixes in the inner loop for
5175 this out soon because of the critical fixes in the inner loop for
5161 generators.
5176 generators.
5162
5177
5163 * IPython/Magic.py (Magic.getargspec): removed. This (and
5178 * IPython/Magic.py (Magic.getargspec): removed. This (and
5164 _get_def) have been obsoleted by OInspect for a long time, I
5179 _get_def) have been obsoleted by OInspect for a long time, I
5165 hadn't noticed that they were dead code.
5180 hadn't noticed that they were dead code.
5166 (Magic._ofind): restored _ofind functionality for a few literals
5181 (Magic._ofind): restored _ofind functionality for a few literals
5167 (those in ["''",'""','[]','{}','()']). But it won't work anymore
5182 (those in ["''",'""','[]','{}','()']). But it won't work anymore
5168 for things like "hello".capitalize?, since that would require a
5183 for things like "hello".capitalize?, since that would require a
5169 potentially dangerous eval() again.
5184 potentially dangerous eval() again.
5170
5185
5171 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
5186 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
5172 logic a bit more to clean up the escapes handling and minimize the
5187 logic a bit more to clean up the escapes handling and minimize the
5173 use of _ofind to only necessary cases. The interactive 'feel' of
5188 use of _ofind to only necessary cases. The interactive 'feel' of
5174 IPython should have improved quite a bit with the changes in
5189 IPython should have improved quite a bit with the changes in
5175 _prefilter and _ofind (besides being far safer than before).
5190 _prefilter and _ofind (besides being far safer than before).
5176
5191
5177 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
5192 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
5178 obscure, never reported). Edit would fail to find the object to
5193 obscure, never reported). Edit would fail to find the object to
5179 edit under some circumstances.
5194 edit under some circumstances.
5180 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
5195 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
5181 which were causing double-calling of generators. Those eval calls
5196 which were causing double-calling of generators. Those eval calls
5182 were _very_ dangerous, since code with side effects could be
5197 were _very_ dangerous, since code with side effects could be
5183 triggered. As they say, 'eval is evil'... These were the
5198 triggered. As they say, 'eval is evil'... These were the
5184 nastiest evals in IPython. Besides, _ofind is now far simpler,
5199 nastiest evals in IPython. Besides, _ofind is now far simpler,
5185 and it should also be quite a bit faster. Its use of inspect is
5200 and it should also be quite a bit faster. Its use of inspect is
5186 also safer, so perhaps some of the inspect-related crashes I've
5201 also safer, so perhaps some of the inspect-related crashes I've
5187 seen lately with Python 2.3 might be taken care of. That will
5202 seen lately with Python 2.3 might be taken care of. That will
5188 need more testing.
5203 need more testing.
5189
5204
5190 2003-08-17 Fernando Perez <fperez@colorado.edu>
5205 2003-08-17 Fernando Perez <fperez@colorado.edu>
5191
5206
5192 * IPython/iplib.py (InteractiveShell._prefilter): significant
5207 * IPython/iplib.py (InteractiveShell._prefilter): significant
5193 simplifications to the logic for handling user escapes. Faster
5208 simplifications to the logic for handling user escapes. Faster
5194 and simpler code.
5209 and simpler code.
5195
5210
5196 2003-08-14 Fernando Perez <fperez@colorado.edu>
5211 2003-08-14 Fernando Perez <fperez@colorado.edu>
5197
5212
5198 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
5213 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
5199 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
5214 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
5200 but it should be quite a bit faster. And the recursive version
5215 but it should be quite a bit faster. And the recursive version
5201 generated O(log N) intermediate storage for all rank>1 arrays,
5216 generated O(log N) intermediate storage for all rank>1 arrays,
5202 even if they were contiguous.
5217 even if they were contiguous.
5203 (l1norm): Added this function.
5218 (l1norm): Added this function.
5204 (norm): Added this function for arbitrary norms (including
5219 (norm): Added this function for arbitrary norms (including
5205 l-infinity). l1 and l2 are still special cases for convenience
5220 l-infinity). l1 and l2 are still special cases for convenience
5206 and speed.
5221 and speed.
5207
5222
5208 2003-08-03 Fernando Perez <fperez@colorado.edu>
5223 2003-08-03 Fernando Perez <fperez@colorado.edu>
5209
5224
5210 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
5225 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
5211 exceptions, which now raise PendingDeprecationWarnings in Python
5226 exceptions, which now raise PendingDeprecationWarnings in Python
5212 2.3. There were some in Magic and some in Gnuplot2.
5227 2.3. There were some in Magic and some in Gnuplot2.
5213
5228
5214 2003-06-30 Fernando Perez <fperez@colorado.edu>
5229 2003-06-30 Fernando Perez <fperez@colorado.edu>
5215
5230
5216 * IPython/genutils.py (page): modified to call curses only for
5231 * IPython/genutils.py (page): modified to call curses only for
5217 terminals where TERM=='xterm'. After problems under many other
5232 terminals where TERM=='xterm'. After problems under many other
5218 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
5233 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
5219
5234
5220 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
5235 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
5221 would be triggered when readline was absent. This was just an old
5236 would be triggered when readline was absent. This was just an old
5222 debugging statement I'd forgotten to take out.
5237 debugging statement I'd forgotten to take out.
5223
5238
5224 2003-06-20 Fernando Perez <fperez@colorado.edu>
5239 2003-06-20 Fernando Perez <fperez@colorado.edu>
5225
5240
5226 * IPython/genutils.py (clock): modified to return only user time
5241 * IPython/genutils.py (clock): modified to return only user time
5227 (not counting system time), after a discussion on scipy. While
5242 (not counting system time), after a discussion on scipy. While
5228 system time may be a useful quantity occasionally, it may much
5243 system time may be a useful quantity occasionally, it may much
5229 more easily be skewed by occasional swapping or other similar
5244 more easily be skewed by occasional swapping or other similar
5230 activity.
5245 activity.
5231
5246
5232 2003-06-05 Fernando Perez <fperez@colorado.edu>
5247 2003-06-05 Fernando Perez <fperez@colorado.edu>
5233
5248
5234 * IPython/numutils.py (identity): new function, for building
5249 * IPython/numutils.py (identity): new function, for building
5235 arbitrary rank Kronecker deltas (mostly backwards compatible with
5250 arbitrary rank Kronecker deltas (mostly backwards compatible with
5236 Numeric.identity)
5251 Numeric.identity)
5237
5252
5238 2003-06-03 Fernando Perez <fperez@colorado.edu>
5253 2003-06-03 Fernando Perez <fperez@colorado.edu>
5239
5254
5240 * IPython/iplib.py (InteractiveShell.handle_magic): protect
5255 * IPython/iplib.py (InteractiveShell.handle_magic): protect
5241 arguments passed to magics with spaces, to allow trailing '\' to
5256 arguments passed to magics with spaces, to allow trailing '\' to
5242 work normally (mainly for Windows users).
5257 work normally (mainly for Windows users).
5243
5258
5244 2003-05-29 Fernando Perez <fperez@colorado.edu>
5259 2003-05-29 Fernando Perez <fperez@colorado.edu>
5245
5260
5246 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
5261 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
5247 instead of pydoc.help. This fixes a bizarre behavior where
5262 instead of pydoc.help. This fixes a bizarre behavior where
5248 printing '%s' % locals() would trigger the help system. Now
5263 printing '%s' % locals() would trigger the help system. Now
5249 ipython behaves like normal python does.
5264 ipython behaves like normal python does.
5250
5265
5251 Note that if one does 'from pydoc import help', the bizarre
5266 Note that if one does 'from pydoc import help', the bizarre
5252 behavior returns, but this will also happen in normal python, so
5267 behavior returns, but this will also happen in normal python, so
5253 it's not an ipython bug anymore (it has to do with how pydoc.help
5268 it's not an ipython bug anymore (it has to do with how pydoc.help
5254 is implemented).
5269 is implemented).
5255
5270
5256 2003-05-22 Fernando Perez <fperez@colorado.edu>
5271 2003-05-22 Fernando Perez <fperez@colorado.edu>
5257
5272
5258 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
5273 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
5259 return [] instead of None when nothing matches, also match to end
5274 return [] instead of None when nothing matches, also match to end
5260 of line. Patch by Gary Bishop.
5275 of line. Patch by Gary Bishop.
5261
5276
5262 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
5277 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
5263 protection as before, for files passed on the command line. This
5278 protection as before, for files passed on the command line. This
5264 prevents the CrashHandler from kicking in if user files call into
5279 prevents the CrashHandler from kicking in if user files call into
5265 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
5280 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
5266 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
5281 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
5267
5282
5268 2003-05-20 *** Released version 0.4.0
5283 2003-05-20 *** Released version 0.4.0
5269
5284
5270 2003-05-20 Fernando Perez <fperez@colorado.edu>
5285 2003-05-20 Fernando Perez <fperez@colorado.edu>
5271
5286
5272 * setup.py: added support for manpages. It's a bit hackish b/c of
5287 * setup.py: added support for manpages. It's a bit hackish b/c of
5273 a bug in the way the bdist_rpm distutils target handles gzipped
5288 a bug in the way the bdist_rpm distutils target handles gzipped
5274 manpages, but it works. After a patch by Jack.
5289 manpages, but it works. After a patch by Jack.
5275
5290
5276 2003-05-19 Fernando Perez <fperez@colorado.edu>
5291 2003-05-19 Fernando Perez <fperez@colorado.edu>
5277
5292
5278 * IPython/numutils.py: added a mockup of the kinds module, since
5293 * IPython/numutils.py: added a mockup of the kinds module, since
5279 it was recently removed from Numeric. This way, numutils will
5294 it was recently removed from Numeric. This way, numutils will
5280 work for all users even if they are missing kinds.
5295 work for all users even if they are missing kinds.
5281
5296
5282 * IPython/Magic.py (Magic._ofind): Harden against an inspect
5297 * IPython/Magic.py (Magic._ofind): Harden against an inspect
5283 failure, which can occur with SWIG-wrapped extensions. After a
5298 failure, which can occur with SWIG-wrapped extensions. After a
5284 crash report from Prabhu.
5299 crash report from Prabhu.
5285
5300
5286 2003-05-16 Fernando Perez <fperez@colorado.edu>
5301 2003-05-16 Fernando Perez <fperez@colorado.edu>
5287
5302
5288 * IPython/iplib.py (InteractiveShell.excepthook): New method to
5303 * IPython/iplib.py (InteractiveShell.excepthook): New method to
5289 protect ipython from user code which may call directly
5304 protect ipython from user code which may call directly
5290 sys.excepthook (this looks like an ipython crash to the user, even
5305 sys.excepthook (this looks like an ipython crash to the user, even
5291 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5306 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5292 This is especially important to help users of WxWindows, but may
5307 This is especially important to help users of WxWindows, but may
5293 also be useful in other cases.
5308 also be useful in other cases.
5294
5309
5295 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
5310 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
5296 an optional tb_offset to be specified, and to preserve exception
5311 an optional tb_offset to be specified, and to preserve exception
5297 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5312 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5298
5313
5299 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
5314 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
5300
5315
5301 2003-05-15 Fernando Perez <fperez@colorado.edu>
5316 2003-05-15 Fernando Perez <fperez@colorado.edu>
5302
5317
5303 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
5318 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
5304 installing for a new user under Windows.
5319 installing for a new user under Windows.
5305
5320
5306 2003-05-12 Fernando Perez <fperez@colorado.edu>
5321 2003-05-12 Fernando Perez <fperez@colorado.edu>
5307
5322
5308 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
5323 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
5309 handler for Emacs comint-based lines. Currently it doesn't do
5324 handler for Emacs comint-based lines. Currently it doesn't do
5310 much (but importantly, it doesn't update the history cache). In
5325 much (but importantly, it doesn't update the history cache). In
5311 the future it may be expanded if Alex needs more functionality
5326 the future it may be expanded if Alex needs more functionality
5312 there.
5327 there.
5313
5328
5314 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
5329 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
5315 info to crash reports.
5330 info to crash reports.
5316
5331
5317 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
5332 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
5318 just like Python's -c. Also fixed crash with invalid -color
5333 just like Python's -c. Also fixed crash with invalid -color
5319 option value at startup. Thanks to Will French
5334 option value at startup. Thanks to Will French
5320 <wfrench-AT-bestweb.net> for the bug report.
5335 <wfrench-AT-bestweb.net> for the bug report.
5321
5336
5322 2003-05-09 Fernando Perez <fperez@colorado.edu>
5337 2003-05-09 Fernando Perez <fperez@colorado.edu>
5323
5338
5324 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
5339 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
5325 to EvalDict (it's a mapping, after all) and simplified its code
5340 to EvalDict (it's a mapping, after all) and simplified its code
5326 quite a bit, after a nice discussion on c.l.py where Gustavo
5341 quite a bit, after a nice discussion on c.l.py where Gustavo
5327 Córdova <gcordova-AT-sismex.com> suggested the new version.
5342 Córdova <gcordova-AT-sismex.com> suggested the new version.
5328
5343
5329 2003-04-30 Fernando Perez <fperez@colorado.edu>
5344 2003-04-30 Fernando Perez <fperez@colorado.edu>
5330
5345
5331 * IPython/genutils.py (timings_out): modified it to reduce its
5346 * IPython/genutils.py (timings_out): modified it to reduce its
5332 overhead in the common reps==1 case.
5347 overhead in the common reps==1 case.
5333
5348
5334 2003-04-29 Fernando Perez <fperez@colorado.edu>
5349 2003-04-29 Fernando Perez <fperez@colorado.edu>
5335
5350
5336 * IPython/genutils.py (timings_out): Modified to use the resource
5351 * IPython/genutils.py (timings_out): Modified to use the resource
5337 module, which avoids the wraparound problems of time.clock().
5352 module, which avoids the wraparound problems of time.clock().
5338
5353
5339 2003-04-17 *** Released version 0.2.15pre4
5354 2003-04-17 *** Released version 0.2.15pre4
5340
5355
5341 2003-04-17 Fernando Perez <fperez@colorado.edu>
5356 2003-04-17 Fernando Perez <fperez@colorado.edu>
5342
5357
5343 * setup.py (scriptfiles): Split windows-specific stuff over to a
5358 * setup.py (scriptfiles): Split windows-specific stuff over to a
5344 separate file, in an attempt to have a Windows GUI installer.
5359 separate file, in an attempt to have a Windows GUI installer.
5345 That didn't work, but part of the groundwork is done.
5360 That didn't work, but part of the groundwork is done.
5346
5361
5347 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
5362 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
5348 indent/unindent with 4 spaces. Particularly useful in combination
5363 indent/unindent with 4 spaces. Particularly useful in combination
5349 with the new auto-indent option.
5364 with the new auto-indent option.
5350
5365
5351 2003-04-16 Fernando Perez <fperez@colorado.edu>
5366 2003-04-16 Fernando Perez <fperez@colorado.edu>
5352
5367
5353 * IPython/Magic.py: various replacements of self.rc for
5368 * IPython/Magic.py: various replacements of self.rc for
5354 self.shell.rc. A lot more remains to be done to fully disentangle
5369 self.shell.rc. A lot more remains to be done to fully disentangle
5355 this class from the main Shell class.
5370 this class from the main Shell class.
5356
5371
5357 * IPython/GnuplotRuntime.py: added checks for mouse support so
5372 * IPython/GnuplotRuntime.py: added checks for mouse support so
5358 that we don't try to enable it if the current gnuplot doesn't
5373 that we don't try to enable it if the current gnuplot doesn't
5359 really support it. Also added checks so that we don't try to
5374 really support it. Also added checks so that we don't try to
5360 enable persist under Windows (where Gnuplot doesn't recognize the
5375 enable persist under Windows (where Gnuplot doesn't recognize the
5361 option).
5376 option).
5362
5377
5363 * IPython/iplib.py (InteractiveShell.interact): Added optional
5378 * IPython/iplib.py (InteractiveShell.interact): Added optional
5364 auto-indenting code, after a patch by King C. Shu
5379 auto-indenting code, after a patch by King C. Shu
5365 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
5380 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
5366 get along well with pasting indented code. If I ever figure out
5381 get along well with pasting indented code. If I ever figure out
5367 how to make that part go well, it will become on by default.
5382 how to make that part go well, it will become on by default.
5368
5383
5369 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
5384 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
5370 crash ipython if there was an unmatched '%' in the user's prompt
5385 crash ipython if there was an unmatched '%' in the user's prompt
5371 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5386 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5372
5387
5373 * IPython/iplib.py (InteractiveShell.interact): removed the
5388 * IPython/iplib.py (InteractiveShell.interact): removed the
5374 ability to ask the user whether he wants to crash or not at the
5389 ability to ask the user whether he wants to crash or not at the
5375 'last line' exception handler. Calling functions at that point
5390 'last line' exception handler. Calling functions at that point
5376 changes the stack, and the error reports would have incorrect
5391 changes the stack, and the error reports would have incorrect
5377 tracebacks.
5392 tracebacks.
5378
5393
5379 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
5394 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
5380 pass through a peger a pretty-printed form of any object. After a
5395 pass through a peger a pretty-printed form of any object. After a
5381 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
5396 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
5382
5397
5383 2003-04-14 Fernando Perez <fperez@colorado.edu>
5398 2003-04-14 Fernando Perez <fperez@colorado.edu>
5384
5399
5385 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
5400 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
5386 all files in ~ would be modified at first install (instead of
5401 all files in ~ would be modified at first install (instead of
5387 ~/.ipython). This could be potentially disastrous, as the
5402 ~/.ipython). This could be potentially disastrous, as the
5388 modification (make line-endings native) could damage binary files.
5403 modification (make line-endings native) could damage binary files.
5389
5404
5390 2003-04-10 Fernando Perez <fperez@colorado.edu>
5405 2003-04-10 Fernando Perez <fperez@colorado.edu>
5391
5406
5392 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
5407 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
5393 handle only lines which are invalid python. This now means that
5408 handle only lines which are invalid python. This now means that
5394 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
5409 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
5395 for the bug report.
5410 for the bug report.
5396
5411
5397 2003-04-01 Fernando Perez <fperez@colorado.edu>
5412 2003-04-01 Fernando Perez <fperez@colorado.edu>
5398
5413
5399 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
5414 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
5400 where failing to set sys.last_traceback would crash pdb.pm().
5415 where failing to set sys.last_traceback would crash pdb.pm().
5401 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
5416 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
5402 report.
5417 report.
5403
5418
5404 2003-03-25 Fernando Perez <fperez@colorado.edu>
5419 2003-03-25 Fernando Perez <fperez@colorado.edu>
5405
5420
5406 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
5421 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
5407 before printing it (it had a lot of spurious blank lines at the
5422 before printing it (it had a lot of spurious blank lines at the
5408 end).
5423 end).
5409
5424
5410 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5425 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5411 output would be sent 21 times! Obviously people don't use this
5426 output would be sent 21 times! Obviously people don't use this
5412 too often, or I would have heard about it.
5427 too often, or I would have heard about it.
5413
5428
5414 2003-03-24 Fernando Perez <fperez@colorado.edu>
5429 2003-03-24 Fernando Perez <fperez@colorado.edu>
5415
5430
5416 * setup.py (scriptfiles): renamed the data_files parameter from
5431 * setup.py (scriptfiles): renamed the data_files parameter from
5417 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5432 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5418 for the patch.
5433 for the patch.
5419
5434
5420 2003-03-20 Fernando Perez <fperez@colorado.edu>
5435 2003-03-20 Fernando Perez <fperez@colorado.edu>
5421
5436
5422 * IPython/genutils.py (error): added error() and fatal()
5437 * IPython/genutils.py (error): added error() and fatal()
5423 functions.
5438 functions.
5424
5439
5425 2003-03-18 *** Released version 0.2.15pre3
5440 2003-03-18 *** Released version 0.2.15pre3
5426
5441
5427 2003-03-18 Fernando Perez <fperez@colorado.edu>
5442 2003-03-18 Fernando Perez <fperez@colorado.edu>
5428
5443
5429 * setupext/install_data_ext.py
5444 * setupext/install_data_ext.py
5430 (install_data_ext.initialize_options): Class contributed by Jack
5445 (install_data_ext.initialize_options): Class contributed by Jack
5431 Moffit for fixing the old distutils hack. He is sending this to
5446 Moffit for fixing the old distutils hack. He is sending this to
5432 the distutils folks so in the future we may not need it as a
5447 the distutils folks so in the future we may not need it as a
5433 private fix.
5448 private fix.
5434
5449
5435 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5450 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5436 changes for Debian packaging. See his patch for full details.
5451 changes for Debian packaging. See his patch for full details.
5437 The old distutils hack of making the ipythonrc* files carry a
5452 The old distutils hack of making the ipythonrc* files carry a
5438 bogus .py extension is gone, at last. Examples were moved to a
5453 bogus .py extension is gone, at last. Examples were moved to a
5439 separate subdir under doc/, and the separate executable scripts
5454 separate subdir under doc/, and the separate executable scripts
5440 now live in their own directory. Overall a great cleanup. The
5455 now live in their own directory. Overall a great cleanup. The
5441 manual was updated to use the new files, and setup.py has been
5456 manual was updated to use the new files, and setup.py has been
5442 fixed for this setup.
5457 fixed for this setup.
5443
5458
5444 * IPython/PyColorize.py (Parser.usage): made non-executable and
5459 * IPython/PyColorize.py (Parser.usage): made non-executable and
5445 created a pycolor wrapper around it to be included as a script.
5460 created a pycolor wrapper around it to be included as a script.
5446
5461
5447 2003-03-12 *** Released version 0.2.15pre2
5462 2003-03-12 *** Released version 0.2.15pre2
5448
5463
5449 2003-03-12 Fernando Perez <fperez@colorado.edu>
5464 2003-03-12 Fernando Perez <fperez@colorado.edu>
5450
5465
5451 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5466 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5452 long-standing problem with garbage characters in some terminals.
5467 long-standing problem with garbage characters in some terminals.
5453 The issue was really that the \001 and \002 escapes must _only_ be
5468 The issue was really that the \001 and \002 escapes must _only_ be
5454 passed to input prompts (which call readline), but _never_ to
5469 passed to input prompts (which call readline), but _never_ to
5455 normal text to be printed on screen. I changed ColorANSI to have
5470 normal text to be printed on screen. I changed ColorANSI to have
5456 two classes: TermColors and InputTermColors, each with the
5471 two classes: TermColors and InputTermColors, each with the
5457 appropriate escapes for input prompts or normal text. The code in
5472 appropriate escapes for input prompts or normal text. The code in
5458 Prompts.py got slightly more complicated, but this very old and
5473 Prompts.py got slightly more complicated, but this very old and
5459 annoying bug is finally fixed.
5474 annoying bug is finally fixed.
5460
5475
5461 All the credit for nailing down the real origin of this problem
5476 All the credit for nailing down the real origin of this problem
5462 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5477 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5463 *Many* thanks to him for spending quite a bit of effort on this.
5478 *Many* thanks to him for spending quite a bit of effort on this.
5464
5479
5465 2003-03-05 *** Released version 0.2.15pre1
5480 2003-03-05 *** Released version 0.2.15pre1
5466
5481
5467 2003-03-03 Fernando Perez <fperez@colorado.edu>
5482 2003-03-03 Fernando Perez <fperez@colorado.edu>
5468
5483
5469 * IPython/FakeModule.py: Moved the former _FakeModule to a
5484 * IPython/FakeModule.py: Moved the former _FakeModule to a
5470 separate file, because it's also needed by Magic (to fix a similar
5485 separate file, because it's also needed by Magic (to fix a similar
5471 pickle-related issue in @run).
5486 pickle-related issue in @run).
5472
5487
5473 2003-03-02 Fernando Perez <fperez@colorado.edu>
5488 2003-03-02 Fernando Perez <fperez@colorado.edu>
5474
5489
5475 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5490 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5476 the autocall option at runtime.
5491 the autocall option at runtime.
5477 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5492 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5478 across Magic.py to start separating Magic from InteractiveShell.
5493 across Magic.py to start separating Magic from InteractiveShell.
5479 (Magic._ofind): Fixed to return proper namespace for dotted
5494 (Magic._ofind): Fixed to return proper namespace for dotted
5480 names. Before, a dotted name would always return 'not currently
5495 names. Before, a dotted name would always return 'not currently
5481 defined', because it would find the 'parent'. s.x would be found,
5496 defined', because it would find the 'parent'. s.x would be found,
5482 but since 'x' isn't defined by itself, it would get confused.
5497 but since 'x' isn't defined by itself, it would get confused.
5483 (Magic.magic_run): Fixed pickling problems reported by Ralf
5498 (Magic.magic_run): Fixed pickling problems reported by Ralf
5484 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5499 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5485 that I'd used when Mike Heeter reported similar issues at the
5500 that I'd used when Mike Heeter reported similar issues at the
5486 top-level, but now for @run. It boils down to injecting the
5501 top-level, but now for @run. It boils down to injecting the
5487 namespace where code is being executed with something that looks
5502 namespace where code is being executed with something that looks
5488 enough like a module to fool pickle.dump(). Since a pickle stores
5503 enough like a module to fool pickle.dump(). Since a pickle stores
5489 a named reference to the importing module, we need this for
5504 a named reference to the importing module, we need this for
5490 pickles to save something sensible.
5505 pickles to save something sensible.
5491
5506
5492 * IPython/ipmaker.py (make_IPython): added an autocall option.
5507 * IPython/ipmaker.py (make_IPython): added an autocall option.
5493
5508
5494 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5509 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5495 the auto-eval code. Now autocalling is an option, and the code is
5510 the auto-eval code. Now autocalling is an option, and the code is
5496 also vastly safer. There is no more eval() involved at all.
5511 also vastly safer. There is no more eval() involved at all.
5497
5512
5498 2003-03-01 Fernando Perez <fperez@colorado.edu>
5513 2003-03-01 Fernando Perez <fperez@colorado.edu>
5499
5514
5500 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5515 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5501 dict with named keys instead of a tuple.
5516 dict with named keys instead of a tuple.
5502
5517
5503 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5518 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5504
5519
5505 * setup.py (make_shortcut): Fixed message about directories
5520 * setup.py (make_shortcut): Fixed message about directories
5506 created during Windows installation (the directories were ok, just
5521 created during Windows installation (the directories were ok, just
5507 the printed message was misleading). Thanks to Chris Liechti
5522 the printed message was misleading). Thanks to Chris Liechti
5508 <cliechti-AT-gmx.net> for the heads up.
5523 <cliechti-AT-gmx.net> for the heads up.
5509
5524
5510 2003-02-21 Fernando Perez <fperez@colorado.edu>
5525 2003-02-21 Fernando Perez <fperez@colorado.edu>
5511
5526
5512 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5527 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5513 of ValueError exception when checking for auto-execution. This
5528 of ValueError exception when checking for auto-execution. This
5514 one is raised by things like Numeric arrays arr.flat when the
5529 one is raised by things like Numeric arrays arr.flat when the
5515 array is non-contiguous.
5530 array is non-contiguous.
5516
5531
5517 2003-01-31 Fernando Perez <fperez@colorado.edu>
5532 2003-01-31 Fernando Perez <fperez@colorado.edu>
5518
5533
5519 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5534 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5520 not return any value at all (even though the command would get
5535 not return any value at all (even though the command would get
5521 executed).
5536 executed).
5522 (xsys): Flush stdout right after printing the command to ensure
5537 (xsys): Flush stdout right after printing the command to ensure
5523 proper ordering of commands and command output in the total
5538 proper ordering of commands and command output in the total
5524 output.
5539 output.
5525 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5540 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5526 system/getoutput as defaults. The old ones are kept for
5541 system/getoutput as defaults. The old ones are kept for
5527 compatibility reasons, so no code which uses this library needs
5542 compatibility reasons, so no code which uses this library needs
5528 changing.
5543 changing.
5529
5544
5530 2003-01-27 *** Released version 0.2.14
5545 2003-01-27 *** Released version 0.2.14
5531
5546
5532 2003-01-25 Fernando Perez <fperez@colorado.edu>
5547 2003-01-25 Fernando Perez <fperez@colorado.edu>
5533
5548
5534 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5549 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5535 functions defined in previous edit sessions could not be re-edited
5550 functions defined in previous edit sessions could not be re-edited
5536 (because the temp files were immediately removed). Now temp files
5551 (because the temp files were immediately removed). Now temp files
5537 are removed only at IPython's exit.
5552 are removed only at IPython's exit.
5538 (Magic.magic_run): Improved @run to perform shell-like expansions
5553 (Magic.magic_run): Improved @run to perform shell-like expansions
5539 on its arguments (~users and $VARS). With this, @run becomes more
5554 on its arguments (~users and $VARS). With this, @run becomes more
5540 like a normal command-line.
5555 like a normal command-line.
5541
5556
5542 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5557 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5543 bugs related to embedding and cleaned up that code. A fairly
5558 bugs related to embedding and cleaned up that code. A fairly
5544 important one was the impossibility to access the global namespace
5559 important one was the impossibility to access the global namespace
5545 through the embedded IPython (only local variables were visible).
5560 through the embedded IPython (only local variables were visible).
5546
5561
5547 2003-01-14 Fernando Perez <fperez@colorado.edu>
5562 2003-01-14 Fernando Perez <fperez@colorado.edu>
5548
5563
5549 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5564 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5550 auto-calling to be a bit more conservative. Now it doesn't get
5565 auto-calling to be a bit more conservative. Now it doesn't get
5551 triggered if any of '!=()<>' are in the rest of the input line, to
5566 triggered if any of '!=()<>' are in the rest of the input line, to
5552 allow comparing callables. Thanks to Alex for the heads up.
5567 allow comparing callables. Thanks to Alex for the heads up.
5553
5568
5554 2003-01-07 Fernando Perez <fperez@colorado.edu>
5569 2003-01-07 Fernando Perez <fperez@colorado.edu>
5555
5570
5556 * IPython/genutils.py (page): fixed estimation of the number of
5571 * IPython/genutils.py (page): fixed estimation of the number of
5557 lines in a string to be paged to simply count newlines. This
5572 lines in a string to be paged to simply count newlines. This
5558 prevents over-guessing due to embedded escape sequences. A better
5573 prevents over-guessing due to embedded escape sequences. A better
5559 long-term solution would involve stripping out the control chars
5574 long-term solution would involve stripping out the control chars
5560 for the count, but it's potentially so expensive I just don't
5575 for the count, but it's potentially so expensive I just don't
5561 think it's worth doing.
5576 think it's worth doing.
5562
5577
5563 2002-12-19 *** Released version 0.2.14pre50
5578 2002-12-19 *** Released version 0.2.14pre50
5564
5579
5565 2002-12-19 Fernando Perez <fperez@colorado.edu>
5580 2002-12-19 Fernando Perez <fperez@colorado.edu>
5566
5581
5567 * tools/release (version): Changed release scripts to inform
5582 * tools/release (version): Changed release scripts to inform
5568 Andrea and build a NEWS file with a list of recent changes.
5583 Andrea and build a NEWS file with a list of recent changes.
5569
5584
5570 * IPython/ColorANSI.py (__all__): changed terminal detection
5585 * IPython/ColorANSI.py (__all__): changed terminal detection
5571 code. Seems to work better for xterms without breaking
5586 code. Seems to work better for xterms without breaking
5572 konsole. Will need more testing to determine if WinXP and Mac OSX
5587 konsole. Will need more testing to determine if WinXP and Mac OSX
5573 also work ok.
5588 also work ok.
5574
5589
5575 2002-12-18 *** Released version 0.2.14pre49
5590 2002-12-18 *** Released version 0.2.14pre49
5576
5591
5577 2002-12-18 Fernando Perez <fperez@colorado.edu>
5592 2002-12-18 Fernando Perez <fperez@colorado.edu>
5578
5593
5579 * Docs: added new info about Mac OSX, from Andrea.
5594 * Docs: added new info about Mac OSX, from Andrea.
5580
5595
5581 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5596 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5582 allow direct plotting of python strings whose format is the same
5597 allow direct plotting of python strings whose format is the same
5583 of gnuplot data files.
5598 of gnuplot data files.
5584
5599
5585 2002-12-16 Fernando Perez <fperez@colorado.edu>
5600 2002-12-16 Fernando Perez <fperez@colorado.edu>
5586
5601
5587 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5602 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5588 value of exit question to be acknowledged.
5603 value of exit question to be acknowledged.
5589
5604
5590 2002-12-03 Fernando Perez <fperez@colorado.edu>
5605 2002-12-03 Fernando Perez <fperez@colorado.edu>
5591
5606
5592 * IPython/ipmaker.py: removed generators, which had been added
5607 * IPython/ipmaker.py: removed generators, which had been added
5593 by mistake in an earlier debugging run. This was causing trouble
5608 by mistake in an earlier debugging run. This was causing trouble
5594 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5609 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5595 for pointing this out.
5610 for pointing this out.
5596
5611
5597 2002-11-17 Fernando Perez <fperez@colorado.edu>
5612 2002-11-17 Fernando Perez <fperez@colorado.edu>
5598
5613
5599 * Manual: updated the Gnuplot section.
5614 * Manual: updated the Gnuplot section.
5600
5615
5601 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5616 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5602 a much better split of what goes in Runtime and what goes in
5617 a much better split of what goes in Runtime and what goes in
5603 Interactive.
5618 Interactive.
5604
5619
5605 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5620 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5606 being imported from iplib.
5621 being imported from iplib.
5607
5622
5608 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5623 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5609 for command-passing. Now the global Gnuplot instance is called
5624 for command-passing. Now the global Gnuplot instance is called
5610 'gp' instead of 'g', which was really a far too fragile and
5625 'gp' instead of 'g', which was really a far too fragile and
5611 common name.
5626 common name.
5612
5627
5613 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5628 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5614 bounding boxes generated by Gnuplot for square plots.
5629 bounding boxes generated by Gnuplot for square plots.
5615
5630
5616 * IPython/genutils.py (popkey): new function added. I should
5631 * IPython/genutils.py (popkey): new function added. I should
5617 suggest this on c.l.py as a dict method, it seems useful.
5632 suggest this on c.l.py as a dict method, it seems useful.
5618
5633
5619 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5634 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5620 to transparently handle PostScript generation. MUCH better than
5635 to transparently handle PostScript generation. MUCH better than
5621 the previous plot_eps/replot_eps (which I removed now). The code
5636 the previous plot_eps/replot_eps (which I removed now). The code
5622 is also fairly clean and well documented now (including
5637 is also fairly clean and well documented now (including
5623 docstrings).
5638 docstrings).
5624
5639
5625 2002-11-13 Fernando Perez <fperez@colorado.edu>
5640 2002-11-13 Fernando Perez <fperez@colorado.edu>
5626
5641
5627 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5642 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5628 (inconsistent with options).
5643 (inconsistent with options).
5629
5644
5630 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5645 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5631 manually disabled, I don't know why. Fixed it.
5646 manually disabled, I don't know why. Fixed it.
5632 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5647 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5633 eps output.
5648 eps output.
5634
5649
5635 2002-11-12 Fernando Perez <fperez@colorado.edu>
5650 2002-11-12 Fernando Perez <fperez@colorado.edu>
5636
5651
5637 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5652 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5638 don't propagate up to caller. Fixes crash reported by François
5653 don't propagate up to caller. Fixes crash reported by François
5639 Pinard.
5654 Pinard.
5640
5655
5641 2002-11-09 Fernando Perez <fperez@colorado.edu>
5656 2002-11-09 Fernando Perez <fperez@colorado.edu>
5642
5657
5643 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5658 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5644 history file for new users.
5659 history file for new users.
5645 (make_IPython): fixed bug where initial install would leave the
5660 (make_IPython): fixed bug where initial install would leave the
5646 user running in the .ipython dir.
5661 user running in the .ipython dir.
5647 (make_IPython): fixed bug where config dir .ipython would be
5662 (make_IPython): fixed bug where config dir .ipython would be
5648 created regardless of the given -ipythondir option. Thanks to Cory
5663 created regardless of the given -ipythondir option. Thanks to Cory
5649 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5664 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5650
5665
5651 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5666 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5652 type confirmations. Will need to use it in all of IPython's code
5667 type confirmations. Will need to use it in all of IPython's code
5653 consistently.
5668 consistently.
5654
5669
5655 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5670 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5656 context to print 31 lines instead of the default 5. This will make
5671 context to print 31 lines instead of the default 5. This will make
5657 the crash reports extremely detailed in case the problem is in
5672 the crash reports extremely detailed in case the problem is in
5658 libraries I don't have access to.
5673 libraries I don't have access to.
5659
5674
5660 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5675 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5661 line of defense' code to still crash, but giving users fair
5676 line of defense' code to still crash, but giving users fair
5662 warning. I don't want internal errors to go unreported: if there's
5677 warning. I don't want internal errors to go unreported: if there's
5663 an internal problem, IPython should crash and generate a full
5678 an internal problem, IPython should crash and generate a full
5664 report.
5679 report.
5665
5680
5666 2002-11-08 Fernando Perez <fperez@colorado.edu>
5681 2002-11-08 Fernando Perez <fperez@colorado.edu>
5667
5682
5668 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5683 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5669 otherwise uncaught exceptions which can appear if people set
5684 otherwise uncaught exceptions which can appear if people set
5670 sys.stdout to something badly broken. Thanks to a crash report
5685 sys.stdout to something badly broken. Thanks to a crash report
5671 from henni-AT-mail.brainbot.com.
5686 from henni-AT-mail.brainbot.com.
5672
5687
5673 2002-11-04 Fernando Perez <fperez@colorado.edu>
5688 2002-11-04 Fernando Perez <fperez@colorado.edu>
5674
5689
5675 * IPython/iplib.py (InteractiveShell.interact): added
5690 * IPython/iplib.py (InteractiveShell.interact): added
5676 __IPYTHON__active to the builtins. It's a flag which goes on when
5691 __IPYTHON__active to the builtins. It's a flag which goes on when
5677 the interaction starts and goes off again when it stops. This
5692 the interaction starts and goes off again when it stops. This
5678 allows embedding code to detect being inside IPython. Before this
5693 allows embedding code to detect being inside IPython. Before this
5679 was done via __IPYTHON__, but that only shows that an IPython
5694 was done via __IPYTHON__, but that only shows that an IPython
5680 instance has been created.
5695 instance has been created.
5681
5696
5682 * IPython/Magic.py (Magic.magic_env): I realized that in a
5697 * IPython/Magic.py (Magic.magic_env): I realized that in a
5683 UserDict, instance.data holds the data as a normal dict. So I
5698 UserDict, instance.data holds the data as a normal dict. So I
5684 modified @env to return os.environ.data instead of rebuilding a
5699 modified @env to return os.environ.data instead of rebuilding a
5685 dict by hand.
5700 dict by hand.
5686
5701
5687 2002-11-02 Fernando Perez <fperez@colorado.edu>
5702 2002-11-02 Fernando Perez <fperez@colorado.edu>
5688
5703
5689 * IPython/genutils.py (warn): changed so that level 1 prints no
5704 * IPython/genutils.py (warn): changed so that level 1 prints no
5690 header. Level 2 is now the default (with 'WARNING' header, as
5705 header. Level 2 is now the default (with 'WARNING' header, as
5691 before). I think I tracked all places where changes were needed in
5706 before). I think I tracked all places where changes were needed in
5692 IPython, but outside code using the old level numbering may have
5707 IPython, but outside code using the old level numbering may have
5693 broken.
5708 broken.
5694
5709
5695 * IPython/iplib.py (InteractiveShell.runcode): added this to
5710 * IPython/iplib.py (InteractiveShell.runcode): added this to
5696 handle the tracebacks in SystemExit traps correctly. The previous
5711 handle the tracebacks in SystemExit traps correctly. The previous
5697 code (through interact) was printing more of the stack than
5712 code (through interact) was printing more of the stack than
5698 necessary, showing IPython internal code to the user.
5713 necessary, showing IPython internal code to the user.
5699
5714
5700 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5715 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5701 default. Now that the default at the confirmation prompt is yes,
5716 default. Now that the default at the confirmation prompt is yes,
5702 it's not so intrusive. François' argument that ipython sessions
5717 it's not so intrusive. François' argument that ipython sessions
5703 tend to be complex enough not to lose them from an accidental C-d,
5718 tend to be complex enough not to lose them from an accidental C-d,
5704 is a valid one.
5719 is a valid one.
5705
5720
5706 * IPython/iplib.py (InteractiveShell.interact): added a
5721 * IPython/iplib.py (InteractiveShell.interact): added a
5707 showtraceback() call to the SystemExit trap, and modified the exit
5722 showtraceback() call to the SystemExit trap, and modified the exit
5708 confirmation to have yes as the default.
5723 confirmation to have yes as the default.
5709
5724
5710 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5725 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5711 this file. It's been gone from the code for a long time, this was
5726 this file. It's been gone from the code for a long time, this was
5712 simply leftover junk.
5727 simply leftover junk.
5713
5728
5714 2002-11-01 Fernando Perez <fperez@colorado.edu>
5729 2002-11-01 Fernando Perez <fperez@colorado.edu>
5715
5730
5716 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5731 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5717 added. If set, IPython now traps EOF and asks for
5732 added. If set, IPython now traps EOF and asks for
5718 confirmation. After a request by François Pinard.
5733 confirmation. After a request by François Pinard.
5719
5734
5720 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5735 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5721 of @abort, and with a new (better) mechanism for handling the
5736 of @abort, and with a new (better) mechanism for handling the
5722 exceptions.
5737 exceptions.
5723
5738
5724 2002-10-27 Fernando Perez <fperez@colorado.edu>
5739 2002-10-27 Fernando Perez <fperez@colorado.edu>
5725
5740
5726 * IPython/usage.py (__doc__): updated the --help information and
5741 * IPython/usage.py (__doc__): updated the --help information and
5727 the ipythonrc file to indicate that -log generates
5742 the ipythonrc file to indicate that -log generates
5728 ./ipython.log. Also fixed the corresponding info in @logstart.
5743 ./ipython.log. Also fixed the corresponding info in @logstart.
5729 This and several other fixes in the manuals thanks to reports by
5744 This and several other fixes in the manuals thanks to reports by
5730 François Pinard <pinard-AT-iro.umontreal.ca>.
5745 François Pinard <pinard-AT-iro.umontreal.ca>.
5731
5746
5732 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5747 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5733 refer to @logstart (instead of @log, which doesn't exist).
5748 refer to @logstart (instead of @log, which doesn't exist).
5734
5749
5735 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5750 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5736 AttributeError crash. Thanks to Christopher Armstrong
5751 AttributeError crash. Thanks to Christopher Armstrong
5737 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5752 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5738 introduced recently (in 0.2.14pre37) with the fix to the eval
5753 introduced recently (in 0.2.14pre37) with the fix to the eval
5739 problem mentioned below.
5754 problem mentioned below.
5740
5755
5741 2002-10-17 Fernando Perez <fperez@colorado.edu>
5756 2002-10-17 Fernando Perez <fperez@colorado.edu>
5742
5757
5743 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5758 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5744 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5759 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5745
5760
5746 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5761 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5747 this function to fix a problem reported by Alex Schmolck. He saw
5762 this function to fix a problem reported by Alex Schmolck. He saw
5748 it with list comprehensions and generators, which were getting
5763 it with list comprehensions and generators, which were getting
5749 called twice. The real problem was an 'eval' call in testing for
5764 called twice. The real problem was an 'eval' call in testing for
5750 automagic which was evaluating the input line silently.
5765 automagic which was evaluating the input line silently.
5751
5766
5752 This is a potentially very nasty bug, if the input has side
5767 This is a potentially very nasty bug, if the input has side
5753 effects which must not be repeated. The code is much cleaner now,
5768 effects which must not be repeated. The code is much cleaner now,
5754 without any blanket 'except' left and with a regexp test for
5769 without any blanket 'except' left and with a regexp test for
5755 actual function names.
5770 actual function names.
5756
5771
5757 But an eval remains, which I'm not fully comfortable with. I just
5772 But an eval remains, which I'm not fully comfortable with. I just
5758 don't know how to find out if an expression could be a callable in
5773 don't know how to find out if an expression could be a callable in
5759 the user's namespace without doing an eval on the string. However
5774 the user's namespace without doing an eval on the string. However
5760 that string is now much more strictly checked so that no code
5775 that string is now much more strictly checked so that no code
5761 slips by, so the eval should only happen for things that can
5776 slips by, so the eval should only happen for things that can
5762 really be only function/method names.
5777 really be only function/method names.
5763
5778
5764 2002-10-15 Fernando Perez <fperez@colorado.edu>
5779 2002-10-15 Fernando Perez <fperez@colorado.edu>
5765
5780
5766 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5781 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5767 OSX information to main manual, removed README_Mac_OSX file from
5782 OSX information to main manual, removed README_Mac_OSX file from
5768 distribution. Also updated credits for recent additions.
5783 distribution. Also updated credits for recent additions.
5769
5784
5770 2002-10-10 Fernando Perez <fperez@colorado.edu>
5785 2002-10-10 Fernando Perez <fperez@colorado.edu>
5771
5786
5772 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5787 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5773 terminal-related issues. Many thanks to Andrea Riciputi
5788 terminal-related issues. Many thanks to Andrea Riciputi
5774 <andrea.riciputi-AT-libero.it> for writing it.
5789 <andrea.riciputi-AT-libero.it> for writing it.
5775
5790
5776 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5791 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5777 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5792 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5778
5793
5779 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5794 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5780 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5795 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5781 <syver-en-AT-online.no> who both submitted patches for this problem.
5796 <syver-en-AT-online.no> who both submitted patches for this problem.
5782
5797
5783 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5798 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5784 global embedding to make sure that things don't overwrite user
5799 global embedding to make sure that things don't overwrite user
5785 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5800 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5786
5801
5787 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5802 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5788 compatibility. Thanks to Hayden Callow
5803 compatibility. Thanks to Hayden Callow
5789 <h.callow-AT-elec.canterbury.ac.nz>
5804 <h.callow-AT-elec.canterbury.ac.nz>
5790
5805
5791 2002-10-04 Fernando Perez <fperez@colorado.edu>
5806 2002-10-04 Fernando Perez <fperez@colorado.edu>
5792
5807
5793 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5808 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5794 Gnuplot.File objects.
5809 Gnuplot.File objects.
5795
5810
5796 2002-07-23 Fernando Perez <fperez@colorado.edu>
5811 2002-07-23 Fernando Perez <fperez@colorado.edu>
5797
5812
5798 * IPython/genutils.py (timing): Added timings() and timing() for
5813 * IPython/genutils.py (timing): Added timings() and timing() for
5799 quick access to the most commonly needed data, the execution
5814 quick access to the most commonly needed data, the execution
5800 times. Old timing() renamed to timings_out().
5815 times. Old timing() renamed to timings_out().
5801
5816
5802 2002-07-18 Fernando Perez <fperez@colorado.edu>
5817 2002-07-18 Fernando Perez <fperez@colorado.edu>
5803
5818
5804 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5819 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5805 bug with nested instances disrupting the parent's tab completion.
5820 bug with nested instances disrupting the parent's tab completion.
5806
5821
5807 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5822 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5808 all_completions code to begin the emacs integration.
5823 all_completions code to begin the emacs integration.
5809
5824
5810 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5825 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5811 argument to allow titling individual arrays when plotting.
5826 argument to allow titling individual arrays when plotting.
5812
5827
5813 2002-07-15 Fernando Perez <fperez@colorado.edu>
5828 2002-07-15 Fernando Perez <fperez@colorado.edu>
5814
5829
5815 * setup.py (make_shortcut): changed to retrieve the value of
5830 * setup.py (make_shortcut): changed to retrieve the value of
5816 'Program Files' directory from the registry (this value changes in
5831 'Program Files' directory from the registry (this value changes in
5817 non-english versions of Windows). Thanks to Thomas Fanslau
5832 non-english versions of Windows). Thanks to Thomas Fanslau
5818 <tfanslau-AT-gmx.de> for the report.
5833 <tfanslau-AT-gmx.de> for the report.
5819
5834
5820 2002-07-10 Fernando Perez <fperez@colorado.edu>
5835 2002-07-10 Fernando Perez <fperez@colorado.edu>
5821
5836
5822 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5837 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5823 a bug in pdb, which crashes if a line with only whitespace is
5838 a bug in pdb, which crashes if a line with only whitespace is
5824 entered. Bug report submitted to sourceforge.
5839 entered. Bug report submitted to sourceforge.
5825
5840
5826 2002-07-09 Fernando Perez <fperez@colorado.edu>
5841 2002-07-09 Fernando Perez <fperez@colorado.edu>
5827
5842
5828 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5843 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5829 reporting exceptions (it's a bug in inspect.py, I just set a
5844 reporting exceptions (it's a bug in inspect.py, I just set a
5830 workaround).
5845 workaround).
5831
5846
5832 2002-07-08 Fernando Perez <fperez@colorado.edu>
5847 2002-07-08 Fernando Perez <fperez@colorado.edu>
5833
5848
5834 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5849 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5835 __IPYTHON__ in __builtins__ to show up in user_ns.
5850 __IPYTHON__ in __builtins__ to show up in user_ns.
5836
5851
5837 2002-07-03 Fernando Perez <fperez@colorado.edu>
5852 2002-07-03 Fernando Perez <fperez@colorado.edu>
5838
5853
5839 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5854 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5840 name from @gp_set_instance to @gp_set_default.
5855 name from @gp_set_instance to @gp_set_default.
5841
5856
5842 * IPython/ipmaker.py (make_IPython): default editor value set to
5857 * IPython/ipmaker.py (make_IPython): default editor value set to
5843 '0' (a string), to match the rc file. Otherwise will crash when
5858 '0' (a string), to match the rc file. Otherwise will crash when
5844 .strip() is called on it.
5859 .strip() is called on it.
5845
5860
5846
5861
5847 2002-06-28 Fernando Perez <fperez@colorado.edu>
5862 2002-06-28 Fernando Perez <fperez@colorado.edu>
5848
5863
5849 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5864 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5850 of files in current directory when a file is executed via
5865 of files in current directory when a file is executed via
5851 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5866 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5852
5867
5853 * setup.py (manfiles): fix for rpm builds, submitted by RA
5868 * setup.py (manfiles): fix for rpm builds, submitted by RA
5854 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5869 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5855
5870
5856 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5871 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5857 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5872 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5858 string!). A. Schmolck caught this one.
5873 string!). A. Schmolck caught this one.
5859
5874
5860 2002-06-27 Fernando Perez <fperez@colorado.edu>
5875 2002-06-27 Fernando Perez <fperez@colorado.edu>
5861
5876
5862 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5877 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5863 defined files at the cmd line. __name__ wasn't being set to
5878 defined files at the cmd line. __name__ wasn't being set to
5864 __main__.
5879 __main__.
5865
5880
5866 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5881 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5867 regular lists and tuples besides Numeric arrays.
5882 regular lists and tuples besides Numeric arrays.
5868
5883
5869 * IPython/Prompts.py (CachedOutput.__call__): Added output
5884 * IPython/Prompts.py (CachedOutput.__call__): Added output
5870 supression for input ending with ';'. Similar to Mathematica and
5885 supression for input ending with ';'. Similar to Mathematica and
5871 Matlab. The _* vars and Out[] list are still updated, just like
5886 Matlab. The _* vars and Out[] list are still updated, just like
5872 Mathematica behaves.
5887 Mathematica behaves.
5873
5888
5874 2002-06-25 Fernando Perez <fperez@colorado.edu>
5889 2002-06-25 Fernando Perez <fperez@colorado.edu>
5875
5890
5876 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5891 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5877 .ini extensions for profiels under Windows.
5892 .ini extensions for profiels under Windows.
5878
5893
5879 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5894 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5880 string form. Fix contributed by Alexander Schmolck
5895 string form. Fix contributed by Alexander Schmolck
5881 <a.schmolck-AT-gmx.net>
5896 <a.schmolck-AT-gmx.net>
5882
5897
5883 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5898 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5884 pre-configured Gnuplot instance.
5899 pre-configured Gnuplot instance.
5885
5900
5886 2002-06-21 Fernando Perez <fperez@colorado.edu>
5901 2002-06-21 Fernando Perez <fperez@colorado.edu>
5887
5902
5888 * IPython/numutils.py (exp_safe): new function, works around the
5903 * IPython/numutils.py (exp_safe): new function, works around the
5889 underflow problems in Numeric.
5904 underflow problems in Numeric.
5890 (log2): New fn. Safe log in base 2: returns exact integer answer
5905 (log2): New fn. Safe log in base 2: returns exact integer answer
5891 for exact integer powers of 2.
5906 for exact integer powers of 2.
5892
5907
5893 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5908 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5894 properly.
5909 properly.
5895
5910
5896 2002-06-20 Fernando Perez <fperez@colorado.edu>
5911 2002-06-20 Fernando Perez <fperez@colorado.edu>
5897
5912
5898 * IPython/genutils.py (timing): new function like
5913 * IPython/genutils.py (timing): new function like
5899 Mathematica's. Similar to time_test, but returns more info.
5914 Mathematica's. Similar to time_test, but returns more info.
5900
5915
5901 2002-06-18 Fernando Perez <fperez@colorado.edu>
5916 2002-06-18 Fernando Perez <fperez@colorado.edu>
5902
5917
5903 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5918 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5904 according to Mike Heeter's suggestions.
5919 according to Mike Heeter's suggestions.
5905
5920
5906 2002-06-16 Fernando Perez <fperez@colorado.edu>
5921 2002-06-16 Fernando Perez <fperez@colorado.edu>
5907
5922
5908 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5923 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5909 system. GnuplotMagic is gone as a user-directory option. New files
5924 system. GnuplotMagic is gone as a user-directory option. New files
5910 make it easier to use all the gnuplot stuff both from external
5925 make it easier to use all the gnuplot stuff both from external
5911 programs as well as from IPython. Had to rewrite part of
5926 programs as well as from IPython. Had to rewrite part of
5912 hardcopy() b/c of a strange bug: often the ps files simply don't
5927 hardcopy() b/c of a strange bug: often the ps files simply don't
5913 get created, and require a repeat of the command (often several
5928 get created, and require a repeat of the command (often several
5914 times).
5929 times).
5915
5930
5916 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5931 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5917 resolve output channel at call time, so that if sys.stderr has
5932 resolve output channel at call time, so that if sys.stderr has
5918 been redirected by user this gets honored.
5933 been redirected by user this gets honored.
5919
5934
5920 2002-06-13 Fernando Perez <fperez@colorado.edu>
5935 2002-06-13 Fernando Perez <fperez@colorado.edu>
5921
5936
5922 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5937 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5923 IPShell. Kept a copy with the old names to avoid breaking people's
5938 IPShell. Kept a copy with the old names to avoid breaking people's
5924 embedded code.
5939 embedded code.
5925
5940
5926 * IPython/ipython: simplified it to the bare minimum after
5941 * IPython/ipython: simplified it to the bare minimum after
5927 Holger's suggestions. Added info about how to use it in
5942 Holger's suggestions. Added info about how to use it in
5928 PYTHONSTARTUP.
5943 PYTHONSTARTUP.
5929
5944
5930 * IPython/Shell.py (IPythonShell): changed the options passing
5945 * IPython/Shell.py (IPythonShell): changed the options passing
5931 from a string with funky %s replacements to a straight list. Maybe
5946 from a string with funky %s replacements to a straight list. Maybe
5932 a bit more typing, but it follows sys.argv conventions, so there's
5947 a bit more typing, but it follows sys.argv conventions, so there's
5933 less special-casing to remember.
5948 less special-casing to remember.
5934
5949
5935 2002-06-12 Fernando Perez <fperez@colorado.edu>
5950 2002-06-12 Fernando Perez <fperez@colorado.edu>
5936
5951
5937 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5952 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5938 command. Thanks to a suggestion by Mike Heeter.
5953 command. Thanks to a suggestion by Mike Heeter.
5939 (Magic.magic_pfile): added behavior to look at filenames if given
5954 (Magic.magic_pfile): added behavior to look at filenames if given
5940 arg is not a defined object.
5955 arg is not a defined object.
5941 (Magic.magic_save): New @save function to save code snippets. Also
5956 (Magic.magic_save): New @save function to save code snippets. Also
5942 a Mike Heeter idea.
5957 a Mike Heeter idea.
5943
5958
5944 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5959 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5945 plot() and replot(). Much more convenient now, especially for
5960 plot() and replot(). Much more convenient now, especially for
5946 interactive use.
5961 interactive use.
5947
5962
5948 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5963 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5949 filenames.
5964 filenames.
5950
5965
5951 2002-06-02 Fernando Perez <fperez@colorado.edu>
5966 2002-06-02 Fernando Perez <fperez@colorado.edu>
5952
5967
5953 * IPython/Struct.py (Struct.__init__): modified to admit
5968 * IPython/Struct.py (Struct.__init__): modified to admit
5954 initialization via another struct.
5969 initialization via another struct.
5955
5970
5956 * IPython/genutils.py (SystemExec.__init__): New stateful
5971 * IPython/genutils.py (SystemExec.__init__): New stateful
5957 interface to xsys and bq. Useful for writing system scripts.
5972 interface to xsys and bq. Useful for writing system scripts.
5958
5973
5959 2002-05-30 Fernando Perez <fperez@colorado.edu>
5974 2002-05-30 Fernando Perez <fperez@colorado.edu>
5960
5975
5961 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5976 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5962 documents. This will make the user download smaller (it's getting
5977 documents. This will make the user download smaller (it's getting
5963 too big).
5978 too big).
5964
5979
5965 2002-05-29 Fernando Perez <fperez@colorado.edu>
5980 2002-05-29 Fernando Perez <fperez@colorado.edu>
5966
5981
5967 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5982 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5968 fix problems with shelve and pickle. Seems to work, but I don't
5983 fix problems with shelve and pickle. Seems to work, but I don't
5969 know if corner cases break it. Thanks to Mike Heeter
5984 know if corner cases break it. Thanks to Mike Heeter
5970 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5985 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5971
5986
5972 2002-05-24 Fernando Perez <fperez@colorado.edu>
5987 2002-05-24 Fernando Perez <fperez@colorado.edu>
5973
5988
5974 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5989 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5975 macros having broken.
5990 macros having broken.
5976
5991
5977 2002-05-21 Fernando Perez <fperez@colorado.edu>
5992 2002-05-21 Fernando Perez <fperez@colorado.edu>
5978
5993
5979 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5994 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5980 introduced logging bug: all history before logging started was
5995 introduced logging bug: all history before logging started was
5981 being written one character per line! This came from the redesign
5996 being written one character per line! This came from the redesign
5982 of the input history as a special list which slices to strings,
5997 of the input history as a special list which slices to strings,
5983 not to lists.
5998 not to lists.
5984
5999
5985 2002-05-20 Fernando Perez <fperez@colorado.edu>
6000 2002-05-20 Fernando Perez <fperez@colorado.edu>
5986
6001
5987 * IPython/Prompts.py (CachedOutput.__init__): made the color table
6002 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5988 be an attribute of all classes in this module. The design of these
6003 be an attribute of all classes in this module. The design of these
5989 classes needs some serious overhauling.
6004 classes needs some serious overhauling.
5990
6005
5991 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
6006 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5992 which was ignoring '_' in option names.
6007 which was ignoring '_' in option names.
5993
6008
5994 * IPython/ultraTB.py (FormattedTB.__init__): Changed
6009 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5995 'Verbose_novars' to 'Context' and made it the new default. It's a
6010 'Verbose_novars' to 'Context' and made it the new default. It's a
5996 bit more readable and also safer than verbose.
6011 bit more readable and also safer than verbose.
5997
6012
5998 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
6013 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5999 triple-quoted strings.
6014 triple-quoted strings.
6000
6015
6001 * IPython/OInspect.py (__all__): new module exposing the object
6016 * IPython/OInspect.py (__all__): new module exposing the object
6002 introspection facilities. Now the corresponding magics are dummy
6017 introspection facilities. Now the corresponding magics are dummy
6003 wrappers around this. Having this module will make it much easier
6018 wrappers around this. Having this module will make it much easier
6004 to put these functions into our modified pdb.
6019 to put these functions into our modified pdb.
6005 This new object inspector system uses the new colorizing module,
6020 This new object inspector system uses the new colorizing module,
6006 so source code and other things are nicely syntax highlighted.
6021 so source code and other things are nicely syntax highlighted.
6007
6022
6008 2002-05-18 Fernando Perez <fperez@colorado.edu>
6023 2002-05-18 Fernando Perez <fperez@colorado.edu>
6009
6024
6010 * IPython/ColorANSI.py: Split the coloring tools into a separate
6025 * IPython/ColorANSI.py: Split the coloring tools into a separate
6011 module so I can use them in other code easier (they were part of
6026 module so I can use them in other code easier (they were part of
6012 ultraTB).
6027 ultraTB).
6013
6028
6014 2002-05-17 Fernando Perez <fperez@colorado.edu>
6029 2002-05-17 Fernando Perez <fperez@colorado.edu>
6015
6030
6016 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
6031 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
6017 fixed it to set the global 'g' also to the called instance, as
6032 fixed it to set the global 'g' also to the called instance, as
6018 long as 'g' was still a gnuplot instance (so it doesn't overwrite
6033 long as 'g' was still a gnuplot instance (so it doesn't overwrite
6019 user's 'g' variables).
6034 user's 'g' variables).
6020
6035
6021 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
6036 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
6022 global variables (aliases to _ih,_oh) so that users which expect
6037 global variables (aliases to _ih,_oh) so that users which expect
6023 In[5] or Out[7] to work aren't unpleasantly surprised.
6038 In[5] or Out[7] to work aren't unpleasantly surprised.
6024 (InputList.__getslice__): new class to allow executing slices of
6039 (InputList.__getslice__): new class to allow executing slices of
6025 input history directly. Very simple class, complements the use of
6040 input history directly. Very simple class, complements the use of
6026 macros.
6041 macros.
6027
6042
6028 2002-05-16 Fernando Perez <fperez@colorado.edu>
6043 2002-05-16 Fernando Perez <fperez@colorado.edu>
6029
6044
6030 * setup.py (docdirbase): make doc directory be just doc/IPython
6045 * setup.py (docdirbase): make doc directory be just doc/IPython
6031 without version numbers, it will reduce clutter for users.
6046 without version numbers, it will reduce clutter for users.
6032
6047
6033 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
6048 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
6034 execfile call to prevent possible memory leak. See for details:
6049 execfile call to prevent possible memory leak. See for details:
6035 http://mail.python.org/pipermail/python-list/2002-February/088476.html
6050 http://mail.python.org/pipermail/python-list/2002-February/088476.html
6036
6051
6037 2002-05-15 Fernando Perez <fperez@colorado.edu>
6052 2002-05-15 Fernando Perez <fperez@colorado.edu>
6038
6053
6039 * IPython/Magic.py (Magic.magic_psource): made the object
6054 * IPython/Magic.py (Magic.magic_psource): made the object
6040 introspection names be more standard: pdoc, pdef, pfile and
6055 introspection names be more standard: pdoc, pdef, pfile and
6041 psource. They all print/page their output, and it makes
6056 psource. They all print/page their output, and it makes
6042 remembering them easier. Kept old names for compatibility as
6057 remembering them easier. Kept old names for compatibility as
6043 aliases.
6058 aliases.
6044
6059
6045 2002-05-14 Fernando Perez <fperez@colorado.edu>
6060 2002-05-14 Fernando Perez <fperez@colorado.edu>
6046
6061
6047 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
6062 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
6048 what the mouse problem was. The trick is to use gnuplot with temp
6063 what the mouse problem was. The trick is to use gnuplot with temp
6049 files and NOT with pipes (for data communication), because having
6064 files and NOT with pipes (for data communication), because having
6050 both pipes and the mouse on is bad news.
6065 both pipes and the mouse on is bad news.
6051
6066
6052 2002-05-13 Fernando Perez <fperez@colorado.edu>
6067 2002-05-13 Fernando Perez <fperez@colorado.edu>
6053
6068
6054 * IPython/Magic.py (Magic._ofind): fixed namespace order search
6069 * IPython/Magic.py (Magic._ofind): fixed namespace order search
6055 bug. Information would be reported about builtins even when
6070 bug. Information would be reported about builtins even when
6056 user-defined functions overrode them.
6071 user-defined functions overrode them.
6057
6072
6058 2002-05-11 Fernando Perez <fperez@colorado.edu>
6073 2002-05-11 Fernando Perez <fperez@colorado.edu>
6059
6074
6060 * IPython/__init__.py (__all__): removed FlexCompleter from
6075 * IPython/__init__.py (__all__): removed FlexCompleter from
6061 __all__ so that things don't fail in platforms without readline.
6076 __all__ so that things don't fail in platforms without readline.
6062
6077
6063 2002-05-10 Fernando Perez <fperez@colorado.edu>
6078 2002-05-10 Fernando Perez <fperez@colorado.edu>
6064
6079
6065 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
6080 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
6066 it requires Numeric, effectively making Numeric a dependency for
6081 it requires Numeric, effectively making Numeric a dependency for
6067 IPython.
6082 IPython.
6068
6083
6069 * Released 0.2.13
6084 * Released 0.2.13
6070
6085
6071 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
6086 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
6072 profiler interface. Now all the major options from the profiler
6087 profiler interface. Now all the major options from the profiler
6073 module are directly supported in IPython, both for single
6088 module are directly supported in IPython, both for single
6074 expressions (@prun) and for full programs (@run -p).
6089 expressions (@prun) and for full programs (@run -p).
6075
6090
6076 2002-05-09 Fernando Perez <fperez@colorado.edu>
6091 2002-05-09 Fernando Perez <fperez@colorado.edu>
6077
6092
6078 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
6093 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
6079 magic properly formatted for screen.
6094 magic properly formatted for screen.
6080
6095
6081 * setup.py (make_shortcut): Changed things to put pdf version in
6096 * setup.py (make_shortcut): Changed things to put pdf version in
6082 doc/ instead of doc/manual (had to change lyxport a bit).
6097 doc/ instead of doc/manual (had to change lyxport a bit).
6083
6098
6084 * IPython/Magic.py (Profile.string_stats): made profile runs go
6099 * IPython/Magic.py (Profile.string_stats): made profile runs go
6085 through pager (they are long and a pager allows searching, saving,
6100 through pager (they are long and a pager allows searching, saving,
6086 etc.)
6101 etc.)
6087
6102
6088 2002-05-08 Fernando Perez <fperez@colorado.edu>
6103 2002-05-08 Fernando Perez <fperez@colorado.edu>
6089
6104
6090 * Released 0.2.12
6105 * Released 0.2.12
6091
6106
6092 2002-05-06 Fernando Perez <fperez@colorado.edu>
6107 2002-05-06 Fernando Perez <fperez@colorado.edu>
6093
6108
6094 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
6109 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
6095 introduced); 'hist n1 n2' was broken.
6110 introduced); 'hist n1 n2' was broken.
6096 (Magic.magic_pdb): added optional on/off arguments to @pdb
6111 (Magic.magic_pdb): added optional on/off arguments to @pdb
6097 (Magic.magic_run): added option -i to @run, which executes code in
6112 (Magic.magic_run): added option -i to @run, which executes code in
6098 the IPython namespace instead of a clean one. Also added @irun as
6113 the IPython namespace instead of a clean one. Also added @irun as
6099 an alias to @run -i.
6114 an alias to @run -i.
6100
6115
6101 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
6116 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
6102 fixed (it didn't really do anything, the namespaces were wrong).
6117 fixed (it didn't really do anything, the namespaces were wrong).
6103
6118
6104 * IPython/Debugger.py (__init__): Added workaround for python 2.1
6119 * IPython/Debugger.py (__init__): Added workaround for python 2.1
6105
6120
6106 * IPython/__init__.py (__all__): Fixed package namespace, now
6121 * IPython/__init__.py (__all__): Fixed package namespace, now
6107 'import IPython' does give access to IPython.<all> as
6122 'import IPython' does give access to IPython.<all> as
6108 expected. Also renamed __release__ to Release.
6123 expected. Also renamed __release__ to Release.
6109
6124
6110 * IPython/Debugger.py (__license__): created new Pdb class which
6125 * IPython/Debugger.py (__license__): created new Pdb class which
6111 functions like a drop-in for the normal pdb.Pdb but does NOT
6126 functions like a drop-in for the normal pdb.Pdb but does NOT
6112 import readline by default. This way it doesn't muck up IPython's
6127 import readline by default. This way it doesn't muck up IPython's
6113 readline handling, and now tab-completion finally works in the
6128 readline handling, and now tab-completion finally works in the
6114 debugger -- sort of. It completes things globally visible, but the
6129 debugger -- sort of. It completes things globally visible, but the
6115 completer doesn't track the stack as pdb walks it. That's a bit
6130 completer doesn't track the stack as pdb walks it. That's a bit
6116 tricky, and I'll have to implement it later.
6131 tricky, and I'll have to implement it later.
6117
6132
6118 2002-05-05 Fernando Perez <fperez@colorado.edu>
6133 2002-05-05 Fernando Perez <fperez@colorado.edu>
6119
6134
6120 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
6135 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
6121 magic docstrings when printed via ? (explicit \'s were being
6136 magic docstrings when printed via ? (explicit \'s were being
6122 printed).
6137 printed).
6123
6138
6124 * IPython/ipmaker.py (make_IPython): fixed namespace
6139 * IPython/ipmaker.py (make_IPython): fixed namespace
6125 identification bug. Now variables loaded via logs or command-line
6140 identification bug. Now variables loaded via logs or command-line
6126 files are recognized in the interactive namespace by @who.
6141 files are recognized in the interactive namespace by @who.
6127
6142
6128 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
6143 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
6129 log replay system stemming from the string form of Structs.
6144 log replay system stemming from the string form of Structs.
6130
6145
6131 * IPython/Magic.py (Macro.__init__): improved macros to properly
6146 * IPython/Magic.py (Macro.__init__): improved macros to properly
6132 handle magic commands in them.
6147 handle magic commands in them.
6133 (Magic.magic_logstart): usernames are now expanded so 'logstart
6148 (Magic.magic_logstart): usernames are now expanded so 'logstart
6134 ~/mylog' now works.
6149 ~/mylog' now works.
6135
6150
6136 * IPython/iplib.py (complete): fixed bug where paths starting with
6151 * IPython/iplib.py (complete): fixed bug where paths starting with
6137 '/' would be completed as magic names.
6152 '/' would be completed as magic names.
6138
6153
6139 2002-05-04 Fernando Perez <fperez@colorado.edu>
6154 2002-05-04 Fernando Perez <fperez@colorado.edu>
6140
6155
6141 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
6156 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
6142 allow running full programs under the profiler's control.
6157 allow running full programs under the profiler's control.
6143
6158
6144 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
6159 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
6145 mode to report exceptions verbosely but without formatting
6160 mode to report exceptions verbosely but without formatting
6146 variables. This addresses the issue of ipython 'freezing' (it's
6161 variables. This addresses the issue of ipython 'freezing' (it's
6147 not frozen, but caught in an expensive formatting loop) when huge
6162 not frozen, but caught in an expensive formatting loop) when huge
6148 variables are in the context of an exception.
6163 variables are in the context of an exception.
6149 (VerboseTB.text): Added '--->' markers at line where exception was
6164 (VerboseTB.text): Added '--->' markers at line where exception was
6150 triggered. Much clearer to read, especially in NoColor modes.
6165 triggered. Much clearer to read, especially in NoColor modes.
6151
6166
6152 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
6167 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
6153 implemented in reverse when changing to the new parse_options().
6168 implemented in reverse when changing to the new parse_options().
6154
6169
6155 2002-05-03 Fernando Perez <fperez@colorado.edu>
6170 2002-05-03 Fernando Perez <fperez@colorado.edu>
6156
6171
6157 * IPython/Magic.py (Magic.parse_options): new function so that
6172 * IPython/Magic.py (Magic.parse_options): new function so that
6158 magics can parse options easier.
6173 magics can parse options easier.
6159 (Magic.magic_prun): new function similar to profile.run(),
6174 (Magic.magic_prun): new function similar to profile.run(),
6160 suggested by Chris Hart.
6175 suggested by Chris Hart.
6161 (Magic.magic_cd): fixed behavior so that it only changes if
6176 (Magic.magic_cd): fixed behavior so that it only changes if
6162 directory actually is in history.
6177 directory actually is in history.
6163
6178
6164 * IPython/usage.py (__doc__): added information about potential
6179 * IPython/usage.py (__doc__): added information about potential
6165 slowness of Verbose exception mode when there are huge data
6180 slowness of Verbose exception mode when there are huge data
6166 structures to be formatted (thanks to Archie Paulson).
6181 structures to be formatted (thanks to Archie Paulson).
6167
6182
6168 * IPython/ipmaker.py (make_IPython): Changed default logging
6183 * IPython/ipmaker.py (make_IPython): Changed default logging
6169 (when simply called with -log) to use curr_dir/ipython.log in
6184 (when simply called with -log) to use curr_dir/ipython.log in
6170 rotate mode. Fixed crash which was occuring with -log before
6185 rotate mode. Fixed crash which was occuring with -log before
6171 (thanks to Jim Boyle).
6186 (thanks to Jim Boyle).
6172
6187
6173 2002-05-01 Fernando Perez <fperez@colorado.edu>
6188 2002-05-01 Fernando Perez <fperez@colorado.edu>
6174
6189
6175 * Released 0.2.11 for these fixes (mainly the ultraTB one which
6190 * Released 0.2.11 for these fixes (mainly the ultraTB one which
6176 was nasty -- though somewhat of a corner case).
6191 was nasty -- though somewhat of a corner case).
6177
6192
6178 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
6193 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
6179 text (was a bug).
6194 text (was a bug).
6180
6195
6181 2002-04-30 Fernando Perez <fperez@colorado.edu>
6196 2002-04-30 Fernando Perez <fperez@colorado.edu>
6182
6197
6183 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
6198 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
6184 a print after ^D or ^C from the user so that the In[] prompt
6199 a print after ^D or ^C from the user so that the In[] prompt
6185 doesn't over-run the gnuplot one.
6200 doesn't over-run the gnuplot one.
6186
6201
6187 2002-04-29 Fernando Perez <fperez@colorado.edu>
6202 2002-04-29 Fernando Perez <fperez@colorado.edu>
6188
6203
6189 * Released 0.2.10
6204 * Released 0.2.10
6190
6205
6191 * IPython/__release__.py (version): get date dynamically.
6206 * IPython/__release__.py (version): get date dynamically.
6192
6207
6193 * Misc. documentation updates thanks to Arnd's comments. Also ran
6208 * Misc. documentation updates thanks to Arnd's comments. Also ran
6194 a full spellcheck on the manual (hadn't been done in a while).
6209 a full spellcheck on the manual (hadn't been done in a while).
6195
6210
6196 2002-04-27 Fernando Perez <fperez@colorado.edu>
6211 2002-04-27 Fernando Perez <fperez@colorado.edu>
6197
6212
6198 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
6213 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
6199 starting a log in mid-session would reset the input history list.
6214 starting a log in mid-session would reset the input history list.
6200
6215
6201 2002-04-26 Fernando Perez <fperez@colorado.edu>
6216 2002-04-26 Fernando Perez <fperez@colorado.edu>
6202
6217
6203 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
6218 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
6204 all files were being included in an update. Now anything in
6219 all files were being included in an update. Now anything in
6205 UserConfig that matches [A-Za-z]*.py will go (this excludes
6220 UserConfig that matches [A-Za-z]*.py will go (this excludes
6206 __init__.py)
6221 __init__.py)
6207
6222
6208 2002-04-25 Fernando Perez <fperez@colorado.edu>
6223 2002-04-25 Fernando Perez <fperez@colorado.edu>
6209
6224
6210 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
6225 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
6211 to __builtins__ so that any form of embedded or imported code can
6226 to __builtins__ so that any form of embedded or imported code can
6212 test for being inside IPython.
6227 test for being inside IPython.
6213
6228
6214 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
6229 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
6215 changed to GnuplotMagic because it's now an importable module,
6230 changed to GnuplotMagic because it's now an importable module,
6216 this makes the name follow that of the standard Gnuplot module.
6231 this makes the name follow that of the standard Gnuplot module.
6217 GnuplotMagic can now be loaded at any time in mid-session.
6232 GnuplotMagic can now be loaded at any time in mid-session.
6218
6233
6219 2002-04-24 Fernando Perez <fperez@colorado.edu>
6234 2002-04-24 Fernando Perez <fperez@colorado.edu>
6220
6235
6221 * IPython/numutils.py: removed SIUnits. It doesn't properly set
6236 * IPython/numutils.py: removed SIUnits. It doesn't properly set
6222 the globals (IPython has its own namespace) and the
6237 the globals (IPython has its own namespace) and the
6223 PhysicalQuantity stuff is much better anyway.
6238 PhysicalQuantity stuff is much better anyway.
6224
6239
6225 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
6240 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
6226 embedding example to standard user directory for
6241 embedding example to standard user directory for
6227 distribution. Also put it in the manual.
6242 distribution. Also put it in the manual.
6228
6243
6229 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
6244 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
6230 instance as first argument (so it doesn't rely on some obscure
6245 instance as first argument (so it doesn't rely on some obscure
6231 hidden global).
6246 hidden global).
6232
6247
6233 * IPython/UserConfig/ipythonrc.py: put () back in accepted
6248 * IPython/UserConfig/ipythonrc.py: put () back in accepted
6234 delimiters. While it prevents ().TAB from working, it allows
6249 delimiters. While it prevents ().TAB from working, it allows
6235 completions in open (... expressions. This is by far a more common
6250 completions in open (... expressions. This is by far a more common
6236 case.
6251 case.
6237
6252
6238 2002-04-23 Fernando Perez <fperez@colorado.edu>
6253 2002-04-23 Fernando Perez <fperez@colorado.edu>
6239
6254
6240 * IPython/Extensions/InterpreterPasteInput.py: new
6255 * IPython/Extensions/InterpreterPasteInput.py: new
6241 syntax-processing module for pasting lines with >>> or ... at the
6256 syntax-processing module for pasting lines with >>> or ... at the
6242 start.
6257 start.
6243
6258
6244 * IPython/Extensions/PhysicalQ_Interactive.py
6259 * IPython/Extensions/PhysicalQ_Interactive.py
6245 (PhysicalQuantityInteractive.__int__): fixed to work with either
6260 (PhysicalQuantityInteractive.__int__): fixed to work with either
6246 Numeric or math.
6261 Numeric or math.
6247
6262
6248 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
6263 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
6249 provided profiles. Now we have:
6264 provided profiles. Now we have:
6250 -math -> math module as * and cmath with its own namespace.
6265 -math -> math module as * and cmath with its own namespace.
6251 -numeric -> Numeric as *, plus gnuplot & grace
6266 -numeric -> Numeric as *, plus gnuplot & grace
6252 -physics -> same as before
6267 -physics -> same as before
6253
6268
6254 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
6269 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
6255 user-defined magics wouldn't be found by @magic if they were
6270 user-defined magics wouldn't be found by @magic if they were
6256 defined as class methods. Also cleaned up the namespace search
6271 defined as class methods. Also cleaned up the namespace search
6257 logic and the string building (to use %s instead of many repeated
6272 logic and the string building (to use %s instead of many repeated
6258 string adds).
6273 string adds).
6259
6274
6260 * IPython/UserConfig/example-magic.py (magic_foo): updated example
6275 * IPython/UserConfig/example-magic.py (magic_foo): updated example
6261 of user-defined magics to operate with class methods (cleaner, in
6276 of user-defined magics to operate with class methods (cleaner, in
6262 line with the gnuplot code).
6277 line with the gnuplot code).
6263
6278
6264 2002-04-22 Fernando Perez <fperez@colorado.edu>
6279 2002-04-22 Fernando Perez <fperez@colorado.edu>
6265
6280
6266 * setup.py: updated dependency list so that manual is updated when
6281 * setup.py: updated dependency list so that manual is updated when
6267 all included files change.
6282 all included files change.
6268
6283
6269 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
6284 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
6270 the delimiter removal option (the fix is ugly right now).
6285 the delimiter removal option (the fix is ugly right now).
6271
6286
6272 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
6287 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
6273 all of the math profile (quicker loading, no conflict between
6288 all of the math profile (quicker loading, no conflict between
6274 g-9.8 and g-gnuplot).
6289 g-9.8 and g-gnuplot).
6275
6290
6276 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
6291 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
6277 name of post-mortem files to IPython_crash_report.txt.
6292 name of post-mortem files to IPython_crash_report.txt.
6278
6293
6279 * Cleanup/update of the docs. Added all the new readline info and
6294 * Cleanup/update of the docs. Added all the new readline info and
6280 formatted all lists as 'real lists'.
6295 formatted all lists as 'real lists'.
6281
6296
6282 * IPython/ipmaker.py (make_IPython): removed now-obsolete
6297 * IPython/ipmaker.py (make_IPython): removed now-obsolete
6283 tab-completion options, since the full readline parse_and_bind is
6298 tab-completion options, since the full readline parse_and_bind is
6284 now accessible.
6299 now accessible.
6285
6300
6286 * IPython/iplib.py (InteractiveShell.init_readline): Changed
6301 * IPython/iplib.py (InteractiveShell.init_readline): Changed
6287 handling of readline options. Now users can specify any string to
6302 handling of readline options. Now users can specify any string to
6288 be passed to parse_and_bind(), as well as the delimiters to be
6303 be passed to parse_and_bind(), as well as the delimiters to be
6289 removed.
6304 removed.
6290 (InteractiveShell.__init__): Added __name__ to the global
6305 (InteractiveShell.__init__): Added __name__ to the global
6291 namespace so that things like Itpl which rely on its existence
6306 namespace so that things like Itpl which rely on its existence
6292 don't crash.
6307 don't crash.
6293 (InteractiveShell._prefilter): Defined the default with a _ so
6308 (InteractiveShell._prefilter): Defined the default with a _ so
6294 that prefilter() is easier to override, while the default one
6309 that prefilter() is easier to override, while the default one
6295 remains available.
6310 remains available.
6296
6311
6297 2002-04-18 Fernando Perez <fperez@colorado.edu>
6312 2002-04-18 Fernando Perez <fperez@colorado.edu>
6298
6313
6299 * Added information about pdb in the docs.
6314 * Added information about pdb in the docs.
6300
6315
6301 2002-04-17 Fernando Perez <fperez@colorado.edu>
6316 2002-04-17 Fernando Perez <fperez@colorado.edu>
6302
6317
6303 * IPython/ipmaker.py (make_IPython): added rc_override option to
6318 * IPython/ipmaker.py (make_IPython): added rc_override option to
6304 allow passing config options at creation time which may override
6319 allow passing config options at creation time which may override
6305 anything set in the config files or command line. This is
6320 anything set in the config files or command line. This is
6306 particularly useful for configuring embedded instances.
6321 particularly useful for configuring embedded instances.
6307
6322
6308 2002-04-15 Fernando Perez <fperez@colorado.edu>
6323 2002-04-15 Fernando Perez <fperez@colorado.edu>
6309
6324
6310 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
6325 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
6311 crash embedded instances because of the input cache falling out of
6326 crash embedded instances because of the input cache falling out of
6312 sync with the output counter.
6327 sync with the output counter.
6313
6328
6314 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
6329 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
6315 mode which calls pdb after an uncaught exception in IPython itself.
6330 mode which calls pdb after an uncaught exception in IPython itself.
6316
6331
6317 2002-04-14 Fernando Perez <fperez@colorado.edu>
6332 2002-04-14 Fernando Perez <fperez@colorado.edu>
6318
6333
6319 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
6334 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
6320 readline, fix it back after each call.
6335 readline, fix it back after each call.
6321
6336
6322 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
6337 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
6323 method to force all access via __call__(), which guarantees that
6338 method to force all access via __call__(), which guarantees that
6324 traceback references are properly deleted.
6339 traceback references are properly deleted.
6325
6340
6326 * IPython/Prompts.py (CachedOutput._display): minor fixes to
6341 * IPython/Prompts.py (CachedOutput._display): minor fixes to
6327 improve printing when pprint is in use.
6342 improve printing when pprint is in use.
6328
6343
6329 2002-04-13 Fernando Perez <fperez@colorado.edu>
6344 2002-04-13 Fernando Perez <fperez@colorado.edu>
6330
6345
6331 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
6346 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
6332 exceptions aren't caught anymore. If the user triggers one, he
6347 exceptions aren't caught anymore. If the user triggers one, he
6333 should know why he's doing it and it should go all the way up,
6348 should know why he's doing it and it should go all the way up,
6334 just like any other exception. So now @abort will fully kill the
6349 just like any other exception. So now @abort will fully kill the
6335 embedded interpreter and the embedding code (unless that happens
6350 embedded interpreter and the embedding code (unless that happens
6336 to catch SystemExit).
6351 to catch SystemExit).
6337
6352
6338 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
6353 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
6339 and a debugger() method to invoke the interactive pdb debugger
6354 and a debugger() method to invoke the interactive pdb debugger
6340 after printing exception information. Also added the corresponding
6355 after printing exception information. Also added the corresponding
6341 -pdb option and @pdb magic to control this feature, and updated
6356 -pdb option and @pdb magic to control this feature, and updated
6342 the docs. After a suggestion from Christopher Hart
6357 the docs. After a suggestion from Christopher Hart
6343 (hart-AT-caltech.edu).
6358 (hart-AT-caltech.edu).
6344
6359
6345 2002-04-12 Fernando Perez <fperez@colorado.edu>
6360 2002-04-12 Fernando Perez <fperez@colorado.edu>
6346
6361
6347 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
6362 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
6348 the exception handlers defined by the user (not the CrashHandler)
6363 the exception handlers defined by the user (not the CrashHandler)
6349 so that user exceptions don't trigger an ipython bug report.
6364 so that user exceptions don't trigger an ipython bug report.
6350
6365
6351 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
6366 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
6352 configurable (it should have always been so).
6367 configurable (it should have always been so).
6353
6368
6354 2002-03-26 Fernando Perez <fperez@colorado.edu>
6369 2002-03-26 Fernando Perez <fperez@colorado.edu>
6355
6370
6356 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
6371 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
6357 and there to fix embedding namespace issues. This should all be
6372 and there to fix embedding namespace issues. This should all be
6358 done in a more elegant way.
6373 done in a more elegant way.
6359
6374
6360 2002-03-25 Fernando Perez <fperez@colorado.edu>
6375 2002-03-25 Fernando Perez <fperez@colorado.edu>
6361
6376
6362 * IPython/genutils.py (get_home_dir): Try to make it work under
6377 * IPython/genutils.py (get_home_dir): Try to make it work under
6363 win9x also.
6378 win9x also.
6364
6379
6365 2002-03-20 Fernando Perez <fperez@colorado.edu>
6380 2002-03-20 Fernando Perez <fperez@colorado.edu>
6366
6381
6367 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
6382 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
6368 sys.displayhook untouched upon __init__.
6383 sys.displayhook untouched upon __init__.
6369
6384
6370 2002-03-19 Fernando Perez <fperez@colorado.edu>
6385 2002-03-19 Fernando Perez <fperez@colorado.edu>
6371
6386
6372 * Released 0.2.9 (for embedding bug, basically).
6387 * Released 0.2.9 (for embedding bug, basically).
6373
6388
6374 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
6389 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
6375 exceptions so that enclosing shell's state can be restored.
6390 exceptions so that enclosing shell's state can be restored.
6376
6391
6377 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
6392 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
6378 naming conventions in the .ipython/ dir.
6393 naming conventions in the .ipython/ dir.
6379
6394
6380 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
6395 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
6381 from delimiters list so filenames with - in them get expanded.
6396 from delimiters list so filenames with - in them get expanded.
6382
6397
6383 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
6398 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
6384 sys.displayhook not being properly restored after an embedded call.
6399 sys.displayhook not being properly restored after an embedded call.
6385
6400
6386 2002-03-18 Fernando Perez <fperez@colorado.edu>
6401 2002-03-18 Fernando Perez <fperez@colorado.edu>
6387
6402
6388 * Released 0.2.8
6403 * Released 0.2.8
6389
6404
6390 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
6405 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
6391 some files weren't being included in a -upgrade.
6406 some files weren't being included in a -upgrade.
6392 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
6407 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
6393 on' so that the first tab completes.
6408 on' so that the first tab completes.
6394 (InteractiveShell.handle_magic): fixed bug with spaces around
6409 (InteractiveShell.handle_magic): fixed bug with spaces around
6395 quotes breaking many magic commands.
6410 quotes breaking many magic commands.
6396
6411
6397 * setup.py: added note about ignoring the syntax error messages at
6412 * setup.py: added note about ignoring the syntax error messages at
6398 installation.
6413 installation.
6399
6414
6400 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
6415 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
6401 streamlining the gnuplot interface, now there's only one magic @gp.
6416 streamlining the gnuplot interface, now there's only one magic @gp.
6402
6417
6403 2002-03-17 Fernando Perez <fperez@colorado.edu>
6418 2002-03-17 Fernando Perez <fperez@colorado.edu>
6404
6419
6405 * IPython/UserConfig/magic_gnuplot.py: new name for the
6420 * IPython/UserConfig/magic_gnuplot.py: new name for the
6406 example-magic_pm.py file. Much enhanced system, now with a shell
6421 example-magic_pm.py file. Much enhanced system, now with a shell
6407 for communicating directly with gnuplot, one command at a time.
6422 for communicating directly with gnuplot, one command at a time.
6408
6423
6409 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6424 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6410 setting __name__=='__main__'.
6425 setting __name__=='__main__'.
6411
6426
6412 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6427 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6413 mini-shell for accessing gnuplot from inside ipython. Should
6428 mini-shell for accessing gnuplot from inside ipython. Should
6414 extend it later for grace access too. Inspired by Arnd's
6429 extend it later for grace access too. Inspired by Arnd's
6415 suggestion.
6430 suggestion.
6416
6431
6417 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6432 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6418 calling magic functions with () in their arguments. Thanks to Arnd
6433 calling magic functions with () in their arguments. Thanks to Arnd
6419 Baecker for pointing this to me.
6434 Baecker for pointing this to me.
6420
6435
6421 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6436 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6422 infinitely for integer or complex arrays (only worked with floats).
6437 infinitely for integer or complex arrays (only worked with floats).
6423
6438
6424 2002-03-16 Fernando Perez <fperez@colorado.edu>
6439 2002-03-16 Fernando Perez <fperez@colorado.edu>
6425
6440
6426 * setup.py: Merged setup and setup_windows into a single script
6441 * setup.py: Merged setup and setup_windows into a single script
6427 which properly handles things for windows users.
6442 which properly handles things for windows users.
6428
6443
6429 2002-03-15 Fernando Perez <fperez@colorado.edu>
6444 2002-03-15 Fernando Perez <fperez@colorado.edu>
6430
6445
6431 * Big change to the manual: now the magics are all automatically
6446 * Big change to the manual: now the magics are all automatically
6432 documented. This information is generated from their docstrings
6447 documented. This information is generated from their docstrings
6433 and put in a latex file included by the manual lyx file. This way
6448 and put in a latex file included by the manual lyx file. This way
6434 we get always up to date information for the magics. The manual
6449 we get always up to date information for the magics. The manual
6435 now also has proper version information, also auto-synced.
6450 now also has proper version information, also auto-synced.
6436
6451
6437 For this to work, an undocumented --magic_docstrings option was added.
6452 For this to work, an undocumented --magic_docstrings option was added.
6438
6453
6439 2002-03-13 Fernando Perez <fperez@colorado.edu>
6454 2002-03-13 Fernando Perez <fperez@colorado.edu>
6440
6455
6441 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6456 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6442 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6457 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6443
6458
6444 2002-03-12 Fernando Perez <fperez@colorado.edu>
6459 2002-03-12 Fernando Perez <fperez@colorado.edu>
6445
6460
6446 * IPython/ultraTB.py (TermColors): changed color escapes again to
6461 * IPython/ultraTB.py (TermColors): changed color escapes again to
6447 fix the (old, reintroduced) line-wrapping bug. Basically, if
6462 fix the (old, reintroduced) line-wrapping bug. Basically, if
6448 \001..\002 aren't given in the color escapes, lines get wrapped
6463 \001..\002 aren't given in the color escapes, lines get wrapped
6449 weirdly. But giving those screws up old xterms and emacs terms. So
6464 weirdly. But giving those screws up old xterms and emacs terms. So
6450 I added some logic for emacs terms to be ok, but I can't identify old
6465 I added some logic for emacs terms to be ok, but I can't identify old
6451 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6466 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6452
6467
6453 2002-03-10 Fernando Perez <fperez@colorado.edu>
6468 2002-03-10 Fernando Perez <fperez@colorado.edu>
6454
6469
6455 * IPython/usage.py (__doc__): Various documentation cleanups and
6470 * IPython/usage.py (__doc__): Various documentation cleanups and
6456 updates, both in usage docstrings and in the manual.
6471 updates, both in usage docstrings and in the manual.
6457
6472
6458 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6473 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6459 handling of caching. Set minimum acceptabe value for having a
6474 handling of caching. Set minimum acceptabe value for having a
6460 cache at 20 values.
6475 cache at 20 values.
6461
6476
6462 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6477 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6463 install_first_time function to a method, renamed it and added an
6478 install_first_time function to a method, renamed it and added an
6464 'upgrade' mode. Now people can update their config directory with
6479 'upgrade' mode. Now people can update their config directory with
6465 a simple command line switch (-upgrade, also new).
6480 a simple command line switch (-upgrade, also new).
6466
6481
6467 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6482 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6468 @file (convenient for automagic users under Python >= 2.2).
6483 @file (convenient for automagic users under Python >= 2.2).
6469 Removed @files (it seemed more like a plural than an abbrev. of
6484 Removed @files (it seemed more like a plural than an abbrev. of
6470 'file show').
6485 'file show').
6471
6486
6472 * IPython/iplib.py (install_first_time): Fixed crash if there were
6487 * IPython/iplib.py (install_first_time): Fixed crash if there were
6473 backup files ('~') in .ipython/ install directory.
6488 backup files ('~') in .ipython/ install directory.
6474
6489
6475 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6490 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6476 system. Things look fine, but these changes are fairly
6491 system. Things look fine, but these changes are fairly
6477 intrusive. Test them for a few days.
6492 intrusive. Test them for a few days.
6478
6493
6479 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6494 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6480 the prompts system. Now all in/out prompt strings are user
6495 the prompts system. Now all in/out prompt strings are user
6481 controllable. This is particularly useful for embedding, as one
6496 controllable. This is particularly useful for embedding, as one
6482 can tag embedded instances with particular prompts.
6497 can tag embedded instances with particular prompts.
6483
6498
6484 Also removed global use of sys.ps1/2, which now allows nested
6499 Also removed global use of sys.ps1/2, which now allows nested
6485 embeddings without any problems. Added command-line options for
6500 embeddings without any problems. Added command-line options for
6486 the prompt strings.
6501 the prompt strings.
6487
6502
6488 2002-03-08 Fernando Perez <fperez@colorado.edu>
6503 2002-03-08 Fernando Perez <fperez@colorado.edu>
6489
6504
6490 * IPython/UserConfig/example-embed-short.py (ipshell): added
6505 * IPython/UserConfig/example-embed-short.py (ipshell): added
6491 example file with the bare minimum code for embedding.
6506 example file with the bare minimum code for embedding.
6492
6507
6493 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6508 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6494 functionality for the embeddable shell to be activated/deactivated
6509 functionality for the embeddable shell to be activated/deactivated
6495 either globally or at each call.
6510 either globally or at each call.
6496
6511
6497 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6512 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6498 rewriting the prompt with '--->' for auto-inputs with proper
6513 rewriting the prompt with '--->' for auto-inputs with proper
6499 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6514 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6500 this is handled by the prompts class itself, as it should.
6515 this is handled by the prompts class itself, as it should.
6501
6516
6502 2002-03-05 Fernando Perez <fperez@colorado.edu>
6517 2002-03-05 Fernando Perez <fperez@colorado.edu>
6503
6518
6504 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6519 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6505 @logstart to avoid name clashes with the math log function.
6520 @logstart to avoid name clashes with the math log function.
6506
6521
6507 * Big updates to X/Emacs section of the manual.
6522 * Big updates to X/Emacs section of the manual.
6508
6523
6509 * Removed ipython_emacs. Milan explained to me how to pass
6524 * Removed ipython_emacs. Milan explained to me how to pass
6510 arguments to ipython through Emacs. Some day I'm going to end up
6525 arguments to ipython through Emacs. Some day I'm going to end up
6511 learning some lisp...
6526 learning some lisp...
6512
6527
6513 2002-03-04 Fernando Perez <fperez@colorado.edu>
6528 2002-03-04 Fernando Perez <fperez@colorado.edu>
6514
6529
6515 * IPython/ipython_emacs: Created script to be used as the
6530 * IPython/ipython_emacs: Created script to be used as the
6516 py-python-command Emacs variable so we can pass IPython
6531 py-python-command Emacs variable so we can pass IPython
6517 parameters. I can't figure out how to tell Emacs directly to pass
6532 parameters. I can't figure out how to tell Emacs directly to pass
6518 parameters to IPython, so a dummy shell script will do it.
6533 parameters to IPython, so a dummy shell script will do it.
6519
6534
6520 Other enhancements made for things to work better under Emacs'
6535 Other enhancements made for things to work better under Emacs'
6521 various types of terminals. Many thanks to Milan Zamazal
6536 various types of terminals. Many thanks to Milan Zamazal
6522 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6537 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6523
6538
6524 2002-03-01 Fernando Perez <fperez@colorado.edu>
6539 2002-03-01 Fernando Perez <fperez@colorado.edu>
6525
6540
6526 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6541 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6527 that loading of readline is now optional. This gives better
6542 that loading of readline is now optional. This gives better
6528 control to emacs users.
6543 control to emacs users.
6529
6544
6530 * IPython/ultraTB.py (__date__): Modified color escape sequences
6545 * IPython/ultraTB.py (__date__): Modified color escape sequences
6531 and now things work fine under xterm and in Emacs' term buffers
6546 and now things work fine under xterm and in Emacs' term buffers
6532 (though not shell ones). Well, in emacs you get colors, but all
6547 (though not shell ones). Well, in emacs you get colors, but all
6533 seem to be 'light' colors (no difference between dark and light
6548 seem to be 'light' colors (no difference between dark and light
6534 ones). But the garbage chars are gone, and also in xterms. It
6549 ones). But the garbage chars are gone, and also in xterms. It
6535 seems that now I'm using 'cleaner' ansi sequences.
6550 seems that now I'm using 'cleaner' ansi sequences.
6536
6551
6537 2002-02-21 Fernando Perez <fperez@colorado.edu>
6552 2002-02-21 Fernando Perez <fperez@colorado.edu>
6538
6553
6539 * Released 0.2.7 (mainly to publish the scoping fix).
6554 * Released 0.2.7 (mainly to publish the scoping fix).
6540
6555
6541 * IPython/Logger.py (Logger.logstate): added. A corresponding
6556 * IPython/Logger.py (Logger.logstate): added. A corresponding
6542 @logstate magic was created.
6557 @logstate magic was created.
6543
6558
6544 * IPython/Magic.py: fixed nested scoping problem under Python
6559 * IPython/Magic.py: fixed nested scoping problem under Python
6545 2.1.x (automagic wasn't working).
6560 2.1.x (automagic wasn't working).
6546
6561
6547 2002-02-20 Fernando Perez <fperez@colorado.edu>
6562 2002-02-20 Fernando Perez <fperez@colorado.edu>
6548
6563
6549 * Released 0.2.6.
6564 * Released 0.2.6.
6550
6565
6551 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6566 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6552 option so that logs can come out without any headers at all.
6567 option so that logs can come out without any headers at all.
6553
6568
6554 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6569 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6555 SciPy.
6570 SciPy.
6556
6571
6557 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6572 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6558 that embedded IPython calls don't require vars() to be explicitly
6573 that embedded IPython calls don't require vars() to be explicitly
6559 passed. Now they are extracted from the caller's frame (code
6574 passed. Now they are extracted from the caller's frame (code
6560 snatched from Eric Jones' weave). Added better documentation to
6575 snatched from Eric Jones' weave). Added better documentation to
6561 the section on embedding and the example file.
6576 the section on embedding and the example file.
6562
6577
6563 * IPython/genutils.py (page): Changed so that under emacs, it just
6578 * IPython/genutils.py (page): Changed so that under emacs, it just
6564 prints the string. You can then page up and down in the emacs
6579 prints the string. You can then page up and down in the emacs
6565 buffer itself. This is how the builtin help() works.
6580 buffer itself. This is how the builtin help() works.
6566
6581
6567 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6582 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6568 macro scoping: macros need to be executed in the user's namespace
6583 macro scoping: macros need to be executed in the user's namespace
6569 to work as if they had been typed by the user.
6584 to work as if they had been typed by the user.
6570
6585
6571 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6586 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6572 execute automatically (no need to type 'exec...'). They then
6587 execute automatically (no need to type 'exec...'). They then
6573 behave like 'true macros'. The printing system was also modified
6588 behave like 'true macros'. The printing system was also modified
6574 for this to work.
6589 for this to work.
6575
6590
6576 2002-02-19 Fernando Perez <fperez@colorado.edu>
6591 2002-02-19 Fernando Perez <fperez@colorado.edu>
6577
6592
6578 * IPython/genutils.py (page_file): new function for paging files
6593 * IPython/genutils.py (page_file): new function for paging files
6579 in an OS-independent way. Also necessary for file viewing to work
6594 in an OS-independent way. Also necessary for file viewing to work
6580 well inside Emacs buffers.
6595 well inside Emacs buffers.
6581 (page): Added checks for being in an emacs buffer.
6596 (page): Added checks for being in an emacs buffer.
6582 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6597 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6583 same bug in iplib.
6598 same bug in iplib.
6584
6599
6585 2002-02-18 Fernando Perez <fperez@colorado.edu>
6600 2002-02-18 Fernando Perez <fperez@colorado.edu>
6586
6601
6587 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6602 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6588 of readline so that IPython can work inside an Emacs buffer.
6603 of readline so that IPython can work inside an Emacs buffer.
6589
6604
6590 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6605 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6591 method signatures (they weren't really bugs, but it looks cleaner
6606 method signatures (they weren't really bugs, but it looks cleaner
6592 and keeps PyChecker happy).
6607 and keeps PyChecker happy).
6593
6608
6594 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6609 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6595 for implementing various user-defined hooks. Currently only
6610 for implementing various user-defined hooks. Currently only
6596 display is done.
6611 display is done.
6597
6612
6598 * IPython/Prompts.py (CachedOutput._display): changed display
6613 * IPython/Prompts.py (CachedOutput._display): changed display
6599 functions so that they can be dynamically changed by users easily.
6614 functions so that they can be dynamically changed by users easily.
6600
6615
6601 * IPython/Extensions/numeric_formats.py (num_display): added an
6616 * IPython/Extensions/numeric_formats.py (num_display): added an
6602 extension for printing NumPy arrays in flexible manners. It
6617 extension for printing NumPy arrays in flexible manners. It
6603 doesn't do anything yet, but all the structure is in
6618 doesn't do anything yet, but all the structure is in
6604 place. Ultimately the plan is to implement output format control
6619 place. Ultimately the plan is to implement output format control
6605 like in Octave.
6620 like in Octave.
6606
6621
6607 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6622 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6608 methods are found at run-time by all the automatic machinery.
6623 methods are found at run-time by all the automatic machinery.
6609
6624
6610 2002-02-17 Fernando Perez <fperez@colorado.edu>
6625 2002-02-17 Fernando Perez <fperez@colorado.edu>
6611
6626
6612 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6627 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6613 whole file a little.
6628 whole file a little.
6614
6629
6615 * ToDo: closed this document. Now there's a new_design.lyx
6630 * ToDo: closed this document. Now there's a new_design.lyx
6616 document for all new ideas. Added making a pdf of it for the
6631 document for all new ideas. Added making a pdf of it for the
6617 end-user distro.
6632 end-user distro.
6618
6633
6619 * IPython/Logger.py (Logger.switch_log): Created this to replace
6634 * IPython/Logger.py (Logger.switch_log): Created this to replace
6620 logon() and logoff(). It also fixes a nasty crash reported by
6635 logon() and logoff(). It also fixes a nasty crash reported by
6621 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6636 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6622
6637
6623 * IPython/iplib.py (complete): got auto-completion to work with
6638 * IPython/iplib.py (complete): got auto-completion to work with
6624 automagic (I had wanted this for a long time).
6639 automagic (I had wanted this for a long time).
6625
6640
6626 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6641 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6627 to @file, since file() is now a builtin and clashes with automagic
6642 to @file, since file() is now a builtin and clashes with automagic
6628 for @file.
6643 for @file.
6629
6644
6630 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6645 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6631 of this was previously in iplib, which had grown to more than 2000
6646 of this was previously in iplib, which had grown to more than 2000
6632 lines, way too long. No new functionality, but it makes managing
6647 lines, way too long. No new functionality, but it makes managing
6633 the code a bit easier.
6648 the code a bit easier.
6634
6649
6635 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6650 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6636 information to crash reports.
6651 information to crash reports.
6637
6652
6638 2002-02-12 Fernando Perez <fperez@colorado.edu>
6653 2002-02-12 Fernando Perez <fperez@colorado.edu>
6639
6654
6640 * Released 0.2.5.
6655 * Released 0.2.5.
6641
6656
6642 2002-02-11 Fernando Perez <fperez@colorado.edu>
6657 2002-02-11 Fernando Perez <fperez@colorado.edu>
6643
6658
6644 * Wrote a relatively complete Windows installer. It puts
6659 * Wrote a relatively complete Windows installer. It puts
6645 everything in place, creates Start Menu entries and fixes the
6660 everything in place, creates Start Menu entries and fixes the
6646 color issues. Nothing fancy, but it works.
6661 color issues. Nothing fancy, but it works.
6647
6662
6648 2002-02-10 Fernando Perez <fperez@colorado.edu>
6663 2002-02-10 Fernando Perez <fperez@colorado.edu>
6649
6664
6650 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6665 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6651 os.path.expanduser() call so that we can type @run ~/myfile.py and
6666 os.path.expanduser() call so that we can type @run ~/myfile.py and
6652 have thigs work as expected.
6667 have thigs work as expected.
6653
6668
6654 * IPython/genutils.py (page): fixed exception handling so things
6669 * IPython/genutils.py (page): fixed exception handling so things
6655 work both in Unix and Windows correctly. Quitting a pager triggers
6670 work both in Unix and Windows correctly. Quitting a pager triggers
6656 an IOError/broken pipe in Unix, and in windows not finding a pager
6671 an IOError/broken pipe in Unix, and in windows not finding a pager
6657 is also an IOError, so I had to actually look at the return value
6672 is also an IOError, so I had to actually look at the return value
6658 of the exception, not just the exception itself. Should be ok now.
6673 of the exception, not just the exception itself. Should be ok now.
6659
6674
6660 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6675 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6661 modified to allow case-insensitive color scheme changes.
6676 modified to allow case-insensitive color scheme changes.
6662
6677
6663 2002-02-09 Fernando Perez <fperez@colorado.edu>
6678 2002-02-09 Fernando Perez <fperez@colorado.edu>
6664
6679
6665 * IPython/genutils.py (native_line_ends): new function to leave
6680 * IPython/genutils.py (native_line_ends): new function to leave
6666 user config files with os-native line-endings.
6681 user config files with os-native line-endings.
6667
6682
6668 * README and manual updates.
6683 * README and manual updates.
6669
6684
6670 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6685 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6671 instead of StringType to catch Unicode strings.
6686 instead of StringType to catch Unicode strings.
6672
6687
6673 * IPython/genutils.py (filefind): fixed bug for paths with
6688 * IPython/genutils.py (filefind): fixed bug for paths with
6674 embedded spaces (very common in Windows).
6689 embedded spaces (very common in Windows).
6675
6690
6676 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6691 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6677 files under Windows, so that they get automatically associated
6692 files under Windows, so that they get automatically associated
6678 with a text editor. Windows makes it a pain to handle
6693 with a text editor. Windows makes it a pain to handle
6679 extension-less files.
6694 extension-less files.
6680
6695
6681 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6696 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6682 warning about readline only occur for Posix. In Windows there's no
6697 warning about readline only occur for Posix. In Windows there's no
6683 way to get readline, so why bother with the warning.
6698 way to get readline, so why bother with the warning.
6684
6699
6685 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6700 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6686 for __str__ instead of dir(self), since dir() changed in 2.2.
6701 for __str__ instead of dir(self), since dir() changed in 2.2.
6687
6702
6688 * Ported to Windows! Tested on XP, I suspect it should work fine
6703 * Ported to Windows! Tested on XP, I suspect it should work fine
6689 on NT/2000, but I don't think it will work on 98 et al. That
6704 on NT/2000, but I don't think it will work on 98 et al. That
6690 series of Windows is such a piece of junk anyway that I won't try
6705 series of Windows is such a piece of junk anyway that I won't try
6691 porting it there. The XP port was straightforward, showed a few
6706 porting it there. The XP port was straightforward, showed a few
6692 bugs here and there (fixed all), in particular some string
6707 bugs here and there (fixed all), in particular some string
6693 handling stuff which required considering Unicode strings (which
6708 handling stuff which required considering Unicode strings (which
6694 Windows uses). This is good, but hasn't been too tested :) No
6709 Windows uses). This is good, but hasn't been too tested :) No
6695 fancy installer yet, I'll put a note in the manual so people at
6710 fancy installer yet, I'll put a note in the manual so people at
6696 least make manually a shortcut.
6711 least make manually a shortcut.
6697
6712
6698 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6713 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6699 into a single one, "colors". This now controls both prompt and
6714 into a single one, "colors". This now controls both prompt and
6700 exception color schemes, and can be changed both at startup
6715 exception color schemes, and can be changed both at startup
6701 (either via command-line switches or via ipythonrc files) and at
6716 (either via command-line switches or via ipythonrc files) and at
6702 runtime, with @colors.
6717 runtime, with @colors.
6703 (Magic.magic_run): renamed @prun to @run and removed the old
6718 (Magic.magic_run): renamed @prun to @run and removed the old
6704 @run. The two were too similar to warrant keeping both.
6719 @run. The two were too similar to warrant keeping both.
6705
6720
6706 2002-02-03 Fernando Perez <fperez@colorado.edu>
6721 2002-02-03 Fernando Perez <fperez@colorado.edu>
6707
6722
6708 * IPython/iplib.py (install_first_time): Added comment on how to
6723 * IPython/iplib.py (install_first_time): Added comment on how to
6709 configure the color options for first-time users. Put a <return>
6724 configure the color options for first-time users. Put a <return>
6710 request at the end so that small-terminal users get a chance to
6725 request at the end so that small-terminal users get a chance to
6711 read the startup info.
6726 read the startup info.
6712
6727
6713 2002-01-23 Fernando Perez <fperez@colorado.edu>
6728 2002-01-23 Fernando Perez <fperez@colorado.edu>
6714
6729
6715 * IPython/iplib.py (CachedOutput.update): Changed output memory
6730 * IPython/iplib.py (CachedOutput.update): Changed output memory
6716 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6731 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6717 input history we still use _i. Did this b/c these variable are
6732 input history we still use _i. Did this b/c these variable are
6718 very commonly used in interactive work, so the less we need to
6733 very commonly used in interactive work, so the less we need to
6719 type the better off we are.
6734 type the better off we are.
6720 (Magic.magic_prun): updated @prun to better handle the namespaces
6735 (Magic.magic_prun): updated @prun to better handle the namespaces
6721 the file will run in, including a fix for __name__ not being set
6736 the file will run in, including a fix for __name__ not being set
6722 before.
6737 before.
6723
6738
6724 2002-01-20 Fernando Perez <fperez@colorado.edu>
6739 2002-01-20 Fernando Perez <fperez@colorado.edu>
6725
6740
6726 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6741 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6727 extra garbage for Python 2.2. Need to look more carefully into
6742 extra garbage for Python 2.2. Need to look more carefully into
6728 this later.
6743 this later.
6729
6744
6730 2002-01-19 Fernando Perez <fperez@colorado.edu>
6745 2002-01-19 Fernando Perez <fperez@colorado.edu>
6731
6746
6732 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6747 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6733 display SyntaxError exceptions properly formatted when they occur
6748 display SyntaxError exceptions properly formatted when they occur
6734 (they can be triggered by imported code).
6749 (they can be triggered by imported code).
6735
6750
6736 2002-01-18 Fernando Perez <fperez@colorado.edu>
6751 2002-01-18 Fernando Perez <fperez@colorado.edu>
6737
6752
6738 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6753 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6739 SyntaxError exceptions are reported nicely formatted, instead of
6754 SyntaxError exceptions are reported nicely formatted, instead of
6740 spitting out only offset information as before.
6755 spitting out only offset information as before.
6741 (Magic.magic_prun): Added the @prun function for executing
6756 (Magic.magic_prun): Added the @prun function for executing
6742 programs with command line args inside IPython.
6757 programs with command line args inside IPython.
6743
6758
6744 2002-01-16 Fernando Perez <fperez@colorado.edu>
6759 2002-01-16 Fernando Perez <fperez@colorado.edu>
6745
6760
6746 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6761 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6747 to *not* include the last item given in a range. This brings their
6762 to *not* include the last item given in a range. This brings their
6748 behavior in line with Python's slicing:
6763 behavior in line with Python's slicing:
6749 a[n1:n2] -> a[n1]...a[n2-1]
6764 a[n1:n2] -> a[n1]...a[n2-1]
6750 It may be a bit less convenient, but I prefer to stick to Python's
6765 It may be a bit less convenient, but I prefer to stick to Python's
6751 conventions *everywhere*, so users never have to wonder.
6766 conventions *everywhere*, so users never have to wonder.
6752 (Magic.magic_macro): Added @macro function to ease the creation of
6767 (Magic.magic_macro): Added @macro function to ease the creation of
6753 macros.
6768 macros.
6754
6769
6755 2002-01-05 Fernando Perez <fperez@colorado.edu>
6770 2002-01-05 Fernando Perez <fperez@colorado.edu>
6756
6771
6757 * Released 0.2.4.
6772 * Released 0.2.4.
6758
6773
6759 * IPython/iplib.py (Magic.magic_pdef):
6774 * IPython/iplib.py (Magic.magic_pdef):
6760 (InteractiveShell.safe_execfile): report magic lines and error
6775 (InteractiveShell.safe_execfile): report magic lines and error
6761 lines without line numbers so one can easily copy/paste them for
6776 lines without line numbers so one can easily copy/paste them for
6762 re-execution.
6777 re-execution.
6763
6778
6764 * Updated manual with recent changes.
6779 * Updated manual with recent changes.
6765
6780
6766 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6781 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6767 docstring printing when class? is called. Very handy for knowing
6782 docstring printing when class? is called. Very handy for knowing
6768 how to create class instances (as long as __init__ is well
6783 how to create class instances (as long as __init__ is well
6769 documented, of course :)
6784 documented, of course :)
6770 (Magic.magic_doc): print both class and constructor docstrings.
6785 (Magic.magic_doc): print both class and constructor docstrings.
6771 (Magic.magic_pdef): give constructor info if passed a class and
6786 (Magic.magic_pdef): give constructor info if passed a class and
6772 __call__ info for callable object instances.
6787 __call__ info for callable object instances.
6773
6788
6774 2002-01-04 Fernando Perez <fperez@colorado.edu>
6789 2002-01-04 Fernando Perez <fperez@colorado.edu>
6775
6790
6776 * Made deep_reload() off by default. It doesn't always work
6791 * Made deep_reload() off by default. It doesn't always work
6777 exactly as intended, so it's probably safer to have it off. It's
6792 exactly as intended, so it's probably safer to have it off. It's
6778 still available as dreload() anyway, so nothing is lost.
6793 still available as dreload() anyway, so nothing is lost.
6779
6794
6780 2002-01-02 Fernando Perez <fperez@colorado.edu>
6795 2002-01-02 Fernando Perez <fperez@colorado.edu>
6781
6796
6782 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6797 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6783 so I wanted an updated release).
6798 so I wanted an updated release).
6784
6799
6785 2001-12-27 Fernando Perez <fperez@colorado.edu>
6800 2001-12-27 Fernando Perez <fperez@colorado.edu>
6786
6801
6787 * IPython/iplib.py (InteractiveShell.interact): Added the original
6802 * IPython/iplib.py (InteractiveShell.interact): Added the original
6788 code from 'code.py' for this module in order to change the
6803 code from 'code.py' for this module in order to change the
6789 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6804 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6790 the history cache would break when the user hit Ctrl-C, and
6805 the history cache would break when the user hit Ctrl-C, and
6791 interact() offers no way to add any hooks to it.
6806 interact() offers no way to add any hooks to it.
6792
6807
6793 2001-12-23 Fernando Perez <fperez@colorado.edu>
6808 2001-12-23 Fernando Perez <fperez@colorado.edu>
6794
6809
6795 * setup.py: added check for 'MANIFEST' before trying to remove
6810 * setup.py: added check for 'MANIFEST' before trying to remove
6796 it. Thanks to Sean Reifschneider.
6811 it. Thanks to Sean Reifschneider.
6797
6812
6798 2001-12-22 Fernando Perez <fperez@colorado.edu>
6813 2001-12-22 Fernando Perez <fperez@colorado.edu>
6799
6814
6800 * Released 0.2.2.
6815 * Released 0.2.2.
6801
6816
6802 * Finished (reasonably) writing the manual. Later will add the
6817 * Finished (reasonably) writing the manual. Later will add the
6803 python-standard navigation stylesheets, but for the time being
6818 python-standard navigation stylesheets, but for the time being
6804 it's fairly complete. Distribution will include html and pdf
6819 it's fairly complete. Distribution will include html and pdf
6805 versions.
6820 versions.
6806
6821
6807 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6822 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6808 (MayaVi author).
6823 (MayaVi author).
6809
6824
6810 2001-12-21 Fernando Perez <fperez@colorado.edu>
6825 2001-12-21 Fernando Perez <fperez@colorado.edu>
6811
6826
6812 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6827 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6813 good public release, I think (with the manual and the distutils
6828 good public release, I think (with the manual and the distutils
6814 installer). The manual can use some work, but that can go
6829 installer). The manual can use some work, but that can go
6815 slowly. Otherwise I think it's quite nice for end users. Next
6830 slowly. Otherwise I think it's quite nice for end users. Next
6816 summer, rewrite the guts of it...
6831 summer, rewrite the guts of it...
6817
6832
6818 * Changed format of ipythonrc files to use whitespace as the
6833 * Changed format of ipythonrc files to use whitespace as the
6819 separator instead of an explicit '='. Cleaner.
6834 separator instead of an explicit '='. Cleaner.
6820
6835
6821 2001-12-20 Fernando Perez <fperez@colorado.edu>
6836 2001-12-20 Fernando Perez <fperez@colorado.edu>
6822
6837
6823 * Started a manual in LyX. For now it's just a quick merge of the
6838 * Started a manual in LyX. For now it's just a quick merge of the
6824 various internal docstrings and READMEs. Later it may grow into a
6839 various internal docstrings and READMEs. Later it may grow into a
6825 nice, full-blown manual.
6840 nice, full-blown manual.
6826
6841
6827 * Set up a distutils based installer. Installation should now be
6842 * Set up a distutils based installer. Installation should now be
6828 trivially simple for end-users.
6843 trivially simple for end-users.
6829
6844
6830 2001-12-11 Fernando Perez <fperez@colorado.edu>
6845 2001-12-11 Fernando Perez <fperez@colorado.edu>
6831
6846
6832 * Released 0.2.0. First public release, announced it at
6847 * Released 0.2.0. First public release, announced it at
6833 comp.lang.python. From now on, just bugfixes...
6848 comp.lang.python. From now on, just bugfixes...
6834
6849
6835 * Went through all the files, set copyright/license notices and
6850 * Went through all the files, set copyright/license notices and
6836 cleaned up things. Ready for release.
6851 cleaned up things. Ready for release.
6837
6852
6838 2001-12-10 Fernando Perez <fperez@colorado.edu>
6853 2001-12-10 Fernando Perez <fperez@colorado.edu>
6839
6854
6840 * Changed the first-time installer not to use tarfiles. It's more
6855 * Changed the first-time installer not to use tarfiles. It's more
6841 robust now and less unix-dependent. Also makes it easier for
6856 robust now and less unix-dependent. Also makes it easier for
6842 people to later upgrade versions.
6857 people to later upgrade versions.
6843
6858
6844 * Changed @exit to @abort to reflect the fact that it's pretty
6859 * Changed @exit to @abort to reflect the fact that it's pretty
6845 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6860 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6846 becomes significant only when IPyhton is embedded: in that case,
6861 becomes significant only when IPyhton is embedded: in that case,
6847 C-D closes IPython only, but @abort kills the enclosing program
6862 C-D closes IPython only, but @abort kills the enclosing program
6848 too (unless it had called IPython inside a try catching
6863 too (unless it had called IPython inside a try catching
6849 SystemExit).
6864 SystemExit).
6850
6865
6851 * Created Shell module which exposes the actuall IPython Shell
6866 * Created Shell module which exposes the actuall IPython Shell
6852 classes, currently the normal and the embeddable one. This at
6867 classes, currently the normal and the embeddable one. This at
6853 least offers a stable interface we won't need to change when
6868 least offers a stable interface we won't need to change when
6854 (later) the internals are rewritten. That rewrite will be confined
6869 (later) the internals are rewritten. That rewrite will be confined
6855 to iplib and ipmaker, but the Shell interface should remain as is.
6870 to iplib and ipmaker, but the Shell interface should remain as is.
6856
6871
6857 * Added embed module which offers an embeddable IPShell object,
6872 * Added embed module which offers an embeddable IPShell object,
6858 useful to fire up IPython *inside* a running program. Great for
6873 useful to fire up IPython *inside* a running program. Great for
6859 debugging or dynamical data analysis.
6874 debugging or dynamical data analysis.
6860
6875
6861 2001-12-08 Fernando Perez <fperez@colorado.edu>
6876 2001-12-08 Fernando Perez <fperez@colorado.edu>
6862
6877
6863 * Fixed small bug preventing seeing info from methods of defined
6878 * Fixed small bug preventing seeing info from methods of defined
6864 objects (incorrect namespace in _ofind()).
6879 objects (incorrect namespace in _ofind()).
6865
6880
6866 * Documentation cleanup. Moved the main usage docstrings to a
6881 * Documentation cleanup. Moved the main usage docstrings to a
6867 separate file, usage.py (cleaner to maintain, and hopefully in the
6882 separate file, usage.py (cleaner to maintain, and hopefully in the
6868 future some perlpod-like way of producing interactive, man and
6883 future some perlpod-like way of producing interactive, man and
6869 html docs out of it will be found).
6884 html docs out of it will be found).
6870
6885
6871 * Added @profile to see your profile at any time.
6886 * Added @profile to see your profile at any time.
6872
6887
6873 * Added @p as an alias for 'print'. It's especially convenient if
6888 * Added @p as an alias for 'print'. It's especially convenient if
6874 using automagic ('p x' prints x).
6889 using automagic ('p x' prints x).
6875
6890
6876 * Small cleanups and fixes after a pychecker run.
6891 * Small cleanups and fixes after a pychecker run.
6877
6892
6878 * Changed the @cd command to handle @cd - and @cd -<n> for
6893 * Changed the @cd command to handle @cd - and @cd -<n> for
6879 visiting any directory in _dh.
6894 visiting any directory in _dh.
6880
6895
6881 * Introduced _dh, a history of visited directories. @dhist prints
6896 * Introduced _dh, a history of visited directories. @dhist prints
6882 it out with numbers.
6897 it out with numbers.
6883
6898
6884 2001-12-07 Fernando Perez <fperez@colorado.edu>
6899 2001-12-07 Fernando Perez <fperez@colorado.edu>
6885
6900
6886 * Released 0.1.22
6901 * Released 0.1.22
6887
6902
6888 * Made initialization a bit more robust against invalid color
6903 * Made initialization a bit more robust against invalid color
6889 options in user input (exit, not traceback-crash).
6904 options in user input (exit, not traceback-crash).
6890
6905
6891 * Changed the bug crash reporter to write the report only in the
6906 * Changed the bug crash reporter to write the report only in the
6892 user's .ipython directory. That way IPython won't litter people's
6907 user's .ipython directory. That way IPython won't litter people's
6893 hard disks with crash files all over the place. Also print on
6908 hard disks with crash files all over the place. Also print on
6894 screen the necessary mail command.
6909 screen the necessary mail command.
6895
6910
6896 * With the new ultraTB, implemented LightBG color scheme for light
6911 * With the new ultraTB, implemented LightBG color scheme for light
6897 background terminals. A lot of people like white backgrounds, so I
6912 background terminals. A lot of people like white backgrounds, so I
6898 guess we should at least give them something readable.
6913 guess we should at least give them something readable.
6899
6914
6900 2001-12-06 Fernando Perez <fperez@colorado.edu>
6915 2001-12-06 Fernando Perez <fperez@colorado.edu>
6901
6916
6902 * Modified the structure of ultraTB. Now there's a proper class
6917 * Modified the structure of ultraTB. Now there's a proper class
6903 for tables of color schemes which allow adding schemes easily and
6918 for tables of color schemes which allow adding schemes easily and
6904 switching the active scheme without creating a new instance every
6919 switching the active scheme without creating a new instance every
6905 time (which was ridiculous). The syntax for creating new schemes
6920 time (which was ridiculous). The syntax for creating new schemes
6906 is also cleaner. I think ultraTB is finally done, with a clean
6921 is also cleaner. I think ultraTB is finally done, with a clean
6907 class structure. Names are also much cleaner (now there's proper
6922 class structure. Names are also much cleaner (now there's proper
6908 color tables, no need for every variable to also have 'color' in
6923 color tables, no need for every variable to also have 'color' in
6909 its name).
6924 its name).
6910
6925
6911 * Broke down genutils into separate files. Now genutils only
6926 * Broke down genutils into separate files. Now genutils only
6912 contains utility functions, and classes have been moved to their
6927 contains utility functions, and classes have been moved to their
6913 own files (they had enough independent functionality to warrant
6928 own files (they had enough independent functionality to warrant
6914 it): ConfigLoader, OutputTrap, Struct.
6929 it): ConfigLoader, OutputTrap, Struct.
6915
6930
6916 2001-12-05 Fernando Perez <fperez@colorado.edu>
6931 2001-12-05 Fernando Perez <fperez@colorado.edu>
6917
6932
6918 * IPython turns 21! Released version 0.1.21, as a candidate for
6933 * IPython turns 21! Released version 0.1.21, as a candidate for
6919 public consumption. If all goes well, release in a few days.
6934 public consumption. If all goes well, release in a few days.
6920
6935
6921 * Fixed path bug (files in Extensions/ directory wouldn't be found
6936 * Fixed path bug (files in Extensions/ directory wouldn't be found
6922 unless IPython/ was explicitly in sys.path).
6937 unless IPython/ was explicitly in sys.path).
6923
6938
6924 * Extended the FlexCompleter class as MagicCompleter to allow
6939 * Extended the FlexCompleter class as MagicCompleter to allow
6925 completion of @-starting lines.
6940 completion of @-starting lines.
6926
6941
6927 * Created __release__.py file as a central repository for release
6942 * Created __release__.py file as a central repository for release
6928 info that other files can read from.
6943 info that other files can read from.
6929
6944
6930 * Fixed small bug in logging: when logging was turned on in
6945 * Fixed small bug in logging: when logging was turned on in
6931 mid-session, old lines with special meanings (!@?) were being
6946 mid-session, old lines with special meanings (!@?) were being
6932 logged without the prepended comment, which is necessary since
6947 logged without the prepended comment, which is necessary since
6933 they are not truly valid python syntax. This should make session
6948 they are not truly valid python syntax. This should make session
6934 restores produce less errors.
6949 restores produce less errors.
6935
6950
6936 * The namespace cleanup forced me to make a FlexCompleter class
6951 * The namespace cleanup forced me to make a FlexCompleter class
6937 which is nothing but a ripoff of rlcompleter, but with selectable
6952 which is nothing but a ripoff of rlcompleter, but with selectable
6938 namespace (rlcompleter only works in __main__.__dict__). I'll try
6953 namespace (rlcompleter only works in __main__.__dict__). I'll try
6939 to submit a note to the authors to see if this change can be
6954 to submit a note to the authors to see if this change can be
6940 incorporated in future rlcompleter releases (Dec.6: done)
6955 incorporated in future rlcompleter releases (Dec.6: done)
6941
6956
6942 * More fixes to namespace handling. It was a mess! Now all
6957 * More fixes to namespace handling. It was a mess! Now all
6943 explicit references to __main__.__dict__ are gone (except when
6958 explicit references to __main__.__dict__ are gone (except when
6944 really needed) and everything is handled through the namespace
6959 really needed) and everything is handled through the namespace
6945 dicts in the IPython instance. We seem to be getting somewhere
6960 dicts in the IPython instance. We seem to be getting somewhere
6946 with this, finally...
6961 with this, finally...
6947
6962
6948 * Small documentation updates.
6963 * Small documentation updates.
6949
6964
6950 * Created the Extensions directory under IPython (with an
6965 * Created the Extensions directory under IPython (with an
6951 __init__.py). Put the PhysicalQ stuff there. This directory should
6966 __init__.py). Put the PhysicalQ stuff there. This directory should
6952 be used for all special-purpose extensions.
6967 be used for all special-purpose extensions.
6953
6968
6954 * File renaming:
6969 * File renaming:
6955 ipythonlib --> ipmaker
6970 ipythonlib --> ipmaker
6956 ipplib --> iplib
6971 ipplib --> iplib
6957 This makes a bit more sense in terms of what these files actually do.
6972 This makes a bit more sense in terms of what these files actually do.
6958
6973
6959 * Moved all the classes and functions in ipythonlib to ipplib, so
6974 * Moved all the classes and functions in ipythonlib to ipplib, so
6960 now ipythonlib only has make_IPython(). This will ease up its
6975 now ipythonlib only has make_IPython(). This will ease up its
6961 splitting in smaller functional chunks later.
6976 splitting in smaller functional chunks later.
6962
6977
6963 * Cleaned up (done, I think) output of @whos. Better column
6978 * Cleaned up (done, I think) output of @whos. Better column
6964 formatting, and now shows str(var) for as much as it can, which is
6979 formatting, and now shows str(var) for as much as it can, which is
6965 typically what one gets with a 'print var'.
6980 typically what one gets with a 'print var'.
6966
6981
6967 2001-12-04 Fernando Perez <fperez@colorado.edu>
6982 2001-12-04 Fernando Perez <fperez@colorado.edu>
6968
6983
6969 * Fixed namespace problems. Now builtin/IPyhton/user names get
6984 * Fixed namespace problems. Now builtin/IPyhton/user names get
6970 properly reported in their namespace. Internal namespace handling
6985 properly reported in their namespace. Internal namespace handling
6971 is finally getting decent (not perfect yet, but much better than
6986 is finally getting decent (not perfect yet, but much better than
6972 the ad-hoc mess we had).
6987 the ad-hoc mess we had).
6973
6988
6974 * Removed -exit option. If people just want to run a python
6989 * Removed -exit option. If people just want to run a python
6975 script, that's what the normal interpreter is for. Less
6990 script, that's what the normal interpreter is for. Less
6976 unnecessary options, less chances for bugs.
6991 unnecessary options, less chances for bugs.
6977
6992
6978 * Added a crash handler which generates a complete post-mortem if
6993 * Added a crash handler which generates a complete post-mortem if
6979 IPython crashes. This will help a lot in tracking bugs down the
6994 IPython crashes. This will help a lot in tracking bugs down the
6980 road.
6995 road.
6981
6996
6982 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6997 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6983 which were boud to functions being reassigned would bypass the
6998 which were boud to functions being reassigned would bypass the
6984 logger, breaking the sync of _il with the prompt counter. This
6999 logger, breaking the sync of _il with the prompt counter. This
6985 would then crash IPython later when a new line was logged.
7000 would then crash IPython later when a new line was logged.
6986
7001
6987 2001-12-02 Fernando Perez <fperez@colorado.edu>
7002 2001-12-02 Fernando Perez <fperez@colorado.edu>
6988
7003
6989 * Made IPython a package. This means people don't have to clutter
7004 * Made IPython a package. This means people don't have to clutter
6990 their sys.path with yet another directory. Changed the INSTALL
7005 their sys.path with yet another directory. Changed the INSTALL
6991 file accordingly.
7006 file accordingly.
6992
7007
6993 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
7008 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6994 sorts its output (so @who shows it sorted) and @whos formats the
7009 sorts its output (so @who shows it sorted) and @whos formats the
6995 table according to the width of the first column. Nicer, easier to
7010 table according to the width of the first column. Nicer, easier to
6996 read. Todo: write a generic table_format() which takes a list of
7011 read. Todo: write a generic table_format() which takes a list of
6997 lists and prints it nicely formatted, with optional row/column
7012 lists and prints it nicely formatted, with optional row/column
6998 separators and proper padding and justification.
7013 separators and proper padding and justification.
6999
7014
7000 * Released 0.1.20
7015 * Released 0.1.20
7001
7016
7002 * Fixed bug in @log which would reverse the inputcache list (a
7017 * Fixed bug in @log which would reverse the inputcache list (a
7003 copy operation was missing).
7018 copy operation was missing).
7004
7019
7005 * Code cleanup. @config was changed to use page(). Better, since
7020 * Code cleanup. @config was changed to use page(). Better, since
7006 its output is always quite long.
7021 its output is always quite long.
7007
7022
7008 * Itpl is back as a dependency. I was having too many problems
7023 * Itpl is back as a dependency. I was having too many problems
7009 getting the parametric aliases to work reliably, and it's just
7024 getting the parametric aliases to work reliably, and it's just
7010 easier to code weird string operations with it than playing %()s
7025 easier to code weird string operations with it than playing %()s
7011 games. It's only ~6k, so I don't think it's too big a deal.
7026 games. It's only ~6k, so I don't think it's too big a deal.
7012
7027
7013 * Found (and fixed) a very nasty bug with history. !lines weren't
7028 * Found (and fixed) a very nasty bug with history. !lines weren't
7014 getting cached, and the out of sync caches would crash
7029 getting cached, and the out of sync caches would crash
7015 IPython. Fixed it by reorganizing the prefilter/handlers/logger
7030 IPython. Fixed it by reorganizing the prefilter/handlers/logger
7016 division of labor a bit better. Bug fixed, cleaner structure.
7031 division of labor a bit better. Bug fixed, cleaner structure.
7017
7032
7018 2001-12-01 Fernando Perez <fperez@colorado.edu>
7033 2001-12-01 Fernando Perez <fperez@colorado.edu>
7019
7034
7020 * Released 0.1.19
7035 * Released 0.1.19
7021
7036
7022 * Added option -n to @hist to prevent line number printing. Much
7037 * Added option -n to @hist to prevent line number printing. Much
7023 easier to copy/paste code this way.
7038 easier to copy/paste code this way.
7024
7039
7025 * Created global _il to hold the input list. Allows easy
7040 * Created global _il to hold the input list. Allows easy
7026 re-execution of blocks of code by slicing it (inspired by Janko's
7041 re-execution of blocks of code by slicing it (inspired by Janko's
7027 comment on 'macros').
7042 comment on 'macros').
7028
7043
7029 * Small fixes and doc updates.
7044 * Small fixes and doc updates.
7030
7045
7031 * Rewrote @history function (was @h). Renamed it to @hist, @h is
7046 * Rewrote @history function (was @h). Renamed it to @hist, @h is
7032 much too fragile with automagic. Handles properly multi-line
7047 much too fragile with automagic. Handles properly multi-line
7033 statements and takes parameters.
7048 statements and takes parameters.
7034
7049
7035 2001-11-30 Fernando Perez <fperez@colorado.edu>
7050 2001-11-30 Fernando Perez <fperez@colorado.edu>
7036
7051
7037 * Version 0.1.18 released.
7052 * Version 0.1.18 released.
7038
7053
7039 * Fixed nasty namespace bug in initial module imports.
7054 * Fixed nasty namespace bug in initial module imports.
7040
7055
7041 * Added copyright/license notes to all code files (except
7056 * Added copyright/license notes to all code files (except
7042 DPyGetOpt). For the time being, LGPL. That could change.
7057 DPyGetOpt). For the time being, LGPL. That could change.
7043
7058
7044 * Rewrote a much nicer README, updated INSTALL, cleaned up
7059 * Rewrote a much nicer README, updated INSTALL, cleaned up
7045 ipythonrc-* samples.
7060 ipythonrc-* samples.
7046
7061
7047 * Overall code/documentation cleanup. Basically ready for
7062 * Overall code/documentation cleanup. Basically ready for
7048 release. Only remaining thing: licence decision (LGPL?).
7063 release. Only remaining thing: licence decision (LGPL?).
7049
7064
7050 * Converted load_config to a class, ConfigLoader. Now recursion
7065 * Converted load_config to a class, ConfigLoader. Now recursion
7051 control is better organized. Doesn't include the same file twice.
7066 control is better organized. Doesn't include the same file twice.
7052
7067
7053 2001-11-29 Fernando Perez <fperez@colorado.edu>
7068 2001-11-29 Fernando Perez <fperez@colorado.edu>
7054
7069
7055 * Got input history working. Changed output history variables from
7070 * Got input history working. Changed output history variables from
7056 _p to _o so that _i is for input and _o for output. Just cleaner
7071 _p to _o so that _i is for input and _o for output. Just cleaner
7057 convention.
7072 convention.
7058
7073
7059 * Implemented parametric aliases. This pretty much allows the
7074 * Implemented parametric aliases. This pretty much allows the
7060 alias system to offer full-blown shell convenience, I think.
7075 alias system to offer full-blown shell convenience, I think.
7061
7076
7062 * Version 0.1.17 released, 0.1.18 opened.
7077 * Version 0.1.17 released, 0.1.18 opened.
7063
7078
7064 * dot_ipython/ipythonrc (alias): added documentation.
7079 * dot_ipython/ipythonrc (alias): added documentation.
7065 (xcolor): Fixed small bug (xcolors -> xcolor)
7080 (xcolor): Fixed small bug (xcolors -> xcolor)
7066
7081
7067 * Changed the alias system. Now alias is a magic command to define
7082 * Changed the alias system. Now alias is a magic command to define
7068 aliases just like the shell. Rationale: the builtin magics should
7083 aliases just like the shell. Rationale: the builtin magics should
7069 be there for things deeply connected to IPython's
7084 be there for things deeply connected to IPython's
7070 architecture. And this is a much lighter system for what I think
7085 architecture. And this is a much lighter system for what I think
7071 is the really important feature: allowing users to define quickly
7086 is the really important feature: allowing users to define quickly
7072 magics that will do shell things for them, so they can customize
7087 magics that will do shell things for them, so they can customize
7073 IPython easily to match their work habits. If someone is really
7088 IPython easily to match their work habits. If someone is really
7074 desperate to have another name for a builtin alias, they can
7089 desperate to have another name for a builtin alias, they can
7075 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
7090 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
7076 works.
7091 works.
7077
7092
7078 2001-11-28 Fernando Perez <fperez@colorado.edu>
7093 2001-11-28 Fernando Perez <fperez@colorado.edu>
7079
7094
7080 * Changed @file so that it opens the source file at the proper
7095 * Changed @file so that it opens the source file at the proper
7081 line. Since it uses less, if your EDITOR environment is
7096 line. Since it uses less, if your EDITOR environment is
7082 configured, typing v will immediately open your editor of choice
7097 configured, typing v will immediately open your editor of choice
7083 right at the line where the object is defined. Not as quick as
7098 right at the line where the object is defined. Not as quick as
7084 having a direct @edit command, but for all intents and purposes it
7099 having a direct @edit command, but for all intents and purposes it
7085 works. And I don't have to worry about writing @edit to deal with
7100 works. And I don't have to worry about writing @edit to deal with
7086 all the editors, less does that.
7101 all the editors, less does that.
7087
7102
7088 * Version 0.1.16 released, 0.1.17 opened.
7103 * Version 0.1.16 released, 0.1.17 opened.
7089
7104
7090 * Fixed some nasty bugs in the page/page_dumb combo that could
7105 * Fixed some nasty bugs in the page/page_dumb combo that could
7091 crash IPython.
7106 crash IPython.
7092
7107
7093 2001-11-27 Fernando Perez <fperez@colorado.edu>
7108 2001-11-27 Fernando Perez <fperez@colorado.edu>
7094
7109
7095 * Version 0.1.15 released, 0.1.16 opened.
7110 * Version 0.1.15 released, 0.1.16 opened.
7096
7111
7097 * Finally got ? and ?? to work for undefined things: now it's
7112 * Finally got ? and ?? to work for undefined things: now it's
7098 possible to type {}.get? and get information about the get method
7113 possible to type {}.get? and get information about the get method
7099 of dicts, or os.path? even if only os is defined (so technically
7114 of dicts, or os.path? even if only os is defined (so technically
7100 os.path isn't). Works at any level. For example, after import os,
7115 os.path isn't). Works at any level. For example, after import os,
7101 os?, os.path?, os.path.abspath? all work. This is great, took some
7116 os?, os.path?, os.path.abspath? all work. This is great, took some
7102 work in _ofind.
7117 work in _ofind.
7103
7118
7104 * Fixed more bugs with logging. The sanest way to do it was to add
7119 * Fixed more bugs with logging. The sanest way to do it was to add
7105 to @log a 'mode' parameter. Killed two in one shot (this mode
7120 to @log a 'mode' parameter. Killed two in one shot (this mode
7106 option was a request of Janko's). I think it's finally clean
7121 option was a request of Janko's). I think it's finally clean
7107 (famous last words).
7122 (famous last words).
7108
7123
7109 * Added a page_dumb() pager which does a decent job of paging on
7124 * Added a page_dumb() pager which does a decent job of paging on
7110 screen, if better things (like less) aren't available. One less
7125 screen, if better things (like less) aren't available. One less
7111 unix dependency (someday maybe somebody will port this to
7126 unix dependency (someday maybe somebody will port this to
7112 windows).
7127 windows).
7113
7128
7114 * Fixed problem in magic_log: would lock of logging out if log
7129 * Fixed problem in magic_log: would lock of logging out if log
7115 creation failed (because it would still think it had succeeded).
7130 creation failed (because it would still think it had succeeded).
7116
7131
7117 * Improved the page() function using curses to auto-detect screen
7132 * Improved the page() function using curses to auto-detect screen
7118 size. Now it can make a much better decision on whether to print
7133 size. Now it can make a much better decision on whether to print
7119 or page a string. Option screen_length was modified: a value 0
7134 or page a string. Option screen_length was modified: a value 0
7120 means auto-detect, and that's the default now.
7135 means auto-detect, and that's the default now.
7121
7136
7122 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
7137 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
7123 go out. I'll test it for a few days, then talk to Janko about
7138 go out. I'll test it for a few days, then talk to Janko about
7124 licences and announce it.
7139 licences and announce it.
7125
7140
7126 * Fixed the length of the auto-generated ---> prompt which appears
7141 * Fixed the length of the auto-generated ---> prompt which appears
7127 for auto-parens and auto-quotes. Getting this right isn't trivial,
7142 for auto-parens and auto-quotes. Getting this right isn't trivial,
7128 with all the color escapes, different prompt types and optional
7143 with all the color escapes, different prompt types and optional
7129 separators. But it seems to be working in all the combinations.
7144 separators. But it seems to be working in all the combinations.
7130
7145
7131 2001-11-26 Fernando Perez <fperez@colorado.edu>
7146 2001-11-26 Fernando Perez <fperez@colorado.edu>
7132
7147
7133 * Wrote a regexp filter to get option types from the option names
7148 * Wrote a regexp filter to get option types from the option names
7134 string. This eliminates the need to manually keep two duplicate
7149 string. This eliminates the need to manually keep two duplicate
7135 lists.
7150 lists.
7136
7151
7137 * Removed the unneeded check_option_names. Now options are handled
7152 * Removed the unneeded check_option_names. Now options are handled
7138 in a much saner manner and it's easy to visually check that things
7153 in a much saner manner and it's easy to visually check that things
7139 are ok.
7154 are ok.
7140
7155
7141 * Updated version numbers on all files I modified to carry a
7156 * Updated version numbers on all files I modified to carry a
7142 notice so Janko and Nathan have clear version markers.
7157 notice so Janko and Nathan have clear version markers.
7143
7158
7144 * Updated docstring for ultraTB with my changes. I should send
7159 * Updated docstring for ultraTB with my changes. I should send
7145 this to Nathan.
7160 this to Nathan.
7146
7161
7147 * Lots of small fixes. Ran everything through pychecker again.
7162 * Lots of small fixes. Ran everything through pychecker again.
7148
7163
7149 * Made loading of deep_reload an cmd line option. If it's not too
7164 * Made loading of deep_reload an cmd line option. If it's not too
7150 kosher, now people can just disable it. With -nodeep_reload it's
7165 kosher, now people can just disable it. With -nodeep_reload it's
7151 still available as dreload(), it just won't overwrite reload().
7166 still available as dreload(), it just won't overwrite reload().
7152
7167
7153 * Moved many options to the no| form (-opt and -noopt
7168 * Moved many options to the no| form (-opt and -noopt
7154 accepted). Cleaner.
7169 accepted). Cleaner.
7155
7170
7156 * Changed magic_log so that if called with no parameters, it uses
7171 * Changed magic_log so that if called with no parameters, it uses
7157 'rotate' mode. That way auto-generated logs aren't automatically
7172 'rotate' mode. That way auto-generated logs aren't automatically
7158 over-written. For normal logs, now a backup is made if it exists
7173 over-written. For normal logs, now a backup is made if it exists
7159 (only 1 level of backups). A new 'backup' mode was added to the
7174 (only 1 level of backups). A new 'backup' mode was added to the
7160 Logger class to support this. This was a request by Janko.
7175 Logger class to support this. This was a request by Janko.
7161
7176
7162 * Added @logoff/@logon to stop/restart an active log.
7177 * Added @logoff/@logon to stop/restart an active log.
7163
7178
7164 * Fixed a lot of bugs in log saving/replay. It was pretty
7179 * Fixed a lot of bugs in log saving/replay. It was pretty
7165 broken. Now special lines (!@,/) appear properly in the command
7180 broken. Now special lines (!@,/) appear properly in the command
7166 history after a log replay.
7181 history after a log replay.
7167
7182
7168 * Tried and failed to implement full session saving via pickle. My
7183 * Tried and failed to implement full session saving via pickle. My
7169 idea was to pickle __main__.__dict__, but modules can't be
7184 idea was to pickle __main__.__dict__, but modules can't be
7170 pickled. This would be a better alternative to replaying logs, but
7185 pickled. This would be a better alternative to replaying logs, but
7171 seems quite tricky to get to work. Changed -session to be called
7186 seems quite tricky to get to work. Changed -session to be called
7172 -logplay, which more accurately reflects what it does. And if we
7187 -logplay, which more accurately reflects what it does. And if we
7173 ever get real session saving working, -session is now available.
7188 ever get real session saving working, -session is now available.
7174
7189
7175 * Implemented color schemes for prompts also. As for tracebacks,
7190 * Implemented color schemes for prompts also. As for tracebacks,
7176 currently only NoColor and Linux are supported. But now the
7191 currently only NoColor and Linux are supported. But now the
7177 infrastructure is in place, based on a generic ColorScheme
7192 infrastructure is in place, based on a generic ColorScheme
7178 class. So writing and activating new schemes both for the prompts
7193 class. So writing and activating new schemes both for the prompts
7179 and the tracebacks should be straightforward.
7194 and the tracebacks should be straightforward.
7180
7195
7181 * Version 0.1.13 released, 0.1.14 opened.
7196 * Version 0.1.13 released, 0.1.14 opened.
7182
7197
7183 * Changed handling of options for output cache. Now counter is
7198 * Changed handling of options for output cache. Now counter is
7184 hardwired starting at 1 and one specifies the maximum number of
7199 hardwired starting at 1 and one specifies the maximum number of
7185 entries *in the outcache* (not the max prompt counter). This is
7200 entries *in the outcache* (not the max prompt counter). This is
7186 much better, since many statements won't increase the cache
7201 much better, since many statements won't increase the cache
7187 count. It also eliminated some confusing options, now there's only
7202 count. It also eliminated some confusing options, now there's only
7188 one: cache_size.
7203 one: cache_size.
7189
7204
7190 * Added 'alias' magic function and magic_alias option in the
7205 * Added 'alias' magic function and magic_alias option in the
7191 ipythonrc file. Now the user can easily define whatever names he
7206 ipythonrc file. Now the user can easily define whatever names he
7192 wants for the magic functions without having to play weird
7207 wants for the magic functions without having to play weird
7193 namespace games. This gives IPython a real shell-like feel.
7208 namespace games. This gives IPython a real shell-like feel.
7194
7209
7195 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
7210 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
7196 @ or not).
7211 @ or not).
7197
7212
7198 This was one of the last remaining 'visible' bugs (that I know
7213 This was one of the last remaining 'visible' bugs (that I know
7199 of). I think if I can clean up the session loading so it works
7214 of). I think if I can clean up the session loading so it works
7200 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
7215 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
7201 about licensing).
7216 about licensing).
7202
7217
7203 2001-11-25 Fernando Perez <fperez@colorado.edu>
7218 2001-11-25 Fernando Perez <fperez@colorado.edu>
7204
7219
7205 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
7220 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
7206 there's a cleaner distinction between what ? and ?? show.
7221 there's a cleaner distinction between what ? and ?? show.
7207
7222
7208 * Added screen_length option. Now the user can define his own
7223 * Added screen_length option. Now the user can define his own
7209 screen size for page() operations.
7224 screen size for page() operations.
7210
7225
7211 * Implemented magic shell-like functions with automatic code
7226 * Implemented magic shell-like functions with automatic code
7212 generation. Now adding another function is just a matter of adding
7227 generation. Now adding another function is just a matter of adding
7213 an entry to a dict, and the function is dynamically generated at
7228 an entry to a dict, and the function is dynamically generated at
7214 run-time. Python has some really cool features!
7229 run-time. Python has some really cool features!
7215
7230
7216 * Renamed many options to cleanup conventions a little. Now all
7231 * Renamed many options to cleanup conventions a little. Now all
7217 are lowercase, and only underscores where needed. Also in the code
7232 are lowercase, and only underscores where needed. Also in the code
7218 option name tables are clearer.
7233 option name tables are clearer.
7219
7234
7220 * Changed prompts a little. Now input is 'In [n]:' instead of
7235 * Changed prompts a little. Now input is 'In [n]:' instead of
7221 'In[n]:='. This allows it the numbers to be aligned with the
7236 'In[n]:='. This allows it the numbers to be aligned with the
7222 Out[n] numbers, and removes usage of ':=' which doesn't exist in
7237 Out[n] numbers, and removes usage of ':=' which doesn't exist in
7223 Python (it was a Mathematica thing). The '...' continuation prompt
7238 Python (it was a Mathematica thing). The '...' continuation prompt
7224 was also changed a little to align better.
7239 was also changed a little to align better.
7225
7240
7226 * Fixed bug when flushing output cache. Not all _p<n> variables
7241 * Fixed bug when flushing output cache. Not all _p<n> variables
7227 exist, so their deletion needs to be wrapped in a try:
7242 exist, so their deletion needs to be wrapped in a try:
7228
7243
7229 * Figured out how to properly use inspect.formatargspec() (it
7244 * Figured out how to properly use inspect.formatargspec() (it
7230 requires the args preceded by *). So I removed all the code from
7245 requires the args preceded by *). So I removed all the code from
7231 _get_pdef in Magic, which was just replicating that.
7246 _get_pdef in Magic, which was just replicating that.
7232
7247
7233 * Added test to prefilter to allow redefining magic function names
7248 * Added test to prefilter to allow redefining magic function names
7234 as variables. This is ok, since the @ form is always available,
7249 as variables. This is ok, since the @ form is always available,
7235 but whe should allow the user to define a variable called 'ls' if
7250 but whe should allow the user to define a variable called 'ls' if
7236 he needs it.
7251 he needs it.
7237
7252
7238 * Moved the ToDo information from README into a separate ToDo.
7253 * Moved the ToDo information from README into a separate ToDo.
7239
7254
7240 * General code cleanup and small bugfixes. I think it's close to a
7255 * General code cleanup and small bugfixes. I think it's close to a
7241 state where it can be released, obviously with a big 'beta'
7256 state where it can be released, obviously with a big 'beta'
7242 warning on it.
7257 warning on it.
7243
7258
7244 * Got the magic function split to work. Now all magics are defined
7259 * Got the magic function split to work. Now all magics are defined
7245 in a separate class. It just organizes things a bit, and now
7260 in a separate class. It just organizes things a bit, and now
7246 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
7261 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
7247 was too long).
7262 was too long).
7248
7263
7249 * Changed @clear to @reset to avoid potential confusions with
7264 * Changed @clear to @reset to avoid potential confusions with
7250 the shell command clear. Also renamed @cl to @clear, which does
7265 the shell command clear. Also renamed @cl to @clear, which does
7251 exactly what people expect it to from their shell experience.
7266 exactly what people expect it to from their shell experience.
7252
7267
7253 Added a check to the @reset command (since it's so
7268 Added a check to the @reset command (since it's so
7254 destructive, it's probably a good idea to ask for confirmation).
7269 destructive, it's probably a good idea to ask for confirmation).
7255 But now reset only works for full namespace resetting. Since the
7270 But now reset only works for full namespace resetting. Since the
7256 del keyword is already there for deleting a few specific
7271 del keyword is already there for deleting a few specific
7257 variables, I don't see the point of having a redundant magic
7272 variables, I don't see the point of having a redundant magic
7258 function for the same task.
7273 function for the same task.
7259
7274
7260 2001-11-24 Fernando Perez <fperez@colorado.edu>
7275 2001-11-24 Fernando Perez <fperez@colorado.edu>
7261
7276
7262 * Updated the builtin docs (esp. the ? ones).
7277 * Updated the builtin docs (esp. the ? ones).
7263
7278
7264 * Ran all the code through pychecker. Not terribly impressed with
7279 * Ran all the code through pychecker. Not terribly impressed with
7265 it: lots of spurious warnings and didn't really find anything of
7280 it: lots of spurious warnings and didn't really find anything of
7266 substance (just a few modules being imported and not used).
7281 substance (just a few modules being imported and not used).
7267
7282
7268 * Implemented the new ultraTB functionality into IPython. New
7283 * Implemented the new ultraTB functionality into IPython. New
7269 option: xcolors. This chooses color scheme. xmode now only selects
7284 option: xcolors. This chooses color scheme. xmode now only selects
7270 between Plain and Verbose. Better orthogonality.
7285 between Plain and Verbose. Better orthogonality.
7271
7286
7272 * Large rewrite of ultraTB. Much cleaner now, with a separation of
7287 * Large rewrite of ultraTB. Much cleaner now, with a separation of
7273 mode and color scheme for the exception handlers. Now it's
7288 mode and color scheme for the exception handlers. Now it's
7274 possible to have the verbose traceback with no coloring.
7289 possible to have the verbose traceback with no coloring.
7275
7290
7276 2001-11-23 Fernando Perez <fperez@colorado.edu>
7291 2001-11-23 Fernando Perez <fperez@colorado.edu>
7277
7292
7278 * Version 0.1.12 released, 0.1.13 opened.
7293 * Version 0.1.12 released, 0.1.13 opened.
7279
7294
7280 * Removed option to set auto-quote and auto-paren escapes by
7295 * Removed option to set auto-quote and auto-paren escapes by
7281 user. The chances of breaking valid syntax are just too high. If
7296 user. The chances of breaking valid syntax are just too high. If
7282 someone *really* wants, they can always dig into the code.
7297 someone *really* wants, they can always dig into the code.
7283
7298
7284 * Made prompt separators configurable.
7299 * Made prompt separators configurable.
7285
7300
7286 2001-11-22 Fernando Perez <fperez@colorado.edu>
7301 2001-11-22 Fernando Perez <fperez@colorado.edu>
7287
7302
7288 * Small bugfixes in many places.
7303 * Small bugfixes in many places.
7289
7304
7290 * Removed the MyCompleter class from ipplib. It seemed redundant
7305 * Removed the MyCompleter class from ipplib. It seemed redundant
7291 with the C-p,C-n history search functionality. Less code to
7306 with the C-p,C-n history search functionality. Less code to
7292 maintain.
7307 maintain.
7293
7308
7294 * Moved all the original ipython.py code into ipythonlib.py. Right
7309 * Moved all the original ipython.py code into ipythonlib.py. Right
7295 now it's just one big dump into a function called make_IPython, so
7310 now it's just one big dump into a function called make_IPython, so
7296 no real modularity has been gained. But at least it makes the
7311 no real modularity has been gained. But at least it makes the
7297 wrapper script tiny, and since ipythonlib is a module, it gets
7312 wrapper script tiny, and since ipythonlib is a module, it gets
7298 compiled and startup is much faster.
7313 compiled and startup is much faster.
7299
7314
7300 This is a reasobably 'deep' change, so we should test it for a
7315 This is a reasobably 'deep' change, so we should test it for a
7301 while without messing too much more with the code.
7316 while without messing too much more with the code.
7302
7317
7303 2001-11-21 Fernando Perez <fperez@colorado.edu>
7318 2001-11-21 Fernando Perez <fperez@colorado.edu>
7304
7319
7305 * Version 0.1.11 released, 0.1.12 opened for further work.
7320 * Version 0.1.11 released, 0.1.12 opened for further work.
7306
7321
7307 * Removed dependency on Itpl. It was only needed in one place. It
7322 * Removed dependency on Itpl. It was only needed in one place. It
7308 would be nice if this became part of python, though. It makes life
7323 would be nice if this became part of python, though. It makes life
7309 *a lot* easier in some cases.
7324 *a lot* easier in some cases.
7310
7325
7311 * Simplified the prefilter code a bit. Now all handlers are
7326 * Simplified the prefilter code a bit. Now all handlers are
7312 expected to explicitly return a value (at least a blank string).
7327 expected to explicitly return a value (at least a blank string).
7313
7328
7314 * Heavy edits in ipplib. Removed the help system altogether. Now
7329 * Heavy edits in ipplib. Removed the help system altogether. Now
7315 obj?/?? is used for inspecting objects, a magic @doc prints
7330 obj?/?? is used for inspecting objects, a magic @doc prints
7316 docstrings, and full-blown Python help is accessed via the 'help'
7331 docstrings, and full-blown Python help is accessed via the 'help'
7317 keyword. This cleans up a lot of code (less to maintain) and does
7332 keyword. This cleans up a lot of code (less to maintain) and does
7318 the job. Since 'help' is now a standard Python component, might as
7333 the job. Since 'help' is now a standard Python component, might as
7319 well use it and remove duplicate functionality.
7334 well use it and remove duplicate functionality.
7320
7335
7321 Also removed the option to use ipplib as a standalone program. By
7336 Also removed the option to use ipplib as a standalone program. By
7322 now it's too dependent on other parts of IPython to function alone.
7337 now it's too dependent on other parts of IPython to function alone.
7323
7338
7324 * Fixed bug in genutils.pager. It would crash if the pager was
7339 * Fixed bug in genutils.pager. It would crash if the pager was
7325 exited immediately after opening (broken pipe).
7340 exited immediately after opening (broken pipe).
7326
7341
7327 * Trimmed down the VerboseTB reporting a little. The header is
7342 * Trimmed down the VerboseTB reporting a little. The header is
7328 much shorter now and the repeated exception arguments at the end
7343 much shorter now and the repeated exception arguments at the end
7329 have been removed. For interactive use the old header seemed a bit
7344 have been removed. For interactive use the old header seemed a bit
7330 excessive.
7345 excessive.
7331
7346
7332 * Fixed small bug in output of @whos for variables with multi-word
7347 * Fixed small bug in output of @whos for variables with multi-word
7333 types (only first word was displayed).
7348 types (only first word was displayed).
7334
7349
7335 2001-11-17 Fernando Perez <fperez@colorado.edu>
7350 2001-11-17 Fernando Perez <fperez@colorado.edu>
7336
7351
7337 * Version 0.1.10 released, 0.1.11 opened for further work.
7352 * Version 0.1.10 released, 0.1.11 opened for further work.
7338
7353
7339 * Modified dirs and friends. dirs now *returns* the stack (not
7354 * Modified dirs and friends. dirs now *returns* the stack (not
7340 prints), so one can manipulate it as a variable. Convenient to
7355 prints), so one can manipulate it as a variable. Convenient to
7341 travel along many directories.
7356 travel along many directories.
7342
7357
7343 * Fixed bug in magic_pdef: would only work with functions with
7358 * Fixed bug in magic_pdef: would only work with functions with
7344 arguments with default values.
7359 arguments with default values.
7345
7360
7346 2001-11-14 Fernando Perez <fperez@colorado.edu>
7361 2001-11-14 Fernando Perez <fperez@colorado.edu>
7347
7362
7348 * Added the PhysicsInput stuff to dot_ipython so it ships as an
7363 * Added the PhysicsInput stuff to dot_ipython so it ships as an
7349 example with IPython. Various other minor fixes and cleanups.
7364 example with IPython. Various other minor fixes and cleanups.
7350
7365
7351 * Version 0.1.9 released, 0.1.10 opened for further work.
7366 * Version 0.1.9 released, 0.1.10 opened for further work.
7352
7367
7353 * Added sys.path to the list of directories searched in the
7368 * Added sys.path to the list of directories searched in the
7354 execfile= option. It used to be the current directory and the
7369 execfile= option. It used to be the current directory and the
7355 user's IPYTHONDIR only.
7370 user's IPYTHONDIR only.
7356
7371
7357 2001-11-13 Fernando Perez <fperez@colorado.edu>
7372 2001-11-13 Fernando Perez <fperez@colorado.edu>
7358
7373
7359 * Reinstated the raw_input/prefilter separation that Janko had
7374 * Reinstated the raw_input/prefilter separation that Janko had
7360 initially. This gives a more convenient setup for extending the
7375 initially. This gives a more convenient setup for extending the
7361 pre-processor from the outside: raw_input always gets a string,
7376 pre-processor from the outside: raw_input always gets a string,
7362 and prefilter has to process it. We can then redefine prefilter
7377 and prefilter has to process it. We can then redefine prefilter
7363 from the outside and implement extensions for special
7378 from the outside and implement extensions for special
7364 purposes.
7379 purposes.
7365
7380
7366 Today I got one for inputting PhysicalQuantity objects
7381 Today I got one for inputting PhysicalQuantity objects
7367 (from Scientific) without needing any function calls at
7382 (from Scientific) without needing any function calls at
7368 all. Extremely convenient, and it's all done as a user-level
7383 all. Extremely convenient, and it's all done as a user-level
7369 extension (no IPython code was touched). Now instead of:
7384 extension (no IPython code was touched). Now instead of:
7370 a = PhysicalQuantity(4.2,'m/s**2')
7385 a = PhysicalQuantity(4.2,'m/s**2')
7371 one can simply say
7386 one can simply say
7372 a = 4.2 m/s**2
7387 a = 4.2 m/s**2
7373 or even
7388 or even
7374 a = 4.2 m/s^2
7389 a = 4.2 m/s^2
7375
7390
7376 I use this, but it's also a proof of concept: IPython really is
7391 I use this, but it's also a proof of concept: IPython really is
7377 fully user-extensible, even at the level of the parsing of the
7392 fully user-extensible, even at the level of the parsing of the
7378 command line. It's not trivial, but it's perfectly doable.
7393 command line. It's not trivial, but it's perfectly doable.
7379
7394
7380 * Added 'add_flip' method to inclusion conflict resolver. Fixes
7395 * Added 'add_flip' method to inclusion conflict resolver. Fixes
7381 the problem of modules being loaded in the inverse order in which
7396 the problem of modules being loaded in the inverse order in which
7382 they were defined in
7397 they were defined in
7383
7398
7384 * Version 0.1.8 released, 0.1.9 opened for further work.
7399 * Version 0.1.8 released, 0.1.9 opened for further work.
7385
7400
7386 * Added magics pdef, source and file. They respectively show the
7401 * Added magics pdef, source and file. They respectively show the
7387 definition line ('prototype' in C), source code and full python
7402 definition line ('prototype' in C), source code and full python
7388 file for any callable object. The object inspector oinfo uses
7403 file for any callable object. The object inspector oinfo uses
7389 these to show the same information.
7404 these to show the same information.
7390
7405
7391 * Version 0.1.7 released, 0.1.8 opened for further work.
7406 * Version 0.1.7 released, 0.1.8 opened for further work.
7392
7407
7393 * Separated all the magic functions into a class called Magic. The
7408 * Separated all the magic functions into a class called Magic. The
7394 InteractiveShell class was becoming too big for Xemacs to handle
7409 InteractiveShell class was becoming too big for Xemacs to handle
7395 (de-indenting a line would lock it up for 10 seconds while it
7410 (de-indenting a line would lock it up for 10 seconds while it
7396 backtracked on the whole class!)
7411 backtracked on the whole class!)
7397
7412
7398 FIXME: didn't work. It can be done, but right now namespaces are
7413 FIXME: didn't work. It can be done, but right now namespaces are
7399 all messed up. Do it later (reverted it for now, so at least
7414 all messed up. Do it later (reverted it for now, so at least
7400 everything works as before).
7415 everything works as before).
7401
7416
7402 * Got the object introspection system (magic_oinfo) working! I
7417 * Got the object introspection system (magic_oinfo) working! I
7403 think this is pretty much ready for release to Janko, so he can
7418 think this is pretty much ready for release to Janko, so he can
7404 test it for a while and then announce it. Pretty much 100% of what
7419 test it for a while and then announce it. Pretty much 100% of what
7405 I wanted for the 'phase 1' release is ready. Happy, tired.
7420 I wanted for the 'phase 1' release is ready. Happy, tired.
7406
7421
7407 2001-11-12 Fernando Perez <fperez@colorado.edu>
7422 2001-11-12 Fernando Perez <fperez@colorado.edu>
7408
7423
7409 * Version 0.1.6 released, 0.1.7 opened for further work.
7424 * Version 0.1.6 released, 0.1.7 opened for further work.
7410
7425
7411 * Fixed bug in printing: it used to test for truth before
7426 * Fixed bug in printing: it used to test for truth before
7412 printing, so 0 wouldn't print. Now checks for None.
7427 printing, so 0 wouldn't print. Now checks for None.
7413
7428
7414 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7429 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7415 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7430 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7416 reaches by hand into the outputcache. Think of a better way to do
7431 reaches by hand into the outputcache. Think of a better way to do
7417 this later.
7432 this later.
7418
7433
7419 * Various small fixes thanks to Nathan's comments.
7434 * Various small fixes thanks to Nathan's comments.
7420
7435
7421 * Changed magic_pprint to magic_Pprint. This way it doesn't
7436 * Changed magic_pprint to magic_Pprint. This way it doesn't
7422 collide with pprint() and the name is consistent with the command
7437 collide with pprint() and the name is consistent with the command
7423 line option.
7438 line option.
7424
7439
7425 * Changed prompt counter behavior to be fully like
7440 * Changed prompt counter behavior to be fully like
7426 Mathematica's. That is, even input that doesn't return a result
7441 Mathematica's. That is, even input that doesn't return a result
7427 raises the prompt counter. The old behavior was kind of confusing
7442 raises the prompt counter. The old behavior was kind of confusing
7428 (getting the same prompt number several times if the operation
7443 (getting the same prompt number several times if the operation
7429 didn't return a result).
7444 didn't return a result).
7430
7445
7431 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7446 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7432
7447
7433 * Fixed -Classic mode (wasn't working anymore).
7448 * Fixed -Classic mode (wasn't working anymore).
7434
7449
7435 * Added colored prompts using Nathan's new code. Colors are
7450 * Added colored prompts using Nathan's new code. Colors are
7436 currently hardwired, they can be user-configurable. For
7451 currently hardwired, they can be user-configurable. For
7437 developers, they can be chosen in file ipythonlib.py, at the
7452 developers, they can be chosen in file ipythonlib.py, at the
7438 beginning of the CachedOutput class def.
7453 beginning of the CachedOutput class def.
7439
7454
7440 2001-11-11 Fernando Perez <fperez@colorado.edu>
7455 2001-11-11 Fernando Perez <fperez@colorado.edu>
7441
7456
7442 * Version 0.1.5 released, 0.1.6 opened for further work.
7457 * Version 0.1.5 released, 0.1.6 opened for further work.
7443
7458
7444 * Changed magic_env to *return* the environment as a dict (not to
7459 * Changed magic_env to *return* the environment as a dict (not to
7445 print it). This way it prints, but it can also be processed.
7460 print it). This way it prints, but it can also be processed.
7446
7461
7447 * Added Verbose exception reporting to interactive
7462 * Added Verbose exception reporting to interactive
7448 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7463 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7449 traceback. Had to make some changes to the ultraTB file. This is
7464 traceback. Had to make some changes to the ultraTB file. This is
7450 probably the last 'big' thing in my mental todo list. This ties
7465 probably the last 'big' thing in my mental todo list. This ties
7451 in with the next entry:
7466 in with the next entry:
7452
7467
7453 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7468 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7454 has to specify is Plain, Color or Verbose for all exception
7469 has to specify is Plain, Color or Verbose for all exception
7455 handling.
7470 handling.
7456
7471
7457 * Removed ShellServices option. All this can really be done via
7472 * Removed ShellServices option. All this can really be done via
7458 the magic system. It's easier to extend, cleaner and has automatic
7473 the magic system. It's easier to extend, cleaner and has automatic
7459 namespace protection and documentation.
7474 namespace protection and documentation.
7460
7475
7461 2001-11-09 Fernando Perez <fperez@colorado.edu>
7476 2001-11-09 Fernando Perez <fperez@colorado.edu>
7462
7477
7463 * Fixed bug in output cache flushing (missing parameter to
7478 * Fixed bug in output cache flushing (missing parameter to
7464 __init__). Other small bugs fixed (found using pychecker).
7479 __init__). Other small bugs fixed (found using pychecker).
7465
7480
7466 * Version 0.1.4 opened for bugfixing.
7481 * Version 0.1.4 opened for bugfixing.
7467
7482
7468 2001-11-07 Fernando Perez <fperez@colorado.edu>
7483 2001-11-07 Fernando Perez <fperez@colorado.edu>
7469
7484
7470 * Version 0.1.3 released, mainly because of the raw_input bug.
7485 * Version 0.1.3 released, mainly because of the raw_input bug.
7471
7486
7472 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7487 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7473 and when testing for whether things were callable, a call could
7488 and when testing for whether things were callable, a call could
7474 actually be made to certain functions. They would get called again
7489 actually be made to certain functions. They would get called again
7475 once 'really' executed, with a resulting double call. A disaster
7490 once 'really' executed, with a resulting double call. A disaster
7476 in many cases (list.reverse() would never work!).
7491 in many cases (list.reverse() would never work!).
7477
7492
7478 * Removed prefilter() function, moved its code to raw_input (which
7493 * Removed prefilter() function, moved its code to raw_input (which
7479 after all was just a near-empty caller for prefilter). This saves
7494 after all was just a near-empty caller for prefilter). This saves
7480 a function call on every prompt, and simplifies the class a tiny bit.
7495 a function call on every prompt, and simplifies the class a tiny bit.
7481
7496
7482 * Fix _ip to __ip name in magic example file.
7497 * Fix _ip to __ip name in magic example file.
7483
7498
7484 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7499 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7485 work with non-gnu versions of tar.
7500 work with non-gnu versions of tar.
7486
7501
7487 2001-11-06 Fernando Perez <fperez@colorado.edu>
7502 2001-11-06 Fernando Perez <fperez@colorado.edu>
7488
7503
7489 * Version 0.1.2. Just to keep track of the recent changes.
7504 * Version 0.1.2. Just to keep track of the recent changes.
7490
7505
7491 * Fixed nasty bug in output prompt routine. It used to check 'if
7506 * Fixed nasty bug in output prompt routine. It used to check 'if
7492 arg != None...'. Problem is, this fails if arg implements a
7507 arg != None...'. Problem is, this fails if arg implements a
7493 special comparison (__cmp__) which disallows comparing to
7508 special comparison (__cmp__) which disallows comparing to
7494 None. Found it when trying to use the PhysicalQuantity module from
7509 None. Found it when trying to use the PhysicalQuantity module from
7495 ScientificPython.
7510 ScientificPython.
7496
7511
7497 2001-11-05 Fernando Perez <fperez@colorado.edu>
7512 2001-11-05 Fernando Perez <fperez@colorado.edu>
7498
7513
7499 * Also added dirs. Now the pushd/popd/dirs family functions
7514 * Also added dirs. Now the pushd/popd/dirs family functions
7500 basically like the shell, with the added convenience of going home
7515 basically like the shell, with the added convenience of going home
7501 when called with no args.
7516 when called with no args.
7502
7517
7503 * pushd/popd slightly modified to mimic shell behavior more
7518 * pushd/popd slightly modified to mimic shell behavior more
7504 closely.
7519 closely.
7505
7520
7506 * Added env,pushd,popd from ShellServices as magic functions. I
7521 * Added env,pushd,popd from ShellServices as magic functions. I
7507 think the cleanest will be to port all desired functions from
7522 think the cleanest will be to port all desired functions from
7508 ShellServices as magics and remove ShellServices altogether. This
7523 ShellServices as magics and remove ShellServices altogether. This
7509 will provide a single, clean way of adding functionality
7524 will provide a single, clean way of adding functionality
7510 (shell-type or otherwise) to IP.
7525 (shell-type or otherwise) to IP.
7511
7526
7512 2001-11-04 Fernando Perez <fperez@colorado.edu>
7527 2001-11-04 Fernando Perez <fperez@colorado.edu>
7513
7528
7514 * Added .ipython/ directory to sys.path. This way users can keep
7529 * Added .ipython/ directory to sys.path. This way users can keep
7515 customizations there and access them via import.
7530 customizations there and access them via import.
7516
7531
7517 2001-11-03 Fernando Perez <fperez@colorado.edu>
7532 2001-11-03 Fernando Perez <fperez@colorado.edu>
7518
7533
7519 * Opened version 0.1.1 for new changes.
7534 * Opened version 0.1.1 for new changes.
7520
7535
7521 * Changed version number to 0.1.0: first 'public' release, sent to
7536 * Changed version number to 0.1.0: first 'public' release, sent to
7522 Nathan and Janko.
7537 Nathan and Janko.
7523
7538
7524 * Lots of small fixes and tweaks.
7539 * Lots of small fixes and tweaks.
7525
7540
7526 * Minor changes to whos format. Now strings are shown, snipped if
7541 * Minor changes to whos format. Now strings are shown, snipped if
7527 too long.
7542 too long.
7528
7543
7529 * Changed ShellServices to work on __main__ so they show up in @who
7544 * Changed ShellServices to work on __main__ so they show up in @who
7530
7545
7531 * Help also works with ? at the end of a line:
7546 * Help also works with ? at the end of a line:
7532 ?sin and sin?
7547 ?sin and sin?
7533 both produce the same effect. This is nice, as often I use the
7548 both produce the same effect. This is nice, as often I use the
7534 tab-complete to find the name of a method, but I used to then have
7549 tab-complete to find the name of a method, but I used to then have
7535 to go to the beginning of the line to put a ? if I wanted more
7550 to go to the beginning of the line to put a ? if I wanted more
7536 info. Now I can just add the ? and hit return. Convenient.
7551 info. Now I can just add the ? and hit return. Convenient.
7537
7552
7538 2001-11-02 Fernando Perez <fperez@colorado.edu>
7553 2001-11-02 Fernando Perez <fperez@colorado.edu>
7539
7554
7540 * Python version check (>=2.1) added.
7555 * Python version check (>=2.1) added.
7541
7556
7542 * Added LazyPython documentation. At this point the docs are quite
7557 * Added LazyPython documentation. At this point the docs are quite
7543 a mess. A cleanup is in order.
7558 a mess. A cleanup is in order.
7544
7559
7545 * Auto-installer created. For some bizarre reason, the zipfiles
7560 * Auto-installer created. For some bizarre reason, the zipfiles
7546 module isn't working on my system. So I made a tar version
7561 module isn't working on my system. So I made a tar version
7547 (hopefully the command line options in various systems won't kill
7562 (hopefully the command line options in various systems won't kill
7548 me).
7563 me).
7549
7564
7550 * Fixes to Struct in genutils. Now all dictionary-like methods are
7565 * Fixes to Struct in genutils. Now all dictionary-like methods are
7551 protected (reasonably).
7566 protected (reasonably).
7552
7567
7553 * Added pager function to genutils and changed ? to print usage
7568 * Added pager function to genutils and changed ? to print usage
7554 note through it (it was too long).
7569 note through it (it was too long).
7555
7570
7556 * Added the LazyPython functionality. Works great! I changed the
7571 * Added the LazyPython functionality. Works great! I changed the
7557 auto-quote escape to ';', it's on home row and next to '. But
7572 auto-quote escape to ';', it's on home row and next to '. But
7558 both auto-quote and auto-paren (still /) escapes are command-line
7573 both auto-quote and auto-paren (still /) escapes are command-line
7559 parameters.
7574 parameters.
7560
7575
7561
7576
7562 2001-11-01 Fernando Perez <fperez@colorado.edu>
7577 2001-11-01 Fernando Perez <fperez@colorado.edu>
7563
7578
7564 * Version changed to 0.0.7. Fairly large change: configuration now
7579 * Version changed to 0.0.7. Fairly large change: configuration now
7565 is all stored in a directory, by default .ipython. There, all
7580 is all stored in a directory, by default .ipython. There, all
7566 config files have normal looking names (not .names)
7581 config files have normal looking names (not .names)
7567
7582
7568 * Version 0.0.6 Released first to Lucas and Archie as a test
7583 * Version 0.0.6 Released first to Lucas and Archie as a test
7569 run. Since it's the first 'semi-public' release, change version to
7584 run. Since it's the first 'semi-public' release, change version to
7570 > 0.0.6 for any changes now.
7585 > 0.0.6 for any changes now.
7571
7586
7572 * Stuff I had put in the ipplib.py changelog:
7587 * Stuff I had put in the ipplib.py changelog:
7573
7588
7574 Changes to InteractiveShell:
7589 Changes to InteractiveShell:
7575
7590
7576 - Made the usage message a parameter.
7591 - Made the usage message a parameter.
7577
7592
7578 - Require the name of the shell variable to be given. It's a bit
7593 - Require the name of the shell variable to be given. It's a bit
7579 of a hack, but allows the name 'shell' not to be hardwired in the
7594 of a hack, but allows the name 'shell' not to be hardwired in the
7580 magic (@) handler, which is problematic b/c it requires
7595 magic (@) handler, which is problematic b/c it requires
7581 polluting the global namespace with 'shell'. This in turn is
7596 polluting the global namespace with 'shell'. This in turn is
7582 fragile: if a user redefines a variable called shell, things
7597 fragile: if a user redefines a variable called shell, things
7583 break.
7598 break.
7584
7599
7585 - magic @: all functions available through @ need to be defined
7600 - magic @: all functions available through @ need to be defined
7586 as magic_<name>, even though they can be called simply as
7601 as magic_<name>, even though they can be called simply as
7587 @<name>. This allows the special command @magic to gather
7602 @<name>. This allows the special command @magic to gather
7588 information automatically about all existing magic functions,
7603 information automatically about all existing magic functions,
7589 even if they are run-time user extensions, by parsing the shell
7604 even if they are run-time user extensions, by parsing the shell
7590 instance __dict__ looking for special magic_ names.
7605 instance __dict__ looking for special magic_ names.
7591
7606
7592 - mainloop: added *two* local namespace parameters. This allows
7607 - mainloop: added *two* local namespace parameters. This allows
7593 the class to differentiate between parameters which were there
7608 the class to differentiate between parameters which were there
7594 before and after command line initialization was processed. This
7609 before and after command line initialization was processed. This
7595 way, later @who can show things loaded at startup by the
7610 way, later @who can show things loaded at startup by the
7596 user. This trick was necessary to make session saving/reloading
7611 user. This trick was necessary to make session saving/reloading
7597 really work: ideally after saving/exiting/reloading a session,
7612 really work: ideally after saving/exiting/reloading a session,
7598 *everything* should look the same, including the output of @who. I
7613 *everything* should look the same, including the output of @who. I
7599 was only able to make this work with this double namespace
7614 was only able to make this work with this double namespace
7600 trick.
7615 trick.
7601
7616
7602 - added a header to the logfile which allows (almost) full
7617 - added a header to the logfile which allows (almost) full
7603 session restoring.
7618 session restoring.
7604
7619
7605 - prepend lines beginning with @ or !, with a and log
7620 - prepend lines beginning with @ or !, with a and log
7606 them. Why? !lines: may be useful to know what you did @lines:
7621 them. Why? !lines: may be useful to know what you did @lines:
7607 they may affect session state. So when restoring a session, at
7622 they may affect session state. So when restoring a session, at
7608 least inform the user of their presence. I couldn't quite get
7623 least inform the user of their presence. I couldn't quite get
7609 them to properly re-execute, but at least the user is warned.
7624 them to properly re-execute, but at least the user is warned.
7610
7625
7611 * Started ChangeLog.
7626 * Started ChangeLog.
@@ -1,165 +1,186 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 """Setup script for IPython.
3 """Setup script for IPython.
4
4
5 Under Posix environments it works like a typical setup.py script.
5 Under Posix environments it works like a typical setup.py script.
6 Under Windows, the command sdist is not supported, since IPython
6 Under Windows, the command sdist is not supported, since IPython
7 requires utilities, which are not available under Windows."""
7 requires utilities which are not available under Windows."""
8
8
9 #*****************************************************************************
9 #*****************************************************************************
10 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
10 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
14 #*****************************************************************************
14 #*****************************************************************************
15
15
16 # Stdlib imports
16 # Stdlib imports
17 import os
17 import os
18 import sys
18 import sys
19
19
20 from glob import glob
20 from glob import glob
21
22 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
23 # update it when the contents of directories change.
24 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
25
26 from distutils.core import setup
21 from setupext import install_data_ext
27 from setupext import install_data_ext
22
28
29 # Local imports
30 from IPython.genutils import target_update
31
23 # A few handy globals
32 # A few handy globals
24 isfile = os.path.isfile
33 isfile = os.path.isfile
25 pjoin = os.path.join
34 pjoin = os.path.join
26
35
27 # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
36 ##############################################################################
28 # update it when the contents of directories change.
37 # Utility functions
29 if os.path.exists('MANIFEST'): os.remove('MANIFEST')
38 def oscmd(s):
39 print ">", s
40 os.system(s)
41
42 # A little utility we'll need below, since glob() does NOT allow you to do
43 # exclusion on multiple endings!
44 def file_doesnt_endwith(test,endings):
45 """Return true if test is a file and its name does NOT end with any
46 of the strings listed in endings."""
47 if not isfile(test):
48 return False
49 for e in endings:
50 if test.endswith(e):
51 return False
52 return True
53
54 ###############################################################################
55 # Main code begins
30
56
31 if os.name == 'posix':
57 if os.name == 'posix':
32 os_name = 'posix'
58 os_name = 'posix'
33 elif os.name in ['nt','dos']:
59 elif os.name in ['nt','dos']:
34 os_name = 'windows'
60 os_name = 'windows'
35 else:
61 else:
36 print 'Unsupported operating system:',os.name
62 print 'Unsupported operating system:',os.name
37 sys.exit(1)
63 sys.exit(1)
38
64
39 # Under Windows, 'sdist' is not supported, since it requires lyxport (and
65 # Under Windows, 'sdist' has not been supported. Now that the docs build with
40 # hence lyx,perl,latex,pdflatex,latex2html,sh,...)
66 # Sphinx it might work, but let's not turn it on until someone confirms that it
67 # actually works.
41 if os_name == 'windows' and 'sdist' in sys.argv:
68 if os_name == 'windows' and 'sdist' in sys.argv:
42 print 'The sdist command is not available under Windows. Exiting.'
69 print 'The sdist command is not available under Windows. Exiting.'
43 sys.exit(1)
70 sys.exit(1)
44
71
45 from distutils.core import setup
46
47 # update the manuals when building a source dist
72 # update the manuals when building a source dist
48 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
73 if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'):
49 import textwrap
74 import textwrap
50 from IPython.genutils import target_update
75
51 # list of things to be updated. Each entry is a triplet of args for
76 # List of things to be updated. Each entry is a triplet of args for
52 # target_update()
77 # target_update()
53
78 to_update = [ # The do_sphinx scripts builds html and pdf, so just one
54 def oscmd(s):
79 # target is enough to cover all manual generation
55 print ">", s
80 ('doc/manual/ipython.pdf',
56 os.system(s)
81 ['IPython/Release.py','doc/source/ipython.rst'],
57
82 "cd doc && python do_sphinx.py" ),
58 oscmd("cd doc && python do_sphinx.py")
83
59
84 # FIXME - Disabled for now: we need to redo an automatic way
60 oscmd("cd doc && gzip -9c ipython.1 > ipython.1.gz")
85 # of generating the magic info inside the rst.
61 oscmd("cd doc && gzip -9c pycolor.1 > pycolor.1.gz")
86 #('doc/magic.tex',
87 #['IPython/Magic.py'],
88 #"cd doc && ./update_magic.sh" ),
89
90 ('doc/ipython.1.gz',
91 ['doc/ipython.1'],
92 "cd doc && gzip -9c ipython.1 > ipython.1.gz"),
93
94 ('doc/pycolor.1.gz',
95 ['doc/pycolor.1'],
96 "cd doc && gzip -9c pycolor.1 > pycolor.1.gz"),
97 ]
98
99 [ target_update(*t) for t in to_update ]
62
100
63 # Release.py contains version, authors, license, url, keywords, etc.
101 # Release.py contains version, authors, license, url, keywords, etc.
64 execfile(pjoin('IPython','Release.py'))
102 execfile(pjoin('IPython','Release.py'))
65
103
66 # A little utility we'll need below, since glob() does NOT allow you to do
67 # exclusion on multiple endings!
68 def file_doesnt_endwith(test,endings):
69 """Return true if test is a file and its name does NOT end with any
70 of the strings listed in endings."""
71 if not isfile(test):
72 return False
73 for e in endings:
74 if test.endswith(e):
75 return False
76 return True
77
78 # I can't find how to make distutils create a nested dir. structure, so
104 # I can't find how to make distutils create a nested dir. structure, so
79 # in the meantime do it manually. Butt ugly.
105 # in the meantime do it manually. Butt ugly.
80 # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
106 # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain
81 # information on how to do this more cleanly once python 2.4 can be assumed.
107 # information on how to do this more cleanly once python 2.4 can be assumed.
82 # Thanks to Noel for the tip.
108 # Thanks to Noel for the tip.
83 docdirbase = 'share/doc/ipython'
109 docdirbase = 'share/doc/ipython'
84 manpagebase = 'share/man/man1'
110 manpagebase = 'share/man/man1'
85
111
86 # We only need to exclude from this things NOT already excluded in the
112 # We only need to exclude from this things NOT already excluded in the
87 # MANIFEST.in file.
113 # MANIFEST.in file.
88 exclude = ('.sh','.1.gz')
114 exclude = ('.sh','.1.gz')
89 docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*'))
115 docfiles = filter(lambda f:file_doesnt_endwith(f,exclude),glob('doc/*'))
90
91 examfiles = filter(isfile, glob('doc/examples/*.py'))
116 examfiles = filter(isfile, glob('doc/examples/*.py'))
92 manfiles = filter(isfile, glob('doc/build/html/*'))
117 manfiles = filter(isfile, glob('doc/manual/*'))
93 manstatic = filter(isfile, glob('doc/build/html/_static/*'))
118 manstatic = filter(isfile, glob('doc/manual/_static/*'))
94
95 # filter(isfile, glob('doc/manual/*.css')) + \
96 # filter(isfile, glob('doc/manual/*.png'))
97
98 manpages = filter(isfile, glob('doc/*.1.gz'))
119 manpages = filter(isfile, glob('doc/*.1.gz'))
120
99 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
121 cfgfiles = filter(isfile, glob('IPython/UserConfig/*'))
100 scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor',
122 scriptfiles = filter(isfile, ['scripts/ipython','scripts/pycolor',
101 'scripts/irunner'])
123 'scripts/irunner'])
124
102 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
125 igridhelpfiles = filter(isfile, glob('IPython/Extensions/igrid_help.*'))
103
126
104 # Script to be run by the windows binary installer after the default setup
127 # Script to be run by the windows binary installer after the default setup
105 # routine, to add shortcuts and similar windows-only things. Windows
128 # routine, to add shortcuts and similar windows-only things. Windows
106 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
129 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
107 # doesn't find them.
130 # doesn't find them.
108 if 'bdist_wininst' in sys.argv:
131 if 'bdist_wininst' in sys.argv:
109 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
132 if len(sys.argv) > 2 and ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
110 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
133 print >> sys.stderr,"ERROR: bdist_wininst must be run alone. Exiting."
111 sys.exit(1)
134 sys.exit(1)
112 scriptfiles.append('scripts/ipython_win_post_install.py')
135 scriptfiles.append('scripts/ipython_win_post_install.py')
113
136
114 datafiles = [('data', docdirbase, docfiles),
137 datafiles = [('data', docdirbase, docfiles),
115 ('data', pjoin(docdirbase, 'examples'),examfiles),
138 ('data', pjoin(docdirbase, 'examples'),examfiles),
116 ('data', pjoin(docdirbase, 'manual'),manfiles),
139 ('data', pjoin(docdirbase, 'manual'),manfiles),
117 ('data', pjoin(docdirbase, 'manual/_static'),manstatic),
140 ('data', pjoin(docdirbase, 'manual/_static'),manstatic),
118 ('data', manpagebase, manpages),
141 ('data', manpagebase, manpages),
119 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
142 ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles),
120 ]
143 ]
121
144
122 if 'setuptools' in sys.modules:
145 if 'setuptools' in sys.modules:
123 # setuptools config for egg building
146 # setuptools config for egg building
124 egg_extra_kwds = {
147 egg_extra_kwds = {
125 'entry_points': {
148 'entry_points': {
126 'console_scripts': [
149 'console_scripts': [
127 'ipython = IPython.ipapi:launch_new_instance',
150 'ipython = IPython.ipapi:launch_new_instance',
128 'pycolor = IPython.PyColorize:main'
151 'pycolor = IPython.PyColorize:main'
129 ]}
152 ]}
130 }
153 }
131 scriptfiles = []
154 scriptfiles = []
132 # eggs will lack docs, eaxmples
155 # eggs will lack docs, examples
133 datafiles = []
156 datafiles = []
134
135 #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)]
136 else:
157 else:
158 # Normal, non-setuptools install
137 egg_extra_kwds = {}
159 egg_extra_kwds = {}
138 # package_data of setuptools was introduced to distutils in 2.4
160 # package_data of setuptools was introduced to distutils in 2.4
139 if sys.version_info < (2,4):
161 if sys.version_info < (2,4):
140 datafiles.append(('lib', 'IPython/UserConfig', cfgfiles))
162 datafiles.append(('lib', 'IPython/UserConfig', cfgfiles))
141
163
142
143
144
145 # Call the setup() routine which does most of the work
164 # Call the setup() routine which does most of the work
146 setup(name = name,
165 setup(name = name,
147 version = version,
166 version = version,
148 description = description,
167 description = description,
149 long_description = long_description,
168 long_description = long_description,
150 author = authors['Fernando'][0],
169 author = authors['Fernando'][0],
151 author_email = authors['Fernando'][1],
170 author_email = authors['Fernando'][1],
152 url = url,
171 url = url,
153 download_url = download_url,
172 download_url = download_url,
154 license = license,
173 license = license,
155 platforms = platforms,
174 platforms = platforms,
156 keywords = keywords,
175 keywords = keywords,
157 packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx', 'IPython.UserConfig'],
176 packages = ['IPython', 'IPython.Extensions', 'IPython.external',
177 'IPython.gui', 'IPython.gui.wx',
178 'IPython.UserConfig'],
158 scripts = scriptfiles,
179 scripts = scriptfiles,
159 package_data = {'IPython.UserConfig' : ['*'] },
180 package_data = {'IPython.UserConfig' : ['*'] },
160
181
161 cmdclass = {'install_data': install_data_ext},
182 cmdclass = {'install_data': install_data_ext},
162 data_files = datafiles,
183 data_files = datafiles,
163 # extra params needed for eggs
184 # extra params needed for eggs
164 **egg_extra_kwds
185 **egg_extra_kwds
165 )
186 )
@@ -1,28 +1,37 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 # release test
3 # release test
4
4
5 cd ~/ipython/ipython
5 ipdir=~/ipython/ipython
6 ipbackupdir=~/ipython/backup
6
7
7 # clean up build/dist directories
8 cd $ipdir
8 rm -rf build/*
9
9 rm -rf dist/*
10 # Clean up build/dist directories
11 rm -rf $ipdir/build/*
12 rm -rf $ipdir/dist/*
13
14 # Perform local backup
15 cd $ipdir/tools
16 ./make_tarball.py
17 mv ipython-*.tgz $ipbackupdir
10
18
11 # build source distros
19 # build source distros
20 cd $ipdir
12 ./setup.py sdist --formats=gztar
21 ./setup.py sdist --formats=gztar
13
22
14 # Build rpms
23 # Build rpms
15 python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4
24 python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4
16 python2.5 ./setup.py bdist_rpm --binary-only --release=py25 --python=/usr/bin/python2.5
25 python2.5 ./setup.py bdist_rpm --binary-only --release=py25 --python=/usr/bin/python2.5
17
26
18 # Build eggs
27 # Build eggs
19 python2.4 ./setup_bdist_egg.py
28 python2.4 ./setup_bdist_egg.py
20 python2.5 ./setup_bdist_egg.py
29 python2.5 ./setup_bdist_egg.py
21
30
22 # Call the windows build separately, so that the extra Windows scripts don't
31 # Call the windows build separately, so that the extra Windows scripts don't
23 # get pulled into Unix builds (setup.py has code which checks for
32 # get pulled into Unix builds (setup.py has code which checks for
24 # bdist_wininst)
33 # bdist_wininst)
25 ./setup.py bdist_wininst --install-script=ipython_win_post_install.py
34 ./setup.py bdist_wininst --install-script=ipython_win_post_install.py
26
35
27 # Change name so retarded Vista runs the installer correctly
36 # Change name so retarded Vista runs the installer correctly
28 rename 's/win32/win32-setup/' dist/*.exe
37 rename 's/win32/win32-setup/' $ipdir/dist/*.exe
@@ -1,141 +1,141 b''
1 #!python
1 #!python
2 """Windows-specific part of the installation"""
2 """Windows-specific part of the installation"""
3
3
4 import os, sys
4 import os, sys
5
5
6 try:
6 try:
7 import shutil,pythoncom
7 import shutil,pythoncom
8 from win32com.shell import shell
8 from win32com.shell import shell
9 import _winreg as wreg
9 import _winreg as wreg
10 except ImportError:
10 except ImportError:
11 print """
11 print """
12 You seem to be missing the PythonWin extensions necessary for automatic
12 You seem to be missing the PythonWin extensions necessary for automatic
13 installation. You can get them (free) from
13 installation. You can get them (free) from
14 http://starship.python.net/crew/mhammond/
14 http://starship.python.net/crew/mhammond/
15
15
16 Please see the manual for details if you want to finish the installation by
16 Please see the manual for details if you want to finish the installation by
17 hand, or get PythonWin and repeat the procedure.
17 hand, or get PythonWin and repeat the procedure.
18
18
19 Press <Enter> to exit this installer."""
19 Press <Enter> to exit this installer."""
20 raw_input()
20 raw_input()
21 sys.exit()
21 sys.exit()
22
22
23
23
24 def make_shortcut(fname,target,args='',start_in='',comment='',icon=None):
24 def make_shortcut(fname,target,args='',start_in='',comment='',icon=None):
25 """Make a Windows shortcut (.lnk) file.
25 """Make a Windows shortcut (.lnk) file.
26
26
27 make_shortcut(fname,target,args='',start_in='',comment='',icon=None)
27 make_shortcut(fname,target,args='',start_in='',comment='',icon=None)
28
28
29 Arguments:
29 Arguments:
30 fname - name of the final shortcut file (include the .lnk)
30 fname - name of the final shortcut file (include the .lnk)
31 target - what the shortcut will point to
31 target - what the shortcut will point to
32 args - additional arguments to pass to the target program
32 args - additional arguments to pass to the target program
33 start_in - directory where the target command will be called
33 start_in - directory where the target command will be called
34 comment - for the popup tooltips
34 comment - for the popup tooltips
35 icon - optional icon file. This must be a tuple of the type
35 icon - optional icon file. This must be a tuple of the type
36 (icon_file,index), where index is the index of the icon you want
36 (icon_file,index), where index is the index of the icon you want
37 in the file. For single .ico files, index=0, but for icon libraries
37 in the file. For single .ico files, index=0, but for icon libraries
38 contained in a single file it can be >0.
38 contained in a single file it can be >0.
39 """
39 """
40
40
41 shortcut = pythoncom.CoCreateInstance(
41 shortcut = pythoncom.CoCreateInstance(
42 shell.CLSID_ShellLink, None,
42 shell.CLSID_ShellLink, None,
43 pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink
43 pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink
44 )
44 )
45 shortcut.SetPath(target)
45 shortcut.SetPath(target)
46 shortcut.SetArguments(args)
46 shortcut.SetArguments(args)
47 shortcut.SetWorkingDirectory(start_in)
47 shortcut.SetWorkingDirectory(start_in)
48 shortcut.SetDescription(comment)
48 shortcut.SetDescription(comment)
49 if icon:
49 if icon:
50 shortcut.SetIconLocation(*icon)
50 shortcut.SetIconLocation(*icon)
51 shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(fname,0)
51 shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(fname,0)
52
52
53
53
54 def run(wait=0):
54 def run(wait=0):
55 # Find where the Start Menu and My Documents are on the filesystem
55 # Find where the Start Menu and My Documents are on the filesystem
56 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
56 key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
57 r'Software\Microsoft\Windows\CurrentVersion'
57 r'Software\Microsoft\Windows\CurrentVersion'
58 r'\Explorer\Shell Folders')
58 r'\Explorer\Shell Folders')
59
59
60 programs_dir = wreg.QueryValueEx(key,'Programs')[0]
60 programs_dir = wreg.QueryValueEx(key,'Programs')[0]
61 my_documents_dir = wreg.QueryValueEx(key,'Personal')[0]
61 my_documents_dir = wreg.QueryValueEx(key,'Personal')[0]
62 key.Close()
62 key.Close()
63
63
64 # Find where the 'program files' directory is
64 # Find where the 'program files' directory is
65 key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE,
65 key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE,
66 r'SOFTWARE\Microsoft\Windows\CurrentVersion')
66 r'SOFTWARE\Microsoft\Windows\CurrentVersion')
67
67
68 program_files_dir = wreg.QueryValueEx(key,'ProgramFilesDir')[0]
68 program_files_dir = wreg.QueryValueEx(key,'ProgramFilesDir')[0]
69 key.Close()
69 key.Close()
70
70
71
71
72 # File and directory names
72 # File and directory names
73 ip_dir = program_files_dir + r'\IPython'
73 ip_dir = program_files_dir + r'\IPython'
74 ip_prog_dir = programs_dir + r'\IPython'
74 ip_prog_dir = programs_dir + r'\IPython'
75 doc_dir = ip_dir+r'\doc'
75 doc_dir = ip_dir+r'\doc'
76 ip_filename = ip_dir+r'\IPython_shell.py'
76 ip_filename = ip_dir+r'\IPython_shell.py'
77 pycon_icon = doc_dir+r'\pycon.ico'
77 pycon_icon = doc_dir+r'\pycon.ico'
78
78
79 if not os.path.isdir(ip_dir):
79 if not os.path.isdir(ip_dir):
80 os.mkdir(ip_dir)
80 os.mkdir(ip_dir)
81
81
82 # Copy startup script and documentation
82 # Copy startup script and documentation
83 shutil.copy(sys.prefix+r'\Scripts\ipython',ip_filename)
83 shutil.copy(sys.prefix+r'\Scripts\ipython',ip_filename)
84 if os.path.isdir(doc_dir):
84 if os.path.isdir(doc_dir):
85 shutil.rmtree(doc_dir)
85 shutil.rmtree(doc_dir)
86 shutil.copytree('doc',doc_dir)
86 shutil.copytree('doc',doc_dir)
87
87
88 # make shortcuts for IPython, html and pdf docs.
88 # make shortcuts for IPython, html and pdf docs.
89 print 'Making entries for IPython in Start Menu...',
89 print 'Making entries for IPython in Start Menu...',
90
90
91 # Create .bat file in \Scripts
91 # Create .bat file in \Scripts
92 fic = open(sys.prefix + r'\Scripts\ipython.bat','w')
92 fic = open(sys.prefix + r'\Scripts\ipython.bat','w')
93 fic.write('"' + sys.prefix + r'\python.exe' + '" -i ' + '"' +
93 fic.write('"' + sys.prefix + r'\python.exe' + '" -i ' + '"' +
94 sys.prefix + r'\Scripts\ipython" %*')
94 sys.prefix + r'\Scripts\ipython" %*')
95 fic.close()
95 fic.close()
96
96
97 # Create .bat file in \\Scripts
97 # Create .bat file in \\Scripts
98 fic = open(sys.prefix + '\\Scripts\\ipython.bat','w')
98 fic = open(sys.prefix + '\\Scripts\\ipython.bat','w')
99 fic.write('"' + sys.prefix + '\\python.exe' + '" -i ' + '"' + sys.prefix + '\\Scripts\ipython" %*')
99 fic.write('"' + sys.prefix + '\\python.exe' + '" -i ' + '"' + sys.prefix + '\\Scripts\ipython" %*')
100 fic.close()
100 fic.close()
101
101
102 # Create shortcuts in Programs\IPython:
102 # Create shortcuts in Programs\IPython:
103 if not os.path.isdir(ip_prog_dir):
103 if not os.path.isdir(ip_prog_dir):
104 os.mkdir(ip_prog_dir)
104 os.mkdir(ip_prog_dir)
105 os.chdir(ip_prog_dir)
105 os.chdir(ip_prog_dir)
106
106
107 man_pdf = doc_dir + r'\manual.pdf'
107 man_pdf = doc_dir + r'\manual\ipython.pdf'
108 man_htm = doc_dir + r'\manual\manual.html'
108 man_htm = doc_dir + r'\manual\ipython.html'
109
109
110 make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename,
110 make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename,
111 my_documents_dir,
111 my_documents_dir,
112 'IPython - Enhanced python command line interpreter',
112 'IPython - Enhanced python command line interpreter',
113 (pycon_icon,0))
113 (pycon_icon,0))
114 make_shortcut('pysh.lnk',sys.executable, '"%s" -p pysh' % ip_filename,
114 make_shortcut('pysh.lnk',sys.executable, '"%s" -p pysh' % ip_filename,
115 my_documents_dir,
115 my_documents_dir,
116 'pysh - a system shell with Python syntax (IPython based)',
116 'pysh - a system shell with Python syntax (IPython based)',
117 (pycon_icon,0))
117 (pycon_icon,0))
118 make_shortcut('Manual in HTML format.lnk',man_htm,'','',
118 make_shortcut('Manual in HTML format.lnk',man_htm,'','',
119 'IPython Manual - HTML format')
119 'IPython Manual - HTML format')
120 make_shortcut('Manual in PDF format.lnk',man_pdf,'','',
120 make_shortcut('Manual in PDF format.lnk',man_pdf,'','',
121 'IPython Manual - PDF format')
121 'IPython Manual - PDF format')
122
122
123 print """Done.
123 print """Done.
124
124
125 I created the directory %s. There you will find the
125 I created the directory %s. There you will find the
126 IPython startup script and manuals.
126 IPython startup script and manuals.
127
127
128 An IPython menu was also created in your Start Menu, with entries for
128 An IPython menu was also created in your Start Menu, with entries for
129 IPython itself and the manual in HTML and PDF formats.
129 IPython itself and the manual in HTML and PDF formats.
130
130
131 For reading PDF documents you need the freely available Adobe Acrobat
131 For reading PDF documents you need the freely available Adobe Acrobat
132 Reader. If you don't have it, you can download it from:
132 Reader. If you don't have it, you can download it from:
133 http://www.adobe.com/products/acrobat/readstep2.html
133 http://www.adobe.com/products/acrobat/readstep2.html
134 """ % ip_dir
134 """ % ip_dir
135
135
136 if wait:
136 if wait:
137 print "Finished with IPython installation. Press Enter to exit this installer.",
137 print "Finished with IPython installation. Press Enter to exit this installer.",
138 raw_input()
138 raw_input()
139
139
140 if __name__ == '__main__':
140 if __name__ == '__main__':
141 run()
141 run()
@@ -1,72 +0,0 b''
1 #!/usr/bin/env python
2 """Backup directories using rsync. Quick and dirty.
3
4 backup.py config_file final_actions
5 """
6
7 #----------------------------------------------------------------------------
8 # configure in this section
9
10 # all dirs relative to current dir.
11
12 # output directory for backups
13 outdir = ''
14
15 # list directories to backup as a dict with 1 or 0 values for
16 # recursive (or not) descent:
17 to_backup = {}
18
19 # list exclude patterns here (space-separated):
20 # if the pattern ends with a / then it will only match a directory, not a
21 # file, link or device.
22 # see man rsync for more details on the exclude patterns
23 exc_pats = '#*# *~ *.pyc *.pyo *.o '
24
25 # global options for rsync
26 rsync_opts='-v -t -a --delete --delete-excluded'
27
28 #----------------------------------------------------------------------------
29 # real code begins
30 import os,string,re,sys
31 from IPython.genutils import *
32 from IPython.Itpl import itpl
33
34 # config file can redefine final actions
35 def final():
36 pass
37
38 # load config from cmd line config file or default bkprc.py
39 try:
40 execfile(sys.argv[1])
41 except:
42 try:
43 execfile('bkprc.py')
44 except IOError:
45 print 'You need to provide a config file: bkp.py rcfile'
46 sys.exit()
47
48 # make output dir if needed
49 outdir = os.path.expanduser(outdir)
50 try:
51 os.makedirs(outdir)
52 except OSError: # raised if dir already exists -> no need to make it
53 pass
54
55 # build rsync command and call:
56 exclude = re.sub(r'([^\s].*?)(\s|$)',r'--exclude "\1"\2',exc_pats)
57 rsync = itpl('rsync $rsync_opts $exclude')
58
59 # the same can also be done with lists (keep it for reference):
60 #exclude = string.join(['--exclude "'+p+'"' for p in qw(exc_pats)])
61
62 # rsync takes -r as a flag, not 0/1 so translate:
63 rec_flag = {0:'',1:'-r'}
64
65 # loop over user specified directories calling rsync
66 for bakdir,rec in to_backup.items():
67 bakdir = os.path.expanduser(bakdir)
68 xsys(itpl('$rsync $rec_flag[rec] $bakdir $outdir'),
69 debug=0,verbose=1,header='\n### ')
70
71 # final actions?
72 final()
@@ -1,22 +0,0 b''
1 #!/bin/sh
2
3 # Simple backup script for ipython, to keep around a static copy of the whole
4 # project at the current version point. We do this by exporting from SVN.
5
6 # Config here
7 IPYTHONSVN=$HOME/ipython/svn/ipython/trunk
8 BACKUPDIR=$HOME/ipython/backup
9
10 ####
11 # Code begins
12 IPVERSION=`ipython -Version`
13 IPX=ipython-$IPVERSION
14 ARCHIVE=$BACKUPDIR/$IPX.tgz
15
16 svn export $IPYTHONSVN $IPX
17
18 tar czf $ARCHIVE $IPX
19
20 rm -rf $IPX
21
22 echo "Backup left in: $ARCHIVE"
@@ -1,22 +0,0 b''
1 # config file for a quick'n dirty backup script that uses rsync
2
3 # output directory for backups
4 outdir = '~/tmp'
5
6 # list directories to backup as a dict with 1 or 0 values for
7 # recursive (or not) descent:
8 to_backup = {'~/ipython/ipython':1}
9
10 # exclude patterns. anything ending in / is considered a directory
11 exc_pats = '#*# *~ *.o *.pyc *.pyo MANIFEST *.pdf *.flc build/ dist/ ' \
12 ' doc/manual/ doc/manual.lyx ChangeLog.* magic.tex *.1.gz '
13
14 # final actions after doing the backup
15 def final():
16 dbg = 0
17 version = bq('ipython -V')
18 out_tgz = outdir+'/ipython-'+version+'.tgz'
19 xsys(itpl('cd $outdir; pwd;tar -czf $out_tgz ipython'),debug=dbg,verbose=1)
20 #xsys(itpl('cp $out_tgz /mnt/card/fperez/ipython'),debug=dbg,verbose=1)
21 xsys(itpl('mv $out_tgz ~/ipython/backup'),debug=dbg,verbose=1)
22 xsys(itpl('rm -rf ${outdir}/ipython'),debug=dbg,verbose=1)
@@ -1,78 +0,0 b''
1 #!/usr/bin/env python
2 """Simple svn commit wrapper which emails a given list of people.
3
4 Usage:
5
6 ipsvnc [args]
7
8 This is equivalent to doing
9
10 svn commit [args]
11
12 If the commit operation is successful (the script asks for confirmation), a
13 hardwired list of maintainers is informed of the commit.
14
15 This is a poor-man's substitute for a proper svn post-commit hook with an
16 ipython-svn email list, which we're waiting to get soon. It should be removed
17 once that facility is in place.
18
19 This only works on a unix box which can send mail by itself."""
20
21 import os
22 import commands
23 import sys
24 import time
25
26 # Package maintainers to be alerted
27 maintainers = ['fperez@colorado.edu', 'rkern@ucsd.edu', 'antont@an.org',
28 'tsanko@gmail.com']
29
30 #maintainers = ['fperez@colorado.edu'] # dbg
31
32 # Assemble command line back, before passing it to svn
33 svnargs = []
34 for arg in sys.argv[1:]:
35 if ' ' in arg:
36 svnargs.append('"%s"' % arg)
37 else:
38 svnargs.append(arg)
39 svnargs = ' '.join(svnargs)
40
41 #print 'SVN args: <%s>' % svnargs; sys.exit() # dbg
42
43 # perform commit
44 print 'Performing SVN commit, this may take some time...'
45 os.system('svn commit %s' % svnargs)
46 svntime = time.asctime()
47 print 'Getting SVN log and version info...'
48 svnstatus = commands.getoutput('svn log -r HEAD')
49 svnversion = commands.getoutput('svnversion .').split(':')[-1]
50
51 # Confirm with user (trying to get the status from the svn commit blocks
52 # silently, I don't care to debug it)
53 ans = raw_input('If commit was succesful, proceed '
54 'with email notification? [Y/n] ')
55 if ans.lower().startswith('n'):
56 print "Exiting now..."
57 sys.exit(1)
58 else:
59 print "OK. Emailing maintainers..."
60
61 # Send emails
62 subject = "[IPython SVN] New commit performed by %s" % os.getlogin()
63 body = """\
64 Commit performed at: %s
65
66 SVN arguments used: %s
67
68 SVN Version: %s
69
70 This version probably points to this changeset:
71 http://projects.scipy.org/ipython/ipython/changeset/%s
72
73 Current SVN status after last commit:
74 %s""" % (svntime,svnargs,svnversion,svnversion,svnstatus)
75
76 for maint in maintainers:
77 print "Emailing",maint
78 os.system('echo "%s" | mail -s "%s" %s' % (body, subject,maint))
This diff has been collapsed as it changes many lines, (1049 lines changed) Show them Hide them
@@ -1,1049 +0,0 b''
1 #!/usr/bin/env perl
2 #
3 #*****************************************************************************
4 #
5 # lyxport - script for exporting lyx docs to HTML, PostScript and PDF
6 #
7 # Inspired on the lyx2html script by Steffen Evers (tron@cs.tu-berlin.de)
8 # (many thanks to him).
9 #
10 # Copyright (C) 2001 Fernando Pérez (Fernando.Perez@colorado.edu)
11 #
12 #*****************************************************************************
13 #
14 # This program is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # If you do not have a copy of the GNU General Public License, write
25 # to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
26 # MA 02139, USA.
27 #
28 # If the author of this software was too lazy to include the full GPL
29 # text along with the code, you can find it at:
30 #
31 # http://www.gnu.org/copyleft/gpl.html
32 #
33 #*****************************************************************************
34
35 =pod
36
37 =head1 NAME
38
39 B<lyxport> - Export a LyX or LaTeX file to HTML, PostScript and PDF.
40
41 =head1 SYNOPSIS
42
43 B<lyxport> [options] F<file>
44
45 Perl script which takes a LyX or LaTeX file as its only argument and produces
46 HTML, PostScript and PDF versions of the document. The name is short for "lyx
47 export".
48
49 You can call B<lyxport> with a filename with or without extension: F<file>,
50 F<file.lyx> and F<file.tex> will all work. B<lyxport> will update the LaTeX
51 file if there is a corresponding LyX file with a newer timestamp.
52
53 Use B<lyxport --help> for more information, and B<lyxport --man> for a full
54 man page.
55
56 =cut
57
58 #*****************************************************************************
59 # modify here the command names to suit your local conditions
60 my %cmd= (
61 lyx => "/usr/bin/lyx",
62 latex => "latex",
63 latex2html => "latex2html",
64 dvips => "dvips",
65 pdflatex => "pdflatex",
66 epstopdf => "epstopdf"
67 );
68
69 #************ DO NOT CHANGE ANYTHING BELOW THIS ULESS YOU *REALLY* KNOW
70 #************ WHAT YOU ARE DOING.
71
72 #*****************************************************************************
73 # modules and globals
74 use strict;
75 use File::Copy;
76 use File::Basename;
77 my (%opt); # command line options
78 my $version = "0.3.2"; # keep this up to date with the docs (at end)!
79
80 #*****************************************************************************
81 # "main" (simple minded way to keep variable scoping under control)
82 main();
83
84 sub main {
85 my ($runs, # number of latex runs
86 $file_in, # input filename as given at cmd line
87 $file_base, # base (no extension) name of file to work on
88 $lyx_time, # timestamps of lyx/tex files
89 $tex_time,
90 $l2h_file, # tex file cleaned up for latex2html
91 $targets_built,
92 $targets_failed,
93 $status, # status string for diagnostics printing
94 @latex_from_lyx # LaTeX files was created from LyX file
95 );
96
97 #------------------------------------------------------------------------
98 # code begins
99
100 cmdline_process(\%opt,\$file_in);
101
102 # set defaults and filenames needed throughout
103 $runs=$opt{runs};
104 set_cmd_defaults(\%cmd);
105 $file_base=check_file_exists($file_in);
106 # various filenames (with extensions)
107 my @exts=qw(lyx tex aux dvi log ps pdf out toc);
108 my ($lyx,$tex,$aux,$dvi,$log,$ps,$pdf,$out,$toc) = map { "$file_base.$_" } @exts;
109
110 # first, if tex file is older than lyx file, update
111 @latex_from_lyx=update_tex($lyx,$tex);
112
113 if ($opt{clean}) {
114 lyxport_info("Cleanup of old auxiliary files requested");
115 safe_system("rm -rf $file_base");
116 unlink ($aux,$log,$out,$toc);
117 }
118
119 # run latex for both html (needs .aux file) and ps (needs .dvi)
120 if ($opt{html} or $opt{ps}) {
121 run_latex("$cmd{latex} -interaction=nonstopmode",$tex,\$runs);
122 }
123 # now make targets
124 if ($opt{html}) {
125 make_html($tex,$file_base,$opt{opts_l2h},\$status,
126 \$targets_built,\$targets_failed);
127 }
128 if ($opt{ps}) {
129 make_ps($dvi,$ps,$file_base,\$status,\$targets_built,\$targets_failed);
130 }
131 if ($opt{pdf}) {
132 make_pdf($tex,$pdf,\$runs,$file_base,
133 \$status,\$targets_built,\$targets_failed);
134 }
135
136 #cleanup before exiting and print some diagnostics info
137 unless ($opt{debug}) {
138 unlink ($dvi,$log,$out);
139 }
140 # extra cleanup
141 if ($opt{tidy}) {
142 print "tidy up $opt{tidy},$aux,$log,$out,$toc,@latex_from_lyx\n";
143 tidy_up($opt{tidy},$aux,$log,$out,$toc,@latex_from_lyx);
144 }
145 final_diagnostics($file_in,$status,$targets_built,$targets_failed);
146 exit(0);
147 } # end of main()
148
149 #*****************************************************************************
150 # subroutines
151
152 #-----------------------------------------------------------------------------
153 sub make_html {
154 my($tex,$html_dir,$opts_l2h,$stat_ref,$built_ref,$failed_ref)=@_;
155 my($success);
156
157 lyxport_info("Making HTML");
158 run_latex2html($tex,$opts_l2h);
159 $success=check_targets("${html_dir}/${html_dir}.html",'HTML',
160 $built_ref,$failed_ref);
161 if ($success) {$$stat_ref .= "Target HTML built in directory $html_dir\n" }
162 } # end of make_html()
163
164 #-----------------------------------------------------------------------------
165 sub make_ps {
166 my($dvi,$ps,$html_dir,$stat_ref,$built_ref,$failed_ref)=@_;
167 my($success);
168
169 lyxport_info("Making PostScript");
170 safe_system("$cmd{dvips} $dvi -o $ps");
171 $success=check_targets($ps,'PostScript',$built_ref,$failed_ref);
172 if ($success and not $opt{leave}) {
173 move2html_dir('PostScript',$ps,$html_dir,$stat_ref,$built_ref);
174 }
175 } # end of make_ps()
176
177 #-----------------------------------------------------------------------------
178 sub make_pdf {
179 my($tex,$pdf,$runs_ref,$html_dir,$stat_ref,$built_ref,$failed_ref)=@_;
180 my($success);
181
182 lyxport_info("Making PDF");
183 run_pdflatex($tex,$pdf,$runs_ref);
184 $success=check_targets($pdf,'PDF',$built_ref,$failed_ref);
185 if ($success and not $opt{leave}) {
186 move2html_dir('PDF',$pdf,$html_dir,$stat_ref,$built_ref);
187 }
188 } # end of make_pdf()
189
190 #-----------------------------------------------------------------------------
191 # move a given target to the html dir, only if it exists. leaves diagnostics
192 # info in a status string
193 sub move2html_dir {
194 my($name,$file,$dir,$stat_ref,$html_status_ref)=@_;
195
196 if ($$html_status_ref =~ /HTML/) {
197 safe_system("mv $file $dir");
198 $$stat_ref .= "Target $name moved to directory $dir\n";
199 } else {
200 $$stat_ref .= "Target $name left in current directory\n";
201 }
202 } # end of move2html_dir()
203
204 #-----------------------------------------------------------------------------
205 # make sure that the tex file is up to date vs the lyx original before starting
206 # returns a list of the included .tex files which were generated (besides the main one)
207 sub update_tex {
208 my($lyx,$tex)=@_;
209 my($lyx_time,$tex_time);
210 my(@lyx_out,@made_tex,$lc);
211
212 @made_tex=();
213 unless (-e $lyx) {
214 print "LyX file not found. Working off the LaTeX file alone.\n\n";
215 return;
216 }
217 $lyx_time=(stat($lyx))[9];
218 $tex_time=(stat($tex))[9];
219 if ($lyx_time>$tex_time or not(-e $tex)) {
220 lyxport_info("LaTeX file outdated or not existent, regenerating it...");
221 unlink $tex;
222 @lyx_out=`$cmd{lyx} -dbg latex --export latex $lyx 2>&1 `;
223 # try again without -dbg option: LyX has a bug here! Note that this will
224 # disable the ability to remove extra .tex files generated from \include
225 # statements. But at least it will work, until they fix the bug in LyX.
226 unless (-e $tex) {
227 @lyx_out=`$cmd{lyx} --export latex $lyx 2>&1 `;
228 }
229 # end of ugly workaround
230 unless (-e $tex) {die "Aborting: couldn't create LaTeX file with LyX.\n\n"};
231 push (@made_tex,$tex);
232 # find whether lyx made auxiliary (included) .tex files and report
233 foreach $lc (0..$#lyx_out-1) {
234 $_=$lyx_out[$lc];
235 if (/^incfile:.*\.lyx/) {
236 $lyx_out[$lc+1] =~ /^writefile:(.*)$/;
237 push (@made_tex,basename($1));
238 }
239 }
240 if (@made_tex) {
241 lyxport_info("Made LaTeX included files: @made_tex");
242 }
243 lyxport_info("Done with LaTeX generation. Moving on.");
244 }
245 return @made_tex;
246 } # end of update_tex()
247
248 #-----------------------------------------------------------------------------
249 # run latex on a file as many times as needed
250 # if the given # of runs is > 0, that many are done; otherwise latex is run
251 # as many times as needed until cross-references work.
252 # can be used to run either normal latex or pdflatex
253 sub run_latex {
254 my($latex_cmd,$file,$runs_ref)=@_;
255
256 # pre-determined # of runs
257 if ($$runs_ref > 0) {
258 foreach (1..$$runs_ref) {
259 lyxport_info("$latex_cmd run # $$runs_ref");
260 safe_system("$latex_cmd $file");
261 }
262 }
263 # or make as many runs as needed to get things right (not very robust...)
264 else {
265 $$runs_ref=0;
266 while (1) {
267 $$runs_ref++;
268 lyxport_info("$latex_cmd run # $$runs_ref");
269 $_ = `$latex_cmd $file`;
270 print;
271 last unless (/Rerun to get cross-references right/m or
272 /^No file .*\.toc.$/m);
273 }
274 }
275 } # end of run_latex()
276
277 #-----------------------------------------------------------------------------
278 # cleanup the tex code so that latex2html doesn't get too confused
279 # this is essentially a Perl version (made with s2p) of Steffan Effer's
280 # original improvetex sed script, part of his lyx2html script collection
281 sub improve_tex4html {
282 my ($texfile,$newfile)=@_;
283 my ($len1,$pflag);
284 my $printit=1;
285 local *OLD,*NEW;
286
287 open(OLD,"< $texfile") || die "Can't read from file $texfile: $!\n";
288 open(NEW,"> $newfile") || die "Can't write to file $newfile: $!\n";
289 select(NEW) || die "Can't make $newfile default filehandle: $!\n";
290
291 # code generated by s2p follows. Emacs can't reindent it properly!
292 # this code is ugly (once in Perl, original sed was ok). Clean it up...
293 $pflag=$\; # save print flag
294 $\="\n";
295 LINE:
296 while (<OLD>) {
297 chomp;
298 # remove pagerefs over two lines (senseless in HTML)
299 if (/on *$\|on *page *$/) {
300 $_ .= "\n";
301 $len1 = length;
302 $_ .= <OLD>;
303 chop if $len1 < length;
304 s/on *\n*page *\n*\\pageref{[^}]*}/\n/g;
305 }
306 # remove regular pagerefs (senseless in HTML)
307 s/on *page *\\pageref{[^}]*}//g;
308 # comment out redefintion of url tag (confuses latex2html)
309 if (/^\\IfFileExists{url.sty}/) {
310 s/^/%/;
311 print;
312 $_ = <OLD>;
313 s/^/%/;
314 }
315 # remove empty pages
316 if (/^\\thispagestyle{empty}~\\newpage$/) {
317 $printit = 0;
318 next LINE;
319 }
320 if (/^\\thispagestyle{empty}~$/) {
321 $printit = 0;
322 next LINE;
323 }
324 # remove custom latex commands for fancyheaders
325 s/\\fancyhead[^{]*{[^{}]*([^{}]*{[^{}]*})*[^{}]*}*//g;
326 s/\\thispagestyle{[^{}]*}//g;
327 # change documentclass from scrbook to book
328 s/^(\\documentclass[^{}]*{)scrbook}/$1book}/;
329 # comment out unsupported packages
330 s/^(\\usepackage\[T1\]{fontenc})/%$1/;
331 s/^(\\usepackage{a4wide})/%$1/;
332 s/^(\\usepackage{fancyhdr})/%$1/;
333 s/^(\\usepackage{ae)/%$1/;
334 s/^(\\pagestyle{fancy})/%$1/;
335 # the geometry package doesn't make sense in html
336 s/^(\\usepackage{geometry})/%$1/;
337 s/^(\\geometry)/%$1/;
338 # comment out ident/skip block command (produces error message; why?)
339 s/^(\\setlength\\parskip{.*})/%$1/;
340 s/^(\\setlength\\parindent{.*})/%$1/;
341 } continue {
342 if ($printit) { print }
343 else { $printit++ }
344 }
345 close(OLD);
346 close(NEW);
347 select(STDOUT);
348 $\=$pflag; # restore defaults
349 } # end of improve_tex4html()
350
351 #-----------------------------------------------------------------------------
352 sub run_latex2html {
353 my ($tex,$latex2html_opts)=@_;
354 my ($l2h_file,$symlink_exists,$htmldir);
355
356 ($htmldir=$tex) =~ s/\.tex$//;
357 $l2h_file="${tex}_#tmp_2html#";
358 improve_tex4html($tex,$l2h_file);
359 # add index support
360 my $xtraargs = "";
361 my $idx = "$htmldir.idx";
362 if(-e $idx ) {
363 $xtraargs .= "-index $idx";
364 }
365 safe_system("$cmd{latex2html} $xtraargs $latex2html_opts $l2h_file");
366 unless ($opt{debug}) {
367 unlink($l2h_file,"$htmldir/labels.pl");
368 }
369
370 # latex2html always leaves 2 copies of the file (one as file.html, one as
371 # index.html). In systems that support symlinks, remove one and replace it
372 # with a link:
373 $symlink_exists = eval { symlink("",""); 1 };
374 if ($symlink_exists) {
375 unlink("$htmldir/index.html");
376 symlink("$htmldir.html","$htmldir/index.html");
377 }
378 } # end of run_latex2html()
379
380 #-----------------------------------------------------------------------------
381 # remove calls to eps figures if they have an accompanying tiff, jpg or png
382 sub improve_tex_figs {
383 my ($tex,$textmp)=@_;
384 local (*TEX,*TMP);
385
386 # begin changes to tex file
387 my ($printit,$figname,$fignoneps,$figbase,$figext,$fignew,@figlist,@tmpfiles);
388 open(TEX,"< $tex") || die "Can't read from LaTeX file $tex: $!\n";
389 open(TMP,"> $textmp") || die "Can't write to temp file $textmp: $!\n";
390 $printit=1;
391 while (<TEX>) {
392 if (/includegraphics{([^\}]*)/) {
393 $figname=$1;
394 # remove .eps from fig name and make a .pdf version if necessary
395 if ($figname =~ /\.eps$/i) {
396 ($figbase = $figname) =~ s/\.eps$//i;
397 # now we need to find if there's any non-eps figure for this file:
398 # pdflatex can handle jpegs, tiffs, etc. So we only need to build
399 # an associated pdf if there is no other figure file for pdflatex
400 # to work with
401 @figlist=grep {/\.jpe?g$|\.tiff?$|\.png$|\.pdf$/i} <$figbase.*>;
402 if (@figlist > 1) {
403 lyxport_info("Problem! More than one figure file found: @figlist");
404 die "I don't know what to do here. Sorry, aborting...\n\n";
405 } elsif (@figlist==1) {
406 # problem: pdftex only recognizes jpg (not jpeg, not JPG, etc)
407 # and tif (not tiff, not TIF, etc). It also gets confused by files
408 # called a.b.c.jpg (it thinks .b.c.jpg is the extension). argh!!!
409 ($fignoneps)=(@figlist);
410 # so first, extract the 3 or 4 letter extension and lowercase it
411 $fignoneps =~ /.*\.(....??)$/;
412 ($figext = $1) =~ tr/[A-Z]/[a-z]/;
413 # and remove any periods from the base of the name (replace by _)
414 $figbase =~ s/\./_/g;
415 $fignew="$figbase.$figext";
416 if ($fignoneps =~ /\.JPE?G$|\.TIFF?$|\.PNG$|\.PDF$/) {
417 lyxport_info("pdflatex only recognizes the following extensions:\n".
418 "pdf, png, jpg, tif. (all lowercase, no variations like jpeg or tiff).\n".
419 "lyxport will make a copy of $fignoneps to $fignew so that pdflatex is happy");
420 copy($fignoneps,$fignew);
421 push(@tmpfiles,$fignew);
422 }
423 s/$figname/$fignew/; # in $_, for printing to temp file
424 } else {
425 s/$figname/$figbase.pdf/;
426 lyxport_info("Making PDF figure <$figbase.pdf> from <$figname>");
427 safe_system("$cmd{epstopdf} $figname");
428 }
429
430 }
431 }
432 } continue {
433 if ($printit) { print TMP $_}
434 else { $printit++ }
435 }
436 close(TEX);
437 close(TMP);
438 return @tmpfiles;
439 } # end of improve_tex_figs()
440
441 #-----------------------------------------------------------------------------
442 # Make the pdf directly from the latex file
443 # Notes: for this to work ok, the following must have been done:
444 # 1. ~/.dvipsrc file must contain the lines
445 # p+ psfonts.cmz
446 # p+ psfonts.amz
447 # 2. The latex preamble of the lyx file must have
448 # \usepackage{ae,aecompl}
449 # This is so that T1 encoded fonts come out looking good in the final pdf.
450 sub run_pdflatex {
451 my ($tex,$pdf,$runs_ref)=@_;
452 my ($texbase,$tmpbase,$textmp,@tmpfiles,@extensions,$printit);
453 local *TEX,*TMP;
454
455 # first fix references to eps figures (make sure that pdf versions exist!!!)
456 # make all changes in a temp tex file
457 ($texbase=$tex) =~ s/\.tex$//;
458 $tmpbase = "${texbase}_#tmp_pdf#";
459 @extensions=qw(tex aux out toc log);
460 ($textmp,@tmpfiles)= map { "${tmpbase}.$_" } @extensions;
461
462 push(@tmpfiles,improve_tex_figs($tex,$textmp));
463 # now run the actual pdflatex converter
464 run_latex("$cmd{pdflatex} -interaction=nonstopmode",$textmp,$runs_ref);
465 rename( "${tmpbase}.pdf",$pdf);
466 unless ($opt{debug}) { unlink ($textmp,@tmpfiles,"texput.log"); }
467 } # end of run_pdflatex()
468
469 #-----------------------------------------------------------------------------
470 # general utility routines (not related to latex/html/pdf) follow
471
472 #-------------------------------------------------------------------------
473 sub cmdline_process{
474 my($opt_ref,$file_ref)=@_;
475
476 # modules
477 no strict "vars"; # avoid some unpleasant warnings while checking options
478
479 use Getopt::Long;
480 # allow bundling of single letter options (-a -b == -ab)
481 Getopt::Long::Configure ("bundling");
482 use Pod::Usage;
483
484 # note: the second name for each option (after |) is an alias for user
485 # convenience only. Internally, the only created hash entries use the *first*
486 # name as a key (i.e. $opt{h} doesn't exist, $opt{html} is set with -h or --html)
487 my(@option_list) = qw(html|h ps|p pdf|f leave
488 runs|r=i opts_l2h|o=s clean|c tidy|t+
489 cld|l debug|d help man|m version|v);
490
491 # debug mode overrides all post-run cleanup options
492 if ($opt{debug}) { $opt{t}=0 }
493
494 # default: a negative # of runs means auto-detect
495 $$opt_ref{runs}= -99;
496 # dash options first
497 GetOptions($opt_ref,@option_list) || pod2usage(-verbose => 0);
498
499 # execute all possible "die" modes first
500 cmdline_debug(%$opt_ref) if ($$opt_ref{cld});
501 pod2usage(-verbose => 1) if ($$opt_ref{help});
502 pod2usage(-verbose => 2) if ($$opt_ref{man});
503 die "\nlyxport: version $version\n\n" if ($$opt_ref{version});
504
505 ## Now get filename (only ONE)
506 pod2usage(-verbose => 0, -message =>
507 "\nERROR: lyxport works with exactly ONE file at a time.\n")
508 if (@ARGV != 1);
509 ($$file_ref)=@ARGV;
510
511 # choose whether to make all targets or just the explicitly specified ones
512 unless ($$opt_ref{html} or $$opt_ref{ps} or $$opt_ref{pdf}) {
513 $$opt_ref{html}=$$opt_ref{ps}=$$opt_ref{pdf}=1;
514 }
515 } # end of cmdline_process()
516
517 #-----------------------------------------------------------------------------
518 # quick and dirty hash printing by key/value pairs
519 sub print_hash {
520 my($key_msg,$val_msg,%hash)=@_;
521 my($op,$val);
522
523 while ( ($op,$val)=each(%hash) ) {print "$key_msg $op $val_msg $val\n" }
524 } # end of print_hash()
525
526 #-----------------------------------------------------------------------------
527 sub cmdline_debug{
528 my(%opt)=@_;
529
530 print "\nlyxport command line debug mode\n";
531 print "-------------------------------\n\n";
532 print "This is a dump of your command line options, as key-value pairs:\n\n";
533 print_hash("","->",%opt);
534 print "\nExiting...\n\n";
535 exit;
536 } # end of cmdline_debug()
537
538 #-----------------------------------------------------------------------------
539 # execute a system call but die with some info if return value is non-zero
540 sub safe_system {
541 my $error;
542
543 $error=system(@_)/256;
544 if ($error) {
545 print "\nERROR: Command\n @_\nfailed.\n";
546 }
547 return $error;
548 } # end of safe_system()
549
550 #-----------------------------------------------------------------------------
551 # check that the command names specified at the top exist in the system,
552 # otherwise choose bare defaults and hope for the best.
553 sub set_cmd_defaults {
554 my ($cmd)=@_;
555 my ($prog,$cmd_name);
556
557 print "\n";
558 while (($prog,$cmd_name)=each(%cmd)) {
559 print "Checking for program <$prog>, as <$cmd_name>... \n";
560 if (system("which $cmd_name")/256) {
561 $$cmd{$prog}=$prog;
562 print "Not found. Reverting to default name $prog.\n";
563 } else { print "OK, found it.\n" }
564 }
565 print "\nDone configuring command names\n\n";
566 } # end of set_cmd_defaults()
567
568 #-----------------------------------------------------------------------------
569 # make sure there's either a .lyx or a .tex file to work with
570 # returns a stripped name (without .lyx or .tex extension) of the file
571 sub check_file_exists {
572 my($file_in)=@_;
573 my($base_file);
574
575 $_=$file_in;
576 if (/\.lyx$/) { s/\.lyx$// }
577 elsif (/\.tex$/) { s/\.tex$// }
578 $base_file=$_;
579 unless (-e "${base_file}.lyx" or -e "${base_file}.tex") {
580 die "I can't find a LyX or LaTeX file to work with!\nAborting...\n\n";
581 }
582 return $base_file;
583 } # end of check_file_exists()
584
585 #-----------------------------------------------------------------------------
586 sub check_targets{
587 my($file,$tag,$built,$failed)=@_;
588 my($success)=0;
589
590 $tag .= ' ';
591 if (-s $file) { $$built .= $tag; $success=1; }
592 else { $$failed .= $tag }
593 return $success;
594 } # end of check_targets()
595
596 #-----------------------------------------------------------------------------
597 # do extra cleaning of aux, toc, log files generated during running
598 sub tidy_up {
599 my($tidy,$aux,$log,$out,$toc,@latex_from_lyx)=@_;
600
601 lyxport_info("Cleanup of leftover auxiliary files");
602 print "Removing files: $aux, $log, $out, $toc\n";
603 unlink ($aux,$log,$out,$toc);
604 if ($tidy>1 and @latex_from_lyx) {
605 lyxport_info("Extra cleanup: removing LaTeX file(s) @latex_from_lyx");
606 unlink(@latex_from_lyx);
607 foreach (@latex_from_lyx) {
608 s/\.tex$/\.aux/;
609 if (-e) {
610 print "Removing aux file $_\n";
611 unlink($_);
612 }
613 }
614 }
615 } # end of tidy_up()
616
617 #-----------------------------------------------------------------------------
618 sub lyxport_info {
619 my ($target)=@_;
620
621 print "\n",'*'x75,"\n";
622 print "<lyxport> $target\n\n";
623 } # end of lyxport_info()
624
625 #-----------------------------------------------------------------------------
626 sub final_diagnostics{
627 my($file_in,$status,$targets_built,$targets_failed)=@_;
628
629 lyxport_info("All done!");
630 print "Input file: $file_in\n\n";
631 print "Targets built : $targets_built\n\n";
632 if ($targets_failed) {
633 print "PROBLEM!\nTargets failed: $targets_failed\n\n";
634 }
635 print "Diagnostics of build process:\n\n$status\nBye!\n\n";
636 } # end of final_diagnostics()
637
638
639 #************************ end of code for <lyxport> *******************
640
641 __END__
642
643 =pod
644
645 =head1 DESCRIPTION
646
647 =head2 Purpose
648
649 LyX ( http://www.lyx.org ) is a wonderful document processor, which can produce
650 from a single source multiple versions for different purposes: a PostScript
651 file for printing on a Unix-type system, a PDF file for distribution across
652 multiple operating systems, or an HTML file for Internet display. It
653 accomplishes this by exporting its own file format to a LaTeX file and then
654 running various converters on this resulting file.
655
656 However, it turns out that this process isn't exactly foolproof, as these
657 converters have all sorts of little quirks which can produce anything from
658 surprises in the way the final result looks like to outright failure of the
659 export process. The purpose of B<lyxport> is to serve as a "smart wrapper"
660 around those export facilities which LyX normally uses, trying to massage the
661 LaTeX file that everything starts from in the hopes of having better success
662 in producing HTML and PDF (PostScript usually poses no problems).
663
664 B<lyxport> also allows you to keep around only the LyX file, and possibly any
665 ancillary figure files. B<lyxport> takes care of generating (and removing
666 afterwards if instructed to do so) any intermediate files necessary for the
667 export process.
668
669 For example, in order to make PDF from a LaTeX file, any included eps figures
670 need to be converted to pdf format. But LyX likes to have the figures in eps
671 format for on-screen display, which is a great feature to have. B<lyxport>
672 allows you to keep your LyX file as usual (with references to .eps figures)
673 and will make .pdf versions of any included figure on the fly as needed. You
674 can even ask it to remove those pdf files after it finishes, if you really
675 want to maintain a minimum of files around (though it will have to remake them
676 again if you ever need to update your pdf exported document).
677
678 =head2 Command line use
679
680 If you simply type B<lyxport> F<file>, it will try to make PostScript, HTML,
681 and PDF versions of your file, putting them all in a single directory named
682 F<file> (without a .lyx or .tex extension if your file had one). But it has
683 L<command line options|OPTIONS AND ARGUMENTS> for making only the
684 formats you want, and fairly detailed control over its behavior.
685
686 =head2 If you don't have LyX
687
688 Despite its name, if you are a regular LaTeX user and don't even have LyX
689 installed in your system, B<lyxport> can still be useful to you. In fact,
690 B<lyxport> only uses LyX once in each run: if there is no F<file.tex> or if
691 F<file.lyx> file is newer than F<file.tex>, B<lyxport> updates F<file.tex>
692 from F<file.lyx>. But if there is no F<file.lyx> at all it will simply use
693 F<file.tex> and proceed with all its functionality intact.
694
695 =cut
696 ###########################################################################
697 =pod
698
699 =head1 OPTIONS AND ARGUMENTS
700
701 Single letter options (preceded by a single dash B<->) can be bundled: B<-pf>
702 is equivalent to B<-p -f>. Long options (preceded by two dashes B<-->) can be
703 abbreviated to as few letters as needed to clear ambiguity.
704
705 =over
706
707 =item B<-r --runs> I<NUM>
708
709 Set number of latex runs by hand (otherwise auto-determined).
710
711 =item B<-o --opts_l2h> I<'string'>
712
713 String with options to be passed to B<latex2html>. This string should be
714 protected by single quotes to allow double quotes inside of it.
715
716 For example, if you want to pass to B<latex2html> the option B<-info "my
717 info"> you can do so with B<lyxport -o ' -info "my info" '> (the extra spaces
718 around the quote marks are not needed, they are here only for the sake of
719 clarity).
720
721 B<latex2html> has I<many> command-line options. For a project you are working
722 constantly on, it may be more convenient to permanently set some of those
723 options via a file called F<.latex2html-init> which B<latex2html> always
724 reads at startup. See the B<latex2html> man page or the excellent online
725 documentation kept at http://www-texdev.mpce.mq.edu.au/l2h/docs/manual for
726 full details.
727
728 =item B<-h --html>
729
730 Export to HTML.
731
732 =item B<-p --ps>
733
734 Export to PostScript.
735
736 =item B<-f --pdf>
737
738 Export to PDF. See below the section L<PDF GENERATION> for details on how to
739 obtain nice-looking PDF from your LaTeX sources.
740
741 If none of the three above options is specified, the default behavior is to
742 export I<all> three formats. If any is given, then only those formats
743 explicitly specified will be produced (e.g. B<-h -f> makes HTML and PDF only,
744 but not PostScript).
745
746 =item B<--leave>
747
748 By default lyxport moves the resulting PostScript and PDF files into the
749 directory containing the HTML results (if it was created). This option tells
750 it to leave them in the current directory.
751
752 =item B<-c --clean>
753
754 Do a clean start export, removing first any html directory, .aux, .log
755 and .toc files which may have been left from previous runs.
756
757 =item B<-t --tidy>
758
759 B<lyxport> will tidy up I<after> itself, removing .aux, .log and .toc files left
760 in the current directory. Use this only for "final" publication of documents, as
761 those files are otherwise useful to shorten the time of runs.
762
763 This option is incremental: you can call it twice (you can bundle it as
764 B<-tt>). If called twice, B<lyxport> will remove also the LaTeX file
765 associated with your LyX file, but I<only if> B<lyxport> I<itself created it
766 in the same run>. This behavior is meant to be a safety net, so that
767 B<lyxport> doesn't accidentally remove LaTeX files which you may have manually
768 modified in some way.
769
770 So if this option is called twice, you can start with a LyX file named F<file.lyx>
771 and end up only with your original file plus a single directory named F<file> which
772 will contain F<file.html>, F<file.ps> and F<file.pdf> (plus some ancillary stuff for
773 the html version). This mode of operation is obviously provided for the neatness
774 freaks amongst us.
775
776 =item B<-d --debug>
777
778 Debugging mode: B<lyxport> will leave I<all> temporary files it creates lying
779 around. If a particular target refuses to build, you can then try to run the
780 respective commands on the temporary files manually, and possibly diagnose the
781 source of the problem.
782
783 This option will override any calls made to option B<--tidy>.
784
785 =item B<-l --cld>
786
787 Special command-line debugging mode: only prints (in a rather primitive form)
788 the names and values of all command-line options which were set. Useful for
789 finding problems with complicated option strings being passed to
790 B<latex2html>.
791
792 =item B<--help>
793
794 Print this help and quit.
795
796 =item B<-m --man>
797
798 Print a complete man page. B<lyxport> is documented using embedded pod
799 strings, so you can see its full documentation using the command B<perldoc
800 lyxport>.
801
802 You can also convert this documentation to other formats using the
803 I<pod2_anything> family of converters (L<pod2html>, L<pod2latex>, L<pod2man>
804 and L<pod2text>). See their respective man pages for details.
805
806 Note that if you installed B<lyxport> properly, you should already have a man
807 page available, plus html and plain text versions of the documents. These are
808 by default installed to a directory named F</usr/local/doc/lyxport-XXX>, where
809 F<XXX> is the version number. At installation time, you may manually change
810 the F</usr/local> prefix. Consult your local documents or ask your system
811 administrator for details on the specifics of your configuration.
812
813 =item B<-v --version>
814
815 Print version information and quit.
816
817 =item B<filename>
818
819 The given filename may have a .lyx or .tex extension (or none at
820 all). I<lyxport> will update the tex file from the lyx file if necessary.
821
822 B<lyxport> accepts only I<one> filename at a time.
823
824 =back
825
826 =cut
827 ###########################################################################
828 =pod
829
830 =head1 INTEGRATION WITH LyX
831
832 If you find that B<lyxport> is more succesful in exporting your files than
833 LyX's default calls to B<latex2html> and B<pdflatex>, you can modify LyX to
834 use B<lyxport> as its conversion routine. For LyX versions 1.1.6 and above, go
835 to C<< Edit->Preferences->Converters->Converters >> and specify B<lyxport> as your
836 converter for C<< LaTeX->HTML >> and C<< LaTeX->PDF >>. LyX's convention
837 is to call B<$$i> the current file.
838
839 For example, if you want to setup B<lyxport> to be your PDF export filter
840 under LyX, in the C<Converters> dialog, in the C<< LaTeX->PDF(pdflatex) >>
841 option, set:
842
843 lyxport --pdf $$i
844
845 This way you'll be able to export to pdf directly from within LyX, even if
846 your figures are in eps format.
847
848 LyX's C<Converters> dialog is a bit confusing: after making changes, you must
849 first press the C<Modify> button for your changes to actually be recorded, and
850 then C<Save>.
851
852 You can similarly set up B<lyxport> to be your LaTeX to HTML converter.
853
854 For LyX versions earlier than 1.1.6 (which didn't have the new Preferences
855 dialog) these same options can be configured via your LyX defaults file. See
856 the LyX documentation for details.
857
858 =cut
859 ###########################################################################
860 =pod
861
862 =head1 PDF GENERATION
863
864 =head2 Fonts
865
866 Normally PDF documents made on Unix-type systems from LaTeX sources produce
867 horrible looking fonts when viewed with Adobe's own Acrobat Reader. I don't
868 know the many intricacies of the problem (you can search for the details on
869 your own). I'll simply list here the trick that has helped I<me> solve the
870 font problem. Try it, your mileage may vary.
871
872 =over
873
874 =item 1
875
876 In your home directory, make (or modify it if it already exists) a file
877 named F<.dvipsrc> which must contain the lines:
878
879 p+ psfonts.cmz
880 p+ psfonts.amz
881
882 =item 2
883
884 Make sure that the LaTeX preamble of your LyX file (or the part before
885 C<\begin{document}> if you are using straight LaTeX files) contains:
886
887 \usepackage[T1]{fontenc}
888 \usepackage{ae,aecompl}
889
890 This will guarantee that T1 encoded fonts come out looking good in the final PDF.
891
892 =back
893
894 =head2 Figures
895
896 B<pdflatex> (if I understand correctly) only accepts filenames with a single
897 B<.> in them, and only uses graphic files with extensions pdf, png, jpg and
898 tif (all lowercase). B<lyxport> will do its best to analyze your latex file
899 and try to change references to figures to accommodate B<pdflatex>, by
900 creating temporary copies of your image files if necessary.
901
902 Ideally, you should be able to have for example a figure called F<fig.1.JPG>
903 along with a F<fig.1.eps> (for B<lyx> to preview it), and B<lyxport> would
904 export a pdf document without leaving any more files after itself, even though
905 it temporarily had to create F<fig_1.jpg> to make B<pdflatex> happy. As I
906 said, ideally... If things don't quite work, try the B<--debug> option. If you
907 find a fix for the problem, mail it to me: fperez@pizero.colorado.edu
908
909 =head2 Links
910
911 In order for URLs and similar elements to produce proper active links in the
912 PDF document, you need to include in your LaTeX preamble the line
913
914 \usepackage{hyperref}
915
916 =cut
917 ###########################################################################
918 =pod
919
920 =head1 REQUIRES
921
922 B<lyxport> relies on some programs listed below, for the reasons indicated:
923
924 =over
925
926 =item B<lyx>
927
928 To make LaTeX files from LyX files. Tested with lyx version 1.1.6fix1, should
929 work with earlier versions (perhaps with minor changes to the way LyX is called).
930
931 =item B<latex>
932
933 To produce PostScript and for latex2html to work properly (cross-references).
934
935 =item B<dvips>
936
937 For making PostScript output.
938
939 =item B<latex2html>
940
941 For generating HTML from latex sources.
942
943 =item B<pdflatex>
944
945 For making PDF output from a latex file with proper cross-referencing and
946 internal document links.
947
948 =item B<epstopdf>
949
950 A Perl script to automatically generate pdf versions of eps figures included
951 in lyx files. It is more robust in its handling of various eps quirks than a
952 straight call to B<ps2pdf>.
953
954 =item B<perl>
955
956 Well, it's a Perl script after all, isn't it?
957
958 =back
959
960 However, partial use of B<lyxport> is still possible without some of these
961 components. If for example you don't have B<latex2html> in your system, you
962 can still use B<lyxport> to produce PostScript and PDF. Various combinations
963 are possible.
964
965 =head2 Portability
966
967 There are calls in B<lyxport> to some Unix commands like B<rm -rf>. For this
968 reason it is not totally portable. These calls are however reasonably few and
969 could be eliminated if there is enough demand by replacing them with
970 equivalent Perl code. It's just more work...
971
972 =cut
973 ###########################################################################
974 =pod
975
976 =head1 TO DO
977
978 =over
979
980 =item *
981
982 Build rpm for more convenient installation.
983
984 =item *
985
986 Clean up the C<improve_tex4html()> code for readability.
987
988 =back
989
990 =cut
991 ###########################################################################
992 =pod
993
994 =head1 VERSION
995
996 This is B<lyxport> version 0.3.1
997
998 =cut
999 ###########################################################################
1000 =pod
1001
1002 =head1 AUTHOR
1003
1004 Fernando Pérez E<lt>fperez@pizero.colorado.eduE<gt>.
1005
1006 Please email me with comments, suggestions, bugfixes, etc.
1007
1008 The most current version of B<lyxport> should always be available at
1009 http://www-hep.colorado.edu/~fperez/lyxport
1010
1011 =cut
1012 ###########################################################################
1013 =pod
1014
1015 =head1 ACKNOWLEDGEMENTS
1016
1017 Inspired on the B<lyx2html> script by Steffen Evers
1018 E<lt>tron@cs.tu-berlin.deE<gt>. Some of the code is a blatant ripoff of
1019 Steffen's code, using B<s2p> to get Perl versions of his original B<sed>
1020 scripts.
1021
1022 =cut
1023 ###########################################################################
1024 =pod
1025
1026
1027 =head1 COPYRIGHT AND DISCLAIMER
1028
1029 This program is Copyright 2001 by Fernando Pérez.
1030
1031 This program is free software; you can redistribute it and/or modify it under
1032 the terms of the GNU General Public License as published by the Free Software
1033 Foundation; either version 2 of the License, or (at your option) any later
1034 version.
1035
1036 This program is distributed in the hope that it will be useful,
1037 but WITHOUT ANY WARRANTY; without even the implied warranty of
1038 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1039 GNU General Public License for more details.
1040
1041 If you do not have a copy of the GNU General Public License write to
1042 the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
1043 MA 02139, USA.
1044
1045 If the author of this software was too lazy to include the full GPL text along
1046 with the code, you can find it at: http://www.gnu.org/copyleft/gpl.html
1047
1048 =cut
1049 #************************** end of file <lyxport> **********************
General Comments 0
You need to be logged in to leave comments. Login now