Show More
@@ -1,483 +1,486 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """Tools for inspecting Python objects. |
|
3 | 3 | |
|
4 | 4 | Uses syntax highlighting for presenting the various information elements. |
|
5 | 5 | |
|
6 | 6 | Similar in spirit to the inspect module, but all calls take a name argument to |
|
7 | 7 | reference the name under which an object is being read. |
|
8 | 8 | |
|
9 |
$Id: OInspect.py 13 |
|
|
9 | $Id: OInspect.py 1329 2006-05-26 07:52:45Z fperez $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
|
13 | 13 | # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu> |
|
14 | 14 | # |
|
15 | 15 | # Distributed under the terms of the BSD License. The full license is in |
|
16 | 16 | # the file COPYING, distributed as part of this software. |
|
17 | 17 | #***************************************************************************** |
|
18 | 18 | |
|
19 | 19 | from IPython import Release |
|
20 | 20 | __author__ = '%s <%s>' % Release.authors['Fernando'] |
|
21 | 21 | __license__ = Release.license |
|
22 | 22 | |
|
23 | 23 | __all__ = ['Inspector','InspectColors'] |
|
24 | 24 | |
|
25 | 25 | # stdlib modules |
|
26 | 26 | import __builtin__ |
|
27 | 27 | import inspect |
|
28 | 28 | import linecache |
|
29 | 29 | import string |
|
30 | 30 | import StringIO |
|
31 | 31 | import types |
|
32 | 32 | import os |
|
33 | 33 | # IPython's own |
|
34 | 34 | from IPython import PyColorize |
|
35 | 35 | from IPython.genutils import page,indent,Term,mkdict |
|
36 | 36 | from IPython.Itpl import itpl |
|
37 | 37 | from IPython.wildcard import list_namespace |
|
38 | 38 | from IPython.ColorANSI import * |
|
39 | 39 | |
|
40 | 40 | #**************************************************************************** |
|
41 | 41 | # Builtin color schemes |
|
42 | 42 | |
|
43 | 43 | Colors = TermColors # just a shorthand |
|
44 | 44 | |
|
45 | 45 | # Build a few color schemes |
|
46 | 46 | NoColor = ColorScheme( |
|
47 | 47 | 'NoColor',{ |
|
48 | 48 | 'header' : Colors.NoColor, |
|
49 | 49 | 'normal' : Colors.NoColor # color off (usu. Colors.Normal) |
|
50 | 50 | } ) |
|
51 | 51 | |
|
52 | 52 | LinuxColors = ColorScheme( |
|
53 | 53 | 'Linux',{ |
|
54 | 54 | 'header' : Colors.LightRed, |
|
55 | 55 | 'normal' : Colors.Normal # color off (usu. Colors.Normal) |
|
56 | 56 | } ) |
|
57 | 57 | |
|
58 | 58 | LightBGColors = ColorScheme( |
|
59 | 59 | 'LightBG',{ |
|
60 | 60 | 'header' : Colors.Red, |
|
61 | 61 | 'normal' : Colors.Normal # color off (usu. Colors.Normal) |
|
62 | 62 | } ) |
|
63 | 63 | |
|
64 | 64 | # Build table of color schemes (needed by the parser) |
|
65 | 65 | InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors], |
|
66 | 66 | 'Linux') |
|
67 | 67 | |
|
68 | 68 | #**************************************************************************** |
|
69 | 69 | # Auxiliary functions |
|
70 | 70 | def getdoc(obj): |
|
71 | 71 | """Stable wrapper around inspect.getdoc. |
|
72 | 72 | |
|
73 | 73 | This can't crash because of attribute problems. |
|
74 | 74 | |
|
75 | 75 | It also attempts to call a getdoc() method on the given object. This |
|
76 | 76 | allows objects which provide their docstrings via non-standard mechanisms |
|
77 | 77 | (like Pyro proxies) to still be inspected by ipython's ? system.""" |
|
78 | 78 | |
|
79 | 79 | ds = None # default return value |
|
80 | 80 | try: |
|
81 | 81 | ds = inspect.getdoc(obj) |
|
82 | 82 | except: |
|
83 | 83 | # Harden against an inspect failure, which can occur with |
|
84 | 84 | # SWIG-wrapped extensions. |
|
85 | 85 | pass |
|
86 | 86 | # Allow objects to offer customized documentation via a getdoc method: |
|
87 | 87 | try: |
|
88 | 88 | ds2 = obj.getdoc() |
|
89 | 89 | except: |
|
90 | 90 | pass |
|
91 | 91 | else: |
|
92 | 92 | # if we get extra info, we add it to the normal docstring. |
|
93 | 93 | if ds is None: |
|
94 | 94 | ds = ds2 |
|
95 | 95 | else: |
|
96 | 96 | ds = '%s\n%s' % (ds,ds2) |
|
97 | 97 | return ds |
|
98 | 98 | |
|
99 | 99 | #**************************************************************************** |
|
100 | 100 | # Class definitions |
|
101 | 101 | |
|
102 | 102 | class myStringIO(StringIO.StringIO): |
|
103 | 103 | """Adds a writeln method to normal StringIO.""" |
|
104 | 104 | def writeln(self,*arg,**kw): |
|
105 | 105 | """Does a write() and then a write('\n')""" |
|
106 | 106 | self.write(*arg,**kw) |
|
107 | 107 | self.write('\n') |
|
108 | 108 | |
|
109 | 109 | class Inspector: |
|
110 |
def __init__(self,color_table,code_color_table,scheme |
|
|
110 | def __init__(self,color_table,code_color_table,scheme, | |
|
111 | str_detail_level=0): | |
|
111 | 112 | self.color_table = color_table |
|
112 | 113 | self.parser = PyColorize.Parser(code_color_table,out='str') |
|
113 | 114 | self.format = self.parser.format |
|
115 | self.str_detail_level = str_detail_level | |
|
114 | 116 | self.set_active_scheme(scheme) |
|
115 | 117 | |
|
116 | 118 | def __getargspec(self,obj): |
|
117 | 119 | """Get the names and default values of a function's arguments. |
|
118 | 120 | |
|
119 | 121 | A tuple of four things is returned: (args, varargs, varkw, defaults). |
|
120 | 122 | 'args' is a list of the argument names (it may contain nested lists). |
|
121 | 123 | 'varargs' and 'varkw' are the names of the * and ** arguments or None. |
|
122 | 124 | 'defaults' is an n-tuple of the default values of the last n arguments. |
|
123 | 125 | |
|
124 | 126 | Modified version of inspect.getargspec from the Python Standard |
|
125 | 127 | Library.""" |
|
126 | 128 | |
|
127 | 129 | if inspect.isfunction(obj): |
|
128 | 130 | func_obj = obj |
|
129 | 131 | elif inspect.ismethod(obj): |
|
130 | 132 | func_obj = obj.im_func |
|
131 | 133 | else: |
|
132 | 134 | raise TypeError, 'arg is not a Python function' |
|
133 | 135 | args, varargs, varkw = inspect.getargs(func_obj.func_code) |
|
134 | 136 | return args, varargs, varkw, func_obj.func_defaults |
|
135 | 137 | |
|
136 | 138 | def __getdef(self,obj,oname=''): |
|
137 | 139 | """Return the definition header for any callable object. |
|
138 | 140 | |
|
139 | 141 | If any exception is generated, None is returned instead and the |
|
140 | 142 | exception is suppressed.""" |
|
141 | 143 | |
|
142 | 144 | try: |
|
143 | 145 | return oname + inspect.formatargspec(*self.__getargspec(obj)) |
|
144 | 146 | except: |
|
145 | 147 | return None |
|
146 | 148 | |
|
147 | 149 | def __head(self,h): |
|
148 | 150 | """Return a header string with proper colors.""" |
|
149 | 151 | return '%s%s%s' % (self.color_table.active_colors.header,h, |
|
150 | 152 | self.color_table.active_colors.normal) |
|
151 | 153 | |
|
152 | 154 | def set_active_scheme(self,scheme): |
|
153 | 155 | self.color_table.set_active_scheme(scheme) |
|
154 | 156 | self.parser.color_table.set_active_scheme(scheme) |
|
155 | 157 | |
|
156 | 158 | def noinfo(self,msg,oname): |
|
157 | 159 | """Generic message when no information is found.""" |
|
158 | 160 | print 'No %s found' % msg, |
|
159 | 161 | if oname: |
|
160 | 162 | print 'for %s' % oname |
|
161 | 163 | else: |
|
162 | 164 | |
|
163 | 165 | |
|
164 | 166 | def pdef(self,obj,oname=''): |
|
165 | 167 | """Print the definition header for any callable object. |
|
166 | 168 | |
|
167 | 169 | If the object is a class, print the constructor information.""" |
|
168 | 170 | |
|
169 | 171 | if not callable(obj): |
|
170 | 172 | print 'Object is not callable.' |
|
171 | 173 | return |
|
172 | 174 | |
|
173 | 175 | header = '' |
|
174 | 176 | if type(obj) is types.ClassType: |
|
175 | 177 | header = self.__head('Class constructor information:\n') |
|
176 | 178 | obj = obj.__init__ |
|
177 | 179 | elif type(obj) is types.InstanceType: |
|
178 | 180 | obj = obj.__call__ |
|
179 | 181 | |
|
180 | 182 | output = self.__getdef(obj,oname) |
|
181 | 183 | if output is None: |
|
182 | 184 | self.noinfo('definition header',oname) |
|
183 | 185 | else: |
|
184 | 186 | print >>Term.cout, header,self.format(output), |
|
185 | 187 | |
|
186 | 188 | def pdoc(self,obj,oname='',formatter = None): |
|
187 | 189 | """Print the docstring for any object. |
|
188 | 190 | |
|
189 | 191 | Optional: |
|
190 | 192 | -formatter: a function to run the docstring through for specially |
|
191 | 193 | formatted docstrings.""" |
|
192 | 194 | |
|
193 | 195 | head = self.__head # so that itpl can find it even if private |
|
194 | 196 | ds = getdoc(obj) |
|
195 | 197 | if formatter: |
|
196 | 198 | ds = formatter(ds) |
|
197 | 199 | if type(obj) is types.ClassType: |
|
198 | 200 | init_ds = getdoc(obj.__init__) |
|
199 | 201 | output = itpl('$head("Class Docstring:")\n' |
|
200 | 202 | '$indent(ds)\n' |
|
201 | 203 | '$head("Constructor Docstring"):\n' |
|
202 | 204 | '$indent(init_ds)') |
|
203 | 205 | elif type(obj) is types.InstanceType and hasattr(obj,'__call__'): |
|
204 | 206 | call_ds = getdoc(obj.__call__) |
|
205 | 207 | if call_ds: |
|
206 | 208 | output = itpl('$head("Class Docstring:")\n$indent(ds)\n' |
|
207 | 209 | '$head("Calling Docstring:")\n$indent(call_ds)') |
|
208 | 210 | else: |
|
209 | 211 | output = ds |
|
210 | 212 | else: |
|
211 | 213 | output = ds |
|
212 | 214 | if output is None: |
|
213 | 215 | self.noinfo('documentation',oname) |
|
214 | 216 | return |
|
215 | 217 | page(output) |
|
216 | 218 | |
|
217 | 219 | def psource(self,obj,oname=''): |
|
218 | 220 | """Print the source code for an object.""" |
|
219 | 221 | |
|
220 | 222 | # Flush the source cache because inspect can return out-of-date source |
|
221 | 223 | linecache.checkcache() |
|
222 | 224 | try: |
|
223 | 225 | src = inspect.getsource(obj) |
|
224 | 226 | except: |
|
225 | 227 | self.noinfo('source',oname) |
|
226 | 228 | else: |
|
227 | 229 | page(self.format(src)) |
|
228 | 230 | |
|
229 | 231 | def pfile(self,obj,oname=''): |
|
230 | 232 | """Show the whole file where an object was defined.""" |
|
231 | 233 | try: |
|
232 | 234 | sourcelines,lineno = inspect.getsourcelines(obj) |
|
233 | 235 | except: |
|
234 | 236 | self.noinfo('file',oname) |
|
235 | 237 | else: |
|
236 | 238 | # run contents of file through pager starting at line |
|
237 | 239 | # where the object is defined |
|
238 | 240 | ofile = inspect.getabsfile(obj) |
|
239 | 241 | |
|
240 | 242 | if (ofile.endswith('.so') or ofile.endswith('.dll')): |
|
241 | 243 | print 'File %r is binary, not printing.' % ofile |
|
242 | 244 | elif not os.path.isfile(ofile): |
|
243 | 245 | print 'File %r does not exist, not printing.' % ofile |
|
244 | 246 | else: |
|
245 | 247 | # Print only text files, not extension binaries. |
|
246 | 248 | page(self.format(open(ofile).read()),lineno) |
|
247 | 249 | #page(self.format(open(inspect.getabsfile(obj)).read()),lineno) |
|
248 | 250 | |
|
249 | 251 | def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0): |
|
250 | 252 | """Show detailed information about an object. |
|
251 | 253 | |
|
252 | 254 | Optional arguments: |
|
253 | 255 | |
|
254 | 256 | - oname: name of the variable pointing to the object. |
|
255 | 257 | |
|
256 | 258 | - formatter: special formatter for docstrings (see pdoc) |
|
257 | 259 | |
|
258 | 260 | - info: a structure with some information fields which may have been |
|
259 | 261 | precomputed already. |
|
260 | 262 | |
|
261 | 263 | - detail_level: if set to 1, more information is given. |
|
262 | 264 | """ |
|
263 | 265 | |
|
264 | 266 | obj_type = type(obj) |
|
265 | 267 | |
|
266 | 268 | header = self.__head |
|
267 | 269 | if info is None: |
|
268 | 270 | ismagic = 0 |
|
269 | 271 | isalias = 0 |
|
270 | 272 | ospace = '' |
|
271 | 273 | else: |
|
272 | 274 | ismagic = info.ismagic |
|
273 | 275 | isalias = info.isalias |
|
274 | 276 | ospace = info.namespace |
|
275 | 277 | # Get docstring, special-casing aliases: |
|
276 | 278 | if isalias: |
|
277 | 279 | ds = "Alias to the system command:\n %s" % obj[1] |
|
278 | 280 | else: |
|
279 | 281 | ds = getdoc(obj) |
|
280 | 282 | if ds is None: |
|
281 | 283 | ds = '<no docstring>' |
|
282 | 284 | if formatter is not None: |
|
283 | 285 | ds = formatter(ds) |
|
284 | 286 | |
|
285 | 287 | # store output in a list which gets joined with \n at the end. |
|
286 | 288 | out = myStringIO() |
|
287 | 289 | |
|
288 | 290 | string_max = 200 # max size of strings to show (snipped if longer) |
|
289 | 291 | shalf = int((string_max -5)/2) |
|
290 | 292 | |
|
291 | 293 | if ismagic: |
|
292 | 294 | obj_type_name = 'Magic function' |
|
293 | 295 | elif isalias: |
|
294 | 296 | obj_type_name = 'System alias' |
|
295 | 297 | else: |
|
296 | 298 | obj_type_name = obj_type.__name__ |
|
297 | 299 | out.writeln(header('Type:\t\t')+obj_type_name) |
|
298 | 300 | |
|
299 | 301 | try: |
|
300 | 302 | bclass = obj.__class__ |
|
301 | 303 | out.writeln(header('Base Class:\t')+str(bclass)) |
|
302 | 304 | except: pass |
|
303 | 305 | |
|
304 | 306 | # String form, but snip if too long in ? form (full in ??) |
|
307 | if detail_level >= self.str_detail_level: | |
|
305 | 308 | try: |
|
306 | 309 | ostr = str(obj) |
|
307 | 310 | str_head = 'String Form:' |
|
308 | 311 | if not detail_level and len(ostr)>string_max: |
|
309 | 312 | ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:] |
|
310 | 313 | ostr = ("\n" + " " * len(str_head.expandtabs())).\ |
|
311 | 314 | join(map(string.strip,ostr.split("\n"))) |
|
312 | 315 | if ostr.find('\n') > -1: |
|
313 | 316 | # Print multi-line strings starting at the next line. |
|
314 | 317 | str_sep = '\n' |
|
315 | 318 | else: |
|
316 | 319 | str_sep = '\t' |
|
317 | 320 | out.writeln("%s%s%s" % (header(str_head),str_sep,ostr)) |
|
318 | 321 | except: |
|
319 | 322 | pass |
|
320 | 323 | |
|
321 | 324 | if ospace: |
|
322 | 325 | out.writeln(header('Namespace:\t')+ospace) |
|
323 | 326 | |
|
324 | 327 | # Length (for strings and lists) |
|
325 | 328 | try: |
|
326 | 329 | length = str(len(obj)) |
|
327 | 330 | out.writeln(header('Length:\t\t')+length) |
|
328 | 331 | except: pass |
|
329 | 332 | |
|
330 | 333 | # Filename where object was defined |
|
331 | 334 | binary_file = False |
|
332 | 335 | try: |
|
333 | 336 | fname = inspect.getabsfile(obj) |
|
334 | 337 | if fname.endswith('<string>'): |
|
335 | 338 | fname = 'Dynamically generated function. No source code available.' |
|
336 | 339 | if (fname.endswith('.so') or fname.endswith('.dll') or |
|
337 | 340 | not os.path.isfile(fname)): |
|
338 | 341 | binary_file = True |
|
339 | 342 | out.writeln(header('File:\t\t')+fname) |
|
340 | 343 | except: |
|
341 | 344 | # if anything goes wrong, we don't want to show source, so it's as |
|
342 | 345 | # if the file was binary |
|
343 | 346 | binary_file = True |
|
344 | 347 | |
|
345 | 348 | # reconstruct the function definition and print it: |
|
346 | 349 | defln = self.__getdef(obj,oname) |
|
347 | 350 | if defln: |
|
348 | 351 | out.write(header('Definition:\t')+self.format(defln)) |
|
349 | 352 | |
|
350 | 353 | # Docstrings only in detail 0 mode, since source contains them (we |
|
351 | 354 | # avoid repetitions). If source fails, we add them back, see below. |
|
352 | 355 | if ds and detail_level == 0: |
|
353 | 356 | out.writeln(header('Docstring:\n') + indent(ds)) |
|
354 | 357 | |
|
355 | 358 | |
|
356 | 359 | # Original source code for any callable |
|
357 | 360 | if detail_level: |
|
358 | 361 | # Flush the source cache because inspect can return out-of-date source |
|
359 | 362 | linecache.checkcache() |
|
360 | 363 | source_success = False |
|
361 | 364 | try: |
|
362 | 365 | if not binary_file: |
|
363 | 366 | source = self.format(inspect.getsource(obj)) |
|
364 | 367 | out.write(header('Source:\n')+source.rstrip()) |
|
365 | 368 | source_success = True |
|
366 | 369 | except: |
|
367 | 370 | pass |
|
368 | 371 | |
|
369 | 372 | if ds and not source_success: |
|
370 | 373 | out.writeln(header('Docstring [source file open failed]:\n') + indent(ds)) |
|
371 | 374 | |
|
372 | 375 | # Constructor docstring for classes |
|
373 | 376 | if obj_type is types.ClassType: |
|
374 | 377 | # reconstruct the function definition and print it: |
|
375 | 378 | try: |
|
376 | 379 | obj_init = obj.__init__ |
|
377 | 380 | except AttributeError: |
|
378 | 381 | init_def = init_ds = None |
|
379 | 382 | else: |
|
380 | 383 | init_def = self.__getdef(obj_init,oname) |
|
381 | 384 | init_ds = getdoc(obj_init) |
|
382 | 385 | |
|
383 | 386 | if init_def or init_ds: |
|
384 | 387 | out.writeln(header('\nConstructor information:')) |
|
385 | 388 | if init_def: |
|
386 | 389 | out.write(header('Definition:\t')+ self.format(init_def)) |
|
387 | 390 | if init_ds: |
|
388 | 391 | out.writeln(header('Docstring:\n') + indent(init_ds)) |
|
389 | 392 | # and class docstring for instances: |
|
390 | 393 | elif obj_type is types.InstanceType: |
|
391 | 394 | |
|
392 | 395 | # First, check whether the instance docstring is identical to the |
|
393 | 396 | # class one, and print it separately if they don't coincide. In |
|
394 | 397 | # most cases they will, but it's nice to print all the info for |
|
395 | 398 | # objects which use instance-customized docstrings. |
|
396 | 399 | if ds: |
|
397 | 400 | class_ds = getdoc(obj.__class__) |
|
398 | 401 | if class_ds and ds != class_ds: |
|
399 | 402 | out.writeln(header('Class Docstring:\n') + |
|
400 | 403 | indent(class_ds)) |
|
401 | 404 | |
|
402 | 405 | # Next, try to show constructor docstrings |
|
403 | 406 | try: |
|
404 | 407 | init_ds = getdoc(obj.__init__) |
|
405 | 408 | except AttributeError: |
|
406 | 409 | init_ds = None |
|
407 | 410 | if init_ds: |
|
408 | 411 | out.writeln(header('Constructor Docstring:\n') + |
|
409 | 412 | indent(init_ds)) |
|
410 | 413 | |
|
411 | 414 | # Call form docstring for callable instances |
|
412 | 415 | if hasattr(obj,'__call__'): |
|
413 | 416 | out.writeln(header('Callable:\t')+'Yes') |
|
414 | 417 | call_def = self.__getdef(obj.__call__,oname) |
|
415 | 418 | if call_def is None: |
|
416 | 419 | out.write(header('Call def:\t')+ |
|
417 | 420 | 'Calling definition not available.') |
|
418 | 421 | else: |
|
419 | 422 | out.write(header('Call def:\t')+self.format(call_def)) |
|
420 | 423 | call_ds = getdoc(obj.__call__) |
|
421 | 424 | if call_ds: |
|
422 | 425 | out.writeln(header('Call docstring:\n') + indent(call_ds)) |
|
423 | 426 | |
|
424 | 427 | # Finally send to printer/pager |
|
425 | 428 | output = out.getvalue() |
|
426 | 429 | if output: |
|
427 | 430 | page(output) |
|
428 | 431 | # end pinfo |
|
429 | 432 | |
|
430 | 433 | def psearch(self,pattern,ns_table,ns_search=[], |
|
431 | 434 | ignore_case=False,show_all=False): |
|
432 | 435 | """Search namespaces with wildcards for objects. |
|
433 | 436 | |
|
434 | 437 | Arguments: |
|
435 | 438 | |
|
436 | 439 | - pattern: string containing shell-like wildcards to use in namespace |
|
437 | 440 | searches and optionally a type specification to narrow the search to |
|
438 | 441 | objects of that type. |
|
439 | 442 | |
|
440 | 443 | - ns_table: dict of name->namespaces for search. |
|
441 | 444 | |
|
442 | 445 | Optional arguments: |
|
443 | 446 | |
|
444 | 447 | - ns_search: list of namespace names to include in search. |
|
445 | 448 | |
|
446 | 449 | - ignore_case(False): make the search case-insensitive. |
|
447 | 450 | |
|
448 | 451 | - show_all(False): show all names, including those starting with |
|
449 | 452 | underscores. |
|
450 | 453 | """ |
|
451 | 454 | # defaults |
|
452 | 455 | type_pattern = 'all' |
|
453 | 456 | filter = '' |
|
454 | 457 | |
|
455 | 458 | cmds = pattern.split() |
|
456 | 459 | len_cmds = len(cmds) |
|
457 | 460 | if len_cmds == 1: |
|
458 | 461 | # Only filter pattern given |
|
459 | 462 | filter = cmds[0] |
|
460 | 463 | elif len_cmds == 2: |
|
461 | 464 | # Both filter and type specified |
|
462 | 465 | filter,type_pattern = cmds |
|
463 | 466 | else: |
|
464 | 467 | raise ValueError('invalid argument string for psearch: <%s>' % |
|
465 | 468 | pattern) |
|
466 | 469 | |
|
467 | 470 | # filter search namespaces |
|
468 | 471 | for name in ns_search: |
|
469 | 472 | if name not in ns_table: |
|
470 | 473 | raise ValueError('invalid namespace <%s>. Valid names: %s' % |
|
471 | 474 | (name,ns_table.keys())) |
|
472 | 475 | |
|
473 | 476 | #print 'type_pattern:',type_pattern # dbg |
|
474 | 477 | search_result = [] |
|
475 | 478 | for ns_name in ns_search: |
|
476 | 479 | ns = ns_table[ns_name] |
|
477 | 480 | tmp_res = list(list_namespace(ns,type_pattern,filter, |
|
478 | 481 | ignore_case=ignore_case, |
|
479 | 482 | show_all=show_all)) |
|
480 | 483 | search_result.extend(tmp_res) |
|
481 | 484 | search_result.sort() |
|
482 | 485 | |
|
483 | 486 | page('\n'.join(search_result)) |
@@ -1,597 +1,607 b'' | |||
|
1 | 1 | # -*- Mode: Shell-Script -*- Not really, but shows comments correctly |
|
2 |
# $Id: ipythonrc 132 |
|
|
2 | # $Id: ipythonrc 1329 2006-05-26 07:52:45Z fperez $ | |
|
3 | 3 | |
|
4 | 4 | #*************************************************************************** |
|
5 | 5 | # |
|
6 | 6 | # Configuration file for IPython -- ipythonrc format |
|
7 | 7 | # |
|
8 | 8 | # The format of this file is simply one of 'key value' lines. |
|
9 | 9 | # Lines containing only whitespace at the beginning and then a # are ignored |
|
10 | 10 | # as comments. But comments can NOT be put on lines with data. |
|
11 | 11 | |
|
12 | 12 | # The meaning and use of each key are explained below. |
|
13 | 13 | |
|
14 | 14 | #--------------------------------------------------------------------------- |
|
15 | 15 | # Section: included files |
|
16 | 16 | |
|
17 | 17 | # Put one or more *config* files (with the syntax of this file) you want to |
|
18 | 18 | # include. For keys with a unique value the outermost file has precedence. For |
|
19 | 19 | # keys with multiple values, they all get assembled into a list which then |
|
20 | 20 | # gets loaded by IPython. |
|
21 | 21 | |
|
22 | 22 | # In this file, all lists of things should simply be space-separated. |
|
23 | 23 | |
|
24 | 24 | # This allows you to build hierarchies of files which recursively load |
|
25 | 25 | # lower-level services. If this is your main ~/.ipython/ipythonrc file, you |
|
26 | 26 | # should only keep here basic things you always want available. Then you can |
|
27 | 27 | # include it in every other special-purpose config file you create. |
|
28 | 28 | include |
|
29 | 29 | |
|
30 | 30 | #--------------------------------------------------------------------------- |
|
31 | 31 | # Section: startup setup |
|
32 | 32 | |
|
33 | 33 | # These are mostly things which parallel a command line option of the same |
|
34 | 34 | # name. |
|
35 | 35 | |
|
36 | 36 | # Keys in this section should only appear once. If any key from this section |
|
37 | 37 | # is encountered more than once, the last value remains, all earlier ones get |
|
38 | 38 | # discarded. |
|
39 | 39 | |
|
40 | 40 | |
|
41 | 41 | # Automatic calling of callable objects. If set to 1 or 2, callable objects |
|
42 | 42 | # are automatically called when invoked at the command line, even if you don't |
|
43 | 43 | # type parentheses. IPython adds the parentheses for you. For example: |
|
44 | 44 | |
|
45 | 45 | #In [1]: str 45 |
|
46 | 46 | #------> str(45) |
|
47 | 47 | #Out[1]: '45' |
|
48 | 48 | |
|
49 | 49 | # IPython reprints your line with '---->' indicating that it added |
|
50 | 50 | # parentheses. While this option is very convenient for interactive use, it |
|
51 | 51 | # may occasionally cause problems with objects which have side-effects if |
|
52 | 52 | # called unexpectedly. |
|
53 | 53 | |
|
54 | 54 | # The valid values for autocall are: |
|
55 | 55 | |
|
56 | 56 | # autocall 0 -> disabled (you can toggle it at runtime with the %autocall magic) |
|
57 | 57 | |
|
58 | 58 | # autocall 1 -> active, but do not apply if there are no arguments on the line. |
|
59 | 59 | |
|
60 | 60 | # In this mode, you get: |
|
61 | 61 | |
|
62 | 62 | #In [1]: callable |
|
63 | 63 | #Out[1]: <built-in function callable> |
|
64 | 64 | |
|
65 | 65 | #In [2]: callable 'hello' |
|
66 | 66 | #------> callable('hello') |
|
67 | 67 | #Out[2]: False |
|
68 | 68 | |
|
69 | 69 | # 2 -> Active always. Even if no arguments are present, the callable object |
|
70 | 70 | # is called: |
|
71 | 71 | |
|
72 | 72 | #In [4]: callable |
|
73 | 73 | #------> callable() |
|
74 | 74 | |
|
75 | 75 | # Note that even with autocall off, you can still use '/' at the start of a |
|
76 | 76 | # line to treat the first argument on the command line as a function and add |
|
77 | 77 | # parentheses to it: |
|
78 | 78 | |
|
79 | 79 | #In [8]: /str 43 |
|
80 | 80 | #------> str(43) |
|
81 | 81 | #Out[8]: '43' |
|
82 | 82 | |
|
83 | 83 | autocall 1 |
|
84 | 84 | |
|
85 | 85 | # Auto-edit syntax errors. When you use the %edit magic in ipython to edit |
|
86 | 86 | # source code (see the 'editor' variable below), it is possible that you save |
|
87 | 87 | # a file with syntax errors in it. If this variable is true, IPython will ask |
|
88 | 88 | # you whether to re-open the editor immediately to correct such an error. |
|
89 | 89 | |
|
90 | 90 | autoedit_syntax 0 |
|
91 | 91 | |
|
92 | 92 | # Auto-indent. IPython can recognize lines ending in ':' and indent the next |
|
93 | 93 | # line, while also un-indenting automatically after 'raise' or 'return'. |
|
94 | 94 | |
|
95 | 95 | # This feature uses the readline library, so it will honor your ~/.inputrc |
|
96 | 96 | # configuration (or whatever file your INPUTRC variable points to). Adding |
|
97 | 97 | # the following lines to your .inputrc file can make indent/unindenting more |
|
98 | 98 | # convenient (M-i indents, M-u unindents): |
|
99 | 99 | |
|
100 | 100 | # $if Python |
|
101 | 101 | # "\M-i": " " |
|
102 | 102 | # "\M-u": "\d\d\d\d" |
|
103 | 103 | # $endif |
|
104 | 104 | |
|
105 | 105 | # The feature is potentially a bit dangerous, because it can cause problems |
|
106 | 106 | # with pasting of indented code (the pasted code gets re-indented on each |
|
107 | 107 | # line). But it's a huge time-saver when working interactively. The magic |
|
108 | 108 | # function %autoindent allows you to toggle it on/off at runtime. |
|
109 | 109 | |
|
110 | 110 | autoindent 1 |
|
111 | 111 | |
|
112 | 112 | # Auto-magic. This gives you access to all the magic functions without having |
|
113 | 113 | # to prepend them with an % sign. If you define a variable with the same name |
|
114 | 114 | # as a magic function (say who=1), you will need to access the magic function |
|
115 | 115 | # with % (%who in this example). However, if later you delete your variable |
|
116 | 116 | # (del who), you'll recover the automagic calling form. |
|
117 | 117 | |
|
118 | 118 | # Considering that many magic functions provide a lot of shell-like |
|
119 | 119 | # functionality, automagic gives you something close to a full Python+system |
|
120 | 120 | # shell environment (and you can extend it further if you want). |
|
121 | 121 | |
|
122 | 122 | automagic 1 |
|
123 | 123 | |
|
124 | 124 | # Size of the output cache. After this many entries are stored, the cache will |
|
125 | 125 | # get flushed. Depending on the size of your intermediate calculations, you |
|
126 | 126 | # may have memory problems if you make it too big, since keeping things in the |
|
127 | 127 | # cache prevents Python from reclaiming the memory for old results. Experiment |
|
128 | 128 | # with a value that works well for you. |
|
129 | 129 | |
|
130 | 130 | # If you choose cache_size 0 IPython will revert to python's regular >>> |
|
131 | 131 | # unnumbered prompt. You will still have _, __ and ___ for your last three |
|
132 | 132 | # results, but that will be it. No dynamic _1, _2, etc. will be created. If |
|
133 | 133 | # you are running on a slow machine or with very limited memory, this may |
|
134 | 134 | # help. |
|
135 | 135 | |
|
136 | 136 | cache_size 1000 |
|
137 | 137 | |
|
138 | 138 | # Classic mode: Setting 'classic 1' you lose many of IPython niceties, |
|
139 | 139 | # but that's your choice! Classic 1 -> same as IPython -classic. |
|
140 | 140 | # Note that this is _not_ the normal python interpreter, it's simply |
|
141 | 141 | # IPython emulating most of the classic interpreter's behavior. |
|
142 | 142 | classic 0 |
|
143 | 143 | |
|
144 | 144 | # colors - Coloring option for prompts and traceback printouts. |
|
145 | 145 | |
|
146 | 146 | # Currently available schemes: NoColor, Linux, LightBG. |
|
147 | 147 | |
|
148 | 148 | # This option allows coloring the prompts and traceback printouts. This |
|
149 | 149 | # requires a terminal which can properly handle color escape sequences. If you |
|
150 | 150 | # are having problems with this, use the NoColor scheme (uses no color escapes |
|
151 | 151 | # at all). |
|
152 | 152 | |
|
153 | 153 | # The Linux option works well in linux console type environments: dark |
|
154 | 154 | # background with light fonts. |
|
155 | 155 | |
|
156 | 156 | # LightBG is similar to Linux but swaps dark/light colors to be more readable |
|
157 | 157 | # in light background terminals. |
|
158 | 158 | |
|
159 | 159 | # keep uncommented only the one you want: |
|
160 | 160 | colors Linux |
|
161 | 161 | #colors LightBG |
|
162 | 162 | #colors NoColor |
|
163 | 163 | |
|
164 | 164 | ######################## |
|
165 | 165 | # Note to Windows users |
|
166 | 166 | # |
|
167 | 167 | # Color and readline support is avaialble to Windows users via Gary Bishop's |
|
168 | 168 | # readline library. You can find Gary's tools at |
|
169 | 169 | # http://sourceforge.net/projects/uncpythontools. |
|
170 | 170 | # Note that his readline module requires in turn the ctypes library, available |
|
171 | 171 | # at http://starship.python.net/crew/theller/ctypes. |
|
172 | 172 | ######################## |
|
173 | 173 | |
|
174 | 174 | # color_info: IPython can display information about objects via a set of |
|
175 | 175 | # functions, and optionally can use colors for this, syntax highlighting |
|
176 | 176 | # source code and various other elements. This information is passed through a |
|
177 | 177 | # pager (it defaults to 'less' if $PAGER is not set). |
|
178 | 178 | |
|
179 | 179 | # If your pager has problems, try to setting it to properly handle escapes |
|
180 | 180 | # (see the less manpage for detail), or disable this option. The magic |
|
181 | 181 | # function %color_info allows you to toggle this interactively for testing. |
|
182 | 182 | |
|
183 | 183 | color_info 1 |
|
184 | 184 | |
|
185 | 185 | # confirm_exit: set to 1 if you want IPython to confirm when you try to exit |
|
186 | 186 | # with an EOF (Control-d in Unix, Control-Z/Enter in Windows). Note that using |
|
187 | 187 | # the magic functions %Exit or %Quit you can force a direct exit, bypassing |
|
188 | 188 | # any confirmation. |
|
189 | 189 | |
|
190 | 190 | confirm_exit 1 |
|
191 | 191 | |
|
192 | 192 | # Use deep_reload() as a substitute for reload() by default. deep_reload() is |
|
193 | 193 | # still available as dreload() and appears as a builtin. |
|
194 | 194 | |
|
195 | 195 | deep_reload 0 |
|
196 | 196 | |
|
197 | 197 | # Which editor to use with the %edit command. If you leave this at 0, IPython |
|
198 | 198 | # will honor your EDITOR environment variable. Since this editor is invoked on |
|
199 | 199 | # the fly by ipython and is meant for editing small code snippets, you may |
|
200 | 200 | # want to use a small, lightweight editor here. |
|
201 | 201 | |
|
202 | 202 | # For Emacs users, setting up your Emacs server properly as described in the |
|
203 | 203 | # manual is a good idea. An alternative is to use jed, a very light editor |
|
204 | 204 | # with much of the feel of Emacs (though not as powerful for heavy-duty work). |
|
205 | 205 | |
|
206 | 206 | editor 0 |
|
207 | 207 | |
|
208 | 208 | # log 1 -> same as ipython -log. This automatically logs to ./ipython.log |
|
209 | 209 | log 0 |
|
210 | 210 | |
|
211 | 211 | # Same as ipython -Logfile YourLogfileName. |
|
212 | 212 | # Don't use with log 1 (use one or the other) |
|
213 | 213 | logfile '' |
|
214 | 214 | |
|
215 | 215 | # banner 0 -> same as ipython -nobanner |
|
216 | 216 | banner 1 |
|
217 | 217 | |
|
218 | 218 | # messages 0 -> same as ipython -nomessages |
|
219 | 219 | messages 1 |
|
220 | 220 | |
|
221 | 221 | # Automatically call the pdb debugger after every uncaught exception. If you |
|
222 | 222 | # are used to debugging using pdb, this puts you automatically inside of it |
|
223 | 223 | # after any call (either in IPython or in code called by it) which triggers an |
|
224 | 224 | # exception which goes uncaught. |
|
225 | 225 | pdb 0 |
|
226 | 226 | |
|
227 | 227 | # Enable the pprint module for printing. pprint tends to give a more readable |
|
228 | 228 | # display (than print) for complex nested data structures. |
|
229 | 229 | pprint 1 |
|
230 | 230 | |
|
231 | 231 | # Prompt strings |
|
232 | 232 | |
|
233 | 233 | # Most bash-like escapes can be used to customize IPython's prompts, as well as |
|
234 | 234 | # a few additional ones which are IPython-specific. All valid prompt escapes |
|
235 | 235 | # are described in detail in the Customization section of the IPython HTML/PDF |
|
236 | 236 | # manual. |
|
237 | 237 | |
|
238 | 238 | # Use \# to represent the current prompt number, and quote them to protect |
|
239 | 239 | # spaces. |
|
240 | 240 | prompt_in1 'In [\#]: ' |
|
241 | 241 | |
|
242 | 242 | # \D is replaced by as many dots as there are digits in the |
|
243 | 243 | # current value of \#. |
|
244 | 244 | prompt_in2 ' .\D.: ' |
|
245 | 245 | |
|
246 | 246 | prompt_out 'Out[\#]: ' |
|
247 | 247 | |
|
248 | 248 | # Select whether to left-pad the output prompts to match the length of the |
|
249 | 249 | # input ones. This allows you for example to use a simple '>' as an output |
|
250 | 250 | # prompt, and yet have the output line up with the input. If set to false, |
|
251 | 251 | # the output prompts will be unpadded (flush left). |
|
252 | 252 | prompts_pad_left 1 |
|
253 | 253 | |
|
254 | 254 | # quick 1 -> same as ipython -quick |
|
255 | 255 | quick 0 |
|
256 | 256 | |
|
257 | 257 | # Use the readline library (1) or not (0). Most users will want this on, but |
|
258 | 258 | # if you experience strange problems with line management (mainly when using |
|
259 | 259 | # IPython inside Emacs buffers) you may try disabling it. Not having it on |
|
260 | 260 | # prevents you from getting command history with the arrow keys, searching and |
|
261 | 261 | # name completion using TAB. |
|
262 | 262 | |
|
263 | 263 | readline 1 |
|
264 | 264 | |
|
265 | 265 | # Screen Length: number of lines of your screen. This is used to control |
|
266 | 266 | # printing of very long strings. Strings longer than this number of lines will |
|
267 | 267 | # be paged with the less command instead of directly printed. |
|
268 | 268 | |
|
269 | 269 | # The default value for this is 0, which means IPython will auto-detect your |
|
270 | 270 | # screen size every time it needs to print. If for some reason this isn't |
|
271 | 271 | # working well (it needs curses support), specify it yourself. Otherwise don't |
|
272 | 272 | # change the default. |
|
273 | 273 | |
|
274 | 274 | screen_length 0 |
|
275 | 275 | |
|
276 | 276 | # Prompt separators for input and output. |
|
277 | 277 | # Use \n for newline explicitly, without quotes. |
|
278 | 278 | # Use 0 (like at the cmd line) to turn off a given separator. |
|
279 | 279 | |
|
280 | 280 | # The structure of prompt printing is: |
|
281 | 281 | # (SeparateIn)Input.... |
|
282 | 282 | # (SeparateOut)Output... |
|
283 | 283 | # (SeparateOut2), # that is, no newline is printed after Out2 |
|
284 | 284 | # By choosing these you can organize your output any way you want. |
|
285 | 285 | |
|
286 | 286 | separate_in \n |
|
287 | 287 | separate_out 0 |
|
288 | 288 | separate_out2 0 |
|
289 | 289 | |
|
290 | 290 | # 'nosep 1' is a shorthand for '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'. |
|
291 | 291 | # Simply removes all input/output separators, overriding the choices above. |
|
292 | 292 | nosep 0 |
|
293 | 293 | |
|
294 | 294 | # Wildcard searches - IPython has a system for searching names using |
|
295 | 295 | # shell-like wildcards; type %psearch? for details. This variables sets |
|
296 | 296 | # whether by default such searches should be case sensitive or not. You can |
|
297 | 297 | # always override the default at the system command line or the IPython |
|
298 | 298 | # prompt. |
|
299 | 299 | |
|
300 | 300 | wildcards_case_sensitive 1 |
|
301 | 301 | |
|
302 | # Object information: at what level of detail to display the string form of an | |
|
303 | # object. If set to 0, ipython will compute the string form of any object X, | |
|
304 | # by calling str(X), when X? is typed. If set to 1, str(X) will only be | |
|
305 | # computed when X?? is given, and if set to 2 or higher, it will never be | |
|
306 | # computed (there is no X??? level of detail). This is mostly of use to | |
|
307 | # people who frequently manipulate objects whose string representation is | |
|
308 | # extremely expensive to compute. | |
|
309 | ||
|
310 | object_info_string_level 0 | |
|
311 | ||
|
302 | 312 | # xmode - Exception reporting mode. |
|
303 | 313 | |
|
304 | 314 | # Valid modes: Plain, Context and Verbose. |
|
305 | 315 | |
|
306 | 316 | # Plain: similar to python's normal traceback printing. |
|
307 | 317 | |
|
308 | 318 | # Context: prints 5 lines of context source code around each line in the |
|
309 | 319 | # traceback. |
|
310 | 320 | |
|
311 | 321 | # Verbose: similar to Context, but additionally prints the variables currently |
|
312 | 322 | # visible where the exception happened (shortening their strings if too |
|
313 | 323 | # long). This can potentially be very slow, if you happen to have a huge data |
|
314 | 324 | # structure whose string representation is complex to compute. Your computer |
|
315 | 325 | # may appear to freeze for a while with cpu usage at 100%. If this occurs, you |
|
316 | 326 | # can cancel the traceback with Ctrl-C (maybe hitting it more than once). |
|
317 | 327 | |
|
318 | 328 | #xmode Plain |
|
319 | 329 | xmode Context |
|
320 | 330 | #xmode Verbose |
|
321 | 331 | |
|
322 | 332 | # multi_line_specials: if true, allow magics, aliases and shell escapes (via |
|
323 | 333 | # !cmd) to be used in multi-line input (like for loops). For example, if you |
|
324 | 334 | # have this active, the following is valid in IPython: |
|
325 | 335 | # |
|
326 | 336 | #In [17]: for i in range(3): |
|
327 | 337 | # ....: mkdir $i |
|
328 | 338 | # ....: !touch $i/hello |
|
329 | 339 | # ....: ls -l $i |
|
330 | 340 | |
|
331 | 341 | multi_line_specials 1 |
|
332 | 342 | |
|
333 | 343 | # wxversion: request a specific wxPython version (used for -wthread) |
|
334 | 344 | |
|
335 | 345 | # Set this to the value of wxPython you want to use, but note that this |
|
336 | 346 | # feature requires you to have the wxversion Python module to work. If you |
|
337 | 347 | # don't have the wxversion module (try 'import wxversion' at the prompt to |
|
338 | 348 | # check) or simply want to leave the system to pick up the default, leave this |
|
339 | 349 | # variable at 0. |
|
340 | 350 | |
|
341 | 351 | wxversion 0 |
|
342 | 352 | |
|
343 | 353 | #--------------------------------------------------------------------------- |
|
344 | 354 | # Section: Readline configuration (readline is not available for MS-Windows) |
|
345 | 355 | |
|
346 | 356 | # This is done via the following options: |
|
347 | 357 | |
|
348 | 358 | # (i) readline_parse_and_bind: this option can appear as many times as you |
|
349 | 359 | # want, each time defining a string to be executed via a |
|
350 | 360 | # readline.parse_and_bind() command. The syntax for valid commands of this |
|
351 | 361 | # kind can be found by reading the documentation for the GNU readline library, |
|
352 | 362 | # as these commands are of the kind which readline accepts in its |
|
353 | 363 | # configuration file. |
|
354 | 364 | |
|
355 | 365 | # The TAB key can be used to complete names at the command line in one of two |
|
356 | 366 | # ways: 'complete' and 'menu-complete'. The difference is that 'complete' only |
|
357 | 367 | # completes as much as possible while 'menu-complete' cycles through all |
|
358 | 368 | # possible completions. Leave the one you prefer uncommented. |
|
359 | 369 | |
|
360 | 370 | readline_parse_and_bind tab: complete |
|
361 | 371 | #readline_parse_and_bind tab: menu-complete |
|
362 | 372 | |
|
363 | 373 | # This binds Control-l to printing the list of all possible completions when |
|
364 | 374 | # there is more than one (what 'complete' does when hitting TAB twice, or at |
|
365 | 375 | # the first TAB if show-all-if-ambiguous is on) |
|
366 | 376 | readline_parse_and_bind "\C-l": possible-completions |
|
367 | 377 | |
|
368 | 378 | # This forces readline to automatically print the above list when tab |
|
369 | 379 | # completion is set to 'complete'. You can still get this list manually by |
|
370 | 380 | # using the key bound to 'possible-completions' (Control-l by default) or by |
|
371 | 381 | # hitting TAB twice. Turning this on makes the printing happen at the first |
|
372 | 382 | # TAB. |
|
373 | 383 | readline_parse_and_bind set show-all-if-ambiguous on |
|
374 | 384 | |
|
375 | 385 | # If you have TAB set to complete names, you can rebind any key (Control-o by |
|
376 | 386 | # default) to insert a true TAB character. |
|
377 | 387 | readline_parse_and_bind "\C-o": tab-insert |
|
378 | 388 | |
|
379 | 389 | # These commands allow you to indent/unindent easily, with the 4-space |
|
380 | 390 | # convention of the Python coding standards. Since IPython's internal |
|
381 | 391 | # auto-indent system also uses 4 spaces, you should not change the number of |
|
382 | 392 | # spaces in the code below. |
|
383 | 393 | readline_parse_and_bind "\M-i": " " |
|
384 | 394 | readline_parse_and_bind "\M-o": "\d\d\d\d" |
|
385 | 395 | readline_parse_and_bind "\M-I": "\d\d\d\d" |
|
386 | 396 | |
|
387 | 397 | # Bindings for incremental searches in the history. These searches use the |
|
388 | 398 | # string typed so far on the command line and search anything in the previous |
|
389 | 399 | # input history containing them. |
|
390 | 400 | readline_parse_and_bind "\C-r": reverse-search-history |
|
391 | 401 | readline_parse_and_bind "\C-s": forward-search-history |
|
392 | 402 | |
|
393 | 403 | # Bindings for completing the current line in the history of previous |
|
394 | 404 | # commands. This allows you to recall any previous command by typing its first |
|
395 | 405 | # few letters and hitting Control-p, bypassing all intermediate commands which |
|
396 | 406 | # may be in the history (much faster than hitting up-arrow 50 times!) |
|
397 | 407 | readline_parse_and_bind "\C-p": history-search-backward |
|
398 | 408 | readline_parse_and_bind "\C-n": history-search-forward |
|
399 | 409 | |
|
400 | 410 | # I also like to have the same functionality on the plain arrow keys. If you'd |
|
401 | 411 | # rather have the arrows use all the history (and not just match what you've |
|
402 | 412 | # typed so far), comment out or delete the next two lines. |
|
403 | 413 | readline_parse_and_bind "\e[A": history-search-backward |
|
404 | 414 | readline_parse_and_bind "\e[B": history-search-forward |
|
405 | 415 | |
|
406 | 416 | # These are typically on by default under *nix, but not win32. |
|
407 | 417 | readline_parse_and_bind "\C-k": kill-line |
|
408 | 418 | readline_parse_and_bind "\C-u": unix-line-discard |
|
409 | 419 | |
|
410 | 420 | # (ii) readline_remove_delims: a string of characters to be removed from the |
|
411 | 421 | # default word-delimiters list used by readline, so that completions may be |
|
412 | 422 | # performed on strings which contain them. |
|
413 | 423 | |
|
414 | 424 | readline_remove_delims -/~ |
|
415 | 425 | |
|
416 | 426 | # (iii) readline_merge_completions: whether to merge the result of all |
|
417 | 427 | # possible completions or not. If true, IPython will complete filenames, |
|
418 | 428 | # python names and aliases and return all possible completions. If you set it |
|
419 | 429 | # to false, each completer is used at a time, and only if it doesn't return |
|
420 | 430 | # any completions is the next one used. |
|
421 | 431 | |
|
422 | 432 | # The default order is: [python_matches, file_matches, alias_matches] |
|
423 | 433 | |
|
424 | 434 | readline_merge_completions 1 |
|
425 | 435 | |
|
426 | 436 | # (iv) readline_omit__names: normally hitting <tab> after a '.' in a name |
|
427 | 437 | # will complete all attributes of an object, including all the special methods |
|
428 | 438 | # whose names start with single or double underscores (like __getitem__ or |
|
429 | 439 | # __class__). |
|
430 | 440 | |
|
431 | 441 | # This variable allows you to control this completion behavior: |
|
432 | 442 | |
|
433 | 443 | # readline_omit__names 1 -> completion will omit showing any names starting |
|
434 | 444 | # with two __, but it will still show names starting with one _. |
|
435 | 445 | |
|
436 | 446 | # readline_omit__names 2 -> completion will omit all names beginning with one |
|
437 | 447 | # _ (which obviously means filtering out the double __ ones). |
|
438 | 448 | |
|
439 | 449 | # Even when this option is set, you can still see those names by explicitly |
|
440 | 450 | # typing a _ after the period and hitting <tab>: 'name._<tab>' will always |
|
441 | 451 | # complete attribute names starting with '_'. |
|
442 | 452 | |
|
443 | 453 | # This option is off by default so that new users see all attributes of any |
|
444 | 454 | # objects they are dealing with. |
|
445 | 455 | |
|
446 | 456 | readline_omit__names 0 |
|
447 | 457 | |
|
448 | 458 | #--------------------------------------------------------------------------- |
|
449 | 459 | # Section: modules to be loaded with 'import ...' |
|
450 | 460 | |
|
451 | 461 | # List, separated by spaces, the names of the modules you want to import |
|
452 | 462 | |
|
453 | 463 | # Example: |
|
454 | 464 | # import_mod sys os |
|
455 | 465 | # will produce internally the statements |
|
456 | 466 | # import sys |
|
457 | 467 | # import os |
|
458 | 468 | |
|
459 | 469 | # Each import is executed in its own try/except block, so if one module |
|
460 | 470 | # fails to load the others will still be ok. |
|
461 | 471 | |
|
462 | 472 | import_mod |
|
463 | 473 | |
|
464 | 474 | #--------------------------------------------------------------------------- |
|
465 | 475 | # Section: modules to import some functions from: 'from ... import ...' |
|
466 | 476 | |
|
467 | 477 | # List, one per line, the modules for which you want only to import some |
|
468 | 478 | # functions. Give the module name first and then the name of functions to be |
|
469 | 479 | # imported from that module. |
|
470 | 480 | |
|
471 | 481 | # Example: |
|
472 | 482 | |
|
473 | 483 | # import_some IPython.genutils timing timings |
|
474 | 484 | # will produce internally the statement |
|
475 | 485 | # from IPython.genutils import timing, timings |
|
476 | 486 | |
|
477 | 487 | # timing() and timings() are two IPython utilities for timing the execution of |
|
478 | 488 | # your own functions, which you may find useful. Just commment out the above |
|
479 | 489 | # line if you want to test them. |
|
480 | 490 | |
|
481 | 491 | # If you have more than one modules_some line, each gets its own try/except |
|
482 | 492 | # block (like modules, see above). |
|
483 | 493 | |
|
484 | 494 | import_some |
|
485 | 495 | |
|
486 | 496 | #--------------------------------------------------------------------------- |
|
487 | 497 | # Section: modules to import all from : 'from ... import *' |
|
488 | 498 | |
|
489 | 499 | # List (same syntax as import_mod above) those modules for which you want to |
|
490 | 500 | # import all functions. Remember, this is a potentially dangerous thing to do, |
|
491 | 501 | # since it is very easy to overwrite names of things you need. Use with |
|
492 | 502 | # caution. |
|
493 | 503 | |
|
494 | 504 | # Example: |
|
495 | 505 | # import_all sys os |
|
496 | 506 | # will produce internally the statements |
|
497 | 507 | # from sys import * |
|
498 | 508 | # from os import * |
|
499 | 509 | |
|
500 | 510 | # As before, each will be called in a separate try/except block. |
|
501 | 511 | |
|
502 | 512 | import_all |
|
503 | 513 | |
|
504 | 514 | #--------------------------------------------------------------------------- |
|
505 | 515 | # Section: Python code to execute. |
|
506 | 516 | |
|
507 | 517 | # Put here code to be explicitly executed (keep it simple!) |
|
508 | 518 | # Put one line of python code per line. All whitespace is removed (this is a |
|
509 | 519 | # feature, not a bug), so don't get fancy building loops here. |
|
510 | 520 | # This is just for quick convenient creation of things you want available. |
|
511 | 521 | |
|
512 | 522 | # Example: |
|
513 | 523 | # execute x = 1 |
|
514 | 524 | # execute print 'hello world'; y = z = 'a' |
|
515 | 525 | # will produce internally |
|
516 | 526 | # x = 1 |
|
517 | 527 | # print 'hello world'; y = z = 'a' |
|
518 | 528 | # and each *line* (not each statement, we don't do python syntax parsing) is |
|
519 | 529 | # executed in its own try/except block. |
|
520 | 530 | |
|
521 | 531 | execute |
|
522 | 532 | |
|
523 | 533 | # Note for the adventurous: you can use this to define your own names for the |
|
524 | 534 | # magic functions, by playing some namespace tricks: |
|
525 | 535 | |
|
526 | 536 | # execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile |
|
527 | 537 | |
|
528 | 538 | # defines %pf as a new name for %profile. |
|
529 | 539 | |
|
530 | 540 | #--------------------------------------------------------------------------- |
|
531 | 541 | # Section: Pyhton files to load and execute. |
|
532 | 542 | |
|
533 | 543 | # Put here the full names of files you want executed with execfile(file). If |
|
534 | 544 | # you want complicated initialization, just write whatever you want in a |
|
535 | 545 | # regular python file and load it from here. |
|
536 | 546 | |
|
537 | 547 | # Filenames defined here (which *must* include the extension) are searched for |
|
538 | 548 | # through all of sys.path. Since IPython adds your .ipython directory to |
|
539 | 549 | # sys.path, they can also be placed in your .ipython dir and will be |
|
540 | 550 | # found. Otherwise (if you want to execute things not in .ipyton nor in |
|
541 | 551 | # sys.path) give a full path (you can use ~, it gets expanded) |
|
542 | 552 | |
|
543 | 553 | # Example: |
|
544 | 554 | # execfile file1.py ~/file2.py |
|
545 | 555 | # will generate |
|
546 | 556 | # execfile('file1.py') |
|
547 | 557 | # execfile('_path_to_your_home/file2.py') |
|
548 | 558 | |
|
549 | 559 | # As before, each file gets its own try/except block. |
|
550 | 560 | |
|
551 | 561 | execfile |
|
552 | 562 | |
|
553 | 563 | # If you are feeling adventurous, you can even add functionality to IPython |
|
554 | 564 | # through here. IPython works through a global variable called __ip which |
|
555 | 565 | # exists at the time when these files are read. If you know what you are doing |
|
556 | 566 | # (read the source) you can add functions to __ip in files loaded here. |
|
557 | 567 | |
|
558 | 568 | # The file example-magic.py contains a simple but correct example. Try it: |
|
559 | 569 | |
|
560 | 570 | # execfile example-magic.py |
|
561 | 571 | |
|
562 | 572 | # Look at the examples in IPython/iplib.py for more details on how these magic |
|
563 | 573 | # functions need to process their arguments. |
|
564 | 574 | |
|
565 | 575 | #--------------------------------------------------------------------------- |
|
566 | 576 | # Section: aliases for system shell commands |
|
567 | 577 | |
|
568 | 578 | # Here you can define your own names for system commands. The syntax is |
|
569 | 579 | # similar to that of the builtin %alias function: |
|
570 | 580 | |
|
571 | 581 | # alias alias_name command_string |
|
572 | 582 | |
|
573 | 583 | # The resulting aliases are auto-generated magic functions (hence usable as |
|
574 | 584 | # %alias_name) |
|
575 | 585 | |
|
576 | 586 | # For example: |
|
577 | 587 | |
|
578 | 588 | # alias myls ls -la |
|
579 | 589 | |
|
580 | 590 | # will define 'myls' as an alias for executing the system command 'ls -la'. |
|
581 | 591 | # This allows you to customize IPython's environment to have the same aliases |
|
582 | 592 | # you are accustomed to from your own shell. |
|
583 | 593 | |
|
584 | 594 | # You can also define aliases with parameters using %s specifiers (one per |
|
585 | 595 | # parameter): |
|
586 | 596 | |
|
587 | 597 | # alias parts echo first %s second %s |
|
588 | 598 | |
|
589 | 599 | # will give you in IPython: |
|
590 | 600 | # >>> %parts A B |
|
591 | 601 | # first A second B |
|
592 | 602 | |
|
593 | 603 | # Use one 'alias' statement per alias you wish to define. |
|
594 | 604 | |
|
595 | 605 | # alias |
|
596 | 606 | |
|
597 | 607 | #************************* end of file <ipythonrc> ************************ |
@@ -1,2291 +1,2300 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 | 3 | IPython -- An enhanced Interactive Python |
|
4 | 4 | |
|
5 | 5 | Requires Python 2.3 or newer. |
|
6 | 6 | |
|
7 | 7 | This file contains all the classes and helper functions specific to IPython. |
|
8 | 8 | |
|
9 |
$Id: iplib.py 132 |
|
|
9 | $Id: iplib.py 1329 2006-05-26 07:52:45Z fperez $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
|
13 | 13 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
|
14 | 14 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
|
15 | 15 | # |
|
16 | 16 | # Distributed under the terms of the BSD License. The full license is in |
|
17 | 17 | # the file COPYING, distributed as part of this software. |
|
18 | 18 | # |
|
19 | 19 | # Note: this code originally subclassed code.InteractiveConsole from the |
|
20 | 20 | # Python standard library. Over time, all of that class has been copied |
|
21 | 21 | # verbatim here for modifications which could not be accomplished by |
|
22 | 22 | # subclassing. At this point, there are no dependencies at all on the code |
|
23 | 23 | # module anymore (it is not even imported). The Python License (sec. 2) |
|
24 | 24 | # allows for this, but it's always nice to acknowledge credit where credit is |
|
25 | 25 | # due. |
|
26 | 26 | #***************************************************************************** |
|
27 | 27 | |
|
28 | 28 | #**************************************************************************** |
|
29 | 29 | # Modules and globals |
|
30 | 30 | |
|
31 | 31 | from IPython import Release |
|
32 | 32 | __author__ = '%s <%s>\n%s <%s>' % \ |
|
33 | 33 | ( Release.authors['Janko'] + Release.authors['Fernando'] ) |
|
34 | 34 | __license__ = Release.license |
|
35 | 35 | __version__ = Release.version |
|
36 | 36 | |
|
37 | 37 | # Python standard modules |
|
38 | 38 | import __main__ |
|
39 | 39 | import __builtin__ |
|
40 | 40 | import StringIO |
|
41 | 41 | import bdb |
|
42 | 42 | import cPickle as pickle |
|
43 | 43 | import codeop |
|
44 | 44 | import exceptions |
|
45 | 45 | import glob |
|
46 | 46 | import inspect |
|
47 | 47 | import keyword |
|
48 | 48 | import new |
|
49 | 49 | import os |
|
50 | 50 | import pdb |
|
51 | 51 | import pydoc |
|
52 | 52 | import re |
|
53 | 53 | import shutil |
|
54 | 54 | import string |
|
55 | 55 | import sys |
|
56 | 56 | import tempfile |
|
57 | 57 | import traceback |
|
58 | 58 | import types |
|
59 | 59 | import pickleshare |
|
60 | 60 | |
|
61 | 61 | from pprint import pprint, pformat |
|
62 | 62 | |
|
63 | 63 | # IPython's own modules |
|
64 | 64 | import IPython |
|
65 | 65 | from IPython import OInspect,PyColorize,ultraTB |
|
66 | 66 | from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names |
|
67 | 67 | from IPython.FakeModule import FakeModule |
|
68 | 68 | from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns |
|
69 | 69 | from IPython.Logger import Logger |
|
70 | 70 | from IPython.Magic import Magic |
|
71 | 71 | from IPython.Prompts import CachedOutput |
|
72 | 72 | from IPython.ipstruct import Struct |
|
73 | 73 | from IPython.background_jobs import BackgroundJobManager |
|
74 | 74 | from IPython.usage import cmd_line_usage,interactive_usage |
|
75 | 75 | from IPython.genutils import * |
|
76 | 76 | import IPython.ipapi |
|
77 | 77 | |
|
78 | 78 | # Globals |
|
79 | 79 | |
|
80 | 80 | # store the builtin raw_input globally, and use this always, in case user code |
|
81 | 81 | # overwrites it (like wx.py.PyShell does) |
|
82 | 82 | raw_input_original = raw_input |
|
83 | 83 | |
|
84 | 84 | # compiled regexps for autoindent management |
|
85 | 85 | dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass') |
|
86 | 86 | |
|
87 | 87 | |
|
88 | 88 | #**************************************************************************** |
|
89 | 89 | # Some utility function definitions |
|
90 | 90 | |
|
91 | 91 | ini_spaces_re = re.compile(r'^(\s+)') |
|
92 | 92 | |
|
93 | 93 | def num_ini_spaces(strng): |
|
94 | 94 | """Return the number of initial spaces in a string""" |
|
95 | 95 | |
|
96 | 96 | ini_spaces = ini_spaces_re.match(strng) |
|
97 | 97 | if ini_spaces: |
|
98 | 98 | return ini_spaces.end() |
|
99 | 99 | else: |
|
100 | 100 | return 0 |
|
101 | 101 | |
|
102 | 102 | def softspace(file, newvalue): |
|
103 | 103 | """Copied from code.py, to remove the dependency""" |
|
104 | 104 | |
|
105 | 105 | oldvalue = 0 |
|
106 | 106 | try: |
|
107 | 107 | oldvalue = file.softspace |
|
108 | 108 | except AttributeError: |
|
109 | 109 | pass |
|
110 | 110 | try: |
|
111 | 111 | file.softspace = newvalue |
|
112 | 112 | except (AttributeError, TypeError): |
|
113 | 113 | # "attribute-less object" or "read-only attributes" |
|
114 | 114 | pass |
|
115 | 115 | return oldvalue |
|
116 | 116 | |
|
117 | 117 | |
|
118 | 118 | #**************************************************************************** |
|
119 | 119 | # Local use exceptions |
|
120 | 120 | class SpaceInInput(exceptions.Exception): pass |
|
121 | 121 | |
|
122 | 122 | |
|
123 | 123 | #**************************************************************************** |
|
124 | 124 | # Local use classes |
|
125 | 125 | class Bunch: pass |
|
126 | 126 | |
|
127 | 127 | class Undefined: pass |
|
128 | 128 | |
|
129 | 129 | class InputList(list): |
|
130 | 130 | """Class to store user input. |
|
131 | 131 | |
|
132 | 132 | It's basically a list, but slices return a string instead of a list, thus |
|
133 | 133 | allowing things like (assuming 'In' is an instance): |
|
134 | 134 | |
|
135 | 135 | exec In[4:7] |
|
136 | 136 | |
|
137 | 137 | or |
|
138 | 138 | |
|
139 | 139 | exec In[5:9] + In[14] + In[21:25]""" |
|
140 | 140 | |
|
141 | 141 | def __getslice__(self,i,j): |
|
142 | 142 | return ''.join(list.__getslice__(self,i,j)) |
|
143 | 143 | |
|
144 | 144 | class SyntaxTB(ultraTB.ListTB): |
|
145 | 145 | """Extension which holds some state: the last exception value""" |
|
146 | 146 | |
|
147 | 147 | def __init__(self,color_scheme = 'NoColor'): |
|
148 | 148 | ultraTB.ListTB.__init__(self,color_scheme) |
|
149 | 149 | self.last_syntax_error = None |
|
150 | 150 | |
|
151 | 151 | def __call__(self, etype, value, elist): |
|
152 | 152 | self.last_syntax_error = value |
|
153 | 153 | ultraTB.ListTB.__call__(self,etype,value,elist) |
|
154 | 154 | |
|
155 | 155 | def clear_err_state(self): |
|
156 | 156 | """Return the current error state and clear it""" |
|
157 | 157 | e = self.last_syntax_error |
|
158 | 158 | self.last_syntax_error = None |
|
159 | 159 | return e |
|
160 | 160 | |
|
161 | 161 | #**************************************************************************** |
|
162 | 162 | # Main IPython class |
|
163 | 163 | |
|
164 | 164 | # FIXME: the Magic class is a mixin for now, and will unfortunately remain so |
|
165 | 165 | # until a full rewrite is made. I've cleaned all cross-class uses of |
|
166 | 166 | # attributes and methods, but too much user code out there relies on the |
|
167 | 167 | # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage. |
|
168 | 168 | # |
|
169 | 169 | # But at least now, all the pieces have been separated and we could, in |
|
170 | 170 | # principle, stop using the mixin. This will ease the transition to the |
|
171 | 171 | # chainsaw branch. |
|
172 | 172 | |
|
173 | 173 | # For reference, the following is the list of 'self.foo' uses in the Magic |
|
174 | 174 | # class as of 2005-12-28. These are names we CAN'T use in the main ipython |
|
175 | 175 | # class, to prevent clashes. |
|
176 | 176 | |
|
177 | 177 | # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind', |
|
178 | 178 | # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic', |
|
179 | 179 | # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell', |
|
180 | 180 | # 'self.value'] |
|
181 | 181 | |
|
182 | 182 | class InteractiveShell(object,Magic): |
|
183 | 183 | """An enhanced console for Python.""" |
|
184 | 184 | |
|
185 | 185 | # class attribute to indicate whether the class supports threads or not. |
|
186 | 186 | # Subclasses with thread support should override this as needed. |
|
187 | 187 | isthreaded = False |
|
188 | 188 | |
|
189 | 189 | def __init__(self,name,usage=None,rc=Struct(opts=None,args=None), |
|
190 | 190 | user_ns = None,user_global_ns=None,banner2='', |
|
191 | 191 | custom_exceptions=((),None),embedded=False): |
|
192 | 192 | |
|
193 | 193 | |
|
194 | 194 | # log system |
|
195 | 195 | self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate') |
|
196 | 196 | |
|
197 | 197 | # some minimal strict typechecks. For some core data structures, I |
|
198 | 198 | # want actual basic python types, not just anything that looks like |
|
199 | 199 | # one. This is especially true for namespaces. |
|
200 | 200 | for ns in (user_ns,user_global_ns): |
|
201 | 201 | if ns is not None and type(ns) != types.DictType: |
|
202 | 202 | raise TypeError,'namespace must be a dictionary' |
|
203 | 203 | |
|
204 | 204 | # Job manager (for jobs run as background threads) |
|
205 | 205 | self.jobs = BackgroundJobManager() |
|
206 | 206 | |
|
207 | 207 | # Store the actual shell's name |
|
208 | 208 | self.name = name |
|
209 | 209 | |
|
210 | 210 | # We need to know whether the instance is meant for embedding, since |
|
211 | 211 | # global/local namespaces need to be handled differently in that case |
|
212 | 212 | self.embedded = embedded |
|
213 | 213 | |
|
214 | 214 | # command compiler |
|
215 | 215 | self.compile = codeop.CommandCompiler() |
|
216 | 216 | |
|
217 | 217 | # User input buffer |
|
218 | 218 | self.buffer = [] |
|
219 | 219 | |
|
220 | 220 | # Default name given in compilation of code |
|
221 | 221 | self.filename = '<ipython console>' |
|
222 | 222 | |
|
223 | 223 | # Make an empty namespace, which extension writers can rely on both |
|
224 | 224 | # existing and NEVER being used by ipython itself. This gives them a |
|
225 | 225 | # convenient location for storing additional information and state |
|
226 | 226 | # their extensions may require, without fear of collisions with other |
|
227 | 227 | # ipython names that may develop later. |
|
228 | 228 | self.meta = Struct() |
|
229 | 229 | |
|
230 | 230 | # Create the namespace where the user will operate. user_ns is |
|
231 | 231 | # normally the only one used, and it is passed to the exec calls as |
|
232 | 232 | # the locals argument. But we do carry a user_global_ns namespace |
|
233 | 233 | # given as the exec 'globals' argument, This is useful in embedding |
|
234 | 234 | # situations where the ipython shell opens in a context where the |
|
235 | 235 | # distinction between locals and globals is meaningful. |
|
236 | 236 | |
|
237 | 237 | # FIXME. For some strange reason, __builtins__ is showing up at user |
|
238 | 238 | # level as a dict instead of a module. This is a manual fix, but I |
|
239 | 239 | # should really track down where the problem is coming from. Alex |
|
240 | 240 | # Schmolck reported this problem first. |
|
241 | 241 | |
|
242 | 242 | # A useful post by Alex Martelli on this topic: |
|
243 | 243 | # Re: inconsistent value from __builtins__ |
|
244 | 244 | # Von: Alex Martelli <aleaxit@yahoo.com> |
|
245 | 245 | # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends |
|
246 | 246 | # Gruppen: comp.lang.python |
|
247 | 247 | |
|
248 | 248 | # Michael Hohn <hohn@hooknose.lbl.gov> wrote: |
|
249 | 249 | # > >>> print type(builtin_check.get_global_binding('__builtins__')) |
|
250 | 250 | # > <type 'dict'> |
|
251 | 251 | # > >>> print type(__builtins__) |
|
252 | 252 | # > <type 'module'> |
|
253 | 253 | # > Is this difference in return value intentional? |
|
254 | 254 | |
|
255 | 255 | # Well, it's documented that '__builtins__' can be either a dictionary |
|
256 | 256 | # or a module, and it's been that way for a long time. Whether it's |
|
257 | 257 | # intentional (or sensible), I don't know. In any case, the idea is |
|
258 | 258 | # that if you need to access the built-in namespace directly, you |
|
259 | 259 | # should start with "import __builtin__" (note, no 's') which will |
|
260 | 260 | # definitely give you a module. Yeah, it's somewhat confusing:-(. |
|
261 | 261 | |
|
262 | 262 | # These routines return properly built dicts as needed by the rest of |
|
263 | 263 | # the code, and can also be used by extension writers to generate |
|
264 | 264 | # properly initialized namespaces. |
|
265 | 265 | user_ns = IPython.ipapi.make_user_ns(user_ns) |
|
266 | 266 | user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns) |
|
267 | 267 | |
|
268 | 268 | # Assign namespaces |
|
269 | 269 | # This is the namespace where all normal user variables live |
|
270 | 270 | self.user_ns = user_ns |
|
271 | 271 | # Embedded instances require a separate namespace for globals. |
|
272 | 272 | # Normally this one is unused by non-embedded instances. |
|
273 | 273 | self.user_global_ns = user_global_ns |
|
274 | 274 | # A namespace to keep track of internal data structures to prevent |
|
275 | 275 | # them from cluttering user-visible stuff. Will be updated later |
|
276 | 276 | self.internal_ns = {} |
|
277 | 277 | |
|
278 | 278 | # Namespace of system aliases. Each entry in the alias |
|
279 | 279 | # table must be a 2-tuple of the form (N,name), where N is the number |
|
280 | 280 | # of positional arguments of the alias. |
|
281 | 281 | self.alias_table = {} |
|
282 | 282 | |
|
283 | 283 | # A table holding all the namespaces IPython deals with, so that |
|
284 | 284 | # introspection facilities can search easily. |
|
285 | 285 | self.ns_table = {'user':user_ns, |
|
286 | 286 | 'user_global':user_global_ns, |
|
287 | 287 | 'alias':self.alias_table, |
|
288 | 288 | 'internal':self.internal_ns, |
|
289 | 289 | 'builtin':__builtin__.__dict__ |
|
290 | 290 | } |
|
291 | 291 | |
|
292 | 292 | # The user namespace MUST have a pointer to the shell itself. |
|
293 | 293 | self.user_ns[name] = self |
|
294 | 294 | |
|
295 | 295 | # We need to insert into sys.modules something that looks like a |
|
296 | 296 | # module but which accesses the IPython namespace, for shelve and |
|
297 | 297 | # pickle to work interactively. Normally they rely on getting |
|
298 | 298 | # everything out of __main__, but for embedding purposes each IPython |
|
299 | 299 | # instance has its own private namespace, so we can't go shoving |
|
300 | 300 | # everything into __main__. |
|
301 | 301 | |
|
302 | 302 | # note, however, that we should only do this for non-embedded |
|
303 | 303 | # ipythons, which really mimic the __main__.__dict__ with their own |
|
304 | 304 | # namespace. Embedded instances, on the other hand, should not do |
|
305 | 305 | # this because they need to manage the user local/global namespaces |
|
306 | 306 | # only, but they live within a 'normal' __main__ (meaning, they |
|
307 | 307 | # shouldn't overtake the execution environment of the script they're |
|
308 | 308 | # embedded in). |
|
309 | 309 | |
|
310 | 310 | if not embedded: |
|
311 | 311 | try: |
|
312 | 312 | main_name = self.user_ns['__name__'] |
|
313 | 313 | except KeyError: |
|
314 | 314 | raise KeyError,'user_ns dictionary MUST have a "__name__" key' |
|
315 | 315 | else: |
|
316 | 316 | #print "pickle hack in place" # dbg |
|
317 | 317 | #print 'main_name:',main_name # dbg |
|
318 | 318 | sys.modules[main_name] = FakeModule(self.user_ns) |
|
319 | 319 | |
|
320 | 320 | # List of input with multi-line handling. |
|
321 | 321 | # Fill its zero entry, user counter starts at 1 |
|
322 | 322 | self.input_hist = InputList(['\n']) |
|
323 | 323 | # This one will hold the 'raw' input history, without any |
|
324 | 324 | # pre-processing. This will allow users to retrieve the input just as |
|
325 | 325 | # it was exactly typed in by the user, with %hist -r. |
|
326 | 326 | self.input_hist_raw = InputList(['\n']) |
|
327 | 327 | |
|
328 | 328 | # list of visited directories |
|
329 | 329 | try: |
|
330 | 330 | self.dir_hist = [os.getcwd()] |
|
331 | 331 | except IOError, e: |
|
332 | 332 | self.dir_hist = [] |
|
333 | 333 | |
|
334 | 334 | # dict of output history |
|
335 | 335 | self.output_hist = {} |
|
336 | 336 | |
|
337 | 337 | # dict of things NOT to alias (keywords, builtins and some magics) |
|
338 | 338 | no_alias = {} |
|
339 | 339 | no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias'] |
|
340 | 340 | for key in keyword.kwlist + no_alias_magics: |
|
341 | 341 | no_alias[key] = 1 |
|
342 | 342 | no_alias.update(__builtin__.__dict__) |
|
343 | 343 | self.no_alias = no_alias |
|
344 | 344 | |
|
345 | 345 | # make global variables for user access to these |
|
346 | 346 | self.user_ns['_ih'] = self.input_hist |
|
347 | 347 | self.user_ns['_oh'] = self.output_hist |
|
348 | 348 | self.user_ns['_dh'] = self.dir_hist |
|
349 | 349 | |
|
350 | 350 | # user aliases to input and output histories |
|
351 | 351 | self.user_ns['In'] = self.input_hist |
|
352 | 352 | self.user_ns['Out'] = self.output_hist |
|
353 | 353 | |
|
354 | 354 | # Object variable to store code object waiting execution. This is |
|
355 | 355 | # used mainly by the multithreaded shells, but it can come in handy in |
|
356 | 356 | # other situations. No need to use a Queue here, since it's a single |
|
357 | 357 | # item which gets cleared once run. |
|
358 | 358 | self.code_to_run = None |
|
359 | 359 | |
|
360 | 360 | # escapes for automatic behavior on the command line |
|
361 | 361 | self.ESC_SHELL = '!' |
|
362 | 362 | self.ESC_HELP = '?' |
|
363 | 363 | self.ESC_MAGIC = '%' |
|
364 | 364 | self.ESC_QUOTE = ',' |
|
365 | 365 | self.ESC_QUOTE2 = ';' |
|
366 | 366 | self.ESC_PAREN = '/' |
|
367 | 367 | |
|
368 | 368 | # And their associated handlers |
|
369 | 369 | self.esc_handlers = {self.ESC_PAREN : self.handle_auto, |
|
370 | 370 | self.ESC_QUOTE : self.handle_auto, |
|
371 | 371 | self.ESC_QUOTE2 : self.handle_auto, |
|
372 | 372 | self.ESC_MAGIC : self.handle_magic, |
|
373 | 373 | self.ESC_HELP : self.handle_help, |
|
374 | 374 | self.ESC_SHELL : self.handle_shell_escape, |
|
375 | 375 | } |
|
376 | 376 | |
|
377 | 377 | # class initializations |
|
378 | 378 | Magic.__init__(self,self) |
|
379 | 379 | |
|
380 | 380 | # Python source parser/formatter for syntax highlighting |
|
381 | 381 | pyformat = PyColorize.Parser().format |
|
382 | 382 | self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors']) |
|
383 | 383 | |
|
384 | 384 | # hooks holds pointers used for user-side customizations |
|
385 | 385 | self.hooks = Struct() |
|
386 | 386 | |
|
387 | 387 | # Set all default hooks, defined in the IPython.hooks module. |
|
388 | 388 | hooks = IPython.hooks |
|
389 | 389 | for hook_name in hooks.__all__: |
|
390 | 390 | # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority |
|
391 | 391 | self.set_hook(hook_name,getattr(hooks,hook_name), 100) |
|
392 | 392 | #print "bound hook",hook_name |
|
393 | 393 | |
|
394 | 394 | # Flag to mark unconditional exit |
|
395 | 395 | self.exit_now = False |
|
396 | 396 | |
|
397 | 397 | self.usage_min = """\ |
|
398 | 398 | An enhanced console for Python. |
|
399 | 399 | Some of its features are: |
|
400 | 400 | - Readline support if the readline library is present. |
|
401 | 401 | - Tab completion in the local namespace. |
|
402 | 402 | - Logging of input, see command-line options. |
|
403 | 403 | - System shell escape via ! , eg !ls. |
|
404 | 404 | - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.) |
|
405 | 405 | - Keeps track of locally defined variables via %who, %whos. |
|
406 | 406 | - Show object information with a ? eg ?x or x? (use ?? for more info). |
|
407 | 407 | """ |
|
408 | 408 | if usage: self.usage = usage |
|
409 | 409 | else: self.usage = self.usage_min |
|
410 | 410 | |
|
411 | 411 | # Storage |
|
412 | 412 | self.rc = rc # This will hold all configuration information |
|
413 | 413 | self.pager = 'less' |
|
414 | 414 | # temporary files used for various purposes. Deleted at exit. |
|
415 | 415 | self.tempfiles = [] |
|
416 | 416 | |
|
417 | 417 | # Keep track of readline usage (later set by init_readline) |
|
418 | 418 | self.has_readline = False |
|
419 | 419 | |
|
420 | 420 | # template for logfile headers. It gets resolved at runtime by the |
|
421 | 421 | # logstart method. |
|
422 | 422 | self.loghead_tpl = \ |
|
423 | 423 | """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE *** |
|
424 | 424 | #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW |
|
425 | 425 | #log# opts = %s |
|
426 | 426 | #log# args = %s |
|
427 | 427 | #log# It is safe to make manual edits below here. |
|
428 | 428 | #log#----------------------------------------------------------------------- |
|
429 | 429 | """ |
|
430 | 430 | # for pushd/popd management |
|
431 | 431 | try: |
|
432 | 432 | self.home_dir = get_home_dir() |
|
433 | 433 | except HomeDirError,msg: |
|
434 | 434 | fatal(msg) |
|
435 | 435 | |
|
436 | 436 | self.dir_stack = [os.getcwd().replace(self.home_dir,'~')] |
|
437 | 437 | |
|
438 | 438 | # Functions to call the underlying shell. |
|
439 | 439 | |
|
440 | 440 | # utility to expand user variables via Itpl |
|
441 | 441 | self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'), |
|
442 | 442 | self.user_ns)) |
|
443 | 443 | # The first is similar to os.system, but it doesn't return a value, |
|
444 | 444 | # and it allows interpolation of variables in the user's namespace. |
|
445 | 445 | self.system = lambda cmd: shell(self.var_expand(cmd), |
|
446 | 446 | header='IPython system call: ', |
|
447 | 447 | verbose=self.rc.system_verbose) |
|
448 | 448 | # These are for getoutput and getoutputerror: |
|
449 | 449 | self.getoutput = lambda cmd: \ |
|
450 | 450 | getoutput(self.var_expand(cmd), |
|
451 | 451 | header='IPython system call: ', |
|
452 | 452 | verbose=self.rc.system_verbose) |
|
453 | 453 | self.getoutputerror = lambda cmd: \ |
|
454 | 454 | getoutputerror(str(ItplNS(cmd.replace('#','\#'), |
|
455 | 455 | self.user_ns)), |
|
456 | 456 | header='IPython system call: ', |
|
457 | 457 | verbose=self.rc.system_verbose) |
|
458 | 458 | |
|
459 | 459 | # RegExp for splitting line contents into pre-char//first |
|
460 | 460 | # word-method//rest. For clarity, each group in on one line. |
|
461 | 461 | |
|
462 | 462 | # WARNING: update the regexp if the above escapes are changed, as they |
|
463 | 463 | # are hardwired in. |
|
464 | 464 | |
|
465 | 465 | # Don't get carried away with trying to make the autocalling catch too |
|
466 | 466 | # much: it's better to be conservative rather than to trigger hidden |
|
467 | 467 | # evals() somewhere and end up causing side effects. |
|
468 | 468 | |
|
469 | 469 | self.line_split = re.compile(r'^([\s*,;/])' |
|
470 | 470 | r'([\?\w\.]+\w*\s*)' |
|
471 | 471 | r'(\(?.*$)') |
|
472 | 472 | |
|
473 | 473 | # Original re, keep around for a while in case changes break something |
|
474 | 474 | #self.line_split = re.compile(r'(^[\s*!\?%,/]?)' |
|
475 | 475 | # r'(\s*[\?\w\.]+\w*\s*)' |
|
476 | 476 | # r'(\(?.*$)') |
|
477 | 477 | |
|
478 | 478 | # RegExp to identify potential function names |
|
479 | 479 | self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$') |
|
480 | 480 | |
|
481 | 481 | # RegExp to exclude strings with this start from autocalling. In |
|
482 | 482 | # particular, all binary operators should be excluded, so that if foo |
|
483 | 483 | # is callable, foo OP bar doesn't become foo(OP bar), which is |
|
484 | 484 | # invalid. The characters '!=()' don't need to be checked for, as the |
|
485 | 485 | # _prefilter routine explicitely does so, to catch direct calls and |
|
486 | 486 | # rebindings of existing names. |
|
487 | 487 | |
|
488 | 488 | # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise |
|
489 | 489 | # it affects the rest of the group in square brackets. |
|
490 | 490 | self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]' |
|
491 | 491 | '|^is |^not |^in |^and |^or ') |
|
492 | 492 | |
|
493 | 493 | # try to catch also methods for stuff in lists/tuples/dicts: off |
|
494 | 494 | # (experimental). For this to work, the line_split regexp would need |
|
495 | 495 | # to be modified so it wouldn't break things at '['. That line is |
|
496 | 496 | # nasty enough that I shouldn't change it until I can test it _well_. |
|
497 | 497 | #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$') |
|
498 | 498 | |
|
499 | 499 | # keep track of where we started running (mainly for crash post-mortem) |
|
500 | 500 | self.starting_dir = os.getcwd() |
|
501 | 501 | |
|
502 | 502 | # Various switches which can be set |
|
503 | 503 | self.CACHELENGTH = 5000 # this is cheap, it's just text |
|
504 | 504 | self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__ |
|
505 | 505 | self.banner2 = banner2 |
|
506 | 506 | |
|
507 | 507 | # TraceBack handlers: |
|
508 | 508 | |
|
509 | 509 | # Syntax error handler. |
|
510 | 510 | self.SyntaxTB = SyntaxTB(color_scheme='NoColor') |
|
511 | 511 | |
|
512 | 512 | # The interactive one is initialized with an offset, meaning we always |
|
513 | 513 | # want to remove the topmost item in the traceback, which is our own |
|
514 | 514 | # internal code. Valid modes: ['Plain','Context','Verbose'] |
|
515 | 515 | self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain', |
|
516 | 516 | color_scheme='NoColor', |
|
517 | 517 | tb_offset = 1) |
|
518 | 518 | |
|
519 | 519 | # IPython itself shouldn't crash. This will produce a detailed |
|
520 | 520 | # post-mortem if it does. But we only install the crash handler for |
|
521 | 521 | # non-threaded shells, the threaded ones use a normal verbose reporter |
|
522 | 522 | # and lose the crash handler. This is because exceptions in the main |
|
523 | 523 | # thread (such as in GUI code) propagate directly to sys.excepthook, |
|
524 | 524 | # and there's no point in printing crash dumps for every user exception. |
|
525 | 525 | if self.isthreaded: |
|
526 | 526 | sys.excepthook = ultraTB.FormattedTB() |
|
527 | 527 | else: |
|
528 | 528 | from IPython import CrashHandler |
|
529 | 529 | sys.excepthook = CrashHandler.CrashHandler(self) |
|
530 | 530 | |
|
531 | 531 | # The instance will store a pointer to this, so that runtime code |
|
532 | 532 | # (such as magics) can access it. This is because during the |
|
533 | 533 | # read-eval loop, it gets temporarily overwritten (to deal with GUI |
|
534 | 534 | # frameworks). |
|
535 | 535 | self.sys_excepthook = sys.excepthook |
|
536 | 536 | |
|
537 | 537 | # and add any custom exception handlers the user may have specified |
|
538 | 538 | self.set_custom_exc(*custom_exceptions) |
|
539 | 539 | |
|
540 | # Object inspector | |
|
541 | self.inspector = OInspect.Inspector(OInspect.InspectColors, | |
|
542 | PyColorize.ANSICodeColors, | |
|
543 | 'NoColor') | |
|
544 | 540 | # indentation management |
|
545 | 541 | self.autoindent = False |
|
546 | 542 | self.indent_current_nsp = 0 |
|
547 | 543 | |
|
548 | 544 | # Make some aliases automatically |
|
549 | 545 | # Prepare list of shell aliases to auto-define |
|
550 | 546 | if os.name == 'posix': |
|
551 | 547 | auto_alias = ('mkdir mkdir', 'rmdir rmdir', |
|
552 | 548 | 'mv mv -i','rm rm -i','cp cp -i', |
|
553 | 549 | 'cat cat','less less','clear clear', |
|
554 | 550 | # a better ls |
|
555 | 551 | 'ls ls -F', |
|
556 | 552 | # long ls |
|
557 | 553 | 'll ls -lF', |
|
558 | 554 | # color ls |
|
559 | 555 | 'lc ls -F -o --color', |
|
560 | 556 | # ls normal files only |
|
561 | 557 | 'lf ls -F -o --color %l | grep ^-', |
|
562 | 558 | # ls symbolic links |
|
563 | 559 | 'lk ls -F -o --color %l | grep ^l', |
|
564 | 560 | # directories or links to directories, |
|
565 | 561 | 'ldir ls -F -o --color %l | grep /$', |
|
566 | 562 | # things which are executable |
|
567 | 563 | 'lx ls -F -o --color %l | grep ^-..x', |
|
568 | 564 | ) |
|
569 | 565 | elif os.name in ['nt','dos']: |
|
570 | 566 | auto_alias = ('dir dir /on', 'ls dir /on', |
|
571 | 567 | 'ddir dir /ad /on', 'ldir dir /ad /on', |
|
572 | 568 | 'mkdir mkdir','rmdir rmdir','echo echo', |
|
573 | 569 | 'ren ren','cls cls','copy copy') |
|
574 | 570 | else: |
|
575 | 571 | auto_alias = () |
|
576 | 572 | self.auto_alias = map(lambda s:s.split(None,1),auto_alias) |
|
577 | 573 | # Call the actual (public) initializer |
|
578 | 574 | self.init_auto_alias() |
|
579 | 575 | |
|
580 | 576 | # Produce a public API instance |
|
581 | 577 | self.api = IPython.ipapi.IPApi(self) |
|
582 | 578 | |
|
583 | 579 | # track which builtins we add, so we can clean up later |
|
584 | 580 | self.builtins_added = {} |
|
585 | 581 | # This method will add the necessary builtins for operation, but |
|
586 | 582 | # tracking what it did via the builtins_added dict. |
|
587 | 583 | self.add_builtins() |
|
588 | 584 | |
|
589 | 585 | # end __init__ |
|
590 | 586 | |
|
591 | 587 | def pre_config_initialization(self): |
|
592 | 588 | """Pre-configuration init method |
|
593 | 589 | |
|
594 | 590 | This is called before the configuration files are processed to |
|
595 | 591 | prepare the services the config files might need. |
|
596 | 592 | |
|
597 | 593 | self.rc already has reasonable default values at this point. |
|
598 | 594 | """ |
|
599 | 595 | rc = self.rc |
|
600 | 596 | |
|
601 | 597 | self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db") |
|
602 | 598 | |
|
603 | 599 | def post_config_initialization(self): |
|
604 | 600 | """Post configuration init method |
|
605 | 601 | |
|
606 | 602 | This is called after the configuration files have been processed to |
|
607 | 603 | 'finalize' the initialization.""" |
|
608 | 604 | |
|
609 | 605 | rc = self.rc |
|
610 | 606 | |
|
607 | # Object inspector | |
|
608 | self.inspector = OInspect.Inspector(OInspect.InspectColors, | |
|
609 | PyColorize.ANSICodeColors, | |
|
610 | 'NoColor', | |
|
611 | rc.object_info_string_level) | |
|
612 | ||
|
611 | 613 | # Load readline proper |
|
612 | 614 | if rc.readline: |
|
613 | 615 | self.init_readline() |
|
614 | 616 | |
|
615 | 617 | # local shortcut, this is used a LOT |
|
616 | 618 | self.log = self.logger.log |
|
617 | 619 | |
|
618 | 620 | # Initialize cache, set in/out prompts and printing system |
|
619 | 621 | self.outputcache = CachedOutput(self, |
|
620 | 622 | rc.cache_size, |
|
621 | 623 | rc.pprint, |
|
622 | 624 | input_sep = rc.separate_in, |
|
623 | 625 | output_sep = rc.separate_out, |
|
624 | 626 | output_sep2 = rc.separate_out2, |
|
625 | 627 | ps1 = rc.prompt_in1, |
|
626 | 628 | ps2 = rc.prompt_in2, |
|
627 | 629 | ps_out = rc.prompt_out, |
|
628 | 630 | pad_left = rc.prompts_pad_left) |
|
629 | 631 | |
|
630 | 632 | # user may have over-ridden the default print hook: |
|
631 | 633 | try: |
|
632 | 634 | self.outputcache.__class__.display = self.hooks.display |
|
633 | 635 | except AttributeError: |
|
634 | 636 | pass |
|
635 | 637 | |
|
636 | 638 | # I don't like assigning globally to sys, because it means when embedding |
|
637 | 639 | # instances, each embedded instance overrides the previous choice. But |
|
638 | 640 | # sys.displayhook seems to be called internally by exec, so I don't see a |
|
639 | 641 | # way around it. |
|
640 | 642 | sys.displayhook = self.outputcache |
|
641 | 643 | |
|
642 | 644 | # Set user colors (don't do it in the constructor above so that it |
|
643 | 645 | # doesn't crash if colors option is invalid) |
|
644 | 646 | self.magic_colors(rc.colors) |
|
645 | 647 | |
|
646 | 648 | # Set calling of pdb on exceptions |
|
647 | 649 | self.call_pdb = rc.pdb |
|
648 | 650 | |
|
649 | 651 | # Load user aliases |
|
650 | 652 | for alias in rc.alias: |
|
651 | 653 | self.magic_alias(alias) |
|
652 | 654 | self.hooks.late_startup_hook() |
|
653 | 655 | |
|
654 | 656 | for batchfile in [path(arg) for arg in self.rc.args |
|
655 | 657 | if arg.lower().endswith('.ipy')]: |
|
656 | 658 | if not batchfile.isfile(): |
|
657 | 659 | print "No such batch file:", batchfile |
|
658 | 660 | continue |
|
659 | 661 | self.api.runlines(batchfile.text()) |
|
660 | 662 | |
|
661 | 663 | def add_builtins(self): |
|
662 | 664 | """Store ipython references into the builtin namespace. |
|
663 | 665 | |
|
664 | 666 | Some parts of ipython operate via builtins injected here, which hold a |
|
665 | 667 | reference to IPython itself.""" |
|
666 | 668 | |
|
667 | 669 | # TODO: deprecate all except _ip; 'jobs' should be installed |
|
668 | 670 | # by an extension and the rest are under _ip, ipalias is redundant |
|
669 | 671 | builtins_new = dict(__IPYTHON__ = self, |
|
670 | 672 | ip_set_hook = self.set_hook, |
|
671 | 673 | jobs = self.jobs, |
|
672 | 674 | ipmagic = self.ipmagic, |
|
673 | 675 | ipalias = self.ipalias, |
|
674 | 676 | ipsystem = self.ipsystem, |
|
675 | 677 | _ip = self.api |
|
676 | 678 | ) |
|
677 | 679 | for biname,bival in builtins_new.items(): |
|
678 | 680 | try: |
|
679 | 681 | # store the orignal value so we can restore it |
|
680 | 682 | self.builtins_added[biname] = __builtin__.__dict__[biname] |
|
681 | 683 | except KeyError: |
|
682 | 684 | # or mark that it wasn't defined, and we'll just delete it at |
|
683 | 685 | # cleanup |
|
684 | 686 | self.builtins_added[biname] = Undefined |
|
685 | 687 | __builtin__.__dict__[biname] = bival |
|
686 | 688 | |
|
687 | 689 | # Keep in the builtins a flag for when IPython is active. We set it |
|
688 | 690 | # with setdefault so that multiple nested IPythons don't clobber one |
|
689 | 691 | # another. Each will increase its value by one upon being activated, |
|
690 | 692 | # which also gives us a way to determine the nesting level. |
|
691 | 693 | __builtin__.__dict__.setdefault('__IPYTHON__active',0) |
|
692 | 694 | |
|
693 | 695 | def clean_builtins(self): |
|
694 | 696 | """Remove any builtins which might have been added by add_builtins, or |
|
695 | 697 | restore overwritten ones to their previous values.""" |
|
696 | 698 | for biname,bival in self.builtins_added.items(): |
|
697 | 699 | if bival is Undefined: |
|
698 | 700 | del __builtin__.__dict__[biname] |
|
699 | 701 | else: |
|
700 | 702 | __builtin__.__dict__[biname] = bival |
|
701 | 703 | self.builtins_added.clear() |
|
702 | 704 | |
|
703 | 705 | def set_hook(self,name,hook, priority = 50): |
|
704 | 706 | """set_hook(name,hook) -> sets an internal IPython hook. |
|
705 | 707 | |
|
706 | 708 | IPython exposes some of its internal API as user-modifiable hooks. By |
|
707 | 709 | adding your function to one of these hooks, you can modify IPython's |
|
708 | 710 | behavior to call at runtime your own routines.""" |
|
709 | 711 | |
|
710 | 712 | # At some point in the future, this should validate the hook before it |
|
711 | 713 | # accepts it. Probably at least check that the hook takes the number |
|
712 | 714 | # of args it's supposed to. |
|
713 | 715 | dp = getattr(self.hooks, name, None) |
|
714 | 716 | if name not in IPython.hooks.__all__: |
|
715 | 717 | print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ ) |
|
716 | 718 | if not dp: |
|
717 | 719 | dp = IPython.hooks.CommandChainDispatcher() |
|
718 | 720 | |
|
719 | 721 | f = new.instancemethod(hook,self,self.__class__) |
|
720 | 722 | try: |
|
721 | 723 | dp.add(f,priority) |
|
722 | 724 | except AttributeError: |
|
723 | 725 | # it was not commandchain, plain old func - replace |
|
724 | 726 | dp = f |
|
725 | 727 | |
|
726 | 728 | setattr(self.hooks,name, dp) |
|
727 | 729 | |
|
728 | 730 | |
|
729 | 731 | #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__)) |
|
730 | 732 | |
|
731 | 733 | def set_custom_exc(self,exc_tuple,handler): |
|
732 | 734 | """set_custom_exc(exc_tuple,handler) |
|
733 | 735 | |
|
734 | 736 | Set a custom exception handler, which will be called if any of the |
|
735 | 737 | exceptions in exc_tuple occur in the mainloop (specifically, in the |
|
736 | 738 | runcode() method. |
|
737 | 739 | |
|
738 | 740 | Inputs: |
|
739 | 741 | |
|
740 | 742 | - exc_tuple: a *tuple* of valid exceptions to call the defined |
|
741 | 743 | handler for. It is very important that you use a tuple, and NOT A |
|
742 | 744 | LIST here, because of the way Python's except statement works. If |
|
743 | 745 | you only want to trap a single exception, use a singleton tuple: |
|
744 | 746 | |
|
745 | 747 | exc_tuple == (MyCustomException,) |
|
746 | 748 | |
|
747 | 749 | - handler: this must be defined as a function with the following |
|
748 | 750 | basic interface: def my_handler(self,etype,value,tb). |
|
749 | 751 | |
|
750 | 752 | This will be made into an instance method (via new.instancemethod) |
|
751 | 753 | of IPython itself, and it will be called if any of the exceptions |
|
752 | 754 | listed in the exc_tuple are caught. If the handler is None, an |
|
753 | 755 | internal basic one is used, which just prints basic info. |
|
754 | 756 | |
|
755 | 757 | WARNING: by putting in your own exception handler into IPython's main |
|
756 | 758 | execution loop, you run a very good chance of nasty crashes. This |
|
757 | 759 | facility should only be used if you really know what you are doing.""" |
|
758 | 760 | |
|
759 | 761 | assert type(exc_tuple)==type(()) , \ |
|
760 | 762 | "The custom exceptions must be given AS A TUPLE." |
|
761 | 763 | |
|
762 | 764 | def dummy_handler(self,etype,value,tb): |
|
763 | 765 | print '*** Simple custom exception handler ***' |
|
764 | 766 | print 'Exception type :',etype |
|
765 | 767 | print 'Exception value:',value |
|
766 | 768 | print 'Traceback :',tb |
|
767 | 769 | print 'Source code :','\n'.join(self.buffer) |
|
768 | 770 | |
|
769 | 771 | if handler is None: handler = dummy_handler |
|
770 | 772 | |
|
771 | 773 | self.CustomTB = new.instancemethod(handler,self,self.__class__) |
|
772 | 774 | self.custom_exceptions = exc_tuple |
|
773 | 775 | |
|
774 | 776 | def set_custom_completer(self,completer,pos=0): |
|
775 | 777 | """set_custom_completer(completer,pos=0) |
|
776 | 778 | |
|
777 | 779 | Adds a new custom completer function. |
|
778 | 780 | |
|
779 | 781 | The position argument (defaults to 0) is the index in the completers |
|
780 | 782 | list where you want the completer to be inserted.""" |
|
781 | 783 | |
|
782 | 784 | newcomp = new.instancemethod(completer,self.Completer, |
|
783 | 785 | self.Completer.__class__) |
|
784 | 786 | self.Completer.matchers.insert(pos,newcomp) |
|
785 | 787 | |
|
786 | 788 | def _get_call_pdb(self): |
|
787 | 789 | return self._call_pdb |
|
788 | 790 | |
|
789 | 791 | def _set_call_pdb(self,val): |
|
790 | 792 | |
|
791 | 793 | if val not in (0,1,False,True): |
|
792 | 794 | raise ValueError,'new call_pdb value must be boolean' |
|
793 | 795 | |
|
794 | 796 | # store value in instance |
|
795 | 797 | self._call_pdb = val |
|
796 | 798 | |
|
797 | 799 | # notify the actual exception handlers |
|
798 | 800 | self.InteractiveTB.call_pdb = val |
|
799 | 801 | if self.isthreaded: |
|
800 | 802 | try: |
|
801 | 803 | self.sys_excepthook.call_pdb = val |
|
802 | 804 | except: |
|
803 | 805 | warn('Failed to activate pdb for threaded exception handler') |
|
804 | 806 | |
|
805 | 807 | call_pdb = property(_get_call_pdb,_set_call_pdb,None, |
|
806 | 808 | 'Control auto-activation of pdb at exceptions') |
|
807 | 809 | |
|
808 | 810 | |
|
809 | 811 | # These special functions get installed in the builtin namespace, to |
|
810 | 812 | # provide programmatic (pure python) access to magics, aliases and system |
|
811 | 813 | # calls. This is important for logging, user scripting, and more. |
|
812 | 814 | |
|
813 | 815 | # We are basically exposing, via normal python functions, the three |
|
814 | 816 | # mechanisms in which ipython offers special call modes (magics for |
|
815 | 817 | # internal control, aliases for direct system access via pre-selected |
|
816 | 818 | # names, and !cmd for calling arbitrary system commands). |
|
817 | 819 | |
|
818 | 820 | def ipmagic(self,arg_s): |
|
819 | 821 | """Call a magic function by name. |
|
820 | 822 | |
|
821 | 823 | Input: a string containing the name of the magic function to call and any |
|
822 | 824 | additional arguments to be passed to the magic. |
|
823 | 825 | |
|
824 | 826 | ipmagic('name -opt foo bar') is equivalent to typing at the ipython |
|
825 | 827 | prompt: |
|
826 | 828 | |
|
827 | 829 | In[1]: %name -opt foo bar |
|
828 | 830 | |
|
829 | 831 | To call a magic without arguments, simply use ipmagic('name'). |
|
830 | 832 | |
|
831 | 833 | This provides a proper Python function to call IPython's magics in any |
|
832 | 834 | valid Python code you can type at the interpreter, including loops and |
|
833 | 835 | compound statements. It is added by IPython to the Python builtin |
|
834 | 836 | namespace upon initialization.""" |
|
835 | 837 | |
|
836 | 838 | args = arg_s.split(' ',1) |
|
837 | 839 | magic_name = args[0] |
|
838 | 840 | magic_name = magic_name.lstrip(self.ESC_MAGIC) |
|
839 | 841 | |
|
840 | 842 | try: |
|
841 | 843 | magic_args = args[1] |
|
842 | 844 | except IndexError: |
|
843 | 845 | magic_args = '' |
|
844 | 846 | fn = getattr(self,'magic_'+magic_name,None) |
|
845 | 847 | if fn is None: |
|
846 | 848 | error("Magic function `%s` not found." % magic_name) |
|
847 | 849 | else: |
|
848 | 850 | magic_args = self.var_expand(magic_args) |
|
849 | 851 | return fn(magic_args) |
|
850 | 852 | |
|
851 | 853 | def ipalias(self,arg_s): |
|
852 | 854 | """Call an alias by name. |
|
853 | 855 | |
|
854 | 856 | Input: a string containing the name of the alias to call and any |
|
855 | 857 | additional arguments to be passed to the magic. |
|
856 | 858 | |
|
857 | 859 | ipalias('name -opt foo bar') is equivalent to typing at the ipython |
|
858 | 860 | prompt: |
|
859 | 861 | |
|
860 | 862 | In[1]: name -opt foo bar |
|
861 | 863 | |
|
862 | 864 | To call an alias without arguments, simply use ipalias('name'). |
|
863 | 865 | |
|
864 | 866 | This provides a proper Python function to call IPython's aliases in any |
|
865 | 867 | valid Python code you can type at the interpreter, including loops and |
|
866 | 868 | compound statements. It is added by IPython to the Python builtin |
|
867 | 869 | namespace upon initialization.""" |
|
868 | 870 | |
|
869 | 871 | args = arg_s.split(' ',1) |
|
870 | 872 | alias_name = args[0] |
|
871 | 873 | try: |
|
872 | 874 | alias_args = args[1] |
|
873 | 875 | except IndexError: |
|
874 | 876 | alias_args = '' |
|
875 | 877 | if alias_name in self.alias_table: |
|
876 | 878 | self.call_alias(alias_name,alias_args) |
|
877 | 879 | else: |
|
878 | 880 | error("Alias `%s` not found." % alias_name) |
|
879 | 881 | |
|
880 | 882 | def ipsystem(self,arg_s): |
|
881 | 883 | """Make a system call, using IPython.""" |
|
882 | 884 | |
|
883 | 885 | self.system(arg_s) |
|
884 | 886 | |
|
885 | 887 | def complete(self,text): |
|
886 | 888 | """Return a sorted list of all possible completions on text. |
|
887 | 889 | |
|
888 | 890 | Inputs: |
|
889 | 891 | |
|
890 | 892 | - text: a string of text to be completed on. |
|
891 | 893 | |
|
892 | 894 | This is a wrapper around the completion mechanism, similar to what |
|
893 | 895 | readline does at the command line when the TAB key is hit. By |
|
894 | 896 | exposing it as a method, it can be used by other non-readline |
|
895 | 897 | environments (such as GUIs) for text completion. |
|
896 | 898 | |
|
897 | 899 | Simple usage example: |
|
898 | 900 | |
|
899 | 901 | In [1]: x = 'hello' |
|
900 | 902 | |
|
901 | 903 | In [2]: __IP.complete('x.l') |
|
902 | 904 | Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']""" |
|
903 | 905 | |
|
904 | 906 | complete = self.Completer.complete |
|
905 | 907 | state = 0 |
|
906 | 908 | # use a dict so we get unique keys, since ipyhton's multiple |
|
907 | 909 | # completers can return duplicates. |
|
908 | 910 | comps = {} |
|
909 | 911 | while True: |
|
910 | 912 | newcomp = complete(text,state) |
|
911 | 913 | if newcomp is None: |
|
912 | 914 | break |
|
913 | 915 | comps[newcomp] = 1 |
|
914 | 916 | state += 1 |
|
915 | 917 | outcomps = comps.keys() |
|
916 | 918 | outcomps.sort() |
|
917 | 919 | return outcomps |
|
918 | 920 | |
|
919 | 921 | def set_completer_frame(self, frame=None): |
|
920 | 922 | if frame: |
|
921 | 923 | self.Completer.namespace = frame.f_locals |
|
922 | 924 | self.Completer.global_namespace = frame.f_globals |
|
923 | 925 | else: |
|
924 | 926 | self.Completer.namespace = self.user_ns |
|
925 | 927 | self.Completer.global_namespace = self.user_global_ns |
|
926 | 928 | |
|
927 | 929 | def init_auto_alias(self): |
|
928 | 930 | """Define some aliases automatically. |
|
929 | 931 | |
|
930 | 932 | These are ALL parameter-less aliases""" |
|
931 | 933 | |
|
932 | 934 | for alias,cmd in self.auto_alias: |
|
933 | 935 | self.alias_table[alias] = (0,cmd) |
|
934 | 936 | |
|
935 | 937 | def alias_table_validate(self,verbose=0): |
|
936 | 938 | """Update information about the alias table. |
|
937 | 939 | |
|
938 | 940 | In particular, make sure no Python keywords/builtins are in it.""" |
|
939 | 941 | |
|
940 | 942 | no_alias = self.no_alias |
|
941 | 943 | for k in self.alias_table.keys(): |
|
942 | 944 | if k in no_alias: |
|
943 | 945 | del self.alias_table[k] |
|
944 | 946 | if verbose: |
|
945 | 947 | print ("Deleting alias <%s>, it's a Python " |
|
946 | 948 | "keyword or builtin." % k) |
|
947 | 949 | |
|
948 | 950 | def set_autoindent(self,value=None): |
|
949 | 951 | """Set the autoindent flag, checking for readline support. |
|
950 | 952 | |
|
951 | 953 | If called with no arguments, it acts as a toggle.""" |
|
952 | 954 | |
|
953 | 955 | if not self.has_readline: |
|
954 | 956 | if os.name == 'posix': |
|
955 | 957 | warn("The auto-indent feature requires the readline library") |
|
956 | 958 | self.autoindent = 0 |
|
957 | 959 | return |
|
958 | 960 | if value is None: |
|
959 | 961 | self.autoindent = not self.autoindent |
|
960 | 962 | else: |
|
961 | 963 | self.autoindent = value |
|
962 | 964 | |
|
963 | 965 | def rc_set_toggle(self,rc_field,value=None): |
|
964 | 966 | """Set or toggle a field in IPython's rc config. structure. |
|
965 | 967 | |
|
966 | 968 | If called with no arguments, it acts as a toggle. |
|
967 | 969 | |
|
968 | 970 | If called with a non-existent field, the resulting AttributeError |
|
969 | 971 | exception will propagate out.""" |
|
970 | 972 | |
|
971 | 973 | rc_val = getattr(self.rc,rc_field) |
|
972 | 974 | if value is None: |
|
973 | 975 | value = not rc_val |
|
974 | 976 | setattr(self.rc,rc_field,value) |
|
975 | 977 | |
|
976 | 978 | def user_setup(self,ipythondir,rc_suffix,mode='install'): |
|
977 | 979 | """Install the user configuration directory. |
|
978 | 980 | |
|
979 | 981 | Can be called when running for the first time or to upgrade the user's |
|
980 | 982 | .ipython/ directory with the mode parameter. Valid modes are 'install' |
|
981 | 983 | and 'upgrade'.""" |
|
982 | 984 | |
|
983 | 985 | def wait(): |
|
984 | 986 | try: |
|
985 | 987 | raw_input("Please press <RETURN> to start IPython.") |
|
986 | 988 | except EOFError: |
|
987 | 989 | print >> Term.cout |
|
988 | 990 | print '*'*70 |
|
989 | 991 | |
|
990 | 992 | cwd = os.getcwd() # remember where we started |
|
991 | 993 | glb = glob.glob |
|
992 | 994 | print '*'*70 |
|
993 | 995 | if mode == 'install': |
|
994 | 996 | print \ |
|
995 | 997 | """Welcome to IPython. I will try to create a personal configuration directory |
|
996 | 998 | where you can customize many aspects of IPython's functionality in:\n""" |
|
997 | 999 | else: |
|
998 | 1000 | print 'I am going to upgrade your configuration in:' |
|
999 | 1001 | |
|
1000 | 1002 | print ipythondir |
|
1001 | 1003 | |
|
1002 | 1004 | rcdirend = os.path.join('IPython','UserConfig') |
|
1003 | 1005 | cfg = lambda d: os.path.join(d,rcdirend) |
|
1004 | 1006 | try: |
|
1005 | 1007 | rcdir = filter(os.path.isdir,map(cfg,sys.path))[0] |
|
1006 | 1008 | except IOError: |
|
1007 | 1009 | warning = """ |
|
1008 | 1010 | Installation error. IPython's directory was not found. |
|
1009 | 1011 | |
|
1010 | 1012 | Check the following: |
|
1011 | 1013 | |
|
1012 | 1014 | The ipython/IPython directory should be in a directory belonging to your |
|
1013 | 1015 | PYTHONPATH environment variable (that is, it should be in a directory |
|
1014 | 1016 | belonging to sys.path). You can copy it explicitly there or just link to it. |
|
1015 | 1017 | |
|
1016 | 1018 | IPython will proceed with builtin defaults. |
|
1017 | 1019 | """ |
|
1018 | 1020 | warn(warning) |
|
1019 | 1021 | wait() |
|
1020 | 1022 | return |
|
1021 | 1023 | |
|
1022 | 1024 | if mode == 'install': |
|
1023 | 1025 | try: |
|
1024 | 1026 | shutil.copytree(rcdir,ipythondir) |
|
1025 | 1027 | os.chdir(ipythondir) |
|
1026 | 1028 | rc_files = glb("ipythonrc*") |
|
1027 | 1029 | for rc_file in rc_files: |
|
1028 | 1030 | os.rename(rc_file,rc_file+rc_suffix) |
|
1029 | 1031 | except: |
|
1030 | 1032 | warning = """ |
|
1031 | 1033 | |
|
1032 | 1034 | There was a problem with the installation: |
|
1033 | 1035 | %s |
|
1034 | 1036 | Try to correct it or contact the developers if you think it's a bug. |
|
1035 | 1037 | IPython will proceed with builtin defaults.""" % sys.exc_info()[1] |
|
1036 | 1038 | warn(warning) |
|
1037 | 1039 | wait() |
|
1038 | 1040 | return |
|
1039 | 1041 | |
|
1040 | 1042 | elif mode == 'upgrade': |
|
1041 | 1043 | try: |
|
1042 | 1044 | os.chdir(ipythondir) |
|
1043 | 1045 | except: |
|
1044 | 1046 | print """ |
|
1045 | 1047 | Can not upgrade: changing to directory %s failed. Details: |
|
1046 | 1048 | %s |
|
1047 | 1049 | """ % (ipythondir,sys.exc_info()[1]) |
|
1048 | 1050 | wait() |
|
1049 | 1051 | return |
|
1050 | 1052 | else: |
|
1051 | 1053 | sources = glb(os.path.join(rcdir,'[A-Za-z]*')) |
|
1052 | 1054 | for new_full_path in sources: |
|
1053 | 1055 | new_filename = os.path.basename(new_full_path) |
|
1054 | 1056 | if new_filename.startswith('ipythonrc'): |
|
1055 | 1057 | new_filename = new_filename + rc_suffix |
|
1056 | 1058 | # The config directory should only contain files, skip any |
|
1057 | 1059 | # directories which may be there (like CVS) |
|
1058 | 1060 | if os.path.isdir(new_full_path): |
|
1059 | 1061 | continue |
|
1060 | 1062 | if os.path.exists(new_filename): |
|
1061 | 1063 | old_file = new_filename+'.old' |
|
1062 | 1064 | if os.path.exists(old_file): |
|
1063 | 1065 | os.remove(old_file) |
|
1064 | 1066 | os.rename(new_filename,old_file) |
|
1065 | 1067 | shutil.copy(new_full_path,new_filename) |
|
1066 | 1068 | else: |
|
1067 | 1069 | raise ValueError,'unrecognized mode for install:',`mode` |
|
1068 | 1070 | |
|
1069 | 1071 | # Fix line-endings to those native to each platform in the config |
|
1070 | 1072 | # directory. |
|
1071 | 1073 | try: |
|
1072 | 1074 | os.chdir(ipythondir) |
|
1073 | 1075 | except: |
|
1074 | 1076 | print """ |
|
1075 | 1077 | Problem: changing to directory %s failed. |
|
1076 | 1078 | Details: |
|
1077 | 1079 | %s |
|
1078 | 1080 | |
|
1079 | 1081 | Some configuration files may have incorrect line endings. This should not |
|
1080 | 1082 | cause any problems during execution. """ % (ipythondir,sys.exc_info()[1]) |
|
1081 | 1083 | wait() |
|
1082 | 1084 | else: |
|
1083 | 1085 | for fname in glb('ipythonrc*'): |
|
1084 | 1086 | try: |
|
1085 | 1087 | native_line_ends(fname,backup=0) |
|
1086 | 1088 | except IOError: |
|
1087 | 1089 | pass |
|
1088 | 1090 | |
|
1089 | 1091 | if mode == 'install': |
|
1090 | 1092 | print """ |
|
1091 | 1093 | Successful installation! |
|
1092 | 1094 | |
|
1093 | 1095 | Please read the sections 'Initial Configuration' and 'Quick Tips' in the |
|
1094 | 1096 | IPython manual (there are both HTML and PDF versions supplied with the |
|
1095 | 1097 | distribution) to make sure that your system environment is properly configured |
|
1096 | 1098 | to take advantage of IPython's features. |
|
1097 | 1099 | |
|
1098 | 1100 | Important note: the configuration system has changed! The old system is |
|
1099 | 1101 | still in place, but its setting may be partly overridden by the settings in |
|
1100 | 1102 | "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file |
|
1101 | 1103 | if some of the new settings bother you. |
|
1102 | 1104 | |
|
1103 | 1105 | """ |
|
1104 | 1106 | else: |
|
1105 | 1107 | print """ |
|
1106 | 1108 | Successful upgrade! |
|
1107 | 1109 | |
|
1108 | 1110 | All files in your directory: |
|
1109 | 1111 | %(ipythondir)s |
|
1110 | 1112 | which would have been overwritten by the upgrade were backed up with a .old |
|
1111 | 1113 | extension. If you had made particular customizations in those files you may |
|
1112 | 1114 | want to merge them back into the new files.""" % locals() |
|
1113 | 1115 | wait() |
|
1114 | 1116 | os.chdir(cwd) |
|
1115 | 1117 | # end user_setup() |
|
1116 | 1118 | |
|
1117 | 1119 | def atexit_operations(self): |
|
1118 | 1120 | """This will be executed at the time of exit. |
|
1119 | 1121 | |
|
1120 | 1122 | Saving of persistent data should be performed here. """ |
|
1121 | 1123 | |
|
1122 | 1124 | #print '*** IPython exit cleanup ***' # dbg |
|
1123 | 1125 | # input history |
|
1124 | 1126 | self.savehist() |
|
1125 | 1127 | |
|
1126 | 1128 | # Cleanup all tempfiles left around |
|
1127 | 1129 | for tfile in self.tempfiles: |
|
1128 | 1130 | try: |
|
1129 | 1131 | os.unlink(tfile) |
|
1130 | 1132 | except OSError: |
|
1131 | 1133 | pass |
|
1132 | 1134 | |
|
1133 | 1135 | # save the "persistent data" catch-all dictionary |
|
1134 | 1136 | self.hooks.shutdown_hook() |
|
1135 | 1137 | |
|
1136 | 1138 | def savehist(self): |
|
1137 | 1139 | """Save input history to a file (via readline library).""" |
|
1138 | 1140 | try: |
|
1139 | 1141 | self.readline.write_history_file(self.histfile) |
|
1140 | 1142 | except: |
|
1141 | 1143 | print 'Unable to save IPython command history to file: ' + \ |
|
1142 | 1144 | `self.histfile` |
|
1143 | 1145 | |
|
1144 | 1146 | def pre_readline(self): |
|
1145 | 1147 | """readline hook to be used at the start of each line. |
|
1146 | 1148 | |
|
1147 | 1149 | Currently it handles auto-indent only.""" |
|
1148 | 1150 | |
|
1149 | 1151 | #debugx('self.indent_current_nsp','pre_readline:') |
|
1150 | 1152 | self.readline.insert_text(self.indent_current_str()) |
|
1151 | 1153 | |
|
1152 | 1154 | def init_readline(self): |
|
1153 | 1155 | """Command history completion/saving/reloading.""" |
|
1154 | 1156 | |
|
1155 | 1157 | import IPython.rlineimpl as readline |
|
1156 | 1158 | if not readline.have_readline: |
|
1157 | 1159 | self.has_readline = 0 |
|
1158 | 1160 | self.readline = None |
|
1159 | 1161 | # no point in bugging windows users with this every time: |
|
1160 | 1162 | warn('Readline services not available on this platform.') |
|
1161 | 1163 | else: |
|
1162 | 1164 | sys.modules['readline'] = readline |
|
1163 | 1165 | import atexit |
|
1164 | 1166 | from IPython.completer import IPCompleter |
|
1165 | 1167 | self.Completer = IPCompleter(self, |
|
1166 | 1168 | self.user_ns, |
|
1167 | 1169 | self.user_global_ns, |
|
1168 | 1170 | self.rc.readline_omit__names, |
|
1169 | 1171 | self.alias_table) |
|
1170 | 1172 | |
|
1171 | 1173 | # Platform-specific configuration |
|
1172 | 1174 | if os.name == 'nt': |
|
1173 | 1175 | self.readline_startup_hook = readline.set_pre_input_hook |
|
1174 | 1176 | else: |
|
1175 | 1177 | self.readline_startup_hook = readline.set_startup_hook |
|
1176 | 1178 | |
|
1177 | 1179 | # Load user's initrc file (readline config) |
|
1178 | 1180 | inputrc_name = os.environ.get('INPUTRC') |
|
1179 | 1181 | if inputrc_name is None: |
|
1180 | 1182 | home_dir = get_home_dir() |
|
1181 | 1183 | if home_dir is not None: |
|
1182 | 1184 | inputrc_name = os.path.join(home_dir,'.inputrc') |
|
1183 | 1185 | if os.path.isfile(inputrc_name): |
|
1184 | 1186 | try: |
|
1185 | 1187 | readline.read_init_file(inputrc_name) |
|
1186 | 1188 | except: |
|
1187 | 1189 | warn('Problems reading readline initialization file <%s>' |
|
1188 | 1190 | % inputrc_name) |
|
1189 | 1191 | |
|
1190 | 1192 | self.has_readline = 1 |
|
1191 | 1193 | self.readline = readline |
|
1192 | 1194 | # save this in sys so embedded copies can restore it properly |
|
1193 | 1195 | sys.ipcompleter = self.Completer.complete |
|
1194 | 1196 | readline.set_completer(self.Completer.complete) |
|
1195 | 1197 | |
|
1196 | 1198 | # Configure readline according to user's prefs |
|
1197 | 1199 | for rlcommand in self.rc.readline_parse_and_bind: |
|
1198 | 1200 | readline.parse_and_bind(rlcommand) |
|
1199 | 1201 | |
|
1200 | 1202 | # remove some chars from the delimiters list |
|
1201 | 1203 | delims = readline.get_completer_delims() |
|
1202 | 1204 | delims = delims.translate(string._idmap, |
|
1203 | 1205 | self.rc.readline_remove_delims) |
|
1204 | 1206 | readline.set_completer_delims(delims) |
|
1205 | 1207 | # otherwise we end up with a monster history after a while: |
|
1206 | 1208 | readline.set_history_length(1000) |
|
1207 | 1209 | try: |
|
1208 | 1210 | #print '*** Reading readline history' # dbg |
|
1209 | 1211 | readline.read_history_file(self.histfile) |
|
1210 | 1212 | except IOError: |
|
1211 | 1213 | pass # It doesn't exist yet. |
|
1212 | 1214 | |
|
1213 | 1215 | atexit.register(self.atexit_operations) |
|
1214 | 1216 | del atexit |
|
1215 | 1217 | |
|
1216 | 1218 | # Configure auto-indent for all platforms |
|
1217 | 1219 | self.set_autoindent(self.rc.autoindent) |
|
1218 | 1220 | |
|
1219 | 1221 | def _should_recompile(self,e): |
|
1220 | 1222 | """Utility routine for edit_syntax_error""" |
|
1221 | 1223 | |
|
1222 | 1224 | if e.filename in ('<ipython console>','<input>','<string>', |
|
1223 | 1225 | '<console>','<BackgroundJob compilation>', |
|
1224 | 1226 | None): |
|
1225 | 1227 | |
|
1226 | 1228 | return False |
|
1227 | 1229 | try: |
|
1228 | 1230 | if (self.rc.autoedit_syntax and |
|
1229 | 1231 | not ask_yes_no('Return to editor to correct syntax error? ' |
|
1230 | 1232 | '[Y/n] ','y')): |
|
1231 | 1233 | return False |
|
1232 | 1234 | except EOFError: |
|
1233 | 1235 | return False |
|
1234 | 1236 | |
|
1235 | 1237 | def int0(x): |
|
1236 | 1238 | try: |
|
1237 | 1239 | return int(x) |
|
1238 | 1240 | except TypeError: |
|
1239 | 1241 | return 0 |
|
1240 | 1242 | # always pass integer line and offset values to editor hook |
|
1241 | 1243 | self.hooks.fix_error_editor(e.filename, |
|
1242 | 1244 | int0(e.lineno),int0(e.offset),e.msg) |
|
1243 | 1245 | return True |
|
1244 | 1246 | |
|
1245 | 1247 | def edit_syntax_error(self): |
|
1246 | 1248 | """The bottom half of the syntax error handler called in the main loop. |
|
1247 | 1249 | |
|
1248 | 1250 | Loop until syntax error is fixed or user cancels. |
|
1249 | 1251 | """ |
|
1250 | 1252 | |
|
1251 | 1253 | while self.SyntaxTB.last_syntax_error: |
|
1252 | 1254 | # copy and clear last_syntax_error |
|
1253 | 1255 | err = self.SyntaxTB.clear_err_state() |
|
1254 | 1256 | if not self._should_recompile(err): |
|
1255 | 1257 | return |
|
1256 | 1258 | try: |
|
1257 | 1259 | # may set last_syntax_error again if a SyntaxError is raised |
|
1258 | 1260 | self.safe_execfile(err.filename,self.shell.user_ns) |
|
1259 | 1261 | except: |
|
1260 | 1262 | self.showtraceback() |
|
1261 | 1263 | else: |
|
1262 | 1264 | try: |
|
1263 | 1265 | f = file(err.filename) |
|
1264 | 1266 | try: |
|
1265 | 1267 | sys.displayhook(f.read()) |
|
1266 | 1268 | finally: |
|
1267 | 1269 | f.close() |
|
1268 | 1270 | except: |
|
1269 | 1271 | self.showtraceback() |
|
1270 | 1272 | |
|
1271 | 1273 | def showsyntaxerror(self, filename=None): |
|
1272 | 1274 | """Display the syntax error that just occurred. |
|
1273 | 1275 | |
|
1274 | 1276 | This doesn't display a stack trace because there isn't one. |
|
1275 | 1277 | |
|
1276 | 1278 | If a filename is given, it is stuffed in the exception instead |
|
1277 | 1279 | of what was there before (because Python's parser always uses |
|
1278 | 1280 | "<string>" when reading from a string). |
|
1279 | 1281 | """ |
|
1280 | 1282 | etype, value, last_traceback = sys.exc_info() |
|
1281 | 1283 | |
|
1282 | 1284 | # See note about these variables in showtraceback() below |
|
1283 | 1285 | sys.last_type = etype |
|
1284 | 1286 | sys.last_value = value |
|
1285 | 1287 | sys.last_traceback = last_traceback |
|
1286 | 1288 | |
|
1287 | 1289 | if filename and etype is SyntaxError: |
|
1288 | 1290 | # Work hard to stuff the correct filename in the exception |
|
1289 | 1291 | try: |
|
1290 | 1292 | msg, (dummy_filename, lineno, offset, line) = value |
|
1291 | 1293 | except: |
|
1292 | 1294 | # Not the format we expect; leave it alone |
|
1293 | 1295 | pass |
|
1294 | 1296 | else: |
|
1295 | 1297 | # Stuff in the right filename |
|
1296 | 1298 | try: |
|
1297 | 1299 | # Assume SyntaxError is a class exception |
|
1298 | 1300 | value = SyntaxError(msg, (filename, lineno, offset, line)) |
|
1299 | 1301 | except: |
|
1300 | 1302 | # If that failed, assume SyntaxError is a string |
|
1301 | 1303 | value = msg, (filename, lineno, offset, line) |
|
1302 | 1304 | self.SyntaxTB(etype,value,[]) |
|
1303 | 1305 | |
|
1304 | 1306 | def debugger(self): |
|
1305 | 1307 | """Call the pdb debugger.""" |
|
1306 | 1308 | |
|
1307 | 1309 | if not self.rc.pdb: |
|
1308 | 1310 | return |
|
1309 | 1311 | pdb.pm() |
|
1310 | 1312 | |
|
1311 | 1313 | def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None): |
|
1312 | 1314 | """Display the exception that just occurred. |
|
1313 | 1315 | |
|
1314 | 1316 | If nothing is known about the exception, this is the method which |
|
1315 | 1317 | should be used throughout the code for presenting user tracebacks, |
|
1316 | 1318 | rather than directly invoking the InteractiveTB object. |
|
1317 | 1319 | |
|
1318 | 1320 | A specific showsyntaxerror() also exists, but this method can take |
|
1319 | 1321 | care of calling it if needed, so unless you are explicitly catching a |
|
1320 | 1322 | SyntaxError exception, don't try to analyze the stack manually and |
|
1321 | 1323 | simply call this method.""" |
|
1322 | 1324 | |
|
1323 | 1325 | # Though this won't be called by syntax errors in the input line, |
|
1324 | 1326 | # there may be SyntaxError cases whith imported code. |
|
1325 | 1327 | if exc_tuple is None: |
|
1326 | 1328 | etype, value, tb = sys.exc_info() |
|
1327 | 1329 | else: |
|
1328 | 1330 | etype, value, tb = exc_tuple |
|
1329 | 1331 | if etype is SyntaxError: |
|
1330 | 1332 | self.showsyntaxerror(filename) |
|
1331 | 1333 | else: |
|
1332 | 1334 | # WARNING: these variables are somewhat deprecated and not |
|
1333 | 1335 | # necessarily safe to use in a threaded environment, but tools |
|
1334 | 1336 | # like pdb depend on their existence, so let's set them. If we |
|
1335 | 1337 | # find problems in the field, we'll need to revisit their use. |
|
1336 | 1338 | sys.last_type = etype |
|
1337 | 1339 | sys.last_value = value |
|
1338 | 1340 | sys.last_traceback = tb |
|
1339 | 1341 | |
|
1340 | 1342 | self.InteractiveTB(etype,value,tb,tb_offset=tb_offset) |
|
1341 | 1343 | if self.InteractiveTB.call_pdb and self.has_readline: |
|
1342 | 1344 | # pdb mucks up readline, fix it back |
|
1343 | 1345 | self.readline.set_completer(self.Completer.complete) |
|
1344 | 1346 | |
|
1345 | 1347 | def mainloop(self,banner=None): |
|
1346 | 1348 | """Creates the local namespace and starts the mainloop. |
|
1347 | 1349 | |
|
1348 | 1350 | If an optional banner argument is given, it will override the |
|
1349 | 1351 | internally created default banner.""" |
|
1350 | 1352 | |
|
1351 | 1353 | if self.rc.c: # Emulate Python's -c option |
|
1352 | 1354 | self.exec_init_cmd() |
|
1353 | 1355 | if banner is None: |
|
1354 | 1356 | if not self.rc.banner: |
|
1355 | 1357 | banner = '' |
|
1356 | 1358 | # banner is string? Use it directly! |
|
1357 | 1359 | elif isinstance(self.rc.banner,basestring): |
|
1358 | 1360 | banner = self.rc.banner |
|
1359 | 1361 | else: |
|
1360 | 1362 | banner = self.BANNER+self.banner2 |
|
1361 | 1363 | |
|
1362 | 1364 | self.interact(banner) |
|
1363 | 1365 | |
|
1364 | 1366 | def exec_init_cmd(self): |
|
1365 | 1367 | """Execute a command given at the command line. |
|
1366 | 1368 | |
|
1367 | 1369 | This emulates Python's -c option.""" |
|
1368 | 1370 | |
|
1369 | 1371 | #sys.argv = ['-c'] |
|
1370 | 1372 | self.push(self.rc.c) |
|
1371 | 1373 | |
|
1372 | 1374 | def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0): |
|
1373 | 1375 | """Embeds IPython into a running python program. |
|
1374 | 1376 | |
|
1375 | 1377 | Input: |
|
1376 | 1378 | |
|
1377 | 1379 | - header: An optional header message can be specified. |
|
1378 | 1380 | |
|
1379 | 1381 | - local_ns, global_ns: working namespaces. If given as None, the |
|
1380 | 1382 | IPython-initialized one is updated with __main__.__dict__, so that |
|
1381 | 1383 | program variables become visible but user-specific configuration |
|
1382 | 1384 | remains possible. |
|
1383 | 1385 | |
|
1384 | 1386 | - stack_depth: specifies how many levels in the stack to go to |
|
1385 | 1387 | looking for namespaces (when local_ns and global_ns are None). This |
|
1386 | 1388 | allows an intermediate caller to make sure that this function gets |
|
1387 | 1389 | the namespace from the intended level in the stack. By default (0) |
|
1388 | 1390 | it will get its locals and globals from the immediate caller. |
|
1389 | 1391 | |
|
1390 | 1392 | Warning: it's possible to use this in a program which is being run by |
|
1391 | 1393 | IPython itself (via %run), but some funny things will happen (a few |
|
1392 | 1394 | globals get overwritten). In the future this will be cleaned up, as |
|
1393 | 1395 | there is no fundamental reason why it can't work perfectly.""" |
|
1394 | 1396 | |
|
1395 | 1397 | # Get locals and globals from caller |
|
1396 | 1398 | if local_ns is None or global_ns is None: |
|
1397 | 1399 | call_frame = sys._getframe(stack_depth).f_back |
|
1398 | 1400 | |
|
1399 | 1401 | if local_ns is None: |
|
1400 | 1402 | local_ns = call_frame.f_locals |
|
1401 | 1403 | if global_ns is None: |
|
1402 | 1404 | global_ns = call_frame.f_globals |
|
1403 | 1405 | |
|
1404 | 1406 | # Update namespaces and fire up interpreter |
|
1405 | 1407 | |
|
1406 | 1408 | # The global one is easy, we can just throw it in |
|
1407 | 1409 | self.user_global_ns = global_ns |
|
1408 | 1410 | |
|
1409 | 1411 | # but the user/local one is tricky: ipython needs it to store internal |
|
1410 | 1412 | # data, but we also need the locals. We'll copy locals in the user |
|
1411 | 1413 | # one, but will track what got copied so we can delete them at exit. |
|
1412 | 1414 | # This is so that a later embedded call doesn't see locals from a |
|
1413 | 1415 | # previous call (which most likely existed in a separate scope). |
|
1414 | 1416 | local_varnames = local_ns.keys() |
|
1415 | 1417 | self.user_ns.update(local_ns) |
|
1416 | 1418 | |
|
1417 | 1419 | # Patch for global embedding to make sure that things don't overwrite |
|
1418 | 1420 | # user globals accidentally. Thanks to Richard <rxe@renre-europe.com> |
|
1419 | 1421 | # FIXME. Test this a bit more carefully (the if.. is new) |
|
1420 | 1422 | if local_ns is None and global_ns is None: |
|
1421 | 1423 | self.user_global_ns.update(__main__.__dict__) |
|
1422 | 1424 | |
|
1423 | 1425 | # make sure the tab-completer has the correct frame information, so it |
|
1424 | 1426 | # actually completes using the frame's locals/globals |
|
1425 | 1427 | self.set_completer_frame() |
|
1426 | 1428 | |
|
1427 | 1429 | # before activating the interactive mode, we need to make sure that |
|
1428 | 1430 | # all names in the builtin namespace needed by ipython point to |
|
1429 | 1431 | # ourselves, and not to other instances. |
|
1430 | 1432 | self.add_builtins() |
|
1431 | 1433 | |
|
1432 | 1434 | self.interact(header) |
|
1433 | 1435 | |
|
1434 | 1436 | # now, purge out the user namespace from anything we might have added |
|
1435 | 1437 | # from the caller's local namespace |
|
1436 | 1438 | delvar = self.user_ns.pop |
|
1437 | 1439 | for var in local_varnames: |
|
1438 | 1440 | delvar(var,None) |
|
1439 | 1441 | # and clean builtins we may have overridden |
|
1440 | 1442 | self.clean_builtins() |
|
1441 | 1443 | |
|
1442 | 1444 | def interact(self, banner=None): |
|
1443 | 1445 | """Closely emulate the interactive Python console. |
|
1444 | 1446 | |
|
1445 | 1447 | The optional banner argument specify the banner to print |
|
1446 | 1448 | before the first interaction; by default it prints a banner |
|
1447 | 1449 | similar to the one printed by the real Python interpreter, |
|
1448 | 1450 | followed by the current class name in parentheses (so as not |
|
1449 | 1451 | to confuse this with the real interpreter -- since it's so |
|
1450 | 1452 | close!). |
|
1451 | 1453 | |
|
1452 | 1454 | """ |
|
1453 | 1455 | cprt = 'Type "copyright", "credits" or "license" for more information.' |
|
1454 | 1456 | if banner is None: |
|
1455 | 1457 | self.write("Python %s on %s\n%s\n(%s)\n" % |
|
1456 | 1458 | (sys.version, sys.platform, cprt, |
|
1457 | 1459 | self.__class__.__name__)) |
|
1458 | 1460 | else: |
|
1459 | 1461 | self.write(banner) |
|
1460 | 1462 | |
|
1461 | 1463 | more = 0 |
|
1462 | 1464 | |
|
1463 | 1465 | # Mark activity in the builtins |
|
1464 | 1466 | __builtin__.__dict__['__IPYTHON__active'] += 1 |
|
1465 | 1467 | |
|
1466 | 1468 | # exit_now is set by a call to %Exit or %Quit |
|
1467 | 1469 | self.exit_now = False |
|
1468 | 1470 | while not self.exit_now: |
|
1469 | 1471 | if more: |
|
1470 | 1472 | prompt = self.outputcache.prompt2 |
|
1471 | 1473 | if self.autoindent: |
|
1472 | 1474 | self.readline_startup_hook(self.pre_readline) |
|
1473 | 1475 | else: |
|
1474 | 1476 | prompt = self.outputcache.prompt1 |
|
1475 | 1477 | try: |
|
1476 | 1478 | line = self.raw_input(prompt,more) |
|
1477 | 1479 | if self.autoindent: |
|
1478 | 1480 | self.readline_startup_hook(None) |
|
1479 | 1481 | except KeyboardInterrupt: |
|
1480 | 1482 | self.write('\nKeyboardInterrupt\n') |
|
1481 | 1483 | self.resetbuffer() |
|
1482 | 1484 | # keep cache in sync with the prompt counter: |
|
1483 | 1485 | self.outputcache.prompt_count -= 1 |
|
1484 | 1486 | |
|
1485 | 1487 | if self.autoindent: |
|
1486 | 1488 | self.indent_current_nsp = 0 |
|
1487 | 1489 | more = 0 |
|
1488 | 1490 | except EOFError: |
|
1489 | 1491 | if self.autoindent: |
|
1490 | 1492 | self.readline_startup_hook(None) |
|
1491 | 1493 | self.write('\n') |
|
1492 | 1494 | self.exit() |
|
1493 | 1495 | except bdb.BdbQuit: |
|
1494 | 1496 | warn('The Python debugger has exited with a BdbQuit exception.\n' |
|
1495 | 1497 | 'Because of how pdb handles the stack, it is impossible\n' |
|
1496 | 1498 | 'for IPython to properly format this particular exception.\n' |
|
1497 | 1499 | 'IPython will resume normal operation.') |
|
1498 | 1500 | except: |
|
1499 | 1501 | # exceptions here are VERY RARE, but they can be triggered |
|
1500 | 1502 | # asynchronously by signal handlers, for example. |
|
1501 | 1503 | self.showtraceback() |
|
1502 | 1504 | else: |
|
1503 | 1505 | more = self.push(line) |
|
1504 | 1506 | if (self.SyntaxTB.last_syntax_error and |
|
1505 | 1507 | self.rc.autoedit_syntax): |
|
1506 | 1508 | self.edit_syntax_error() |
|
1507 | 1509 | |
|
1508 | 1510 | # We are off again... |
|
1509 | 1511 | __builtin__.__dict__['__IPYTHON__active'] -= 1 |
|
1510 | 1512 | |
|
1511 | 1513 | def excepthook(self, etype, value, tb): |
|
1512 | 1514 | """One more defense for GUI apps that call sys.excepthook. |
|
1513 | 1515 | |
|
1514 | 1516 | GUI frameworks like wxPython trap exceptions and call |
|
1515 | 1517 | sys.excepthook themselves. I guess this is a feature that |
|
1516 | 1518 | enables them to keep running after exceptions that would |
|
1517 | 1519 | otherwise kill their mainloop. This is a bother for IPython |
|
1518 | 1520 | which excepts to catch all of the program exceptions with a try: |
|
1519 | 1521 | except: statement. |
|
1520 | 1522 | |
|
1521 | 1523 | Normally, IPython sets sys.excepthook to a CrashHandler instance, so if |
|
1522 | 1524 | any app directly invokes sys.excepthook, it will look to the user like |
|
1523 | 1525 | IPython crashed. In order to work around this, we can disable the |
|
1524 | 1526 | CrashHandler and replace it with this excepthook instead, which prints a |
|
1525 | 1527 | regular traceback using our InteractiveTB. In this fashion, apps which |
|
1526 | 1528 | call sys.excepthook will generate a regular-looking exception from |
|
1527 | 1529 | IPython, and the CrashHandler will only be triggered by real IPython |
|
1528 | 1530 | crashes. |
|
1529 | 1531 | |
|
1530 | 1532 | This hook should be used sparingly, only in places which are not likely |
|
1531 | 1533 | to be true IPython errors. |
|
1532 | 1534 | """ |
|
1533 | 1535 | self.showtraceback((etype,value,tb),tb_offset=0) |
|
1534 | 1536 | |
|
1535 | 1537 | def transform_alias(self, alias,rest=''): |
|
1536 | 1538 | """ Transform alias to system command string |
|
1537 | 1539 | |
|
1538 | 1540 | """ |
|
1539 | 1541 | nargs,cmd = self.alias_table[alias] |
|
1540 | 1542 | if ' ' in cmd and os.path.isfile(cmd): |
|
1541 | 1543 | cmd = '"%s"' % cmd |
|
1542 | 1544 | |
|
1543 | 1545 | # Expand the %l special to be the user's input line |
|
1544 | 1546 | if cmd.find('%l') >= 0: |
|
1545 | 1547 | cmd = cmd.replace('%l',rest) |
|
1546 | 1548 | rest = '' |
|
1547 | 1549 | if nargs==0: |
|
1548 | 1550 | # Simple, argument-less aliases |
|
1549 | 1551 | cmd = '%s %s' % (cmd,rest) |
|
1550 | 1552 | else: |
|
1551 | 1553 | # Handle aliases with positional arguments |
|
1552 | 1554 | args = rest.split(None,nargs) |
|
1553 | 1555 | if len(args)< nargs: |
|
1554 | 1556 | error('Alias <%s> requires %s arguments, %s given.' % |
|
1555 | 1557 | (alias,nargs,len(args))) |
|
1556 | 1558 | return None |
|
1557 | 1559 | cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:])) |
|
1558 | 1560 | # Now call the macro, evaluating in the user's namespace |
|
1559 | 1561 | |
|
1560 | 1562 | return cmd |
|
1561 | 1563 | |
|
1562 | 1564 | def call_alias(self,alias,rest=''): |
|
1563 | 1565 | """Call an alias given its name and the rest of the line. |
|
1564 | 1566 | |
|
1565 | 1567 | This is only used to provide backwards compatibility for users of |
|
1566 | 1568 | ipalias(), use of which is not recommended for anymore.""" |
|
1567 | 1569 | |
|
1568 | 1570 | # Now call the macro, evaluating in the user's namespace |
|
1569 | 1571 | cmd = self.transform_alias(alias, rest) |
|
1570 | 1572 | try: |
|
1571 | 1573 | self.system(cmd) |
|
1572 | 1574 | except: |
|
1573 | 1575 | self.showtraceback() |
|
1574 | 1576 | |
|
1575 | 1577 | def indent_current_str(self): |
|
1576 | 1578 | """return the current level of indentation as a string""" |
|
1577 | 1579 | return self.indent_current_nsp * ' ' |
|
1578 | 1580 | |
|
1579 | 1581 | def autoindent_update(self,line): |
|
1580 | 1582 | """Keep track of the indent level.""" |
|
1581 | 1583 | |
|
1582 | 1584 | #debugx('line') |
|
1583 | 1585 | #debugx('self.indent_current_nsp') |
|
1584 | 1586 | if self.autoindent: |
|
1585 | 1587 | if line: |
|
1586 | 1588 | inisp = num_ini_spaces(line) |
|
1587 | 1589 | if inisp < self.indent_current_nsp: |
|
1588 | 1590 | self.indent_current_nsp = inisp |
|
1589 | 1591 | |
|
1590 | 1592 | if line[-1] == ':': |
|
1591 | 1593 | self.indent_current_nsp += 4 |
|
1592 | 1594 | elif dedent_re.match(line): |
|
1593 | 1595 | self.indent_current_nsp -= 4 |
|
1594 | 1596 | else: |
|
1595 | 1597 | self.indent_current_nsp = 0 |
|
1596 | 1598 | |
|
1597 | 1599 | def runlines(self,lines): |
|
1598 | 1600 | """Run a string of one or more lines of source. |
|
1599 | 1601 | |
|
1600 | 1602 | This method is capable of running a string containing multiple source |
|
1601 | 1603 | lines, as if they had been entered at the IPython prompt. Since it |
|
1602 | 1604 | exposes IPython's processing machinery, the given strings can contain |
|
1603 | 1605 | magic calls (%magic), special shell access (!cmd), etc.""" |
|
1604 | 1606 | |
|
1605 | 1607 | # We must start with a clean buffer, in case this is run from an |
|
1606 | 1608 | # interactive IPython session (via a magic, for example). |
|
1607 | 1609 | self.resetbuffer() |
|
1608 | 1610 | lines = lines.split('\n') |
|
1609 | 1611 | more = 0 |
|
1610 | 1612 | for line in lines: |
|
1611 | 1613 | # skip blank lines so we don't mess up the prompt counter, but do |
|
1612 | 1614 | # NOT skip even a blank line if we are in a code block (more is |
|
1613 | 1615 | # true) |
|
1614 | 1616 | if line or more: |
|
1615 | 1617 | more = self.push(self.prefilter(line,more)) |
|
1616 | 1618 | # IPython's runsource returns None if there was an error |
|
1617 | 1619 | # compiling the code. This allows us to stop processing right |
|
1618 | 1620 | # away, so the user gets the error message at the right place. |
|
1619 | 1621 | if more is None: |
|
1620 | 1622 | break |
|
1621 | 1623 | # final newline in case the input didn't have it, so that the code |
|
1622 | 1624 | # actually does get executed |
|
1623 | 1625 | if more: |
|
1624 | 1626 | self.push('\n') |
|
1625 | 1627 | |
|
1626 | 1628 | def runsource(self, source, filename='<input>', symbol='single'): |
|
1627 | 1629 | """Compile and run some source in the interpreter. |
|
1628 | 1630 | |
|
1629 | 1631 | Arguments are as for compile_command(). |
|
1630 | 1632 | |
|
1631 | 1633 | One several things can happen: |
|
1632 | 1634 | |
|
1633 | 1635 | 1) The input is incorrect; compile_command() raised an |
|
1634 | 1636 | exception (SyntaxError or OverflowError). A syntax traceback |
|
1635 | 1637 | will be printed by calling the showsyntaxerror() method. |
|
1636 | 1638 | |
|
1637 | 1639 | 2) The input is incomplete, and more input is required; |
|
1638 | 1640 | compile_command() returned None. Nothing happens. |
|
1639 | 1641 | |
|
1640 | 1642 | 3) The input is complete; compile_command() returned a code |
|
1641 | 1643 | object. The code is executed by calling self.runcode() (which |
|
1642 | 1644 | also handles run-time exceptions, except for SystemExit). |
|
1643 | 1645 | |
|
1644 | 1646 | The return value is: |
|
1645 | 1647 | |
|
1646 | 1648 | - True in case 2 |
|
1647 | 1649 | |
|
1648 | 1650 | - False in the other cases, unless an exception is raised, where |
|
1649 | 1651 | None is returned instead. This can be used by external callers to |
|
1650 | 1652 | know whether to continue feeding input or not. |
|
1651 | 1653 | |
|
1652 | 1654 | The return value can be used to decide whether to use sys.ps1 or |
|
1653 | 1655 | sys.ps2 to prompt the next line.""" |
|
1654 | 1656 | |
|
1655 | 1657 | try: |
|
1656 | 1658 | code = self.compile(source,filename,symbol) |
|
1657 | 1659 | except (OverflowError, SyntaxError, ValueError): |
|
1658 | 1660 | # Case 1 |
|
1659 | 1661 | self.showsyntaxerror(filename) |
|
1660 | 1662 | return None |
|
1661 | 1663 | |
|
1662 | 1664 | if code is None: |
|
1663 | 1665 | # Case 2 |
|
1664 | 1666 | return True |
|
1665 | 1667 | |
|
1666 | 1668 | # Case 3 |
|
1667 | 1669 | # We store the code object so that threaded shells and |
|
1668 | 1670 | # custom exception handlers can access all this info if needed. |
|
1669 | 1671 | # The source corresponding to this can be obtained from the |
|
1670 | 1672 | # buffer attribute as '\n'.join(self.buffer). |
|
1671 | 1673 | self.code_to_run = code |
|
1672 | 1674 | # now actually execute the code object |
|
1673 | 1675 | if self.runcode(code) == 0: |
|
1674 | 1676 | return False |
|
1675 | 1677 | else: |
|
1676 | 1678 | return None |
|
1677 | 1679 | |
|
1678 | 1680 | def runcode(self,code_obj): |
|
1679 | 1681 | """Execute a code object. |
|
1680 | 1682 | |
|
1681 | 1683 | When an exception occurs, self.showtraceback() is called to display a |
|
1682 | 1684 | traceback. |
|
1683 | 1685 | |
|
1684 | 1686 | Return value: a flag indicating whether the code to be run completed |
|
1685 | 1687 | successfully: |
|
1686 | 1688 | |
|
1687 | 1689 | - 0: successful execution. |
|
1688 | 1690 | - 1: an error occurred. |
|
1689 | 1691 | """ |
|
1690 | 1692 | |
|
1691 | 1693 | # Set our own excepthook in case the user code tries to call it |
|
1692 | 1694 | # directly, so that the IPython crash handler doesn't get triggered |
|
1693 | 1695 | old_excepthook,sys.excepthook = sys.excepthook, self.excepthook |
|
1694 | 1696 | |
|
1695 | 1697 | # we save the original sys.excepthook in the instance, in case config |
|
1696 | 1698 | # code (such as magics) needs access to it. |
|
1697 | 1699 | self.sys_excepthook = old_excepthook |
|
1698 | 1700 | outflag = 1 # happens in more places, so it's easier as default |
|
1699 | 1701 | try: |
|
1700 | 1702 | try: |
|
1701 | 1703 | # Embedded instances require separate global/local namespaces |
|
1702 | 1704 | # so they can see both the surrounding (local) namespace and |
|
1703 | 1705 | # the module-level globals when called inside another function. |
|
1704 | 1706 | if self.embedded: |
|
1705 | 1707 | exec code_obj in self.user_global_ns, self.user_ns |
|
1706 | 1708 | # Normal (non-embedded) instances should only have a single |
|
1707 | 1709 | # namespace for user code execution, otherwise functions won't |
|
1708 | 1710 | # see interactive top-level globals. |
|
1709 | 1711 | else: |
|
1710 | 1712 | exec code_obj in self.user_ns |
|
1711 | 1713 | finally: |
|
1712 | 1714 | # Reset our crash handler in place |
|
1713 | 1715 | sys.excepthook = old_excepthook |
|
1714 | 1716 | except SystemExit: |
|
1715 | 1717 | self.resetbuffer() |
|
1716 | 1718 | self.showtraceback() |
|
1717 | 1719 | warn("Type exit or quit to exit IPython " |
|
1718 | 1720 | "(%Exit or %Quit do so unconditionally).",level=1) |
|
1719 | 1721 | except self.custom_exceptions: |
|
1720 | 1722 | etype,value,tb = sys.exc_info() |
|
1721 | 1723 | self.CustomTB(etype,value,tb) |
|
1722 | 1724 | except: |
|
1723 | 1725 | self.showtraceback() |
|
1724 | 1726 | else: |
|
1725 | 1727 | outflag = 0 |
|
1726 | 1728 | if softspace(sys.stdout, 0): |
|
1727 | 1729 | |
|
1728 | 1730 | # Flush out code object which has been run (and source) |
|
1729 | 1731 | self.code_to_run = None |
|
1730 | 1732 | return outflag |
|
1731 | 1733 | |
|
1732 | 1734 | def push(self, line): |
|
1733 | 1735 | """Push a line to the interpreter. |
|
1734 | 1736 | |
|
1735 | 1737 | The line should not have a trailing newline; it may have |
|
1736 | 1738 | internal newlines. The line is appended to a buffer and the |
|
1737 | 1739 | interpreter's runsource() method is called with the |
|
1738 | 1740 | concatenated contents of the buffer as source. If this |
|
1739 | 1741 | indicates that the command was executed or invalid, the buffer |
|
1740 | 1742 | is reset; otherwise, the command is incomplete, and the buffer |
|
1741 | 1743 | is left as it was after the line was appended. The return |
|
1742 | 1744 | value is 1 if more input is required, 0 if the line was dealt |
|
1743 | 1745 | with in some way (this is the same as runsource()). |
|
1744 | 1746 | """ |
|
1745 | 1747 | |
|
1746 | 1748 | # autoindent management should be done here, and not in the |
|
1747 | 1749 | # interactive loop, since that one is only seen by keyboard input. We |
|
1748 | 1750 | # need this done correctly even for code run via runlines (which uses |
|
1749 | 1751 | # push). |
|
1750 | 1752 | |
|
1751 | 1753 | #print 'push line: <%s>' % line # dbg |
|
1752 | 1754 | self.autoindent_update(line) |
|
1753 | 1755 | |
|
1754 | 1756 | self.buffer.append(line) |
|
1755 | 1757 | more = self.runsource('\n'.join(self.buffer), self.filename) |
|
1756 | 1758 | if not more: |
|
1757 | 1759 | self.resetbuffer() |
|
1758 | 1760 | return more |
|
1759 | 1761 | |
|
1760 | 1762 | def resetbuffer(self): |
|
1761 | 1763 | """Reset the input buffer.""" |
|
1762 | 1764 | self.buffer[:] = [] |
|
1763 | 1765 | |
|
1764 | 1766 | def raw_input(self,prompt='',continue_prompt=False): |
|
1765 | 1767 | """Write a prompt and read a line. |
|
1766 | 1768 | |
|
1767 | 1769 | The returned line does not include the trailing newline. |
|
1768 | 1770 | When the user enters the EOF key sequence, EOFError is raised. |
|
1769 | 1771 | |
|
1770 | 1772 | Optional inputs: |
|
1771 | 1773 | |
|
1772 | 1774 | - prompt(''): a string to be printed to prompt the user. |
|
1773 | 1775 | |
|
1774 | 1776 | - continue_prompt(False): whether this line is the first one or a |
|
1775 | 1777 | continuation in a sequence of inputs. |
|
1776 | 1778 | """ |
|
1777 | 1779 | |
|
1778 | 1780 | line = raw_input_original(prompt) |
|
1779 | 1781 | |
|
1780 | 1782 | # Try to be reasonably smart about not re-indenting pasted input more |
|
1781 | 1783 | # than necessary. We do this by trimming out the auto-indent initial |
|
1782 | 1784 | # spaces, if the user's actual input started itself with whitespace. |
|
1783 | 1785 | #debugx('self.buffer[-1]') |
|
1784 | 1786 | |
|
1785 | 1787 | if self.autoindent: |
|
1786 | 1788 | if num_ini_spaces(line) > self.indent_current_nsp: |
|
1787 | 1789 | line = line[self.indent_current_nsp:] |
|
1788 | 1790 | self.indent_current_nsp = 0 |
|
1789 | 1791 | |
|
1790 | 1792 | # store the unfiltered input before the user has any chance to modify |
|
1791 | 1793 | # it. |
|
1792 | 1794 | if line.strip(): |
|
1793 | 1795 | if continue_prompt: |
|
1794 | 1796 | self.input_hist_raw[-1] += '%s\n' % line |
|
1795 | 1797 | else: |
|
1796 | 1798 | self.input_hist_raw.append('%s\n' % line) |
|
1797 | 1799 | |
|
1798 | 1800 | try: |
|
1799 | 1801 | lineout = self.prefilter(line,continue_prompt) |
|
1800 | 1802 | except: |
|
1801 | 1803 | # blanket except, in case a user-defined prefilter crashes, so it |
|
1802 | 1804 | # can't take all of ipython with it. |
|
1803 | 1805 | self.showtraceback() |
|
1804 | 1806 | return lineout |
|
1805 | 1807 | |
|
1806 | 1808 | def split_user_input(self,line): |
|
1807 | 1809 | """Split user input into pre-char, function part and rest.""" |
|
1808 | 1810 | |
|
1809 | 1811 | lsplit = self.line_split.match(line) |
|
1810 | 1812 | if lsplit is None: # no regexp match returns None |
|
1811 | 1813 | try: |
|
1812 | 1814 | iFun,theRest = line.split(None,1) |
|
1813 | 1815 | except ValueError: |
|
1814 | 1816 | iFun,theRest = line,'' |
|
1815 | 1817 | pre = re.match('^(\s*)(.*)',line).groups()[0] |
|
1816 | 1818 | else: |
|
1817 | 1819 | pre,iFun,theRest = lsplit.groups() |
|
1818 | 1820 | |
|
1819 | 1821 | #print 'line:<%s>' % line # dbg |
|
1820 | 1822 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg |
|
1821 | 1823 | return pre,iFun.strip(),theRest |
|
1822 | 1824 | |
|
1823 | 1825 | def _prefilter(self, line, continue_prompt): |
|
1824 | 1826 | """Calls different preprocessors, depending on the form of line.""" |
|
1825 | 1827 | |
|
1826 | 1828 | # All handlers *must* return a value, even if it's blank (''). |
|
1827 | 1829 | |
|
1828 | 1830 | # Lines are NOT logged here. Handlers should process the line as |
|
1829 | 1831 | # needed, update the cache AND log it (so that the input cache array |
|
1830 | 1832 | # stays synced). |
|
1831 | 1833 | |
|
1832 | 1834 | # This function is _very_ delicate, and since it's also the one which |
|
1833 | 1835 | # determines IPython's response to user input, it must be as efficient |
|
1834 | 1836 | # as possible. For this reason it has _many_ returns in it, trying |
|
1835 | 1837 | # always to exit as quickly as it can figure out what it needs to do. |
|
1836 | 1838 | |
|
1837 | 1839 | # This function is the main responsible for maintaining IPython's |
|
1838 | 1840 | # behavior respectful of Python's semantics. So be _very_ careful if |
|
1839 | 1841 | # making changes to anything here. |
|
1840 | 1842 | |
|
1841 | 1843 | #..................................................................... |
|
1842 | 1844 | # Code begins |
|
1843 | 1845 | |
|
1844 | 1846 | #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg |
|
1845 | 1847 | |
|
1846 | 1848 | # save the line away in case we crash, so the post-mortem handler can |
|
1847 | 1849 | # record it |
|
1848 | 1850 | self._last_input_line = line |
|
1849 | 1851 | |
|
1850 | 1852 | #print '***line: <%s>' % line # dbg |
|
1851 | 1853 | |
|
1852 | 1854 | # the input history needs to track even empty lines |
|
1853 | 1855 | stripped = line.strip() |
|
1854 | 1856 | |
|
1855 | 1857 | if not stripped: |
|
1856 | 1858 | if not continue_prompt: |
|
1857 | 1859 | self.outputcache.prompt_count -= 1 |
|
1858 | 1860 | return self.handle_normal(line,continue_prompt) |
|
1859 | 1861 | #return self.handle_normal('',continue_prompt) |
|
1860 | 1862 | |
|
1861 | 1863 | # print '***cont',continue_prompt # dbg |
|
1862 | 1864 | # special handlers are only allowed for single line statements |
|
1863 | 1865 | if continue_prompt and not self.rc.multi_line_specials: |
|
1864 | 1866 | return self.handle_normal(line,continue_prompt) |
|
1865 | 1867 | |
|
1866 | 1868 | |
|
1867 | 1869 | # For the rest, we need the structure of the input |
|
1868 | 1870 | pre,iFun,theRest = self.split_user_input(line) |
|
1869 | 1871 | |
|
1870 | 1872 | # See whether any pre-existing handler can take care of it |
|
1871 | 1873 | |
|
1872 | 1874 | rewritten = self.hooks.input_prefilter(stripped) |
|
1873 | 1875 | if rewritten != stripped: # ok, some prefilter did something |
|
1874 | 1876 | rewritten = pre + rewritten # add indentation |
|
1875 | 1877 | return self.handle_normal(rewritten) |
|
1876 | 1878 | |
|
1877 | ||
|
1878 | ||
|
1879 | ||
|
1880 | 1879 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg |
|
1881 | 1880 | |
|
1882 | 1881 | # First check for explicit escapes in the last/first character |
|
1883 | 1882 | handler = None |
|
1884 | 1883 | if line[-1] == self.ESC_HELP: |
|
1885 | 1884 | handler = self.esc_handlers.get(line[-1]) # the ? can be at the end |
|
1886 | 1885 | if handler is None: |
|
1887 | 1886 | # look at the first character of iFun, NOT of line, so we skip |
|
1888 | 1887 | # leading whitespace in multiline input |
|
1889 | 1888 | handler = self.esc_handlers.get(iFun[0:1]) |
|
1890 | 1889 | if handler is not None: |
|
1891 | 1890 | return handler(line,continue_prompt,pre,iFun,theRest) |
|
1892 | 1891 | # Emacs ipython-mode tags certain input lines |
|
1893 | 1892 | if line.endswith('# PYTHON-MODE'): |
|
1894 | 1893 | return self.handle_emacs(line,continue_prompt) |
|
1895 | 1894 | |
|
1896 | 1895 | # Next, check if we can automatically execute this thing |
|
1897 | 1896 | |
|
1898 | 1897 | # Allow ! in multi-line statements if multi_line_specials is on: |
|
1899 | 1898 | if continue_prompt and self.rc.multi_line_specials and \ |
|
1900 | 1899 | iFun.startswith(self.ESC_SHELL): |
|
1901 | 1900 | return self.handle_shell_escape(line,continue_prompt, |
|
1902 | 1901 | pre=pre,iFun=iFun, |
|
1903 | 1902 | theRest=theRest) |
|
1904 | 1903 | |
|
1905 | 1904 | # Let's try to find if the input line is a magic fn |
|
1906 | 1905 | oinfo = None |
|
1907 | 1906 | if hasattr(self,'magic_'+iFun): |
|
1908 | 1907 | # WARNING: _ofind uses getattr(), so it can consume generators and |
|
1909 | 1908 | # cause other side effects. |
|
1910 | 1909 | oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic |
|
1911 | 1910 | if oinfo['ismagic']: |
|
1912 | 1911 | # Be careful not to call magics when a variable assignment is |
|
1913 | 1912 | # being made (ls='hi', for example) |
|
1914 | 1913 | if self.rc.automagic and \ |
|
1915 | 1914 | (len(theRest)==0 or theRest[0] not in '!=()<>,') and \ |
|
1916 | 1915 | (self.rc.multi_line_specials or not continue_prompt): |
|
1917 | 1916 | return self.handle_magic(line,continue_prompt, |
|
1918 | 1917 | pre,iFun,theRest) |
|
1919 | 1918 | else: |
|
1920 | 1919 | return self.handle_normal(line,continue_prompt) |
|
1921 | 1920 | |
|
1922 | 1921 | # If the rest of the line begins with an (in)equality, assginment or |
|
1923 | 1922 | # function call, we should not call _ofind but simply execute it. |
|
1924 | 1923 | # This avoids spurious geattr() accesses on objects upon assignment. |
|
1925 | 1924 | # |
|
1926 | 1925 | # It also allows users to assign to either alias or magic names true |
|
1927 | 1926 | # python variables (the magic/alias systems always take second seat to |
|
1928 | 1927 | # true python code). |
|
1929 | 1928 | if theRest and theRest[0] in '!=()': |
|
1930 | 1929 | return self.handle_normal(line,continue_prompt) |
|
1931 | 1930 | |
|
1932 | 1931 | if oinfo is None: |
|
1933 | 1932 | # let's try to ensure that _oinfo is ONLY called when autocall is |
|
1934 | 1933 | # on. Since it has inevitable potential side effects, at least |
|
1935 | 1934 | # having autocall off should be a guarantee to the user that no |
|
1936 | 1935 | # weird things will happen. |
|
1937 | 1936 | |
|
1938 | 1937 | if self.rc.autocall: |
|
1939 | 1938 | oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic |
|
1940 | 1939 | else: |
|
1941 | 1940 | # in this case, all that's left is either an alias or |
|
1942 | 1941 | # processing the line normally. |
|
1943 | 1942 | if iFun in self.alias_table: |
|
1943 | # if autocall is off, by not running _ofind we won't know | |
|
1944 | # whether the given name may also exist in one of the | |
|
1945 | # user's namespace. At this point, it's best to do a | |
|
1946 | # quick check just to be sure that we don't let aliases | |
|
1947 | # shadow variables. | |
|
1948 | head = iFun.split('.',1)[0] | |
|
1949 | if head in self.user_ns or head in self.internal_ns \ | |
|
1950 | or head in __builtin__.__dict__: | |
|
1951 | return self.handle_normal(line,continue_prompt) | |
|
1952 | else: | |
|
1944 | 1953 | return self.handle_alias(line,continue_prompt, |
|
1945 | 1954 | pre,iFun,theRest) |
|
1946 | 1955 | |
|
1947 | 1956 | else: |
|
1948 | 1957 | return self.handle_normal(line,continue_prompt) |
|
1949 | 1958 | |
|
1950 | 1959 | if not oinfo['found']: |
|
1951 | 1960 | return self.handle_normal(line,continue_prompt) |
|
1952 | 1961 | else: |
|
1953 | 1962 | #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg |
|
1954 | 1963 | if oinfo['isalias']: |
|
1955 | 1964 | return self.handle_alias(line,continue_prompt, |
|
1956 | 1965 | pre,iFun,theRest) |
|
1957 | 1966 | |
|
1958 | 1967 | if (self.rc.autocall |
|
1959 | 1968 | and |
|
1960 | 1969 | ( |
|
1961 | 1970 | #only consider exclusion re if not "," or ";" autoquoting |
|
1962 | 1971 | (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2 |
|
1963 | 1972 | or pre == self.ESC_PAREN) or |
|
1964 | 1973 | (not self.re_exclude_auto.match(theRest))) |
|
1965 | 1974 | and |
|
1966 | 1975 | self.re_fun_name.match(iFun) and |
|
1967 | 1976 | callable(oinfo['obj'])) : |
|
1968 | 1977 | #print 'going auto' # dbg |
|
1969 | 1978 | return self.handle_auto(line,continue_prompt, |
|
1970 | 1979 | pre,iFun,theRest,oinfo['obj']) |
|
1971 | 1980 | else: |
|
1972 | 1981 | #print 'was callable?', callable(oinfo['obj']) # dbg |
|
1973 | 1982 | return self.handle_normal(line,continue_prompt) |
|
1974 | 1983 | |
|
1975 | 1984 | # If we get here, we have a normal Python line. Log and return. |
|
1976 | 1985 | return self.handle_normal(line,continue_prompt) |
|
1977 | 1986 | |
|
1978 | 1987 | def _prefilter_dumb(self, line, continue_prompt): |
|
1979 | 1988 | """simple prefilter function, for debugging""" |
|
1980 | 1989 | return self.handle_normal(line,continue_prompt) |
|
1981 | 1990 | |
|
1982 | 1991 | # Set the default prefilter() function (this can be user-overridden) |
|
1983 | 1992 | prefilter = _prefilter |
|
1984 | 1993 | |
|
1985 | 1994 | def handle_normal(self,line,continue_prompt=None, |
|
1986 | 1995 | pre=None,iFun=None,theRest=None): |
|
1987 | 1996 | """Handle normal input lines. Use as a template for handlers.""" |
|
1988 | 1997 | |
|
1989 | 1998 | # With autoindent on, we need some way to exit the input loop, and I |
|
1990 | 1999 | # don't want to force the user to have to backspace all the way to |
|
1991 | 2000 | # clear the line. The rule will be in this case, that either two |
|
1992 | 2001 | # lines of pure whitespace in a row, or a line of pure whitespace but |
|
1993 | 2002 | # of a size different to the indent level, will exit the input loop. |
|
1994 | 2003 | |
|
1995 | 2004 | if (continue_prompt and self.autoindent and line.isspace() and |
|
1996 | 2005 | (0 < abs(len(line) - self.indent_current_nsp) <= 2 or |
|
1997 | 2006 | (self.buffer[-1]).isspace() )): |
|
1998 | 2007 | line = '' |
|
1999 | 2008 | |
|
2000 | 2009 | self.log(line,continue_prompt) |
|
2001 | 2010 | return line |
|
2002 | 2011 | |
|
2003 | 2012 | def handle_alias(self,line,continue_prompt=None, |
|
2004 | 2013 | pre=None,iFun=None,theRest=None): |
|
2005 | 2014 | """Handle alias input lines. """ |
|
2006 | 2015 | |
|
2007 | 2016 | # pre is needed, because it carries the leading whitespace. Otherwise |
|
2008 | 2017 | # aliases won't work in indented sections. |
|
2009 | 2018 | transformed = self.transform_alias(iFun, theRest) |
|
2010 | 2019 | line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed )) |
|
2011 | 2020 | self.log(line_out,continue_prompt) |
|
2012 | 2021 | return line_out |
|
2013 | 2022 | |
|
2014 | 2023 | def handle_shell_escape(self, line, continue_prompt=None, |
|
2015 | 2024 | pre=None,iFun=None,theRest=None): |
|
2016 | 2025 | """Execute the line in a shell, empty return value""" |
|
2017 | 2026 | |
|
2018 | 2027 | #print 'line in :', `line` # dbg |
|
2019 | 2028 | # Example of a special handler. Others follow a similar pattern. |
|
2020 | 2029 | if line.lstrip().startswith('!!'): |
|
2021 | 2030 | # rewrite iFun/theRest to properly hold the call to %sx and |
|
2022 | 2031 | # the actual command to be executed, so handle_magic can work |
|
2023 | 2032 | # correctly |
|
2024 | 2033 | theRest = '%s %s' % (iFun[2:],theRest) |
|
2025 | 2034 | iFun = 'sx' |
|
2026 | 2035 | return self.handle_magic('%ssx %s' % (self.ESC_MAGIC, |
|
2027 | 2036 | line.lstrip()[2:]), |
|
2028 | 2037 | continue_prompt,pre,iFun,theRest) |
|
2029 | 2038 | else: |
|
2030 | 2039 | cmd=line.lstrip().lstrip('!') |
|
2031 | 2040 | line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd)) |
|
2032 | 2041 | # update cache/log and return |
|
2033 | 2042 | self.log(line_out,continue_prompt) |
|
2034 | 2043 | return line_out |
|
2035 | 2044 | |
|
2036 | 2045 | def handle_magic(self, line, continue_prompt=None, |
|
2037 | 2046 | pre=None,iFun=None,theRest=None): |
|
2038 | 2047 | """Execute magic functions.""" |
|
2039 | 2048 | |
|
2040 | 2049 | |
|
2041 | 2050 | cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest)) |
|
2042 | 2051 | self.log(cmd,continue_prompt) |
|
2043 | 2052 | #print 'in handle_magic, cmd=<%s>' % cmd # dbg |
|
2044 | 2053 | return cmd |
|
2045 | 2054 | |
|
2046 | 2055 | def handle_auto(self, line, continue_prompt=None, |
|
2047 | 2056 | pre=None,iFun=None,theRest=None,obj=None): |
|
2048 | 2057 | """Hande lines which can be auto-executed, quoting if requested.""" |
|
2049 | 2058 | |
|
2050 | 2059 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg |
|
2051 | 2060 | |
|
2052 | 2061 | # This should only be active for single-line input! |
|
2053 | 2062 | if continue_prompt: |
|
2054 | 2063 | self.log(line,continue_prompt) |
|
2055 | 2064 | return line |
|
2056 | 2065 | |
|
2057 | 2066 | auto_rewrite = True |
|
2058 | 2067 | |
|
2059 | 2068 | if pre == self.ESC_QUOTE: |
|
2060 | 2069 | # Auto-quote splitting on whitespace |
|
2061 | 2070 | newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) ) |
|
2062 | 2071 | elif pre == self.ESC_QUOTE2: |
|
2063 | 2072 | # Auto-quote whole string |
|
2064 | 2073 | newcmd = '%s("%s")' % (iFun,theRest) |
|
2065 | 2074 | elif pre == self.ESC_PAREN: |
|
2066 | 2075 | newcmd = '%s(%s)' % (iFun,",".join(theRest.split())) |
|
2067 | 2076 | else: |
|
2068 | 2077 | # Auto-paren. |
|
2069 | 2078 | # We only apply it to argument-less calls if the autocall |
|
2070 | 2079 | # parameter is set to 2. We only need to check that autocall is < |
|
2071 | 2080 | # 2, since this function isn't called unless it's at least 1. |
|
2072 | 2081 | if not theRest and (self.rc.autocall < 2): |
|
2073 | 2082 | newcmd = '%s %s' % (iFun,theRest) |
|
2074 | 2083 | auto_rewrite = False |
|
2075 | 2084 | else: |
|
2076 | 2085 | if theRest.startswith('['): |
|
2077 | 2086 | if hasattr(obj,'__getitem__'): |
|
2078 | 2087 | # Don't autocall in this case: item access for an object |
|
2079 | 2088 | # which is BOTH callable and implements __getitem__. |
|
2080 | 2089 | newcmd = '%s %s' % (iFun,theRest) |
|
2081 | 2090 | auto_rewrite = False |
|
2082 | 2091 | else: |
|
2083 | 2092 | # if the object doesn't support [] access, go ahead and |
|
2084 | 2093 | # autocall |
|
2085 | 2094 | newcmd = '%s(%s)' % (iFun.rstrip(),theRest) |
|
2086 | 2095 | elif theRest.endswith(';'): |
|
2087 | 2096 | newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1]) |
|
2088 | 2097 | else: |
|
2089 | 2098 | newcmd = '%s(%s)' % (iFun.rstrip(), theRest) |
|
2090 | 2099 | |
|
2091 | 2100 | if auto_rewrite: |
|
2092 | 2101 | print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd |
|
2093 | 2102 | # log what is now valid Python, not the actual user input (without the |
|
2094 | 2103 | # final newline) |
|
2095 | 2104 | self.log(newcmd,continue_prompt) |
|
2096 | 2105 | return newcmd |
|
2097 | 2106 | |
|
2098 | 2107 | def handle_help(self, line, continue_prompt=None, |
|
2099 | 2108 | pre=None,iFun=None,theRest=None): |
|
2100 | 2109 | """Try to get some help for the object. |
|
2101 | 2110 | |
|
2102 | 2111 | obj? or ?obj -> basic information. |
|
2103 | 2112 | obj?? or ??obj -> more details. |
|
2104 | 2113 | """ |
|
2105 | 2114 | |
|
2106 | 2115 | # We need to make sure that we don't process lines which would be |
|
2107 | 2116 | # otherwise valid python, such as "x=1 # what?" |
|
2108 | 2117 | try: |
|
2109 | 2118 | codeop.compile_command(line) |
|
2110 | 2119 | except SyntaxError: |
|
2111 | 2120 | # We should only handle as help stuff which is NOT valid syntax |
|
2112 | 2121 | if line[0]==self.ESC_HELP: |
|
2113 | 2122 | line = line[1:] |
|
2114 | 2123 | elif line[-1]==self.ESC_HELP: |
|
2115 | 2124 | line = line[:-1] |
|
2116 | 2125 | self.log('#?'+line) |
|
2117 | 2126 | if line: |
|
2118 | 2127 | self.magic_pinfo(line) |
|
2119 | 2128 | else: |
|
2120 | 2129 | page(self.usage,screen_lines=self.rc.screen_length) |
|
2121 | 2130 | return '' # Empty string is needed here! |
|
2122 | 2131 | except: |
|
2123 | 2132 | # Pass any other exceptions through to the normal handler |
|
2124 | 2133 | return self.handle_normal(line,continue_prompt) |
|
2125 | 2134 | else: |
|
2126 | 2135 | # If the code compiles ok, we should handle it normally |
|
2127 | 2136 | return self.handle_normal(line,continue_prompt) |
|
2128 | 2137 | |
|
2129 | 2138 | def getapi(self): |
|
2130 | 2139 | """ Get an IPApi object for this shell instance |
|
2131 | 2140 | |
|
2132 | 2141 | Getting an IPApi object is always preferable to accessing the shell |
|
2133 | 2142 | directly, but this holds true especially for extensions. |
|
2134 | 2143 | |
|
2135 | 2144 | It should always be possible to implement an extension with IPApi |
|
2136 | 2145 | alone. If not, contact maintainer to request an addition. |
|
2137 | 2146 | |
|
2138 | 2147 | """ |
|
2139 | 2148 | return self.api |
|
2140 | 2149 | |
|
2141 | 2150 | def handle_emacs(self,line,continue_prompt=None, |
|
2142 | 2151 | pre=None,iFun=None,theRest=None): |
|
2143 | 2152 | """Handle input lines marked by python-mode.""" |
|
2144 | 2153 | |
|
2145 | 2154 | # Currently, nothing is done. Later more functionality can be added |
|
2146 | 2155 | # here if needed. |
|
2147 | 2156 | |
|
2148 | 2157 | # The input cache shouldn't be updated |
|
2149 | 2158 | |
|
2150 | 2159 | return line |
|
2151 | 2160 | |
|
2152 | 2161 | def mktempfile(self,data=None): |
|
2153 | 2162 | """Make a new tempfile and return its filename. |
|
2154 | 2163 | |
|
2155 | 2164 | This makes a call to tempfile.mktemp, but it registers the created |
|
2156 | 2165 | filename internally so ipython cleans it up at exit time. |
|
2157 | 2166 | |
|
2158 | 2167 | Optional inputs: |
|
2159 | 2168 | |
|
2160 | 2169 | - data(None): if data is given, it gets written out to the temp file |
|
2161 | 2170 | immediately, and the file is closed again.""" |
|
2162 | 2171 | |
|
2163 | 2172 | filename = tempfile.mktemp('.py','ipython_edit_') |
|
2164 | 2173 | self.tempfiles.append(filename) |
|
2165 | 2174 | |
|
2166 | 2175 | if data: |
|
2167 | 2176 | tmp_file = open(filename,'w') |
|
2168 | 2177 | tmp_file.write(data) |
|
2169 | 2178 | tmp_file.close() |
|
2170 | 2179 | return filename |
|
2171 | 2180 | |
|
2172 | 2181 | def write(self,data): |
|
2173 | 2182 | """Write a string to the default output""" |
|
2174 | 2183 | Term.cout.write(data) |
|
2175 | 2184 | |
|
2176 | 2185 | def write_err(self,data): |
|
2177 | 2186 | """Write a string to the default error output""" |
|
2178 | 2187 | Term.cerr.write(data) |
|
2179 | 2188 | |
|
2180 | 2189 | def exit(self): |
|
2181 | 2190 | """Handle interactive exit. |
|
2182 | 2191 | |
|
2183 | 2192 | This method sets the exit_now attribute.""" |
|
2184 | 2193 | |
|
2185 | 2194 | if self.rc.confirm_exit: |
|
2186 | 2195 | if ask_yes_no('Do you really want to exit ([y]/n)?','y'): |
|
2187 | 2196 | self.exit_now = True |
|
2188 | 2197 | else: |
|
2189 | 2198 | self.exit_now = True |
|
2190 | 2199 | return self.exit_now |
|
2191 | 2200 | |
|
2192 | 2201 | def safe_execfile(self,fname,*where,**kw): |
|
2193 | 2202 | fname = os.path.expanduser(fname) |
|
2194 | 2203 | |
|
2195 | 2204 | # find things also in current directory |
|
2196 | 2205 | dname = os.path.dirname(fname) |
|
2197 | 2206 | if not sys.path.count(dname): |
|
2198 | 2207 | sys.path.append(dname) |
|
2199 | 2208 | |
|
2200 | 2209 | try: |
|
2201 | 2210 | xfile = open(fname) |
|
2202 | 2211 | except: |
|
2203 | 2212 | print >> Term.cerr, \ |
|
2204 | 2213 | 'Could not open file <%s> for safe execution.' % fname |
|
2205 | 2214 | return None |
|
2206 | 2215 | |
|
2207 | 2216 | kw.setdefault('islog',0) |
|
2208 | 2217 | kw.setdefault('quiet',1) |
|
2209 | 2218 | kw.setdefault('exit_ignore',0) |
|
2210 | 2219 | first = xfile.readline() |
|
2211 | 2220 | loghead = str(self.loghead_tpl).split('\n',1)[0].strip() |
|
2212 | 2221 | xfile.close() |
|
2213 | 2222 | # line by line execution |
|
2214 | 2223 | if first.startswith(loghead) or kw['islog']: |
|
2215 | 2224 | print 'Loading log file <%s> one line at a time...' % fname |
|
2216 | 2225 | if kw['quiet']: |
|
2217 | 2226 | stdout_save = sys.stdout |
|
2218 | 2227 | sys.stdout = StringIO.StringIO() |
|
2219 | 2228 | try: |
|
2220 | 2229 | globs,locs = where[0:2] |
|
2221 | 2230 | except: |
|
2222 | 2231 | try: |
|
2223 | 2232 | globs = locs = where[0] |
|
2224 | 2233 | except: |
|
2225 | 2234 | globs = locs = globals() |
|
2226 | 2235 | badblocks = [] |
|
2227 | 2236 | |
|
2228 | 2237 | # we also need to identify indented blocks of code when replaying |
|
2229 | 2238 | # logs and put them together before passing them to an exec |
|
2230 | 2239 | # statement. This takes a bit of regexp and look-ahead work in the |
|
2231 | 2240 | # file. It's easiest if we swallow the whole thing in memory |
|
2232 | 2241 | # first, and manually walk through the lines list moving the |
|
2233 | 2242 | # counter ourselves. |
|
2234 | 2243 | indent_re = re.compile('\s+\S') |
|
2235 | 2244 | xfile = open(fname) |
|
2236 | 2245 | filelines = xfile.readlines() |
|
2237 | 2246 | xfile.close() |
|
2238 | 2247 | nlines = len(filelines) |
|
2239 | 2248 | lnum = 0 |
|
2240 | 2249 | while lnum < nlines: |
|
2241 | 2250 | line = filelines[lnum] |
|
2242 | 2251 | lnum += 1 |
|
2243 | 2252 | # don't re-insert logger status info into cache |
|
2244 | 2253 | if line.startswith('#log#'): |
|
2245 | 2254 | continue |
|
2246 | 2255 | else: |
|
2247 | 2256 | # build a block of code (maybe a single line) for execution |
|
2248 | 2257 | block = line |
|
2249 | 2258 | try: |
|
2250 | 2259 | next = filelines[lnum] # lnum has already incremented |
|
2251 | 2260 | except: |
|
2252 | 2261 | next = None |
|
2253 | 2262 | while next and indent_re.match(next): |
|
2254 | 2263 | block += next |
|
2255 | 2264 | lnum += 1 |
|
2256 | 2265 | try: |
|
2257 | 2266 | next = filelines[lnum] |
|
2258 | 2267 | except: |
|
2259 | 2268 | next = None |
|
2260 | 2269 | # now execute the block of one or more lines |
|
2261 | 2270 | try: |
|
2262 | 2271 | exec block in globs,locs |
|
2263 | 2272 | except SystemExit: |
|
2264 | 2273 | pass |
|
2265 | 2274 | except: |
|
2266 | 2275 | badblocks.append(block.rstrip()) |
|
2267 | 2276 | if kw['quiet']: # restore stdout |
|
2268 | 2277 | sys.stdout.close() |
|
2269 | 2278 | sys.stdout = stdout_save |
|
2270 | 2279 | print 'Finished replaying log file <%s>' % fname |
|
2271 | 2280 | if badblocks: |
|
2272 | 2281 | print >> sys.stderr, ('\nThe following lines/blocks in file ' |
|
2273 | 2282 | '<%s> reported errors:' % fname) |
|
2274 | 2283 | |
|
2275 | 2284 | for badline in badblocks: |
|
2276 | 2285 | print >> sys.stderr, badline |
|
2277 | 2286 | else: # regular file execution |
|
2278 | 2287 | try: |
|
2279 | 2288 | execfile(fname,*where) |
|
2280 | 2289 | except SyntaxError: |
|
2281 | 2290 | self.showsyntaxerror() |
|
2282 | 2291 | warn('Failure executing file: <%s>' % fname) |
|
2283 | 2292 | except SystemExit,status: |
|
2284 | 2293 | if not kw['exit_ignore']: |
|
2285 | 2294 | self.showtraceback() |
|
2286 | 2295 | warn('Failure executing file: <%s>' % fname) |
|
2287 | 2296 | except: |
|
2288 | 2297 | self.showtraceback() |
|
2289 | 2298 | warn('Failure executing file: <%s>' % fname) |
|
2290 | 2299 | |
|
2291 | 2300 | #************************* end of file <iplib.py> ***************************** |
@@ -1,755 +1,757 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 | 3 | IPython -- An enhanced Interactive Python |
|
4 | 4 | |
|
5 | 5 | Requires Python 2.1 or better. |
|
6 | 6 | |
|
7 | 7 | This file contains the main make_IPython() starter function. |
|
8 | 8 | |
|
9 |
$Id: ipmaker.py 132 |
|
|
9 | $Id: ipmaker.py 1329 2006-05-26 07:52:45Z fperez $""" | |
|
10 | 10 | |
|
11 | 11 | #***************************************************************************** |
|
12 | 12 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
|
13 | 13 | # |
|
14 | 14 | # Distributed under the terms of the BSD License. The full license is in |
|
15 | 15 | # the file COPYING, distributed as part of this software. |
|
16 | 16 | #***************************************************************************** |
|
17 | 17 | |
|
18 | 18 | from IPython import Release |
|
19 | 19 | __author__ = '%s <%s>' % Release.authors['Fernando'] |
|
20 | 20 | __license__ = Release.license |
|
21 | 21 | __version__ = Release.version |
|
22 | 22 | |
|
23 | 23 | credits._Printer__data = """ |
|
24 | 24 | Python: %s |
|
25 | 25 | |
|
26 | 26 | IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users. |
|
27 | 27 | See http://ipython.scipy.org for more information.""" \ |
|
28 | 28 | % credits._Printer__data |
|
29 | 29 | |
|
30 | 30 | copyright._Printer__data += """ |
|
31 | 31 | |
|
32 | 32 | Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray. |
|
33 | 33 | All Rights Reserved.""" |
|
34 | 34 | |
|
35 | 35 | #**************************************************************************** |
|
36 | 36 | # Required modules |
|
37 | 37 | |
|
38 | 38 | # From the standard library |
|
39 | 39 | import __main__ |
|
40 | 40 | import __builtin__ |
|
41 | 41 | import os |
|
42 | 42 | import re |
|
43 | 43 | import sys |
|
44 | 44 | import types |
|
45 | 45 | from pprint import pprint,pformat |
|
46 | 46 | |
|
47 | 47 | # Our own |
|
48 | 48 | from IPython import DPyGetOpt |
|
49 | 49 | from IPython.ipstruct import Struct |
|
50 | 50 | from IPython.OutputTrap import OutputTrap |
|
51 | 51 | from IPython.ConfigLoader import ConfigLoader |
|
52 | 52 | from IPython.iplib import InteractiveShell |
|
53 | 53 | from IPython.usage import cmd_line_usage,interactive_usage |
|
54 | 54 | from IPython.genutils import * |
|
55 | 55 | |
|
56 | 56 | #----------------------------------------------------------------------------- |
|
57 | 57 | def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1, |
|
58 | 58 | rc_override=None,shell_class=InteractiveShell, |
|
59 | 59 | embedded=False,**kw): |
|
60 | 60 | """This is a dump of IPython into a single function. |
|
61 | 61 | |
|
62 | 62 | Later it will have to be broken up in a sensible manner. |
|
63 | 63 | |
|
64 | 64 | Arguments: |
|
65 | 65 | |
|
66 | 66 | - argv: a list similar to sys.argv[1:]. It should NOT contain the desired |
|
67 | 67 | script name, b/c DPyGetOpt strips the first argument only for the real |
|
68 | 68 | sys.argv. |
|
69 | 69 | |
|
70 | 70 | - user_ns: a dict to be used as the user's namespace.""" |
|
71 | 71 | |
|
72 | 72 | #---------------------------------------------------------------------- |
|
73 | 73 | # Defaults and initialization |
|
74 | 74 | |
|
75 | 75 | # For developer debugging, deactivates crash handler and uses pdb. |
|
76 | 76 | DEVDEBUG = False |
|
77 | 77 | |
|
78 | 78 | if argv is None: |
|
79 | 79 | argv = sys.argv |
|
80 | 80 | |
|
81 | 81 | # __IP is the main global that lives throughout and represents the whole |
|
82 | 82 | # application. If the user redefines it, all bets are off as to what |
|
83 | 83 | # happens. |
|
84 | 84 | |
|
85 | 85 | # __IP is the name of he global which the caller will have accessible as |
|
86 | 86 | # __IP.name. We set its name via the first parameter passed to |
|
87 | 87 | # InteractiveShell: |
|
88 | 88 | |
|
89 | 89 | IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns, |
|
90 | 90 | embedded=embedded,**kw) |
|
91 | 91 | |
|
92 | 92 | # Put 'help' in the user namespace |
|
93 | 93 | from site import _Helper |
|
94 | 94 | IP.user_ns['help'] = _Helper() |
|
95 | 95 | |
|
96 | 96 | |
|
97 | 97 | if DEVDEBUG: |
|
98 | 98 | # For developer debugging only (global flag) |
|
99 | 99 | from IPython import ultraTB |
|
100 | 100 | sys.excepthook = ultraTB.VerboseTB(call_pdb=1) |
|
101 | 101 | |
|
102 | 102 | IP.BANNER_PARTS = ['Python %s\n' |
|
103 | 103 | 'Type "copyright", "credits" or "license" ' |
|
104 | 104 | 'for more information.\n' |
|
105 | 105 | % (sys.version.split('\n')[0],), |
|
106 | 106 | "IPython %s -- An enhanced Interactive Python." |
|
107 | 107 | % (__version__,), |
|
108 | 108 | """? -> Introduction to IPython's features. |
|
109 | 109 | %magic -> Information about IPython's 'magic' % functions. |
|
110 | 110 | help -> Python's own help system. |
|
111 | 111 | object? -> Details about 'object'. ?object also works, ?? prints more. |
|
112 | 112 | """ ] |
|
113 | 113 | |
|
114 | 114 | IP.usage = interactive_usage |
|
115 | 115 | |
|
116 | 116 | # Platform-dependent suffix and directory names. We use _ipython instead |
|
117 | 117 | # of .ipython under win32 b/c there's software that breaks with .named |
|
118 | 118 | # directories on that platform. |
|
119 | 119 | if os.name == 'posix': |
|
120 | 120 | rc_suffix = '' |
|
121 | 121 | ipdir_def = '.ipython' |
|
122 | 122 | else: |
|
123 | 123 | rc_suffix = '.ini' |
|
124 | 124 | ipdir_def = '_ipython' |
|
125 | 125 | |
|
126 | 126 | # default directory for configuration |
|
127 | 127 | ipythondir = os.path.abspath(os.environ.get('IPYTHONDIR', |
|
128 | 128 | os.path.join(IP.home_dir,ipdir_def))) |
|
129 | 129 | |
|
130 | 130 | # add personal .ipython dir to sys.path so that users can put things in |
|
131 | 131 | # there for customization |
|
132 | 132 | sys.path.append(ipythondir) |
|
133 | 133 | |
|
134 | 134 | sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran |
|
135 | 135 | |
|
136 | 136 | # we need the directory where IPython itself is installed |
|
137 | 137 | import IPython |
|
138 | 138 | IPython_dir = os.path.dirname(IPython.__file__) |
|
139 | 139 | del IPython |
|
140 | 140 | |
|
141 | 141 | #------------------------------------------------------------------------- |
|
142 | 142 | # Command line handling |
|
143 | 143 | |
|
144 | 144 | # Valid command line options (uses DPyGetOpt syntax, like Perl's |
|
145 | 145 | # GetOpt::Long) |
|
146 | 146 | |
|
147 | 147 | # Any key not listed here gets deleted even if in the file (like session |
|
148 | 148 | # or profile). That's deliberate, to maintain the rc namespace clean. |
|
149 | 149 | |
|
150 | 150 | # Each set of options appears twice: under _conv only the names are |
|
151 | 151 | # listed, indicating which type they must be converted to when reading the |
|
152 | 152 | # ipythonrc file. And under DPyGetOpt they are listed with the regular |
|
153 | 153 | # DPyGetOpt syntax (=s,=i,:f,etc). |
|
154 | 154 | |
|
155 | 155 | # Make sure there's a space before each end of line (they get auto-joined!) |
|
156 | 156 | cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i ' |
|
157 | 157 | 'c=s classic|cl color_info! colors=s confirm_exit! ' |
|
158 |
'debug! deep_reload! editor=s log|l messages! nosep |
|
|
158 | 'debug! deep_reload! editor=s log|l messages! nosep ' | |
|
159 | 'object_info_string_level=i pdb! ' | |
|
159 | 160 | 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s ' |
|
160 | 161 | 'quick screen_length|sl=i prompts_pad_left=i ' |
|
161 | 162 | 'logfile|lf=s logplay|lp=s profile|p=s ' |
|
162 | 163 | 'readline! readline_merge_completions! ' |
|
163 | 164 | 'readline_omit__names! ' |
|
164 | 165 | 'rcfile=s separate_in|si=s separate_out|so=s ' |
|
165 | 166 | 'separate_out2|so2=s xmode=s wildcards_case_sensitive! ' |
|
166 | 167 | 'magic_docstrings system_verbose! ' |
|
167 | 168 | 'multi_line_specials! ' |
|
168 | 169 | 'wxversion=s ' |
|
169 | 170 | 'autoedit_syntax!') |
|
170 | 171 | |
|
171 | 172 | # Options that can *only* appear at the cmd line (not in rcfiles). |
|
172 | 173 | |
|
173 | 174 | # The "ignore" option is a kludge so that Emacs buffers don't crash, since |
|
174 | 175 | # the 'C-c !' command in emacs automatically appends a -i option at the end. |
|
175 | 176 | cmdline_only = ('help ignore|i ipythondir=s Version upgrade ' |
|
176 | 177 | 'gthread! qthread! wthread! pylab! tk!') |
|
177 | 178 | |
|
178 | 179 | # Build the actual name list to be used by DPyGetOpt |
|
179 | 180 | opts_names = qw(cmdline_opts) + qw(cmdline_only) |
|
180 | 181 | |
|
181 | 182 | # Set sensible command line defaults. |
|
182 | 183 | # This should have everything from cmdline_opts and cmdline_only |
|
183 | 184 | opts_def = Struct(autocall = 1, |
|
184 | 185 | autoedit_syntax = 0, |
|
185 | 186 | autoindent = 0, |
|
186 | 187 | automagic = 1, |
|
187 | 188 | banner = 1, |
|
188 | 189 | cache_size = 1000, |
|
189 | 190 | c = '', |
|
190 | 191 | classic = 0, |
|
191 | 192 | colors = 'NoColor', |
|
192 | 193 | color_info = 0, |
|
193 | 194 | confirm_exit = 1, |
|
194 | 195 | debug = 0, |
|
195 | 196 | deep_reload = 0, |
|
196 | 197 | editor = '0', |
|
197 | 198 | help = 0, |
|
198 | 199 | ignore = 0, |
|
199 | 200 | ipythondir = ipythondir, |
|
200 | 201 | log = 0, |
|
201 | 202 | logfile = '', |
|
202 | 203 | logplay = '', |
|
203 | 204 | multi_line_specials = 1, |
|
204 | 205 | messages = 1, |
|
206 | object_info_string_level = 0, | |
|
205 | 207 | nosep = 0, |
|
206 | 208 | pdb = 0, |
|
207 | 209 | pprint = 0, |
|
208 | 210 | profile = '', |
|
209 | 211 | prompt_in1 = 'In [\\#]: ', |
|
210 | 212 | prompt_in2 = ' .\\D.: ', |
|
211 | 213 | prompt_out = 'Out[\\#]: ', |
|
212 | 214 | prompts_pad_left = 1, |
|
213 | 215 | quick = 0, |
|
214 | 216 | readline = 1, |
|
215 | 217 | readline_merge_completions = 1, |
|
216 | 218 | readline_omit__names = 0, |
|
217 | 219 | rcfile = 'ipythonrc' + rc_suffix, |
|
218 | 220 | screen_length = 0, |
|
219 | 221 | separate_in = '\n', |
|
220 | 222 | separate_out = '\n', |
|
221 | 223 | separate_out2 = '', |
|
222 | 224 | system_verbose = 0, |
|
223 | 225 | gthread = 0, |
|
224 | 226 | qthread = 0, |
|
225 | 227 | wthread = 0, |
|
226 | 228 | pylab = 0, |
|
227 | 229 | tk = 0, |
|
228 | 230 | upgrade = 0, |
|
229 | 231 | Version = 0, |
|
230 | 232 | xmode = 'Verbose', |
|
231 | 233 | wildcards_case_sensitive = 1, |
|
232 | 234 | wxversion = '0', |
|
233 | 235 | magic_docstrings = 0, # undocumented, for doc generation |
|
234 | 236 | ) |
|
235 | 237 | |
|
236 | 238 | # Things that will *only* appear in rcfiles (not at the command line). |
|
237 | 239 | # Make sure there's a space before each end of line (they get auto-joined!) |
|
238 | 240 | rcfile_opts = { qwflat: 'include import_mod import_all execfile ', |
|
239 | 241 | qw_lol: 'import_some ', |
|
240 | 242 | # for things with embedded whitespace: |
|
241 | 243 | list_strings:'execute alias readline_parse_and_bind ', |
|
242 | 244 | # Regular strings need no conversion: |
|
243 | 245 | None:'readline_remove_delims ', |
|
244 | 246 | } |
|
245 | 247 | # Default values for these |
|
246 | 248 | rc_def = Struct(include = [], |
|
247 | 249 | import_mod = [], |
|
248 | 250 | import_all = [], |
|
249 | 251 | import_some = [[]], |
|
250 | 252 | execute = [], |
|
251 | 253 | execfile = [], |
|
252 | 254 | alias = [], |
|
253 | 255 | readline_parse_and_bind = [], |
|
254 | 256 | readline_remove_delims = '', |
|
255 | 257 | ) |
|
256 | 258 | |
|
257 | 259 | # Build the type conversion dictionary from the above tables: |
|
258 | 260 | typeconv = rcfile_opts.copy() |
|
259 | 261 | typeconv.update(optstr2types(cmdline_opts)) |
|
260 | 262 | |
|
261 | 263 | # FIXME: the None key appears in both, put that back together by hand. Ugly! |
|
262 | 264 | typeconv[None] += ' ' + rcfile_opts[None] |
|
263 | 265 | |
|
264 | 266 | # Remove quotes at ends of all strings (used to protect spaces) |
|
265 | 267 | typeconv[unquote_ends] = typeconv[None] |
|
266 | 268 | del typeconv[None] |
|
267 | 269 | |
|
268 | 270 | # Build the list we'll use to make all config decisions with defaults: |
|
269 | 271 | opts_all = opts_def.copy() |
|
270 | 272 | opts_all.update(rc_def) |
|
271 | 273 | |
|
272 | 274 | # Build conflict resolver for recursive loading of config files: |
|
273 | 275 | # - preserve means the outermost file maintains the value, it is not |
|
274 | 276 | # overwritten if an included file has the same key. |
|
275 | 277 | # - add_flip applies + to the two values, so it better make sense to add |
|
276 | 278 | # those types of keys. But it flips them first so that things loaded |
|
277 | 279 | # deeper in the inclusion chain have lower precedence. |
|
278 | 280 | conflict = {'preserve': ' '.join([ typeconv[int], |
|
279 | 281 | typeconv[unquote_ends] ]), |
|
280 | 282 | 'add_flip': ' '.join([ typeconv[qwflat], |
|
281 | 283 | typeconv[qw_lol], |
|
282 | 284 | typeconv[list_strings] ]) |
|
283 | 285 | } |
|
284 | 286 | |
|
285 | 287 | # Now actually process the command line |
|
286 | 288 | getopt = DPyGetOpt.DPyGetOpt() |
|
287 | 289 | getopt.setIgnoreCase(0) |
|
288 | 290 | |
|
289 | 291 | getopt.parseConfiguration(opts_names) |
|
290 | 292 | |
|
291 | 293 | try: |
|
292 | 294 | getopt.processArguments(argv) |
|
293 | 295 | except: |
|
294 | 296 | print cmd_line_usage |
|
295 | 297 | warn('\nError in Arguments: ' + `sys.exc_value`) |
|
296 | 298 | sys.exit(1) |
|
297 | 299 | |
|
298 | 300 | # convert the options dict to a struct for much lighter syntax later |
|
299 | 301 | opts = Struct(getopt.optionValues) |
|
300 | 302 | args = getopt.freeValues |
|
301 | 303 | |
|
302 | 304 | # this is the struct (which has default values at this point) with which |
|
303 | 305 | # we make all decisions: |
|
304 | 306 | opts_all.update(opts) |
|
305 | 307 | |
|
306 | 308 | # Options that force an immediate exit |
|
307 | 309 | if opts_all.help: |
|
308 | 310 | page(cmd_line_usage) |
|
309 | 311 | sys.exit() |
|
310 | 312 | |
|
311 | 313 | if opts_all.Version: |
|
312 | 314 | print __version__ |
|
313 | 315 | sys.exit() |
|
314 | 316 | |
|
315 | 317 | if opts_all.magic_docstrings: |
|
316 | 318 | IP.magic_magic('-latex') |
|
317 | 319 | sys.exit() |
|
318 | 320 | |
|
319 | 321 | # Create user config directory if it doesn't exist. This must be done |
|
320 | 322 | # *after* getting the cmd line options. |
|
321 | 323 | if not os.path.isdir(opts_all.ipythondir): |
|
322 | 324 | IP.user_setup(opts_all.ipythondir,rc_suffix,'install') |
|
323 | 325 | |
|
324 | 326 | # upgrade user config files while preserving a copy of the originals |
|
325 | 327 | if opts_all.upgrade: |
|
326 | 328 | IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade') |
|
327 | 329 | |
|
328 | 330 | # check mutually exclusive options in the *original* command line |
|
329 | 331 | mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'), |
|
330 | 332 | qw('classic profile'),qw('classic rcfile')]) |
|
331 | 333 | |
|
332 | 334 | # Fix up sys.argv to omit the ipython call, for consistency with how |
|
333 | 335 | # Python itself operates (the inconsistency can break user scripts which |
|
334 | 336 | # rely on the Python behavior when run under ipython). |
|
335 | 337 | sys.argv[:] = sys.argv[1:] |
|
336 | 338 | |
|
337 | 339 | #--------------------------------------------------------------------------- |
|
338 | 340 | # Log replay |
|
339 | 341 | |
|
340 | 342 | # if -logplay, we need to 'become' the other session. That basically means |
|
341 | 343 | # replacing the current command line environment with that of the old |
|
342 | 344 | # session and moving on. |
|
343 | 345 | |
|
344 | 346 | # this is needed so that later we know we're in session reload mode, as |
|
345 | 347 | # opts_all will get overwritten: |
|
346 | 348 | load_logplay = 0 |
|
347 | 349 | |
|
348 | 350 | if opts_all.logplay: |
|
349 | 351 | load_logplay = opts_all.logplay |
|
350 | 352 | opts_debug_save = opts_all.debug |
|
351 | 353 | try: |
|
352 | 354 | logplay = open(opts_all.logplay) |
|
353 | 355 | except IOError: |
|
354 | 356 | if opts_all.debug: IP.InteractiveTB() |
|
355 | 357 | warn('Could not open logplay file '+`opts_all.logplay`) |
|
356 | 358 | # restore state as if nothing had happened and move on, but make |
|
357 | 359 | # sure that later we don't try to actually load the session file |
|
358 | 360 | logplay = None |
|
359 | 361 | load_logplay = 0 |
|
360 | 362 | del opts_all.logplay |
|
361 | 363 | else: |
|
362 | 364 | try: |
|
363 | 365 | logplay.readline() |
|
364 | 366 | logplay.readline(); |
|
365 | 367 | # this reloads that session's command line |
|
366 | 368 | cmd = logplay.readline()[6:] |
|
367 | 369 | exec cmd |
|
368 | 370 | # restore the true debug flag given so that the process of |
|
369 | 371 | # session loading itself can be monitored. |
|
370 | 372 | opts.debug = opts_debug_save |
|
371 | 373 | # save the logplay flag so later we don't overwrite the log |
|
372 | 374 | opts.logplay = load_logplay |
|
373 | 375 | # now we must update our own structure with defaults |
|
374 | 376 | opts_all.update(opts) |
|
375 | 377 | # now load args |
|
376 | 378 | cmd = logplay.readline()[6:] |
|
377 | 379 | exec cmd |
|
378 | 380 | logplay.close() |
|
379 | 381 | except: |
|
380 | 382 | logplay.close() |
|
381 | 383 | if opts_all.debug: IP.InteractiveTB() |
|
382 | 384 | warn("Logplay file lacking full configuration information.\n" |
|
383 | 385 | "I'll try to read it, but some things may not work.") |
|
384 | 386 | |
|
385 | 387 | #------------------------------------------------------------------------- |
|
386 | 388 | # set up output traps: catch all output from files, being run, modules |
|
387 | 389 | # loaded, etc. Then give it to the user in a clean form at the end. |
|
388 | 390 | |
|
389 | 391 | msg_out = 'Output messages. ' |
|
390 | 392 | msg_err = 'Error messages. ' |
|
391 | 393 | msg_sep = '\n' |
|
392 | 394 | msg = Struct(config = OutputTrap('Configuration Loader',msg_out, |
|
393 | 395 | msg_err,msg_sep,debug, |
|
394 | 396 | quiet_out=1), |
|
395 | 397 | user_exec = OutputTrap('User File Execution',msg_out, |
|
396 | 398 | msg_err,msg_sep,debug), |
|
397 | 399 | logplay = OutputTrap('Log Loader',msg_out, |
|
398 | 400 | msg_err,msg_sep,debug), |
|
399 | 401 | summary = '' |
|
400 | 402 | ) |
|
401 | 403 | |
|
402 | 404 | #------------------------------------------------------------------------- |
|
403 | 405 | # Process user ipythonrc-type configuration files |
|
404 | 406 | |
|
405 | 407 | # turn on output trapping and log to msg.config |
|
406 | 408 | # remember that with debug on, trapping is actually disabled |
|
407 | 409 | msg.config.trap_all() |
|
408 | 410 | |
|
409 | 411 | # look for rcfile in current or default directory |
|
410 | 412 | try: |
|
411 | 413 | opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir) |
|
412 | 414 | except IOError: |
|
413 | 415 | if opts_all.debug: IP.InteractiveTB() |
|
414 | 416 | warn('Configuration file %s not found. Ignoring request.' |
|
415 | 417 | % (opts_all.rcfile) ) |
|
416 | 418 | |
|
417 | 419 | # 'profiles' are a shorthand notation for config filenames |
|
418 | 420 | if opts_all.profile: |
|
419 | 421 | |
|
420 | 422 | try: |
|
421 | 423 | opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile |
|
422 | 424 | + rc_suffix, |
|
423 | 425 | opts_all.ipythondir) |
|
424 | 426 | except IOError: |
|
425 | 427 | if opts_all.debug: IP.InteractiveTB() |
|
426 | 428 | opts.profile = '' # remove profile from options if invalid |
|
427 | 429 | # We won't warn anymore, primary method is ipy_profile_PROFNAME |
|
428 | 430 | # which does trigger a warning. |
|
429 | 431 | |
|
430 | 432 | # load the config file |
|
431 | 433 | rcfiledata = None |
|
432 | 434 | if opts_all.quick: |
|
433 | 435 | print 'Launching IPython in quick mode. No config file read.' |
|
434 | 436 | elif opts_all.classic: |
|
435 | 437 | print 'Launching IPython in classic mode. No config file read.' |
|
436 | 438 | elif opts_all.rcfile: |
|
437 | 439 | try: |
|
438 | 440 | cfg_loader = ConfigLoader(conflict) |
|
439 | 441 | rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv, |
|
440 | 442 | 'include',opts_all.ipythondir, |
|
441 | 443 | purge = 1, |
|
442 | 444 | unique = conflict['preserve']) |
|
443 | 445 | except: |
|
444 | 446 | IP.InteractiveTB() |
|
445 | 447 | warn('Problems loading configuration file '+ |
|
446 | 448 | `opts_all.rcfile`+ |
|
447 | 449 | '\nStarting with default -bare bones- configuration.') |
|
448 | 450 | else: |
|
449 | 451 | warn('No valid configuration file found in either currrent directory\n'+ |
|
450 | 452 | 'or in the IPython config. directory: '+`opts_all.ipythondir`+ |
|
451 | 453 | '\nProceeding with internal defaults.') |
|
452 | 454 | |
|
453 | 455 | #------------------------------------------------------------------------ |
|
454 | 456 | # Set exception handlers in mode requested by user. |
|
455 | 457 | otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode |
|
456 | 458 | IP.magic_xmode(opts_all.xmode) |
|
457 | 459 | otrap.release_out() |
|
458 | 460 | |
|
459 | 461 | #------------------------------------------------------------------------ |
|
460 | 462 | # Execute user config |
|
461 | 463 | |
|
462 | 464 | # Create a valid config structure with the right precedence order: |
|
463 | 465 | # defaults < rcfile < command line. This needs to be in the instance, so |
|
464 | 466 | # that method calls below that rely on it find it. |
|
465 | 467 | IP.rc = rc_def.copy() |
|
466 | 468 | |
|
467 | 469 | # Work with a local alias inside this routine to avoid unnecessary |
|
468 | 470 | # attribute lookups. |
|
469 | 471 | IP_rc = IP.rc |
|
470 | 472 | |
|
471 | 473 | IP_rc.update(opts_def) |
|
472 | 474 | if rcfiledata: |
|
473 | 475 | # now we can update |
|
474 | 476 | IP_rc.update(rcfiledata) |
|
475 | 477 | IP_rc.update(opts) |
|
476 | 478 | IP_rc.update(rc_override) |
|
477 | 479 | |
|
478 | 480 | # Store the original cmd line for reference: |
|
479 | 481 | IP_rc.opts = opts |
|
480 | 482 | IP_rc.args = args |
|
481 | 483 | |
|
482 | 484 | # create a *runtime* Struct like rc for holding parameters which may be |
|
483 | 485 | # created and/or modified by runtime user extensions. |
|
484 | 486 | IP.runtime_rc = Struct() |
|
485 | 487 | |
|
486 | 488 | # from this point on, all config should be handled through IP_rc, |
|
487 | 489 | # opts* shouldn't be used anymore. |
|
488 | 490 | |
|
489 | 491 | |
|
490 | 492 | # update IP_rc with some special things that need manual |
|
491 | 493 | # tweaks. Basically options which affect other options. I guess this |
|
492 | 494 | # should just be written so that options are fully orthogonal and we |
|
493 | 495 | # wouldn't worry about this stuff! |
|
494 | 496 | |
|
495 | 497 | if IP_rc.classic: |
|
496 | 498 | IP_rc.quick = 1 |
|
497 | 499 | IP_rc.cache_size = 0 |
|
498 | 500 | IP_rc.pprint = 0 |
|
499 | 501 | IP_rc.prompt_in1 = '>>> ' |
|
500 | 502 | IP_rc.prompt_in2 = '... ' |
|
501 | 503 | IP_rc.prompt_out = '' |
|
502 | 504 | IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0' |
|
503 | 505 | IP_rc.colors = 'NoColor' |
|
504 | 506 | IP_rc.xmode = 'Plain' |
|
505 | 507 | |
|
506 | 508 | IP.pre_config_initialization() |
|
507 | 509 | # configure readline |
|
508 | 510 | # Define the history file for saving commands in between sessions |
|
509 | 511 | if IP_rc.profile: |
|
510 | 512 | histfname = 'history-%s' % IP_rc.profile |
|
511 | 513 | else: |
|
512 | 514 | histfname = 'history' |
|
513 | 515 | IP.histfile = os.path.join(opts_all.ipythondir,histfname) |
|
514 | 516 | |
|
515 | 517 | # update exception handlers with rc file status |
|
516 | 518 | otrap.trap_out() # I don't want these messages ever. |
|
517 | 519 | IP.magic_xmode(IP_rc.xmode) |
|
518 | 520 | otrap.release_out() |
|
519 | 521 | |
|
520 | 522 | # activate logging if requested and not reloading a log |
|
521 | 523 | if IP_rc.logplay: |
|
522 | 524 | IP.magic_logstart(IP_rc.logplay + ' append') |
|
523 | 525 | elif IP_rc.logfile: |
|
524 | 526 | IP.magic_logstart(IP_rc.logfile) |
|
525 | 527 | elif IP_rc.log: |
|
526 | 528 | IP.magic_logstart() |
|
527 | 529 | |
|
528 | 530 | # find user editor so that it we don't have to look it up constantly |
|
529 | 531 | if IP_rc.editor.strip()=='0': |
|
530 | 532 | try: |
|
531 | 533 | ed = os.environ['EDITOR'] |
|
532 | 534 | except KeyError: |
|
533 | 535 | if os.name == 'posix': |
|
534 | 536 | ed = 'vi' # the only one guaranteed to be there! |
|
535 | 537 | else: |
|
536 | 538 | ed = 'notepad' # same in Windows! |
|
537 | 539 | IP_rc.editor = ed |
|
538 | 540 | |
|
539 | 541 | # Keep track of whether this is an embedded instance or not (useful for |
|
540 | 542 | # post-mortems). |
|
541 | 543 | IP_rc.embedded = IP.embedded |
|
542 | 544 | |
|
543 | 545 | # Recursive reload |
|
544 | 546 | try: |
|
545 | 547 | from IPython import deep_reload |
|
546 | 548 | if IP_rc.deep_reload: |
|
547 | 549 | __builtin__.reload = deep_reload.reload |
|
548 | 550 | else: |
|
549 | 551 | __builtin__.dreload = deep_reload.reload |
|
550 | 552 | del deep_reload |
|
551 | 553 | except ImportError: |
|
552 | 554 | pass |
|
553 | 555 | |
|
554 | 556 | # Save the current state of our namespace so that the interactive shell |
|
555 | 557 | # can later know which variables have been created by us from config files |
|
556 | 558 | # and loading. This way, loading a file (in any way) is treated just like |
|
557 | 559 | # defining things on the command line, and %who works as expected. |
|
558 | 560 | |
|
559 | 561 | # DON'T do anything that affects the namespace beyond this point! |
|
560 | 562 | IP.internal_ns.update(__main__.__dict__) |
|
561 | 563 | |
|
562 | 564 | #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who |
|
563 | 565 | |
|
564 | 566 | # Now run through the different sections of the users's config |
|
565 | 567 | if IP_rc.debug: |
|
566 | 568 | print 'Trying to execute the following configuration structure:' |
|
567 | 569 | print '(Things listed first are deeper in the inclusion tree and get' |
|
568 | 570 | print 'loaded first).\n' |
|
569 | 571 | pprint(IP_rc.__dict__) |
|
570 | 572 | |
|
571 | 573 | for mod in IP_rc.import_mod: |
|
572 | 574 | try: |
|
573 | 575 | exec 'import '+mod in IP.user_ns |
|
574 | 576 | except : |
|
575 | 577 | IP.InteractiveTB() |
|
576 | 578 | import_fail_info(mod) |
|
577 | 579 | |
|
578 | 580 | for mod_fn in IP_rc.import_some: |
|
579 | 581 | if mod_fn == []: break |
|
580 | 582 | mod,fn = mod_fn[0],','.join(mod_fn[1:]) |
|
581 | 583 | try: |
|
582 | 584 | exec 'from '+mod+' import '+fn in IP.user_ns |
|
583 | 585 | except : |
|
584 | 586 | IP.InteractiveTB() |
|
585 | 587 | import_fail_info(mod,fn) |
|
586 | 588 | |
|
587 | 589 | for mod in IP_rc.import_all: |
|
588 | 590 | try: |
|
589 | 591 | exec 'from '+mod+' import *' in IP.user_ns |
|
590 | 592 | except : |
|
591 | 593 | IP.InteractiveTB() |
|
592 | 594 | import_fail_info(mod) |
|
593 | 595 | |
|
594 | 596 | for code in IP_rc.execute: |
|
595 | 597 | try: |
|
596 | 598 | exec code in IP.user_ns |
|
597 | 599 | except: |
|
598 | 600 | IP.InteractiveTB() |
|
599 | 601 | warn('Failure executing code: ' + `code`) |
|
600 | 602 | |
|
601 | 603 | # Execute the files the user wants in ipythonrc |
|
602 | 604 | for file in IP_rc.execfile: |
|
603 | 605 | try: |
|
604 | 606 | file = filefind(file,sys.path+[IPython_dir]) |
|
605 | 607 | except IOError: |
|
606 | 608 | warn(itpl('File $file not found. Skipping it.')) |
|
607 | 609 | else: |
|
608 | 610 | IP.safe_execfile(os.path.expanduser(file),IP.user_ns) |
|
609 | 611 | |
|
610 | 612 | # finally, try importing ipy_*_conf for final configuration |
|
611 | 613 | try: |
|
612 | 614 | import ipy_system_conf |
|
613 | 615 | except ImportError: |
|
614 | 616 | if opts_all.debug: IP.InteractiveTB() |
|
615 | 617 | warn("Could not import 'ipy_system_conf'") |
|
616 | 618 | except: |
|
617 | 619 | IP.InteractiveTB() |
|
618 | 620 | import_fail_info('ipy_system_conf') |
|
619 | 621 | |
|
620 | 622 | if opts_all.profile: |
|
621 | 623 | profmodname = 'ipy_profile_' + opts_all.profile |
|
622 | 624 | try: |
|
623 | 625 | __import__(profmodname) |
|
624 | 626 | except ImportError: |
|
625 | 627 | # only warn if ipythonrc-PROFNAME didn't exist |
|
626 | 628 | if opts.profile =='': |
|
627 | 629 | warn("Could not start with profile '%s'!\n ('%s/%s.py' does not exist? run '%%upgrade')" % ( |
|
628 | 630 | opts_all.profile, ipythondir, profmodname) |
|
629 | 631 | |
|
630 | 632 | ) |
|
631 | 633 | except: |
|
632 | 634 | print "Error importing",profmodname |
|
633 | 635 | IP.InteractiveTB() |
|
634 | 636 | import_fail_info(profmodname) |
|
635 | 637 | |
|
636 | 638 | try: |
|
637 | 639 | import ipy_user_conf |
|
638 | 640 | except ImportError: |
|
639 | 641 | if opts_all.debug: IP.InteractiveTB() |
|
640 | 642 | warn("Could not import user config!\n ('%s/ipy_user_conf.py' does not exist? Please run '%%upgrade')\n" % |
|
641 | 643 | ipythondir) |
|
642 | 644 | except: |
|
643 | 645 | print "Error importing ipy_user_conf" |
|
644 | 646 | IP.InteractiveTB() |
|
645 | 647 | import_fail_info("ipy_user_conf") |
|
646 | 648 | |
|
647 | 649 | |
|
648 | 650 | # release stdout and stderr and save config log into a global summary |
|
649 | 651 | msg.config.release_all() |
|
650 | 652 | if IP_rc.messages: |
|
651 | 653 | msg.summary += msg.config.summary_all() |
|
652 | 654 | |
|
653 | 655 | #------------------------------------------------------------------------ |
|
654 | 656 | # Setup interactive session |
|
655 | 657 | |
|
656 | 658 | # Now we should be fully configured. We can then execute files or load |
|
657 | 659 | # things only needed for interactive use. Then we'll open the shell. |
|
658 | 660 | |
|
659 | 661 | # Take a snapshot of the user namespace before opening the shell. That way |
|
660 | 662 | # we'll be able to identify which things were interactively defined and |
|
661 | 663 | # which were defined through config files. |
|
662 | 664 | IP.user_config_ns = IP.user_ns.copy() |
|
663 | 665 | |
|
664 | 666 | # Force reading a file as if it were a session log. Slower but safer. |
|
665 | 667 | if load_logplay: |
|
666 | 668 | print 'Replaying log...' |
|
667 | 669 | try: |
|
668 | 670 | if IP_rc.debug: |
|
669 | 671 | logplay_quiet = 0 |
|
670 | 672 | else: |
|
671 | 673 | logplay_quiet = 1 |
|
672 | 674 | |
|
673 | 675 | msg.logplay.trap_all() |
|
674 | 676 | IP.safe_execfile(load_logplay,IP.user_ns, |
|
675 | 677 | islog = 1, quiet = logplay_quiet) |
|
676 | 678 | msg.logplay.release_all() |
|
677 | 679 | if IP_rc.messages: |
|
678 | 680 | msg.summary += msg.logplay.summary_all() |
|
679 | 681 | except: |
|
680 | 682 | warn('Problems replaying logfile %s.' % load_logplay) |
|
681 | 683 | IP.InteractiveTB() |
|
682 | 684 | |
|
683 | 685 | # Load remaining files in command line |
|
684 | 686 | msg.user_exec.trap_all() |
|
685 | 687 | |
|
686 | 688 | # Do NOT execute files named in the command line as scripts to be loaded |
|
687 | 689 | # by embedded instances. Doing so has the potential for an infinite |
|
688 | 690 | # recursion if there are exceptions thrown in the process. |
|
689 | 691 | |
|
690 | 692 | # XXX FIXME: the execution of user files should be moved out to after |
|
691 | 693 | # ipython is fully initialized, just as if they were run via %run at the |
|
692 | 694 | # ipython prompt. This would also give them the benefit of ipython's |
|
693 | 695 | # nice tracebacks. |
|
694 | 696 | |
|
695 | 697 | if (not embedded and IP_rc.args and |
|
696 | 698 | not IP_rc.args[0].lower().endswith('.ipy')): |
|
697 | 699 | name_save = IP.user_ns['__name__'] |
|
698 | 700 | IP.user_ns['__name__'] = '__main__' |
|
699 | 701 | # Set our own excepthook in case the user code tries to call it |
|
700 | 702 | # directly. This prevents triggering the IPython crash handler. |
|
701 | 703 | old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook |
|
702 | 704 | |
|
703 | 705 | save_argv = sys.argv[:] # save it for later restoring |
|
704 | 706 | |
|
705 | 707 | sys.argv = args |
|
706 | 708 | |
|
707 | 709 | try: |
|
708 | 710 | IP.safe_execfile(args[0], IP.user_ns) |
|
709 | 711 | finally: |
|
710 | 712 | # Reset our crash handler in place |
|
711 | 713 | sys.excepthook = old_excepthook |
|
712 | 714 | sys.argv = save_argv |
|
713 | 715 | IP.user_ns['__name__'] = name_save |
|
714 | 716 | |
|
715 | 717 | msg.user_exec.release_all() |
|
716 | 718 | if IP_rc.messages: |
|
717 | 719 | msg.summary += msg.user_exec.summary_all() |
|
718 | 720 | |
|
719 | 721 | # since we can't specify a null string on the cmd line, 0 is the equivalent: |
|
720 | 722 | if IP_rc.nosep: |
|
721 | 723 | IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0' |
|
722 | 724 | if IP_rc.separate_in == '0': IP_rc.separate_in = '' |
|
723 | 725 | if IP_rc.separate_out == '0': IP_rc.separate_out = '' |
|
724 | 726 | if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = '' |
|
725 | 727 | IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n') |
|
726 | 728 | IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n') |
|
727 | 729 | IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n') |
|
728 | 730 | |
|
729 | 731 | # Determine how many lines at the bottom of the screen are needed for |
|
730 | 732 | # showing prompts, so we can know wheter long strings are to be printed or |
|
731 | 733 | # paged: |
|
732 | 734 | num_lines_bot = IP_rc.separate_in.count('\n')+1 |
|
733 | 735 | IP_rc.screen_length = IP_rc.screen_length - num_lines_bot |
|
734 | 736 | |
|
735 | 737 | # configure startup banner |
|
736 | 738 | if IP_rc.c: # regular python doesn't print the banner with -c |
|
737 | 739 | IP_rc.banner = 0 |
|
738 | 740 | if IP_rc.banner: |
|
739 | 741 | BANN_P = IP.BANNER_PARTS |
|
740 | 742 | else: |
|
741 | 743 | BANN_P = [] |
|
742 | 744 | |
|
743 | 745 | if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile) |
|
744 | 746 | |
|
745 | 747 | # add message log (possibly empty) |
|
746 | 748 | if msg.summary: BANN_P.append(msg.summary) |
|
747 | 749 | # Final banner is a string |
|
748 | 750 | IP.BANNER = '\n'.join(BANN_P) |
|
749 | 751 | |
|
750 | 752 | # Finalize the IPython instance. This assumes the rc structure is fully |
|
751 | 753 | # in place. |
|
752 | 754 | IP.post_config_initialization() |
|
753 | 755 | |
|
754 | 756 | return IP |
|
755 | 757 | #************************ end of file <ipmaker.py> ************************** |
@@ -1,5439 +1,5454 b'' | |||
|
1 | 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu> | |
|
2 | ||
|
3 | * IPython/iplib.py (_prefilter): fix bug where aliases would | |
|
4 | shadow variables when autocall was fully off. Reported by SAGE | |
|
5 | author William Stein. | |
|
6 | ||
|
7 | * IPython/OInspect.py (Inspector.__init__): add a flag to control | |
|
8 | at what detail level strings are computed when foo? is requested. | |
|
9 | This allows users to ask for example that the string form of an | |
|
10 | object is only computed when foo?? is called, or even never, by | |
|
11 | setting the object_info_string_level >= 2 in the configuration | |
|
12 | file. This new option has been added and documented. After a | |
|
13 | request by SAGE to be able to control the printing of very large | |
|
14 | objects more easily. | |
|
15 | ||
|
1 | 16 | 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu> |
|
2 | 17 | |
|
3 | 18 | * IPython/ipmaker.py (make_IPython): remove the ipython call path |
|
4 | 19 | from sys.argv, to be 100% consistent with how Python itself works |
|
5 | 20 | (as seen for example with python -i file.py). After a bug report |
|
6 | 21 | by Jeffrey Collins. |
|
7 | 22 | |
|
8 | 23 | * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix |
|
9 | 24 | nasty bug which was preventing custom namespaces with -pylab, |
|
10 | 25 | reported by M. Foord. Minor cleanup, remove old matplotlib.matlab |
|
11 | 26 | compatibility (long gone from mpl). |
|
12 | 27 | |
|
13 | 28 | * IPython/ipapi.py (make_session): name change: create->make. We |
|
14 | 29 | use make in other places (ipmaker,...), it's shorter and easier to |
|
15 | 30 | type and say, etc. I'm trying to clean things before 0.7.2 so |
|
16 | 31 | that I can keep things stable wrt to ipapi in the chainsaw branch. |
|
17 | 32 | |
|
18 | 33 | * ipython.el: fix the py-pdbtrack-input-prompt variable so that |
|
19 | 34 | python-mode recognizes our debugger mode. Add support for |
|
20 | 35 | autoindent inside (X)emacs. After a patch sent in by Jin Liu |
|
21 | 36 | <m.liu.jin-AT-gmail.com> originally written by |
|
22 | 37 | doxgen-AT-newsmth.net (with minor modifications for xemacs |
|
23 | 38 | compatibility) |
|
24 | 39 | |
|
25 | 40 | * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of |
|
26 | 41 | tracebacks when walking the stack so that the stack tracking system |
|
27 | 42 | in emacs' python-mode can identify the frames correctly. |
|
28 | 43 | |
|
29 | 44 | * IPython/ipmaker.py (make_IPython): make the internal (and |
|
30 | 45 | default config) autoedit_syntax value false by default. Too many |
|
31 | 46 | users have complained to me (both on and off-list) about problems |
|
32 | 47 | with this option being on by default, so I'm making it default to |
|
33 | 48 | off. It can still be enabled by anyone via the usual mechanisms. |
|
34 | 49 | |
|
35 | 50 | * IPython/completer.py (Completer.attr_matches): add support for |
|
36 | 51 | PyCrust-style _getAttributeNames magic method. Patch contributed |
|
37 | 52 | by <mscott-AT-goldenspud.com>. Closes #50. |
|
38 | 53 | |
|
39 | 54 | * IPython/iplib.py (InteractiveShell.__init__): remove the |
|
40 | 55 | deletion of exit/quit from __builtin__, which can break |
|
41 | 56 | third-party tools like the Zope debugging console. The |
|
42 | 57 | %exit/%quit magics remain. In general, it's probably a good idea |
|
43 | 58 | not to delete anything from __builtin__, since we never know what |
|
44 | 59 | that will break. In any case, python now (for 2.5) will support |
|
45 | 60 | 'real' exit/quit, so this issue is moot. Closes #55. |
|
46 | 61 | |
|
47 | 62 | * IPython/genutils.py (with_obj): rename the 'with' function to |
|
48 | 63 | 'withobj' to avoid incompatibilities with Python 2.5, where 'with' |
|
49 | 64 | becomes a language keyword. Closes #53. |
|
50 | 65 | |
|
51 | 66 | * IPython/FakeModule.py (FakeModule.__init__): add a proper |
|
52 | 67 | __file__ attribute to this so it fools more things into thinking |
|
53 | 68 | it is a real module. Closes #59. |
|
54 | 69 | |
|
55 | 70 | * IPython/Magic.py (magic_edit): add -n option to open the editor |
|
56 | 71 | at a specific line number. After a patch by Stefan van der Walt. |
|
57 | 72 | |
|
58 | 73 | 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu> |
|
59 | 74 | |
|
60 | 75 | * IPython/iplib.py (edit_syntax_error): fix crash when for some |
|
61 | 76 | reason the file could not be opened. After automatic crash |
|
62 | 77 | reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and |
|
63 | 78 | Charles Dolan <charlespatrickdolan-AT-yahoo.com>. |
|
64 | 79 | (_should_recompile): Don't fire editor if using %bg, since there |
|
65 | 80 | is no file in the first place. From the same report as above. |
|
66 | 81 | (raw_input): protect against faulty third-party prefilters. After |
|
67 | 82 | an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za> |
|
68 | 83 | while running under SAGE. |
|
69 | 84 | |
|
70 | 85 | 2006-05-23 Ville Vainio <vivainio@gmail.com> |
|
71 | 86 | |
|
72 | 87 | * ipapi.py: Stripped down ip.to_user_ns() to work only as |
|
73 | 88 | ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get() |
|
74 | 89 | now returns None (again), unless dummy is specifically allowed by |
|
75 | 90 | ipapi.get(allow_dummy=True). |
|
76 | 91 | |
|
77 | 92 | 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu> |
|
78 | 93 | |
|
79 | 94 | * IPython: remove all 2.2-compatibility objects and hacks from |
|
80 | 95 | everywhere, since we only support 2.3 at this point. Docs |
|
81 | 96 | updated. |
|
82 | 97 | |
|
83 | 98 | * IPython/ipapi.py (IPApi.__init__): Clean up of all getters. |
|
84 | 99 | Anything requiring extra validation can be turned into a Python |
|
85 | 100 | property in the future. I used a property for the db one b/c |
|
86 | 101 | there was a nasty circularity problem with the initialization |
|
87 | 102 | order, which right now I don't have time to clean up. |
|
88 | 103 | |
|
89 | 104 | * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think, |
|
90 | 105 | another locking bug reported by Jorgen. I'm not 100% sure though, |
|
91 | 106 | so more testing is needed... |
|
92 | 107 | |
|
93 | 108 | 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu> |
|
94 | 109 | |
|
95 | 110 | * IPython/ipapi.py (IPApi.to_user_ns): New function to inject |
|
96 | 111 | local variables from any routine in user code (typically executed |
|
97 | 112 | with %run) directly into the interactive namespace. Very useful |
|
98 | 113 | when doing complex debugging. |
|
99 | 114 | (IPythonNotRunning): Changed the default None object to a dummy |
|
100 | 115 | whose attributes can be queried as well as called without |
|
101 | 116 | exploding, to ease writing code which works transparently both in |
|
102 | 117 | and out of ipython and uses some of this API. |
|
103 | 118 | |
|
104 | 119 | 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu> |
|
105 | 120 | |
|
106 | 121 | * IPython/hooks.py (result_display): Fix the fact that our display |
|
107 | 122 | hook was using str() instead of repr(), as the default python |
|
108 | 123 | console does. This had gone unnoticed b/c it only happened if |
|
109 | 124 | %Pprint was off, but the inconsistency was there. |
|
110 | 125 | |
|
111 | 126 | 2006-05-15 Ville Vainio <vivainio@gmail.com> |
|
112 | 127 | |
|
113 | 128 | * Oinspect.py: Only show docstring for nonexisting/binary files |
|
114 | 129 | when doing object??, closing ticket #62 |
|
115 | 130 | |
|
116 | 131 | 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu> |
|
117 | 132 | |
|
118 | 133 | * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading |
|
119 | 134 | bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock |
|
120 | 135 | was being released in a routine which hadn't checked if it had |
|
121 | 136 | been the one to acquire it. |
|
122 | 137 | |
|
123 | 138 | 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu> |
|
124 | 139 | |
|
125 | 140 | * IPython/Release.py (version): put out 0.7.2.rc1 for testing. |
|
126 | 141 | |
|
127 | 142 | 2006-04-11 Ville Vainio <vivainio@gmail.com> |
|
128 | 143 | |
|
129 | 144 | * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file" |
|
130 | 145 | in command line. E.g. "ipython test.ipy" runs test.ipy with ipython |
|
131 | 146 | prefilters, allowing stuff like magics and aliases in the file. |
|
132 | 147 | |
|
133 | 148 | * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic |
|
134 | 149 | added. Supported now are "%clear in" and "%clear out" (clear input and |
|
135 | 150 | output history, respectively). Also fixed CachedOutput.flush to |
|
136 | 151 | properly flush the output cache. |
|
137 | 152 | |
|
138 | 153 | * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr" |
|
139 | 154 | half-success (and fail explicitly). |
|
140 | 155 | |
|
141 | 156 | 2006-03-28 Ville Vainio <vivainio@gmail.com> |
|
142 | 157 | |
|
143 | 158 | * iplib.py: Fix quoting of aliases so that only argless ones |
|
144 | 159 | are quoted |
|
145 | 160 | |
|
146 | 161 | 2006-03-28 Ville Vainio <vivainio@gmail.com> |
|
147 | 162 | |
|
148 | 163 | * iplib.py: Quote aliases with spaces in the name. |
|
149 | 164 | "c:\program files\blah\bin" is now legal alias target. |
|
150 | 165 | |
|
151 | 166 | * ext_rehashdir.py: Space no longer allowed as arg |
|
152 | 167 | separator, since space is legal in path names. |
|
153 | 168 | |
|
154 | 169 | 2006-03-16 Ville Vainio <vivainio@gmail.com> |
|
155 | 170 | |
|
156 | 171 | * upgrade_dir.py: Take path.py from Extensions, correcting |
|
157 | 172 | %upgrade magic |
|
158 | 173 | |
|
159 | 174 | * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found. |
|
160 | 175 | |
|
161 | 176 | * hooks.py: Only enclose editor binary in quotes if legal and |
|
162 | 177 | necessary (space in the name, and is an existing file). Fixes a bug |
|
163 | 178 | reported by Zachary Pincus. |
|
164 | 179 | |
|
165 | 180 | 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu> |
|
166 | 181 | |
|
167 | 182 | * Manual: thanks to a tip on proper color handling for Emacs, by |
|
168 | 183 | Eric J Haywiser <ejh1-AT-MIT.EDU>. |
|
169 | 184 | |
|
170 | 185 | * ipython.el: close http://www.scipy.net/roundup/ipython/issue57 |
|
171 | 186 | by applying the provided patch. Thanks to Liu Jin |
|
172 | 187 | <m.liu.jin-AT-gmail.com> for the contribution. No problems under |
|
173 | 188 | XEmacs/Linux, I'm trusting the submitter that it actually helps |
|
174 | 189 | under win32/GNU Emacs. Will revisit if any problems are reported. |
|
175 | 190 | |
|
176 | 191 | 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu> |
|
177 | 192 | |
|
178 | 193 | * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py |
|
179 | 194 | from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>. |
|
180 | 195 | |
|
181 | 196 | 2006-03-12 Ville Vainio <vivainio@gmail.com> |
|
182 | 197 | |
|
183 | 198 | * Magic.py (magic_timeit): Added %timeit magic, contributed by |
|
184 | 199 | Torsten Marek. |
|
185 | 200 | |
|
186 | 201 | 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu> |
|
187 | 202 | |
|
188 | 203 | * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for |
|
189 | 204 | line ranges works again. |
|
190 | 205 | |
|
191 | 206 | 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu> |
|
192 | 207 | |
|
193 | 208 | * IPython/iplib.py (showtraceback): add back sys.last_traceback |
|
194 | 209 | and friends, after a discussion with Zach Pincus on ipython-user. |
|
195 | 210 | I'm not 100% sure, but after thinking aobut it quite a bit, it may |
|
196 | 211 | be OK. Testing with the multithreaded shells didn't reveal any |
|
197 | 212 | problems, but let's keep an eye out. |
|
198 | 213 | |
|
199 | 214 | In the process, I fixed a few things which were calling |
|
200 | 215 | self.InteractiveTB() directly (like safe_execfile), which is a |
|
201 | 216 | mistake: ALL exception reporting should be done by calling |
|
202 | 217 | self.showtraceback(), which handles state and tab-completion and |
|
203 | 218 | more. |
|
204 | 219 | |
|
205 | 220 | 2006-03-01 Ville Vainio <vivainio@gmail.com> |
|
206 | 221 | |
|
207 | 222 | * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module. |
|
208 | 223 | To use, do "from ipipe import *". |
|
209 | 224 | |
|
210 | 225 | 2006-02-24 Ville Vainio <vivainio@gmail.com> |
|
211 | 226 | |
|
212 | 227 | * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more |
|
213 | 228 | "cleanly" and safely than the older upgrade mechanism. |
|
214 | 229 | |
|
215 | 230 | 2006-02-21 Ville Vainio <vivainio@gmail.com> |
|
216 | 231 | |
|
217 | 232 | * Magic.py: %save works again. |
|
218 | 233 | |
|
219 | 234 | 2006-02-15 Ville Vainio <vivainio@gmail.com> |
|
220 | 235 | |
|
221 | 236 | * Magic.py: %Pprint works again |
|
222 | 237 | |
|
223 | 238 | * Extensions/ipy_sane_defaults.py: Provide everything provided |
|
224 | 239 | in default ipythonrc, to make it possible to have a completely empty |
|
225 | 240 | ipythonrc (and thus completely rc-file free configuration) |
|
226 | 241 | |
|
227 | 242 | |
|
228 | 243 | 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu> |
|
229 | 244 | |
|
230 | 245 | * IPython/hooks.py (editor): quote the call to the editor command, |
|
231 | 246 | to allow commands with spaces in them. Problem noted by watching |
|
232 | 247 | Ian Oswald's video about textpad under win32 at |
|
233 | 248 | http://showmedo.com/videoListPage?listKey=PythonIPythonSeries |
|
234 | 249 | |
|
235 | 250 | * IPython/UserConfig/ipythonrc: Replace @ signs with % when |
|
236 | 251 | describing magics (we haven't used @ for a loong time). |
|
237 | 252 | |
|
238 | 253 | * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch |
|
239 | 254 | contributed by marienz to close |
|
240 | 255 | http://www.scipy.net/roundup/ipython/issue53. |
|
241 | 256 | |
|
242 | 257 | 2006-02-10 Ville Vainio <vivainio@gmail.com> |
|
243 | 258 | |
|
244 | 259 | * genutils.py: getoutput now works in win32 too |
|
245 | 260 | |
|
246 | 261 | * completer.py: alias and magic completion only invoked |
|
247 | 262 | at the first "item" in the line, to avoid "cd %store" |
|
248 | 263 | nonsense. |
|
249 | 264 | |
|
250 | 265 | 2006-02-09 Ville Vainio <vivainio@gmail.com> |
|
251 | 266 | |
|
252 | 267 | * test/*: Added a unit testing framework (finally). |
|
253 | 268 | '%run runtests.py' to run test_*. |
|
254 | 269 | |
|
255 | 270 | * ipapi.py: Exposed runlines and set_custom_exc |
|
256 | 271 | |
|
257 | 272 | 2006-02-07 Ville Vainio <vivainio@gmail.com> |
|
258 | 273 | |
|
259 | 274 | * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall, |
|
260 | 275 | instead use "f(1 2)" as before. |
|
261 | 276 | |
|
262 | 277 | 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu> |
|
263 | 278 | |
|
264 | 279 | * IPython/demo.py (IPythonDemo): Add new classes to the demo |
|
265 | 280 | facilities, for demos processed by the IPython input filter |
|
266 | 281 | (IPythonDemo), and for running a script one-line-at-a-time as a |
|
267 | 282 | demo, both for pure Python (LineDemo) and for IPython-processed |
|
268 | 283 | input (IPythonLineDemo). After a request by Dave Kohel, from the |
|
269 | 284 | SAGE team. |
|
270 | 285 | (Demo.edit): added and edit() method to the demo objects, to edit |
|
271 | 286 | the in-memory copy of the last executed block. |
|
272 | 287 | |
|
273 | 288 | * IPython/Magic.py (magic_edit): add '-r' option for 'raw' |
|
274 | 289 | processing to %edit, %macro and %save. These commands can now be |
|
275 | 290 | invoked on the unprocessed input as it was typed by the user |
|
276 | 291 | (without any prefilters applied). After requests by the SAGE team |
|
277 | 292 | at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html. |
|
278 | 293 | |
|
279 | 294 | 2006-02-01 Ville Vainio <vivainio@gmail.com> |
|
280 | 295 | |
|
281 | 296 | * setup.py, eggsetup.py: easy_install ipython==dev works |
|
282 | 297 | correctly now (on Linux) |
|
283 | 298 | |
|
284 | 299 | * ipy_user_conf,ipmaker: user config changes, removed spurious |
|
285 | 300 | warnings |
|
286 | 301 | |
|
287 | 302 | * iplib: if rc.banner is string, use it as is. |
|
288 | 303 | |
|
289 | 304 | * Magic: %pycat accepts a string argument and pages it's contents. |
|
290 | 305 | |
|
291 | 306 | |
|
292 | 307 | 2006-01-30 Ville Vainio <vivainio@gmail.com> |
|
293 | 308 | |
|
294 | 309 | * pickleshare,pspersistence,ipapi,Magic: persistence overhaul. |
|
295 | 310 | Now %store and bookmarks work through PickleShare, meaning that |
|
296 | 311 | concurrent access is possible and all ipython sessions see the |
|
297 | 312 | same database situation all the time, instead of snapshot of |
|
298 | 313 | the situation when the session was started. Hence, %bookmark |
|
299 | 314 | results are immediately accessible from othes sessions. The database |
|
300 | 315 | is also available for use by user extensions. See: |
|
301 | 316 | http://www.python.org/pypi/pickleshare |
|
302 | 317 | |
|
303 | 318 | * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'. |
|
304 | 319 | |
|
305 | 320 | * aliases can now be %store'd |
|
306 | 321 | |
|
307 | 322 | * path.py move to Extensions so that pickleshare does not need |
|
308 | 323 | IPython-specific import. Extensions added to pythonpath right |
|
309 | 324 | at __init__. |
|
310 | 325 | |
|
311 | 326 | * iplib.py: ipalias deprecated/redundant; aliases are converted and |
|
312 | 327 | called with _ip.system and the pre-transformed command string. |
|
313 | 328 | |
|
314 | 329 | 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu> |
|
315 | 330 | |
|
316 | 331 | * IPython/iplib.py (interact): Fix that we were not catching |
|
317 | 332 | KeyboardInterrupt exceptions properly. I'm not quite sure why the |
|
318 | 333 | logic here had to change, but it's fixed now. |
|
319 | 334 | |
|
320 | 335 | 2006-01-29 Ville Vainio <vivainio@gmail.com> |
|
321 | 336 | |
|
322 | 337 | * iplib.py: Try to import pyreadline on Windows. |
|
323 | 338 | |
|
324 | 339 | 2006-01-27 Ville Vainio <vivainio@gmail.com> |
|
325 | 340 | |
|
326 | 341 | * iplib.py: Expose ipapi as _ip in builtin namespace. |
|
327 | 342 | Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system) |
|
328 | 343 | and ip_set_hook (-> _ip.set_hook) redundant. % and ! |
|
329 | 344 | syntax now produce _ip.* variant of the commands. |
|
330 | 345 | |
|
331 | 346 | * "_ip.options().autoedit_syntax = 2" automatically throws |
|
332 | 347 | user to editor for syntax error correction without prompting. |
|
333 | 348 | |
|
334 | 349 | 2006-01-27 Ville Vainio <vivainio@gmail.com> |
|
335 | 350 | |
|
336 | 351 | * ipmaker.py: Give "realistic" sys.argv for scripts (without |
|
337 | 352 | 'ipython' at argv[0]) executed through command line. |
|
338 | 353 | NOTE: this DEPRECATES calling ipython with multiple scripts |
|
339 | 354 | ("ipython a.py b.py c.py") |
|
340 | 355 | |
|
341 | 356 | * iplib.py, hooks.py: Added configurable input prefilter, |
|
342 | 357 | named 'input_prefilter'. See ext_rescapture.py for example |
|
343 | 358 | usage. |
|
344 | 359 | |
|
345 | 360 | * ext_rescapture.py, Magic.py: Better system command output capture |
|
346 | 361 | through 'var = !ls' (deprecates user-visible %sc). Same notation |
|
347 | 362 | applies for magics, 'var = %alias' assigns alias list to var. |
|
348 | 363 | |
|
349 | 364 | * ipapi.py: added meta() for accessing extension-usable data store. |
|
350 | 365 | |
|
351 | 366 | * iplib.py: added InteractiveShell.getapi(). New magics should be |
|
352 | 367 | written doing self.getapi() instead of using the shell directly. |
|
353 | 368 | |
|
354 | 369 | * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and |
|
355 | 370 | %store foo >> ~/myfoo.txt to store variables to files (in clean |
|
356 | 371 | textual form, not a restorable pickle). |
|
357 | 372 | |
|
358 | 373 | * ipmaker.py: now import ipy_profile_PROFILENAME automatically |
|
359 | 374 | |
|
360 | 375 | * usage.py, Magic.py: added %quickref |
|
361 | 376 | |
|
362 | 377 | * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2). |
|
363 | 378 | |
|
364 | 379 | * GetoptErrors when invoking magics etc. with wrong args |
|
365 | 380 | are now more helpful: |
|
366 | 381 | GetoptError: option -l not recognized (allowed: "qb" ) |
|
367 | 382 | |
|
368 | 383 | 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu> |
|
369 | 384 | |
|
370 | 385 | * IPython/demo.py (Demo.show): Flush stdout after each block, so |
|
371 | 386 | computationally intensive blocks don't appear to stall the demo. |
|
372 | 387 | |
|
373 | 388 | 2006-01-24 Ville Vainio <vivainio@gmail.com> |
|
374 | 389 | |
|
375 | 390 | * iplib.py, hooks.py: 'result_display' hook can return a non-None |
|
376 | 391 | value to manipulate resulting history entry. |
|
377 | 392 | |
|
378 | 393 | * ipapi.py: Moved TryNext here from hooks.py. Moved functions |
|
379 | 394 | to instance methods of IPApi class, to make extending an embedded |
|
380 | 395 | IPython feasible. See ext_rehashdir.py for example usage. |
|
381 | 396 | |
|
382 | 397 | * Merged 1071-1076 from banches/0.7.1 |
|
383 | 398 | |
|
384 | 399 | |
|
385 | 400 | 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu> |
|
386 | 401 | |
|
387 | 402 | * tools/release (daystamp): Fix build tools to use the new |
|
388 | 403 | eggsetup.py script to build lightweight eggs. |
|
389 | 404 | |
|
390 | 405 | * Applied changesets 1062 and 1064 before 0.7.1 release. |
|
391 | 406 | |
|
392 | 407 | * IPython/Magic.py (magic_history): Add '-r' option to %hist, to |
|
393 | 408 | see the raw input history (without conversions like %ls -> |
|
394 | 409 | ipmagic("ls")). After a request from W. Stein, SAGE |
|
395 | 410 | (http://modular.ucsd.edu/sage) developer. This information is |
|
396 | 411 | stored in the input_hist_raw attribute of the IPython instance, so |
|
397 | 412 | developers can access it if needed (it's an InputList instance). |
|
398 | 413 | |
|
399 | 414 | * Versionstring = 0.7.2.svn |
|
400 | 415 | |
|
401 | 416 | * eggsetup.py: A separate script for constructing eggs, creates |
|
402 | 417 | proper launch scripts even on Windows (an .exe file in |
|
403 | 418 | \python24\scripts). |
|
404 | 419 | |
|
405 | 420 | * ipapi.py: launch_new_instance, launch entry point needed for the |
|
406 | 421 | egg. |
|
407 | 422 | |
|
408 | 423 | 2006-01-23 Ville Vainio <vivainio@gmail.com> |
|
409 | 424 | |
|
410 | 425 | * Added %cpaste magic for pasting python code |
|
411 | 426 | |
|
412 | 427 | 2006-01-22 Ville Vainio <vivainio@gmail.com> |
|
413 | 428 | |
|
414 | 429 | * Merge from branches/0.7.1 into trunk, revs 1052-1057 |
|
415 | 430 | |
|
416 | 431 | * Versionstring = 0.7.2.svn |
|
417 | 432 | |
|
418 | 433 | * eggsetup.py: A separate script for constructing eggs, creates |
|
419 | 434 | proper launch scripts even on Windows (an .exe file in |
|
420 | 435 | \python24\scripts). |
|
421 | 436 | |
|
422 | 437 | * ipapi.py: launch_new_instance, launch entry point needed for the |
|
423 | 438 | egg. |
|
424 | 439 | |
|
425 | 440 | 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu> |
|
426 | 441 | |
|
427 | 442 | * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or |
|
428 | 443 | %pfile foo would print the file for foo even if it was a binary. |
|
429 | 444 | Now, extensions '.so' and '.dll' are skipped. |
|
430 | 445 | |
|
431 | 446 | * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading |
|
432 | 447 | bug, where macros would fail in all threaded modes. I'm not 100% |
|
433 | 448 | sure, so I'm going to put out an rc instead of making a release |
|
434 | 449 | today, and wait for feedback for at least a few days. |
|
435 | 450 | |
|
436 | 451 | * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt |
|
437 | 452 | it...) the handling of pasting external code with autoindent on. |
|
438 | 453 | To get out of a multiline input, the rule will appear for most |
|
439 | 454 | users unchanged: two blank lines or change the indent level |
|
440 | 455 | proposed by IPython. But there is a twist now: you can |
|
441 | 456 | add/subtract only *one or two spaces*. If you add/subtract three |
|
442 | 457 | or more (unless you completely delete the line), IPython will |
|
443 | 458 | accept that line, and you'll need to enter a second one of pure |
|
444 | 459 | whitespace. I know it sounds complicated, but I can't find a |
|
445 | 460 | different solution that covers all the cases, with the right |
|
446 | 461 | heuristics. Hopefully in actual use, nobody will really notice |
|
447 | 462 | all these strange rules and things will 'just work'. |
|
448 | 463 | |
|
449 | 464 | 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu> |
|
450 | 465 | |
|
451 | 466 | * IPython/iplib.py (interact): catch exceptions which can be |
|
452 | 467 | triggered asynchronously by signal handlers. Thanks to an |
|
453 | 468 | automatic crash report, submitted by Colin Kingsley |
|
454 | 469 | <tercel-AT-gentoo.org>. |
|
455 | 470 | |
|
456 | 471 | 2006-01-20 Ville Vainio <vivainio@gmail.com> |
|
457 | 472 | |
|
458 | 473 | * Ipython/Extensions/ext_rehashdir.py: Created a usable example |
|
459 | 474 | (%rehashdir, very useful, try it out) of how to extend ipython |
|
460 | 475 | with new magics. Also added Extensions dir to pythonpath to make |
|
461 | 476 | importing extensions easy. |
|
462 | 477 | |
|
463 | 478 | * %store now complains when trying to store interactively declared |
|
464 | 479 | classes / instances of those classes. |
|
465 | 480 | |
|
466 | 481 | * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py, |
|
467 | 482 | ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported |
|
468 | 483 | if they exist, and ipy_user_conf.py with some defaults is created for |
|
469 | 484 | the user. |
|
470 | 485 | |
|
471 | 486 | * Startup rehashing done by the config file, not InterpreterExec. |
|
472 | 487 | This means system commands are available even without selecting the |
|
473 | 488 | pysh profile. It's the sensible default after all. |
|
474 | 489 | |
|
475 | 490 | 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu> |
|
476 | 491 | |
|
477 | 492 | * IPython/iplib.py (raw_input): I _think_ I got the pasting of |
|
478 | 493 | multiline code with autoindent on working. But I am really not |
|
479 | 494 | sure, so this needs more testing. Will commit a debug-enabled |
|
480 | 495 | version for now, while I test it some more, so that Ville and |
|
481 | 496 | others may also catch any problems. Also made |
|
482 | 497 | self.indent_current_str() a method, to ensure that there's no |
|
483 | 498 | chance of the indent space count and the corresponding string |
|
484 | 499 | falling out of sync. All code needing the string should just call |
|
485 | 500 | the method. |
|
486 | 501 | |
|
487 | 502 | 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu> |
|
488 | 503 | |
|
489 | 504 | * IPython/Magic.py (magic_edit): fix check for when users don't |
|
490 | 505 | save their output files, the try/except was in the wrong section. |
|
491 | 506 | |
|
492 | 507 | 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu> |
|
493 | 508 | |
|
494 | 509 | * IPython/Magic.py (magic_run): fix __file__ global missing from |
|
495 | 510 | script's namespace when executed via %run. After a report by |
|
496 | 511 | Vivian. |
|
497 | 512 | |
|
498 | 513 | * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d' |
|
499 | 514 | when using python 2.4. The parent constructor changed in 2.4, and |
|
500 | 515 | we need to track it directly (we can't call it, as it messes up |
|
501 | 516 | readline and tab-completion inside our pdb would stop working). |
|
502 | 517 | After a bug report by R. Bernstein <rocky-AT-panix.com>. |
|
503 | 518 | |
|
504 | 519 | 2006-01-16 Ville Vainio <vivainio@gmail.com> |
|
505 | 520 | |
|
506 | 521 | * Ipython/magic.py:Reverted back to old %edit functionality |
|
507 | 522 | that returns file contents on exit. |
|
508 | 523 | |
|
509 | 524 | * IPython/path.py: Added Jason Orendorff's "path" module to |
|
510 | 525 | IPython tree, http://www.jorendorff.com/articles/python/path/. |
|
511 | 526 | You can get path objects conveniently through %sc, and !!, e.g.: |
|
512 | 527 | sc files=ls |
|
513 | 528 | for p in files.paths: # or files.p |
|
514 | 529 | print p,p.mtime |
|
515 | 530 | |
|
516 | 531 | * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall |
|
517 | 532 | now work again without considering the exclusion regexp - |
|
518 | 533 | hence, things like ',foo my/path' turn to 'foo("my/path")' |
|
519 | 534 | instead of syntax error. |
|
520 | 535 | |
|
521 | 536 | |
|
522 | 537 | 2006-01-14 Ville Vainio <vivainio@gmail.com> |
|
523 | 538 | |
|
524 | 539 | * IPython/ipapi.py (ashook, asmagic, options): Added convenience |
|
525 | 540 | ipapi decorators for python 2.4 users, options() provides access to rc |
|
526 | 541 | data. |
|
527 | 542 | |
|
528 | 543 | * IPython/Magic.py (magic_cd): %cd now accepts backslashes |
|
529 | 544 | as path separators (even on Linux ;-). Space character after |
|
530 | 545 | backslash (as yielded by tab completer) is still space; |
|
531 | 546 | "%cd long\ name" works as expected. |
|
532 | 547 | |
|
533 | 548 | * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented |
|
534 | 549 | as "chain of command", with priority. API stays the same, |
|
535 | 550 | TryNext exception raised by a hook function signals that |
|
536 | 551 | current hook failed and next hook should try handling it, as |
|
537 | 552 | suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also |
|
538 | 553 | requested configurable display hook, which is now implemented. |
|
539 | 554 | |
|
540 | 555 | 2006-01-13 Ville Vainio <vivainio@gmail.com> |
|
541 | 556 | |
|
542 | 557 | * IPython/platutils*.py: platform specific utility functions, |
|
543 | 558 | so far only set_term_title is implemented (change terminal |
|
544 | 559 | label in windowing systems). %cd now changes the title to |
|
545 | 560 | current dir. |
|
546 | 561 | |
|
547 | 562 | * IPython/Release.py: Added myself to "authors" list, |
|
548 | 563 | had to create new files. |
|
549 | 564 | |
|
550 | 565 | * IPython/iplib.py (handle_shell_escape): fixed logical flaw in |
|
551 | 566 | shell escape; not a known bug but had potential to be one in the |
|
552 | 567 | future. |
|
553 | 568 | |
|
554 | 569 | * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public" |
|
555 | 570 | extension API for IPython! See the module for usage example. Fix |
|
556 | 571 | OInspect for docstring-less magic functions. |
|
557 | 572 | |
|
558 | 573 | |
|
559 | 574 | 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu> |
|
560 | 575 | |
|
561 | 576 | * IPython/iplib.py (raw_input): temporarily deactivate all |
|
562 | 577 | attempts at allowing pasting of code with autoindent on. It |
|
563 | 578 | introduced bugs (reported by Prabhu) and I can't seem to find a |
|
564 | 579 | robust combination which works in all cases. Will have to revisit |
|
565 | 580 | later. |
|
566 | 581 | |
|
567 | 582 | * IPython/genutils.py: remove isspace() function. We've dropped |
|
568 | 583 | 2.2 compatibility, so it's OK to use the string method. |
|
569 | 584 | |
|
570 | 585 | 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu> |
|
571 | 586 | |
|
572 | 587 | * IPython/iplib.py (InteractiveShell.__init__): fix regexp |
|
573 | 588 | matching what NOT to autocall on, to include all python binary |
|
574 | 589 | operators (including things like 'and', 'or', 'is' and 'in'). |
|
575 | 590 | Prompted by a bug report on 'foo & bar', but I realized we had |
|
576 | 591 | many more potential bug cases with other operators. The regexp is |
|
577 | 592 | self.re_exclude_auto, it's fairly commented. |
|
578 | 593 | |
|
579 | 594 | 2006-01-12 Ville Vainio <vivainio@gmail.com> |
|
580 | 595 | |
|
581 | 596 | * IPython/iplib.py (make_quoted_expr,handle_shell_escape): |
|
582 | 597 | Prettified and hardened string/backslash quoting with ipsystem(), |
|
583 | 598 | ipalias() and ipmagic(). Now even \ characters are passed to |
|
584 | 599 | %magics, !shell escapes and aliases exactly as they are in the |
|
585 | 600 | ipython command line. Should improve backslash experience, |
|
586 | 601 | particularly in Windows (path delimiter for some commands that |
|
587 | 602 | won't understand '/'), but Unix benefits as well (regexps). %cd |
|
588 | 603 | magic still doesn't support backslash path delimiters, though. Also |
|
589 | 604 | deleted all pretense of supporting multiline command strings in |
|
590 | 605 | !system or %magic commands. Thanks to Jerry McRae for suggestions. |
|
591 | 606 | |
|
592 | 607 | * doc/build_doc_instructions.txt added. Documentation on how to |
|
593 | 608 | use doc/update_manual.py, added yesterday. Both files contributed |
|
594 | 609 | by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates |
|
595 | 610 | doc/*.sh for deprecation at a later date. |
|
596 | 611 | |
|
597 | 612 | * /ipython.py Added ipython.py to root directory for |
|
598 | 613 | zero-installation (tar xzvf ipython.tgz; cd ipython; python |
|
599 | 614 | ipython.py) and development convenience (no need to kee doing |
|
600 | 615 | "setup.py install" between changes). |
|
601 | 616 | |
|
602 | 617 | * Made ! and !! shell escapes work (again) in multiline expressions: |
|
603 | 618 | if 1: |
|
604 | 619 | !ls |
|
605 | 620 | !!ls |
|
606 | 621 | |
|
607 | 622 | 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu> |
|
608 | 623 | |
|
609 | 624 | * IPython/ipstruct.py (Struct): Rename IPython.Struct to |
|
610 | 625 | IPython.ipstruct, to avoid local shadowing of the stdlib 'struct' |
|
611 | 626 | module in case-insensitive installation. Was causing crashes |
|
612 | 627 | under win32. Closes http://www.scipy.net/roundup/ipython/issue49. |
|
613 | 628 | |
|
614 | 629 | * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart |
|
615 | 630 | <marienz-AT-gentoo.org>, closes |
|
616 | 631 | http://www.scipy.net/roundup/ipython/issue51. |
|
617 | 632 | |
|
618 | 633 | 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu> |
|
619 | 634 | |
|
620 | 635 | * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the |
|
621 | 636 | problem of excessive CPU usage under *nix and keyboard lag under |
|
622 | 637 | win32. |
|
623 | 638 | |
|
624 | 639 | 2006-01-10 *** Released version 0.7.0 |
|
625 | 640 | |
|
626 | 641 | 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu> |
|
627 | 642 | |
|
628 | 643 | * IPython/Release.py (revision): tag version number to 0.7.0, |
|
629 | 644 | ready for release. |
|
630 | 645 | |
|
631 | 646 | * IPython/Magic.py (magic_edit): Add print statement to %edit so |
|
632 | 647 | it informs the user of the name of the temp. file used. This can |
|
633 | 648 | help if you decide later to reuse that same file, so you know |
|
634 | 649 | where to copy the info from. |
|
635 | 650 | |
|
636 | 651 | 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu> |
|
637 | 652 | |
|
638 | 653 | * setup_bdist_egg.py: little script to build an egg. Added |
|
639 | 654 | support in the release tools as well. |
|
640 | 655 | |
|
641 | 656 | 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu> |
|
642 | 657 | |
|
643 | 658 | * IPython/Shell.py (IPShellWX.__init__): add support for WXPython |
|
644 | 659 | version selection (new -wxversion command line and ipythonrc |
|
645 | 660 | parameter). Patch contributed by Arnd Baecker |
|
646 | 661 | <arnd.baecker-AT-web.de>. |
|
647 | 662 | |
|
648 | 663 | * IPython/iplib.py (embed_mainloop): fix tab-completion in |
|
649 | 664 | embedded instances, for variables defined at the interactive |
|
650 | 665 | prompt of the embedded ipython. Reported by Arnd. |
|
651 | 666 | |
|
652 | 667 | * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now |
|
653 | 668 | it can be used as a (stateful) toggle, or with a direct parameter. |
|
654 | 669 | |
|
655 | 670 | * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which |
|
656 | 671 | could be triggered in certain cases and cause the traceback |
|
657 | 672 | printer not to work. |
|
658 | 673 | |
|
659 | 674 | 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu> |
|
660 | 675 | |
|
661 | 676 | * IPython/iplib.py (_should_recompile): Small fix, closes |
|
662 | 677 | http://www.scipy.net/roundup/ipython/issue48. Patch by Scott. |
|
663 | 678 | |
|
664 | 679 | 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu> |
|
665 | 680 | |
|
666 | 681 | * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK |
|
667 | 682 | backend for matplotlib (100% cpu utiliziation). Thanks to Charlie |
|
668 | 683 | Moad for help with tracking it down. |
|
669 | 684 | |
|
670 | 685 | * IPython/iplib.py (handle_auto): fix autocall handling for |
|
671 | 686 | objects which support BOTH __getitem__ and __call__ (so that f [x] |
|
672 | 687 | is left alone, instead of becoming f([x]) automatically). |
|
673 | 688 | |
|
674 | 689 | * IPython/Magic.py (magic_cd): fix crash when cd -b was used. |
|
675 | 690 | Ville's patch. |
|
676 | 691 | |
|
677 | 692 | 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu> |
|
678 | 693 | |
|
679 | 694 | * IPython/iplib.py (handle_auto): changed autocall semantics to |
|
680 | 695 | include 'smart' mode, where the autocall transformation is NOT |
|
681 | 696 | applied if there are no arguments on the line. This allows you to |
|
682 | 697 | just type 'foo' if foo is a callable to see its internal form, |
|
683 | 698 | instead of having it called with no arguments (typically a |
|
684 | 699 | mistake). The old 'full' autocall still exists: for that, you |
|
685 | 700 | need to set the 'autocall' parameter to 2 in your ipythonrc file. |
|
686 | 701 | |
|
687 | 702 | * IPython/completer.py (Completer.attr_matches): add |
|
688 | 703 | tab-completion support for Enthoughts' traits. After a report by |
|
689 | 704 | Arnd and a patch by Prabhu. |
|
690 | 705 | |
|
691 | 706 | 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu> |
|
692 | 707 | |
|
693 | 708 | * IPython/ultraTB.py (_fixed_getinnerframes): added Alex |
|
694 | 709 | Schmolck's patch to fix inspect.getinnerframes(). |
|
695 | 710 | |
|
696 | 711 | * IPython/iplib.py (InteractiveShell.__init__): significant fixes |
|
697 | 712 | for embedded instances, regarding handling of namespaces and items |
|
698 | 713 | added to the __builtin__ one. Multiple embedded instances and |
|
699 | 714 | recursive embeddings should work better now (though I'm not sure |
|
700 | 715 | I've got all the corner cases fixed, that code is a bit of a brain |
|
701 | 716 | twister). |
|
702 | 717 | |
|
703 | 718 | * IPython/Magic.py (magic_edit): added support to edit in-memory |
|
704 | 719 | macros (automatically creates the necessary temp files). %edit |
|
705 | 720 | also doesn't return the file contents anymore, it's just noise. |
|
706 | 721 | |
|
707 | 722 | * IPython/completer.py (Completer.attr_matches): revert change to |
|
708 | 723 | complete only on attributes listed in __all__. I realized it |
|
709 | 724 | cripples the tab-completion system as a tool for exploring the |
|
710 | 725 | internals of unknown libraries (it renders any non-__all__ |
|
711 | 726 | attribute off-limits). I got bit by this when trying to see |
|
712 | 727 | something inside the dis module. |
|
713 | 728 | |
|
714 | 729 | 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu> |
|
715 | 730 | |
|
716 | 731 | * IPython/iplib.py (InteractiveShell.__init__): add .meta |
|
717 | 732 | namespace for users and extension writers to hold data in. This |
|
718 | 733 | follows the discussion in |
|
719 | 734 | http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython. |
|
720 | 735 | |
|
721 | 736 | * IPython/completer.py (IPCompleter.complete): small patch to help |
|
722 | 737 | tab-completion under Emacs, after a suggestion by John Barnard |
|
723 | 738 | <barnarj-AT-ccf.org>. |
|
724 | 739 | |
|
725 | 740 | * IPython/Magic.py (Magic.extract_input_slices): added support for |
|
726 | 741 | the slice notation in magics to use N-M to represent numbers N...M |
|
727 | 742 | (closed endpoints). This is used by %macro and %save. |
|
728 | 743 | |
|
729 | 744 | * IPython/completer.py (Completer.attr_matches): for modules which |
|
730 | 745 | define __all__, complete only on those. After a patch by Jeffrey |
|
731 | 746 | Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and |
|
732 | 747 | speed up this routine. |
|
733 | 748 | |
|
734 | 749 | * IPython/Logger.py (Logger.log): fix a history handling bug. I |
|
735 | 750 | don't know if this is the end of it, but the behavior now is |
|
736 | 751 | certainly much more correct. Note that coupled with macros, |
|
737 | 752 | slightly surprising (at first) behavior may occur: a macro will in |
|
738 | 753 | general expand to multiple lines of input, so upon exiting, the |
|
739 | 754 | in/out counters will both be bumped by the corresponding amount |
|
740 | 755 | (as if the macro's contents had been typed interactively). Typing |
|
741 | 756 | %hist will reveal the intermediate (silently processed) lines. |
|
742 | 757 | |
|
743 | 758 | * IPython/Magic.py (magic_run): fix a subtle bug which could cause |
|
744 | 759 | pickle to fail (%run was overwriting __main__ and not restoring |
|
745 | 760 | it, but pickle relies on __main__ to operate). |
|
746 | 761 | |
|
747 | 762 | * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now |
|
748 | 763 | using properties, but forgot to make the main InteractiveShell |
|
749 | 764 | class a new-style class. Properties fail silently, and |
|
750 | 765 | misteriously, with old-style class (getters work, but |
|
751 | 766 | setters don't do anything). |
|
752 | 767 | |
|
753 | 768 | 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu> |
|
754 | 769 | |
|
755 | 770 | * IPython/Magic.py (magic_history): fix history reporting bug (I |
|
756 | 771 | know some nasties are still there, I just can't seem to find a |
|
757 | 772 | reproducible test case to track them down; the input history is |
|
758 | 773 | falling out of sync...) |
|
759 | 774 | |
|
760 | 775 | * IPython/iplib.py (handle_shell_escape): fix bug where both |
|
761 | 776 | aliases and system accesses where broken for indented code (such |
|
762 | 777 | as loops). |
|
763 | 778 | |
|
764 | 779 | * IPython/genutils.py (shell): fix small but critical bug for |
|
765 | 780 | win32 system access. |
|
766 | 781 | |
|
767 | 782 | 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu> |
|
768 | 783 | |
|
769 | 784 | * IPython/iplib.py (showtraceback): remove use of the |
|
770 | 785 | sys.last_{type/value/traceback} structures, which are non |
|
771 | 786 | thread-safe. |
|
772 | 787 | (_prefilter): change control flow to ensure that we NEVER |
|
773 | 788 | introspect objects when autocall is off. This will guarantee that |
|
774 | 789 | having an input line of the form 'x.y', where access to attribute |
|
775 | 790 | 'y' has side effects, doesn't trigger the side effect TWICE. It |
|
776 | 791 | is important to note that, with autocall on, these side effects |
|
777 | 792 | can still happen. |
|
778 | 793 | (ipsystem): new builtin, to complete the ip{magic/alias/system} |
|
779 | 794 | trio. IPython offers these three kinds of special calls which are |
|
780 | 795 | not python code, and it's a good thing to have their call method |
|
781 | 796 | be accessible as pure python functions (not just special syntax at |
|
782 | 797 | the command line). It gives us a better internal implementation |
|
783 | 798 | structure, as well as exposing these for user scripting more |
|
784 | 799 | cleanly. |
|
785 | 800 | |
|
786 | 801 | * IPython/macro.py (Macro.__init__): moved macros to a standalone |
|
787 | 802 | file. Now that they'll be more likely to be used with the |
|
788 | 803 | persistance system (%store), I want to make sure their module path |
|
789 | 804 | doesn't change in the future, so that we don't break things for |
|
790 | 805 | users' persisted data. |
|
791 | 806 | |
|
792 | 807 | * IPython/iplib.py (autoindent_update): move indentation |
|
793 | 808 | management into the _text_ processing loop, not the keyboard |
|
794 | 809 | interactive one. This is necessary to correctly process non-typed |
|
795 | 810 | multiline input (such as macros). |
|
796 | 811 | |
|
797 | 812 | * IPython/Magic.py (Magic.format_latex): patch by Stefan van der |
|
798 | 813 | Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings, |
|
799 | 814 | which was producing problems in the resulting manual. |
|
800 | 815 | (magic_whos): improve reporting of instances (show their class, |
|
801 | 816 | instead of simply printing 'instance' which isn't terribly |
|
802 | 817 | informative). |
|
803 | 818 | |
|
804 | 819 | * IPython/genutils.py (shell): commit Jorgen Stenarson's patch |
|
805 | 820 | (minor mods) to support network shares under win32. |
|
806 | 821 | |
|
807 | 822 | * IPython/winconsole.py (get_console_size): add new winconsole |
|
808 | 823 | module and fixes to page_dumb() to improve its behavior under |
|
809 | 824 | win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>. |
|
810 | 825 | |
|
811 | 826 | * IPython/Magic.py (Macro): simplified Macro class to just |
|
812 | 827 | subclass list. We've had only 2.2 compatibility for a very long |
|
813 | 828 | time, yet I was still avoiding subclassing the builtin types. No |
|
814 | 829 | more (I'm also starting to use properties, though I won't shift to |
|
815 | 830 | 2.3-specific features quite yet). |
|
816 | 831 | (magic_store): added Ville's patch for lightweight variable |
|
817 | 832 | persistence, after a request on the user list by Matt Wilkie |
|
818 | 833 | <maphew-AT-gmail.com>. The new %store magic's docstring has full |
|
819 | 834 | details. |
|
820 | 835 | |
|
821 | 836 | * IPython/iplib.py (InteractiveShell.post_config_initialization): |
|
822 | 837 | changed the default logfile name from 'ipython.log' to |
|
823 | 838 | 'ipython_log.py'. These logs are real python files, and now that |
|
824 | 839 | we have much better multiline support, people are more likely to |
|
825 | 840 | want to use them as such. Might as well name them correctly. |
|
826 | 841 | |
|
827 | 842 | * IPython/Magic.py: substantial cleanup. While we can't stop |
|
828 | 843 | using magics as mixins, due to the existing customizations 'out |
|
829 | 844 | there' which rely on the mixin naming conventions, at least I |
|
830 | 845 | cleaned out all cross-class name usage. So once we are OK with |
|
831 | 846 | breaking compatibility, the two systems can be separated. |
|
832 | 847 | |
|
833 | 848 | * IPython/Logger.py: major cleanup. This one is NOT a mixin |
|
834 | 849 | anymore, and the class is a fair bit less hideous as well. New |
|
835 | 850 | features were also introduced: timestamping of input, and logging |
|
836 | 851 | of output results. These are user-visible with the -t and -o |
|
837 | 852 | options to %logstart. Closes |
|
838 | 853 | http://www.scipy.net/roundup/ipython/issue11 and a request by |
|
839 | 854 | William Stein (SAGE developer - http://modular.ucsd.edu/sage). |
|
840 | 855 | |
|
841 | 856 | 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu> |
|
842 | 857 | |
|
843 | 858 | * IPython/iplib.py (handle_shell_escape): add Ville's patch to |
|
844 | 859 | better hadnle backslashes in paths. See the thread 'More Windows |
|
845 | 860 | questions part 2 - \/ characters revisited' on the iypthon user |
|
846 | 861 | list: |
|
847 | 862 | http://scipy.net/pipermail/ipython-user/2005-June/000907.html |
|
848 | 863 | |
|
849 | 864 | (InteractiveShell.__init__): fix tab-completion bug in threaded shells. |
|
850 | 865 | |
|
851 | 866 | (InteractiveShell.__init__): change threaded shells to not use the |
|
852 | 867 | ipython crash handler. This was causing more problems than not, |
|
853 | 868 | as exceptions in the main thread (GUI code, typically) would |
|
854 | 869 | always show up as a 'crash', when they really weren't. |
|
855 | 870 | |
|
856 | 871 | The colors and exception mode commands (%colors/%xmode) have been |
|
857 | 872 | synchronized to also take this into account, so users can get |
|
858 | 873 | verbose exceptions for their threaded code as well. I also added |
|
859 | 874 | support for activating pdb inside this exception handler as well, |
|
860 | 875 | so now GUI authors can use IPython's enhanced pdb at runtime. |
|
861 | 876 | |
|
862 | 877 | * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag |
|
863 | 878 | true by default, and add it to the shipped ipythonrc file. Since |
|
864 | 879 | this asks the user before proceeding, I think it's OK to make it |
|
865 | 880 | true by default. |
|
866 | 881 | |
|
867 | 882 | * IPython/Magic.py (magic_exit): make new exit/quit magics instead |
|
868 | 883 | of the previous special-casing of input in the eval loop. I think |
|
869 | 884 | this is cleaner, as they really are commands and shouldn't have |
|
870 | 885 | a special role in the middle of the core code. |
|
871 | 886 | |
|
872 | 887 | 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
873 | 888 | |
|
874 | 889 | * IPython/iplib.py (edit_syntax_error): added support for |
|
875 | 890 | automatically reopening the editor if the file had a syntax error |
|
876 | 891 | in it. Thanks to scottt who provided the patch at: |
|
877 | 892 | http://www.scipy.net/roundup/ipython/issue36 (slightly modified |
|
878 | 893 | version committed). |
|
879 | 894 | |
|
880 | 895 | * IPython/iplib.py (handle_normal): add suport for multi-line |
|
881 | 896 | input with emtpy lines. This fixes |
|
882 | 897 | http://www.scipy.net/roundup/ipython/issue43 and a similar |
|
883 | 898 | discussion on the user list. |
|
884 | 899 | |
|
885 | 900 | WARNING: a behavior change is necessarily introduced to support |
|
886 | 901 | blank lines: now a single blank line with whitespace does NOT |
|
887 | 902 | break the input loop, which means that when autoindent is on, by |
|
888 | 903 | default hitting return on the next (indented) line does NOT exit. |
|
889 | 904 | |
|
890 | 905 | Instead, to exit a multiline input you can either have: |
|
891 | 906 | |
|
892 | 907 | - TWO whitespace lines (just hit return again), or |
|
893 | 908 | - a single whitespace line of a different length than provided |
|
894 | 909 | by the autoindent (add or remove a space). |
|
895 | 910 | |
|
896 | 911 | * IPython/completer.py (MagicCompleter.__init__): new 'completer' |
|
897 | 912 | module to better organize all readline-related functionality. |
|
898 | 913 | I've deleted FlexCompleter and put all completion clases here. |
|
899 | 914 | |
|
900 | 915 | * IPython/iplib.py (raw_input): improve indentation management. |
|
901 | 916 | It is now possible to paste indented code with autoindent on, and |
|
902 | 917 | the code is interpreted correctly (though it still looks bad on |
|
903 | 918 | screen, due to the line-oriented nature of ipython). |
|
904 | 919 | (MagicCompleter.complete): change behavior so that a TAB key on an |
|
905 | 920 | otherwise empty line actually inserts a tab, instead of completing |
|
906 | 921 | on the entire global namespace. This makes it easier to use the |
|
907 | 922 | TAB key for indentation. After a request by Hans Meine |
|
908 | 923 | <hans_meine-AT-gmx.net> |
|
909 | 924 | (_prefilter): add support so that typing plain 'exit' or 'quit' |
|
910 | 925 | does a sensible thing. Originally I tried to deviate as little as |
|
911 | 926 | possible from the default python behavior, but even that one may |
|
912 | 927 | change in this direction (thread on python-dev to that effect). |
|
913 | 928 | Regardless, ipython should do the right thing even if CPython's |
|
914 | 929 | '>>>' prompt doesn't. |
|
915 | 930 | (InteractiveShell): removed subclassing code.InteractiveConsole |
|
916 | 931 | class. By now we'd overridden just about all of its methods: I've |
|
917 | 932 | copied the remaining two over, and now ipython is a standalone |
|
918 | 933 | class. This will provide a clearer picture for the chainsaw |
|
919 | 934 | branch refactoring. |
|
920 | 935 | |
|
921 | 936 | 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu> |
|
922 | 937 | |
|
923 | 938 | * IPython/ultraTB.py (VerboseTB.text): harden reporting against |
|
924 | 939 | failures for objects which break when dir() is called on them. |
|
925 | 940 | |
|
926 | 941 | * IPython/FlexCompleter.py (Completer.__init__): Added support for |
|
927 | 942 | distinct local and global namespaces in the completer API. This |
|
928 | 943 | change allows us top properly handle completion with distinct |
|
929 | 944 | scopes, including in embedded instances (this had never really |
|
930 | 945 | worked correctly). |
|
931 | 946 | |
|
932 | 947 | Note: this introduces a change in the constructor for |
|
933 | 948 | MagicCompleter, as a new global_namespace parameter is now the |
|
934 | 949 | second argument (the others were bumped one position). |
|
935 | 950 | |
|
936 | 951 | 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu> |
|
937 | 952 | |
|
938 | 953 | * IPython/iplib.py (embed_mainloop): fix tab-completion in |
|
939 | 954 | embedded instances (which can be done now thanks to Vivian's |
|
940 | 955 | frame-handling fixes for pdb). |
|
941 | 956 | (InteractiveShell.__init__): Fix namespace handling problem in |
|
942 | 957 | embedded instances. We were overwriting __main__ unconditionally, |
|
943 | 958 | and this should only be done for 'full' (non-embedded) IPython; |
|
944 | 959 | embedded instances must respect the caller's __main__. Thanks to |
|
945 | 960 | a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com> |
|
946 | 961 | |
|
947 | 962 | 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu> |
|
948 | 963 | |
|
949 | 964 | * setup.py: added download_url to setup(). This registers the |
|
950 | 965 | download address at PyPI, which is not only useful to humans |
|
951 | 966 | browsing the site, but is also picked up by setuptools (the Eggs |
|
952 | 967 | machinery). Thanks to Ville and R. Kern for the info/discussion |
|
953 | 968 | on this. |
|
954 | 969 | |
|
955 | 970 | 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu> |
|
956 | 971 | |
|
957 | 972 | * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements. |
|
958 | 973 | This brings a lot of nice functionality to the pdb mode, which now |
|
959 | 974 | has tab-completion, syntax highlighting, and better stack handling |
|
960 | 975 | than before. Many thanks to Vivian De Smedt |
|
961 | 976 | <vivian-AT-vdesmedt.com> for the original patches. |
|
962 | 977 | |
|
963 | 978 | 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu> |
|
964 | 979 | |
|
965 | 980 | * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling |
|
966 | 981 | sequence to consistently accept the banner argument. The |
|
967 | 982 | inconsistency was tripping SAGE, thanks to Gary Zablackis |
|
968 | 983 | <gzabl-AT-yahoo.com> for the report. |
|
969 | 984 | |
|
970 | 985 | 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
971 | 986 | |
|
972 | 987 | * IPython/iplib.py (InteractiveShell.post_config_initialization): |
|
973 | 988 | Fix bug where a naked 'alias' call in the ipythonrc file would |
|
974 | 989 | cause a crash. Bug reported by Jorgen Stenarson. |
|
975 | 990 | |
|
976 | 991 | 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
977 | 992 | |
|
978 | 993 | * IPython/ipmaker.py (make_IPython): cleanups which should improve |
|
979 | 994 | startup time. |
|
980 | 995 | |
|
981 | 996 | * IPython/iplib.py (runcode): my globals 'fix' for embedded |
|
982 | 997 | instances had introduced a bug with globals in normal code. Now |
|
983 | 998 | it's working in all cases. |
|
984 | 999 | |
|
985 | 1000 | * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and |
|
986 | 1001 | API changes. A new ipytonrc option, 'wildcards_case_sensitive' |
|
987 | 1002 | has been introduced to set the default case sensitivity of the |
|
988 | 1003 | searches. Users can still select either mode at runtime on a |
|
989 | 1004 | per-search basis. |
|
990 | 1005 | |
|
991 | 1006 | 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu> |
|
992 | 1007 | |
|
993 | 1008 | * IPython/wildcard.py (NameSpace.__init__): fix resolution of |
|
994 | 1009 | attributes in wildcard searches for subclasses. Modified version |
|
995 | 1010 | of a patch by Jorgen. |
|
996 | 1011 | |
|
997 | 1012 | 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu> |
|
998 | 1013 | |
|
999 | 1014 | * IPython/iplib.py (embed_mainloop): Fix handling of globals for |
|
1000 | 1015 | embedded instances. I added a user_global_ns attribute to the |
|
1001 | 1016 | InteractiveShell class to handle this. |
|
1002 | 1017 | |
|
1003 | 1018 | 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1004 | 1019 | |
|
1005 | 1020 | * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to |
|
1006 | 1021 | idle_add, which fixes horrible keyboard lag problems under gtk 2.6 |
|
1007 | 1022 | (reported under win32, but may happen also in other platforms). |
|
1008 | 1023 | Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm> |
|
1009 | 1024 | |
|
1010 | 1025 | 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1011 | 1026 | |
|
1012 | 1027 | * IPython/Magic.py (magic_psearch): new support for wildcard |
|
1013 | 1028 | patterns. Now, typing ?a*b will list all names which begin with a |
|
1014 | 1029 | and end in b, for example. The %psearch magic has full |
|
1015 | 1030 | docstrings. Many thanks to JΓΆrgen Stenarson |
|
1016 | 1031 | <jorgen.stenarson-AT-bostream.nu>, author of the patches |
|
1017 | 1032 | implementing this functionality. |
|
1018 | 1033 | |
|
1019 | 1034 | 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1020 | 1035 | |
|
1021 | 1036 | * Manual: fixed long-standing annoyance of double-dashes (as in |
|
1022 | 1037 | --prefix=~, for example) being stripped in the HTML version. This |
|
1023 | 1038 | is a latex2html bug, but a workaround was provided. Many thanks |
|
1024 | 1039 | to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed |
|
1025 | 1040 | help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball |
|
1026 | 1041 | rolling. This seemingly small issue had tripped a number of users |
|
1027 | 1042 | when first installing, so I'm glad to see it gone. |
|
1028 | 1043 | |
|
1029 | 1044 | 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1030 | 1045 | |
|
1031 | 1046 | * IPython/Extensions/numeric_formats.py: fix missing import, |
|
1032 | 1047 | reported by Stephen Walton. |
|
1033 | 1048 | |
|
1034 | 1049 | 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1035 | 1050 | |
|
1036 | 1051 | * IPython/demo.py: finish demo module, fully documented now. |
|
1037 | 1052 | |
|
1038 | 1053 | * IPython/genutils.py (file_read): simple little utility to read a |
|
1039 | 1054 | file and ensure it's closed afterwards. |
|
1040 | 1055 | |
|
1041 | 1056 | 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1042 | 1057 | |
|
1043 | 1058 | * IPython/demo.py (Demo.__init__): added support for individually |
|
1044 | 1059 | tagging blocks for automatic execution. |
|
1045 | 1060 | |
|
1046 | 1061 | * IPython/Magic.py (magic_pycat): new %pycat magic for showing |
|
1047 | 1062 | syntax-highlighted python sources, requested by John. |
|
1048 | 1063 | |
|
1049 | 1064 | 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1050 | 1065 | |
|
1051 | 1066 | * IPython/demo.py (Demo.again): fix bug where again() blocks after |
|
1052 | 1067 | finishing. |
|
1053 | 1068 | |
|
1054 | 1069 | * IPython/genutils.py (shlex_split): moved from Magic to here, |
|
1055 | 1070 | where all 2.2 compatibility stuff lives. I needed it for demo.py. |
|
1056 | 1071 | |
|
1057 | 1072 | * IPython/demo.py (Demo.__init__): added support for silent |
|
1058 | 1073 | blocks, improved marks as regexps, docstrings written. |
|
1059 | 1074 | (Demo.__init__): better docstring, added support for sys.argv. |
|
1060 | 1075 | |
|
1061 | 1076 | * IPython/genutils.py (marquee): little utility used by the demo |
|
1062 | 1077 | code, handy in general. |
|
1063 | 1078 | |
|
1064 | 1079 | * IPython/demo.py (Demo.__init__): new class for interactive |
|
1065 | 1080 | demos. Not documented yet, I just wrote it in a hurry for |
|
1066 | 1081 | scipy'05. Will docstring later. |
|
1067 | 1082 | |
|
1068 | 1083 | 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1069 | 1084 | |
|
1070 | 1085 | * IPython/Shell.py (sigint_handler): Drastic simplification which |
|
1071 | 1086 | also seems to make Ctrl-C work correctly across threads! This is |
|
1072 | 1087 | so simple, that I can't beleive I'd missed it before. Needs more |
|
1073 | 1088 | testing, though. |
|
1074 | 1089 | (KBINT): Never mind, revert changes. I'm sure I'd tried something |
|
1075 | 1090 | like this before... |
|
1076 | 1091 | |
|
1077 | 1092 | * IPython/genutils.py (get_home_dir): add protection against |
|
1078 | 1093 | non-dirs in win32 registry. |
|
1079 | 1094 | |
|
1080 | 1095 | * IPython/iplib.py (InteractiveShell.alias_table_validate): fix |
|
1081 | 1096 | bug where dict was mutated while iterating (pysh crash). |
|
1082 | 1097 | |
|
1083 | 1098 | 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1084 | 1099 | |
|
1085 | 1100 | * IPython/iplib.py (handle_auto): Fix inconsistency arising from |
|
1086 | 1101 | spurious newlines added by this routine. After a report by |
|
1087 | 1102 | F. Mantegazza. |
|
1088 | 1103 | |
|
1089 | 1104 | 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1090 | 1105 | |
|
1091 | 1106 | * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0") |
|
1092 | 1107 | calls. These were a leftover from the GTK 1.x days, and can cause |
|
1093 | 1108 | problems in certain cases (after a report by John Hunter). |
|
1094 | 1109 | |
|
1095 | 1110 | * IPython/iplib.py (InteractiveShell.__init__): Trap exception if |
|
1096 | 1111 | os.getcwd() fails at init time. Thanks to patch from David Remahl |
|
1097 | 1112 | <chmod007-AT-mac.com>. |
|
1098 | 1113 | (InteractiveShell.__init__): prevent certain special magics from |
|
1099 | 1114 | being shadowed by aliases. Closes |
|
1100 | 1115 | http://www.scipy.net/roundup/ipython/issue41. |
|
1101 | 1116 | |
|
1102 | 1117 | 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1103 | 1118 | |
|
1104 | 1119 | * IPython/iplib.py (InteractiveShell.complete): Added new |
|
1105 | 1120 | top-level completion method to expose the completion mechanism |
|
1106 | 1121 | beyond readline-based environments. |
|
1107 | 1122 | |
|
1108 | 1123 | 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1109 | 1124 | |
|
1110 | 1125 | * tools/ipsvnc (svnversion): fix svnversion capture. |
|
1111 | 1126 | |
|
1112 | 1127 | * IPython/iplib.py (InteractiveShell.__init__): Add has_readline |
|
1113 | 1128 | attribute to self, which was missing. Before, it was set by a |
|
1114 | 1129 | routine which in certain cases wasn't being called, so the |
|
1115 | 1130 | instance could end up missing the attribute. This caused a crash. |
|
1116 | 1131 | Closes http://www.scipy.net/roundup/ipython/issue40. |
|
1117 | 1132 | |
|
1118 | 1133 | 2005-08-16 Fernando Perez <fperez@colorado.edu> |
|
1119 | 1134 | |
|
1120 | 1135 | * IPython/ultraTB.py (VerboseTB.text): don't crash if object |
|
1121 | 1136 | contains non-string attribute. Closes |
|
1122 | 1137 | http://www.scipy.net/roundup/ipython/issue38. |
|
1123 | 1138 | |
|
1124 | 1139 | 2005-08-14 Fernando Perez <fperez@colorado.edu> |
|
1125 | 1140 | |
|
1126 | 1141 | * tools/ipsvnc: Minor improvements, to add changeset info. |
|
1127 | 1142 | |
|
1128 | 1143 | 2005-08-12 Fernando Perez <fperez@colorado.edu> |
|
1129 | 1144 | |
|
1130 | 1145 | * IPython/iplib.py (runsource): remove self.code_to_run_src |
|
1131 | 1146 | attribute. I realized this is nothing more than |
|
1132 | 1147 | '\n'.join(self.buffer), and having the same data in two different |
|
1133 | 1148 | places is just asking for synchronization bugs. This may impact |
|
1134 | 1149 | people who have custom exception handlers, so I need to warn |
|
1135 | 1150 | ipython-dev about it (F. Mantegazza may use them). |
|
1136 | 1151 | |
|
1137 | 1152 | 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1138 | 1153 | |
|
1139 | 1154 | * IPython/genutils.py: fix 2.2 compatibility (generators) |
|
1140 | 1155 | |
|
1141 | 1156 | 2005-07-18 Fernando Perez <fperez@colorado.edu> |
|
1142 | 1157 | |
|
1143 | 1158 | * IPython/genutils.py (get_home_dir): fix to help users with |
|
1144 | 1159 | invalid $HOME under win32. |
|
1145 | 1160 | |
|
1146 | 1161 | 2005-07-17 Fernando Perez <fperez@colorado.edu> |
|
1147 | 1162 | |
|
1148 | 1163 | * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove |
|
1149 | 1164 | some old hacks and clean up a bit other routines; code should be |
|
1150 | 1165 | simpler and a bit faster. |
|
1151 | 1166 | |
|
1152 | 1167 | * IPython/iplib.py (interact): removed some last-resort attempts |
|
1153 | 1168 | to survive broken stdout/stderr. That code was only making it |
|
1154 | 1169 | harder to abstract out the i/o (necessary for gui integration), |
|
1155 | 1170 | and the crashes it could prevent were extremely rare in practice |
|
1156 | 1171 | (besides being fully user-induced in a pretty violent manner). |
|
1157 | 1172 | |
|
1158 | 1173 | * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff. |
|
1159 | 1174 | Nothing major yet, but the code is simpler to read; this should |
|
1160 | 1175 | make it easier to do more serious modifications in the future. |
|
1161 | 1176 | |
|
1162 | 1177 | * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh, |
|
1163 | 1178 | which broke in .15 (thanks to a report by Ville). |
|
1164 | 1179 | |
|
1165 | 1180 | * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not |
|
1166 | 1181 | be quite correct, I know next to nothing about unicode). This |
|
1167 | 1182 | will allow unicode strings to be used in prompts, amongst other |
|
1168 | 1183 | cases. It also will prevent ipython from crashing when unicode |
|
1169 | 1184 | shows up unexpectedly in many places. If ascii encoding fails, we |
|
1170 | 1185 | assume utf_8. Currently the encoding is not a user-visible |
|
1171 | 1186 | setting, though it could be made so if there is demand for it. |
|
1172 | 1187 | |
|
1173 | 1188 | * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack. |
|
1174 | 1189 | |
|
1175 | 1190 | * IPython/Struct.py (Struct.merge): switch keys() to iterator. |
|
1176 | 1191 | |
|
1177 | 1192 | * IPython/background_jobs.py: moved 2.2 compatibility to genutils. |
|
1178 | 1193 | |
|
1179 | 1194 | * IPython/genutils.py: Add 2.2 compatibility here, so all other |
|
1180 | 1195 | code can work transparently for 2.2/2.3. |
|
1181 | 1196 | |
|
1182 | 1197 | 2005-07-16 Fernando Perez <fperez@colorado.edu> |
|
1183 | 1198 | |
|
1184 | 1199 | * IPython/ultraTB.py (ExceptionColors): Make a global variable |
|
1185 | 1200 | out of the color scheme table used for coloring exception |
|
1186 | 1201 | tracebacks. This allows user code to add new schemes at runtime. |
|
1187 | 1202 | This is a minimally modified version of the patch at |
|
1188 | 1203 | http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw |
|
1189 | 1204 | for the contribution. |
|
1190 | 1205 | |
|
1191 | 1206 | * IPython/FlexCompleter.py (Completer.attr_matches): Add a |
|
1192 | 1207 | slightly modified version of the patch in |
|
1193 | 1208 | http://www.scipy.net/roundup/ipython/issue34, which also allows me |
|
1194 | 1209 | to remove the previous try/except solution (which was costlier). |
|
1195 | 1210 | Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix. |
|
1196 | 1211 | |
|
1197 | 1212 | 2005-06-08 Fernando Perez <fperez@colorado.edu> |
|
1198 | 1213 | |
|
1199 | 1214 | * IPython/iplib.py (write/write_err): Add methods to abstract all |
|
1200 | 1215 | I/O a bit more. |
|
1201 | 1216 | |
|
1202 | 1217 | * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation |
|
1203 | 1218 | warning, reported by Aric Hagberg, fix by JD Hunter. |
|
1204 | 1219 | |
|
1205 | 1220 | 2005-06-02 *** Released version 0.6.15 |
|
1206 | 1221 | |
|
1207 | 1222 | 2005-06-01 Fernando Perez <fperez@colorado.edu> |
|
1208 | 1223 | |
|
1209 | 1224 | * IPython/iplib.py (MagicCompleter.file_matches): Fix |
|
1210 | 1225 | tab-completion of filenames within open-quoted strings. Note that |
|
1211 | 1226 | this requires that in ~/.ipython/ipythonrc, users change the |
|
1212 | 1227 | readline delimiters configuration to read: |
|
1213 | 1228 | |
|
1214 | 1229 | readline_remove_delims -/~ |
|
1215 | 1230 | |
|
1216 | 1231 | |
|
1217 | 1232 | 2005-05-31 *** Released version 0.6.14 |
|
1218 | 1233 | |
|
1219 | 1234 | 2005-05-29 Fernando Perez <fperez@colorado.edu> |
|
1220 | 1235 | |
|
1221 | 1236 | * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks |
|
1222 | 1237 | with files not on the filesystem. Reported by Eliyahu Sandler |
|
1223 | 1238 | <eli@gondolin.net> |
|
1224 | 1239 | |
|
1225 | 1240 | 2005-05-22 Fernando Perez <fperez@colorado.edu> |
|
1226 | 1241 | |
|
1227 | 1242 | * IPython/iplib.py: Fix a few crashes in the --upgrade option. |
|
1228 | 1243 | After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>. |
|
1229 | 1244 | |
|
1230 | 1245 | 2005-05-19 Fernando Perez <fperez@colorado.edu> |
|
1231 | 1246 | |
|
1232 | 1247 | * IPython/iplib.py (safe_execfile): close a file which could be |
|
1233 | 1248 | left open (causing problems in win32, which locks open files). |
|
1234 | 1249 | Thanks to a bug report by D Brown <dbrown2@yahoo.com>. |
|
1235 | 1250 | |
|
1236 | 1251 | 2005-05-18 Fernando Perez <fperez@colorado.edu> |
|
1237 | 1252 | |
|
1238 | 1253 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all |
|
1239 | 1254 | keyword arguments correctly to safe_execfile(). |
|
1240 | 1255 | |
|
1241 | 1256 | 2005-05-13 Fernando Perez <fperez@colorado.edu> |
|
1242 | 1257 | |
|
1243 | 1258 | * ipython.1: Added info about Qt to manpage, and threads warning |
|
1244 | 1259 | to usage page (invoked with --help). |
|
1245 | 1260 | |
|
1246 | 1261 | * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added |
|
1247 | 1262 | new matcher (it goes at the end of the priority list) to do |
|
1248 | 1263 | tab-completion on named function arguments. Submitted by George |
|
1249 | 1264 | Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at |
|
1250 | 1265 | http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html |
|
1251 | 1266 | for more details. |
|
1252 | 1267 | |
|
1253 | 1268 | * IPython/Magic.py (magic_run): Added new -e flag to ignore |
|
1254 | 1269 | SystemExit exceptions in the script being run. Thanks to a report |
|
1255 | 1270 | by danny shevitz <danny_shevitz-AT-yahoo.com>, about this |
|
1256 | 1271 | producing very annoying behavior when running unit tests. |
|
1257 | 1272 | |
|
1258 | 1273 | 2005-05-12 Fernando Perez <fperez@colorado.edu> |
|
1259 | 1274 | |
|
1260 | 1275 | * IPython/iplib.py (handle_auto): fixed auto-quoting and parens, |
|
1261 | 1276 | which I'd broken (again) due to a changed regexp. In the process, |
|
1262 | 1277 | added ';' as an escape to auto-quote the whole line without |
|
1263 | 1278 | splitting its arguments. Thanks to a report by Jerry McRae |
|
1264 | 1279 | <qrs0xyc02-AT-sneakemail.com>. |
|
1265 | 1280 | |
|
1266 | 1281 | * IPython/ultraTB.py (VerboseTB.text): protect against rare but |
|
1267 | 1282 | possible crashes caused by a TokenError. Reported by Ed Schofield |
|
1268 | 1283 | <schofield-AT-ftw.at>. |
|
1269 | 1284 | |
|
1270 | 1285 | 2005-05-06 Fernando Perez <fperez@colorado.edu> |
|
1271 | 1286 | |
|
1272 | 1287 | * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6. |
|
1273 | 1288 | |
|
1274 | 1289 | 2005-04-29 Fernando Perez <fperez@colorado.edu> |
|
1275 | 1290 | |
|
1276 | 1291 | * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière |
|
1277 | 1292 | <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin |
|
1278 | 1293 | Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option |
|
1279 | 1294 | which provides support for Qt interactive usage (similar to the |
|
1280 | 1295 | existing one for WX and GTK). This had been often requested. |
|
1281 | 1296 | |
|
1282 | 1297 | 2005-04-14 *** Released version 0.6.13 |
|
1283 | 1298 | |
|
1284 | 1299 | 2005-04-08 Fernando Perez <fperez@colorado.edu> |
|
1285 | 1300 | |
|
1286 | 1301 | * IPython/Magic.py (Magic._ofind): remove docstring evaluation |
|
1287 | 1302 | from _ofind, which gets called on almost every input line. Now, |
|
1288 | 1303 | we only try to get docstrings if they are actually going to be |
|
1289 | 1304 | used (the overhead of fetching unnecessary docstrings can be |
|
1290 | 1305 | noticeable for certain objects, such as Pyro proxies). |
|
1291 | 1306 | |
|
1292 | 1307 | * IPython/iplib.py (MagicCompleter.python_matches): Change the API |
|
1293 | 1308 | for completers. For some reason I had been passing them the state |
|
1294 | 1309 | variable, which completers never actually need, and was in |
|
1295 | 1310 | conflict with the rlcompleter API. Custom completers ONLY need to |
|
1296 | 1311 | take the text parameter. |
|
1297 | 1312 | |
|
1298 | 1313 | * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics |
|
1299 | 1314 | work correctly in pysh. I've also moved all the logic which used |
|
1300 | 1315 | to be in pysh.py here, which will prevent problems with future |
|
1301 | 1316 | upgrades. However, this time I must warn users to update their |
|
1302 | 1317 | pysh profile to include the line |
|
1303 | 1318 | |
|
1304 | 1319 | import_all IPython.Extensions.InterpreterExec |
|
1305 | 1320 | |
|
1306 | 1321 | because otherwise things won't work for them. They MUST also |
|
1307 | 1322 | delete pysh.py and the line |
|
1308 | 1323 | |
|
1309 | 1324 | execfile pysh.py |
|
1310 | 1325 | |
|
1311 | 1326 | from their ipythonrc-pysh. |
|
1312 | 1327 | |
|
1313 | 1328 | * IPython/FlexCompleter.py (Completer.attr_matches): Make more |
|
1314 | 1329 | robust in the face of objects whose dir() returns non-strings |
|
1315 | 1330 | (which it shouldn't, but some broken libs like ITK do). Thanks to |
|
1316 | 1331 | a patch by John Hunter (implemented differently, though). Also |
|
1317 | 1332 | minor improvements by using .extend instead of + on lists. |
|
1318 | 1333 | |
|
1319 | 1334 | * pysh.py: |
|
1320 | 1335 | |
|
1321 | 1336 | 2005-04-06 Fernando Perez <fperez@colorado.edu> |
|
1322 | 1337 | |
|
1323 | 1338 | * IPython/ipmaker.py (make_IPython): Make multi_line_specials on |
|
1324 | 1339 | by default, so that all users benefit from it. Those who don't |
|
1325 | 1340 | want it can still turn it off. |
|
1326 | 1341 | |
|
1327 | 1342 | * IPython/UserConfig/ipythonrc: Add multi_line_specials to the |
|
1328 | 1343 | config file, I'd forgotten about this, so users were getting it |
|
1329 | 1344 | off by default. |
|
1330 | 1345 | |
|
1331 | 1346 | * IPython/iplib.py (ipmagic): big overhaul of the magic system for |
|
1332 | 1347 | consistency. Now magics can be called in multiline statements, |
|
1333 | 1348 | and python variables can be expanded in magic calls via $var. |
|
1334 | 1349 | This makes the magic system behave just like aliases or !system |
|
1335 | 1350 | calls. |
|
1336 | 1351 | |
|
1337 | 1352 | 2005-03-28 Fernando Perez <fperez@colorado.edu> |
|
1338 | 1353 | |
|
1339 | 1354 | * IPython/iplib.py (handle_auto): cleanup to use %s instead of |
|
1340 | 1355 | expensive string additions for building command. Add support for |
|
1341 | 1356 | trailing ';' when autocall is used. |
|
1342 | 1357 | |
|
1343 | 1358 | 2005-03-26 Fernando Perez <fperez@colorado.edu> |
|
1344 | 1359 | |
|
1345 | 1360 | * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31. |
|
1346 | 1361 | Bugfix by A. Schmolck, the ipython.el maintainer. Also make |
|
1347 | 1362 | ipython.el robust against prompts with any number of spaces |
|
1348 | 1363 | (including 0) after the ':' character. |
|
1349 | 1364 | |
|
1350 | 1365 | * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in |
|
1351 | 1366 | continuation prompt, which misled users to think the line was |
|
1352 | 1367 | already indented. Closes debian Bug#300847, reported to me by |
|
1353 | 1368 | Norbert Tretkowski <tretkowski-AT-inittab.de>. |
|
1354 | 1369 | |
|
1355 | 1370 | 2005-03-23 Fernando Perez <fperez@colorado.edu> |
|
1356 | 1371 | |
|
1357 | 1372 | * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are |
|
1358 | 1373 | properly aligned if they have embedded newlines. |
|
1359 | 1374 | |
|
1360 | 1375 | * IPython/iplib.py (runlines): Add a public method to expose |
|
1361 | 1376 | IPython's code execution machinery, so that users can run strings |
|
1362 | 1377 | as if they had been typed at the prompt interactively. |
|
1363 | 1378 | (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__ |
|
1364 | 1379 | methods which can call the system shell, but with python variable |
|
1365 | 1380 | expansion. The three such methods are: __IPYTHON__.system, |
|
1366 | 1381 | .getoutput and .getoutputerror. These need to be documented in a |
|
1367 | 1382 | 'public API' section (to be written) of the manual. |
|
1368 | 1383 | |
|
1369 | 1384 | 2005-03-20 Fernando Perez <fperez@colorado.edu> |
|
1370 | 1385 | |
|
1371 | 1386 | * IPython/iplib.py (InteractiveShell.set_custom_exc): new system |
|
1372 | 1387 | for custom exception handling. This is quite powerful, and it |
|
1373 | 1388 | allows for user-installable exception handlers which can trap |
|
1374 | 1389 | custom exceptions at runtime and treat them separately from |
|
1375 | 1390 | IPython's default mechanisms. At the request of FrΓ©dΓ©ric |
|
1376 | 1391 | Mantegazza <mantegazza-AT-ill.fr>. |
|
1377 | 1392 | (InteractiveShell.set_custom_completer): public API function to |
|
1378 | 1393 | add new completers at runtime. |
|
1379 | 1394 | |
|
1380 | 1395 | 2005-03-19 Fernando Perez <fperez@colorado.edu> |
|
1381 | 1396 | |
|
1382 | 1397 | * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to |
|
1383 | 1398 | allow objects which provide their docstrings via non-standard |
|
1384 | 1399 | mechanisms (like Pyro proxies) to still be inspected by ipython's |
|
1385 | 1400 | ? system. |
|
1386 | 1401 | |
|
1387 | 1402 | * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e |
|
1388 | 1403 | automatic capture system. I tried quite hard to make it work |
|
1389 | 1404 | reliably, and simply failed. I tried many combinations with the |
|
1390 | 1405 | subprocess module, but eventually nothing worked in all needed |
|
1391 | 1406 | cases (not blocking stdin for the child, duplicating stdout |
|
1392 | 1407 | without blocking, etc). The new %sc/%sx still do capture to these |
|
1393 | 1408 | magical list/string objects which make shell use much more |
|
1394 | 1409 | conveninent, so not all is lost. |
|
1395 | 1410 | |
|
1396 | 1411 | XXX - FIX MANUAL for the change above! |
|
1397 | 1412 | |
|
1398 | 1413 | (runsource): I copied code.py's runsource() into ipython to modify |
|
1399 | 1414 | it a bit. Now the code object and source to be executed are |
|
1400 | 1415 | stored in ipython. This makes this info accessible to third-party |
|
1401 | 1416 | tools, like custom exception handlers. After a request by FrΓ©dΓ©ric |
|
1402 | 1417 | Mantegazza <mantegazza-AT-ill.fr>. |
|
1403 | 1418 | |
|
1404 | 1419 | * IPython/UserConfig/ipythonrc: Add up/down arrow keys to |
|
1405 | 1420 | history-search via readline (like C-p/C-n). I'd wanted this for a |
|
1406 | 1421 | long time, but only recently found out how to do it. For users |
|
1407 | 1422 | who already have their ipythonrc files made and want this, just |
|
1408 | 1423 | add: |
|
1409 | 1424 | |
|
1410 | 1425 | readline_parse_and_bind "\e[A": history-search-backward |
|
1411 | 1426 | readline_parse_and_bind "\e[B": history-search-forward |
|
1412 | 1427 | |
|
1413 | 1428 | 2005-03-18 Fernando Perez <fperez@colorado.edu> |
|
1414 | 1429 | |
|
1415 | 1430 | * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy |
|
1416 | 1431 | LSString and SList classes which allow transparent conversions |
|
1417 | 1432 | between list mode and whitespace-separated string. |
|
1418 | 1433 | (magic_r): Fix recursion problem in %r. |
|
1419 | 1434 | |
|
1420 | 1435 | * IPython/genutils.py (LSString): New class to be used for |
|
1421 | 1436 | automatic storage of the results of all alias/system calls in _o |
|
1422 | 1437 | and _e (stdout/err). These provide a .l/.list attribute which |
|
1423 | 1438 | does automatic splitting on newlines. This means that for most |
|
1424 | 1439 | uses, you'll never need to do capturing of output with %sc/%sx |
|
1425 | 1440 | anymore, since ipython keeps this always done for you. Note that |
|
1426 | 1441 | only the LAST results are stored, the _o/e variables are |
|
1427 | 1442 | overwritten on each call. If you need to save their contents |
|
1428 | 1443 | further, simply bind them to any other name. |
|
1429 | 1444 | |
|
1430 | 1445 | 2005-03-17 Fernando Perez <fperez@colorado.edu> |
|
1431 | 1446 | |
|
1432 | 1447 | * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for |
|
1433 | 1448 | prompt namespace handling. |
|
1434 | 1449 | |
|
1435 | 1450 | 2005-03-16 Fernando Perez <fperez@colorado.edu> |
|
1436 | 1451 | |
|
1437 | 1452 | * IPython/Prompts.py (CachedOutput.__init__): Fix default and |
|
1438 | 1453 | classic prompts to be '>>> ' (final space was missing, and it |
|
1439 | 1454 | trips the emacs python mode). |
|
1440 | 1455 | (BasePrompt.__str__): Added safe support for dynamic prompt |
|
1441 | 1456 | strings. Now you can set your prompt string to be '$x', and the |
|
1442 | 1457 | value of x will be printed from your interactive namespace. The |
|
1443 | 1458 | interpolation syntax includes the full Itpl support, so |
|
1444 | 1459 | ${foo()+x+bar()} is a valid prompt string now, and the function |
|
1445 | 1460 | calls will be made at runtime. |
|
1446 | 1461 | |
|
1447 | 1462 | 2005-03-15 Fernando Perez <fperez@colorado.edu> |
|
1448 | 1463 | |
|
1449 | 1464 | * IPython/Magic.py (magic_history): renamed %hist to %history, to |
|
1450 | 1465 | avoid name clashes in pylab. %hist still works, it just forwards |
|
1451 | 1466 | the call to %history. |
|
1452 | 1467 | |
|
1453 | 1468 | 2005-03-02 *** Released version 0.6.12 |
|
1454 | 1469 | |
|
1455 | 1470 | 2005-03-02 Fernando Perez <fperez@colorado.edu> |
|
1456 | 1471 | |
|
1457 | 1472 | * IPython/iplib.py (handle_magic): log magic calls properly as |
|
1458 | 1473 | ipmagic() function calls. |
|
1459 | 1474 | |
|
1460 | 1475 | * IPython/Magic.py (magic_time): Improved %time to support |
|
1461 | 1476 | statements and provide wall-clock as well as CPU time. |
|
1462 | 1477 | |
|
1463 | 1478 | 2005-02-27 Fernando Perez <fperez@colorado.edu> |
|
1464 | 1479 | |
|
1465 | 1480 | * IPython/hooks.py: New hooks module, to expose user-modifiable |
|
1466 | 1481 | IPython functionality in a clean manner. For now only the editor |
|
1467 | 1482 | hook is actually written, and other thigns which I intend to turn |
|
1468 | 1483 | into proper hooks aren't yet there. The display and prefilter |
|
1469 | 1484 | stuff, for example, should be hooks. But at least now the |
|
1470 | 1485 | framework is in place, and the rest can be moved here with more |
|
1471 | 1486 | time later. IPython had had a .hooks variable for a long time for |
|
1472 | 1487 | this purpose, but I'd never actually used it for anything. |
|
1473 | 1488 | |
|
1474 | 1489 | 2005-02-26 Fernando Perez <fperez@colorado.edu> |
|
1475 | 1490 | |
|
1476 | 1491 | * IPython/ipmaker.py (make_IPython): make the default ipython |
|
1477 | 1492 | directory be called _ipython under win32, to follow more the |
|
1478 | 1493 | naming peculiarities of that platform (where buggy software like |
|
1479 | 1494 | Visual Sourcesafe breaks with .named directories). Reported by |
|
1480 | 1495 | Ville Vainio. |
|
1481 | 1496 | |
|
1482 | 1497 | 2005-02-23 Fernando Perez <fperez@colorado.edu> |
|
1483 | 1498 | |
|
1484 | 1499 | * IPython/iplib.py (InteractiveShell.__init__): removed a few |
|
1485 | 1500 | auto_aliases for win32 which were causing problems. Users can |
|
1486 | 1501 | define the ones they personally like. |
|
1487 | 1502 | |
|
1488 | 1503 | 2005-02-21 Fernando Perez <fperez@colorado.edu> |
|
1489 | 1504 | |
|
1490 | 1505 | * IPython/Magic.py (magic_time): new magic to time execution of |
|
1491 | 1506 | expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>. |
|
1492 | 1507 | |
|
1493 | 1508 | 2005-02-19 Fernando Perez <fperez@colorado.edu> |
|
1494 | 1509 | |
|
1495 | 1510 | * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings |
|
1496 | 1511 | into keys (for prompts, for example). |
|
1497 | 1512 | |
|
1498 | 1513 | * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty |
|
1499 | 1514 | prompts in case users want them. This introduces a small behavior |
|
1500 | 1515 | change: ipython does not automatically add a space to all prompts |
|
1501 | 1516 | anymore. To get the old prompts with a space, users should add it |
|
1502 | 1517 | manually to their ipythonrc file, so for example prompt_in1 should |
|
1503 | 1518 | now read 'In [\#]: ' instead of 'In [\#]:'. |
|
1504 | 1519 | (BasePrompt.__init__): New option prompts_pad_left (only in rc |
|
1505 | 1520 | file) to control left-padding of secondary prompts. |
|
1506 | 1521 | |
|
1507 | 1522 | * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if |
|
1508 | 1523 | the profiler can't be imported. Fix for Debian, which removed |
|
1509 | 1524 | profile.py because of License issues. I applied a slightly |
|
1510 | 1525 | modified version of the original Debian patch at |
|
1511 | 1526 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500. |
|
1512 | 1527 | |
|
1513 | 1528 | 2005-02-17 Fernando Perez <fperez@colorado.edu> |
|
1514 | 1529 | |
|
1515 | 1530 | * IPython/genutils.py (native_line_ends): Fix bug which would |
|
1516 | 1531 | cause improper line-ends under win32 b/c I was not opening files |
|
1517 | 1532 | in binary mode. Bug report and fix thanks to Ville. |
|
1518 | 1533 | |
|
1519 | 1534 | * IPython/iplib.py (handle_auto): Fix bug which I introduced when |
|
1520 | 1535 | trying to catch spurious foo[1] autocalls. My fix actually broke |
|
1521 | 1536 | ',/' autoquote/call with explicit escape (bad regexp). |
|
1522 | 1537 | |
|
1523 | 1538 | 2005-02-15 *** Released version 0.6.11 |
|
1524 | 1539 | |
|
1525 | 1540 | 2005-02-14 Fernando Perez <fperez@colorado.edu> |
|
1526 | 1541 | |
|
1527 | 1542 | * IPython/background_jobs.py: New background job management |
|
1528 | 1543 | subsystem. This is implemented via a new set of classes, and |
|
1529 | 1544 | IPython now provides a builtin 'jobs' object for background job |
|
1530 | 1545 | execution. A convenience %bg magic serves as a lightweight |
|
1531 | 1546 | frontend for starting the more common type of calls. This was |
|
1532 | 1547 | inspired by discussions with B. Granger and the BackgroundCommand |
|
1533 | 1548 | class described in the book Python Scripting for Computational |
|
1534 | 1549 | Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting |
|
1535 | 1550 | (although ultimately no code from this text was used, as IPython's |
|
1536 | 1551 | system is a separate implementation). |
|
1537 | 1552 | |
|
1538 | 1553 | * IPython/iplib.py (MagicCompleter.python_matches): add new option |
|
1539 | 1554 | to control the completion of single/double underscore names |
|
1540 | 1555 | separately. As documented in the example ipytonrc file, the |
|
1541 | 1556 | readline_omit__names variable can now be set to 2, to omit even |
|
1542 | 1557 | single underscore names. Thanks to a patch by Brian Wong |
|
1543 | 1558 | <BrianWong-AT-AirgoNetworks.Com>. |
|
1544 | 1559 | (InteractiveShell.__init__): Fix bug which would cause foo[1] to |
|
1545 | 1560 | be autocalled as foo([1]) if foo were callable. A problem for |
|
1546 | 1561 | things which are both callable and implement __getitem__. |
|
1547 | 1562 | (init_readline): Fix autoindentation for win32. Thanks to a patch |
|
1548 | 1563 | by Vivian De Smedt <vivian-AT-vdesmedt.com>. |
|
1549 | 1564 | |
|
1550 | 1565 | 2005-02-12 Fernando Perez <fperez@colorado.edu> |
|
1551 | 1566 | |
|
1552 | 1567 | * IPython/ipmaker.py (make_IPython): Disabled the stout traps |
|
1553 | 1568 | which I had written long ago to sort out user error messages which |
|
1554 | 1569 | may occur during startup. This seemed like a good idea initially, |
|
1555 | 1570 | but it has proven a disaster in retrospect. I don't want to |
|
1556 | 1571 | change much code for now, so my fix is to set the internal 'debug' |
|
1557 | 1572 | flag to true everywhere, whose only job was precisely to control |
|
1558 | 1573 | this subsystem. This closes issue 28 (as well as avoiding all |
|
1559 | 1574 | sorts of strange hangups which occur from time to time). |
|
1560 | 1575 | |
|
1561 | 1576 | 2005-02-07 Fernando Perez <fperez@colorado.edu> |
|
1562 | 1577 | |
|
1563 | 1578 | * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the |
|
1564 | 1579 | previous call produced a syntax error. |
|
1565 | 1580 | |
|
1566 | 1581 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting |
|
1567 | 1582 | classes without constructor. |
|
1568 | 1583 | |
|
1569 | 1584 | 2005-02-06 Fernando Perez <fperez@colorado.edu> |
|
1570 | 1585 | |
|
1571 | 1586 | * IPython/iplib.py (MagicCompleter.complete): Extend the list of |
|
1572 | 1587 | completions with the results of each matcher, so we return results |
|
1573 | 1588 | to the user from all namespaces. This breaks with ipython |
|
1574 | 1589 | tradition, but I think it's a nicer behavior. Now you get all |
|
1575 | 1590 | possible completions listed, from all possible namespaces (python, |
|
1576 | 1591 | filesystem, magics...) After a request by John Hunter |
|
1577 | 1592 | <jdhunter-AT-nitace.bsd.uchicago.edu>. |
|
1578 | 1593 | |
|
1579 | 1594 | 2005-02-05 Fernando Perez <fperez@colorado.edu> |
|
1580 | 1595 | |
|
1581 | 1596 | * IPython/Magic.py (magic_prun): Fix bug where prun would fail if |
|
1582 | 1597 | the call had quote characters in it (the quotes were stripped). |
|
1583 | 1598 | |
|
1584 | 1599 | 2005-01-31 Fernando Perez <fperez@colorado.edu> |
|
1585 | 1600 | |
|
1586 | 1601 | * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on |
|
1587 | 1602 | Itpl.itpl() to make the code more robust against psyco |
|
1588 | 1603 | optimizations. |
|
1589 | 1604 | |
|
1590 | 1605 | * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead |
|
1591 | 1606 | of causing an exception. Quicker, cleaner. |
|
1592 | 1607 | |
|
1593 | 1608 | 2005-01-28 Fernando Perez <fperez@colorado.edu> |
|
1594 | 1609 | |
|
1595 | 1610 | * scripts/ipython_win_post_install.py (install): hardcode |
|
1596 | 1611 | sys.prefix+'python.exe' as the executable path. It turns out that |
|
1597 | 1612 | during the post-installation run, sys.executable resolves to the |
|
1598 | 1613 | name of the binary installer! I should report this as a distutils |
|
1599 | 1614 | bug, I think. I updated the .10 release with this tiny fix, to |
|
1600 | 1615 | avoid annoying the lists further. |
|
1601 | 1616 | |
|
1602 | 1617 | 2005-01-27 *** Released version 0.6.10 |
|
1603 | 1618 | |
|
1604 | 1619 | 2005-01-27 Fernando Perez <fperez@colorado.edu> |
|
1605 | 1620 | |
|
1606 | 1621 | * IPython/numutils.py (norm): Added 'inf' as optional name for |
|
1607 | 1622 | L-infinity norm, included references to mathworld.com for vector |
|
1608 | 1623 | norm definitions. |
|
1609 | 1624 | (amin/amax): added amin/amax for array min/max. Similar to what |
|
1610 | 1625 | pylab ships with after the recent reorganization of names. |
|
1611 | 1626 | (spike/spike_odd): removed deprecated spike/spike_odd functions. |
|
1612 | 1627 | |
|
1613 | 1628 | * ipython.el: committed Alex's recent fixes and improvements. |
|
1614 | 1629 | Tested with python-mode from CVS, and it looks excellent. Since |
|
1615 | 1630 | python-mode hasn't released anything in a while, I'm temporarily |
|
1616 | 1631 | putting a copy of today's CVS (v 4.70) of python-mode in: |
|
1617 | 1632 | http://ipython.scipy.org/tmp/python-mode.el |
|
1618 | 1633 | |
|
1619 | 1634 | * scripts/ipython_win_post_install.py (install): Win32 fix to use |
|
1620 | 1635 | sys.executable for the executable name, instead of assuming it's |
|
1621 | 1636 | called 'python.exe' (the post-installer would have produced broken |
|
1622 | 1637 | setups on systems with a differently named python binary). |
|
1623 | 1638 | |
|
1624 | 1639 | * IPython/PyColorize.py (Parser.__call__): change explicit '\n' |
|
1625 | 1640 | references to os.linesep, to make the code more |
|
1626 | 1641 | platform-independent. This is also part of the win32 coloring |
|
1627 | 1642 | fixes. |
|
1628 | 1643 | |
|
1629 | 1644 | * IPython/genutils.py (page_dumb): Remove attempts to chop long |
|
1630 | 1645 | lines, which actually cause coloring bugs because the length of |
|
1631 | 1646 | the line is very difficult to correctly compute with embedded |
|
1632 | 1647 | escapes. This was the source of all the coloring problems under |
|
1633 | 1648 | Win32. I think that _finally_, Win32 users have a properly |
|
1634 | 1649 | working ipython in all respects. This would never have happened |
|
1635 | 1650 | if not for Gary Bishop and Viktor Ransmayr's great help and work. |
|
1636 | 1651 | |
|
1637 | 1652 | 2005-01-26 *** Released version 0.6.9 |
|
1638 | 1653 | |
|
1639 | 1654 | 2005-01-25 Fernando Perez <fperez@colorado.edu> |
|
1640 | 1655 | |
|
1641 | 1656 | * setup.py: finally, we have a true Windows installer, thanks to |
|
1642 | 1657 | the excellent work of Viktor Ransmayr |
|
1643 | 1658 | <viktor.ransmayr-AT-t-online.de>. The docs have been updated for |
|
1644 | 1659 | Windows users. The setup routine is quite a bit cleaner thanks to |
|
1645 | 1660 | this, and the post-install script uses the proper functions to |
|
1646 | 1661 | allow a clean de-installation using the standard Windows Control |
|
1647 | 1662 | Panel. |
|
1648 | 1663 | |
|
1649 | 1664 | * IPython/genutils.py (get_home_dir): changed to use the $HOME |
|
1650 | 1665 | environment variable under all OSes (including win32) if |
|
1651 | 1666 | available. This will give consistency to win32 users who have set |
|
1652 | 1667 | this variable for any reason. If os.environ['HOME'] fails, the |
|
1653 | 1668 | previous policy of using HOMEDRIVE\HOMEPATH kicks in. |
|
1654 | 1669 | |
|
1655 | 1670 | 2005-01-24 Fernando Perez <fperez@colorado.edu> |
|
1656 | 1671 | |
|
1657 | 1672 | * IPython/numutils.py (empty_like): add empty_like(), similar to |
|
1658 | 1673 | zeros_like() but taking advantage of the new empty() Numeric routine. |
|
1659 | 1674 | |
|
1660 | 1675 | 2005-01-23 *** Released version 0.6.8 |
|
1661 | 1676 | |
|
1662 | 1677 | 2005-01-22 Fernando Perez <fperez@colorado.edu> |
|
1663 | 1678 | |
|
1664 | 1679 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the |
|
1665 | 1680 | automatic show() calls. After discussing things with JDH, it |
|
1666 | 1681 | turns out there are too many corner cases where this can go wrong. |
|
1667 | 1682 | It's best not to try to be 'too smart', and simply have ipython |
|
1668 | 1683 | reproduce as much as possible the default behavior of a normal |
|
1669 | 1684 | python shell. |
|
1670 | 1685 | |
|
1671 | 1686 | * IPython/iplib.py (InteractiveShell.__init__): Modified the |
|
1672 | 1687 | line-splitting regexp and _prefilter() to avoid calling getattr() |
|
1673 | 1688 | on assignments. This closes |
|
1674 | 1689 | http://www.scipy.net/roundup/ipython/issue24. Note that Python's |
|
1675 | 1690 | readline uses getattr(), so a simple <TAB> keypress is still |
|
1676 | 1691 | enough to trigger getattr() calls on an object. |
|
1677 | 1692 | |
|
1678 | 1693 | 2005-01-21 Fernando Perez <fperez@colorado.edu> |
|
1679 | 1694 | |
|
1680 | 1695 | * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run |
|
1681 | 1696 | docstring under pylab so it doesn't mask the original. |
|
1682 | 1697 | |
|
1683 | 1698 | 2005-01-21 *** Released version 0.6.7 |
|
1684 | 1699 | |
|
1685 | 1700 | 2005-01-21 Fernando Perez <fperez@colorado.edu> |
|
1686 | 1701 | |
|
1687 | 1702 | * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with |
|
1688 | 1703 | signal handling for win32 users in multithreaded mode. |
|
1689 | 1704 | |
|
1690 | 1705 | 2005-01-17 Fernando Perez <fperez@colorado.edu> |
|
1691 | 1706 | |
|
1692 | 1707 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting |
|
1693 | 1708 | instances with no __init__. After a crash report by Norbert Nemec |
|
1694 | 1709 | <Norbert-AT-nemec-online.de>. |
|
1695 | 1710 | |
|
1696 | 1711 | 2005-01-14 Fernando Perez <fperez@colorado.edu> |
|
1697 | 1712 | |
|
1698 | 1713 | * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of |
|
1699 | 1714 | names for verbose exceptions, when multiple dotted names and the |
|
1700 | 1715 | 'parent' object were present on the same line. |
|
1701 | 1716 | |
|
1702 | 1717 | 2005-01-11 Fernando Perez <fperez@colorado.edu> |
|
1703 | 1718 | |
|
1704 | 1719 | * IPython/genutils.py (flag_calls): new utility to trap and flag |
|
1705 | 1720 | calls in functions. I need it to clean up matplotlib support. |
|
1706 | 1721 | Also removed some deprecated code in genutils. |
|
1707 | 1722 | |
|
1708 | 1723 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so |
|
1709 | 1724 | that matplotlib scripts called with %run, which don't call show() |
|
1710 | 1725 | themselves, still have their plotting windows open. |
|
1711 | 1726 | |
|
1712 | 1727 | 2005-01-05 Fernando Perez <fperez@colorado.edu> |
|
1713 | 1728 | |
|
1714 | 1729 | * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw |
|
1715 | 1730 | <astraw-AT-caltech.edu>, to fix gtk deprecation warnings. |
|
1716 | 1731 | |
|
1717 | 1732 | 2004-12-19 Fernando Perez <fperez@colorado.edu> |
|
1718 | 1733 | |
|
1719 | 1734 | * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of |
|
1720 | 1735 | parent_runcode, which was an eyesore. The same result can be |
|
1721 | 1736 | obtained with Python's regular superclass mechanisms. |
|
1722 | 1737 | |
|
1723 | 1738 | 2004-12-17 Fernando Perez <fperez@colorado.edu> |
|
1724 | 1739 | |
|
1725 | 1740 | * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem |
|
1726 | 1741 | reported by Prabhu. |
|
1727 | 1742 | (Magic.magic_sx): direct all errors to Term.cerr (defaults to |
|
1728 | 1743 | sys.stderr) instead of explicitly calling sys.stderr. This helps |
|
1729 | 1744 | maintain our I/O abstractions clean, for future GUI embeddings. |
|
1730 | 1745 | |
|
1731 | 1746 | * IPython/genutils.py (info): added new utility for sys.stderr |
|
1732 | 1747 | unified info message handling (thin wrapper around warn()). |
|
1733 | 1748 | |
|
1734 | 1749 | * IPython/ultraTB.py (VerboseTB.text): Fix misreported global |
|
1735 | 1750 | composite (dotted) names on verbose exceptions. |
|
1736 | 1751 | (VerboseTB.nullrepr): harden against another kind of errors which |
|
1737 | 1752 | Python's inspect module can trigger, and which were crashing |
|
1738 | 1753 | IPython. Thanks to a report by Marco Lombardi |
|
1739 | 1754 | <mlombard-AT-ma010192.hq.eso.org>. |
|
1740 | 1755 | |
|
1741 | 1756 | 2004-12-13 *** Released version 0.6.6 |
|
1742 | 1757 | |
|
1743 | 1758 | 2004-12-12 Fernando Perez <fperez@colorado.edu> |
|
1744 | 1759 | |
|
1745 | 1760 | * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors |
|
1746 | 1761 | generated by pygtk upon initialization if it was built without |
|
1747 | 1762 | threads (for matplotlib users). After a crash reported by |
|
1748 | 1763 | Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>. |
|
1749 | 1764 | |
|
1750 | 1765 | * IPython/ipmaker.py (make_IPython): fix small bug in the |
|
1751 | 1766 | import_some parameter for multiple imports. |
|
1752 | 1767 | |
|
1753 | 1768 | * IPython/iplib.py (ipmagic): simplified the interface of |
|
1754 | 1769 | ipmagic() to take a single string argument, just as it would be |
|
1755 | 1770 | typed at the IPython cmd line. |
|
1756 | 1771 | (ipalias): Added new ipalias() with an interface identical to |
|
1757 | 1772 | ipmagic(). This completes exposing a pure python interface to the |
|
1758 | 1773 | alias and magic system, which can be used in loops or more complex |
|
1759 | 1774 | code where IPython's automatic line mangling is not active. |
|
1760 | 1775 | |
|
1761 | 1776 | * IPython/genutils.py (timing): changed interface of timing to |
|
1762 | 1777 | simply run code once, which is the most common case. timings() |
|
1763 | 1778 | remains unchanged, for the cases where you want multiple runs. |
|
1764 | 1779 | |
|
1765 | 1780 | * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a |
|
1766 | 1781 | bug where Python2.2 crashes with exec'ing code which does not end |
|
1767 | 1782 | in a single newline. Python 2.3 is OK, so I hadn't noticed this |
|
1768 | 1783 | before. |
|
1769 | 1784 | |
|
1770 | 1785 | 2004-12-10 Fernando Perez <fperez@colorado.edu> |
|
1771 | 1786 | |
|
1772 | 1787 | * IPython/Magic.py (Magic.magic_prun): changed name of option from |
|
1773 | 1788 | -t to -T, to accomodate the new -t flag in %run (the %run and |
|
1774 | 1789 | %prun options are kind of intermixed, and it's not easy to change |
|
1775 | 1790 | this with the limitations of python's getopt). |
|
1776 | 1791 | |
|
1777 | 1792 | * IPython/Magic.py (Magic.magic_run): Added new -t option to time |
|
1778 | 1793 | the execution of scripts. It's not as fine-tuned as timeit.py, |
|
1779 | 1794 | but it works from inside ipython (and under 2.2, which lacks |
|
1780 | 1795 | timeit.py). Optionally a number of runs > 1 can be given for |
|
1781 | 1796 | timing very short-running code. |
|
1782 | 1797 | |
|
1783 | 1798 | * IPython/genutils.py (uniq_stable): new routine which returns a |
|
1784 | 1799 | list of unique elements in any iterable, but in stable order of |
|
1785 | 1800 | appearance. I needed this for the ultraTB fixes, and it's a handy |
|
1786 | 1801 | utility. |
|
1787 | 1802 | |
|
1788 | 1803 | * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of |
|
1789 | 1804 | dotted names in Verbose exceptions. This had been broken since |
|
1790 | 1805 | the very start, now x.y will properly be printed in a Verbose |
|
1791 | 1806 | traceback, instead of x being shown and y appearing always as an |
|
1792 | 1807 | 'undefined global'. Getting this to work was a bit tricky, |
|
1793 | 1808 | because by default python tokenizers are stateless. Saved by |
|
1794 | 1809 | python's ability to easily add a bit of state to an arbitrary |
|
1795 | 1810 | function (without needing to build a full-blown callable object). |
|
1796 | 1811 | |
|
1797 | 1812 | Also big cleanup of this code, which had horrendous runtime |
|
1798 | 1813 | lookups of zillions of attributes for colorization. Moved all |
|
1799 | 1814 | this code into a few templates, which make it cleaner and quicker. |
|
1800 | 1815 | |
|
1801 | 1816 | Printout quality was also improved for Verbose exceptions: one |
|
1802 | 1817 | variable per line, and memory addresses are printed (this can be |
|
1803 | 1818 | quite handy in nasty debugging situations, which is what Verbose |
|
1804 | 1819 | is for). |
|
1805 | 1820 | |
|
1806 | 1821 | * IPython/ipmaker.py (make_IPython): Do NOT execute files named in |
|
1807 | 1822 | the command line as scripts to be loaded by embedded instances. |
|
1808 | 1823 | Doing so has the potential for an infinite recursion if there are |
|
1809 | 1824 | exceptions thrown in the process. This fixes a strange crash |
|
1810 | 1825 | reported by Philippe MULLER <muller-AT-irit.fr>. |
|
1811 | 1826 | |
|
1812 | 1827 | 2004-12-09 Fernando Perez <fperez@colorado.edu> |
|
1813 | 1828 | |
|
1814 | 1829 | * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support |
|
1815 | 1830 | to reflect new names in matplotlib, which now expose the |
|
1816 | 1831 | matlab-compatible interface via a pylab module instead of the |
|
1817 | 1832 | 'matlab' name. The new code is backwards compatible, so users of |
|
1818 | 1833 | all matplotlib versions are OK. Patch by J. Hunter. |
|
1819 | 1834 | |
|
1820 | 1835 | * IPython/OInspect.py (Inspector.pinfo): Add to object? printing |
|
1821 | 1836 | of __init__ docstrings for instances (class docstrings are already |
|
1822 | 1837 | automatically printed). Instances with customized docstrings |
|
1823 | 1838 | (indep. of the class) are also recognized and all 3 separate |
|
1824 | 1839 | docstrings are printed (instance, class, constructor). After some |
|
1825 | 1840 | comments/suggestions by J. Hunter. |
|
1826 | 1841 | |
|
1827 | 1842 | 2004-12-05 Fernando Perez <fperez@colorado.edu> |
|
1828 | 1843 | |
|
1829 | 1844 | * IPython/iplib.py (MagicCompleter.complete): Remove annoying |
|
1830 | 1845 | warnings when tab-completion fails and triggers an exception. |
|
1831 | 1846 | |
|
1832 | 1847 | 2004-12-03 Fernando Perez <fperez@colorado.edu> |
|
1833 | 1848 | |
|
1834 | 1849 | * IPython/Magic.py (magic_prun): Fix bug where an exception would |
|
1835 | 1850 | be triggered when using 'run -p'. An incorrect option flag was |
|
1836 | 1851 | being set ('d' instead of 'D'). |
|
1837 | 1852 | (manpage): fix missing escaped \- sign. |
|
1838 | 1853 | |
|
1839 | 1854 | 2004-11-30 *** Released version 0.6.5 |
|
1840 | 1855 | |
|
1841 | 1856 | 2004-11-30 Fernando Perez <fperez@colorado.edu> |
|
1842 | 1857 | |
|
1843 | 1858 | * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint |
|
1844 | 1859 | setting with -d option. |
|
1845 | 1860 | |
|
1846 | 1861 | * setup.py (docfiles): Fix problem where the doc glob I was using |
|
1847 | 1862 | was COMPLETELY BROKEN. It was giving the right files by pure |
|
1848 | 1863 | accident, but failed once I tried to include ipython.el. Note: |
|
1849 | 1864 | glob() does NOT allow you to do exclusion on multiple endings! |
|
1850 | 1865 | |
|
1851 | 1866 | 2004-11-29 Fernando Perez <fperez@colorado.edu> |
|
1852 | 1867 | |
|
1853 | 1868 | * IPython/usage.py (__doc__): cleaned up usage docstring, by using |
|
1854 | 1869 | the manpage as the source. Better formatting & consistency. |
|
1855 | 1870 | |
|
1856 | 1871 | * IPython/Magic.py (magic_run): Added new -d option, to run |
|
1857 | 1872 | scripts under the control of the python pdb debugger. Note that |
|
1858 | 1873 | this required changing the %prun option -d to -D, to avoid a clash |
|
1859 | 1874 | (since %run must pass options to %prun, and getopt is too dumb to |
|
1860 | 1875 | handle options with string values with embedded spaces). Thanks |
|
1861 | 1876 | to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>. |
|
1862 | 1877 | (magic_who_ls): added type matching to %who and %whos, so that one |
|
1863 | 1878 | can filter their output to only include variables of certain |
|
1864 | 1879 | types. Another suggestion by Matthew. |
|
1865 | 1880 | (magic_whos): Added memory summaries in kb and Mb for arrays. |
|
1866 | 1881 | (magic_who): Improve formatting (break lines every 9 vars). |
|
1867 | 1882 | |
|
1868 | 1883 | 2004-11-28 Fernando Perez <fperez@colorado.edu> |
|
1869 | 1884 | |
|
1870 | 1885 | * IPython/Logger.py (Logger.log): Fix bug in syncing the input |
|
1871 | 1886 | cache when empty lines were present. |
|
1872 | 1887 | |
|
1873 | 1888 | 2004-11-24 Fernando Perez <fperez@colorado.edu> |
|
1874 | 1889 | |
|
1875 | 1890 | * IPython/usage.py (__doc__): document the re-activated threading |
|
1876 | 1891 | options for WX and GTK. |
|
1877 | 1892 | |
|
1878 | 1893 | 2004-11-23 Fernando Perez <fperez@colorado.edu> |
|
1879 | 1894 | |
|
1880 | 1895 | * IPython/Shell.py (start): Added Prabhu's big patch to reactivate |
|
1881 | 1896 | the -wthread and -gthread options, along with a new -tk one to try |
|
1882 | 1897 | and coordinate Tk threading with wx/gtk. The tk support is very |
|
1883 | 1898 | platform dependent, since it seems to require Tcl and Tk to be |
|
1884 | 1899 | built with threads (Fedora1/2 appears NOT to have it, but in |
|
1885 | 1900 | Prabhu's Debian boxes it works OK). But even with some Tk |
|
1886 | 1901 | limitations, this is a great improvement. |
|
1887 | 1902 | |
|
1888 | 1903 | * IPython/Prompts.py (prompt_specials_color): Added \t for time |
|
1889 | 1904 | info in user prompts. Patch by Prabhu. |
|
1890 | 1905 | |
|
1891 | 1906 | 2004-11-18 Fernando Perez <fperez@colorado.edu> |
|
1892 | 1907 | |
|
1893 | 1908 | * IPython/genutils.py (ask_yes_no): Add check for a max of 20 |
|
1894 | 1909 | EOFErrors and bail, to avoid infinite loops if a non-terminating |
|
1895 | 1910 | file is fed into ipython. Patch submitted in issue 19 by user, |
|
1896 | 1911 | many thanks. |
|
1897 | 1912 | |
|
1898 | 1913 | * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger |
|
1899 | 1914 | autoquote/parens in continuation prompts, which can cause lots of |
|
1900 | 1915 | problems. Closes roundup issue 20. |
|
1901 | 1916 | |
|
1902 | 1917 | 2004-11-17 Fernando Perez <fperez@colorado.edu> |
|
1903 | 1918 | |
|
1904 | 1919 | * debian/control (Build-Depends-Indep): Fix dpatch dependency, |
|
1905 | 1920 | reported as debian bug #280505. I'm not sure my local changelog |
|
1906 | 1921 | entry has the proper debian format (Jack?). |
|
1907 | 1922 | |
|
1908 | 1923 | 2004-11-08 *** Released version 0.6.4 |
|
1909 | 1924 | |
|
1910 | 1925 | 2004-11-08 Fernando Perez <fperez@colorado.edu> |
|
1911 | 1926 | |
|
1912 | 1927 | * IPython/iplib.py (init_readline): Fix exit message for Windows |
|
1913 | 1928 | when readline is active. Thanks to a report by Eric Jones |
|
1914 | 1929 | <eric-AT-enthought.com>. |
|
1915 | 1930 | |
|
1916 | 1931 | 2004-11-07 Fernando Perez <fperez@colorado.edu> |
|
1917 | 1932 | |
|
1918 | 1933 | * IPython/genutils.py (page): Add a trap for OSError exceptions, |
|
1919 | 1934 | sometimes seen by win2k/cygwin users. |
|
1920 | 1935 | |
|
1921 | 1936 | 2004-11-06 Fernando Perez <fperez@colorado.edu> |
|
1922 | 1937 | |
|
1923 | 1938 | * IPython/iplib.py (interact): Change the handling of %Exit from |
|
1924 | 1939 | trying to propagate a SystemExit to an internal ipython flag. |
|
1925 | 1940 | This is less elegant than using Python's exception mechanism, but |
|
1926 | 1941 | I can't get that to work reliably with threads, so under -pylab |
|
1927 | 1942 | %Exit was hanging IPython. Cross-thread exception handling is |
|
1928 | 1943 | really a bitch. Thaks to a bug report by Stephen Walton |
|
1929 | 1944 | <stephen.walton-AT-csun.edu>. |
|
1930 | 1945 | |
|
1931 | 1946 | 2004-11-04 Fernando Perez <fperez@colorado.edu> |
|
1932 | 1947 | |
|
1933 | 1948 | * IPython/iplib.py (raw_input_original): store a pointer to the |
|
1934 | 1949 | true raw_input to harden against code which can modify it |
|
1935 | 1950 | (wx.py.PyShell does this and would otherwise crash ipython). |
|
1936 | 1951 | Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>. |
|
1937 | 1952 | |
|
1938 | 1953 | * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for |
|
1939 | 1954 | Ctrl-C problem, which does not mess up the input line. |
|
1940 | 1955 | |
|
1941 | 1956 | 2004-11-03 Fernando Perez <fperez@colorado.edu> |
|
1942 | 1957 | |
|
1943 | 1958 | * IPython/Release.py: Changed licensing to BSD, in all files. |
|
1944 | 1959 | (name): lowercase name for tarball/RPM release. |
|
1945 | 1960 | |
|
1946 | 1961 | * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for |
|
1947 | 1962 | use throughout ipython. |
|
1948 | 1963 | |
|
1949 | 1964 | * IPython/Magic.py (Magic._ofind): Switch to using the new |
|
1950 | 1965 | OInspect.getdoc() function. |
|
1951 | 1966 | |
|
1952 | 1967 | * IPython/Shell.py (sigint_handler): Hack to ignore the execution |
|
1953 | 1968 | of the line currently being canceled via Ctrl-C. It's extremely |
|
1954 | 1969 | ugly, but I don't know how to do it better (the problem is one of |
|
1955 | 1970 | handling cross-thread exceptions). |
|
1956 | 1971 | |
|
1957 | 1972 | 2004-10-28 Fernando Perez <fperez@colorado.edu> |
|
1958 | 1973 | |
|
1959 | 1974 | * IPython/Shell.py (signal_handler): add signal handlers to trap |
|
1960 | 1975 | SIGINT and SIGSEGV in threaded code properly. Thanks to a bug |
|
1961 | 1976 | report by Francesc Alted. |
|
1962 | 1977 | |
|
1963 | 1978 | 2004-10-21 Fernando Perez <fperez@colorado.edu> |
|
1964 | 1979 | |
|
1965 | 1980 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @ |
|
1966 | 1981 | to % for pysh syntax extensions. |
|
1967 | 1982 | |
|
1968 | 1983 | 2004-10-09 Fernando Perez <fperez@colorado.edu> |
|
1969 | 1984 | |
|
1970 | 1985 | * IPython/Magic.py (Magic.magic_whos): modify output of Numeric |
|
1971 | 1986 | arrays to print a more useful summary, without calling str(arr). |
|
1972 | 1987 | This avoids the problem of extremely lengthy computations which |
|
1973 | 1988 | occur if arr is large, and appear to the user as a system lockup |
|
1974 | 1989 | with 100% cpu activity. After a suggestion by Kristian Sandberg |
|
1975 | 1990 | <Kristian.Sandberg@colorado.edu>. |
|
1976 | 1991 | (Magic.__init__): fix bug in global magic escapes not being |
|
1977 | 1992 | correctly set. |
|
1978 | 1993 | |
|
1979 | 1994 | 2004-10-08 Fernando Perez <fperez@colorado.edu> |
|
1980 | 1995 | |
|
1981 | 1996 | * IPython/Magic.py (__license__): change to absolute imports of |
|
1982 | 1997 | ipython's own internal packages, to start adapting to the absolute |
|
1983 | 1998 | import requirement of PEP-328. |
|
1984 | 1999 | |
|
1985 | 2000 | * IPython/genutils.py (__author__): Fix coding to utf-8 on all |
|
1986 | 2001 | files, and standardize author/license marks through the Release |
|
1987 | 2002 | module instead of having per/file stuff (except for files with |
|
1988 | 2003 | particular licenses, like the MIT/PSF-licensed codes). |
|
1989 | 2004 | |
|
1990 | 2005 | * IPython/Debugger.py: remove dead code for python 2.1 |
|
1991 | 2006 | |
|
1992 | 2007 | 2004-10-04 Fernando Perez <fperez@colorado.edu> |
|
1993 | 2008 | |
|
1994 | 2009 | * IPython/iplib.py (ipmagic): New function for accessing magics |
|
1995 | 2010 | via a normal python function call. |
|
1996 | 2011 | |
|
1997 | 2012 | * IPython/Magic.py (Magic.magic_magic): Change the magic escape |
|
1998 | 2013 | from '@' to '%', to accomodate the new @decorator syntax of python |
|
1999 | 2014 | 2.4. |
|
2000 | 2015 | |
|
2001 | 2016 | 2004-09-29 Fernando Perez <fperez@colorado.edu> |
|
2002 | 2017 | |
|
2003 | 2018 | * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to |
|
2004 | 2019 | matplotlib.use to prevent running scripts which try to switch |
|
2005 | 2020 | interactive backends from within ipython. This will just crash |
|
2006 | 2021 | the python interpreter, so we can't allow it (but a detailed error |
|
2007 | 2022 | is given to the user). |
|
2008 | 2023 | |
|
2009 | 2024 | 2004-09-28 Fernando Perez <fperez@colorado.edu> |
|
2010 | 2025 | |
|
2011 | 2026 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): |
|
2012 | 2027 | matplotlib-related fixes so that using @run with non-matplotlib |
|
2013 | 2028 | scripts doesn't pop up spurious plot windows. This requires |
|
2014 | 2029 | matplotlib >= 0.63, where I had to make some changes as well. |
|
2015 | 2030 | |
|
2016 | 2031 | * IPython/ipmaker.py (make_IPython): update version requirement to |
|
2017 | 2032 | python 2.2. |
|
2018 | 2033 | |
|
2019 | 2034 | * IPython/iplib.py (InteractiveShell.mainloop): Add an optional |
|
2020 | 2035 | banner arg for embedded customization. |
|
2021 | 2036 | |
|
2022 | 2037 | * IPython/Magic.py (Magic.__init__): big cleanup to remove all |
|
2023 | 2038 | explicit uses of __IP as the IPython's instance name. Now things |
|
2024 | 2039 | are properly handled via the shell.name value. The actual code |
|
2025 | 2040 | is a bit ugly b/c I'm doing it via a global in Magic.py, but this |
|
2026 | 2041 | is much better than before. I'll clean things completely when the |
|
2027 | 2042 | magic stuff gets a real overhaul. |
|
2028 | 2043 | |
|
2029 | 2044 | * ipython.1: small fixes, sent in by Jack Moffit. He also sent in |
|
2030 | 2045 | minor changes to debian dir. |
|
2031 | 2046 | |
|
2032 | 2047 | * IPython/iplib.py (InteractiveShell.__init__): Fix adding a |
|
2033 | 2048 | pointer to the shell itself in the interactive namespace even when |
|
2034 | 2049 | a user-supplied dict is provided. This is needed for embedding |
|
2035 | 2050 | purposes (found by tests with Michel Sanner). |
|
2036 | 2051 | |
|
2037 | 2052 | 2004-09-27 Fernando Perez <fperez@colorado.edu> |
|
2038 | 2053 | |
|
2039 | 2054 | * IPython/UserConfig/ipythonrc: remove []{} from |
|
2040 | 2055 | readline_remove_delims, so that things like [modname.<TAB> do |
|
2041 | 2056 | proper completion. This disables [].TAB, but that's a less common |
|
2042 | 2057 | case than module names in list comprehensions, for example. |
|
2043 | 2058 | Thanks to a report by Andrea Riciputi. |
|
2044 | 2059 | |
|
2045 | 2060 | 2004-09-09 Fernando Perez <fperez@colorado.edu> |
|
2046 | 2061 | |
|
2047 | 2062 | * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid |
|
2048 | 2063 | blocking problems in win32 and osx. Fix by John. |
|
2049 | 2064 | |
|
2050 | 2065 | 2004-09-08 Fernando Perez <fperez@colorado.edu> |
|
2051 | 2066 | |
|
2052 | 2067 | * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug |
|
2053 | 2068 | for Win32 and OSX. Fix by John Hunter. |
|
2054 | 2069 | |
|
2055 | 2070 | 2004-08-30 *** Released version 0.6.3 |
|
2056 | 2071 | |
|
2057 | 2072 | 2004-08-30 Fernando Perez <fperez@colorado.edu> |
|
2058 | 2073 | |
|
2059 | 2074 | * setup.py (isfile): Add manpages to list of dependent files to be |
|
2060 | 2075 | updated. |
|
2061 | 2076 | |
|
2062 | 2077 | 2004-08-27 Fernando Perez <fperez@colorado.edu> |
|
2063 | 2078 | |
|
2064 | 2079 | * IPython/Shell.py (start): I've disabled -wthread and -gthread |
|
2065 | 2080 | for now. They don't really work with standalone WX/GTK code |
|
2066 | 2081 | (though matplotlib IS working fine with both of those backends). |
|
2067 | 2082 | This will neeed much more testing. I disabled most things with |
|
2068 | 2083 | comments, so turning it back on later should be pretty easy. |
|
2069 | 2084 | |
|
2070 | 2085 | * IPython/iplib.py (InteractiveShell.__init__): Fix accidental |
|
2071 | 2086 | autocalling of expressions like r'foo', by modifying the line |
|
2072 | 2087 | split regexp. Closes |
|
2073 | 2088 | http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas |
|
2074 | 2089 | Riley <ipythonbugs-AT-sabi.net>. |
|
2075 | 2090 | (InteractiveShell.mainloop): honor --nobanner with banner |
|
2076 | 2091 | extensions. |
|
2077 | 2092 | |
|
2078 | 2093 | * IPython/Shell.py: Significant refactoring of all classes, so |
|
2079 | 2094 | that we can really support ALL matplotlib backends and threading |
|
2080 | 2095 | models (John spotted a bug with Tk which required this). Now we |
|
2081 | 2096 | should support single-threaded, WX-threads and GTK-threads, both |
|
2082 | 2097 | for generic code and for matplotlib. |
|
2083 | 2098 | |
|
2084 | 2099 | * IPython/ipmaker.py (__call__): Changed -mpthread option to |
|
2085 | 2100 | -pylab, to simplify things for users. Will also remove the pylab |
|
2086 | 2101 | profile, since now all of matplotlib configuration is directly |
|
2087 | 2102 | handled here. This also reduces startup time. |
|
2088 | 2103 | |
|
2089 | 2104 | * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of |
|
2090 | 2105 | shell wasn't being correctly called. Also in IPShellWX. |
|
2091 | 2106 | |
|
2092 | 2107 | * IPython/iplib.py (InteractiveShell.__init__): Added option to |
|
2093 | 2108 | fine-tune banner. |
|
2094 | 2109 | |
|
2095 | 2110 | * IPython/numutils.py (spike): Deprecate these spike functions, |
|
2096 | 2111 | delete (long deprecated) gnuplot_exec handler. |
|
2097 | 2112 | |
|
2098 | 2113 | 2004-08-26 Fernando Perez <fperez@colorado.edu> |
|
2099 | 2114 | |
|
2100 | 2115 | * ipython.1: Update for threading options, plus some others which |
|
2101 | 2116 | were missing. |
|
2102 | 2117 | |
|
2103 | 2118 | * IPython/ipmaker.py (__call__): Added -wthread option for |
|
2104 | 2119 | wxpython thread handling. Make sure threading options are only |
|
2105 | 2120 | valid at the command line. |
|
2106 | 2121 | |
|
2107 | 2122 | * scripts/ipython: moved shell selection into a factory function |
|
2108 | 2123 | in Shell.py, to keep the starter script to a minimum. |
|
2109 | 2124 | |
|
2110 | 2125 | 2004-08-25 Fernando Perez <fperez@colorado.edu> |
|
2111 | 2126 | |
|
2112 | 2127 | * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by |
|
2113 | 2128 | John. Along with some recent changes he made to matplotlib, the |
|
2114 | 2129 | next versions of both systems should work very well together. |
|
2115 | 2130 | |
|
2116 | 2131 | 2004-08-24 Fernando Perez <fperez@colorado.edu> |
|
2117 | 2132 | |
|
2118 | 2133 | * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I |
|
2119 | 2134 | tried to switch the profiling to using hotshot, but I'm getting |
|
2120 | 2135 | strange errors from prof.runctx() there. I may be misreading the |
|
2121 | 2136 | docs, but it looks weird. For now the profiling code will |
|
2122 | 2137 | continue to use the standard profiler. |
|
2123 | 2138 | |
|
2124 | 2139 | 2004-08-23 Fernando Perez <fperez@colorado.edu> |
|
2125 | 2140 | |
|
2126 | 2141 | * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX |
|
2127 | 2142 | threaded shell, by John Hunter. It's not quite ready yet, but |
|
2128 | 2143 | close. |
|
2129 | 2144 | |
|
2130 | 2145 | 2004-08-22 Fernando Perez <fperez@colorado.edu> |
|
2131 | 2146 | |
|
2132 | 2147 | * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also |
|
2133 | 2148 | in Magic and ultraTB. |
|
2134 | 2149 | |
|
2135 | 2150 | * ipython.1: document threading options in manpage. |
|
2136 | 2151 | |
|
2137 | 2152 | * scripts/ipython: Changed name of -thread option to -gthread, |
|
2138 | 2153 | since this is GTK specific. I want to leave the door open for a |
|
2139 | 2154 | -wthread option for WX, which will most likely be necessary. This |
|
2140 | 2155 | change affects usage and ipmaker as well. |
|
2141 | 2156 | |
|
2142 | 2157 | * IPython/Shell.py (matplotlib_shell): Add a factory function to |
|
2143 | 2158 | handle the matplotlib shell issues. Code by John Hunter |
|
2144 | 2159 | <jdhunter-AT-nitace.bsd.uchicago.edu>. |
|
2145 | 2160 | (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's |
|
2146 | 2161 | broken (and disabled for end users) for now, but it puts the |
|
2147 | 2162 | infrastructure in place. |
|
2148 | 2163 | |
|
2149 | 2164 | 2004-08-21 Fernando Perez <fperez@colorado.edu> |
|
2150 | 2165 | |
|
2151 | 2166 | * ipythonrc-pylab: Add matplotlib support. |
|
2152 | 2167 | |
|
2153 | 2168 | * matplotlib_config.py: new files for matplotlib support, part of |
|
2154 | 2169 | the pylab profile. |
|
2155 | 2170 | |
|
2156 | 2171 | * IPython/usage.py (__doc__): documented the threading options. |
|
2157 | 2172 | |
|
2158 | 2173 | 2004-08-20 Fernando Perez <fperez@colorado.edu> |
|
2159 | 2174 | |
|
2160 | 2175 | * ipython: Modified the main calling routine to handle the -thread |
|
2161 | 2176 | and -mpthread options. This needs to be done as a top-level hack, |
|
2162 | 2177 | because it determines which class to instantiate for IPython |
|
2163 | 2178 | itself. |
|
2164 | 2179 | |
|
2165 | 2180 | * IPython/Shell.py (MTInteractiveShell.__init__): New set of |
|
2166 | 2181 | classes to support multithreaded GTK operation without blocking, |
|
2167 | 2182 | and matplotlib with all backends. This is a lot of still very |
|
2168 | 2183 | experimental code, and threads are tricky. So it may still have a |
|
2169 | 2184 | few rough edges... This code owes a lot to |
|
2170 | 2185 | http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by |
|
2171 | 2186 | Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and |
|
2172 | 2187 | to John Hunter for all the matplotlib work. |
|
2173 | 2188 | |
|
2174 | 2189 | * IPython/ipmaker.py (__call__): Added -thread and -mpthread |
|
2175 | 2190 | options for gtk thread and matplotlib support. |
|
2176 | 2191 | |
|
2177 | 2192 | 2004-08-16 Fernando Perez <fperez@colorado.edu> |
|
2178 | 2193 | |
|
2179 | 2194 | * IPython/iplib.py (InteractiveShell.__init__): don't trigger |
|
2180 | 2195 | autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug |
|
2181 | 2196 | reported by Stephen Walton <stephen.walton-AT-csun.edu>. |
|
2182 | 2197 | |
|
2183 | 2198 | 2004-08-11 Fernando Perez <fperez@colorado.edu> |
|
2184 | 2199 | |
|
2185 | 2200 | * setup.py (isfile): Fix build so documentation gets updated for |
|
2186 | 2201 | rpms (it was only done for .tgz builds). |
|
2187 | 2202 | |
|
2188 | 2203 | 2004-08-10 Fernando Perez <fperez@colorado.edu> |
|
2189 | 2204 | |
|
2190 | 2205 | * genutils.py (Term): Fix misspell of stdin stream (sin->cin). |
|
2191 | 2206 | |
|
2192 | 2207 | * iplib.py : Silence syntax error exceptions in tab-completion. |
|
2193 | 2208 | |
|
2194 | 2209 | 2004-08-05 Fernando Perez <fperez@colorado.edu> |
|
2195 | 2210 | |
|
2196 | 2211 | * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set |
|
2197 | 2212 | 'color off' mark for continuation prompts. This was causing long |
|
2198 | 2213 | continuation lines to mis-wrap. |
|
2199 | 2214 | |
|
2200 | 2215 | 2004-08-01 Fernando Perez <fperez@colorado.edu> |
|
2201 | 2216 | |
|
2202 | 2217 | * IPython/ipmaker.py (make_IPython): Allow the shell class used |
|
2203 | 2218 | for building ipython to be a parameter. All this is necessary |
|
2204 | 2219 | right now to have a multithreaded version, but this insane |
|
2205 | 2220 | non-design will be cleaned up soon. For now, it's a hack that |
|
2206 | 2221 | works. |
|
2207 | 2222 | |
|
2208 | 2223 | * IPython/Shell.py (IPShell.__init__): Stop using mutable default |
|
2209 | 2224 | args in various places. No bugs so far, but it's a dangerous |
|
2210 | 2225 | practice. |
|
2211 | 2226 | |
|
2212 | 2227 | 2004-07-31 Fernando Perez <fperez@colorado.edu> |
|
2213 | 2228 | |
|
2214 | 2229 | * IPython/iplib.py (complete): ignore SyntaxError exceptions to |
|
2215 | 2230 | fix completion of files with dots in their names under most |
|
2216 | 2231 | profiles (pysh was OK because the completion order is different). |
|
2217 | 2232 | |
|
2218 | 2233 | 2004-07-27 Fernando Perez <fperez@colorado.edu> |
|
2219 | 2234 | |
|
2220 | 2235 | * IPython/iplib.py (InteractiveShell.__init__): build dict of |
|
2221 | 2236 | keywords manually, b/c the one in keyword.py was removed in python |
|
2222 | 2237 | 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>. |
|
2223 | 2238 | This is NOT a bug under python 2.3 and earlier. |
|
2224 | 2239 | |
|
2225 | 2240 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
2226 | 2241 | |
|
2227 | 2242 | * IPython/ultraTB.py (VerboseTB.text): Add another |
|
2228 | 2243 | linecache.checkcache() call to try to prevent inspect.py from |
|
2229 | 2244 | crashing under python 2.3. I think this fixes |
|
2230 | 2245 | http://www.scipy.net/roundup/ipython/issue17. |
|
2231 | 2246 | |
|
2232 | 2247 | 2004-07-26 *** Released version 0.6.2 |
|
2233 | 2248 | |
|
2234 | 2249 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
2235 | 2250 | |
|
2236 | 2251 | * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would |
|
2237 | 2252 | fail for any number. |
|
2238 | 2253 | (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for |
|
2239 | 2254 | empty bookmarks. |
|
2240 | 2255 | |
|
2241 | 2256 | 2004-07-26 *** Released version 0.6.1 |
|
2242 | 2257 | |
|
2243 | 2258 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
2244 | 2259 | |
|
2245 | 2260 | * ipython_win_post_install.py (run): Added pysh shortcut for Windows. |
|
2246 | 2261 | |
|
2247 | 2262 | * IPython/iplib.py (protect_filename): Applied Ville's patch for |
|
2248 | 2263 | escaping '()[]{}' in filenames. |
|
2249 | 2264 | |
|
2250 | 2265 | * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for |
|
2251 | 2266 | Python 2.2 users who lack a proper shlex.split. |
|
2252 | 2267 | |
|
2253 | 2268 | 2004-07-19 Fernando Perez <fperez@colorado.edu> |
|
2254 | 2269 | |
|
2255 | 2270 | * IPython/iplib.py (InteractiveShell.init_readline): Add support |
|
2256 | 2271 | for reading readline's init file. I follow the normal chain: |
|
2257 | 2272 | $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a |
|
2258 | 2273 | report by Mike Heeter. This closes |
|
2259 | 2274 | http://www.scipy.net/roundup/ipython/issue16. |
|
2260 | 2275 | |
|
2261 | 2276 | 2004-07-18 Fernando Perez <fperez@colorado.edu> |
|
2262 | 2277 | |
|
2263 | 2278 | * IPython/iplib.py (__init__): Add better handling of '\' under |
|
2264 | 2279 | Win32 for filenames. After a patch by Ville. |
|
2265 | 2280 | |
|
2266 | 2281 | 2004-07-17 Fernando Perez <fperez@colorado.edu> |
|
2267 | 2282 | |
|
2268 | 2283 | * IPython/iplib.py (InteractiveShell._prefilter): fix bug where |
|
2269 | 2284 | autocalling would be triggered for 'foo is bar' if foo is |
|
2270 | 2285 | callable. I also cleaned up the autocall detection code to use a |
|
2271 | 2286 | regexp, which is faster. Bug reported by Alexander Schmolck. |
|
2272 | 2287 | |
|
2273 | 2288 | * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with |
|
2274 | 2289 | '?' in them would confuse the help system. Reported by Alex |
|
2275 | 2290 | Schmolck. |
|
2276 | 2291 | |
|
2277 | 2292 | 2004-07-16 Fernando Perez <fperez@colorado.edu> |
|
2278 | 2293 | |
|
2279 | 2294 | * IPython/GnuplotInteractive.py (__all__): added plot2. |
|
2280 | 2295 | |
|
2281 | 2296 | * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for |
|
2282 | 2297 | plotting dictionaries, lists or tuples of 1d arrays. |
|
2283 | 2298 | |
|
2284 | 2299 | * IPython/Magic.py (Magic.magic_hist): small clenaups and |
|
2285 | 2300 | optimizations. |
|
2286 | 2301 | |
|
2287 | 2302 | * IPython/iplib.py:Remove old Changelog info for cleanup. This is |
|
2288 | 2303 | the information which was there from Janko's original IPP code: |
|
2289 | 2304 | |
|
2290 | 2305 | 03.05.99 20:53 porto.ifm.uni-kiel.de |
|
2291 | 2306 | --Started changelog. |
|
2292 | 2307 | --make clear do what it say it does |
|
2293 | 2308 | --added pretty output of lines from inputcache |
|
2294 | 2309 | --Made Logger a mixin class, simplifies handling of switches |
|
2295 | 2310 | --Added own completer class. .string<TAB> expands to last history |
|
2296 | 2311 | line which starts with string. The new expansion is also present |
|
2297 | 2312 | with Ctrl-r from the readline library. But this shows, who this |
|
2298 | 2313 | can be done for other cases. |
|
2299 | 2314 | --Added convention that all shell functions should accept a |
|
2300 | 2315 | parameter_string This opens the door for different behaviour for |
|
2301 | 2316 | each function. @cd is a good example of this. |
|
2302 | 2317 | |
|
2303 | 2318 | 04.05.99 12:12 porto.ifm.uni-kiel.de |
|
2304 | 2319 | --added logfile rotation |
|
2305 | 2320 | --added new mainloop method which freezes first the namespace |
|
2306 | 2321 | |
|
2307 | 2322 | 07.05.99 21:24 porto.ifm.uni-kiel.de |
|
2308 | 2323 | --added the docreader classes. Now there is a help system. |
|
2309 | 2324 | -This is only a first try. Currently it's not easy to put new |
|
2310 | 2325 | stuff in the indices. But this is the way to go. Info would be |
|
2311 | 2326 | better, but HTML is every where and not everybody has an info |
|
2312 | 2327 | system installed and it's not so easy to change html-docs to info. |
|
2313 | 2328 | --added global logfile option |
|
2314 | 2329 | --there is now a hook for object inspection method pinfo needs to |
|
2315 | 2330 | be provided for this. Can be reached by two '??'. |
|
2316 | 2331 | |
|
2317 | 2332 | 08.05.99 20:51 porto.ifm.uni-kiel.de |
|
2318 | 2333 | --added a README |
|
2319 | 2334 | --bug in rc file. Something has changed so functions in the rc |
|
2320 | 2335 | file need to reference the shell and not self. Not clear if it's a |
|
2321 | 2336 | bug or feature. |
|
2322 | 2337 | --changed rc file for new behavior |
|
2323 | 2338 | |
|
2324 | 2339 | 2004-07-15 Fernando Perez <fperez@colorado.edu> |
|
2325 | 2340 | |
|
2326 | 2341 | * IPython/Logger.py (Logger.log): fixed recent bug where the input |
|
2327 | 2342 | cache was falling out of sync in bizarre manners when multi-line |
|
2328 | 2343 | input was present. Minor optimizations and cleanup. |
|
2329 | 2344 | |
|
2330 | 2345 | (Logger): Remove old Changelog info for cleanup. This is the |
|
2331 | 2346 | information which was there from Janko's original code: |
|
2332 | 2347 | |
|
2333 | 2348 | Changes to Logger: - made the default log filename a parameter |
|
2334 | 2349 | |
|
2335 | 2350 | - put a check for lines beginning with !@? in log(). Needed |
|
2336 | 2351 | (even if the handlers properly log their lines) for mid-session |
|
2337 | 2352 | logging activation to work properly. Without this, lines logged |
|
2338 | 2353 | in mid session, which get read from the cache, would end up |
|
2339 | 2354 | 'bare' (with !@? in the open) in the log. Now they are caught |
|
2340 | 2355 | and prepended with a #. |
|
2341 | 2356 | |
|
2342 | 2357 | * IPython/iplib.py (InteractiveShell.init_readline): added check |
|
2343 | 2358 | in case MagicCompleter fails to be defined, so we don't crash. |
|
2344 | 2359 | |
|
2345 | 2360 | 2004-07-13 Fernando Perez <fperez@colorado.edu> |
|
2346 | 2361 | |
|
2347 | 2362 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation |
|
2348 | 2363 | of EPS if the requested filename ends in '.eps'. |
|
2349 | 2364 | |
|
2350 | 2365 | 2004-07-04 Fernando Perez <fperez@colorado.edu> |
|
2351 | 2366 | |
|
2352 | 2367 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix |
|
2353 | 2368 | escaping of quotes when calling the shell. |
|
2354 | 2369 | |
|
2355 | 2370 | 2004-07-02 Fernando Perez <fperez@colorado.edu> |
|
2356 | 2371 | |
|
2357 | 2372 | * IPython/Prompts.py (CachedOutput.update): Fix problem with |
|
2358 | 2373 | gettext not working because we were clobbering '_'. Fixes |
|
2359 | 2374 | http://www.scipy.net/roundup/ipython/issue6. |
|
2360 | 2375 | |
|
2361 | 2376 | 2004-07-01 Fernando Perez <fperez@colorado.edu> |
|
2362 | 2377 | |
|
2363 | 2378 | * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling |
|
2364 | 2379 | into @cd. Patch by Ville. |
|
2365 | 2380 | |
|
2366 | 2381 | * IPython/iplib.py (InteractiveShell.post_config_initialization): |
|
2367 | 2382 | new function to store things after ipmaker runs. Patch by Ville. |
|
2368 | 2383 | Eventually this will go away once ipmaker is removed and the class |
|
2369 | 2384 | gets cleaned up, but for now it's ok. Key functionality here is |
|
2370 | 2385 | the addition of the persistent storage mechanism, a dict for |
|
2371 | 2386 | keeping data across sessions (for now just bookmarks, but more can |
|
2372 | 2387 | be implemented later). |
|
2373 | 2388 | |
|
2374 | 2389 | * IPython/Magic.py (Magic.magic_bookmark): New bookmark system, |
|
2375 | 2390 | persistent across sections. Patch by Ville, I modified it |
|
2376 | 2391 | soemwhat to allow bookmarking arbitrary dirs other than CWD. Also |
|
2377 | 2392 | added a '-l' option to list all bookmarks. |
|
2378 | 2393 | |
|
2379 | 2394 | * IPython/iplib.py (InteractiveShell.atexit_operations): new |
|
2380 | 2395 | center for cleanup. Registered with atexit.register(). I moved |
|
2381 | 2396 | here the old exit_cleanup(). After a patch by Ville. |
|
2382 | 2397 | |
|
2383 | 2398 | * IPython/Magic.py (get_py_filename): added '~' to the accepted |
|
2384 | 2399 | characters in the hacked shlex_split for python 2.2. |
|
2385 | 2400 | |
|
2386 | 2401 | * IPython/iplib.py (file_matches): more fixes to filenames with |
|
2387 | 2402 | whitespace in them. It's not perfect, but limitations in python's |
|
2388 | 2403 | readline make it impossible to go further. |
|
2389 | 2404 | |
|
2390 | 2405 | 2004-06-29 Fernando Perez <fperez@colorado.edu> |
|
2391 | 2406 | |
|
2392 | 2407 | * IPython/iplib.py (file_matches): escape whitespace correctly in |
|
2393 | 2408 | filename completions. Bug reported by Ville. |
|
2394 | 2409 | |
|
2395 | 2410 | 2004-06-28 Fernando Perez <fperez@colorado.edu> |
|
2396 | 2411 | |
|
2397 | 2412 | * IPython/ipmaker.py (__call__): Added per-profile histories. Now |
|
2398 | 2413 | the history file will be called 'history-PROFNAME' (or just |
|
2399 | 2414 | 'history' if no profile is loaded). I was getting annoyed at |
|
2400 | 2415 | getting my Numerical work history clobbered by pysh sessions. |
|
2401 | 2416 | |
|
2402 | 2417 | * IPython/iplib.py (InteractiveShell.__init__): Internal |
|
2403 | 2418 | getoutputerror() function so that we can honor the system_verbose |
|
2404 | 2419 | flag for _all_ system calls. I also added escaping of # |
|
2405 | 2420 | characters here to avoid confusing Itpl. |
|
2406 | 2421 | |
|
2407 | 2422 | * IPython/Magic.py (shlex_split): removed call to shell in |
|
2408 | 2423 | parse_options and replaced it with shlex.split(). The annoying |
|
2409 | 2424 | part was that in Python 2.2, shlex.split() doesn't exist, so I had |
|
2410 | 2425 | to backport it from 2.3, with several frail hacks (the shlex |
|
2411 | 2426 | module is rather limited in 2.2). Thanks to a suggestion by Ville |
|
2412 | 2427 | Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no |
|
2413 | 2428 | problem. |
|
2414 | 2429 | |
|
2415 | 2430 | (Magic.magic_system_verbose): new toggle to print the actual |
|
2416 | 2431 | system calls made by ipython. Mainly for debugging purposes. |
|
2417 | 2432 | |
|
2418 | 2433 | * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which |
|
2419 | 2434 | doesn't support persistence. Reported (and fix suggested) by |
|
2420 | 2435 | Travis Caldwell <travis_caldwell2000@yahoo.com>. |
|
2421 | 2436 | |
|
2422 | 2437 | 2004-06-26 Fernando Perez <fperez@colorado.edu> |
|
2423 | 2438 | |
|
2424 | 2439 | * IPython/Logger.py (Logger.log): fix to handle correctly empty |
|
2425 | 2440 | continue prompts. |
|
2426 | 2441 | |
|
2427 | 2442 | * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh() |
|
2428 | 2443 | function (basically a big docstring) and a few more things here to |
|
2429 | 2444 | speedup startup. pysh.py is now very lightweight. We want because |
|
2430 | 2445 | it gets execfile'd, while InterpreterExec gets imported, so |
|
2431 | 2446 | byte-compilation saves time. |
|
2432 | 2447 | |
|
2433 | 2448 | 2004-06-25 Fernando Perez <fperez@colorado.edu> |
|
2434 | 2449 | |
|
2435 | 2450 | * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd |
|
2436 | 2451 | -NUM', which was recently broken. |
|
2437 | 2452 | |
|
2438 | 2453 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow ! |
|
2439 | 2454 | in multi-line input (but not !!, which doesn't make sense there). |
|
2440 | 2455 | |
|
2441 | 2456 | * IPython/UserConfig/ipythonrc: made autoindent on by default. |
|
2442 | 2457 | It's just too useful, and people can turn it off in the less |
|
2443 | 2458 | common cases where it's a problem. |
|
2444 | 2459 | |
|
2445 | 2460 | 2004-06-24 Fernando Perez <fperez@colorado.edu> |
|
2446 | 2461 | |
|
2447 | 2462 | * IPython/iplib.py (InteractiveShell._prefilter): big change - |
|
2448 | 2463 | special syntaxes (like alias calling) is now allied in multi-line |
|
2449 | 2464 | input. This is still _very_ experimental, but it's necessary for |
|
2450 | 2465 | efficient shell usage combining python looping syntax with system |
|
2451 | 2466 | calls. For now it's restricted to aliases, I don't think it |
|
2452 | 2467 | really even makes sense to have this for magics. |
|
2453 | 2468 | |
|
2454 | 2469 | 2004-06-23 Fernando Perez <fperez@colorado.edu> |
|
2455 | 2470 | |
|
2456 | 2471 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added |
|
2457 | 2472 | $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd. |
|
2458 | 2473 | |
|
2459 | 2474 | * IPython/Magic.py (Magic.magic_rehashx): modified to handle |
|
2460 | 2475 | extensions under Windows (after code sent by Gary Bishop). The |
|
2461 | 2476 | extensions considered 'executable' are stored in IPython's rc |
|
2462 | 2477 | structure as win_exec_ext. |
|
2463 | 2478 | |
|
2464 | 2479 | * IPython/genutils.py (shell): new function, like system() but |
|
2465 | 2480 | without return value. Very useful for interactive shell work. |
|
2466 | 2481 | |
|
2467 | 2482 | * IPython/Magic.py (Magic.magic_unalias): New @unalias function to |
|
2468 | 2483 | delete aliases. |
|
2469 | 2484 | |
|
2470 | 2485 | * IPython/iplib.py (InteractiveShell.alias_table_update): make |
|
2471 | 2486 | sure that the alias table doesn't contain python keywords. |
|
2472 | 2487 | |
|
2473 | 2488 | 2004-06-21 Fernando Perez <fperez@colorado.edu> |
|
2474 | 2489 | |
|
2475 | 2490 | * IPython/Magic.py (Magic.magic_rehash): Fix crash when |
|
2476 | 2491 | non-existent items are found in $PATH. Reported by Thorsten. |
|
2477 | 2492 | |
|
2478 | 2493 | 2004-06-20 Fernando Perez <fperez@colorado.edu> |
|
2479 | 2494 | |
|
2480 | 2495 | * IPython/iplib.py (complete): modified the completer so that the |
|
2481 | 2496 | order of priorities can be easily changed at runtime. |
|
2482 | 2497 | |
|
2483 | 2498 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): |
|
2484 | 2499 | Modified to auto-execute all lines beginning with '~', '/' or '.'. |
|
2485 | 2500 | |
|
2486 | 2501 | * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to |
|
2487 | 2502 | expand Python variables prepended with $ in all system calls. The |
|
2488 | 2503 | same was done to InteractiveShell.handle_shell_escape. Now all |
|
2489 | 2504 | system access mechanisms (!, !!, @sc, @sx and aliases) allow the |
|
2490 | 2505 | expansion of python variables and expressions according to the |
|
2491 | 2506 | syntax of PEP-215 - http://www.python.org/peps/pep-0215.html. |
|
2492 | 2507 | |
|
2493 | 2508 | Though PEP-215 has been rejected, a similar (but simpler) one |
|
2494 | 2509 | seems like it will go into Python 2.4, PEP-292 - |
|
2495 | 2510 | http://www.python.org/peps/pep-0292.html. |
|
2496 | 2511 | |
|
2497 | 2512 | I'll keep the full syntax of PEP-215, since IPython has since the |
|
2498 | 2513 | start used Ka-Ping Yee's reference implementation discussed there |
|
2499 | 2514 | (Itpl), and I actually like the powerful semantics it offers. |
|
2500 | 2515 | |
|
2501 | 2516 | In order to access normal shell variables, the $ has to be escaped |
|
2502 | 2517 | via an extra $. For example: |
|
2503 | 2518 | |
|
2504 | 2519 | In [7]: PATH='a python variable' |
|
2505 | 2520 | |
|
2506 | 2521 | In [8]: !echo $PATH |
|
2507 | 2522 | a python variable |
|
2508 | 2523 | |
|
2509 | 2524 | In [9]: !echo $$PATH |
|
2510 | 2525 | /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:... |
|
2511 | 2526 | |
|
2512 | 2527 | (Magic.parse_options): escape $ so the shell doesn't evaluate |
|
2513 | 2528 | things prematurely. |
|
2514 | 2529 | |
|
2515 | 2530 | * IPython/iplib.py (InteractiveShell.call_alias): added the |
|
2516 | 2531 | ability for aliases to expand python variables via $. |
|
2517 | 2532 | |
|
2518 | 2533 | * IPython/Magic.py (Magic.magic_rehash): based on the new alias |
|
2519 | 2534 | system, now there's a @rehash/@rehashx pair of magics. These work |
|
2520 | 2535 | like the csh rehash command, and can be invoked at any time. They |
|
2521 | 2536 | build a table of aliases to everything in the user's $PATH |
|
2522 | 2537 | (@rehash uses everything, @rehashx is slower but only adds |
|
2523 | 2538 | executable files). With this, the pysh.py-based shell profile can |
|
2524 | 2539 | now simply call rehash upon startup, and full access to all |
|
2525 | 2540 | programs in the user's path is obtained. |
|
2526 | 2541 | |
|
2527 | 2542 | * IPython/iplib.py (InteractiveShell.call_alias): The new alias |
|
2528 | 2543 | functionality is now fully in place. I removed the old dynamic |
|
2529 | 2544 | code generation based approach, in favor of a much lighter one |
|
2530 | 2545 | based on a simple dict. The advantage is that this allows me to |
|
2531 | 2546 | now have thousands of aliases with negligible cost (unthinkable |
|
2532 | 2547 | with the old system). |
|
2533 | 2548 | |
|
2534 | 2549 | 2004-06-19 Fernando Perez <fperez@colorado.edu> |
|
2535 | 2550 | |
|
2536 | 2551 | * IPython/iplib.py (__init__): extended MagicCompleter class to |
|
2537 | 2552 | also complete (last in priority) on user aliases. |
|
2538 | 2553 | |
|
2539 | 2554 | * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in |
|
2540 | 2555 | call to eval. |
|
2541 | 2556 | (ItplNS.__init__): Added a new class which functions like Itpl, |
|
2542 | 2557 | but allows configuring the namespace for the evaluation to occur |
|
2543 | 2558 | in. |
|
2544 | 2559 | |
|
2545 | 2560 | 2004-06-18 Fernando Perez <fperez@colorado.edu> |
|
2546 | 2561 | |
|
2547 | 2562 | * IPython/iplib.py (InteractiveShell.runcode): modify to print a |
|
2548 | 2563 | better message when 'exit' or 'quit' are typed (a common newbie |
|
2549 | 2564 | confusion). |
|
2550 | 2565 | |
|
2551 | 2566 | * IPython/Magic.py (Magic.magic_colors): Added the runtime color |
|
2552 | 2567 | check for Windows users. |
|
2553 | 2568 | |
|
2554 | 2569 | * IPython/iplib.py (InteractiveShell.user_setup): removed |
|
2555 | 2570 | disabling of colors for Windows. I'll test at runtime and issue a |
|
2556 | 2571 | warning if Gary's readline isn't found, as to nudge users to |
|
2557 | 2572 | download it. |
|
2558 | 2573 | |
|
2559 | 2574 | 2004-06-16 Fernando Perez <fperez@colorado.edu> |
|
2560 | 2575 | |
|
2561 | 2576 | * IPython/genutils.py (Stream.__init__): changed to print errors |
|
2562 | 2577 | to sys.stderr. I had a circular dependency here. Now it's |
|
2563 | 2578 | possible to run ipython as IDLE's shell (consider this pre-alpha, |
|
2564 | 2579 | since true stdout things end up in the starting terminal instead |
|
2565 | 2580 | of IDLE's out). |
|
2566 | 2581 | |
|
2567 | 2582 | * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for |
|
2568 | 2583 | users who haven't # updated their prompt_in2 definitions. Remove |
|
2569 | 2584 | eventually. |
|
2570 | 2585 | (multiple_replace): added credit to original ASPN recipe. |
|
2571 | 2586 | |
|
2572 | 2587 | 2004-06-15 Fernando Perez <fperez@colorado.edu> |
|
2573 | 2588 | |
|
2574 | 2589 | * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the |
|
2575 | 2590 | list of auto-defined aliases. |
|
2576 | 2591 | |
|
2577 | 2592 | 2004-06-13 Fernando Perez <fperez@colorado.edu> |
|
2578 | 2593 | |
|
2579 | 2594 | * setup.py (scriptfiles): Don't trigger win_post_install unless an |
|
2580 | 2595 | install was really requested (so setup.py can be used for other |
|
2581 | 2596 | things under Windows). |
|
2582 | 2597 | |
|
2583 | 2598 | 2004-06-10 Fernando Perez <fperez@colorado.edu> |
|
2584 | 2599 | |
|
2585 | 2600 | * IPython/Logger.py (Logger.create_log): Manually remove any old |
|
2586 | 2601 | backup, since os.remove may fail under Windows. Fixes bug |
|
2587 | 2602 | reported by Thorsten. |
|
2588 | 2603 | |
|
2589 | 2604 | 2004-06-09 Fernando Perez <fperez@colorado.edu> |
|
2590 | 2605 | |
|
2591 | 2606 | * examples/example-embed.py: fixed all references to %n (replaced |
|
2592 | 2607 | with \\# for ps1/out prompts and with \\D for ps2 prompts). Done |
|
2593 | 2608 | for all examples and the manual as well. |
|
2594 | 2609 | |
|
2595 | 2610 | 2004-06-08 Fernando Perez <fperez@colorado.edu> |
|
2596 | 2611 | |
|
2597 | 2612 | * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt |
|
2598 | 2613 | alignment and color management. All 3 prompt subsystems now |
|
2599 | 2614 | inherit from BasePrompt. |
|
2600 | 2615 | |
|
2601 | 2616 | * tools/release: updates for windows installer build and tag rpms |
|
2602 | 2617 | with python version (since paths are fixed). |
|
2603 | 2618 | |
|
2604 | 2619 | * IPython/UserConfig/ipythonrc: modified to use \# instead of %n, |
|
2605 | 2620 | which will become eventually obsolete. Also fixed the default |
|
2606 | 2621 | prompt_in2 to use \D, so at least new users start with the correct |
|
2607 | 2622 | defaults. |
|
2608 | 2623 | WARNING: Users with existing ipythonrc files will need to apply |
|
2609 | 2624 | this fix manually! |
|
2610 | 2625 | |
|
2611 | 2626 | * setup.py: make windows installer (.exe). This is finally the |
|
2612 | 2627 | integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>, |
|
2613 | 2628 | which I hadn't included because it required Python 2.3 (or recent |
|
2614 | 2629 | distutils). |
|
2615 | 2630 | |
|
2616 | 2631 | * IPython/usage.py (__doc__): update docs (and manpage) to reflect |
|
2617 | 2632 | usage of new '\D' escape. |
|
2618 | 2633 | |
|
2619 | 2634 | * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which |
|
2620 | 2635 | lacks os.getuid()) |
|
2621 | 2636 | (CachedOutput.set_colors): Added the ability to turn coloring |
|
2622 | 2637 | on/off with @colors even for manually defined prompt colors. It |
|
2623 | 2638 | uses a nasty global, but it works safely and via the generic color |
|
2624 | 2639 | handling mechanism. |
|
2625 | 2640 | (Prompt2.__init__): Introduced new escape '\D' for continuation |
|
2626 | 2641 | prompts. It represents the counter ('\#') as dots. |
|
2627 | 2642 | *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will |
|
2628 | 2643 | need to update their ipythonrc files and replace '%n' with '\D' in |
|
2629 | 2644 | their prompt_in2 settings everywhere. Sorry, but there's |
|
2630 | 2645 | otherwise no clean way to get all prompts to properly align. The |
|
2631 | 2646 | ipythonrc shipped with IPython has been updated. |
|
2632 | 2647 | |
|
2633 | 2648 | 2004-06-07 Fernando Perez <fperez@colorado.edu> |
|
2634 | 2649 | |
|
2635 | 2650 | * setup.py (isfile): Pass local_icons option to latex2html, so the |
|
2636 | 2651 | resulting HTML file is self-contained. Thanks to |
|
2637 | 2652 | dryice-AT-liu.com.cn for the tip. |
|
2638 | 2653 | |
|
2639 | 2654 | * pysh.py: I created a new profile 'shell', which implements a |
|
2640 | 2655 | _rudimentary_ IPython-based shell. This is in NO WAY a realy |
|
2641 | 2656 | system shell, nor will it become one anytime soon. It's mainly |
|
2642 | 2657 | meant to illustrate the use of the new flexible bash-like prompts. |
|
2643 | 2658 | I guess it could be used by hardy souls for true shell management, |
|
2644 | 2659 | but it's no tcsh/bash... pysh.py is loaded by the 'shell' |
|
2645 | 2660 | profile. This uses the InterpreterExec extension provided by |
|
2646 | 2661 | W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl> |
|
2647 | 2662 | |
|
2648 | 2663 | * IPython/Prompts.py (PromptOut.__str__): now it will correctly |
|
2649 | 2664 | auto-align itself with the length of the previous input prompt |
|
2650 | 2665 | (taking into account the invisible color escapes). |
|
2651 | 2666 | (CachedOutput.__init__): Large restructuring of this class. Now |
|
2652 | 2667 | all three prompts (primary1, primary2, output) are proper objects, |
|
2653 | 2668 | managed by the 'parent' CachedOutput class. The code is still a |
|
2654 | 2669 | bit hackish (all prompts share state via a pointer to the cache), |
|
2655 | 2670 | but it's overall far cleaner than before. |
|
2656 | 2671 | |
|
2657 | 2672 | * IPython/genutils.py (getoutputerror): modified to add verbose, |
|
2658 | 2673 | debug and header options. This makes the interface of all getout* |
|
2659 | 2674 | functions uniform. |
|
2660 | 2675 | (SystemExec.getoutputerror): added getoutputerror to SystemExec. |
|
2661 | 2676 | |
|
2662 | 2677 | * IPython/Magic.py (Magic.default_option): added a function to |
|
2663 | 2678 | allow registering default options for any magic command. This |
|
2664 | 2679 | makes it easy to have profiles which customize the magics globally |
|
2665 | 2680 | for a certain use. The values set through this function are |
|
2666 | 2681 | picked up by the parse_options() method, which all magics should |
|
2667 | 2682 | use to parse their options. |
|
2668 | 2683 | |
|
2669 | 2684 | * IPython/genutils.py (warn): modified the warnings framework to |
|
2670 | 2685 | use the Term I/O class. I'm trying to slowly unify all of |
|
2671 | 2686 | IPython's I/O operations to pass through Term. |
|
2672 | 2687 | |
|
2673 | 2688 | * IPython/Prompts.py (Prompt2._str_other): Added functionality in |
|
2674 | 2689 | the secondary prompt to correctly match the length of the primary |
|
2675 | 2690 | one for any prompt. Now multi-line code will properly line up |
|
2676 | 2691 | even for path dependent prompts, such as the new ones available |
|
2677 | 2692 | via the prompt_specials. |
|
2678 | 2693 | |
|
2679 | 2694 | 2004-06-06 Fernando Perez <fperez@colorado.edu> |
|
2680 | 2695 | |
|
2681 | 2696 | * IPython/Prompts.py (prompt_specials): Added the ability to have |
|
2682 | 2697 | bash-like special sequences in the prompts, which get |
|
2683 | 2698 | automatically expanded. Things like hostname, current working |
|
2684 | 2699 | directory and username are implemented already, but it's easy to |
|
2685 | 2700 | add more in the future. Thanks to a patch by W.J. van der Laan |
|
2686 | 2701 | <gnufnork-AT-hetdigitalegat.nl> |
|
2687 | 2702 | (prompt_specials): Added color support for prompt strings, so |
|
2688 | 2703 | users can define arbitrary color setups for their prompts. |
|
2689 | 2704 | |
|
2690 | 2705 | 2004-06-05 Fernando Perez <fperez@colorado.edu> |
|
2691 | 2706 | |
|
2692 | 2707 | * IPython/genutils.py (Term.reopen_all): Added Windows-specific |
|
2693 | 2708 | code to load Gary Bishop's readline and configure it |
|
2694 | 2709 | automatically. Thanks to Gary for help on this. |
|
2695 | 2710 | |
|
2696 | 2711 | 2004-06-01 Fernando Perez <fperez@colorado.edu> |
|
2697 | 2712 | |
|
2698 | 2713 | * IPython/Logger.py (Logger.create_log): fix bug for logging |
|
2699 | 2714 | with no filename (previous fix was incomplete). |
|
2700 | 2715 | |
|
2701 | 2716 | 2004-05-25 Fernando Perez <fperez@colorado.edu> |
|
2702 | 2717 | |
|
2703 | 2718 | * IPython/Magic.py (Magic.parse_options): fix bug where naked |
|
2704 | 2719 | parens would get passed to the shell. |
|
2705 | 2720 | |
|
2706 | 2721 | 2004-05-20 Fernando Perez <fperez@colorado.edu> |
|
2707 | 2722 | |
|
2708 | 2723 | * IPython/Magic.py (Magic.magic_prun): changed default profile |
|
2709 | 2724 | sort order to 'time' (the more common profiling need). |
|
2710 | 2725 | |
|
2711 | 2726 | * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache |
|
2712 | 2727 | so that source code shown is guaranteed in sync with the file on |
|
2713 | 2728 | disk (also changed in psource). Similar fix to the one for |
|
2714 | 2729 | ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du |
|
2715 | 2730 | <yann.ledu-AT-noos.fr>. |
|
2716 | 2731 | |
|
2717 | 2732 | * IPython/Magic.py (Magic.parse_options): Fixed bug where commands |
|
2718 | 2733 | with a single option would not be correctly parsed. Closes |
|
2719 | 2734 | http://www.scipy.net/roundup/ipython/issue14. This bug had been |
|
2720 | 2735 | introduced in 0.6.0 (on 2004-05-06). |
|
2721 | 2736 | |
|
2722 | 2737 | 2004-05-13 *** Released version 0.6.0 |
|
2723 | 2738 | |
|
2724 | 2739 | 2004-05-13 Fernando Perez <fperez@colorado.edu> |
|
2725 | 2740 | |
|
2726 | 2741 | * debian/: Added debian/ directory to CVS, so that debian support |
|
2727 | 2742 | is publicly accessible. The debian package is maintained by Jack |
|
2728 | 2743 | Moffit <jack-AT-xiph.org>. |
|
2729 | 2744 | |
|
2730 | 2745 | * Documentation: included the notes about an ipython-based system |
|
2731 | 2746 | shell (the hypothetical 'pysh') into the new_design.pdf document, |
|
2732 | 2747 | so that these ideas get distributed to users along with the |
|
2733 | 2748 | official documentation. |
|
2734 | 2749 | |
|
2735 | 2750 | 2004-05-10 Fernando Perez <fperez@colorado.edu> |
|
2736 | 2751 | |
|
2737 | 2752 | * IPython/Logger.py (Logger.create_log): fix recently introduced |
|
2738 | 2753 | bug (misindented line) where logstart would fail when not given an |
|
2739 | 2754 | explicit filename. |
|
2740 | 2755 | |
|
2741 | 2756 | 2004-05-09 Fernando Perez <fperez@colorado.edu> |
|
2742 | 2757 | |
|
2743 | 2758 | * IPython/Magic.py (Magic.parse_options): skip system call when |
|
2744 | 2759 | there are no options to look for. Faster, cleaner for the common |
|
2745 | 2760 | case. |
|
2746 | 2761 | |
|
2747 | 2762 | * Documentation: many updates to the manual: describing Windows |
|
2748 | 2763 | support better, Gnuplot updates, credits, misc small stuff. Also |
|
2749 | 2764 | updated the new_design doc a bit. |
|
2750 | 2765 | |
|
2751 | 2766 | 2004-05-06 *** Released version 0.6.0.rc1 |
|
2752 | 2767 | |
|
2753 | 2768 | 2004-05-06 Fernando Perez <fperez@colorado.edu> |
|
2754 | 2769 | |
|
2755 | 2770 | * IPython/ultraTB.py (ListTB.text): modified a ton of string += |
|
2756 | 2771 | operations to use the vastly more efficient list/''.join() method. |
|
2757 | 2772 | (FormattedTB.text): Fix |
|
2758 | 2773 | http://www.scipy.net/roundup/ipython/issue12 - exception source |
|
2759 | 2774 | extract not updated after reload. Thanks to Mike Salib |
|
2760 | 2775 | <msalib-AT-mit.edu> for pinning the source of the problem. |
|
2761 | 2776 | Fortunately, the solution works inside ipython and doesn't require |
|
2762 | 2777 | any changes to python proper. |
|
2763 | 2778 | |
|
2764 | 2779 | * IPython/Magic.py (Magic.parse_options): Improved to process the |
|
2765 | 2780 | argument list as a true shell would (by actually using the |
|
2766 | 2781 | underlying system shell). This way, all @magics automatically get |
|
2767 | 2782 | shell expansion for variables. Thanks to a comment by Alex |
|
2768 | 2783 | Schmolck. |
|
2769 | 2784 | |
|
2770 | 2785 | 2004-04-04 Fernando Perez <fperez@colorado.edu> |
|
2771 | 2786 | |
|
2772 | 2787 | * IPython/iplib.py (InteractiveShell.interact): Added a special |
|
2773 | 2788 | trap for a debugger quit exception, which is basically impossible |
|
2774 | 2789 | to handle by normal mechanisms, given what pdb does to the stack. |
|
2775 | 2790 | This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>. |
|
2776 | 2791 | |
|
2777 | 2792 | 2004-04-03 Fernando Perez <fperez@colorado.edu> |
|
2778 | 2793 | |
|
2779 | 2794 | * IPython/genutils.py (Term): Standardized the names of the Term |
|
2780 | 2795 | class streams to cin/cout/cerr, following C++ naming conventions |
|
2781 | 2796 | (I can't use in/out/err because 'in' is not a valid attribute |
|
2782 | 2797 | name). |
|
2783 | 2798 | |
|
2784 | 2799 | * IPython/iplib.py (InteractiveShell.interact): don't increment |
|
2785 | 2800 | the prompt if there's no user input. By Daniel 'Dang' Griffith |
|
2786 | 2801 | <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from |
|
2787 | 2802 | Francois Pinard. |
|
2788 | 2803 | |
|
2789 | 2804 | 2004-04-02 Fernando Perez <fperez@colorado.edu> |
|
2790 | 2805 | |
|
2791 | 2806 | * IPython/genutils.py (Stream.__init__): Modified to survive at |
|
2792 | 2807 | least importing in contexts where stdin/out/err aren't true file |
|
2793 | 2808 | objects, such as PyCrust (they lack fileno() and mode). However, |
|
2794 | 2809 | the recovery facilities which rely on these things existing will |
|
2795 | 2810 | not work. |
|
2796 | 2811 | |
|
2797 | 2812 | 2004-04-01 Fernando Perez <fperez@colorado.edu> |
|
2798 | 2813 | |
|
2799 | 2814 | * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to |
|
2800 | 2815 | use the new getoutputerror() function, so it properly |
|
2801 | 2816 | distinguishes stdout/err. |
|
2802 | 2817 | |
|
2803 | 2818 | * IPython/genutils.py (getoutputerror): added a function to |
|
2804 | 2819 | capture separately the standard output and error of a command. |
|
2805 | 2820 | After a comment from dang on the mailing lists. This code is |
|
2806 | 2821 | basically a modified version of commands.getstatusoutput(), from |
|
2807 | 2822 | the standard library. |
|
2808 | 2823 | |
|
2809 | 2824 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): added |
|
2810 | 2825 | '!!' as a special syntax (shorthand) to access @sx. |
|
2811 | 2826 | |
|
2812 | 2827 | * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell |
|
2813 | 2828 | command and return its output as a list split on '\n'. |
|
2814 | 2829 | |
|
2815 | 2830 | 2004-03-31 Fernando Perez <fperez@colorado.edu> |
|
2816 | 2831 | |
|
2817 | 2832 | * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__ |
|
2818 | 2833 | method to dictionaries used as FakeModule instances if they lack |
|
2819 | 2834 | it. At least pydoc in python2.3 breaks for runtime-defined |
|
2820 | 2835 | functions without this hack. At some point I need to _really_ |
|
2821 | 2836 | understand what FakeModule is doing, because it's a gross hack. |
|
2822 | 2837 | But it solves Arnd's problem for now... |
|
2823 | 2838 | |
|
2824 | 2839 | 2004-02-27 Fernando Perez <fperez@colorado.edu> |
|
2825 | 2840 | |
|
2826 | 2841 | * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate' |
|
2827 | 2842 | mode would behave erratically. Also increased the number of |
|
2828 | 2843 | possible logs in rotate mod to 999. Thanks to Rod Holland |
|
2829 | 2844 | <rhh@StructureLABS.com> for the report and fixes. |
|
2830 | 2845 | |
|
2831 | 2846 | 2004-02-26 Fernando Perez <fperez@colorado.edu> |
|
2832 | 2847 | |
|
2833 | 2848 | * IPython/genutils.py (page): Check that the curses module really |
|
2834 | 2849 | has the initscr attribute before trying to use it. For some |
|
2835 | 2850 | reason, the Solaris curses module is missing this. I think this |
|
2836 | 2851 | should be considered a Solaris python bug, but I'm not sure. |
|
2837 | 2852 | |
|
2838 | 2853 | 2004-01-17 Fernando Perez <fperez@colorado.edu> |
|
2839 | 2854 | |
|
2840 | 2855 | * IPython/genutils.py (Stream.__init__): Changes to try to make |
|
2841 | 2856 | ipython robust against stdin/out/err being closed by the user. |
|
2842 | 2857 | This is 'user error' (and blocks a normal python session, at least |
|
2843 | 2858 | the stdout case). However, Ipython should be able to survive such |
|
2844 | 2859 | instances of abuse as gracefully as possible. To simplify the |
|
2845 | 2860 | coding and maintain compatibility with Gary Bishop's Term |
|
2846 | 2861 | contributions, I've made use of classmethods for this. I think |
|
2847 | 2862 | this introduces a dependency on python 2.2. |
|
2848 | 2863 | |
|
2849 | 2864 | 2004-01-13 Fernando Perez <fperez@colorado.edu> |
|
2850 | 2865 | |
|
2851 | 2866 | * IPython/numutils.py (exp_safe): simplified the code a bit and |
|
2852 | 2867 | removed the need for importing the kinds module altogether. |
|
2853 | 2868 | |
|
2854 | 2869 | 2004-01-06 Fernando Perez <fperez@colorado.edu> |
|
2855 | 2870 | |
|
2856 | 2871 | * IPython/Magic.py (Magic.magic_sc): Made the shell capture system |
|
2857 | 2872 | a magic function instead, after some community feedback. No |
|
2858 | 2873 | special syntax will exist for it, but its name is deliberately |
|
2859 | 2874 | very short. |
|
2860 | 2875 | |
|
2861 | 2876 | 2003-12-20 Fernando Perez <fperez@colorado.edu> |
|
2862 | 2877 | |
|
2863 | 2878 | * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added |
|
2864 | 2879 | new functionality, to automagically assign the result of a shell |
|
2865 | 2880 | command to a variable. I'll solicit some community feedback on |
|
2866 | 2881 | this before making it permanent. |
|
2867 | 2882 | |
|
2868 | 2883 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was |
|
2869 | 2884 | requested about callables for which inspect couldn't obtain a |
|
2870 | 2885 | proper argspec. Thanks to a crash report sent by Etienne |
|
2871 | 2886 | Posthumus <etienne-AT-apple01.cs.vu.nl>. |
|
2872 | 2887 | |
|
2873 | 2888 | 2003-12-09 Fernando Perez <fperez@colorado.edu> |
|
2874 | 2889 | |
|
2875 | 2890 | * IPython/genutils.py (page): patch for the pager to work across |
|
2876 | 2891 | various versions of Windows. By Gary Bishop. |
|
2877 | 2892 | |
|
2878 | 2893 | 2003-12-04 Fernando Perez <fperez@colorado.edu> |
|
2879 | 2894 | |
|
2880 | 2895 | * IPython/Gnuplot2.py (PlotItems): Fixes for working with |
|
2881 | 2896 | Gnuplot.py version 1.7, whose internal names changed quite a bit. |
|
2882 | 2897 | While I tested this and it looks ok, there may still be corner |
|
2883 | 2898 | cases I've missed. |
|
2884 | 2899 | |
|
2885 | 2900 | 2003-12-01 Fernando Perez <fperez@colorado.edu> |
|
2886 | 2901 | |
|
2887 | 2902 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug |
|
2888 | 2903 | where a line like 'p,q=1,2' would fail because the automagic |
|
2889 | 2904 | system would be triggered for @p. |
|
2890 | 2905 | |
|
2891 | 2906 | * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related |
|
2892 | 2907 | cleanups, code unmodified. |
|
2893 | 2908 | |
|
2894 | 2909 | * IPython/genutils.py (Term): added a class for IPython to handle |
|
2895 | 2910 | output. In most cases it will just be a proxy for stdout/err, but |
|
2896 | 2911 | having this allows modifications to be made for some platforms, |
|
2897 | 2912 | such as handling color escapes under Windows. All of this code |
|
2898 | 2913 | was contributed by Gary Bishop, with minor modifications by me. |
|
2899 | 2914 | The actual changes affect many files. |
|
2900 | 2915 | |
|
2901 | 2916 | 2003-11-30 Fernando Perez <fperez@colorado.edu> |
|
2902 | 2917 | |
|
2903 | 2918 | * IPython/iplib.py (file_matches): new completion code, courtesy |
|
2904 | 2919 | of Jeff Collins. This enables filename completion again under |
|
2905 | 2920 | python 2.3, which disabled it at the C level. |
|
2906 | 2921 | |
|
2907 | 2922 | 2003-11-11 Fernando Perez <fperez@colorado.edu> |
|
2908 | 2923 | |
|
2909 | 2924 | * IPython/numutils.py (amap): Added amap() fn. Simple shorthand |
|
2910 | 2925 | for Numeric.array(map(...)), but often convenient. |
|
2911 | 2926 | |
|
2912 | 2927 | 2003-11-05 Fernando Perez <fperez@colorado.edu> |
|
2913 | 2928 | |
|
2914 | 2929 | * IPython/numutils.py (frange): Changed a call from int() to |
|
2915 | 2930 | int(round()) to prevent a problem reported with arange() in the |
|
2916 | 2931 | numpy list. |
|
2917 | 2932 | |
|
2918 | 2933 | 2003-10-06 Fernando Perez <fperez@colorado.edu> |
|
2919 | 2934 | |
|
2920 | 2935 | * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to |
|
2921 | 2936 | prevent crashes if sys lacks an argv attribute (it happens with |
|
2922 | 2937 | embedded interpreters which build a bare-bones sys module). |
|
2923 | 2938 | Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>. |
|
2924 | 2939 | |
|
2925 | 2940 | 2003-09-24 Fernando Perez <fperez@colorado.edu> |
|
2926 | 2941 | |
|
2927 | 2942 | * IPython/Magic.py (Magic._ofind): blanket except around getattr() |
|
2928 | 2943 | to protect against poorly written user objects where __getattr__ |
|
2929 | 2944 | raises exceptions other than AttributeError. Thanks to a bug |
|
2930 | 2945 | report by Oliver Sander <osander-AT-gmx.de>. |
|
2931 | 2946 | |
|
2932 | 2947 | * IPython/FakeModule.py (FakeModule.__repr__): this method was |
|
2933 | 2948 | missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>. |
|
2934 | 2949 | |
|
2935 | 2950 | 2003-09-09 Fernando Perez <fperez@colorado.edu> |
|
2936 | 2951 | |
|
2937 | 2952 | * IPython/iplib.py (InteractiveShell._prefilter): fix bug where |
|
2938 | 2953 | unpacking a list whith a callable as first element would |
|
2939 | 2954 | mistakenly trigger autocalling. Thanks to a bug report by Jeffery |
|
2940 | 2955 | Collins. |
|
2941 | 2956 | |
|
2942 | 2957 | 2003-08-25 *** Released version 0.5.0 |
|
2943 | 2958 | |
|
2944 | 2959 | 2003-08-22 Fernando Perez <fperez@colorado.edu> |
|
2945 | 2960 | |
|
2946 | 2961 | * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of |
|
2947 | 2962 | improperly defined user exceptions. Thanks to feedback from Mark |
|
2948 | 2963 | Russell <mrussell-AT-verio.net>. |
|
2949 | 2964 | |
|
2950 | 2965 | 2003-08-20 Fernando Perez <fperez@colorado.edu> |
|
2951 | 2966 | |
|
2952 | 2967 | * IPython/OInspect.py (Inspector.pinfo): changed String Form |
|
2953 | 2968 | printing so that it would print multi-line string forms starting |
|
2954 | 2969 | with a new line. This way the formatting is better respected for |
|
2955 | 2970 | objects which work hard to make nice string forms. |
|
2956 | 2971 | |
|
2957 | 2972 | * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where |
|
2958 | 2973 | autocall would overtake data access for objects with both |
|
2959 | 2974 | __getitem__ and __call__. |
|
2960 | 2975 | |
|
2961 | 2976 | 2003-08-19 *** Released version 0.5.0-rc1 |
|
2962 | 2977 | |
|
2963 | 2978 | 2003-08-19 Fernando Perez <fperez@colorado.edu> |
|
2964 | 2979 | |
|
2965 | 2980 | * IPython/deep_reload.py (load_tail): single tiny change here |
|
2966 | 2981 | seems to fix the long-standing bug of dreload() failing to work |
|
2967 | 2982 | for dotted names. But this module is pretty tricky, so I may have |
|
2968 | 2983 | missed some subtlety. Needs more testing!. |
|
2969 | 2984 | |
|
2970 | 2985 | * IPython/ultraTB.py (VerboseTB.linereader): harden against user |
|
2971 | 2986 | exceptions which have badly implemented __str__ methods. |
|
2972 | 2987 | (VerboseTB.text): harden against inspect.getinnerframes crashing, |
|
2973 | 2988 | which I've been getting reports about from Python 2.3 users. I |
|
2974 | 2989 | wish I had a simple test case to reproduce the problem, so I could |
|
2975 | 2990 | either write a cleaner workaround or file a bug report if |
|
2976 | 2991 | necessary. |
|
2977 | 2992 | |
|
2978 | 2993 | * IPython/Magic.py (Magic.magic_edit): fixed bug where after |
|
2979 | 2994 | making a class 'foo', file 'foo.py' couldn't be edited. Thanks to |
|
2980 | 2995 | a bug report by Tjabo Kloppenburg. |
|
2981 | 2996 | |
|
2982 | 2997 | * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb |
|
2983 | 2998 | crashes. Wrapped the pdb call in a blanket try/except, since pdb |
|
2984 | 2999 | seems rather unstable. Thanks to a bug report by Tjabo |
|
2985 | 3000 | Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>. |
|
2986 | 3001 | |
|
2987 | 3002 | * IPython/Release.py (version): release 0.5.0-rc1. I want to put |
|
2988 | 3003 | this out soon because of the critical fixes in the inner loop for |
|
2989 | 3004 | generators. |
|
2990 | 3005 | |
|
2991 | 3006 | * IPython/Magic.py (Magic.getargspec): removed. This (and |
|
2992 | 3007 | _get_def) have been obsoleted by OInspect for a long time, I |
|
2993 | 3008 | hadn't noticed that they were dead code. |
|
2994 | 3009 | (Magic._ofind): restored _ofind functionality for a few literals |
|
2995 | 3010 | (those in ["''",'""','[]','{}','()']). But it won't work anymore |
|
2996 | 3011 | for things like "hello".capitalize?, since that would require a |
|
2997 | 3012 | potentially dangerous eval() again. |
|
2998 | 3013 | |
|
2999 | 3014 | * IPython/iplib.py (InteractiveShell._prefilter): reorganized the |
|
3000 | 3015 | logic a bit more to clean up the escapes handling and minimize the |
|
3001 | 3016 | use of _ofind to only necessary cases. The interactive 'feel' of |
|
3002 | 3017 | IPython should have improved quite a bit with the changes in |
|
3003 | 3018 | _prefilter and _ofind (besides being far safer than before). |
|
3004 | 3019 | |
|
3005 | 3020 | * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather |
|
3006 | 3021 | obscure, never reported). Edit would fail to find the object to |
|
3007 | 3022 | edit under some circumstances. |
|
3008 | 3023 | (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls |
|
3009 | 3024 | which were causing double-calling of generators. Those eval calls |
|
3010 | 3025 | were _very_ dangerous, since code with side effects could be |
|
3011 | 3026 | triggered. As they say, 'eval is evil'... These were the |
|
3012 | 3027 | nastiest evals in IPython. Besides, _ofind is now far simpler, |
|
3013 | 3028 | and it should also be quite a bit faster. Its use of inspect is |
|
3014 | 3029 | also safer, so perhaps some of the inspect-related crashes I've |
|
3015 | 3030 | seen lately with Python 2.3 might be taken care of. That will |
|
3016 | 3031 | need more testing. |
|
3017 | 3032 | |
|
3018 | 3033 | 2003-08-17 Fernando Perez <fperez@colorado.edu> |
|
3019 | 3034 | |
|
3020 | 3035 | * IPython/iplib.py (InteractiveShell._prefilter): significant |
|
3021 | 3036 | simplifications to the logic for handling user escapes. Faster |
|
3022 | 3037 | and simpler code. |
|
3023 | 3038 | |
|
3024 | 3039 | 2003-08-14 Fernando Perez <fperez@colorado.edu> |
|
3025 | 3040 | |
|
3026 | 3041 | * IPython/numutils.py (sum_flat): rewrote to be non-recursive. |
|
3027 | 3042 | Now it requires O(N) storage (N=size(a)) for non-contiguous input, |
|
3028 | 3043 | but it should be quite a bit faster. And the recursive version |
|
3029 | 3044 | generated O(log N) intermediate storage for all rank>1 arrays, |
|
3030 | 3045 | even if they were contiguous. |
|
3031 | 3046 | (l1norm): Added this function. |
|
3032 | 3047 | (norm): Added this function for arbitrary norms (including |
|
3033 | 3048 | l-infinity). l1 and l2 are still special cases for convenience |
|
3034 | 3049 | and speed. |
|
3035 | 3050 | |
|
3036 | 3051 | 2003-08-03 Fernando Perez <fperez@colorado.edu> |
|
3037 | 3052 | |
|
3038 | 3053 | * IPython/Magic.py (Magic.magic_edit): Removed all remaining string |
|
3039 | 3054 | exceptions, which now raise PendingDeprecationWarnings in Python |
|
3040 | 3055 | 2.3. There were some in Magic and some in Gnuplot2. |
|
3041 | 3056 | |
|
3042 | 3057 | 2003-06-30 Fernando Perez <fperez@colorado.edu> |
|
3043 | 3058 | |
|
3044 | 3059 | * IPython/genutils.py (page): modified to call curses only for |
|
3045 | 3060 | terminals where TERM=='xterm'. After problems under many other |
|
3046 | 3061 | terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>. |
|
3047 | 3062 | |
|
3048 | 3063 | * IPython/iplib.py (complete): removed spurious 'print "IE"' which |
|
3049 | 3064 | would be triggered when readline was absent. This was just an old |
|
3050 | 3065 | debugging statement I'd forgotten to take out. |
|
3051 | 3066 | |
|
3052 | 3067 | 2003-06-20 Fernando Perez <fperez@colorado.edu> |
|
3053 | 3068 | |
|
3054 | 3069 | * IPython/genutils.py (clock): modified to return only user time |
|
3055 | 3070 | (not counting system time), after a discussion on scipy. While |
|
3056 | 3071 | system time may be a useful quantity occasionally, it may much |
|
3057 | 3072 | more easily be skewed by occasional swapping or other similar |
|
3058 | 3073 | activity. |
|
3059 | 3074 | |
|
3060 | 3075 | 2003-06-05 Fernando Perez <fperez@colorado.edu> |
|
3061 | 3076 | |
|
3062 | 3077 | * IPython/numutils.py (identity): new function, for building |
|
3063 | 3078 | arbitrary rank Kronecker deltas (mostly backwards compatible with |
|
3064 | 3079 | Numeric.identity) |
|
3065 | 3080 | |
|
3066 | 3081 | 2003-06-03 Fernando Perez <fperez@colorado.edu> |
|
3067 | 3082 | |
|
3068 | 3083 | * IPython/iplib.py (InteractiveShell.handle_magic): protect |
|
3069 | 3084 | arguments passed to magics with spaces, to allow trailing '\' to |
|
3070 | 3085 | work normally (mainly for Windows users). |
|
3071 | 3086 | |
|
3072 | 3087 | 2003-05-29 Fernando Perez <fperez@colorado.edu> |
|
3073 | 3088 | |
|
3074 | 3089 | * IPython/ipmaker.py (make_IPython): Load site._Helper() as help |
|
3075 | 3090 | instead of pydoc.help. This fixes a bizarre behavior where |
|
3076 | 3091 | printing '%s' % locals() would trigger the help system. Now |
|
3077 | 3092 | ipython behaves like normal python does. |
|
3078 | 3093 | |
|
3079 | 3094 | Note that if one does 'from pydoc import help', the bizarre |
|
3080 | 3095 | behavior returns, but this will also happen in normal python, so |
|
3081 | 3096 | it's not an ipython bug anymore (it has to do with how pydoc.help |
|
3082 | 3097 | is implemented). |
|
3083 | 3098 | |
|
3084 | 3099 | 2003-05-22 Fernando Perez <fperez@colorado.edu> |
|
3085 | 3100 | |
|
3086 | 3101 | * IPython/FlexCompleter.py (Completer.attr_matches): fixed to |
|
3087 | 3102 | return [] instead of None when nothing matches, also match to end |
|
3088 | 3103 | of line. Patch by Gary Bishop. |
|
3089 | 3104 | |
|
3090 | 3105 | * IPython/ipmaker.py (make_IPython): Added same sys.excepthook |
|
3091 | 3106 | protection as before, for files passed on the command line. This |
|
3092 | 3107 | prevents the CrashHandler from kicking in if user files call into |
|
3093 | 3108 | sys.excepthook (such as PyQt and WxWindows have a nasty habit of |
|
3094 | 3109 | doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr> |
|
3095 | 3110 | |
|
3096 | 3111 | 2003-05-20 *** Released version 0.4.0 |
|
3097 | 3112 | |
|
3098 | 3113 | 2003-05-20 Fernando Perez <fperez@colorado.edu> |
|
3099 | 3114 | |
|
3100 | 3115 | * setup.py: added support for manpages. It's a bit hackish b/c of |
|
3101 | 3116 | a bug in the way the bdist_rpm distutils target handles gzipped |
|
3102 | 3117 | manpages, but it works. After a patch by Jack. |
|
3103 | 3118 | |
|
3104 | 3119 | 2003-05-19 Fernando Perez <fperez@colorado.edu> |
|
3105 | 3120 | |
|
3106 | 3121 | * IPython/numutils.py: added a mockup of the kinds module, since |
|
3107 | 3122 | it was recently removed from Numeric. This way, numutils will |
|
3108 | 3123 | work for all users even if they are missing kinds. |
|
3109 | 3124 | |
|
3110 | 3125 | * IPython/Magic.py (Magic._ofind): Harden against an inspect |
|
3111 | 3126 | failure, which can occur with SWIG-wrapped extensions. After a |
|
3112 | 3127 | crash report from Prabhu. |
|
3113 | 3128 | |
|
3114 | 3129 | 2003-05-16 Fernando Perez <fperez@colorado.edu> |
|
3115 | 3130 | |
|
3116 | 3131 | * IPython/iplib.py (InteractiveShell.excepthook): New method to |
|
3117 | 3132 | protect ipython from user code which may call directly |
|
3118 | 3133 | sys.excepthook (this looks like an ipython crash to the user, even |
|
3119 | 3134 | when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>. |
|
3120 | 3135 | This is especially important to help users of WxWindows, but may |
|
3121 | 3136 | also be useful in other cases. |
|
3122 | 3137 | |
|
3123 | 3138 | * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow |
|
3124 | 3139 | an optional tb_offset to be specified, and to preserve exception |
|
3125 | 3140 | info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>. |
|
3126 | 3141 | |
|
3127 | 3142 | * ipython.1 (Default): Thanks to Jack's work, we now have manpages! |
|
3128 | 3143 | |
|
3129 | 3144 | 2003-05-15 Fernando Perez <fperez@colorado.edu> |
|
3130 | 3145 | |
|
3131 | 3146 | * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when |
|
3132 | 3147 | installing for a new user under Windows. |
|
3133 | 3148 | |
|
3134 | 3149 | 2003-05-12 Fernando Perez <fperez@colorado.edu> |
|
3135 | 3150 | |
|
3136 | 3151 | * IPython/iplib.py (InteractiveShell.handle_emacs): New line |
|
3137 | 3152 | handler for Emacs comint-based lines. Currently it doesn't do |
|
3138 | 3153 | much (but importantly, it doesn't update the history cache). In |
|
3139 | 3154 | the future it may be expanded if Alex needs more functionality |
|
3140 | 3155 | there. |
|
3141 | 3156 | |
|
3142 | 3157 | * IPython/CrashHandler.py (CrashHandler.__call__): Added platform |
|
3143 | 3158 | info to crash reports. |
|
3144 | 3159 | |
|
3145 | 3160 | * IPython/iplib.py (InteractiveShell.mainloop): Added -c option, |
|
3146 | 3161 | just like Python's -c. Also fixed crash with invalid -color |
|
3147 | 3162 | option value at startup. Thanks to Will French |
|
3148 | 3163 | <wfrench-AT-bestweb.net> for the bug report. |
|
3149 | 3164 | |
|
3150 | 3165 | 2003-05-09 Fernando Perez <fperez@colorado.edu> |
|
3151 | 3166 | |
|
3152 | 3167 | * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString |
|
3153 | 3168 | to EvalDict (it's a mapping, after all) and simplified its code |
|
3154 | 3169 | quite a bit, after a nice discussion on c.l.py where Gustavo |
|
3155 | 3170 | CΓ³rdova <gcordova-AT-sismex.com> suggested the new version. |
|
3156 | 3171 | |
|
3157 | 3172 | 2003-04-30 Fernando Perez <fperez@colorado.edu> |
|
3158 | 3173 | |
|
3159 | 3174 | * IPython/genutils.py (timings_out): modified it to reduce its |
|
3160 | 3175 | overhead in the common reps==1 case. |
|
3161 | 3176 | |
|
3162 | 3177 | 2003-04-29 Fernando Perez <fperez@colorado.edu> |
|
3163 | 3178 | |
|
3164 | 3179 | * IPython/genutils.py (timings_out): Modified to use the resource |
|
3165 | 3180 | module, which avoids the wraparound problems of time.clock(). |
|
3166 | 3181 | |
|
3167 | 3182 | 2003-04-17 *** Released version 0.2.15pre4 |
|
3168 | 3183 | |
|
3169 | 3184 | 2003-04-17 Fernando Perez <fperez@colorado.edu> |
|
3170 | 3185 | |
|
3171 | 3186 | * setup.py (scriptfiles): Split windows-specific stuff over to a |
|
3172 | 3187 | separate file, in an attempt to have a Windows GUI installer. |
|
3173 | 3188 | That didn't work, but part of the groundwork is done. |
|
3174 | 3189 | |
|
3175 | 3190 | * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for |
|
3176 | 3191 | indent/unindent with 4 spaces. Particularly useful in combination |
|
3177 | 3192 | with the new auto-indent option. |
|
3178 | 3193 | |
|
3179 | 3194 | 2003-04-16 Fernando Perez <fperez@colorado.edu> |
|
3180 | 3195 | |
|
3181 | 3196 | * IPython/Magic.py: various replacements of self.rc for |
|
3182 | 3197 | self.shell.rc. A lot more remains to be done to fully disentangle |
|
3183 | 3198 | this class from the main Shell class. |
|
3184 | 3199 | |
|
3185 | 3200 | * IPython/GnuplotRuntime.py: added checks for mouse support so |
|
3186 | 3201 | that we don't try to enable it if the current gnuplot doesn't |
|
3187 | 3202 | really support it. Also added checks so that we don't try to |
|
3188 | 3203 | enable persist under Windows (where Gnuplot doesn't recognize the |
|
3189 | 3204 | option). |
|
3190 | 3205 | |
|
3191 | 3206 | * IPython/iplib.py (InteractiveShell.interact): Added optional |
|
3192 | 3207 | auto-indenting code, after a patch by King C. Shu |
|
3193 | 3208 | <kingshu-AT-myrealbox.com>. It's off by default because it doesn't |
|
3194 | 3209 | get along well with pasting indented code. If I ever figure out |
|
3195 | 3210 | how to make that part go well, it will become on by default. |
|
3196 | 3211 | |
|
3197 | 3212 | * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would |
|
3198 | 3213 | crash ipython if there was an unmatched '%' in the user's prompt |
|
3199 | 3214 | string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>. |
|
3200 | 3215 | |
|
3201 | 3216 | * IPython/iplib.py (InteractiveShell.interact): removed the |
|
3202 | 3217 | ability to ask the user whether he wants to crash or not at the |
|
3203 | 3218 | 'last line' exception handler. Calling functions at that point |
|
3204 | 3219 | changes the stack, and the error reports would have incorrect |
|
3205 | 3220 | tracebacks. |
|
3206 | 3221 | |
|
3207 | 3222 | * IPython/Magic.py (Magic.magic_page): Added new @page magic, to |
|
3208 | 3223 | pass through a peger a pretty-printed form of any object. After a |
|
3209 | 3224 | contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr> |
|
3210 | 3225 | |
|
3211 | 3226 | 2003-04-14 Fernando Perez <fperez@colorado.edu> |
|
3212 | 3227 | |
|
3213 | 3228 | * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where |
|
3214 | 3229 | all files in ~ would be modified at first install (instead of |
|
3215 | 3230 | ~/.ipython). This could be potentially disastrous, as the |
|
3216 | 3231 | modification (make line-endings native) could damage binary files. |
|
3217 | 3232 | |
|
3218 | 3233 | 2003-04-10 Fernando Perez <fperez@colorado.edu> |
|
3219 | 3234 | |
|
3220 | 3235 | * IPython/iplib.py (InteractiveShell.handle_help): Modified to |
|
3221 | 3236 | handle only lines which are invalid python. This now means that |
|
3222 | 3237 | lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins |
|
3223 | 3238 | for the bug report. |
|
3224 | 3239 | |
|
3225 | 3240 | 2003-04-01 Fernando Perez <fperez@colorado.edu> |
|
3226 | 3241 | |
|
3227 | 3242 | * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug |
|
3228 | 3243 | where failing to set sys.last_traceback would crash pdb.pm(). |
|
3229 | 3244 | Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug |
|
3230 | 3245 | report. |
|
3231 | 3246 | |
|
3232 | 3247 | 2003-03-25 Fernando Perez <fperez@colorado.edu> |
|
3233 | 3248 | |
|
3234 | 3249 | * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler |
|
3235 | 3250 | before printing it (it had a lot of spurious blank lines at the |
|
3236 | 3251 | end). |
|
3237 | 3252 | |
|
3238 | 3253 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr |
|
3239 | 3254 | output would be sent 21 times! Obviously people don't use this |
|
3240 | 3255 | too often, or I would have heard about it. |
|
3241 | 3256 | |
|
3242 | 3257 | 2003-03-24 Fernando Perez <fperez@colorado.edu> |
|
3243 | 3258 | |
|
3244 | 3259 | * setup.py (scriptfiles): renamed the data_files parameter from |
|
3245 | 3260 | 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink |
|
3246 | 3261 | for the patch. |
|
3247 | 3262 | |
|
3248 | 3263 | 2003-03-20 Fernando Perez <fperez@colorado.edu> |
|
3249 | 3264 | |
|
3250 | 3265 | * IPython/genutils.py (error): added error() and fatal() |
|
3251 | 3266 | functions. |
|
3252 | 3267 | |
|
3253 | 3268 | 2003-03-18 *** Released version 0.2.15pre3 |
|
3254 | 3269 | |
|
3255 | 3270 | 2003-03-18 Fernando Perez <fperez@colorado.edu> |
|
3256 | 3271 | |
|
3257 | 3272 | * setupext/install_data_ext.py |
|
3258 | 3273 | (install_data_ext.initialize_options): Class contributed by Jack |
|
3259 | 3274 | Moffit for fixing the old distutils hack. He is sending this to |
|
3260 | 3275 | the distutils folks so in the future we may not need it as a |
|
3261 | 3276 | private fix. |
|
3262 | 3277 | |
|
3263 | 3278 | * MANIFEST.in: Extensive reorganization, based on Jack Moffit's |
|
3264 | 3279 | changes for Debian packaging. See his patch for full details. |
|
3265 | 3280 | The old distutils hack of making the ipythonrc* files carry a |
|
3266 | 3281 | bogus .py extension is gone, at last. Examples were moved to a |
|
3267 | 3282 | separate subdir under doc/, and the separate executable scripts |
|
3268 | 3283 | now live in their own directory. Overall a great cleanup. The |
|
3269 | 3284 | manual was updated to use the new files, and setup.py has been |
|
3270 | 3285 | fixed for this setup. |
|
3271 | 3286 | |
|
3272 | 3287 | * IPython/PyColorize.py (Parser.usage): made non-executable and |
|
3273 | 3288 | created a pycolor wrapper around it to be included as a script. |
|
3274 | 3289 | |
|
3275 | 3290 | 2003-03-12 *** Released version 0.2.15pre2 |
|
3276 | 3291 | |
|
3277 | 3292 | 2003-03-12 Fernando Perez <fperez@colorado.edu> |
|
3278 | 3293 | |
|
3279 | 3294 | * IPython/ColorANSI.py (make_color_table): Finally fixed the |
|
3280 | 3295 | long-standing problem with garbage characters in some terminals. |
|
3281 | 3296 | The issue was really that the \001 and \002 escapes must _only_ be |
|
3282 | 3297 | passed to input prompts (which call readline), but _never_ to |
|
3283 | 3298 | normal text to be printed on screen. I changed ColorANSI to have |
|
3284 | 3299 | two classes: TermColors and InputTermColors, each with the |
|
3285 | 3300 | appropriate escapes for input prompts or normal text. The code in |
|
3286 | 3301 | Prompts.py got slightly more complicated, but this very old and |
|
3287 | 3302 | annoying bug is finally fixed. |
|
3288 | 3303 | |
|
3289 | 3304 | All the credit for nailing down the real origin of this problem |
|
3290 | 3305 | and the correct solution goes to Jack Moffit <jack-AT-xiph.org>. |
|
3291 | 3306 | *Many* thanks to him for spending quite a bit of effort on this. |
|
3292 | 3307 | |
|
3293 | 3308 | 2003-03-05 *** Released version 0.2.15pre1 |
|
3294 | 3309 | |
|
3295 | 3310 | 2003-03-03 Fernando Perez <fperez@colorado.edu> |
|
3296 | 3311 | |
|
3297 | 3312 | * IPython/FakeModule.py: Moved the former _FakeModule to a |
|
3298 | 3313 | separate file, because it's also needed by Magic (to fix a similar |
|
3299 | 3314 | pickle-related issue in @run). |
|
3300 | 3315 | |
|
3301 | 3316 | 2003-03-02 Fernando Perez <fperez@colorado.edu> |
|
3302 | 3317 | |
|
3303 | 3318 | * IPython/Magic.py (Magic.magic_autocall): new magic to control |
|
3304 | 3319 | the autocall option at runtime. |
|
3305 | 3320 | (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns |
|
3306 | 3321 | across Magic.py to start separating Magic from InteractiveShell. |
|
3307 | 3322 | (Magic._ofind): Fixed to return proper namespace for dotted |
|
3308 | 3323 | names. Before, a dotted name would always return 'not currently |
|
3309 | 3324 | defined', because it would find the 'parent'. s.x would be found, |
|
3310 | 3325 | but since 'x' isn't defined by itself, it would get confused. |
|
3311 | 3326 | (Magic.magic_run): Fixed pickling problems reported by Ralf |
|
3312 | 3327 | Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to |
|
3313 | 3328 | that I'd used when Mike Heeter reported similar issues at the |
|
3314 | 3329 | top-level, but now for @run. It boils down to injecting the |
|
3315 | 3330 | namespace where code is being executed with something that looks |
|
3316 | 3331 | enough like a module to fool pickle.dump(). Since a pickle stores |
|
3317 | 3332 | a named reference to the importing module, we need this for |
|
3318 | 3333 | pickles to save something sensible. |
|
3319 | 3334 | |
|
3320 | 3335 | * IPython/ipmaker.py (make_IPython): added an autocall option. |
|
3321 | 3336 | |
|
3322 | 3337 | * IPython/iplib.py (InteractiveShell._prefilter): reordered all of |
|
3323 | 3338 | the auto-eval code. Now autocalling is an option, and the code is |
|
3324 | 3339 | also vastly safer. There is no more eval() involved at all. |
|
3325 | 3340 | |
|
3326 | 3341 | 2003-03-01 Fernando Perez <fperez@colorado.edu> |
|
3327 | 3342 | |
|
3328 | 3343 | * IPython/Magic.py (Magic._ofind): Changed interface to return a |
|
3329 | 3344 | dict with named keys instead of a tuple. |
|
3330 | 3345 | |
|
3331 | 3346 | * IPython: Started using CVS for IPython as of 0.2.15pre1. |
|
3332 | 3347 | |
|
3333 | 3348 | * setup.py (make_shortcut): Fixed message about directories |
|
3334 | 3349 | created during Windows installation (the directories were ok, just |
|
3335 | 3350 | the printed message was misleading). Thanks to Chris Liechti |
|
3336 | 3351 | <cliechti-AT-gmx.net> for the heads up. |
|
3337 | 3352 | |
|
3338 | 3353 | 2003-02-21 Fernando Perez <fperez@colorado.edu> |
|
3339 | 3354 | |
|
3340 | 3355 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching |
|
3341 | 3356 | of ValueError exception when checking for auto-execution. This |
|
3342 | 3357 | one is raised by things like Numeric arrays arr.flat when the |
|
3343 | 3358 | array is non-contiguous. |
|
3344 | 3359 | |
|
3345 | 3360 | 2003-01-31 Fernando Perez <fperez@colorado.edu> |
|
3346 | 3361 | |
|
3347 | 3362 | * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would |
|
3348 | 3363 | not return any value at all (even though the command would get |
|
3349 | 3364 | executed). |
|
3350 | 3365 | (xsys): Flush stdout right after printing the command to ensure |
|
3351 | 3366 | proper ordering of commands and command output in the total |
|
3352 | 3367 | output. |
|
3353 | 3368 | (SystemExec/xsys/bq): Switched the names of xsys/bq and |
|
3354 | 3369 | system/getoutput as defaults. The old ones are kept for |
|
3355 | 3370 | compatibility reasons, so no code which uses this library needs |
|
3356 | 3371 | changing. |
|
3357 | 3372 | |
|
3358 | 3373 | 2003-01-27 *** Released version 0.2.14 |
|
3359 | 3374 | |
|
3360 | 3375 | 2003-01-25 Fernando Perez <fperez@colorado.edu> |
|
3361 | 3376 | |
|
3362 | 3377 | * IPython/Magic.py (Magic.magic_edit): Fixed problem where |
|
3363 | 3378 | functions defined in previous edit sessions could not be re-edited |
|
3364 | 3379 | (because the temp files were immediately removed). Now temp files |
|
3365 | 3380 | are removed only at IPython's exit. |
|
3366 | 3381 | (Magic.magic_run): Improved @run to perform shell-like expansions |
|
3367 | 3382 | on its arguments (~users and $VARS). With this, @run becomes more |
|
3368 | 3383 | like a normal command-line. |
|
3369 | 3384 | |
|
3370 | 3385 | * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small |
|
3371 | 3386 | bugs related to embedding and cleaned up that code. A fairly |
|
3372 | 3387 | important one was the impossibility to access the global namespace |
|
3373 | 3388 | through the embedded IPython (only local variables were visible). |
|
3374 | 3389 | |
|
3375 | 3390 | 2003-01-14 Fernando Perez <fperez@colorado.edu> |
|
3376 | 3391 | |
|
3377 | 3392 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed |
|
3378 | 3393 | auto-calling to be a bit more conservative. Now it doesn't get |
|
3379 | 3394 | triggered if any of '!=()<>' are in the rest of the input line, to |
|
3380 | 3395 | allow comparing callables. Thanks to Alex for the heads up. |
|
3381 | 3396 | |
|
3382 | 3397 | 2003-01-07 Fernando Perez <fperez@colorado.edu> |
|
3383 | 3398 | |
|
3384 | 3399 | * IPython/genutils.py (page): fixed estimation of the number of |
|
3385 | 3400 | lines in a string to be paged to simply count newlines. This |
|
3386 | 3401 | prevents over-guessing due to embedded escape sequences. A better |
|
3387 | 3402 | long-term solution would involve stripping out the control chars |
|
3388 | 3403 | for the count, but it's potentially so expensive I just don't |
|
3389 | 3404 | think it's worth doing. |
|
3390 | 3405 | |
|
3391 | 3406 | 2002-12-19 *** Released version 0.2.14pre50 |
|
3392 | 3407 | |
|
3393 | 3408 | 2002-12-19 Fernando Perez <fperez@colorado.edu> |
|
3394 | 3409 | |
|
3395 | 3410 | * tools/release (version): Changed release scripts to inform |
|
3396 | 3411 | Andrea and build a NEWS file with a list of recent changes. |
|
3397 | 3412 | |
|
3398 | 3413 | * IPython/ColorANSI.py (__all__): changed terminal detection |
|
3399 | 3414 | code. Seems to work better for xterms without breaking |
|
3400 | 3415 | konsole. Will need more testing to determine if WinXP and Mac OSX |
|
3401 | 3416 | also work ok. |
|
3402 | 3417 | |
|
3403 | 3418 | 2002-12-18 *** Released version 0.2.14pre49 |
|
3404 | 3419 | |
|
3405 | 3420 | 2002-12-18 Fernando Perez <fperez@colorado.edu> |
|
3406 | 3421 | |
|
3407 | 3422 | * Docs: added new info about Mac OSX, from Andrea. |
|
3408 | 3423 | |
|
3409 | 3424 | * IPython/Gnuplot2.py (String): Added a String PlotItem class to |
|
3410 | 3425 | allow direct plotting of python strings whose format is the same |
|
3411 | 3426 | of gnuplot data files. |
|
3412 | 3427 | |
|
3413 | 3428 | 2002-12-16 Fernando Perez <fperez@colorado.edu> |
|
3414 | 3429 | |
|
3415 | 3430 | * IPython/iplib.py (InteractiveShell.interact): fixed default (y) |
|
3416 | 3431 | value of exit question to be acknowledged. |
|
3417 | 3432 | |
|
3418 | 3433 | 2002-12-03 Fernando Perez <fperez@colorado.edu> |
|
3419 | 3434 | |
|
3420 | 3435 | * IPython/ipmaker.py: removed generators, which had been added |
|
3421 | 3436 | by mistake in an earlier debugging run. This was causing trouble |
|
3422 | 3437 | to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu> |
|
3423 | 3438 | for pointing this out. |
|
3424 | 3439 | |
|
3425 | 3440 | 2002-11-17 Fernando Perez <fperez@colorado.edu> |
|
3426 | 3441 | |
|
3427 | 3442 | * Manual: updated the Gnuplot section. |
|
3428 | 3443 | |
|
3429 | 3444 | * IPython/GnuplotRuntime.py: refactored a lot all this code, with |
|
3430 | 3445 | a much better split of what goes in Runtime and what goes in |
|
3431 | 3446 | Interactive. |
|
3432 | 3447 | |
|
3433 | 3448 | * IPython/ipmaker.py: fixed bug where import_fail_info wasn't |
|
3434 | 3449 | being imported from iplib. |
|
3435 | 3450 | |
|
3436 | 3451 | * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc |
|
3437 | 3452 | for command-passing. Now the global Gnuplot instance is called |
|
3438 | 3453 | 'gp' instead of 'g', which was really a far too fragile and |
|
3439 | 3454 | common name. |
|
3440 | 3455 | |
|
3441 | 3456 | * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken |
|
3442 | 3457 | bounding boxes generated by Gnuplot for square plots. |
|
3443 | 3458 | |
|
3444 | 3459 | * IPython/genutils.py (popkey): new function added. I should |
|
3445 | 3460 | suggest this on c.l.py as a dict method, it seems useful. |
|
3446 | 3461 | |
|
3447 | 3462 | * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot |
|
3448 | 3463 | to transparently handle PostScript generation. MUCH better than |
|
3449 | 3464 | the previous plot_eps/replot_eps (which I removed now). The code |
|
3450 | 3465 | is also fairly clean and well documented now (including |
|
3451 | 3466 | docstrings). |
|
3452 | 3467 | |
|
3453 | 3468 | 2002-11-13 Fernando Perez <fperez@colorado.edu> |
|
3454 | 3469 | |
|
3455 | 3470 | * IPython/Magic.py (Magic.magic_edit): fixed docstring |
|
3456 | 3471 | (inconsistent with options). |
|
3457 | 3472 | |
|
3458 | 3473 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been |
|
3459 | 3474 | manually disabled, I don't know why. Fixed it. |
|
3460 | 3475 | (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly |
|
3461 | 3476 | eps output. |
|
3462 | 3477 | |
|
3463 | 3478 | 2002-11-12 Fernando Perez <fperez@colorado.edu> |
|
3464 | 3479 | |
|
3465 | 3480 | * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they |
|
3466 | 3481 | don't propagate up to caller. Fixes crash reported by François |
|
3467 | 3482 | Pinard. |
|
3468 | 3483 | |
|
3469 | 3484 | 2002-11-09 Fernando Perez <fperez@colorado.edu> |
|
3470 | 3485 | |
|
3471 | 3486 | * IPython/ipmaker.py (make_IPython): fixed problem with writing |
|
3472 | 3487 | history file for new users. |
|
3473 | 3488 | (make_IPython): fixed bug where initial install would leave the |
|
3474 | 3489 | user running in the .ipython dir. |
|
3475 | 3490 | (make_IPython): fixed bug where config dir .ipython would be |
|
3476 | 3491 | created regardless of the given -ipythondir option. Thanks to Cory |
|
3477 | 3492 | Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report. |
|
3478 | 3493 | |
|
3479 | 3494 | * IPython/genutils.py (ask_yes_no): new function for asking yes/no |
|
3480 | 3495 | type confirmations. Will need to use it in all of IPython's code |
|
3481 | 3496 | consistently. |
|
3482 | 3497 | |
|
3483 | 3498 | * IPython/CrashHandler.py (CrashHandler.__call__): changed the |
|
3484 | 3499 | context to print 31 lines instead of the default 5. This will make |
|
3485 | 3500 | the crash reports extremely detailed in case the problem is in |
|
3486 | 3501 | libraries I don't have access to. |
|
3487 | 3502 | |
|
3488 | 3503 | * IPython/iplib.py (InteractiveShell.interact): changed the 'last |
|
3489 | 3504 | line of defense' code to still crash, but giving users fair |
|
3490 | 3505 | warning. I don't want internal errors to go unreported: if there's |
|
3491 | 3506 | an internal problem, IPython should crash and generate a full |
|
3492 | 3507 | report. |
|
3493 | 3508 | |
|
3494 | 3509 | 2002-11-08 Fernando Perez <fperez@colorado.edu> |
|
3495 | 3510 | |
|
3496 | 3511 | * IPython/iplib.py (InteractiveShell.interact): added code to trap |
|
3497 | 3512 | otherwise uncaught exceptions which can appear if people set |
|
3498 | 3513 | sys.stdout to something badly broken. Thanks to a crash report |
|
3499 | 3514 | from henni-AT-mail.brainbot.com. |
|
3500 | 3515 | |
|
3501 | 3516 | 2002-11-04 Fernando Perez <fperez@colorado.edu> |
|
3502 | 3517 | |
|
3503 | 3518 | * IPython/iplib.py (InteractiveShell.interact): added |
|
3504 | 3519 | __IPYTHON__active to the builtins. It's a flag which goes on when |
|
3505 | 3520 | the interaction starts and goes off again when it stops. This |
|
3506 | 3521 | allows embedding code to detect being inside IPython. Before this |
|
3507 | 3522 | was done via __IPYTHON__, but that only shows that an IPython |
|
3508 | 3523 | instance has been created. |
|
3509 | 3524 | |
|
3510 | 3525 | * IPython/Magic.py (Magic.magic_env): I realized that in a |
|
3511 | 3526 | UserDict, instance.data holds the data as a normal dict. So I |
|
3512 | 3527 | modified @env to return os.environ.data instead of rebuilding a |
|
3513 | 3528 | dict by hand. |
|
3514 | 3529 | |
|
3515 | 3530 | 2002-11-02 Fernando Perez <fperez@colorado.edu> |
|
3516 | 3531 | |
|
3517 | 3532 | * IPython/genutils.py (warn): changed so that level 1 prints no |
|
3518 | 3533 | header. Level 2 is now the default (with 'WARNING' header, as |
|
3519 | 3534 | before). I think I tracked all places where changes were needed in |
|
3520 | 3535 | IPython, but outside code using the old level numbering may have |
|
3521 | 3536 | broken. |
|
3522 | 3537 | |
|
3523 | 3538 | * IPython/iplib.py (InteractiveShell.runcode): added this to |
|
3524 | 3539 | handle the tracebacks in SystemExit traps correctly. The previous |
|
3525 | 3540 | code (through interact) was printing more of the stack than |
|
3526 | 3541 | necessary, showing IPython internal code to the user. |
|
3527 | 3542 | |
|
3528 | 3543 | * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by |
|
3529 | 3544 | default. Now that the default at the confirmation prompt is yes, |
|
3530 | 3545 | it's not so intrusive. François' argument that ipython sessions |
|
3531 | 3546 | tend to be complex enough not to lose them from an accidental C-d, |
|
3532 | 3547 | is a valid one. |
|
3533 | 3548 | |
|
3534 | 3549 | * IPython/iplib.py (InteractiveShell.interact): added a |
|
3535 | 3550 | showtraceback() call to the SystemExit trap, and modified the exit |
|
3536 | 3551 | confirmation to have yes as the default. |
|
3537 | 3552 | |
|
3538 | 3553 | * IPython/UserConfig/ipythonrc.py: removed 'session' option from |
|
3539 | 3554 | this file. It's been gone from the code for a long time, this was |
|
3540 | 3555 | simply leftover junk. |
|
3541 | 3556 | |
|
3542 | 3557 | 2002-11-01 Fernando Perez <fperez@colorado.edu> |
|
3543 | 3558 | |
|
3544 | 3559 | * IPython/UserConfig/ipythonrc.py: new confirm_exit option |
|
3545 | 3560 | added. If set, IPython now traps EOF and asks for |
|
3546 | 3561 | confirmation. After a request by François Pinard. |
|
3547 | 3562 | |
|
3548 | 3563 | * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead |
|
3549 | 3564 | of @abort, and with a new (better) mechanism for handling the |
|
3550 | 3565 | exceptions. |
|
3551 | 3566 | |
|
3552 | 3567 | 2002-10-27 Fernando Perez <fperez@colorado.edu> |
|
3553 | 3568 | |
|
3554 | 3569 | * IPython/usage.py (__doc__): updated the --help information and |
|
3555 | 3570 | the ipythonrc file to indicate that -log generates |
|
3556 | 3571 | ./ipython.log. Also fixed the corresponding info in @logstart. |
|
3557 | 3572 | This and several other fixes in the manuals thanks to reports by |
|
3558 | 3573 | François Pinard <pinard-AT-iro.umontreal.ca>. |
|
3559 | 3574 | |
|
3560 | 3575 | * IPython/Logger.py (Logger.switch_log): Fixed error message to |
|
3561 | 3576 | refer to @logstart (instead of @log, which doesn't exist). |
|
3562 | 3577 | |
|
3563 | 3578 | * IPython/iplib.py (InteractiveShell._prefilter): fixed |
|
3564 | 3579 | AttributeError crash. Thanks to Christopher Armstrong |
|
3565 | 3580 | <radix-AT-twistedmatrix.com> for the report/fix. This bug had been |
|
3566 | 3581 | introduced recently (in 0.2.14pre37) with the fix to the eval |
|
3567 | 3582 | problem mentioned below. |
|
3568 | 3583 | |
|
3569 | 3584 | 2002-10-17 Fernando Perez <fperez@colorado.edu> |
|
3570 | 3585 | |
|
3571 | 3586 | * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows |
|
3572 | 3587 | installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>. |
|
3573 | 3588 | |
|
3574 | 3589 | * IPython/iplib.py (InteractiveShell._prefilter): Many changes to |
|
3575 | 3590 | this function to fix a problem reported by Alex Schmolck. He saw |
|
3576 | 3591 | it with list comprehensions and generators, which were getting |
|
3577 | 3592 | called twice. The real problem was an 'eval' call in testing for |
|
3578 | 3593 | automagic which was evaluating the input line silently. |
|
3579 | 3594 | |
|
3580 | 3595 | This is a potentially very nasty bug, if the input has side |
|
3581 | 3596 | effects which must not be repeated. The code is much cleaner now, |
|
3582 | 3597 | without any blanket 'except' left and with a regexp test for |
|
3583 | 3598 | actual function names. |
|
3584 | 3599 | |
|
3585 | 3600 | But an eval remains, which I'm not fully comfortable with. I just |
|
3586 | 3601 | don't know how to find out if an expression could be a callable in |
|
3587 | 3602 | the user's namespace without doing an eval on the string. However |
|
3588 | 3603 | that string is now much more strictly checked so that no code |
|
3589 | 3604 | slips by, so the eval should only happen for things that can |
|
3590 | 3605 | really be only function/method names. |
|
3591 | 3606 | |
|
3592 | 3607 | 2002-10-15 Fernando Perez <fperez@colorado.edu> |
|
3593 | 3608 | |
|
3594 | 3609 | * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac |
|
3595 | 3610 | OSX information to main manual, removed README_Mac_OSX file from |
|
3596 | 3611 | distribution. Also updated credits for recent additions. |
|
3597 | 3612 | |
|
3598 | 3613 | 2002-10-10 Fernando Perez <fperez@colorado.edu> |
|
3599 | 3614 | |
|
3600 | 3615 | * README_Mac_OSX: Added a README for Mac OSX users for fixing |
|
3601 | 3616 | terminal-related issues. Many thanks to Andrea Riciputi |
|
3602 | 3617 | <andrea.riciputi-AT-libero.it> for writing it. |
|
3603 | 3618 | |
|
3604 | 3619 | * IPython/UserConfig/ipythonrc.py: Fixes to various small issues, |
|
3605 | 3620 | thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>. |
|
3606 | 3621 | |
|
3607 | 3622 | * setup.py (make_shortcut): Fixes for Windows installation. Thanks |
|
3608 | 3623 | to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad |
|
3609 | 3624 | <syver-en-AT-online.no> who both submitted patches for this problem. |
|
3610 | 3625 | |
|
3611 | 3626 | * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for |
|
3612 | 3627 | global embedding to make sure that things don't overwrite user |
|
3613 | 3628 | globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com> |
|
3614 | 3629 | |
|
3615 | 3630 | * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6 |
|
3616 | 3631 | compatibility. Thanks to Hayden Callow |
|
3617 | 3632 | <h.callow-AT-elec.canterbury.ac.nz> |
|
3618 | 3633 | |
|
3619 | 3634 | 2002-10-04 Fernando Perez <fperez@colorado.edu> |
|
3620 | 3635 | |
|
3621 | 3636 | * IPython/Gnuplot2.py (PlotItem): Added 'index' option for |
|
3622 | 3637 | Gnuplot.File objects. |
|
3623 | 3638 | |
|
3624 | 3639 | 2002-07-23 Fernando Perez <fperez@colorado.edu> |
|
3625 | 3640 | |
|
3626 | 3641 | * IPython/genutils.py (timing): Added timings() and timing() for |
|
3627 | 3642 | quick access to the most commonly needed data, the execution |
|
3628 | 3643 | times. Old timing() renamed to timings_out(). |
|
3629 | 3644 | |
|
3630 | 3645 | 2002-07-18 Fernando Perez <fperez@colorado.edu> |
|
3631 | 3646 | |
|
3632 | 3647 | * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed |
|
3633 | 3648 | bug with nested instances disrupting the parent's tab completion. |
|
3634 | 3649 | |
|
3635 | 3650 | * IPython/iplib.py (all_completions): Added Alex Schmolck's |
|
3636 | 3651 | all_completions code to begin the emacs integration. |
|
3637 | 3652 | |
|
3638 | 3653 | * IPython/Gnuplot2.py (zip_items): Added optional 'titles' |
|
3639 | 3654 | argument to allow titling individual arrays when plotting. |
|
3640 | 3655 | |
|
3641 | 3656 | 2002-07-15 Fernando Perez <fperez@colorado.edu> |
|
3642 | 3657 | |
|
3643 | 3658 | * setup.py (make_shortcut): changed to retrieve the value of |
|
3644 | 3659 | 'Program Files' directory from the registry (this value changes in |
|
3645 | 3660 | non-english versions of Windows). Thanks to Thomas Fanslau |
|
3646 | 3661 | <tfanslau-AT-gmx.de> for the report. |
|
3647 | 3662 | |
|
3648 | 3663 | 2002-07-10 Fernando Perez <fperez@colorado.edu> |
|
3649 | 3664 | |
|
3650 | 3665 | * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for |
|
3651 | 3666 | a bug in pdb, which crashes if a line with only whitespace is |
|
3652 | 3667 | entered. Bug report submitted to sourceforge. |
|
3653 | 3668 | |
|
3654 | 3669 | 2002-07-09 Fernando Perez <fperez@colorado.edu> |
|
3655 | 3670 | |
|
3656 | 3671 | * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when |
|
3657 | 3672 | reporting exceptions (it's a bug in inspect.py, I just set a |
|
3658 | 3673 | workaround). |
|
3659 | 3674 | |
|
3660 | 3675 | 2002-07-08 Fernando Perez <fperez@colorado.edu> |
|
3661 | 3676 | |
|
3662 | 3677 | * IPython/iplib.py (InteractiveShell.__init__): fixed reference to |
|
3663 | 3678 | __IPYTHON__ in __builtins__ to show up in user_ns. |
|
3664 | 3679 | |
|
3665 | 3680 | 2002-07-03 Fernando Perez <fperez@colorado.edu> |
|
3666 | 3681 | |
|
3667 | 3682 | * IPython/GnuplotInteractive.py (magic_gp_set_default): changed |
|
3668 | 3683 | name from @gp_set_instance to @gp_set_default. |
|
3669 | 3684 | |
|
3670 | 3685 | * IPython/ipmaker.py (make_IPython): default editor value set to |
|
3671 | 3686 | '0' (a string), to match the rc file. Otherwise will crash when |
|
3672 | 3687 | .strip() is called on it. |
|
3673 | 3688 | |
|
3674 | 3689 | |
|
3675 | 3690 | 2002-06-28 Fernando Perez <fperez@colorado.edu> |
|
3676 | 3691 | |
|
3677 | 3692 | * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing |
|
3678 | 3693 | of files in current directory when a file is executed via |
|
3679 | 3694 | @run. Patch also by RA <ralf_ahlbrink-AT-web.de>. |
|
3680 | 3695 | |
|
3681 | 3696 | * setup.py (manfiles): fix for rpm builds, submitted by RA |
|
3682 | 3697 | <ralf_ahlbrink-AT-web.de>. Now we have RPMs! |
|
3683 | 3698 | |
|
3684 | 3699 | * IPython/ipmaker.py (make_IPython): fixed lookup of default |
|
3685 | 3700 | editor when set to '0'. Problem was, '0' evaluates to True (it's a |
|
3686 | 3701 | string!). A. Schmolck caught this one. |
|
3687 | 3702 | |
|
3688 | 3703 | 2002-06-27 Fernando Perez <fperez@colorado.edu> |
|
3689 | 3704 | |
|
3690 | 3705 | * IPython/ipmaker.py (make_IPython): fixed bug when running user |
|
3691 | 3706 | defined files at the cmd line. __name__ wasn't being set to |
|
3692 | 3707 | __main__. |
|
3693 | 3708 | |
|
3694 | 3709 | * IPython/Gnuplot2.py (zip_items): improved it so it can plot also |
|
3695 | 3710 | regular lists and tuples besides Numeric arrays. |
|
3696 | 3711 | |
|
3697 | 3712 | * IPython/Prompts.py (CachedOutput.__call__): Added output |
|
3698 | 3713 | supression for input ending with ';'. Similar to Mathematica and |
|
3699 | 3714 | Matlab. The _* vars and Out[] list are still updated, just like |
|
3700 | 3715 | Mathematica behaves. |
|
3701 | 3716 | |
|
3702 | 3717 | 2002-06-25 Fernando Perez <fperez@colorado.edu> |
|
3703 | 3718 | |
|
3704 | 3719 | * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of |
|
3705 | 3720 | .ini extensions for profiels under Windows. |
|
3706 | 3721 | |
|
3707 | 3722 | * IPython/OInspect.py (Inspector.pinfo): improved alignment of |
|
3708 | 3723 | string form. Fix contributed by Alexander Schmolck |
|
3709 | 3724 | <a.schmolck-AT-gmx.net> |
|
3710 | 3725 | |
|
3711 | 3726 | * IPython/GnuplotRuntime.py (gp_new): new function. Returns a |
|
3712 | 3727 | pre-configured Gnuplot instance. |
|
3713 | 3728 | |
|
3714 | 3729 | 2002-06-21 Fernando Perez <fperez@colorado.edu> |
|
3715 | 3730 | |
|
3716 | 3731 | * IPython/numutils.py (exp_safe): new function, works around the |
|
3717 | 3732 | underflow problems in Numeric. |
|
3718 | 3733 | (log2): New fn. Safe log in base 2: returns exact integer answer |
|
3719 | 3734 | for exact integer powers of 2. |
|
3720 | 3735 | |
|
3721 | 3736 | * IPython/Magic.py (get_py_filename): fixed it not expanding '~' |
|
3722 | 3737 | properly. |
|
3723 | 3738 | |
|
3724 | 3739 | 2002-06-20 Fernando Perez <fperez@colorado.edu> |
|
3725 | 3740 | |
|
3726 | 3741 | * IPython/genutils.py (timing): new function like |
|
3727 | 3742 | Mathematica's. Similar to time_test, but returns more info. |
|
3728 | 3743 | |
|
3729 | 3744 | 2002-06-18 Fernando Perez <fperez@colorado.edu> |
|
3730 | 3745 | |
|
3731 | 3746 | * IPython/Magic.py (Magic.magic_save): modified @save and @r |
|
3732 | 3747 | according to Mike Heeter's suggestions. |
|
3733 | 3748 | |
|
3734 | 3749 | 2002-06-16 Fernando Perez <fperez@colorado.edu> |
|
3735 | 3750 | |
|
3736 | 3751 | * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot |
|
3737 | 3752 | system. GnuplotMagic is gone as a user-directory option. New files |
|
3738 | 3753 | make it easier to use all the gnuplot stuff both from external |
|
3739 | 3754 | programs as well as from IPython. Had to rewrite part of |
|
3740 | 3755 | hardcopy() b/c of a strange bug: often the ps files simply don't |
|
3741 | 3756 | get created, and require a repeat of the command (often several |
|
3742 | 3757 | times). |
|
3743 | 3758 | |
|
3744 | 3759 | * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to |
|
3745 | 3760 | resolve output channel at call time, so that if sys.stderr has |
|
3746 | 3761 | been redirected by user this gets honored. |
|
3747 | 3762 | |
|
3748 | 3763 | 2002-06-13 Fernando Perez <fperez@colorado.edu> |
|
3749 | 3764 | |
|
3750 | 3765 | * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to |
|
3751 | 3766 | IPShell. Kept a copy with the old names to avoid breaking people's |
|
3752 | 3767 | embedded code. |
|
3753 | 3768 | |
|
3754 | 3769 | * IPython/ipython: simplified it to the bare minimum after |
|
3755 | 3770 | Holger's suggestions. Added info about how to use it in |
|
3756 | 3771 | PYTHONSTARTUP. |
|
3757 | 3772 | |
|
3758 | 3773 | * IPython/Shell.py (IPythonShell): changed the options passing |
|
3759 | 3774 | from a string with funky %s replacements to a straight list. Maybe |
|
3760 | 3775 | a bit more typing, but it follows sys.argv conventions, so there's |
|
3761 | 3776 | less special-casing to remember. |
|
3762 | 3777 | |
|
3763 | 3778 | 2002-06-12 Fernando Perez <fperez@colorado.edu> |
|
3764 | 3779 | |
|
3765 | 3780 | * IPython/Magic.py (Magic.magic_r): new magic auto-repeat |
|
3766 | 3781 | command. Thanks to a suggestion by Mike Heeter. |
|
3767 | 3782 | (Magic.magic_pfile): added behavior to look at filenames if given |
|
3768 | 3783 | arg is not a defined object. |
|
3769 | 3784 | (Magic.magic_save): New @save function to save code snippets. Also |
|
3770 | 3785 | a Mike Heeter idea. |
|
3771 | 3786 | |
|
3772 | 3787 | * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to |
|
3773 | 3788 | plot() and replot(). Much more convenient now, especially for |
|
3774 | 3789 | interactive use. |
|
3775 | 3790 | |
|
3776 | 3791 | * IPython/Magic.py (Magic.magic_run): Added .py automatically to |
|
3777 | 3792 | filenames. |
|
3778 | 3793 | |
|
3779 | 3794 | 2002-06-02 Fernando Perez <fperez@colorado.edu> |
|
3780 | 3795 | |
|
3781 | 3796 | * IPython/Struct.py (Struct.__init__): modified to admit |
|
3782 | 3797 | initialization via another struct. |
|
3783 | 3798 | |
|
3784 | 3799 | * IPython/genutils.py (SystemExec.__init__): New stateful |
|
3785 | 3800 | interface to xsys and bq. Useful for writing system scripts. |
|
3786 | 3801 | |
|
3787 | 3802 | 2002-05-30 Fernando Perez <fperez@colorado.edu> |
|
3788 | 3803 | |
|
3789 | 3804 | * MANIFEST.in: Changed docfile selection to exclude all the lyx |
|
3790 | 3805 | documents. This will make the user download smaller (it's getting |
|
3791 | 3806 | too big). |
|
3792 | 3807 | |
|
3793 | 3808 | 2002-05-29 Fernando Perez <fperez@colorado.edu> |
|
3794 | 3809 | |
|
3795 | 3810 | * IPython/iplib.py (_FakeModule.__init__): New class introduced to |
|
3796 | 3811 | fix problems with shelve and pickle. Seems to work, but I don't |
|
3797 | 3812 | know if corner cases break it. Thanks to Mike Heeter |
|
3798 | 3813 | <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases. |
|
3799 | 3814 | |
|
3800 | 3815 | 2002-05-24 Fernando Perez <fperez@colorado.edu> |
|
3801 | 3816 | |
|
3802 | 3817 | * IPython/Magic.py (Macro.__init__): fixed magics embedded in |
|
3803 | 3818 | macros having broken. |
|
3804 | 3819 | |
|
3805 | 3820 | 2002-05-21 Fernando Perez <fperez@colorado.edu> |
|
3806 | 3821 | |
|
3807 | 3822 | * IPython/Magic.py (Magic.magic_logstart): fixed recently |
|
3808 | 3823 | introduced logging bug: all history before logging started was |
|
3809 | 3824 | being written one character per line! This came from the redesign |
|
3810 | 3825 | of the input history as a special list which slices to strings, |
|
3811 | 3826 | not to lists. |
|
3812 | 3827 | |
|
3813 | 3828 | 2002-05-20 Fernando Perez <fperez@colorado.edu> |
|
3814 | 3829 | |
|
3815 | 3830 | * IPython/Prompts.py (CachedOutput.__init__): made the color table |
|
3816 | 3831 | be an attribute of all classes in this module. The design of these |
|
3817 | 3832 | classes needs some serious overhauling. |
|
3818 | 3833 | |
|
3819 | 3834 | * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug |
|
3820 | 3835 | which was ignoring '_' in option names. |
|
3821 | 3836 | |
|
3822 | 3837 | * IPython/ultraTB.py (FormattedTB.__init__): Changed |
|
3823 | 3838 | 'Verbose_novars' to 'Context' and made it the new default. It's a |
|
3824 | 3839 | bit more readable and also safer than verbose. |
|
3825 | 3840 | |
|
3826 | 3841 | * IPython/PyColorize.py (Parser.__call__): Fixed coloring of |
|
3827 | 3842 | triple-quoted strings. |
|
3828 | 3843 | |
|
3829 | 3844 | * IPython/OInspect.py (__all__): new module exposing the object |
|
3830 | 3845 | introspection facilities. Now the corresponding magics are dummy |
|
3831 | 3846 | wrappers around this. Having this module will make it much easier |
|
3832 | 3847 | to put these functions into our modified pdb. |
|
3833 | 3848 | This new object inspector system uses the new colorizing module, |
|
3834 | 3849 | so source code and other things are nicely syntax highlighted. |
|
3835 | 3850 | |
|
3836 | 3851 | 2002-05-18 Fernando Perez <fperez@colorado.edu> |
|
3837 | 3852 | |
|
3838 | 3853 | * IPython/ColorANSI.py: Split the coloring tools into a separate |
|
3839 | 3854 | module so I can use them in other code easier (they were part of |
|
3840 | 3855 | ultraTB). |
|
3841 | 3856 | |
|
3842 | 3857 | 2002-05-17 Fernando Perez <fperez@colorado.edu> |
|
3843 | 3858 | |
|
3844 | 3859 | * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance): |
|
3845 | 3860 | fixed it to set the global 'g' also to the called instance, as |
|
3846 | 3861 | long as 'g' was still a gnuplot instance (so it doesn't overwrite |
|
3847 | 3862 | user's 'g' variables). |
|
3848 | 3863 | |
|
3849 | 3864 | * IPython/iplib.py (InteractiveShell.__init__): Added In/Out |
|
3850 | 3865 | global variables (aliases to _ih,_oh) so that users which expect |
|
3851 | 3866 | In[5] or Out[7] to work aren't unpleasantly surprised. |
|
3852 | 3867 | (InputList.__getslice__): new class to allow executing slices of |
|
3853 | 3868 | input history directly. Very simple class, complements the use of |
|
3854 | 3869 | macros. |
|
3855 | 3870 | |
|
3856 | 3871 | 2002-05-16 Fernando Perez <fperez@colorado.edu> |
|
3857 | 3872 | |
|
3858 | 3873 | * setup.py (docdirbase): make doc directory be just doc/IPython |
|
3859 | 3874 | without version numbers, it will reduce clutter for users. |
|
3860 | 3875 | |
|
3861 | 3876 | * IPython/Magic.py (Magic.magic_run): Add explicit local dict to |
|
3862 | 3877 | execfile call to prevent possible memory leak. See for details: |
|
3863 | 3878 | http://mail.python.org/pipermail/python-list/2002-February/088476.html |
|
3864 | 3879 | |
|
3865 | 3880 | 2002-05-15 Fernando Perez <fperez@colorado.edu> |
|
3866 | 3881 | |
|
3867 | 3882 | * IPython/Magic.py (Magic.magic_psource): made the object |
|
3868 | 3883 | introspection names be more standard: pdoc, pdef, pfile and |
|
3869 | 3884 | psource. They all print/page their output, and it makes |
|
3870 | 3885 | remembering them easier. Kept old names for compatibility as |
|
3871 | 3886 | aliases. |
|
3872 | 3887 | |
|
3873 | 3888 | 2002-05-14 Fernando Perez <fperez@colorado.edu> |
|
3874 | 3889 | |
|
3875 | 3890 | * IPython/UserConfig/GnuplotMagic.py: I think I finally understood |
|
3876 | 3891 | what the mouse problem was. The trick is to use gnuplot with temp |
|
3877 | 3892 | files and NOT with pipes (for data communication), because having |
|
3878 | 3893 | both pipes and the mouse on is bad news. |
|
3879 | 3894 | |
|
3880 | 3895 | 2002-05-13 Fernando Perez <fperez@colorado.edu> |
|
3881 | 3896 | |
|
3882 | 3897 | * IPython/Magic.py (Magic._ofind): fixed namespace order search |
|
3883 | 3898 | bug. Information would be reported about builtins even when |
|
3884 | 3899 | user-defined functions overrode them. |
|
3885 | 3900 | |
|
3886 | 3901 | 2002-05-11 Fernando Perez <fperez@colorado.edu> |
|
3887 | 3902 | |
|
3888 | 3903 | * IPython/__init__.py (__all__): removed FlexCompleter from |
|
3889 | 3904 | __all__ so that things don't fail in platforms without readline. |
|
3890 | 3905 | |
|
3891 | 3906 | 2002-05-10 Fernando Perez <fperez@colorado.edu> |
|
3892 | 3907 | |
|
3893 | 3908 | * IPython/__init__.py (__all__): removed numutils from __all__ b/c |
|
3894 | 3909 | it requires Numeric, effectively making Numeric a dependency for |
|
3895 | 3910 | IPython. |
|
3896 | 3911 | |
|
3897 | 3912 | * Released 0.2.13 |
|
3898 | 3913 | |
|
3899 | 3914 | * IPython/Magic.py (Magic.magic_prun): big overhaul to the |
|
3900 | 3915 | profiler interface. Now all the major options from the profiler |
|
3901 | 3916 | module are directly supported in IPython, both for single |
|
3902 | 3917 | expressions (@prun) and for full programs (@run -p). |
|
3903 | 3918 | |
|
3904 | 3919 | 2002-05-09 Fernando Perez <fperez@colorado.edu> |
|
3905 | 3920 | |
|
3906 | 3921 | * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of |
|
3907 | 3922 | magic properly formatted for screen. |
|
3908 | 3923 | |
|
3909 | 3924 | * setup.py (make_shortcut): Changed things to put pdf version in |
|
3910 | 3925 | doc/ instead of doc/manual (had to change lyxport a bit). |
|
3911 | 3926 | |
|
3912 | 3927 | * IPython/Magic.py (Profile.string_stats): made profile runs go |
|
3913 | 3928 | through pager (they are long and a pager allows searching, saving, |
|
3914 | 3929 | etc.) |
|
3915 | 3930 | |
|
3916 | 3931 | 2002-05-08 Fernando Perez <fperez@colorado.edu> |
|
3917 | 3932 | |
|
3918 | 3933 | * Released 0.2.12 |
|
3919 | 3934 | |
|
3920 | 3935 | 2002-05-06 Fernando Perez <fperez@colorado.edu> |
|
3921 | 3936 | |
|
3922 | 3937 | * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently |
|
3923 | 3938 | introduced); 'hist n1 n2' was broken. |
|
3924 | 3939 | (Magic.magic_pdb): added optional on/off arguments to @pdb |
|
3925 | 3940 | (Magic.magic_run): added option -i to @run, which executes code in |
|
3926 | 3941 | the IPython namespace instead of a clean one. Also added @irun as |
|
3927 | 3942 | an alias to @run -i. |
|
3928 | 3943 | |
|
3929 | 3944 | * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance): |
|
3930 | 3945 | fixed (it didn't really do anything, the namespaces were wrong). |
|
3931 | 3946 | |
|
3932 | 3947 | * IPython/Debugger.py (__init__): Added workaround for python 2.1 |
|
3933 | 3948 | |
|
3934 | 3949 | * IPython/__init__.py (__all__): Fixed package namespace, now |
|
3935 | 3950 | 'import IPython' does give access to IPython.<all> as |
|
3936 | 3951 | expected. Also renamed __release__ to Release. |
|
3937 | 3952 | |
|
3938 | 3953 | * IPython/Debugger.py (__license__): created new Pdb class which |
|
3939 | 3954 | functions like a drop-in for the normal pdb.Pdb but does NOT |
|
3940 | 3955 | import readline by default. This way it doesn't muck up IPython's |
|
3941 | 3956 | readline handling, and now tab-completion finally works in the |
|
3942 | 3957 | debugger -- sort of. It completes things globally visible, but the |
|
3943 | 3958 | completer doesn't track the stack as pdb walks it. That's a bit |
|
3944 | 3959 | tricky, and I'll have to implement it later. |
|
3945 | 3960 | |
|
3946 | 3961 | 2002-05-05 Fernando Perez <fperez@colorado.edu> |
|
3947 | 3962 | |
|
3948 | 3963 | * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for |
|
3949 | 3964 | magic docstrings when printed via ? (explicit \'s were being |
|
3950 | 3965 | printed). |
|
3951 | 3966 | |
|
3952 | 3967 | * IPython/ipmaker.py (make_IPython): fixed namespace |
|
3953 | 3968 | identification bug. Now variables loaded via logs or command-line |
|
3954 | 3969 | files are recognized in the interactive namespace by @who. |
|
3955 | 3970 | |
|
3956 | 3971 | * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in |
|
3957 | 3972 | log replay system stemming from the string form of Structs. |
|
3958 | 3973 | |
|
3959 | 3974 | * IPython/Magic.py (Macro.__init__): improved macros to properly |
|
3960 | 3975 | handle magic commands in them. |
|
3961 | 3976 | (Magic.magic_logstart): usernames are now expanded so 'logstart |
|
3962 | 3977 | ~/mylog' now works. |
|
3963 | 3978 | |
|
3964 | 3979 | * IPython/iplib.py (complete): fixed bug where paths starting with |
|
3965 | 3980 | '/' would be completed as magic names. |
|
3966 | 3981 | |
|
3967 | 3982 | 2002-05-04 Fernando Perez <fperez@colorado.edu> |
|
3968 | 3983 | |
|
3969 | 3984 | * IPython/Magic.py (Magic.magic_run): added options -p and -f to |
|
3970 | 3985 | allow running full programs under the profiler's control. |
|
3971 | 3986 | |
|
3972 | 3987 | * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars |
|
3973 | 3988 | mode to report exceptions verbosely but without formatting |
|
3974 | 3989 | variables. This addresses the issue of ipython 'freezing' (it's |
|
3975 | 3990 | not frozen, but caught in an expensive formatting loop) when huge |
|
3976 | 3991 | variables are in the context of an exception. |
|
3977 | 3992 | (VerboseTB.text): Added '--->' markers at line where exception was |
|
3978 | 3993 | triggered. Much clearer to read, especially in NoColor modes. |
|
3979 | 3994 | |
|
3980 | 3995 | * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been |
|
3981 | 3996 | implemented in reverse when changing to the new parse_options(). |
|
3982 | 3997 | |
|
3983 | 3998 | 2002-05-03 Fernando Perez <fperez@colorado.edu> |
|
3984 | 3999 | |
|
3985 | 4000 | * IPython/Magic.py (Magic.parse_options): new function so that |
|
3986 | 4001 | magics can parse options easier. |
|
3987 | 4002 | (Magic.magic_prun): new function similar to profile.run(), |
|
3988 | 4003 | suggested by Chris Hart. |
|
3989 | 4004 | (Magic.magic_cd): fixed behavior so that it only changes if |
|
3990 | 4005 | directory actually is in history. |
|
3991 | 4006 | |
|
3992 | 4007 | * IPython/usage.py (__doc__): added information about potential |
|
3993 | 4008 | slowness of Verbose exception mode when there are huge data |
|
3994 | 4009 | structures to be formatted (thanks to Archie Paulson). |
|
3995 | 4010 | |
|
3996 | 4011 | * IPython/ipmaker.py (make_IPython): Changed default logging |
|
3997 | 4012 | (when simply called with -log) to use curr_dir/ipython.log in |
|
3998 | 4013 | rotate mode. Fixed crash which was occuring with -log before |
|
3999 | 4014 | (thanks to Jim Boyle). |
|
4000 | 4015 | |
|
4001 | 4016 | 2002-05-01 Fernando Perez <fperez@colorado.edu> |
|
4002 | 4017 | |
|
4003 | 4018 | * Released 0.2.11 for these fixes (mainly the ultraTB one which |
|
4004 | 4019 | was nasty -- though somewhat of a corner case). |
|
4005 | 4020 | |
|
4006 | 4021 | * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to |
|
4007 | 4022 | text (was a bug). |
|
4008 | 4023 | |
|
4009 | 4024 | 2002-04-30 Fernando Perez <fperez@colorado.edu> |
|
4010 | 4025 | |
|
4011 | 4026 | * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add |
|
4012 | 4027 | a print after ^D or ^C from the user so that the In[] prompt |
|
4013 | 4028 | doesn't over-run the gnuplot one. |
|
4014 | 4029 | |
|
4015 | 4030 | 2002-04-29 Fernando Perez <fperez@colorado.edu> |
|
4016 | 4031 | |
|
4017 | 4032 | * Released 0.2.10 |
|
4018 | 4033 | |
|
4019 | 4034 | * IPython/__release__.py (version): get date dynamically. |
|
4020 | 4035 | |
|
4021 | 4036 | * Misc. documentation updates thanks to Arnd's comments. Also ran |
|
4022 | 4037 | a full spellcheck on the manual (hadn't been done in a while). |
|
4023 | 4038 | |
|
4024 | 4039 | 2002-04-27 Fernando Perez <fperez@colorado.edu> |
|
4025 | 4040 | |
|
4026 | 4041 | * IPython/Magic.py (Magic.magic_logstart): Fixed bug where |
|
4027 | 4042 | starting a log in mid-session would reset the input history list. |
|
4028 | 4043 | |
|
4029 | 4044 | 2002-04-26 Fernando Perez <fperez@colorado.edu> |
|
4030 | 4045 | |
|
4031 | 4046 | * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not |
|
4032 | 4047 | all files were being included in an update. Now anything in |
|
4033 | 4048 | UserConfig that matches [A-Za-z]*.py will go (this excludes |
|
4034 | 4049 | __init__.py) |
|
4035 | 4050 | |
|
4036 | 4051 | 2002-04-25 Fernando Perez <fperez@colorado.edu> |
|
4037 | 4052 | |
|
4038 | 4053 | * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__ |
|
4039 | 4054 | to __builtins__ so that any form of embedded or imported code can |
|
4040 | 4055 | test for being inside IPython. |
|
4041 | 4056 | |
|
4042 | 4057 | * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance): |
|
4043 | 4058 | changed to GnuplotMagic because it's now an importable module, |
|
4044 | 4059 | this makes the name follow that of the standard Gnuplot module. |
|
4045 | 4060 | GnuplotMagic can now be loaded at any time in mid-session. |
|
4046 | 4061 | |
|
4047 | 4062 | 2002-04-24 Fernando Perez <fperez@colorado.edu> |
|
4048 | 4063 | |
|
4049 | 4064 | * IPython/numutils.py: removed SIUnits. It doesn't properly set |
|
4050 | 4065 | the globals (IPython has its own namespace) and the |
|
4051 | 4066 | PhysicalQuantity stuff is much better anyway. |
|
4052 | 4067 | |
|
4053 | 4068 | * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot |
|
4054 | 4069 | embedding example to standard user directory for |
|
4055 | 4070 | distribution. Also put it in the manual. |
|
4056 | 4071 | |
|
4057 | 4072 | * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot |
|
4058 | 4073 | instance as first argument (so it doesn't rely on some obscure |
|
4059 | 4074 | hidden global). |
|
4060 | 4075 | |
|
4061 | 4076 | * IPython/UserConfig/ipythonrc.py: put () back in accepted |
|
4062 | 4077 | delimiters. While it prevents ().TAB from working, it allows |
|
4063 | 4078 | completions in open (... expressions. This is by far a more common |
|
4064 | 4079 | case. |
|
4065 | 4080 | |
|
4066 | 4081 | 2002-04-23 Fernando Perez <fperez@colorado.edu> |
|
4067 | 4082 | |
|
4068 | 4083 | * IPython/Extensions/InterpreterPasteInput.py: new |
|
4069 | 4084 | syntax-processing module for pasting lines with >>> or ... at the |
|
4070 | 4085 | start. |
|
4071 | 4086 | |
|
4072 | 4087 | * IPython/Extensions/PhysicalQ_Interactive.py |
|
4073 | 4088 | (PhysicalQuantityInteractive.__int__): fixed to work with either |
|
4074 | 4089 | Numeric or math. |
|
4075 | 4090 | |
|
4076 | 4091 | * IPython/UserConfig/ipythonrc-numeric.py: reorganized the |
|
4077 | 4092 | provided profiles. Now we have: |
|
4078 | 4093 | -math -> math module as * and cmath with its own namespace. |
|
4079 | 4094 | -numeric -> Numeric as *, plus gnuplot & grace |
|
4080 | 4095 | -physics -> same as before |
|
4081 | 4096 | |
|
4082 | 4097 | * IPython/Magic.py (Magic.magic_magic): Fixed bug where |
|
4083 | 4098 | user-defined magics wouldn't be found by @magic if they were |
|
4084 | 4099 | defined as class methods. Also cleaned up the namespace search |
|
4085 | 4100 | logic and the string building (to use %s instead of many repeated |
|
4086 | 4101 | string adds). |
|
4087 | 4102 | |
|
4088 | 4103 | * IPython/UserConfig/example-magic.py (magic_foo): updated example |
|
4089 | 4104 | of user-defined magics to operate with class methods (cleaner, in |
|
4090 | 4105 | line with the gnuplot code). |
|
4091 | 4106 | |
|
4092 | 4107 | 2002-04-22 Fernando Perez <fperez@colorado.edu> |
|
4093 | 4108 | |
|
4094 | 4109 | * setup.py: updated dependency list so that manual is updated when |
|
4095 | 4110 | all included files change. |
|
4096 | 4111 | |
|
4097 | 4112 | * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring |
|
4098 | 4113 | the delimiter removal option (the fix is ugly right now). |
|
4099 | 4114 | |
|
4100 | 4115 | * IPython/UserConfig/ipythonrc-physics.py: simplified not to load |
|
4101 | 4116 | all of the math profile (quicker loading, no conflict between |
|
4102 | 4117 | g-9.8 and g-gnuplot). |
|
4103 | 4118 | |
|
4104 | 4119 | * IPython/CrashHandler.py (CrashHandler.__call__): changed default |
|
4105 | 4120 | name of post-mortem files to IPython_crash_report.txt. |
|
4106 | 4121 | |
|
4107 | 4122 | * Cleanup/update of the docs. Added all the new readline info and |
|
4108 | 4123 | formatted all lists as 'real lists'. |
|
4109 | 4124 | |
|
4110 | 4125 | * IPython/ipmaker.py (make_IPython): removed now-obsolete |
|
4111 | 4126 | tab-completion options, since the full readline parse_and_bind is |
|
4112 | 4127 | now accessible. |
|
4113 | 4128 | |
|
4114 | 4129 | * IPython/iplib.py (InteractiveShell.init_readline): Changed |
|
4115 | 4130 | handling of readline options. Now users can specify any string to |
|
4116 | 4131 | be passed to parse_and_bind(), as well as the delimiters to be |
|
4117 | 4132 | removed. |
|
4118 | 4133 | (InteractiveShell.__init__): Added __name__ to the global |
|
4119 | 4134 | namespace so that things like Itpl which rely on its existence |
|
4120 | 4135 | don't crash. |
|
4121 | 4136 | (InteractiveShell._prefilter): Defined the default with a _ so |
|
4122 | 4137 | that prefilter() is easier to override, while the default one |
|
4123 | 4138 | remains available. |
|
4124 | 4139 | |
|
4125 | 4140 | 2002-04-18 Fernando Perez <fperez@colorado.edu> |
|
4126 | 4141 | |
|
4127 | 4142 | * Added information about pdb in the docs. |
|
4128 | 4143 | |
|
4129 | 4144 | 2002-04-17 Fernando Perez <fperez@colorado.edu> |
|
4130 | 4145 | |
|
4131 | 4146 | * IPython/ipmaker.py (make_IPython): added rc_override option to |
|
4132 | 4147 | allow passing config options at creation time which may override |
|
4133 | 4148 | anything set in the config files or command line. This is |
|
4134 | 4149 | particularly useful for configuring embedded instances. |
|
4135 | 4150 | |
|
4136 | 4151 | 2002-04-15 Fernando Perez <fperez@colorado.edu> |
|
4137 | 4152 | |
|
4138 | 4153 | * IPython/Logger.py (Logger.log): Fixed a nasty bug which could |
|
4139 | 4154 | crash embedded instances because of the input cache falling out of |
|
4140 | 4155 | sync with the output counter. |
|
4141 | 4156 | |
|
4142 | 4157 | * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug |
|
4143 | 4158 | mode which calls pdb after an uncaught exception in IPython itself. |
|
4144 | 4159 | |
|
4145 | 4160 | 2002-04-14 Fernando Perez <fperez@colorado.edu> |
|
4146 | 4161 | |
|
4147 | 4162 | * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up |
|
4148 | 4163 | readline, fix it back after each call. |
|
4149 | 4164 | |
|
4150 | 4165 | * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private |
|
4151 | 4166 | method to force all access via __call__(), which guarantees that |
|
4152 | 4167 | traceback references are properly deleted. |
|
4153 | 4168 | |
|
4154 | 4169 | * IPython/Prompts.py (CachedOutput._display): minor fixes to |
|
4155 | 4170 | improve printing when pprint is in use. |
|
4156 | 4171 | |
|
4157 | 4172 | 2002-04-13 Fernando Perez <fperez@colorado.edu> |
|
4158 | 4173 | |
|
4159 | 4174 | * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit |
|
4160 | 4175 | exceptions aren't caught anymore. If the user triggers one, he |
|
4161 | 4176 | should know why he's doing it and it should go all the way up, |
|
4162 | 4177 | just like any other exception. So now @abort will fully kill the |
|
4163 | 4178 | embedded interpreter and the embedding code (unless that happens |
|
4164 | 4179 | to catch SystemExit). |
|
4165 | 4180 | |
|
4166 | 4181 | * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag |
|
4167 | 4182 | and a debugger() method to invoke the interactive pdb debugger |
|
4168 | 4183 | after printing exception information. Also added the corresponding |
|
4169 | 4184 | -pdb option and @pdb magic to control this feature, and updated |
|
4170 | 4185 | the docs. After a suggestion from Christopher Hart |
|
4171 | 4186 | (hart-AT-caltech.edu). |
|
4172 | 4187 | |
|
4173 | 4188 | 2002-04-12 Fernando Perez <fperez@colorado.edu> |
|
4174 | 4189 | |
|
4175 | 4190 | * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use |
|
4176 | 4191 | the exception handlers defined by the user (not the CrashHandler) |
|
4177 | 4192 | so that user exceptions don't trigger an ipython bug report. |
|
4178 | 4193 | |
|
4179 | 4194 | * IPython/ultraTB.py (ColorTB.__init__): made the color scheme |
|
4180 | 4195 | configurable (it should have always been so). |
|
4181 | 4196 | |
|
4182 | 4197 | 2002-03-26 Fernando Perez <fperez@colorado.edu> |
|
4183 | 4198 | |
|
4184 | 4199 | * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here |
|
4185 | 4200 | and there to fix embedding namespace issues. This should all be |
|
4186 | 4201 | done in a more elegant way. |
|
4187 | 4202 | |
|
4188 | 4203 | 2002-03-25 Fernando Perez <fperez@colorado.edu> |
|
4189 | 4204 | |
|
4190 | 4205 | * IPython/genutils.py (get_home_dir): Try to make it work under |
|
4191 | 4206 | win9x also. |
|
4192 | 4207 | |
|
4193 | 4208 | 2002-03-20 Fernando Perez <fperez@colorado.edu> |
|
4194 | 4209 | |
|
4195 | 4210 | * IPython/Shell.py (IPythonShellEmbed.__init__): leave |
|
4196 | 4211 | sys.displayhook untouched upon __init__. |
|
4197 | 4212 | |
|
4198 | 4213 | 2002-03-19 Fernando Perez <fperez@colorado.edu> |
|
4199 | 4214 | |
|
4200 | 4215 | * Released 0.2.9 (for embedding bug, basically). |
|
4201 | 4216 | |
|
4202 | 4217 | * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit |
|
4203 | 4218 | exceptions so that enclosing shell's state can be restored. |
|
4204 | 4219 | |
|
4205 | 4220 | * Changed magic_gnuplot.py to magic-gnuplot.py to standardize |
|
4206 | 4221 | naming conventions in the .ipython/ dir. |
|
4207 | 4222 | |
|
4208 | 4223 | * IPython/iplib.py (InteractiveShell.init_readline): removed '-' |
|
4209 | 4224 | from delimiters list so filenames with - in them get expanded. |
|
4210 | 4225 | |
|
4211 | 4226 | * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with |
|
4212 | 4227 | sys.displayhook not being properly restored after an embedded call. |
|
4213 | 4228 | |
|
4214 | 4229 | 2002-03-18 Fernando Perez <fperez@colorado.edu> |
|
4215 | 4230 | |
|
4216 | 4231 | * Released 0.2.8 |
|
4217 | 4232 | |
|
4218 | 4233 | * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where |
|
4219 | 4234 | some files weren't being included in a -upgrade. |
|
4220 | 4235 | (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous |
|
4221 | 4236 | on' so that the first tab completes. |
|
4222 | 4237 | (InteractiveShell.handle_magic): fixed bug with spaces around |
|
4223 | 4238 | quotes breaking many magic commands. |
|
4224 | 4239 | |
|
4225 | 4240 | * setup.py: added note about ignoring the syntax error messages at |
|
4226 | 4241 | installation. |
|
4227 | 4242 | |
|
4228 | 4243 | * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished |
|
4229 | 4244 | streamlining the gnuplot interface, now there's only one magic @gp. |
|
4230 | 4245 | |
|
4231 | 4246 | 2002-03-17 Fernando Perez <fperez@colorado.edu> |
|
4232 | 4247 | |
|
4233 | 4248 | * IPython/UserConfig/magic_gnuplot.py: new name for the |
|
4234 | 4249 | example-magic_pm.py file. Much enhanced system, now with a shell |
|
4235 | 4250 | for communicating directly with gnuplot, one command at a time. |
|
4236 | 4251 | |
|
4237 | 4252 | * IPython/Magic.py (Magic.magic_run): added option -n to prevent |
|
4238 | 4253 | setting __name__=='__main__'. |
|
4239 | 4254 | |
|
4240 | 4255 | * IPython/UserConfig/example-magic_pm.py (magic_pm): Added |
|
4241 | 4256 | mini-shell for accessing gnuplot from inside ipython. Should |
|
4242 | 4257 | extend it later for grace access too. Inspired by Arnd's |
|
4243 | 4258 | suggestion. |
|
4244 | 4259 | |
|
4245 | 4260 | * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when |
|
4246 | 4261 | calling magic functions with () in their arguments. Thanks to Arnd |
|
4247 | 4262 | Baecker for pointing this to me. |
|
4248 | 4263 | |
|
4249 | 4264 | * IPython/numutils.py (sum_flat): fixed bug. Would recurse |
|
4250 | 4265 | infinitely for integer or complex arrays (only worked with floats). |
|
4251 | 4266 | |
|
4252 | 4267 | 2002-03-16 Fernando Perez <fperez@colorado.edu> |
|
4253 | 4268 | |
|
4254 | 4269 | * setup.py: Merged setup and setup_windows into a single script |
|
4255 | 4270 | which properly handles things for windows users. |
|
4256 | 4271 | |
|
4257 | 4272 | 2002-03-15 Fernando Perez <fperez@colorado.edu> |
|
4258 | 4273 | |
|
4259 | 4274 | * Big change to the manual: now the magics are all automatically |
|
4260 | 4275 | documented. This information is generated from their docstrings |
|
4261 | 4276 | and put in a latex file included by the manual lyx file. This way |
|
4262 | 4277 | we get always up to date information for the magics. The manual |
|
4263 | 4278 | now also has proper version information, also auto-synced. |
|
4264 | 4279 | |
|
4265 | 4280 | For this to work, an undocumented --magic_docstrings option was added. |
|
4266 | 4281 | |
|
4267 | 4282 | 2002-03-13 Fernando Perez <fperez@colorado.edu> |
|
4268 | 4283 | |
|
4269 | 4284 | * IPython/ultraTB.py (TermColors): fixed problem with dark colors |
|
4270 | 4285 | under CDE terminals. An explicit ;2 color reset is needed in the escapes. |
|
4271 | 4286 | |
|
4272 | 4287 | 2002-03-12 Fernando Perez <fperez@colorado.edu> |
|
4273 | 4288 | |
|
4274 | 4289 | * IPython/ultraTB.py (TermColors): changed color escapes again to |
|
4275 | 4290 | fix the (old, reintroduced) line-wrapping bug. Basically, if |
|
4276 | 4291 | \001..\002 aren't given in the color escapes, lines get wrapped |
|
4277 | 4292 | weirdly. But giving those screws up old xterms and emacs terms. So |
|
4278 | 4293 | I added some logic for emacs terms to be ok, but I can't identify old |
|
4279 | 4294 | xterms separately ($TERM=='xterm' for many terminals, like konsole). |
|
4280 | 4295 | |
|
4281 | 4296 | 2002-03-10 Fernando Perez <fperez@colorado.edu> |
|
4282 | 4297 | |
|
4283 | 4298 | * IPython/usage.py (__doc__): Various documentation cleanups and |
|
4284 | 4299 | updates, both in usage docstrings and in the manual. |
|
4285 | 4300 | |
|
4286 | 4301 | * IPython/Prompts.py (CachedOutput.set_colors): cleanups for |
|
4287 | 4302 | handling of caching. Set minimum acceptabe value for having a |
|
4288 | 4303 | cache at 20 values. |
|
4289 | 4304 | |
|
4290 | 4305 | * IPython/iplib.py (InteractiveShell.user_setup): moved the |
|
4291 | 4306 | install_first_time function to a method, renamed it and added an |
|
4292 | 4307 | 'upgrade' mode. Now people can update their config directory with |
|
4293 | 4308 | a simple command line switch (-upgrade, also new). |
|
4294 | 4309 | |
|
4295 | 4310 | * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to |
|
4296 | 4311 | @file (convenient for automagic users under Python >= 2.2). |
|
4297 | 4312 | Removed @files (it seemed more like a plural than an abbrev. of |
|
4298 | 4313 | 'file show'). |
|
4299 | 4314 | |
|
4300 | 4315 | * IPython/iplib.py (install_first_time): Fixed crash if there were |
|
4301 | 4316 | backup files ('~') in .ipython/ install directory. |
|
4302 | 4317 | |
|
4303 | 4318 | * IPython/ipmaker.py (make_IPython): fixes for new prompt |
|
4304 | 4319 | system. Things look fine, but these changes are fairly |
|
4305 | 4320 | intrusive. Test them for a few days. |
|
4306 | 4321 | |
|
4307 | 4322 | * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of |
|
4308 | 4323 | the prompts system. Now all in/out prompt strings are user |
|
4309 | 4324 | controllable. This is particularly useful for embedding, as one |
|
4310 | 4325 | can tag embedded instances with particular prompts. |
|
4311 | 4326 | |
|
4312 | 4327 | Also removed global use of sys.ps1/2, which now allows nested |
|
4313 | 4328 | embeddings without any problems. Added command-line options for |
|
4314 | 4329 | the prompt strings. |
|
4315 | 4330 | |
|
4316 | 4331 | 2002-03-08 Fernando Perez <fperez@colorado.edu> |
|
4317 | 4332 | |
|
4318 | 4333 | * IPython/UserConfig/example-embed-short.py (ipshell): added |
|
4319 | 4334 | example file with the bare minimum code for embedding. |
|
4320 | 4335 | |
|
4321 | 4336 | * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added |
|
4322 | 4337 | functionality for the embeddable shell to be activated/deactivated |
|
4323 | 4338 | either globally or at each call. |
|
4324 | 4339 | |
|
4325 | 4340 | * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of |
|
4326 | 4341 | rewriting the prompt with '--->' for auto-inputs with proper |
|
4327 | 4342 | coloring. Now the previous UGLY hack in handle_auto() is gone, and |
|
4328 | 4343 | this is handled by the prompts class itself, as it should. |
|
4329 | 4344 | |
|
4330 | 4345 | 2002-03-05 Fernando Perez <fperez@colorado.edu> |
|
4331 | 4346 | |
|
4332 | 4347 | * IPython/Magic.py (Magic.magic_logstart): Changed @log to |
|
4333 | 4348 | @logstart to avoid name clashes with the math log function. |
|
4334 | 4349 | |
|
4335 | 4350 | * Big updates to X/Emacs section of the manual. |
|
4336 | 4351 | |
|
4337 | 4352 | * Removed ipython_emacs. Milan explained to me how to pass |
|
4338 | 4353 | arguments to ipython through Emacs. Some day I'm going to end up |
|
4339 | 4354 | learning some lisp... |
|
4340 | 4355 | |
|
4341 | 4356 | 2002-03-04 Fernando Perez <fperez@colorado.edu> |
|
4342 | 4357 | |
|
4343 | 4358 | * IPython/ipython_emacs: Created script to be used as the |
|
4344 | 4359 | py-python-command Emacs variable so we can pass IPython |
|
4345 | 4360 | parameters. I can't figure out how to tell Emacs directly to pass |
|
4346 | 4361 | parameters to IPython, so a dummy shell script will do it. |
|
4347 | 4362 | |
|
4348 | 4363 | Other enhancements made for things to work better under Emacs' |
|
4349 | 4364 | various types of terminals. Many thanks to Milan Zamazal |
|
4350 | 4365 | <pdm-AT-zamazal.org> for all the suggestions and pointers. |
|
4351 | 4366 | |
|
4352 | 4367 | 2002-03-01 Fernando Perez <fperez@colorado.edu> |
|
4353 | 4368 | |
|
4354 | 4369 | * IPython/ipmaker.py (make_IPython): added a --readline! option so |
|
4355 | 4370 | that loading of readline is now optional. This gives better |
|
4356 | 4371 | control to emacs users. |
|
4357 | 4372 | |
|
4358 | 4373 | * IPython/ultraTB.py (__date__): Modified color escape sequences |
|
4359 | 4374 | and now things work fine under xterm and in Emacs' term buffers |
|
4360 | 4375 | (though not shell ones). Well, in emacs you get colors, but all |
|
4361 | 4376 | seem to be 'light' colors (no difference between dark and light |
|
4362 | 4377 | ones). But the garbage chars are gone, and also in xterms. It |
|
4363 | 4378 | seems that now I'm using 'cleaner' ansi sequences. |
|
4364 | 4379 | |
|
4365 | 4380 | 2002-02-21 Fernando Perez <fperez@colorado.edu> |
|
4366 | 4381 | |
|
4367 | 4382 | * Released 0.2.7 (mainly to publish the scoping fix). |
|
4368 | 4383 | |
|
4369 | 4384 | * IPython/Logger.py (Logger.logstate): added. A corresponding |
|
4370 | 4385 | @logstate magic was created. |
|
4371 | 4386 | |
|
4372 | 4387 | * IPython/Magic.py: fixed nested scoping problem under Python |
|
4373 | 4388 | 2.1.x (automagic wasn't working). |
|
4374 | 4389 | |
|
4375 | 4390 | 2002-02-20 Fernando Perez <fperez@colorado.edu> |
|
4376 | 4391 | |
|
4377 | 4392 | * Released 0.2.6. |
|
4378 | 4393 | |
|
4379 | 4394 | * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet' |
|
4380 | 4395 | option so that logs can come out without any headers at all. |
|
4381 | 4396 | |
|
4382 | 4397 | * IPython/UserConfig/ipythonrc-scipy.py: created a profile for |
|
4383 | 4398 | SciPy. |
|
4384 | 4399 | |
|
4385 | 4400 | * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so |
|
4386 | 4401 | that embedded IPython calls don't require vars() to be explicitly |
|
4387 | 4402 | passed. Now they are extracted from the caller's frame (code |
|
4388 | 4403 | snatched from Eric Jones' weave). Added better documentation to |
|
4389 | 4404 | the section on embedding and the example file. |
|
4390 | 4405 | |
|
4391 | 4406 | * IPython/genutils.py (page): Changed so that under emacs, it just |
|
4392 | 4407 | prints the string. You can then page up and down in the emacs |
|
4393 | 4408 | buffer itself. This is how the builtin help() works. |
|
4394 | 4409 | |
|
4395 | 4410 | * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with |
|
4396 | 4411 | macro scoping: macros need to be executed in the user's namespace |
|
4397 | 4412 | to work as if they had been typed by the user. |
|
4398 | 4413 | |
|
4399 | 4414 | * IPython/Magic.py (Magic.magic_macro): Changed macros so they |
|
4400 | 4415 | execute automatically (no need to type 'exec...'). They then |
|
4401 | 4416 | behave like 'true macros'. The printing system was also modified |
|
4402 | 4417 | for this to work. |
|
4403 | 4418 | |
|
4404 | 4419 | 2002-02-19 Fernando Perez <fperez@colorado.edu> |
|
4405 | 4420 | |
|
4406 | 4421 | * IPython/genutils.py (page_file): new function for paging files |
|
4407 | 4422 | in an OS-independent way. Also necessary for file viewing to work |
|
4408 | 4423 | well inside Emacs buffers. |
|
4409 | 4424 | (page): Added checks for being in an emacs buffer. |
|
4410 | 4425 | (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed |
|
4411 | 4426 | same bug in iplib. |
|
4412 | 4427 | |
|
4413 | 4428 | 2002-02-18 Fernando Perez <fperez@colorado.edu> |
|
4414 | 4429 | |
|
4415 | 4430 | * IPython/iplib.py (InteractiveShell.init_readline): modified use |
|
4416 | 4431 | of readline so that IPython can work inside an Emacs buffer. |
|
4417 | 4432 | |
|
4418 | 4433 | * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to |
|
4419 | 4434 | method signatures (they weren't really bugs, but it looks cleaner |
|
4420 | 4435 | and keeps PyChecker happy). |
|
4421 | 4436 | |
|
4422 | 4437 | * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP |
|
4423 | 4438 | for implementing various user-defined hooks. Currently only |
|
4424 | 4439 | display is done. |
|
4425 | 4440 | |
|
4426 | 4441 | * IPython/Prompts.py (CachedOutput._display): changed display |
|
4427 | 4442 | functions so that they can be dynamically changed by users easily. |
|
4428 | 4443 | |
|
4429 | 4444 | * IPython/Extensions/numeric_formats.py (num_display): added an |
|
4430 | 4445 | extension for printing NumPy arrays in flexible manners. It |
|
4431 | 4446 | doesn't do anything yet, but all the structure is in |
|
4432 | 4447 | place. Ultimately the plan is to implement output format control |
|
4433 | 4448 | like in Octave. |
|
4434 | 4449 | |
|
4435 | 4450 | * IPython/Magic.py (Magic.lsmagic): changed so that bound magic |
|
4436 | 4451 | methods are found at run-time by all the automatic machinery. |
|
4437 | 4452 | |
|
4438 | 4453 | 2002-02-17 Fernando Perez <fperez@colorado.edu> |
|
4439 | 4454 | |
|
4440 | 4455 | * setup_Windows.py (make_shortcut): documented. Cleaned up the |
|
4441 | 4456 | whole file a little. |
|
4442 | 4457 | |
|
4443 | 4458 | * ToDo: closed this document. Now there's a new_design.lyx |
|
4444 | 4459 | document for all new ideas. Added making a pdf of it for the |
|
4445 | 4460 | end-user distro. |
|
4446 | 4461 | |
|
4447 | 4462 | * IPython/Logger.py (Logger.switch_log): Created this to replace |
|
4448 | 4463 | logon() and logoff(). It also fixes a nasty crash reported by |
|
4449 | 4464 | Philip Hisley <compsys-AT-starpower.net>. Many thanks to him. |
|
4450 | 4465 | |
|
4451 | 4466 | * IPython/iplib.py (complete): got auto-completion to work with |
|
4452 | 4467 | automagic (I had wanted this for a long time). |
|
4453 | 4468 | |
|
4454 | 4469 | * IPython/Magic.py (Magic.magic_files): Added @files as an alias |
|
4455 | 4470 | to @file, since file() is now a builtin and clashes with automagic |
|
4456 | 4471 | for @file. |
|
4457 | 4472 | |
|
4458 | 4473 | * Made some new files: Prompts, CrashHandler, Magic, Logger. All |
|
4459 | 4474 | of this was previously in iplib, which had grown to more than 2000 |
|
4460 | 4475 | lines, way too long. No new functionality, but it makes managing |
|
4461 | 4476 | the code a bit easier. |
|
4462 | 4477 | |
|
4463 | 4478 | * IPython/iplib.py (IPythonCrashHandler.__call__): Added version |
|
4464 | 4479 | information to crash reports. |
|
4465 | 4480 | |
|
4466 | 4481 | 2002-02-12 Fernando Perez <fperez@colorado.edu> |
|
4467 | 4482 | |
|
4468 | 4483 | * Released 0.2.5. |
|
4469 | 4484 | |
|
4470 | 4485 | 2002-02-11 Fernando Perez <fperez@colorado.edu> |
|
4471 | 4486 | |
|
4472 | 4487 | * Wrote a relatively complete Windows installer. It puts |
|
4473 | 4488 | everything in place, creates Start Menu entries and fixes the |
|
4474 | 4489 | color issues. Nothing fancy, but it works. |
|
4475 | 4490 | |
|
4476 | 4491 | 2002-02-10 Fernando Perez <fperez@colorado.edu> |
|
4477 | 4492 | |
|
4478 | 4493 | * IPython/iplib.py (InteractiveShell.safe_execfile): added an |
|
4479 | 4494 | os.path.expanduser() call so that we can type @run ~/myfile.py and |
|
4480 | 4495 | have thigs work as expected. |
|
4481 | 4496 | |
|
4482 | 4497 | * IPython/genutils.py (page): fixed exception handling so things |
|
4483 | 4498 | work both in Unix and Windows correctly. Quitting a pager triggers |
|
4484 | 4499 | an IOError/broken pipe in Unix, and in windows not finding a pager |
|
4485 | 4500 | is also an IOError, so I had to actually look at the return value |
|
4486 | 4501 | of the exception, not just the exception itself. Should be ok now. |
|
4487 | 4502 | |
|
4488 | 4503 | * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme): |
|
4489 | 4504 | modified to allow case-insensitive color scheme changes. |
|
4490 | 4505 | |
|
4491 | 4506 | 2002-02-09 Fernando Perez <fperez@colorado.edu> |
|
4492 | 4507 | |
|
4493 | 4508 | * IPython/genutils.py (native_line_ends): new function to leave |
|
4494 | 4509 | user config files with os-native line-endings. |
|
4495 | 4510 | |
|
4496 | 4511 | * README and manual updates. |
|
4497 | 4512 | |
|
4498 | 4513 | * IPython/genutils.py: fixed unicode bug: use types.StringTypes |
|
4499 | 4514 | instead of StringType to catch Unicode strings. |
|
4500 | 4515 | |
|
4501 | 4516 | * IPython/genutils.py (filefind): fixed bug for paths with |
|
4502 | 4517 | embedded spaces (very common in Windows). |
|
4503 | 4518 | |
|
4504 | 4519 | * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc |
|
4505 | 4520 | files under Windows, so that they get automatically associated |
|
4506 | 4521 | with a text editor. Windows makes it a pain to handle |
|
4507 | 4522 | extension-less files. |
|
4508 | 4523 | |
|
4509 | 4524 | * IPython/iplib.py (InteractiveShell.init_readline): Made the |
|
4510 | 4525 | warning about readline only occur for Posix. In Windows there's no |
|
4511 | 4526 | way to get readline, so why bother with the warning. |
|
4512 | 4527 | |
|
4513 | 4528 | * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__ |
|
4514 | 4529 | for __str__ instead of dir(self), since dir() changed in 2.2. |
|
4515 | 4530 | |
|
4516 | 4531 | * Ported to Windows! Tested on XP, I suspect it should work fine |
|
4517 | 4532 | on NT/2000, but I don't think it will work on 98 et al. That |
|
4518 | 4533 | series of Windows is such a piece of junk anyway that I won't try |
|
4519 | 4534 | porting it there. The XP port was straightforward, showed a few |
|
4520 | 4535 | bugs here and there (fixed all), in particular some string |
|
4521 | 4536 | handling stuff which required considering Unicode strings (which |
|
4522 | 4537 | Windows uses). This is good, but hasn't been too tested :) No |
|
4523 | 4538 | fancy installer yet, I'll put a note in the manual so people at |
|
4524 | 4539 | least make manually a shortcut. |
|
4525 | 4540 | |
|
4526 | 4541 | * IPython/iplib.py (Magic.magic_colors): Unified the color options |
|
4527 | 4542 | into a single one, "colors". This now controls both prompt and |
|
4528 | 4543 | exception color schemes, and can be changed both at startup |
|
4529 | 4544 | (either via command-line switches or via ipythonrc files) and at |
|
4530 | 4545 | runtime, with @colors. |
|
4531 | 4546 | (Magic.magic_run): renamed @prun to @run and removed the old |
|
4532 | 4547 | @run. The two were too similar to warrant keeping both. |
|
4533 | 4548 | |
|
4534 | 4549 | 2002-02-03 Fernando Perez <fperez@colorado.edu> |
|
4535 | 4550 | |
|
4536 | 4551 | * IPython/iplib.py (install_first_time): Added comment on how to |
|
4537 | 4552 | configure the color options for first-time users. Put a <return> |
|
4538 | 4553 | request at the end so that small-terminal users get a chance to |
|
4539 | 4554 | read the startup info. |
|
4540 | 4555 | |
|
4541 | 4556 | 2002-01-23 Fernando Perez <fperez@colorado.edu> |
|
4542 | 4557 | |
|
4543 | 4558 | * IPython/iplib.py (CachedOutput.update): Changed output memory |
|
4544 | 4559 | variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For |
|
4545 | 4560 | input history we still use _i. Did this b/c these variable are |
|
4546 | 4561 | very commonly used in interactive work, so the less we need to |
|
4547 | 4562 | type the better off we are. |
|
4548 | 4563 | (Magic.magic_prun): updated @prun to better handle the namespaces |
|
4549 | 4564 | the file will run in, including a fix for __name__ not being set |
|
4550 | 4565 | before. |
|
4551 | 4566 | |
|
4552 | 4567 | 2002-01-20 Fernando Perez <fperez@colorado.edu> |
|
4553 | 4568 | |
|
4554 | 4569 | * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of |
|
4555 | 4570 | extra garbage for Python 2.2. Need to look more carefully into |
|
4556 | 4571 | this later. |
|
4557 | 4572 | |
|
4558 | 4573 | 2002-01-19 Fernando Perez <fperez@colorado.edu> |
|
4559 | 4574 | |
|
4560 | 4575 | * IPython/iplib.py (InteractiveShell.showtraceback): fixed to |
|
4561 | 4576 | display SyntaxError exceptions properly formatted when they occur |
|
4562 | 4577 | (they can be triggered by imported code). |
|
4563 | 4578 | |
|
4564 | 4579 | 2002-01-18 Fernando Perez <fperez@colorado.edu> |
|
4565 | 4580 | |
|
4566 | 4581 | * IPython/iplib.py (InteractiveShell.safe_execfile): now |
|
4567 | 4582 | SyntaxError exceptions are reported nicely formatted, instead of |
|
4568 | 4583 | spitting out only offset information as before. |
|
4569 | 4584 | (Magic.magic_prun): Added the @prun function for executing |
|
4570 | 4585 | programs with command line args inside IPython. |
|
4571 | 4586 | |
|
4572 | 4587 | 2002-01-16 Fernando Perez <fperez@colorado.edu> |
|
4573 | 4588 | |
|
4574 | 4589 | * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist |
|
4575 | 4590 | to *not* include the last item given in a range. This brings their |
|
4576 | 4591 | behavior in line with Python's slicing: |
|
4577 | 4592 | a[n1:n2] -> a[n1]...a[n2-1] |
|
4578 | 4593 | It may be a bit less convenient, but I prefer to stick to Python's |
|
4579 | 4594 | conventions *everywhere*, so users never have to wonder. |
|
4580 | 4595 | (Magic.magic_macro): Added @macro function to ease the creation of |
|
4581 | 4596 | macros. |
|
4582 | 4597 | |
|
4583 | 4598 | 2002-01-05 Fernando Perez <fperez@colorado.edu> |
|
4584 | 4599 | |
|
4585 | 4600 | * Released 0.2.4. |
|
4586 | 4601 | |
|
4587 | 4602 | * IPython/iplib.py (Magic.magic_pdef): |
|
4588 | 4603 | (InteractiveShell.safe_execfile): report magic lines and error |
|
4589 | 4604 | lines without line numbers so one can easily copy/paste them for |
|
4590 | 4605 | re-execution. |
|
4591 | 4606 | |
|
4592 | 4607 | * Updated manual with recent changes. |
|
4593 | 4608 | |
|
4594 | 4609 | * IPython/iplib.py (Magic.magic_oinfo): added constructor |
|
4595 | 4610 | docstring printing when class? is called. Very handy for knowing |
|
4596 | 4611 | how to create class instances (as long as __init__ is well |
|
4597 | 4612 | documented, of course :) |
|
4598 | 4613 | (Magic.magic_doc): print both class and constructor docstrings. |
|
4599 | 4614 | (Magic.magic_pdef): give constructor info if passed a class and |
|
4600 | 4615 | __call__ info for callable object instances. |
|
4601 | 4616 | |
|
4602 | 4617 | 2002-01-04 Fernando Perez <fperez@colorado.edu> |
|
4603 | 4618 | |
|
4604 | 4619 | * Made deep_reload() off by default. It doesn't always work |
|
4605 | 4620 | exactly as intended, so it's probably safer to have it off. It's |
|
4606 | 4621 | still available as dreload() anyway, so nothing is lost. |
|
4607 | 4622 | |
|
4608 | 4623 | 2002-01-02 Fernando Perez <fperez@colorado.edu> |
|
4609 | 4624 | |
|
4610 | 4625 | * Released 0.2.3 (contacted R.Singh at CU about biopython course, |
|
4611 | 4626 | so I wanted an updated release). |
|
4612 | 4627 | |
|
4613 | 4628 | 2001-12-27 Fernando Perez <fperez@colorado.edu> |
|
4614 | 4629 | |
|
4615 | 4630 | * IPython/iplib.py (InteractiveShell.interact): Added the original |
|
4616 | 4631 | code from 'code.py' for this module in order to change the |
|
4617 | 4632 | handling of a KeyboardInterrupt. This was necessary b/c otherwise |
|
4618 | 4633 | the history cache would break when the user hit Ctrl-C, and |
|
4619 | 4634 | interact() offers no way to add any hooks to it. |
|
4620 | 4635 | |
|
4621 | 4636 | 2001-12-23 Fernando Perez <fperez@colorado.edu> |
|
4622 | 4637 | |
|
4623 | 4638 | * setup.py: added check for 'MANIFEST' before trying to remove |
|
4624 | 4639 | it. Thanks to Sean Reifschneider. |
|
4625 | 4640 | |
|
4626 | 4641 | 2001-12-22 Fernando Perez <fperez@colorado.edu> |
|
4627 | 4642 | |
|
4628 | 4643 | * Released 0.2.2. |
|
4629 | 4644 | |
|
4630 | 4645 | * Finished (reasonably) writing the manual. Later will add the |
|
4631 | 4646 | python-standard navigation stylesheets, but for the time being |
|
4632 | 4647 | it's fairly complete. Distribution will include html and pdf |
|
4633 | 4648 | versions. |
|
4634 | 4649 | |
|
4635 | 4650 | * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu |
|
4636 | 4651 | (MayaVi author). |
|
4637 | 4652 | |
|
4638 | 4653 | 2001-12-21 Fernando Perez <fperez@colorado.edu> |
|
4639 | 4654 | |
|
4640 | 4655 | * Released 0.2.1. Barring any nasty bugs, this is it as far as a |
|
4641 | 4656 | good public release, I think (with the manual and the distutils |
|
4642 | 4657 | installer). The manual can use some work, but that can go |
|
4643 | 4658 | slowly. Otherwise I think it's quite nice for end users. Next |
|
4644 | 4659 | summer, rewrite the guts of it... |
|
4645 | 4660 | |
|
4646 | 4661 | * Changed format of ipythonrc files to use whitespace as the |
|
4647 | 4662 | separator instead of an explicit '='. Cleaner. |
|
4648 | 4663 | |
|
4649 | 4664 | 2001-12-20 Fernando Perez <fperez@colorado.edu> |
|
4650 | 4665 | |
|
4651 | 4666 | * Started a manual in LyX. For now it's just a quick merge of the |
|
4652 | 4667 | various internal docstrings and READMEs. Later it may grow into a |
|
4653 | 4668 | nice, full-blown manual. |
|
4654 | 4669 | |
|
4655 | 4670 | * Set up a distutils based installer. Installation should now be |
|
4656 | 4671 | trivially simple for end-users. |
|
4657 | 4672 | |
|
4658 | 4673 | 2001-12-11 Fernando Perez <fperez@colorado.edu> |
|
4659 | 4674 | |
|
4660 | 4675 | * Released 0.2.0. First public release, announced it at |
|
4661 | 4676 | comp.lang.python. From now on, just bugfixes... |
|
4662 | 4677 | |
|
4663 | 4678 | * Went through all the files, set copyright/license notices and |
|
4664 | 4679 | cleaned up things. Ready for release. |
|
4665 | 4680 | |
|
4666 | 4681 | 2001-12-10 Fernando Perez <fperez@colorado.edu> |
|
4667 | 4682 | |
|
4668 | 4683 | * Changed the first-time installer not to use tarfiles. It's more |
|
4669 | 4684 | robust now and less unix-dependent. Also makes it easier for |
|
4670 | 4685 | people to later upgrade versions. |
|
4671 | 4686 | |
|
4672 | 4687 | * Changed @exit to @abort to reflect the fact that it's pretty |
|
4673 | 4688 | brutal (a sys.exit()). The difference between @abort and Ctrl-D |
|
4674 | 4689 | becomes significant only when IPyhton is embedded: in that case, |
|
4675 | 4690 | C-D closes IPython only, but @abort kills the enclosing program |
|
4676 | 4691 | too (unless it had called IPython inside a try catching |
|
4677 | 4692 | SystemExit). |
|
4678 | 4693 | |
|
4679 | 4694 | * Created Shell module which exposes the actuall IPython Shell |
|
4680 | 4695 | classes, currently the normal and the embeddable one. This at |
|
4681 | 4696 | least offers a stable interface we won't need to change when |
|
4682 | 4697 | (later) the internals are rewritten. That rewrite will be confined |
|
4683 | 4698 | to iplib and ipmaker, but the Shell interface should remain as is. |
|
4684 | 4699 | |
|
4685 | 4700 | * Added embed module which offers an embeddable IPShell object, |
|
4686 | 4701 | useful to fire up IPython *inside* a running program. Great for |
|
4687 | 4702 | debugging or dynamical data analysis. |
|
4688 | 4703 | |
|
4689 | 4704 | 2001-12-08 Fernando Perez <fperez@colorado.edu> |
|
4690 | 4705 | |
|
4691 | 4706 | * Fixed small bug preventing seeing info from methods of defined |
|
4692 | 4707 | objects (incorrect namespace in _ofind()). |
|
4693 | 4708 | |
|
4694 | 4709 | * Documentation cleanup. Moved the main usage docstrings to a |
|
4695 | 4710 | separate file, usage.py (cleaner to maintain, and hopefully in the |
|
4696 | 4711 | future some perlpod-like way of producing interactive, man and |
|
4697 | 4712 | html docs out of it will be found). |
|
4698 | 4713 | |
|
4699 | 4714 | * Added @profile to see your profile at any time. |
|
4700 | 4715 | |
|
4701 | 4716 | * Added @p as an alias for 'print'. It's especially convenient if |
|
4702 | 4717 | using automagic ('p x' prints x). |
|
4703 | 4718 | |
|
4704 | 4719 | * Small cleanups and fixes after a pychecker run. |
|
4705 | 4720 | |
|
4706 | 4721 | * Changed the @cd command to handle @cd - and @cd -<n> for |
|
4707 | 4722 | visiting any directory in _dh. |
|
4708 | 4723 | |
|
4709 | 4724 | * Introduced _dh, a history of visited directories. @dhist prints |
|
4710 | 4725 | it out with numbers. |
|
4711 | 4726 | |
|
4712 | 4727 | 2001-12-07 Fernando Perez <fperez@colorado.edu> |
|
4713 | 4728 | |
|
4714 | 4729 | * Released 0.1.22 |
|
4715 | 4730 | |
|
4716 | 4731 | * Made initialization a bit more robust against invalid color |
|
4717 | 4732 | options in user input (exit, not traceback-crash). |
|
4718 | 4733 | |
|
4719 | 4734 | * Changed the bug crash reporter to write the report only in the |
|
4720 | 4735 | user's .ipython directory. That way IPython won't litter people's |
|
4721 | 4736 | hard disks with crash files all over the place. Also print on |
|
4722 | 4737 | screen the necessary mail command. |
|
4723 | 4738 | |
|
4724 | 4739 | * With the new ultraTB, implemented LightBG color scheme for light |
|
4725 | 4740 | background terminals. A lot of people like white backgrounds, so I |
|
4726 | 4741 | guess we should at least give them something readable. |
|
4727 | 4742 | |
|
4728 | 4743 | 2001-12-06 Fernando Perez <fperez@colorado.edu> |
|
4729 | 4744 | |
|
4730 | 4745 | * Modified the structure of ultraTB. Now there's a proper class |
|
4731 | 4746 | for tables of color schemes which allow adding schemes easily and |
|
4732 | 4747 | switching the active scheme without creating a new instance every |
|
4733 | 4748 | time (which was ridiculous). The syntax for creating new schemes |
|
4734 | 4749 | is also cleaner. I think ultraTB is finally done, with a clean |
|
4735 | 4750 | class structure. Names are also much cleaner (now there's proper |
|
4736 | 4751 | color tables, no need for every variable to also have 'color' in |
|
4737 | 4752 | its name). |
|
4738 | 4753 | |
|
4739 | 4754 | * Broke down genutils into separate files. Now genutils only |
|
4740 | 4755 | contains utility functions, and classes have been moved to their |
|
4741 | 4756 | own files (they had enough independent functionality to warrant |
|
4742 | 4757 | it): ConfigLoader, OutputTrap, Struct. |
|
4743 | 4758 | |
|
4744 | 4759 | 2001-12-05 Fernando Perez <fperez@colorado.edu> |
|
4745 | 4760 | |
|
4746 | 4761 | * IPython turns 21! Released version 0.1.21, as a candidate for |
|
4747 | 4762 | public consumption. If all goes well, release in a few days. |
|
4748 | 4763 | |
|
4749 | 4764 | * Fixed path bug (files in Extensions/ directory wouldn't be found |
|
4750 | 4765 | unless IPython/ was explicitly in sys.path). |
|
4751 | 4766 | |
|
4752 | 4767 | * Extended the FlexCompleter class as MagicCompleter to allow |
|
4753 | 4768 | completion of @-starting lines. |
|
4754 | 4769 | |
|
4755 | 4770 | * Created __release__.py file as a central repository for release |
|
4756 | 4771 | info that other files can read from. |
|
4757 | 4772 | |
|
4758 | 4773 | * Fixed small bug in logging: when logging was turned on in |
|
4759 | 4774 | mid-session, old lines with special meanings (!@?) were being |
|
4760 | 4775 | logged without the prepended comment, which is necessary since |
|
4761 | 4776 | they are not truly valid python syntax. This should make session |
|
4762 | 4777 | restores produce less errors. |
|
4763 | 4778 | |
|
4764 | 4779 | * The namespace cleanup forced me to make a FlexCompleter class |
|
4765 | 4780 | which is nothing but a ripoff of rlcompleter, but with selectable |
|
4766 | 4781 | namespace (rlcompleter only works in __main__.__dict__). I'll try |
|
4767 | 4782 | to submit a note to the authors to see if this change can be |
|
4768 | 4783 | incorporated in future rlcompleter releases (Dec.6: done) |
|
4769 | 4784 | |
|
4770 | 4785 | * More fixes to namespace handling. It was a mess! Now all |
|
4771 | 4786 | explicit references to __main__.__dict__ are gone (except when |
|
4772 | 4787 | really needed) and everything is handled through the namespace |
|
4773 | 4788 | dicts in the IPython instance. We seem to be getting somewhere |
|
4774 | 4789 | with this, finally... |
|
4775 | 4790 | |
|
4776 | 4791 | * Small documentation updates. |
|
4777 | 4792 | |
|
4778 | 4793 | * Created the Extensions directory under IPython (with an |
|
4779 | 4794 | __init__.py). Put the PhysicalQ stuff there. This directory should |
|
4780 | 4795 | be used for all special-purpose extensions. |
|
4781 | 4796 | |
|
4782 | 4797 | * File renaming: |
|
4783 | 4798 | ipythonlib --> ipmaker |
|
4784 | 4799 | ipplib --> iplib |
|
4785 | 4800 | This makes a bit more sense in terms of what these files actually do. |
|
4786 | 4801 | |
|
4787 | 4802 | * Moved all the classes and functions in ipythonlib to ipplib, so |
|
4788 | 4803 | now ipythonlib only has make_IPython(). This will ease up its |
|
4789 | 4804 | splitting in smaller functional chunks later. |
|
4790 | 4805 | |
|
4791 | 4806 | * Cleaned up (done, I think) output of @whos. Better column |
|
4792 | 4807 | formatting, and now shows str(var) for as much as it can, which is |
|
4793 | 4808 | typically what one gets with a 'print var'. |
|
4794 | 4809 | |
|
4795 | 4810 | 2001-12-04 Fernando Perez <fperez@colorado.edu> |
|
4796 | 4811 | |
|
4797 | 4812 | * Fixed namespace problems. Now builtin/IPyhton/user names get |
|
4798 | 4813 | properly reported in their namespace. Internal namespace handling |
|
4799 | 4814 | is finally getting decent (not perfect yet, but much better than |
|
4800 | 4815 | the ad-hoc mess we had). |
|
4801 | 4816 | |
|
4802 | 4817 | * Removed -exit option. If people just want to run a python |
|
4803 | 4818 | script, that's what the normal interpreter is for. Less |
|
4804 | 4819 | unnecessary options, less chances for bugs. |
|
4805 | 4820 | |
|
4806 | 4821 | * Added a crash handler which generates a complete post-mortem if |
|
4807 | 4822 | IPython crashes. This will help a lot in tracking bugs down the |
|
4808 | 4823 | road. |
|
4809 | 4824 | |
|
4810 | 4825 | * Fixed nasty bug in auto-evaluation part of prefilter(). Names |
|
4811 | 4826 | which were boud to functions being reassigned would bypass the |
|
4812 | 4827 | logger, breaking the sync of _il with the prompt counter. This |
|
4813 | 4828 | would then crash IPython later when a new line was logged. |
|
4814 | 4829 | |
|
4815 | 4830 | 2001-12-02 Fernando Perez <fperez@colorado.edu> |
|
4816 | 4831 | |
|
4817 | 4832 | * Made IPython a package. This means people don't have to clutter |
|
4818 | 4833 | their sys.path with yet another directory. Changed the INSTALL |
|
4819 | 4834 | file accordingly. |
|
4820 | 4835 | |
|
4821 | 4836 | * Cleaned up the output of @who_ls, @who and @whos. @who_ls now |
|
4822 | 4837 | sorts its output (so @who shows it sorted) and @whos formats the |
|
4823 | 4838 | table according to the width of the first column. Nicer, easier to |
|
4824 | 4839 | read. Todo: write a generic table_format() which takes a list of |
|
4825 | 4840 | lists and prints it nicely formatted, with optional row/column |
|
4826 | 4841 | separators and proper padding and justification. |
|
4827 | 4842 | |
|
4828 | 4843 | * Released 0.1.20 |
|
4829 | 4844 | |
|
4830 | 4845 | * Fixed bug in @log which would reverse the inputcache list (a |
|
4831 | 4846 | copy operation was missing). |
|
4832 | 4847 | |
|
4833 | 4848 | * Code cleanup. @config was changed to use page(). Better, since |
|
4834 | 4849 | its output is always quite long. |
|
4835 | 4850 | |
|
4836 | 4851 | * Itpl is back as a dependency. I was having too many problems |
|
4837 | 4852 | getting the parametric aliases to work reliably, and it's just |
|
4838 | 4853 | easier to code weird string operations with it than playing %()s |
|
4839 | 4854 | games. It's only ~6k, so I don't think it's too big a deal. |
|
4840 | 4855 | |
|
4841 | 4856 | * Found (and fixed) a very nasty bug with history. !lines weren't |
|
4842 | 4857 | getting cached, and the out of sync caches would crash |
|
4843 | 4858 | IPython. Fixed it by reorganizing the prefilter/handlers/logger |
|
4844 | 4859 | division of labor a bit better. Bug fixed, cleaner structure. |
|
4845 | 4860 | |
|
4846 | 4861 | 2001-12-01 Fernando Perez <fperez@colorado.edu> |
|
4847 | 4862 | |
|
4848 | 4863 | * Released 0.1.19 |
|
4849 | 4864 | |
|
4850 | 4865 | * Added option -n to @hist to prevent line number printing. Much |
|
4851 | 4866 | easier to copy/paste code this way. |
|
4852 | 4867 | |
|
4853 | 4868 | * Created global _il to hold the input list. Allows easy |
|
4854 | 4869 | re-execution of blocks of code by slicing it (inspired by Janko's |
|
4855 | 4870 | comment on 'macros'). |
|
4856 | 4871 | |
|
4857 | 4872 | * Small fixes and doc updates. |
|
4858 | 4873 | |
|
4859 | 4874 | * Rewrote @history function (was @h). Renamed it to @hist, @h is |
|
4860 | 4875 | much too fragile with automagic. Handles properly multi-line |
|
4861 | 4876 | statements and takes parameters. |
|
4862 | 4877 | |
|
4863 | 4878 | 2001-11-30 Fernando Perez <fperez@colorado.edu> |
|
4864 | 4879 | |
|
4865 | 4880 | * Version 0.1.18 released. |
|
4866 | 4881 | |
|
4867 | 4882 | * Fixed nasty namespace bug in initial module imports. |
|
4868 | 4883 | |
|
4869 | 4884 | * Added copyright/license notes to all code files (except |
|
4870 | 4885 | DPyGetOpt). For the time being, LGPL. That could change. |
|
4871 | 4886 | |
|
4872 | 4887 | * Rewrote a much nicer README, updated INSTALL, cleaned up |
|
4873 | 4888 | ipythonrc-* samples. |
|
4874 | 4889 | |
|
4875 | 4890 | * Overall code/documentation cleanup. Basically ready for |
|
4876 | 4891 | release. Only remaining thing: licence decision (LGPL?). |
|
4877 | 4892 | |
|
4878 | 4893 | * Converted load_config to a class, ConfigLoader. Now recursion |
|
4879 | 4894 | control is better organized. Doesn't include the same file twice. |
|
4880 | 4895 | |
|
4881 | 4896 | 2001-11-29 Fernando Perez <fperez@colorado.edu> |
|
4882 | 4897 | |
|
4883 | 4898 | * Got input history working. Changed output history variables from |
|
4884 | 4899 | _p to _o so that _i is for input and _o for output. Just cleaner |
|
4885 | 4900 | convention. |
|
4886 | 4901 | |
|
4887 | 4902 | * Implemented parametric aliases. This pretty much allows the |
|
4888 | 4903 | alias system to offer full-blown shell convenience, I think. |
|
4889 | 4904 | |
|
4890 | 4905 | * Version 0.1.17 released, 0.1.18 opened. |
|
4891 | 4906 | |
|
4892 | 4907 | * dot_ipython/ipythonrc (alias): added documentation. |
|
4893 | 4908 | (xcolor): Fixed small bug (xcolors -> xcolor) |
|
4894 | 4909 | |
|
4895 | 4910 | * Changed the alias system. Now alias is a magic command to define |
|
4896 | 4911 | aliases just like the shell. Rationale: the builtin magics should |
|
4897 | 4912 | be there for things deeply connected to IPython's |
|
4898 | 4913 | architecture. And this is a much lighter system for what I think |
|
4899 | 4914 | is the really important feature: allowing users to define quickly |
|
4900 | 4915 | magics that will do shell things for them, so they can customize |
|
4901 | 4916 | IPython easily to match their work habits. If someone is really |
|
4902 | 4917 | desperate to have another name for a builtin alias, they can |
|
4903 | 4918 | always use __IP.magic_newname = __IP.magic_oldname. Hackish but |
|
4904 | 4919 | works. |
|
4905 | 4920 | |
|
4906 | 4921 | 2001-11-28 Fernando Perez <fperez@colorado.edu> |
|
4907 | 4922 | |
|
4908 | 4923 | * Changed @file so that it opens the source file at the proper |
|
4909 | 4924 | line. Since it uses less, if your EDITOR environment is |
|
4910 | 4925 | configured, typing v will immediately open your editor of choice |
|
4911 | 4926 | right at the line where the object is defined. Not as quick as |
|
4912 | 4927 | having a direct @edit command, but for all intents and purposes it |
|
4913 | 4928 | works. And I don't have to worry about writing @edit to deal with |
|
4914 | 4929 | all the editors, less does that. |
|
4915 | 4930 | |
|
4916 | 4931 | * Version 0.1.16 released, 0.1.17 opened. |
|
4917 | 4932 | |
|
4918 | 4933 | * Fixed some nasty bugs in the page/page_dumb combo that could |
|
4919 | 4934 | crash IPython. |
|
4920 | 4935 | |
|
4921 | 4936 | 2001-11-27 Fernando Perez <fperez@colorado.edu> |
|
4922 | 4937 | |
|
4923 | 4938 | * Version 0.1.15 released, 0.1.16 opened. |
|
4924 | 4939 | |
|
4925 | 4940 | * Finally got ? and ?? to work for undefined things: now it's |
|
4926 | 4941 | possible to type {}.get? and get information about the get method |
|
4927 | 4942 | of dicts, or os.path? even if only os is defined (so technically |
|
4928 | 4943 | os.path isn't). Works at any level. For example, after import os, |
|
4929 | 4944 | os?, os.path?, os.path.abspath? all work. This is great, took some |
|
4930 | 4945 | work in _ofind. |
|
4931 | 4946 | |
|
4932 | 4947 | * Fixed more bugs with logging. The sanest way to do it was to add |
|
4933 | 4948 | to @log a 'mode' parameter. Killed two in one shot (this mode |
|
4934 | 4949 | option was a request of Janko's). I think it's finally clean |
|
4935 | 4950 | (famous last words). |
|
4936 | 4951 | |
|
4937 | 4952 | * Added a page_dumb() pager which does a decent job of paging on |
|
4938 | 4953 | screen, if better things (like less) aren't available. One less |
|
4939 | 4954 | unix dependency (someday maybe somebody will port this to |
|
4940 | 4955 | windows). |
|
4941 | 4956 | |
|
4942 | 4957 | * Fixed problem in magic_log: would lock of logging out if log |
|
4943 | 4958 | creation failed (because it would still think it had succeeded). |
|
4944 | 4959 | |
|
4945 | 4960 | * Improved the page() function using curses to auto-detect screen |
|
4946 | 4961 | size. Now it can make a much better decision on whether to print |
|
4947 | 4962 | or page a string. Option screen_length was modified: a value 0 |
|
4948 | 4963 | means auto-detect, and that's the default now. |
|
4949 | 4964 | |
|
4950 | 4965 | * Version 0.1.14 released, 0.1.15 opened. I think this is ready to |
|
4951 | 4966 | go out. I'll test it for a few days, then talk to Janko about |
|
4952 | 4967 | licences and announce it. |
|
4953 | 4968 | |
|
4954 | 4969 | * Fixed the length of the auto-generated ---> prompt which appears |
|
4955 | 4970 | for auto-parens and auto-quotes. Getting this right isn't trivial, |
|
4956 | 4971 | with all the color escapes, different prompt types and optional |
|
4957 | 4972 | separators. But it seems to be working in all the combinations. |
|
4958 | 4973 | |
|
4959 | 4974 | 2001-11-26 Fernando Perez <fperez@colorado.edu> |
|
4960 | 4975 | |
|
4961 | 4976 | * Wrote a regexp filter to get option types from the option names |
|
4962 | 4977 | string. This eliminates the need to manually keep two duplicate |
|
4963 | 4978 | lists. |
|
4964 | 4979 | |
|
4965 | 4980 | * Removed the unneeded check_option_names. Now options are handled |
|
4966 | 4981 | in a much saner manner and it's easy to visually check that things |
|
4967 | 4982 | are ok. |
|
4968 | 4983 | |
|
4969 | 4984 | * Updated version numbers on all files I modified to carry a |
|
4970 | 4985 | notice so Janko and Nathan have clear version markers. |
|
4971 | 4986 | |
|
4972 | 4987 | * Updated docstring for ultraTB with my changes. I should send |
|
4973 | 4988 | this to Nathan. |
|
4974 | 4989 | |
|
4975 | 4990 | * Lots of small fixes. Ran everything through pychecker again. |
|
4976 | 4991 | |
|
4977 | 4992 | * Made loading of deep_reload an cmd line option. If it's not too |
|
4978 | 4993 | kosher, now people can just disable it. With -nodeep_reload it's |
|
4979 | 4994 | still available as dreload(), it just won't overwrite reload(). |
|
4980 | 4995 | |
|
4981 | 4996 | * Moved many options to the no| form (-opt and -noopt |
|
4982 | 4997 | accepted). Cleaner. |
|
4983 | 4998 | |
|
4984 | 4999 | * Changed magic_log so that if called with no parameters, it uses |
|
4985 | 5000 | 'rotate' mode. That way auto-generated logs aren't automatically |
|
4986 | 5001 | over-written. For normal logs, now a backup is made if it exists |
|
4987 | 5002 | (only 1 level of backups). A new 'backup' mode was added to the |
|
4988 | 5003 | Logger class to support this. This was a request by Janko. |
|
4989 | 5004 | |
|
4990 | 5005 | * Added @logoff/@logon to stop/restart an active log. |
|
4991 | 5006 | |
|
4992 | 5007 | * Fixed a lot of bugs in log saving/replay. It was pretty |
|
4993 | 5008 | broken. Now special lines (!@,/) appear properly in the command |
|
4994 | 5009 | history after a log replay. |
|
4995 | 5010 | |
|
4996 | 5011 | * Tried and failed to implement full session saving via pickle. My |
|
4997 | 5012 | idea was to pickle __main__.__dict__, but modules can't be |
|
4998 | 5013 | pickled. This would be a better alternative to replaying logs, but |
|
4999 | 5014 | seems quite tricky to get to work. Changed -session to be called |
|
5000 | 5015 | -logplay, which more accurately reflects what it does. And if we |
|
5001 | 5016 | ever get real session saving working, -session is now available. |
|
5002 | 5017 | |
|
5003 | 5018 | * Implemented color schemes for prompts also. As for tracebacks, |
|
5004 | 5019 | currently only NoColor and Linux are supported. But now the |
|
5005 | 5020 | infrastructure is in place, based on a generic ColorScheme |
|
5006 | 5021 | class. So writing and activating new schemes both for the prompts |
|
5007 | 5022 | and the tracebacks should be straightforward. |
|
5008 | 5023 | |
|
5009 | 5024 | * Version 0.1.13 released, 0.1.14 opened. |
|
5010 | 5025 | |
|
5011 | 5026 | * Changed handling of options for output cache. Now counter is |
|
5012 | 5027 | hardwired starting at 1 and one specifies the maximum number of |
|
5013 | 5028 | entries *in the outcache* (not the max prompt counter). This is |
|
5014 | 5029 | much better, since many statements won't increase the cache |
|
5015 | 5030 | count. It also eliminated some confusing options, now there's only |
|
5016 | 5031 | one: cache_size. |
|
5017 | 5032 | |
|
5018 | 5033 | * Added 'alias' magic function and magic_alias option in the |
|
5019 | 5034 | ipythonrc file. Now the user can easily define whatever names he |
|
5020 | 5035 | wants for the magic functions without having to play weird |
|
5021 | 5036 | namespace games. This gives IPython a real shell-like feel. |
|
5022 | 5037 | |
|
5023 | 5038 | * Fixed doc/?/?? for magics. Now all work, in all forms (explicit |
|
5024 | 5039 | @ or not). |
|
5025 | 5040 | |
|
5026 | 5041 | This was one of the last remaining 'visible' bugs (that I know |
|
5027 | 5042 | of). I think if I can clean up the session loading so it works |
|
5028 | 5043 | 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first |
|
5029 | 5044 | about licensing). |
|
5030 | 5045 | |
|
5031 | 5046 | 2001-11-25 Fernando Perez <fperez@colorado.edu> |
|
5032 | 5047 | |
|
5033 | 5048 | * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and |
|
5034 | 5049 | there's a cleaner distinction between what ? and ?? show. |
|
5035 | 5050 | |
|
5036 | 5051 | * Added screen_length option. Now the user can define his own |
|
5037 | 5052 | screen size for page() operations. |
|
5038 | 5053 | |
|
5039 | 5054 | * Implemented magic shell-like functions with automatic code |
|
5040 | 5055 | generation. Now adding another function is just a matter of adding |
|
5041 | 5056 | an entry to a dict, and the function is dynamically generated at |
|
5042 | 5057 | run-time. Python has some really cool features! |
|
5043 | 5058 | |
|
5044 | 5059 | * Renamed many options to cleanup conventions a little. Now all |
|
5045 | 5060 | are lowercase, and only underscores where needed. Also in the code |
|
5046 | 5061 | option name tables are clearer. |
|
5047 | 5062 | |
|
5048 | 5063 | * Changed prompts a little. Now input is 'In [n]:' instead of |
|
5049 | 5064 | 'In[n]:='. This allows it the numbers to be aligned with the |
|
5050 | 5065 | Out[n] numbers, and removes usage of ':=' which doesn't exist in |
|
5051 | 5066 | Python (it was a Mathematica thing). The '...' continuation prompt |
|
5052 | 5067 | was also changed a little to align better. |
|
5053 | 5068 | |
|
5054 | 5069 | * Fixed bug when flushing output cache. Not all _p<n> variables |
|
5055 | 5070 | exist, so their deletion needs to be wrapped in a try: |
|
5056 | 5071 | |
|
5057 | 5072 | * Figured out how to properly use inspect.formatargspec() (it |
|
5058 | 5073 | requires the args preceded by *). So I removed all the code from |
|
5059 | 5074 | _get_pdef in Magic, which was just replicating that. |
|
5060 | 5075 | |
|
5061 | 5076 | * Added test to prefilter to allow redefining magic function names |
|
5062 | 5077 | as variables. This is ok, since the @ form is always available, |
|
5063 | 5078 | but whe should allow the user to define a variable called 'ls' if |
|
5064 | 5079 | he needs it. |
|
5065 | 5080 | |
|
5066 | 5081 | * Moved the ToDo information from README into a separate ToDo. |
|
5067 | 5082 | |
|
5068 | 5083 | * General code cleanup and small bugfixes. I think it's close to a |
|
5069 | 5084 | state where it can be released, obviously with a big 'beta' |
|
5070 | 5085 | warning on it. |
|
5071 | 5086 | |
|
5072 | 5087 | * Got the magic function split to work. Now all magics are defined |
|
5073 | 5088 | in a separate class. It just organizes things a bit, and now |
|
5074 | 5089 | Xemacs behaves nicer (it was choking on InteractiveShell b/c it |
|
5075 | 5090 | was too long). |
|
5076 | 5091 | |
|
5077 | 5092 | * Changed @clear to @reset to avoid potential confusions with |
|
5078 | 5093 | the shell command clear. Also renamed @cl to @clear, which does |
|
5079 | 5094 | exactly what people expect it to from their shell experience. |
|
5080 | 5095 | |
|
5081 | 5096 | Added a check to the @reset command (since it's so |
|
5082 | 5097 | destructive, it's probably a good idea to ask for confirmation). |
|
5083 | 5098 | But now reset only works for full namespace resetting. Since the |
|
5084 | 5099 | del keyword is already there for deleting a few specific |
|
5085 | 5100 | variables, I don't see the point of having a redundant magic |
|
5086 | 5101 | function for the same task. |
|
5087 | 5102 | |
|
5088 | 5103 | 2001-11-24 Fernando Perez <fperez@colorado.edu> |
|
5089 | 5104 | |
|
5090 | 5105 | * Updated the builtin docs (esp. the ? ones). |
|
5091 | 5106 | |
|
5092 | 5107 | * Ran all the code through pychecker. Not terribly impressed with |
|
5093 | 5108 | it: lots of spurious warnings and didn't really find anything of |
|
5094 | 5109 | substance (just a few modules being imported and not used). |
|
5095 | 5110 | |
|
5096 | 5111 | * Implemented the new ultraTB functionality into IPython. New |
|
5097 | 5112 | option: xcolors. This chooses color scheme. xmode now only selects |
|
5098 | 5113 | between Plain and Verbose. Better orthogonality. |
|
5099 | 5114 | |
|
5100 | 5115 | * Large rewrite of ultraTB. Much cleaner now, with a separation of |
|
5101 | 5116 | mode and color scheme for the exception handlers. Now it's |
|
5102 | 5117 | possible to have the verbose traceback with no coloring. |
|
5103 | 5118 | |
|
5104 | 5119 | 2001-11-23 Fernando Perez <fperez@colorado.edu> |
|
5105 | 5120 | |
|
5106 | 5121 | * Version 0.1.12 released, 0.1.13 opened. |
|
5107 | 5122 | |
|
5108 | 5123 | * Removed option to set auto-quote and auto-paren escapes by |
|
5109 | 5124 | user. The chances of breaking valid syntax are just too high. If |
|
5110 | 5125 | someone *really* wants, they can always dig into the code. |
|
5111 | 5126 | |
|
5112 | 5127 | * Made prompt separators configurable. |
|
5113 | 5128 | |
|
5114 | 5129 | 2001-11-22 Fernando Perez <fperez@colorado.edu> |
|
5115 | 5130 | |
|
5116 | 5131 | * Small bugfixes in many places. |
|
5117 | 5132 | |
|
5118 | 5133 | * Removed the MyCompleter class from ipplib. It seemed redundant |
|
5119 | 5134 | with the C-p,C-n history search functionality. Less code to |
|
5120 | 5135 | maintain. |
|
5121 | 5136 | |
|
5122 | 5137 | * Moved all the original ipython.py code into ipythonlib.py. Right |
|
5123 | 5138 | now it's just one big dump into a function called make_IPython, so |
|
5124 | 5139 | no real modularity has been gained. But at least it makes the |
|
5125 | 5140 | wrapper script tiny, and since ipythonlib is a module, it gets |
|
5126 | 5141 | compiled and startup is much faster. |
|
5127 | 5142 | |
|
5128 | 5143 | This is a reasobably 'deep' change, so we should test it for a |
|
5129 | 5144 | while without messing too much more with the code. |
|
5130 | 5145 | |
|
5131 | 5146 | 2001-11-21 Fernando Perez <fperez@colorado.edu> |
|
5132 | 5147 | |
|
5133 | 5148 | * Version 0.1.11 released, 0.1.12 opened for further work. |
|
5134 | 5149 | |
|
5135 | 5150 | * Removed dependency on Itpl. It was only needed in one place. It |
|
5136 | 5151 | would be nice if this became part of python, though. It makes life |
|
5137 | 5152 | *a lot* easier in some cases. |
|
5138 | 5153 | |
|
5139 | 5154 | * Simplified the prefilter code a bit. Now all handlers are |
|
5140 | 5155 | expected to explicitly return a value (at least a blank string). |
|
5141 | 5156 | |
|
5142 | 5157 | * Heavy edits in ipplib. Removed the help system altogether. Now |
|
5143 | 5158 | obj?/?? is used for inspecting objects, a magic @doc prints |
|
5144 | 5159 | docstrings, and full-blown Python help is accessed via the 'help' |
|
5145 | 5160 | keyword. This cleans up a lot of code (less to maintain) and does |
|
5146 | 5161 | the job. Since 'help' is now a standard Python component, might as |
|
5147 | 5162 | well use it and remove duplicate functionality. |
|
5148 | 5163 | |
|
5149 | 5164 | Also removed the option to use ipplib as a standalone program. By |
|
5150 | 5165 | now it's too dependent on other parts of IPython to function alone. |
|
5151 | 5166 | |
|
5152 | 5167 | * Fixed bug in genutils.pager. It would crash if the pager was |
|
5153 | 5168 | exited immediately after opening (broken pipe). |
|
5154 | 5169 | |
|
5155 | 5170 | * Trimmed down the VerboseTB reporting a little. The header is |
|
5156 | 5171 | much shorter now and the repeated exception arguments at the end |
|
5157 | 5172 | have been removed. For interactive use the old header seemed a bit |
|
5158 | 5173 | excessive. |
|
5159 | 5174 | |
|
5160 | 5175 | * Fixed small bug in output of @whos for variables with multi-word |
|
5161 | 5176 | types (only first word was displayed). |
|
5162 | 5177 | |
|
5163 | 5178 | 2001-11-17 Fernando Perez <fperez@colorado.edu> |
|
5164 | 5179 | |
|
5165 | 5180 | * Version 0.1.10 released, 0.1.11 opened for further work. |
|
5166 | 5181 | |
|
5167 | 5182 | * Modified dirs and friends. dirs now *returns* the stack (not |
|
5168 | 5183 | prints), so one can manipulate it as a variable. Convenient to |
|
5169 | 5184 | travel along many directories. |
|
5170 | 5185 | |
|
5171 | 5186 | * Fixed bug in magic_pdef: would only work with functions with |
|
5172 | 5187 | arguments with default values. |
|
5173 | 5188 | |
|
5174 | 5189 | 2001-11-14 Fernando Perez <fperez@colorado.edu> |
|
5175 | 5190 | |
|
5176 | 5191 | * Added the PhysicsInput stuff to dot_ipython so it ships as an |
|
5177 | 5192 | example with IPython. Various other minor fixes and cleanups. |
|
5178 | 5193 | |
|
5179 | 5194 | * Version 0.1.9 released, 0.1.10 opened for further work. |
|
5180 | 5195 | |
|
5181 | 5196 | * Added sys.path to the list of directories searched in the |
|
5182 | 5197 | execfile= option. It used to be the current directory and the |
|
5183 | 5198 | user's IPYTHONDIR only. |
|
5184 | 5199 | |
|
5185 | 5200 | 2001-11-13 Fernando Perez <fperez@colorado.edu> |
|
5186 | 5201 | |
|
5187 | 5202 | * Reinstated the raw_input/prefilter separation that Janko had |
|
5188 | 5203 | initially. This gives a more convenient setup for extending the |
|
5189 | 5204 | pre-processor from the outside: raw_input always gets a string, |
|
5190 | 5205 | and prefilter has to process it. We can then redefine prefilter |
|
5191 | 5206 | from the outside and implement extensions for special |
|
5192 | 5207 | purposes. |
|
5193 | 5208 | |
|
5194 | 5209 | Today I got one for inputting PhysicalQuantity objects |
|
5195 | 5210 | (from Scientific) without needing any function calls at |
|
5196 | 5211 | all. Extremely convenient, and it's all done as a user-level |
|
5197 | 5212 | extension (no IPython code was touched). Now instead of: |
|
5198 | 5213 | a = PhysicalQuantity(4.2,'m/s**2') |
|
5199 | 5214 | one can simply say |
|
5200 | 5215 | a = 4.2 m/s**2 |
|
5201 | 5216 | or even |
|
5202 | 5217 | a = 4.2 m/s^2 |
|
5203 | 5218 | |
|
5204 | 5219 | I use this, but it's also a proof of concept: IPython really is |
|
5205 | 5220 | fully user-extensible, even at the level of the parsing of the |
|
5206 | 5221 | command line. It's not trivial, but it's perfectly doable. |
|
5207 | 5222 | |
|
5208 | 5223 | * Added 'add_flip' method to inclusion conflict resolver. Fixes |
|
5209 | 5224 | the problem of modules being loaded in the inverse order in which |
|
5210 | 5225 | they were defined in |
|
5211 | 5226 | |
|
5212 | 5227 | * Version 0.1.8 released, 0.1.9 opened for further work. |
|
5213 | 5228 | |
|
5214 | 5229 | * Added magics pdef, source and file. They respectively show the |
|
5215 | 5230 | definition line ('prototype' in C), source code and full python |
|
5216 | 5231 | file for any callable object. The object inspector oinfo uses |
|
5217 | 5232 | these to show the same information. |
|
5218 | 5233 | |
|
5219 | 5234 | * Version 0.1.7 released, 0.1.8 opened for further work. |
|
5220 | 5235 | |
|
5221 | 5236 | * Separated all the magic functions into a class called Magic. The |
|
5222 | 5237 | InteractiveShell class was becoming too big for Xemacs to handle |
|
5223 | 5238 | (de-indenting a line would lock it up for 10 seconds while it |
|
5224 | 5239 | backtracked on the whole class!) |
|
5225 | 5240 | |
|
5226 | 5241 | FIXME: didn't work. It can be done, but right now namespaces are |
|
5227 | 5242 | all messed up. Do it later (reverted it for now, so at least |
|
5228 | 5243 | everything works as before). |
|
5229 | 5244 | |
|
5230 | 5245 | * Got the object introspection system (magic_oinfo) working! I |
|
5231 | 5246 | think this is pretty much ready for release to Janko, so he can |
|
5232 | 5247 | test it for a while and then announce it. Pretty much 100% of what |
|
5233 | 5248 | I wanted for the 'phase 1' release is ready. Happy, tired. |
|
5234 | 5249 | |
|
5235 | 5250 | 2001-11-12 Fernando Perez <fperez@colorado.edu> |
|
5236 | 5251 | |
|
5237 | 5252 | * Version 0.1.6 released, 0.1.7 opened for further work. |
|
5238 | 5253 | |
|
5239 | 5254 | * Fixed bug in printing: it used to test for truth before |
|
5240 | 5255 | printing, so 0 wouldn't print. Now checks for None. |
|
5241 | 5256 | |
|
5242 | 5257 | * Fixed bug where auto-execs increase the prompt counter by 2 (b/c |
|
5243 | 5258 | they have to call len(str(sys.ps1)) ). But the fix is ugly, it |
|
5244 | 5259 | reaches by hand into the outputcache. Think of a better way to do |
|
5245 | 5260 | this later. |
|
5246 | 5261 | |
|
5247 | 5262 | * Various small fixes thanks to Nathan's comments. |
|
5248 | 5263 | |
|
5249 | 5264 | * Changed magic_pprint to magic_Pprint. This way it doesn't |
|
5250 | 5265 | collide with pprint() and the name is consistent with the command |
|
5251 | 5266 | line option. |
|
5252 | 5267 | |
|
5253 | 5268 | * Changed prompt counter behavior to be fully like |
|
5254 | 5269 | Mathematica's. That is, even input that doesn't return a result |
|
5255 | 5270 | raises the prompt counter. The old behavior was kind of confusing |
|
5256 | 5271 | (getting the same prompt number several times if the operation |
|
5257 | 5272 | didn't return a result). |
|
5258 | 5273 | |
|
5259 | 5274 | * Fixed Nathan's last name in a couple of places (Gray, not Graham). |
|
5260 | 5275 | |
|
5261 | 5276 | * Fixed -Classic mode (wasn't working anymore). |
|
5262 | 5277 | |
|
5263 | 5278 | * Added colored prompts using Nathan's new code. Colors are |
|
5264 | 5279 | currently hardwired, they can be user-configurable. For |
|
5265 | 5280 | developers, they can be chosen in file ipythonlib.py, at the |
|
5266 | 5281 | beginning of the CachedOutput class def. |
|
5267 | 5282 | |
|
5268 | 5283 | 2001-11-11 Fernando Perez <fperez@colorado.edu> |
|
5269 | 5284 | |
|
5270 | 5285 | * Version 0.1.5 released, 0.1.6 opened for further work. |
|
5271 | 5286 | |
|
5272 | 5287 | * Changed magic_env to *return* the environment as a dict (not to |
|
5273 | 5288 | print it). This way it prints, but it can also be processed. |
|
5274 | 5289 | |
|
5275 | 5290 | * Added Verbose exception reporting to interactive |
|
5276 | 5291 | exceptions. Very nice, now even 1/0 at the prompt gives a verbose |
|
5277 | 5292 | traceback. Had to make some changes to the ultraTB file. This is |
|
5278 | 5293 | probably the last 'big' thing in my mental todo list. This ties |
|
5279 | 5294 | in with the next entry: |
|
5280 | 5295 | |
|
5281 | 5296 | * Changed -Xi and -Xf to a single -xmode option. Now all the user |
|
5282 | 5297 | has to specify is Plain, Color or Verbose for all exception |
|
5283 | 5298 | handling. |
|
5284 | 5299 | |
|
5285 | 5300 | * Removed ShellServices option. All this can really be done via |
|
5286 | 5301 | the magic system. It's easier to extend, cleaner and has automatic |
|
5287 | 5302 | namespace protection and documentation. |
|
5288 | 5303 | |
|
5289 | 5304 | 2001-11-09 Fernando Perez <fperez@colorado.edu> |
|
5290 | 5305 | |
|
5291 | 5306 | * Fixed bug in output cache flushing (missing parameter to |
|
5292 | 5307 | __init__). Other small bugs fixed (found using pychecker). |
|
5293 | 5308 | |
|
5294 | 5309 | * Version 0.1.4 opened for bugfixing. |
|
5295 | 5310 | |
|
5296 | 5311 | 2001-11-07 Fernando Perez <fperez@colorado.edu> |
|
5297 | 5312 | |
|
5298 | 5313 | * Version 0.1.3 released, mainly because of the raw_input bug. |
|
5299 | 5314 | |
|
5300 | 5315 | * Fixed NASTY bug in raw_input: input line wasn't properly parsed |
|
5301 | 5316 | and when testing for whether things were callable, a call could |
|
5302 | 5317 | actually be made to certain functions. They would get called again |
|
5303 | 5318 | once 'really' executed, with a resulting double call. A disaster |
|
5304 | 5319 | in many cases (list.reverse() would never work!). |
|
5305 | 5320 | |
|
5306 | 5321 | * Removed prefilter() function, moved its code to raw_input (which |
|
5307 | 5322 | after all was just a near-empty caller for prefilter). This saves |
|
5308 | 5323 | a function call on every prompt, and simplifies the class a tiny bit. |
|
5309 | 5324 | |
|
5310 | 5325 | * Fix _ip to __ip name in magic example file. |
|
5311 | 5326 | |
|
5312 | 5327 | * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should |
|
5313 | 5328 | work with non-gnu versions of tar. |
|
5314 | 5329 | |
|
5315 | 5330 | 2001-11-06 Fernando Perez <fperez@colorado.edu> |
|
5316 | 5331 | |
|
5317 | 5332 | * Version 0.1.2. Just to keep track of the recent changes. |
|
5318 | 5333 | |
|
5319 | 5334 | * Fixed nasty bug in output prompt routine. It used to check 'if |
|
5320 | 5335 | arg != None...'. Problem is, this fails if arg implements a |
|
5321 | 5336 | special comparison (__cmp__) which disallows comparing to |
|
5322 | 5337 | None. Found it when trying to use the PhysicalQuantity module from |
|
5323 | 5338 | ScientificPython. |
|
5324 | 5339 | |
|
5325 | 5340 | 2001-11-05 Fernando Perez <fperez@colorado.edu> |
|
5326 | 5341 | |
|
5327 | 5342 | * Also added dirs. Now the pushd/popd/dirs family functions |
|
5328 | 5343 | basically like the shell, with the added convenience of going home |
|
5329 | 5344 | when called with no args. |
|
5330 | 5345 | |
|
5331 | 5346 | * pushd/popd slightly modified to mimic shell behavior more |
|
5332 | 5347 | closely. |
|
5333 | 5348 | |
|
5334 | 5349 | * Added env,pushd,popd from ShellServices as magic functions. I |
|
5335 | 5350 | think the cleanest will be to port all desired functions from |
|
5336 | 5351 | ShellServices as magics and remove ShellServices altogether. This |
|
5337 | 5352 | will provide a single, clean way of adding functionality |
|
5338 | 5353 | (shell-type or otherwise) to IP. |
|
5339 | 5354 | |
|
5340 | 5355 | 2001-11-04 Fernando Perez <fperez@colorado.edu> |
|
5341 | 5356 | |
|
5342 | 5357 | * Added .ipython/ directory to sys.path. This way users can keep |
|
5343 | 5358 | customizations there and access them via import. |
|
5344 | 5359 | |
|
5345 | 5360 | 2001-11-03 Fernando Perez <fperez@colorado.edu> |
|
5346 | 5361 | |
|
5347 | 5362 | * Opened version 0.1.1 for new changes. |
|
5348 | 5363 | |
|
5349 | 5364 | * Changed version number to 0.1.0: first 'public' release, sent to |
|
5350 | 5365 | Nathan and Janko. |
|
5351 | 5366 | |
|
5352 | 5367 | * Lots of small fixes and tweaks. |
|
5353 | 5368 | |
|
5354 | 5369 | * Minor changes to whos format. Now strings are shown, snipped if |
|
5355 | 5370 | too long. |
|
5356 | 5371 | |
|
5357 | 5372 | * Changed ShellServices to work on __main__ so they show up in @who |
|
5358 | 5373 | |
|
5359 | 5374 | * Help also works with ? at the end of a line: |
|
5360 | 5375 | ?sin and sin? |
|
5361 | 5376 | both produce the same effect. This is nice, as often I use the |
|
5362 | 5377 | tab-complete to find the name of a method, but I used to then have |
|
5363 | 5378 | to go to the beginning of the line to put a ? if I wanted more |
|
5364 | 5379 | info. Now I can just add the ? and hit return. Convenient. |
|
5365 | 5380 | |
|
5366 | 5381 | 2001-11-02 Fernando Perez <fperez@colorado.edu> |
|
5367 | 5382 | |
|
5368 | 5383 | * Python version check (>=2.1) added. |
|
5369 | 5384 | |
|
5370 | 5385 | * Added LazyPython documentation. At this point the docs are quite |
|
5371 | 5386 | a mess. A cleanup is in order. |
|
5372 | 5387 | |
|
5373 | 5388 | * Auto-installer created. For some bizarre reason, the zipfiles |
|
5374 | 5389 | module isn't working on my system. So I made a tar version |
|
5375 | 5390 | (hopefully the command line options in various systems won't kill |
|
5376 | 5391 | me). |
|
5377 | 5392 | |
|
5378 | 5393 | * Fixes to Struct in genutils. Now all dictionary-like methods are |
|
5379 | 5394 | protected (reasonably). |
|
5380 | 5395 | |
|
5381 | 5396 | * Added pager function to genutils and changed ? to print usage |
|
5382 | 5397 | note through it (it was too long). |
|
5383 | 5398 | |
|
5384 | 5399 | * Added the LazyPython functionality. Works great! I changed the |
|
5385 | 5400 | auto-quote escape to ';', it's on home row and next to '. But |
|
5386 | 5401 | both auto-quote and auto-paren (still /) escapes are command-line |
|
5387 | 5402 | parameters. |
|
5388 | 5403 | |
|
5389 | 5404 | |
|
5390 | 5405 | 2001-11-01 Fernando Perez <fperez@colorado.edu> |
|
5391 | 5406 | |
|
5392 | 5407 | * Version changed to 0.0.7. Fairly large change: configuration now |
|
5393 | 5408 | is all stored in a directory, by default .ipython. There, all |
|
5394 | 5409 | config files have normal looking names (not .names) |
|
5395 | 5410 | |
|
5396 | 5411 | * Version 0.0.6 Released first to Lucas and Archie as a test |
|
5397 | 5412 | run. Since it's the first 'semi-public' release, change version to |
|
5398 | 5413 | > 0.0.6 for any changes now. |
|
5399 | 5414 | |
|
5400 | 5415 | * Stuff I had put in the ipplib.py changelog: |
|
5401 | 5416 | |
|
5402 | 5417 | Changes to InteractiveShell: |
|
5403 | 5418 | |
|
5404 | 5419 | - Made the usage message a parameter. |
|
5405 | 5420 | |
|
5406 | 5421 | - Require the name of the shell variable to be given. It's a bit |
|
5407 | 5422 | of a hack, but allows the name 'shell' not to be hardwire in the |
|
5408 | 5423 | magic (@) handler, which is problematic b/c it requires |
|
5409 | 5424 | polluting the global namespace with 'shell'. This in turn is |
|
5410 | 5425 | fragile: if a user redefines a variable called shell, things |
|
5411 | 5426 | break. |
|
5412 | 5427 | |
|
5413 | 5428 | - magic @: all functions available through @ need to be defined |
|
5414 | 5429 | as magic_<name>, even though they can be called simply as |
|
5415 | 5430 | @<name>. This allows the special command @magic to gather |
|
5416 | 5431 | information automatically about all existing magic functions, |
|
5417 | 5432 | even if they are run-time user extensions, by parsing the shell |
|
5418 | 5433 | instance __dict__ looking for special magic_ names. |
|
5419 | 5434 | |
|
5420 | 5435 | - mainloop: added *two* local namespace parameters. This allows |
|
5421 | 5436 | the class to differentiate between parameters which were there |
|
5422 | 5437 | before and after command line initialization was processed. This |
|
5423 | 5438 | way, later @who can show things loaded at startup by the |
|
5424 | 5439 | user. This trick was necessary to make session saving/reloading |
|
5425 | 5440 | really work: ideally after saving/exiting/reloading a session, |
|
5426 | 5441 | *everythin* should look the same, including the output of @who. I |
|
5427 | 5442 | was only able to make this work with this double namespace |
|
5428 | 5443 | trick. |
|
5429 | 5444 | |
|
5430 | 5445 | - added a header to the logfile which allows (almost) full |
|
5431 | 5446 | session restoring. |
|
5432 | 5447 | |
|
5433 | 5448 | - prepend lines beginning with @ or !, with a and log |
|
5434 | 5449 | them. Why? !lines: may be useful to know what you did @lines: |
|
5435 | 5450 | they may affect session state. So when restoring a session, at |
|
5436 | 5451 | least inform the user of their presence. I couldn't quite get |
|
5437 | 5452 | them to properly re-execute, but at least the user is warned. |
|
5438 | 5453 | |
|
5439 | 5454 | * Started ChangeLog. |
General Comments 0
You need to be logged in to leave comments.
Login now