##// END OF EJS Templates
- Add %logstop functionality to fully stop logger after turning it on....
fperez -
Show More
@@ -1,261 +1,271 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 Logger class for IPython's logging facilities.
4 4
5 $Id: Logger.py 2653 2007-08-22 18:01:09Z vivainio $
5 $Id: Logger.py 2874 2007-11-26 06:50:42Z fperez $
6 6 """
7 7
8 8 #*****************************************************************************
9 9 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
10 10 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
11 11 #
12 12 # Distributed under the terms of the BSD License. The full license is in
13 13 # the file COPYING, distributed as part of this software.
14 14 #*****************************************************************************
15 15
16 16 #****************************************************************************
17 17 # Modules and globals
18 18
19 19 from IPython import Release
20 20 __author__ = '%s <%s>\n%s <%s>' % \
21 21 ( Release.authors['Janko'] + Release.authors['Fernando'] )
22 22 __license__ = Release.license
23 23
24 24 # Python standard modules
25 25 import glob
26 26 import os
27 27 import time
28 28
29 29 #****************************************************************************
30 30 # FIXME: This class isn't a mixin anymore, but it still needs attributes from
31 31 # ipython and does input cache management. Finish cleanup later...
32 32
33 33 class Logger(object):
34 34 """A Logfile class with different policies for file creation"""
35 35
36 36 def __init__(self,shell,logfname='Logger.log',loghead='',logmode='over'):
37 37
38 38 self._i00,self._i,self._ii,self._iii = '','','',''
39 39
40 40 # this is the full ipython instance, we need some attributes from it
41 41 # which won't exist until later. What a mess, clean up later...
42 42 self.shell = shell
43 43
44 44 self.logfname = logfname
45 45 self.loghead = loghead
46 46 self.logmode = logmode
47 47 self.logfile = None
48 48
49 49 # Whether to log raw or processed input
50 50 self.log_raw_input = False
51 51
52 52 # whether to also log output
53 53 self.log_output = False
54 54
55 55 # whether to put timestamps before each log entry
56 56 self.timestamp = False
57 57
58 58 # activity control flags
59 59 self.log_active = False
60 60
61 61 # logmode is a validated property
62 62 def _set_mode(self,mode):
63 63 if mode not in ['append','backup','global','over','rotate']:
64 64 raise ValueError,'invalid log mode %s given' % mode
65 65 self._logmode = mode
66 66
67 67 def _get_mode(self):
68 68 return self._logmode
69 69
70 70 logmode = property(_get_mode,_set_mode)
71 71
72 72 def logstart(self,logfname=None,loghead=None,logmode=None,
73 73 log_output=False,timestamp=False,log_raw_input=False):
74 74 """Generate a new log-file with a default header.
75 75
76 76 Raises RuntimeError if the log has already been started"""
77 77
78 78 if self.logfile is not None:
79 79 raise RuntimeError('Log file is already active: %s' %
80 80 self.logfname)
81 81
82 82 self.log_active = True
83 83
84 84 # The parameters can override constructor defaults
85 85 if logfname is not None: self.logfname = logfname
86 86 if loghead is not None: self.loghead = loghead
87 87 if logmode is not None: self.logmode = logmode
88 88
89 89 # Parameters not part of the constructor
90 90 self.timestamp = timestamp
91 91 self.log_output = log_output
92 92 self.log_raw_input = log_raw_input
93 93
94 94 # init depending on the log mode requested
95 95 isfile = os.path.isfile
96 96 logmode = self.logmode
97 97
98 98 if logmode == 'append':
99 99 self.logfile = open(self.logfname,'a')
100 100
101 101 elif logmode == 'backup':
102 102 if isfile(self.logfname):
103 103 backup_logname = self.logfname+'~'
104 104 # Manually remove any old backup, since os.rename may fail
105 105 # under Windows.
106 106 if isfile(backup_logname):
107 107 os.remove(backup_logname)
108 108 os.rename(self.logfname,backup_logname)
109 109 self.logfile = open(self.logfname,'w')
110 110
111 111 elif logmode == 'global':
112 112 self.logfname = os.path.join(self.shell.home_dir,self.logfname)
113 113 self.logfile = open(self.logfname, 'a')
114 114
115 115 elif logmode == 'over':
116 116 if isfile(self.logfname):
117 117 os.remove(self.logfname)
118 118 self.logfile = open(self.logfname,'w')
119 119
120 120 elif logmode == 'rotate':
121 121 if isfile(self.logfname):
122 122 if isfile(self.logfname+'.001~'):
123 123 old = glob.glob(self.logfname+'.*~')
124 124 old.sort()
125 125 old.reverse()
126 126 for f in old:
127 127 root, ext = os.path.splitext(f)
128 128 num = int(ext[1:-1])+1
129 129 os.rename(f, root+'.'+`num`.zfill(3)+'~')
130 130 os.rename(self.logfname, self.logfname+'.001~')
131 131 self.logfile = open(self.logfname,'w')
132 132
133 133 if logmode != 'append':
134 134 self.logfile.write(self.loghead)
135 135
136 136 self.logfile.flush()
137 137
138 138 def switch_log(self,val):
139 139 """Switch logging on/off. val should be ONLY a boolean."""
140 140
141 141 if val not in [False,True,0,1]:
142 142 raise ValueError, \
143 143 'Call switch_log ONLY with a boolean argument, not with:',val
144 144
145 145 label = {0:'OFF',1:'ON',False:'OFF',True:'ON'}
146 146
147 147 if self.logfile is None:
148 148 print """
149 149 Logging hasn't been started yet (use logstart for that).
150 150
151 151 %logon/%logoff are for temporarily starting and stopping logging for a logfile
152 152 which already exists. But you must first start the logging process with
153 153 %logstart (optionally giving a logfile name)."""
154 154
155 155 else:
156 156 if self.log_active == val:
157 157 print 'Logging is already',label[val]
158 158 else:
159 159 print 'Switching logging',label[val]
160 160 self.log_active = not self.log_active
161 161 self.log_active_out = self.log_active
162 162
163 163 def logstate(self):
164 164 """Print a status message about the logger."""
165 165 if self.logfile is None:
166 166 print 'Logging has not been activated.'
167 167 else:
168 168 state = self.log_active and 'active' or 'temporarily suspended'
169 169 print 'Filename :',self.logfname
170 170 print 'Mode :',self.logmode
171 171 print 'Output logging :',self.log_output
172 172 print 'Raw input log :',self.log_raw_input
173 173 print 'Timestamping :',self.timestamp
174 174 print 'State :',state
175 175
176 176 def log(self,line_ori,line_mod,continuation=None):
177 177 """Write the line to a log and create input cache variables _i*.
178 178
179 179 Inputs:
180 180
181 181 - line_ori: unmodified input line from the user. This is not
182 182 necessarily valid Python.
183 183
184 184 - line_mod: possibly modified input, such as the transformations made
185 185 by input prefilters or input handlers of various kinds. This should
186 186 always be valid Python.
187 187
188 188 - continuation: if True, indicates this is part of multi-line input."""
189 189
190 190 # update the auto _i tables
191 191 #print '***logging line',line_mod # dbg
192 192 #print '***cache_count', self.shell.outputcache.prompt_count # dbg
193 193 try:
194 194 input_hist = self.shell.user_ns['_ih']
195 195 except:
196 196 print 'userns:',self.shell.user_ns.keys()
197 197 return
198 198
199 199 out_cache = self.shell.outputcache
200 200
201 201 # add blank lines if the input cache fell out of sync.
202 202 if out_cache.do_full_cache and \
203 203 out_cache.prompt_count +1 > len(input_hist):
204 204 input_hist.extend(['\n'] * (out_cache.prompt_count - len(input_hist)))
205 205
206 206 if not continuation and line_mod:
207 207 self._iii = self._ii
208 208 self._ii = self._i
209 209 self._i = self._i00
210 210 # put back the final \n of every input line
211 211 self._i00 = line_mod+'\n'
212 212 #print 'Logging input:<%s>' % line_mod # dbg
213 213 input_hist.append(self._i00)
214 214 #print '---[%s]' % (len(input_hist)-1,) # dbg
215 215
216 216 # hackish access to top-level namespace to create _i1,_i2... dynamically
217 217 to_main = {'_i':self._i,'_ii':self._ii,'_iii':self._iii}
218 218 if self.shell.outputcache.do_full_cache:
219 219 in_num = self.shell.outputcache.prompt_count
220 220
221 221 # but if the opposite is true (a macro can produce multiple inputs
222 222 # with no output display called), then bring the output counter in
223 223 # sync:
224 224 last_num = len(input_hist)-1
225 225 if in_num != last_num:
226 226 in_num = self.shell.outputcache.prompt_count = last_num
227 227 new_i = '_i%s' % in_num
228 228 if continuation:
229 229 self._i00 = '%s%s\n' % (self.shell.user_ns[new_i],line_mod)
230 230 input_hist[in_num] = self._i00
231 231 to_main[new_i] = self._i00
232 232 self.shell.user_ns.update(to_main)
233 233
234 234 # Write the log line, but decide which one according to the
235 235 # log_raw_input flag, set when the log is started.
236 236 if self.log_raw_input:
237 237 self.log_write(line_ori)
238 238 else:
239 239 self.log_write(line_mod)
240 240
241 241 def log_write(self,data,kind='input'):
242 242 """Write data to the log file, if active"""
243 243
244 244 #print 'data: %r' % data # dbg
245 245 if self.log_active and data:
246 246 write = self.logfile.write
247 247 if kind=='input':
248 248 if self.timestamp:
249 249 write(time.strftime('# %a, %d %b %Y %H:%M:%S\n',
250 250 time.localtime()))
251 251 write('%s\n' % data)
252 252 elif kind=='output' and self.log_output:
253 253 odata = '\n'.join(['#[Out]# %s' % s
254 254 for s in data.split('\n')])
255 255 write('%s\n' % odata)
256 256 self.logfile.flush()
257 257
258 def close_log(self):
258 def logstop(self):
259 """Fully stop logging and close log file.
260
261 In order to start logging again, a new logstart() call needs to be
262 made, possibly (though not necessarily) with a new filename, mode and
263 other options."""
264
259 265 self.logfile.close()
260 266 self.logfile = None
261 267 self.logfname = ''
268 self.log_active = False
269
270 # For backwards compatibility, in case anyone was using this.
271 close_log = logstop
@@ -1,3265 +1,3273 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 2872 2007-11-25 17:58:05Z fperez $"""
4 $Id: Magic.py 2874 2007-11-26 06:50:42Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
8 8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 9 #
10 10 # Distributed under the terms of the BSD License. The full license is in
11 11 # the file COPYING, distributed as part of this software.
12 12 #*****************************************************************************
13 13
14 14 #****************************************************************************
15 15 # Modules and globals
16 16
17 17 from IPython import Release
18 18 __author__ = '%s <%s>\n%s <%s>' % \
19 19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
20 20 __license__ = Release.license
21 21
22 22 # Python standard modules
23 23 import __builtin__
24 24 import bdb
25 25 import inspect
26 26 import os
27 27 import pdb
28 28 import pydoc
29 29 import sys
30 30 import re
31 31 import tempfile
32 32 import time
33 33 import cPickle as pickle
34 34 import textwrap
35 35 from cStringIO import StringIO
36 36 from getopt import getopt,GetoptError
37 37 from pprint import pprint, pformat
38 38 from sets import Set
39 39
40 40 # cProfile was added in Python2.5
41 41 try:
42 42 import cProfile as profile
43 43 import pstats
44 44 except ImportError:
45 45 # profile isn't bundled by default in Debian for license reasons
46 46 try:
47 47 import profile,pstats
48 48 except ImportError:
49 49 profile = pstats = None
50 50
51 51 # Homebrewed
52 52 import IPython
53 53 from IPython import Debugger, OInspect, wildcard
54 54 from IPython.FakeModule import FakeModule
55 55 from IPython.Itpl import Itpl, itpl, printpl,itplns
56 56 from IPython.PyColorize import Parser
57 57 from IPython.ipstruct import Struct
58 58 from IPython.macro import Macro
59 59 from IPython.genutils import *
60 60 from IPython import platutils
61 61 import IPython.generics
62 62 import IPython.ipapi
63 63 from IPython.ipapi import UsageError
64 64 #***************************************************************************
65 65 # Utility functions
66 66 def on_off(tag):
67 67 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
68 68 return ['OFF','ON'][tag]
69 69
70 70 class Bunch: pass
71 71
72 72 def compress_dhist(dh):
73 73 head, tail = dh[:-10], dh[-10:]
74 74
75 75 newhead = []
76 76 done = Set()
77 77 for h in head:
78 78 if h in done:
79 79 continue
80 80 newhead.append(h)
81 81 done.add(h)
82 82
83 83 return newhead + tail
84 84
85 85
86 86 #***************************************************************************
87 87 # Main class implementing Magic functionality
88 88 class Magic:
89 89 """Magic functions for InteractiveShell.
90 90
91 91 Shell functions which can be reached as %function_name. All magic
92 92 functions should accept a string, which they can parse for their own
93 93 needs. This can make some functions easier to type, eg `%cd ../`
94 94 vs. `%cd("../")`
95 95
96 96 ALL definitions MUST begin with the prefix magic_. The user won't need it
97 97 at the command line, but it is is needed in the definition. """
98 98
99 99 # class globals
100 100 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
101 101 'Automagic is ON, % prefix NOT needed for magic functions.']
102 102
103 103 #......................................................................
104 104 # some utility functions
105 105
106 106 def __init__(self,shell):
107 107
108 108 self.options_table = {}
109 109 if profile is None:
110 110 self.magic_prun = self.profile_missing_notice
111 111 self.shell = shell
112 112
113 113 # namespace for holding state we may need
114 114 self._magic_state = Bunch()
115 115
116 116 def profile_missing_notice(self, *args, **kwargs):
117 117 error("""\
118 118 The profile module could not be found. If you are a Debian user,
119 119 it has been removed from the standard Debian package because of its non-free
120 120 license. To use profiling, please install"python2.3-profiler" from non-free.""")
121 121
122 122 def default_option(self,fn,optstr):
123 123 """Make an entry in the options_table for fn, with value optstr"""
124 124
125 125 if fn not in self.lsmagic():
126 126 error("%s is not a magic function" % fn)
127 127 self.options_table[fn] = optstr
128 128
129 129 def lsmagic(self):
130 130 """Return a list of currently available magic functions.
131 131
132 132 Gives a list of the bare names after mangling (['ls','cd', ...], not
133 133 ['magic_ls','magic_cd',...]"""
134 134
135 135 # FIXME. This needs a cleanup, in the way the magics list is built.
136 136
137 137 # magics in class definition
138 138 class_magic = lambda fn: fn.startswith('magic_') and \
139 139 callable(Magic.__dict__[fn])
140 140 # in instance namespace (run-time user additions)
141 141 inst_magic = lambda fn: fn.startswith('magic_') and \
142 142 callable(self.__dict__[fn])
143 143 # and bound magics by user (so they can access self):
144 144 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
145 145 callable(self.__class__.__dict__[fn])
146 146 magics = filter(class_magic,Magic.__dict__.keys()) + \
147 147 filter(inst_magic,self.__dict__.keys()) + \
148 148 filter(inst_bound_magic,self.__class__.__dict__.keys())
149 149 out = []
150 150 for fn in magics:
151 151 out.append(fn.replace('magic_','',1))
152 152 out.sort()
153 153 return out
154 154
155 155 def extract_input_slices(self,slices,raw=False):
156 156 """Return as a string a set of input history slices.
157 157
158 158 Inputs:
159 159
160 160 - slices: the set of slices is given as a list of strings (like
161 161 ['1','4:8','9'], since this function is for use by magic functions
162 162 which get their arguments as strings.
163 163
164 164 Optional inputs:
165 165
166 166 - raw(False): by default, the processed input is used. If this is
167 167 true, the raw input history is used instead.
168 168
169 169 Note that slices can be called with two notations:
170 170
171 171 N:M -> standard python form, means including items N...(M-1).
172 172
173 173 N-M -> include items N..M (closed endpoint)."""
174 174
175 175 if raw:
176 176 hist = self.shell.input_hist_raw
177 177 else:
178 178 hist = self.shell.input_hist
179 179
180 180 cmds = []
181 181 for chunk in slices:
182 182 if ':' in chunk:
183 183 ini,fin = map(int,chunk.split(':'))
184 184 elif '-' in chunk:
185 185 ini,fin = map(int,chunk.split('-'))
186 186 fin += 1
187 187 else:
188 188 ini = int(chunk)
189 189 fin = ini+1
190 190 cmds.append(hist[ini:fin])
191 191 return cmds
192 192
193 193 def _ofind(self, oname, namespaces=None):
194 194 """Find an object in the available namespaces.
195 195
196 196 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
197 197
198 198 Has special code to detect magic functions.
199 199 """
200 200
201 201 oname = oname.strip()
202 202
203 203 alias_ns = None
204 204 if namespaces is None:
205 205 # Namespaces to search in:
206 206 # Put them in a list. The order is important so that we
207 207 # find things in the same order that Python finds them.
208 208 namespaces = [ ('Interactive', self.shell.user_ns),
209 209 ('IPython internal', self.shell.internal_ns),
210 210 ('Python builtin', __builtin__.__dict__),
211 211 ('Alias', self.shell.alias_table),
212 212 ]
213 213 alias_ns = self.shell.alias_table
214 214
215 215 # initialize results to 'null'
216 216 found = 0; obj = None; ospace = None; ds = None;
217 217 ismagic = 0; isalias = 0; parent = None
218 218
219 219 # Look for the given name by splitting it in parts. If the head is
220 220 # found, then we look for all the remaining parts as members, and only
221 221 # declare success if we can find them all.
222 222 oname_parts = oname.split('.')
223 223 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
224 224 for nsname,ns in namespaces:
225 225 try:
226 226 obj = ns[oname_head]
227 227 except KeyError:
228 228 continue
229 229 else:
230 230 #print 'oname_rest:', oname_rest # dbg
231 231 for part in oname_rest:
232 232 try:
233 233 parent = obj
234 234 obj = getattr(obj,part)
235 235 except:
236 236 # Blanket except b/c some badly implemented objects
237 237 # allow __getattr__ to raise exceptions other than
238 238 # AttributeError, which then crashes IPython.
239 239 break
240 240 else:
241 241 # If we finish the for loop (no break), we got all members
242 242 found = 1
243 243 ospace = nsname
244 244 if ns == alias_ns:
245 245 isalias = 1
246 246 break # namespace loop
247 247
248 248 # Try to see if it's magic
249 249 if not found:
250 250 if oname.startswith(self.shell.ESC_MAGIC):
251 251 oname = oname[1:]
252 252 obj = getattr(self,'magic_'+oname,None)
253 253 if obj is not None:
254 254 found = 1
255 255 ospace = 'IPython internal'
256 256 ismagic = 1
257 257
258 258 # Last try: special-case some literals like '', [], {}, etc:
259 259 if not found and oname_head in ["''",'""','[]','{}','()']:
260 260 obj = eval(oname_head)
261 261 found = 1
262 262 ospace = 'Interactive'
263 263
264 264 return {'found':found, 'obj':obj, 'namespace':ospace,
265 265 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
266 266
267 267 def arg_err(self,func):
268 268 """Print docstring if incorrect arguments were passed"""
269 269 print 'Error in arguments:'
270 270 print OInspect.getdoc(func)
271 271
272 272 def format_latex(self,strng):
273 273 """Format a string for latex inclusion."""
274 274
275 275 # Characters that need to be escaped for latex:
276 276 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
277 277 # Magic command names as headers:
278 278 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
279 279 re.MULTILINE)
280 280 # Magic commands
281 281 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
282 282 re.MULTILINE)
283 283 # Paragraph continue
284 284 par_re = re.compile(r'\\$',re.MULTILINE)
285 285
286 286 # The "\n" symbol
287 287 newline_re = re.compile(r'\\n')
288 288
289 289 # Now build the string for output:
290 290 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
291 291 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
292 292 strng)
293 293 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
294 294 strng = par_re.sub(r'\\\\',strng)
295 295 strng = escape_re.sub(r'\\\1',strng)
296 296 strng = newline_re.sub(r'\\textbackslash{}n',strng)
297 297 return strng
298 298
299 299 def format_screen(self,strng):
300 300 """Format a string for screen printing.
301 301
302 302 This removes some latex-type format codes."""
303 303 # Paragraph continue
304 304 par_re = re.compile(r'\\$',re.MULTILINE)
305 305 strng = par_re.sub('',strng)
306 306 return strng
307 307
308 308 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
309 309 """Parse options passed to an argument string.
310 310
311 311 The interface is similar to that of getopt(), but it returns back a
312 312 Struct with the options as keys and the stripped argument string still
313 313 as a string.
314 314
315 315 arg_str is quoted as a true sys.argv vector by using shlex.split.
316 316 This allows us to easily expand variables, glob files, quote
317 317 arguments, etc.
318 318
319 319 Options:
320 320 -mode: default 'string'. If given as 'list', the argument string is
321 321 returned as a list (split on whitespace) instead of a string.
322 322
323 323 -list_all: put all option values in lists. Normally only options
324 324 appearing more than once are put in a list.
325 325
326 326 -posix (True): whether to split the input line in POSIX mode or not,
327 327 as per the conventions outlined in the shlex module from the
328 328 standard library."""
329 329
330 330 # inject default options at the beginning of the input line
331 331 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
332 332 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
333 333
334 334 mode = kw.get('mode','string')
335 335 if mode not in ['string','list']:
336 336 raise ValueError,'incorrect mode given: %s' % mode
337 337 # Get options
338 338 list_all = kw.get('list_all',0)
339 339 posix = kw.get('posix',True)
340 340
341 341 # Check if we have more than one argument to warrant extra processing:
342 342 odict = {} # Dictionary with options
343 343 args = arg_str.split()
344 344 if len(args) >= 1:
345 345 # If the list of inputs only has 0 or 1 thing in it, there's no
346 346 # need to look for options
347 347 argv = arg_split(arg_str,posix)
348 348 # Do regular option processing
349 349 try:
350 350 opts,args = getopt(argv,opt_str,*long_opts)
351 351 except GetoptError,e:
352 352 raise UsageError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
353 353 " ".join(long_opts)))
354 354 for o,a in opts:
355 355 if o.startswith('--'):
356 356 o = o[2:]
357 357 else:
358 358 o = o[1:]
359 359 try:
360 360 odict[o].append(a)
361 361 except AttributeError:
362 362 odict[o] = [odict[o],a]
363 363 except KeyError:
364 364 if list_all:
365 365 odict[o] = [a]
366 366 else:
367 367 odict[o] = a
368 368
369 369 # Prepare opts,args for return
370 370 opts = Struct(odict)
371 371 if mode == 'string':
372 372 args = ' '.join(args)
373 373
374 374 return opts,args
375 375
376 376 #......................................................................
377 377 # And now the actual magic functions
378 378
379 379 # Functions for IPython shell work (vars,funcs, config, etc)
380 380 def magic_lsmagic(self, parameter_s = ''):
381 381 """List currently available magic functions."""
382 382 mesc = self.shell.ESC_MAGIC
383 383 print 'Available magic functions:\n'+mesc+\
384 384 (' '+mesc).join(self.lsmagic())
385 385 print '\n' + Magic.auto_status[self.shell.rc.automagic]
386 386 return None
387 387
388 388 def magic_magic(self, parameter_s = ''):
389 389 """Print information about the magic function system."""
390 390
391 391 mode = ''
392 392 try:
393 393 if parameter_s.split()[0] == '-latex':
394 394 mode = 'latex'
395 395 if parameter_s.split()[0] == '-brief':
396 396 mode = 'brief'
397 397 except:
398 398 pass
399 399
400 400 magic_docs = []
401 401 for fname in self.lsmagic():
402 402 mname = 'magic_' + fname
403 403 for space in (Magic,self,self.__class__):
404 404 try:
405 405 fn = space.__dict__[mname]
406 406 except KeyError:
407 407 pass
408 408 else:
409 409 break
410 410 if mode == 'brief':
411 411 # only first line
412 412 fndoc = fn.__doc__.split('\n',1)[0]
413 413 else:
414 414 fndoc = fn.__doc__
415 415
416 416 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
417 417 fname,fndoc))
418 418 magic_docs = ''.join(magic_docs)
419 419
420 420 if mode == 'latex':
421 421 print self.format_latex(magic_docs)
422 422 return
423 423 else:
424 424 magic_docs = self.format_screen(magic_docs)
425 425 if mode == 'brief':
426 426 return magic_docs
427 427
428 428 outmsg = """
429 429 IPython's 'magic' functions
430 430 ===========================
431 431
432 432 The magic function system provides a series of functions which allow you to
433 433 control the behavior of IPython itself, plus a lot of system-type
434 434 features. All these functions are prefixed with a % character, but parameters
435 435 are given without parentheses or quotes.
436 436
437 437 NOTE: If you have 'automagic' enabled (via the command line option or with the
438 438 %automagic function), you don't need to type in the % explicitly. By default,
439 439 IPython ships with automagic on, so you should only rarely need the % escape.
440 440
441 441 Example: typing '%cd mydir' (without the quotes) changes you working directory
442 442 to 'mydir', if it exists.
443 443
444 444 You can define your own magic functions to extend the system. See the supplied
445 445 ipythonrc and example-magic.py files for details (in your ipython
446 446 configuration directory, typically $HOME/.ipython/).
447 447
448 448 You can also define your own aliased names for magic functions. In your
449 449 ipythonrc file, placing a line like:
450 450
451 451 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
452 452
453 453 will define %pf as a new name for %profile.
454 454
455 455 You can also call magics in code using the ipmagic() function, which IPython
456 456 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
457 457
458 458 For a list of the available magic functions, use %lsmagic. For a description
459 459 of any of them, type %magic_name?, e.g. '%cd?'.
460 460
461 461 Currently the magic system has the following functions:\n"""
462 462
463 463 mesc = self.shell.ESC_MAGIC
464 464 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
465 465 "\n\n%s%s\n\n%s" % (outmsg,
466 466 magic_docs,mesc,mesc,
467 467 (' '+mesc).join(self.lsmagic()),
468 468 Magic.auto_status[self.shell.rc.automagic] ) )
469 469
470 470 page(outmsg,screen_lines=self.shell.rc.screen_length)
471 471
472 472
473 473 def magic_autoindent(self, parameter_s = ''):
474 474 """Toggle autoindent on/off (if available)."""
475 475
476 476 self.shell.set_autoindent()
477 477 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
478 478
479 479
480 480 def magic_automagic(self, parameter_s = ''):
481 481 """Make magic functions callable without having to type the initial %.
482 482
483 483 Without argumentsl toggles on/off (when off, you must call it as
484 484 %automagic, of course). With arguments it sets the value, and you can
485 485 use any of (case insensitive):
486 486
487 487 - on,1,True: to activate
488 488
489 489 - off,0,False: to deactivate.
490 490
491 491 Note that magic functions have lowest priority, so if there's a
492 492 variable whose name collides with that of a magic fn, automagic won't
493 493 work for that function (you get the variable instead). However, if you
494 494 delete the variable (del var), the previously shadowed magic function
495 495 becomes visible to automagic again."""
496 496
497 497 rc = self.shell.rc
498 498 arg = parameter_s.lower()
499 499 if parameter_s in ('on','1','true'):
500 500 rc.automagic = True
501 501 elif parameter_s in ('off','0','false'):
502 502 rc.automagic = False
503 503 else:
504 504 rc.automagic = not rc.automagic
505 505 print '\n' + Magic.auto_status[rc.automagic]
506 506
507 507
508 508 def magic_autocall(self, parameter_s = ''):
509 509 """Make functions callable without having to type parentheses.
510 510
511 511 Usage:
512 512
513 513 %autocall [mode]
514 514
515 515 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
516 516 value is toggled on and off (remembering the previous state).
517 517
518 518 In more detail, these values mean:
519 519
520 520 0 -> fully disabled
521 521
522 522 1 -> active, but do not apply if there are no arguments on the line.
523 523
524 524 In this mode, you get:
525 525
526 526 In [1]: callable
527 527 Out[1]: <built-in function callable>
528 528
529 529 In [2]: callable 'hello'
530 530 ------> callable('hello')
531 531 Out[2]: False
532 532
533 533 2 -> Active always. Even if no arguments are present, the callable
534 534 object is called:
535 535
536 536 In [4]: callable
537 537 ------> callable()
538 538
539 539 Note that even with autocall off, you can still use '/' at the start of
540 540 a line to treat the first argument on the command line as a function
541 541 and add parentheses to it:
542 542
543 543 In [8]: /str 43
544 544 ------> str(43)
545 545 Out[8]: '43'
546 546 """
547 547
548 548 rc = self.shell.rc
549 549
550 550 if parameter_s:
551 551 arg = int(parameter_s)
552 552 else:
553 553 arg = 'toggle'
554 554
555 555 if not arg in (0,1,2,'toggle'):
556 556 error('Valid modes: (0->Off, 1->Smart, 2->Full')
557 557 return
558 558
559 559 if arg in (0,1,2):
560 560 rc.autocall = arg
561 561 else: # toggle
562 562 if rc.autocall:
563 563 self._magic_state.autocall_save = rc.autocall
564 564 rc.autocall = 0
565 565 else:
566 566 try:
567 567 rc.autocall = self._magic_state.autocall_save
568 568 except AttributeError:
569 569 rc.autocall = self._magic_state.autocall_save = 1
570 570
571 571 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
572 572
573 573 def magic_system_verbose(self, parameter_s = ''):
574 574 """Set verbose printing of system calls.
575 575
576 576 If called without an argument, act as a toggle"""
577 577
578 578 if parameter_s:
579 579 val = bool(eval(parameter_s))
580 580 else:
581 581 val = None
582 582
583 583 self.shell.rc_set_toggle('system_verbose',val)
584 584 print "System verbose printing is:",\
585 585 ['OFF','ON'][self.shell.rc.system_verbose]
586 586
587 587
588 588 def magic_page(self, parameter_s=''):
589 589 """Pretty print the object and display it through a pager.
590 590
591 591 %page [options] OBJECT
592 592
593 593 If no object is given, use _ (last output).
594 594
595 595 Options:
596 596
597 597 -r: page str(object), don't pretty-print it."""
598 598
599 599 # After a function contributed by Olivier Aubert, slightly modified.
600 600
601 601 # Process options/args
602 602 opts,args = self.parse_options(parameter_s,'r')
603 603 raw = 'r' in opts
604 604
605 605 oname = args and args or '_'
606 606 info = self._ofind(oname)
607 607 if info['found']:
608 608 txt = (raw and str or pformat)( info['obj'] )
609 609 page(txt)
610 610 else:
611 611 print 'Object `%s` not found' % oname
612 612
613 613 def magic_profile(self, parameter_s=''):
614 614 """Print your currently active IPyhton profile."""
615 615 if self.shell.rc.profile:
616 616 printpl('Current IPython profile: $self.shell.rc.profile.')
617 617 else:
618 618 print 'No profile active.'
619 619
620 620 def magic_pinfo(self, parameter_s='', namespaces=None):
621 621 """Provide detailed information about an object.
622 622
623 623 '%pinfo object' is just a synonym for object? or ?object."""
624 624
625 625 #print 'pinfo par: <%s>' % parameter_s # dbg
626 626
627 627
628 628 # detail_level: 0 -> obj? , 1 -> obj??
629 629 detail_level = 0
630 630 # We need to detect if we got called as 'pinfo pinfo foo', which can
631 631 # happen if the user types 'pinfo foo?' at the cmd line.
632 632 pinfo,qmark1,oname,qmark2 = \
633 633 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
634 634 if pinfo or qmark1 or qmark2:
635 635 detail_level = 1
636 636 if "*" in oname:
637 637 self.magic_psearch(oname)
638 638 else:
639 639 self._inspect('pinfo', oname, detail_level=detail_level,
640 640 namespaces=namespaces)
641 641
642 642 def magic_pdef(self, parameter_s='', namespaces=None):
643 643 """Print the definition header for any callable object.
644 644
645 645 If the object is a class, print the constructor information."""
646 646 self._inspect('pdef',parameter_s, namespaces)
647 647
648 648 def magic_pdoc(self, parameter_s='', namespaces=None):
649 649 """Print the docstring for an object.
650 650
651 651 If the given object is a class, it will print both the class and the
652 652 constructor docstrings."""
653 653 self._inspect('pdoc',parameter_s, namespaces)
654 654
655 655 def magic_psource(self, parameter_s='', namespaces=None):
656 656 """Print (or run through pager) the source code for an object."""
657 657 self._inspect('psource',parameter_s, namespaces)
658 658
659 659 def magic_pfile(self, parameter_s=''):
660 660 """Print (or run through pager) the file where an object is defined.
661 661
662 662 The file opens at the line where the object definition begins. IPython
663 663 will honor the environment variable PAGER if set, and otherwise will
664 664 do its best to print the file in a convenient form.
665 665
666 666 If the given argument is not an object currently defined, IPython will
667 667 try to interpret it as a filename (automatically adding a .py extension
668 668 if needed). You can thus use %pfile as a syntax highlighting code
669 669 viewer."""
670 670
671 671 # first interpret argument as an object name
672 672 out = self._inspect('pfile',parameter_s)
673 673 # if not, try the input as a filename
674 674 if out == 'not found':
675 675 try:
676 676 filename = get_py_filename(parameter_s)
677 677 except IOError,msg:
678 678 print msg
679 679 return
680 680 page(self.shell.inspector.format(file(filename).read()))
681 681
682 682 def _inspect(self,meth,oname,namespaces=None,**kw):
683 683 """Generic interface to the inspector system.
684 684
685 685 This function is meant to be called by pdef, pdoc & friends."""
686 686
687 687 #oname = oname.strip()
688 688 #print '1- oname: <%r>' % oname # dbg
689 689 try:
690 690 oname = oname.strip().encode('ascii')
691 691 #print '2- oname: <%r>' % oname # dbg
692 692 except UnicodeEncodeError:
693 693 print 'Python identifiers can only contain ascii characters.'
694 694 return 'not found'
695 695
696 696 info = Struct(self._ofind(oname, namespaces))
697 697
698 698 if info.found:
699 699 try:
700 700 IPython.generics.inspect_object(info.obj)
701 701 return
702 702 except IPython.ipapi.TryNext:
703 703 pass
704 704 # Get the docstring of the class property if it exists.
705 705 path = oname.split('.')
706 706 root = '.'.join(path[:-1])
707 707 if info.parent is not None:
708 708 try:
709 709 target = getattr(info.parent, '__class__')
710 710 # The object belongs to a class instance.
711 711 try:
712 712 target = getattr(target, path[-1])
713 713 # The class defines the object.
714 714 if isinstance(target, property):
715 715 oname = root + '.__class__.' + path[-1]
716 716 info = Struct(self._ofind(oname))
717 717 except AttributeError: pass
718 718 except AttributeError: pass
719 719
720 720 pmethod = getattr(self.shell.inspector,meth)
721 721 formatter = info.ismagic and self.format_screen or None
722 722 if meth == 'pdoc':
723 723 pmethod(info.obj,oname,formatter)
724 724 elif meth == 'pinfo':
725 725 pmethod(info.obj,oname,formatter,info,**kw)
726 726 else:
727 727 pmethod(info.obj,oname)
728 728 else:
729 729 print 'Object `%s` not found.' % oname
730 730 return 'not found' # so callers can take other action
731 731
732 732 def magic_psearch(self, parameter_s=''):
733 733 """Search for object in namespaces by wildcard.
734 734
735 735 %psearch [options] PATTERN [OBJECT TYPE]
736 736
737 737 Note: ? can be used as a synonym for %psearch, at the beginning or at
738 738 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
739 739 rest of the command line must be unchanged (options come first), so
740 740 for example the following forms are equivalent
741 741
742 742 %psearch -i a* function
743 743 -i a* function?
744 744 ?-i a* function
745 745
746 746 Arguments:
747 747
748 748 PATTERN
749 749
750 750 where PATTERN is a string containing * as a wildcard similar to its
751 751 use in a shell. The pattern is matched in all namespaces on the
752 752 search path. By default objects starting with a single _ are not
753 753 matched, many IPython generated objects have a single
754 754 underscore. The default is case insensitive matching. Matching is
755 755 also done on the attributes of objects and not only on the objects
756 756 in a module.
757 757
758 758 [OBJECT TYPE]
759 759
760 760 Is the name of a python type from the types module. The name is
761 761 given in lowercase without the ending type, ex. StringType is
762 762 written string. By adding a type here only objects matching the
763 763 given type are matched. Using all here makes the pattern match all
764 764 types (this is the default).
765 765
766 766 Options:
767 767
768 768 -a: makes the pattern match even objects whose names start with a
769 769 single underscore. These names are normally ommitted from the
770 770 search.
771 771
772 772 -i/-c: make the pattern case insensitive/sensitive. If neither of
773 773 these options is given, the default is read from your ipythonrc
774 774 file. The option name which sets this value is
775 775 'wildcards_case_sensitive'. If this option is not specified in your
776 776 ipythonrc file, IPython's internal default is to do a case sensitive
777 777 search.
778 778
779 779 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
780 780 specifiy can be searched in any of the following namespaces:
781 781 'builtin', 'user', 'user_global','internal', 'alias', where
782 782 'builtin' and 'user' are the search defaults. Note that you should
783 783 not use quotes when specifying namespaces.
784 784
785 785 'Builtin' contains the python module builtin, 'user' contains all
786 786 user data, 'alias' only contain the shell aliases and no python
787 787 objects, 'internal' contains objects used by IPython. The
788 788 'user_global' namespace is only used by embedded IPython instances,
789 789 and it contains module-level globals. You can add namespaces to the
790 790 search with -s or exclude them with -e (these options can be given
791 791 more than once).
792 792
793 793 Examples:
794 794
795 795 %psearch a* -> objects beginning with an a
796 796 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
797 797 %psearch a* function -> all functions beginning with an a
798 798 %psearch re.e* -> objects beginning with an e in module re
799 799 %psearch r*.e* -> objects that start with e in modules starting in r
800 800 %psearch r*.* string -> all strings in modules beginning with r
801 801
802 802 Case sensitve search:
803 803
804 804 %psearch -c a* list all object beginning with lower case a
805 805
806 806 Show objects beginning with a single _:
807 807
808 808 %psearch -a _* list objects beginning with a single underscore"""
809 809 try:
810 810 parameter_s = parameter_s.encode('ascii')
811 811 except UnicodeEncodeError:
812 812 print 'Python identifiers can only contain ascii characters.'
813 813 return
814 814
815 815 # default namespaces to be searched
816 816 def_search = ['user','builtin']
817 817
818 818 # Process options/args
819 819 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
820 820 opt = opts.get
821 821 shell = self.shell
822 822 psearch = shell.inspector.psearch
823 823
824 824 # select case options
825 825 if opts.has_key('i'):
826 826 ignore_case = True
827 827 elif opts.has_key('c'):
828 828 ignore_case = False
829 829 else:
830 830 ignore_case = not shell.rc.wildcards_case_sensitive
831 831
832 832 # Build list of namespaces to search from user options
833 833 def_search.extend(opt('s',[]))
834 834 ns_exclude = ns_exclude=opt('e',[])
835 835 ns_search = [nm for nm in def_search if nm not in ns_exclude]
836 836
837 837 # Call the actual search
838 838 try:
839 839 psearch(args,shell.ns_table,ns_search,
840 840 show_all=opt('a'),ignore_case=ignore_case)
841 841 except:
842 842 shell.showtraceback()
843 843
844 844 def magic_who_ls(self, parameter_s=''):
845 845 """Return a sorted list of all interactive variables.
846 846
847 847 If arguments are given, only variables of types matching these
848 848 arguments are returned."""
849 849
850 850 user_ns = self.shell.user_ns
851 851 internal_ns = self.shell.internal_ns
852 852 user_config_ns = self.shell.user_config_ns
853 853 out = []
854 854 typelist = parameter_s.split()
855 855
856 856 for i in user_ns:
857 857 if not (i.startswith('_') or i.startswith('_i')) \
858 858 and not (i in internal_ns or i in user_config_ns):
859 859 if typelist:
860 860 if type(user_ns[i]).__name__ in typelist:
861 861 out.append(i)
862 862 else:
863 863 out.append(i)
864 864 out.sort()
865 865 return out
866 866
867 867 def magic_who(self, parameter_s=''):
868 868 """Print all interactive variables, with some minimal formatting.
869 869
870 870 If any arguments are given, only variables whose type matches one of
871 871 these are printed. For example:
872 872
873 873 %who function str
874 874
875 875 will only list functions and strings, excluding all other types of
876 876 variables. To find the proper type names, simply use type(var) at a
877 877 command line to see how python prints type names. For example:
878 878
879 879 In [1]: type('hello')\\
880 880 Out[1]: <type 'str'>
881 881
882 882 indicates that the type name for strings is 'str'.
883 883
884 884 %who always excludes executed names loaded through your configuration
885 885 file and things which are internal to IPython.
886 886
887 887 This is deliberate, as typically you may load many modules and the
888 888 purpose of %who is to show you only what you've manually defined."""
889 889
890 890 varlist = self.magic_who_ls(parameter_s)
891 891 if not varlist:
892 892 if parameter_s:
893 893 print 'No variables match your requested type.'
894 894 else:
895 895 print 'Interactive namespace is empty.'
896 896 return
897 897
898 898 # if we have variables, move on...
899 899 count = 0
900 900 for i in varlist:
901 901 print i+'\t',
902 902 count += 1
903 903 if count > 8:
904 904 count = 0
905 905 print
906 906 print
907 907
908 908 def magic_whos(self, parameter_s=''):
909 909 """Like %who, but gives some extra information about each variable.
910 910
911 911 The same type filtering of %who can be applied here.
912 912
913 913 For all variables, the type is printed. Additionally it prints:
914 914
915 915 - For {},[],(): their length.
916 916
917 917 - For numpy and Numeric arrays, a summary with shape, number of
918 918 elements, typecode and size in memory.
919 919
920 920 - Everything else: a string representation, snipping their middle if
921 921 too long."""
922 922
923 923 varnames = self.magic_who_ls(parameter_s)
924 924 if not varnames:
925 925 if parameter_s:
926 926 print 'No variables match your requested type.'
927 927 else:
928 928 print 'Interactive namespace is empty.'
929 929 return
930 930
931 931 # if we have variables, move on...
932 932
933 933 # for these types, show len() instead of data:
934 934 seq_types = [types.DictType,types.ListType,types.TupleType]
935 935
936 936 # for numpy/Numeric arrays, display summary info
937 937 try:
938 938 import numpy
939 939 except ImportError:
940 940 ndarray_type = None
941 941 else:
942 942 ndarray_type = numpy.ndarray.__name__
943 943 try:
944 944 import Numeric
945 945 except ImportError:
946 946 array_type = None
947 947 else:
948 948 array_type = Numeric.ArrayType.__name__
949 949
950 950 # Find all variable names and types so we can figure out column sizes
951 951 def get_vars(i):
952 952 return self.shell.user_ns[i]
953 953
954 954 # some types are well known and can be shorter
955 955 abbrevs = {'IPython.macro.Macro' : 'Macro'}
956 956 def type_name(v):
957 957 tn = type(v).__name__
958 958 return abbrevs.get(tn,tn)
959 959
960 960 varlist = map(get_vars,varnames)
961 961
962 962 typelist = []
963 963 for vv in varlist:
964 964 tt = type_name(vv)
965 965
966 966 if tt=='instance':
967 967 typelist.append( abbrevs.get(str(vv.__class__),
968 968 str(vv.__class__)))
969 969 else:
970 970 typelist.append(tt)
971 971
972 972 # column labels and # of spaces as separator
973 973 varlabel = 'Variable'
974 974 typelabel = 'Type'
975 975 datalabel = 'Data/Info'
976 976 colsep = 3
977 977 # variable format strings
978 978 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
979 979 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
980 980 aformat = "%s: %s elems, type `%s`, %s bytes"
981 981 # find the size of the columns to format the output nicely
982 982 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
983 983 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
984 984 # table header
985 985 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
986 986 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
987 987 # and the table itself
988 988 kb = 1024
989 989 Mb = 1048576 # kb**2
990 990 for vname,var,vtype in zip(varnames,varlist,typelist):
991 991 print itpl(vformat),
992 992 if vtype in seq_types:
993 993 print len(var)
994 994 elif vtype in [array_type,ndarray_type]:
995 995 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
996 996 if vtype==ndarray_type:
997 997 # numpy
998 998 vsize = var.size
999 999 vbytes = vsize*var.itemsize
1000 1000 vdtype = var.dtype
1001 1001 else:
1002 1002 # Numeric
1003 1003 vsize = Numeric.size(var)
1004 1004 vbytes = vsize*var.itemsize()
1005 1005 vdtype = var.typecode()
1006 1006
1007 1007 if vbytes < 100000:
1008 1008 print aformat % (vshape,vsize,vdtype,vbytes)
1009 1009 else:
1010 1010 print aformat % (vshape,vsize,vdtype,vbytes),
1011 1011 if vbytes < Mb:
1012 1012 print '(%s kb)' % (vbytes/kb,)
1013 1013 else:
1014 1014 print '(%s Mb)' % (vbytes/Mb,)
1015 1015 else:
1016 1016 try:
1017 1017 vstr = str(var)
1018 1018 except UnicodeEncodeError:
1019 1019 vstr = unicode(var).encode(sys.getdefaultencoding(),
1020 1020 'backslashreplace')
1021 1021 vstr = vstr.replace('\n','\\n')
1022 1022 if len(vstr) < 50:
1023 1023 print vstr
1024 1024 else:
1025 1025 printpl(vfmt_short)
1026 1026
1027 1027 def magic_reset(self, parameter_s=''):
1028 1028 """Resets the namespace by removing all names defined by the user.
1029 1029
1030 1030 Input/Output history are left around in case you need them."""
1031 1031
1032 1032 ans = self.shell.ask_yes_no(
1033 1033 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1034 1034 if not ans:
1035 1035 print 'Nothing done.'
1036 1036 return
1037 1037 user_ns = self.shell.user_ns
1038 1038 for i in self.magic_who_ls():
1039 1039 del(user_ns[i])
1040 1040
1041 1041 # Also flush the private list of module references kept for script
1042 1042 # execution protection
1043 1043 self.shell._user_main_modules[:] = []
1044 1044
1045 1045 def magic_logstart(self,parameter_s=''):
1046 1046 """Start logging anywhere in a session.
1047 1047
1048 1048 %logstart [-o|-r|-t] [log_name [log_mode]]
1049 1049
1050 1050 If no name is given, it defaults to a file named 'ipython_log.py' in your
1051 1051 current directory, in 'rotate' mode (see below).
1052 1052
1053 1053 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1054 1054 history up to that point and then continues logging.
1055 1055
1056 1056 %logstart takes a second optional parameter: logging mode. This can be one
1057 1057 of (note that the modes are given unquoted):\\
1058 1058 append: well, that says it.\\
1059 1059 backup: rename (if exists) to name~ and start name.\\
1060 1060 global: single logfile in your home dir, appended to.\\
1061 1061 over : overwrite existing log.\\
1062 1062 rotate: create rotating logs name.1~, name.2~, etc.
1063 1063
1064 1064 Options:
1065 1065
1066 1066 -o: log also IPython's output. In this mode, all commands which
1067 1067 generate an Out[NN] prompt are recorded to the logfile, right after
1068 1068 their corresponding input line. The output lines are always
1069 1069 prepended with a '#[Out]# ' marker, so that the log remains valid
1070 1070 Python code.
1071 1071
1072 1072 Since this marker is always the same, filtering only the output from
1073 1073 a log is very easy, using for example a simple awk call:
1074 1074
1075 1075 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1076 1076
1077 1077 -r: log 'raw' input. Normally, IPython's logs contain the processed
1078 1078 input, so that user lines are logged in their final form, converted
1079 1079 into valid Python. For example, %Exit is logged as
1080 1080 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1081 1081 exactly as typed, with no transformations applied.
1082 1082
1083 1083 -t: put timestamps before each input line logged (these are put in
1084 1084 comments)."""
1085 1085
1086 1086 opts,par = self.parse_options(parameter_s,'ort')
1087 1087 log_output = 'o' in opts
1088 1088 log_raw_input = 'r' in opts
1089 1089 timestamp = 't' in opts
1090 1090
1091 1091 rc = self.shell.rc
1092 1092 logger = self.shell.logger
1093 1093
1094 1094 # if no args are given, the defaults set in the logger constructor by
1095 1095 # ipytohn remain valid
1096 1096 if par:
1097 1097 try:
1098 1098 logfname,logmode = par.split()
1099 1099 except:
1100 1100 logfname = par
1101 1101 logmode = 'backup'
1102 1102 else:
1103 1103 logfname = logger.logfname
1104 1104 logmode = logger.logmode
1105 1105 # put logfname into rc struct as if it had been called on the command
1106 1106 # line, so it ends up saved in the log header Save it in case we need
1107 1107 # to restore it...
1108 1108 old_logfile = rc.opts.get('logfile','')
1109 1109 if logfname:
1110 1110 logfname = os.path.expanduser(logfname)
1111 1111 rc.opts.logfile = logfname
1112 1112 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1113 1113 try:
1114 1114 started = logger.logstart(logfname,loghead,logmode,
1115 1115 log_output,timestamp,log_raw_input)
1116 1116 except:
1117 1117 rc.opts.logfile = old_logfile
1118 1118 warn("Couldn't start log: %s" % sys.exc_info()[1])
1119 1119 else:
1120 1120 # log input history up to this point, optionally interleaving
1121 1121 # output if requested
1122 1122
1123 1123 if timestamp:
1124 1124 # disable timestamping for the previous history, since we've
1125 1125 # lost those already (no time machine here).
1126 1126 logger.timestamp = False
1127 1127
1128 1128 if log_raw_input:
1129 1129 input_hist = self.shell.input_hist_raw
1130 1130 else:
1131 1131 input_hist = self.shell.input_hist
1132 1132
1133 1133 if log_output:
1134 1134 log_write = logger.log_write
1135 1135 output_hist = self.shell.output_hist
1136 1136 for n in range(1,len(input_hist)-1):
1137 1137 log_write(input_hist[n].rstrip())
1138 1138 if n in output_hist:
1139 1139 log_write(repr(output_hist[n]),'output')
1140 1140 else:
1141 1141 logger.log_write(input_hist[1:])
1142 1142 if timestamp:
1143 1143 # re-enable timestamping
1144 1144 logger.timestamp = True
1145 1145
1146 1146 print ('Activating auto-logging. '
1147 1147 'Current session state plus future input saved.')
1148 1148 logger.logstate()
1149 1149
1150 def magic_logstop(self,parameter_s=''):
1151 """Fully stop logging and close log file.
1152
1153 In order to start logging again, a new %logstart call needs to be made,
1154 possibly (though not necessarily) with a new filename, mode and other
1155 options."""
1156 self.logger.logstop()
1157
1150 1158 def magic_logoff(self,parameter_s=''):
1151 1159 """Temporarily stop logging.
1152 1160
1153 1161 You must have previously started logging."""
1154 1162 self.shell.logger.switch_log(0)
1155 1163
1156 1164 def magic_logon(self,parameter_s=''):
1157 1165 """Restart logging.
1158 1166
1159 1167 This function is for restarting logging which you've temporarily
1160 1168 stopped with %logoff. For starting logging for the first time, you
1161 1169 must use the %logstart function, which allows you to specify an
1162 1170 optional log filename."""
1163 1171
1164 1172 self.shell.logger.switch_log(1)
1165 1173
1166 1174 def magic_logstate(self,parameter_s=''):
1167 1175 """Print the status of the logging system."""
1168 1176
1169 1177 self.shell.logger.logstate()
1170 1178
1171 1179 def magic_pdb(self, parameter_s=''):
1172 1180 """Control the automatic calling of the pdb interactive debugger.
1173 1181
1174 1182 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1175 1183 argument it works as a toggle.
1176 1184
1177 1185 When an exception is triggered, IPython can optionally call the
1178 1186 interactive pdb debugger after the traceback printout. %pdb toggles
1179 1187 this feature on and off.
1180 1188
1181 1189 The initial state of this feature is set in your ipythonrc
1182 1190 configuration file (the variable is called 'pdb').
1183 1191
1184 1192 If you want to just activate the debugger AFTER an exception has fired,
1185 1193 without having to type '%pdb on' and rerunning your code, you can use
1186 1194 the %debug magic."""
1187 1195
1188 1196 par = parameter_s.strip().lower()
1189 1197
1190 1198 if par:
1191 1199 try:
1192 1200 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1193 1201 except KeyError:
1194 1202 print ('Incorrect argument. Use on/1, off/0, '
1195 1203 'or nothing for a toggle.')
1196 1204 return
1197 1205 else:
1198 1206 # toggle
1199 1207 new_pdb = not self.shell.call_pdb
1200 1208
1201 1209 # set on the shell
1202 1210 self.shell.call_pdb = new_pdb
1203 1211 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1204 1212
1205 1213 def magic_debug(self, parameter_s=''):
1206 1214 """Activate the interactive debugger in post-mortem mode.
1207 1215
1208 1216 If an exception has just occurred, this lets you inspect its stack
1209 1217 frames interactively. Note that this will always work only on the last
1210 1218 traceback that occurred, so you must call this quickly after an
1211 1219 exception that you wish to inspect has fired, because if another one
1212 1220 occurs, it clobbers the previous one.
1213 1221
1214 1222 If you want IPython to automatically do this on every exception, see
1215 1223 the %pdb magic for more details.
1216 1224 """
1217 1225
1218 1226 self.shell.debugger(force=True)
1219 1227
1220 1228 def magic_prun(self, parameter_s ='',user_mode=1,
1221 1229 opts=None,arg_lst=None,prog_ns=None):
1222 1230
1223 1231 """Run a statement through the python code profiler.
1224 1232
1225 1233 Usage:\\
1226 1234 %prun [options] statement
1227 1235
1228 1236 The given statement (which doesn't require quote marks) is run via the
1229 1237 python profiler in a manner similar to the profile.run() function.
1230 1238 Namespaces are internally managed to work correctly; profile.run
1231 1239 cannot be used in IPython because it makes certain assumptions about
1232 1240 namespaces which do not hold under IPython.
1233 1241
1234 1242 Options:
1235 1243
1236 1244 -l <limit>: you can place restrictions on what or how much of the
1237 1245 profile gets printed. The limit value can be:
1238 1246
1239 1247 * A string: only information for function names containing this string
1240 1248 is printed.
1241 1249
1242 1250 * An integer: only these many lines are printed.
1243 1251
1244 1252 * A float (between 0 and 1): this fraction of the report is printed
1245 1253 (for example, use a limit of 0.4 to see the topmost 40% only).
1246 1254
1247 1255 You can combine several limits with repeated use of the option. For
1248 1256 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1249 1257 information about class constructors.
1250 1258
1251 1259 -r: return the pstats.Stats object generated by the profiling. This
1252 1260 object has all the information about the profile in it, and you can
1253 1261 later use it for further analysis or in other functions.
1254 1262
1255 1263 -s <key>: sort profile by given key. You can provide more than one key
1256 1264 by using the option several times: '-s key1 -s key2 -s key3...'. The
1257 1265 default sorting key is 'time'.
1258 1266
1259 1267 The following is copied verbatim from the profile documentation
1260 1268 referenced below:
1261 1269
1262 1270 When more than one key is provided, additional keys are used as
1263 1271 secondary criteria when the there is equality in all keys selected
1264 1272 before them.
1265 1273
1266 1274 Abbreviations can be used for any key names, as long as the
1267 1275 abbreviation is unambiguous. The following are the keys currently
1268 1276 defined:
1269 1277
1270 1278 Valid Arg Meaning\\
1271 1279 "calls" call count\\
1272 1280 "cumulative" cumulative time\\
1273 1281 "file" file name\\
1274 1282 "module" file name\\
1275 1283 "pcalls" primitive call count\\
1276 1284 "line" line number\\
1277 1285 "name" function name\\
1278 1286 "nfl" name/file/line\\
1279 1287 "stdname" standard name\\
1280 1288 "time" internal time
1281 1289
1282 1290 Note that all sorts on statistics are in descending order (placing
1283 1291 most time consuming items first), where as name, file, and line number
1284 1292 searches are in ascending order (i.e., alphabetical). The subtle
1285 1293 distinction between "nfl" and "stdname" is that the standard name is a
1286 1294 sort of the name as printed, which means that the embedded line
1287 1295 numbers get compared in an odd way. For example, lines 3, 20, and 40
1288 1296 would (if the file names were the same) appear in the string order
1289 1297 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1290 1298 line numbers. In fact, sort_stats("nfl") is the same as
1291 1299 sort_stats("name", "file", "line").
1292 1300
1293 1301 -T <filename>: save profile results as shown on screen to a text
1294 1302 file. The profile is still shown on screen.
1295 1303
1296 1304 -D <filename>: save (via dump_stats) profile statistics to given
1297 1305 filename. This data is in a format understod by the pstats module, and
1298 1306 is generated by a call to the dump_stats() method of profile
1299 1307 objects. The profile is still shown on screen.
1300 1308
1301 1309 If you want to run complete programs under the profiler's control, use
1302 1310 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1303 1311 contains profiler specific options as described here.
1304 1312
1305 1313 You can read the complete documentation for the profile module with:\\
1306 1314 In [1]: import profile; profile.help() """
1307 1315
1308 1316 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1309 1317 # protect user quote marks
1310 1318 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1311 1319
1312 1320 if user_mode: # regular user call
1313 1321 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1314 1322 list_all=1)
1315 1323 namespace = self.shell.user_ns
1316 1324 else: # called to run a program by %run -p
1317 1325 try:
1318 1326 filename = get_py_filename(arg_lst[0])
1319 1327 except IOError,msg:
1320 1328 error(msg)
1321 1329 return
1322 1330
1323 1331 arg_str = 'execfile(filename,prog_ns)'
1324 1332 namespace = locals()
1325 1333
1326 1334 opts.merge(opts_def)
1327 1335
1328 1336 prof = profile.Profile()
1329 1337 try:
1330 1338 prof = prof.runctx(arg_str,namespace,namespace)
1331 1339 sys_exit = ''
1332 1340 except SystemExit:
1333 1341 sys_exit = """*** SystemExit exception caught in code being profiled."""
1334 1342
1335 1343 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1336 1344
1337 1345 lims = opts.l
1338 1346 if lims:
1339 1347 lims = [] # rebuild lims with ints/floats/strings
1340 1348 for lim in opts.l:
1341 1349 try:
1342 1350 lims.append(int(lim))
1343 1351 except ValueError:
1344 1352 try:
1345 1353 lims.append(float(lim))
1346 1354 except ValueError:
1347 1355 lims.append(lim)
1348 1356
1349 1357 # Trap output.
1350 1358 stdout_trap = StringIO()
1351 1359
1352 1360 if hasattr(stats,'stream'):
1353 1361 # In newer versions of python, the stats object has a 'stream'
1354 1362 # attribute to write into.
1355 1363 stats.stream = stdout_trap
1356 1364 stats.print_stats(*lims)
1357 1365 else:
1358 1366 # For older versions, we manually redirect stdout during printing
1359 1367 sys_stdout = sys.stdout
1360 1368 try:
1361 1369 sys.stdout = stdout_trap
1362 1370 stats.print_stats(*lims)
1363 1371 finally:
1364 1372 sys.stdout = sys_stdout
1365 1373
1366 1374 output = stdout_trap.getvalue()
1367 1375 output = output.rstrip()
1368 1376
1369 1377 page(output,screen_lines=self.shell.rc.screen_length)
1370 1378 print sys_exit,
1371 1379
1372 1380 dump_file = opts.D[0]
1373 1381 text_file = opts.T[0]
1374 1382 if dump_file:
1375 1383 prof.dump_stats(dump_file)
1376 1384 print '\n*** Profile stats marshalled to file',\
1377 1385 `dump_file`+'.',sys_exit
1378 1386 if text_file:
1379 1387 pfile = file(text_file,'w')
1380 1388 pfile.write(output)
1381 1389 pfile.close()
1382 1390 print '\n*** Profile printout saved to text file',\
1383 1391 `text_file`+'.',sys_exit
1384 1392
1385 1393 if opts.has_key('r'):
1386 1394 return stats
1387 1395 else:
1388 1396 return None
1389 1397
1390 1398 def magic_run(self, parameter_s ='',runner=None):
1391 1399 """Run the named file inside IPython as a program.
1392 1400
1393 1401 Usage:\\
1394 1402 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1395 1403
1396 1404 Parameters after the filename are passed as command-line arguments to
1397 1405 the program (put in sys.argv). Then, control returns to IPython's
1398 1406 prompt.
1399 1407
1400 1408 This is similar to running at a system prompt:\\
1401 1409 $ python file args\\
1402 1410 but with the advantage of giving you IPython's tracebacks, and of
1403 1411 loading all variables into your interactive namespace for further use
1404 1412 (unless -p is used, see below).
1405 1413
1406 1414 The file is executed in a namespace initially consisting only of
1407 1415 __name__=='__main__' and sys.argv constructed as indicated. It thus
1408 1416 sees its environment as if it were being run as a stand-alone program
1409 1417 (except for sharing global objects such as previously imported
1410 1418 modules). But after execution, the IPython interactive namespace gets
1411 1419 updated with all variables defined in the program (except for __name__
1412 1420 and sys.argv). This allows for very convenient loading of code for
1413 1421 interactive work, while giving each program a 'clean sheet' to run in.
1414 1422
1415 1423 Options:
1416 1424
1417 1425 -n: __name__ is NOT set to '__main__', but to the running file's name
1418 1426 without extension (as python does under import). This allows running
1419 1427 scripts and reloading the definitions in them without calling code
1420 1428 protected by an ' if __name__ == "__main__" ' clause.
1421 1429
1422 1430 -i: run the file in IPython's namespace instead of an empty one. This
1423 1431 is useful if you are experimenting with code written in a text editor
1424 1432 which depends on variables defined interactively.
1425 1433
1426 1434 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1427 1435 being run. This is particularly useful if IPython is being used to
1428 1436 run unittests, which always exit with a sys.exit() call. In such
1429 1437 cases you are interested in the output of the test results, not in
1430 1438 seeing a traceback of the unittest module.
1431 1439
1432 1440 -t: print timing information at the end of the run. IPython will give
1433 1441 you an estimated CPU time consumption for your script, which under
1434 1442 Unix uses the resource module to avoid the wraparound problems of
1435 1443 time.clock(). Under Unix, an estimate of time spent on system tasks
1436 1444 is also given (for Windows platforms this is reported as 0.0).
1437 1445
1438 1446 If -t is given, an additional -N<N> option can be given, where <N>
1439 1447 must be an integer indicating how many times you want the script to
1440 1448 run. The final timing report will include total and per run results.
1441 1449
1442 1450 For example (testing the script uniq_stable.py):
1443 1451
1444 1452 In [1]: run -t uniq_stable
1445 1453
1446 1454 IPython CPU timings (estimated):\\
1447 1455 User : 0.19597 s.\\
1448 1456 System: 0.0 s.\\
1449 1457
1450 1458 In [2]: run -t -N5 uniq_stable
1451 1459
1452 1460 IPython CPU timings (estimated):\\
1453 1461 Total runs performed: 5\\
1454 1462 Times : Total Per run\\
1455 1463 User : 0.910862 s, 0.1821724 s.\\
1456 1464 System: 0.0 s, 0.0 s.
1457 1465
1458 1466 -d: run your program under the control of pdb, the Python debugger.
1459 1467 This allows you to execute your program step by step, watch variables,
1460 1468 etc. Internally, what IPython does is similar to calling:
1461 1469
1462 1470 pdb.run('execfile("YOURFILENAME")')
1463 1471
1464 1472 with a breakpoint set on line 1 of your file. You can change the line
1465 1473 number for this automatic breakpoint to be <N> by using the -bN option
1466 1474 (where N must be an integer). For example:
1467 1475
1468 1476 %run -d -b40 myscript
1469 1477
1470 1478 will set the first breakpoint at line 40 in myscript.py. Note that
1471 1479 the first breakpoint must be set on a line which actually does
1472 1480 something (not a comment or docstring) for it to stop execution.
1473 1481
1474 1482 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1475 1483 first enter 'c' (without qoutes) to start execution up to the first
1476 1484 breakpoint.
1477 1485
1478 1486 Entering 'help' gives information about the use of the debugger. You
1479 1487 can easily see pdb's full documentation with "import pdb;pdb.help()"
1480 1488 at a prompt.
1481 1489
1482 1490 -p: run program under the control of the Python profiler module (which
1483 1491 prints a detailed report of execution times, function calls, etc).
1484 1492
1485 1493 You can pass other options after -p which affect the behavior of the
1486 1494 profiler itself. See the docs for %prun for details.
1487 1495
1488 1496 In this mode, the program's variables do NOT propagate back to the
1489 1497 IPython interactive namespace (because they remain in the namespace
1490 1498 where the profiler executes them).
1491 1499
1492 1500 Internally this triggers a call to %prun, see its documentation for
1493 1501 details on the options available specifically for profiling.
1494 1502
1495 1503 There is one special usage for which the text above doesn't apply:
1496 1504 if the filename ends with .ipy, the file is run as ipython script,
1497 1505 just as if the commands were written on IPython prompt.
1498 1506 """
1499 1507
1500 1508 # get arguments and set sys.argv for program to be run.
1501 1509 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1502 1510 mode='list',list_all=1)
1503 1511
1504 1512 try:
1505 1513 filename = get_py_filename(arg_lst[0])
1506 1514 except IndexError:
1507 1515 warn('you must provide at least a filename.')
1508 1516 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1509 1517 return
1510 1518 except IOError,msg:
1511 1519 error(msg)
1512 1520 return
1513 1521
1514 1522 if filename.lower().endswith('.ipy'):
1515 1523 self.api.runlines(open(filename).read())
1516 1524 return
1517 1525
1518 1526 # Control the response to exit() calls made by the script being run
1519 1527 exit_ignore = opts.has_key('e')
1520 1528
1521 1529 # Make sure that the running script gets a proper sys.argv as if it
1522 1530 # were run from a system shell.
1523 1531 save_argv = sys.argv # save it for later restoring
1524 1532 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1525 1533
1526 1534 if opts.has_key('i'):
1527 1535 # Run in user's interactive namespace
1528 1536 prog_ns = self.shell.user_ns
1529 1537 __name__save = self.shell.user_ns['__name__']
1530 1538 prog_ns['__name__'] = '__main__'
1531 1539 main_mod = FakeModule(prog_ns)
1532 1540 else:
1533 1541 # Run in a fresh, empty namespace
1534 1542 if opts.has_key('n'):
1535 1543 name = os.path.splitext(os.path.basename(filename))[0]
1536 1544 else:
1537 1545 name = '__main__'
1538 1546 main_mod = FakeModule()
1539 1547 prog_ns = main_mod.__dict__
1540 1548 prog_ns['__name__'] = name
1541 1549 # The shell MUST hold a reference to main_mod so after %run exits,
1542 1550 # the python deletion mechanism doesn't zero it out (leaving
1543 1551 # dangling references)
1544 1552 self.shell._user_main_modules.append(main_mod)
1545 1553
1546 1554 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1547 1555 # set the __file__ global in the script's namespace
1548 1556 prog_ns['__file__'] = filename
1549 1557
1550 1558 # pickle fix. See iplib for an explanation. But we need to make sure
1551 1559 # that, if we overwrite __main__, we replace it at the end
1552 1560 if prog_ns['__name__'] == '__main__':
1553 1561 restore_main = sys.modules['__main__']
1554 1562 else:
1555 1563 restore_main = False
1556 1564
1557 1565 sys.modules[prog_ns['__name__']] = main_mod
1558 1566
1559 1567 stats = None
1560 1568 try:
1561 1569 if self.shell.has_readline:
1562 1570 self.shell.savehist()
1563 1571
1564 1572 if opts.has_key('p'):
1565 1573 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1566 1574 else:
1567 1575 if opts.has_key('d'):
1568 1576 deb = Debugger.Pdb(self.shell.rc.colors)
1569 1577 # reset Breakpoint state, which is moronically kept
1570 1578 # in a class
1571 1579 bdb.Breakpoint.next = 1
1572 1580 bdb.Breakpoint.bplist = {}
1573 1581 bdb.Breakpoint.bpbynumber = [None]
1574 1582 # Set an initial breakpoint to stop execution
1575 1583 maxtries = 10
1576 1584 bp = int(opts.get('b',[1])[0])
1577 1585 checkline = deb.checkline(filename,bp)
1578 1586 if not checkline:
1579 1587 for bp in range(bp+1,bp+maxtries+1):
1580 1588 if deb.checkline(filename,bp):
1581 1589 break
1582 1590 else:
1583 1591 msg = ("\nI failed to find a valid line to set "
1584 1592 "a breakpoint\n"
1585 1593 "after trying up to line: %s.\n"
1586 1594 "Please set a valid breakpoint manually "
1587 1595 "with the -b option." % bp)
1588 1596 error(msg)
1589 1597 return
1590 1598 # if we find a good linenumber, set the breakpoint
1591 1599 deb.do_break('%s:%s' % (filename,bp))
1592 1600 # Start file run
1593 1601 print "NOTE: Enter 'c' at the",
1594 1602 print "%s prompt to start your script." % deb.prompt
1595 1603 try:
1596 1604 deb.run('execfile("%s")' % filename,prog_ns)
1597 1605
1598 1606 except:
1599 1607 etype, value, tb = sys.exc_info()
1600 1608 # Skip three frames in the traceback: the %run one,
1601 1609 # one inside bdb.py, and the command-line typed by the
1602 1610 # user (run by exec in pdb itself).
1603 1611 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1604 1612 else:
1605 1613 if runner is None:
1606 1614 runner = self.shell.safe_execfile
1607 1615 if opts.has_key('t'):
1608 1616 # timed execution
1609 1617 try:
1610 1618 nruns = int(opts['N'][0])
1611 1619 if nruns < 1:
1612 1620 error('Number of runs must be >=1')
1613 1621 return
1614 1622 except (KeyError):
1615 1623 nruns = 1
1616 1624 if nruns == 1:
1617 1625 t0 = clock2()
1618 1626 runner(filename,prog_ns,prog_ns,
1619 1627 exit_ignore=exit_ignore)
1620 1628 t1 = clock2()
1621 1629 t_usr = t1[0]-t0[0]
1622 1630 t_sys = t1[1]-t1[1]
1623 1631 print "\nIPython CPU timings (estimated):"
1624 1632 print " User : %10s s." % t_usr
1625 1633 print " System: %10s s." % t_sys
1626 1634 else:
1627 1635 runs = range(nruns)
1628 1636 t0 = clock2()
1629 1637 for nr in runs:
1630 1638 runner(filename,prog_ns,prog_ns,
1631 1639 exit_ignore=exit_ignore)
1632 1640 t1 = clock2()
1633 1641 t_usr = t1[0]-t0[0]
1634 1642 t_sys = t1[1]-t1[1]
1635 1643 print "\nIPython CPU timings (estimated):"
1636 1644 print "Total runs performed:",nruns
1637 1645 print " Times : %10s %10s" % ('Total','Per run')
1638 1646 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1639 1647 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1640 1648
1641 1649 else:
1642 1650 # regular execution
1643 1651 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1644 1652 if opts.has_key('i'):
1645 1653 self.shell.user_ns['__name__'] = __name__save
1646 1654 else:
1647 1655 # update IPython interactive namespace
1648 1656 del prog_ns['__name__']
1649 1657 self.shell.user_ns.update(prog_ns)
1650 1658 finally:
1651 1659 sys.argv = save_argv
1652 1660 if restore_main:
1653 1661 sys.modules['__main__'] = restore_main
1654 1662 self.shell.reloadhist()
1655 1663
1656 1664 return stats
1657 1665
1658 1666 def magic_runlog(self, parameter_s =''):
1659 1667 """Run files as logs.
1660 1668
1661 1669 Usage:\\
1662 1670 %runlog file1 file2 ...
1663 1671
1664 1672 Run the named files (treating them as log files) in sequence inside
1665 1673 the interpreter, and return to the prompt. This is much slower than
1666 1674 %run because each line is executed in a try/except block, but it
1667 1675 allows running files with syntax errors in them.
1668 1676
1669 1677 Normally IPython will guess when a file is one of its own logfiles, so
1670 1678 you can typically use %run even for logs. This shorthand allows you to
1671 1679 force any file to be treated as a log file."""
1672 1680
1673 1681 for f in parameter_s.split():
1674 1682 self.shell.safe_execfile(f,self.shell.user_ns,
1675 1683 self.shell.user_ns,islog=1)
1676 1684
1677 1685 def magic_timeit(self, parameter_s =''):
1678 1686 """Time execution of a Python statement or expression
1679 1687
1680 1688 Usage:\\
1681 1689 %timeit [-n<N> -r<R> [-t|-c]] statement
1682 1690
1683 1691 Time execution of a Python statement or expression using the timeit
1684 1692 module.
1685 1693
1686 1694 Options:
1687 1695 -n<N>: execute the given statement <N> times in a loop. If this value
1688 1696 is not given, a fitting value is chosen.
1689 1697
1690 1698 -r<R>: repeat the loop iteration <R> times and take the best result.
1691 1699 Default: 3
1692 1700
1693 1701 -t: use time.time to measure the time, which is the default on Unix.
1694 1702 This function measures wall time.
1695 1703
1696 1704 -c: use time.clock to measure the time, which is the default on
1697 1705 Windows and measures wall time. On Unix, resource.getrusage is used
1698 1706 instead and returns the CPU user time.
1699 1707
1700 1708 -p<P>: use a precision of <P> digits to display the timing result.
1701 1709 Default: 3
1702 1710
1703 1711
1704 1712 Examples:\\
1705 1713 In [1]: %timeit pass
1706 1714 10000000 loops, best of 3: 53.3 ns per loop
1707 1715
1708 1716 In [2]: u = None
1709 1717
1710 1718 In [3]: %timeit u is None
1711 1719 10000000 loops, best of 3: 184 ns per loop
1712 1720
1713 1721 In [4]: %timeit -r 4 u == None
1714 1722 1000000 loops, best of 4: 242 ns per loop
1715 1723
1716 1724 In [5]: import time
1717 1725
1718 1726 In [6]: %timeit -n1 time.sleep(2)
1719 1727 1 loops, best of 3: 2 s per loop
1720 1728
1721 1729
1722 1730 The times reported by %timeit will be slightly higher than those
1723 1731 reported by the timeit.py script when variables are accessed. This is
1724 1732 due to the fact that %timeit executes the statement in the namespace
1725 1733 of the shell, compared with timeit.py, which uses a single setup
1726 1734 statement to import function or create variables. Generally, the bias
1727 1735 does not matter as long as results from timeit.py are not mixed with
1728 1736 those from %timeit."""
1729 1737
1730 1738 import timeit
1731 1739 import math
1732 1740
1733 1741 units = ["s", "ms", "\xc2\xb5s", "ns"]
1734 1742 scaling = [1, 1e3, 1e6, 1e9]
1735 1743
1736 1744 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1737 1745 posix=False)
1738 1746 if stmt == "":
1739 1747 return
1740 1748 timefunc = timeit.default_timer
1741 1749 number = int(getattr(opts, "n", 0))
1742 1750 repeat = int(getattr(opts, "r", timeit.default_repeat))
1743 1751 precision = int(getattr(opts, "p", 3))
1744 1752 if hasattr(opts, "t"):
1745 1753 timefunc = time.time
1746 1754 if hasattr(opts, "c"):
1747 1755 timefunc = clock
1748 1756
1749 1757 timer = timeit.Timer(timer=timefunc)
1750 1758 # this code has tight coupling to the inner workings of timeit.Timer,
1751 1759 # but is there a better way to achieve that the code stmt has access
1752 1760 # to the shell namespace?
1753 1761
1754 1762 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1755 1763 'setup': "pass"}
1756 1764 # Track compilation time so it can be reported if too long
1757 1765 # Minimum time above which compilation time will be reported
1758 1766 tc_min = 0.1
1759 1767
1760 1768 t0 = clock()
1761 1769 code = compile(src, "<magic-timeit>", "exec")
1762 1770 tc = clock()-t0
1763 1771
1764 1772 ns = {}
1765 1773 exec code in self.shell.user_ns, ns
1766 1774 timer.inner = ns["inner"]
1767 1775
1768 1776 if number == 0:
1769 1777 # determine number so that 0.2 <= total time < 2.0
1770 1778 number = 1
1771 1779 for i in range(1, 10):
1772 1780 number *= 10
1773 1781 if timer.timeit(number) >= 0.2:
1774 1782 break
1775 1783
1776 1784 best = min(timer.repeat(repeat, number)) / number
1777 1785
1778 1786 if best > 0.0:
1779 1787 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1780 1788 else:
1781 1789 order = 3
1782 1790 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1783 1791 precision,
1784 1792 best * scaling[order],
1785 1793 units[order])
1786 1794 if tc > tc_min:
1787 1795 print "Compiler time: %.2f s" % tc
1788 1796
1789 1797 def magic_time(self,parameter_s = ''):
1790 1798 """Time execution of a Python statement or expression.
1791 1799
1792 1800 The CPU and wall clock times are printed, and the value of the
1793 1801 expression (if any) is returned. Note that under Win32, system time
1794 1802 is always reported as 0, since it can not be measured.
1795 1803
1796 1804 This function provides very basic timing functionality. In Python
1797 1805 2.3, the timeit module offers more control and sophistication, so this
1798 1806 could be rewritten to use it (patches welcome).
1799 1807
1800 1808 Some examples:
1801 1809
1802 1810 In [1]: time 2**128
1803 1811 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1804 1812 Wall time: 0.00
1805 1813 Out[1]: 340282366920938463463374607431768211456L
1806 1814
1807 1815 In [2]: n = 1000000
1808 1816
1809 1817 In [3]: time sum(range(n))
1810 1818 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1811 1819 Wall time: 1.37
1812 1820 Out[3]: 499999500000L
1813 1821
1814 1822 In [4]: time print 'hello world'
1815 1823 hello world
1816 1824 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1817 1825 Wall time: 0.00
1818 1826
1819 1827 Note that the time needed by Python to compile the given expression
1820 1828 will be reported if it is more than 0.1s. In this example, the
1821 1829 actual exponentiation is done by Python at compilation time, so while
1822 1830 the expression can take a noticeable amount of time to compute, that
1823 1831 time is purely due to the compilation:
1824 1832
1825 1833 In [5]: time 3**9999;
1826 1834 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1827 1835 Wall time: 0.00 s
1828 1836
1829 1837 In [6]: time 3**999999;
1830 1838 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1831 1839 Wall time: 0.00 s
1832 1840 Compiler : 0.78 s
1833 1841 """
1834 1842
1835 1843 # fail immediately if the given expression can't be compiled
1836 1844
1837 1845 expr = self.shell.prefilter(parameter_s,False)
1838 1846
1839 1847 # Minimum time above which compilation time will be reported
1840 1848 tc_min = 0.1
1841 1849
1842 1850 try:
1843 1851 mode = 'eval'
1844 1852 t0 = clock()
1845 1853 code = compile(expr,'<timed eval>',mode)
1846 1854 tc = clock()-t0
1847 1855 except SyntaxError:
1848 1856 mode = 'exec'
1849 1857 t0 = clock()
1850 1858 code = compile(expr,'<timed exec>',mode)
1851 1859 tc = clock()-t0
1852 1860 # skew measurement as little as possible
1853 1861 glob = self.shell.user_ns
1854 1862 clk = clock2
1855 1863 wtime = time.time
1856 1864 # time execution
1857 1865 wall_st = wtime()
1858 1866 if mode=='eval':
1859 1867 st = clk()
1860 1868 out = eval(code,glob)
1861 1869 end = clk()
1862 1870 else:
1863 1871 st = clk()
1864 1872 exec code in glob
1865 1873 end = clk()
1866 1874 out = None
1867 1875 wall_end = wtime()
1868 1876 # Compute actual times and report
1869 1877 wall_time = wall_end-wall_st
1870 1878 cpu_user = end[0]-st[0]
1871 1879 cpu_sys = end[1]-st[1]
1872 1880 cpu_tot = cpu_user+cpu_sys
1873 1881 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1874 1882 (cpu_user,cpu_sys,cpu_tot)
1875 1883 print "Wall time: %.2f s" % wall_time
1876 1884 if tc > tc_min:
1877 1885 print "Compiler : %.2f s" % tc
1878 1886 return out
1879 1887
1880 1888 def magic_macro(self,parameter_s = ''):
1881 1889 """Define a set of input lines as a macro for future re-execution.
1882 1890
1883 1891 Usage:\\
1884 1892 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1885 1893
1886 1894 Options:
1887 1895
1888 1896 -r: use 'raw' input. By default, the 'processed' history is used,
1889 1897 so that magics are loaded in their transformed version to valid
1890 1898 Python. If this option is given, the raw input as typed as the
1891 1899 command line is used instead.
1892 1900
1893 1901 This will define a global variable called `name` which is a string
1894 1902 made of joining the slices and lines you specify (n1,n2,... numbers
1895 1903 above) from your input history into a single string. This variable
1896 1904 acts like an automatic function which re-executes those lines as if
1897 1905 you had typed them. You just type 'name' at the prompt and the code
1898 1906 executes.
1899 1907
1900 1908 The notation for indicating number ranges is: n1-n2 means 'use line
1901 1909 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1902 1910 using the lines numbered 5,6 and 7.
1903 1911
1904 1912 Note: as a 'hidden' feature, you can also use traditional python slice
1905 1913 notation, where N:M means numbers N through M-1.
1906 1914
1907 1915 For example, if your history contains (%hist prints it):
1908 1916
1909 1917 44: x=1\\
1910 1918 45: y=3\\
1911 1919 46: z=x+y\\
1912 1920 47: print x\\
1913 1921 48: a=5\\
1914 1922 49: print 'x',x,'y',y\\
1915 1923
1916 1924 you can create a macro with lines 44 through 47 (included) and line 49
1917 1925 called my_macro with:
1918 1926
1919 1927 In [51]: %macro my_macro 44-47 49
1920 1928
1921 1929 Now, typing `my_macro` (without quotes) will re-execute all this code
1922 1930 in one pass.
1923 1931
1924 1932 You don't need to give the line-numbers in order, and any given line
1925 1933 number can appear multiple times. You can assemble macros with any
1926 1934 lines from your input history in any order.
1927 1935
1928 1936 The macro is a simple object which holds its value in an attribute,
1929 1937 but IPython's display system checks for macros and executes them as
1930 1938 code instead of printing them when you type their name.
1931 1939
1932 1940 You can view a macro's contents by explicitly printing it with:
1933 1941
1934 1942 'print macro_name'.
1935 1943
1936 1944 For one-off cases which DON'T contain magic function calls in them you
1937 1945 can obtain similar results by explicitly executing slices from your
1938 1946 input history with:
1939 1947
1940 1948 In [60]: exec In[44:48]+In[49]"""
1941 1949
1942 1950 opts,args = self.parse_options(parameter_s,'r',mode='list')
1943 1951 if not args:
1944 1952 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1945 1953 macs.sort()
1946 1954 return macs
1947 1955 if len(args) == 1:
1948 1956 raise UsageError(
1949 1957 "%macro insufficient args; usage '%macro name n1-n2 n3-4...")
1950 1958 name,ranges = args[0], args[1:]
1951 1959
1952 1960 #print 'rng',ranges # dbg
1953 1961 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1954 1962 macro = Macro(lines)
1955 1963 self.shell.user_ns.update({name:macro})
1956 1964 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1957 1965 print 'Macro contents:'
1958 1966 print macro,
1959 1967
1960 1968 def magic_save(self,parameter_s = ''):
1961 1969 """Save a set of lines to a given filename.
1962 1970
1963 1971 Usage:\\
1964 1972 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1965 1973
1966 1974 Options:
1967 1975
1968 1976 -r: use 'raw' input. By default, the 'processed' history is used,
1969 1977 so that magics are loaded in their transformed version to valid
1970 1978 Python. If this option is given, the raw input as typed as the
1971 1979 command line is used instead.
1972 1980
1973 1981 This function uses the same syntax as %macro for line extraction, but
1974 1982 instead of creating a macro it saves the resulting string to the
1975 1983 filename you specify.
1976 1984
1977 1985 It adds a '.py' extension to the file if you don't do so yourself, and
1978 1986 it asks for confirmation before overwriting existing files."""
1979 1987
1980 1988 opts,args = self.parse_options(parameter_s,'r',mode='list')
1981 1989 fname,ranges = args[0], args[1:]
1982 1990 if not fname.endswith('.py'):
1983 1991 fname += '.py'
1984 1992 if os.path.isfile(fname):
1985 1993 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1986 1994 if ans.lower() not in ['y','yes']:
1987 1995 print 'Operation cancelled.'
1988 1996 return
1989 1997 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1990 1998 f = file(fname,'w')
1991 1999 f.write(cmds)
1992 2000 f.close()
1993 2001 print 'The following commands were written to file `%s`:' % fname
1994 2002 print cmds
1995 2003
1996 2004 def _edit_macro(self,mname,macro):
1997 2005 """open an editor with the macro data in a file"""
1998 2006 filename = self.shell.mktempfile(macro.value)
1999 2007 self.shell.hooks.editor(filename)
2000 2008
2001 2009 # and make a new macro object, to replace the old one
2002 2010 mfile = open(filename)
2003 2011 mvalue = mfile.read()
2004 2012 mfile.close()
2005 2013 self.shell.user_ns[mname] = Macro(mvalue)
2006 2014
2007 2015 def magic_ed(self,parameter_s=''):
2008 2016 """Alias to %edit."""
2009 2017 return self.magic_edit(parameter_s)
2010 2018
2011 2019 def magic_edit(self,parameter_s='',last_call=['','']):
2012 2020 """Bring up an editor and execute the resulting code.
2013 2021
2014 2022 Usage:
2015 2023 %edit [options] [args]
2016 2024
2017 2025 %edit runs IPython's editor hook. The default version of this hook is
2018 2026 set to call the __IPYTHON__.rc.editor command. This is read from your
2019 2027 environment variable $EDITOR. If this isn't found, it will default to
2020 2028 vi under Linux/Unix and to notepad under Windows. See the end of this
2021 2029 docstring for how to change the editor hook.
2022 2030
2023 2031 You can also set the value of this editor via the command line option
2024 2032 '-editor' or in your ipythonrc file. This is useful if you wish to use
2025 2033 specifically for IPython an editor different from your typical default
2026 2034 (and for Windows users who typically don't set environment variables).
2027 2035
2028 2036 This command allows you to conveniently edit multi-line code right in
2029 2037 your IPython session.
2030 2038
2031 2039 If called without arguments, %edit opens up an empty editor with a
2032 2040 temporary file and will execute the contents of this file when you
2033 2041 close it (don't forget to save it!).
2034 2042
2035 2043
2036 2044 Options:
2037 2045
2038 2046 -n <number>: open the editor at a specified line number. By default,
2039 2047 the IPython editor hook uses the unix syntax 'editor +N filename', but
2040 2048 you can configure this by providing your own modified hook if your
2041 2049 favorite editor supports line-number specifications with a different
2042 2050 syntax.
2043 2051
2044 2052 -p: this will call the editor with the same data as the previous time
2045 2053 it was used, regardless of how long ago (in your current session) it
2046 2054 was.
2047 2055
2048 2056 -r: use 'raw' input. This option only applies to input taken from the
2049 2057 user's history. By default, the 'processed' history is used, so that
2050 2058 magics are loaded in their transformed version to valid Python. If
2051 2059 this option is given, the raw input as typed as the command line is
2052 2060 used instead. When you exit the editor, it will be executed by
2053 2061 IPython's own processor.
2054 2062
2055 2063 -x: do not execute the edited code immediately upon exit. This is
2056 2064 mainly useful if you are editing programs which need to be called with
2057 2065 command line arguments, which you can then do using %run.
2058 2066
2059 2067
2060 2068 Arguments:
2061 2069
2062 2070 If arguments are given, the following possibilites exist:
2063 2071
2064 2072 - The arguments are numbers or pairs of colon-separated numbers (like
2065 2073 1 4:8 9). These are interpreted as lines of previous input to be
2066 2074 loaded into the editor. The syntax is the same of the %macro command.
2067 2075
2068 2076 - If the argument doesn't start with a number, it is evaluated as a
2069 2077 variable and its contents loaded into the editor. You can thus edit
2070 2078 any string which contains python code (including the result of
2071 2079 previous edits).
2072 2080
2073 2081 - If the argument is the name of an object (other than a string),
2074 2082 IPython will try to locate the file where it was defined and open the
2075 2083 editor at the point where it is defined. You can use `%edit function`
2076 2084 to load an editor exactly at the point where 'function' is defined,
2077 2085 edit it and have the file be executed automatically.
2078 2086
2079 2087 If the object is a macro (see %macro for details), this opens up your
2080 2088 specified editor with a temporary file containing the macro's data.
2081 2089 Upon exit, the macro is reloaded with the contents of the file.
2082 2090
2083 2091 Note: opening at an exact line is only supported under Unix, and some
2084 2092 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2085 2093 '+NUMBER' parameter necessary for this feature. Good editors like
2086 2094 (X)Emacs, vi, jed, pico and joe all do.
2087 2095
2088 2096 - If the argument is not found as a variable, IPython will look for a
2089 2097 file with that name (adding .py if necessary) and load it into the
2090 2098 editor. It will execute its contents with execfile() when you exit,
2091 2099 loading any code in the file into your interactive namespace.
2092 2100
2093 2101 After executing your code, %edit will return as output the code you
2094 2102 typed in the editor (except when it was an existing file). This way
2095 2103 you can reload the code in further invocations of %edit as a variable,
2096 2104 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2097 2105 the output.
2098 2106
2099 2107 Note that %edit is also available through the alias %ed.
2100 2108
2101 2109 This is an example of creating a simple function inside the editor and
2102 2110 then modifying it. First, start up the editor:
2103 2111
2104 2112 In [1]: ed\\
2105 2113 Editing... done. Executing edited code...\\
2106 2114 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2107 2115
2108 2116 We can then call the function foo():
2109 2117
2110 2118 In [2]: foo()\\
2111 2119 foo() was defined in an editing session
2112 2120
2113 2121 Now we edit foo. IPython automatically loads the editor with the
2114 2122 (temporary) file where foo() was previously defined:
2115 2123
2116 2124 In [3]: ed foo\\
2117 2125 Editing... done. Executing edited code...
2118 2126
2119 2127 And if we call foo() again we get the modified version:
2120 2128
2121 2129 In [4]: foo()\\
2122 2130 foo() has now been changed!
2123 2131
2124 2132 Here is an example of how to edit a code snippet successive
2125 2133 times. First we call the editor:
2126 2134
2127 2135 In [8]: ed\\
2128 2136 Editing... done. Executing edited code...\\
2129 2137 hello\\
2130 2138 Out[8]: "print 'hello'\\n"
2131 2139
2132 2140 Now we call it again with the previous output (stored in _):
2133 2141
2134 2142 In [9]: ed _\\
2135 2143 Editing... done. Executing edited code...\\
2136 2144 hello world\\
2137 2145 Out[9]: "print 'hello world'\\n"
2138 2146
2139 2147 Now we call it with the output #8 (stored in _8, also as Out[8]):
2140 2148
2141 2149 In [10]: ed _8\\
2142 2150 Editing... done. Executing edited code...\\
2143 2151 hello again\\
2144 2152 Out[10]: "print 'hello again'\\n"
2145 2153
2146 2154
2147 2155 Changing the default editor hook:
2148 2156
2149 2157 If you wish to write your own editor hook, you can put it in a
2150 2158 configuration file which you load at startup time. The default hook
2151 2159 is defined in the IPython.hooks module, and you can use that as a
2152 2160 starting example for further modifications. That file also has
2153 2161 general instructions on how to set a new hook for use once you've
2154 2162 defined it."""
2155 2163
2156 2164 # FIXME: This function has become a convoluted mess. It needs a
2157 2165 # ground-up rewrite with clean, simple logic.
2158 2166
2159 2167 def make_filename(arg):
2160 2168 "Make a filename from the given args"
2161 2169 try:
2162 2170 filename = get_py_filename(arg)
2163 2171 except IOError:
2164 2172 if args.endswith('.py'):
2165 2173 filename = arg
2166 2174 else:
2167 2175 filename = None
2168 2176 return filename
2169 2177
2170 2178 # custom exceptions
2171 2179 class DataIsObject(Exception): pass
2172 2180
2173 2181 opts,args = self.parse_options(parameter_s,'prxn:')
2174 2182 # Set a few locals from the options for convenience:
2175 2183 opts_p = opts.has_key('p')
2176 2184 opts_r = opts.has_key('r')
2177 2185
2178 2186 # Default line number value
2179 2187 lineno = opts.get('n',None)
2180 2188
2181 2189 if opts_p:
2182 2190 args = '_%s' % last_call[0]
2183 2191 if not self.shell.user_ns.has_key(args):
2184 2192 args = last_call[1]
2185 2193
2186 2194 # use last_call to remember the state of the previous call, but don't
2187 2195 # let it be clobbered by successive '-p' calls.
2188 2196 try:
2189 2197 last_call[0] = self.shell.outputcache.prompt_count
2190 2198 if not opts_p:
2191 2199 last_call[1] = parameter_s
2192 2200 except:
2193 2201 pass
2194 2202
2195 2203 # by default this is done with temp files, except when the given
2196 2204 # arg is a filename
2197 2205 use_temp = 1
2198 2206
2199 2207 if re.match(r'\d',args):
2200 2208 # Mode where user specifies ranges of lines, like in %macro.
2201 2209 # This means that you can't edit files whose names begin with
2202 2210 # numbers this way. Tough.
2203 2211 ranges = args.split()
2204 2212 data = ''.join(self.extract_input_slices(ranges,opts_r))
2205 2213 elif args.endswith('.py'):
2206 2214 filename = make_filename(args)
2207 2215 data = ''
2208 2216 use_temp = 0
2209 2217 elif args:
2210 2218 try:
2211 2219 # Load the parameter given as a variable. If not a string,
2212 2220 # process it as an object instead (below)
2213 2221
2214 2222 #print '*** args',args,'type',type(args) # dbg
2215 2223 data = eval(args,self.shell.user_ns)
2216 2224 if not type(data) in StringTypes:
2217 2225 raise DataIsObject
2218 2226
2219 2227 except (NameError,SyntaxError):
2220 2228 # given argument is not a variable, try as a filename
2221 2229 filename = make_filename(args)
2222 2230 if filename is None:
2223 2231 warn("Argument given (%s) can't be found as a variable "
2224 2232 "or as a filename." % args)
2225 2233 return
2226 2234
2227 2235 data = ''
2228 2236 use_temp = 0
2229 2237 except DataIsObject:
2230 2238
2231 2239 # macros have a special edit function
2232 2240 if isinstance(data,Macro):
2233 2241 self._edit_macro(args,data)
2234 2242 return
2235 2243
2236 2244 # For objects, try to edit the file where they are defined
2237 2245 try:
2238 2246 filename = inspect.getabsfile(data)
2239 2247 datafile = 1
2240 2248 except TypeError:
2241 2249 filename = make_filename(args)
2242 2250 datafile = 1
2243 2251 warn('Could not find file where `%s` is defined.\n'
2244 2252 'Opening a file named `%s`' % (args,filename))
2245 2253 # Now, make sure we can actually read the source (if it was in
2246 2254 # a temp file it's gone by now).
2247 2255 if datafile:
2248 2256 try:
2249 2257 if lineno is None:
2250 2258 lineno = inspect.getsourcelines(data)[1]
2251 2259 except IOError:
2252 2260 filename = make_filename(args)
2253 2261 if filename is None:
2254 2262 warn('The file `%s` where `%s` was defined cannot '
2255 2263 'be read.' % (filename,data))
2256 2264 return
2257 2265 use_temp = 0
2258 2266 else:
2259 2267 data = ''
2260 2268
2261 2269 if use_temp:
2262 2270 filename = self.shell.mktempfile(data)
2263 2271 print 'IPython will make a temporary file named:',filename
2264 2272
2265 2273 # do actual editing here
2266 2274 print 'Editing...',
2267 2275 sys.stdout.flush()
2268 2276 self.shell.hooks.editor(filename,lineno)
2269 2277 if opts.has_key('x'): # -x prevents actual execution
2270 2278 print
2271 2279 else:
2272 2280 print 'done. Executing edited code...'
2273 2281 if opts_r:
2274 2282 self.shell.runlines(file_read(filename))
2275 2283 else:
2276 2284 self.shell.safe_execfile(filename,self.shell.user_ns,
2277 2285 self.shell.user_ns)
2278 2286 if use_temp:
2279 2287 try:
2280 2288 return open(filename).read()
2281 2289 except IOError,msg:
2282 2290 if msg.filename == filename:
2283 2291 warn('File not found. Did you forget to save?')
2284 2292 return
2285 2293 else:
2286 2294 self.shell.showtraceback()
2287 2295
2288 2296 def magic_xmode(self,parameter_s = ''):
2289 2297 """Switch modes for the exception handlers.
2290 2298
2291 2299 Valid modes: Plain, Context and Verbose.
2292 2300
2293 2301 If called without arguments, acts as a toggle."""
2294 2302
2295 2303 def xmode_switch_err(name):
2296 2304 warn('Error changing %s exception modes.\n%s' %
2297 2305 (name,sys.exc_info()[1]))
2298 2306
2299 2307 shell = self.shell
2300 2308 new_mode = parameter_s.strip().capitalize()
2301 2309 try:
2302 2310 shell.InteractiveTB.set_mode(mode=new_mode)
2303 2311 print 'Exception reporting mode:',shell.InteractiveTB.mode
2304 2312 except:
2305 2313 xmode_switch_err('user')
2306 2314
2307 2315 # threaded shells use a special handler in sys.excepthook
2308 2316 if shell.isthreaded:
2309 2317 try:
2310 2318 shell.sys_excepthook.set_mode(mode=new_mode)
2311 2319 except:
2312 2320 xmode_switch_err('threaded')
2313 2321
2314 2322 def magic_colors(self,parameter_s = ''):
2315 2323 """Switch color scheme for prompts, info system and exception handlers.
2316 2324
2317 2325 Currently implemented schemes: NoColor, Linux, LightBG.
2318 2326
2319 2327 Color scheme names are not case-sensitive."""
2320 2328
2321 2329 def color_switch_err(name):
2322 2330 warn('Error changing %s color schemes.\n%s' %
2323 2331 (name,sys.exc_info()[1]))
2324 2332
2325 2333
2326 2334 new_scheme = parameter_s.strip()
2327 2335 if not new_scheme:
2328 2336 raise UsageError(
2329 2337 "%colors: you must specify a color scheme. See '%colors?'")
2330 2338 return
2331 2339 # local shortcut
2332 2340 shell = self.shell
2333 2341
2334 2342 import IPython.rlineimpl as readline
2335 2343
2336 2344 if not readline.have_readline and sys.platform == "win32":
2337 2345 msg = """\
2338 2346 Proper color support under MS Windows requires the pyreadline library.
2339 2347 You can find it at:
2340 2348 http://ipython.scipy.org/moin/PyReadline/Intro
2341 2349 Gary's readline needs the ctypes module, from:
2342 2350 http://starship.python.net/crew/theller/ctypes
2343 2351 (Note that ctypes is already part of Python versions 2.5 and newer).
2344 2352
2345 2353 Defaulting color scheme to 'NoColor'"""
2346 2354 new_scheme = 'NoColor'
2347 2355 warn(msg)
2348 2356
2349 2357 # readline option is 0
2350 2358 if not shell.has_readline:
2351 2359 new_scheme = 'NoColor'
2352 2360
2353 2361 # Set prompt colors
2354 2362 try:
2355 2363 shell.outputcache.set_colors(new_scheme)
2356 2364 except:
2357 2365 color_switch_err('prompt')
2358 2366 else:
2359 2367 shell.rc.colors = \
2360 2368 shell.outputcache.color_table.active_scheme_name
2361 2369 # Set exception colors
2362 2370 try:
2363 2371 shell.InteractiveTB.set_colors(scheme = new_scheme)
2364 2372 shell.SyntaxTB.set_colors(scheme = new_scheme)
2365 2373 except:
2366 2374 color_switch_err('exception')
2367 2375
2368 2376 # threaded shells use a verbose traceback in sys.excepthook
2369 2377 if shell.isthreaded:
2370 2378 try:
2371 2379 shell.sys_excepthook.set_colors(scheme=new_scheme)
2372 2380 except:
2373 2381 color_switch_err('system exception handler')
2374 2382
2375 2383 # Set info (for 'object?') colors
2376 2384 if shell.rc.color_info:
2377 2385 try:
2378 2386 shell.inspector.set_active_scheme(new_scheme)
2379 2387 except:
2380 2388 color_switch_err('object inspector')
2381 2389 else:
2382 2390 shell.inspector.set_active_scheme('NoColor')
2383 2391
2384 2392 def magic_color_info(self,parameter_s = ''):
2385 2393 """Toggle color_info.
2386 2394
2387 2395 The color_info configuration parameter controls whether colors are
2388 2396 used for displaying object details (by things like %psource, %pfile or
2389 2397 the '?' system). This function toggles this value with each call.
2390 2398
2391 2399 Note that unless you have a fairly recent pager (less works better
2392 2400 than more) in your system, using colored object information displays
2393 2401 will not work properly. Test it and see."""
2394 2402
2395 2403 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2396 2404 self.magic_colors(self.shell.rc.colors)
2397 2405 print 'Object introspection functions have now coloring:',
2398 2406 print ['OFF','ON'][self.shell.rc.color_info]
2399 2407
2400 2408 def magic_Pprint(self, parameter_s=''):
2401 2409 """Toggle pretty printing on/off."""
2402 2410
2403 2411 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2404 2412 print 'Pretty printing has been turned', \
2405 2413 ['OFF','ON'][self.shell.rc.pprint]
2406 2414
2407 2415 def magic_exit(self, parameter_s=''):
2408 2416 """Exit IPython, confirming if configured to do so.
2409 2417
2410 2418 You can configure whether IPython asks for confirmation upon exit by
2411 2419 setting the confirm_exit flag in the ipythonrc file."""
2412 2420
2413 2421 self.shell.exit()
2414 2422
2415 2423 def magic_quit(self, parameter_s=''):
2416 2424 """Exit IPython, confirming if configured to do so (like %exit)"""
2417 2425
2418 2426 self.shell.exit()
2419 2427
2420 2428 def magic_Exit(self, parameter_s=''):
2421 2429 """Exit IPython without confirmation."""
2422 2430
2423 2431 self.shell.exit_now = True
2424 2432
2425 2433 #......................................................................
2426 2434 # Functions to implement unix shell-type things
2427 2435
2428 2436 def magic_alias(self, parameter_s = ''):
2429 2437 """Define an alias for a system command.
2430 2438
2431 2439 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2432 2440
2433 2441 Then, typing 'alias_name params' will execute the system command 'cmd
2434 2442 params' (from your underlying operating system).
2435 2443
2436 2444 Aliases have lower precedence than magic functions and Python normal
2437 2445 variables, so if 'foo' is both a Python variable and an alias, the
2438 2446 alias can not be executed until 'del foo' removes the Python variable.
2439 2447
2440 2448 You can use the %l specifier in an alias definition to represent the
2441 2449 whole line when the alias is called. For example:
2442 2450
2443 2451 In [2]: alias all echo "Input in brackets: <%l>"\\
2444 2452 In [3]: all hello world\\
2445 2453 Input in brackets: <hello world>
2446 2454
2447 2455 You can also define aliases with parameters using %s specifiers (one
2448 2456 per parameter):
2449 2457
2450 2458 In [1]: alias parts echo first %s second %s\\
2451 2459 In [2]: %parts A B\\
2452 2460 first A second B\\
2453 2461 In [3]: %parts A\\
2454 2462 Incorrect number of arguments: 2 expected.\\
2455 2463 parts is an alias to: 'echo first %s second %s'
2456 2464
2457 2465 Note that %l and %s are mutually exclusive. You can only use one or
2458 2466 the other in your aliases.
2459 2467
2460 2468 Aliases expand Python variables just like system calls using ! or !!
2461 2469 do: all expressions prefixed with '$' get expanded. For details of
2462 2470 the semantic rules, see PEP-215:
2463 2471 http://www.python.org/peps/pep-0215.html. This is the library used by
2464 2472 IPython for variable expansion. If you want to access a true shell
2465 2473 variable, an extra $ is necessary to prevent its expansion by IPython:
2466 2474
2467 2475 In [6]: alias show echo\\
2468 2476 In [7]: PATH='A Python string'\\
2469 2477 In [8]: show $PATH\\
2470 2478 A Python string\\
2471 2479 In [9]: show $$PATH\\
2472 2480 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2473 2481
2474 2482 You can use the alias facility to acess all of $PATH. See the %rehash
2475 2483 and %rehashx functions, which automatically create aliases for the
2476 2484 contents of your $PATH.
2477 2485
2478 2486 If called with no parameters, %alias prints the current alias table."""
2479 2487
2480 2488 par = parameter_s.strip()
2481 2489 if not par:
2482 2490 stored = self.db.get('stored_aliases', {} )
2483 2491 atab = self.shell.alias_table
2484 2492 aliases = atab.keys()
2485 2493 aliases.sort()
2486 2494 res = []
2487 2495 showlast = []
2488 2496 for alias in aliases:
2489 2497 special = False
2490 2498 try:
2491 2499 tgt = atab[alias][1]
2492 2500 except (TypeError, AttributeError):
2493 2501 # unsubscriptable? probably a callable
2494 2502 tgt = atab[alias]
2495 2503 special = True
2496 2504 # 'interesting' aliases
2497 2505 if (alias in stored or
2498 2506 special or
2499 2507 alias.lower() != os.path.splitext(tgt)[0].lower() or
2500 2508 ' ' in tgt):
2501 2509 showlast.append((alias, tgt))
2502 2510 else:
2503 2511 res.append((alias, tgt ))
2504 2512
2505 2513 # show most interesting aliases last
2506 2514 res.extend(showlast)
2507 2515 print "Total number of aliases:",len(aliases)
2508 2516 return res
2509 2517 try:
2510 2518 alias,cmd = par.split(None,1)
2511 2519 except:
2512 2520 print OInspect.getdoc(self.magic_alias)
2513 2521 else:
2514 2522 nargs = cmd.count('%s')
2515 2523 if nargs>0 and cmd.find('%l')>=0:
2516 2524 error('The %s and %l specifiers are mutually exclusive '
2517 2525 'in alias definitions.')
2518 2526 else: # all looks OK
2519 2527 self.shell.alias_table[alias] = (nargs,cmd)
2520 2528 self.shell.alias_table_validate(verbose=0)
2521 2529 # end magic_alias
2522 2530
2523 2531 def magic_unalias(self, parameter_s = ''):
2524 2532 """Remove an alias"""
2525 2533
2526 2534 aname = parameter_s.strip()
2527 2535 if aname in self.shell.alias_table:
2528 2536 del self.shell.alias_table[aname]
2529 2537 stored = self.db.get('stored_aliases', {} )
2530 2538 if aname in stored:
2531 2539 print "Removing %stored alias",aname
2532 2540 del stored[aname]
2533 2541 self.db['stored_aliases'] = stored
2534 2542
2535 2543
2536 2544 def magic_rehashx(self, parameter_s = ''):
2537 2545 """Update the alias table with all executable files in $PATH.
2538 2546
2539 2547 This version explicitly checks that every entry in $PATH is a file
2540 2548 with execute access (os.X_OK), so it is much slower than %rehash.
2541 2549
2542 2550 Under Windows, it checks executability as a match agains a
2543 2551 '|'-separated string of extensions, stored in the IPython config
2544 2552 variable win_exec_ext. This defaults to 'exe|com|bat'.
2545 2553
2546 2554 This function also resets the root module cache of module completer,
2547 2555 used on slow filesystems.
2548 2556 """
2549 2557
2550 2558
2551 2559 ip = self.api
2552 2560
2553 2561 # for the benefit of module completer in ipy_completers.py
2554 2562 del ip.db['rootmodules']
2555 2563
2556 2564 path = [os.path.abspath(os.path.expanduser(p)) for p in
2557 2565 os.environ.get('PATH','').split(os.pathsep)]
2558 2566 path = filter(os.path.isdir,path)
2559 2567
2560 2568 alias_table = self.shell.alias_table
2561 2569 syscmdlist = []
2562 2570 if os.name == 'posix':
2563 2571 isexec = lambda fname:os.path.isfile(fname) and \
2564 2572 os.access(fname,os.X_OK)
2565 2573 else:
2566 2574
2567 2575 try:
2568 2576 winext = os.environ['pathext'].replace(';','|').replace('.','')
2569 2577 except KeyError:
2570 2578 winext = 'exe|com|bat|py'
2571 2579 if 'py' not in winext:
2572 2580 winext += '|py'
2573 2581 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2574 2582 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2575 2583 savedir = os.getcwd()
2576 2584 try:
2577 2585 # write the whole loop for posix/Windows so we don't have an if in
2578 2586 # the innermost part
2579 2587 if os.name == 'posix':
2580 2588 for pdir in path:
2581 2589 os.chdir(pdir)
2582 2590 for ff in os.listdir(pdir):
2583 2591 if isexec(ff) and ff not in self.shell.no_alias:
2584 2592 # each entry in the alias table must be (N,name),
2585 2593 # where N is the number of positional arguments of the
2586 2594 # alias.
2587 2595 alias_table[ff] = (0,ff)
2588 2596 syscmdlist.append(ff)
2589 2597 else:
2590 2598 for pdir in path:
2591 2599 os.chdir(pdir)
2592 2600 for ff in os.listdir(pdir):
2593 2601 base, ext = os.path.splitext(ff)
2594 2602 if isexec(ff) and base not in self.shell.no_alias:
2595 2603 if ext.lower() == '.exe':
2596 2604 ff = base
2597 2605 alias_table[base.lower()] = (0,ff)
2598 2606 syscmdlist.append(ff)
2599 2607 # Make sure the alias table doesn't contain keywords or builtins
2600 2608 self.shell.alias_table_validate()
2601 2609 # Call again init_auto_alias() so we get 'rm -i' and other
2602 2610 # modified aliases since %rehashx will probably clobber them
2603 2611
2604 2612 # no, we don't want them. if %rehashx clobbers them, good,
2605 2613 # we'll probably get better versions
2606 2614 # self.shell.init_auto_alias()
2607 2615 db = ip.db
2608 2616 db['syscmdlist'] = syscmdlist
2609 2617 finally:
2610 2618 os.chdir(savedir)
2611 2619
2612 2620 def magic_pwd(self, parameter_s = ''):
2613 2621 """Return the current working directory path."""
2614 2622 return os.getcwd()
2615 2623
2616 2624 def magic_cd(self, parameter_s=''):
2617 2625 """Change the current working directory.
2618 2626
2619 2627 This command automatically maintains an internal list of directories
2620 2628 you visit during your IPython session, in the variable _dh. The
2621 2629 command %dhist shows this history nicely formatted. You can also
2622 2630 do 'cd -<tab>' to see directory history conveniently.
2623 2631
2624 2632 Usage:
2625 2633
2626 2634 cd 'dir': changes to directory 'dir'.
2627 2635
2628 2636 cd -: changes to the last visited directory.
2629 2637
2630 2638 cd -<n>: changes to the n-th directory in the directory history.
2631 2639
2632 2640 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2633 2641 (note: cd <bookmark_name> is enough if there is no
2634 2642 directory <bookmark_name>, but a bookmark with the name exists.)
2635 2643 'cd -b <tab>' allows you to tab-complete bookmark names.
2636 2644
2637 2645 Options:
2638 2646
2639 2647 -q: quiet. Do not print the working directory after the cd command is
2640 2648 executed. By default IPython's cd command does print this directory,
2641 2649 since the default prompts do not display path information.
2642 2650
2643 2651 Note that !cd doesn't work for this purpose because the shell where
2644 2652 !command runs is immediately discarded after executing 'command'."""
2645 2653
2646 2654 parameter_s = parameter_s.strip()
2647 2655 #bkms = self.shell.persist.get("bookmarks",{})
2648 2656
2649 2657 numcd = re.match(r'(-)(\d+)$',parameter_s)
2650 2658 # jump in directory history by number
2651 2659 if numcd:
2652 2660 nn = int(numcd.group(2))
2653 2661 try:
2654 2662 ps = self.shell.user_ns['_dh'][nn]
2655 2663 except IndexError:
2656 2664 print 'The requested directory does not exist in history.'
2657 2665 return
2658 2666 else:
2659 2667 opts = {}
2660 2668 else:
2661 2669 #turn all non-space-escaping backslashes to slashes,
2662 2670 # for c:\windows\directory\names\
2663 2671 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2664 2672 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2665 2673 # jump to previous
2666 2674 if ps == '-':
2667 2675 try:
2668 2676 ps = self.shell.user_ns['_dh'][-2]
2669 2677 except IndexError:
2670 2678 raise UsageError('%cd -: No previous directory to change to.')
2671 2679 # jump to bookmark if needed
2672 2680 else:
2673 2681 if not os.path.isdir(ps) or opts.has_key('b'):
2674 2682 bkms = self.db.get('bookmarks', {})
2675 2683
2676 2684 if bkms.has_key(ps):
2677 2685 target = bkms[ps]
2678 2686 print '(bookmark:%s) -> %s' % (ps,target)
2679 2687 ps = target
2680 2688 else:
2681 2689 if opts.has_key('b'):
2682 2690 raise UsageError("Bookmark '%s' not found. "
2683 2691 "Use '%%bookmark -l' to see your bookmarks." % ps)
2684 2692
2685 2693 # at this point ps should point to the target dir
2686 2694 if ps:
2687 2695 try:
2688 2696 os.chdir(os.path.expanduser(ps))
2689 2697 if self.shell.rc.term_title:
2690 2698 #print 'set term title:',self.shell.rc.term_title # dbg
2691 2699 ttitle = 'IPy ' + abbrev_cwd()
2692 2700 platutils.set_term_title(ttitle)
2693 2701 except OSError:
2694 2702 print sys.exc_info()[1]
2695 2703 else:
2696 2704 cwd = os.getcwd()
2697 2705 dhist = self.shell.user_ns['_dh']
2698 2706 dhist.append(cwd)
2699 2707 self.db['dhist'] = compress_dhist(dhist)[-100:]
2700 2708
2701 2709 else:
2702 2710 os.chdir(self.shell.home_dir)
2703 2711 if self.shell.rc.term_title:
2704 2712 platutils.set_term_title("IPy ~")
2705 2713 cwd = os.getcwd()
2706 2714 dhist = self.shell.user_ns['_dh']
2707 2715 dhist.append(cwd)
2708 2716 self.db['dhist'] = compress_dhist(dhist)[-100:]
2709 2717 if not 'q' in opts and self.shell.user_ns['_dh']:
2710 2718 print self.shell.user_ns['_dh'][-1]
2711 2719
2712 2720
2713 2721 def magic_env(self, parameter_s=''):
2714 2722 """List environment variables."""
2715 2723
2716 2724 return os.environ.data
2717 2725
2718 2726 def magic_pushd(self, parameter_s=''):
2719 2727 """Place the current dir on stack and change directory.
2720 2728
2721 2729 Usage:\\
2722 2730 %pushd ['dirname']
2723 2731 """
2724 2732
2725 2733 dir_s = self.shell.dir_stack
2726 2734 tgt = os.path.expanduser(parameter_s)
2727 2735 cwd = os.getcwd().replace(self.home_dir,'~')
2728 2736 if tgt:
2729 2737 self.magic_cd(parameter_s)
2730 2738 dir_s.insert(0,cwd)
2731 2739 return self.magic_dirs()
2732 2740
2733 2741 def magic_popd(self, parameter_s=''):
2734 2742 """Change to directory popped off the top of the stack.
2735 2743 """
2736 2744 if not self.shell.dir_stack:
2737 2745 raise UsageError("%popd on empty stack")
2738 2746 top = self.shell.dir_stack.pop(0)
2739 2747 self.magic_cd(top)
2740 2748 print "popd ->",top
2741 2749
2742 2750 def magic_dirs(self, parameter_s=''):
2743 2751 """Return the current directory stack."""
2744 2752
2745 2753 return self.shell.dir_stack
2746 2754
2747 2755 def magic_dhist(self, parameter_s=''):
2748 2756 """Print your history of visited directories.
2749 2757
2750 2758 %dhist -> print full history\\
2751 2759 %dhist n -> print last n entries only\\
2752 2760 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2753 2761
2754 2762 This history is automatically maintained by the %cd command, and
2755 2763 always available as the global list variable _dh. You can use %cd -<n>
2756 2764 to go to directory number <n>.
2757 2765
2758 2766 Note that most of time, you should view directory history by entering
2759 2767 cd -<TAB>.
2760 2768
2761 2769 """
2762 2770
2763 2771 dh = self.shell.user_ns['_dh']
2764 2772 if parameter_s:
2765 2773 try:
2766 2774 args = map(int,parameter_s.split())
2767 2775 except:
2768 2776 self.arg_err(Magic.magic_dhist)
2769 2777 return
2770 2778 if len(args) == 1:
2771 2779 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2772 2780 elif len(args) == 2:
2773 2781 ini,fin = args
2774 2782 else:
2775 2783 self.arg_err(Magic.magic_dhist)
2776 2784 return
2777 2785 else:
2778 2786 ini,fin = 0,len(dh)
2779 2787 nlprint(dh,
2780 2788 header = 'Directory history (kept in _dh)',
2781 2789 start=ini,stop=fin)
2782 2790
2783 2791
2784 2792 def magic_sc(self, parameter_s=''):
2785 2793 """Shell capture - execute a shell command and capture its output.
2786 2794
2787 2795 DEPRECATED. Suboptimal, retained for backwards compatibility.
2788 2796
2789 2797 You should use the form 'var = !command' instead. Example:
2790 2798
2791 2799 "%sc -l myfiles = ls ~" should now be written as
2792 2800
2793 2801 "myfiles = !ls ~"
2794 2802
2795 2803 myfiles.s, myfiles.l and myfiles.n still apply as documented
2796 2804 below.
2797 2805
2798 2806 --
2799 2807 %sc [options] varname=command
2800 2808
2801 2809 IPython will run the given command using commands.getoutput(), and
2802 2810 will then update the user's interactive namespace with a variable
2803 2811 called varname, containing the value of the call. Your command can
2804 2812 contain shell wildcards, pipes, etc.
2805 2813
2806 2814 The '=' sign in the syntax is mandatory, and the variable name you
2807 2815 supply must follow Python's standard conventions for valid names.
2808 2816
2809 2817 (A special format without variable name exists for internal use)
2810 2818
2811 2819 Options:
2812 2820
2813 2821 -l: list output. Split the output on newlines into a list before
2814 2822 assigning it to the given variable. By default the output is stored
2815 2823 as a single string.
2816 2824
2817 2825 -v: verbose. Print the contents of the variable.
2818 2826
2819 2827 In most cases you should not need to split as a list, because the
2820 2828 returned value is a special type of string which can automatically
2821 2829 provide its contents either as a list (split on newlines) or as a
2822 2830 space-separated string. These are convenient, respectively, either
2823 2831 for sequential processing or to be passed to a shell command.
2824 2832
2825 2833 For example:
2826 2834
2827 2835 # Capture into variable a
2828 2836 In [9]: sc a=ls *py
2829 2837
2830 2838 # a is a string with embedded newlines
2831 2839 In [10]: a
2832 2840 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2833 2841
2834 2842 # which can be seen as a list:
2835 2843 In [11]: a.l
2836 2844 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2837 2845
2838 2846 # or as a whitespace-separated string:
2839 2847 In [12]: a.s
2840 2848 Out[12]: 'setup.py win32_manual_post_install.py'
2841 2849
2842 2850 # a.s is useful to pass as a single command line:
2843 2851 In [13]: !wc -l $a.s
2844 2852 146 setup.py
2845 2853 130 win32_manual_post_install.py
2846 2854 276 total
2847 2855
2848 2856 # while the list form is useful to loop over:
2849 2857 In [14]: for f in a.l:
2850 2858 ....: !wc -l $f
2851 2859 ....:
2852 2860 146 setup.py
2853 2861 130 win32_manual_post_install.py
2854 2862
2855 2863 Similiarly, the lists returned by the -l option are also special, in
2856 2864 the sense that you can equally invoke the .s attribute on them to
2857 2865 automatically get a whitespace-separated string from their contents:
2858 2866
2859 2867 In [1]: sc -l b=ls *py
2860 2868
2861 2869 In [2]: b
2862 2870 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2863 2871
2864 2872 In [3]: b.s
2865 2873 Out[3]: 'setup.py win32_manual_post_install.py'
2866 2874
2867 2875 In summary, both the lists and strings used for ouptut capture have
2868 2876 the following special attributes:
2869 2877
2870 2878 .l (or .list) : value as list.
2871 2879 .n (or .nlstr): value as newline-separated string.
2872 2880 .s (or .spstr): value as space-separated string.
2873 2881 """
2874 2882
2875 2883 opts,args = self.parse_options(parameter_s,'lv')
2876 2884 # Try to get a variable name and command to run
2877 2885 try:
2878 2886 # the variable name must be obtained from the parse_options
2879 2887 # output, which uses shlex.split to strip options out.
2880 2888 var,_ = args.split('=',1)
2881 2889 var = var.strip()
2882 2890 # But the the command has to be extracted from the original input
2883 2891 # parameter_s, not on what parse_options returns, to avoid the
2884 2892 # quote stripping which shlex.split performs on it.
2885 2893 _,cmd = parameter_s.split('=',1)
2886 2894 except ValueError:
2887 2895 var,cmd = '',''
2888 2896 # If all looks ok, proceed
2889 2897 out,err = self.shell.getoutputerror(cmd)
2890 2898 if err:
2891 2899 print >> Term.cerr,err
2892 2900 if opts.has_key('l'):
2893 2901 out = SList(out.split('\n'))
2894 2902 else:
2895 2903 out = LSString(out)
2896 2904 if opts.has_key('v'):
2897 2905 print '%s ==\n%s' % (var,pformat(out))
2898 2906 if var:
2899 2907 self.shell.user_ns.update({var:out})
2900 2908 else:
2901 2909 return out
2902 2910
2903 2911 def magic_sx(self, parameter_s=''):
2904 2912 """Shell execute - run a shell command and capture its output.
2905 2913
2906 2914 %sx command
2907 2915
2908 2916 IPython will run the given command using commands.getoutput(), and
2909 2917 return the result formatted as a list (split on '\\n'). Since the
2910 2918 output is _returned_, it will be stored in ipython's regular output
2911 2919 cache Out[N] and in the '_N' automatic variables.
2912 2920
2913 2921 Notes:
2914 2922
2915 2923 1) If an input line begins with '!!', then %sx is automatically
2916 2924 invoked. That is, while:
2917 2925 !ls
2918 2926 causes ipython to simply issue system('ls'), typing
2919 2927 !!ls
2920 2928 is a shorthand equivalent to:
2921 2929 %sx ls
2922 2930
2923 2931 2) %sx differs from %sc in that %sx automatically splits into a list,
2924 2932 like '%sc -l'. The reason for this is to make it as easy as possible
2925 2933 to process line-oriented shell output via further python commands.
2926 2934 %sc is meant to provide much finer control, but requires more
2927 2935 typing.
2928 2936
2929 2937 3) Just like %sc -l, this is a list with special attributes:
2930 2938
2931 2939 .l (or .list) : value as list.
2932 2940 .n (or .nlstr): value as newline-separated string.
2933 2941 .s (or .spstr): value as whitespace-separated string.
2934 2942
2935 2943 This is very useful when trying to use such lists as arguments to
2936 2944 system commands."""
2937 2945
2938 2946 if parameter_s:
2939 2947 out,err = self.shell.getoutputerror(parameter_s)
2940 2948 if err:
2941 2949 print >> Term.cerr,err
2942 2950 return SList(out.split('\n'))
2943 2951
2944 2952 def magic_bg(self, parameter_s=''):
2945 2953 """Run a job in the background, in a separate thread.
2946 2954
2947 2955 For example,
2948 2956
2949 2957 %bg myfunc(x,y,z=1)
2950 2958
2951 2959 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2952 2960 execution starts, a message will be printed indicating the job
2953 2961 number. If your job number is 5, you can use
2954 2962
2955 2963 myvar = jobs.result(5) or myvar = jobs[5].result
2956 2964
2957 2965 to assign this result to variable 'myvar'.
2958 2966
2959 2967 IPython has a job manager, accessible via the 'jobs' object. You can
2960 2968 type jobs? to get more information about it, and use jobs.<TAB> to see
2961 2969 its attributes. All attributes not starting with an underscore are
2962 2970 meant for public use.
2963 2971
2964 2972 In particular, look at the jobs.new() method, which is used to create
2965 2973 new jobs. This magic %bg function is just a convenience wrapper
2966 2974 around jobs.new(), for expression-based jobs. If you want to create a
2967 2975 new job with an explicit function object and arguments, you must call
2968 2976 jobs.new() directly.
2969 2977
2970 2978 The jobs.new docstring also describes in detail several important
2971 2979 caveats associated with a thread-based model for background job
2972 2980 execution. Type jobs.new? for details.
2973 2981
2974 2982 You can check the status of all jobs with jobs.status().
2975 2983
2976 2984 The jobs variable is set by IPython into the Python builtin namespace.
2977 2985 If you ever declare a variable named 'jobs', you will shadow this
2978 2986 name. You can either delete your global jobs variable to regain
2979 2987 access to the job manager, or make a new name and assign it manually
2980 2988 to the manager (stored in IPython's namespace). For example, to
2981 2989 assign the job manager to the Jobs name, use:
2982 2990
2983 2991 Jobs = __builtins__.jobs"""
2984 2992
2985 2993 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2986 2994
2987 2995 def magic_r(self, parameter_s=''):
2988 2996 """Repeat previous input.
2989 2997
2990 2998 Note: Consider using the more powerfull %rep instead!
2991 2999
2992 3000 If given an argument, repeats the previous command which starts with
2993 3001 the same string, otherwise it just repeats the previous input.
2994 3002
2995 3003 Shell escaped commands (with ! as first character) are not recognized
2996 3004 by this system, only pure python code and magic commands.
2997 3005 """
2998 3006
2999 3007 start = parameter_s.strip()
3000 3008 esc_magic = self.shell.ESC_MAGIC
3001 3009 # Identify magic commands even if automagic is on (which means
3002 3010 # the in-memory version is different from that typed by the user).
3003 3011 if self.shell.rc.automagic:
3004 3012 start_magic = esc_magic+start
3005 3013 else:
3006 3014 start_magic = start
3007 3015 # Look through the input history in reverse
3008 3016 for n in range(len(self.shell.input_hist)-2,0,-1):
3009 3017 input = self.shell.input_hist[n]
3010 3018 # skip plain 'r' lines so we don't recurse to infinity
3011 3019 if input != '_ip.magic("r")\n' and \
3012 3020 (input.startswith(start) or input.startswith(start_magic)):
3013 3021 #print 'match',`input` # dbg
3014 3022 print 'Executing:',input,
3015 3023 self.shell.runlines(input)
3016 3024 return
3017 3025 print 'No previous input matching `%s` found.' % start
3018 3026
3019 3027
3020 3028 def magic_bookmark(self, parameter_s=''):
3021 3029 """Manage IPython's bookmark system.
3022 3030
3023 3031 %bookmark <name> - set bookmark to current dir
3024 3032 %bookmark <name> <dir> - set bookmark to <dir>
3025 3033 %bookmark -l - list all bookmarks
3026 3034 %bookmark -d <name> - remove bookmark
3027 3035 %bookmark -r - remove all bookmarks
3028 3036
3029 3037 You can later on access a bookmarked folder with:
3030 3038 %cd -b <name>
3031 3039 or simply '%cd <name>' if there is no directory called <name> AND
3032 3040 there is such a bookmark defined.
3033 3041
3034 3042 Your bookmarks persist through IPython sessions, but they are
3035 3043 associated with each profile."""
3036 3044
3037 3045 opts,args = self.parse_options(parameter_s,'drl',mode='list')
3038 3046 if len(args) > 2:
3039 3047 raise UsageError("%bookmark: too many arguments")
3040 3048
3041 3049 bkms = self.db.get('bookmarks',{})
3042 3050
3043 3051 if opts.has_key('d'):
3044 3052 try:
3045 3053 todel = args[0]
3046 3054 except IndexError:
3047 3055 raise UsageError(
3048 3056 "%bookmark -d: must provide a bookmark to delete")
3049 3057 else:
3050 3058 try:
3051 3059 del bkms[todel]
3052 3060 except KeyError:
3053 3061 raise UsageError(
3054 3062 "%%bookmark -d: Can't delete bookmark '%s'" % todel)
3055 3063
3056 3064 elif opts.has_key('r'):
3057 3065 bkms = {}
3058 3066 elif opts.has_key('l'):
3059 3067 bks = bkms.keys()
3060 3068 bks.sort()
3061 3069 if bks:
3062 3070 size = max(map(len,bks))
3063 3071 else:
3064 3072 size = 0
3065 3073 fmt = '%-'+str(size)+'s -> %s'
3066 3074 print 'Current bookmarks:'
3067 3075 for bk in bks:
3068 3076 print fmt % (bk,bkms[bk])
3069 3077 else:
3070 3078 if not args:
3071 3079 raise UsageError("%bookmark: You must specify the bookmark name")
3072 3080 elif len(args)==1:
3073 3081 bkms[args[0]] = os.getcwd()
3074 3082 elif len(args)==2:
3075 3083 bkms[args[0]] = args[1]
3076 3084 self.db['bookmarks'] = bkms
3077 3085
3078 3086 def magic_pycat(self, parameter_s=''):
3079 3087 """Show a syntax-highlighted file through a pager.
3080 3088
3081 3089 This magic is similar to the cat utility, but it will assume the file
3082 3090 to be Python source and will show it with syntax highlighting. """
3083 3091
3084 3092 try:
3085 3093 filename = get_py_filename(parameter_s)
3086 3094 cont = file_read(filename)
3087 3095 except IOError:
3088 3096 try:
3089 3097 cont = eval(parameter_s,self.user_ns)
3090 3098 except NameError:
3091 3099 cont = None
3092 3100 if cont is None:
3093 3101 print "Error: no such file or variable"
3094 3102 return
3095 3103
3096 3104 page(self.shell.pycolorize(cont),
3097 3105 screen_lines=self.shell.rc.screen_length)
3098 3106
3099 3107 def magic_cpaste(self, parameter_s=''):
3100 3108 """Allows you to paste & execute a pre-formatted code block from clipboard
3101 3109
3102 3110 You must terminate the block with '--' (two minus-signs) alone on the
3103 3111 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3104 3112 is the new sentinel for this operation)
3105 3113
3106 3114 The block is dedented prior to execution to enable execution of method
3107 3115 definitions. '>' and '+' characters at the beginning of a line are
3108 3116 ignored, to allow pasting directly from e-mails or diff files. The
3109 3117 executed block is also assigned to variable named 'pasted_block' for
3110 3118 later editing with '%edit pasted_block'.
3111 3119
3112 3120 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3113 3121 This assigns the pasted block to variable 'foo' as string, without
3114 3122 dedenting or executing it.
3115 3123
3116 3124 Do not be alarmed by garbled output on Windows (it's a readline bug).
3117 3125 Just press enter and type -- (and press enter again) and the block
3118 3126 will be what was just pasted.
3119 3127
3120 3128 IPython statements (magics, shell escapes) are not supported (yet).
3121 3129 """
3122 3130 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3123 3131 par = args.strip()
3124 3132 sentinel = opts.get('s','--')
3125 3133
3126 3134 from IPython import iplib
3127 3135 lines = []
3128 3136 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3129 3137 while 1:
3130 3138 l = iplib.raw_input_original(':')
3131 3139 if l ==sentinel:
3132 3140 break
3133 3141 lines.append(l.lstrip('>').lstrip('+'))
3134 3142 block = "\n".join(lines) + '\n'
3135 3143 #print "block:\n",block
3136 3144 if not par:
3137 3145 b = textwrap.dedent(block)
3138 3146 exec b in self.user_ns
3139 3147 self.user_ns['pasted_block'] = b
3140 3148 else:
3141 3149 self.user_ns[par] = block
3142 3150 print "Block assigned to '%s'" % par
3143 3151
3144 3152 def magic_quickref(self,arg):
3145 3153 """ Show a quick reference sheet """
3146 3154 import IPython.usage
3147 3155 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3148 3156
3149 3157 page(qr)
3150 3158
3151 3159 def magic_upgrade(self,arg):
3152 3160 """ Upgrade your IPython installation
3153 3161
3154 3162 This will copy the config files that don't yet exist in your
3155 3163 ipython dir from the system config dir. Use this after upgrading
3156 3164 IPython if you don't wish to delete your .ipython dir.
3157 3165
3158 3166 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3159 3167 new users)
3160 3168
3161 3169 """
3162 3170 ip = self.getapi()
3163 3171 ipinstallation = path(IPython.__file__).dirname()
3164 3172 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3165 3173 src_config = ipinstallation / 'UserConfig'
3166 3174 userdir = path(ip.options.ipythondir)
3167 3175 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3168 3176 print ">",cmd
3169 3177 shell(cmd)
3170 3178 if arg == '-nolegacy':
3171 3179 legacy = userdir.files('ipythonrc*')
3172 3180 print "Nuking legacy files:",legacy
3173 3181
3174 3182 [p.remove() for p in legacy]
3175 3183 suffix = (sys.platform == 'win32' and '.ini' or '')
3176 3184 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3177 3185
3178 3186
3179 3187 def magic_doctest_mode(self,parameter_s=''):
3180 3188 """Toggle doctest mode on and off.
3181 3189
3182 3190 This mode allows you to toggle the prompt behavior between normal
3183 3191 IPython prompts and ones that are as similar to the default IPython
3184 3192 interpreter as possible.
3185 3193
3186 3194 It also supports the pasting of code snippets that have leading '>>>'
3187 3195 and '...' prompts in them. This means that you can paste doctests from
3188 3196 files or docstrings (even if they have leading whitespace), and the
3189 3197 code will execute correctly. You can then use '%history -tn' to see
3190 3198 the translated history without line numbers; this will give you the
3191 3199 input after removal of all the leading prompts and whitespace, which
3192 3200 can be pasted back into an editor.
3193 3201
3194 3202 With these features, you can switch into this mode easily whenever you
3195 3203 need to do testing and changes to doctests, without having to leave
3196 3204 your existing IPython session.
3197 3205 """
3198 3206
3199 3207 # XXX - Fix this to have cleaner activate/deactivate calls.
3200 3208 from IPython.Extensions import InterpreterPasteInput as ipaste
3201 3209 from IPython.ipstruct import Struct
3202 3210
3203 3211 # Shorthands
3204 3212 shell = self.shell
3205 3213 oc = shell.outputcache
3206 3214 rc = shell.rc
3207 3215 meta = shell.meta
3208 3216 # dstore is a data store kept in the instance metadata bag to track any
3209 3217 # changes we make, so we can undo them later.
3210 3218 dstore = meta.setdefault('doctest_mode',Struct())
3211 3219 save_dstore = dstore.setdefault
3212 3220
3213 3221 # save a few values we'll need to recover later
3214 3222 mode = save_dstore('mode',False)
3215 3223 save_dstore('rc_pprint',rc.pprint)
3216 3224 save_dstore('xmode',shell.InteractiveTB.mode)
3217 3225 save_dstore('rc_separate_in',rc.separate_in)
3218 3226 save_dstore('rc_separate_out',rc.separate_out)
3219 3227 save_dstore('rc_separate_out2',rc.separate_out2)
3220 3228 save_dstore('rc_prompts_pad_left',rc.prompts_pad_left)
3221 3229
3222 3230 if mode == False:
3223 3231 # turn on
3224 3232 ipaste.activate_prefilter()
3225 3233
3226 3234 oc.prompt1.p_template = '>>> '
3227 3235 oc.prompt2.p_template = '... '
3228 3236 oc.prompt_out.p_template = ''
3229 3237
3230 3238 oc.prompt1.sep = '\n'
3231 3239 oc.output_sep = ''
3232 3240 oc.output_sep2 = ''
3233 3241
3234 3242 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3235 3243 oc.prompt_out.pad_left = False
3236 3244
3237 3245 rc.pprint = False
3238 3246
3239 3247 shell.magic_xmode('Plain')
3240 3248
3241 3249 else:
3242 3250 # turn off
3243 3251 ipaste.deactivate_prefilter()
3244 3252
3245 3253 oc.prompt1.p_template = rc.prompt_in1
3246 3254 oc.prompt2.p_template = rc.prompt_in2
3247 3255 oc.prompt_out.p_template = rc.prompt_out
3248 3256
3249 3257 oc.prompt1.sep = dstore.rc_separate_in
3250 3258 oc.output_sep = dstore.rc_separate_out
3251 3259 oc.output_sep2 = dstore.rc_separate_out2
3252 3260
3253 3261 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3254 3262 oc.prompt_out.pad_left = dstore.rc_prompts_pad_left
3255 3263
3256 3264 rc.pprint = dstore.rc_pprint
3257 3265
3258 3266 shell.magic_xmode(dstore.xmode)
3259 3267
3260 3268 # Store new mode and inform
3261 3269 dstore.mode = bool(1-int(mode))
3262 3270 print 'Doctest mode is:',
3263 3271 print ['OFF','ON'][dstore.mode]
3264 3272
3265 3273 # end Magic
@@ -1,75 +1,82 b''
1 1 """ User configuration file for IPython
2 2
3 3 This is a more flexible and safe way to configure ipython than *rc files
4 4 (ipythonrc, ipythonrc-pysh etc.)
5 5
6 6 This file is always imported on ipython startup. You can import the
7 7 ipython extensions you need here (see IPython/Extensions directory).
8 8
9 9 Feel free to edit this file to customize your ipython experience.
10 10
11 11 Note that as such this file does nothing, for backwards compatibility.
12 12 Consult e.g. file 'ipy_profile_sh.py' for an example of the things
13 13 you can do here.
14 14
15 15 See http://ipython.scipy.org/moin/IpythonExtensionApi for detailed
16 16 description on what you could do here.
17 17 """
18 18
19 19 # Most of your config files and extensions will probably start with this import
20 20
21 21 import IPython.ipapi
22 22 ip = IPython.ipapi.get()
23 23
24 24 # You probably want to uncomment this if you did %upgrade -nolegacy
25 25 # import ipy_defaults
26 26
27 27 import os
28 28
29 29 def main():
30 30 # Handy tab-completers for %cd, %run, import etc.
31 31 # Try commenting this out if you have completion problems/slowness
32 32 # import ipy_stock_completers
33 33
34 34 # uncomment if you want to get ipython -p sh behaviour
35 35 # without having to use command line switches
36 36
37 37 # import ipy_profile_sh
38 38
39 39
40 40 # Configure your favourite editor?
41 41 # Good idea e.g. for %edit os.path.isfile
42 42
43 43 #import ipy_editors
44 44
45 45 # Choose one of these:
46 46
47 47 #ipy_editors.scite()
48 48 #ipy_editors.scite('c:/opt/scite/scite.exe')
49 49 #ipy_editors.komodo()
50 50 #ipy_editors.idle()
51 51 # ... or many others, try 'ipy_editors??' after import to see them
52 52
53 53 # Or roll your own:
54 54 #ipy_editors.install_editor("c:/opt/jed +$line $file")
55 55
56 56
57 57 o = ip.options
58 58 # An example on how to set options
59 59 #o.autocall = 1
60 60 o.system_verbose = 0
61 61
62 62 #import_all("os sys")
63 63 #execf('~/_ipython/ns.py')
64 64
65 # A different, more compact set of prompts from the default ones, that
66 # always show your current location in the filesystem:
67
68 #o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>'
69 #o.prompt_in2 = r'.\D: '
70 #o.prompt_out = r'[\#] '
71
65 72 # some config helper functions you can use
66 73 def import_all(modules):
67 74 """ Usage: import_all("os sys") """
68 75 for m in modules.split():
69 76 ip.ex("from %s import *" % m)
70 77
71 78 def execf(fname):
72 79 """ Execute a file in user namespace """
73 80 ip.ex('execfile("%s")' % os.path.expanduser(fname))
74 81
75 82 main()
@@ -1,7241 +1,7251 b''
1 2007-11-25 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/Logger.py (Logger.logstop): add a proper logstop()
4 method to fully stop the logger, along with a corresponding
5 %logstop magic for interactive use.
6
7 * IPython/Extensions/ipy_host_completers.py: added new host
8 completers functionality, contributed by Gael Pasgrimaud
9 <gawel-AT-afpy.org>.
10
1 11 2007-11-24 Fernando Perez <Fernando.Perez@colorado.edu>
2 12
3 13 * IPython/DPyGetOpt.py (ArgumentError): Apply patch by Paul Mueller
4 14 <gakusei-AT-dakotacom.net>, to fix deprecated string exceptions in
5 15 options handling. Unicode fix in %whos (committed a while ago)
6 16 was also contributed by Paul.
7 17
8 18 2007-11-23 Darren Dale <darren.dale@cornell.edu>
9 19 * ipy_traits_completer.py: let traits_completer respect the user's
10 20 readline_omit__names setting.
11 21
12 22 2007-11-08 Ville Vainio <vivainio@gmail.com>
13 * ipy_completers.py (import completer): assume 'xml' module exists.
23 * ipy_completers.py (import completer): assume 'xml' module exists.
14 24 Do not add every module twice anymore. Closes #196.
15
25
16 26 * ipy_completers.py, ipy_app_completers.py: Add proper apt-get
17 27 completer that uses apt-cache to search for existing packages.
18 28
19 29 2007-11-06 Ville Vainio <vivainio@gmail.com>
20 30
21 31 * Prompts.py: Do not update _oh and _123 when do_full_cache is not
22 32 true. Closes #194.
23 33
24 34 2007-11-01 Brian Granger <ellisonbg@gmail.com>
25 35
26 36 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
27 37 working with OS X 10.5 libedit implementation of readline.
28 38
29 39 2007-10-24 Ville Vainio <vivainio@gmail.com>
30 40
31 41 * iplib.py(user_setup): To route around buggy installations where
32 42 UserConfig is not available, create a minimal _ipython.
33 43
34 44 * iplib.py: Unicode fixes from Jorgen.
35 45
36 46 * genutils.py: Slist now has new method 'fields()' for extraction of
37 47 whitespace-separated fields from line-oriented data.
38 48
39 49 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
40 50
41 51 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
42 52 when querying objects with no __class__ attribute (such as
43 53 f2py-generated modules).
44 54
45 55 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
46 56
47 57 * IPython/Magic.py (magic_time): track compilation time and report
48 58 it if longer than 0.1s (fix done to %time and %timeit). After a
49 59 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
50 60
51 61 2007-09-18 Ville Vainio <vivainio@gmail.com>
52 62
53 63 * genutils.py(make_quoted_expr): Do not use Itpl, it does
54 64 not support unicode at the moment. Fixes (many) magic calls with
55 65 special characters.
56 66
57 67 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
58 68
59 69 * IPython/genutils.py (doctest_reload): expose the doctest
60 70 reloader to the user so that people can easily reset doctest while
61 71 using it interactively. Fixes a problem reported by Jorgen.
62 72
63 73 * IPython/iplib.py (InteractiveShell.__init__): protect the
64 74 FakeModule instances used for __main__ in %run calls from
65 75 deletion, so that user code defined in them isn't left with
66 76 dangling references due to the Python module deletion machinery.
67 77 This should fix the problems reported by Darren.
68 78
69 79 2007-09-10 Darren Dale <dd55@cornell.edu>
70 80
71 81 * Cleanup of IPShellQt and IPShellQt4
72 82
73 83 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
74 84
75 85 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
76 86 doctest support.
77 87
78 88 * IPython/iplib.py (safe_execfile): minor docstring improvements.
79 89
80 90 2007-09-08 Ville Vainio <vivainio@gmail.com>
81 91
82 92 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
83 93 directory, not the target directory.
84 94
85 95 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
86 96 exception that won't print the tracebacks. Switched many magics to
87 97 raise them on error situations, also GetoptError is not printed
88 98 anymore.
89 99
90 100 2007-09-07 Ville Vainio <vivainio@gmail.com>
91 101
92 102 * iplib.py: do not auto-alias "dir", it screws up other dir auto
93 103 aliases.
94 104
95 105 * genutils.py: SList.grep() implemented.
96 106
97 107 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
98 108 for easy "out of the box" setup of several common editors, so that
99 109 e.g. '%edit os.path.isfile' will jump to the correct line
100 110 automatically. Contributions for command lines of your favourite
101 111 editors welcome.
102 112
103 113 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
104 114
105 115 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
106 116 preventing source display in certain cases. In reality I think
107 117 the problem is with Ubuntu's Python build, but this change works
108 118 around the issue in some cases (not in all, unfortunately). I'd
109 119 filed a Python bug on this with more details, but in the change of
110 120 bug trackers it seems to have been lost.
111 121
112 122 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
113 123 not the same, it's not self-documenting, doesn't allow range
114 124 selection, and sorts alphabetically instead of numerically.
115 125 (magic_r): restore %r. No, "up + enter. One char magic" is not
116 126 the same thing, since %r takes parameters to allow fast retrieval
117 127 of old commands. I've received emails from users who use this a
118 128 LOT, so it stays.
119 129 (magic_automagic): restore %automagic. "use _ip.option.automagic"
120 130 is not a valid replacement b/c it doesn't provide an complete
121 131 explanation (which the automagic docstring does).
122 132 (magic_autocall): restore %autocall, with improved docstring.
123 133 Same argument as for others, "use _ip.options.autocall" is not a
124 134 valid replacement.
125 135 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
126 136 tutorials and online docs.
127 137
128 138 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
129 139
130 140 * IPython/usage.py (quick_reference): mention magics in quickref,
131 141 modified main banner to mention %quickref.
132 142
133 143 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
134 144
135 145 2007-09-06 Ville Vainio <vivainio@gmail.com>
136 146
137 147 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
138 148 Callable aliases now pass the _ip as first arg. This breaks
139 149 compatibility with earlier 0.8.2.svn series! (though they should
140 150 not have been in use yet outside these few extensions)
141 151
142 152 2007-09-05 Ville Vainio <vivainio@gmail.com>
143 153
144 154 * external/mglob.py: expand('dirname') => ['dirname'], instead
145 155 of ['dirname/foo','dirname/bar', ...].
146 156
147 157 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
148 158 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
149 159 is useful for others as well).
150 160
151 161 * iplib.py: on callable aliases (as opposed to old style aliases),
152 162 do var_expand() immediately, and use make_quoted_expr instead
153 163 of hardcoded r"""
154 164
155 165 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
156 166 if not available load ipy_fsops.py for cp, mv, etc. replacements
157 167
158 168 * OInspect.py, ipy_which.py: improve %which and obj? for callable
159 169 aliases
160 170
161 171 2007-09-04 Ville Vainio <vivainio@gmail.com>
162 172
163 173 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
164 174 Relicensed under BSD with the authors approval.
165 175
166 176 * ipmaker.py, usage.py: Remove %magic from default banner, improve
167 177 %quickref
168 178
169 179 2007-09-03 Ville Vainio <vivainio@gmail.com>
170 180
171 181 * Magic.py: %time now passes expression through prefilter,
172 182 allowing IPython syntax.
173 183
174 184 2007-09-01 Ville Vainio <vivainio@gmail.com>
175 185
176 186 * ipmaker.py: Always show full traceback when newstyle config fails
177 187
178 188 2007-08-27 Ville Vainio <vivainio@gmail.com>
179 189
180 190 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
181 191
182 192 2007-08-26 Ville Vainio <vivainio@gmail.com>
183 193
184 194 * ipmaker.py: Command line args have the highest priority again
185 195
186 196 * iplib.py, ipmaker.py: -i command line argument now behaves as in
187 197 normal python, i.e. leaves the IPython session running after -c
188 198 command or running a batch file from command line.
189 199
190 200 2007-08-22 Ville Vainio <vivainio@gmail.com>
191 201
192 202 * iplib.py: no extra empty (last) line in raw hist w/ multiline
193 203 statements
194 204
195 205 * logger.py: Fix bug where blank lines in history were not
196 206 added until AFTER adding the current line; translated and raw
197 207 history should finally be in sync with prompt now.
198 208
199 209 * ipy_completers.py: quick_completer now makes it easy to create
200 210 trivial custom completers
201 211
202 212 * clearcmd.py: shadow history compression & erasing, fixed input hist
203 213 clearing.
204 214
205 215 * envpersist.py, history.py: %env (sh profile only), %hist completers
206 216
207 217 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
208 218 term title now include the drive letter, and always use / instead of
209 219 os.sep (as per recommended approach for win32 ipython in general).
210 220
211 221 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
212 222 plain python scripts from ipykit command line by running
213 223 "py myscript.py", even w/o installed python.
214 224
215 225 2007-08-21 Ville Vainio <vivainio@gmail.com>
216 226
217 227 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
218 228 (for backwards compatibility)
219 229
220 230 * history.py: switch back to %hist -t from %hist -r as default.
221 231 At least until raw history is fixed for good.
222 232
223 233 2007-08-20 Ville Vainio <vivainio@gmail.com>
224 234
225 235 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
226 236 locate alias redeclarations etc. Also, avoid handling
227 237 _ip.IP.alias_table directly, prefer using _ip.defalias.
228 238
229 239
230 240 2007-08-15 Ville Vainio <vivainio@gmail.com>
231 241
232 242 * prefilter.py: ! is now always served first
233 243
234 244 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
235 245
236 246 * IPython/iplib.py (safe_execfile): fix the SystemExit
237 247 auto-suppression code to work in Python2.4 (the internal structure
238 248 of that exception changed and I'd only tested the code with 2.5).
239 249 Bug reported by a SciPy attendee.
240 250
241 251 2007-08-13 Ville Vainio <vivainio@gmail.com>
242 252
243 253 * prefilter.py: reverted !c:/bin/foo fix, made % in
244 254 multiline specials work again
245 255
246 256 2007-08-13 Ville Vainio <vivainio@gmail.com>
247 257
248 258 * prefilter.py: Take more care to special-case !, so that
249 259 !c:/bin/foo.exe works.
250 260
251 261 * setup.py: if we are building eggs, strip all docs and
252 262 examples (it doesn't make sense to bytecompile examples,
253 263 and docs would be in an awkward place anyway).
254 264
255 265 * Ryan Krauss' patch fixes start menu shortcuts when IPython
256 266 is installed into a directory that has spaces in the name.
257 267
258 268 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
259 269
260 270 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
261 271 doctest profile and %doctest_mode, so they actually generate the
262 272 blank lines needed by doctest to separate individual tests.
263 273
264 274 * IPython/iplib.py (safe_execfile): modify so that running code
265 275 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
266 276 doesn't get a printed traceback. Any other value in sys.exit(),
267 277 including the empty call, still generates a traceback. This
268 278 enables use of %run without having to pass '-e' for codes that
269 279 correctly set the exit status flag.
270 280
271 281 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
272 282
273 283 * IPython/iplib.py (InteractiveShell.post_config_initialization):
274 284 fix problems with doctests failing when run inside IPython due to
275 285 IPython's modifications of sys.displayhook.
276 286
277 287 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
278 288
279 289 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
280 290 a string with names.
281 291
282 292 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
283 293
284 294 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
285 295 magic to toggle on/off the doctest pasting support without having
286 296 to leave a session to switch to a separate profile.
287 297
288 298 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
289 299
290 300 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
291 301 introduce a blank line between inputs, to conform to doctest
292 302 requirements.
293 303
294 304 * IPython/OInspect.py (Inspector.pinfo): fix another part where
295 305 auto-generated docstrings for new-style classes were showing up.
296 306
297 307 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
298 308
299 309 * api_changes: Add new file to track backward-incompatible
300 310 user-visible changes.
301 311
302 312 2007-08-06 Ville Vainio <vivainio@gmail.com>
303 313
304 314 * ipmaker.py: fix bug where user_config_ns didn't exist at all
305 315 before all the config files were handled.
306 316
307 317 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
308 318
309 319 * IPython/irunner.py (RunnerFactory): Add new factory class for
310 320 creating reusable runners based on filenames.
311 321
312 322 * IPython/Extensions/ipy_profile_doctest.py: New profile for
313 323 doctest support. It sets prompts/exceptions as similar to
314 324 standard Python as possible, so that ipython sessions in this
315 325 profile can be easily pasted as doctests with minimal
316 326 modifications. It also enables pasting of doctests from external
317 327 sources (even if they have leading whitespace), so that you can
318 328 rerun doctests from existing sources.
319 329
320 330 * IPython/iplib.py (_prefilter): fix a buglet where after entering
321 331 some whitespace, the prompt would become a continuation prompt
322 332 with no way of exiting it other than Ctrl-C. This fix brings us
323 333 into conformity with how the default python prompt works.
324 334
325 335 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
326 336 Add support for pasting not only lines that start with '>>>', but
327 337 also with ' >>>'. That is, arbitrary whitespace can now precede
328 338 the prompts. This makes the system useful for pasting doctests
329 339 from docstrings back into a normal session.
330 340
331 341 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
332 342
333 343 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
334 344 r1357, which had killed multiple invocations of an embedded
335 345 ipython (this means that example-embed has been broken for over 1
336 346 year!!!). Rather than possibly breaking the batch stuff for which
337 347 the code in iplib.py/interact was introduced, I worked around the
338 348 problem in the embedding class in Shell.py. We really need a
339 349 bloody test suite for this code, I'm sick of finding stuff that
340 350 used to work breaking left and right every time I use an old
341 351 feature I hadn't touched in a few months.
342 352 (kill_embedded): Add a new magic that only shows up in embedded
343 353 mode, to allow users to permanently deactivate an embedded instance.
344 354
345 355 2007-08-01 Ville Vainio <vivainio@gmail.com>
346 356
347 357 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
348 358 history gets out of sync on runlines (e.g. when running macros).
349 359
350 360 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
351 361
352 362 * IPython/Magic.py (magic_colors): fix win32-related error message
353 363 that could appear under *nix when readline was missing. Patch by
354 364 Scott Jackson, closes #175.
355 365
356 366 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
357 367
358 368 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
359 369 completer that it traits-aware, so that traits objects don't show
360 370 all of their internal attributes all the time.
361 371
362 372 * IPython/genutils.py (dir2): moved this code from inside
363 373 completer.py to expose it publicly, so I could use it in the
364 374 wildcards bugfix.
365 375
366 376 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
367 377 Stefan with Traits.
368 378
369 379 * IPython/completer.py (Completer.attr_matches): change internal
370 380 var name from 'object' to 'obj', since 'object' is now a builtin
371 381 and this can lead to weird bugs if reusing this code elsewhere.
372 382
373 383 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
374 384
375 385 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
376 386 'foo?' and update the code to prevent printing of default
377 387 docstrings that started appearing after I added support for
378 388 new-style classes. The approach I'm using isn't ideal (I just
379 389 special-case those strings) but I'm not sure how to more robustly
380 390 differentiate between truly user-written strings and Python's
381 391 automatic ones.
382 392
383 393 2007-07-09 Ville Vainio <vivainio@gmail.com>
384 394
385 395 * completer.py: Applied Matthew Neeley's patch:
386 396 Dynamic attributes from trait_names and _getAttributeNames are added
387 397 to the list of tab completions, but when this happens, the attribute
388 398 list is turned into a set, so the attributes are unordered when
389 399 printed, which makes it hard to find the right completion. This patch
390 400 turns this set back into a list and sort it.
391 401
392 402 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
393 403
394 404 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
395 405 classes in various inspector functions.
396 406
397 407 2007-06-28 Ville Vainio <vivainio@gmail.com>
398 408
399 409 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
400 410 Implement "shadow" namespace, and callable aliases that reside there.
401 411 Use them by:
402 412
403 413 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
404 414
405 415 foo hello world
406 416 (gets translated to:)
407 417 _sh.foo(r"""hello world""")
408 418
409 419 In practice, this kind of alias can take the role of a magic function
410 420
411 421 * New generic inspect_object, called on obj? and obj??
412 422
413 423 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
414 424
415 425 * IPython/ultraTB.py (findsource): fix a problem with
416 426 inspect.getfile that can cause crashes during traceback construction.
417 427
418 428 2007-06-14 Ville Vainio <vivainio@gmail.com>
419 429
420 430 * iplib.py (handle_auto): Try to use ascii for printing "--->"
421 431 autocall rewrite indication, becausesometimes unicode fails to print
422 432 properly (and you get ' - - - '). Use plain uncoloured ---> for
423 433 unicode.
424 434
425 435 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
426 436
427 437 . pickleshare 'hash' commands (hget, hset, hcompress,
428 438 hdict) for efficient shadow history storage.
429 439
430 440 2007-06-13 Ville Vainio <vivainio@gmail.com>
431 441
432 442 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
433 443 Added kw arg 'interactive', tell whether vars should be visible
434 444 with %whos.
435 445
436 446 2007-06-11 Ville Vainio <vivainio@gmail.com>
437 447
438 448 * pspersistence.py, Magic.py, iplib.py: directory history now saved
439 449 to db
440 450
441 451 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
442 452 Also, it exits IPython immediately after evaluating the command (just like
443 453 std python)
444 454
445 455 2007-06-05 Walter Doerwald <walter@livinglogic.de>
446 456
447 457 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
448 458 Python string and captures the output. (Idea and original patch by
449 459 Stefan van der Walt)
450 460
451 461 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
452 462
453 463 * IPython/ultraTB.py (VerboseTB.text): update printing of
454 464 exception types for Python 2.5 (now all exceptions in the stdlib
455 465 are new-style classes).
456 466
457 467 2007-05-31 Walter Doerwald <walter@livinglogic.de>
458 468
459 469 * IPython/Extensions/igrid.py: Add new commands refresh and
460 470 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
461 471 the iterator once (refresh) or after every x seconds (refresh_timer).
462 472 Add a working implementation of "searchexpression", where the text
463 473 entered is not the text to search for, but an expression that must
464 474 be true. Added display of shortcuts to the menu. Added commands "pickinput"
465 475 and "pickinputattr" that put the object or attribute under the cursor
466 476 in the input line. Split the statusbar to be able to display the currently
467 477 active refresh interval. (Patch by Nik Tautenhahn)
468 478
469 479 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
470 480
471 481 * fixing set_term_title to use ctypes as default
472 482
473 483 * fixing set_term_title fallback to work when curent dir
474 484 is on a windows network share
475 485
476 486 2007-05-28 Ville Vainio <vivainio@gmail.com>
477 487
478 488 * %cpaste: strip + with > from left (diffs).
479 489
480 490 * iplib.py: Fix crash when readline not installed
481 491
482 492 2007-05-26 Ville Vainio <vivainio@gmail.com>
483 493
484 494 * generics.py: intruduce easy to extend result_display generic
485 495 function (using simplegeneric.py).
486 496
487 497 * Fixed the append functionality of %set.
488 498
489 499 2007-05-25 Ville Vainio <vivainio@gmail.com>
490 500
491 501 * New magic: %rep (fetch / run old commands from history)
492 502
493 503 * New extension: mglob (%mglob magic), for powerful glob / find /filter
494 504 like functionality
495 505
496 506 % maghistory.py: %hist -g PATTERM greps the history for pattern
497 507
498 508 2007-05-24 Walter Doerwald <walter@livinglogic.de>
499 509
500 510 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
501 511 browse the IPython input history
502 512
503 513 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
504 514 (mapped to "i") can be used to put the object under the curser in the input
505 515 line. pickinputattr (mapped to "I") does the same for the attribute under
506 516 the cursor.
507 517
508 518 2007-05-24 Ville Vainio <vivainio@gmail.com>
509 519
510 520 * Grand magic cleansing (changeset [2380]):
511 521
512 522 * Introduce ipy_legacy.py where the following magics were
513 523 moved:
514 524
515 525 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
516 526
517 527 If you need them, either use default profile or "import ipy_legacy"
518 528 in your ipy_user_conf.py
519 529
520 530 * Move sh and scipy profile to Extensions from UserConfig. this implies
521 531 you should not edit them, but you don't need to run %upgrade when
522 532 upgrading IPython anymore.
523 533
524 534 * %hist/%history now operates in "raw" mode by default. To get the old
525 535 behaviour, run '%hist -n' (native mode).
526 536
527 537 * split ipy_stock_completers.py to ipy_stock_completers.py and
528 538 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
529 539 installed as default.
530 540
531 541 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
532 542 handling.
533 543
534 544 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
535 545 input if readline is available.
536 546
537 547 2007-05-23 Ville Vainio <vivainio@gmail.com>
538 548
539 549 * macro.py: %store uses __getstate__ properly
540 550
541 551 * exesetup.py: added new setup script for creating
542 552 standalone IPython executables with py2exe (i.e.
543 553 no python installation required).
544 554
545 555 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
546 556 its place.
547 557
548 558 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
549 559
550 560 2007-05-21 Ville Vainio <vivainio@gmail.com>
551 561
552 562 * platutil_win32.py (set_term_title): handle
553 563 failure of 'title' system call properly.
554 564
555 565 2007-05-17 Walter Doerwald <walter@livinglogic.de>
556 566
557 567 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
558 568 (Bug detected by Paul Mueller).
559 569
560 570 2007-05-16 Ville Vainio <vivainio@gmail.com>
561 571
562 572 * ipy_profile_sci.py, ipython_win_post_install.py: Create
563 573 new "sci" profile, effectively a modern version of the old
564 574 "scipy" profile (which is now slated for deprecation).
565 575
566 576 2007-05-15 Ville Vainio <vivainio@gmail.com>
567 577
568 578 * pycolorize.py, pycolor.1: Paul Mueller's patches that
569 579 make pycolorize read input from stdin when run without arguments.
570 580
571 581 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
572 582
573 583 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
574 584 it in sh profile (instead of ipy_system_conf.py).
575 585
576 586 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
577 587 aliases are now lower case on windows (MyCommand.exe => mycommand).
578 588
579 589 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
580 590 Macros are now callable objects that inherit from ipapi.IPyAutocall,
581 591 i.e. get autocalled regardless of system autocall setting.
582 592
583 593 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
584 594
585 595 * IPython/rlineimpl.py: check for clear_history in readline and
586 596 make it a dummy no-op if not available. This function isn't
587 597 guaranteed to be in the API and appeared in Python 2.4, so we need
588 598 to check it ourselves. Also, clean up this file quite a bit.
589 599
590 600 * ipython.1: update man page and full manual with information
591 601 about threads (remove outdated warning). Closes #151.
592 602
593 603 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
594 604
595 605 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
596 606 in trunk (note that this made it into the 0.8.1 release already,
597 607 but the changelogs didn't get coordinated). Many thanks to Gael
598 608 Varoquaux <gael.varoquaux-AT-normalesup.org>
599 609
600 610 2007-05-09 *** Released version 0.8.1
601 611
602 612 2007-05-10 Walter Doerwald <walter@livinglogic.de>
603 613
604 614 * IPython/Extensions/igrid.py: Incorporate html help into
605 615 the module, so we don't have to search for the file.
606 616
607 617 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
608 618
609 619 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
610 620
611 621 2007-04-30 Ville Vainio <vivainio@gmail.com>
612 622
613 623 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
614 624 user has illegal (non-ascii) home directory name
615 625
616 626 2007-04-27 Ville Vainio <vivainio@gmail.com>
617 627
618 628 * platutils_win32.py: implement set_term_title for windows
619 629
620 630 * Update version number
621 631
622 632 * ipy_profile_sh.py: more informative prompt (2 dir levels)
623 633
624 634 2007-04-26 Walter Doerwald <walter@livinglogic.de>
625 635
626 636 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
627 637 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
628 638 bug discovered by Ville).
629 639
630 640 2007-04-26 Ville Vainio <vivainio@gmail.com>
631 641
632 642 * Extensions/ipy_completers.py: Olivier's module completer now
633 643 saves the list of root modules if it takes > 4 secs on the first run.
634 644
635 645 * Magic.py (%rehashx): %rehashx now clears the completer cache
636 646
637 647
638 648 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
639 649
640 650 * ipython.el: fix incorrect color scheme, reported by Stefan.
641 651 Closes #149.
642 652
643 653 * IPython/PyColorize.py (Parser.format2): fix state-handling
644 654 logic. I still don't like how that code handles state, but at
645 655 least now it should be correct, if inelegant. Closes #146.
646 656
647 657 2007-04-25 Ville Vainio <vivainio@gmail.com>
648 658
649 659 * Extensions/ipy_which.py: added extension for %which magic, works
650 660 a lot like unix 'which' but also finds and expands aliases, and
651 661 allows wildcards.
652 662
653 663 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
654 664 as opposed to returning nothing.
655 665
656 666 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
657 667 ipy_stock_completers on default profile, do import on sh profile.
658 668
659 669 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
660 670
661 671 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
662 672 like ipython.py foo.py which raised a IndexError.
663 673
664 674 2007-04-21 Ville Vainio <vivainio@gmail.com>
665 675
666 676 * Extensions/ipy_extutil.py: added extension to manage other ipython
667 677 extensions. Now only supports 'ls' == list extensions.
668 678
669 679 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
670 680
671 681 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
672 682 would prevent use of the exception system outside of a running
673 683 IPython instance.
674 684
675 685 2007-04-20 Ville Vainio <vivainio@gmail.com>
676 686
677 687 * Extensions/ipy_render.py: added extension for easy
678 688 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
679 689 'Iptl' template notation,
680 690
681 691 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
682 692 safer & faster 'import' completer.
683 693
684 694 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
685 695 and _ip.defalias(name, command).
686 696
687 697 * Extensions/ipy_exportdb.py: New extension for exporting all the
688 698 %store'd data in a portable format (normal ipapi calls like
689 699 defmacro() etc.)
690 700
691 701 2007-04-19 Ville Vainio <vivainio@gmail.com>
692 702
693 703 * upgrade_dir.py: skip junk files like *.pyc
694 704
695 705 * Release.py: version number to 0.8.1
696 706
697 707 2007-04-18 Ville Vainio <vivainio@gmail.com>
698 708
699 709 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
700 710 and later on win32.
701 711
702 712 2007-04-16 Ville Vainio <vivainio@gmail.com>
703 713
704 714 * iplib.py (showtraceback): Do not crash when running w/o readline.
705 715
706 716 2007-04-12 Walter Doerwald <walter@livinglogic.de>
707 717
708 718 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
709 719 sorted (case sensitive with files and dirs mixed).
710 720
711 721 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
712 722
713 723 * IPython/Release.py (version): Open trunk for 0.8.1 development.
714 724
715 725 2007-04-10 *** Released version 0.8.0
716 726
717 727 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
718 728
719 729 * Tag 0.8.0 for release.
720 730
721 731 * IPython/iplib.py (reloadhist): add API function to cleanly
722 732 reload the readline history, which was growing inappropriately on
723 733 every %run call.
724 734
725 735 * win32_manual_post_install.py (run): apply last part of Nicolas
726 736 Pernetty's patch (I'd accidentally applied it in a different
727 737 directory and this particular file didn't get patched).
728 738
729 739 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
730 740
731 741 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
732 742 find the main thread id and use the proper API call. Thanks to
733 743 Stefan for the fix.
734 744
735 745 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
736 746 unit tests to reflect fixed ticket #52, and add more tests sent by
737 747 him.
738 748
739 749 * IPython/iplib.py (raw_input): restore the readline completer
740 750 state on every input, in case third-party code messed it up.
741 751 (_prefilter): revert recent addition of early-escape checks which
742 752 prevent many valid alias calls from working.
743 753
744 754 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
745 755 flag for sigint handler so we don't run a full signal() call on
746 756 each runcode access.
747 757
748 758 * IPython/Magic.py (magic_whos): small improvement to diagnostic
749 759 message.
750 760
751 761 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
752 762
753 763 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
754 764 asynchronous exceptions working, i.e., Ctrl-C can actually
755 765 interrupt long-running code in the multithreaded shells.
756 766
757 767 This is using Tomer Filiba's great ctypes-based trick:
758 768 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
759 769 this in the past, but hadn't been able to make it work before. So
760 770 far it looks like it's actually running, but this needs more
761 771 testing. If it really works, I'll be *very* happy, and we'll owe
762 772 a huge thank you to Tomer. My current implementation is ugly,
763 773 hackish and uses nasty globals, but I don't want to try and clean
764 774 anything up until we know if it actually works.
765 775
766 776 NOTE: this feature needs ctypes to work. ctypes is included in
767 777 Python2.5, but 2.4 users will need to manually install it. This
768 778 feature makes multi-threaded shells so much more usable that it's
769 779 a minor price to pay (ctypes is very easy to install, already a
770 780 requirement for win32 and available in major linux distros).
771 781
772 782 2007-04-04 Ville Vainio <vivainio@gmail.com>
773 783
774 784 * Extensions/ipy_completers.py, ipy_stock_completers.py:
775 785 Moved implementations of 'bundled' completers to ipy_completers.py,
776 786 they are only enabled in ipy_stock_completers.py.
777 787
778 788 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
779 789
780 790 * IPython/PyColorize.py (Parser.format2): Fix identation of
781 791 colorzied output and return early if color scheme is NoColor, to
782 792 avoid unnecessary and expensive tokenization. Closes #131.
783 793
784 794 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
785 795
786 796 * IPython/Debugger.py: disable the use of pydb version 1.17. It
787 797 has a critical bug (a missing import that makes post-mortem not
788 798 work at all). Unfortunately as of this time, this is the version
789 799 shipped with Ubuntu Edgy, so quite a few people have this one. I
790 800 hope Edgy will update to a more recent package.
791 801
792 802 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
793 803
794 804 * IPython/iplib.py (_prefilter): close #52, second part of a patch
795 805 set by Stefan (only the first part had been applied before).
796 806
797 807 * IPython/Extensions/ipy_stock_completers.py (module_completer):
798 808 remove usage of the dangerous pkgutil.walk_packages(). See
799 809 details in comments left in the code.
800 810
801 811 * IPython/Magic.py (magic_whos): add support for numpy arrays
802 812 similar to what we had for Numeric.
803 813
804 814 * IPython/completer.py (IPCompleter.complete): extend the
805 815 complete() call API to support completions by other mechanisms
806 816 than readline. Closes #109.
807 817
808 818 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
809 819 protect against a bug in Python's execfile(). Closes #123.
810 820
811 821 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
812 822
813 823 * IPython/iplib.py (split_user_input): ensure that when splitting
814 824 user input, the part that can be treated as a python name is pure
815 825 ascii (Python identifiers MUST be pure ascii). Part of the
816 826 ongoing Unicode support work.
817 827
818 828 * IPython/Prompts.py (prompt_specials_color): Add \N for the
819 829 actual prompt number, without any coloring. This allows users to
820 830 produce numbered prompts with their own colors. Added after a
821 831 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
822 832
823 833 2007-03-31 Walter Doerwald <walter@livinglogic.de>
824 834
825 835 * IPython/Extensions/igrid.py: Map the return key
826 836 to enter() and shift-return to enterattr().
827 837
828 838 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
829 839
830 840 * IPython/Magic.py (magic_psearch): add unicode support by
831 841 encoding to ascii the input, since this routine also only deals
832 842 with valid Python names. Fixes a bug reported by Stefan.
833 843
834 844 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
835 845
836 846 * IPython/Magic.py (_inspect): convert unicode input into ascii
837 847 before trying to evaluate it as a Python identifier. This fixes a
838 848 problem that the new unicode support had introduced when analyzing
839 849 long definition lines for functions.
840 850
841 851 2007-03-24 Walter Doerwald <walter@livinglogic.de>
842 852
843 853 * IPython/Extensions/igrid.py: Fix picking. Using
844 854 igrid with wxPython 2.6 and -wthread should work now.
845 855 igrid.display() simply tries to create a frame without
846 856 an application. Only if this fails an application is created.
847 857
848 858 2007-03-23 Walter Doerwald <walter@livinglogic.de>
849 859
850 860 * IPython/Extensions/path.py: Updated to version 2.2.
851 861
852 862 2007-03-23 Ville Vainio <vivainio@gmail.com>
853 863
854 864 * iplib.py: recursive alias expansion now works better, so that
855 865 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
856 866 doesn't trip up the process, if 'd' has been aliased to 'ls'.
857 867
858 868 * Extensions/ipy_gnuglobal.py added, provides %global magic
859 869 for users of http://www.gnu.org/software/global
860 870
861 871 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
862 872 Closes #52. Patch by Stefan van der Walt.
863 873
864 874 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
865 875
866 876 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
867 877 respect the __file__ attribute when using %run. Thanks to a bug
868 878 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
869 879
870 880 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
871 881
872 882 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
873 883 input. Patch sent by Stefan.
874 884
875 885 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
876 886 * IPython/Extensions/ipy_stock_completer.py
877 887 shlex_split, fix bug in shlex_split. len function
878 888 call was missing an if statement. Caused shlex_split to
879 889 sometimes return "" as last element.
880 890
881 891 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
882 892
883 893 * IPython/completer.py
884 894 (IPCompleter.file_matches.single_dir_expand): fix a problem
885 895 reported by Stefan, where directories containign a single subdir
886 896 would be completed too early.
887 897
888 898 * IPython/Shell.py (_load_pylab): Make the execution of 'from
889 899 pylab import *' when -pylab is given be optional. A new flag,
890 900 pylab_import_all controls this behavior, the default is True for
891 901 backwards compatibility.
892 902
893 903 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
894 904 modified) R. Bernstein's patch for fully syntax highlighted
895 905 tracebacks. The functionality is also available under ultraTB for
896 906 non-ipython users (someone using ultraTB but outside an ipython
897 907 session). They can select the color scheme by setting the
898 908 module-level global DEFAULT_SCHEME. The highlight functionality
899 909 also works when debugging.
900 910
901 911 * IPython/genutils.py (IOStream.close): small patch by
902 912 R. Bernstein for improved pydb support.
903 913
904 914 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
905 915 DaveS <davls@telus.net> to improve support of debugging under
906 916 NTEmacs, including improved pydb behavior.
907 917
908 918 * IPython/Magic.py (magic_prun): Fix saving of profile info for
909 919 Python 2.5, where the stats object API changed a little. Thanks
910 920 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
911 921
912 922 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
913 923 Pernetty's patch to improve support for (X)Emacs under Win32.
914 924
915 925 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
916 926
917 927 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
918 928 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
919 929 a report by Nik Tautenhahn.
920 930
921 931 2007-03-16 Walter Doerwald <walter@livinglogic.de>
922 932
923 933 * setup.py: Add the igrid help files to the list of data files
924 934 to be installed alongside igrid.
925 935 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
926 936 Show the input object of the igrid browser as the window tile.
927 937 Show the object the cursor is on in the statusbar.
928 938
929 939 2007-03-15 Ville Vainio <vivainio@gmail.com>
930 940
931 941 * Extensions/ipy_stock_completers.py: Fixed exception
932 942 on mismatching quotes in %run completer. Patch by
933 943 Jorgen Stenarson. Closes #127.
934 944
935 945 2007-03-14 Ville Vainio <vivainio@gmail.com>
936 946
937 947 * Extensions/ext_rehashdir.py: Do not do auto_alias
938 948 in %rehashdir, it clobbers %store'd aliases.
939 949
940 950 * UserConfig/ipy_profile_sh.py: envpersist.py extension
941 951 (beefed up %env) imported for sh profile.
942 952
943 953 2007-03-10 Walter Doerwald <walter@livinglogic.de>
944 954
945 955 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
946 956 as the default browser.
947 957 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
948 958 As igrid displays all attributes it ever encounters, fetch() (which has
949 959 been renamed to _fetch()) doesn't have to recalculate the display attributes
950 960 every time a new item is fetched. This should speed up scrolling.
951 961
952 962 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
953 963
954 964 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
955 965 Schmolck's recently reported tab-completion bug (my previous one
956 966 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
957 967
958 968 2007-03-09 Walter Doerwald <walter@livinglogic.de>
959 969
960 970 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
961 971 Close help window if exiting igrid.
962 972
963 973 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
964 974
965 975 * IPython/Extensions/ipy_defaults.py: Check if readline is available
966 976 before calling functions from readline.
967 977
968 978 2007-03-02 Walter Doerwald <walter@livinglogic.de>
969 979
970 980 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
971 981 igrid is a wxPython-based display object for ipipe. If your system has
972 982 wx installed igrid will be the default display. Without wx ipipe falls
973 983 back to ibrowse (which needs curses). If no curses is installed ipipe
974 984 falls back to idump.
975 985
976 986 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
977 987
978 988 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
979 989 my changes from yesterday, they introduced bugs. Will reactivate
980 990 once I get a correct solution, which will be much easier thanks to
981 991 Dan Milstein's new prefilter test suite.
982 992
983 993 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
984 994
985 995 * IPython/iplib.py (split_user_input): fix input splitting so we
986 996 don't attempt attribute accesses on things that can't possibly be
987 997 valid Python attributes. After a bug report by Alex Schmolck.
988 998 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
989 999 %magic with explicit % prefix.
990 1000
991 1001 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
992 1002
993 1003 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
994 1004 avoid a DeprecationWarning from GTK.
995 1005
996 1006 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
997 1007
998 1008 * IPython/genutils.py (clock): I modified clock() to return total
999 1009 time, user+system. This is a more commonly needed metric. I also
1000 1010 introduced the new clocku/clocks to get only user/system time if
1001 1011 one wants those instead.
1002 1012
1003 1013 ***WARNING: API CHANGE*** clock() used to return only user time,
1004 1014 so if you want exactly the same results as before, use clocku
1005 1015 instead.
1006 1016
1007 1017 2007-02-22 Ville Vainio <vivainio@gmail.com>
1008 1018
1009 1019 * IPython/Extensions/ipy_p4.py: Extension for improved
1010 1020 p4 (perforce version control system) experience.
1011 1021 Adds %p4 magic with p4 command completion and
1012 1022 automatic -G argument (marshall output as python dict)
1013 1023
1014 1024 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
1015 1025
1016 1026 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
1017 1027 stop marks.
1018 1028 (ClearingMixin): a simple mixin to easily make a Demo class clear
1019 1029 the screen in between blocks and have empty marquees. The
1020 1030 ClearDemo and ClearIPDemo classes that use it are included.
1021 1031
1022 1032 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
1023 1033
1024 1034 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
1025 1035 protect against exceptions at Python shutdown time. Patch
1026 1036 sumbmitted to upstream.
1027 1037
1028 1038 2007-02-14 Walter Doerwald <walter@livinglogic.de>
1029 1039
1030 1040 * IPython/Extensions/ibrowse.py: If entering the first object level
1031 1041 (i.e. the object for which the browser has been started) fails,
1032 1042 now the error is raised directly (aborting the browser) instead of
1033 1043 running into an empty levels list later.
1034 1044
1035 1045 2007-02-03 Walter Doerwald <walter@livinglogic.de>
1036 1046
1037 1047 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1038 1048 for the noitem object.
1039 1049
1040 1050 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1041 1051
1042 1052 * IPython/completer.py (Completer.attr_matches): Fix small
1043 1053 tab-completion bug with Enthought Traits objects with units.
1044 1054 Thanks to a bug report by Tom Denniston
1045 1055 <tom.denniston-AT-alum.dartmouth.org>.
1046 1056
1047 1057 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1048 1058
1049 1059 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1050 1060 bug where only .ipy or .py would be completed. Once the first
1051 1061 argument to %run has been given, all completions are valid because
1052 1062 they are the arguments to the script, which may well be non-python
1053 1063 filenames.
1054 1064
1055 1065 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1056 1066 to irunner to allow it to correctly support real doctesting of
1057 1067 out-of-process ipython code.
1058 1068
1059 1069 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1060 1070 title an option (-noterm_title) because it completely breaks
1061 1071 doctesting.
1062 1072
1063 1073 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1064 1074
1065 1075 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1066 1076
1067 1077 * IPython/irunner.py (main): fix small bug where extensions were
1068 1078 not being correctly recognized.
1069 1079
1070 1080 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1071 1081
1072 1082 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1073 1083 a string containing a single line yields the string itself as the
1074 1084 only item.
1075 1085
1076 1086 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1077 1087 object if it's the same as the one on the last level (This avoids
1078 1088 infinite recursion for one line strings).
1079 1089
1080 1090 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1081 1091
1082 1092 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1083 1093 all output streams before printing tracebacks. This ensures that
1084 1094 user output doesn't end up interleaved with traceback output.
1085 1095
1086 1096 2007-01-10 Ville Vainio <vivainio@gmail.com>
1087 1097
1088 1098 * Extensions/envpersist.py: Turbocharged %env that remembers
1089 1099 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1090 1100 "%env VISUAL=jed".
1091 1101
1092 1102 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1093 1103
1094 1104 * IPython/iplib.py (showtraceback): ensure that we correctly call
1095 1105 custom handlers in all cases (some with pdb were slipping through,
1096 1106 but I'm not exactly sure why).
1097 1107
1098 1108 * IPython/Debugger.py (Tracer.__init__): added new class to
1099 1109 support set_trace-like usage of IPython's enhanced debugger.
1100 1110
1101 1111 2006-12-24 Ville Vainio <vivainio@gmail.com>
1102 1112
1103 1113 * ipmaker.py: more informative message when ipy_user_conf
1104 1114 import fails (suggest running %upgrade).
1105 1115
1106 1116 * tools/run_ipy_in_profiler.py: Utility to see where
1107 1117 the time during IPython startup is spent.
1108 1118
1109 1119 2006-12-20 Ville Vainio <vivainio@gmail.com>
1110 1120
1111 1121 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1112 1122
1113 1123 * ipapi.py: Add new ipapi method, expand_alias.
1114 1124
1115 1125 * Release.py: Bump up version to 0.7.4.svn
1116 1126
1117 1127 2006-12-17 Ville Vainio <vivainio@gmail.com>
1118 1128
1119 1129 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1120 1130 to work properly on posix too
1121 1131
1122 1132 * Release.py: Update revnum (version is still just 0.7.3).
1123 1133
1124 1134 2006-12-15 Ville Vainio <vivainio@gmail.com>
1125 1135
1126 1136 * scripts/ipython_win_post_install: create ipython.py in
1127 1137 prefix + "/scripts".
1128 1138
1129 1139 * Release.py: Update version to 0.7.3.
1130 1140
1131 1141 2006-12-14 Ville Vainio <vivainio@gmail.com>
1132 1142
1133 1143 * scripts/ipython_win_post_install: Overwrite old shortcuts
1134 1144 if they already exist
1135 1145
1136 1146 * Release.py: release 0.7.3rc2
1137 1147
1138 1148 2006-12-13 Ville Vainio <vivainio@gmail.com>
1139 1149
1140 1150 * Branch and update Release.py for 0.7.3rc1
1141 1151
1142 1152 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1143 1153
1144 1154 * IPython/Shell.py (IPShellWX): update for current WX naming
1145 1155 conventions, to avoid a deprecation warning with current WX
1146 1156 versions. Thanks to a report by Danny Shevitz.
1147 1157
1148 1158 2006-12-12 Ville Vainio <vivainio@gmail.com>
1149 1159
1150 1160 * ipmaker.py: apply david cournapeau's patch to make
1151 1161 import_some work properly even when ipythonrc does
1152 1162 import_some on empty list (it was an old bug!).
1153 1163
1154 1164 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1155 1165 Add deprecation note to ipythonrc and a url to wiki
1156 1166 in ipy_user_conf.py
1157 1167
1158 1168
1159 1169 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1160 1170 as if it was typed on IPython command prompt, i.e.
1161 1171 as IPython script.
1162 1172
1163 1173 * example-magic.py, magic_grepl.py: remove outdated examples
1164 1174
1165 1175 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1166 1176
1167 1177 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1168 1178 is called before any exception has occurred.
1169 1179
1170 1180 2006-12-08 Ville Vainio <vivainio@gmail.com>
1171 1181
1172 1182 * Extensions/ipy_stock_completers.py: fix cd completer
1173 1183 to translate /'s to \'s again.
1174 1184
1175 1185 * completer.py: prevent traceback on file completions w/
1176 1186 backslash.
1177 1187
1178 1188 * Release.py: Update release number to 0.7.3b3 for release
1179 1189
1180 1190 2006-12-07 Ville Vainio <vivainio@gmail.com>
1181 1191
1182 1192 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1183 1193 while executing external code. Provides more shell-like behaviour
1184 1194 and overall better response to ctrl + C / ctrl + break.
1185 1195
1186 1196 * tools/make_tarball.py: new script to create tarball straight from svn
1187 1197 (setup.py sdist doesn't work on win32).
1188 1198
1189 1199 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1190 1200 on dirnames with spaces and use the default completer instead.
1191 1201
1192 1202 * Revision.py: Change version to 0.7.3b2 for release.
1193 1203
1194 1204 2006-12-05 Ville Vainio <vivainio@gmail.com>
1195 1205
1196 1206 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1197 1207 pydb patch 4 (rm debug printing, py 2.5 checking)
1198 1208
1199 1209 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1200 1210 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1201 1211 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1202 1212 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1203 1213 object the cursor was on before the refresh. The command "markrange" is
1204 1214 mapped to "%" now.
1205 1215 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1206 1216
1207 1217 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1208 1218
1209 1219 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1210 1220 interactive debugger on the last traceback, without having to call
1211 1221 %pdb and rerun your code. Made minor changes in various modules,
1212 1222 should automatically recognize pydb if available.
1213 1223
1214 1224 2006-11-28 Ville Vainio <vivainio@gmail.com>
1215 1225
1216 1226 * completer.py: If the text start with !, show file completions
1217 1227 properly. This helps when trying to complete command name
1218 1228 for shell escapes.
1219 1229
1220 1230 2006-11-27 Ville Vainio <vivainio@gmail.com>
1221 1231
1222 1232 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1223 1233 der Walt. Clean up svn and hg completers by using a common
1224 1234 vcs_completer.
1225 1235
1226 1236 2006-11-26 Ville Vainio <vivainio@gmail.com>
1227 1237
1228 1238 * Remove ipconfig and %config; you should use _ip.options structure
1229 1239 directly instead!
1230 1240
1231 1241 * genutils.py: add wrap_deprecated function for deprecating callables
1232 1242
1233 1243 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1234 1244 _ip.system instead. ipalias is redundant.
1235 1245
1236 1246 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1237 1247 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1238 1248 explicit.
1239 1249
1240 1250 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1241 1251 completer. Try it by entering 'hg ' and pressing tab.
1242 1252
1243 1253 * macro.py: Give Macro a useful __repr__ method
1244 1254
1245 1255 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1246 1256
1247 1257 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1248 1258 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1249 1259 we don't get a duplicate ipipe module, where registration of the xrepr
1250 1260 implementation for Text is useless.
1251 1261
1252 1262 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1253 1263
1254 1264 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1255 1265
1256 1266 2006-11-24 Ville Vainio <vivainio@gmail.com>
1257 1267
1258 1268 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1259 1269 try to use "cProfile" instead of the slower pure python
1260 1270 "profile"
1261 1271
1262 1272 2006-11-23 Ville Vainio <vivainio@gmail.com>
1263 1273
1264 1274 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1265 1275 Qt+IPython+Designer link in documentation.
1266 1276
1267 1277 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1268 1278 correct Pdb object to %pydb.
1269 1279
1270 1280
1271 1281 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1272 1282 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1273 1283 generic xrepr(), otherwise the list implementation would kick in.
1274 1284
1275 1285 2006-11-21 Ville Vainio <vivainio@gmail.com>
1276 1286
1277 1287 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1278 1288 with one from UserConfig.
1279 1289
1280 1290 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1281 1291 it was missing which broke the sh profile.
1282 1292
1283 1293 * completer.py: file completer now uses explicit '/' instead
1284 1294 of os.path.join, expansion of 'foo' was broken on win32
1285 1295 if there was one directory with name 'foobar'.
1286 1296
1287 1297 * A bunch of patches from Kirill Smelkov:
1288 1298
1289 1299 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1290 1300
1291 1301 * [patch 7/9] Implement %page -r (page in raw mode) -
1292 1302
1293 1303 * [patch 5/9] ScientificPython webpage has moved
1294 1304
1295 1305 * [patch 4/9] The manual mentions %ds, should be %dhist
1296 1306
1297 1307 * [patch 3/9] Kill old bits from %prun doc.
1298 1308
1299 1309 * [patch 1/9] Fix typos here and there.
1300 1310
1301 1311 2006-11-08 Ville Vainio <vivainio@gmail.com>
1302 1312
1303 1313 * completer.py (attr_matches): catch all exceptions raised
1304 1314 by eval of expr with dots.
1305 1315
1306 1316 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1307 1317
1308 1318 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1309 1319 input if it starts with whitespace. This allows you to paste
1310 1320 indented input from any editor without manually having to type in
1311 1321 the 'if 1:', which is convenient when working interactively.
1312 1322 Slightly modifed version of a patch by Bo Peng
1313 1323 <bpeng-AT-rice.edu>.
1314 1324
1315 1325 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1316 1326
1317 1327 * IPython/irunner.py (main): modified irunner so it automatically
1318 1328 recognizes the right runner to use based on the extension (.py for
1319 1329 python, .ipy for ipython and .sage for sage).
1320 1330
1321 1331 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1322 1332 visible in ipapi as ip.config(), to programatically control the
1323 1333 internal rc object. There's an accompanying %config magic for
1324 1334 interactive use, which has been enhanced to match the
1325 1335 funtionality in ipconfig.
1326 1336
1327 1337 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1328 1338 so it's not just a toggle, it now takes an argument. Add support
1329 1339 for a customizable header when making system calls, as the new
1330 1340 system_header variable in the ipythonrc file.
1331 1341
1332 1342 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1333 1343
1334 1344 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1335 1345 generic functions (using Philip J. Eby's simplegeneric package).
1336 1346 This makes it possible to customize the display of third-party classes
1337 1347 without having to monkeypatch them. xiter() no longer supports a mode
1338 1348 argument and the XMode class has been removed. The same functionality can
1339 1349 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1340 1350 One consequence of the switch to generic functions is that xrepr() and
1341 1351 xattrs() implementation must define the default value for the mode
1342 1352 argument themselves and xattrs() implementations must return real
1343 1353 descriptors.
1344 1354
1345 1355 * IPython/external: This new subpackage will contain all third-party
1346 1356 packages that are bundled with IPython. (The first one is simplegeneric).
1347 1357
1348 1358 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1349 1359 directory which as been dropped in r1703.
1350 1360
1351 1361 * IPython/Extensions/ipipe.py (iless): Fixed.
1352 1362
1353 1363 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1354 1364
1355 1365 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1356 1366
1357 1367 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1358 1368 handling in variable expansion so that shells and magics recognize
1359 1369 function local scopes correctly. Bug reported by Brian.
1360 1370
1361 1371 * scripts/ipython: remove the very first entry in sys.path which
1362 1372 Python auto-inserts for scripts, so that sys.path under IPython is
1363 1373 as similar as possible to that under plain Python.
1364 1374
1365 1375 * IPython/completer.py (IPCompleter.file_matches): Fix
1366 1376 tab-completion so that quotes are not closed unless the completion
1367 1377 is unambiguous. After a request by Stefan. Minor cleanups in
1368 1378 ipy_stock_completers.
1369 1379
1370 1380 2006-11-02 Ville Vainio <vivainio@gmail.com>
1371 1381
1372 1382 * ipy_stock_completers.py: Add %run and %cd completers.
1373 1383
1374 1384 * completer.py: Try running custom completer for both
1375 1385 "foo" and "%foo" if the command is just "foo". Ignore case
1376 1386 when filtering possible completions.
1377 1387
1378 1388 * UserConfig/ipy_user_conf.py: install stock completers as default
1379 1389
1380 1390 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1381 1391 simplified readline history save / restore through a wrapper
1382 1392 function
1383 1393
1384 1394
1385 1395 2006-10-31 Ville Vainio <vivainio@gmail.com>
1386 1396
1387 1397 * strdispatch.py, completer.py, ipy_stock_completers.py:
1388 1398 Allow str_key ("command") in completer hooks. Implement
1389 1399 trivial completer for 'import' (stdlib modules only). Rename
1390 1400 ipy_linux_package_managers.py to ipy_stock_completers.py.
1391 1401 SVN completer.
1392 1402
1393 1403 * Extensions/ledit.py: %magic line editor for easily and
1394 1404 incrementally manipulating lists of strings. The magic command
1395 1405 name is %led.
1396 1406
1397 1407 2006-10-30 Ville Vainio <vivainio@gmail.com>
1398 1408
1399 1409 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1400 1410 Bernsteins's patches for pydb integration.
1401 1411 http://bashdb.sourceforge.net/pydb/
1402 1412
1403 1413 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1404 1414 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1405 1415 custom completer hook to allow the users to implement their own
1406 1416 completers. See ipy_linux_package_managers.py for example. The
1407 1417 hook name is 'complete_command'.
1408 1418
1409 1419 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1410 1420
1411 1421 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1412 1422 Numeric leftovers.
1413 1423
1414 1424 * ipython.el (py-execute-region): apply Stefan's patch to fix
1415 1425 garbled results if the python shell hasn't been previously started.
1416 1426
1417 1427 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1418 1428 pretty generic function and useful for other things.
1419 1429
1420 1430 * IPython/OInspect.py (getsource): Add customizable source
1421 1431 extractor. After a request/patch form W. Stein (SAGE).
1422 1432
1423 1433 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1424 1434 window size to a more reasonable value from what pexpect does,
1425 1435 since their choice causes wrapping bugs with long input lines.
1426 1436
1427 1437 2006-10-28 Ville Vainio <vivainio@gmail.com>
1428 1438
1429 1439 * Magic.py (%run): Save and restore the readline history from
1430 1440 file around %run commands to prevent side effects from
1431 1441 %runned programs that might use readline (e.g. pydb).
1432 1442
1433 1443 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1434 1444 invoking the pydb enhanced debugger.
1435 1445
1436 1446 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1437 1447
1438 1448 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1439 1449 call the base class method and propagate the return value to
1440 1450 ifile. This is now done by path itself.
1441 1451
1442 1452 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1443 1453
1444 1454 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1445 1455 api: set_crash_handler(), to expose the ability to change the
1446 1456 internal crash handler.
1447 1457
1448 1458 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1449 1459 the various parameters of the crash handler so that apps using
1450 1460 IPython as their engine can customize crash handling. Ipmlemented
1451 1461 at the request of SAGE.
1452 1462
1453 1463 2006-10-14 Ville Vainio <vivainio@gmail.com>
1454 1464
1455 1465 * Magic.py, ipython.el: applied first "safe" part of Rocky
1456 1466 Bernstein's patch set for pydb integration.
1457 1467
1458 1468 * Magic.py (%unalias, %alias): %store'd aliases can now be
1459 1469 removed with '%unalias'. %alias w/o args now shows most
1460 1470 interesting (stored / manually defined) aliases last
1461 1471 where they catch the eye w/o scrolling.
1462 1472
1463 1473 * Magic.py (%rehashx), ext_rehashdir.py: files with
1464 1474 'py' extension are always considered executable, even
1465 1475 when not in PATHEXT environment variable.
1466 1476
1467 1477 2006-10-12 Ville Vainio <vivainio@gmail.com>
1468 1478
1469 1479 * jobctrl.py: Add new "jobctrl" extension for spawning background
1470 1480 processes with "&find /". 'import jobctrl' to try it out. Requires
1471 1481 'subprocess' module, standard in python 2.4+.
1472 1482
1473 1483 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1474 1484 so if foo -> bar and bar -> baz, then foo -> baz.
1475 1485
1476 1486 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1477 1487
1478 1488 * IPython/Magic.py (Magic.parse_options): add a new posix option
1479 1489 to allow parsing of input args in magics that doesn't strip quotes
1480 1490 (if posix=False). This also closes %timeit bug reported by
1481 1491 Stefan.
1482 1492
1483 1493 2006-10-03 Ville Vainio <vivainio@gmail.com>
1484 1494
1485 1495 * iplib.py (raw_input, interact): Return ValueError catching for
1486 1496 raw_input. Fixes infinite loop for sys.stdin.close() or
1487 1497 sys.stdout.close().
1488 1498
1489 1499 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1490 1500
1491 1501 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1492 1502 to help in handling doctests. irunner is now pretty useful for
1493 1503 running standalone scripts and simulate a full interactive session
1494 1504 in a format that can be then pasted as a doctest.
1495 1505
1496 1506 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1497 1507 on top of the default (useless) ones. This also fixes the nasty
1498 1508 way in which 2.5's Quitter() exits (reverted [1785]).
1499 1509
1500 1510 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1501 1511 2.5.
1502 1512
1503 1513 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1504 1514 color scheme is updated as well when color scheme is changed
1505 1515 interactively.
1506 1516
1507 1517 2006-09-27 Ville Vainio <vivainio@gmail.com>
1508 1518
1509 1519 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1510 1520 infinite loop and just exit. It's a hack, but will do for a while.
1511 1521
1512 1522 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1513 1523
1514 1524 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1515 1525 the constructor, this makes it possible to get a list of only directories
1516 1526 or only files.
1517 1527
1518 1528 2006-08-12 Ville Vainio <vivainio@gmail.com>
1519 1529
1520 1530 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1521 1531 they broke unittest
1522 1532
1523 1533 2006-08-11 Ville Vainio <vivainio@gmail.com>
1524 1534
1525 1535 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1526 1536 by resolving issue properly, i.e. by inheriting FakeModule
1527 1537 from types.ModuleType. Pickling ipython interactive data
1528 1538 should still work as usual (testing appreciated).
1529 1539
1530 1540 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1531 1541
1532 1542 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1533 1543 running under python 2.3 with code from 2.4 to fix a bug with
1534 1544 help(). Reported by the Debian maintainers, Norbert Tretkowski
1535 1545 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1536 1546 <afayolle-AT-debian.org>.
1537 1547
1538 1548 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1539 1549
1540 1550 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1541 1551 (which was displaying "quit" twice).
1542 1552
1543 1553 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1544 1554
1545 1555 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1546 1556 the mode argument).
1547 1557
1548 1558 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1549 1559
1550 1560 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1551 1561 not running under IPython.
1552 1562
1553 1563 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1554 1564 and make it iterable (iterating over the attribute itself). Add two new
1555 1565 magic strings for __xattrs__(): If the string starts with "-", the attribute
1556 1566 will not be displayed in ibrowse's detail view (but it can still be
1557 1567 iterated over). This makes it possible to add attributes that are large
1558 1568 lists or generator methods to the detail view. Replace magic attribute names
1559 1569 and _attrname() and _getattr() with "descriptors": For each type of magic
1560 1570 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1561 1571 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1562 1572 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1563 1573 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1564 1574 are still supported.
1565 1575
1566 1576 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1567 1577 fails in ibrowse.fetch(), the exception object is added as the last item
1568 1578 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1569 1579 a generator throws an exception midway through execution.
1570 1580
1571 1581 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1572 1582 encoding into methods.
1573 1583
1574 1584 2006-07-26 Ville Vainio <vivainio@gmail.com>
1575 1585
1576 1586 * iplib.py: history now stores multiline input as single
1577 1587 history entries. Patch by Jorgen Cederlof.
1578 1588
1579 1589 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1580 1590
1581 1591 * IPython/Extensions/ibrowse.py: Make cursor visible over
1582 1592 non existing attributes.
1583 1593
1584 1594 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1585 1595
1586 1596 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1587 1597 error output of the running command doesn't mess up the screen.
1588 1598
1589 1599 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1590 1600
1591 1601 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1592 1602 argument. This sorts the items themselves.
1593 1603
1594 1604 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1595 1605
1596 1606 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1597 1607 Compile expression strings into code objects. This should speed
1598 1608 up ifilter and friends somewhat.
1599 1609
1600 1610 2006-07-08 Ville Vainio <vivainio@gmail.com>
1601 1611
1602 1612 * Magic.py: %cpaste now strips > from the beginning of lines
1603 1613 to ease pasting quoted code from emails. Contributed by
1604 1614 Stefan van der Walt.
1605 1615
1606 1616 2006-06-29 Ville Vainio <vivainio@gmail.com>
1607 1617
1608 1618 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1609 1619 mode, patch contributed by Darren Dale. NEEDS TESTING!
1610 1620
1611 1621 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1612 1622
1613 1623 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1614 1624 a blue background. Fix fetching new display rows when the browser
1615 1625 scrolls more than a screenful (e.g. by using the goto command).
1616 1626
1617 1627 2006-06-27 Ville Vainio <vivainio@gmail.com>
1618 1628
1619 1629 * Magic.py (_inspect, _ofind) Apply David Huard's
1620 1630 patch for displaying the correct docstring for 'property'
1621 1631 attributes.
1622 1632
1623 1633 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1624 1634
1625 1635 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1626 1636 commands into the methods implementing them.
1627 1637
1628 1638 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1629 1639
1630 1640 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1631 1641 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1632 1642 autoindent support was authored by Jin Liu.
1633 1643
1634 1644 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1635 1645
1636 1646 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1637 1647 for keymaps with a custom class that simplifies handling.
1638 1648
1639 1649 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1640 1650
1641 1651 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1642 1652 resizing. This requires Python 2.5 to work.
1643 1653
1644 1654 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1645 1655
1646 1656 * IPython/Extensions/ibrowse.py: Add two new commands to
1647 1657 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1648 1658 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1649 1659 attributes again. Remapped the help command to "?". Display
1650 1660 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1651 1661 as keys for the "home" and "end" commands. Add three new commands
1652 1662 to the input mode for "find" and friends: "delend" (CTRL-K)
1653 1663 deletes to the end of line. "incsearchup" searches upwards in the
1654 1664 command history for an input that starts with the text before the cursor.
1655 1665 "incsearchdown" does the same downwards. Removed a bogus mapping of
1656 1666 the x key to "delete".
1657 1667
1658 1668 2006-06-15 Ville Vainio <vivainio@gmail.com>
1659 1669
1660 1670 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1661 1671 used to create prompts dynamically, instead of the "old" way of
1662 1672 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1663 1673 way still works (it's invoked by the default hook), of course.
1664 1674
1665 1675 * Prompts.py: added generate_output_prompt hook for altering output
1666 1676 prompt
1667 1677
1668 1678 * Release.py: Changed version string to 0.7.3.svn.
1669 1679
1670 1680 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1671 1681
1672 1682 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1673 1683 the call to fetch() always tries to fetch enough data for at least one
1674 1684 full screen. This makes it possible to simply call moveto(0,0,True) in
1675 1685 the constructor. Fix typos and removed the obsolete goto attribute.
1676 1686
1677 1687 2006-06-12 Ville Vainio <vivainio@gmail.com>
1678 1688
1679 1689 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1680 1690 allowing $variable interpolation within multiline statements,
1681 1691 though so far only with "sh" profile for a testing period.
1682 1692 The patch also enables splitting long commands with \ but it
1683 1693 doesn't work properly yet.
1684 1694
1685 1695 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1686 1696
1687 1697 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1688 1698 input history and the position of the cursor in the input history for
1689 1699 the find, findbackwards and goto command.
1690 1700
1691 1701 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1692 1702
1693 1703 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1694 1704 implements the basic functionality of browser commands that require
1695 1705 input. Reimplement the goto, find and findbackwards commands as
1696 1706 subclasses of _CommandInput. Add an input history and keymaps to those
1697 1707 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1698 1708 execute commands.
1699 1709
1700 1710 2006-06-07 Ville Vainio <vivainio@gmail.com>
1701 1711
1702 1712 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1703 1713 running the batch files instead of leaving the session open.
1704 1714
1705 1715 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1706 1716
1707 1717 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1708 1718 the original fix was incomplete. Patch submitted by W. Maier.
1709 1719
1710 1720 2006-06-07 Ville Vainio <vivainio@gmail.com>
1711 1721
1712 1722 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1713 1723 Confirmation prompts can be supressed by 'quiet' option.
1714 1724 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1715 1725
1716 1726 2006-06-06 *** Released version 0.7.2
1717 1727
1718 1728 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1719 1729
1720 1730 * IPython/Release.py (version): Made 0.7.2 final for release.
1721 1731 Repo tagged and release cut.
1722 1732
1723 1733 2006-06-05 Ville Vainio <vivainio@gmail.com>
1724 1734
1725 1735 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1726 1736 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1727 1737
1728 1738 * upgrade_dir.py: try import 'path' module a bit harder
1729 1739 (for %upgrade)
1730 1740
1731 1741 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1732 1742
1733 1743 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1734 1744 instead of looping 20 times.
1735 1745
1736 1746 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1737 1747 correctly at initialization time. Bug reported by Krishna Mohan
1738 1748 Gundu <gkmohan-AT-gmail.com> on the user list.
1739 1749
1740 1750 * IPython/Release.py (version): Mark 0.7.2 version to start
1741 1751 testing for release on 06/06.
1742 1752
1743 1753 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1744 1754
1745 1755 * scripts/irunner: thin script interface so users don't have to
1746 1756 find the module and call it as an executable, since modules rarely
1747 1757 live in people's PATH.
1748 1758
1749 1759 * IPython/irunner.py (InteractiveRunner.__init__): added
1750 1760 delaybeforesend attribute to control delays with newer versions of
1751 1761 pexpect. Thanks to detailed help from pexpect's author, Noah
1752 1762 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1753 1763 correctly (it works in NoColor mode).
1754 1764
1755 1765 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1756 1766 SAGE list, from improper log() calls.
1757 1767
1758 1768 2006-05-31 Ville Vainio <vivainio@gmail.com>
1759 1769
1760 1770 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1761 1771 with args in parens to work correctly with dirs that have spaces.
1762 1772
1763 1773 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1764 1774
1765 1775 * IPython/Logger.py (Logger.logstart): add option to log raw input
1766 1776 instead of the processed one. A -r flag was added to the
1767 1777 %logstart magic used for controlling logging.
1768 1778
1769 1779 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1770 1780
1771 1781 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1772 1782 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1773 1783 recognize the option. After a bug report by Will Maier. This
1774 1784 closes #64 (will do it after confirmation from W. Maier).
1775 1785
1776 1786 * IPython/irunner.py: New module to run scripts as if manually
1777 1787 typed into an interactive environment, based on pexpect. After a
1778 1788 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1779 1789 ipython-user list. Simple unittests in the tests/ directory.
1780 1790
1781 1791 * tools/release: add Will Maier, OpenBSD port maintainer, to
1782 1792 recepients list. We are now officially part of the OpenBSD ports:
1783 1793 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1784 1794 work.
1785 1795
1786 1796 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1787 1797
1788 1798 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1789 1799 so that it doesn't break tkinter apps.
1790 1800
1791 1801 * IPython/iplib.py (_prefilter): fix bug where aliases would
1792 1802 shadow variables when autocall was fully off. Reported by SAGE
1793 1803 author William Stein.
1794 1804
1795 1805 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1796 1806 at what detail level strings are computed when foo? is requested.
1797 1807 This allows users to ask for example that the string form of an
1798 1808 object is only computed when foo?? is called, or even never, by
1799 1809 setting the object_info_string_level >= 2 in the configuration
1800 1810 file. This new option has been added and documented. After a
1801 1811 request by SAGE to be able to control the printing of very large
1802 1812 objects more easily.
1803 1813
1804 1814 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1805 1815
1806 1816 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1807 1817 from sys.argv, to be 100% consistent with how Python itself works
1808 1818 (as seen for example with python -i file.py). After a bug report
1809 1819 by Jeffrey Collins.
1810 1820
1811 1821 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1812 1822 nasty bug which was preventing custom namespaces with -pylab,
1813 1823 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1814 1824 compatibility (long gone from mpl).
1815 1825
1816 1826 * IPython/ipapi.py (make_session): name change: create->make. We
1817 1827 use make in other places (ipmaker,...), it's shorter and easier to
1818 1828 type and say, etc. I'm trying to clean things before 0.7.2 so
1819 1829 that I can keep things stable wrt to ipapi in the chainsaw branch.
1820 1830
1821 1831 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1822 1832 python-mode recognizes our debugger mode. Add support for
1823 1833 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1824 1834 <m.liu.jin-AT-gmail.com> originally written by
1825 1835 doxgen-AT-newsmth.net (with minor modifications for xemacs
1826 1836 compatibility)
1827 1837
1828 1838 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1829 1839 tracebacks when walking the stack so that the stack tracking system
1830 1840 in emacs' python-mode can identify the frames correctly.
1831 1841
1832 1842 * IPython/ipmaker.py (make_IPython): make the internal (and
1833 1843 default config) autoedit_syntax value false by default. Too many
1834 1844 users have complained to me (both on and off-list) about problems
1835 1845 with this option being on by default, so I'm making it default to
1836 1846 off. It can still be enabled by anyone via the usual mechanisms.
1837 1847
1838 1848 * IPython/completer.py (Completer.attr_matches): add support for
1839 1849 PyCrust-style _getAttributeNames magic method. Patch contributed
1840 1850 by <mscott-AT-goldenspud.com>. Closes #50.
1841 1851
1842 1852 * IPython/iplib.py (InteractiveShell.__init__): remove the
1843 1853 deletion of exit/quit from __builtin__, which can break
1844 1854 third-party tools like the Zope debugging console. The
1845 1855 %exit/%quit magics remain. In general, it's probably a good idea
1846 1856 not to delete anything from __builtin__, since we never know what
1847 1857 that will break. In any case, python now (for 2.5) will support
1848 1858 'real' exit/quit, so this issue is moot. Closes #55.
1849 1859
1850 1860 * IPython/genutils.py (with_obj): rename the 'with' function to
1851 1861 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1852 1862 becomes a language keyword. Closes #53.
1853 1863
1854 1864 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1855 1865 __file__ attribute to this so it fools more things into thinking
1856 1866 it is a real module. Closes #59.
1857 1867
1858 1868 * IPython/Magic.py (magic_edit): add -n option to open the editor
1859 1869 at a specific line number. After a patch by Stefan van der Walt.
1860 1870
1861 1871 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1862 1872
1863 1873 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1864 1874 reason the file could not be opened. After automatic crash
1865 1875 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1866 1876 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1867 1877 (_should_recompile): Don't fire editor if using %bg, since there
1868 1878 is no file in the first place. From the same report as above.
1869 1879 (raw_input): protect against faulty third-party prefilters. After
1870 1880 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1871 1881 while running under SAGE.
1872 1882
1873 1883 2006-05-23 Ville Vainio <vivainio@gmail.com>
1874 1884
1875 1885 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1876 1886 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1877 1887 now returns None (again), unless dummy is specifically allowed by
1878 1888 ipapi.get(allow_dummy=True).
1879 1889
1880 1890 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1881 1891
1882 1892 * IPython: remove all 2.2-compatibility objects and hacks from
1883 1893 everywhere, since we only support 2.3 at this point. Docs
1884 1894 updated.
1885 1895
1886 1896 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1887 1897 Anything requiring extra validation can be turned into a Python
1888 1898 property in the future. I used a property for the db one b/c
1889 1899 there was a nasty circularity problem with the initialization
1890 1900 order, which right now I don't have time to clean up.
1891 1901
1892 1902 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1893 1903 another locking bug reported by Jorgen. I'm not 100% sure though,
1894 1904 so more testing is needed...
1895 1905
1896 1906 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1897 1907
1898 1908 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1899 1909 local variables from any routine in user code (typically executed
1900 1910 with %run) directly into the interactive namespace. Very useful
1901 1911 when doing complex debugging.
1902 1912 (IPythonNotRunning): Changed the default None object to a dummy
1903 1913 whose attributes can be queried as well as called without
1904 1914 exploding, to ease writing code which works transparently both in
1905 1915 and out of ipython and uses some of this API.
1906 1916
1907 1917 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1908 1918
1909 1919 * IPython/hooks.py (result_display): Fix the fact that our display
1910 1920 hook was using str() instead of repr(), as the default python
1911 1921 console does. This had gone unnoticed b/c it only happened if
1912 1922 %Pprint was off, but the inconsistency was there.
1913 1923
1914 1924 2006-05-15 Ville Vainio <vivainio@gmail.com>
1915 1925
1916 1926 * Oinspect.py: Only show docstring for nonexisting/binary files
1917 1927 when doing object??, closing ticket #62
1918 1928
1919 1929 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1920 1930
1921 1931 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1922 1932 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1923 1933 was being released in a routine which hadn't checked if it had
1924 1934 been the one to acquire it.
1925 1935
1926 1936 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1927 1937
1928 1938 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1929 1939
1930 1940 2006-04-11 Ville Vainio <vivainio@gmail.com>
1931 1941
1932 1942 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1933 1943 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1934 1944 prefilters, allowing stuff like magics and aliases in the file.
1935 1945
1936 1946 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1937 1947 added. Supported now are "%clear in" and "%clear out" (clear input and
1938 1948 output history, respectively). Also fixed CachedOutput.flush to
1939 1949 properly flush the output cache.
1940 1950
1941 1951 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1942 1952 half-success (and fail explicitly).
1943 1953
1944 1954 2006-03-28 Ville Vainio <vivainio@gmail.com>
1945 1955
1946 1956 * iplib.py: Fix quoting of aliases so that only argless ones
1947 1957 are quoted
1948 1958
1949 1959 2006-03-28 Ville Vainio <vivainio@gmail.com>
1950 1960
1951 1961 * iplib.py: Quote aliases with spaces in the name.
1952 1962 "c:\program files\blah\bin" is now legal alias target.
1953 1963
1954 1964 * ext_rehashdir.py: Space no longer allowed as arg
1955 1965 separator, since space is legal in path names.
1956 1966
1957 1967 2006-03-16 Ville Vainio <vivainio@gmail.com>
1958 1968
1959 1969 * upgrade_dir.py: Take path.py from Extensions, correcting
1960 1970 %upgrade magic
1961 1971
1962 1972 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1963 1973
1964 1974 * hooks.py: Only enclose editor binary in quotes if legal and
1965 1975 necessary (space in the name, and is an existing file). Fixes a bug
1966 1976 reported by Zachary Pincus.
1967 1977
1968 1978 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1969 1979
1970 1980 * Manual: thanks to a tip on proper color handling for Emacs, by
1971 1981 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1972 1982
1973 1983 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1974 1984 by applying the provided patch. Thanks to Liu Jin
1975 1985 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1976 1986 XEmacs/Linux, I'm trusting the submitter that it actually helps
1977 1987 under win32/GNU Emacs. Will revisit if any problems are reported.
1978 1988
1979 1989 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1980 1990
1981 1991 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1982 1992 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1983 1993
1984 1994 2006-03-12 Ville Vainio <vivainio@gmail.com>
1985 1995
1986 1996 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1987 1997 Torsten Marek.
1988 1998
1989 1999 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1990 2000
1991 2001 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1992 2002 line ranges works again.
1993 2003
1994 2004 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1995 2005
1996 2006 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1997 2007 and friends, after a discussion with Zach Pincus on ipython-user.
1998 2008 I'm not 100% sure, but after thinking about it quite a bit, it may
1999 2009 be OK. Testing with the multithreaded shells didn't reveal any
2000 2010 problems, but let's keep an eye out.
2001 2011
2002 2012 In the process, I fixed a few things which were calling
2003 2013 self.InteractiveTB() directly (like safe_execfile), which is a
2004 2014 mistake: ALL exception reporting should be done by calling
2005 2015 self.showtraceback(), which handles state and tab-completion and
2006 2016 more.
2007 2017
2008 2018 2006-03-01 Ville Vainio <vivainio@gmail.com>
2009 2019
2010 2020 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
2011 2021 To use, do "from ipipe import *".
2012 2022
2013 2023 2006-02-24 Ville Vainio <vivainio@gmail.com>
2014 2024
2015 2025 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
2016 2026 "cleanly" and safely than the older upgrade mechanism.
2017 2027
2018 2028 2006-02-21 Ville Vainio <vivainio@gmail.com>
2019 2029
2020 2030 * Magic.py: %save works again.
2021 2031
2022 2032 2006-02-15 Ville Vainio <vivainio@gmail.com>
2023 2033
2024 2034 * Magic.py: %Pprint works again
2025 2035
2026 2036 * Extensions/ipy_sane_defaults.py: Provide everything provided
2027 2037 in default ipythonrc, to make it possible to have a completely empty
2028 2038 ipythonrc (and thus completely rc-file free configuration)
2029 2039
2030 2040 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
2031 2041
2032 2042 * IPython/hooks.py (editor): quote the call to the editor command,
2033 2043 to allow commands with spaces in them. Problem noted by watching
2034 2044 Ian Oswald's video about textpad under win32 at
2035 2045 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
2036 2046
2037 2047 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2038 2048 describing magics (we haven't used @ for a loong time).
2039 2049
2040 2050 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2041 2051 contributed by marienz to close
2042 2052 http://www.scipy.net/roundup/ipython/issue53.
2043 2053
2044 2054 2006-02-10 Ville Vainio <vivainio@gmail.com>
2045 2055
2046 2056 * genutils.py: getoutput now works in win32 too
2047 2057
2048 2058 * completer.py: alias and magic completion only invoked
2049 2059 at the first "item" in the line, to avoid "cd %store"
2050 2060 nonsense.
2051 2061
2052 2062 2006-02-09 Ville Vainio <vivainio@gmail.com>
2053 2063
2054 2064 * test/*: Added a unit testing framework (finally).
2055 2065 '%run runtests.py' to run test_*.
2056 2066
2057 2067 * ipapi.py: Exposed runlines and set_custom_exc
2058 2068
2059 2069 2006-02-07 Ville Vainio <vivainio@gmail.com>
2060 2070
2061 2071 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2062 2072 instead use "f(1 2)" as before.
2063 2073
2064 2074 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2065 2075
2066 2076 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2067 2077 facilities, for demos processed by the IPython input filter
2068 2078 (IPythonDemo), and for running a script one-line-at-a-time as a
2069 2079 demo, both for pure Python (LineDemo) and for IPython-processed
2070 2080 input (IPythonLineDemo). After a request by Dave Kohel, from the
2071 2081 SAGE team.
2072 2082 (Demo.edit): added an edit() method to the demo objects, to edit
2073 2083 the in-memory copy of the last executed block.
2074 2084
2075 2085 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2076 2086 processing to %edit, %macro and %save. These commands can now be
2077 2087 invoked on the unprocessed input as it was typed by the user
2078 2088 (without any prefilters applied). After requests by the SAGE team
2079 2089 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2080 2090
2081 2091 2006-02-01 Ville Vainio <vivainio@gmail.com>
2082 2092
2083 2093 * setup.py, eggsetup.py: easy_install ipython==dev works
2084 2094 correctly now (on Linux)
2085 2095
2086 2096 * ipy_user_conf,ipmaker: user config changes, removed spurious
2087 2097 warnings
2088 2098
2089 2099 * iplib: if rc.banner is string, use it as is.
2090 2100
2091 2101 * Magic: %pycat accepts a string argument and pages it's contents.
2092 2102
2093 2103
2094 2104 2006-01-30 Ville Vainio <vivainio@gmail.com>
2095 2105
2096 2106 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2097 2107 Now %store and bookmarks work through PickleShare, meaning that
2098 2108 concurrent access is possible and all ipython sessions see the
2099 2109 same database situation all the time, instead of snapshot of
2100 2110 the situation when the session was started. Hence, %bookmark
2101 2111 results are immediately accessible from othes sessions. The database
2102 2112 is also available for use by user extensions. See:
2103 2113 http://www.python.org/pypi/pickleshare
2104 2114
2105 2115 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2106 2116
2107 2117 * aliases can now be %store'd
2108 2118
2109 2119 * path.py moved to Extensions so that pickleshare does not need
2110 2120 IPython-specific import. Extensions added to pythonpath right
2111 2121 at __init__.
2112 2122
2113 2123 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2114 2124 called with _ip.system and the pre-transformed command string.
2115 2125
2116 2126 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2117 2127
2118 2128 * IPython/iplib.py (interact): Fix that we were not catching
2119 2129 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2120 2130 logic here had to change, but it's fixed now.
2121 2131
2122 2132 2006-01-29 Ville Vainio <vivainio@gmail.com>
2123 2133
2124 2134 * iplib.py: Try to import pyreadline on Windows.
2125 2135
2126 2136 2006-01-27 Ville Vainio <vivainio@gmail.com>
2127 2137
2128 2138 * iplib.py: Expose ipapi as _ip in builtin namespace.
2129 2139 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2130 2140 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2131 2141 syntax now produce _ip.* variant of the commands.
2132 2142
2133 2143 * "_ip.options().autoedit_syntax = 2" automatically throws
2134 2144 user to editor for syntax error correction without prompting.
2135 2145
2136 2146 2006-01-27 Ville Vainio <vivainio@gmail.com>
2137 2147
2138 2148 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2139 2149 'ipython' at argv[0]) executed through command line.
2140 2150 NOTE: this DEPRECATES calling ipython with multiple scripts
2141 2151 ("ipython a.py b.py c.py")
2142 2152
2143 2153 * iplib.py, hooks.py: Added configurable input prefilter,
2144 2154 named 'input_prefilter'. See ext_rescapture.py for example
2145 2155 usage.
2146 2156
2147 2157 * ext_rescapture.py, Magic.py: Better system command output capture
2148 2158 through 'var = !ls' (deprecates user-visible %sc). Same notation
2149 2159 applies for magics, 'var = %alias' assigns alias list to var.
2150 2160
2151 2161 * ipapi.py: added meta() for accessing extension-usable data store.
2152 2162
2153 2163 * iplib.py: added InteractiveShell.getapi(). New magics should be
2154 2164 written doing self.getapi() instead of using the shell directly.
2155 2165
2156 2166 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2157 2167 %store foo >> ~/myfoo.txt to store variables to files (in clean
2158 2168 textual form, not a restorable pickle).
2159 2169
2160 2170 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2161 2171
2162 2172 * usage.py, Magic.py: added %quickref
2163 2173
2164 2174 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2165 2175
2166 2176 * GetoptErrors when invoking magics etc. with wrong args
2167 2177 are now more helpful:
2168 2178 GetoptError: option -l not recognized (allowed: "qb" )
2169 2179
2170 2180 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2171 2181
2172 2182 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2173 2183 computationally intensive blocks don't appear to stall the demo.
2174 2184
2175 2185 2006-01-24 Ville Vainio <vivainio@gmail.com>
2176 2186
2177 2187 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2178 2188 value to manipulate resulting history entry.
2179 2189
2180 2190 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2181 2191 to instance methods of IPApi class, to make extending an embedded
2182 2192 IPython feasible. See ext_rehashdir.py for example usage.
2183 2193
2184 2194 * Merged 1071-1076 from branches/0.7.1
2185 2195
2186 2196
2187 2197 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2188 2198
2189 2199 * tools/release (daystamp): Fix build tools to use the new
2190 2200 eggsetup.py script to build lightweight eggs.
2191 2201
2192 2202 * Applied changesets 1062 and 1064 before 0.7.1 release.
2193 2203
2194 2204 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2195 2205 see the raw input history (without conversions like %ls ->
2196 2206 ipmagic("ls")). After a request from W. Stein, SAGE
2197 2207 (http://modular.ucsd.edu/sage) developer. This information is
2198 2208 stored in the input_hist_raw attribute of the IPython instance, so
2199 2209 developers can access it if needed (it's an InputList instance).
2200 2210
2201 2211 * Versionstring = 0.7.2.svn
2202 2212
2203 2213 * eggsetup.py: A separate script for constructing eggs, creates
2204 2214 proper launch scripts even on Windows (an .exe file in
2205 2215 \python24\scripts).
2206 2216
2207 2217 * ipapi.py: launch_new_instance, launch entry point needed for the
2208 2218 egg.
2209 2219
2210 2220 2006-01-23 Ville Vainio <vivainio@gmail.com>
2211 2221
2212 2222 * Added %cpaste magic for pasting python code
2213 2223
2214 2224 2006-01-22 Ville Vainio <vivainio@gmail.com>
2215 2225
2216 2226 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2217 2227
2218 2228 * Versionstring = 0.7.2.svn
2219 2229
2220 2230 * eggsetup.py: A separate script for constructing eggs, creates
2221 2231 proper launch scripts even on Windows (an .exe file in
2222 2232 \python24\scripts).
2223 2233
2224 2234 * ipapi.py: launch_new_instance, launch entry point needed for the
2225 2235 egg.
2226 2236
2227 2237 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2228 2238
2229 2239 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2230 2240 %pfile foo would print the file for foo even if it was a binary.
2231 2241 Now, extensions '.so' and '.dll' are skipped.
2232 2242
2233 2243 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2234 2244 bug, where macros would fail in all threaded modes. I'm not 100%
2235 2245 sure, so I'm going to put out an rc instead of making a release
2236 2246 today, and wait for feedback for at least a few days.
2237 2247
2238 2248 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2239 2249 it...) the handling of pasting external code with autoindent on.
2240 2250 To get out of a multiline input, the rule will appear for most
2241 2251 users unchanged: two blank lines or change the indent level
2242 2252 proposed by IPython. But there is a twist now: you can
2243 2253 add/subtract only *one or two spaces*. If you add/subtract three
2244 2254 or more (unless you completely delete the line), IPython will
2245 2255 accept that line, and you'll need to enter a second one of pure
2246 2256 whitespace. I know it sounds complicated, but I can't find a
2247 2257 different solution that covers all the cases, with the right
2248 2258 heuristics. Hopefully in actual use, nobody will really notice
2249 2259 all these strange rules and things will 'just work'.
2250 2260
2251 2261 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2252 2262
2253 2263 * IPython/iplib.py (interact): catch exceptions which can be
2254 2264 triggered asynchronously by signal handlers. Thanks to an
2255 2265 automatic crash report, submitted by Colin Kingsley
2256 2266 <tercel-AT-gentoo.org>.
2257 2267
2258 2268 2006-01-20 Ville Vainio <vivainio@gmail.com>
2259 2269
2260 2270 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2261 2271 (%rehashdir, very useful, try it out) of how to extend ipython
2262 2272 with new magics. Also added Extensions dir to pythonpath to make
2263 2273 importing extensions easy.
2264 2274
2265 2275 * %store now complains when trying to store interactively declared
2266 2276 classes / instances of those classes.
2267 2277
2268 2278 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2269 2279 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2270 2280 if they exist, and ipy_user_conf.py with some defaults is created for
2271 2281 the user.
2272 2282
2273 2283 * Startup rehashing done by the config file, not InterpreterExec.
2274 2284 This means system commands are available even without selecting the
2275 2285 pysh profile. It's the sensible default after all.
2276 2286
2277 2287 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2278 2288
2279 2289 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2280 2290 multiline code with autoindent on working. But I am really not
2281 2291 sure, so this needs more testing. Will commit a debug-enabled
2282 2292 version for now, while I test it some more, so that Ville and
2283 2293 others may also catch any problems. Also made
2284 2294 self.indent_current_str() a method, to ensure that there's no
2285 2295 chance of the indent space count and the corresponding string
2286 2296 falling out of sync. All code needing the string should just call
2287 2297 the method.
2288 2298
2289 2299 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2290 2300
2291 2301 * IPython/Magic.py (magic_edit): fix check for when users don't
2292 2302 save their output files, the try/except was in the wrong section.
2293 2303
2294 2304 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2295 2305
2296 2306 * IPython/Magic.py (magic_run): fix __file__ global missing from
2297 2307 script's namespace when executed via %run. After a report by
2298 2308 Vivian.
2299 2309
2300 2310 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2301 2311 when using python 2.4. The parent constructor changed in 2.4, and
2302 2312 we need to track it directly (we can't call it, as it messes up
2303 2313 readline and tab-completion inside our pdb would stop working).
2304 2314 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2305 2315
2306 2316 2006-01-16 Ville Vainio <vivainio@gmail.com>
2307 2317
2308 2318 * Ipython/magic.py: Reverted back to old %edit functionality
2309 2319 that returns file contents on exit.
2310 2320
2311 2321 * IPython/path.py: Added Jason Orendorff's "path" module to
2312 2322 IPython tree, http://www.jorendorff.com/articles/python/path/.
2313 2323 You can get path objects conveniently through %sc, and !!, e.g.:
2314 2324 sc files=ls
2315 2325 for p in files.paths: # or files.p
2316 2326 print p,p.mtime
2317 2327
2318 2328 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2319 2329 now work again without considering the exclusion regexp -
2320 2330 hence, things like ',foo my/path' turn to 'foo("my/path")'
2321 2331 instead of syntax error.
2322 2332
2323 2333
2324 2334 2006-01-14 Ville Vainio <vivainio@gmail.com>
2325 2335
2326 2336 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2327 2337 ipapi decorators for python 2.4 users, options() provides access to rc
2328 2338 data.
2329 2339
2330 2340 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2331 2341 as path separators (even on Linux ;-). Space character after
2332 2342 backslash (as yielded by tab completer) is still space;
2333 2343 "%cd long\ name" works as expected.
2334 2344
2335 2345 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2336 2346 as "chain of command", with priority. API stays the same,
2337 2347 TryNext exception raised by a hook function signals that
2338 2348 current hook failed and next hook should try handling it, as
2339 2349 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
2340 2350 requested configurable display hook, which is now implemented.
2341 2351
2342 2352 2006-01-13 Ville Vainio <vivainio@gmail.com>
2343 2353
2344 2354 * IPython/platutils*.py: platform specific utility functions,
2345 2355 so far only set_term_title is implemented (change terminal
2346 2356 label in windowing systems). %cd now changes the title to
2347 2357 current dir.
2348 2358
2349 2359 * IPython/Release.py: Added myself to "authors" list,
2350 2360 had to create new files.
2351 2361
2352 2362 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2353 2363 shell escape; not a known bug but had potential to be one in the
2354 2364 future.
2355 2365
2356 2366 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2357 2367 extension API for IPython! See the module for usage example. Fix
2358 2368 OInspect for docstring-less magic functions.
2359 2369
2360 2370
2361 2371 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2362 2372
2363 2373 * IPython/iplib.py (raw_input): temporarily deactivate all
2364 2374 attempts at allowing pasting of code with autoindent on. It
2365 2375 introduced bugs (reported by Prabhu) and I can't seem to find a
2366 2376 robust combination which works in all cases. Will have to revisit
2367 2377 later.
2368 2378
2369 2379 * IPython/genutils.py: remove isspace() function. We've dropped
2370 2380 2.2 compatibility, so it's OK to use the string method.
2371 2381
2372 2382 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2373 2383
2374 2384 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2375 2385 matching what NOT to autocall on, to include all python binary
2376 2386 operators (including things like 'and', 'or', 'is' and 'in').
2377 2387 Prompted by a bug report on 'foo & bar', but I realized we had
2378 2388 many more potential bug cases with other operators. The regexp is
2379 2389 self.re_exclude_auto, it's fairly commented.
2380 2390
2381 2391 2006-01-12 Ville Vainio <vivainio@gmail.com>
2382 2392
2383 2393 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2384 2394 Prettified and hardened string/backslash quoting with ipsystem(),
2385 2395 ipalias() and ipmagic(). Now even \ characters are passed to
2386 2396 %magics, !shell escapes and aliases exactly as they are in the
2387 2397 ipython command line. Should improve backslash experience,
2388 2398 particularly in Windows (path delimiter for some commands that
2389 2399 won't understand '/'), but Unix benefits as well (regexps). %cd
2390 2400 magic still doesn't support backslash path delimiters, though. Also
2391 2401 deleted all pretense of supporting multiline command strings in
2392 2402 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2393 2403
2394 2404 * doc/build_doc_instructions.txt added. Documentation on how to
2395 2405 use doc/update_manual.py, added yesterday. Both files contributed
2396 2406 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2397 2407 doc/*.sh for deprecation at a later date.
2398 2408
2399 2409 * /ipython.py Added ipython.py to root directory for
2400 2410 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2401 2411 ipython.py) and development convenience (no need to keep doing
2402 2412 "setup.py install" between changes).
2403 2413
2404 2414 * Made ! and !! shell escapes work (again) in multiline expressions:
2405 2415 if 1:
2406 2416 !ls
2407 2417 !!ls
2408 2418
2409 2419 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2410 2420
2411 2421 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2412 2422 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2413 2423 module in case-insensitive installation. Was causing crashes
2414 2424 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2415 2425
2416 2426 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2417 2427 <marienz-AT-gentoo.org>, closes
2418 2428 http://www.scipy.net/roundup/ipython/issue51.
2419 2429
2420 2430 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2421 2431
2422 2432 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2423 2433 problem of excessive CPU usage under *nix and keyboard lag under
2424 2434 win32.
2425 2435
2426 2436 2006-01-10 *** Released version 0.7.0
2427 2437
2428 2438 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2429 2439
2430 2440 * IPython/Release.py (revision): tag version number to 0.7.0,
2431 2441 ready for release.
2432 2442
2433 2443 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2434 2444 it informs the user of the name of the temp. file used. This can
2435 2445 help if you decide later to reuse that same file, so you know
2436 2446 where to copy the info from.
2437 2447
2438 2448 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2439 2449
2440 2450 * setup_bdist_egg.py: little script to build an egg. Added
2441 2451 support in the release tools as well.
2442 2452
2443 2453 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2444 2454
2445 2455 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2446 2456 version selection (new -wxversion command line and ipythonrc
2447 2457 parameter). Patch contributed by Arnd Baecker
2448 2458 <arnd.baecker-AT-web.de>.
2449 2459
2450 2460 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2451 2461 embedded instances, for variables defined at the interactive
2452 2462 prompt of the embedded ipython. Reported by Arnd.
2453 2463
2454 2464 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2455 2465 it can be used as a (stateful) toggle, or with a direct parameter.
2456 2466
2457 2467 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2458 2468 could be triggered in certain cases and cause the traceback
2459 2469 printer not to work.
2460 2470
2461 2471 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2462 2472
2463 2473 * IPython/iplib.py (_should_recompile): Small fix, closes
2464 2474 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2465 2475
2466 2476 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2467 2477
2468 2478 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2469 2479 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2470 2480 Moad for help with tracking it down.
2471 2481
2472 2482 * IPython/iplib.py (handle_auto): fix autocall handling for
2473 2483 objects which support BOTH __getitem__ and __call__ (so that f [x]
2474 2484 is left alone, instead of becoming f([x]) automatically).
2475 2485
2476 2486 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2477 2487 Ville's patch.
2478 2488
2479 2489 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2480 2490
2481 2491 * IPython/iplib.py (handle_auto): changed autocall semantics to
2482 2492 include 'smart' mode, where the autocall transformation is NOT
2483 2493 applied if there are no arguments on the line. This allows you to
2484 2494 just type 'foo' if foo is a callable to see its internal form,
2485 2495 instead of having it called with no arguments (typically a
2486 2496 mistake). The old 'full' autocall still exists: for that, you
2487 2497 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2488 2498
2489 2499 * IPython/completer.py (Completer.attr_matches): add
2490 2500 tab-completion support for Enthoughts' traits. After a report by
2491 2501 Arnd and a patch by Prabhu.
2492 2502
2493 2503 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2494 2504
2495 2505 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2496 2506 Schmolck's patch to fix inspect.getinnerframes().
2497 2507
2498 2508 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2499 2509 for embedded instances, regarding handling of namespaces and items
2500 2510 added to the __builtin__ one. Multiple embedded instances and
2501 2511 recursive embeddings should work better now (though I'm not sure
2502 2512 I've got all the corner cases fixed, that code is a bit of a brain
2503 2513 twister).
2504 2514
2505 2515 * IPython/Magic.py (magic_edit): added support to edit in-memory
2506 2516 macros (automatically creates the necessary temp files). %edit
2507 2517 also doesn't return the file contents anymore, it's just noise.
2508 2518
2509 2519 * IPython/completer.py (Completer.attr_matches): revert change to
2510 2520 complete only on attributes listed in __all__. I realized it
2511 2521 cripples the tab-completion system as a tool for exploring the
2512 2522 internals of unknown libraries (it renders any non-__all__
2513 2523 attribute off-limits). I got bit by this when trying to see
2514 2524 something inside the dis module.
2515 2525
2516 2526 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2517 2527
2518 2528 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2519 2529 namespace for users and extension writers to hold data in. This
2520 2530 follows the discussion in
2521 2531 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2522 2532
2523 2533 * IPython/completer.py (IPCompleter.complete): small patch to help
2524 2534 tab-completion under Emacs, after a suggestion by John Barnard
2525 2535 <barnarj-AT-ccf.org>.
2526 2536
2527 2537 * IPython/Magic.py (Magic.extract_input_slices): added support for
2528 2538 the slice notation in magics to use N-M to represent numbers N...M
2529 2539 (closed endpoints). This is used by %macro and %save.
2530 2540
2531 2541 * IPython/completer.py (Completer.attr_matches): for modules which
2532 2542 define __all__, complete only on those. After a patch by Jeffrey
2533 2543 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2534 2544 speed up this routine.
2535 2545
2536 2546 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2537 2547 don't know if this is the end of it, but the behavior now is
2538 2548 certainly much more correct. Note that coupled with macros,
2539 2549 slightly surprising (at first) behavior may occur: a macro will in
2540 2550 general expand to multiple lines of input, so upon exiting, the
2541 2551 in/out counters will both be bumped by the corresponding amount
2542 2552 (as if the macro's contents had been typed interactively). Typing
2543 2553 %hist will reveal the intermediate (silently processed) lines.
2544 2554
2545 2555 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2546 2556 pickle to fail (%run was overwriting __main__ and not restoring
2547 2557 it, but pickle relies on __main__ to operate).
2548 2558
2549 2559 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2550 2560 using properties, but forgot to make the main InteractiveShell
2551 2561 class a new-style class. Properties fail silently, and
2552 2562 mysteriously, with old-style class (getters work, but
2553 2563 setters don't do anything).
2554 2564
2555 2565 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2556 2566
2557 2567 * IPython/Magic.py (magic_history): fix history reporting bug (I
2558 2568 know some nasties are still there, I just can't seem to find a
2559 2569 reproducible test case to track them down; the input history is
2560 2570 falling out of sync...)
2561 2571
2562 2572 * IPython/iplib.py (handle_shell_escape): fix bug where both
2563 2573 aliases and system accesses where broken for indented code (such
2564 2574 as loops).
2565 2575
2566 2576 * IPython/genutils.py (shell): fix small but critical bug for
2567 2577 win32 system access.
2568 2578
2569 2579 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2570 2580
2571 2581 * IPython/iplib.py (showtraceback): remove use of the
2572 2582 sys.last_{type/value/traceback} structures, which are non
2573 2583 thread-safe.
2574 2584 (_prefilter): change control flow to ensure that we NEVER
2575 2585 introspect objects when autocall is off. This will guarantee that
2576 2586 having an input line of the form 'x.y', where access to attribute
2577 2587 'y' has side effects, doesn't trigger the side effect TWICE. It
2578 2588 is important to note that, with autocall on, these side effects
2579 2589 can still happen.
2580 2590 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2581 2591 trio. IPython offers these three kinds of special calls which are
2582 2592 not python code, and it's a good thing to have their call method
2583 2593 be accessible as pure python functions (not just special syntax at
2584 2594 the command line). It gives us a better internal implementation
2585 2595 structure, as well as exposing these for user scripting more
2586 2596 cleanly.
2587 2597
2588 2598 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2589 2599 file. Now that they'll be more likely to be used with the
2590 2600 persistance system (%store), I want to make sure their module path
2591 2601 doesn't change in the future, so that we don't break things for
2592 2602 users' persisted data.
2593 2603
2594 2604 * IPython/iplib.py (autoindent_update): move indentation
2595 2605 management into the _text_ processing loop, not the keyboard
2596 2606 interactive one. This is necessary to correctly process non-typed
2597 2607 multiline input (such as macros).
2598 2608
2599 2609 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2600 2610 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2601 2611 which was producing problems in the resulting manual.
2602 2612 (magic_whos): improve reporting of instances (show their class,
2603 2613 instead of simply printing 'instance' which isn't terribly
2604 2614 informative).
2605 2615
2606 2616 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2607 2617 (minor mods) to support network shares under win32.
2608 2618
2609 2619 * IPython/winconsole.py (get_console_size): add new winconsole
2610 2620 module and fixes to page_dumb() to improve its behavior under
2611 2621 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2612 2622
2613 2623 * IPython/Magic.py (Macro): simplified Macro class to just
2614 2624 subclass list. We've had only 2.2 compatibility for a very long
2615 2625 time, yet I was still avoiding subclassing the builtin types. No
2616 2626 more (I'm also starting to use properties, though I won't shift to
2617 2627 2.3-specific features quite yet).
2618 2628 (magic_store): added Ville's patch for lightweight variable
2619 2629 persistence, after a request on the user list by Matt Wilkie
2620 2630 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2621 2631 details.
2622 2632
2623 2633 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2624 2634 changed the default logfile name from 'ipython.log' to
2625 2635 'ipython_log.py'. These logs are real python files, and now that
2626 2636 we have much better multiline support, people are more likely to
2627 2637 want to use them as such. Might as well name them correctly.
2628 2638
2629 2639 * IPython/Magic.py: substantial cleanup. While we can't stop
2630 2640 using magics as mixins, due to the existing customizations 'out
2631 2641 there' which rely on the mixin naming conventions, at least I
2632 2642 cleaned out all cross-class name usage. So once we are OK with
2633 2643 breaking compatibility, the two systems can be separated.
2634 2644
2635 2645 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2636 2646 anymore, and the class is a fair bit less hideous as well. New
2637 2647 features were also introduced: timestamping of input, and logging
2638 2648 of output results. These are user-visible with the -t and -o
2639 2649 options to %logstart. Closes
2640 2650 http://www.scipy.net/roundup/ipython/issue11 and a request by
2641 2651 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2642 2652
2643 2653 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2644 2654
2645 2655 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2646 2656 better handle backslashes in paths. See the thread 'More Windows
2647 2657 questions part 2 - \/ characters revisited' on the iypthon user
2648 2658 list:
2649 2659 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2650 2660
2651 2661 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2652 2662
2653 2663 (InteractiveShell.__init__): change threaded shells to not use the
2654 2664 ipython crash handler. This was causing more problems than not,
2655 2665 as exceptions in the main thread (GUI code, typically) would
2656 2666 always show up as a 'crash', when they really weren't.
2657 2667
2658 2668 The colors and exception mode commands (%colors/%xmode) have been
2659 2669 synchronized to also take this into account, so users can get
2660 2670 verbose exceptions for their threaded code as well. I also added
2661 2671 support for activating pdb inside this exception handler as well,
2662 2672 so now GUI authors can use IPython's enhanced pdb at runtime.
2663 2673
2664 2674 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2665 2675 true by default, and add it to the shipped ipythonrc file. Since
2666 2676 this asks the user before proceeding, I think it's OK to make it
2667 2677 true by default.
2668 2678
2669 2679 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2670 2680 of the previous special-casing of input in the eval loop. I think
2671 2681 this is cleaner, as they really are commands and shouldn't have
2672 2682 a special role in the middle of the core code.
2673 2683
2674 2684 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2675 2685
2676 2686 * IPython/iplib.py (edit_syntax_error): added support for
2677 2687 automatically reopening the editor if the file had a syntax error
2678 2688 in it. Thanks to scottt who provided the patch at:
2679 2689 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2680 2690 version committed).
2681 2691
2682 2692 * IPython/iplib.py (handle_normal): add suport for multi-line
2683 2693 input with emtpy lines. This fixes
2684 2694 http://www.scipy.net/roundup/ipython/issue43 and a similar
2685 2695 discussion on the user list.
2686 2696
2687 2697 WARNING: a behavior change is necessarily introduced to support
2688 2698 blank lines: now a single blank line with whitespace does NOT
2689 2699 break the input loop, which means that when autoindent is on, by
2690 2700 default hitting return on the next (indented) line does NOT exit.
2691 2701
2692 2702 Instead, to exit a multiline input you can either have:
2693 2703
2694 2704 - TWO whitespace lines (just hit return again), or
2695 2705 - a single whitespace line of a different length than provided
2696 2706 by the autoindent (add or remove a space).
2697 2707
2698 2708 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2699 2709 module to better organize all readline-related functionality.
2700 2710 I've deleted FlexCompleter and put all completion clases here.
2701 2711
2702 2712 * IPython/iplib.py (raw_input): improve indentation management.
2703 2713 It is now possible to paste indented code with autoindent on, and
2704 2714 the code is interpreted correctly (though it still looks bad on
2705 2715 screen, due to the line-oriented nature of ipython).
2706 2716 (MagicCompleter.complete): change behavior so that a TAB key on an
2707 2717 otherwise empty line actually inserts a tab, instead of completing
2708 2718 on the entire global namespace. This makes it easier to use the
2709 2719 TAB key for indentation. After a request by Hans Meine
2710 2720 <hans_meine-AT-gmx.net>
2711 2721 (_prefilter): add support so that typing plain 'exit' or 'quit'
2712 2722 does a sensible thing. Originally I tried to deviate as little as
2713 2723 possible from the default python behavior, but even that one may
2714 2724 change in this direction (thread on python-dev to that effect).
2715 2725 Regardless, ipython should do the right thing even if CPython's
2716 2726 '>>>' prompt doesn't.
2717 2727 (InteractiveShell): removed subclassing code.InteractiveConsole
2718 2728 class. By now we'd overridden just about all of its methods: I've
2719 2729 copied the remaining two over, and now ipython is a standalone
2720 2730 class. This will provide a clearer picture for the chainsaw
2721 2731 branch refactoring.
2722 2732
2723 2733 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2724 2734
2725 2735 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2726 2736 failures for objects which break when dir() is called on them.
2727 2737
2728 2738 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2729 2739 distinct local and global namespaces in the completer API. This
2730 2740 change allows us to properly handle completion with distinct
2731 2741 scopes, including in embedded instances (this had never really
2732 2742 worked correctly).
2733 2743
2734 2744 Note: this introduces a change in the constructor for
2735 2745 MagicCompleter, as a new global_namespace parameter is now the
2736 2746 second argument (the others were bumped one position).
2737 2747
2738 2748 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2739 2749
2740 2750 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2741 2751 embedded instances (which can be done now thanks to Vivian's
2742 2752 frame-handling fixes for pdb).
2743 2753 (InteractiveShell.__init__): Fix namespace handling problem in
2744 2754 embedded instances. We were overwriting __main__ unconditionally,
2745 2755 and this should only be done for 'full' (non-embedded) IPython;
2746 2756 embedded instances must respect the caller's __main__. Thanks to
2747 2757 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2748 2758
2749 2759 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2750 2760
2751 2761 * setup.py: added download_url to setup(). This registers the
2752 2762 download address at PyPI, which is not only useful to humans
2753 2763 browsing the site, but is also picked up by setuptools (the Eggs
2754 2764 machinery). Thanks to Ville and R. Kern for the info/discussion
2755 2765 on this.
2756 2766
2757 2767 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2758 2768
2759 2769 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2760 2770 This brings a lot of nice functionality to the pdb mode, which now
2761 2771 has tab-completion, syntax highlighting, and better stack handling
2762 2772 than before. Many thanks to Vivian De Smedt
2763 2773 <vivian-AT-vdesmedt.com> for the original patches.
2764 2774
2765 2775 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2766 2776
2767 2777 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2768 2778 sequence to consistently accept the banner argument. The
2769 2779 inconsistency was tripping SAGE, thanks to Gary Zablackis
2770 2780 <gzabl-AT-yahoo.com> for the report.
2771 2781
2772 2782 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2773 2783
2774 2784 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2775 2785 Fix bug where a naked 'alias' call in the ipythonrc file would
2776 2786 cause a crash. Bug reported by Jorgen Stenarson.
2777 2787
2778 2788 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2779 2789
2780 2790 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2781 2791 startup time.
2782 2792
2783 2793 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2784 2794 instances had introduced a bug with globals in normal code. Now
2785 2795 it's working in all cases.
2786 2796
2787 2797 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2788 2798 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2789 2799 has been introduced to set the default case sensitivity of the
2790 2800 searches. Users can still select either mode at runtime on a
2791 2801 per-search basis.
2792 2802
2793 2803 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2794 2804
2795 2805 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2796 2806 attributes in wildcard searches for subclasses. Modified version
2797 2807 of a patch by Jorgen.
2798 2808
2799 2809 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2800 2810
2801 2811 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2802 2812 embedded instances. I added a user_global_ns attribute to the
2803 2813 InteractiveShell class to handle this.
2804 2814
2805 2815 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2806 2816
2807 2817 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2808 2818 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2809 2819 (reported under win32, but may happen also in other platforms).
2810 2820 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2811 2821
2812 2822 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2813 2823
2814 2824 * IPython/Magic.py (magic_psearch): new support for wildcard
2815 2825 patterns. Now, typing ?a*b will list all names which begin with a
2816 2826 and end in b, for example. The %psearch magic has full
2817 2827 docstrings. Many thanks to Jörgen Stenarson
2818 2828 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2819 2829 implementing this functionality.
2820 2830
2821 2831 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2822 2832
2823 2833 * Manual: fixed long-standing annoyance of double-dashes (as in
2824 2834 --prefix=~, for example) being stripped in the HTML version. This
2825 2835 is a latex2html bug, but a workaround was provided. Many thanks
2826 2836 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2827 2837 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2828 2838 rolling. This seemingly small issue had tripped a number of users
2829 2839 when first installing, so I'm glad to see it gone.
2830 2840
2831 2841 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2832 2842
2833 2843 * IPython/Extensions/numeric_formats.py: fix missing import,
2834 2844 reported by Stephen Walton.
2835 2845
2836 2846 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2837 2847
2838 2848 * IPython/demo.py: finish demo module, fully documented now.
2839 2849
2840 2850 * IPython/genutils.py (file_read): simple little utility to read a
2841 2851 file and ensure it's closed afterwards.
2842 2852
2843 2853 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2844 2854
2845 2855 * IPython/demo.py (Demo.__init__): added support for individually
2846 2856 tagging blocks for automatic execution.
2847 2857
2848 2858 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2849 2859 syntax-highlighted python sources, requested by John.
2850 2860
2851 2861 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2852 2862
2853 2863 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2854 2864 finishing.
2855 2865
2856 2866 * IPython/genutils.py (shlex_split): moved from Magic to here,
2857 2867 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2858 2868
2859 2869 * IPython/demo.py (Demo.__init__): added support for silent
2860 2870 blocks, improved marks as regexps, docstrings written.
2861 2871 (Demo.__init__): better docstring, added support for sys.argv.
2862 2872
2863 2873 * IPython/genutils.py (marquee): little utility used by the demo
2864 2874 code, handy in general.
2865 2875
2866 2876 * IPython/demo.py (Demo.__init__): new class for interactive
2867 2877 demos. Not documented yet, I just wrote it in a hurry for
2868 2878 scipy'05. Will docstring later.
2869 2879
2870 2880 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2871 2881
2872 2882 * IPython/Shell.py (sigint_handler): Drastic simplification which
2873 2883 also seems to make Ctrl-C work correctly across threads! This is
2874 2884 so simple, that I can't beleive I'd missed it before. Needs more
2875 2885 testing, though.
2876 2886 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2877 2887 like this before...
2878 2888
2879 2889 * IPython/genutils.py (get_home_dir): add protection against
2880 2890 non-dirs in win32 registry.
2881 2891
2882 2892 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2883 2893 bug where dict was mutated while iterating (pysh crash).
2884 2894
2885 2895 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2886 2896
2887 2897 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2888 2898 spurious newlines added by this routine. After a report by
2889 2899 F. Mantegazza.
2890 2900
2891 2901 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2892 2902
2893 2903 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2894 2904 calls. These were a leftover from the GTK 1.x days, and can cause
2895 2905 problems in certain cases (after a report by John Hunter).
2896 2906
2897 2907 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2898 2908 os.getcwd() fails at init time. Thanks to patch from David Remahl
2899 2909 <chmod007-AT-mac.com>.
2900 2910 (InteractiveShell.__init__): prevent certain special magics from
2901 2911 being shadowed by aliases. Closes
2902 2912 http://www.scipy.net/roundup/ipython/issue41.
2903 2913
2904 2914 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2905 2915
2906 2916 * IPython/iplib.py (InteractiveShell.complete): Added new
2907 2917 top-level completion method to expose the completion mechanism
2908 2918 beyond readline-based environments.
2909 2919
2910 2920 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2911 2921
2912 2922 * tools/ipsvnc (svnversion): fix svnversion capture.
2913 2923
2914 2924 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2915 2925 attribute to self, which was missing. Before, it was set by a
2916 2926 routine which in certain cases wasn't being called, so the
2917 2927 instance could end up missing the attribute. This caused a crash.
2918 2928 Closes http://www.scipy.net/roundup/ipython/issue40.
2919 2929
2920 2930 2005-08-16 Fernando Perez <fperez@colorado.edu>
2921 2931
2922 2932 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2923 2933 contains non-string attribute. Closes
2924 2934 http://www.scipy.net/roundup/ipython/issue38.
2925 2935
2926 2936 2005-08-14 Fernando Perez <fperez@colorado.edu>
2927 2937
2928 2938 * tools/ipsvnc: Minor improvements, to add changeset info.
2929 2939
2930 2940 2005-08-12 Fernando Perez <fperez@colorado.edu>
2931 2941
2932 2942 * IPython/iplib.py (runsource): remove self.code_to_run_src
2933 2943 attribute. I realized this is nothing more than
2934 2944 '\n'.join(self.buffer), and having the same data in two different
2935 2945 places is just asking for synchronization bugs. This may impact
2936 2946 people who have custom exception handlers, so I need to warn
2937 2947 ipython-dev about it (F. Mantegazza may use them).
2938 2948
2939 2949 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2940 2950
2941 2951 * IPython/genutils.py: fix 2.2 compatibility (generators)
2942 2952
2943 2953 2005-07-18 Fernando Perez <fperez@colorado.edu>
2944 2954
2945 2955 * IPython/genutils.py (get_home_dir): fix to help users with
2946 2956 invalid $HOME under win32.
2947 2957
2948 2958 2005-07-17 Fernando Perez <fperez@colorado.edu>
2949 2959
2950 2960 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2951 2961 some old hacks and clean up a bit other routines; code should be
2952 2962 simpler and a bit faster.
2953 2963
2954 2964 * IPython/iplib.py (interact): removed some last-resort attempts
2955 2965 to survive broken stdout/stderr. That code was only making it
2956 2966 harder to abstract out the i/o (necessary for gui integration),
2957 2967 and the crashes it could prevent were extremely rare in practice
2958 2968 (besides being fully user-induced in a pretty violent manner).
2959 2969
2960 2970 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2961 2971 Nothing major yet, but the code is simpler to read; this should
2962 2972 make it easier to do more serious modifications in the future.
2963 2973
2964 2974 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2965 2975 which broke in .15 (thanks to a report by Ville).
2966 2976
2967 2977 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2968 2978 be quite correct, I know next to nothing about unicode). This
2969 2979 will allow unicode strings to be used in prompts, amongst other
2970 2980 cases. It also will prevent ipython from crashing when unicode
2971 2981 shows up unexpectedly in many places. If ascii encoding fails, we
2972 2982 assume utf_8. Currently the encoding is not a user-visible
2973 2983 setting, though it could be made so if there is demand for it.
2974 2984
2975 2985 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2976 2986
2977 2987 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2978 2988
2979 2989 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2980 2990
2981 2991 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2982 2992 code can work transparently for 2.2/2.3.
2983 2993
2984 2994 2005-07-16 Fernando Perez <fperez@colorado.edu>
2985 2995
2986 2996 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2987 2997 out of the color scheme table used for coloring exception
2988 2998 tracebacks. This allows user code to add new schemes at runtime.
2989 2999 This is a minimally modified version of the patch at
2990 3000 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2991 3001 for the contribution.
2992 3002
2993 3003 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2994 3004 slightly modified version of the patch in
2995 3005 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2996 3006 to remove the previous try/except solution (which was costlier).
2997 3007 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2998 3008
2999 3009 2005-06-08 Fernando Perez <fperez@colorado.edu>
3000 3010
3001 3011 * IPython/iplib.py (write/write_err): Add methods to abstract all
3002 3012 I/O a bit more.
3003 3013
3004 3014 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
3005 3015 warning, reported by Aric Hagberg, fix by JD Hunter.
3006 3016
3007 3017 2005-06-02 *** Released version 0.6.15
3008 3018
3009 3019 2005-06-01 Fernando Perez <fperez@colorado.edu>
3010 3020
3011 3021 * IPython/iplib.py (MagicCompleter.file_matches): Fix
3012 3022 tab-completion of filenames within open-quoted strings. Note that
3013 3023 this requires that in ~/.ipython/ipythonrc, users change the
3014 3024 readline delimiters configuration to read:
3015 3025
3016 3026 readline_remove_delims -/~
3017 3027
3018 3028
3019 3029 2005-05-31 *** Released version 0.6.14
3020 3030
3021 3031 2005-05-29 Fernando Perez <fperez@colorado.edu>
3022 3032
3023 3033 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
3024 3034 with files not on the filesystem. Reported by Eliyahu Sandler
3025 3035 <eli@gondolin.net>
3026 3036
3027 3037 2005-05-22 Fernando Perez <fperez@colorado.edu>
3028 3038
3029 3039 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
3030 3040 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
3031 3041
3032 3042 2005-05-19 Fernando Perez <fperez@colorado.edu>
3033 3043
3034 3044 * IPython/iplib.py (safe_execfile): close a file which could be
3035 3045 left open (causing problems in win32, which locks open files).
3036 3046 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
3037 3047
3038 3048 2005-05-18 Fernando Perez <fperez@colorado.edu>
3039 3049
3040 3050 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3041 3051 keyword arguments correctly to safe_execfile().
3042 3052
3043 3053 2005-05-13 Fernando Perez <fperez@colorado.edu>
3044 3054
3045 3055 * ipython.1: Added info about Qt to manpage, and threads warning
3046 3056 to usage page (invoked with --help).
3047 3057
3048 3058 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3049 3059 new matcher (it goes at the end of the priority list) to do
3050 3060 tab-completion on named function arguments. Submitted by George
3051 3061 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3052 3062 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3053 3063 for more details.
3054 3064
3055 3065 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3056 3066 SystemExit exceptions in the script being run. Thanks to a report
3057 3067 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3058 3068 producing very annoying behavior when running unit tests.
3059 3069
3060 3070 2005-05-12 Fernando Perez <fperez@colorado.edu>
3061 3071
3062 3072 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3063 3073 which I'd broken (again) due to a changed regexp. In the process,
3064 3074 added ';' as an escape to auto-quote the whole line without
3065 3075 splitting its arguments. Thanks to a report by Jerry McRae
3066 3076 <qrs0xyc02-AT-sneakemail.com>.
3067 3077
3068 3078 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3069 3079 possible crashes caused by a TokenError. Reported by Ed Schofield
3070 3080 <schofield-AT-ftw.at>.
3071 3081
3072 3082 2005-05-06 Fernando Perez <fperez@colorado.edu>
3073 3083
3074 3084 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3075 3085
3076 3086 2005-04-29 Fernando Perez <fperez@colorado.edu>
3077 3087
3078 3088 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3079 3089 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3080 3090 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3081 3091 which provides support for Qt interactive usage (similar to the
3082 3092 existing one for WX and GTK). This had been often requested.
3083 3093
3084 3094 2005-04-14 *** Released version 0.6.13
3085 3095
3086 3096 2005-04-08 Fernando Perez <fperez@colorado.edu>
3087 3097
3088 3098 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3089 3099 from _ofind, which gets called on almost every input line. Now,
3090 3100 we only try to get docstrings if they are actually going to be
3091 3101 used (the overhead of fetching unnecessary docstrings can be
3092 3102 noticeable for certain objects, such as Pyro proxies).
3093 3103
3094 3104 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3095 3105 for completers. For some reason I had been passing them the state
3096 3106 variable, which completers never actually need, and was in
3097 3107 conflict with the rlcompleter API. Custom completers ONLY need to
3098 3108 take the text parameter.
3099 3109
3100 3110 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3101 3111 work correctly in pysh. I've also moved all the logic which used
3102 3112 to be in pysh.py here, which will prevent problems with future
3103 3113 upgrades. However, this time I must warn users to update their
3104 3114 pysh profile to include the line
3105 3115
3106 3116 import_all IPython.Extensions.InterpreterExec
3107 3117
3108 3118 because otherwise things won't work for them. They MUST also
3109 3119 delete pysh.py and the line
3110 3120
3111 3121 execfile pysh.py
3112 3122
3113 3123 from their ipythonrc-pysh.
3114 3124
3115 3125 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3116 3126 robust in the face of objects whose dir() returns non-strings
3117 3127 (which it shouldn't, but some broken libs like ITK do). Thanks to
3118 3128 a patch by John Hunter (implemented differently, though). Also
3119 3129 minor improvements by using .extend instead of + on lists.
3120 3130
3121 3131 * pysh.py:
3122 3132
3123 3133 2005-04-06 Fernando Perez <fperez@colorado.edu>
3124 3134
3125 3135 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3126 3136 by default, so that all users benefit from it. Those who don't
3127 3137 want it can still turn it off.
3128 3138
3129 3139 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3130 3140 config file, I'd forgotten about this, so users were getting it
3131 3141 off by default.
3132 3142
3133 3143 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3134 3144 consistency. Now magics can be called in multiline statements,
3135 3145 and python variables can be expanded in magic calls via $var.
3136 3146 This makes the magic system behave just like aliases or !system
3137 3147 calls.
3138 3148
3139 3149 2005-03-28 Fernando Perez <fperez@colorado.edu>
3140 3150
3141 3151 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3142 3152 expensive string additions for building command. Add support for
3143 3153 trailing ';' when autocall is used.
3144 3154
3145 3155 2005-03-26 Fernando Perez <fperez@colorado.edu>
3146 3156
3147 3157 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3148 3158 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3149 3159 ipython.el robust against prompts with any number of spaces
3150 3160 (including 0) after the ':' character.
3151 3161
3152 3162 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3153 3163 continuation prompt, which misled users to think the line was
3154 3164 already indented. Closes debian Bug#300847, reported to me by
3155 3165 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3156 3166
3157 3167 2005-03-23 Fernando Perez <fperez@colorado.edu>
3158 3168
3159 3169 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3160 3170 properly aligned if they have embedded newlines.
3161 3171
3162 3172 * IPython/iplib.py (runlines): Add a public method to expose
3163 3173 IPython's code execution machinery, so that users can run strings
3164 3174 as if they had been typed at the prompt interactively.
3165 3175 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3166 3176 methods which can call the system shell, but with python variable
3167 3177 expansion. The three such methods are: __IPYTHON__.system,
3168 3178 .getoutput and .getoutputerror. These need to be documented in a
3169 3179 'public API' section (to be written) of the manual.
3170 3180
3171 3181 2005-03-20 Fernando Perez <fperez@colorado.edu>
3172 3182
3173 3183 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3174 3184 for custom exception handling. This is quite powerful, and it
3175 3185 allows for user-installable exception handlers which can trap
3176 3186 custom exceptions at runtime and treat them separately from
3177 3187 IPython's default mechanisms. At the request of Frédéric
3178 3188 Mantegazza <mantegazza-AT-ill.fr>.
3179 3189 (InteractiveShell.set_custom_completer): public API function to
3180 3190 add new completers at runtime.
3181 3191
3182 3192 2005-03-19 Fernando Perez <fperez@colorado.edu>
3183 3193
3184 3194 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3185 3195 allow objects which provide their docstrings via non-standard
3186 3196 mechanisms (like Pyro proxies) to still be inspected by ipython's
3187 3197 ? system.
3188 3198
3189 3199 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3190 3200 automatic capture system. I tried quite hard to make it work
3191 3201 reliably, and simply failed. I tried many combinations with the
3192 3202 subprocess module, but eventually nothing worked in all needed
3193 3203 cases (not blocking stdin for the child, duplicating stdout
3194 3204 without blocking, etc). The new %sc/%sx still do capture to these
3195 3205 magical list/string objects which make shell use much more
3196 3206 conveninent, so not all is lost.
3197 3207
3198 3208 XXX - FIX MANUAL for the change above!
3199 3209
3200 3210 (runsource): I copied code.py's runsource() into ipython to modify
3201 3211 it a bit. Now the code object and source to be executed are
3202 3212 stored in ipython. This makes this info accessible to third-party
3203 3213 tools, like custom exception handlers. After a request by Frédéric
3204 3214 Mantegazza <mantegazza-AT-ill.fr>.
3205 3215
3206 3216 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3207 3217 history-search via readline (like C-p/C-n). I'd wanted this for a
3208 3218 long time, but only recently found out how to do it. For users
3209 3219 who already have their ipythonrc files made and want this, just
3210 3220 add:
3211 3221
3212 3222 readline_parse_and_bind "\e[A": history-search-backward
3213 3223 readline_parse_and_bind "\e[B": history-search-forward
3214 3224
3215 3225 2005-03-18 Fernando Perez <fperez@colorado.edu>
3216 3226
3217 3227 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3218 3228 LSString and SList classes which allow transparent conversions
3219 3229 between list mode and whitespace-separated string.
3220 3230 (magic_r): Fix recursion problem in %r.
3221 3231
3222 3232 * IPython/genutils.py (LSString): New class to be used for
3223 3233 automatic storage of the results of all alias/system calls in _o
3224 3234 and _e (stdout/err). These provide a .l/.list attribute which
3225 3235 does automatic splitting on newlines. This means that for most
3226 3236 uses, you'll never need to do capturing of output with %sc/%sx
3227 3237 anymore, since ipython keeps this always done for you. Note that
3228 3238 only the LAST results are stored, the _o/e variables are
3229 3239 overwritten on each call. If you need to save their contents
3230 3240 further, simply bind them to any other name.
3231 3241
3232 3242 2005-03-17 Fernando Perez <fperez@colorado.edu>
3233 3243
3234 3244 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3235 3245 prompt namespace handling.
3236 3246
3237 3247 2005-03-16 Fernando Perez <fperez@colorado.edu>
3238 3248
3239 3249 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3240 3250 classic prompts to be '>>> ' (final space was missing, and it
3241 3251 trips the emacs python mode).
3242 3252 (BasePrompt.__str__): Added safe support for dynamic prompt
3243 3253 strings. Now you can set your prompt string to be '$x', and the
3244 3254 value of x will be printed from your interactive namespace. The
3245 3255 interpolation syntax includes the full Itpl support, so
3246 3256 ${foo()+x+bar()} is a valid prompt string now, and the function
3247 3257 calls will be made at runtime.
3248 3258
3249 3259 2005-03-15 Fernando Perez <fperez@colorado.edu>
3250 3260
3251 3261 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3252 3262 avoid name clashes in pylab. %hist still works, it just forwards
3253 3263 the call to %history.
3254 3264
3255 3265 2005-03-02 *** Released version 0.6.12
3256 3266
3257 3267 2005-03-02 Fernando Perez <fperez@colorado.edu>
3258 3268
3259 3269 * IPython/iplib.py (handle_magic): log magic calls properly as
3260 3270 ipmagic() function calls.
3261 3271
3262 3272 * IPython/Magic.py (magic_time): Improved %time to support
3263 3273 statements and provide wall-clock as well as CPU time.
3264 3274
3265 3275 2005-02-27 Fernando Perez <fperez@colorado.edu>
3266 3276
3267 3277 * IPython/hooks.py: New hooks module, to expose user-modifiable
3268 3278 IPython functionality in a clean manner. For now only the editor
3269 3279 hook is actually written, and other thigns which I intend to turn
3270 3280 into proper hooks aren't yet there. The display and prefilter
3271 3281 stuff, for example, should be hooks. But at least now the
3272 3282 framework is in place, and the rest can be moved here with more
3273 3283 time later. IPython had had a .hooks variable for a long time for
3274 3284 this purpose, but I'd never actually used it for anything.
3275 3285
3276 3286 2005-02-26 Fernando Perez <fperez@colorado.edu>
3277 3287
3278 3288 * IPython/ipmaker.py (make_IPython): make the default ipython
3279 3289 directory be called _ipython under win32, to follow more the
3280 3290 naming peculiarities of that platform (where buggy software like
3281 3291 Visual Sourcesafe breaks with .named directories). Reported by
3282 3292 Ville Vainio.
3283 3293
3284 3294 2005-02-23 Fernando Perez <fperez@colorado.edu>
3285 3295
3286 3296 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3287 3297 auto_aliases for win32 which were causing problems. Users can
3288 3298 define the ones they personally like.
3289 3299
3290 3300 2005-02-21 Fernando Perez <fperez@colorado.edu>
3291 3301
3292 3302 * IPython/Magic.py (magic_time): new magic to time execution of
3293 3303 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3294 3304
3295 3305 2005-02-19 Fernando Perez <fperez@colorado.edu>
3296 3306
3297 3307 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3298 3308 into keys (for prompts, for example).
3299 3309
3300 3310 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3301 3311 prompts in case users want them. This introduces a small behavior
3302 3312 change: ipython does not automatically add a space to all prompts
3303 3313 anymore. To get the old prompts with a space, users should add it
3304 3314 manually to their ipythonrc file, so for example prompt_in1 should
3305 3315 now read 'In [\#]: ' instead of 'In [\#]:'.
3306 3316 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3307 3317 file) to control left-padding of secondary prompts.
3308 3318
3309 3319 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3310 3320 the profiler can't be imported. Fix for Debian, which removed
3311 3321 profile.py because of License issues. I applied a slightly
3312 3322 modified version of the original Debian patch at
3313 3323 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3314 3324
3315 3325 2005-02-17 Fernando Perez <fperez@colorado.edu>
3316 3326
3317 3327 * IPython/genutils.py (native_line_ends): Fix bug which would
3318 3328 cause improper line-ends under win32 b/c I was not opening files
3319 3329 in binary mode. Bug report and fix thanks to Ville.
3320 3330
3321 3331 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3322 3332 trying to catch spurious foo[1] autocalls. My fix actually broke
3323 3333 ',/' autoquote/call with explicit escape (bad regexp).
3324 3334
3325 3335 2005-02-15 *** Released version 0.6.11
3326 3336
3327 3337 2005-02-14 Fernando Perez <fperez@colorado.edu>
3328 3338
3329 3339 * IPython/background_jobs.py: New background job management
3330 3340 subsystem. This is implemented via a new set of classes, and
3331 3341 IPython now provides a builtin 'jobs' object for background job
3332 3342 execution. A convenience %bg magic serves as a lightweight
3333 3343 frontend for starting the more common type of calls. This was
3334 3344 inspired by discussions with B. Granger and the BackgroundCommand
3335 3345 class described in the book Python Scripting for Computational
3336 3346 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3337 3347 (although ultimately no code from this text was used, as IPython's
3338 3348 system is a separate implementation).
3339 3349
3340 3350 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3341 3351 to control the completion of single/double underscore names
3342 3352 separately. As documented in the example ipytonrc file, the
3343 3353 readline_omit__names variable can now be set to 2, to omit even
3344 3354 single underscore names. Thanks to a patch by Brian Wong
3345 3355 <BrianWong-AT-AirgoNetworks.Com>.
3346 3356 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3347 3357 be autocalled as foo([1]) if foo were callable. A problem for
3348 3358 things which are both callable and implement __getitem__.
3349 3359 (init_readline): Fix autoindentation for win32. Thanks to a patch
3350 3360 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3351 3361
3352 3362 2005-02-12 Fernando Perez <fperez@colorado.edu>
3353 3363
3354 3364 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3355 3365 which I had written long ago to sort out user error messages which
3356 3366 may occur during startup. This seemed like a good idea initially,
3357 3367 but it has proven a disaster in retrospect. I don't want to
3358 3368 change much code for now, so my fix is to set the internal 'debug'
3359 3369 flag to true everywhere, whose only job was precisely to control
3360 3370 this subsystem. This closes issue 28 (as well as avoiding all
3361 3371 sorts of strange hangups which occur from time to time).
3362 3372
3363 3373 2005-02-07 Fernando Perez <fperez@colorado.edu>
3364 3374
3365 3375 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3366 3376 previous call produced a syntax error.
3367 3377
3368 3378 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3369 3379 classes without constructor.
3370 3380
3371 3381 2005-02-06 Fernando Perez <fperez@colorado.edu>
3372 3382
3373 3383 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3374 3384 completions with the results of each matcher, so we return results
3375 3385 to the user from all namespaces. This breaks with ipython
3376 3386 tradition, but I think it's a nicer behavior. Now you get all
3377 3387 possible completions listed, from all possible namespaces (python,
3378 3388 filesystem, magics...) After a request by John Hunter
3379 3389 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3380 3390
3381 3391 2005-02-05 Fernando Perez <fperez@colorado.edu>
3382 3392
3383 3393 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3384 3394 the call had quote characters in it (the quotes were stripped).
3385 3395
3386 3396 2005-01-31 Fernando Perez <fperez@colorado.edu>
3387 3397
3388 3398 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3389 3399 Itpl.itpl() to make the code more robust against psyco
3390 3400 optimizations.
3391 3401
3392 3402 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3393 3403 of causing an exception. Quicker, cleaner.
3394 3404
3395 3405 2005-01-28 Fernando Perez <fperez@colorado.edu>
3396 3406
3397 3407 * scripts/ipython_win_post_install.py (install): hardcode
3398 3408 sys.prefix+'python.exe' as the executable path. It turns out that
3399 3409 during the post-installation run, sys.executable resolves to the
3400 3410 name of the binary installer! I should report this as a distutils
3401 3411 bug, I think. I updated the .10 release with this tiny fix, to
3402 3412 avoid annoying the lists further.
3403 3413
3404 3414 2005-01-27 *** Released version 0.6.10
3405 3415
3406 3416 2005-01-27 Fernando Perez <fperez@colorado.edu>
3407 3417
3408 3418 * IPython/numutils.py (norm): Added 'inf' as optional name for
3409 3419 L-infinity norm, included references to mathworld.com for vector
3410 3420 norm definitions.
3411 3421 (amin/amax): added amin/amax for array min/max. Similar to what
3412 3422 pylab ships with after the recent reorganization of names.
3413 3423 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3414 3424
3415 3425 * ipython.el: committed Alex's recent fixes and improvements.
3416 3426 Tested with python-mode from CVS, and it looks excellent. Since
3417 3427 python-mode hasn't released anything in a while, I'm temporarily
3418 3428 putting a copy of today's CVS (v 4.70) of python-mode in:
3419 3429 http://ipython.scipy.org/tmp/python-mode.el
3420 3430
3421 3431 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3422 3432 sys.executable for the executable name, instead of assuming it's
3423 3433 called 'python.exe' (the post-installer would have produced broken
3424 3434 setups on systems with a differently named python binary).
3425 3435
3426 3436 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3427 3437 references to os.linesep, to make the code more
3428 3438 platform-independent. This is also part of the win32 coloring
3429 3439 fixes.
3430 3440
3431 3441 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3432 3442 lines, which actually cause coloring bugs because the length of
3433 3443 the line is very difficult to correctly compute with embedded
3434 3444 escapes. This was the source of all the coloring problems under
3435 3445 Win32. I think that _finally_, Win32 users have a properly
3436 3446 working ipython in all respects. This would never have happened
3437 3447 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3438 3448
3439 3449 2005-01-26 *** Released version 0.6.9
3440 3450
3441 3451 2005-01-25 Fernando Perez <fperez@colorado.edu>
3442 3452
3443 3453 * setup.py: finally, we have a true Windows installer, thanks to
3444 3454 the excellent work of Viktor Ransmayr
3445 3455 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3446 3456 Windows users. The setup routine is quite a bit cleaner thanks to
3447 3457 this, and the post-install script uses the proper functions to
3448 3458 allow a clean de-installation using the standard Windows Control
3449 3459 Panel.
3450 3460
3451 3461 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3452 3462 environment variable under all OSes (including win32) if
3453 3463 available. This will give consistency to win32 users who have set
3454 3464 this variable for any reason. If os.environ['HOME'] fails, the
3455 3465 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3456 3466
3457 3467 2005-01-24 Fernando Perez <fperez@colorado.edu>
3458 3468
3459 3469 * IPython/numutils.py (empty_like): add empty_like(), similar to
3460 3470 zeros_like() but taking advantage of the new empty() Numeric routine.
3461 3471
3462 3472 2005-01-23 *** Released version 0.6.8
3463 3473
3464 3474 2005-01-22 Fernando Perez <fperez@colorado.edu>
3465 3475
3466 3476 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3467 3477 automatic show() calls. After discussing things with JDH, it
3468 3478 turns out there are too many corner cases where this can go wrong.
3469 3479 It's best not to try to be 'too smart', and simply have ipython
3470 3480 reproduce as much as possible the default behavior of a normal
3471 3481 python shell.
3472 3482
3473 3483 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3474 3484 line-splitting regexp and _prefilter() to avoid calling getattr()
3475 3485 on assignments. This closes
3476 3486 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3477 3487 readline uses getattr(), so a simple <TAB> keypress is still
3478 3488 enough to trigger getattr() calls on an object.
3479 3489
3480 3490 2005-01-21 Fernando Perez <fperez@colorado.edu>
3481 3491
3482 3492 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3483 3493 docstring under pylab so it doesn't mask the original.
3484 3494
3485 3495 2005-01-21 *** Released version 0.6.7
3486 3496
3487 3497 2005-01-21 Fernando Perez <fperez@colorado.edu>
3488 3498
3489 3499 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3490 3500 signal handling for win32 users in multithreaded mode.
3491 3501
3492 3502 2005-01-17 Fernando Perez <fperez@colorado.edu>
3493 3503
3494 3504 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3495 3505 instances with no __init__. After a crash report by Norbert Nemec
3496 3506 <Norbert-AT-nemec-online.de>.
3497 3507
3498 3508 2005-01-14 Fernando Perez <fperez@colorado.edu>
3499 3509
3500 3510 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3501 3511 names for verbose exceptions, when multiple dotted names and the
3502 3512 'parent' object were present on the same line.
3503 3513
3504 3514 2005-01-11 Fernando Perez <fperez@colorado.edu>
3505 3515
3506 3516 * IPython/genutils.py (flag_calls): new utility to trap and flag
3507 3517 calls in functions. I need it to clean up matplotlib support.
3508 3518 Also removed some deprecated code in genutils.
3509 3519
3510 3520 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3511 3521 that matplotlib scripts called with %run, which don't call show()
3512 3522 themselves, still have their plotting windows open.
3513 3523
3514 3524 2005-01-05 Fernando Perez <fperez@colorado.edu>
3515 3525
3516 3526 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3517 3527 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3518 3528
3519 3529 2004-12-19 Fernando Perez <fperez@colorado.edu>
3520 3530
3521 3531 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3522 3532 parent_runcode, which was an eyesore. The same result can be
3523 3533 obtained with Python's regular superclass mechanisms.
3524 3534
3525 3535 2004-12-17 Fernando Perez <fperez@colorado.edu>
3526 3536
3527 3537 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3528 3538 reported by Prabhu.
3529 3539 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3530 3540 sys.stderr) instead of explicitly calling sys.stderr. This helps
3531 3541 maintain our I/O abstractions clean, for future GUI embeddings.
3532 3542
3533 3543 * IPython/genutils.py (info): added new utility for sys.stderr
3534 3544 unified info message handling (thin wrapper around warn()).
3535 3545
3536 3546 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3537 3547 composite (dotted) names on verbose exceptions.
3538 3548 (VerboseTB.nullrepr): harden against another kind of errors which
3539 3549 Python's inspect module can trigger, and which were crashing
3540 3550 IPython. Thanks to a report by Marco Lombardi
3541 3551 <mlombard-AT-ma010192.hq.eso.org>.
3542 3552
3543 3553 2004-12-13 *** Released version 0.6.6
3544 3554
3545 3555 2004-12-12 Fernando Perez <fperez@colorado.edu>
3546 3556
3547 3557 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3548 3558 generated by pygtk upon initialization if it was built without
3549 3559 threads (for matplotlib users). After a crash reported by
3550 3560 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3551 3561
3552 3562 * IPython/ipmaker.py (make_IPython): fix small bug in the
3553 3563 import_some parameter for multiple imports.
3554 3564
3555 3565 * IPython/iplib.py (ipmagic): simplified the interface of
3556 3566 ipmagic() to take a single string argument, just as it would be
3557 3567 typed at the IPython cmd line.
3558 3568 (ipalias): Added new ipalias() with an interface identical to
3559 3569 ipmagic(). This completes exposing a pure python interface to the
3560 3570 alias and magic system, which can be used in loops or more complex
3561 3571 code where IPython's automatic line mangling is not active.
3562 3572
3563 3573 * IPython/genutils.py (timing): changed interface of timing to
3564 3574 simply run code once, which is the most common case. timings()
3565 3575 remains unchanged, for the cases where you want multiple runs.
3566 3576
3567 3577 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3568 3578 bug where Python2.2 crashes with exec'ing code which does not end
3569 3579 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3570 3580 before.
3571 3581
3572 3582 2004-12-10 Fernando Perez <fperez@colorado.edu>
3573 3583
3574 3584 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3575 3585 -t to -T, to accomodate the new -t flag in %run (the %run and
3576 3586 %prun options are kind of intermixed, and it's not easy to change
3577 3587 this with the limitations of python's getopt).
3578 3588
3579 3589 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3580 3590 the execution of scripts. It's not as fine-tuned as timeit.py,
3581 3591 but it works from inside ipython (and under 2.2, which lacks
3582 3592 timeit.py). Optionally a number of runs > 1 can be given for
3583 3593 timing very short-running code.
3584 3594
3585 3595 * IPython/genutils.py (uniq_stable): new routine which returns a
3586 3596 list of unique elements in any iterable, but in stable order of
3587 3597 appearance. I needed this for the ultraTB fixes, and it's a handy
3588 3598 utility.
3589 3599
3590 3600 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3591 3601 dotted names in Verbose exceptions. This had been broken since
3592 3602 the very start, now x.y will properly be printed in a Verbose
3593 3603 traceback, instead of x being shown and y appearing always as an
3594 3604 'undefined global'. Getting this to work was a bit tricky,
3595 3605 because by default python tokenizers are stateless. Saved by
3596 3606 python's ability to easily add a bit of state to an arbitrary
3597 3607 function (without needing to build a full-blown callable object).
3598 3608
3599 3609 Also big cleanup of this code, which had horrendous runtime
3600 3610 lookups of zillions of attributes for colorization. Moved all
3601 3611 this code into a few templates, which make it cleaner and quicker.
3602 3612
3603 3613 Printout quality was also improved for Verbose exceptions: one
3604 3614 variable per line, and memory addresses are printed (this can be
3605 3615 quite handy in nasty debugging situations, which is what Verbose
3606 3616 is for).
3607 3617
3608 3618 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3609 3619 the command line as scripts to be loaded by embedded instances.
3610 3620 Doing so has the potential for an infinite recursion if there are
3611 3621 exceptions thrown in the process. This fixes a strange crash
3612 3622 reported by Philippe MULLER <muller-AT-irit.fr>.
3613 3623
3614 3624 2004-12-09 Fernando Perez <fperez@colorado.edu>
3615 3625
3616 3626 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3617 3627 to reflect new names in matplotlib, which now expose the
3618 3628 matlab-compatible interface via a pylab module instead of the
3619 3629 'matlab' name. The new code is backwards compatible, so users of
3620 3630 all matplotlib versions are OK. Patch by J. Hunter.
3621 3631
3622 3632 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3623 3633 of __init__ docstrings for instances (class docstrings are already
3624 3634 automatically printed). Instances with customized docstrings
3625 3635 (indep. of the class) are also recognized and all 3 separate
3626 3636 docstrings are printed (instance, class, constructor). After some
3627 3637 comments/suggestions by J. Hunter.
3628 3638
3629 3639 2004-12-05 Fernando Perez <fperez@colorado.edu>
3630 3640
3631 3641 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3632 3642 warnings when tab-completion fails and triggers an exception.
3633 3643
3634 3644 2004-12-03 Fernando Perez <fperez@colorado.edu>
3635 3645
3636 3646 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3637 3647 be triggered when using 'run -p'. An incorrect option flag was
3638 3648 being set ('d' instead of 'D').
3639 3649 (manpage): fix missing escaped \- sign.
3640 3650
3641 3651 2004-11-30 *** Released version 0.6.5
3642 3652
3643 3653 2004-11-30 Fernando Perez <fperez@colorado.edu>
3644 3654
3645 3655 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3646 3656 setting with -d option.
3647 3657
3648 3658 * setup.py (docfiles): Fix problem where the doc glob I was using
3649 3659 was COMPLETELY BROKEN. It was giving the right files by pure
3650 3660 accident, but failed once I tried to include ipython.el. Note:
3651 3661 glob() does NOT allow you to do exclusion on multiple endings!
3652 3662
3653 3663 2004-11-29 Fernando Perez <fperez@colorado.edu>
3654 3664
3655 3665 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3656 3666 the manpage as the source. Better formatting & consistency.
3657 3667
3658 3668 * IPython/Magic.py (magic_run): Added new -d option, to run
3659 3669 scripts under the control of the python pdb debugger. Note that
3660 3670 this required changing the %prun option -d to -D, to avoid a clash
3661 3671 (since %run must pass options to %prun, and getopt is too dumb to
3662 3672 handle options with string values with embedded spaces). Thanks
3663 3673 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3664 3674 (magic_who_ls): added type matching to %who and %whos, so that one
3665 3675 can filter their output to only include variables of certain
3666 3676 types. Another suggestion by Matthew.
3667 3677 (magic_whos): Added memory summaries in kb and Mb for arrays.
3668 3678 (magic_who): Improve formatting (break lines every 9 vars).
3669 3679
3670 3680 2004-11-28 Fernando Perez <fperez@colorado.edu>
3671 3681
3672 3682 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3673 3683 cache when empty lines were present.
3674 3684
3675 3685 2004-11-24 Fernando Perez <fperez@colorado.edu>
3676 3686
3677 3687 * IPython/usage.py (__doc__): document the re-activated threading
3678 3688 options for WX and GTK.
3679 3689
3680 3690 2004-11-23 Fernando Perez <fperez@colorado.edu>
3681 3691
3682 3692 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3683 3693 the -wthread and -gthread options, along with a new -tk one to try
3684 3694 and coordinate Tk threading with wx/gtk. The tk support is very
3685 3695 platform dependent, since it seems to require Tcl and Tk to be
3686 3696 built with threads (Fedora1/2 appears NOT to have it, but in
3687 3697 Prabhu's Debian boxes it works OK). But even with some Tk
3688 3698 limitations, this is a great improvement.
3689 3699
3690 3700 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3691 3701 info in user prompts. Patch by Prabhu.
3692 3702
3693 3703 2004-11-18 Fernando Perez <fperez@colorado.edu>
3694 3704
3695 3705 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3696 3706 EOFErrors and bail, to avoid infinite loops if a non-terminating
3697 3707 file is fed into ipython. Patch submitted in issue 19 by user,
3698 3708 many thanks.
3699 3709
3700 3710 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3701 3711 autoquote/parens in continuation prompts, which can cause lots of
3702 3712 problems. Closes roundup issue 20.
3703 3713
3704 3714 2004-11-17 Fernando Perez <fperez@colorado.edu>
3705 3715
3706 3716 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3707 3717 reported as debian bug #280505. I'm not sure my local changelog
3708 3718 entry has the proper debian format (Jack?).
3709 3719
3710 3720 2004-11-08 *** Released version 0.6.4
3711 3721
3712 3722 2004-11-08 Fernando Perez <fperez@colorado.edu>
3713 3723
3714 3724 * IPython/iplib.py (init_readline): Fix exit message for Windows
3715 3725 when readline is active. Thanks to a report by Eric Jones
3716 3726 <eric-AT-enthought.com>.
3717 3727
3718 3728 2004-11-07 Fernando Perez <fperez@colorado.edu>
3719 3729
3720 3730 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3721 3731 sometimes seen by win2k/cygwin users.
3722 3732
3723 3733 2004-11-06 Fernando Perez <fperez@colorado.edu>
3724 3734
3725 3735 * IPython/iplib.py (interact): Change the handling of %Exit from
3726 3736 trying to propagate a SystemExit to an internal ipython flag.
3727 3737 This is less elegant than using Python's exception mechanism, but
3728 3738 I can't get that to work reliably with threads, so under -pylab
3729 3739 %Exit was hanging IPython. Cross-thread exception handling is
3730 3740 really a bitch. Thaks to a bug report by Stephen Walton
3731 3741 <stephen.walton-AT-csun.edu>.
3732 3742
3733 3743 2004-11-04 Fernando Perez <fperez@colorado.edu>
3734 3744
3735 3745 * IPython/iplib.py (raw_input_original): store a pointer to the
3736 3746 true raw_input to harden against code which can modify it
3737 3747 (wx.py.PyShell does this and would otherwise crash ipython).
3738 3748 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3739 3749
3740 3750 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3741 3751 Ctrl-C problem, which does not mess up the input line.
3742 3752
3743 3753 2004-11-03 Fernando Perez <fperez@colorado.edu>
3744 3754
3745 3755 * IPython/Release.py: Changed licensing to BSD, in all files.
3746 3756 (name): lowercase name for tarball/RPM release.
3747 3757
3748 3758 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3749 3759 use throughout ipython.
3750 3760
3751 3761 * IPython/Magic.py (Magic._ofind): Switch to using the new
3752 3762 OInspect.getdoc() function.
3753 3763
3754 3764 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3755 3765 of the line currently being canceled via Ctrl-C. It's extremely
3756 3766 ugly, but I don't know how to do it better (the problem is one of
3757 3767 handling cross-thread exceptions).
3758 3768
3759 3769 2004-10-28 Fernando Perez <fperez@colorado.edu>
3760 3770
3761 3771 * IPython/Shell.py (signal_handler): add signal handlers to trap
3762 3772 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3763 3773 report by Francesc Alted.
3764 3774
3765 3775 2004-10-21 Fernando Perez <fperez@colorado.edu>
3766 3776
3767 3777 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3768 3778 to % for pysh syntax extensions.
3769 3779
3770 3780 2004-10-09 Fernando Perez <fperez@colorado.edu>
3771 3781
3772 3782 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3773 3783 arrays to print a more useful summary, without calling str(arr).
3774 3784 This avoids the problem of extremely lengthy computations which
3775 3785 occur if arr is large, and appear to the user as a system lockup
3776 3786 with 100% cpu activity. After a suggestion by Kristian Sandberg
3777 3787 <Kristian.Sandberg@colorado.edu>.
3778 3788 (Magic.__init__): fix bug in global magic escapes not being
3779 3789 correctly set.
3780 3790
3781 3791 2004-10-08 Fernando Perez <fperez@colorado.edu>
3782 3792
3783 3793 * IPython/Magic.py (__license__): change to absolute imports of
3784 3794 ipython's own internal packages, to start adapting to the absolute
3785 3795 import requirement of PEP-328.
3786 3796
3787 3797 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3788 3798 files, and standardize author/license marks through the Release
3789 3799 module instead of having per/file stuff (except for files with
3790 3800 particular licenses, like the MIT/PSF-licensed codes).
3791 3801
3792 3802 * IPython/Debugger.py: remove dead code for python 2.1
3793 3803
3794 3804 2004-10-04 Fernando Perez <fperez@colorado.edu>
3795 3805
3796 3806 * IPython/iplib.py (ipmagic): New function for accessing magics
3797 3807 via a normal python function call.
3798 3808
3799 3809 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3800 3810 from '@' to '%', to accomodate the new @decorator syntax of python
3801 3811 2.4.
3802 3812
3803 3813 2004-09-29 Fernando Perez <fperez@colorado.edu>
3804 3814
3805 3815 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3806 3816 matplotlib.use to prevent running scripts which try to switch
3807 3817 interactive backends from within ipython. This will just crash
3808 3818 the python interpreter, so we can't allow it (but a detailed error
3809 3819 is given to the user).
3810 3820
3811 3821 2004-09-28 Fernando Perez <fperez@colorado.edu>
3812 3822
3813 3823 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3814 3824 matplotlib-related fixes so that using @run with non-matplotlib
3815 3825 scripts doesn't pop up spurious plot windows. This requires
3816 3826 matplotlib >= 0.63, where I had to make some changes as well.
3817 3827
3818 3828 * IPython/ipmaker.py (make_IPython): update version requirement to
3819 3829 python 2.2.
3820 3830
3821 3831 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3822 3832 banner arg for embedded customization.
3823 3833
3824 3834 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3825 3835 explicit uses of __IP as the IPython's instance name. Now things
3826 3836 are properly handled via the shell.name value. The actual code
3827 3837 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3828 3838 is much better than before. I'll clean things completely when the
3829 3839 magic stuff gets a real overhaul.
3830 3840
3831 3841 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3832 3842 minor changes to debian dir.
3833 3843
3834 3844 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3835 3845 pointer to the shell itself in the interactive namespace even when
3836 3846 a user-supplied dict is provided. This is needed for embedding
3837 3847 purposes (found by tests with Michel Sanner).
3838 3848
3839 3849 2004-09-27 Fernando Perez <fperez@colorado.edu>
3840 3850
3841 3851 * IPython/UserConfig/ipythonrc: remove []{} from
3842 3852 readline_remove_delims, so that things like [modname.<TAB> do
3843 3853 proper completion. This disables [].TAB, but that's a less common
3844 3854 case than module names in list comprehensions, for example.
3845 3855 Thanks to a report by Andrea Riciputi.
3846 3856
3847 3857 2004-09-09 Fernando Perez <fperez@colorado.edu>
3848 3858
3849 3859 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3850 3860 blocking problems in win32 and osx. Fix by John.
3851 3861
3852 3862 2004-09-08 Fernando Perez <fperez@colorado.edu>
3853 3863
3854 3864 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3855 3865 for Win32 and OSX. Fix by John Hunter.
3856 3866
3857 3867 2004-08-30 *** Released version 0.6.3
3858 3868
3859 3869 2004-08-30 Fernando Perez <fperez@colorado.edu>
3860 3870
3861 3871 * setup.py (isfile): Add manpages to list of dependent files to be
3862 3872 updated.
3863 3873
3864 3874 2004-08-27 Fernando Perez <fperez@colorado.edu>
3865 3875
3866 3876 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3867 3877 for now. They don't really work with standalone WX/GTK code
3868 3878 (though matplotlib IS working fine with both of those backends).
3869 3879 This will neeed much more testing. I disabled most things with
3870 3880 comments, so turning it back on later should be pretty easy.
3871 3881
3872 3882 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3873 3883 autocalling of expressions like r'foo', by modifying the line
3874 3884 split regexp. Closes
3875 3885 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3876 3886 Riley <ipythonbugs-AT-sabi.net>.
3877 3887 (InteractiveShell.mainloop): honor --nobanner with banner
3878 3888 extensions.
3879 3889
3880 3890 * IPython/Shell.py: Significant refactoring of all classes, so
3881 3891 that we can really support ALL matplotlib backends and threading
3882 3892 models (John spotted a bug with Tk which required this). Now we
3883 3893 should support single-threaded, WX-threads and GTK-threads, both
3884 3894 for generic code and for matplotlib.
3885 3895
3886 3896 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3887 3897 -pylab, to simplify things for users. Will also remove the pylab
3888 3898 profile, since now all of matplotlib configuration is directly
3889 3899 handled here. This also reduces startup time.
3890 3900
3891 3901 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3892 3902 shell wasn't being correctly called. Also in IPShellWX.
3893 3903
3894 3904 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3895 3905 fine-tune banner.
3896 3906
3897 3907 * IPython/numutils.py (spike): Deprecate these spike functions,
3898 3908 delete (long deprecated) gnuplot_exec handler.
3899 3909
3900 3910 2004-08-26 Fernando Perez <fperez@colorado.edu>
3901 3911
3902 3912 * ipython.1: Update for threading options, plus some others which
3903 3913 were missing.
3904 3914
3905 3915 * IPython/ipmaker.py (__call__): Added -wthread option for
3906 3916 wxpython thread handling. Make sure threading options are only
3907 3917 valid at the command line.
3908 3918
3909 3919 * scripts/ipython: moved shell selection into a factory function
3910 3920 in Shell.py, to keep the starter script to a minimum.
3911 3921
3912 3922 2004-08-25 Fernando Perez <fperez@colorado.edu>
3913 3923
3914 3924 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3915 3925 John. Along with some recent changes he made to matplotlib, the
3916 3926 next versions of both systems should work very well together.
3917 3927
3918 3928 2004-08-24 Fernando Perez <fperez@colorado.edu>
3919 3929
3920 3930 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3921 3931 tried to switch the profiling to using hotshot, but I'm getting
3922 3932 strange errors from prof.runctx() there. I may be misreading the
3923 3933 docs, but it looks weird. For now the profiling code will
3924 3934 continue to use the standard profiler.
3925 3935
3926 3936 2004-08-23 Fernando Perez <fperez@colorado.edu>
3927 3937
3928 3938 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3929 3939 threaded shell, by John Hunter. It's not quite ready yet, but
3930 3940 close.
3931 3941
3932 3942 2004-08-22 Fernando Perez <fperez@colorado.edu>
3933 3943
3934 3944 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3935 3945 in Magic and ultraTB.
3936 3946
3937 3947 * ipython.1: document threading options in manpage.
3938 3948
3939 3949 * scripts/ipython: Changed name of -thread option to -gthread,
3940 3950 since this is GTK specific. I want to leave the door open for a
3941 3951 -wthread option for WX, which will most likely be necessary. This
3942 3952 change affects usage and ipmaker as well.
3943 3953
3944 3954 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3945 3955 handle the matplotlib shell issues. Code by John Hunter
3946 3956 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3947 3957 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3948 3958 broken (and disabled for end users) for now, but it puts the
3949 3959 infrastructure in place.
3950 3960
3951 3961 2004-08-21 Fernando Perez <fperez@colorado.edu>
3952 3962
3953 3963 * ipythonrc-pylab: Add matplotlib support.
3954 3964
3955 3965 * matplotlib_config.py: new files for matplotlib support, part of
3956 3966 the pylab profile.
3957 3967
3958 3968 * IPython/usage.py (__doc__): documented the threading options.
3959 3969
3960 3970 2004-08-20 Fernando Perez <fperez@colorado.edu>
3961 3971
3962 3972 * ipython: Modified the main calling routine to handle the -thread
3963 3973 and -mpthread options. This needs to be done as a top-level hack,
3964 3974 because it determines which class to instantiate for IPython
3965 3975 itself.
3966 3976
3967 3977 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3968 3978 classes to support multithreaded GTK operation without blocking,
3969 3979 and matplotlib with all backends. This is a lot of still very
3970 3980 experimental code, and threads are tricky. So it may still have a
3971 3981 few rough edges... This code owes a lot to
3972 3982 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3973 3983 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3974 3984 to John Hunter for all the matplotlib work.
3975 3985
3976 3986 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3977 3987 options for gtk thread and matplotlib support.
3978 3988
3979 3989 2004-08-16 Fernando Perez <fperez@colorado.edu>
3980 3990
3981 3991 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3982 3992 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3983 3993 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3984 3994
3985 3995 2004-08-11 Fernando Perez <fperez@colorado.edu>
3986 3996
3987 3997 * setup.py (isfile): Fix build so documentation gets updated for
3988 3998 rpms (it was only done for .tgz builds).
3989 3999
3990 4000 2004-08-10 Fernando Perez <fperez@colorado.edu>
3991 4001
3992 4002 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3993 4003
3994 4004 * iplib.py : Silence syntax error exceptions in tab-completion.
3995 4005
3996 4006 2004-08-05 Fernando Perez <fperez@colorado.edu>
3997 4007
3998 4008 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3999 4009 'color off' mark for continuation prompts. This was causing long
4000 4010 continuation lines to mis-wrap.
4001 4011
4002 4012 2004-08-01 Fernando Perez <fperez@colorado.edu>
4003 4013
4004 4014 * IPython/ipmaker.py (make_IPython): Allow the shell class used
4005 4015 for building ipython to be a parameter. All this is necessary
4006 4016 right now to have a multithreaded version, but this insane
4007 4017 non-design will be cleaned up soon. For now, it's a hack that
4008 4018 works.
4009 4019
4010 4020 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
4011 4021 args in various places. No bugs so far, but it's a dangerous
4012 4022 practice.
4013 4023
4014 4024 2004-07-31 Fernando Perez <fperez@colorado.edu>
4015 4025
4016 4026 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
4017 4027 fix completion of files with dots in their names under most
4018 4028 profiles (pysh was OK because the completion order is different).
4019 4029
4020 4030 2004-07-27 Fernando Perez <fperez@colorado.edu>
4021 4031
4022 4032 * IPython/iplib.py (InteractiveShell.__init__): build dict of
4023 4033 keywords manually, b/c the one in keyword.py was removed in python
4024 4034 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
4025 4035 This is NOT a bug under python 2.3 and earlier.
4026 4036
4027 4037 2004-07-26 Fernando Perez <fperez@colorado.edu>
4028 4038
4029 4039 * IPython/ultraTB.py (VerboseTB.text): Add another
4030 4040 linecache.checkcache() call to try to prevent inspect.py from
4031 4041 crashing under python 2.3. I think this fixes
4032 4042 http://www.scipy.net/roundup/ipython/issue17.
4033 4043
4034 4044 2004-07-26 *** Released version 0.6.2
4035 4045
4036 4046 2004-07-26 Fernando Perez <fperez@colorado.edu>
4037 4047
4038 4048 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4039 4049 fail for any number.
4040 4050 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4041 4051 empty bookmarks.
4042 4052
4043 4053 2004-07-26 *** Released version 0.6.1
4044 4054
4045 4055 2004-07-26 Fernando Perez <fperez@colorado.edu>
4046 4056
4047 4057 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4048 4058
4049 4059 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4050 4060 escaping '()[]{}' in filenames.
4051 4061
4052 4062 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4053 4063 Python 2.2 users who lack a proper shlex.split.
4054 4064
4055 4065 2004-07-19 Fernando Perez <fperez@colorado.edu>
4056 4066
4057 4067 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4058 4068 for reading readline's init file. I follow the normal chain:
4059 4069 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4060 4070 report by Mike Heeter. This closes
4061 4071 http://www.scipy.net/roundup/ipython/issue16.
4062 4072
4063 4073 2004-07-18 Fernando Perez <fperez@colorado.edu>
4064 4074
4065 4075 * IPython/iplib.py (__init__): Add better handling of '\' under
4066 4076 Win32 for filenames. After a patch by Ville.
4067 4077
4068 4078 2004-07-17 Fernando Perez <fperez@colorado.edu>
4069 4079
4070 4080 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4071 4081 autocalling would be triggered for 'foo is bar' if foo is
4072 4082 callable. I also cleaned up the autocall detection code to use a
4073 4083 regexp, which is faster. Bug reported by Alexander Schmolck.
4074 4084
4075 4085 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4076 4086 '?' in them would confuse the help system. Reported by Alex
4077 4087 Schmolck.
4078 4088
4079 4089 2004-07-16 Fernando Perez <fperez@colorado.edu>
4080 4090
4081 4091 * IPython/GnuplotInteractive.py (__all__): added plot2.
4082 4092
4083 4093 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4084 4094 plotting dictionaries, lists or tuples of 1d arrays.
4085 4095
4086 4096 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4087 4097 optimizations.
4088 4098
4089 4099 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4090 4100 the information which was there from Janko's original IPP code:
4091 4101
4092 4102 03.05.99 20:53 porto.ifm.uni-kiel.de
4093 4103 --Started changelog.
4094 4104 --make clear do what it say it does
4095 4105 --added pretty output of lines from inputcache
4096 4106 --Made Logger a mixin class, simplifies handling of switches
4097 4107 --Added own completer class. .string<TAB> expands to last history
4098 4108 line which starts with string. The new expansion is also present
4099 4109 with Ctrl-r from the readline library. But this shows, who this
4100 4110 can be done for other cases.
4101 4111 --Added convention that all shell functions should accept a
4102 4112 parameter_string This opens the door for different behaviour for
4103 4113 each function. @cd is a good example of this.
4104 4114
4105 4115 04.05.99 12:12 porto.ifm.uni-kiel.de
4106 4116 --added logfile rotation
4107 4117 --added new mainloop method which freezes first the namespace
4108 4118
4109 4119 07.05.99 21:24 porto.ifm.uni-kiel.de
4110 4120 --added the docreader classes. Now there is a help system.
4111 4121 -This is only a first try. Currently it's not easy to put new
4112 4122 stuff in the indices. But this is the way to go. Info would be
4113 4123 better, but HTML is every where and not everybody has an info
4114 4124 system installed and it's not so easy to change html-docs to info.
4115 4125 --added global logfile option
4116 4126 --there is now a hook for object inspection method pinfo needs to
4117 4127 be provided for this. Can be reached by two '??'.
4118 4128
4119 4129 08.05.99 20:51 porto.ifm.uni-kiel.de
4120 4130 --added a README
4121 4131 --bug in rc file. Something has changed so functions in the rc
4122 4132 file need to reference the shell and not self. Not clear if it's a
4123 4133 bug or feature.
4124 4134 --changed rc file for new behavior
4125 4135
4126 4136 2004-07-15 Fernando Perez <fperez@colorado.edu>
4127 4137
4128 4138 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4129 4139 cache was falling out of sync in bizarre manners when multi-line
4130 4140 input was present. Minor optimizations and cleanup.
4131 4141
4132 4142 (Logger): Remove old Changelog info for cleanup. This is the
4133 4143 information which was there from Janko's original code:
4134 4144
4135 4145 Changes to Logger: - made the default log filename a parameter
4136 4146
4137 4147 - put a check for lines beginning with !@? in log(). Needed
4138 4148 (even if the handlers properly log their lines) for mid-session
4139 4149 logging activation to work properly. Without this, lines logged
4140 4150 in mid session, which get read from the cache, would end up
4141 4151 'bare' (with !@? in the open) in the log. Now they are caught
4142 4152 and prepended with a #.
4143 4153
4144 4154 * IPython/iplib.py (InteractiveShell.init_readline): added check
4145 4155 in case MagicCompleter fails to be defined, so we don't crash.
4146 4156
4147 4157 2004-07-13 Fernando Perez <fperez@colorado.edu>
4148 4158
4149 4159 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4150 4160 of EPS if the requested filename ends in '.eps'.
4151 4161
4152 4162 2004-07-04 Fernando Perez <fperez@colorado.edu>
4153 4163
4154 4164 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4155 4165 escaping of quotes when calling the shell.
4156 4166
4157 4167 2004-07-02 Fernando Perez <fperez@colorado.edu>
4158 4168
4159 4169 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4160 4170 gettext not working because we were clobbering '_'. Fixes
4161 4171 http://www.scipy.net/roundup/ipython/issue6.
4162 4172
4163 4173 2004-07-01 Fernando Perez <fperez@colorado.edu>
4164 4174
4165 4175 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4166 4176 into @cd. Patch by Ville.
4167 4177
4168 4178 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4169 4179 new function to store things after ipmaker runs. Patch by Ville.
4170 4180 Eventually this will go away once ipmaker is removed and the class
4171 4181 gets cleaned up, but for now it's ok. Key functionality here is
4172 4182 the addition of the persistent storage mechanism, a dict for
4173 4183 keeping data across sessions (for now just bookmarks, but more can
4174 4184 be implemented later).
4175 4185
4176 4186 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4177 4187 persistent across sections. Patch by Ville, I modified it
4178 4188 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4179 4189 added a '-l' option to list all bookmarks.
4180 4190
4181 4191 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4182 4192 center for cleanup. Registered with atexit.register(). I moved
4183 4193 here the old exit_cleanup(). After a patch by Ville.
4184 4194
4185 4195 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4186 4196 characters in the hacked shlex_split for python 2.2.
4187 4197
4188 4198 * IPython/iplib.py (file_matches): more fixes to filenames with
4189 4199 whitespace in them. It's not perfect, but limitations in python's
4190 4200 readline make it impossible to go further.
4191 4201
4192 4202 2004-06-29 Fernando Perez <fperez@colorado.edu>
4193 4203
4194 4204 * IPython/iplib.py (file_matches): escape whitespace correctly in
4195 4205 filename completions. Bug reported by Ville.
4196 4206
4197 4207 2004-06-28 Fernando Perez <fperez@colorado.edu>
4198 4208
4199 4209 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4200 4210 the history file will be called 'history-PROFNAME' (or just
4201 4211 'history' if no profile is loaded). I was getting annoyed at
4202 4212 getting my Numerical work history clobbered by pysh sessions.
4203 4213
4204 4214 * IPython/iplib.py (InteractiveShell.__init__): Internal
4205 4215 getoutputerror() function so that we can honor the system_verbose
4206 4216 flag for _all_ system calls. I also added escaping of #
4207 4217 characters here to avoid confusing Itpl.
4208 4218
4209 4219 * IPython/Magic.py (shlex_split): removed call to shell in
4210 4220 parse_options and replaced it with shlex.split(). The annoying
4211 4221 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4212 4222 to backport it from 2.3, with several frail hacks (the shlex
4213 4223 module is rather limited in 2.2). Thanks to a suggestion by Ville
4214 4224 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4215 4225 problem.
4216 4226
4217 4227 (Magic.magic_system_verbose): new toggle to print the actual
4218 4228 system calls made by ipython. Mainly for debugging purposes.
4219 4229
4220 4230 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4221 4231 doesn't support persistence. Reported (and fix suggested) by
4222 4232 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4223 4233
4224 4234 2004-06-26 Fernando Perez <fperez@colorado.edu>
4225 4235
4226 4236 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4227 4237 continue prompts.
4228 4238
4229 4239 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4230 4240 function (basically a big docstring) and a few more things here to
4231 4241 speedup startup. pysh.py is now very lightweight. We want because
4232 4242 it gets execfile'd, while InterpreterExec gets imported, so
4233 4243 byte-compilation saves time.
4234 4244
4235 4245 2004-06-25 Fernando Perez <fperez@colorado.edu>
4236 4246
4237 4247 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4238 4248 -NUM', which was recently broken.
4239 4249
4240 4250 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4241 4251 in multi-line input (but not !!, which doesn't make sense there).
4242 4252
4243 4253 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4244 4254 It's just too useful, and people can turn it off in the less
4245 4255 common cases where it's a problem.
4246 4256
4247 4257 2004-06-24 Fernando Perez <fperez@colorado.edu>
4248 4258
4249 4259 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4250 4260 special syntaxes (like alias calling) is now allied in multi-line
4251 4261 input. This is still _very_ experimental, but it's necessary for
4252 4262 efficient shell usage combining python looping syntax with system
4253 4263 calls. For now it's restricted to aliases, I don't think it
4254 4264 really even makes sense to have this for magics.
4255 4265
4256 4266 2004-06-23 Fernando Perez <fperez@colorado.edu>
4257 4267
4258 4268 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4259 4269 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4260 4270
4261 4271 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4262 4272 extensions under Windows (after code sent by Gary Bishop). The
4263 4273 extensions considered 'executable' are stored in IPython's rc
4264 4274 structure as win_exec_ext.
4265 4275
4266 4276 * IPython/genutils.py (shell): new function, like system() but
4267 4277 without return value. Very useful for interactive shell work.
4268 4278
4269 4279 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4270 4280 delete aliases.
4271 4281
4272 4282 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4273 4283 sure that the alias table doesn't contain python keywords.
4274 4284
4275 4285 2004-06-21 Fernando Perez <fperez@colorado.edu>
4276 4286
4277 4287 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4278 4288 non-existent items are found in $PATH. Reported by Thorsten.
4279 4289
4280 4290 2004-06-20 Fernando Perez <fperez@colorado.edu>
4281 4291
4282 4292 * IPython/iplib.py (complete): modified the completer so that the
4283 4293 order of priorities can be easily changed at runtime.
4284 4294
4285 4295 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4286 4296 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4287 4297
4288 4298 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4289 4299 expand Python variables prepended with $ in all system calls. The
4290 4300 same was done to InteractiveShell.handle_shell_escape. Now all
4291 4301 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4292 4302 expansion of python variables and expressions according to the
4293 4303 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4294 4304
4295 4305 Though PEP-215 has been rejected, a similar (but simpler) one
4296 4306 seems like it will go into Python 2.4, PEP-292 -
4297 4307 http://www.python.org/peps/pep-0292.html.
4298 4308
4299 4309 I'll keep the full syntax of PEP-215, since IPython has since the
4300 4310 start used Ka-Ping Yee's reference implementation discussed there
4301 4311 (Itpl), and I actually like the powerful semantics it offers.
4302 4312
4303 4313 In order to access normal shell variables, the $ has to be escaped
4304 4314 via an extra $. For example:
4305 4315
4306 4316 In [7]: PATH='a python variable'
4307 4317
4308 4318 In [8]: !echo $PATH
4309 4319 a python variable
4310 4320
4311 4321 In [9]: !echo $$PATH
4312 4322 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4313 4323
4314 4324 (Magic.parse_options): escape $ so the shell doesn't evaluate
4315 4325 things prematurely.
4316 4326
4317 4327 * IPython/iplib.py (InteractiveShell.call_alias): added the
4318 4328 ability for aliases to expand python variables via $.
4319 4329
4320 4330 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4321 4331 system, now there's a @rehash/@rehashx pair of magics. These work
4322 4332 like the csh rehash command, and can be invoked at any time. They
4323 4333 build a table of aliases to everything in the user's $PATH
4324 4334 (@rehash uses everything, @rehashx is slower but only adds
4325 4335 executable files). With this, the pysh.py-based shell profile can
4326 4336 now simply call rehash upon startup, and full access to all
4327 4337 programs in the user's path is obtained.
4328 4338
4329 4339 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4330 4340 functionality is now fully in place. I removed the old dynamic
4331 4341 code generation based approach, in favor of a much lighter one
4332 4342 based on a simple dict. The advantage is that this allows me to
4333 4343 now have thousands of aliases with negligible cost (unthinkable
4334 4344 with the old system).
4335 4345
4336 4346 2004-06-19 Fernando Perez <fperez@colorado.edu>
4337 4347
4338 4348 * IPython/iplib.py (__init__): extended MagicCompleter class to
4339 4349 also complete (last in priority) on user aliases.
4340 4350
4341 4351 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4342 4352 call to eval.
4343 4353 (ItplNS.__init__): Added a new class which functions like Itpl,
4344 4354 but allows configuring the namespace for the evaluation to occur
4345 4355 in.
4346 4356
4347 4357 2004-06-18 Fernando Perez <fperez@colorado.edu>
4348 4358
4349 4359 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4350 4360 better message when 'exit' or 'quit' are typed (a common newbie
4351 4361 confusion).
4352 4362
4353 4363 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4354 4364 check for Windows users.
4355 4365
4356 4366 * IPython/iplib.py (InteractiveShell.user_setup): removed
4357 4367 disabling of colors for Windows. I'll test at runtime and issue a
4358 4368 warning if Gary's readline isn't found, as to nudge users to
4359 4369 download it.
4360 4370
4361 4371 2004-06-16 Fernando Perez <fperez@colorado.edu>
4362 4372
4363 4373 * IPython/genutils.py (Stream.__init__): changed to print errors
4364 4374 to sys.stderr. I had a circular dependency here. Now it's
4365 4375 possible to run ipython as IDLE's shell (consider this pre-alpha,
4366 4376 since true stdout things end up in the starting terminal instead
4367 4377 of IDLE's out).
4368 4378
4369 4379 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4370 4380 users who haven't # updated their prompt_in2 definitions. Remove
4371 4381 eventually.
4372 4382 (multiple_replace): added credit to original ASPN recipe.
4373 4383
4374 4384 2004-06-15 Fernando Perez <fperez@colorado.edu>
4375 4385
4376 4386 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4377 4387 list of auto-defined aliases.
4378 4388
4379 4389 2004-06-13 Fernando Perez <fperez@colorado.edu>
4380 4390
4381 4391 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4382 4392 install was really requested (so setup.py can be used for other
4383 4393 things under Windows).
4384 4394
4385 4395 2004-06-10 Fernando Perez <fperez@colorado.edu>
4386 4396
4387 4397 * IPython/Logger.py (Logger.create_log): Manually remove any old
4388 4398 backup, since os.remove may fail under Windows. Fixes bug
4389 4399 reported by Thorsten.
4390 4400
4391 4401 2004-06-09 Fernando Perez <fperez@colorado.edu>
4392 4402
4393 4403 * examples/example-embed.py: fixed all references to %n (replaced
4394 4404 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4395 4405 for all examples and the manual as well.
4396 4406
4397 4407 2004-06-08 Fernando Perez <fperez@colorado.edu>
4398 4408
4399 4409 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4400 4410 alignment and color management. All 3 prompt subsystems now
4401 4411 inherit from BasePrompt.
4402 4412
4403 4413 * tools/release: updates for windows installer build and tag rpms
4404 4414 with python version (since paths are fixed).
4405 4415
4406 4416 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4407 4417 which will become eventually obsolete. Also fixed the default
4408 4418 prompt_in2 to use \D, so at least new users start with the correct
4409 4419 defaults.
4410 4420 WARNING: Users with existing ipythonrc files will need to apply
4411 4421 this fix manually!
4412 4422
4413 4423 * setup.py: make windows installer (.exe). This is finally the
4414 4424 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4415 4425 which I hadn't included because it required Python 2.3 (or recent
4416 4426 distutils).
4417 4427
4418 4428 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4419 4429 usage of new '\D' escape.
4420 4430
4421 4431 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4422 4432 lacks os.getuid())
4423 4433 (CachedOutput.set_colors): Added the ability to turn coloring
4424 4434 on/off with @colors even for manually defined prompt colors. It
4425 4435 uses a nasty global, but it works safely and via the generic color
4426 4436 handling mechanism.
4427 4437 (Prompt2.__init__): Introduced new escape '\D' for continuation
4428 4438 prompts. It represents the counter ('\#') as dots.
4429 4439 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4430 4440 need to update their ipythonrc files and replace '%n' with '\D' in
4431 4441 their prompt_in2 settings everywhere. Sorry, but there's
4432 4442 otherwise no clean way to get all prompts to properly align. The
4433 4443 ipythonrc shipped with IPython has been updated.
4434 4444
4435 4445 2004-06-07 Fernando Perez <fperez@colorado.edu>
4436 4446
4437 4447 * setup.py (isfile): Pass local_icons option to latex2html, so the
4438 4448 resulting HTML file is self-contained. Thanks to
4439 4449 dryice-AT-liu.com.cn for the tip.
4440 4450
4441 4451 * pysh.py: I created a new profile 'shell', which implements a
4442 4452 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4443 4453 system shell, nor will it become one anytime soon. It's mainly
4444 4454 meant to illustrate the use of the new flexible bash-like prompts.
4445 4455 I guess it could be used by hardy souls for true shell management,
4446 4456 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4447 4457 profile. This uses the InterpreterExec extension provided by
4448 4458 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4449 4459
4450 4460 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4451 4461 auto-align itself with the length of the previous input prompt
4452 4462 (taking into account the invisible color escapes).
4453 4463 (CachedOutput.__init__): Large restructuring of this class. Now
4454 4464 all three prompts (primary1, primary2, output) are proper objects,
4455 4465 managed by the 'parent' CachedOutput class. The code is still a
4456 4466 bit hackish (all prompts share state via a pointer to the cache),
4457 4467 but it's overall far cleaner than before.
4458 4468
4459 4469 * IPython/genutils.py (getoutputerror): modified to add verbose,
4460 4470 debug and header options. This makes the interface of all getout*
4461 4471 functions uniform.
4462 4472 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4463 4473
4464 4474 * IPython/Magic.py (Magic.default_option): added a function to
4465 4475 allow registering default options for any magic command. This
4466 4476 makes it easy to have profiles which customize the magics globally
4467 4477 for a certain use. The values set through this function are
4468 4478 picked up by the parse_options() method, which all magics should
4469 4479 use to parse their options.
4470 4480
4471 4481 * IPython/genutils.py (warn): modified the warnings framework to
4472 4482 use the Term I/O class. I'm trying to slowly unify all of
4473 4483 IPython's I/O operations to pass through Term.
4474 4484
4475 4485 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4476 4486 the secondary prompt to correctly match the length of the primary
4477 4487 one for any prompt. Now multi-line code will properly line up
4478 4488 even for path dependent prompts, such as the new ones available
4479 4489 via the prompt_specials.
4480 4490
4481 4491 2004-06-06 Fernando Perez <fperez@colorado.edu>
4482 4492
4483 4493 * IPython/Prompts.py (prompt_specials): Added the ability to have
4484 4494 bash-like special sequences in the prompts, which get
4485 4495 automatically expanded. Things like hostname, current working
4486 4496 directory and username are implemented already, but it's easy to
4487 4497 add more in the future. Thanks to a patch by W.J. van der Laan
4488 4498 <gnufnork-AT-hetdigitalegat.nl>
4489 4499 (prompt_specials): Added color support for prompt strings, so
4490 4500 users can define arbitrary color setups for their prompts.
4491 4501
4492 4502 2004-06-05 Fernando Perez <fperez@colorado.edu>
4493 4503
4494 4504 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4495 4505 code to load Gary Bishop's readline and configure it
4496 4506 automatically. Thanks to Gary for help on this.
4497 4507
4498 4508 2004-06-01 Fernando Perez <fperez@colorado.edu>
4499 4509
4500 4510 * IPython/Logger.py (Logger.create_log): fix bug for logging
4501 4511 with no filename (previous fix was incomplete).
4502 4512
4503 4513 2004-05-25 Fernando Perez <fperez@colorado.edu>
4504 4514
4505 4515 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4506 4516 parens would get passed to the shell.
4507 4517
4508 4518 2004-05-20 Fernando Perez <fperez@colorado.edu>
4509 4519
4510 4520 * IPython/Magic.py (Magic.magic_prun): changed default profile
4511 4521 sort order to 'time' (the more common profiling need).
4512 4522
4513 4523 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4514 4524 so that source code shown is guaranteed in sync with the file on
4515 4525 disk (also changed in psource). Similar fix to the one for
4516 4526 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4517 4527 <yann.ledu-AT-noos.fr>.
4518 4528
4519 4529 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4520 4530 with a single option would not be correctly parsed. Closes
4521 4531 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4522 4532 introduced in 0.6.0 (on 2004-05-06).
4523 4533
4524 4534 2004-05-13 *** Released version 0.6.0
4525 4535
4526 4536 2004-05-13 Fernando Perez <fperez@colorado.edu>
4527 4537
4528 4538 * debian/: Added debian/ directory to CVS, so that debian support
4529 4539 is publicly accessible. The debian package is maintained by Jack
4530 4540 Moffit <jack-AT-xiph.org>.
4531 4541
4532 4542 * Documentation: included the notes about an ipython-based system
4533 4543 shell (the hypothetical 'pysh') into the new_design.pdf document,
4534 4544 so that these ideas get distributed to users along with the
4535 4545 official documentation.
4536 4546
4537 4547 2004-05-10 Fernando Perez <fperez@colorado.edu>
4538 4548
4539 4549 * IPython/Logger.py (Logger.create_log): fix recently introduced
4540 4550 bug (misindented line) where logstart would fail when not given an
4541 4551 explicit filename.
4542 4552
4543 4553 2004-05-09 Fernando Perez <fperez@colorado.edu>
4544 4554
4545 4555 * IPython/Magic.py (Magic.parse_options): skip system call when
4546 4556 there are no options to look for. Faster, cleaner for the common
4547 4557 case.
4548 4558
4549 4559 * Documentation: many updates to the manual: describing Windows
4550 4560 support better, Gnuplot updates, credits, misc small stuff. Also
4551 4561 updated the new_design doc a bit.
4552 4562
4553 4563 2004-05-06 *** Released version 0.6.0.rc1
4554 4564
4555 4565 2004-05-06 Fernando Perez <fperez@colorado.edu>
4556 4566
4557 4567 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4558 4568 operations to use the vastly more efficient list/''.join() method.
4559 4569 (FormattedTB.text): Fix
4560 4570 http://www.scipy.net/roundup/ipython/issue12 - exception source
4561 4571 extract not updated after reload. Thanks to Mike Salib
4562 4572 <msalib-AT-mit.edu> for pinning the source of the problem.
4563 4573 Fortunately, the solution works inside ipython and doesn't require
4564 4574 any changes to python proper.
4565 4575
4566 4576 * IPython/Magic.py (Magic.parse_options): Improved to process the
4567 4577 argument list as a true shell would (by actually using the
4568 4578 underlying system shell). This way, all @magics automatically get
4569 4579 shell expansion for variables. Thanks to a comment by Alex
4570 4580 Schmolck.
4571 4581
4572 4582 2004-04-04 Fernando Perez <fperez@colorado.edu>
4573 4583
4574 4584 * IPython/iplib.py (InteractiveShell.interact): Added a special
4575 4585 trap for a debugger quit exception, which is basically impossible
4576 4586 to handle by normal mechanisms, given what pdb does to the stack.
4577 4587 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4578 4588
4579 4589 2004-04-03 Fernando Perez <fperez@colorado.edu>
4580 4590
4581 4591 * IPython/genutils.py (Term): Standardized the names of the Term
4582 4592 class streams to cin/cout/cerr, following C++ naming conventions
4583 4593 (I can't use in/out/err because 'in' is not a valid attribute
4584 4594 name).
4585 4595
4586 4596 * IPython/iplib.py (InteractiveShell.interact): don't increment
4587 4597 the prompt if there's no user input. By Daniel 'Dang' Griffith
4588 4598 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4589 4599 Francois Pinard.
4590 4600
4591 4601 2004-04-02 Fernando Perez <fperez@colorado.edu>
4592 4602
4593 4603 * IPython/genutils.py (Stream.__init__): Modified to survive at
4594 4604 least importing in contexts where stdin/out/err aren't true file
4595 4605 objects, such as PyCrust (they lack fileno() and mode). However,
4596 4606 the recovery facilities which rely on these things existing will
4597 4607 not work.
4598 4608
4599 4609 2004-04-01 Fernando Perez <fperez@colorado.edu>
4600 4610
4601 4611 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4602 4612 use the new getoutputerror() function, so it properly
4603 4613 distinguishes stdout/err.
4604 4614
4605 4615 * IPython/genutils.py (getoutputerror): added a function to
4606 4616 capture separately the standard output and error of a command.
4607 4617 After a comment from dang on the mailing lists. This code is
4608 4618 basically a modified version of commands.getstatusoutput(), from
4609 4619 the standard library.
4610 4620
4611 4621 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4612 4622 '!!' as a special syntax (shorthand) to access @sx.
4613 4623
4614 4624 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4615 4625 command and return its output as a list split on '\n'.
4616 4626
4617 4627 2004-03-31 Fernando Perez <fperez@colorado.edu>
4618 4628
4619 4629 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4620 4630 method to dictionaries used as FakeModule instances if they lack
4621 4631 it. At least pydoc in python2.3 breaks for runtime-defined
4622 4632 functions without this hack. At some point I need to _really_
4623 4633 understand what FakeModule is doing, because it's a gross hack.
4624 4634 But it solves Arnd's problem for now...
4625 4635
4626 4636 2004-02-27 Fernando Perez <fperez@colorado.edu>
4627 4637
4628 4638 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4629 4639 mode would behave erratically. Also increased the number of
4630 4640 possible logs in rotate mod to 999. Thanks to Rod Holland
4631 4641 <rhh@StructureLABS.com> for the report and fixes.
4632 4642
4633 4643 2004-02-26 Fernando Perez <fperez@colorado.edu>
4634 4644
4635 4645 * IPython/genutils.py (page): Check that the curses module really
4636 4646 has the initscr attribute before trying to use it. For some
4637 4647 reason, the Solaris curses module is missing this. I think this
4638 4648 should be considered a Solaris python bug, but I'm not sure.
4639 4649
4640 4650 2004-01-17 Fernando Perez <fperez@colorado.edu>
4641 4651
4642 4652 * IPython/genutils.py (Stream.__init__): Changes to try to make
4643 4653 ipython robust against stdin/out/err being closed by the user.
4644 4654 This is 'user error' (and blocks a normal python session, at least
4645 4655 the stdout case). However, Ipython should be able to survive such
4646 4656 instances of abuse as gracefully as possible. To simplify the
4647 4657 coding and maintain compatibility with Gary Bishop's Term
4648 4658 contributions, I've made use of classmethods for this. I think
4649 4659 this introduces a dependency on python 2.2.
4650 4660
4651 4661 2004-01-13 Fernando Perez <fperez@colorado.edu>
4652 4662
4653 4663 * IPython/numutils.py (exp_safe): simplified the code a bit and
4654 4664 removed the need for importing the kinds module altogether.
4655 4665
4656 4666 2004-01-06 Fernando Perez <fperez@colorado.edu>
4657 4667
4658 4668 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4659 4669 a magic function instead, after some community feedback. No
4660 4670 special syntax will exist for it, but its name is deliberately
4661 4671 very short.
4662 4672
4663 4673 2003-12-20 Fernando Perez <fperez@colorado.edu>
4664 4674
4665 4675 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4666 4676 new functionality, to automagically assign the result of a shell
4667 4677 command to a variable. I'll solicit some community feedback on
4668 4678 this before making it permanent.
4669 4679
4670 4680 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4671 4681 requested about callables for which inspect couldn't obtain a
4672 4682 proper argspec. Thanks to a crash report sent by Etienne
4673 4683 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4674 4684
4675 4685 2003-12-09 Fernando Perez <fperez@colorado.edu>
4676 4686
4677 4687 * IPython/genutils.py (page): patch for the pager to work across
4678 4688 various versions of Windows. By Gary Bishop.
4679 4689
4680 4690 2003-12-04 Fernando Perez <fperez@colorado.edu>
4681 4691
4682 4692 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4683 4693 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4684 4694 While I tested this and it looks ok, there may still be corner
4685 4695 cases I've missed.
4686 4696
4687 4697 2003-12-01 Fernando Perez <fperez@colorado.edu>
4688 4698
4689 4699 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4690 4700 where a line like 'p,q=1,2' would fail because the automagic
4691 4701 system would be triggered for @p.
4692 4702
4693 4703 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4694 4704 cleanups, code unmodified.
4695 4705
4696 4706 * IPython/genutils.py (Term): added a class for IPython to handle
4697 4707 output. In most cases it will just be a proxy for stdout/err, but
4698 4708 having this allows modifications to be made for some platforms,
4699 4709 such as handling color escapes under Windows. All of this code
4700 4710 was contributed by Gary Bishop, with minor modifications by me.
4701 4711 The actual changes affect many files.
4702 4712
4703 4713 2003-11-30 Fernando Perez <fperez@colorado.edu>
4704 4714
4705 4715 * IPython/iplib.py (file_matches): new completion code, courtesy
4706 4716 of Jeff Collins. This enables filename completion again under
4707 4717 python 2.3, which disabled it at the C level.
4708 4718
4709 4719 2003-11-11 Fernando Perez <fperez@colorado.edu>
4710 4720
4711 4721 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4712 4722 for Numeric.array(map(...)), but often convenient.
4713 4723
4714 4724 2003-11-05 Fernando Perez <fperez@colorado.edu>
4715 4725
4716 4726 * IPython/numutils.py (frange): Changed a call from int() to
4717 4727 int(round()) to prevent a problem reported with arange() in the
4718 4728 numpy list.
4719 4729
4720 4730 2003-10-06 Fernando Perez <fperez@colorado.edu>
4721 4731
4722 4732 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4723 4733 prevent crashes if sys lacks an argv attribute (it happens with
4724 4734 embedded interpreters which build a bare-bones sys module).
4725 4735 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4726 4736
4727 4737 2003-09-24 Fernando Perez <fperez@colorado.edu>
4728 4738
4729 4739 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4730 4740 to protect against poorly written user objects where __getattr__
4731 4741 raises exceptions other than AttributeError. Thanks to a bug
4732 4742 report by Oliver Sander <osander-AT-gmx.de>.
4733 4743
4734 4744 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4735 4745 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4736 4746
4737 4747 2003-09-09 Fernando Perez <fperez@colorado.edu>
4738 4748
4739 4749 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4740 4750 unpacking a list whith a callable as first element would
4741 4751 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4742 4752 Collins.
4743 4753
4744 4754 2003-08-25 *** Released version 0.5.0
4745 4755
4746 4756 2003-08-22 Fernando Perez <fperez@colorado.edu>
4747 4757
4748 4758 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4749 4759 improperly defined user exceptions. Thanks to feedback from Mark
4750 4760 Russell <mrussell-AT-verio.net>.
4751 4761
4752 4762 2003-08-20 Fernando Perez <fperez@colorado.edu>
4753 4763
4754 4764 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4755 4765 printing so that it would print multi-line string forms starting
4756 4766 with a new line. This way the formatting is better respected for
4757 4767 objects which work hard to make nice string forms.
4758 4768
4759 4769 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4760 4770 autocall would overtake data access for objects with both
4761 4771 __getitem__ and __call__.
4762 4772
4763 4773 2003-08-19 *** Released version 0.5.0-rc1
4764 4774
4765 4775 2003-08-19 Fernando Perez <fperez@colorado.edu>
4766 4776
4767 4777 * IPython/deep_reload.py (load_tail): single tiny change here
4768 4778 seems to fix the long-standing bug of dreload() failing to work
4769 4779 for dotted names. But this module is pretty tricky, so I may have
4770 4780 missed some subtlety. Needs more testing!.
4771 4781
4772 4782 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4773 4783 exceptions which have badly implemented __str__ methods.
4774 4784 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4775 4785 which I've been getting reports about from Python 2.3 users. I
4776 4786 wish I had a simple test case to reproduce the problem, so I could
4777 4787 either write a cleaner workaround or file a bug report if
4778 4788 necessary.
4779 4789
4780 4790 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4781 4791 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4782 4792 a bug report by Tjabo Kloppenburg.
4783 4793
4784 4794 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4785 4795 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4786 4796 seems rather unstable. Thanks to a bug report by Tjabo
4787 4797 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4788 4798
4789 4799 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4790 4800 this out soon because of the critical fixes in the inner loop for
4791 4801 generators.
4792 4802
4793 4803 * IPython/Magic.py (Magic.getargspec): removed. This (and
4794 4804 _get_def) have been obsoleted by OInspect for a long time, I
4795 4805 hadn't noticed that they were dead code.
4796 4806 (Magic._ofind): restored _ofind functionality for a few literals
4797 4807 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4798 4808 for things like "hello".capitalize?, since that would require a
4799 4809 potentially dangerous eval() again.
4800 4810
4801 4811 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4802 4812 logic a bit more to clean up the escapes handling and minimize the
4803 4813 use of _ofind to only necessary cases. The interactive 'feel' of
4804 4814 IPython should have improved quite a bit with the changes in
4805 4815 _prefilter and _ofind (besides being far safer than before).
4806 4816
4807 4817 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4808 4818 obscure, never reported). Edit would fail to find the object to
4809 4819 edit under some circumstances.
4810 4820 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4811 4821 which were causing double-calling of generators. Those eval calls
4812 4822 were _very_ dangerous, since code with side effects could be
4813 4823 triggered. As they say, 'eval is evil'... These were the
4814 4824 nastiest evals in IPython. Besides, _ofind is now far simpler,
4815 4825 and it should also be quite a bit faster. Its use of inspect is
4816 4826 also safer, so perhaps some of the inspect-related crashes I've
4817 4827 seen lately with Python 2.3 might be taken care of. That will
4818 4828 need more testing.
4819 4829
4820 4830 2003-08-17 Fernando Perez <fperez@colorado.edu>
4821 4831
4822 4832 * IPython/iplib.py (InteractiveShell._prefilter): significant
4823 4833 simplifications to the logic for handling user escapes. Faster
4824 4834 and simpler code.
4825 4835
4826 4836 2003-08-14 Fernando Perez <fperez@colorado.edu>
4827 4837
4828 4838 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4829 4839 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4830 4840 but it should be quite a bit faster. And the recursive version
4831 4841 generated O(log N) intermediate storage for all rank>1 arrays,
4832 4842 even if they were contiguous.
4833 4843 (l1norm): Added this function.
4834 4844 (norm): Added this function for arbitrary norms (including
4835 4845 l-infinity). l1 and l2 are still special cases for convenience
4836 4846 and speed.
4837 4847
4838 4848 2003-08-03 Fernando Perez <fperez@colorado.edu>
4839 4849
4840 4850 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4841 4851 exceptions, which now raise PendingDeprecationWarnings in Python
4842 4852 2.3. There were some in Magic and some in Gnuplot2.
4843 4853
4844 4854 2003-06-30 Fernando Perez <fperez@colorado.edu>
4845 4855
4846 4856 * IPython/genutils.py (page): modified to call curses only for
4847 4857 terminals where TERM=='xterm'. After problems under many other
4848 4858 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4849 4859
4850 4860 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4851 4861 would be triggered when readline was absent. This was just an old
4852 4862 debugging statement I'd forgotten to take out.
4853 4863
4854 4864 2003-06-20 Fernando Perez <fperez@colorado.edu>
4855 4865
4856 4866 * IPython/genutils.py (clock): modified to return only user time
4857 4867 (not counting system time), after a discussion on scipy. While
4858 4868 system time may be a useful quantity occasionally, it may much
4859 4869 more easily be skewed by occasional swapping or other similar
4860 4870 activity.
4861 4871
4862 4872 2003-06-05 Fernando Perez <fperez@colorado.edu>
4863 4873
4864 4874 * IPython/numutils.py (identity): new function, for building
4865 4875 arbitrary rank Kronecker deltas (mostly backwards compatible with
4866 4876 Numeric.identity)
4867 4877
4868 4878 2003-06-03 Fernando Perez <fperez@colorado.edu>
4869 4879
4870 4880 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4871 4881 arguments passed to magics with spaces, to allow trailing '\' to
4872 4882 work normally (mainly for Windows users).
4873 4883
4874 4884 2003-05-29 Fernando Perez <fperez@colorado.edu>
4875 4885
4876 4886 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4877 4887 instead of pydoc.help. This fixes a bizarre behavior where
4878 4888 printing '%s' % locals() would trigger the help system. Now
4879 4889 ipython behaves like normal python does.
4880 4890
4881 4891 Note that if one does 'from pydoc import help', the bizarre
4882 4892 behavior returns, but this will also happen in normal python, so
4883 4893 it's not an ipython bug anymore (it has to do with how pydoc.help
4884 4894 is implemented).
4885 4895
4886 4896 2003-05-22 Fernando Perez <fperez@colorado.edu>
4887 4897
4888 4898 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4889 4899 return [] instead of None when nothing matches, also match to end
4890 4900 of line. Patch by Gary Bishop.
4891 4901
4892 4902 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4893 4903 protection as before, for files passed on the command line. This
4894 4904 prevents the CrashHandler from kicking in if user files call into
4895 4905 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4896 4906 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4897 4907
4898 4908 2003-05-20 *** Released version 0.4.0
4899 4909
4900 4910 2003-05-20 Fernando Perez <fperez@colorado.edu>
4901 4911
4902 4912 * setup.py: added support for manpages. It's a bit hackish b/c of
4903 4913 a bug in the way the bdist_rpm distutils target handles gzipped
4904 4914 manpages, but it works. After a patch by Jack.
4905 4915
4906 4916 2003-05-19 Fernando Perez <fperez@colorado.edu>
4907 4917
4908 4918 * IPython/numutils.py: added a mockup of the kinds module, since
4909 4919 it was recently removed from Numeric. This way, numutils will
4910 4920 work for all users even if they are missing kinds.
4911 4921
4912 4922 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4913 4923 failure, which can occur with SWIG-wrapped extensions. After a
4914 4924 crash report from Prabhu.
4915 4925
4916 4926 2003-05-16 Fernando Perez <fperez@colorado.edu>
4917 4927
4918 4928 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4919 4929 protect ipython from user code which may call directly
4920 4930 sys.excepthook (this looks like an ipython crash to the user, even
4921 4931 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4922 4932 This is especially important to help users of WxWindows, but may
4923 4933 also be useful in other cases.
4924 4934
4925 4935 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4926 4936 an optional tb_offset to be specified, and to preserve exception
4927 4937 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4928 4938
4929 4939 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4930 4940
4931 4941 2003-05-15 Fernando Perez <fperez@colorado.edu>
4932 4942
4933 4943 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4934 4944 installing for a new user under Windows.
4935 4945
4936 4946 2003-05-12 Fernando Perez <fperez@colorado.edu>
4937 4947
4938 4948 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4939 4949 handler for Emacs comint-based lines. Currently it doesn't do
4940 4950 much (but importantly, it doesn't update the history cache). In
4941 4951 the future it may be expanded if Alex needs more functionality
4942 4952 there.
4943 4953
4944 4954 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4945 4955 info to crash reports.
4946 4956
4947 4957 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4948 4958 just like Python's -c. Also fixed crash with invalid -color
4949 4959 option value at startup. Thanks to Will French
4950 4960 <wfrench-AT-bestweb.net> for the bug report.
4951 4961
4952 4962 2003-05-09 Fernando Perez <fperez@colorado.edu>
4953 4963
4954 4964 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4955 4965 to EvalDict (it's a mapping, after all) and simplified its code
4956 4966 quite a bit, after a nice discussion on c.l.py where Gustavo
4957 4967 Córdova <gcordova-AT-sismex.com> suggested the new version.
4958 4968
4959 4969 2003-04-30 Fernando Perez <fperez@colorado.edu>
4960 4970
4961 4971 * IPython/genutils.py (timings_out): modified it to reduce its
4962 4972 overhead in the common reps==1 case.
4963 4973
4964 4974 2003-04-29 Fernando Perez <fperez@colorado.edu>
4965 4975
4966 4976 * IPython/genutils.py (timings_out): Modified to use the resource
4967 4977 module, which avoids the wraparound problems of time.clock().
4968 4978
4969 4979 2003-04-17 *** Released version 0.2.15pre4
4970 4980
4971 4981 2003-04-17 Fernando Perez <fperez@colorado.edu>
4972 4982
4973 4983 * setup.py (scriptfiles): Split windows-specific stuff over to a
4974 4984 separate file, in an attempt to have a Windows GUI installer.
4975 4985 That didn't work, but part of the groundwork is done.
4976 4986
4977 4987 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4978 4988 indent/unindent with 4 spaces. Particularly useful in combination
4979 4989 with the new auto-indent option.
4980 4990
4981 4991 2003-04-16 Fernando Perez <fperez@colorado.edu>
4982 4992
4983 4993 * IPython/Magic.py: various replacements of self.rc for
4984 4994 self.shell.rc. A lot more remains to be done to fully disentangle
4985 4995 this class from the main Shell class.
4986 4996
4987 4997 * IPython/GnuplotRuntime.py: added checks for mouse support so
4988 4998 that we don't try to enable it if the current gnuplot doesn't
4989 4999 really support it. Also added checks so that we don't try to
4990 5000 enable persist under Windows (where Gnuplot doesn't recognize the
4991 5001 option).
4992 5002
4993 5003 * IPython/iplib.py (InteractiveShell.interact): Added optional
4994 5004 auto-indenting code, after a patch by King C. Shu
4995 5005 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4996 5006 get along well with pasting indented code. If I ever figure out
4997 5007 how to make that part go well, it will become on by default.
4998 5008
4999 5009 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
5000 5010 crash ipython if there was an unmatched '%' in the user's prompt
5001 5011 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5002 5012
5003 5013 * IPython/iplib.py (InteractiveShell.interact): removed the
5004 5014 ability to ask the user whether he wants to crash or not at the
5005 5015 'last line' exception handler. Calling functions at that point
5006 5016 changes the stack, and the error reports would have incorrect
5007 5017 tracebacks.
5008 5018
5009 5019 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
5010 5020 pass through a peger a pretty-printed form of any object. After a
5011 5021 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
5012 5022
5013 5023 2003-04-14 Fernando Perez <fperez@colorado.edu>
5014 5024
5015 5025 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
5016 5026 all files in ~ would be modified at first install (instead of
5017 5027 ~/.ipython). This could be potentially disastrous, as the
5018 5028 modification (make line-endings native) could damage binary files.
5019 5029
5020 5030 2003-04-10 Fernando Perez <fperez@colorado.edu>
5021 5031
5022 5032 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
5023 5033 handle only lines which are invalid python. This now means that
5024 5034 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
5025 5035 for the bug report.
5026 5036
5027 5037 2003-04-01 Fernando Perez <fperez@colorado.edu>
5028 5038
5029 5039 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
5030 5040 where failing to set sys.last_traceback would crash pdb.pm().
5031 5041 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
5032 5042 report.
5033 5043
5034 5044 2003-03-25 Fernando Perez <fperez@colorado.edu>
5035 5045
5036 5046 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
5037 5047 before printing it (it had a lot of spurious blank lines at the
5038 5048 end).
5039 5049
5040 5050 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5041 5051 output would be sent 21 times! Obviously people don't use this
5042 5052 too often, or I would have heard about it.
5043 5053
5044 5054 2003-03-24 Fernando Perez <fperez@colorado.edu>
5045 5055
5046 5056 * setup.py (scriptfiles): renamed the data_files parameter from
5047 5057 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5048 5058 for the patch.
5049 5059
5050 5060 2003-03-20 Fernando Perez <fperez@colorado.edu>
5051 5061
5052 5062 * IPython/genutils.py (error): added error() and fatal()
5053 5063 functions.
5054 5064
5055 5065 2003-03-18 *** Released version 0.2.15pre3
5056 5066
5057 5067 2003-03-18 Fernando Perez <fperez@colorado.edu>
5058 5068
5059 5069 * setupext/install_data_ext.py
5060 5070 (install_data_ext.initialize_options): Class contributed by Jack
5061 5071 Moffit for fixing the old distutils hack. He is sending this to
5062 5072 the distutils folks so in the future we may not need it as a
5063 5073 private fix.
5064 5074
5065 5075 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5066 5076 changes for Debian packaging. See his patch for full details.
5067 5077 The old distutils hack of making the ipythonrc* files carry a
5068 5078 bogus .py extension is gone, at last. Examples were moved to a
5069 5079 separate subdir under doc/, and the separate executable scripts
5070 5080 now live in their own directory. Overall a great cleanup. The
5071 5081 manual was updated to use the new files, and setup.py has been
5072 5082 fixed for this setup.
5073 5083
5074 5084 * IPython/PyColorize.py (Parser.usage): made non-executable and
5075 5085 created a pycolor wrapper around it to be included as a script.
5076 5086
5077 5087 2003-03-12 *** Released version 0.2.15pre2
5078 5088
5079 5089 2003-03-12 Fernando Perez <fperez@colorado.edu>
5080 5090
5081 5091 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5082 5092 long-standing problem with garbage characters in some terminals.
5083 5093 The issue was really that the \001 and \002 escapes must _only_ be
5084 5094 passed to input prompts (which call readline), but _never_ to
5085 5095 normal text to be printed on screen. I changed ColorANSI to have
5086 5096 two classes: TermColors and InputTermColors, each with the
5087 5097 appropriate escapes for input prompts or normal text. The code in
5088 5098 Prompts.py got slightly more complicated, but this very old and
5089 5099 annoying bug is finally fixed.
5090 5100
5091 5101 All the credit for nailing down the real origin of this problem
5092 5102 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5093 5103 *Many* thanks to him for spending quite a bit of effort on this.
5094 5104
5095 5105 2003-03-05 *** Released version 0.2.15pre1
5096 5106
5097 5107 2003-03-03 Fernando Perez <fperez@colorado.edu>
5098 5108
5099 5109 * IPython/FakeModule.py: Moved the former _FakeModule to a
5100 5110 separate file, because it's also needed by Magic (to fix a similar
5101 5111 pickle-related issue in @run).
5102 5112
5103 5113 2003-03-02 Fernando Perez <fperez@colorado.edu>
5104 5114
5105 5115 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5106 5116 the autocall option at runtime.
5107 5117 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5108 5118 across Magic.py to start separating Magic from InteractiveShell.
5109 5119 (Magic._ofind): Fixed to return proper namespace for dotted
5110 5120 names. Before, a dotted name would always return 'not currently
5111 5121 defined', because it would find the 'parent'. s.x would be found,
5112 5122 but since 'x' isn't defined by itself, it would get confused.
5113 5123 (Magic.magic_run): Fixed pickling problems reported by Ralf
5114 5124 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5115 5125 that I'd used when Mike Heeter reported similar issues at the
5116 5126 top-level, but now for @run. It boils down to injecting the
5117 5127 namespace where code is being executed with something that looks
5118 5128 enough like a module to fool pickle.dump(). Since a pickle stores
5119 5129 a named reference to the importing module, we need this for
5120 5130 pickles to save something sensible.
5121 5131
5122 5132 * IPython/ipmaker.py (make_IPython): added an autocall option.
5123 5133
5124 5134 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5125 5135 the auto-eval code. Now autocalling is an option, and the code is
5126 5136 also vastly safer. There is no more eval() involved at all.
5127 5137
5128 5138 2003-03-01 Fernando Perez <fperez@colorado.edu>
5129 5139
5130 5140 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5131 5141 dict with named keys instead of a tuple.
5132 5142
5133 5143 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5134 5144
5135 5145 * setup.py (make_shortcut): Fixed message about directories
5136 5146 created during Windows installation (the directories were ok, just
5137 5147 the printed message was misleading). Thanks to Chris Liechti
5138 5148 <cliechti-AT-gmx.net> for the heads up.
5139 5149
5140 5150 2003-02-21 Fernando Perez <fperez@colorado.edu>
5141 5151
5142 5152 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5143 5153 of ValueError exception when checking for auto-execution. This
5144 5154 one is raised by things like Numeric arrays arr.flat when the
5145 5155 array is non-contiguous.
5146 5156
5147 5157 2003-01-31 Fernando Perez <fperez@colorado.edu>
5148 5158
5149 5159 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5150 5160 not return any value at all (even though the command would get
5151 5161 executed).
5152 5162 (xsys): Flush stdout right after printing the command to ensure
5153 5163 proper ordering of commands and command output in the total
5154 5164 output.
5155 5165 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5156 5166 system/getoutput as defaults. The old ones are kept for
5157 5167 compatibility reasons, so no code which uses this library needs
5158 5168 changing.
5159 5169
5160 5170 2003-01-27 *** Released version 0.2.14
5161 5171
5162 5172 2003-01-25 Fernando Perez <fperez@colorado.edu>
5163 5173
5164 5174 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5165 5175 functions defined in previous edit sessions could not be re-edited
5166 5176 (because the temp files were immediately removed). Now temp files
5167 5177 are removed only at IPython's exit.
5168 5178 (Magic.magic_run): Improved @run to perform shell-like expansions
5169 5179 on its arguments (~users and $VARS). With this, @run becomes more
5170 5180 like a normal command-line.
5171 5181
5172 5182 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5173 5183 bugs related to embedding and cleaned up that code. A fairly
5174 5184 important one was the impossibility to access the global namespace
5175 5185 through the embedded IPython (only local variables were visible).
5176 5186
5177 5187 2003-01-14 Fernando Perez <fperez@colorado.edu>
5178 5188
5179 5189 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5180 5190 auto-calling to be a bit more conservative. Now it doesn't get
5181 5191 triggered if any of '!=()<>' are in the rest of the input line, to
5182 5192 allow comparing callables. Thanks to Alex for the heads up.
5183 5193
5184 5194 2003-01-07 Fernando Perez <fperez@colorado.edu>
5185 5195
5186 5196 * IPython/genutils.py (page): fixed estimation of the number of
5187 5197 lines in a string to be paged to simply count newlines. This
5188 5198 prevents over-guessing due to embedded escape sequences. A better
5189 5199 long-term solution would involve stripping out the control chars
5190 5200 for the count, but it's potentially so expensive I just don't
5191 5201 think it's worth doing.
5192 5202
5193 5203 2002-12-19 *** Released version 0.2.14pre50
5194 5204
5195 5205 2002-12-19 Fernando Perez <fperez@colorado.edu>
5196 5206
5197 5207 * tools/release (version): Changed release scripts to inform
5198 5208 Andrea and build a NEWS file with a list of recent changes.
5199 5209
5200 5210 * IPython/ColorANSI.py (__all__): changed terminal detection
5201 5211 code. Seems to work better for xterms without breaking
5202 5212 konsole. Will need more testing to determine if WinXP and Mac OSX
5203 5213 also work ok.
5204 5214
5205 5215 2002-12-18 *** Released version 0.2.14pre49
5206 5216
5207 5217 2002-12-18 Fernando Perez <fperez@colorado.edu>
5208 5218
5209 5219 * Docs: added new info about Mac OSX, from Andrea.
5210 5220
5211 5221 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5212 5222 allow direct plotting of python strings whose format is the same
5213 5223 of gnuplot data files.
5214 5224
5215 5225 2002-12-16 Fernando Perez <fperez@colorado.edu>
5216 5226
5217 5227 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5218 5228 value of exit question to be acknowledged.
5219 5229
5220 5230 2002-12-03 Fernando Perez <fperez@colorado.edu>
5221 5231
5222 5232 * IPython/ipmaker.py: removed generators, which had been added
5223 5233 by mistake in an earlier debugging run. This was causing trouble
5224 5234 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5225 5235 for pointing this out.
5226 5236
5227 5237 2002-11-17 Fernando Perez <fperez@colorado.edu>
5228 5238
5229 5239 * Manual: updated the Gnuplot section.
5230 5240
5231 5241 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5232 5242 a much better split of what goes in Runtime and what goes in
5233 5243 Interactive.
5234 5244
5235 5245 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5236 5246 being imported from iplib.
5237 5247
5238 5248 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5239 5249 for command-passing. Now the global Gnuplot instance is called
5240 5250 'gp' instead of 'g', which was really a far too fragile and
5241 5251 common name.
5242 5252
5243 5253 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5244 5254 bounding boxes generated by Gnuplot for square plots.
5245 5255
5246 5256 * IPython/genutils.py (popkey): new function added. I should
5247 5257 suggest this on c.l.py as a dict method, it seems useful.
5248 5258
5249 5259 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5250 5260 to transparently handle PostScript generation. MUCH better than
5251 5261 the previous plot_eps/replot_eps (which I removed now). The code
5252 5262 is also fairly clean and well documented now (including
5253 5263 docstrings).
5254 5264
5255 5265 2002-11-13 Fernando Perez <fperez@colorado.edu>
5256 5266
5257 5267 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5258 5268 (inconsistent with options).
5259 5269
5260 5270 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5261 5271 manually disabled, I don't know why. Fixed it.
5262 5272 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5263 5273 eps output.
5264 5274
5265 5275 2002-11-12 Fernando Perez <fperez@colorado.edu>
5266 5276
5267 5277 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5268 5278 don't propagate up to caller. Fixes crash reported by François
5269 5279 Pinard.
5270 5280
5271 5281 2002-11-09 Fernando Perez <fperez@colorado.edu>
5272 5282
5273 5283 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5274 5284 history file for new users.
5275 5285 (make_IPython): fixed bug where initial install would leave the
5276 5286 user running in the .ipython dir.
5277 5287 (make_IPython): fixed bug where config dir .ipython would be
5278 5288 created regardless of the given -ipythondir option. Thanks to Cory
5279 5289 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5280 5290
5281 5291 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5282 5292 type confirmations. Will need to use it in all of IPython's code
5283 5293 consistently.
5284 5294
5285 5295 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5286 5296 context to print 31 lines instead of the default 5. This will make
5287 5297 the crash reports extremely detailed in case the problem is in
5288 5298 libraries I don't have access to.
5289 5299
5290 5300 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5291 5301 line of defense' code to still crash, but giving users fair
5292 5302 warning. I don't want internal errors to go unreported: if there's
5293 5303 an internal problem, IPython should crash and generate a full
5294 5304 report.
5295 5305
5296 5306 2002-11-08 Fernando Perez <fperez@colorado.edu>
5297 5307
5298 5308 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5299 5309 otherwise uncaught exceptions which can appear if people set
5300 5310 sys.stdout to something badly broken. Thanks to a crash report
5301 5311 from henni-AT-mail.brainbot.com.
5302 5312
5303 5313 2002-11-04 Fernando Perez <fperez@colorado.edu>
5304 5314
5305 5315 * IPython/iplib.py (InteractiveShell.interact): added
5306 5316 __IPYTHON__active to the builtins. It's a flag which goes on when
5307 5317 the interaction starts and goes off again when it stops. This
5308 5318 allows embedding code to detect being inside IPython. Before this
5309 5319 was done via __IPYTHON__, but that only shows that an IPython
5310 5320 instance has been created.
5311 5321
5312 5322 * IPython/Magic.py (Magic.magic_env): I realized that in a
5313 5323 UserDict, instance.data holds the data as a normal dict. So I
5314 5324 modified @env to return os.environ.data instead of rebuilding a
5315 5325 dict by hand.
5316 5326
5317 5327 2002-11-02 Fernando Perez <fperez@colorado.edu>
5318 5328
5319 5329 * IPython/genutils.py (warn): changed so that level 1 prints no
5320 5330 header. Level 2 is now the default (with 'WARNING' header, as
5321 5331 before). I think I tracked all places where changes were needed in
5322 5332 IPython, but outside code using the old level numbering may have
5323 5333 broken.
5324 5334
5325 5335 * IPython/iplib.py (InteractiveShell.runcode): added this to
5326 5336 handle the tracebacks in SystemExit traps correctly. The previous
5327 5337 code (through interact) was printing more of the stack than
5328 5338 necessary, showing IPython internal code to the user.
5329 5339
5330 5340 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5331 5341 default. Now that the default at the confirmation prompt is yes,
5332 5342 it's not so intrusive. François' argument that ipython sessions
5333 5343 tend to be complex enough not to lose them from an accidental C-d,
5334 5344 is a valid one.
5335 5345
5336 5346 * IPython/iplib.py (InteractiveShell.interact): added a
5337 5347 showtraceback() call to the SystemExit trap, and modified the exit
5338 5348 confirmation to have yes as the default.
5339 5349
5340 5350 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5341 5351 this file. It's been gone from the code for a long time, this was
5342 5352 simply leftover junk.
5343 5353
5344 5354 2002-11-01 Fernando Perez <fperez@colorado.edu>
5345 5355
5346 5356 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5347 5357 added. If set, IPython now traps EOF and asks for
5348 5358 confirmation. After a request by François Pinard.
5349 5359
5350 5360 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5351 5361 of @abort, and with a new (better) mechanism for handling the
5352 5362 exceptions.
5353 5363
5354 5364 2002-10-27 Fernando Perez <fperez@colorado.edu>
5355 5365
5356 5366 * IPython/usage.py (__doc__): updated the --help information and
5357 5367 the ipythonrc file to indicate that -log generates
5358 5368 ./ipython.log. Also fixed the corresponding info in @logstart.
5359 5369 This and several other fixes in the manuals thanks to reports by
5360 5370 François Pinard <pinard-AT-iro.umontreal.ca>.
5361 5371
5362 5372 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5363 5373 refer to @logstart (instead of @log, which doesn't exist).
5364 5374
5365 5375 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5366 5376 AttributeError crash. Thanks to Christopher Armstrong
5367 5377 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5368 5378 introduced recently (in 0.2.14pre37) with the fix to the eval
5369 5379 problem mentioned below.
5370 5380
5371 5381 2002-10-17 Fernando Perez <fperez@colorado.edu>
5372 5382
5373 5383 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5374 5384 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5375 5385
5376 5386 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5377 5387 this function to fix a problem reported by Alex Schmolck. He saw
5378 5388 it with list comprehensions and generators, which were getting
5379 5389 called twice. The real problem was an 'eval' call in testing for
5380 5390 automagic which was evaluating the input line silently.
5381 5391
5382 5392 This is a potentially very nasty bug, if the input has side
5383 5393 effects which must not be repeated. The code is much cleaner now,
5384 5394 without any blanket 'except' left and with a regexp test for
5385 5395 actual function names.
5386 5396
5387 5397 But an eval remains, which I'm not fully comfortable with. I just
5388 5398 don't know how to find out if an expression could be a callable in
5389 5399 the user's namespace without doing an eval on the string. However
5390 5400 that string is now much more strictly checked so that no code
5391 5401 slips by, so the eval should only happen for things that can
5392 5402 really be only function/method names.
5393 5403
5394 5404 2002-10-15 Fernando Perez <fperez@colorado.edu>
5395 5405
5396 5406 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5397 5407 OSX information to main manual, removed README_Mac_OSX file from
5398 5408 distribution. Also updated credits for recent additions.
5399 5409
5400 5410 2002-10-10 Fernando Perez <fperez@colorado.edu>
5401 5411
5402 5412 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5403 5413 terminal-related issues. Many thanks to Andrea Riciputi
5404 5414 <andrea.riciputi-AT-libero.it> for writing it.
5405 5415
5406 5416 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5407 5417 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5408 5418
5409 5419 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5410 5420 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5411 5421 <syver-en-AT-online.no> who both submitted patches for this problem.
5412 5422
5413 5423 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5414 5424 global embedding to make sure that things don't overwrite user
5415 5425 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5416 5426
5417 5427 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5418 5428 compatibility. Thanks to Hayden Callow
5419 5429 <h.callow-AT-elec.canterbury.ac.nz>
5420 5430
5421 5431 2002-10-04 Fernando Perez <fperez@colorado.edu>
5422 5432
5423 5433 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5424 5434 Gnuplot.File objects.
5425 5435
5426 5436 2002-07-23 Fernando Perez <fperez@colorado.edu>
5427 5437
5428 5438 * IPython/genutils.py (timing): Added timings() and timing() for
5429 5439 quick access to the most commonly needed data, the execution
5430 5440 times. Old timing() renamed to timings_out().
5431 5441
5432 5442 2002-07-18 Fernando Perez <fperez@colorado.edu>
5433 5443
5434 5444 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5435 5445 bug with nested instances disrupting the parent's tab completion.
5436 5446
5437 5447 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5438 5448 all_completions code to begin the emacs integration.
5439 5449
5440 5450 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5441 5451 argument to allow titling individual arrays when plotting.
5442 5452
5443 5453 2002-07-15 Fernando Perez <fperez@colorado.edu>
5444 5454
5445 5455 * setup.py (make_shortcut): changed to retrieve the value of
5446 5456 'Program Files' directory from the registry (this value changes in
5447 5457 non-english versions of Windows). Thanks to Thomas Fanslau
5448 5458 <tfanslau-AT-gmx.de> for the report.
5449 5459
5450 5460 2002-07-10 Fernando Perez <fperez@colorado.edu>
5451 5461
5452 5462 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5453 5463 a bug in pdb, which crashes if a line with only whitespace is
5454 5464 entered. Bug report submitted to sourceforge.
5455 5465
5456 5466 2002-07-09 Fernando Perez <fperez@colorado.edu>
5457 5467
5458 5468 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5459 5469 reporting exceptions (it's a bug in inspect.py, I just set a
5460 5470 workaround).
5461 5471
5462 5472 2002-07-08 Fernando Perez <fperez@colorado.edu>
5463 5473
5464 5474 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5465 5475 __IPYTHON__ in __builtins__ to show up in user_ns.
5466 5476
5467 5477 2002-07-03 Fernando Perez <fperez@colorado.edu>
5468 5478
5469 5479 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5470 5480 name from @gp_set_instance to @gp_set_default.
5471 5481
5472 5482 * IPython/ipmaker.py (make_IPython): default editor value set to
5473 5483 '0' (a string), to match the rc file. Otherwise will crash when
5474 5484 .strip() is called on it.
5475 5485
5476 5486
5477 5487 2002-06-28 Fernando Perez <fperez@colorado.edu>
5478 5488
5479 5489 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5480 5490 of files in current directory when a file is executed via
5481 5491 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5482 5492
5483 5493 * setup.py (manfiles): fix for rpm builds, submitted by RA
5484 5494 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5485 5495
5486 5496 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5487 5497 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5488 5498 string!). A. Schmolck caught this one.
5489 5499
5490 5500 2002-06-27 Fernando Perez <fperez@colorado.edu>
5491 5501
5492 5502 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5493 5503 defined files at the cmd line. __name__ wasn't being set to
5494 5504 __main__.
5495 5505
5496 5506 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5497 5507 regular lists and tuples besides Numeric arrays.
5498 5508
5499 5509 * IPython/Prompts.py (CachedOutput.__call__): Added output
5500 5510 supression for input ending with ';'. Similar to Mathematica and
5501 5511 Matlab. The _* vars and Out[] list are still updated, just like
5502 5512 Mathematica behaves.
5503 5513
5504 5514 2002-06-25 Fernando Perez <fperez@colorado.edu>
5505 5515
5506 5516 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5507 5517 .ini extensions for profiels under Windows.
5508 5518
5509 5519 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5510 5520 string form. Fix contributed by Alexander Schmolck
5511 5521 <a.schmolck-AT-gmx.net>
5512 5522
5513 5523 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5514 5524 pre-configured Gnuplot instance.
5515 5525
5516 5526 2002-06-21 Fernando Perez <fperez@colorado.edu>
5517 5527
5518 5528 * IPython/numutils.py (exp_safe): new function, works around the
5519 5529 underflow problems in Numeric.
5520 5530 (log2): New fn. Safe log in base 2: returns exact integer answer
5521 5531 for exact integer powers of 2.
5522 5532
5523 5533 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5524 5534 properly.
5525 5535
5526 5536 2002-06-20 Fernando Perez <fperez@colorado.edu>
5527 5537
5528 5538 * IPython/genutils.py (timing): new function like
5529 5539 Mathematica's. Similar to time_test, but returns more info.
5530 5540
5531 5541 2002-06-18 Fernando Perez <fperez@colorado.edu>
5532 5542
5533 5543 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5534 5544 according to Mike Heeter's suggestions.
5535 5545
5536 5546 2002-06-16 Fernando Perez <fperez@colorado.edu>
5537 5547
5538 5548 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5539 5549 system. GnuplotMagic is gone as a user-directory option. New files
5540 5550 make it easier to use all the gnuplot stuff both from external
5541 5551 programs as well as from IPython. Had to rewrite part of
5542 5552 hardcopy() b/c of a strange bug: often the ps files simply don't
5543 5553 get created, and require a repeat of the command (often several
5544 5554 times).
5545 5555
5546 5556 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5547 5557 resolve output channel at call time, so that if sys.stderr has
5548 5558 been redirected by user this gets honored.
5549 5559
5550 5560 2002-06-13 Fernando Perez <fperez@colorado.edu>
5551 5561
5552 5562 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5553 5563 IPShell. Kept a copy with the old names to avoid breaking people's
5554 5564 embedded code.
5555 5565
5556 5566 * IPython/ipython: simplified it to the bare minimum after
5557 5567 Holger's suggestions. Added info about how to use it in
5558 5568 PYTHONSTARTUP.
5559 5569
5560 5570 * IPython/Shell.py (IPythonShell): changed the options passing
5561 5571 from a string with funky %s replacements to a straight list. Maybe
5562 5572 a bit more typing, but it follows sys.argv conventions, so there's
5563 5573 less special-casing to remember.
5564 5574
5565 5575 2002-06-12 Fernando Perez <fperez@colorado.edu>
5566 5576
5567 5577 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5568 5578 command. Thanks to a suggestion by Mike Heeter.
5569 5579 (Magic.magic_pfile): added behavior to look at filenames if given
5570 5580 arg is not a defined object.
5571 5581 (Magic.magic_save): New @save function to save code snippets. Also
5572 5582 a Mike Heeter idea.
5573 5583
5574 5584 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5575 5585 plot() and replot(). Much more convenient now, especially for
5576 5586 interactive use.
5577 5587
5578 5588 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5579 5589 filenames.
5580 5590
5581 5591 2002-06-02 Fernando Perez <fperez@colorado.edu>
5582 5592
5583 5593 * IPython/Struct.py (Struct.__init__): modified to admit
5584 5594 initialization via another struct.
5585 5595
5586 5596 * IPython/genutils.py (SystemExec.__init__): New stateful
5587 5597 interface to xsys and bq. Useful for writing system scripts.
5588 5598
5589 5599 2002-05-30 Fernando Perez <fperez@colorado.edu>
5590 5600
5591 5601 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5592 5602 documents. This will make the user download smaller (it's getting
5593 5603 too big).
5594 5604
5595 5605 2002-05-29 Fernando Perez <fperez@colorado.edu>
5596 5606
5597 5607 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5598 5608 fix problems with shelve and pickle. Seems to work, but I don't
5599 5609 know if corner cases break it. Thanks to Mike Heeter
5600 5610 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5601 5611
5602 5612 2002-05-24 Fernando Perez <fperez@colorado.edu>
5603 5613
5604 5614 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5605 5615 macros having broken.
5606 5616
5607 5617 2002-05-21 Fernando Perez <fperez@colorado.edu>
5608 5618
5609 5619 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5610 5620 introduced logging bug: all history before logging started was
5611 5621 being written one character per line! This came from the redesign
5612 5622 of the input history as a special list which slices to strings,
5613 5623 not to lists.
5614 5624
5615 5625 2002-05-20 Fernando Perez <fperez@colorado.edu>
5616 5626
5617 5627 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5618 5628 be an attribute of all classes in this module. The design of these
5619 5629 classes needs some serious overhauling.
5620 5630
5621 5631 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5622 5632 which was ignoring '_' in option names.
5623 5633
5624 5634 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5625 5635 'Verbose_novars' to 'Context' and made it the new default. It's a
5626 5636 bit more readable and also safer than verbose.
5627 5637
5628 5638 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5629 5639 triple-quoted strings.
5630 5640
5631 5641 * IPython/OInspect.py (__all__): new module exposing the object
5632 5642 introspection facilities. Now the corresponding magics are dummy
5633 5643 wrappers around this. Having this module will make it much easier
5634 5644 to put these functions into our modified pdb.
5635 5645 This new object inspector system uses the new colorizing module,
5636 5646 so source code and other things are nicely syntax highlighted.
5637 5647
5638 5648 2002-05-18 Fernando Perez <fperez@colorado.edu>
5639 5649
5640 5650 * IPython/ColorANSI.py: Split the coloring tools into a separate
5641 5651 module so I can use them in other code easier (they were part of
5642 5652 ultraTB).
5643 5653
5644 5654 2002-05-17 Fernando Perez <fperez@colorado.edu>
5645 5655
5646 5656 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5647 5657 fixed it to set the global 'g' also to the called instance, as
5648 5658 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5649 5659 user's 'g' variables).
5650 5660
5651 5661 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5652 5662 global variables (aliases to _ih,_oh) so that users which expect
5653 5663 In[5] or Out[7] to work aren't unpleasantly surprised.
5654 5664 (InputList.__getslice__): new class to allow executing slices of
5655 5665 input history directly. Very simple class, complements the use of
5656 5666 macros.
5657 5667
5658 5668 2002-05-16 Fernando Perez <fperez@colorado.edu>
5659 5669
5660 5670 * setup.py (docdirbase): make doc directory be just doc/IPython
5661 5671 without version numbers, it will reduce clutter for users.
5662 5672
5663 5673 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5664 5674 execfile call to prevent possible memory leak. See for details:
5665 5675 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5666 5676
5667 5677 2002-05-15 Fernando Perez <fperez@colorado.edu>
5668 5678
5669 5679 * IPython/Magic.py (Magic.magic_psource): made the object
5670 5680 introspection names be more standard: pdoc, pdef, pfile and
5671 5681 psource. They all print/page their output, and it makes
5672 5682 remembering them easier. Kept old names for compatibility as
5673 5683 aliases.
5674 5684
5675 5685 2002-05-14 Fernando Perez <fperez@colorado.edu>
5676 5686
5677 5687 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5678 5688 what the mouse problem was. The trick is to use gnuplot with temp
5679 5689 files and NOT with pipes (for data communication), because having
5680 5690 both pipes and the mouse on is bad news.
5681 5691
5682 5692 2002-05-13 Fernando Perez <fperez@colorado.edu>
5683 5693
5684 5694 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5685 5695 bug. Information would be reported about builtins even when
5686 5696 user-defined functions overrode them.
5687 5697
5688 5698 2002-05-11 Fernando Perez <fperez@colorado.edu>
5689 5699
5690 5700 * IPython/__init__.py (__all__): removed FlexCompleter from
5691 5701 __all__ so that things don't fail in platforms without readline.
5692 5702
5693 5703 2002-05-10 Fernando Perez <fperez@colorado.edu>
5694 5704
5695 5705 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5696 5706 it requires Numeric, effectively making Numeric a dependency for
5697 5707 IPython.
5698 5708
5699 5709 * Released 0.2.13
5700 5710
5701 5711 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5702 5712 profiler interface. Now all the major options from the profiler
5703 5713 module are directly supported in IPython, both for single
5704 5714 expressions (@prun) and for full programs (@run -p).
5705 5715
5706 5716 2002-05-09 Fernando Perez <fperez@colorado.edu>
5707 5717
5708 5718 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5709 5719 magic properly formatted for screen.
5710 5720
5711 5721 * setup.py (make_shortcut): Changed things to put pdf version in
5712 5722 doc/ instead of doc/manual (had to change lyxport a bit).
5713 5723
5714 5724 * IPython/Magic.py (Profile.string_stats): made profile runs go
5715 5725 through pager (they are long and a pager allows searching, saving,
5716 5726 etc.)
5717 5727
5718 5728 2002-05-08 Fernando Perez <fperez@colorado.edu>
5719 5729
5720 5730 * Released 0.2.12
5721 5731
5722 5732 2002-05-06 Fernando Perez <fperez@colorado.edu>
5723 5733
5724 5734 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5725 5735 introduced); 'hist n1 n2' was broken.
5726 5736 (Magic.magic_pdb): added optional on/off arguments to @pdb
5727 5737 (Magic.magic_run): added option -i to @run, which executes code in
5728 5738 the IPython namespace instead of a clean one. Also added @irun as
5729 5739 an alias to @run -i.
5730 5740
5731 5741 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5732 5742 fixed (it didn't really do anything, the namespaces were wrong).
5733 5743
5734 5744 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5735 5745
5736 5746 * IPython/__init__.py (__all__): Fixed package namespace, now
5737 5747 'import IPython' does give access to IPython.<all> as
5738 5748 expected. Also renamed __release__ to Release.
5739 5749
5740 5750 * IPython/Debugger.py (__license__): created new Pdb class which
5741 5751 functions like a drop-in for the normal pdb.Pdb but does NOT
5742 5752 import readline by default. This way it doesn't muck up IPython's
5743 5753 readline handling, and now tab-completion finally works in the
5744 5754 debugger -- sort of. It completes things globally visible, but the
5745 5755 completer doesn't track the stack as pdb walks it. That's a bit
5746 5756 tricky, and I'll have to implement it later.
5747 5757
5748 5758 2002-05-05 Fernando Perez <fperez@colorado.edu>
5749 5759
5750 5760 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5751 5761 magic docstrings when printed via ? (explicit \'s were being
5752 5762 printed).
5753 5763
5754 5764 * IPython/ipmaker.py (make_IPython): fixed namespace
5755 5765 identification bug. Now variables loaded via logs or command-line
5756 5766 files are recognized in the interactive namespace by @who.
5757 5767
5758 5768 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5759 5769 log replay system stemming from the string form of Structs.
5760 5770
5761 5771 * IPython/Magic.py (Macro.__init__): improved macros to properly
5762 5772 handle magic commands in them.
5763 5773 (Magic.magic_logstart): usernames are now expanded so 'logstart
5764 5774 ~/mylog' now works.
5765 5775
5766 5776 * IPython/iplib.py (complete): fixed bug where paths starting with
5767 5777 '/' would be completed as magic names.
5768 5778
5769 5779 2002-05-04 Fernando Perez <fperez@colorado.edu>
5770 5780
5771 5781 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5772 5782 allow running full programs under the profiler's control.
5773 5783
5774 5784 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5775 5785 mode to report exceptions verbosely but without formatting
5776 5786 variables. This addresses the issue of ipython 'freezing' (it's
5777 5787 not frozen, but caught in an expensive formatting loop) when huge
5778 5788 variables are in the context of an exception.
5779 5789 (VerboseTB.text): Added '--->' markers at line where exception was
5780 5790 triggered. Much clearer to read, especially in NoColor modes.
5781 5791
5782 5792 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5783 5793 implemented in reverse when changing to the new parse_options().
5784 5794
5785 5795 2002-05-03 Fernando Perez <fperez@colorado.edu>
5786 5796
5787 5797 * IPython/Magic.py (Magic.parse_options): new function so that
5788 5798 magics can parse options easier.
5789 5799 (Magic.magic_prun): new function similar to profile.run(),
5790 5800 suggested by Chris Hart.
5791 5801 (Magic.magic_cd): fixed behavior so that it only changes if
5792 5802 directory actually is in history.
5793 5803
5794 5804 * IPython/usage.py (__doc__): added information about potential
5795 5805 slowness of Verbose exception mode when there are huge data
5796 5806 structures to be formatted (thanks to Archie Paulson).
5797 5807
5798 5808 * IPython/ipmaker.py (make_IPython): Changed default logging
5799 5809 (when simply called with -log) to use curr_dir/ipython.log in
5800 5810 rotate mode. Fixed crash which was occuring with -log before
5801 5811 (thanks to Jim Boyle).
5802 5812
5803 5813 2002-05-01 Fernando Perez <fperez@colorado.edu>
5804 5814
5805 5815 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5806 5816 was nasty -- though somewhat of a corner case).
5807 5817
5808 5818 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5809 5819 text (was a bug).
5810 5820
5811 5821 2002-04-30 Fernando Perez <fperez@colorado.edu>
5812 5822
5813 5823 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5814 5824 a print after ^D or ^C from the user so that the In[] prompt
5815 5825 doesn't over-run the gnuplot one.
5816 5826
5817 5827 2002-04-29 Fernando Perez <fperez@colorado.edu>
5818 5828
5819 5829 * Released 0.2.10
5820 5830
5821 5831 * IPython/__release__.py (version): get date dynamically.
5822 5832
5823 5833 * Misc. documentation updates thanks to Arnd's comments. Also ran
5824 5834 a full spellcheck on the manual (hadn't been done in a while).
5825 5835
5826 5836 2002-04-27 Fernando Perez <fperez@colorado.edu>
5827 5837
5828 5838 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5829 5839 starting a log in mid-session would reset the input history list.
5830 5840
5831 5841 2002-04-26 Fernando Perez <fperez@colorado.edu>
5832 5842
5833 5843 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5834 5844 all files were being included in an update. Now anything in
5835 5845 UserConfig that matches [A-Za-z]*.py will go (this excludes
5836 5846 __init__.py)
5837 5847
5838 5848 2002-04-25 Fernando Perez <fperez@colorado.edu>
5839 5849
5840 5850 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5841 5851 to __builtins__ so that any form of embedded or imported code can
5842 5852 test for being inside IPython.
5843 5853
5844 5854 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5845 5855 changed to GnuplotMagic because it's now an importable module,
5846 5856 this makes the name follow that of the standard Gnuplot module.
5847 5857 GnuplotMagic can now be loaded at any time in mid-session.
5848 5858
5849 5859 2002-04-24 Fernando Perez <fperez@colorado.edu>
5850 5860
5851 5861 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5852 5862 the globals (IPython has its own namespace) and the
5853 5863 PhysicalQuantity stuff is much better anyway.
5854 5864
5855 5865 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5856 5866 embedding example to standard user directory for
5857 5867 distribution. Also put it in the manual.
5858 5868
5859 5869 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5860 5870 instance as first argument (so it doesn't rely on some obscure
5861 5871 hidden global).
5862 5872
5863 5873 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5864 5874 delimiters. While it prevents ().TAB from working, it allows
5865 5875 completions in open (... expressions. This is by far a more common
5866 5876 case.
5867 5877
5868 5878 2002-04-23 Fernando Perez <fperez@colorado.edu>
5869 5879
5870 5880 * IPython/Extensions/InterpreterPasteInput.py: new
5871 5881 syntax-processing module for pasting lines with >>> or ... at the
5872 5882 start.
5873 5883
5874 5884 * IPython/Extensions/PhysicalQ_Interactive.py
5875 5885 (PhysicalQuantityInteractive.__int__): fixed to work with either
5876 5886 Numeric or math.
5877 5887
5878 5888 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5879 5889 provided profiles. Now we have:
5880 5890 -math -> math module as * and cmath with its own namespace.
5881 5891 -numeric -> Numeric as *, plus gnuplot & grace
5882 5892 -physics -> same as before
5883 5893
5884 5894 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5885 5895 user-defined magics wouldn't be found by @magic if they were
5886 5896 defined as class methods. Also cleaned up the namespace search
5887 5897 logic and the string building (to use %s instead of many repeated
5888 5898 string adds).
5889 5899
5890 5900 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5891 5901 of user-defined magics to operate with class methods (cleaner, in
5892 5902 line with the gnuplot code).
5893 5903
5894 5904 2002-04-22 Fernando Perez <fperez@colorado.edu>
5895 5905
5896 5906 * setup.py: updated dependency list so that manual is updated when
5897 5907 all included files change.
5898 5908
5899 5909 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5900 5910 the delimiter removal option (the fix is ugly right now).
5901 5911
5902 5912 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5903 5913 all of the math profile (quicker loading, no conflict between
5904 5914 g-9.8 and g-gnuplot).
5905 5915
5906 5916 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5907 5917 name of post-mortem files to IPython_crash_report.txt.
5908 5918
5909 5919 * Cleanup/update of the docs. Added all the new readline info and
5910 5920 formatted all lists as 'real lists'.
5911 5921
5912 5922 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5913 5923 tab-completion options, since the full readline parse_and_bind is
5914 5924 now accessible.
5915 5925
5916 5926 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5917 5927 handling of readline options. Now users can specify any string to
5918 5928 be passed to parse_and_bind(), as well as the delimiters to be
5919 5929 removed.
5920 5930 (InteractiveShell.__init__): Added __name__ to the global
5921 5931 namespace so that things like Itpl which rely on its existence
5922 5932 don't crash.
5923 5933 (InteractiveShell._prefilter): Defined the default with a _ so
5924 5934 that prefilter() is easier to override, while the default one
5925 5935 remains available.
5926 5936
5927 5937 2002-04-18 Fernando Perez <fperez@colorado.edu>
5928 5938
5929 5939 * Added information about pdb in the docs.
5930 5940
5931 5941 2002-04-17 Fernando Perez <fperez@colorado.edu>
5932 5942
5933 5943 * IPython/ipmaker.py (make_IPython): added rc_override option to
5934 5944 allow passing config options at creation time which may override
5935 5945 anything set in the config files or command line. This is
5936 5946 particularly useful for configuring embedded instances.
5937 5947
5938 5948 2002-04-15 Fernando Perez <fperez@colorado.edu>
5939 5949
5940 5950 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5941 5951 crash embedded instances because of the input cache falling out of
5942 5952 sync with the output counter.
5943 5953
5944 5954 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5945 5955 mode which calls pdb after an uncaught exception in IPython itself.
5946 5956
5947 5957 2002-04-14 Fernando Perez <fperez@colorado.edu>
5948 5958
5949 5959 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5950 5960 readline, fix it back after each call.
5951 5961
5952 5962 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5953 5963 method to force all access via __call__(), which guarantees that
5954 5964 traceback references are properly deleted.
5955 5965
5956 5966 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5957 5967 improve printing when pprint is in use.
5958 5968
5959 5969 2002-04-13 Fernando Perez <fperez@colorado.edu>
5960 5970
5961 5971 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5962 5972 exceptions aren't caught anymore. If the user triggers one, he
5963 5973 should know why he's doing it and it should go all the way up,
5964 5974 just like any other exception. So now @abort will fully kill the
5965 5975 embedded interpreter and the embedding code (unless that happens
5966 5976 to catch SystemExit).
5967 5977
5968 5978 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5969 5979 and a debugger() method to invoke the interactive pdb debugger
5970 5980 after printing exception information. Also added the corresponding
5971 5981 -pdb option and @pdb magic to control this feature, and updated
5972 5982 the docs. After a suggestion from Christopher Hart
5973 5983 (hart-AT-caltech.edu).
5974 5984
5975 5985 2002-04-12 Fernando Perez <fperez@colorado.edu>
5976 5986
5977 5987 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5978 5988 the exception handlers defined by the user (not the CrashHandler)
5979 5989 so that user exceptions don't trigger an ipython bug report.
5980 5990
5981 5991 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5982 5992 configurable (it should have always been so).
5983 5993
5984 5994 2002-03-26 Fernando Perez <fperez@colorado.edu>
5985 5995
5986 5996 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5987 5997 and there to fix embedding namespace issues. This should all be
5988 5998 done in a more elegant way.
5989 5999
5990 6000 2002-03-25 Fernando Perez <fperez@colorado.edu>
5991 6001
5992 6002 * IPython/genutils.py (get_home_dir): Try to make it work under
5993 6003 win9x also.
5994 6004
5995 6005 2002-03-20 Fernando Perez <fperez@colorado.edu>
5996 6006
5997 6007 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5998 6008 sys.displayhook untouched upon __init__.
5999 6009
6000 6010 2002-03-19 Fernando Perez <fperez@colorado.edu>
6001 6011
6002 6012 * Released 0.2.9 (for embedding bug, basically).
6003 6013
6004 6014 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
6005 6015 exceptions so that enclosing shell's state can be restored.
6006 6016
6007 6017 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
6008 6018 naming conventions in the .ipython/ dir.
6009 6019
6010 6020 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
6011 6021 from delimiters list so filenames with - in them get expanded.
6012 6022
6013 6023 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
6014 6024 sys.displayhook not being properly restored after an embedded call.
6015 6025
6016 6026 2002-03-18 Fernando Perez <fperez@colorado.edu>
6017 6027
6018 6028 * Released 0.2.8
6019 6029
6020 6030 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
6021 6031 some files weren't being included in a -upgrade.
6022 6032 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
6023 6033 on' so that the first tab completes.
6024 6034 (InteractiveShell.handle_magic): fixed bug with spaces around
6025 6035 quotes breaking many magic commands.
6026 6036
6027 6037 * setup.py: added note about ignoring the syntax error messages at
6028 6038 installation.
6029 6039
6030 6040 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
6031 6041 streamlining the gnuplot interface, now there's only one magic @gp.
6032 6042
6033 6043 2002-03-17 Fernando Perez <fperez@colorado.edu>
6034 6044
6035 6045 * IPython/UserConfig/magic_gnuplot.py: new name for the
6036 6046 example-magic_pm.py file. Much enhanced system, now with a shell
6037 6047 for communicating directly with gnuplot, one command at a time.
6038 6048
6039 6049 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6040 6050 setting __name__=='__main__'.
6041 6051
6042 6052 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6043 6053 mini-shell for accessing gnuplot from inside ipython. Should
6044 6054 extend it later for grace access too. Inspired by Arnd's
6045 6055 suggestion.
6046 6056
6047 6057 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6048 6058 calling magic functions with () in their arguments. Thanks to Arnd
6049 6059 Baecker for pointing this to me.
6050 6060
6051 6061 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6052 6062 infinitely for integer or complex arrays (only worked with floats).
6053 6063
6054 6064 2002-03-16 Fernando Perez <fperez@colorado.edu>
6055 6065
6056 6066 * setup.py: Merged setup and setup_windows into a single script
6057 6067 which properly handles things for windows users.
6058 6068
6059 6069 2002-03-15 Fernando Perez <fperez@colorado.edu>
6060 6070
6061 6071 * Big change to the manual: now the magics are all automatically
6062 6072 documented. This information is generated from their docstrings
6063 6073 and put in a latex file included by the manual lyx file. This way
6064 6074 we get always up to date information for the magics. The manual
6065 6075 now also has proper version information, also auto-synced.
6066 6076
6067 6077 For this to work, an undocumented --magic_docstrings option was added.
6068 6078
6069 6079 2002-03-13 Fernando Perez <fperez@colorado.edu>
6070 6080
6071 6081 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6072 6082 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6073 6083
6074 6084 2002-03-12 Fernando Perez <fperez@colorado.edu>
6075 6085
6076 6086 * IPython/ultraTB.py (TermColors): changed color escapes again to
6077 6087 fix the (old, reintroduced) line-wrapping bug. Basically, if
6078 6088 \001..\002 aren't given in the color escapes, lines get wrapped
6079 6089 weirdly. But giving those screws up old xterms and emacs terms. So
6080 6090 I added some logic for emacs terms to be ok, but I can't identify old
6081 6091 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6082 6092
6083 6093 2002-03-10 Fernando Perez <fperez@colorado.edu>
6084 6094
6085 6095 * IPython/usage.py (__doc__): Various documentation cleanups and
6086 6096 updates, both in usage docstrings and in the manual.
6087 6097
6088 6098 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6089 6099 handling of caching. Set minimum acceptabe value for having a
6090 6100 cache at 20 values.
6091 6101
6092 6102 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6093 6103 install_first_time function to a method, renamed it and added an
6094 6104 'upgrade' mode. Now people can update their config directory with
6095 6105 a simple command line switch (-upgrade, also new).
6096 6106
6097 6107 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6098 6108 @file (convenient for automagic users under Python >= 2.2).
6099 6109 Removed @files (it seemed more like a plural than an abbrev. of
6100 6110 'file show').
6101 6111
6102 6112 * IPython/iplib.py (install_first_time): Fixed crash if there were
6103 6113 backup files ('~') in .ipython/ install directory.
6104 6114
6105 6115 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6106 6116 system. Things look fine, but these changes are fairly
6107 6117 intrusive. Test them for a few days.
6108 6118
6109 6119 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6110 6120 the prompts system. Now all in/out prompt strings are user
6111 6121 controllable. This is particularly useful for embedding, as one
6112 6122 can tag embedded instances with particular prompts.
6113 6123
6114 6124 Also removed global use of sys.ps1/2, which now allows nested
6115 6125 embeddings without any problems. Added command-line options for
6116 6126 the prompt strings.
6117 6127
6118 6128 2002-03-08 Fernando Perez <fperez@colorado.edu>
6119 6129
6120 6130 * IPython/UserConfig/example-embed-short.py (ipshell): added
6121 6131 example file with the bare minimum code for embedding.
6122 6132
6123 6133 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6124 6134 functionality for the embeddable shell to be activated/deactivated
6125 6135 either globally or at each call.
6126 6136
6127 6137 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6128 6138 rewriting the prompt with '--->' for auto-inputs with proper
6129 6139 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6130 6140 this is handled by the prompts class itself, as it should.
6131 6141
6132 6142 2002-03-05 Fernando Perez <fperez@colorado.edu>
6133 6143
6134 6144 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6135 6145 @logstart to avoid name clashes with the math log function.
6136 6146
6137 6147 * Big updates to X/Emacs section of the manual.
6138 6148
6139 6149 * Removed ipython_emacs. Milan explained to me how to pass
6140 6150 arguments to ipython through Emacs. Some day I'm going to end up
6141 6151 learning some lisp...
6142 6152
6143 6153 2002-03-04 Fernando Perez <fperez@colorado.edu>
6144 6154
6145 6155 * IPython/ipython_emacs: Created script to be used as the
6146 6156 py-python-command Emacs variable so we can pass IPython
6147 6157 parameters. I can't figure out how to tell Emacs directly to pass
6148 6158 parameters to IPython, so a dummy shell script will do it.
6149 6159
6150 6160 Other enhancements made for things to work better under Emacs'
6151 6161 various types of terminals. Many thanks to Milan Zamazal
6152 6162 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6153 6163
6154 6164 2002-03-01 Fernando Perez <fperez@colorado.edu>
6155 6165
6156 6166 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6157 6167 that loading of readline is now optional. This gives better
6158 6168 control to emacs users.
6159 6169
6160 6170 * IPython/ultraTB.py (__date__): Modified color escape sequences
6161 6171 and now things work fine under xterm and in Emacs' term buffers
6162 6172 (though not shell ones). Well, in emacs you get colors, but all
6163 6173 seem to be 'light' colors (no difference between dark and light
6164 6174 ones). But the garbage chars are gone, and also in xterms. It
6165 6175 seems that now I'm using 'cleaner' ansi sequences.
6166 6176
6167 6177 2002-02-21 Fernando Perez <fperez@colorado.edu>
6168 6178
6169 6179 * Released 0.2.7 (mainly to publish the scoping fix).
6170 6180
6171 6181 * IPython/Logger.py (Logger.logstate): added. A corresponding
6172 6182 @logstate magic was created.
6173 6183
6174 6184 * IPython/Magic.py: fixed nested scoping problem under Python
6175 6185 2.1.x (automagic wasn't working).
6176 6186
6177 6187 2002-02-20 Fernando Perez <fperez@colorado.edu>
6178 6188
6179 6189 * Released 0.2.6.
6180 6190
6181 6191 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6182 6192 option so that logs can come out without any headers at all.
6183 6193
6184 6194 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6185 6195 SciPy.
6186 6196
6187 6197 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6188 6198 that embedded IPython calls don't require vars() to be explicitly
6189 6199 passed. Now they are extracted from the caller's frame (code
6190 6200 snatched from Eric Jones' weave). Added better documentation to
6191 6201 the section on embedding and the example file.
6192 6202
6193 6203 * IPython/genutils.py (page): Changed so that under emacs, it just
6194 6204 prints the string. You can then page up and down in the emacs
6195 6205 buffer itself. This is how the builtin help() works.
6196 6206
6197 6207 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6198 6208 macro scoping: macros need to be executed in the user's namespace
6199 6209 to work as if they had been typed by the user.
6200 6210
6201 6211 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6202 6212 execute automatically (no need to type 'exec...'). They then
6203 6213 behave like 'true macros'. The printing system was also modified
6204 6214 for this to work.
6205 6215
6206 6216 2002-02-19 Fernando Perez <fperez@colorado.edu>
6207 6217
6208 6218 * IPython/genutils.py (page_file): new function for paging files
6209 6219 in an OS-independent way. Also necessary for file viewing to work
6210 6220 well inside Emacs buffers.
6211 6221 (page): Added checks for being in an emacs buffer.
6212 6222 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6213 6223 same bug in iplib.
6214 6224
6215 6225 2002-02-18 Fernando Perez <fperez@colorado.edu>
6216 6226
6217 6227 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6218 6228 of readline so that IPython can work inside an Emacs buffer.
6219 6229
6220 6230 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6221 6231 method signatures (they weren't really bugs, but it looks cleaner
6222 6232 and keeps PyChecker happy).
6223 6233
6224 6234 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6225 6235 for implementing various user-defined hooks. Currently only
6226 6236 display is done.
6227 6237
6228 6238 * IPython/Prompts.py (CachedOutput._display): changed display
6229 6239 functions so that they can be dynamically changed by users easily.
6230 6240
6231 6241 * IPython/Extensions/numeric_formats.py (num_display): added an
6232 6242 extension for printing NumPy arrays in flexible manners. It
6233 6243 doesn't do anything yet, but all the structure is in
6234 6244 place. Ultimately the plan is to implement output format control
6235 6245 like in Octave.
6236 6246
6237 6247 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6238 6248 methods are found at run-time by all the automatic machinery.
6239 6249
6240 6250 2002-02-17 Fernando Perez <fperez@colorado.edu>
6241 6251
6242 6252 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6243 6253 whole file a little.
6244 6254
6245 6255 * ToDo: closed this document. Now there's a new_design.lyx
6246 6256 document for all new ideas. Added making a pdf of it for the
6247 6257 end-user distro.
6248 6258
6249 6259 * IPython/Logger.py (Logger.switch_log): Created this to replace
6250 6260 logon() and logoff(). It also fixes a nasty crash reported by
6251 6261 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6252 6262
6253 6263 * IPython/iplib.py (complete): got auto-completion to work with
6254 6264 automagic (I had wanted this for a long time).
6255 6265
6256 6266 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6257 6267 to @file, since file() is now a builtin and clashes with automagic
6258 6268 for @file.
6259 6269
6260 6270 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6261 6271 of this was previously in iplib, which had grown to more than 2000
6262 6272 lines, way too long. No new functionality, but it makes managing
6263 6273 the code a bit easier.
6264 6274
6265 6275 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6266 6276 information to crash reports.
6267 6277
6268 6278 2002-02-12 Fernando Perez <fperez@colorado.edu>
6269 6279
6270 6280 * Released 0.2.5.
6271 6281
6272 6282 2002-02-11 Fernando Perez <fperez@colorado.edu>
6273 6283
6274 6284 * Wrote a relatively complete Windows installer. It puts
6275 6285 everything in place, creates Start Menu entries and fixes the
6276 6286 color issues. Nothing fancy, but it works.
6277 6287
6278 6288 2002-02-10 Fernando Perez <fperez@colorado.edu>
6279 6289
6280 6290 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6281 6291 os.path.expanduser() call so that we can type @run ~/myfile.py and
6282 6292 have thigs work as expected.
6283 6293
6284 6294 * IPython/genutils.py (page): fixed exception handling so things
6285 6295 work both in Unix and Windows correctly. Quitting a pager triggers
6286 6296 an IOError/broken pipe in Unix, and in windows not finding a pager
6287 6297 is also an IOError, so I had to actually look at the return value
6288 6298 of the exception, not just the exception itself. Should be ok now.
6289 6299
6290 6300 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6291 6301 modified to allow case-insensitive color scheme changes.
6292 6302
6293 6303 2002-02-09 Fernando Perez <fperez@colorado.edu>
6294 6304
6295 6305 * IPython/genutils.py (native_line_ends): new function to leave
6296 6306 user config files with os-native line-endings.
6297 6307
6298 6308 * README and manual updates.
6299 6309
6300 6310 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6301 6311 instead of StringType to catch Unicode strings.
6302 6312
6303 6313 * IPython/genutils.py (filefind): fixed bug for paths with
6304 6314 embedded spaces (very common in Windows).
6305 6315
6306 6316 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6307 6317 files under Windows, so that they get automatically associated
6308 6318 with a text editor. Windows makes it a pain to handle
6309 6319 extension-less files.
6310 6320
6311 6321 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6312 6322 warning about readline only occur for Posix. In Windows there's no
6313 6323 way to get readline, so why bother with the warning.
6314 6324
6315 6325 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6316 6326 for __str__ instead of dir(self), since dir() changed in 2.2.
6317 6327
6318 6328 * Ported to Windows! Tested on XP, I suspect it should work fine
6319 6329 on NT/2000, but I don't think it will work on 98 et al. That
6320 6330 series of Windows is such a piece of junk anyway that I won't try
6321 6331 porting it there. The XP port was straightforward, showed a few
6322 6332 bugs here and there (fixed all), in particular some string
6323 6333 handling stuff which required considering Unicode strings (which
6324 6334 Windows uses). This is good, but hasn't been too tested :) No
6325 6335 fancy installer yet, I'll put a note in the manual so people at
6326 6336 least make manually a shortcut.
6327 6337
6328 6338 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6329 6339 into a single one, "colors". This now controls both prompt and
6330 6340 exception color schemes, and can be changed both at startup
6331 6341 (either via command-line switches or via ipythonrc files) and at
6332 6342 runtime, with @colors.
6333 6343 (Magic.magic_run): renamed @prun to @run and removed the old
6334 6344 @run. The two were too similar to warrant keeping both.
6335 6345
6336 6346 2002-02-03 Fernando Perez <fperez@colorado.edu>
6337 6347
6338 6348 * IPython/iplib.py (install_first_time): Added comment on how to
6339 6349 configure the color options for first-time users. Put a <return>
6340 6350 request at the end so that small-terminal users get a chance to
6341 6351 read the startup info.
6342 6352
6343 6353 2002-01-23 Fernando Perez <fperez@colorado.edu>
6344 6354
6345 6355 * IPython/iplib.py (CachedOutput.update): Changed output memory
6346 6356 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6347 6357 input history we still use _i. Did this b/c these variable are
6348 6358 very commonly used in interactive work, so the less we need to
6349 6359 type the better off we are.
6350 6360 (Magic.magic_prun): updated @prun to better handle the namespaces
6351 6361 the file will run in, including a fix for __name__ not being set
6352 6362 before.
6353 6363
6354 6364 2002-01-20 Fernando Perez <fperez@colorado.edu>
6355 6365
6356 6366 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6357 6367 extra garbage for Python 2.2. Need to look more carefully into
6358 6368 this later.
6359 6369
6360 6370 2002-01-19 Fernando Perez <fperez@colorado.edu>
6361 6371
6362 6372 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6363 6373 display SyntaxError exceptions properly formatted when they occur
6364 6374 (they can be triggered by imported code).
6365 6375
6366 6376 2002-01-18 Fernando Perez <fperez@colorado.edu>
6367 6377
6368 6378 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6369 6379 SyntaxError exceptions are reported nicely formatted, instead of
6370 6380 spitting out only offset information as before.
6371 6381 (Magic.magic_prun): Added the @prun function for executing
6372 6382 programs with command line args inside IPython.
6373 6383
6374 6384 2002-01-16 Fernando Perez <fperez@colorado.edu>
6375 6385
6376 6386 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6377 6387 to *not* include the last item given in a range. This brings their
6378 6388 behavior in line with Python's slicing:
6379 6389 a[n1:n2] -> a[n1]...a[n2-1]
6380 6390 It may be a bit less convenient, but I prefer to stick to Python's
6381 6391 conventions *everywhere*, so users never have to wonder.
6382 6392 (Magic.magic_macro): Added @macro function to ease the creation of
6383 6393 macros.
6384 6394
6385 6395 2002-01-05 Fernando Perez <fperez@colorado.edu>
6386 6396
6387 6397 * Released 0.2.4.
6388 6398
6389 6399 * IPython/iplib.py (Magic.magic_pdef):
6390 6400 (InteractiveShell.safe_execfile): report magic lines and error
6391 6401 lines without line numbers so one can easily copy/paste them for
6392 6402 re-execution.
6393 6403
6394 6404 * Updated manual with recent changes.
6395 6405
6396 6406 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6397 6407 docstring printing when class? is called. Very handy for knowing
6398 6408 how to create class instances (as long as __init__ is well
6399 6409 documented, of course :)
6400 6410 (Magic.magic_doc): print both class and constructor docstrings.
6401 6411 (Magic.magic_pdef): give constructor info if passed a class and
6402 6412 __call__ info for callable object instances.
6403 6413
6404 6414 2002-01-04 Fernando Perez <fperez@colorado.edu>
6405 6415
6406 6416 * Made deep_reload() off by default. It doesn't always work
6407 6417 exactly as intended, so it's probably safer to have it off. It's
6408 6418 still available as dreload() anyway, so nothing is lost.
6409 6419
6410 6420 2002-01-02 Fernando Perez <fperez@colorado.edu>
6411 6421
6412 6422 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6413 6423 so I wanted an updated release).
6414 6424
6415 6425 2001-12-27 Fernando Perez <fperez@colorado.edu>
6416 6426
6417 6427 * IPython/iplib.py (InteractiveShell.interact): Added the original
6418 6428 code from 'code.py' for this module in order to change the
6419 6429 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6420 6430 the history cache would break when the user hit Ctrl-C, and
6421 6431 interact() offers no way to add any hooks to it.
6422 6432
6423 6433 2001-12-23 Fernando Perez <fperez@colorado.edu>
6424 6434
6425 6435 * setup.py: added check for 'MANIFEST' before trying to remove
6426 6436 it. Thanks to Sean Reifschneider.
6427 6437
6428 6438 2001-12-22 Fernando Perez <fperez@colorado.edu>
6429 6439
6430 6440 * Released 0.2.2.
6431 6441
6432 6442 * Finished (reasonably) writing the manual. Later will add the
6433 6443 python-standard navigation stylesheets, but for the time being
6434 6444 it's fairly complete. Distribution will include html and pdf
6435 6445 versions.
6436 6446
6437 6447 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6438 6448 (MayaVi author).
6439 6449
6440 6450 2001-12-21 Fernando Perez <fperez@colorado.edu>
6441 6451
6442 6452 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6443 6453 good public release, I think (with the manual and the distutils
6444 6454 installer). The manual can use some work, but that can go
6445 6455 slowly. Otherwise I think it's quite nice for end users. Next
6446 6456 summer, rewrite the guts of it...
6447 6457
6448 6458 * Changed format of ipythonrc files to use whitespace as the
6449 6459 separator instead of an explicit '='. Cleaner.
6450 6460
6451 6461 2001-12-20 Fernando Perez <fperez@colorado.edu>
6452 6462
6453 6463 * Started a manual in LyX. For now it's just a quick merge of the
6454 6464 various internal docstrings and READMEs. Later it may grow into a
6455 6465 nice, full-blown manual.
6456 6466
6457 6467 * Set up a distutils based installer. Installation should now be
6458 6468 trivially simple for end-users.
6459 6469
6460 6470 2001-12-11 Fernando Perez <fperez@colorado.edu>
6461 6471
6462 6472 * Released 0.2.0. First public release, announced it at
6463 6473 comp.lang.python. From now on, just bugfixes...
6464 6474
6465 6475 * Went through all the files, set copyright/license notices and
6466 6476 cleaned up things. Ready for release.
6467 6477
6468 6478 2001-12-10 Fernando Perez <fperez@colorado.edu>
6469 6479
6470 6480 * Changed the first-time installer not to use tarfiles. It's more
6471 6481 robust now and less unix-dependent. Also makes it easier for
6472 6482 people to later upgrade versions.
6473 6483
6474 6484 * Changed @exit to @abort to reflect the fact that it's pretty
6475 6485 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6476 6486 becomes significant only when IPyhton is embedded: in that case,
6477 6487 C-D closes IPython only, but @abort kills the enclosing program
6478 6488 too (unless it had called IPython inside a try catching
6479 6489 SystemExit).
6480 6490
6481 6491 * Created Shell module which exposes the actuall IPython Shell
6482 6492 classes, currently the normal and the embeddable one. This at
6483 6493 least offers a stable interface we won't need to change when
6484 6494 (later) the internals are rewritten. That rewrite will be confined
6485 6495 to iplib and ipmaker, but the Shell interface should remain as is.
6486 6496
6487 6497 * Added embed module which offers an embeddable IPShell object,
6488 6498 useful to fire up IPython *inside* a running program. Great for
6489 6499 debugging or dynamical data analysis.
6490 6500
6491 6501 2001-12-08 Fernando Perez <fperez@colorado.edu>
6492 6502
6493 6503 * Fixed small bug preventing seeing info from methods of defined
6494 6504 objects (incorrect namespace in _ofind()).
6495 6505
6496 6506 * Documentation cleanup. Moved the main usage docstrings to a
6497 6507 separate file, usage.py (cleaner to maintain, and hopefully in the
6498 6508 future some perlpod-like way of producing interactive, man and
6499 6509 html docs out of it will be found).
6500 6510
6501 6511 * Added @profile to see your profile at any time.
6502 6512
6503 6513 * Added @p as an alias for 'print'. It's especially convenient if
6504 6514 using automagic ('p x' prints x).
6505 6515
6506 6516 * Small cleanups and fixes after a pychecker run.
6507 6517
6508 6518 * Changed the @cd command to handle @cd - and @cd -<n> for
6509 6519 visiting any directory in _dh.
6510 6520
6511 6521 * Introduced _dh, a history of visited directories. @dhist prints
6512 6522 it out with numbers.
6513 6523
6514 6524 2001-12-07 Fernando Perez <fperez@colorado.edu>
6515 6525
6516 6526 * Released 0.1.22
6517 6527
6518 6528 * Made initialization a bit more robust against invalid color
6519 6529 options in user input (exit, not traceback-crash).
6520 6530
6521 6531 * Changed the bug crash reporter to write the report only in the
6522 6532 user's .ipython directory. That way IPython won't litter people's
6523 6533 hard disks with crash files all over the place. Also print on
6524 6534 screen the necessary mail command.
6525 6535
6526 6536 * With the new ultraTB, implemented LightBG color scheme for light
6527 6537 background terminals. A lot of people like white backgrounds, so I
6528 6538 guess we should at least give them something readable.
6529 6539
6530 6540 2001-12-06 Fernando Perez <fperez@colorado.edu>
6531 6541
6532 6542 * Modified the structure of ultraTB. Now there's a proper class
6533 6543 for tables of color schemes which allow adding schemes easily and
6534 6544 switching the active scheme without creating a new instance every
6535 6545 time (which was ridiculous). The syntax for creating new schemes
6536 6546 is also cleaner. I think ultraTB is finally done, with a clean
6537 6547 class structure. Names are also much cleaner (now there's proper
6538 6548 color tables, no need for every variable to also have 'color' in
6539 6549 its name).
6540 6550
6541 6551 * Broke down genutils into separate files. Now genutils only
6542 6552 contains utility functions, and classes have been moved to their
6543 6553 own files (they had enough independent functionality to warrant
6544 6554 it): ConfigLoader, OutputTrap, Struct.
6545 6555
6546 6556 2001-12-05 Fernando Perez <fperez@colorado.edu>
6547 6557
6548 6558 * IPython turns 21! Released version 0.1.21, as a candidate for
6549 6559 public consumption. If all goes well, release in a few days.
6550 6560
6551 6561 * Fixed path bug (files in Extensions/ directory wouldn't be found
6552 6562 unless IPython/ was explicitly in sys.path).
6553 6563
6554 6564 * Extended the FlexCompleter class as MagicCompleter to allow
6555 6565 completion of @-starting lines.
6556 6566
6557 6567 * Created __release__.py file as a central repository for release
6558 6568 info that other files can read from.
6559 6569
6560 6570 * Fixed small bug in logging: when logging was turned on in
6561 6571 mid-session, old lines with special meanings (!@?) were being
6562 6572 logged without the prepended comment, which is necessary since
6563 6573 they are not truly valid python syntax. This should make session
6564 6574 restores produce less errors.
6565 6575
6566 6576 * The namespace cleanup forced me to make a FlexCompleter class
6567 6577 which is nothing but a ripoff of rlcompleter, but with selectable
6568 6578 namespace (rlcompleter only works in __main__.__dict__). I'll try
6569 6579 to submit a note to the authors to see if this change can be
6570 6580 incorporated in future rlcompleter releases (Dec.6: done)
6571 6581
6572 6582 * More fixes to namespace handling. It was a mess! Now all
6573 6583 explicit references to __main__.__dict__ are gone (except when
6574 6584 really needed) and everything is handled through the namespace
6575 6585 dicts in the IPython instance. We seem to be getting somewhere
6576 6586 with this, finally...
6577 6587
6578 6588 * Small documentation updates.
6579 6589
6580 6590 * Created the Extensions directory under IPython (with an
6581 6591 __init__.py). Put the PhysicalQ stuff there. This directory should
6582 6592 be used for all special-purpose extensions.
6583 6593
6584 6594 * File renaming:
6585 6595 ipythonlib --> ipmaker
6586 6596 ipplib --> iplib
6587 6597 This makes a bit more sense in terms of what these files actually do.
6588 6598
6589 6599 * Moved all the classes and functions in ipythonlib to ipplib, so
6590 6600 now ipythonlib only has make_IPython(). This will ease up its
6591 6601 splitting in smaller functional chunks later.
6592 6602
6593 6603 * Cleaned up (done, I think) output of @whos. Better column
6594 6604 formatting, and now shows str(var) for as much as it can, which is
6595 6605 typically what one gets with a 'print var'.
6596 6606
6597 6607 2001-12-04 Fernando Perez <fperez@colorado.edu>
6598 6608
6599 6609 * Fixed namespace problems. Now builtin/IPyhton/user names get
6600 6610 properly reported in their namespace. Internal namespace handling
6601 6611 is finally getting decent (not perfect yet, but much better than
6602 6612 the ad-hoc mess we had).
6603 6613
6604 6614 * Removed -exit option. If people just want to run a python
6605 6615 script, that's what the normal interpreter is for. Less
6606 6616 unnecessary options, less chances for bugs.
6607 6617
6608 6618 * Added a crash handler which generates a complete post-mortem if
6609 6619 IPython crashes. This will help a lot in tracking bugs down the
6610 6620 road.
6611 6621
6612 6622 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6613 6623 which were boud to functions being reassigned would bypass the
6614 6624 logger, breaking the sync of _il with the prompt counter. This
6615 6625 would then crash IPython later when a new line was logged.
6616 6626
6617 6627 2001-12-02 Fernando Perez <fperez@colorado.edu>
6618 6628
6619 6629 * Made IPython a package. This means people don't have to clutter
6620 6630 their sys.path with yet another directory. Changed the INSTALL
6621 6631 file accordingly.
6622 6632
6623 6633 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6624 6634 sorts its output (so @who shows it sorted) and @whos formats the
6625 6635 table according to the width of the first column. Nicer, easier to
6626 6636 read. Todo: write a generic table_format() which takes a list of
6627 6637 lists and prints it nicely formatted, with optional row/column
6628 6638 separators and proper padding and justification.
6629 6639
6630 6640 * Released 0.1.20
6631 6641
6632 6642 * Fixed bug in @log which would reverse the inputcache list (a
6633 6643 copy operation was missing).
6634 6644
6635 6645 * Code cleanup. @config was changed to use page(). Better, since
6636 6646 its output is always quite long.
6637 6647
6638 6648 * Itpl is back as a dependency. I was having too many problems
6639 6649 getting the parametric aliases to work reliably, and it's just
6640 6650 easier to code weird string operations with it than playing %()s
6641 6651 games. It's only ~6k, so I don't think it's too big a deal.
6642 6652
6643 6653 * Found (and fixed) a very nasty bug with history. !lines weren't
6644 6654 getting cached, and the out of sync caches would crash
6645 6655 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6646 6656 division of labor a bit better. Bug fixed, cleaner structure.
6647 6657
6648 6658 2001-12-01 Fernando Perez <fperez@colorado.edu>
6649 6659
6650 6660 * Released 0.1.19
6651 6661
6652 6662 * Added option -n to @hist to prevent line number printing. Much
6653 6663 easier to copy/paste code this way.
6654 6664
6655 6665 * Created global _il to hold the input list. Allows easy
6656 6666 re-execution of blocks of code by slicing it (inspired by Janko's
6657 6667 comment on 'macros').
6658 6668
6659 6669 * Small fixes and doc updates.
6660 6670
6661 6671 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6662 6672 much too fragile with automagic. Handles properly multi-line
6663 6673 statements and takes parameters.
6664 6674
6665 6675 2001-11-30 Fernando Perez <fperez@colorado.edu>
6666 6676
6667 6677 * Version 0.1.18 released.
6668 6678
6669 6679 * Fixed nasty namespace bug in initial module imports.
6670 6680
6671 6681 * Added copyright/license notes to all code files (except
6672 6682 DPyGetOpt). For the time being, LGPL. That could change.
6673 6683
6674 6684 * Rewrote a much nicer README, updated INSTALL, cleaned up
6675 6685 ipythonrc-* samples.
6676 6686
6677 6687 * Overall code/documentation cleanup. Basically ready for
6678 6688 release. Only remaining thing: licence decision (LGPL?).
6679 6689
6680 6690 * Converted load_config to a class, ConfigLoader. Now recursion
6681 6691 control is better organized. Doesn't include the same file twice.
6682 6692
6683 6693 2001-11-29 Fernando Perez <fperez@colorado.edu>
6684 6694
6685 6695 * Got input history working. Changed output history variables from
6686 6696 _p to _o so that _i is for input and _o for output. Just cleaner
6687 6697 convention.
6688 6698
6689 6699 * Implemented parametric aliases. This pretty much allows the
6690 6700 alias system to offer full-blown shell convenience, I think.
6691 6701
6692 6702 * Version 0.1.17 released, 0.1.18 opened.
6693 6703
6694 6704 * dot_ipython/ipythonrc (alias): added documentation.
6695 6705 (xcolor): Fixed small bug (xcolors -> xcolor)
6696 6706
6697 6707 * Changed the alias system. Now alias is a magic command to define
6698 6708 aliases just like the shell. Rationale: the builtin magics should
6699 6709 be there for things deeply connected to IPython's
6700 6710 architecture. And this is a much lighter system for what I think
6701 6711 is the really important feature: allowing users to define quickly
6702 6712 magics that will do shell things for them, so they can customize
6703 6713 IPython easily to match their work habits. If someone is really
6704 6714 desperate to have another name for a builtin alias, they can
6705 6715 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6706 6716 works.
6707 6717
6708 6718 2001-11-28 Fernando Perez <fperez@colorado.edu>
6709 6719
6710 6720 * Changed @file so that it opens the source file at the proper
6711 6721 line. Since it uses less, if your EDITOR environment is
6712 6722 configured, typing v will immediately open your editor of choice
6713 6723 right at the line where the object is defined. Not as quick as
6714 6724 having a direct @edit command, but for all intents and purposes it
6715 6725 works. And I don't have to worry about writing @edit to deal with
6716 6726 all the editors, less does that.
6717 6727
6718 6728 * Version 0.1.16 released, 0.1.17 opened.
6719 6729
6720 6730 * Fixed some nasty bugs in the page/page_dumb combo that could
6721 6731 crash IPython.
6722 6732
6723 6733 2001-11-27 Fernando Perez <fperez@colorado.edu>
6724 6734
6725 6735 * Version 0.1.15 released, 0.1.16 opened.
6726 6736
6727 6737 * Finally got ? and ?? to work for undefined things: now it's
6728 6738 possible to type {}.get? and get information about the get method
6729 6739 of dicts, or os.path? even if only os is defined (so technically
6730 6740 os.path isn't). Works at any level. For example, after import os,
6731 6741 os?, os.path?, os.path.abspath? all work. This is great, took some
6732 6742 work in _ofind.
6733 6743
6734 6744 * Fixed more bugs with logging. The sanest way to do it was to add
6735 6745 to @log a 'mode' parameter. Killed two in one shot (this mode
6736 6746 option was a request of Janko's). I think it's finally clean
6737 6747 (famous last words).
6738 6748
6739 6749 * Added a page_dumb() pager which does a decent job of paging on
6740 6750 screen, if better things (like less) aren't available. One less
6741 6751 unix dependency (someday maybe somebody will port this to
6742 6752 windows).
6743 6753
6744 6754 * Fixed problem in magic_log: would lock of logging out if log
6745 6755 creation failed (because it would still think it had succeeded).
6746 6756
6747 6757 * Improved the page() function using curses to auto-detect screen
6748 6758 size. Now it can make a much better decision on whether to print
6749 6759 or page a string. Option screen_length was modified: a value 0
6750 6760 means auto-detect, and that's the default now.
6751 6761
6752 6762 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6753 6763 go out. I'll test it for a few days, then talk to Janko about
6754 6764 licences and announce it.
6755 6765
6756 6766 * Fixed the length of the auto-generated ---> prompt which appears
6757 6767 for auto-parens and auto-quotes. Getting this right isn't trivial,
6758 6768 with all the color escapes, different prompt types and optional
6759 6769 separators. But it seems to be working in all the combinations.
6760 6770
6761 6771 2001-11-26 Fernando Perez <fperez@colorado.edu>
6762 6772
6763 6773 * Wrote a regexp filter to get option types from the option names
6764 6774 string. This eliminates the need to manually keep two duplicate
6765 6775 lists.
6766 6776
6767 6777 * Removed the unneeded check_option_names. Now options are handled
6768 6778 in a much saner manner and it's easy to visually check that things
6769 6779 are ok.
6770 6780
6771 6781 * Updated version numbers on all files I modified to carry a
6772 6782 notice so Janko and Nathan have clear version markers.
6773 6783
6774 6784 * Updated docstring for ultraTB with my changes. I should send
6775 6785 this to Nathan.
6776 6786
6777 6787 * Lots of small fixes. Ran everything through pychecker again.
6778 6788
6779 6789 * Made loading of deep_reload an cmd line option. If it's not too
6780 6790 kosher, now people can just disable it. With -nodeep_reload it's
6781 6791 still available as dreload(), it just won't overwrite reload().
6782 6792
6783 6793 * Moved many options to the no| form (-opt and -noopt
6784 6794 accepted). Cleaner.
6785 6795
6786 6796 * Changed magic_log so that if called with no parameters, it uses
6787 6797 'rotate' mode. That way auto-generated logs aren't automatically
6788 6798 over-written. For normal logs, now a backup is made if it exists
6789 6799 (only 1 level of backups). A new 'backup' mode was added to the
6790 6800 Logger class to support this. This was a request by Janko.
6791 6801
6792 6802 * Added @logoff/@logon to stop/restart an active log.
6793 6803
6794 6804 * Fixed a lot of bugs in log saving/replay. It was pretty
6795 6805 broken. Now special lines (!@,/) appear properly in the command
6796 6806 history after a log replay.
6797 6807
6798 6808 * Tried and failed to implement full session saving via pickle. My
6799 6809 idea was to pickle __main__.__dict__, but modules can't be
6800 6810 pickled. This would be a better alternative to replaying logs, but
6801 6811 seems quite tricky to get to work. Changed -session to be called
6802 6812 -logplay, which more accurately reflects what it does. And if we
6803 6813 ever get real session saving working, -session is now available.
6804 6814
6805 6815 * Implemented color schemes for prompts also. As for tracebacks,
6806 6816 currently only NoColor and Linux are supported. But now the
6807 6817 infrastructure is in place, based on a generic ColorScheme
6808 6818 class. So writing and activating new schemes both for the prompts
6809 6819 and the tracebacks should be straightforward.
6810 6820
6811 6821 * Version 0.1.13 released, 0.1.14 opened.
6812 6822
6813 6823 * Changed handling of options for output cache. Now counter is
6814 6824 hardwired starting at 1 and one specifies the maximum number of
6815 6825 entries *in the outcache* (not the max prompt counter). This is
6816 6826 much better, since many statements won't increase the cache
6817 6827 count. It also eliminated some confusing options, now there's only
6818 6828 one: cache_size.
6819 6829
6820 6830 * Added 'alias' magic function and magic_alias option in the
6821 6831 ipythonrc file. Now the user can easily define whatever names he
6822 6832 wants for the magic functions without having to play weird
6823 6833 namespace games. This gives IPython a real shell-like feel.
6824 6834
6825 6835 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6826 6836 @ or not).
6827 6837
6828 6838 This was one of the last remaining 'visible' bugs (that I know
6829 6839 of). I think if I can clean up the session loading so it works
6830 6840 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6831 6841 about licensing).
6832 6842
6833 6843 2001-11-25 Fernando Perez <fperez@colorado.edu>
6834 6844
6835 6845 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6836 6846 there's a cleaner distinction between what ? and ?? show.
6837 6847
6838 6848 * Added screen_length option. Now the user can define his own
6839 6849 screen size for page() operations.
6840 6850
6841 6851 * Implemented magic shell-like functions with automatic code
6842 6852 generation. Now adding another function is just a matter of adding
6843 6853 an entry to a dict, and the function is dynamically generated at
6844 6854 run-time. Python has some really cool features!
6845 6855
6846 6856 * Renamed many options to cleanup conventions a little. Now all
6847 6857 are lowercase, and only underscores where needed. Also in the code
6848 6858 option name tables are clearer.
6849 6859
6850 6860 * Changed prompts a little. Now input is 'In [n]:' instead of
6851 6861 'In[n]:='. This allows it the numbers to be aligned with the
6852 6862 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6853 6863 Python (it was a Mathematica thing). The '...' continuation prompt
6854 6864 was also changed a little to align better.
6855 6865
6856 6866 * Fixed bug when flushing output cache. Not all _p<n> variables
6857 6867 exist, so their deletion needs to be wrapped in a try:
6858 6868
6859 6869 * Figured out how to properly use inspect.formatargspec() (it
6860 6870 requires the args preceded by *). So I removed all the code from
6861 6871 _get_pdef in Magic, which was just replicating that.
6862 6872
6863 6873 * Added test to prefilter to allow redefining magic function names
6864 6874 as variables. This is ok, since the @ form is always available,
6865 6875 but whe should allow the user to define a variable called 'ls' if
6866 6876 he needs it.
6867 6877
6868 6878 * Moved the ToDo information from README into a separate ToDo.
6869 6879
6870 6880 * General code cleanup and small bugfixes. I think it's close to a
6871 6881 state where it can be released, obviously with a big 'beta'
6872 6882 warning on it.
6873 6883
6874 6884 * Got the magic function split to work. Now all magics are defined
6875 6885 in a separate class. It just organizes things a bit, and now
6876 6886 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6877 6887 was too long).
6878 6888
6879 6889 * Changed @clear to @reset to avoid potential confusions with
6880 6890 the shell command clear. Also renamed @cl to @clear, which does
6881 6891 exactly what people expect it to from their shell experience.
6882 6892
6883 6893 Added a check to the @reset command (since it's so
6884 6894 destructive, it's probably a good idea to ask for confirmation).
6885 6895 But now reset only works for full namespace resetting. Since the
6886 6896 del keyword is already there for deleting a few specific
6887 6897 variables, I don't see the point of having a redundant magic
6888 6898 function for the same task.
6889 6899
6890 6900 2001-11-24 Fernando Perez <fperez@colorado.edu>
6891 6901
6892 6902 * Updated the builtin docs (esp. the ? ones).
6893 6903
6894 6904 * Ran all the code through pychecker. Not terribly impressed with
6895 6905 it: lots of spurious warnings and didn't really find anything of
6896 6906 substance (just a few modules being imported and not used).
6897 6907
6898 6908 * Implemented the new ultraTB functionality into IPython. New
6899 6909 option: xcolors. This chooses color scheme. xmode now only selects
6900 6910 between Plain and Verbose. Better orthogonality.
6901 6911
6902 6912 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6903 6913 mode and color scheme for the exception handlers. Now it's
6904 6914 possible to have the verbose traceback with no coloring.
6905 6915
6906 6916 2001-11-23 Fernando Perez <fperez@colorado.edu>
6907 6917
6908 6918 * Version 0.1.12 released, 0.1.13 opened.
6909 6919
6910 6920 * Removed option to set auto-quote and auto-paren escapes by
6911 6921 user. The chances of breaking valid syntax are just too high. If
6912 6922 someone *really* wants, they can always dig into the code.
6913 6923
6914 6924 * Made prompt separators configurable.
6915 6925
6916 6926 2001-11-22 Fernando Perez <fperez@colorado.edu>
6917 6927
6918 6928 * Small bugfixes in many places.
6919 6929
6920 6930 * Removed the MyCompleter class from ipplib. It seemed redundant
6921 6931 with the C-p,C-n history search functionality. Less code to
6922 6932 maintain.
6923 6933
6924 6934 * Moved all the original ipython.py code into ipythonlib.py. Right
6925 6935 now it's just one big dump into a function called make_IPython, so
6926 6936 no real modularity has been gained. But at least it makes the
6927 6937 wrapper script tiny, and since ipythonlib is a module, it gets
6928 6938 compiled and startup is much faster.
6929 6939
6930 6940 This is a reasobably 'deep' change, so we should test it for a
6931 6941 while without messing too much more with the code.
6932 6942
6933 6943 2001-11-21 Fernando Perez <fperez@colorado.edu>
6934 6944
6935 6945 * Version 0.1.11 released, 0.1.12 opened for further work.
6936 6946
6937 6947 * Removed dependency on Itpl. It was only needed in one place. It
6938 6948 would be nice if this became part of python, though. It makes life
6939 6949 *a lot* easier in some cases.
6940 6950
6941 6951 * Simplified the prefilter code a bit. Now all handlers are
6942 6952 expected to explicitly return a value (at least a blank string).
6943 6953
6944 6954 * Heavy edits in ipplib. Removed the help system altogether. Now
6945 6955 obj?/?? is used for inspecting objects, a magic @doc prints
6946 6956 docstrings, and full-blown Python help is accessed via the 'help'
6947 6957 keyword. This cleans up a lot of code (less to maintain) and does
6948 6958 the job. Since 'help' is now a standard Python component, might as
6949 6959 well use it and remove duplicate functionality.
6950 6960
6951 6961 Also removed the option to use ipplib as a standalone program. By
6952 6962 now it's too dependent on other parts of IPython to function alone.
6953 6963
6954 6964 * Fixed bug in genutils.pager. It would crash if the pager was
6955 6965 exited immediately after opening (broken pipe).
6956 6966
6957 6967 * Trimmed down the VerboseTB reporting a little. The header is
6958 6968 much shorter now and the repeated exception arguments at the end
6959 6969 have been removed. For interactive use the old header seemed a bit
6960 6970 excessive.
6961 6971
6962 6972 * Fixed small bug in output of @whos for variables with multi-word
6963 6973 types (only first word was displayed).
6964 6974
6965 6975 2001-11-17 Fernando Perez <fperez@colorado.edu>
6966 6976
6967 6977 * Version 0.1.10 released, 0.1.11 opened for further work.
6968 6978
6969 6979 * Modified dirs and friends. dirs now *returns* the stack (not
6970 6980 prints), so one can manipulate it as a variable. Convenient to
6971 6981 travel along many directories.
6972 6982
6973 6983 * Fixed bug in magic_pdef: would only work with functions with
6974 6984 arguments with default values.
6975 6985
6976 6986 2001-11-14 Fernando Perez <fperez@colorado.edu>
6977 6987
6978 6988 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6979 6989 example with IPython. Various other minor fixes and cleanups.
6980 6990
6981 6991 * Version 0.1.9 released, 0.1.10 opened for further work.
6982 6992
6983 6993 * Added sys.path to the list of directories searched in the
6984 6994 execfile= option. It used to be the current directory and the
6985 6995 user's IPYTHONDIR only.
6986 6996
6987 6997 2001-11-13 Fernando Perez <fperez@colorado.edu>
6988 6998
6989 6999 * Reinstated the raw_input/prefilter separation that Janko had
6990 7000 initially. This gives a more convenient setup for extending the
6991 7001 pre-processor from the outside: raw_input always gets a string,
6992 7002 and prefilter has to process it. We can then redefine prefilter
6993 7003 from the outside and implement extensions for special
6994 7004 purposes.
6995 7005
6996 7006 Today I got one for inputting PhysicalQuantity objects
6997 7007 (from Scientific) without needing any function calls at
6998 7008 all. Extremely convenient, and it's all done as a user-level
6999 7009 extension (no IPython code was touched). Now instead of:
7000 7010 a = PhysicalQuantity(4.2,'m/s**2')
7001 7011 one can simply say
7002 7012 a = 4.2 m/s**2
7003 7013 or even
7004 7014 a = 4.2 m/s^2
7005 7015
7006 7016 I use this, but it's also a proof of concept: IPython really is
7007 7017 fully user-extensible, even at the level of the parsing of the
7008 7018 command line. It's not trivial, but it's perfectly doable.
7009 7019
7010 7020 * Added 'add_flip' method to inclusion conflict resolver. Fixes
7011 7021 the problem of modules being loaded in the inverse order in which
7012 7022 they were defined in
7013 7023
7014 7024 * Version 0.1.8 released, 0.1.9 opened for further work.
7015 7025
7016 7026 * Added magics pdef, source and file. They respectively show the
7017 7027 definition line ('prototype' in C), source code and full python
7018 7028 file for any callable object. The object inspector oinfo uses
7019 7029 these to show the same information.
7020 7030
7021 7031 * Version 0.1.7 released, 0.1.8 opened for further work.
7022 7032
7023 7033 * Separated all the magic functions into a class called Magic. The
7024 7034 InteractiveShell class was becoming too big for Xemacs to handle
7025 7035 (de-indenting a line would lock it up for 10 seconds while it
7026 7036 backtracked on the whole class!)
7027 7037
7028 7038 FIXME: didn't work. It can be done, but right now namespaces are
7029 7039 all messed up. Do it later (reverted it for now, so at least
7030 7040 everything works as before).
7031 7041
7032 7042 * Got the object introspection system (magic_oinfo) working! I
7033 7043 think this is pretty much ready for release to Janko, so he can
7034 7044 test it for a while and then announce it. Pretty much 100% of what
7035 7045 I wanted for the 'phase 1' release is ready. Happy, tired.
7036 7046
7037 7047 2001-11-12 Fernando Perez <fperez@colorado.edu>
7038 7048
7039 7049 * Version 0.1.6 released, 0.1.7 opened for further work.
7040 7050
7041 7051 * Fixed bug in printing: it used to test for truth before
7042 7052 printing, so 0 wouldn't print. Now checks for None.
7043 7053
7044 7054 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7045 7055 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7046 7056 reaches by hand into the outputcache. Think of a better way to do
7047 7057 this later.
7048 7058
7049 7059 * Various small fixes thanks to Nathan's comments.
7050 7060
7051 7061 * Changed magic_pprint to magic_Pprint. This way it doesn't
7052 7062 collide with pprint() and the name is consistent with the command
7053 7063 line option.
7054 7064
7055 7065 * Changed prompt counter behavior to be fully like
7056 7066 Mathematica's. That is, even input that doesn't return a result
7057 7067 raises the prompt counter. The old behavior was kind of confusing
7058 7068 (getting the same prompt number several times if the operation
7059 7069 didn't return a result).
7060 7070
7061 7071 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7062 7072
7063 7073 * Fixed -Classic mode (wasn't working anymore).
7064 7074
7065 7075 * Added colored prompts using Nathan's new code. Colors are
7066 7076 currently hardwired, they can be user-configurable. For
7067 7077 developers, they can be chosen in file ipythonlib.py, at the
7068 7078 beginning of the CachedOutput class def.
7069 7079
7070 7080 2001-11-11 Fernando Perez <fperez@colorado.edu>
7071 7081
7072 7082 * Version 0.1.5 released, 0.1.6 opened for further work.
7073 7083
7074 7084 * Changed magic_env to *return* the environment as a dict (not to
7075 7085 print it). This way it prints, but it can also be processed.
7076 7086
7077 7087 * Added Verbose exception reporting to interactive
7078 7088 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7079 7089 traceback. Had to make some changes to the ultraTB file. This is
7080 7090 probably the last 'big' thing in my mental todo list. This ties
7081 7091 in with the next entry:
7082 7092
7083 7093 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7084 7094 has to specify is Plain, Color or Verbose for all exception
7085 7095 handling.
7086 7096
7087 7097 * Removed ShellServices option. All this can really be done via
7088 7098 the magic system. It's easier to extend, cleaner and has automatic
7089 7099 namespace protection and documentation.
7090 7100
7091 7101 2001-11-09 Fernando Perez <fperez@colorado.edu>
7092 7102
7093 7103 * Fixed bug in output cache flushing (missing parameter to
7094 7104 __init__). Other small bugs fixed (found using pychecker).
7095 7105
7096 7106 * Version 0.1.4 opened for bugfixing.
7097 7107
7098 7108 2001-11-07 Fernando Perez <fperez@colorado.edu>
7099 7109
7100 7110 * Version 0.1.3 released, mainly because of the raw_input bug.
7101 7111
7102 7112 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7103 7113 and when testing for whether things were callable, a call could
7104 7114 actually be made to certain functions. They would get called again
7105 7115 once 'really' executed, with a resulting double call. A disaster
7106 7116 in many cases (list.reverse() would never work!).
7107 7117
7108 7118 * Removed prefilter() function, moved its code to raw_input (which
7109 7119 after all was just a near-empty caller for prefilter). This saves
7110 7120 a function call on every prompt, and simplifies the class a tiny bit.
7111 7121
7112 7122 * Fix _ip to __ip name in magic example file.
7113 7123
7114 7124 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7115 7125 work with non-gnu versions of tar.
7116 7126
7117 7127 2001-11-06 Fernando Perez <fperez@colorado.edu>
7118 7128
7119 7129 * Version 0.1.2. Just to keep track of the recent changes.
7120 7130
7121 7131 * Fixed nasty bug in output prompt routine. It used to check 'if
7122 7132 arg != None...'. Problem is, this fails if arg implements a
7123 7133 special comparison (__cmp__) which disallows comparing to
7124 7134 None. Found it when trying to use the PhysicalQuantity module from
7125 7135 ScientificPython.
7126 7136
7127 7137 2001-11-05 Fernando Perez <fperez@colorado.edu>
7128 7138
7129 7139 * Also added dirs. Now the pushd/popd/dirs family functions
7130 7140 basically like the shell, with the added convenience of going home
7131 7141 when called with no args.
7132 7142
7133 7143 * pushd/popd slightly modified to mimic shell behavior more
7134 7144 closely.
7135 7145
7136 7146 * Added env,pushd,popd from ShellServices as magic functions. I
7137 7147 think the cleanest will be to port all desired functions from
7138 7148 ShellServices as magics and remove ShellServices altogether. This
7139 7149 will provide a single, clean way of adding functionality
7140 7150 (shell-type or otherwise) to IP.
7141 7151
7142 7152 2001-11-04 Fernando Perez <fperez@colorado.edu>
7143 7153
7144 7154 * Added .ipython/ directory to sys.path. This way users can keep
7145 7155 customizations there and access them via import.
7146 7156
7147 7157 2001-11-03 Fernando Perez <fperez@colorado.edu>
7148 7158
7149 7159 * Opened version 0.1.1 for new changes.
7150 7160
7151 7161 * Changed version number to 0.1.0: first 'public' release, sent to
7152 7162 Nathan and Janko.
7153 7163
7154 7164 * Lots of small fixes and tweaks.
7155 7165
7156 7166 * Minor changes to whos format. Now strings are shown, snipped if
7157 7167 too long.
7158 7168
7159 7169 * Changed ShellServices to work on __main__ so they show up in @who
7160 7170
7161 7171 * Help also works with ? at the end of a line:
7162 7172 ?sin and sin?
7163 7173 both produce the same effect. This is nice, as often I use the
7164 7174 tab-complete to find the name of a method, but I used to then have
7165 7175 to go to the beginning of the line to put a ? if I wanted more
7166 7176 info. Now I can just add the ? and hit return. Convenient.
7167 7177
7168 7178 2001-11-02 Fernando Perez <fperez@colorado.edu>
7169 7179
7170 7180 * Python version check (>=2.1) added.
7171 7181
7172 7182 * Added LazyPython documentation. At this point the docs are quite
7173 7183 a mess. A cleanup is in order.
7174 7184
7175 7185 * Auto-installer created. For some bizarre reason, the zipfiles
7176 7186 module isn't working on my system. So I made a tar version
7177 7187 (hopefully the command line options in various systems won't kill
7178 7188 me).
7179 7189
7180 7190 * Fixes to Struct in genutils. Now all dictionary-like methods are
7181 7191 protected (reasonably).
7182 7192
7183 7193 * Added pager function to genutils and changed ? to print usage
7184 7194 note through it (it was too long).
7185 7195
7186 7196 * Added the LazyPython functionality. Works great! I changed the
7187 7197 auto-quote escape to ';', it's on home row and next to '. But
7188 7198 both auto-quote and auto-paren (still /) escapes are command-line
7189 7199 parameters.
7190 7200
7191 7201
7192 7202 2001-11-01 Fernando Perez <fperez@colorado.edu>
7193 7203
7194 7204 * Version changed to 0.0.7. Fairly large change: configuration now
7195 7205 is all stored in a directory, by default .ipython. There, all
7196 7206 config files have normal looking names (not .names)
7197 7207
7198 7208 * Version 0.0.6 Released first to Lucas and Archie as a test
7199 7209 run. Since it's the first 'semi-public' release, change version to
7200 7210 > 0.0.6 for any changes now.
7201 7211
7202 7212 * Stuff I had put in the ipplib.py changelog:
7203 7213
7204 7214 Changes to InteractiveShell:
7205 7215
7206 7216 - Made the usage message a parameter.
7207 7217
7208 7218 - Require the name of the shell variable to be given. It's a bit
7209 7219 of a hack, but allows the name 'shell' not to be hardwired in the
7210 7220 magic (@) handler, which is problematic b/c it requires
7211 7221 polluting the global namespace with 'shell'. This in turn is
7212 7222 fragile: if a user redefines a variable called shell, things
7213 7223 break.
7214 7224
7215 7225 - magic @: all functions available through @ need to be defined
7216 7226 as magic_<name>, even though they can be called simply as
7217 7227 @<name>. This allows the special command @magic to gather
7218 7228 information automatically about all existing magic functions,
7219 7229 even if they are run-time user extensions, by parsing the shell
7220 7230 instance __dict__ looking for special magic_ names.
7221 7231
7222 7232 - mainloop: added *two* local namespace parameters. This allows
7223 7233 the class to differentiate between parameters which were there
7224 7234 before and after command line initialization was processed. This
7225 7235 way, later @who can show things loaded at startup by the
7226 7236 user. This trick was necessary to make session saving/reloading
7227 7237 really work: ideally after saving/exiting/reloading a session,
7228 7238 *everything* should look the same, including the output of @who. I
7229 7239 was only able to make this work with this double namespace
7230 7240 trick.
7231 7241
7232 7242 - added a header to the logfile which allows (almost) full
7233 7243 session restoring.
7234 7244
7235 7245 - prepend lines beginning with @ or !, with a and log
7236 7246 them. Why? !lines: may be useful to know what you did @lines:
7237 7247 they may affect session state. So when restoring a session, at
7238 7248 least inform the user of their presence. I couldn't quite get
7239 7249 them to properly re-execute, but at least the user is warned.
7240 7250
7241 7251 * Started ChangeLog.
@@ -1,94 +1,96 b''
1 1 #!/bin/sh
2 2 # IPython release script
3 3
4 4 PYVER=`python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}' `
5 5 version=`ipython -Version`
6 6 ipdir=~/ipython/ipython
7 7
8 8 echo
9 9 echo "Releasing IPython version $version"
10 10 echo "=================================="
11 11
12 12 echo "Marking ChangeLog with release information and making NEWS file..."
13 13
14 14 # Stamp changelog and save a copy of the status at each version, in case later
15 15 # we want the NEWS file to start from a point before the very last release (if
16 16 # very small interim releases have no significant changes).
17 17
18 18 cd $ipdir/doc
19 19 cp ChangeLog ChangeLog.old
20 20 cp ChangeLog ChangeLog.$version
21 21 daystamp=`date +%Y-%m-%d`
22 22 echo $daystamp " ***" Released version $version > ChangeLog
23 23 echo >> ChangeLog
24 24 cat ChangeLog.old >> ChangeLog
25 25 rm ChangeLog.old
26 26
27 27 # Build NEWS file
28 28 echo "Changes between the last two releases (major or minor)" > NEWS
29 29 echo "Note that this is an auto-generated diff of the ChangeLogs" >> NEWS
30 30 echo >> NEWS
31 31 diff ChangeLog.previous ChangeLog | grep -v '^0a' | sed 's/^> //g' >> NEWS
32 32 cp ChangeLog ChangeLog.previous
33 33
34 34 # Clean up build/dist directories
35 35 rm -rf $ipdir/build/*
36 36 rm -rf $ipdir/dist/*
37 37
38 38 # Perform local backup
39 39 cd $ipdir/tools
40 40 ./bkp.sh
41 41
42 42 # Build source and binary distros
43 43 cd $ipdir
44 44 ./setup.py sdist --formats=gztar
45 45
46 46 # Build version-specific RPMs, where we must use the --python option to ensure
47 47 # that the resulting RPM is really built with the requested python version (so
48 48 # things go to lib/python2.X/...)
49 49 python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4
50 python2.5 ./setup.py bdist_rpm --binary-only --release=py25 --python=/usr/bin/python2.5
50 51
51 # Build egg
52 ./eggsetup.py bdist_egg
52 # Build eggs
53 python2.4 ./eggsetup.py bdist_egg
54 python2.5 ./eggsetup.py bdist_egg
53 55
54 56 # Call the windows build separately, so that the extra Windows scripts don't
55 57 # get pulled into Unix builds (setup.py has code which checks for
56 58 # bdist_wininst)
57 59 ./setup.py bdist_wininst --install-script=ipython_win_post_install.py
58 60
59 61 # Register with the Python Package Index (PyPI)
60 62 echo "Registering with PyPI..."
61 63 cd $ipdir
62 64 ./setup.py register
63 65
64 66 # Upload all files
65 67 cd $ipdir/dist
66 68 echo "Uploading distribution files..."
67 69 scp * ipython@ipython.scipy.org:www/dist/
68 70
69 71 echo "Uploading backup files..."
70 72 cd ~/ipython/backup
71 73 scp `ls -1tr | tail -1` ipython@ipython.scipy.org:www/backup/
72 74
73 75 echo "Updating webpage..."
74 76 cd $ipdir/doc
75 77 www=~/ipython/homepage
76 78 cp ChangeLog NEWS $www
77 79 rm -rf $www/doc/*
78 80 cp -r manual.pdf manual/ $www/doc
79 81 cd $www
80 82 ./update
81 83
82 84 # Alert package maintainers
83 85 echo "Alerting package maintainers..."
84 86 maintainers='fperez@colorado.edu ariciputi@users.sourceforge.net jack@xiph.org tretkowski@inittab.de dryice@hotpop.com willmaier@ml1.net'
85 87 #maintainers='fperez@colorado.edu'
86 88
87 89 for email in $maintainers
88 90 do
89 91 echo "Emailing $email..."
90 92 mail -s "[Package maintainer notice] A new IPython is out. Version: $version" \
91 93 $email < NEWS
92 94 done
93 95
94 96 echo "Done!"
@@ -1,29 +1,25 b''
1 1 #!/bin/sh
2 2
3 3 # release test
4 4
5 5 # clean up build/dist directories
6 6 rm -rf ~/ipython/ipython/build/*
7 7 rm -rf ~/ipython/ipython/dist/*
8 8
9 9 # build source distros
10 10 cd ~/ipython/ipython
11 11
12 12 ./setup.py sdist --formats=gztar
13 13
14 # Build rpm
15 #python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4
14 # Build rpms
15 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
16 17
17 18 # Build eggs
18 ./eggsetup.py bdist_egg
19 python2.4 ./eggsetup.py bdist_egg
20 python2.5 ./eggsetup.py bdist_egg
19 21
20 22 # Call the windows build separately, so that the extra Windows scripts don't
21 23 # get pulled into Unix builds (setup.py has code which checks for
22 24 # bdist_wininst)
23
24 # For now, make the win32 installer with a hand-built 2.3.5 python, which is
25 # the only one that fixes a crash in the post-install phase.
26 #$HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \
27 # --install-script=ipython_win_post_install.py
28
29 25 ./setup.py bdist_wininst --install-script=ipython_win_post_install.py
General Comments 0
You need to be logged in to leave comments. Login now