##// END OF EJS Templates
- New profile with doctest support (two way: for generating doctests and for...
fperez -
Show More
@@ -0,0 +1,40 b''
1 """Config file for 'doctest' profile.
2
3 This profile modifies the prompts to be the standard Python ones, so that you
4 can generate easily doctests from an IPython session.
5
6 But more importantly, it enables pasting of code with '>>>' prompts and
7 arbitrary initial whitespace, as is typical of doctests in reST files and
8 docstrings. This allows you to easily re-run existing doctests and iteratively
9 work on them as part of your development workflow.
10
11 The exception mode is also set to 'plain' so the generated exceptions are as
12 similar as possible to the default Python ones, for inclusion in doctests."""
13
14 # get various stuff that are there for historical / familiarity reasons
15 import ipy_legacy
16
17 from IPython import ipapi
18
19 from IPython.Extensions import InterpreterPasteInput
20
21 def main():
22 ip = ipapi.get()
23 o = ip.options
24
25 # Set the prompts similar to the defaults
26 o.prompt_in1 = '>>> '
27 o.prompt_in2 = '... '
28 o.prompt_out = ''
29
30 # No separation between successive inputs
31 o.separate_in = ''
32
33 # Disable pprint, so that outputs are printed as similarly to standard
34 # python as possible
35 o.pprint = 0
36
37 # Use plain exceptions, to also resemble normal pyhton.
38 o.xmode = 'plain'
39
40 main()
@@ -1,91 +1,118 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Modified input prompt for entering text with >>> or ... at the start.
3 3
4 4 We define a special input line filter to allow typing lines which begin with
5 5 '>>> ' or '... '. These two strings, if present at the start of the input
6 6 line, are stripped. This allows for direct pasting of code from examples such
7 7 as those available in the standard Python tutorial.
8 8
9 9 Normally pasting such code is one chunk is impossible because of the
10 10 extraneous >>> and ..., requiring one to do a line by line paste with careful
11 11 removal of those characters. This module allows pasting that kind of
12 12 multi-line examples in one pass.
13 13
14 14 Here is an 'screenshot' of a section of the tutorial pasted into IPython with
15 15 this feature enabled:
16 16
17 17 In [1]: >>> def fib2(n): # return Fibonacci series up to n
18 18 ...: ... '''Return a list containing the Fibonacci series up to n.'''
19 19 ...: ... result = []
20 20 ...: ... a, b = 0, 1
21 21 ...: ... while b < n:
22 22 ...: ... result.append(b) # see below
23 23 ...: ... a, b = b, a+b
24 24 ...: ... return result
25 25 ...:
26 26
27 27 In [2]: fib2(10)
28 28 Out[2]: [1, 1, 2, 3, 5, 8]
29 29
30 30 The >>> and ... are stripped from the input so that the python interpreter
31 31 only sees the real part of the code.
32 32
33 33 All other input is processed normally.
34
35 Notes
36 =====
37
38 * You can even paste code that has extra initial spaces, such as is common in
39 doctests:
40
41 In [3]: >>> a = ['Mary', 'had', 'a', 'little', 'lamb']
42
43 In [4]: >>> for i in range(len(a)):
44 ...: ... print i, a[i]
45 ...: ...
46 0 Mary
47 1 had
48 2 a
49 3 little
50 4 lamb
34 51 """
52
35 53 #*****************************************************************************
36 54 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
37 55 #
38 56 # Distributed under the terms of the BSD License. The full license is in
39 57 # the file COPYING, distributed as part of this software.
40 58 #*****************************************************************************
41 59
42 60 from IPython import Release
43 61 __author__ = '%s <%s>' % Release.authors['Fernando']
44 62 __license__ = Release.license
45 63
46 64 # This file is an example of how to modify IPython's line-processing behavior
47 65 # without touching the internal code. We'll define an alternate pre-processing
48 66 # stage which allows a special form of input (which is invalid Python syntax)
49 67 # for certain quantities, rewrites a line of proper Python in those cases, and
50 68 # then passes it off to IPython's normal processor for further work.
51 69
52 70 # With this kind of customization, IPython can be adapted for many
53 71 # special-purpose scenarios providing alternate input syntaxes.
54 72
55 73 # This file can be imported like a regular module.
56 74
57 75 # IPython has a prefilter() function that analyzes each input line. We redefine
58 76 # it here to first pre-process certain forms of input
59 77
60 78 # The prototype of any alternate prefilter must be like this one (the name
61 79 # doesn't matter):
62 80 # - line is a string containing the user input line.
63 # - continuation is a parameter which tells us if we are processing a first line of
64 # user input or the second or higher of a multi-line statement.
81 # - continuation is a parameter which tells us if we are processing a first
82 # line of user input or the second or higher of a multi-line statement.
83
84 import re
85
86 PROMPT_RE = re.compile(r'(^[ \t]*>>> |^[ \t]*\.\.\. )')
65 87
66 88 def prefilter_paste(self,line,continuation):
67 89 """Alternate prefilter for input of pasted code from an interpreter.
68 90 """
69
70 from re import match
71
72 if match(r'^>>> |^\.\.\. ',line):
91 if not line:
92 return ''
93 m = PROMPT_RE.match(line)
94 if m:
73 95 # In the end, always call the default IPython _prefilter() function.
74 96 # Note that self must be passed explicitly, b/c we're calling the
75 97 # unbound class method (since this method will overwrite the instance
76 98 # prefilter())
77 return self._prefilter(line[4:],continuation)
99 return self._prefilter(line[len(m.group(0)):],continuation)
78 100 elif line.strip() == '...':
79 101 return self._prefilter('',continuation)
102 elif line.isspace():
103 # This allows us to recognize multiple input prompts separated by blank
104 # lines and pasted in a single chunk, very common when pasting doctests
105 # or long tutorial passages.
106 return ''
80 107 else:
81 108 return self._prefilter(line,continuation)
82 109
83 110 # Rebind this to be the new IPython prefilter:
84 111 from IPython.iplib import InteractiveShell
85 112 InteractiveShell.prefilter = prefilter_paste
86 113
87 114 # Clean up the namespace.
88 115 del InteractiveShell,prefilter_paste
89 116
90 117 # Just a heads up at the console
91 118 print '*** Pasting of code with ">>>" or "..." has been enabled.'
@@ -1,2475 +1,2486 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 2577 2007-08-02 23:50:02Z fperez $
9 $Id: iplib.py 2581 2007-08-04 20:52:05Z 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 pydoc
51 51 import re
52 52 import shutil
53 53 import string
54 54 import sys
55 55 import tempfile
56 56 import traceback
57 57 import types
58 58 import pickleshare
59 59 from sets import Set
60 60 from pprint import pprint, pformat
61 61
62 62 # IPython's own modules
63 63 #import IPython
64 64 from IPython import Debugger,OInspect,PyColorize,ultraTB
65 65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 66 from IPython.FakeModule import FakeModule
67 67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 68 from IPython.Logger import Logger
69 69 from IPython.Magic import Magic
70 70 from IPython.Prompts import CachedOutput
71 71 from IPython.ipstruct import Struct
72 72 from IPython.background_jobs import BackgroundJobManager
73 73 from IPython.usage import cmd_line_usage,interactive_usage
74 74 from IPython.genutils import *
75 75 from IPython.strdispatch import StrDispatch
76 76 import IPython.ipapi
77 77 import IPython.history
78 78 import IPython.prefilter as prefilter
79 79 import IPython.shadowns
80 80 # Globals
81 81
82 82 # store the builtin raw_input globally, and use this always, in case user code
83 83 # overwrites it (like wx.py.PyShell does)
84 84 raw_input_original = raw_input
85 85
86 86 # compiled regexps for autoindent management
87 87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88 88
89 89
90 90 #****************************************************************************
91 91 # Some utility function definitions
92 92
93 93 ini_spaces_re = re.compile(r'^(\s+)')
94 94
95 95 def num_ini_spaces(strng):
96 96 """Return the number of initial spaces in a string"""
97 97
98 98 ini_spaces = ini_spaces_re.match(strng)
99 99 if ini_spaces:
100 100 return ini_spaces.end()
101 101 else:
102 102 return 0
103 103
104 104 def softspace(file, newvalue):
105 105 """Copied from code.py, to remove the dependency"""
106 106
107 107 oldvalue = 0
108 108 try:
109 109 oldvalue = file.softspace
110 110 except AttributeError:
111 111 pass
112 112 try:
113 113 file.softspace = newvalue
114 114 except (AttributeError, TypeError):
115 115 # "attribute-less object" or "read-only attributes"
116 116 pass
117 117 return oldvalue
118 118
119 119
120 120 #****************************************************************************
121 121 # Local use exceptions
122 122 class SpaceInInput(exceptions.Exception): pass
123 123
124 124
125 125 #****************************************************************************
126 126 # Local use classes
127 127 class Bunch: pass
128 128
129 129 class Undefined: pass
130 130
131 131 class Quitter(object):
132 132 """Simple class to handle exit, similar to Python 2.5's.
133 133
134 134 It handles exiting in an ipython-safe manner, which the one in Python 2.5
135 135 doesn't do (obviously, since it doesn't know about ipython)."""
136 136
137 137 def __init__(self,shell,name):
138 138 self.shell = shell
139 139 self.name = name
140 140
141 141 def __repr__(self):
142 142 return 'Type %s() to exit.' % self.name
143 143 __str__ = __repr__
144 144
145 145 def __call__(self):
146 146 self.shell.exit()
147 147
148 148 class InputList(list):
149 149 """Class to store user input.
150 150
151 151 It's basically a list, but slices return a string instead of a list, thus
152 152 allowing things like (assuming 'In' is an instance):
153 153
154 154 exec In[4:7]
155 155
156 156 or
157 157
158 158 exec In[5:9] + In[14] + In[21:25]"""
159 159
160 160 def __getslice__(self,i,j):
161 161 return ''.join(list.__getslice__(self,i,j))
162 162
163 163 class SyntaxTB(ultraTB.ListTB):
164 164 """Extension which holds some state: the last exception value"""
165 165
166 166 def __init__(self,color_scheme = 'NoColor'):
167 167 ultraTB.ListTB.__init__(self,color_scheme)
168 168 self.last_syntax_error = None
169 169
170 170 def __call__(self, etype, value, elist):
171 171 self.last_syntax_error = value
172 172 ultraTB.ListTB.__call__(self,etype,value,elist)
173 173
174 174 def clear_err_state(self):
175 175 """Return the current error state and clear it"""
176 176 e = self.last_syntax_error
177 177 self.last_syntax_error = None
178 178 return e
179 179
180 180 #****************************************************************************
181 181 # Main IPython class
182 182
183 183 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
184 184 # until a full rewrite is made. I've cleaned all cross-class uses of
185 185 # attributes and methods, but too much user code out there relies on the
186 186 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
187 187 #
188 188 # But at least now, all the pieces have been separated and we could, in
189 189 # principle, stop using the mixin. This will ease the transition to the
190 190 # chainsaw branch.
191 191
192 192 # For reference, the following is the list of 'self.foo' uses in the Magic
193 193 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
194 194 # class, to prevent clashes.
195 195
196 196 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
197 197 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
198 198 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
199 199 # 'self.value']
200 200
201 201 class InteractiveShell(object,Magic):
202 202 """An enhanced console for Python."""
203 203
204 204 # class attribute to indicate whether the class supports threads or not.
205 205 # Subclasses with thread support should override this as needed.
206 206 isthreaded = False
207 207
208 208 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
209 209 user_ns = None,user_global_ns=None,banner2='',
210 210 custom_exceptions=((),None),embedded=False):
211 211
212 212 # log system
213 213 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
214 214
215 215 # some minimal strict typechecks. For some core data structures, I
216 216 # want actual basic python types, not just anything that looks like
217 217 # one. This is especially true for namespaces.
218 218 for ns in (user_ns,user_global_ns):
219 219 if ns is not None and type(ns) != types.DictType:
220 220 raise TypeError,'namespace must be a dictionary'
221 221
222 222 # Job manager (for jobs run as background threads)
223 223 self.jobs = BackgroundJobManager()
224 224
225 225 # Store the actual shell's name
226 226 self.name = name
227 227
228 228 # We need to know whether the instance is meant for embedding, since
229 229 # global/local namespaces need to be handled differently in that case
230 230 self.embedded = embedded
231 231 if embedded:
232 232 # Control variable so users can, from within the embedded instance,
233 233 # permanently deactivate it.
234 234 self.embedded_active = True
235 235
236 236 # command compiler
237 237 self.compile = codeop.CommandCompiler()
238 238
239 239 # User input buffer
240 240 self.buffer = []
241 241
242 242 # Default name given in compilation of code
243 243 self.filename = '<ipython console>'
244 244
245 245 # Install our own quitter instead of the builtins. For python2.3-2.4,
246 246 # this brings in behavior like 2.5, and for 2.5 it's identical.
247 247 __builtin__.exit = Quitter(self,'exit')
248 248 __builtin__.quit = Quitter(self,'quit')
249 249
250 250 # Make an empty namespace, which extension writers can rely on both
251 251 # existing and NEVER being used by ipython itself. This gives them a
252 252 # convenient location for storing additional information and state
253 253 # their extensions may require, without fear of collisions with other
254 254 # ipython names that may develop later.
255 255 self.meta = Struct()
256 256
257 257 # Create the namespace where the user will operate. user_ns is
258 258 # normally the only one used, and it is passed to the exec calls as
259 259 # the locals argument. But we do carry a user_global_ns namespace
260 260 # given as the exec 'globals' argument, This is useful in embedding
261 261 # situations where the ipython shell opens in a context where the
262 262 # distinction between locals and globals is meaningful.
263 263
264 264 # FIXME. For some strange reason, __builtins__ is showing up at user
265 265 # level as a dict instead of a module. This is a manual fix, but I
266 266 # should really track down where the problem is coming from. Alex
267 267 # Schmolck reported this problem first.
268 268
269 269 # A useful post by Alex Martelli on this topic:
270 270 # Re: inconsistent value from __builtins__
271 271 # Von: Alex Martelli <aleaxit@yahoo.com>
272 272 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
273 273 # Gruppen: comp.lang.python
274 274
275 275 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
276 276 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
277 277 # > <type 'dict'>
278 278 # > >>> print type(__builtins__)
279 279 # > <type 'module'>
280 280 # > Is this difference in return value intentional?
281 281
282 282 # Well, it's documented that '__builtins__' can be either a dictionary
283 283 # or a module, and it's been that way for a long time. Whether it's
284 284 # intentional (or sensible), I don't know. In any case, the idea is
285 285 # that if you need to access the built-in namespace directly, you
286 286 # should start with "import __builtin__" (note, no 's') which will
287 287 # definitely give you a module. Yeah, it's somewhat confusing:-(.
288 288
289 289 # These routines return properly built dicts as needed by the rest of
290 290 # the code, and can also be used by extension writers to generate
291 291 # properly initialized namespaces.
292 292 user_ns = IPython.ipapi.make_user_ns(user_ns)
293 293 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
294 294
295 295 # Assign namespaces
296 296 # This is the namespace where all normal user variables live
297 297 self.user_ns = user_ns
298 298 # Embedded instances require a separate namespace for globals.
299 299 # Normally this one is unused by non-embedded instances.
300 300 self.user_global_ns = user_global_ns
301 301 # A namespace to keep track of internal data structures to prevent
302 302 # them from cluttering user-visible stuff. Will be updated later
303 303 self.internal_ns = {}
304 304
305 305 # Namespace of system aliases. Each entry in the alias
306 306 # table must be a 2-tuple of the form (N,name), where N is the number
307 307 # of positional arguments of the alias.
308 308 self.alias_table = {}
309 309
310 310 # A table holding all the namespaces IPython deals with, so that
311 311 # introspection facilities can search easily.
312 312 self.ns_table = {'user':user_ns,
313 313 'user_global':user_global_ns,
314 314 'alias':self.alias_table,
315 315 'internal':self.internal_ns,
316 316 'builtin':__builtin__.__dict__
317 317 }
318 318
319 319 # The user namespace MUST have a pointer to the shell itself.
320 320 self.user_ns[name] = self
321 321
322 322 # We need to insert into sys.modules something that looks like a
323 323 # module but which accesses the IPython namespace, for shelve and
324 324 # pickle to work interactively. Normally they rely on getting
325 325 # everything out of __main__, but for embedding purposes each IPython
326 326 # instance has its own private namespace, so we can't go shoving
327 327 # everything into __main__.
328 328
329 329 # note, however, that we should only do this for non-embedded
330 330 # ipythons, which really mimic the __main__.__dict__ with their own
331 331 # namespace. Embedded instances, on the other hand, should not do
332 332 # this because they need to manage the user local/global namespaces
333 333 # only, but they live within a 'normal' __main__ (meaning, they
334 334 # shouldn't overtake the execution environment of the script they're
335 335 # embedded in).
336 336
337 337 if not embedded:
338 338 try:
339 339 main_name = self.user_ns['__name__']
340 340 except KeyError:
341 341 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
342 342 else:
343 343 #print "pickle hack in place" # dbg
344 344 #print 'main_name:',main_name # dbg
345 345 sys.modules[main_name] = FakeModule(self.user_ns)
346 346
347 347 # List of input with multi-line handling.
348 348 # Fill its zero entry, user counter starts at 1
349 349 self.input_hist = InputList(['\n'])
350 350 # This one will hold the 'raw' input history, without any
351 351 # pre-processing. This will allow users to retrieve the input just as
352 352 # it was exactly typed in by the user, with %hist -r.
353 353 self.input_hist_raw = InputList(['\n'])
354 354
355 355 # list of visited directories
356 356 try:
357 357 self.dir_hist = [os.getcwd()]
358 358 except OSError:
359 359 self.dir_hist = []
360 360
361 361 # dict of output history
362 362 self.output_hist = {}
363 363
364 364 # Get system encoding at startup time. Certain terminals (like Emacs
365 365 # under Win32 have it set to None, and we need to have a known valid
366 366 # encoding to use in the raw_input() method
367 367 self.stdin_encoding = sys.stdin.encoding or 'ascii'
368 368
369 369 # dict of things NOT to alias (keywords, builtins and some magics)
370 370 no_alias = {}
371 371 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
372 372 for key in keyword.kwlist + no_alias_magics:
373 373 no_alias[key] = 1
374 374 no_alias.update(__builtin__.__dict__)
375 375 self.no_alias = no_alias
376 376
377 377 # make global variables for user access to these
378 378 self.user_ns['_ih'] = self.input_hist
379 379 self.user_ns['_oh'] = self.output_hist
380 380 self.user_ns['_dh'] = self.dir_hist
381 381
382 382 # user aliases to input and output histories
383 383 self.user_ns['In'] = self.input_hist
384 384 self.user_ns['Out'] = self.output_hist
385 385
386 386 self.user_ns['_sh'] = IPython.shadowns
387 387 # Object variable to store code object waiting execution. This is
388 388 # used mainly by the multithreaded shells, but it can come in handy in
389 389 # other situations. No need to use a Queue here, since it's a single
390 390 # item which gets cleared once run.
391 391 self.code_to_run = None
392 392
393 393 # escapes for automatic behavior on the command line
394 394 self.ESC_SHELL = '!'
395 395 self.ESC_SH_CAP = '!!'
396 396 self.ESC_HELP = '?'
397 397 self.ESC_MAGIC = '%'
398 398 self.ESC_QUOTE = ','
399 399 self.ESC_QUOTE2 = ';'
400 400 self.ESC_PAREN = '/'
401 401
402 402 # And their associated handlers
403 403 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
404 404 self.ESC_QUOTE : self.handle_auto,
405 405 self.ESC_QUOTE2 : self.handle_auto,
406 406 self.ESC_MAGIC : self.handle_magic,
407 407 self.ESC_HELP : self.handle_help,
408 408 self.ESC_SHELL : self.handle_shell_escape,
409 409 self.ESC_SH_CAP : self.handle_shell_escape,
410 410 }
411 411
412 412 # class initializations
413 413 Magic.__init__(self,self)
414 414
415 415 # Python source parser/formatter for syntax highlighting
416 416 pyformat = PyColorize.Parser().format
417 417 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
418 418
419 419 # hooks holds pointers used for user-side customizations
420 420 self.hooks = Struct()
421 421
422 422 self.strdispatchers = {}
423 423
424 424 # Set all default hooks, defined in the IPython.hooks module.
425 425 hooks = IPython.hooks
426 426 for hook_name in hooks.__all__:
427 427 # default hooks have priority 100, i.e. low; user hooks should have
428 428 # 0-100 priority
429 429 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
430 430 #print "bound hook",hook_name
431 431
432 432 # Flag to mark unconditional exit
433 433 self.exit_now = False
434 434
435 435 self.usage_min = """\
436 436 An enhanced console for Python.
437 437 Some of its features are:
438 438 - Readline support if the readline library is present.
439 439 - Tab completion in the local namespace.
440 440 - Logging of input, see command-line options.
441 441 - System shell escape via ! , eg !ls.
442 442 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
443 443 - Keeps track of locally defined variables via %who, %whos.
444 444 - Show object information with a ? eg ?x or x? (use ?? for more info).
445 445 """
446 446 if usage: self.usage = usage
447 447 else: self.usage = self.usage_min
448 448
449 449 # Storage
450 450 self.rc = rc # This will hold all configuration information
451 451 self.pager = 'less'
452 452 # temporary files used for various purposes. Deleted at exit.
453 453 self.tempfiles = []
454 454
455 455 # Keep track of readline usage (later set by init_readline)
456 456 self.has_readline = False
457 457
458 458 # template for logfile headers. It gets resolved at runtime by the
459 459 # logstart method.
460 460 self.loghead_tpl = \
461 461 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
462 462 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
463 463 #log# opts = %s
464 464 #log# args = %s
465 465 #log# It is safe to make manual edits below here.
466 466 #log#-----------------------------------------------------------------------
467 467 """
468 468 # for pushd/popd management
469 469 try:
470 470 self.home_dir = get_home_dir()
471 471 except HomeDirError,msg:
472 472 fatal(msg)
473 473
474 474 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
475 475
476 476 # Functions to call the underlying shell.
477 477
478 478 # The first is similar to os.system, but it doesn't return a value,
479 479 # and it allows interpolation of variables in the user's namespace.
480 480 self.system = lambda cmd: \
481 481 shell(self.var_expand(cmd,depth=2),
482 482 header=self.rc.system_header,
483 483 verbose=self.rc.system_verbose)
484 484
485 485 # These are for getoutput and getoutputerror:
486 486 self.getoutput = lambda cmd: \
487 487 getoutput(self.var_expand(cmd,depth=2),
488 488 header=self.rc.system_header,
489 489 verbose=self.rc.system_verbose)
490 490
491 491 self.getoutputerror = lambda cmd: \
492 492 getoutputerror(self.var_expand(cmd,depth=2),
493 493 header=self.rc.system_header,
494 494 verbose=self.rc.system_verbose)
495 495
496 496
497 497 # keep track of where we started running (mainly for crash post-mortem)
498 498 self.starting_dir = os.getcwd()
499 499
500 500 # Various switches which can be set
501 501 self.CACHELENGTH = 5000 # this is cheap, it's just text
502 502 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
503 503 self.banner2 = banner2
504 504
505 505 # TraceBack handlers:
506 506
507 507 # Syntax error handler.
508 508 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
509 509
510 510 # The interactive one is initialized with an offset, meaning we always
511 511 # want to remove the topmost item in the traceback, which is our own
512 512 # internal code. Valid modes: ['Plain','Context','Verbose']
513 513 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
514 514 color_scheme='NoColor',
515 515 tb_offset = 1)
516 516
517 517 # IPython itself shouldn't crash. This will produce a detailed
518 518 # post-mortem if it does. But we only install the crash handler for
519 519 # non-threaded shells, the threaded ones use a normal verbose reporter
520 520 # and lose the crash handler. This is because exceptions in the main
521 521 # thread (such as in GUI code) propagate directly to sys.excepthook,
522 522 # and there's no point in printing crash dumps for every user exception.
523 523 if self.isthreaded:
524 524 ipCrashHandler = ultraTB.FormattedTB()
525 525 else:
526 526 from IPython import CrashHandler
527 527 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
528 528 self.set_crash_handler(ipCrashHandler)
529 529
530 530 # and add any custom exception handlers the user may have specified
531 531 self.set_custom_exc(*custom_exceptions)
532 532
533 533 # indentation management
534 534 self.autoindent = False
535 535 self.indent_current_nsp = 0
536 536
537 537 # Make some aliases automatically
538 538 # Prepare list of shell aliases to auto-define
539 539 if os.name == 'posix':
540 540 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
541 541 'mv mv -i','rm rm -i','cp cp -i',
542 542 'cat cat','less less','clear clear',
543 543 # a better ls
544 544 'ls ls -F',
545 545 # long ls
546 546 'll ls -lF')
547 547 # Extra ls aliases with color, which need special treatment on BSD
548 548 # variants
549 549 ls_extra = ( # color ls
550 550 'lc ls -F -o --color',
551 551 # ls normal files only
552 552 'lf ls -F -o --color %l | grep ^-',
553 553 # ls symbolic links
554 554 'lk ls -F -o --color %l | grep ^l',
555 555 # directories or links to directories,
556 556 'ldir ls -F -o --color %l | grep /$',
557 557 # things which are executable
558 558 'lx ls -F -o --color %l | grep ^-..x',
559 559 )
560 560 # The BSDs don't ship GNU ls, so they don't understand the
561 561 # --color switch out of the box
562 562 if 'bsd' in sys.platform:
563 563 ls_extra = ( # ls normal files only
564 564 'lf ls -lF | grep ^-',
565 565 # ls symbolic links
566 566 'lk ls -lF | grep ^l',
567 567 # directories or links to directories,
568 568 'ldir ls -lF | grep /$',
569 569 # things which are executable
570 570 'lx ls -lF | grep ^-..x',
571 571 )
572 572 auto_alias = auto_alias + ls_extra
573 573 elif os.name in ['nt','dos']:
574 574 auto_alias = ('dir dir /on', 'ls dir /on',
575 575 'ddir dir /ad /on', 'ldir dir /ad /on',
576 576 'mkdir mkdir','rmdir rmdir','echo echo',
577 577 'ren ren','cls cls','copy copy')
578 578 else:
579 579 auto_alias = ()
580 580 self.auto_alias = [s.split(None,1) for s in auto_alias]
581 581 # Call the actual (public) initializer
582 582 self.init_auto_alias()
583 583
584 584 # Produce a public API instance
585 585 self.api = IPython.ipapi.IPApi(self)
586 586
587 587 # track which builtins we add, so we can clean up later
588 588 self.builtins_added = {}
589 589 # This method will add the necessary builtins for operation, but
590 590 # tracking what it did via the builtins_added dict.
591 591 self.add_builtins()
592 592
593 593 # end __init__
594 594
595 595 def var_expand(self,cmd,depth=0):
596 596 """Expand python variables in a string.
597 597
598 598 The depth argument indicates how many frames above the caller should
599 599 be walked to look for the local namespace where to expand variables.
600 600
601 601 The global namespace for expansion is always the user's interactive
602 602 namespace.
603 603 """
604 604
605 605 return str(ItplNS(cmd.replace('#','\#'),
606 606 self.user_ns, # globals
607 607 # Skip our own frame in searching for locals:
608 608 sys._getframe(depth+1).f_locals # locals
609 609 ))
610 610
611 611 def pre_config_initialization(self):
612 612 """Pre-configuration init method
613 613
614 614 This is called before the configuration files are processed to
615 615 prepare the services the config files might need.
616 616
617 617 self.rc already has reasonable default values at this point.
618 618 """
619 619 rc = self.rc
620 620 try:
621 621 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
622 622 except exceptions.UnicodeDecodeError:
623 623 print "Your ipythondir can't be decoded to unicode!"
624 624 print "Please set HOME environment variable to something that"
625 625 print r"only has ASCII characters, e.g. c:\home"
626 626 print "Now it is",rc.ipythondir
627 627 sys.exit()
628 628 self.shadowhist = IPython.history.ShadowHist(self.db)
629 629
630 630
631 631 def post_config_initialization(self):
632 632 """Post configuration init method
633 633
634 634 This is called after the configuration files have been processed to
635 635 'finalize' the initialization."""
636 636
637 637 rc = self.rc
638 638
639 639 # Object inspector
640 640 self.inspector = OInspect.Inspector(OInspect.InspectColors,
641 641 PyColorize.ANSICodeColors,
642 642 'NoColor',
643 643 rc.object_info_string_level)
644 644
645 645 self.rl_next_input = None
646 646 self.rl_do_indent = False
647 647 # Load readline proper
648 648 if rc.readline:
649 649 self.init_readline()
650 650
651 651
652 652 # local shortcut, this is used a LOT
653 653 self.log = self.logger.log
654 654
655 655 # Initialize cache, set in/out prompts and printing system
656 656 self.outputcache = CachedOutput(self,
657 657 rc.cache_size,
658 658 rc.pprint,
659 659 input_sep = rc.separate_in,
660 660 output_sep = rc.separate_out,
661 661 output_sep2 = rc.separate_out2,
662 662 ps1 = rc.prompt_in1,
663 663 ps2 = rc.prompt_in2,
664 664 ps_out = rc.prompt_out,
665 665 pad_left = rc.prompts_pad_left)
666 666
667 667 # user may have over-ridden the default print hook:
668 668 try:
669 669 self.outputcache.__class__.display = self.hooks.display
670 670 except AttributeError:
671 671 pass
672 672
673 673 # I don't like assigning globally to sys, because it means when
674 674 # embedding instances, each embedded instance overrides the previous
675 675 # choice. But sys.displayhook seems to be called internally by exec,
676 676 # so I don't see a way around it. We first save the original and then
677 677 # overwrite it.
678 678 self.sys_displayhook = sys.displayhook
679 679 sys.displayhook = self.outputcache
680 680
681 681 # Set user colors (don't do it in the constructor above so that it
682 682 # doesn't crash if colors option is invalid)
683 683 self.magic_colors(rc.colors)
684 684
685 685 # Set calling of pdb on exceptions
686 686 self.call_pdb = rc.pdb
687 687
688 688 # Load user aliases
689 689 for alias in rc.alias:
690 690 self.magic_alias(alias)
691 691 self.hooks.late_startup_hook()
692 692
693 693 batchrun = False
694 694 for batchfile in [path(arg) for arg in self.rc.args
695 695 if arg.lower().endswith('.ipy')]:
696 696 if not batchfile.isfile():
697 697 print "No such batch file:", batchfile
698 698 continue
699 699 self.api.runlines(batchfile.text())
700 700 batchrun = True
701 701 if batchrun:
702 702 self.exit_now = True
703 703
704 704 def add_builtins(self):
705 705 """Store ipython references into the builtin namespace.
706 706
707 707 Some parts of ipython operate via builtins injected here, which hold a
708 708 reference to IPython itself."""
709 709
710 710 # TODO: deprecate all except _ip; 'jobs' should be installed
711 711 # by an extension and the rest are under _ip, ipalias is redundant
712 712 builtins_new = dict(__IPYTHON__ = self,
713 713 ip_set_hook = self.set_hook,
714 714 jobs = self.jobs,
715 715 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
716 716 ipalias = wrap_deprecated(self.ipalias),
717 717 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
718 718 _ip = self.api
719 719 )
720 720 for biname,bival in builtins_new.items():
721 721 try:
722 722 # store the orignal value so we can restore it
723 723 self.builtins_added[biname] = __builtin__.__dict__[biname]
724 724 except KeyError:
725 725 # or mark that it wasn't defined, and we'll just delete it at
726 726 # cleanup
727 727 self.builtins_added[biname] = Undefined
728 728 __builtin__.__dict__[biname] = bival
729 729
730 730 # Keep in the builtins a flag for when IPython is active. We set it
731 731 # with setdefault so that multiple nested IPythons don't clobber one
732 732 # another. Each will increase its value by one upon being activated,
733 733 # which also gives us a way to determine the nesting level.
734 734 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
735 735
736 736 def clean_builtins(self):
737 737 """Remove any builtins which might have been added by add_builtins, or
738 738 restore overwritten ones to their previous values."""
739 739 for biname,bival in self.builtins_added.items():
740 740 if bival is Undefined:
741 741 del __builtin__.__dict__[biname]
742 742 else:
743 743 __builtin__.__dict__[biname] = bival
744 744 self.builtins_added.clear()
745 745
746 746 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
747 747 """set_hook(name,hook) -> sets an internal IPython hook.
748 748
749 749 IPython exposes some of its internal API as user-modifiable hooks. By
750 750 adding your function to one of these hooks, you can modify IPython's
751 751 behavior to call at runtime your own routines."""
752 752
753 753 # At some point in the future, this should validate the hook before it
754 754 # accepts it. Probably at least check that the hook takes the number
755 755 # of args it's supposed to.
756 756
757 757 f = new.instancemethod(hook,self,self.__class__)
758 758
759 759 # check if the hook is for strdispatcher first
760 760 if str_key is not None:
761 761 sdp = self.strdispatchers.get(name, StrDispatch())
762 762 sdp.add_s(str_key, f, priority )
763 763 self.strdispatchers[name] = sdp
764 764 return
765 765 if re_key is not None:
766 766 sdp = self.strdispatchers.get(name, StrDispatch())
767 767 sdp.add_re(re.compile(re_key), f, priority )
768 768 self.strdispatchers[name] = sdp
769 769 return
770 770
771 771 dp = getattr(self.hooks, name, None)
772 772 if name not in IPython.hooks.__all__:
773 773 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
774 774 if not dp:
775 775 dp = IPython.hooks.CommandChainDispatcher()
776 776
777 777 try:
778 778 dp.add(f,priority)
779 779 except AttributeError:
780 780 # it was not commandchain, plain old func - replace
781 781 dp = f
782 782
783 783 setattr(self.hooks,name, dp)
784 784
785 785
786 786 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
787 787
788 788 def set_crash_handler(self,crashHandler):
789 789 """Set the IPython crash handler.
790 790
791 791 This must be a callable with a signature suitable for use as
792 792 sys.excepthook."""
793 793
794 794 # Install the given crash handler as the Python exception hook
795 795 sys.excepthook = crashHandler
796 796
797 797 # The instance will store a pointer to this, so that runtime code
798 798 # (such as magics) can access it. This is because during the
799 799 # read-eval loop, it gets temporarily overwritten (to deal with GUI
800 800 # frameworks).
801 801 self.sys_excepthook = sys.excepthook
802 802
803 803
804 804 def set_custom_exc(self,exc_tuple,handler):
805 805 """set_custom_exc(exc_tuple,handler)
806 806
807 807 Set a custom exception handler, which will be called if any of the
808 808 exceptions in exc_tuple occur in the mainloop (specifically, in the
809 809 runcode() method.
810 810
811 811 Inputs:
812 812
813 813 - exc_tuple: a *tuple* of valid exceptions to call the defined
814 814 handler for. It is very important that you use a tuple, and NOT A
815 815 LIST here, because of the way Python's except statement works. If
816 816 you only want to trap a single exception, use a singleton tuple:
817 817
818 818 exc_tuple == (MyCustomException,)
819 819
820 820 - handler: this must be defined as a function with the following
821 821 basic interface: def my_handler(self,etype,value,tb).
822 822
823 823 This will be made into an instance method (via new.instancemethod)
824 824 of IPython itself, and it will be called if any of the exceptions
825 825 listed in the exc_tuple are caught. If the handler is None, an
826 826 internal basic one is used, which just prints basic info.
827 827
828 828 WARNING: by putting in your own exception handler into IPython's main
829 829 execution loop, you run a very good chance of nasty crashes. This
830 830 facility should only be used if you really know what you are doing."""
831 831
832 832 assert type(exc_tuple)==type(()) , \
833 833 "The custom exceptions must be given AS A TUPLE."
834 834
835 835 def dummy_handler(self,etype,value,tb):
836 836 print '*** Simple custom exception handler ***'
837 837 print 'Exception type :',etype
838 838 print 'Exception value:',value
839 839 print 'Traceback :',tb
840 840 print 'Source code :','\n'.join(self.buffer)
841 841
842 842 if handler is None: handler = dummy_handler
843 843
844 844 self.CustomTB = new.instancemethod(handler,self,self.__class__)
845 845 self.custom_exceptions = exc_tuple
846 846
847 847 def set_custom_completer(self,completer,pos=0):
848 848 """set_custom_completer(completer,pos=0)
849 849
850 850 Adds a new custom completer function.
851 851
852 852 The position argument (defaults to 0) is the index in the completers
853 853 list where you want the completer to be inserted."""
854 854
855 855 newcomp = new.instancemethod(completer,self.Completer,
856 856 self.Completer.__class__)
857 857 self.Completer.matchers.insert(pos,newcomp)
858 858
859 859 def set_completer(self):
860 860 """reset readline's completer to be our own."""
861 861 self.readline.set_completer(self.Completer.complete)
862 862
863 863 def _get_call_pdb(self):
864 864 return self._call_pdb
865 865
866 866 def _set_call_pdb(self,val):
867 867
868 868 if val not in (0,1,False,True):
869 869 raise ValueError,'new call_pdb value must be boolean'
870 870
871 871 # store value in instance
872 872 self._call_pdb = val
873 873
874 874 # notify the actual exception handlers
875 875 self.InteractiveTB.call_pdb = val
876 876 if self.isthreaded:
877 877 try:
878 878 self.sys_excepthook.call_pdb = val
879 879 except:
880 880 warn('Failed to activate pdb for threaded exception handler')
881 881
882 882 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
883 883 'Control auto-activation of pdb at exceptions')
884 884
885 885
886 886 # These special functions get installed in the builtin namespace, to
887 887 # provide programmatic (pure python) access to magics, aliases and system
888 888 # calls. This is important for logging, user scripting, and more.
889 889
890 890 # We are basically exposing, via normal python functions, the three
891 891 # mechanisms in which ipython offers special call modes (magics for
892 892 # internal control, aliases for direct system access via pre-selected
893 893 # names, and !cmd for calling arbitrary system commands).
894 894
895 895 def ipmagic(self,arg_s):
896 896 """Call a magic function by name.
897 897
898 898 Input: a string containing the name of the magic function to call and any
899 899 additional arguments to be passed to the magic.
900 900
901 901 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
902 902 prompt:
903 903
904 904 In[1]: %name -opt foo bar
905 905
906 906 To call a magic without arguments, simply use ipmagic('name').
907 907
908 908 This provides a proper Python function to call IPython's magics in any
909 909 valid Python code you can type at the interpreter, including loops and
910 910 compound statements. It is added by IPython to the Python builtin
911 911 namespace upon initialization."""
912 912
913 913 args = arg_s.split(' ',1)
914 914 magic_name = args[0]
915 915 magic_name = magic_name.lstrip(self.ESC_MAGIC)
916 916
917 917 try:
918 918 magic_args = args[1]
919 919 except IndexError:
920 920 magic_args = ''
921 921 fn = getattr(self,'magic_'+magic_name,None)
922 922 if fn is None:
923 923 error("Magic function `%s` not found." % magic_name)
924 924 else:
925 925 magic_args = self.var_expand(magic_args,1)
926 926 return fn(magic_args)
927 927
928 928 def ipalias(self,arg_s):
929 929 """Call an alias by name.
930 930
931 931 Input: a string containing the name of the alias to call and any
932 932 additional arguments to be passed to the magic.
933 933
934 934 ipalias('name -opt foo bar') is equivalent to typing at the ipython
935 935 prompt:
936 936
937 937 In[1]: name -opt foo bar
938 938
939 939 To call an alias without arguments, simply use ipalias('name').
940 940
941 941 This provides a proper Python function to call IPython's aliases in any
942 942 valid Python code you can type at the interpreter, including loops and
943 943 compound statements. It is added by IPython to the Python builtin
944 944 namespace upon initialization."""
945 945
946 946 args = arg_s.split(' ',1)
947 947 alias_name = args[0]
948 948 try:
949 949 alias_args = args[1]
950 950 except IndexError:
951 951 alias_args = ''
952 952 if alias_name in self.alias_table:
953 953 self.call_alias(alias_name,alias_args)
954 954 else:
955 955 error("Alias `%s` not found." % alias_name)
956 956
957 957 def ipsystem(self,arg_s):
958 958 """Make a system call, using IPython."""
959 959
960 960 self.system(arg_s)
961 961
962 962 def complete(self,text):
963 963 """Return a sorted list of all possible completions on text.
964 964
965 965 Inputs:
966 966
967 967 - text: a string of text to be completed on.
968 968
969 969 This is a wrapper around the completion mechanism, similar to what
970 970 readline does at the command line when the TAB key is hit. By
971 971 exposing it as a method, it can be used by other non-readline
972 972 environments (such as GUIs) for text completion.
973 973
974 974 Simple usage example:
975 975
976 976 In [1]: x = 'hello'
977 977
978 978 In [2]: __IP.complete('x.l')
979 979 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
980 980
981 981 complete = self.Completer.complete
982 982 state = 0
983 983 # use a dict so we get unique keys, since ipyhton's multiple
984 984 # completers can return duplicates. When we make 2.4 a requirement,
985 985 # start using sets instead, which are faster.
986 986 comps = {}
987 987 while True:
988 988 newcomp = complete(text,state,line_buffer=text)
989 989 if newcomp is None:
990 990 break
991 991 comps[newcomp] = 1
992 992 state += 1
993 993 outcomps = comps.keys()
994 994 outcomps.sort()
995 995 return outcomps
996 996
997 997 def set_completer_frame(self, frame=None):
998 998 if frame:
999 999 self.Completer.namespace = frame.f_locals
1000 1000 self.Completer.global_namespace = frame.f_globals
1001 1001 else:
1002 1002 self.Completer.namespace = self.user_ns
1003 1003 self.Completer.global_namespace = self.user_global_ns
1004 1004
1005 1005 def init_auto_alias(self):
1006 1006 """Define some aliases automatically.
1007 1007
1008 1008 These are ALL parameter-less aliases"""
1009 1009
1010 1010 for alias,cmd in self.auto_alias:
1011 1011 self.alias_table[alias] = (0,cmd)
1012 1012
1013 1013 def alias_table_validate(self,verbose=0):
1014 1014 """Update information about the alias table.
1015 1015
1016 1016 In particular, make sure no Python keywords/builtins are in it."""
1017 1017
1018 1018 no_alias = self.no_alias
1019 1019 for k in self.alias_table.keys():
1020 1020 if k in no_alias:
1021 1021 del self.alias_table[k]
1022 1022 if verbose:
1023 1023 print ("Deleting alias <%s>, it's a Python "
1024 1024 "keyword or builtin." % k)
1025 1025
1026 1026 def set_autoindent(self,value=None):
1027 1027 """Set the autoindent flag, checking for readline support.
1028 1028
1029 1029 If called with no arguments, it acts as a toggle."""
1030 1030
1031 1031 if not self.has_readline:
1032 1032 if os.name == 'posix':
1033 1033 warn("The auto-indent feature requires the readline library")
1034 1034 self.autoindent = 0
1035 1035 return
1036 1036 if value is None:
1037 1037 self.autoindent = not self.autoindent
1038 1038 else:
1039 1039 self.autoindent = value
1040 1040
1041 1041 def rc_set_toggle(self,rc_field,value=None):
1042 1042 """Set or toggle a field in IPython's rc config. structure.
1043 1043
1044 1044 If called with no arguments, it acts as a toggle.
1045 1045
1046 1046 If called with a non-existent field, the resulting AttributeError
1047 1047 exception will propagate out."""
1048 1048
1049 1049 rc_val = getattr(self.rc,rc_field)
1050 1050 if value is None:
1051 1051 value = not rc_val
1052 1052 setattr(self.rc,rc_field,value)
1053 1053
1054 1054 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1055 1055 """Install the user configuration directory.
1056 1056
1057 1057 Can be called when running for the first time or to upgrade the user's
1058 1058 .ipython/ directory with the mode parameter. Valid modes are 'install'
1059 1059 and 'upgrade'."""
1060 1060
1061 1061 def wait():
1062 1062 try:
1063 1063 raw_input("Please press <RETURN> to start IPython.")
1064 1064 except EOFError:
1065 1065 print >> Term.cout
1066 1066 print '*'*70
1067 1067
1068 1068 cwd = os.getcwd() # remember where we started
1069 1069 glb = glob.glob
1070 1070 print '*'*70
1071 1071 if mode == 'install':
1072 1072 print \
1073 1073 """Welcome to IPython. I will try to create a personal configuration directory
1074 1074 where you can customize many aspects of IPython's functionality in:\n"""
1075 1075 else:
1076 1076 print 'I am going to upgrade your configuration in:'
1077 1077
1078 1078 print ipythondir
1079 1079
1080 1080 rcdirend = os.path.join('IPython','UserConfig')
1081 1081 cfg = lambda d: os.path.join(d,rcdirend)
1082 1082 try:
1083 1083 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1084 1084 except IOError:
1085 1085 warning = """
1086 1086 Installation error. IPython's directory was not found.
1087 1087
1088 1088 Check the following:
1089 1089
1090 1090 The ipython/IPython directory should be in a directory belonging to your
1091 1091 PYTHONPATH environment variable (that is, it should be in a directory
1092 1092 belonging to sys.path). You can copy it explicitly there or just link to it.
1093 1093
1094 1094 IPython will proceed with builtin defaults.
1095 1095 """
1096 1096 warn(warning)
1097 1097 wait()
1098 1098 return
1099 1099
1100 1100 if mode == 'install':
1101 1101 try:
1102 1102 shutil.copytree(rcdir,ipythondir)
1103 1103 os.chdir(ipythondir)
1104 1104 rc_files = glb("ipythonrc*")
1105 1105 for rc_file in rc_files:
1106 1106 os.rename(rc_file,rc_file+rc_suffix)
1107 1107 except:
1108 1108 warning = """
1109 1109
1110 1110 There was a problem with the installation:
1111 1111 %s
1112 1112 Try to correct it or contact the developers if you think it's a bug.
1113 1113 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1114 1114 warn(warning)
1115 1115 wait()
1116 1116 return
1117 1117
1118 1118 elif mode == 'upgrade':
1119 1119 try:
1120 1120 os.chdir(ipythondir)
1121 1121 except:
1122 1122 print """
1123 1123 Can not upgrade: changing to directory %s failed. Details:
1124 1124 %s
1125 1125 """ % (ipythondir,sys.exc_info()[1])
1126 1126 wait()
1127 1127 return
1128 1128 else:
1129 1129 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1130 1130 for new_full_path in sources:
1131 1131 new_filename = os.path.basename(new_full_path)
1132 1132 if new_filename.startswith('ipythonrc'):
1133 1133 new_filename = new_filename + rc_suffix
1134 1134 # The config directory should only contain files, skip any
1135 1135 # directories which may be there (like CVS)
1136 1136 if os.path.isdir(new_full_path):
1137 1137 continue
1138 1138 if os.path.exists(new_filename):
1139 1139 old_file = new_filename+'.old'
1140 1140 if os.path.exists(old_file):
1141 1141 os.remove(old_file)
1142 1142 os.rename(new_filename,old_file)
1143 1143 shutil.copy(new_full_path,new_filename)
1144 1144 else:
1145 1145 raise ValueError,'unrecognized mode for install:',`mode`
1146 1146
1147 1147 # Fix line-endings to those native to each platform in the config
1148 1148 # directory.
1149 1149 try:
1150 1150 os.chdir(ipythondir)
1151 1151 except:
1152 1152 print """
1153 1153 Problem: changing to directory %s failed.
1154 1154 Details:
1155 1155 %s
1156 1156
1157 1157 Some configuration files may have incorrect line endings. This should not
1158 1158 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1159 1159 wait()
1160 1160 else:
1161 1161 for fname in glb('ipythonrc*'):
1162 1162 try:
1163 1163 native_line_ends(fname,backup=0)
1164 1164 except IOError:
1165 1165 pass
1166 1166
1167 1167 if mode == 'install':
1168 1168 print """
1169 1169 Successful installation!
1170 1170
1171 1171 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1172 1172 IPython manual (there are both HTML and PDF versions supplied with the
1173 1173 distribution) to make sure that your system environment is properly configured
1174 1174 to take advantage of IPython's features.
1175 1175
1176 1176 Important note: the configuration system has changed! The old system is
1177 1177 still in place, but its setting may be partly overridden by the settings in
1178 1178 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1179 1179 if some of the new settings bother you.
1180 1180
1181 1181 """
1182 1182 else:
1183 1183 print """
1184 1184 Successful upgrade!
1185 1185
1186 1186 All files in your directory:
1187 1187 %(ipythondir)s
1188 1188 which would have been overwritten by the upgrade were backed up with a .old
1189 1189 extension. If you had made particular customizations in those files you may
1190 1190 want to merge them back into the new files.""" % locals()
1191 1191 wait()
1192 1192 os.chdir(cwd)
1193 1193 # end user_setup()
1194 1194
1195 1195 def atexit_operations(self):
1196 1196 """This will be executed at the time of exit.
1197 1197
1198 1198 Saving of persistent data should be performed here. """
1199 1199
1200 1200 #print '*** IPython exit cleanup ***' # dbg
1201 1201 # input history
1202 1202 self.savehist()
1203 1203
1204 1204 # Cleanup all tempfiles left around
1205 1205 for tfile in self.tempfiles:
1206 1206 try:
1207 1207 os.unlink(tfile)
1208 1208 except OSError:
1209 1209 pass
1210 1210
1211 1211 self.hooks.shutdown_hook()
1212 1212
1213 1213 def savehist(self):
1214 1214 """Save input history to a file (via readline library)."""
1215 1215 try:
1216 1216 self.readline.write_history_file(self.histfile)
1217 1217 except:
1218 1218 print 'Unable to save IPython command history to file: ' + \
1219 1219 `self.histfile`
1220 1220
1221 1221 def reloadhist(self):
1222 1222 """Reload the input history from disk file."""
1223 1223
1224 1224 if self.has_readline:
1225 1225 self.readline.clear_history()
1226 1226 self.readline.read_history_file(self.shell.histfile)
1227 1227
1228 1228 def history_saving_wrapper(self, func):
1229 1229 """ Wrap func for readline history saving
1230 1230
1231 1231 Convert func into callable that saves & restores
1232 1232 history around the call """
1233 1233
1234 1234 if not self.has_readline:
1235 1235 return func
1236 1236
1237 1237 def wrapper():
1238 1238 self.savehist()
1239 1239 try:
1240 1240 func()
1241 1241 finally:
1242 1242 readline.read_history_file(self.histfile)
1243 1243 return wrapper
1244 1244
1245 1245
1246 1246 def pre_readline(self):
1247 1247 """readline hook to be used at the start of each line.
1248 1248
1249 1249 Currently it handles auto-indent only."""
1250 1250
1251 1251 #debugx('self.indent_current_nsp','pre_readline:')
1252 1252
1253 1253 if self.rl_do_indent:
1254 1254 self.readline.insert_text(self.indent_current_str())
1255 1255 if self.rl_next_input is not None:
1256 1256 self.readline.insert_text(self.rl_next_input)
1257 1257 self.rl_next_input = None
1258 1258
1259 1259 def init_readline(self):
1260 1260 """Command history completion/saving/reloading."""
1261 1261
1262 1262 import IPython.rlineimpl as readline
1263 1263 if not readline.have_readline:
1264 1264 self.has_readline = 0
1265 1265 self.readline = None
1266 1266 # no point in bugging windows users with this every time:
1267 1267 warn('Readline services not available on this platform.')
1268 1268 else:
1269 1269 sys.modules['readline'] = readline
1270 1270 import atexit
1271 1271 from IPython.completer import IPCompleter
1272 1272 self.Completer = IPCompleter(self,
1273 1273 self.user_ns,
1274 1274 self.user_global_ns,
1275 1275 self.rc.readline_omit__names,
1276 1276 self.alias_table)
1277 1277 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1278 1278 self.strdispatchers['complete_command'] = sdisp
1279 1279 self.Completer.custom_completers = sdisp
1280 1280 # Platform-specific configuration
1281 1281 if os.name == 'nt':
1282 1282 self.readline_startup_hook = readline.set_pre_input_hook
1283 1283 else:
1284 1284 self.readline_startup_hook = readline.set_startup_hook
1285 1285
1286 1286 # Load user's initrc file (readline config)
1287 1287 inputrc_name = os.environ.get('INPUTRC')
1288 1288 if inputrc_name is None:
1289 1289 home_dir = get_home_dir()
1290 1290 if home_dir is not None:
1291 1291 inputrc_name = os.path.join(home_dir,'.inputrc')
1292 1292 if os.path.isfile(inputrc_name):
1293 1293 try:
1294 1294 readline.read_init_file(inputrc_name)
1295 1295 except:
1296 1296 warn('Problems reading readline initialization file <%s>'
1297 1297 % inputrc_name)
1298 1298
1299 1299 self.has_readline = 1
1300 1300 self.readline = readline
1301 1301 # save this in sys so embedded copies can restore it properly
1302 1302 sys.ipcompleter = self.Completer.complete
1303 1303 self.set_completer()
1304 1304
1305 1305 # Configure readline according to user's prefs
1306 1306 for rlcommand in self.rc.readline_parse_and_bind:
1307 1307 readline.parse_and_bind(rlcommand)
1308 1308
1309 1309 # remove some chars from the delimiters list
1310 1310 delims = readline.get_completer_delims()
1311 1311 delims = delims.translate(string._idmap,
1312 1312 self.rc.readline_remove_delims)
1313 1313 readline.set_completer_delims(delims)
1314 1314 # otherwise we end up with a monster history after a while:
1315 1315 readline.set_history_length(1000)
1316 1316 try:
1317 1317 #print '*** Reading readline history' # dbg
1318 1318 readline.read_history_file(self.histfile)
1319 1319 except IOError:
1320 1320 pass # It doesn't exist yet.
1321 1321
1322 1322 atexit.register(self.atexit_operations)
1323 1323 del atexit
1324 1324
1325 1325 # Configure auto-indent for all platforms
1326 1326 self.set_autoindent(self.rc.autoindent)
1327 1327
1328 1328 def ask_yes_no(self,prompt,default=True):
1329 1329 if self.rc.quiet:
1330 1330 return True
1331 1331 return ask_yes_no(prompt,default)
1332 1332
1333 1333 def _should_recompile(self,e):
1334 1334 """Utility routine for edit_syntax_error"""
1335 1335
1336 1336 if e.filename in ('<ipython console>','<input>','<string>',
1337 1337 '<console>','<BackgroundJob compilation>',
1338 1338 None):
1339 1339
1340 1340 return False
1341 1341 try:
1342 1342 if (self.rc.autoedit_syntax and
1343 1343 not self.ask_yes_no('Return to editor to correct syntax error? '
1344 1344 '[Y/n] ','y')):
1345 1345 return False
1346 1346 except EOFError:
1347 1347 return False
1348 1348
1349 1349 def int0(x):
1350 1350 try:
1351 1351 return int(x)
1352 1352 except TypeError:
1353 1353 return 0
1354 1354 # always pass integer line and offset values to editor hook
1355 1355 self.hooks.fix_error_editor(e.filename,
1356 1356 int0(e.lineno),int0(e.offset),e.msg)
1357 1357 return True
1358 1358
1359 1359 def edit_syntax_error(self):
1360 1360 """The bottom half of the syntax error handler called in the main loop.
1361 1361
1362 1362 Loop until syntax error is fixed or user cancels.
1363 1363 """
1364 1364
1365 1365 while self.SyntaxTB.last_syntax_error:
1366 1366 # copy and clear last_syntax_error
1367 1367 err = self.SyntaxTB.clear_err_state()
1368 1368 if not self._should_recompile(err):
1369 1369 return
1370 1370 try:
1371 1371 # may set last_syntax_error again if a SyntaxError is raised
1372 1372 self.safe_execfile(err.filename,self.user_ns)
1373 1373 except:
1374 1374 self.showtraceback()
1375 1375 else:
1376 1376 try:
1377 1377 f = file(err.filename)
1378 1378 try:
1379 1379 sys.displayhook(f.read())
1380 1380 finally:
1381 1381 f.close()
1382 1382 except:
1383 1383 self.showtraceback()
1384 1384
1385 1385 def showsyntaxerror(self, filename=None):
1386 1386 """Display the syntax error that just occurred.
1387 1387
1388 1388 This doesn't display a stack trace because there isn't one.
1389 1389
1390 1390 If a filename is given, it is stuffed in the exception instead
1391 1391 of what was there before (because Python's parser always uses
1392 1392 "<string>" when reading from a string).
1393 1393 """
1394 1394 etype, value, last_traceback = sys.exc_info()
1395 1395
1396 1396 # See note about these variables in showtraceback() below
1397 1397 sys.last_type = etype
1398 1398 sys.last_value = value
1399 1399 sys.last_traceback = last_traceback
1400 1400
1401 1401 if filename and etype is SyntaxError:
1402 1402 # Work hard to stuff the correct filename in the exception
1403 1403 try:
1404 1404 msg, (dummy_filename, lineno, offset, line) = value
1405 1405 except:
1406 1406 # Not the format we expect; leave it alone
1407 1407 pass
1408 1408 else:
1409 1409 # Stuff in the right filename
1410 1410 try:
1411 1411 # Assume SyntaxError is a class exception
1412 1412 value = SyntaxError(msg, (filename, lineno, offset, line))
1413 1413 except:
1414 1414 # If that failed, assume SyntaxError is a string
1415 1415 value = msg, (filename, lineno, offset, line)
1416 1416 self.SyntaxTB(etype,value,[])
1417 1417
1418 1418 def debugger(self,force=False):
1419 1419 """Call the pydb/pdb debugger.
1420 1420
1421 1421 Keywords:
1422 1422
1423 1423 - force(False): by default, this routine checks the instance call_pdb
1424 1424 flag and does not actually invoke the debugger if the flag is false.
1425 1425 The 'force' option forces the debugger to activate even if the flag
1426 1426 is false.
1427 1427 """
1428 1428
1429 1429 if not (force or self.call_pdb):
1430 1430 return
1431 1431
1432 1432 if not hasattr(sys,'last_traceback'):
1433 1433 error('No traceback has been produced, nothing to debug.')
1434 1434 return
1435 1435
1436 1436 # use pydb if available
1437 1437 if Debugger.has_pydb:
1438 1438 from pydb import pm
1439 1439 else:
1440 1440 # fallback to our internal debugger
1441 1441 pm = lambda : self.InteractiveTB.debugger(force=True)
1442 1442 self.history_saving_wrapper(pm)()
1443 1443
1444 1444 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1445 1445 """Display the exception that just occurred.
1446 1446
1447 1447 If nothing is known about the exception, this is the method which
1448 1448 should be used throughout the code for presenting user tracebacks,
1449 1449 rather than directly invoking the InteractiveTB object.
1450 1450
1451 1451 A specific showsyntaxerror() also exists, but this method can take
1452 1452 care of calling it if needed, so unless you are explicitly catching a
1453 1453 SyntaxError exception, don't try to analyze the stack manually and
1454 1454 simply call this method."""
1455 1455
1456 1456
1457 1457 # Though this won't be called by syntax errors in the input line,
1458 1458 # there may be SyntaxError cases whith imported code.
1459 1459
1460 1460
1461 1461 if exc_tuple is None:
1462 1462 etype, value, tb = sys.exc_info()
1463 1463 else:
1464 1464 etype, value, tb = exc_tuple
1465 1465
1466 1466 if etype is SyntaxError:
1467 1467 self.showsyntaxerror(filename)
1468 1468 else:
1469 1469 # WARNING: these variables are somewhat deprecated and not
1470 1470 # necessarily safe to use in a threaded environment, but tools
1471 1471 # like pdb depend on their existence, so let's set them. If we
1472 1472 # find problems in the field, we'll need to revisit their use.
1473 1473 sys.last_type = etype
1474 1474 sys.last_value = value
1475 1475 sys.last_traceback = tb
1476 1476
1477 1477 if etype in self.custom_exceptions:
1478 1478 self.CustomTB(etype,value,tb)
1479 1479 else:
1480 1480 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1481 1481 if self.InteractiveTB.call_pdb and self.has_readline:
1482 1482 # pdb mucks up readline, fix it back
1483 1483 self.set_completer()
1484 1484
1485 1485
1486 1486 def mainloop(self,banner=None):
1487 1487 """Creates the local namespace and starts the mainloop.
1488 1488
1489 1489 If an optional banner argument is given, it will override the
1490 1490 internally created default banner."""
1491 1491
1492 1492 if self.rc.c: # Emulate Python's -c option
1493 1493 self.exec_init_cmd()
1494 1494 if banner is None:
1495 1495 if not self.rc.banner:
1496 1496 banner = ''
1497 1497 # banner is string? Use it directly!
1498 1498 elif isinstance(self.rc.banner,basestring):
1499 1499 banner = self.rc.banner
1500 1500 else:
1501 1501 banner = self.BANNER+self.banner2
1502 1502
1503 1503 self.interact(banner)
1504 1504
1505 1505 def exec_init_cmd(self):
1506 1506 """Execute a command given at the command line.
1507 1507
1508 1508 This emulates Python's -c option."""
1509 1509
1510 1510 #sys.argv = ['-c']
1511 1511 self.push(self.prefilter(self.rc.c, False))
1512 1512 self.exit_now = True
1513 1513
1514 1514 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1515 1515 """Embeds IPython into a running python program.
1516 1516
1517 1517 Input:
1518 1518
1519 1519 - header: An optional header message can be specified.
1520 1520
1521 1521 - local_ns, global_ns: working namespaces. If given as None, the
1522 1522 IPython-initialized one is updated with __main__.__dict__, so that
1523 1523 program variables become visible but user-specific configuration
1524 1524 remains possible.
1525 1525
1526 1526 - stack_depth: specifies how many levels in the stack to go to
1527 1527 looking for namespaces (when local_ns and global_ns are None). This
1528 1528 allows an intermediate caller to make sure that this function gets
1529 1529 the namespace from the intended level in the stack. By default (0)
1530 1530 it will get its locals and globals from the immediate caller.
1531 1531
1532 1532 Warning: it's possible to use this in a program which is being run by
1533 1533 IPython itself (via %run), but some funny things will happen (a few
1534 1534 globals get overwritten). In the future this will be cleaned up, as
1535 1535 there is no fundamental reason why it can't work perfectly."""
1536 1536
1537 1537 # Get locals and globals from caller
1538 1538 if local_ns is None or global_ns is None:
1539 1539 call_frame = sys._getframe(stack_depth).f_back
1540 1540
1541 1541 if local_ns is None:
1542 1542 local_ns = call_frame.f_locals
1543 1543 if global_ns is None:
1544 1544 global_ns = call_frame.f_globals
1545 1545
1546 1546 # Update namespaces and fire up interpreter
1547 1547
1548 1548 # The global one is easy, we can just throw it in
1549 1549 self.user_global_ns = global_ns
1550 1550
1551 1551 # but the user/local one is tricky: ipython needs it to store internal
1552 1552 # data, but we also need the locals. We'll copy locals in the user
1553 1553 # one, but will track what got copied so we can delete them at exit.
1554 1554 # This is so that a later embedded call doesn't see locals from a
1555 1555 # previous call (which most likely existed in a separate scope).
1556 1556 local_varnames = local_ns.keys()
1557 1557 self.user_ns.update(local_ns)
1558 1558
1559 1559 # Patch for global embedding to make sure that things don't overwrite
1560 1560 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1561 1561 # FIXME. Test this a bit more carefully (the if.. is new)
1562 1562 if local_ns is None and global_ns is None:
1563 1563 self.user_global_ns.update(__main__.__dict__)
1564 1564
1565 1565 # make sure the tab-completer has the correct frame information, so it
1566 1566 # actually completes using the frame's locals/globals
1567 1567 self.set_completer_frame()
1568 1568
1569 1569 # before activating the interactive mode, we need to make sure that
1570 1570 # all names in the builtin namespace needed by ipython point to
1571 1571 # ourselves, and not to other instances.
1572 1572 self.add_builtins()
1573 1573
1574 1574 self.interact(header)
1575 1575
1576 1576 # now, purge out the user namespace from anything we might have added
1577 1577 # from the caller's local namespace
1578 1578 delvar = self.user_ns.pop
1579 1579 for var in local_varnames:
1580 1580 delvar(var,None)
1581 1581 # and clean builtins we may have overridden
1582 1582 self.clean_builtins()
1583 1583
1584 1584 def interact(self, banner=None):
1585 1585 """Closely emulate the interactive Python console.
1586 1586
1587 1587 The optional banner argument specify the banner to print
1588 1588 before the first interaction; by default it prints a banner
1589 1589 similar to the one printed by the real Python interpreter,
1590 1590 followed by the current class name in parentheses (so as not
1591 1591 to confuse this with the real interpreter -- since it's so
1592 1592 close!).
1593 1593
1594 1594 """
1595 1595
1596 1596 if self.exit_now:
1597 1597 # batch run -> do not interact
1598 1598 return
1599 1599 cprt = 'Type "copyright", "credits" or "license" for more information.'
1600 1600 if banner is None:
1601 1601 self.write("Python %s on %s\n%s\n(%s)\n" %
1602 1602 (sys.version, sys.platform, cprt,
1603 1603 self.__class__.__name__))
1604 1604 else:
1605 1605 self.write(banner)
1606 1606
1607 1607 more = 0
1608 1608
1609 1609 # Mark activity in the builtins
1610 1610 __builtin__.__dict__['__IPYTHON__active'] += 1
1611 1611
1612 1612 if readline.have_readline:
1613 1613 self.readline_startup_hook(self.pre_readline)
1614 1614 # exit_now is set by a call to %Exit or %Quit
1615 1615
1616 1616 while not self.exit_now:
1617 1617 if more:
1618 1618 prompt = self.hooks.generate_prompt(True)
1619 1619 if self.autoindent:
1620 1620 self.rl_do_indent = True
1621 1621
1622 1622 else:
1623 1623 prompt = self.hooks.generate_prompt(False)
1624 1624 try:
1625 1625 line = self.raw_input(prompt,more)
1626 1626 if self.exit_now:
1627 1627 # quick exit on sys.std[in|out] close
1628 1628 break
1629 1629 if self.autoindent:
1630 1630 self.rl_do_indent = False
1631 1631
1632 1632 except KeyboardInterrupt:
1633 1633 self.write('\nKeyboardInterrupt\n')
1634 1634 self.resetbuffer()
1635 1635 # keep cache in sync with the prompt counter:
1636 1636 self.outputcache.prompt_count -= 1
1637 1637
1638 1638 if self.autoindent:
1639 1639 self.indent_current_nsp = 0
1640 1640 more = 0
1641 1641 except EOFError:
1642 1642 if self.autoindent:
1643 1643 self.rl_do_indent = False
1644 1644 self.readline_startup_hook(None)
1645 1645 self.write('\n')
1646 1646 self.exit()
1647 1647 except bdb.BdbQuit:
1648 1648 warn('The Python debugger has exited with a BdbQuit exception.\n'
1649 1649 'Because of how pdb handles the stack, it is impossible\n'
1650 1650 'for IPython to properly format this particular exception.\n'
1651 1651 'IPython will resume normal operation.')
1652 1652 except:
1653 1653 # exceptions here are VERY RARE, but they can be triggered
1654 1654 # asynchronously by signal handlers, for example.
1655 1655 self.showtraceback()
1656 1656 else:
1657 1657 more = self.push(line)
1658 1658 if (self.SyntaxTB.last_syntax_error and
1659 1659 self.rc.autoedit_syntax):
1660 1660 self.edit_syntax_error()
1661 1661
1662 1662 # We are off again...
1663 1663 __builtin__.__dict__['__IPYTHON__active'] -= 1
1664 1664
1665 1665 def excepthook(self, etype, value, tb):
1666 1666 """One more defense for GUI apps that call sys.excepthook.
1667 1667
1668 1668 GUI frameworks like wxPython trap exceptions and call
1669 1669 sys.excepthook themselves. I guess this is a feature that
1670 1670 enables them to keep running after exceptions that would
1671 1671 otherwise kill their mainloop. This is a bother for IPython
1672 1672 which excepts to catch all of the program exceptions with a try:
1673 1673 except: statement.
1674 1674
1675 1675 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1676 1676 any app directly invokes sys.excepthook, it will look to the user like
1677 1677 IPython crashed. In order to work around this, we can disable the
1678 1678 CrashHandler and replace it with this excepthook instead, which prints a
1679 1679 regular traceback using our InteractiveTB. In this fashion, apps which
1680 1680 call sys.excepthook will generate a regular-looking exception from
1681 1681 IPython, and the CrashHandler will only be triggered by real IPython
1682 1682 crashes.
1683 1683
1684 1684 This hook should be used sparingly, only in places which are not likely
1685 1685 to be true IPython errors.
1686 1686 """
1687 1687 self.showtraceback((etype,value,tb),tb_offset=0)
1688 1688
1689 1689 def expand_aliases(self,fn,rest):
1690 1690 """ Expand multiple levels of aliases:
1691 1691
1692 1692 if:
1693 1693
1694 1694 alias foo bar /tmp
1695 1695 alias baz foo
1696 1696
1697 1697 then:
1698 1698
1699 1699 baz huhhahhei -> bar /tmp huhhahhei
1700 1700
1701 1701 """
1702 1702 line = fn + " " + rest
1703 1703
1704 1704 done = Set()
1705 1705 while 1:
1706 1706 pre,fn,rest = prefilter.splitUserInput(line,
1707 1707 prefilter.shell_line_split)
1708 1708 if fn in self.alias_table:
1709 1709 if fn in done:
1710 1710 warn("Cyclic alias definition, repeated '%s'" % fn)
1711 1711 return ""
1712 1712 done.add(fn)
1713 1713
1714 1714 l2 = self.transform_alias(fn,rest)
1715 1715 # dir -> dir
1716 1716 # print "alias",line, "->",l2 #dbg
1717 1717 if l2 == line:
1718 1718 break
1719 1719 # ls -> ls -F should not recurse forever
1720 1720 if l2.split(None,1)[0] == line.split(None,1)[0]:
1721 1721 line = l2
1722 1722 break
1723 1723
1724 1724 line=l2
1725 1725
1726 1726
1727 1727 # print "al expand to",line #dbg
1728 1728 else:
1729 1729 break
1730 1730
1731 1731 return line
1732 1732
1733 1733 def transform_alias(self, alias,rest=''):
1734 1734 """ Transform alias to system command string.
1735 1735 """
1736 1736 nargs,cmd = self.alias_table[alias]
1737 1737 if ' ' in cmd and os.path.isfile(cmd):
1738 1738 cmd = '"%s"' % cmd
1739 1739
1740 1740 # Expand the %l special to be the user's input line
1741 1741 if cmd.find('%l') >= 0:
1742 1742 cmd = cmd.replace('%l',rest)
1743 1743 rest = ''
1744 1744 if nargs==0:
1745 1745 # Simple, argument-less aliases
1746 1746 cmd = '%s %s' % (cmd,rest)
1747 1747 else:
1748 1748 # Handle aliases with positional arguments
1749 1749 args = rest.split(None,nargs)
1750 1750 if len(args)< nargs:
1751 1751 error('Alias <%s> requires %s arguments, %s given.' %
1752 1752 (alias,nargs,len(args)))
1753 1753 return None
1754 1754 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1755 1755 # Now call the macro, evaluating in the user's namespace
1756 1756 #print 'new command: <%r>' % cmd # dbg
1757 1757 return cmd
1758 1758
1759 1759 def call_alias(self,alias,rest=''):
1760 1760 """Call an alias given its name and the rest of the line.
1761 1761
1762 1762 This is only used to provide backwards compatibility for users of
1763 1763 ipalias(), use of which is not recommended for anymore."""
1764 1764
1765 1765 # Now call the macro, evaluating in the user's namespace
1766 1766 cmd = self.transform_alias(alias, rest)
1767 1767 try:
1768 1768 self.system(cmd)
1769 1769 except:
1770 1770 self.showtraceback()
1771 1771
1772 1772 def indent_current_str(self):
1773 1773 """return the current level of indentation as a string"""
1774 1774 return self.indent_current_nsp * ' '
1775 1775
1776 1776 def autoindent_update(self,line):
1777 1777 """Keep track of the indent level."""
1778 1778
1779 1779 #debugx('line')
1780 1780 #debugx('self.indent_current_nsp')
1781 1781 if self.autoindent:
1782 1782 if line:
1783 1783 inisp = num_ini_spaces(line)
1784 1784 if inisp < self.indent_current_nsp:
1785 1785 self.indent_current_nsp = inisp
1786 1786
1787 1787 if line[-1] == ':':
1788 1788 self.indent_current_nsp += 4
1789 1789 elif dedent_re.match(line):
1790 1790 self.indent_current_nsp -= 4
1791 1791 else:
1792 1792 self.indent_current_nsp = 0
1793 1793 def runlines(self,lines):
1794 1794 """Run a string of one or more lines of source.
1795 1795
1796 1796 This method is capable of running a string containing multiple source
1797 1797 lines, as if they had been entered at the IPython prompt. Since it
1798 1798 exposes IPython's processing machinery, the given strings can contain
1799 1799 magic calls (%magic), special shell access (!cmd), etc."""
1800 1800
1801 1801 # We must start with a clean buffer, in case this is run from an
1802 1802 # interactive IPython session (via a magic, for example).
1803 1803 self.resetbuffer()
1804 1804 lines = lines.split('\n')
1805 1805 more = 0
1806 1806
1807 1807 for line in lines:
1808 1808 # skip blank lines so we don't mess up the prompt counter, but do
1809 1809 # NOT skip even a blank line if we are in a code block (more is
1810 1810 # true)
1811 1811
1812 1812
1813 1813 if line or more:
1814 1814 # push to raw history, so hist line numbers stay in sync
1815 1815 self.input_hist_raw.append("# " + line + "\n")
1816 1816 more = self.push(self.prefilter(line,more))
1817 1817 # IPython's runsource returns None if there was an error
1818 1818 # compiling the code. This allows us to stop processing right
1819 1819 # away, so the user gets the error message at the right place.
1820 1820 if more is None:
1821 1821 break
1822 1822 # final newline in case the input didn't have it, so that the code
1823 1823 # actually does get executed
1824 1824 if more:
1825 1825 self.push('\n')
1826 1826
1827 1827 def runsource(self, source, filename='<input>', symbol='single'):
1828 1828 """Compile and run some source in the interpreter.
1829 1829
1830 1830 Arguments are as for compile_command().
1831 1831
1832 1832 One several things can happen:
1833 1833
1834 1834 1) The input is incorrect; compile_command() raised an
1835 1835 exception (SyntaxError or OverflowError). A syntax traceback
1836 1836 will be printed by calling the showsyntaxerror() method.
1837 1837
1838 1838 2) The input is incomplete, and more input is required;
1839 1839 compile_command() returned None. Nothing happens.
1840 1840
1841 1841 3) The input is complete; compile_command() returned a code
1842 1842 object. The code is executed by calling self.runcode() (which
1843 1843 also handles run-time exceptions, except for SystemExit).
1844 1844
1845 1845 The return value is:
1846 1846
1847 1847 - True in case 2
1848 1848
1849 1849 - False in the other cases, unless an exception is raised, where
1850 1850 None is returned instead. This can be used by external callers to
1851 1851 know whether to continue feeding input or not.
1852 1852
1853 1853 The return value can be used to decide whether to use sys.ps1 or
1854 1854 sys.ps2 to prompt the next line."""
1855 1855
1856 1856 # if the source code has leading blanks, add 'if 1:\n' to it
1857 1857 # this allows execution of indented pasted code. It is tempting
1858 1858 # to add '\n' at the end of source to run commands like ' a=1'
1859 1859 # directly, but this fails for more complicated scenarios
1860 1860 if source[:1] in [' ', '\t']:
1861 1861 source = 'if 1:\n%s' % source
1862 1862
1863 1863 try:
1864 1864 code = self.compile(source,filename,symbol)
1865 1865 except (OverflowError, SyntaxError, ValueError):
1866 1866 # Case 1
1867 1867 self.showsyntaxerror(filename)
1868 1868 return None
1869 1869
1870 1870 if code is None:
1871 1871 # Case 2
1872 1872 return True
1873 1873
1874 1874 # Case 3
1875 1875 # We store the code object so that threaded shells and
1876 1876 # custom exception handlers can access all this info if needed.
1877 1877 # The source corresponding to this can be obtained from the
1878 1878 # buffer attribute as '\n'.join(self.buffer).
1879 1879 self.code_to_run = code
1880 1880 # now actually execute the code object
1881 1881 if self.runcode(code) == 0:
1882 1882 return False
1883 1883 else:
1884 1884 return None
1885 1885
1886 1886 def runcode(self,code_obj):
1887 1887 """Execute a code object.
1888 1888
1889 1889 When an exception occurs, self.showtraceback() is called to display a
1890 1890 traceback.
1891 1891
1892 1892 Return value: a flag indicating whether the code to be run completed
1893 1893 successfully:
1894 1894
1895 1895 - 0: successful execution.
1896 1896 - 1: an error occurred.
1897 1897 """
1898 1898
1899 1899 # Set our own excepthook in case the user code tries to call it
1900 1900 # directly, so that the IPython crash handler doesn't get triggered
1901 1901 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1902 1902
1903 1903 # we save the original sys.excepthook in the instance, in case config
1904 1904 # code (such as magics) needs access to it.
1905 1905 self.sys_excepthook = old_excepthook
1906 1906 outflag = 1 # happens in more places, so it's easier as default
1907 1907 try:
1908 1908 try:
1909 1909 # Embedded instances require separate global/local namespaces
1910 1910 # so they can see both the surrounding (local) namespace and
1911 1911 # the module-level globals when called inside another function.
1912 1912 if self.embedded:
1913 1913 exec code_obj in self.user_global_ns, self.user_ns
1914 1914 # Normal (non-embedded) instances should only have a single
1915 1915 # namespace for user code execution, otherwise functions won't
1916 1916 # see interactive top-level globals.
1917 1917 else:
1918 1918 exec code_obj in self.user_ns
1919 1919 finally:
1920 1920 # Reset our crash handler in place
1921 1921 sys.excepthook = old_excepthook
1922 1922 except SystemExit:
1923 1923 self.resetbuffer()
1924 1924 self.showtraceback()
1925 1925 warn("Type %exit or %quit to exit IPython "
1926 1926 "(%Exit or %Quit do so unconditionally).",level=1)
1927 1927 except self.custom_exceptions:
1928 1928 etype,value,tb = sys.exc_info()
1929 1929 self.CustomTB(etype,value,tb)
1930 1930 except:
1931 1931 self.showtraceback()
1932 1932 else:
1933 1933 outflag = 0
1934 1934 if softspace(sys.stdout, 0):
1935 1935 print
1936 1936 # Flush out code object which has been run (and source)
1937 1937 self.code_to_run = None
1938 1938 return outflag
1939 1939
1940 1940 def push(self, line):
1941 1941 """Push a line to the interpreter.
1942 1942
1943 1943 The line should not have a trailing newline; it may have
1944 1944 internal newlines. The line is appended to a buffer and the
1945 1945 interpreter's runsource() method is called with the
1946 1946 concatenated contents of the buffer as source. If this
1947 1947 indicates that the command was executed or invalid, the buffer
1948 1948 is reset; otherwise, the command is incomplete, and the buffer
1949 1949 is left as it was after the line was appended. The return
1950 1950 value is 1 if more input is required, 0 if the line was dealt
1951 1951 with in some way (this is the same as runsource()).
1952 1952 """
1953 1953
1954 1954 # autoindent management should be done here, and not in the
1955 1955 # interactive loop, since that one is only seen by keyboard input. We
1956 1956 # need this done correctly even for code run via runlines (which uses
1957 1957 # push).
1958 1958
1959 1959 #print 'push line: <%s>' % line # dbg
1960 1960 for subline in line.splitlines():
1961 1961 self.autoindent_update(subline)
1962 1962 self.buffer.append(line)
1963 1963 more = self.runsource('\n'.join(self.buffer), self.filename)
1964 1964 if not more:
1965 1965 self.resetbuffer()
1966 1966 return more
1967 1967
1968 1968 def split_user_input(self, line):
1969 1969 # This is really a hold-over to support ipapi and some extensions
1970 1970 return prefilter.splitUserInput(line)
1971 1971
1972 1972 def resetbuffer(self):
1973 1973 """Reset the input buffer."""
1974 1974 self.buffer[:] = []
1975 1975
1976 1976 def raw_input(self,prompt='',continue_prompt=False):
1977 1977 """Write a prompt and read a line.
1978 1978
1979 1979 The returned line does not include the trailing newline.
1980 1980 When the user enters the EOF key sequence, EOFError is raised.
1981 1981
1982 1982 Optional inputs:
1983 1983
1984 1984 - prompt(''): a string to be printed to prompt the user.
1985 1985
1986 1986 - continue_prompt(False): whether this line is the first one or a
1987 1987 continuation in a sequence of inputs.
1988 1988 """
1989 1989
1990 1990 # Code run by the user may have modified the readline completer state.
1991 1991 # We must ensure that our completer is back in place.
1992 1992 if self.has_readline:
1993 1993 self.set_completer()
1994 1994
1995 1995 try:
1996 1996 line = raw_input_original(prompt).decode(self.stdin_encoding)
1997 1997 except ValueError:
1998 1998 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
1999 1999 " or sys.stdout.close()!\nExiting IPython!")
2000 2000 self.exit_now = True
2001 2001 return ""
2002 2002
2003 2003 # Try to be reasonably smart about not re-indenting pasted input more
2004 2004 # than necessary. We do this by trimming out the auto-indent initial
2005 2005 # spaces, if the user's actual input started itself with whitespace.
2006 2006 #debugx('self.buffer[-1]')
2007 2007
2008 2008 if self.autoindent:
2009 2009 if num_ini_spaces(line) > self.indent_current_nsp:
2010 2010 line = line[self.indent_current_nsp:]
2011 2011 self.indent_current_nsp = 0
2012 2012
2013 2013 # store the unfiltered input before the user has any chance to modify
2014 2014 # it.
2015 2015 if line.strip():
2016 2016 if continue_prompt:
2017 2017 self.input_hist_raw[-1] += '%s\n' % line
2018 2018 if self.has_readline: # and some config option is set?
2019 2019 try:
2020 2020 histlen = self.readline.get_current_history_length()
2021 2021 newhist = self.input_hist_raw[-1].rstrip()
2022 2022 self.readline.remove_history_item(histlen-1)
2023 2023 self.readline.replace_history_item(histlen-2,newhist)
2024 2024 except AttributeError:
2025 2025 pass # re{move,place}_history_item are new in 2.4.
2026 2026 else:
2027 2027 self.input_hist_raw.append('%s\n' % line)
2028 2028
2029 2029 if line.lstrip() == line:
2030 2030 self.shadowhist.add(line.strip())
2031 2031
2032 2032 try:
2033 2033 lineout = self.prefilter(line,continue_prompt)
2034 2034 except:
2035 2035 # blanket except, in case a user-defined prefilter crashes, so it
2036 2036 # can't take all of ipython with it.
2037 2037 self.showtraceback()
2038 2038 return ''
2039 2039 else:
2040 2040 return lineout
2041 2041
2042 2042 def _prefilter(self, line, continue_prompt):
2043 2043 """Calls different preprocessors, depending on the form of line."""
2044 2044
2045 2045 # All handlers *must* return a value, even if it's blank ('').
2046 2046
2047 2047 # Lines are NOT logged here. Handlers should process the line as
2048 2048 # needed, update the cache AND log it (so that the input cache array
2049 2049 # stays synced).
2050 2050
2051 2051 #.....................................................................
2052 2052 # Code begins
2053 2053
2054 2054 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2055 2055
2056 2056 # save the line away in case we crash, so the post-mortem handler can
2057 2057 # record it
2058 2058 self._last_input_line = line
2059 2059
2060 2060 #print '***line: <%s>' % line # dbg
2061 2061
2062 if not line:
2063 # Return immediately on purely empty lines, so that if the user
2064 # previously typed some whitespace that started a continuation
2065 # prompt, he can break out of that loop with just an empty line.
2066 # This is how the default python prompt works.
2067
2068 # Only return if the accumulated input buffer was just whitespace!
2069 if ''.join(self.buffer).isspace():
2070 self.buffer[:] = []
2071 return ''
2072
2062 2073 line_info = prefilter.LineInfo(line, continue_prompt)
2063 2074
2064 2075 # the input history needs to track even empty lines
2065 2076 stripped = line.strip()
2066 2077
2067 2078 if not stripped:
2068 2079 if not continue_prompt:
2069 2080 self.outputcache.prompt_count -= 1
2070 2081 return self.handle_normal(line_info)
2071 2082
2072 2083 # print '***cont',continue_prompt # dbg
2073 2084 # special handlers are only allowed for single line statements
2074 2085 if continue_prompt and not self.rc.multi_line_specials:
2075 2086 return self.handle_normal(line_info)
2076 2087
2077 2088
2078 2089 # See whether any pre-existing handler can take care of it
2079 2090 rewritten = self.hooks.input_prefilter(stripped)
2080 2091 if rewritten != stripped: # ok, some prefilter did something
2081 2092 rewritten = line_info.pre + rewritten # add indentation
2082 2093 return self.handle_normal(prefilter.LineInfo(rewritten,
2083 2094 continue_prompt))
2084 2095
2085 2096 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2086 2097
2087 2098 return prefilter.prefilter(line_info, self)
2088 2099
2089 2100
2090 2101 def _prefilter_dumb(self, line, continue_prompt):
2091 2102 """simple prefilter function, for debugging"""
2092 2103 return self.handle_normal(line,continue_prompt)
2093 2104
2094 2105
2095 2106 def multiline_prefilter(self, line, continue_prompt):
2096 2107 """ Run _prefilter for each line of input
2097 2108
2098 2109 Covers cases where there are multiple lines in the user entry,
2099 2110 which is the case when the user goes back to a multiline history
2100 2111 entry and presses enter.
2101 2112
2102 2113 """
2103 2114 out = []
2104 2115 for l in line.rstrip('\n').split('\n'):
2105 2116 out.append(self._prefilter(l, continue_prompt))
2106 2117 return '\n'.join(out)
2107 2118
2108 2119 # Set the default prefilter() function (this can be user-overridden)
2109 2120 prefilter = multiline_prefilter
2110 2121
2111 2122 def handle_normal(self,line_info):
2112 2123 """Handle normal input lines. Use as a template for handlers."""
2113 2124
2114 2125 # With autoindent on, we need some way to exit the input loop, and I
2115 2126 # don't want to force the user to have to backspace all the way to
2116 2127 # clear the line. The rule will be in this case, that either two
2117 2128 # lines of pure whitespace in a row, or a line of pure whitespace but
2118 2129 # of a size different to the indent level, will exit the input loop.
2119 2130 line = line_info.line
2120 2131 continue_prompt = line_info.continue_prompt
2121 2132
2122 2133 if (continue_prompt and self.autoindent and line.isspace() and
2123 2134 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2124 2135 (self.buffer[-1]).isspace() )):
2125 2136 line = ''
2126 2137
2127 2138 self.log(line,line,continue_prompt)
2128 2139 return line
2129 2140
2130 2141 def handle_alias(self,line_info):
2131 2142 """Handle alias input lines. """
2132 2143 tgt = self.alias_table[line_info.iFun]
2133 2144 # print "=>",tgt #dbg
2134 2145 if callable(tgt):
2135 2146 line_out = "_sh." + line_info.iFun + '(r"""' + line_info.theRest + '""")'
2136 2147 else:
2137 2148 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2138 2149
2139 2150 # pre is needed, because it carries the leading whitespace. Otherwise
2140 2151 # aliases won't work in indented sections.
2141 2152 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2142 2153 make_quoted_expr( transformed ))
2143 2154
2144 2155 self.log(line_info.line,line_out,line_info.continue_prompt)
2145 2156 #print 'line out:',line_out # dbg
2146 2157 return line_out
2147 2158
2148 2159 def handle_shell_escape(self, line_info):
2149 2160 """Execute the line in a shell, empty return value"""
2150 2161 #print 'line in :', `line` # dbg
2151 2162 line = line_info.line
2152 2163 if line.lstrip().startswith('!!'):
2153 2164 # rewrite LineInfo's line, iFun and theRest to properly hold the
2154 2165 # call to %sx and the actual command to be executed, so
2155 2166 # handle_magic can work correctly. Note that this works even if
2156 2167 # the line is indented, so it handles multi_line_specials
2157 2168 # properly.
2158 2169 new_rest = line.lstrip()[2:]
2159 2170 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2160 2171 line_info.iFun = 'sx'
2161 2172 line_info.theRest = new_rest
2162 2173 return self.handle_magic(line_info)
2163 2174 else:
2164 2175 cmd = line.lstrip().lstrip('!')
2165 2176 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2166 2177 make_quoted_expr(cmd))
2167 2178 # update cache/log and return
2168 2179 self.log(line,line_out,line_info.continue_prompt)
2169 2180 return line_out
2170 2181
2171 2182 def handle_magic(self, line_info):
2172 2183 """Execute magic functions."""
2173 2184 iFun = line_info.iFun
2174 2185 theRest = line_info.theRest
2175 2186 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2176 2187 make_quoted_expr(iFun + " " + theRest))
2177 2188 self.log(line_info.line,cmd,line_info.continue_prompt)
2178 2189 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2179 2190 return cmd
2180 2191
2181 2192 def handle_auto(self, line_info):
2182 2193 """Hande lines which can be auto-executed, quoting if requested."""
2183 2194
2184 2195 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2185 2196 line = line_info.line
2186 2197 iFun = line_info.iFun
2187 2198 theRest = line_info.theRest
2188 2199 pre = line_info.pre
2189 2200 continue_prompt = line_info.continue_prompt
2190 2201 obj = line_info.ofind(self)['obj']
2191 2202
2192 2203 # This should only be active for single-line input!
2193 2204 if continue_prompt:
2194 2205 self.log(line,line,continue_prompt)
2195 2206 return line
2196 2207
2197 2208 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2198 2209 auto_rewrite = True
2199 2210
2200 2211 if pre == self.ESC_QUOTE:
2201 2212 # Auto-quote splitting on whitespace
2202 2213 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2203 2214 elif pre == self.ESC_QUOTE2:
2204 2215 # Auto-quote whole string
2205 2216 newcmd = '%s("%s")' % (iFun,theRest)
2206 2217 elif pre == self.ESC_PAREN:
2207 2218 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2208 2219 else:
2209 2220 # Auto-paren.
2210 2221 # We only apply it to argument-less calls if the autocall
2211 2222 # parameter is set to 2. We only need to check that autocall is <
2212 2223 # 2, since this function isn't called unless it's at least 1.
2213 2224 if not theRest and (self.rc.autocall < 2) and not force_auto:
2214 2225 newcmd = '%s %s' % (iFun,theRest)
2215 2226 auto_rewrite = False
2216 2227 else:
2217 2228 if not force_auto and theRest.startswith('['):
2218 2229 if hasattr(obj,'__getitem__'):
2219 2230 # Don't autocall in this case: item access for an object
2220 2231 # which is BOTH callable and implements __getitem__.
2221 2232 newcmd = '%s %s' % (iFun,theRest)
2222 2233 auto_rewrite = False
2223 2234 else:
2224 2235 # if the object doesn't support [] access, go ahead and
2225 2236 # autocall
2226 2237 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2227 2238 elif theRest.endswith(';'):
2228 2239 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2229 2240 else:
2230 2241 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2231 2242
2232 2243 if auto_rewrite:
2233 2244 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2234 2245
2235 2246 try:
2236 2247 # plain ascii works better w/ pyreadline, on some machines, so
2237 2248 # we use it and only print uncolored rewrite if we have unicode
2238 2249 rw = str(rw)
2239 2250 print >>Term.cout, rw
2240 2251 except UnicodeEncodeError:
2241 2252 print "-------------->" + newcmd
2242 2253
2243 2254 # log what is now valid Python, not the actual user input (without the
2244 2255 # final newline)
2245 2256 self.log(line,newcmd,continue_prompt)
2246 2257 return newcmd
2247 2258
2248 2259 def handle_help(self, line_info):
2249 2260 """Try to get some help for the object.
2250 2261
2251 2262 obj? or ?obj -> basic information.
2252 2263 obj?? or ??obj -> more details.
2253 2264 """
2254 2265
2255 2266 line = line_info.line
2256 2267 # We need to make sure that we don't process lines which would be
2257 2268 # otherwise valid python, such as "x=1 # what?"
2258 2269 try:
2259 2270 codeop.compile_command(line)
2260 2271 except SyntaxError:
2261 2272 # We should only handle as help stuff which is NOT valid syntax
2262 2273 if line[0]==self.ESC_HELP:
2263 2274 line = line[1:]
2264 2275 elif line[-1]==self.ESC_HELP:
2265 2276 line = line[:-1]
2266 2277 self.log(line,'#?'+line,line_info.continue_prompt)
2267 2278 if line:
2268 2279 #print 'line:<%r>' % line # dbg
2269 2280 self.magic_pinfo(line)
2270 2281 else:
2271 2282 page(self.usage,screen_lines=self.rc.screen_length)
2272 2283 return '' # Empty string is needed here!
2273 2284 except:
2274 2285 # Pass any other exceptions through to the normal handler
2275 2286 return self.handle_normal(line_info)
2276 2287 else:
2277 2288 # If the code compiles ok, we should handle it normally
2278 2289 return self.handle_normal(line_info)
2279 2290
2280 2291 def getapi(self):
2281 2292 """ Get an IPApi object for this shell instance
2282 2293
2283 2294 Getting an IPApi object is always preferable to accessing the shell
2284 2295 directly, but this holds true especially for extensions.
2285 2296
2286 2297 It should always be possible to implement an extension with IPApi
2287 2298 alone. If not, contact maintainer to request an addition.
2288 2299
2289 2300 """
2290 2301 return self.api
2291 2302
2292 2303 def handle_emacs(self, line_info):
2293 2304 """Handle input lines marked by python-mode."""
2294 2305
2295 2306 # Currently, nothing is done. Later more functionality can be added
2296 2307 # here if needed.
2297 2308
2298 2309 # The input cache shouldn't be updated
2299 2310 return line_info.line
2300 2311
2301 2312
2302 2313 def mktempfile(self,data=None):
2303 2314 """Make a new tempfile and return its filename.
2304 2315
2305 2316 This makes a call to tempfile.mktemp, but it registers the created
2306 2317 filename internally so ipython cleans it up at exit time.
2307 2318
2308 2319 Optional inputs:
2309 2320
2310 2321 - data(None): if data is given, it gets written out to the temp file
2311 2322 immediately, and the file is closed again."""
2312 2323
2313 2324 filename = tempfile.mktemp('.py','ipython_edit_')
2314 2325 self.tempfiles.append(filename)
2315 2326
2316 2327 if data:
2317 2328 tmp_file = open(filename,'w')
2318 2329 tmp_file.write(data)
2319 2330 tmp_file.close()
2320 2331 return filename
2321 2332
2322 2333 def write(self,data):
2323 2334 """Write a string to the default output"""
2324 2335 Term.cout.write(data)
2325 2336
2326 2337 def write_err(self,data):
2327 2338 """Write a string to the default error output"""
2328 2339 Term.cerr.write(data)
2329 2340
2330 2341 def exit(self):
2331 2342 """Handle interactive exit.
2332 2343
2333 2344 This method sets the exit_now attribute."""
2334 2345
2335 2346 if self.rc.confirm_exit:
2336 2347 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2337 2348 self.exit_now = True
2338 2349 else:
2339 2350 self.exit_now = True
2340 2351
2341 2352 def safe_execfile(self,fname,*where,**kw):
2342 2353 """A safe version of the builtin execfile().
2343 2354
2344 2355 This version will never throw an exception, and knows how to handle
2345 2356 ipython logs as well."""
2346 2357
2347 2358 def syspath_cleanup():
2348 2359 """Internal cleanup routine for sys.path."""
2349 2360 if add_dname:
2350 2361 try:
2351 2362 sys.path.remove(dname)
2352 2363 except ValueError:
2353 2364 # For some reason the user has already removed it, ignore.
2354 2365 pass
2355 2366
2356 2367 fname = os.path.expanduser(fname)
2357 2368
2358 2369 # Find things also in current directory. This is needed to mimic the
2359 2370 # behavior of running a script from the system command line, where
2360 2371 # Python inserts the script's directory into sys.path
2361 2372 dname = os.path.dirname(os.path.abspath(fname))
2362 2373 add_dname = False
2363 2374 if dname not in sys.path:
2364 2375 sys.path.insert(0,dname)
2365 2376 add_dname = True
2366 2377
2367 2378 try:
2368 2379 xfile = open(fname)
2369 2380 except:
2370 2381 print >> Term.cerr, \
2371 2382 'Could not open file <%s> for safe execution.' % fname
2372 2383 syspath_cleanup()
2373 2384 return None
2374 2385
2375 2386 kw.setdefault('islog',0)
2376 2387 kw.setdefault('quiet',1)
2377 2388 kw.setdefault('exit_ignore',0)
2378 2389 first = xfile.readline()
2379 2390 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2380 2391 xfile.close()
2381 2392 # line by line execution
2382 2393 if first.startswith(loghead) or kw['islog']:
2383 2394 print 'Loading log file <%s> one line at a time...' % fname
2384 2395 if kw['quiet']:
2385 2396 stdout_save = sys.stdout
2386 2397 sys.stdout = StringIO.StringIO()
2387 2398 try:
2388 2399 globs,locs = where[0:2]
2389 2400 except:
2390 2401 try:
2391 2402 globs = locs = where[0]
2392 2403 except:
2393 2404 globs = locs = globals()
2394 2405 badblocks = []
2395 2406
2396 2407 # we also need to identify indented blocks of code when replaying
2397 2408 # logs and put them together before passing them to an exec
2398 2409 # statement. This takes a bit of regexp and look-ahead work in the
2399 2410 # file. It's easiest if we swallow the whole thing in memory
2400 2411 # first, and manually walk through the lines list moving the
2401 2412 # counter ourselves.
2402 2413 indent_re = re.compile('\s+\S')
2403 2414 xfile = open(fname)
2404 2415 filelines = xfile.readlines()
2405 2416 xfile.close()
2406 2417 nlines = len(filelines)
2407 2418 lnum = 0
2408 2419 while lnum < nlines:
2409 2420 line = filelines[lnum]
2410 2421 lnum += 1
2411 2422 # don't re-insert logger status info into cache
2412 2423 if line.startswith('#log#'):
2413 2424 continue
2414 2425 else:
2415 2426 # build a block of code (maybe a single line) for execution
2416 2427 block = line
2417 2428 try:
2418 2429 next = filelines[lnum] # lnum has already incremented
2419 2430 except:
2420 2431 next = None
2421 2432 while next and indent_re.match(next):
2422 2433 block += next
2423 2434 lnum += 1
2424 2435 try:
2425 2436 next = filelines[lnum]
2426 2437 except:
2427 2438 next = None
2428 2439 # now execute the block of one or more lines
2429 2440 try:
2430 2441 exec block in globs,locs
2431 2442 except SystemExit:
2432 2443 pass
2433 2444 except:
2434 2445 badblocks.append(block.rstrip())
2435 2446 if kw['quiet']: # restore stdout
2436 2447 sys.stdout.close()
2437 2448 sys.stdout = stdout_save
2438 2449 print 'Finished replaying log file <%s>' % fname
2439 2450 if badblocks:
2440 2451 print >> sys.stderr, ('\nThe following lines/blocks in file '
2441 2452 '<%s> reported errors:' % fname)
2442 2453
2443 2454 for badline in badblocks:
2444 2455 print >> sys.stderr, badline
2445 2456 else: # regular file execution
2446 2457 try:
2447 2458 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2448 2459 # Work around a bug in Python for Windows. The bug was
2449 2460 # fixed in in Python 2.5 r54159 and 54158, but that's still
2450 2461 # SVN Python as of March/07. For details, see:
2451 2462 # http://projects.scipy.org/ipython/ipython/ticket/123
2452 2463 try:
2453 2464 globs,locs = where[0:2]
2454 2465 except:
2455 2466 try:
2456 2467 globs = locs = where[0]
2457 2468 except:
2458 2469 globs = locs = globals()
2459 2470 exec file(fname) in globs,locs
2460 2471 else:
2461 2472 execfile(fname,*where)
2462 2473 except SyntaxError:
2463 2474 self.showsyntaxerror()
2464 2475 warn('Failure executing file: <%s>' % fname)
2465 2476 except SystemExit,status:
2466 2477 if not kw['exit_ignore']:
2467 2478 self.showtraceback()
2468 2479 warn('Failure executing file: <%s>' % fname)
2469 2480 except:
2470 2481 self.showtraceback()
2471 2482 warn('Failure executing file: <%s>' % fname)
2472 2483
2473 2484 syspath_cleanup()
2474 2485
2475 2486 #************************* end of file <iplib.py> *****************************
@@ -1,6911 +1,6932 b''
1 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/Extensions/ipy_profile_doctest.py: New profile for
4 doctest support. It sets prompts/exceptions as similar to
5 standard Python as possible, so that ipython sessions in this
6 profile can be easily pasted as doctests with minimal
7 modifications. It also enables pasting of doctests from external
8 sources (even if they have leading whitespace), so that you can
9 rerun doctests from existing sources.
10
11 * IPython/iplib.py (_prefilter): fix a buglet where after entering
12 some whitespace, the prompt would become a continuation prompt
13 with no way of exiting it other than Ctrl-C. This fix brings us
14 into conformity with how the default python prompt works.
15
16 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
17 Add support for pasting not only lines that start with '>>>', but
18 also with ' >>>'. That is, arbitrary whitespace can now precede
19 the prompts. This makes the system useful for pasting doctests
20 from docstrings back into a normal session.
21
1 22 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
2 23
3 24 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
4 25 r1357, which had killed multiple invocations of an embedded
5 26 ipython (this means that example-embed has been broken for over 1
6 27 year!!!). Rather than possibly breaking the batch stuff for which
7 28 the code in iplib.py/interact was introduced, I worked around the
8 29 problem in the embedding class in Shell.py. We really need a
9 30 bloody test suite for this code, I'm sick of finding stuff that
10 31 used to work breaking left and right every time I use an old
11 32 feature I hadn't touched in a few months.
12 33 (kill_embedded): Add a new magic that only shows up in embedded
13 34 mode, to allow users to permanently deactivate an embedded instance.
14 35
15 36 2007-08-01 Ville Vainio <vivainio@gmail.com>
16 37
17 38 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
18 39 history gets out of sync on runlines (e.g. when running macros).
19 40
20 41 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
21 42
22 43 * IPython/Magic.py (magic_colors): fix win32-related error message
23 44 that could appear under *nix when readline was missing. Patch by
24 45 Scott Jackson, closes #175.
25 46
26 47 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
27 48
28 49 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
29 50 completer that it traits-aware, so that traits objects don't show
30 51 all of their internal attributes all the time.
31 52
32 53 * IPython/genutils.py (dir2): moved this code from inside
33 54 completer.py to expose it publicly, so I could use it in the
34 55 wildcards bugfix.
35 56
36 57 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
37 58 Stefan with Traits.
38 59
39 60 * IPython/completer.py (Completer.attr_matches): change internal
40 61 var name from 'object' to 'obj', since 'object' is now a builtin
41 62 and this can lead to weird bugs if reusing this code elsewhere.
42 63
43 64 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
44 65
45 66 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
46 67 'foo?' and update the code to prevent printing of default
47 68 docstrings that started appearing after I added support for
48 69 new-style classes. The approach I'm using isn't ideal (I just
49 70 special-case those strings) but I'm not sure how to more robustly
50 71 differentiate between truly user-written strings and Python's
51 72 automatic ones.
52 73
53 74 2007-07-09 Ville Vainio <vivainio@gmail.com>
54 75
55 76 * completer.py: Applied Matthew Neeley's patch:
56 77 Dynamic attributes from trait_names and _getAttributeNames are added
57 78 to the list of tab completions, but when this happens, the attribute
58 79 list is turned into a set, so the attributes are unordered when
59 80 printed, which makes it hard to find the right completion. This patch
60 81 turns this set back into a list and sort it.
61 82
62 83 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
63 84
64 85 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
65 86 classes in various inspector functions.
66 87
67 88 2007-06-28 Ville Vainio <vivainio@gmail.com>
68 89
69 90 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
70 91 Implement "shadow" namespace, and callable aliases that reside there.
71 92 Use them by:
72 93
73 94 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
74 95
75 96 foo hello world
76 97 (gets translated to:)
77 98 _sh.foo(r"""hello world""")
78 99
79 100 In practice, this kind of alias can take the role of a magic function
80 101
81 102 * New generic inspect_object, called on obj? and obj??
82 103
83 104 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
84 105
85 106 * IPython/ultraTB.py (findsource): fix a problem with
86 107 inspect.getfile that can cause crashes during traceback construction.
87 108
88 109 2007-06-14 Ville Vainio <vivainio@gmail.com>
89 110
90 111 * iplib.py (handle_auto): Try to use ascii for printing "--->"
91 112 autocall rewrite indication, becausesometimes unicode fails to print
92 113 properly (and you get ' - - - '). Use plain uncoloured ---> for
93 114 unicode.
94 115
95 116 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
96 117
97 118 . pickleshare 'hash' commands (hget, hset, hcompress,
98 119 hdict) for efficient shadow history storage.
99 120
100 121 2007-06-13 Ville Vainio <vivainio@gmail.com>
101 122
102 123 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
103 124 Added kw arg 'interactive', tell whether vars should be visible
104 125 with %whos.
105 126
106 127 2007-06-11 Ville Vainio <vivainio@gmail.com>
107 128
108 129 * pspersistence.py, Magic.py, iplib.py: directory history now saved
109 130 to db
110 131
111 132 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
112 133 Also, it exits IPython immediately after evaluating the command (just like
113 134 std python)
114 135
115 136 2007-06-05 Walter Doerwald <walter@livinglogic.de>
116 137
117 138 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
118 139 Python string and captures the output. (Idea and original patch by
119 140 StοΏ½fan van der Walt)
120 141
121 142 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
122 143
123 144 * IPython/ultraTB.py (VerboseTB.text): update printing of
124 145 exception types for Python 2.5 (now all exceptions in the stdlib
125 146 are new-style classes).
126 147
127 148 2007-05-31 Walter Doerwald <walter@livinglogic.de>
128 149
129 150 * IPython/Extensions/igrid.py: Add new commands refresh and
130 151 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
131 152 the iterator once (refresh) or after every x seconds (refresh_timer).
132 153 Add a working implementation of "searchexpression", where the text
133 154 entered is not the text to search for, but an expression that must
134 155 be true. Added display of shortcuts to the menu. Added commands "pickinput"
135 156 and "pickinputattr" that put the object or attribute under the cursor
136 157 in the input line. Split the statusbar to be able to display the currently
137 158 active refresh interval. (Patch by Nik Tautenhahn)
138 159
139 160 2007-05-29 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
140 161
141 162 * fixing set_term_title to use ctypes as default
142 163
143 164 * fixing set_term_title fallback to work when curent dir
144 165 is on a windows network share
145 166
146 167 2007-05-28 Ville Vainio <vivainio@gmail.com>
147 168
148 169 * %cpaste: strip + with > from left (diffs).
149 170
150 171 * iplib.py: Fix crash when readline not installed
151 172
152 173 2007-05-26 Ville Vainio <vivainio@gmail.com>
153 174
154 175 * generics.py: intruduce easy to extend result_display generic
155 176 function (using simplegeneric.py).
156 177
157 178 * Fixed the append functionality of %set.
158 179
159 180 2007-05-25 Ville Vainio <vivainio@gmail.com>
160 181
161 182 * New magic: %rep (fetch / run old commands from history)
162 183
163 184 * New extension: mglob (%mglob magic), for powerful glob / find /filter
164 185 like functionality
165 186
166 187 % maghistory.py: %hist -g PATTERM greps the history for pattern
167 188
168 189 2007-05-24 Walter Doerwald <walter@livinglogic.de>
169 190
170 191 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
171 192 browse the IPython input history
172 193
173 194 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
174 195 (mapped to "i") can be used to put the object under the curser in the input
175 196 line. pickinputattr (mapped to "I") does the same for the attribute under
176 197 the cursor.
177 198
178 199 2007-05-24 Ville Vainio <vivainio@gmail.com>
179 200
180 201 * Grand magic cleansing (changeset [2380]):
181 202
182 203 * Introduce ipy_legacy.py where the following magics were
183 204 moved:
184 205
185 206 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
186 207
187 208 If you need them, either use default profile or "import ipy_legacy"
188 209 in your ipy_user_conf.py
189 210
190 211 * Move sh and scipy profile to Extensions from UserConfig. this implies
191 212 you should not edit them, but you don't need to run %upgrade when
192 213 upgrading IPython anymore.
193 214
194 215 * %hist/%history now operates in "raw" mode by default. To get the old
195 216 behaviour, run '%hist -n' (native mode).
196 217
197 218 * split ipy_stock_completers.py to ipy_stock_completers.py and
198 219 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
199 220 installed as default.
200 221
201 222 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
202 223 handling.
203 224
204 225 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
205 226 input if readline is available.
206 227
207 228 2007-05-23 Ville Vainio <vivainio@gmail.com>
208 229
209 230 * macro.py: %store uses __getstate__ properly
210 231
211 232 * exesetup.py: added new setup script for creating
212 233 standalone IPython executables with py2exe (i.e.
213 234 no python installation required).
214 235
215 236 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
216 237 its place.
217 238
218 239 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
219 240
220 241 2007-05-21 Ville Vainio <vivainio@gmail.com>
221 242
222 243 * platutil_win32.py (set_term_title): handle
223 244 failure of 'title' system call properly.
224 245
225 246 2007-05-17 Walter Doerwald <walter@livinglogic.de>
226 247
227 248 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
228 249 (Bug detected by Paul Mueller).
229 250
230 251 2007-05-16 Ville Vainio <vivainio@gmail.com>
231 252
232 253 * ipy_profile_sci.py, ipython_win_post_install.py: Create
233 254 new "sci" profile, effectively a modern version of the old
234 255 "scipy" profile (which is now slated for deprecation).
235 256
236 257 2007-05-15 Ville Vainio <vivainio@gmail.com>
237 258
238 259 * pycolorize.py, pycolor.1: Paul Mueller's patches that
239 260 make pycolorize read input from stdin when run without arguments.
240 261
241 262 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
242 263
243 264 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
244 265 it in sh profile (instead of ipy_system_conf.py).
245 266
246 267 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
247 268 aliases are now lower case on windows (MyCommand.exe => mycommand).
248 269
249 270 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
250 271 Macros are now callable objects that inherit from ipapi.IPyAutocall,
251 272 i.e. get autocalled regardless of system autocall setting.
252 273
253 274 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
254 275
255 276 * IPython/rlineimpl.py: check for clear_history in readline and
256 277 make it a dummy no-op if not available. This function isn't
257 278 guaranteed to be in the API and appeared in Python 2.4, so we need
258 279 to check it ourselves. Also, clean up this file quite a bit.
259 280
260 281 * ipython.1: update man page and full manual with information
261 282 about threads (remove outdated warning). Closes #151.
262 283
263 284 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
264 285
265 286 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
266 287 in trunk (note that this made it into the 0.8.1 release already,
267 288 but the changelogs didn't get coordinated). Many thanks to Gael
268 289 Varoquaux <gael.varoquaux-AT-normalesup.org>
269 290
270 291 2007-05-09 *** Released version 0.8.1
271 292
272 293 2007-05-10 Walter Doerwald <walter@livinglogic.de>
273 294
274 295 * IPython/Extensions/igrid.py: Incorporate html help into
275 296 the module, so we don't have to search for the file.
276 297
277 298 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
278 299
279 300 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
280 301
281 302 2007-04-30 Ville Vainio <vivainio@gmail.com>
282 303
283 304 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
284 305 user has illegal (non-ascii) home directory name
285 306
286 307 2007-04-27 Ville Vainio <vivainio@gmail.com>
287 308
288 309 * platutils_win32.py: implement set_term_title for windows
289 310
290 311 * Update version number
291 312
292 313 * ipy_profile_sh.py: more informative prompt (2 dir levels)
293 314
294 315 2007-04-26 Walter Doerwald <walter@livinglogic.de>
295 316
296 317 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
297 318 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
298 319 bug discovered by Ville).
299 320
300 321 2007-04-26 Ville Vainio <vivainio@gmail.com>
301 322
302 323 * Extensions/ipy_completers.py: Olivier's module completer now
303 324 saves the list of root modules if it takes > 4 secs on the first run.
304 325
305 326 * Magic.py (%rehashx): %rehashx now clears the completer cache
306 327
307 328
308 329 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
309 330
310 331 * ipython.el: fix incorrect color scheme, reported by Stefan.
311 332 Closes #149.
312 333
313 334 * IPython/PyColorize.py (Parser.format2): fix state-handling
314 335 logic. I still don't like how that code handles state, but at
315 336 least now it should be correct, if inelegant. Closes #146.
316 337
317 338 2007-04-25 Ville Vainio <vivainio@gmail.com>
318 339
319 340 * Extensions/ipy_which.py: added extension for %which magic, works
320 341 a lot like unix 'which' but also finds and expands aliases, and
321 342 allows wildcards.
322 343
323 344 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
324 345 as opposed to returning nothing.
325 346
326 347 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
327 348 ipy_stock_completers on default profile, do import on sh profile.
328 349
329 350 2007-04-22 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
330 351
331 352 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
332 353 like ipython.py foo.py which raised a IndexError.
333 354
334 355 2007-04-21 Ville Vainio <vivainio@gmail.com>
335 356
336 357 * Extensions/ipy_extutil.py: added extension to manage other ipython
337 358 extensions. Now only supports 'ls' == list extensions.
338 359
339 360 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
340 361
341 362 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
342 363 would prevent use of the exception system outside of a running
343 364 IPython instance.
344 365
345 366 2007-04-20 Ville Vainio <vivainio@gmail.com>
346 367
347 368 * Extensions/ipy_render.py: added extension for easy
348 369 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
349 370 'Iptl' template notation,
350 371
351 372 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
352 373 safer & faster 'import' completer.
353 374
354 375 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
355 376 and _ip.defalias(name, command).
356 377
357 378 * Extensions/ipy_exportdb.py: New extension for exporting all the
358 379 %store'd data in a portable format (normal ipapi calls like
359 380 defmacro() etc.)
360 381
361 382 2007-04-19 Ville Vainio <vivainio@gmail.com>
362 383
363 384 * upgrade_dir.py: skip junk files like *.pyc
364 385
365 386 * Release.py: version number to 0.8.1
366 387
367 388 2007-04-18 Ville Vainio <vivainio@gmail.com>
368 389
369 390 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
370 391 and later on win32.
371 392
372 393 2007-04-16 Ville Vainio <vivainio@gmail.com>
373 394
374 395 * iplib.py (showtraceback): Do not crash when running w/o readline.
375 396
376 397 2007-04-12 Walter Doerwald <walter@livinglogic.de>
377 398
378 399 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
379 400 sorted (case sensitive with files and dirs mixed).
380 401
381 402 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
382 403
383 404 * IPython/Release.py (version): Open trunk for 0.8.1 development.
384 405
385 406 2007-04-10 *** Released version 0.8.0
386 407
387 408 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
388 409
389 410 * Tag 0.8.0 for release.
390 411
391 412 * IPython/iplib.py (reloadhist): add API function to cleanly
392 413 reload the readline history, which was growing inappropriately on
393 414 every %run call.
394 415
395 416 * win32_manual_post_install.py (run): apply last part of Nicolas
396 417 Pernetty's patch (I'd accidentally applied it in a different
397 418 directory and this particular file didn't get patched).
398 419
399 420 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
400 421
401 422 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
402 423 find the main thread id and use the proper API call. Thanks to
403 424 Stefan for the fix.
404 425
405 426 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
406 427 unit tests to reflect fixed ticket #52, and add more tests sent by
407 428 him.
408 429
409 430 * IPython/iplib.py (raw_input): restore the readline completer
410 431 state on every input, in case third-party code messed it up.
411 432 (_prefilter): revert recent addition of early-escape checks which
412 433 prevent many valid alias calls from working.
413 434
414 435 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
415 436 flag for sigint handler so we don't run a full signal() call on
416 437 each runcode access.
417 438
418 439 * IPython/Magic.py (magic_whos): small improvement to diagnostic
419 440 message.
420 441
421 442 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
422 443
423 444 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
424 445 asynchronous exceptions working, i.e., Ctrl-C can actually
425 446 interrupt long-running code in the multithreaded shells.
426 447
427 448 This is using Tomer Filiba's great ctypes-based trick:
428 449 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
429 450 this in the past, but hadn't been able to make it work before. So
430 451 far it looks like it's actually running, but this needs more
431 452 testing. If it really works, I'll be *very* happy, and we'll owe
432 453 a huge thank you to Tomer. My current implementation is ugly,
433 454 hackish and uses nasty globals, but I don't want to try and clean
434 455 anything up until we know if it actually works.
435 456
436 457 NOTE: this feature needs ctypes to work. ctypes is included in
437 458 Python2.5, but 2.4 users will need to manually install it. This
438 459 feature makes multi-threaded shells so much more usable that it's
439 460 a minor price to pay (ctypes is very easy to install, already a
440 461 requirement for win32 and available in major linux distros).
441 462
442 463 2007-04-04 Ville Vainio <vivainio@gmail.com>
443 464
444 465 * Extensions/ipy_completers.py, ipy_stock_completers.py:
445 466 Moved implementations of 'bundled' completers to ipy_completers.py,
446 467 they are only enabled in ipy_stock_completers.py.
447 468
448 469 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
449 470
450 471 * IPython/PyColorize.py (Parser.format2): Fix identation of
451 472 colorzied output and return early if color scheme is NoColor, to
452 473 avoid unnecessary and expensive tokenization. Closes #131.
453 474
454 475 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
455 476
456 477 * IPython/Debugger.py: disable the use of pydb version 1.17. It
457 478 has a critical bug (a missing import that makes post-mortem not
458 479 work at all). Unfortunately as of this time, this is the version
459 480 shipped with Ubuntu Edgy, so quite a few people have this one. I
460 481 hope Edgy will update to a more recent package.
461 482
462 483 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
463 484
464 485 * IPython/iplib.py (_prefilter): close #52, second part of a patch
465 486 set by Stefan (only the first part had been applied before).
466 487
467 488 * IPython/Extensions/ipy_stock_completers.py (module_completer):
468 489 remove usage of the dangerous pkgutil.walk_packages(). See
469 490 details in comments left in the code.
470 491
471 492 * IPython/Magic.py (magic_whos): add support for numpy arrays
472 493 similar to what we had for Numeric.
473 494
474 495 * IPython/completer.py (IPCompleter.complete): extend the
475 496 complete() call API to support completions by other mechanisms
476 497 than readline. Closes #109.
477 498
478 499 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
479 500 protect against a bug in Python's execfile(). Closes #123.
480 501
481 502 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
482 503
483 504 * IPython/iplib.py (split_user_input): ensure that when splitting
484 505 user input, the part that can be treated as a python name is pure
485 506 ascii (Python identifiers MUST be pure ascii). Part of the
486 507 ongoing Unicode support work.
487 508
488 509 * IPython/Prompts.py (prompt_specials_color): Add \N for the
489 510 actual prompt number, without any coloring. This allows users to
490 511 produce numbered prompts with their own colors. Added after a
491 512 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
492 513
493 514 2007-03-31 Walter Doerwald <walter@livinglogic.de>
494 515
495 516 * IPython/Extensions/igrid.py: Map the return key
496 517 to enter() and shift-return to enterattr().
497 518
498 519 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
499 520
500 521 * IPython/Magic.py (magic_psearch): add unicode support by
501 522 encoding to ascii the input, since this routine also only deals
502 523 with valid Python names. Fixes a bug reported by Stefan.
503 524
504 525 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
505 526
506 527 * IPython/Magic.py (_inspect): convert unicode input into ascii
507 528 before trying to evaluate it as a Python identifier. This fixes a
508 529 problem that the new unicode support had introduced when analyzing
509 530 long definition lines for functions.
510 531
511 532 2007-03-24 Walter Doerwald <walter@livinglogic.de>
512 533
513 534 * IPython/Extensions/igrid.py: Fix picking. Using
514 535 igrid with wxPython 2.6 and -wthread should work now.
515 536 igrid.display() simply tries to create a frame without
516 537 an application. Only if this fails an application is created.
517 538
518 539 2007-03-23 Walter Doerwald <walter@livinglogic.de>
519 540
520 541 * IPython/Extensions/path.py: Updated to version 2.2.
521 542
522 543 2007-03-23 Ville Vainio <vivainio@gmail.com>
523 544
524 545 * iplib.py: recursive alias expansion now works better, so that
525 546 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
526 547 doesn't trip up the process, if 'd' has been aliased to 'ls'.
527 548
528 549 * Extensions/ipy_gnuglobal.py added, provides %global magic
529 550 for users of http://www.gnu.org/software/global
530 551
531 552 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
532 553 Closes #52. Patch by Stefan van der Walt.
533 554
534 555 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
535 556
536 557 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
537 558 respect the __file__ attribute when using %run. Thanks to a bug
538 559 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
539 560
540 561 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
541 562
542 563 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
543 564 input. Patch sent by Stefan.
544 565
545 566 2007-03-20 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
546 567 * IPython/Extensions/ipy_stock_completer.py
547 568 shlex_split, fix bug in shlex_split. len function
548 569 call was missing an if statement. Caused shlex_split to
549 570 sometimes return "" as last element.
550 571
551 572 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
552 573
553 574 * IPython/completer.py
554 575 (IPCompleter.file_matches.single_dir_expand): fix a problem
555 576 reported by Stefan, where directories containign a single subdir
556 577 would be completed too early.
557 578
558 579 * IPython/Shell.py (_load_pylab): Make the execution of 'from
559 580 pylab import *' when -pylab is given be optional. A new flag,
560 581 pylab_import_all controls this behavior, the default is True for
561 582 backwards compatibility.
562 583
563 584 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
564 585 modified) R. Bernstein's patch for fully syntax highlighted
565 586 tracebacks. The functionality is also available under ultraTB for
566 587 non-ipython users (someone using ultraTB but outside an ipython
567 588 session). They can select the color scheme by setting the
568 589 module-level global DEFAULT_SCHEME. The highlight functionality
569 590 also works when debugging.
570 591
571 592 * IPython/genutils.py (IOStream.close): small patch by
572 593 R. Bernstein for improved pydb support.
573 594
574 595 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
575 596 DaveS <davls@telus.net> to improve support of debugging under
576 597 NTEmacs, including improved pydb behavior.
577 598
578 599 * IPython/Magic.py (magic_prun): Fix saving of profile info for
579 600 Python 2.5, where the stats object API changed a little. Thanks
580 601 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
581 602
582 603 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
583 604 Pernetty's patch to improve support for (X)Emacs under Win32.
584 605
585 606 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
586 607
587 608 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
588 609 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
589 610 a report by Nik Tautenhahn.
590 611
591 612 2007-03-16 Walter Doerwald <walter@livinglogic.de>
592 613
593 614 * setup.py: Add the igrid help files to the list of data files
594 615 to be installed alongside igrid.
595 616 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
596 617 Show the input object of the igrid browser as the window tile.
597 618 Show the object the cursor is on in the statusbar.
598 619
599 620 2007-03-15 Ville Vainio <vivainio@gmail.com>
600 621
601 622 * Extensions/ipy_stock_completers.py: Fixed exception
602 623 on mismatching quotes in %run completer. Patch by
603 624 JοΏ½rgen Stenarson. Closes #127.
604 625
605 626 2007-03-14 Ville Vainio <vivainio@gmail.com>
606 627
607 628 * Extensions/ext_rehashdir.py: Do not do auto_alias
608 629 in %rehashdir, it clobbers %store'd aliases.
609 630
610 631 * UserConfig/ipy_profile_sh.py: envpersist.py extension
611 632 (beefed up %env) imported for sh profile.
612 633
613 634 2007-03-10 Walter Doerwald <walter@livinglogic.de>
614 635
615 636 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
616 637 as the default browser.
617 638 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
618 639 As igrid displays all attributes it ever encounters, fetch() (which has
619 640 been renamed to _fetch()) doesn't have to recalculate the display attributes
620 641 every time a new item is fetched. This should speed up scrolling.
621 642
622 643 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
623 644
624 645 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
625 646 Schmolck's recently reported tab-completion bug (my previous one
626 647 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
627 648
628 649 2007-03-09 Walter Doerwald <walter@livinglogic.de>
629 650
630 651 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
631 652 Close help window if exiting igrid.
632 653
633 654 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
634 655
635 656 * IPython/Extensions/ipy_defaults.py: Check if readline is available
636 657 before calling functions from readline.
637 658
638 659 2007-03-02 Walter Doerwald <walter@livinglogic.de>
639 660
640 661 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
641 662 igrid is a wxPython-based display object for ipipe. If your system has
642 663 wx installed igrid will be the default display. Without wx ipipe falls
643 664 back to ibrowse (which needs curses). If no curses is installed ipipe
644 665 falls back to idump.
645 666
646 667 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
647 668
648 669 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
649 670 my changes from yesterday, they introduced bugs. Will reactivate
650 671 once I get a correct solution, which will be much easier thanks to
651 672 Dan Milstein's new prefilter test suite.
652 673
653 674 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
654 675
655 676 * IPython/iplib.py (split_user_input): fix input splitting so we
656 677 don't attempt attribute accesses on things that can't possibly be
657 678 valid Python attributes. After a bug report by Alex Schmolck.
658 679 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
659 680 %magic with explicit % prefix.
660 681
661 682 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
662 683
663 684 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
664 685 avoid a DeprecationWarning from GTK.
665 686
666 687 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
667 688
668 689 * IPython/genutils.py (clock): I modified clock() to return total
669 690 time, user+system. This is a more commonly needed metric. I also
670 691 introduced the new clocku/clocks to get only user/system time if
671 692 one wants those instead.
672 693
673 694 ***WARNING: API CHANGE*** clock() used to return only user time,
674 695 so if you want exactly the same results as before, use clocku
675 696 instead.
676 697
677 698 2007-02-22 Ville Vainio <vivainio@gmail.com>
678 699
679 700 * IPython/Extensions/ipy_p4.py: Extension for improved
680 701 p4 (perforce version control system) experience.
681 702 Adds %p4 magic with p4 command completion and
682 703 automatic -G argument (marshall output as python dict)
683 704
684 705 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
685 706
686 707 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
687 708 stop marks.
688 709 (ClearingMixin): a simple mixin to easily make a Demo class clear
689 710 the screen in between blocks and have empty marquees. The
690 711 ClearDemo and ClearIPDemo classes that use it are included.
691 712
692 713 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
693 714
694 715 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
695 716 protect against exceptions at Python shutdown time. Patch
696 717 sumbmitted to upstream.
697 718
698 719 2007-02-14 Walter Doerwald <walter@livinglogic.de>
699 720
700 721 * IPython/Extensions/ibrowse.py: If entering the first object level
701 722 (i.e. the object for which the browser has been started) fails,
702 723 now the error is raised directly (aborting the browser) instead of
703 724 running into an empty levels list later.
704 725
705 726 2007-02-03 Walter Doerwald <walter@livinglogic.de>
706 727
707 728 * IPython/Extensions/ipipe.py: Add an xrepr implementation
708 729 for the noitem object.
709 730
710 731 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
711 732
712 733 * IPython/completer.py (Completer.attr_matches): Fix small
713 734 tab-completion bug with Enthought Traits objects with units.
714 735 Thanks to a bug report by Tom Denniston
715 736 <tom.denniston-AT-alum.dartmouth.org>.
716 737
717 738 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
718 739
719 740 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
720 741 bug where only .ipy or .py would be completed. Once the first
721 742 argument to %run has been given, all completions are valid because
722 743 they are the arguments to the script, which may well be non-python
723 744 filenames.
724 745
725 746 * IPython/irunner.py (InteractiveRunner.run_source): major updates
726 747 to irunner to allow it to correctly support real doctesting of
727 748 out-of-process ipython code.
728 749
729 750 * IPython/Magic.py (magic_cd): Make the setting of the terminal
730 751 title an option (-noterm_title) because it completely breaks
731 752 doctesting.
732 753
733 754 * IPython/demo.py: fix IPythonDemo class that was not actually working.
734 755
735 756 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
736 757
737 758 * IPython/irunner.py (main): fix small bug where extensions were
738 759 not being correctly recognized.
739 760
740 761 2007-01-23 Walter Doerwald <walter@livinglogic.de>
741 762
742 763 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
743 764 a string containing a single line yields the string itself as the
744 765 only item.
745 766
746 767 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
747 768 object if it's the same as the one on the last level (This avoids
748 769 infinite recursion for one line strings).
749 770
750 771 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
751 772
752 773 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
753 774 all output streams before printing tracebacks. This ensures that
754 775 user output doesn't end up interleaved with traceback output.
755 776
756 777 2007-01-10 Ville Vainio <vivainio@gmail.com>
757 778
758 779 * Extensions/envpersist.py: Turbocharged %env that remembers
759 780 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
760 781 "%env VISUAL=jed".
761 782
762 783 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
763 784
764 785 * IPython/iplib.py (showtraceback): ensure that we correctly call
765 786 custom handlers in all cases (some with pdb were slipping through,
766 787 but I'm not exactly sure why).
767 788
768 789 * IPython/Debugger.py (Tracer.__init__): added new class to
769 790 support set_trace-like usage of IPython's enhanced debugger.
770 791
771 792 2006-12-24 Ville Vainio <vivainio@gmail.com>
772 793
773 794 * ipmaker.py: more informative message when ipy_user_conf
774 795 import fails (suggest running %upgrade).
775 796
776 797 * tools/run_ipy_in_profiler.py: Utility to see where
777 798 the time during IPython startup is spent.
778 799
779 800 2006-12-20 Ville Vainio <vivainio@gmail.com>
780 801
781 802 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
782 803
783 804 * ipapi.py: Add new ipapi method, expand_alias.
784 805
785 806 * Release.py: Bump up version to 0.7.4.svn
786 807
787 808 2006-12-17 Ville Vainio <vivainio@gmail.com>
788 809
789 810 * Extensions/jobctrl.py: Fixed &cmd arg arg...
790 811 to work properly on posix too
791 812
792 813 * Release.py: Update revnum (version is still just 0.7.3).
793 814
794 815 2006-12-15 Ville Vainio <vivainio@gmail.com>
795 816
796 817 * scripts/ipython_win_post_install: create ipython.py in
797 818 prefix + "/scripts".
798 819
799 820 * Release.py: Update version to 0.7.3.
800 821
801 822 2006-12-14 Ville Vainio <vivainio@gmail.com>
802 823
803 824 * scripts/ipython_win_post_install: Overwrite old shortcuts
804 825 if they already exist
805 826
806 827 * Release.py: release 0.7.3rc2
807 828
808 829 2006-12-13 Ville Vainio <vivainio@gmail.com>
809 830
810 831 * Branch and update Release.py for 0.7.3rc1
811 832
812 833 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
813 834
814 835 * IPython/Shell.py (IPShellWX): update for current WX naming
815 836 conventions, to avoid a deprecation warning with current WX
816 837 versions. Thanks to a report by Danny Shevitz.
817 838
818 839 2006-12-12 Ville Vainio <vivainio@gmail.com>
819 840
820 841 * ipmaker.py: apply david cournapeau's patch to make
821 842 import_some work properly even when ipythonrc does
822 843 import_some on empty list (it was an old bug!).
823 844
824 845 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
825 846 Add deprecation note to ipythonrc and a url to wiki
826 847 in ipy_user_conf.py
827 848
828 849
829 850 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
830 851 as if it was typed on IPython command prompt, i.e.
831 852 as IPython script.
832 853
833 854 * example-magic.py, magic_grepl.py: remove outdated examples
834 855
835 856 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
836 857
837 858 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
838 859 is called before any exception has occurred.
839 860
840 861 2006-12-08 Ville Vainio <vivainio@gmail.com>
841 862
842 863 * Extensions/ipy_stock_completers.py: fix cd completer
843 864 to translate /'s to \'s again.
844 865
845 866 * completer.py: prevent traceback on file completions w/
846 867 backslash.
847 868
848 869 * Release.py: Update release number to 0.7.3b3 for release
849 870
850 871 2006-12-07 Ville Vainio <vivainio@gmail.com>
851 872
852 873 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
853 874 while executing external code. Provides more shell-like behaviour
854 875 and overall better response to ctrl + C / ctrl + break.
855 876
856 877 * tools/make_tarball.py: new script to create tarball straight from svn
857 878 (setup.py sdist doesn't work on win32).
858 879
859 880 * Extensions/ipy_stock_completers.py: fix cd completer to give up
860 881 on dirnames with spaces and use the default completer instead.
861 882
862 883 * Revision.py: Change version to 0.7.3b2 for release.
863 884
864 885 2006-12-05 Ville Vainio <vivainio@gmail.com>
865 886
866 887 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
867 888 pydb patch 4 (rm debug printing, py 2.5 checking)
868 889
869 890 2006-11-30 Walter Doerwald <walter@livinglogic.de>
870 891 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
871 892 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
872 893 "refreshfind" (mapped to "R") does the same but tries to go back to the same
873 894 object the cursor was on before the refresh. The command "markrange" is
874 895 mapped to "%" now.
875 896 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
876 897
877 898 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
878 899
879 900 * IPython/Magic.py (magic_debug): new %debug magic to activate the
880 901 interactive debugger on the last traceback, without having to call
881 902 %pdb and rerun your code. Made minor changes in various modules,
882 903 should automatically recognize pydb if available.
883 904
884 905 2006-11-28 Ville Vainio <vivainio@gmail.com>
885 906
886 907 * completer.py: If the text start with !, show file completions
887 908 properly. This helps when trying to complete command name
888 909 for shell escapes.
889 910
890 911 2006-11-27 Ville Vainio <vivainio@gmail.com>
891 912
892 913 * ipy_stock_completers.py: bzr completer submitted by Stefan van
893 914 der Walt. Clean up svn and hg completers by using a common
894 915 vcs_completer.
895 916
896 917 2006-11-26 Ville Vainio <vivainio@gmail.com>
897 918
898 919 * Remove ipconfig and %config; you should use _ip.options structure
899 920 directly instead!
900 921
901 922 * genutils.py: add wrap_deprecated function for deprecating callables
902 923
903 924 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
904 925 _ip.system instead. ipalias is redundant.
905 926
906 927 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
907 928 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
908 929 explicit.
909 930
910 931 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
911 932 completer. Try it by entering 'hg ' and pressing tab.
912 933
913 934 * macro.py: Give Macro a useful __repr__ method
914 935
915 936 * Magic.py: %whos abbreviates the typename of Macro for brevity.
916 937
917 938 2006-11-24 Walter Doerwald <walter@livinglogic.de>
918 939 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
919 940 we don't get a duplicate ipipe module, where registration of the xrepr
920 941 implementation for Text is useless.
921 942
922 943 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
923 944
924 945 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
925 946
926 947 2006-11-24 Ville Vainio <vivainio@gmail.com>
927 948
928 949 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
929 950 try to use "cProfile" instead of the slower pure python
930 951 "profile"
931 952
932 953 2006-11-23 Ville Vainio <vivainio@gmail.com>
933 954
934 955 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
935 956 Qt+IPython+Designer link in documentation.
936 957
937 958 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
938 959 correct Pdb object to %pydb.
939 960
940 961
941 962 2006-11-22 Walter Doerwald <walter@livinglogic.de>
942 963 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
943 964 generic xrepr(), otherwise the list implementation would kick in.
944 965
945 966 2006-11-21 Ville Vainio <vivainio@gmail.com>
946 967
947 968 * upgrade_dir.py: Now actually overwrites a nonmodified user file
948 969 with one from UserConfig.
949 970
950 971 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
951 972 it was missing which broke the sh profile.
952 973
953 974 * completer.py: file completer now uses explicit '/' instead
954 975 of os.path.join, expansion of 'foo' was broken on win32
955 976 if there was one directory with name 'foobar'.
956 977
957 978 * A bunch of patches from Kirill Smelkov:
958 979
959 980 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
960 981
961 982 * [patch 7/9] Implement %page -r (page in raw mode) -
962 983
963 984 * [patch 5/9] ScientificPython webpage has moved
964 985
965 986 * [patch 4/9] The manual mentions %ds, should be %dhist
966 987
967 988 * [patch 3/9] Kill old bits from %prun doc.
968 989
969 990 * [patch 1/9] Fix typos here and there.
970 991
971 992 2006-11-08 Ville Vainio <vivainio@gmail.com>
972 993
973 994 * completer.py (attr_matches): catch all exceptions raised
974 995 by eval of expr with dots.
975 996
976 997 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
977 998
978 999 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
979 1000 input if it starts with whitespace. This allows you to paste
980 1001 indented input from any editor without manually having to type in
981 1002 the 'if 1:', which is convenient when working interactively.
982 1003 Slightly modifed version of a patch by Bo Peng
983 1004 <bpeng-AT-rice.edu>.
984 1005
985 1006 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
986 1007
987 1008 * IPython/irunner.py (main): modified irunner so it automatically
988 1009 recognizes the right runner to use based on the extension (.py for
989 1010 python, .ipy for ipython and .sage for sage).
990 1011
991 1012 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
992 1013 visible in ipapi as ip.config(), to programatically control the
993 1014 internal rc object. There's an accompanying %config magic for
994 1015 interactive use, which has been enhanced to match the
995 1016 funtionality in ipconfig.
996 1017
997 1018 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
998 1019 so it's not just a toggle, it now takes an argument. Add support
999 1020 for a customizable header when making system calls, as the new
1000 1021 system_header variable in the ipythonrc file.
1001 1022
1002 1023 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1003 1024
1004 1025 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1005 1026 generic functions (using Philip J. Eby's simplegeneric package).
1006 1027 This makes it possible to customize the display of third-party classes
1007 1028 without having to monkeypatch them. xiter() no longer supports a mode
1008 1029 argument and the XMode class has been removed. The same functionality can
1009 1030 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1010 1031 One consequence of the switch to generic functions is that xrepr() and
1011 1032 xattrs() implementation must define the default value for the mode
1012 1033 argument themselves and xattrs() implementations must return real
1013 1034 descriptors.
1014 1035
1015 1036 * IPython/external: This new subpackage will contain all third-party
1016 1037 packages that are bundled with IPython. (The first one is simplegeneric).
1017 1038
1018 1039 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1019 1040 directory which as been dropped in r1703.
1020 1041
1021 1042 * IPython/Extensions/ipipe.py (iless): Fixed.
1022 1043
1023 1044 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1024 1045
1025 1046 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1026 1047
1027 1048 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1028 1049 handling in variable expansion so that shells and magics recognize
1029 1050 function local scopes correctly. Bug reported by Brian.
1030 1051
1031 1052 * scripts/ipython: remove the very first entry in sys.path which
1032 1053 Python auto-inserts for scripts, so that sys.path under IPython is
1033 1054 as similar as possible to that under plain Python.
1034 1055
1035 1056 * IPython/completer.py (IPCompleter.file_matches): Fix
1036 1057 tab-completion so that quotes are not closed unless the completion
1037 1058 is unambiguous. After a request by Stefan. Minor cleanups in
1038 1059 ipy_stock_completers.
1039 1060
1040 1061 2006-11-02 Ville Vainio <vivainio@gmail.com>
1041 1062
1042 1063 * ipy_stock_completers.py: Add %run and %cd completers.
1043 1064
1044 1065 * completer.py: Try running custom completer for both
1045 1066 "foo" and "%foo" if the command is just "foo". Ignore case
1046 1067 when filtering possible completions.
1047 1068
1048 1069 * UserConfig/ipy_user_conf.py: install stock completers as default
1049 1070
1050 1071 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1051 1072 simplified readline history save / restore through a wrapper
1052 1073 function
1053 1074
1054 1075
1055 1076 2006-10-31 Ville Vainio <vivainio@gmail.com>
1056 1077
1057 1078 * strdispatch.py, completer.py, ipy_stock_completers.py:
1058 1079 Allow str_key ("command") in completer hooks. Implement
1059 1080 trivial completer for 'import' (stdlib modules only). Rename
1060 1081 ipy_linux_package_managers.py to ipy_stock_completers.py.
1061 1082 SVN completer.
1062 1083
1063 1084 * Extensions/ledit.py: %magic line editor for easily and
1064 1085 incrementally manipulating lists of strings. The magic command
1065 1086 name is %led.
1066 1087
1067 1088 2006-10-30 Ville Vainio <vivainio@gmail.com>
1068 1089
1069 1090 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1070 1091 Bernsteins's patches for pydb integration.
1071 1092 http://bashdb.sourceforge.net/pydb/
1072 1093
1073 1094 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1074 1095 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1075 1096 custom completer hook to allow the users to implement their own
1076 1097 completers. See ipy_linux_package_managers.py for example. The
1077 1098 hook name is 'complete_command'.
1078 1099
1079 1100 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1080 1101
1081 1102 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1082 1103 Numeric leftovers.
1083 1104
1084 1105 * ipython.el (py-execute-region): apply Stefan's patch to fix
1085 1106 garbled results if the python shell hasn't been previously started.
1086 1107
1087 1108 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1088 1109 pretty generic function and useful for other things.
1089 1110
1090 1111 * IPython/OInspect.py (getsource): Add customizable source
1091 1112 extractor. After a request/patch form W. Stein (SAGE).
1092 1113
1093 1114 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1094 1115 window size to a more reasonable value from what pexpect does,
1095 1116 since their choice causes wrapping bugs with long input lines.
1096 1117
1097 1118 2006-10-28 Ville Vainio <vivainio@gmail.com>
1098 1119
1099 1120 * Magic.py (%run): Save and restore the readline history from
1100 1121 file around %run commands to prevent side effects from
1101 1122 %runned programs that might use readline (e.g. pydb).
1102 1123
1103 1124 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1104 1125 invoking the pydb enhanced debugger.
1105 1126
1106 1127 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1107 1128
1108 1129 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1109 1130 call the base class method and propagate the return value to
1110 1131 ifile. This is now done by path itself.
1111 1132
1112 1133 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1113 1134
1114 1135 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1115 1136 api: set_crash_handler(), to expose the ability to change the
1116 1137 internal crash handler.
1117 1138
1118 1139 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1119 1140 the various parameters of the crash handler so that apps using
1120 1141 IPython as their engine can customize crash handling. Ipmlemented
1121 1142 at the request of SAGE.
1122 1143
1123 1144 2006-10-14 Ville Vainio <vivainio@gmail.com>
1124 1145
1125 1146 * Magic.py, ipython.el: applied first "safe" part of Rocky
1126 1147 Bernstein's patch set for pydb integration.
1127 1148
1128 1149 * Magic.py (%unalias, %alias): %store'd aliases can now be
1129 1150 removed with '%unalias'. %alias w/o args now shows most
1130 1151 interesting (stored / manually defined) aliases last
1131 1152 where they catch the eye w/o scrolling.
1132 1153
1133 1154 * Magic.py (%rehashx), ext_rehashdir.py: files with
1134 1155 'py' extension are always considered executable, even
1135 1156 when not in PATHEXT environment variable.
1136 1157
1137 1158 2006-10-12 Ville Vainio <vivainio@gmail.com>
1138 1159
1139 1160 * jobctrl.py: Add new "jobctrl" extension for spawning background
1140 1161 processes with "&find /". 'import jobctrl' to try it out. Requires
1141 1162 'subprocess' module, standard in python 2.4+.
1142 1163
1143 1164 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1144 1165 so if foo -> bar and bar -> baz, then foo -> baz.
1145 1166
1146 1167 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1147 1168
1148 1169 * IPython/Magic.py (Magic.parse_options): add a new posix option
1149 1170 to allow parsing of input args in magics that doesn't strip quotes
1150 1171 (if posix=False). This also closes %timeit bug reported by
1151 1172 Stefan.
1152 1173
1153 1174 2006-10-03 Ville Vainio <vivainio@gmail.com>
1154 1175
1155 1176 * iplib.py (raw_input, interact): Return ValueError catching for
1156 1177 raw_input. Fixes infinite loop for sys.stdin.close() or
1157 1178 sys.stdout.close().
1158 1179
1159 1180 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1160 1181
1161 1182 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1162 1183 to help in handling doctests. irunner is now pretty useful for
1163 1184 running standalone scripts and simulate a full interactive session
1164 1185 in a format that can be then pasted as a doctest.
1165 1186
1166 1187 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1167 1188 on top of the default (useless) ones. This also fixes the nasty
1168 1189 way in which 2.5's Quitter() exits (reverted [1785]).
1169 1190
1170 1191 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1171 1192 2.5.
1172 1193
1173 1194 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1174 1195 color scheme is updated as well when color scheme is changed
1175 1196 interactively.
1176 1197
1177 1198 2006-09-27 Ville Vainio <vivainio@gmail.com>
1178 1199
1179 1200 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1180 1201 infinite loop and just exit. It's a hack, but will do for a while.
1181 1202
1182 1203 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1183 1204
1184 1205 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1185 1206 the constructor, this makes it possible to get a list of only directories
1186 1207 or only files.
1187 1208
1188 1209 2006-08-12 Ville Vainio <vivainio@gmail.com>
1189 1210
1190 1211 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1191 1212 they broke unittest
1192 1213
1193 1214 2006-08-11 Ville Vainio <vivainio@gmail.com>
1194 1215
1195 1216 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1196 1217 by resolving issue properly, i.e. by inheriting FakeModule
1197 1218 from types.ModuleType. Pickling ipython interactive data
1198 1219 should still work as usual (testing appreciated).
1199 1220
1200 1221 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1201 1222
1202 1223 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1203 1224 running under python 2.3 with code from 2.4 to fix a bug with
1204 1225 help(). Reported by the Debian maintainers, Norbert Tretkowski
1205 1226 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1206 1227 <afayolle-AT-debian.org>.
1207 1228
1208 1229 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1209 1230
1210 1231 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1211 1232 (which was displaying "quit" twice).
1212 1233
1213 1234 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1214 1235
1215 1236 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1216 1237 the mode argument).
1217 1238
1218 1239 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1219 1240
1220 1241 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1221 1242 not running under IPython.
1222 1243
1223 1244 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1224 1245 and make it iterable (iterating over the attribute itself). Add two new
1225 1246 magic strings for __xattrs__(): If the string starts with "-", the attribute
1226 1247 will not be displayed in ibrowse's detail view (but it can still be
1227 1248 iterated over). This makes it possible to add attributes that are large
1228 1249 lists or generator methods to the detail view. Replace magic attribute names
1229 1250 and _attrname() and _getattr() with "descriptors": For each type of magic
1230 1251 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1231 1252 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1232 1253 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1233 1254 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1234 1255 are still supported.
1235 1256
1236 1257 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1237 1258 fails in ibrowse.fetch(), the exception object is added as the last item
1238 1259 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1239 1260 a generator throws an exception midway through execution.
1240 1261
1241 1262 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1242 1263 encoding into methods.
1243 1264
1244 1265 2006-07-26 Ville Vainio <vivainio@gmail.com>
1245 1266
1246 1267 * iplib.py: history now stores multiline input as single
1247 1268 history entries. Patch by Jorgen Cederlof.
1248 1269
1249 1270 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1250 1271
1251 1272 * IPython/Extensions/ibrowse.py: Make cursor visible over
1252 1273 non existing attributes.
1253 1274
1254 1275 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1255 1276
1256 1277 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1257 1278 error output of the running command doesn't mess up the screen.
1258 1279
1259 1280 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1260 1281
1261 1282 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1262 1283 argument. This sorts the items themselves.
1263 1284
1264 1285 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1265 1286
1266 1287 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1267 1288 Compile expression strings into code objects. This should speed
1268 1289 up ifilter and friends somewhat.
1269 1290
1270 1291 2006-07-08 Ville Vainio <vivainio@gmail.com>
1271 1292
1272 1293 * Magic.py: %cpaste now strips > from the beginning of lines
1273 1294 to ease pasting quoted code from emails. Contributed by
1274 1295 Stefan van der Walt.
1275 1296
1276 1297 2006-06-29 Ville Vainio <vivainio@gmail.com>
1277 1298
1278 1299 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1279 1300 mode, patch contributed by Darren Dale. NEEDS TESTING!
1280 1301
1281 1302 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1282 1303
1283 1304 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1284 1305 a blue background. Fix fetching new display rows when the browser
1285 1306 scrolls more than a screenful (e.g. by using the goto command).
1286 1307
1287 1308 2006-06-27 Ville Vainio <vivainio@gmail.com>
1288 1309
1289 1310 * Magic.py (_inspect, _ofind) Apply David Huard's
1290 1311 patch for displaying the correct docstring for 'property'
1291 1312 attributes.
1292 1313
1293 1314 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1294 1315
1295 1316 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1296 1317 commands into the methods implementing them.
1297 1318
1298 1319 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1299 1320
1300 1321 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1301 1322 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1302 1323 autoindent support was authored by Jin Liu.
1303 1324
1304 1325 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1305 1326
1306 1327 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1307 1328 for keymaps with a custom class that simplifies handling.
1308 1329
1309 1330 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1310 1331
1311 1332 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1312 1333 resizing. This requires Python 2.5 to work.
1313 1334
1314 1335 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1315 1336
1316 1337 * IPython/Extensions/ibrowse.py: Add two new commands to
1317 1338 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1318 1339 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1319 1340 attributes again. Remapped the help command to "?". Display
1320 1341 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1321 1342 as keys for the "home" and "end" commands. Add three new commands
1322 1343 to the input mode for "find" and friends: "delend" (CTRL-K)
1323 1344 deletes to the end of line. "incsearchup" searches upwards in the
1324 1345 command history for an input that starts with the text before the cursor.
1325 1346 "incsearchdown" does the same downwards. Removed a bogus mapping of
1326 1347 the x key to "delete".
1327 1348
1328 1349 2006-06-15 Ville Vainio <vivainio@gmail.com>
1329 1350
1330 1351 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1331 1352 used to create prompts dynamically, instead of the "old" way of
1332 1353 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1333 1354 way still works (it's invoked by the default hook), of course.
1334 1355
1335 1356 * Prompts.py: added generate_output_prompt hook for altering output
1336 1357 prompt
1337 1358
1338 1359 * Release.py: Changed version string to 0.7.3.svn.
1339 1360
1340 1361 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1341 1362
1342 1363 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1343 1364 the call to fetch() always tries to fetch enough data for at least one
1344 1365 full screen. This makes it possible to simply call moveto(0,0,True) in
1345 1366 the constructor. Fix typos and removed the obsolete goto attribute.
1346 1367
1347 1368 2006-06-12 Ville Vainio <vivainio@gmail.com>
1348 1369
1349 1370 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1350 1371 allowing $variable interpolation within multiline statements,
1351 1372 though so far only with "sh" profile for a testing period.
1352 1373 The patch also enables splitting long commands with \ but it
1353 1374 doesn't work properly yet.
1354 1375
1355 1376 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1356 1377
1357 1378 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1358 1379 input history and the position of the cursor in the input history for
1359 1380 the find, findbackwards and goto command.
1360 1381
1361 1382 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1362 1383
1363 1384 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1364 1385 implements the basic functionality of browser commands that require
1365 1386 input. Reimplement the goto, find and findbackwards commands as
1366 1387 subclasses of _CommandInput. Add an input history and keymaps to those
1367 1388 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1368 1389 execute commands.
1369 1390
1370 1391 2006-06-07 Ville Vainio <vivainio@gmail.com>
1371 1392
1372 1393 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1373 1394 running the batch files instead of leaving the session open.
1374 1395
1375 1396 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1376 1397
1377 1398 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1378 1399 the original fix was incomplete. Patch submitted by W. Maier.
1379 1400
1380 1401 2006-06-07 Ville Vainio <vivainio@gmail.com>
1381 1402
1382 1403 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1383 1404 Confirmation prompts can be supressed by 'quiet' option.
1384 1405 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1385 1406
1386 1407 2006-06-06 *** Released version 0.7.2
1387 1408
1388 1409 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1389 1410
1390 1411 * IPython/Release.py (version): Made 0.7.2 final for release.
1391 1412 Repo tagged and release cut.
1392 1413
1393 1414 2006-06-05 Ville Vainio <vivainio@gmail.com>
1394 1415
1395 1416 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1396 1417 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1397 1418
1398 1419 * upgrade_dir.py: try import 'path' module a bit harder
1399 1420 (for %upgrade)
1400 1421
1401 1422 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1402 1423
1403 1424 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1404 1425 instead of looping 20 times.
1405 1426
1406 1427 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1407 1428 correctly at initialization time. Bug reported by Krishna Mohan
1408 1429 Gundu <gkmohan-AT-gmail.com> on the user list.
1409 1430
1410 1431 * IPython/Release.py (version): Mark 0.7.2 version to start
1411 1432 testing for release on 06/06.
1412 1433
1413 1434 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1414 1435
1415 1436 * scripts/irunner: thin script interface so users don't have to
1416 1437 find the module and call it as an executable, since modules rarely
1417 1438 live in people's PATH.
1418 1439
1419 1440 * IPython/irunner.py (InteractiveRunner.__init__): added
1420 1441 delaybeforesend attribute to control delays with newer versions of
1421 1442 pexpect. Thanks to detailed help from pexpect's author, Noah
1422 1443 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1423 1444 correctly (it works in NoColor mode).
1424 1445
1425 1446 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1426 1447 SAGE list, from improper log() calls.
1427 1448
1428 1449 2006-05-31 Ville Vainio <vivainio@gmail.com>
1429 1450
1430 1451 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1431 1452 with args in parens to work correctly with dirs that have spaces.
1432 1453
1433 1454 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1434 1455
1435 1456 * IPython/Logger.py (Logger.logstart): add option to log raw input
1436 1457 instead of the processed one. A -r flag was added to the
1437 1458 %logstart magic used for controlling logging.
1438 1459
1439 1460 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1440 1461
1441 1462 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1442 1463 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1443 1464 recognize the option. After a bug report by Will Maier. This
1444 1465 closes #64 (will do it after confirmation from W. Maier).
1445 1466
1446 1467 * IPython/irunner.py: New module to run scripts as if manually
1447 1468 typed into an interactive environment, based on pexpect. After a
1448 1469 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1449 1470 ipython-user list. Simple unittests in the tests/ directory.
1450 1471
1451 1472 * tools/release: add Will Maier, OpenBSD port maintainer, to
1452 1473 recepients list. We are now officially part of the OpenBSD ports:
1453 1474 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1454 1475 work.
1455 1476
1456 1477 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1457 1478
1458 1479 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1459 1480 so that it doesn't break tkinter apps.
1460 1481
1461 1482 * IPython/iplib.py (_prefilter): fix bug where aliases would
1462 1483 shadow variables when autocall was fully off. Reported by SAGE
1463 1484 author William Stein.
1464 1485
1465 1486 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1466 1487 at what detail level strings are computed when foo? is requested.
1467 1488 This allows users to ask for example that the string form of an
1468 1489 object is only computed when foo?? is called, or even never, by
1469 1490 setting the object_info_string_level >= 2 in the configuration
1470 1491 file. This new option has been added and documented. After a
1471 1492 request by SAGE to be able to control the printing of very large
1472 1493 objects more easily.
1473 1494
1474 1495 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1475 1496
1476 1497 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1477 1498 from sys.argv, to be 100% consistent with how Python itself works
1478 1499 (as seen for example with python -i file.py). After a bug report
1479 1500 by Jeffrey Collins.
1480 1501
1481 1502 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1482 1503 nasty bug which was preventing custom namespaces with -pylab,
1483 1504 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1484 1505 compatibility (long gone from mpl).
1485 1506
1486 1507 * IPython/ipapi.py (make_session): name change: create->make. We
1487 1508 use make in other places (ipmaker,...), it's shorter and easier to
1488 1509 type and say, etc. I'm trying to clean things before 0.7.2 so
1489 1510 that I can keep things stable wrt to ipapi in the chainsaw branch.
1490 1511
1491 1512 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1492 1513 python-mode recognizes our debugger mode. Add support for
1493 1514 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1494 1515 <m.liu.jin-AT-gmail.com> originally written by
1495 1516 doxgen-AT-newsmth.net (with minor modifications for xemacs
1496 1517 compatibility)
1497 1518
1498 1519 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1499 1520 tracebacks when walking the stack so that the stack tracking system
1500 1521 in emacs' python-mode can identify the frames correctly.
1501 1522
1502 1523 * IPython/ipmaker.py (make_IPython): make the internal (and
1503 1524 default config) autoedit_syntax value false by default. Too many
1504 1525 users have complained to me (both on and off-list) about problems
1505 1526 with this option being on by default, so I'm making it default to
1506 1527 off. It can still be enabled by anyone via the usual mechanisms.
1507 1528
1508 1529 * IPython/completer.py (Completer.attr_matches): add support for
1509 1530 PyCrust-style _getAttributeNames magic method. Patch contributed
1510 1531 by <mscott-AT-goldenspud.com>. Closes #50.
1511 1532
1512 1533 * IPython/iplib.py (InteractiveShell.__init__): remove the
1513 1534 deletion of exit/quit from __builtin__, which can break
1514 1535 third-party tools like the Zope debugging console. The
1515 1536 %exit/%quit magics remain. In general, it's probably a good idea
1516 1537 not to delete anything from __builtin__, since we never know what
1517 1538 that will break. In any case, python now (for 2.5) will support
1518 1539 'real' exit/quit, so this issue is moot. Closes #55.
1519 1540
1520 1541 * IPython/genutils.py (with_obj): rename the 'with' function to
1521 1542 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1522 1543 becomes a language keyword. Closes #53.
1523 1544
1524 1545 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1525 1546 __file__ attribute to this so it fools more things into thinking
1526 1547 it is a real module. Closes #59.
1527 1548
1528 1549 * IPython/Magic.py (magic_edit): add -n option to open the editor
1529 1550 at a specific line number. After a patch by Stefan van der Walt.
1530 1551
1531 1552 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1532 1553
1533 1554 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1534 1555 reason the file could not be opened. After automatic crash
1535 1556 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1536 1557 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1537 1558 (_should_recompile): Don't fire editor if using %bg, since there
1538 1559 is no file in the first place. From the same report as above.
1539 1560 (raw_input): protect against faulty third-party prefilters. After
1540 1561 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1541 1562 while running under SAGE.
1542 1563
1543 1564 2006-05-23 Ville Vainio <vivainio@gmail.com>
1544 1565
1545 1566 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1546 1567 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1547 1568 now returns None (again), unless dummy is specifically allowed by
1548 1569 ipapi.get(allow_dummy=True).
1549 1570
1550 1571 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1551 1572
1552 1573 * IPython: remove all 2.2-compatibility objects and hacks from
1553 1574 everywhere, since we only support 2.3 at this point. Docs
1554 1575 updated.
1555 1576
1556 1577 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1557 1578 Anything requiring extra validation can be turned into a Python
1558 1579 property in the future. I used a property for the db one b/c
1559 1580 there was a nasty circularity problem with the initialization
1560 1581 order, which right now I don't have time to clean up.
1561 1582
1562 1583 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1563 1584 another locking bug reported by Jorgen. I'm not 100% sure though,
1564 1585 so more testing is needed...
1565 1586
1566 1587 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1567 1588
1568 1589 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1569 1590 local variables from any routine in user code (typically executed
1570 1591 with %run) directly into the interactive namespace. Very useful
1571 1592 when doing complex debugging.
1572 1593 (IPythonNotRunning): Changed the default None object to a dummy
1573 1594 whose attributes can be queried as well as called without
1574 1595 exploding, to ease writing code which works transparently both in
1575 1596 and out of ipython and uses some of this API.
1576 1597
1577 1598 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1578 1599
1579 1600 * IPython/hooks.py (result_display): Fix the fact that our display
1580 1601 hook was using str() instead of repr(), as the default python
1581 1602 console does. This had gone unnoticed b/c it only happened if
1582 1603 %Pprint was off, but the inconsistency was there.
1583 1604
1584 1605 2006-05-15 Ville Vainio <vivainio@gmail.com>
1585 1606
1586 1607 * Oinspect.py: Only show docstring for nonexisting/binary files
1587 1608 when doing object??, closing ticket #62
1588 1609
1589 1610 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1590 1611
1591 1612 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1592 1613 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1593 1614 was being released in a routine which hadn't checked if it had
1594 1615 been the one to acquire it.
1595 1616
1596 1617 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1597 1618
1598 1619 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1599 1620
1600 1621 2006-04-11 Ville Vainio <vivainio@gmail.com>
1601 1622
1602 1623 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1603 1624 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1604 1625 prefilters, allowing stuff like magics and aliases in the file.
1605 1626
1606 1627 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1607 1628 added. Supported now are "%clear in" and "%clear out" (clear input and
1608 1629 output history, respectively). Also fixed CachedOutput.flush to
1609 1630 properly flush the output cache.
1610 1631
1611 1632 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1612 1633 half-success (and fail explicitly).
1613 1634
1614 1635 2006-03-28 Ville Vainio <vivainio@gmail.com>
1615 1636
1616 1637 * iplib.py: Fix quoting of aliases so that only argless ones
1617 1638 are quoted
1618 1639
1619 1640 2006-03-28 Ville Vainio <vivainio@gmail.com>
1620 1641
1621 1642 * iplib.py: Quote aliases with spaces in the name.
1622 1643 "c:\program files\blah\bin" is now legal alias target.
1623 1644
1624 1645 * ext_rehashdir.py: Space no longer allowed as arg
1625 1646 separator, since space is legal in path names.
1626 1647
1627 1648 2006-03-16 Ville Vainio <vivainio@gmail.com>
1628 1649
1629 1650 * upgrade_dir.py: Take path.py from Extensions, correcting
1630 1651 %upgrade magic
1631 1652
1632 1653 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1633 1654
1634 1655 * hooks.py: Only enclose editor binary in quotes if legal and
1635 1656 necessary (space in the name, and is an existing file). Fixes a bug
1636 1657 reported by Zachary Pincus.
1637 1658
1638 1659 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1639 1660
1640 1661 * Manual: thanks to a tip on proper color handling for Emacs, by
1641 1662 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1642 1663
1643 1664 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1644 1665 by applying the provided patch. Thanks to Liu Jin
1645 1666 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1646 1667 XEmacs/Linux, I'm trusting the submitter that it actually helps
1647 1668 under win32/GNU Emacs. Will revisit if any problems are reported.
1648 1669
1649 1670 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1650 1671
1651 1672 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1652 1673 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1653 1674
1654 1675 2006-03-12 Ville Vainio <vivainio@gmail.com>
1655 1676
1656 1677 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1657 1678 Torsten Marek.
1658 1679
1659 1680 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1660 1681
1661 1682 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1662 1683 line ranges works again.
1663 1684
1664 1685 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1665 1686
1666 1687 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1667 1688 and friends, after a discussion with Zach Pincus on ipython-user.
1668 1689 I'm not 100% sure, but after thinking about it quite a bit, it may
1669 1690 be OK. Testing with the multithreaded shells didn't reveal any
1670 1691 problems, but let's keep an eye out.
1671 1692
1672 1693 In the process, I fixed a few things which were calling
1673 1694 self.InteractiveTB() directly (like safe_execfile), which is a
1674 1695 mistake: ALL exception reporting should be done by calling
1675 1696 self.showtraceback(), which handles state and tab-completion and
1676 1697 more.
1677 1698
1678 1699 2006-03-01 Ville Vainio <vivainio@gmail.com>
1679 1700
1680 1701 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1681 1702 To use, do "from ipipe import *".
1682 1703
1683 1704 2006-02-24 Ville Vainio <vivainio@gmail.com>
1684 1705
1685 1706 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1686 1707 "cleanly" and safely than the older upgrade mechanism.
1687 1708
1688 1709 2006-02-21 Ville Vainio <vivainio@gmail.com>
1689 1710
1690 1711 * Magic.py: %save works again.
1691 1712
1692 1713 2006-02-15 Ville Vainio <vivainio@gmail.com>
1693 1714
1694 1715 * Magic.py: %Pprint works again
1695 1716
1696 1717 * Extensions/ipy_sane_defaults.py: Provide everything provided
1697 1718 in default ipythonrc, to make it possible to have a completely empty
1698 1719 ipythonrc (and thus completely rc-file free configuration)
1699 1720
1700 1721 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1701 1722
1702 1723 * IPython/hooks.py (editor): quote the call to the editor command,
1703 1724 to allow commands with spaces in them. Problem noted by watching
1704 1725 Ian Oswald's video about textpad under win32 at
1705 1726 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1706 1727
1707 1728 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1708 1729 describing magics (we haven't used @ for a loong time).
1709 1730
1710 1731 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1711 1732 contributed by marienz to close
1712 1733 http://www.scipy.net/roundup/ipython/issue53.
1713 1734
1714 1735 2006-02-10 Ville Vainio <vivainio@gmail.com>
1715 1736
1716 1737 * genutils.py: getoutput now works in win32 too
1717 1738
1718 1739 * completer.py: alias and magic completion only invoked
1719 1740 at the first "item" in the line, to avoid "cd %store"
1720 1741 nonsense.
1721 1742
1722 1743 2006-02-09 Ville Vainio <vivainio@gmail.com>
1723 1744
1724 1745 * test/*: Added a unit testing framework (finally).
1725 1746 '%run runtests.py' to run test_*.
1726 1747
1727 1748 * ipapi.py: Exposed runlines and set_custom_exc
1728 1749
1729 1750 2006-02-07 Ville Vainio <vivainio@gmail.com>
1730 1751
1731 1752 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1732 1753 instead use "f(1 2)" as before.
1733 1754
1734 1755 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1735 1756
1736 1757 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1737 1758 facilities, for demos processed by the IPython input filter
1738 1759 (IPythonDemo), and for running a script one-line-at-a-time as a
1739 1760 demo, both for pure Python (LineDemo) and for IPython-processed
1740 1761 input (IPythonLineDemo). After a request by Dave Kohel, from the
1741 1762 SAGE team.
1742 1763 (Demo.edit): added an edit() method to the demo objects, to edit
1743 1764 the in-memory copy of the last executed block.
1744 1765
1745 1766 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1746 1767 processing to %edit, %macro and %save. These commands can now be
1747 1768 invoked on the unprocessed input as it was typed by the user
1748 1769 (without any prefilters applied). After requests by the SAGE team
1749 1770 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1750 1771
1751 1772 2006-02-01 Ville Vainio <vivainio@gmail.com>
1752 1773
1753 1774 * setup.py, eggsetup.py: easy_install ipython==dev works
1754 1775 correctly now (on Linux)
1755 1776
1756 1777 * ipy_user_conf,ipmaker: user config changes, removed spurious
1757 1778 warnings
1758 1779
1759 1780 * iplib: if rc.banner is string, use it as is.
1760 1781
1761 1782 * Magic: %pycat accepts a string argument and pages it's contents.
1762 1783
1763 1784
1764 1785 2006-01-30 Ville Vainio <vivainio@gmail.com>
1765 1786
1766 1787 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1767 1788 Now %store and bookmarks work through PickleShare, meaning that
1768 1789 concurrent access is possible and all ipython sessions see the
1769 1790 same database situation all the time, instead of snapshot of
1770 1791 the situation when the session was started. Hence, %bookmark
1771 1792 results are immediately accessible from othes sessions. The database
1772 1793 is also available for use by user extensions. See:
1773 1794 http://www.python.org/pypi/pickleshare
1774 1795
1775 1796 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1776 1797
1777 1798 * aliases can now be %store'd
1778 1799
1779 1800 * path.py moved to Extensions so that pickleshare does not need
1780 1801 IPython-specific import. Extensions added to pythonpath right
1781 1802 at __init__.
1782 1803
1783 1804 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1784 1805 called with _ip.system and the pre-transformed command string.
1785 1806
1786 1807 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1787 1808
1788 1809 * IPython/iplib.py (interact): Fix that we were not catching
1789 1810 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1790 1811 logic here had to change, but it's fixed now.
1791 1812
1792 1813 2006-01-29 Ville Vainio <vivainio@gmail.com>
1793 1814
1794 1815 * iplib.py: Try to import pyreadline on Windows.
1795 1816
1796 1817 2006-01-27 Ville Vainio <vivainio@gmail.com>
1797 1818
1798 1819 * iplib.py: Expose ipapi as _ip in builtin namespace.
1799 1820 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1800 1821 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1801 1822 syntax now produce _ip.* variant of the commands.
1802 1823
1803 1824 * "_ip.options().autoedit_syntax = 2" automatically throws
1804 1825 user to editor for syntax error correction without prompting.
1805 1826
1806 1827 2006-01-27 Ville Vainio <vivainio@gmail.com>
1807 1828
1808 1829 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1809 1830 'ipython' at argv[0]) executed through command line.
1810 1831 NOTE: this DEPRECATES calling ipython with multiple scripts
1811 1832 ("ipython a.py b.py c.py")
1812 1833
1813 1834 * iplib.py, hooks.py: Added configurable input prefilter,
1814 1835 named 'input_prefilter'. See ext_rescapture.py for example
1815 1836 usage.
1816 1837
1817 1838 * ext_rescapture.py, Magic.py: Better system command output capture
1818 1839 through 'var = !ls' (deprecates user-visible %sc). Same notation
1819 1840 applies for magics, 'var = %alias' assigns alias list to var.
1820 1841
1821 1842 * ipapi.py: added meta() for accessing extension-usable data store.
1822 1843
1823 1844 * iplib.py: added InteractiveShell.getapi(). New magics should be
1824 1845 written doing self.getapi() instead of using the shell directly.
1825 1846
1826 1847 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1827 1848 %store foo >> ~/myfoo.txt to store variables to files (in clean
1828 1849 textual form, not a restorable pickle).
1829 1850
1830 1851 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1831 1852
1832 1853 * usage.py, Magic.py: added %quickref
1833 1854
1834 1855 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1835 1856
1836 1857 * GetoptErrors when invoking magics etc. with wrong args
1837 1858 are now more helpful:
1838 1859 GetoptError: option -l not recognized (allowed: "qb" )
1839 1860
1840 1861 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1841 1862
1842 1863 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1843 1864 computationally intensive blocks don't appear to stall the demo.
1844 1865
1845 1866 2006-01-24 Ville Vainio <vivainio@gmail.com>
1846 1867
1847 1868 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1848 1869 value to manipulate resulting history entry.
1849 1870
1850 1871 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1851 1872 to instance methods of IPApi class, to make extending an embedded
1852 1873 IPython feasible. See ext_rehashdir.py for example usage.
1853 1874
1854 1875 * Merged 1071-1076 from branches/0.7.1
1855 1876
1856 1877
1857 1878 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1858 1879
1859 1880 * tools/release (daystamp): Fix build tools to use the new
1860 1881 eggsetup.py script to build lightweight eggs.
1861 1882
1862 1883 * Applied changesets 1062 and 1064 before 0.7.1 release.
1863 1884
1864 1885 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1865 1886 see the raw input history (without conversions like %ls ->
1866 1887 ipmagic("ls")). After a request from W. Stein, SAGE
1867 1888 (http://modular.ucsd.edu/sage) developer. This information is
1868 1889 stored in the input_hist_raw attribute of the IPython instance, so
1869 1890 developers can access it if needed (it's an InputList instance).
1870 1891
1871 1892 * Versionstring = 0.7.2.svn
1872 1893
1873 1894 * eggsetup.py: A separate script for constructing eggs, creates
1874 1895 proper launch scripts even on Windows (an .exe file in
1875 1896 \python24\scripts).
1876 1897
1877 1898 * ipapi.py: launch_new_instance, launch entry point needed for the
1878 1899 egg.
1879 1900
1880 1901 2006-01-23 Ville Vainio <vivainio@gmail.com>
1881 1902
1882 1903 * Added %cpaste magic for pasting python code
1883 1904
1884 1905 2006-01-22 Ville Vainio <vivainio@gmail.com>
1885 1906
1886 1907 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1887 1908
1888 1909 * Versionstring = 0.7.2.svn
1889 1910
1890 1911 * eggsetup.py: A separate script for constructing eggs, creates
1891 1912 proper launch scripts even on Windows (an .exe file in
1892 1913 \python24\scripts).
1893 1914
1894 1915 * ipapi.py: launch_new_instance, launch entry point needed for the
1895 1916 egg.
1896 1917
1897 1918 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1898 1919
1899 1920 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1900 1921 %pfile foo would print the file for foo even if it was a binary.
1901 1922 Now, extensions '.so' and '.dll' are skipped.
1902 1923
1903 1924 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1904 1925 bug, where macros would fail in all threaded modes. I'm not 100%
1905 1926 sure, so I'm going to put out an rc instead of making a release
1906 1927 today, and wait for feedback for at least a few days.
1907 1928
1908 1929 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1909 1930 it...) the handling of pasting external code with autoindent on.
1910 1931 To get out of a multiline input, the rule will appear for most
1911 1932 users unchanged: two blank lines or change the indent level
1912 1933 proposed by IPython. But there is a twist now: you can
1913 1934 add/subtract only *one or two spaces*. If you add/subtract three
1914 1935 or more (unless you completely delete the line), IPython will
1915 1936 accept that line, and you'll need to enter a second one of pure
1916 1937 whitespace. I know it sounds complicated, but I can't find a
1917 1938 different solution that covers all the cases, with the right
1918 1939 heuristics. Hopefully in actual use, nobody will really notice
1919 1940 all these strange rules and things will 'just work'.
1920 1941
1921 1942 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1922 1943
1923 1944 * IPython/iplib.py (interact): catch exceptions which can be
1924 1945 triggered asynchronously by signal handlers. Thanks to an
1925 1946 automatic crash report, submitted by Colin Kingsley
1926 1947 <tercel-AT-gentoo.org>.
1927 1948
1928 1949 2006-01-20 Ville Vainio <vivainio@gmail.com>
1929 1950
1930 1951 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1931 1952 (%rehashdir, very useful, try it out) of how to extend ipython
1932 1953 with new magics. Also added Extensions dir to pythonpath to make
1933 1954 importing extensions easy.
1934 1955
1935 1956 * %store now complains when trying to store interactively declared
1936 1957 classes / instances of those classes.
1937 1958
1938 1959 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1939 1960 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1940 1961 if they exist, and ipy_user_conf.py with some defaults is created for
1941 1962 the user.
1942 1963
1943 1964 * Startup rehashing done by the config file, not InterpreterExec.
1944 1965 This means system commands are available even without selecting the
1945 1966 pysh profile. It's the sensible default after all.
1946 1967
1947 1968 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1948 1969
1949 1970 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1950 1971 multiline code with autoindent on working. But I am really not
1951 1972 sure, so this needs more testing. Will commit a debug-enabled
1952 1973 version for now, while I test it some more, so that Ville and
1953 1974 others may also catch any problems. Also made
1954 1975 self.indent_current_str() a method, to ensure that there's no
1955 1976 chance of the indent space count and the corresponding string
1956 1977 falling out of sync. All code needing the string should just call
1957 1978 the method.
1958 1979
1959 1980 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1960 1981
1961 1982 * IPython/Magic.py (magic_edit): fix check for when users don't
1962 1983 save their output files, the try/except was in the wrong section.
1963 1984
1964 1985 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1965 1986
1966 1987 * IPython/Magic.py (magic_run): fix __file__ global missing from
1967 1988 script's namespace when executed via %run. After a report by
1968 1989 Vivian.
1969 1990
1970 1991 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1971 1992 when using python 2.4. The parent constructor changed in 2.4, and
1972 1993 we need to track it directly (we can't call it, as it messes up
1973 1994 readline and tab-completion inside our pdb would stop working).
1974 1995 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1975 1996
1976 1997 2006-01-16 Ville Vainio <vivainio@gmail.com>
1977 1998
1978 1999 * Ipython/magic.py: Reverted back to old %edit functionality
1979 2000 that returns file contents on exit.
1980 2001
1981 2002 * IPython/path.py: Added Jason Orendorff's "path" module to
1982 2003 IPython tree, http://www.jorendorff.com/articles/python/path/.
1983 2004 You can get path objects conveniently through %sc, and !!, e.g.:
1984 2005 sc files=ls
1985 2006 for p in files.paths: # or files.p
1986 2007 print p,p.mtime
1987 2008
1988 2009 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1989 2010 now work again without considering the exclusion regexp -
1990 2011 hence, things like ',foo my/path' turn to 'foo("my/path")'
1991 2012 instead of syntax error.
1992 2013
1993 2014
1994 2015 2006-01-14 Ville Vainio <vivainio@gmail.com>
1995 2016
1996 2017 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1997 2018 ipapi decorators for python 2.4 users, options() provides access to rc
1998 2019 data.
1999 2020
2000 2021 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2001 2022 as path separators (even on Linux ;-). Space character after
2002 2023 backslash (as yielded by tab completer) is still space;
2003 2024 "%cd long\ name" works as expected.
2004 2025
2005 2026 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2006 2027 as "chain of command", with priority. API stays the same,
2007 2028 TryNext exception raised by a hook function signals that
2008 2029 current hook failed and next hook should try handling it, as
2009 2030 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2010 2031 requested configurable display hook, which is now implemented.
2011 2032
2012 2033 2006-01-13 Ville Vainio <vivainio@gmail.com>
2013 2034
2014 2035 * IPython/platutils*.py: platform specific utility functions,
2015 2036 so far only set_term_title is implemented (change terminal
2016 2037 label in windowing systems). %cd now changes the title to
2017 2038 current dir.
2018 2039
2019 2040 * IPython/Release.py: Added myself to "authors" list,
2020 2041 had to create new files.
2021 2042
2022 2043 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2023 2044 shell escape; not a known bug but had potential to be one in the
2024 2045 future.
2025 2046
2026 2047 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2027 2048 extension API for IPython! See the module for usage example. Fix
2028 2049 OInspect for docstring-less magic functions.
2029 2050
2030 2051
2031 2052 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2032 2053
2033 2054 * IPython/iplib.py (raw_input): temporarily deactivate all
2034 2055 attempts at allowing pasting of code with autoindent on. It
2035 2056 introduced bugs (reported by Prabhu) and I can't seem to find a
2036 2057 robust combination which works in all cases. Will have to revisit
2037 2058 later.
2038 2059
2039 2060 * IPython/genutils.py: remove isspace() function. We've dropped
2040 2061 2.2 compatibility, so it's OK to use the string method.
2041 2062
2042 2063 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2043 2064
2044 2065 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2045 2066 matching what NOT to autocall on, to include all python binary
2046 2067 operators (including things like 'and', 'or', 'is' and 'in').
2047 2068 Prompted by a bug report on 'foo & bar', but I realized we had
2048 2069 many more potential bug cases with other operators. The regexp is
2049 2070 self.re_exclude_auto, it's fairly commented.
2050 2071
2051 2072 2006-01-12 Ville Vainio <vivainio@gmail.com>
2052 2073
2053 2074 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2054 2075 Prettified and hardened string/backslash quoting with ipsystem(),
2055 2076 ipalias() and ipmagic(). Now even \ characters are passed to
2056 2077 %magics, !shell escapes and aliases exactly as they are in the
2057 2078 ipython command line. Should improve backslash experience,
2058 2079 particularly in Windows (path delimiter for some commands that
2059 2080 won't understand '/'), but Unix benefits as well (regexps). %cd
2060 2081 magic still doesn't support backslash path delimiters, though. Also
2061 2082 deleted all pretense of supporting multiline command strings in
2062 2083 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2063 2084
2064 2085 * doc/build_doc_instructions.txt added. Documentation on how to
2065 2086 use doc/update_manual.py, added yesterday. Both files contributed
2066 2087 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2067 2088 doc/*.sh for deprecation at a later date.
2068 2089
2069 2090 * /ipython.py Added ipython.py to root directory for
2070 2091 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2071 2092 ipython.py) and development convenience (no need to keep doing
2072 2093 "setup.py install" between changes).
2073 2094
2074 2095 * Made ! and !! shell escapes work (again) in multiline expressions:
2075 2096 if 1:
2076 2097 !ls
2077 2098 !!ls
2078 2099
2079 2100 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2080 2101
2081 2102 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2082 2103 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2083 2104 module in case-insensitive installation. Was causing crashes
2084 2105 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2085 2106
2086 2107 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2087 2108 <marienz-AT-gentoo.org>, closes
2088 2109 http://www.scipy.net/roundup/ipython/issue51.
2089 2110
2090 2111 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2091 2112
2092 2113 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2093 2114 problem of excessive CPU usage under *nix and keyboard lag under
2094 2115 win32.
2095 2116
2096 2117 2006-01-10 *** Released version 0.7.0
2097 2118
2098 2119 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2099 2120
2100 2121 * IPython/Release.py (revision): tag version number to 0.7.0,
2101 2122 ready for release.
2102 2123
2103 2124 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2104 2125 it informs the user of the name of the temp. file used. This can
2105 2126 help if you decide later to reuse that same file, so you know
2106 2127 where to copy the info from.
2107 2128
2108 2129 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2109 2130
2110 2131 * setup_bdist_egg.py: little script to build an egg. Added
2111 2132 support in the release tools as well.
2112 2133
2113 2134 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2114 2135
2115 2136 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2116 2137 version selection (new -wxversion command line and ipythonrc
2117 2138 parameter). Patch contributed by Arnd Baecker
2118 2139 <arnd.baecker-AT-web.de>.
2119 2140
2120 2141 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2121 2142 embedded instances, for variables defined at the interactive
2122 2143 prompt of the embedded ipython. Reported by Arnd.
2123 2144
2124 2145 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2125 2146 it can be used as a (stateful) toggle, or with a direct parameter.
2126 2147
2127 2148 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2128 2149 could be triggered in certain cases and cause the traceback
2129 2150 printer not to work.
2130 2151
2131 2152 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2132 2153
2133 2154 * IPython/iplib.py (_should_recompile): Small fix, closes
2134 2155 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2135 2156
2136 2157 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2137 2158
2138 2159 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2139 2160 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2140 2161 Moad for help with tracking it down.
2141 2162
2142 2163 * IPython/iplib.py (handle_auto): fix autocall handling for
2143 2164 objects which support BOTH __getitem__ and __call__ (so that f [x]
2144 2165 is left alone, instead of becoming f([x]) automatically).
2145 2166
2146 2167 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2147 2168 Ville's patch.
2148 2169
2149 2170 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2150 2171
2151 2172 * IPython/iplib.py (handle_auto): changed autocall semantics to
2152 2173 include 'smart' mode, where the autocall transformation is NOT
2153 2174 applied if there are no arguments on the line. This allows you to
2154 2175 just type 'foo' if foo is a callable to see its internal form,
2155 2176 instead of having it called with no arguments (typically a
2156 2177 mistake). The old 'full' autocall still exists: for that, you
2157 2178 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2158 2179
2159 2180 * IPython/completer.py (Completer.attr_matches): add
2160 2181 tab-completion support for Enthoughts' traits. After a report by
2161 2182 Arnd and a patch by Prabhu.
2162 2183
2163 2184 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2164 2185
2165 2186 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2166 2187 Schmolck's patch to fix inspect.getinnerframes().
2167 2188
2168 2189 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2169 2190 for embedded instances, regarding handling of namespaces and items
2170 2191 added to the __builtin__ one. Multiple embedded instances and
2171 2192 recursive embeddings should work better now (though I'm not sure
2172 2193 I've got all the corner cases fixed, that code is a bit of a brain
2173 2194 twister).
2174 2195
2175 2196 * IPython/Magic.py (magic_edit): added support to edit in-memory
2176 2197 macros (automatically creates the necessary temp files). %edit
2177 2198 also doesn't return the file contents anymore, it's just noise.
2178 2199
2179 2200 * IPython/completer.py (Completer.attr_matches): revert change to
2180 2201 complete only on attributes listed in __all__. I realized it
2181 2202 cripples the tab-completion system as a tool for exploring the
2182 2203 internals of unknown libraries (it renders any non-__all__
2183 2204 attribute off-limits). I got bit by this when trying to see
2184 2205 something inside the dis module.
2185 2206
2186 2207 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2187 2208
2188 2209 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2189 2210 namespace for users and extension writers to hold data in. This
2190 2211 follows the discussion in
2191 2212 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2192 2213
2193 2214 * IPython/completer.py (IPCompleter.complete): small patch to help
2194 2215 tab-completion under Emacs, after a suggestion by John Barnard
2195 2216 <barnarj-AT-ccf.org>.
2196 2217
2197 2218 * IPython/Magic.py (Magic.extract_input_slices): added support for
2198 2219 the slice notation in magics to use N-M to represent numbers N...M
2199 2220 (closed endpoints). This is used by %macro and %save.
2200 2221
2201 2222 * IPython/completer.py (Completer.attr_matches): for modules which
2202 2223 define __all__, complete only on those. After a patch by Jeffrey
2203 2224 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2204 2225 speed up this routine.
2205 2226
2206 2227 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2207 2228 don't know if this is the end of it, but the behavior now is
2208 2229 certainly much more correct. Note that coupled with macros,
2209 2230 slightly surprising (at first) behavior may occur: a macro will in
2210 2231 general expand to multiple lines of input, so upon exiting, the
2211 2232 in/out counters will both be bumped by the corresponding amount
2212 2233 (as if the macro's contents had been typed interactively). Typing
2213 2234 %hist will reveal the intermediate (silently processed) lines.
2214 2235
2215 2236 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2216 2237 pickle to fail (%run was overwriting __main__ and not restoring
2217 2238 it, but pickle relies on __main__ to operate).
2218 2239
2219 2240 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2220 2241 using properties, but forgot to make the main InteractiveShell
2221 2242 class a new-style class. Properties fail silently, and
2222 2243 mysteriously, with old-style class (getters work, but
2223 2244 setters don't do anything).
2224 2245
2225 2246 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2226 2247
2227 2248 * IPython/Magic.py (magic_history): fix history reporting bug (I
2228 2249 know some nasties are still there, I just can't seem to find a
2229 2250 reproducible test case to track them down; the input history is
2230 2251 falling out of sync...)
2231 2252
2232 2253 * IPython/iplib.py (handle_shell_escape): fix bug where both
2233 2254 aliases and system accesses where broken for indented code (such
2234 2255 as loops).
2235 2256
2236 2257 * IPython/genutils.py (shell): fix small but critical bug for
2237 2258 win32 system access.
2238 2259
2239 2260 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2240 2261
2241 2262 * IPython/iplib.py (showtraceback): remove use of the
2242 2263 sys.last_{type/value/traceback} structures, which are non
2243 2264 thread-safe.
2244 2265 (_prefilter): change control flow to ensure that we NEVER
2245 2266 introspect objects when autocall is off. This will guarantee that
2246 2267 having an input line of the form 'x.y', where access to attribute
2247 2268 'y' has side effects, doesn't trigger the side effect TWICE. It
2248 2269 is important to note that, with autocall on, these side effects
2249 2270 can still happen.
2250 2271 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2251 2272 trio. IPython offers these three kinds of special calls which are
2252 2273 not python code, and it's a good thing to have their call method
2253 2274 be accessible as pure python functions (not just special syntax at
2254 2275 the command line). It gives us a better internal implementation
2255 2276 structure, as well as exposing these for user scripting more
2256 2277 cleanly.
2257 2278
2258 2279 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2259 2280 file. Now that they'll be more likely to be used with the
2260 2281 persistance system (%store), I want to make sure their module path
2261 2282 doesn't change in the future, so that we don't break things for
2262 2283 users' persisted data.
2263 2284
2264 2285 * IPython/iplib.py (autoindent_update): move indentation
2265 2286 management into the _text_ processing loop, not the keyboard
2266 2287 interactive one. This is necessary to correctly process non-typed
2267 2288 multiline input (such as macros).
2268 2289
2269 2290 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2270 2291 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2271 2292 which was producing problems in the resulting manual.
2272 2293 (magic_whos): improve reporting of instances (show their class,
2273 2294 instead of simply printing 'instance' which isn't terribly
2274 2295 informative).
2275 2296
2276 2297 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2277 2298 (minor mods) to support network shares under win32.
2278 2299
2279 2300 * IPython/winconsole.py (get_console_size): add new winconsole
2280 2301 module and fixes to page_dumb() to improve its behavior under
2281 2302 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2282 2303
2283 2304 * IPython/Magic.py (Macro): simplified Macro class to just
2284 2305 subclass list. We've had only 2.2 compatibility for a very long
2285 2306 time, yet I was still avoiding subclassing the builtin types. No
2286 2307 more (I'm also starting to use properties, though I won't shift to
2287 2308 2.3-specific features quite yet).
2288 2309 (magic_store): added Ville's patch for lightweight variable
2289 2310 persistence, after a request on the user list by Matt Wilkie
2290 2311 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2291 2312 details.
2292 2313
2293 2314 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2294 2315 changed the default logfile name from 'ipython.log' to
2295 2316 'ipython_log.py'. These logs are real python files, and now that
2296 2317 we have much better multiline support, people are more likely to
2297 2318 want to use them as such. Might as well name them correctly.
2298 2319
2299 2320 * IPython/Magic.py: substantial cleanup. While we can't stop
2300 2321 using magics as mixins, due to the existing customizations 'out
2301 2322 there' which rely on the mixin naming conventions, at least I
2302 2323 cleaned out all cross-class name usage. So once we are OK with
2303 2324 breaking compatibility, the two systems can be separated.
2304 2325
2305 2326 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2306 2327 anymore, and the class is a fair bit less hideous as well. New
2307 2328 features were also introduced: timestamping of input, and logging
2308 2329 of output results. These are user-visible with the -t and -o
2309 2330 options to %logstart. Closes
2310 2331 http://www.scipy.net/roundup/ipython/issue11 and a request by
2311 2332 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2312 2333
2313 2334 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2314 2335
2315 2336 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2316 2337 better handle backslashes in paths. See the thread 'More Windows
2317 2338 questions part 2 - \/ characters revisited' on the iypthon user
2318 2339 list:
2319 2340 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2320 2341
2321 2342 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2322 2343
2323 2344 (InteractiveShell.__init__): change threaded shells to not use the
2324 2345 ipython crash handler. This was causing more problems than not,
2325 2346 as exceptions in the main thread (GUI code, typically) would
2326 2347 always show up as a 'crash', when they really weren't.
2327 2348
2328 2349 The colors and exception mode commands (%colors/%xmode) have been
2329 2350 synchronized to also take this into account, so users can get
2330 2351 verbose exceptions for their threaded code as well. I also added
2331 2352 support for activating pdb inside this exception handler as well,
2332 2353 so now GUI authors can use IPython's enhanced pdb at runtime.
2333 2354
2334 2355 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2335 2356 true by default, and add it to the shipped ipythonrc file. Since
2336 2357 this asks the user before proceeding, I think it's OK to make it
2337 2358 true by default.
2338 2359
2339 2360 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2340 2361 of the previous special-casing of input in the eval loop. I think
2341 2362 this is cleaner, as they really are commands and shouldn't have
2342 2363 a special role in the middle of the core code.
2343 2364
2344 2365 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2345 2366
2346 2367 * IPython/iplib.py (edit_syntax_error): added support for
2347 2368 automatically reopening the editor if the file had a syntax error
2348 2369 in it. Thanks to scottt who provided the patch at:
2349 2370 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2350 2371 version committed).
2351 2372
2352 2373 * IPython/iplib.py (handle_normal): add suport for multi-line
2353 2374 input with emtpy lines. This fixes
2354 2375 http://www.scipy.net/roundup/ipython/issue43 and a similar
2355 2376 discussion on the user list.
2356 2377
2357 2378 WARNING: a behavior change is necessarily introduced to support
2358 2379 blank lines: now a single blank line with whitespace does NOT
2359 2380 break the input loop, which means that when autoindent is on, by
2360 2381 default hitting return on the next (indented) line does NOT exit.
2361 2382
2362 2383 Instead, to exit a multiline input you can either have:
2363 2384
2364 2385 - TWO whitespace lines (just hit return again), or
2365 2386 - a single whitespace line of a different length than provided
2366 2387 by the autoindent (add or remove a space).
2367 2388
2368 2389 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2369 2390 module to better organize all readline-related functionality.
2370 2391 I've deleted FlexCompleter and put all completion clases here.
2371 2392
2372 2393 * IPython/iplib.py (raw_input): improve indentation management.
2373 2394 It is now possible to paste indented code with autoindent on, and
2374 2395 the code is interpreted correctly (though it still looks bad on
2375 2396 screen, due to the line-oriented nature of ipython).
2376 2397 (MagicCompleter.complete): change behavior so that a TAB key on an
2377 2398 otherwise empty line actually inserts a tab, instead of completing
2378 2399 on the entire global namespace. This makes it easier to use the
2379 2400 TAB key for indentation. After a request by Hans Meine
2380 2401 <hans_meine-AT-gmx.net>
2381 2402 (_prefilter): add support so that typing plain 'exit' or 'quit'
2382 2403 does a sensible thing. Originally I tried to deviate as little as
2383 2404 possible from the default python behavior, but even that one may
2384 2405 change in this direction (thread on python-dev to that effect).
2385 2406 Regardless, ipython should do the right thing even if CPython's
2386 2407 '>>>' prompt doesn't.
2387 2408 (InteractiveShell): removed subclassing code.InteractiveConsole
2388 2409 class. By now we'd overridden just about all of its methods: I've
2389 2410 copied the remaining two over, and now ipython is a standalone
2390 2411 class. This will provide a clearer picture for the chainsaw
2391 2412 branch refactoring.
2392 2413
2393 2414 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2394 2415
2395 2416 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2396 2417 failures for objects which break when dir() is called on them.
2397 2418
2398 2419 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2399 2420 distinct local and global namespaces in the completer API. This
2400 2421 change allows us to properly handle completion with distinct
2401 2422 scopes, including in embedded instances (this had never really
2402 2423 worked correctly).
2403 2424
2404 2425 Note: this introduces a change in the constructor for
2405 2426 MagicCompleter, as a new global_namespace parameter is now the
2406 2427 second argument (the others were bumped one position).
2407 2428
2408 2429 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2409 2430
2410 2431 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2411 2432 embedded instances (which can be done now thanks to Vivian's
2412 2433 frame-handling fixes for pdb).
2413 2434 (InteractiveShell.__init__): Fix namespace handling problem in
2414 2435 embedded instances. We were overwriting __main__ unconditionally,
2415 2436 and this should only be done for 'full' (non-embedded) IPython;
2416 2437 embedded instances must respect the caller's __main__. Thanks to
2417 2438 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2418 2439
2419 2440 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2420 2441
2421 2442 * setup.py: added download_url to setup(). This registers the
2422 2443 download address at PyPI, which is not only useful to humans
2423 2444 browsing the site, but is also picked up by setuptools (the Eggs
2424 2445 machinery). Thanks to Ville and R. Kern for the info/discussion
2425 2446 on this.
2426 2447
2427 2448 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2428 2449
2429 2450 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2430 2451 This brings a lot of nice functionality to the pdb mode, which now
2431 2452 has tab-completion, syntax highlighting, and better stack handling
2432 2453 than before. Many thanks to Vivian De Smedt
2433 2454 <vivian-AT-vdesmedt.com> for the original patches.
2434 2455
2435 2456 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2436 2457
2437 2458 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2438 2459 sequence to consistently accept the banner argument. The
2439 2460 inconsistency was tripping SAGE, thanks to Gary Zablackis
2440 2461 <gzabl-AT-yahoo.com> for the report.
2441 2462
2442 2463 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2443 2464
2444 2465 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2445 2466 Fix bug where a naked 'alias' call in the ipythonrc file would
2446 2467 cause a crash. Bug reported by Jorgen Stenarson.
2447 2468
2448 2469 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2449 2470
2450 2471 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2451 2472 startup time.
2452 2473
2453 2474 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2454 2475 instances had introduced a bug with globals in normal code. Now
2455 2476 it's working in all cases.
2456 2477
2457 2478 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2458 2479 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2459 2480 has been introduced to set the default case sensitivity of the
2460 2481 searches. Users can still select either mode at runtime on a
2461 2482 per-search basis.
2462 2483
2463 2484 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2464 2485
2465 2486 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2466 2487 attributes in wildcard searches for subclasses. Modified version
2467 2488 of a patch by Jorgen.
2468 2489
2469 2490 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2470 2491
2471 2492 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2472 2493 embedded instances. I added a user_global_ns attribute to the
2473 2494 InteractiveShell class to handle this.
2474 2495
2475 2496 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2476 2497
2477 2498 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2478 2499 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2479 2500 (reported under win32, but may happen also in other platforms).
2480 2501 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2481 2502
2482 2503 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2483 2504
2484 2505 * IPython/Magic.py (magic_psearch): new support for wildcard
2485 2506 patterns. Now, typing ?a*b will list all names which begin with a
2486 2507 and end in b, for example. The %psearch magic has full
2487 2508 docstrings. Many thanks to JΓΆrgen Stenarson
2488 2509 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2489 2510 implementing this functionality.
2490 2511
2491 2512 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2492 2513
2493 2514 * Manual: fixed long-standing annoyance of double-dashes (as in
2494 2515 --prefix=~, for example) being stripped in the HTML version. This
2495 2516 is a latex2html bug, but a workaround was provided. Many thanks
2496 2517 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2497 2518 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2498 2519 rolling. This seemingly small issue had tripped a number of users
2499 2520 when first installing, so I'm glad to see it gone.
2500 2521
2501 2522 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2502 2523
2503 2524 * IPython/Extensions/numeric_formats.py: fix missing import,
2504 2525 reported by Stephen Walton.
2505 2526
2506 2527 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2507 2528
2508 2529 * IPython/demo.py: finish demo module, fully documented now.
2509 2530
2510 2531 * IPython/genutils.py (file_read): simple little utility to read a
2511 2532 file and ensure it's closed afterwards.
2512 2533
2513 2534 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2514 2535
2515 2536 * IPython/demo.py (Demo.__init__): added support for individually
2516 2537 tagging blocks for automatic execution.
2517 2538
2518 2539 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2519 2540 syntax-highlighted python sources, requested by John.
2520 2541
2521 2542 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2522 2543
2523 2544 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2524 2545 finishing.
2525 2546
2526 2547 * IPython/genutils.py (shlex_split): moved from Magic to here,
2527 2548 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2528 2549
2529 2550 * IPython/demo.py (Demo.__init__): added support for silent
2530 2551 blocks, improved marks as regexps, docstrings written.
2531 2552 (Demo.__init__): better docstring, added support for sys.argv.
2532 2553
2533 2554 * IPython/genutils.py (marquee): little utility used by the demo
2534 2555 code, handy in general.
2535 2556
2536 2557 * IPython/demo.py (Demo.__init__): new class for interactive
2537 2558 demos. Not documented yet, I just wrote it in a hurry for
2538 2559 scipy'05. Will docstring later.
2539 2560
2540 2561 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2541 2562
2542 2563 * IPython/Shell.py (sigint_handler): Drastic simplification which
2543 2564 also seems to make Ctrl-C work correctly across threads! This is
2544 2565 so simple, that I can't beleive I'd missed it before. Needs more
2545 2566 testing, though.
2546 2567 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2547 2568 like this before...
2548 2569
2549 2570 * IPython/genutils.py (get_home_dir): add protection against
2550 2571 non-dirs in win32 registry.
2551 2572
2552 2573 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2553 2574 bug where dict was mutated while iterating (pysh crash).
2554 2575
2555 2576 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2556 2577
2557 2578 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2558 2579 spurious newlines added by this routine. After a report by
2559 2580 F. Mantegazza.
2560 2581
2561 2582 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2562 2583
2563 2584 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2564 2585 calls. These were a leftover from the GTK 1.x days, and can cause
2565 2586 problems in certain cases (after a report by John Hunter).
2566 2587
2567 2588 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2568 2589 os.getcwd() fails at init time. Thanks to patch from David Remahl
2569 2590 <chmod007-AT-mac.com>.
2570 2591 (InteractiveShell.__init__): prevent certain special magics from
2571 2592 being shadowed by aliases. Closes
2572 2593 http://www.scipy.net/roundup/ipython/issue41.
2573 2594
2574 2595 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2575 2596
2576 2597 * IPython/iplib.py (InteractiveShell.complete): Added new
2577 2598 top-level completion method to expose the completion mechanism
2578 2599 beyond readline-based environments.
2579 2600
2580 2601 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2581 2602
2582 2603 * tools/ipsvnc (svnversion): fix svnversion capture.
2583 2604
2584 2605 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2585 2606 attribute to self, which was missing. Before, it was set by a
2586 2607 routine which in certain cases wasn't being called, so the
2587 2608 instance could end up missing the attribute. This caused a crash.
2588 2609 Closes http://www.scipy.net/roundup/ipython/issue40.
2589 2610
2590 2611 2005-08-16 Fernando Perez <fperez@colorado.edu>
2591 2612
2592 2613 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2593 2614 contains non-string attribute. Closes
2594 2615 http://www.scipy.net/roundup/ipython/issue38.
2595 2616
2596 2617 2005-08-14 Fernando Perez <fperez@colorado.edu>
2597 2618
2598 2619 * tools/ipsvnc: Minor improvements, to add changeset info.
2599 2620
2600 2621 2005-08-12 Fernando Perez <fperez@colorado.edu>
2601 2622
2602 2623 * IPython/iplib.py (runsource): remove self.code_to_run_src
2603 2624 attribute. I realized this is nothing more than
2604 2625 '\n'.join(self.buffer), and having the same data in two different
2605 2626 places is just asking for synchronization bugs. This may impact
2606 2627 people who have custom exception handlers, so I need to warn
2607 2628 ipython-dev about it (F. Mantegazza may use them).
2608 2629
2609 2630 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2610 2631
2611 2632 * IPython/genutils.py: fix 2.2 compatibility (generators)
2612 2633
2613 2634 2005-07-18 Fernando Perez <fperez@colorado.edu>
2614 2635
2615 2636 * IPython/genutils.py (get_home_dir): fix to help users with
2616 2637 invalid $HOME under win32.
2617 2638
2618 2639 2005-07-17 Fernando Perez <fperez@colorado.edu>
2619 2640
2620 2641 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2621 2642 some old hacks and clean up a bit other routines; code should be
2622 2643 simpler and a bit faster.
2623 2644
2624 2645 * IPython/iplib.py (interact): removed some last-resort attempts
2625 2646 to survive broken stdout/stderr. That code was only making it
2626 2647 harder to abstract out the i/o (necessary for gui integration),
2627 2648 and the crashes it could prevent were extremely rare in practice
2628 2649 (besides being fully user-induced in a pretty violent manner).
2629 2650
2630 2651 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2631 2652 Nothing major yet, but the code is simpler to read; this should
2632 2653 make it easier to do more serious modifications in the future.
2633 2654
2634 2655 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2635 2656 which broke in .15 (thanks to a report by Ville).
2636 2657
2637 2658 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2638 2659 be quite correct, I know next to nothing about unicode). This
2639 2660 will allow unicode strings to be used in prompts, amongst other
2640 2661 cases. It also will prevent ipython from crashing when unicode
2641 2662 shows up unexpectedly in many places. If ascii encoding fails, we
2642 2663 assume utf_8. Currently the encoding is not a user-visible
2643 2664 setting, though it could be made so if there is demand for it.
2644 2665
2645 2666 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2646 2667
2647 2668 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2648 2669
2649 2670 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2650 2671
2651 2672 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2652 2673 code can work transparently for 2.2/2.3.
2653 2674
2654 2675 2005-07-16 Fernando Perez <fperez@colorado.edu>
2655 2676
2656 2677 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2657 2678 out of the color scheme table used for coloring exception
2658 2679 tracebacks. This allows user code to add new schemes at runtime.
2659 2680 This is a minimally modified version of the patch at
2660 2681 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2661 2682 for the contribution.
2662 2683
2663 2684 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2664 2685 slightly modified version of the patch in
2665 2686 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2666 2687 to remove the previous try/except solution (which was costlier).
2667 2688 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2668 2689
2669 2690 2005-06-08 Fernando Perez <fperez@colorado.edu>
2670 2691
2671 2692 * IPython/iplib.py (write/write_err): Add methods to abstract all
2672 2693 I/O a bit more.
2673 2694
2674 2695 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2675 2696 warning, reported by Aric Hagberg, fix by JD Hunter.
2676 2697
2677 2698 2005-06-02 *** Released version 0.6.15
2678 2699
2679 2700 2005-06-01 Fernando Perez <fperez@colorado.edu>
2680 2701
2681 2702 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2682 2703 tab-completion of filenames within open-quoted strings. Note that
2683 2704 this requires that in ~/.ipython/ipythonrc, users change the
2684 2705 readline delimiters configuration to read:
2685 2706
2686 2707 readline_remove_delims -/~
2687 2708
2688 2709
2689 2710 2005-05-31 *** Released version 0.6.14
2690 2711
2691 2712 2005-05-29 Fernando Perez <fperez@colorado.edu>
2692 2713
2693 2714 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2694 2715 with files not on the filesystem. Reported by Eliyahu Sandler
2695 2716 <eli@gondolin.net>
2696 2717
2697 2718 2005-05-22 Fernando Perez <fperez@colorado.edu>
2698 2719
2699 2720 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2700 2721 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2701 2722
2702 2723 2005-05-19 Fernando Perez <fperez@colorado.edu>
2703 2724
2704 2725 * IPython/iplib.py (safe_execfile): close a file which could be
2705 2726 left open (causing problems in win32, which locks open files).
2706 2727 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2707 2728
2708 2729 2005-05-18 Fernando Perez <fperez@colorado.edu>
2709 2730
2710 2731 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2711 2732 keyword arguments correctly to safe_execfile().
2712 2733
2713 2734 2005-05-13 Fernando Perez <fperez@colorado.edu>
2714 2735
2715 2736 * ipython.1: Added info about Qt to manpage, and threads warning
2716 2737 to usage page (invoked with --help).
2717 2738
2718 2739 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2719 2740 new matcher (it goes at the end of the priority list) to do
2720 2741 tab-completion on named function arguments. Submitted by George
2721 2742 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2722 2743 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2723 2744 for more details.
2724 2745
2725 2746 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2726 2747 SystemExit exceptions in the script being run. Thanks to a report
2727 2748 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2728 2749 producing very annoying behavior when running unit tests.
2729 2750
2730 2751 2005-05-12 Fernando Perez <fperez@colorado.edu>
2731 2752
2732 2753 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2733 2754 which I'd broken (again) due to a changed regexp. In the process,
2734 2755 added ';' as an escape to auto-quote the whole line without
2735 2756 splitting its arguments. Thanks to a report by Jerry McRae
2736 2757 <qrs0xyc02-AT-sneakemail.com>.
2737 2758
2738 2759 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2739 2760 possible crashes caused by a TokenError. Reported by Ed Schofield
2740 2761 <schofield-AT-ftw.at>.
2741 2762
2742 2763 2005-05-06 Fernando Perez <fperez@colorado.edu>
2743 2764
2744 2765 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2745 2766
2746 2767 2005-04-29 Fernando Perez <fperez@colorado.edu>
2747 2768
2748 2769 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2749 2770 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2750 2771 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2751 2772 which provides support for Qt interactive usage (similar to the
2752 2773 existing one for WX and GTK). This had been often requested.
2753 2774
2754 2775 2005-04-14 *** Released version 0.6.13
2755 2776
2756 2777 2005-04-08 Fernando Perez <fperez@colorado.edu>
2757 2778
2758 2779 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2759 2780 from _ofind, which gets called on almost every input line. Now,
2760 2781 we only try to get docstrings if they are actually going to be
2761 2782 used (the overhead of fetching unnecessary docstrings can be
2762 2783 noticeable for certain objects, such as Pyro proxies).
2763 2784
2764 2785 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2765 2786 for completers. For some reason I had been passing them the state
2766 2787 variable, which completers never actually need, and was in
2767 2788 conflict with the rlcompleter API. Custom completers ONLY need to
2768 2789 take the text parameter.
2769 2790
2770 2791 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2771 2792 work correctly in pysh. I've also moved all the logic which used
2772 2793 to be in pysh.py here, which will prevent problems with future
2773 2794 upgrades. However, this time I must warn users to update their
2774 2795 pysh profile to include the line
2775 2796
2776 2797 import_all IPython.Extensions.InterpreterExec
2777 2798
2778 2799 because otherwise things won't work for them. They MUST also
2779 2800 delete pysh.py and the line
2780 2801
2781 2802 execfile pysh.py
2782 2803
2783 2804 from their ipythonrc-pysh.
2784 2805
2785 2806 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2786 2807 robust in the face of objects whose dir() returns non-strings
2787 2808 (which it shouldn't, but some broken libs like ITK do). Thanks to
2788 2809 a patch by John Hunter (implemented differently, though). Also
2789 2810 minor improvements by using .extend instead of + on lists.
2790 2811
2791 2812 * pysh.py:
2792 2813
2793 2814 2005-04-06 Fernando Perez <fperez@colorado.edu>
2794 2815
2795 2816 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2796 2817 by default, so that all users benefit from it. Those who don't
2797 2818 want it can still turn it off.
2798 2819
2799 2820 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2800 2821 config file, I'd forgotten about this, so users were getting it
2801 2822 off by default.
2802 2823
2803 2824 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2804 2825 consistency. Now magics can be called in multiline statements,
2805 2826 and python variables can be expanded in magic calls via $var.
2806 2827 This makes the magic system behave just like aliases or !system
2807 2828 calls.
2808 2829
2809 2830 2005-03-28 Fernando Perez <fperez@colorado.edu>
2810 2831
2811 2832 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2812 2833 expensive string additions for building command. Add support for
2813 2834 trailing ';' when autocall is used.
2814 2835
2815 2836 2005-03-26 Fernando Perez <fperez@colorado.edu>
2816 2837
2817 2838 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2818 2839 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2819 2840 ipython.el robust against prompts with any number of spaces
2820 2841 (including 0) after the ':' character.
2821 2842
2822 2843 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2823 2844 continuation prompt, which misled users to think the line was
2824 2845 already indented. Closes debian Bug#300847, reported to me by
2825 2846 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2826 2847
2827 2848 2005-03-23 Fernando Perez <fperez@colorado.edu>
2828 2849
2829 2850 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2830 2851 properly aligned if they have embedded newlines.
2831 2852
2832 2853 * IPython/iplib.py (runlines): Add a public method to expose
2833 2854 IPython's code execution machinery, so that users can run strings
2834 2855 as if they had been typed at the prompt interactively.
2835 2856 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2836 2857 methods which can call the system shell, but with python variable
2837 2858 expansion. The three such methods are: __IPYTHON__.system,
2838 2859 .getoutput and .getoutputerror. These need to be documented in a
2839 2860 'public API' section (to be written) of the manual.
2840 2861
2841 2862 2005-03-20 Fernando Perez <fperez@colorado.edu>
2842 2863
2843 2864 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2844 2865 for custom exception handling. This is quite powerful, and it
2845 2866 allows for user-installable exception handlers which can trap
2846 2867 custom exceptions at runtime and treat them separately from
2847 2868 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2848 2869 Mantegazza <mantegazza-AT-ill.fr>.
2849 2870 (InteractiveShell.set_custom_completer): public API function to
2850 2871 add new completers at runtime.
2851 2872
2852 2873 2005-03-19 Fernando Perez <fperez@colorado.edu>
2853 2874
2854 2875 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2855 2876 allow objects which provide their docstrings via non-standard
2856 2877 mechanisms (like Pyro proxies) to still be inspected by ipython's
2857 2878 ? system.
2858 2879
2859 2880 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2860 2881 automatic capture system. I tried quite hard to make it work
2861 2882 reliably, and simply failed. I tried many combinations with the
2862 2883 subprocess module, but eventually nothing worked in all needed
2863 2884 cases (not blocking stdin for the child, duplicating stdout
2864 2885 without blocking, etc). The new %sc/%sx still do capture to these
2865 2886 magical list/string objects which make shell use much more
2866 2887 conveninent, so not all is lost.
2867 2888
2868 2889 XXX - FIX MANUAL for the change above!
2869 2890
2870 2891 (runsource): I copied code.py's runsource() into ipython to modify
2871 2892 it a bit. Now the code object and source to be executed are
2872 2893 stored in ipython. This makes this info accessible to third-party
2873 2894 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2874 2895 Mantegazza <mantegazza-AT-ill.fr>.
2875 2896
2876 2897 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2877 2898 history-search via readline (like C-p/C-n). I'd wanted this for a
2878 2899 long time, but only recently found out how to do it. For users
2879 2900 who already have their ipythonrc files made and want this, just
2880 2901 add:
2881 2902
2882 2903 readline_parse_and_bind "\e[A": history-search-backward
2883 2904 readline_parse_and_bind "\e[B": history-search-forward
2884 2905
2885 2906 2005-03-18 Fernando Perez <fperez@colorado.edu>
2886 2907
2887 2908 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2888 2909 LSString and SList classes which allow transparent conversions
2889 2910 between list mode and whitespace-separated string.
2890 2911 (magic_r): Fix recursion problem in %r.
2891 2912
2892 2913 * IPython/genutils.py (LSString): New class to be used for
2893 2914 automatic storage of the results of all alias/system calls in _o
2894 2915 and _e (stdout/err). These provide a .l/.list attribute which
2895 2916 does automatic splitting on newlines. This means that for most
2896 2917 uses, you'll never need to do capturing of output with %sc/%sx
2897 2918 anymore, since ipython keeps this always done for you. Note that
2898 2919 only the LAST results are stored, the _o/e variables are
2899 2920 overwritten on each call. If you need to save their contents
2900 2921 further, simply bind them to any other name.
2901 2922
2902 2923 2005-03-17 Fernando Perez <fperez@colorado.edu>
2903 2924
2904 2925 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2905 2926 prompt namespace handling.
2906 2927
2907 2928 2005-03-16 Fernando Perez <fperez@colorado.edu>
2908 2929
2909 2930 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2910 2931 classic prompts to be '>>> ' (final space was missing, and it
2911 2932 trips the emacs python mode).
2912 2933 (BasePrompt.__str__): Added safe support for dynamic prompt
2913 2934 strings. Now you can set your prompt string to be '$x', and the
2914 2935 value of x will be printed from your interactive namespace. The
2915 2936 interpolation syntax includes the full Itpl support, so
2916 2937 ${foo()+x+bar()} is a valid prompt string now, and the function
2917 2938 calls will be made at runtime.
2918 2939
2919 2940 2005-03-15 Fernando Perez <fperez@colorado.edu>
2920 2941
2921 2942 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2922 2943 avoid name clashes in pylab. %hist still works, it just forwards
2923 2944 the call to %history.
2924 2945
2925 2946 2005-03-02 *** Released version 0.6.12
2926 2947
2927 2948 2005-03-02 Fernando Perez <fperez@colorado.edu>
2928 2949
2929 2950 * IPython/iplib.py (handle_magic): log magic calls properly as
2930 2951 ipmagic() function calls.
2931 2952
2932 2953 * IPython/Magic.py (magic_time): Improved %time to support
2933 2954 statements and provide wall-clock as well as CPU time.
2934 2955
2935 2956 2005-02-27 Fernando Perez <fperez@colorado.edu>
2936 2957
2937 2958 * IPython/hooks.py: New hooks module, to expose user-modifiable
2938 2959 IPython functionality in a clean manner. For now only the editor
2939 2960 hook is actually written, and other thigns which I intend to turn
2940 2961 into proper hooks aren't yet there. The display and prefilter
2941 2962 stuff, for example, should be hooks. But at least now the
2942 2963 framework is in place, and the rest can be moved here with more
2943 2964 time later. IPython had had a .hooks variable for a long time for
2944 2965 this purpose, but I'd never actually used it for anything.
2945 2966
2946 2967 2005-02-26 Fernando Perez <fperez@colorado.edu>
2947 2968
2948 2969 * IPython/ipmaker.py (make_IPython): make the default ipython
2949 2970 directory be called _ipython under win32, to follow more the
2950 2971 naming peculiarities of that platform (where buggy software like
2951 2972 Visual Sourcesafe breaks with .named directories). Reported by
2952 2973 Ville Vainio.
2953 2974
2954 2975 2005-02-23 Fernando Perez <fperez@colorado.edu>
2955 2976
2956 2977 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2957 2978 auto_aliases for win32 which were causing problems. Users can
2958 2979 define the ones they personally like.
2959 2980
2960 2981 2005-02-21 Fernando Perez <fperez@colorado.edu>
2961 2982
2962 2983 * IPython/Magic.py (magic_time): new magic to time execution of
2963 2984 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2964 2985
2965 2986 2005-02-19 Fernando Perez <fperez@colorado.edu>
2966 2987
2967 2988 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2968 2989 into keys (for prompts, for example).
2969 2990
2970 2991 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2971 2992 prompts in case users want them. This introduces a small behavior
2972 2993 change: ipython does not automatically add a space to all prompts
2973 2994 anymore. To get the old prompts with a space, users should add it
2974 2995 manually to their ipythonrc file, so for example prompt_in1 should
2975 2996 now read 'In [\#]: ' instead of 'In [\#]:'.
2976 2997 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2977 2998 file) to control left-padding of secondary prompts.
2978 2999
2979 3000 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2980 3001 the profiler can't be imported. Fix for Debian, which removed
2981 3002 profile.py because of License issues. I applied a slightly
2982 3003 modified version of the original Debian patch at
2983 3004 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2984 3005
2985 3006 2005-02-17 Fernando Perez <fperez@colorado.edu>
2986 3007
2987 3008 * IPython/genutils.py (native_line_ends): Fix bug which would
2988 3009 cause improper line-ends under win32 b/c I was not opening files
2989 3010 in binary mode. Bug report and fix thanks to Ville.
2990 3011
2991 3012 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2992 3013 trying to catch spurious foo[1] autocalls. My fix actually broke
2993 3014 ',/' autoquote/call with explicit escape (bad regexp).
2994 3015
2995 3016 2005-02-15 *** Released version 0.6.11
2996 3017
2997 3018 2005-02-14 Fernando Perez <fperez@colorado.edu>
2998 3019
2999 3020 * IPython/background_jobs.py: New background job management
3000 3021 subsystem. This is implemented via a new set of classes, and
3001 3022 IPython now provides a builtin 'jobs' object for background job
3002 3023 execution. A convenience %bg magic serves as a lightweight
3003 3024 frontend for starting the more common type of calls. This was
3004 3025 inspired by discussions with B. Granger and the BackgroundCommand
3005 3026 class described in the book Python Scripting for Computational
3006 3027 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3007 3028 (although ultimately no code from this text was used, as IPython's
3008 3029 system is a separate implementation).
3009 3030
3010 3031 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3011 3032 to control the completion of single/double underscore names
3012 3033 separately. As documented in the example ipytonrc file, the
3013 3034 readline_omit__names variable can now be set to 2, to omit even
3014 3035 single underscore names. Thanks to a patch by Brian Wong
3015 3036 <BrianWong-AT-AirgoNetworks.Com>.
3016 3037 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3017 3038 be autocalled as foo([1]) if foo were callable. A problem for
3018 3039 things which are both callable and implement __getitem__.
3019 3040 (init_readline): Fix autoindentation for win32. Thanks to a patch
3020 3041 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3021 3042
3022 3043 2005-02-12 Fernando Perez <fperez@colorado.edu>
3023 3044
3024 3045 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3025 3046 which I had written long ago to sort out user error messages which
3026 3047 may occur during startup. This seemed like a good idea initially,
3027 3048 but it has proven a disaster in retrospect. I don't want to
3028 3049 change much code for now, so my fix is to set the internal 'debug'
3029 3050 flag to true everywhere, whose only job was precisely to control
3030 3051 this subsystem. This closes issue 28 (as well as avoiding all
3031 3052 sorts of strange hangups which occur from time to time).
3032 3053
3033 3054 2005-02-07 Fernando Perez <fperez@colorado.edu>
3034 3055
3035 3056 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3036 3057 previous call produced a syntax error.
3037 3058
3038 3059 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3039 3060 classes without constructor.
3040 3061
3041 3062 2005-02-06 Fernando Perez <fperez@colorado.edu>
3042 3063
3043 3064 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3044 3065 completions with the results of each matcher, so we return results
3045 3066 to the user from all namespaces. This breaks with ipython
3046 3067 tradition, but I think it's a nicer behavior. Now you get all
3047 3068 possible completions listed, from all possible namespaces (python,
3048 3069 filesystem, magics...) After a request by John Hunter
3049 3070 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3050 3071
3051 3072 2005-02-05 Fernando Perez <fperez@colorado.edu>
3052 3073
3053 3074 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3054 3075 the call had quote characters in it (the quotes were stripped).
3055 3076
3056 3077 2005-01-31 Fernando Perez <fperez@colorado.edu>
3057 3078
3058 3079 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3059 3080 Itpl.itpl() to make the code more robust against psyco
3060 3081 optimizations.
3061 3082
3062 3083 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3063 3084 of causing an exception. Quicker, cleaner.
3064 3085
3065 3086 2005-01-28 Fernando Perez <fperez@colorado.edu>
3066 3087
3067 3088 * scripts/ipython_win_post_install.py (install): hardcode
3068 3089 sys.prefix+'python.exe' as the executable path. It turns out that
3069 3090 during the post-installation run, sys.executable resolves to the
3070 3091 name of the binary installer! I should report this as a distutils
3071 3092 bug, I think. I updated the .10 release with this tiny fix, to
3072 3093 avoid annoying the lists further.
3073 3094
3074 3095 2005-01-27 *** Released version 0.6.10
3075 3096
3076 3097 2005-01-27 Fernando Perez <fperez@colorado.edu>
3077 3098
3078 3099 * IPython/numutils.py (norm): Added 'inf' as optional name for
3079 3100 L-infinity norm, included references to mathworld.com for vector
3080 3101 norm definitions.
3081 3102 (amin/amax): added amin/amax for array min/max. Similar to what
3082 3103 pylab ships with after the recent reorganization of names.
3083 3104 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3084 3105
3085 3106 * ipython.el: committed Alex's recent fixes and improvements.
3086 3107 Tested with python-mode from CVS, and it looks excellent. Since
3087 3108 python-mode hasn't released anything in a while, I'm temporarily
3088 3109 putting a copy of today's CVS (v 4.70) of python-mode in:
3089 3110 http://ipython.scipy.org/tmp/python-mode.el
3090 3111
3091 3112 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3092 3113 sys.executable for the executable name, instead of assuming it's
3093 3114 called 'python.exe' (the post-installer would have produced broken
3094 3115 setups on systems with a differently named python binary).
3095 3116
3096 3117 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3097 3118 references to os.linesep, to make the code more
3098 3119 platform-independent. This is also part of the win32 coloring
3099 3120 fixes.
3100 3121
3101 3122 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3102 3123 lines, which actually cause coloring bugs because the length of
3103 3124 the line is very difficult to correctly compute with embedded
3104 3125 escapes. This was the source of all the coloring problems under
3105 3126 Win32. I think that _finally_, Win32 users have a properly
3106 3127 working ipython in all respects. This would never have happened
3107 3128 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3108 3129
3109 3130 2005-01-26 *** Released version 0.6.9
3110 3131
3111 3132 2005-01-25 Fernando Perez <fperez@colorado.edu>
3112 3133
3113 3134 * setup.py: finally, we have a true Windows installer, thanks to
3114 3135 the excellent work of Viktor Ransmayr
3115 3136 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3116 3137 Windows users. The setup routine is quite a bit cleaner thanks to
3117 3138 this, and the post-install script uses the proper functions to
3118 3139 allow a clean de-installation using the standard Windows Control
3119 3140 Panel.
3120 3141
3121 3142 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3122 3143 environment variable under all OSes (including win32) if
3123 3144 available. This will give consistency to win32 users who have set
3124 3145 this variable for any reason. If os.environ['HOME'] fails, the
3125 3146 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3126 3147
3127 3148 2005-01-24 Fernando Perez <fperez@colorado.edu>
3128 3149
3129 3150 * IPython/numutils.py (empty_like): add empty_like(), similar to
3130 3151 zeros_like() but taking advantage of the new empty() Numeric routine.
3131 3152
3132 3153 2005-01-23 *** Released version 0.6.8
3133 3154
3134 3155 2005-01-22 Fernando Perez <fperez@colorado.edu>
3135 3156
3136 3157 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3137 3158 automatic show() calls. After discussing things with JDH, it
3138 3159 turns out there are too many corner cases where this can go wrong.
3139 3160 It's best not to try to be 'too smart', and simply have ipython
3140 3161 reproduce as much as possible the default behavior of a normal
3141 3162 python shell.
3142 3163
3143 3164 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3144 3165 line-splitting regexp and _prefilter() to avoid calling getattr()
3145 3166 on assignments. This closes
3146 3167 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3147 3168 readline uses getattr(), so a simple <TAB> keypress is still
3148 3169 enough to trigger getattr() calls on an object.
3149 3170
3150 3171 2005-01-21 Fernando Perez <fperez@colorado.edu>
3151 3172
3152 3173 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3153 3174 docstring under pylab so it doesn't mask the original.
3154 3175
3155 3176 2005-01-21 *** Released version 0.6.7
3156 3177
3157 3178 2005-01-21 Fernando Perez <fperez@colorado.edu>
3158 3179
3159 3180 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3160 3181 signal handling for win32 users in multithreaded mode.
3161 3182
3162 3183 2005-01-17 Fernando Perez <fperez@colorado.edu>
3163 3184
3164 3185 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3165 3186 instances with no __init__. After a crash report by Norbert Nemec
3166 3187 <Norbert-AT-nemec-online.de>.
3167 3188
3168 3189 2005-01-14 Fernando Perez <fperez@colorado.edu>
3169 3190
3170 3191 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3171 3192 names for verbose exceptions, when multiple dotted names and the
3172 3193 'parent' object were present on the same line.
3173 3194
3174 3195 2005-01-11 Fernando Perez <fperez@colorado.edu>
3175 3196
3176 3197 * IPython/genutils.py (flag_calls): new utility to trap and flag
3177 3198 calls in functions. I need it to clean up matplotlib support.
3178 3199 Also removed some deprecated code in genutils.
3179 3200
3180 3201 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3181 3202 that matplotlib scripts called with %run, which don't call show()
3182 3203 themselves, still have their plotting windows open.
3183 3204
3184 3205 2005-01-05 Fernando Perez <fperez@colorado.edu>
3185 3206
3186 3207 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3187 3208 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3188 3209
3189 3210 2004-12-19 Fernando Perez <fperez@colorado.edu>
3190 3211
3191 3212 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3192 3213 parent_runcode, which was an eyesore. The same result can be
3193 3214 obtained with Python's regular superclass mechanisms.
3194 3215
3195 3216 2004-12-17 Fernando Perez <fperez@colorado.edu>
3196 3217
3197 3218 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3198 3219 reported by Prabhu.
3199 3220 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3200 3221 sys.stderr) instead of explicitly calling sys.stderr. This helps
3201 3222 maintain our I/O abstractions clean, for future GUI embeddings.
3202 3223
3203 3224 * IPython/genutils.py (info): added new utility for sys.stderr
3204 3225 unified info message handling (thin wrapper around warn()).
3205 3226
3206 3227 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3207 3228 composite (dotted) names on verbose exceptions.
3208 3229 (VerboseTB.nullrepr): harden against another kind of errors which
3209 3230 Python's inspect module can trigger, and which were crashing
3210 3231 IPython. Thanks to a report by Marco Lombardi
3211 3232 <mlombard-AT-ma010192.hq.eso.org>.
3212 3233
3213 3234 2004-12-13 *** Released version 0.6.6
3214 3235
3215 3236 2004-12-12 Fernando Perez <fperez@colorado.edu>
3216 3237
3217 3238 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3218 3239 generated by pygtk upon initialization if it was built without
3219 3240 threads (for matplotlib users). After a crash reported by
3220 3241 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3221 3242
3222 3243 * IPython/ipmaker.py (make_IPython): fix small bug in the
3223 3244 import_some parameter for multiple imports.
3224 3245
3225 3246 * IPython/iplib.py (ipmagic): simplified the interface of
3226 3247 ipmagic() to take a single string argument, just as it would be
3227 3248 typed at the IPython cmd line.
3228 3249 (ipalias): Added new ipalias() with an interface identical to
3229 3250 ipmagic(). This completes exposing a pure python interface to the
3230 3251 alias and magic system, which can be used in loops or more complex
3231 3252 code where IPython's automatic line mangling is not active.
3232 3253
3233 3254 * IPython/genutils.py (timing): changed interface of timing to
3234 3255 simply run code once, which is the most common case. timings()
3235 3256 remains unchanged, for the cases where you want multiple runs.
3236 3257
3237 3258 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3238 3259 bug where Python2.2 crashes with exec'ing code which does not end
3239 3260 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3240 3261 before.
3241 3262
3242 3263 2004-12-10 Fernando Perez <fperez@colorado.edu>
3243 3264
3244 3265 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3245 3266 -t to -T, to accomodate the new -t flag in %run (the %run and
3246 3267 %prun options are kind of intermixed, and it's not easy to change
3247 3268 this with the limitations of python's getopt).
3248 3269
3249 3270 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3250 3271 the execution of scripts. It's not as fine-tuned as timeit.py,
3251 3272 but it works from inside ipython (and under 2.2, which lacks
3252 3273 timeit.py). Optionally a number of runs > 1 can be given for
3253 3274 timing very short-running code.
3254 3275
3255 3276 * IPython/genutils.py (uniq_stable): new routine which returns a
3256 3277 list of unique elements in any iterable, but in stable order of
3257 3278 appearance. I needed this for the ultraTB fixes, and it's a handy
3258 3279 utility.
3259 3280
3260 3281 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3261 3282 dotted names in Verbose exceptions. This had been broken since
3262 3283 the very start, now x.y will properly be printed in a Verbose
3263 3284 traceback, instead of x being shown and y appearing always as an
3264 3285 'undefined global'. Getting this to work was a bit tricky,
3265 3286 because by default python tokenizers are stateless. Saved by
3266 3287 python's ability to easily add a bit of state to an arbitrary
3267 3288 function (without needing to build a full-blown callable object).
3268 3289
3269 3290 Also big cleanup of this code, which had horrendous runtime
3270 3291 lookups of zillions of attributes for colorization. Moved all
3271 3292 this code into a few templates, which make it cleaner and quicker.
3272 3293
3273 3294 Printout quality was also improved for Verbose exceptions: one
3274 3295 variable per line, and memory addresses are printed (this can be
3275 3296 quite handy in nasty debugging situations, which is what Verbose
3276 3297 is for).
3277 3298
3278 3299 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3279 3300 the command line as scripts to be loaded by embedded instances.
3280 3301 Doing so has the potential for an infinite recursion if there are
3281 3302 exceptions thrown in the process. This fixes a strange crash
3282 3303 reported by Philippe MULLER <muller-AT-irit.fr>.
3283 3304
3284 3305 2004-12-09 Fernando Perez <fperez@colorado.edu>
3285 3306
3286 3307 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3287 3308 to reflect new names in matplotlib, which now expose the
3288 3309 matlab-compatible interface via a pylab module instead of the
3289 3310 'matlab' name. The new code is backwards compatible, so users of
3290 3311 all matplotlib versions are OK. Patch by J. Hunter.
3291 3312
3292 3313 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3293 3314 of __init__ docstrings for instances (class docstrings are already
3294 3315 automatically printed). Instances with customized docstrings
3295 3316 (indep. of the class) are also recognized and all 3 separate
3296 3317 docstrings are printed (instance, class, constructor). After some
3297 3318 comments/suggestions by J. Hunter.
3298 3319
3299 3320 2004-12-05 Fernando Perez <fperez@colorado.edu>
3300 3321
3301 3322 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3302 3323 warnings when tab-completion fails and triggers an exception.
3303 3324
3304 3325 2004-12-03 Fernando Perez <fperez@colorado.edu>
3305 3326
3306 3327 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3307 3328 be triggered when using 'run -p'. An incorrect option flag was
3308 3329 being set ('d' instead of 'D').
3309 3330 (manpage): fix missing escaped \- sign.
3310 3331
3311 3332 2004-11-30 *** Released version 0.6.5
3312 3333
3313 3334 2004-11-30 Fernando Perez <fperez@colorado.edu>
3314 3335
3315 3336 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3316 3337 setting with -d option.
3317 3338
3318 3339 * setup.py (docfiles): Fix problem where the doc glob I was using
3319 3340 was COMPLETELY BROKEN. It was giving the right files by pure
3320 3341 accident, but failed once I tried to include ipython.el. Note:
3321 3342 glob() does NOT allow you to do exclusion on multiple endings!
3322 3343
3323 3344 2004-11-29 Fernando Perez <fperez@colorado.edu>
3324 3345
3325 3346 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3326 3347 the manpage as the source. Better formatting & consistency.
3327 3348
3328 3349 * IPython/Magic.py (magic_run): Added new -d option, to run
3329 3350 scripts under the control of the python pdb debugger. Note that
3330 3351 this required changing the %prun option -d to -D, to avoid a clash
3331 3352 (since %run must pass options to %prun, and getopt is too dumb to
3332 3353 handle options with string values with embedded spaces). Thanks
3333 3354 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3334 3355 (magic_who_ls): added type matching to %who and %whos, so that one
3335 3356 can filter their output to only include variables of certain
3336 3357 types. Another suggestion by Matthew.
3337 3358 (magic_whos): Added memory summaries in kb and Mb for arrays.
3338 3359 (magic_who): Improve formatting (break lines every 9 vars).
3339 3360
3340 3361 2004-11-28 Fernando Perez <fperez@colorado.edu>
3341 3362
3342 3363 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3343 3364 cache when empty lines were present.
3344 3365
3345 3366 2004-11-24 Fernando Perez <fperez@colorado.edu>
3346 3367
3347 3368 * IPython/usage.py (__doc__): document the re-activated threading
3348 3369 options for WX and GTK.
3349 3370
3350 3371 2004-11-23 Fernando Perez <fperez@colorado.edu>
3351 3372
3352 3373 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3353 3374 the -wthread and -gthread options, along with a new -tk one to try
3354 3375 and coordinate Tk threading with wx/gtk. The tk support is very
3355 3376 platform dependent, since it seems to require Tcl and Tk to be
3356 3377 built with threads (Fedora1/2 appears NOT to have it, but in
3357 3378 Prabhu's Debian boxes it works OK). But even with some Tk
3358 3379 limitations, this is a great improvement.
3359 3380
3360 3381 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3361 3382 info in user prompts. Patch by Prabhu.
3362 3383
3363 3384 2004-11-18 Fernando Perez <fperez@colorado.edu>
3364 3385
3365 3386 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3366 3387 EOFErrors and bail, to avoid infinite loops if a non-terminating
3367 3388 file is fed into ipython. Patch submitted in issue 19 by user,
3368 3389 many thanks.
3369 3390
3370 3391 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3371 3392 autoquote/parens in continuation prompts, which can cause lots of
3372 3393 problems. Closes roundup issue 20.
3373 3394
3374 3395 2004-11-17 Fernando Perez <fperez@colorado.edu>
3375 3396
3376 3397 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3377 3398 reported as debian bug #280505. I'm not sure my local changelog
3378 3399 entry has the proper debian format (Jack?).
3379 3400
3380 3401 2004-11-08 *** Released version 0.6.4
3381 3402
3382 3403 2004-11-08 Fernando Perez <fperez@colorado.edu>
3383 3404
3384 3405 * IPython/iplib.py (init_readline): Fix exit message for Windows
3385 3406 when readline is active. Thanks to a report by Eric Jones
3386 3407 <eric-AT-enthought.com>.
3387 3408
3388 3409 2004-11-07 Fernando Perez <fperez@colorado.edu>
3389 3410
3390 3411 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3391 3412 sometimes seen by win2k/cygwin users.
3392 3413
3393 3414 2004-11-06 Fernando Perez <fperez@colorado.edu>
3394 3415
3395 3416 * IPython/iplib.py (interact): Change the handling of %Exit from
3396 3417 trying to propagate a SystemExit to an internal ipython flag.
3397 3418 This is less elegant than using Python's exception mechanism, but
3398 3419 I can't get that to work reliably with threads, so under -pylab
3399 3420 %Exit was hanging IPython. Cross-thread exception handling is
3400 3421 really a bitch. Thaks to a bug report by Stephen Walton
3401 3422 <stephen.walton-AT-csun.edu>.
3402 3423
3403 3424 2004-11-04 Fernando Perez <fperez@colorado.edu>
3404 3425
3405 3426 * IPython/iplib.py (raw_input_original): store a pointer to the
3406 3427 true raw_input to harden against code which can modify it
3407 3428 (wx.py.PyShell does this and would otherwise crash ipython).
3408 3429 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3409 3430
3410 3431 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3411 3432 Ctrl-C problem, which does not mess up the input line.
3412 3433
3413 3434 2004-11-03 Fernando Perez <fperez@colorado.edu>
3414 3435
3415 3436 * IPython/Release.py: Changed licensing to BSD, in all files.
3416 3437 (name): lowercase name for tarball/RPM release.
3417 3438
3418 3439 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3419 3440 use throughout ipython.
3420 3441
3421 3442 * IPython/Magic.py (Magic._ofind): Switch to using the new
3422 3443 OInspect.getdoc() function.
3423 3444
3424 3445 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3425 3446 of the line currently being canceled via Ctrl-C. It's extremely
3426 3447 ugly, but I don't know how to do it better (the problem is one of
3427 3448 handling cross-thread exceptions).
3428 3449
3429 3450 2004-10-28 Fernando Perez <fperez@colorado.edu>
3430 3451
3431 3452 * IPython/Shell.py (signal_handler): add signal handlers to trap
3432 3453 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3433 3454 report by Francesc Alted.
3434 3455
3435 3456 2004-10-21 Fernando Perez <fperez@colorado.edu>
3436 3457
3437 3458 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3438 3459 to % for pysh syntax extensions.
3439 3460
3440 3461 2004-10-09 Fernando Perez <fperez@colorado.edu>
3441 3462
3442 3463 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3443 3464 arrays to print a more useful summary, without calling str(arr).
3444 3465 This avoids the problem of extremely lengthy computations which
3445 3466 occur if arr is large, and appear to the user as a system lockup
3446 3467 with 100% cpu activity. After a suggestion by Kristian Sandberg
3447 3468 <Kristian.Sandberg@colorado.edu>.
3448 3469 (Magic.__init__): fix bug in global magic escapes not being
3449 3470 correctly set.
3450 3471
3451 3472 2004-10-08 Fernando Perez <fperez@colorado.edu>
3452 3473
3453 3474 * IPython/Magic.py (__license__): change to absolute imports of
3454 3475 ipython's own internal packages, to start adapting to the absolute
3455 3476 import requirement of PEP-328.
3456 3477
3457 3478 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3458 3479 files, and standardize author/license marks through the Release
3459 3480 module instead of having per/file stuff (except for files with
3460 3481 particular licenses, like the MIT/PSF-licensed codes).
3461 3482
3462 3483 * IPython/Debugger.py: remove dead code for python 2.1
3463 3484
3464 3485 2004-10-04 Fernando Perez <fperez@colorado.edu>
3465 3486
3466 3487 * IPython/iplib.py (ipmagic): New function for accessing magics
3467 3488 via a normal python function call.
3468 3489
3469 3490 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3470 3491 from '@' to '%', to accomodate the new @decorator syntax of python
3471 3492 2.4.
3472 3493
3473 3494 2004-09-29 Fernando Perez <fperez@colorado.edu>
3474 3495
3475 3496 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3476 3497 matplotlib.use to prevent running scripts which try to switch
3477 3498 interactive backends from within ipython. This will just crash
3478 3499 the python interpreter, so we can't allow it (but a detailed error
3479 3500 is given to the user).
3480 3501
3481 3502 2004-09-28 Fernando Perez <fperez@colorado.edu>
3482 3503
3483 3504 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3484 3505 matplotlib-related fixes so that using @run with non-matplotlib
3485 3506 scripts doesn't pop up spurious plot windows. This requires
3486 3507 matplotlib >= 0.63, where I had to make some changes as well.
3487 3508
3488 3509 * IPython/ipmaker.py (make_IPython): update version requirement to
3489 3510 python 2.2.
3490 3511
3491 3512 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3492 3513 banner arg for embedded customization.
3493 3514
3494 3515 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3495 3516 explicit uses of __IP as the IPython's instance name. Now things
3496 3517 are properly handled via the shell.name value. The actual code
3497 3518 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3498 3519 is much better than before. I'll clean things completely when the
3499 3520 magic stuff gets a real overhaul.
3500 3521
3501 3522 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3502 3523 minor changes to debian dir.
3503 3524
3504 3525 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3505 3526 pointer to the shell itself in the interactive namespace even when
3506 3527 a user-supplied dict is provided. This is needed for embedding
3507 3528 purposes (found by tests with Michel Sanner).
3508 3529
3509 3530 2004-09-27 Fernando Perez <fperez@colorado.edu>
3510 3531
3511 3532 * IPython/UserConfig/ipythonrc: remove []{} from
3512 3533 readline_remove_delims, so that things like [modname.<TAB> do
3513 3534 proper completion. This disables [].TAB, but that's a less common
3514 3535 case than module names in list comprehensions, for example.
3515 3536 Thanks to a report by Andrea Riciputi.
3516 3537
3517 3538 2004-09-09 Fernando Perez <fperez@colorado.edu>
3518 3539
3519 3540 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3520 3541 blocking problems in win32 and osx. Fix by John.
3521 3542
3522 3543 2004-09-08 Fernando Perez <fperez@colorado.edu>
3523 3544
3524 3545 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3525 3546 for Win32 and OSX. Fix by John Hunter.
3526 3547
3527 3548 2004-08-30 *** Released version 0.6.3
3528 3549
3529 3550 2004-08-30 Fernando Perez <fperez@colorado.edu>
3530 3551
3531 3552 * setup.py (isfile): Add manpages to list of dependent files to be
3532 3553 updated.
3533 3554
3534 3555 2004-08-27 Fernando Perez <fperez@colorado.edu>
3535 3556
3536 3557 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3537 3558 for now. They don't really work with standalone WX/GTK code
3538 3559 (though matplotlib IS working fine with both of those backends).
3539 3560 This will neeed much more testing. I disabled most things with
3540 3561 comments, so turning it back on later should be pretty easy.
3541 3562
3542 3563 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3543 3564 autocalling of expressions like r'foo', by modifying the line
3544 3565 split regexp. Closes
3545 3566 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3546 3567 Riley <ipythonbugs-AT-sabi.net>.
3547 3568 (InteractiveShell.mainloop): honor --nobanner with banner
3548 3569 extensions.
3549 3570
3550 3571 * IPython/Shell.py: Significant refactoring of all classes, so
3551 3572 that we can really support ALL matplotlib backends and threading
3552 3573 models (John spotted a bug with Tk which required this). Now we
3553 3574 should support single-threaded, WX-threads and GTK-threads, both
3554 3575 for generic code and for matplotlib.
3555 3576
3556 3577 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3557 3578 -pylab, to simplify things for users. Will also remove the pylab
3558 3579 profile, since now all of matplotlib configuration is directly
3559 3580 handled here. This also reduces startup time.
3560 3581
3561 3582 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3562 3583 shell wasn't being correctly called. Also in IPShellWX.
3563 3584
3564 3585 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3565 3586 fine-tune banner.
3566 3587
3567 3588 * IPython/numutils.py (spike): Deprecate these spike functions,
3568 3589 delete (long deprecated) gnuplot_exec handler.
3569 3590
3570 3591 2004-08-26 Fernando Perez <fperez@colorado.edu>
3571 3592
3572 3593 * ipython.1: Update for threading options, plus some others which
3573 3594 were missing.
3574 3595
3575 3596 * IPython/ipmaker.py (__call__): Added -wthread option for
3576 3597 wxpython thread handling. Make sure threading options are only
3577 3598 valid at the command line.
3578 3599
3579 3600 * scripts/ipython: moved shell selection into a factory function
3580 3601 in Shell.py, to keep the starter script to a minimum.
3581 3602
3582 3603 2004-08-25 Fernando Perez <fperez@colorado.edu>
3583 3604
3584 3605 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3585 3606 John. Along with some recent changes he made to matplotlib, the
3586 3607 next versions of both systems should work very well together.
3587 3608
3588 3609 2004-08-24 Fernando Perez <fperez@colorado.edu>
3589 3610
3590 3611 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3591 3612 tried to switch the profiling to using hotshot, but I'm getting
3592 3613 strange errors from prof.runctx() there. I may be misreading the
3593 3614 docs, but it looks weird. For now the profiling code will
3594 3615 continue to use the standard profiler.
3595 3616
3596 3617 2004-08-23 Fernando Perez <fperez@colorado.edu>
3597 3618
3598 3619 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3599 3620 threaded shell, by John Hunter. It's not quite ready yet, but
3600 3621 close.
3601 3622
3602 3623 2004-08-22 Fernando Perez <fperez@colorado.edu>
3603 3624
3604 3625 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3605 3626 in Magic and ultraTB.
3606 3627
3607 3628 * ipython.1: document threading options in manpage.
3608 3629
3609 3630 * scripts/ipython: Changed name of -thread option to -gthread,
3610 3631 since this is GTK specific. I want to leave the door open for a
3611 3632 -wthread option for WX, which will most likely be necessary. This
3612 3633 change affects usage and ipmaker as well.
3613 3634
3614 3635 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3615 3636 handle the matplotlib shell issues. Code by John Hunter
3616 3637 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3617 3638 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3618 3639 broken (and disabled for end users) for now, but it puts the
3619 3640 infrastructure in place.
3620 3641
3621 3642 2004-08-21 Fernando Perez <fperez@colorado.edu>
3622 3643
3623 3644 * ipythonrc-pylab: Add matplotlib support.
3624 3645
3625 3646 * matplotlib_config.py: new files for matplotlib support, part of
3626 3647 the pylab profile.
3627 3648
3628 3649 * IPython/usage.py (__doc__): documented the threading options.
3629 3650
3630 3651 2004-08-20 Fernando Perez <fperez@colorado.edu>
3631 3652
3632 3653 * ipython: Modified the main calling routine to handle the -thread
3633 3654 and -mpthread options. This needs to be done as a top-level hack,
3634 3655 because it determines which class to instantiate for IPython
3635 3656 itself.
3636 3657
3637 3658 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3638 3659 classes to support multithreaded GTK operation without blocking,
3639 3660 and matplotlib with all backends. This is a lot of still very
3640 3661 experimental code, and threads are tricky. So it may still have a
3641 3662 few rough edges... This code owes a lot to
3642 3663 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3643 3664 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3644 3665 to John Hunter for all the matplotlib work.
3645 3666
3646 3667 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3647 3668 options for gtk thread and matplotlib support.
3648 3669
3649 3670 2004-08-16 Fernando Perez <fperez@colorado.edu>
3650 3671
3651 3672 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3652 3673 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3653 3674 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3654 3675
3655 3676 2004-08-11 Fernando Perez <fperez@colorado.edu>
3656 3677
3657 3678 * setup.py (isfile): Fix build so documentation gets updated for
3658 3679 rpms (it was only done for .tgz builds).
3659 3680
3660 3681 2004-08-10 Fernando Perez <fperez@colorado.edu>
3661 3682
3662 3683 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3663 3684
3664 3685 * iplib.py : Silence syntax error exceptions in tab-completion.
3665 3686
3666 3687 2004-08-05 Fernando Perez <fperez@colorado.edu>
3667 3688
3668 3689 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3669 3690 'color off' mark for continuation prompts. This was causing long
3670 3691 continuation lines to mis-wrap.
3671 3692
3672 3693 2004-08-01 Fernando Perez <fperez@colorado.edu>
3673 3694
3674 3695 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3675 3696 for building ipython to be a parameter. All this is necessary
3676 3697 right now to have a multithreaded version, but this insane
3677 3698 non-design will be cleaned up soon. For now, it's a hack that
3678 3699 works.
3679 3700
3680 3701 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3681 3702 args in various places. No bugs so far, but it's a dangerous
3682 3703 practice.
3683 3704
3684 3705 2004-07-31 Fernando Perez <fperez@colorado.edu>
3685 3706
3686 3707 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3687 3708 fix completion of files with dots in their names under most
3688 3709 profiles (pysh was OK because the completion order is different).
3689 3710
3690 3711 2004-07-27 Fernando Perez <fperez@colorado.edu>
3691 3712
3692 3713 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3693 3714 keywords manually, b/c the one in keyword.py was removed in python
3694 3715 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3695 3716 This is NOT a bug under python 2.3 and earlier.
3696 3717
3697 3718 2004-07-26 Fernando Perez <fperez@colorado.edu>
3698 3719
3699 3720 * IPython/ultraTB.py (VerboseTB.text): Add another
3700 3721 linecache.checkcache() call to try to prevent inspect.py from
3701 3722 crashing under python 2.3. I think this fixes
3702 3723 http://www.scipy.net/roundup/ipython/issue17.
3703 3724
3704 3725 2004-07-26 *** Released version 0.6.2
3705 3726
3706 3727 2004-07-26 Fernando Perez <fperez@colorado.edu>
3707 3728
3708 3729 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3709 3730 fail for any number.
3710 3731 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3711 3732 empty bookmarks.
3712 3733
3713 3734 2004-07-26 *** Released version 0.6.1
3714 3735
3715 3736 2004-07-26 Fernando Perez <fperez@colorado.edu>
3716 3737
3717 3738 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3718 3739
3719 3740 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3720 3741 escaping '()[]{}' in filenames.
3721 3742
3722 3743 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3723 3744 Python 2.2 users who lack a proper shlex.split.
3724 3745
3725 3746 2004-07-19 Fernando Perez <fperez@colorado.edu>
3726 3747
3727 3748 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3728 3749 for reading readline's init file. I follow the normal chain:
3729 3750 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3730 3751 report by Mike Heeter. This closes
3731 3752 http://www.scipy.net/roundup/ipython/issue16.
3732 3753
3733 3754 2004-07-18 Fernando Perez <fperez@colorado.edu>
3734 3755
3735 3756 * IPython/iplib.py (__init__): Add better handling of '\' under
3736 3757 Win32 for filenames. After a patch by Ville.
3737 3758
3738 3759 2004-07-17 Fernando Perez <fperez@colorado.edu>
3739 3760
3740 3761 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3741 3762 autocalling would be triggered for 'foo is bar' if foo is
3742 3763 callable. I also cleaned up the autocall detection code to use a
3743 3764 regexp, which is faster. Bug reported by Alexander Schmolck.
3744 3765
3745 3766 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3746 3767 '?' in them would confuse the help system. Reported by Alex
3747 3768 Schmolck.
3748 3769
3749 3770 2004-07-16 Fernando Perez <fperez@colorado.edu>
3750 3771
3751 3772 * IPython/GnuplotInteractive.py (__all__): added plot2.
3752 3773
3753 3774 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3754 3775 plotting dictionaries, lists or tuples of 1d arrays.
3755 3776
3756 3777 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3757 3778 optimizations.
3758 3779
3759 3780 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3760 3781 the information which was there from Janko's original IPP code:
3761 3782
3762 3783 03.05.99 20:53 porto.ifm.uni-kiel.de
3763 3784 --Started changelog.
3764 3785 --make clear do what it say it does
3765 3786 --added pretty output of lines from inputcache
3766 3787 --Made Logger a mixin class, simplifies handling of switches
3767 3788 --Added own completer class. .string<TAB> expands to last history
3768 3789 line which starts with string. The new expansion is also present
3769 3790 with Ctrl-r from the readline library. But this shows, who this
3770 3791 can be done for other cases.
3771 3792 --Added convention that all shell functions should accept a
3772 3793 parameter_string This opens the door for different behaviour for
3773 3794 each function. @cd is a good example of this.
3774 3795
3775 3796 04.05.99 12:12 porto.ifm.uni-kiel.de
3776 3797 --added logfile rotation
3777 3798 --added new mainloop method which freezes first the namespace
3778 3799
3779 3800 07.05.99 21:24 porto.ifm.uni-kiel.de
3780 3801 --added the docreader classes. Now there is a help system.
3781 3802 -This is only a first try. Currently it's not easy to put new
3782 3803 stuff in the indices. But this is the way to go. Info would be
3783 3804 better, but HTML is every where and not everybody has an info
3784 3805 system installed and it's not so easy to change html-docs to info.
3785 3806 --added global logfile option
3786 3807 --there is now a hook for object inspection method pinfo needs to
3787 3808 be provided for this. Can be reached by two '??'.
3788 3809
3789 3810 08.05.99 20:51 porto.ifm.uni-kiel.de
3790 3811 --added a README
3791 3812 --bug in rc file. Something has changed so functions in the rc
3792 3813 file need to reference the shell and not self. Not clear if it's a
3793 3814 bug or feature.
3794 3815 --changed rc file for new behavior
3795 3816
3796 3817 2004-07-15 Fernando Perez <fperez@colorado.edu>
3797 3818
3798 3819 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3799 3820 cache was falling out of sync in bizarre manners when multi-line
3800 3821 input was present. Minor optimizations and cleanup.
3801 3822
3802 3823 (Logger): Remove old Changelog info for cleanup. This is the
3803 3824 information which was there from Janko's original code:
3804 3825
3805 3826 Changes to Logger: - made the default log filename a parameter
3806 3827
3807 3828 - put a check for lines beginning with !@? in log(). Needed
3808 3829 (even if the handlers properly log their lines) for mid-session
3809 3830 logging activation to work properly. Without this, lines logged
3810 3831 in mid session, which get read from the cache, would end up
3811 3832 'bare' (with !@? in the open) in the log. Now they are caught
3812 3833 and prepended with a #.
3813 3834
3814 3835 * IPython/iplib.py (InteractiveShell.init_readline): added check
3815 3836 in case MagicCompleter fails to be defined, so we don't crash.
3816 3837
3817 3838 2004-07-13 Fernando Perez <fperez@colorado.edu>
3818 3839
3819 3840 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3820 3841 of EPS if the requested filename ends in '.eps'.
3821 3842
3822 3843 2004-07-04 Fernando Perez <fperez@colorado.edu>
3823 3844
3824 3845 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3825 3846 escaping of quotes when calling the shell.
3826 3847
3827 3848 2004-07-02 Fernando Perez <fperez@colorado.edu>
3828 3849
3829 3850 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3830 3851 gettext not working because we were clobbering '_'. Fixes
3831 3852 http://www.scipy.net/roundup/ipython/issue6.
3832 3853
3833 3854 2004-07-01 Fernando Perez <fperez@colorado.edu>
3834 3855
3835 3856 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3836 3857 into @cd. Patch by Ville.
3837 3858
3838 3859 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3839 3860 new function to store things after ipmaker runs. Patch by Ville.
3840 3861 Eventually this will go away once ipmaker is removed and the class
3841 3862 gets cleaned up, but for now it's ok. Key functionality here is
3842 3863 the addition of the persistent storage mechanism, a dict for
3843 3864 keeping data across sessions (for now just bookmarks, but more can
3844 3865 be implemented later).
3845 3866
3846 3867 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3847 3868 persistent across sections. Patch by Ville, I modified it
3848 3869 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3849 3870 added a '-l' option to list all bookmarks.
3850 3871
3851 3872 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3852 3873 center for cleanup. Registered with atexit.register(). I moved
3853 3874 here the old exit_cleanup(). After a patch by Ville.
3854 3875
3855 3876 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3856 3877 characters in the hacked shlex_split for python 2.2.
3857 3878
3858 3879 * IPython/iplib.py (file_matches): more fixes to filenames with
3859 3880 whitespace in them. It's not perfect, but limitations in python's
3860 3881 readline make it impossible to go further.
3861 3882
3862 3883 2004-06-29 Fernando Perez <fperez@colorado.edu>
3863 3884
3864 3885 * IPython/iplib.py (file_matches): escape whitespace correctly in
3865 3886 filename completions. Bug reported by Ville.
3866 3887
3867 3888 2004-06-28 Fernando Perez <fperez@colorado.edu>
3868 3889
3869 3890 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3870 3891 the history file will be called 'history-PROFNAME' (or just
3871 3892 'history' if no profile is loaded). I was getting annoyed at
3872 3893 getting my Numerical work history clobbered by pysh sessions.
3873 3894
3874 3895 * IPython/iplib.py (InteractiveShell.__init__): Internal
3875 3896 getoutputerror() function so that we can honor the system_verbose
3876 3897 flag for _all_ system calls. I also added escaping of #
3877 3898 characters here to avoid confusing Itpl.
3878 3899
3879 3900 * IPython/Magic.py (shlex_split): removed call to shell in
3880 3901 parse_options and replaced it with shlex.split(). The annoying
3881 3902 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3882 3903 to backport it from 2.3, with several frail hacks (the shlex
3883 3904 module is rather limited in 2.2). Thanks to a suggestion by Ville
3884 3905 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3885 3906 problem.
3886 3907
3887 3908 (Magic.magic_system_verbose): new toggle to print the actual
3888 3909 system calls made by ipython. Mainly for debugging purposes.
3889 3910
3890 3911 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3891 3912 doesn't support persistence. Reported (and fix suggested) by
3892 3913 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3893 3914
3894 3915 2004-06-26 Fernando Perez <fperez@colorado.edu>
3895 3916
3896 3917 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3897 3918 continue prompts.
3898 3919
3899 3920 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3900 3921 function (basically a big docstring) and a few more things here to
3901 3922 speedup startup. pysh.py is now very lightweight. We want because
3902 3923 it gets execfile'd, while InterpreterExec gets imported, so
3903 3924 byte-compilation saves time.
3904 3925
3905 3926 2004-06-25 Fernando Perez <fperez@colorado.edu>
3906 3927
3907 3928 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3908 3929 -NUM', which was recently broken.
3909 3930
3910 3931 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3911 3932 in multi-line input (but not !!, which doesn't make sense there).
3912 3933
3913 3934 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3914 3935 It's just too useful, and people can turn it off in the less
3915 3936 common cases where it's a problem.
3916 3937
3917 3938 2004-06-24 Fernando Perez <fperez@colorado.edu>
3918 3939
3919 3940 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3920 3941 special syntaxes (like alias calling) is now allied in multi-line
3921 3942 input. This is still _very_ experimental, but it's necessary for
3922 3943 efficient shell usage combining python looping syntax with system
3923 3944 calls. For now it's restricted to aliases, I don't think it
3924 3945 really even makes sense to have this for magics.
3925 3946
3926 3947 2004-06-23 Fernando Perez <fperez@colorado.edu>
3927 3948
3928 3949 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3929 3950 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3930 3951
3931 3952 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3932 3953 extensions under Windows (after code sent by Gary Bishop). The
3933 3954 extensions considered 'executable' are stored in IPython's rc
3934 3955 structure as win_exec_ext.
3935 3956
3936 3957 * IPython/genutils.py (shell): new function, like system() but
3937 3958 without return value. Very useful for interactive shell work.
3938 3959
3939 3960 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3940 3961 delete aliases.
3941 3962
3942 3963 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3943 3964 sure that the alias table doesn't contain python keywords.
3944 3965
3945 3966 2004-06-21 Fernando Perez <fperez@colorado.edu>
3946 3967
3947 3968 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3948 3969 non-existent items are found in $PATH. Reported by Thorsten.
3949 3970
3950 3971 2004-06-20 Fernando Perez <fperez@colorado.edu>
3951 3972
3952 3973 * IPython/iplib.py (complete): modified the completer so that the
3953 3974 order of priorities can be easily changed at runtime.
3954 3975
3955 3976 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3956 3977 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3957 3978
3958 3979 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3959 3980 expand Python variables prepended with $ in all system calls. The
3960 3981 same was done to InteractiveShell.handle_shell_escape. Now all
3961 3982 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3962 3983 expansion of python variables and expressions according to the
3963 3984 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3964 3985
3965 3986 Though PEP-215 has been rejected, a similar (but simpler) one
3966 3987 seems like it will go into Python 2.4, PEP-292 -
3967 3988 http://www.python.org/peps/pep-0292.html.
3968 3989
3969 3990 I'll keep the full syntax of PEP-215, since IPython has since the
3970 3991 start used Ka-Ping Yee's reference implementation discussed there
3971 3992 (Itpl), and I actually like the powerful semantics it offers.
3972 3993
3973 3994 In order to access normal shell variables, the $ has to be escaped
3974 3995 via an extra $. For example:
3975 3996
3976 3997 In [7]: PATH='a python variable'
3977 3998
3978 3999 In [8]: !echo $PATH
3979 4000 a python variable
3980 4001
3981 4002 In [9]: !echo $$PATH
3982 4003 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3983 4004
3984 4005 (Magic.parse_options): escape $ so the shell doesn't evaluate
3985 4006 things prematurely.
3986 4007
3987 4008 * IPython/iplib.py (InteractiveShell.call_alias): added the
3988 4009 ability for aliases to expand python variables via $.
3989 4010
3990 4011 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3991 4012 system, now there's a @rehash/@rehashx pair of magics. These work
3992 4013 like the csh rehash command, and can be invoked at any time. They
3993 4014 build a table of aliases to everything in the user's $PATH
3994 4015 (@rehash uses everything, @rehashx is slower but only adds
3995 4016 executable files). With this, the pysh.py-based shell profile can
3996 4017 now simply call rehash upon startup, and full access to all
3997 4018 programs in the user's path is obtained.
3998 4019
3999 4020 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4000 4021 functionality is now fully in place. I removed the old dynamic
4001 4022 code generation based approach, in favor of a much lighter one
4002 4023 based on a simple dict. The advantage is that this allows me to
4003 4024 now have thousands of aliases with negligible cost (unthinkable
4004 4025 with the old system).
4005 4026
4006 4027 2004-06-19 Fernando Perez <fperez@colorado.edu>
4007 4028
4008 4029 * IPython/iplib.py (__init__): extended MagicCompleter class to
4009 4030 also complete (last in priority) on user aliases.
4010 4031
4011 4032 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4012 4033 call to eval.
4013 4034 (ItplNS.__init__): Added a new class which functions like Itpl,
4014 4035 but allows configuring the namespace for the evaluation to occur
4015 4036 in.
4016 4037
4017 4038 2004-06-18 Fernando Perez <fperez@colorado.edu>
4018 4039
4019 4040 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4020 4041 better message when 'exit' or 'quit' are typed (a common newbie
4021 4042 confusion).
4022 4043
4023 4044 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4024 4045 check for Windows users.
4025 4046
4026 4047 * IPython/iplib.py (InteractiveShell.user_setup): removed
4027 4048 disabling of colors for Windows. I'll test at runtime and issue a
4028 4049 warning if Gary's readline isn't found, as to nudge users to
4029 4050 download it.
4030 4051
4031 4052 2004-06-16 Fernando Perez <fperez@colorado.edu>
4032 4053
4033 4054 * IPython/genutils.py (Stream.__init__): changed to print errors
4034 4055 to sys.stderr. I had a circular dependency here. Now it's
4035 4056 possible to run ipython as IDLE's shell (consider this pre-alpha,
4036 4057 since true stdout things end up in the starting terminal instead
4037 4058 of IDLE's out).
4038 4059
4039 4060 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4040 4061 users who haven't # updated their prompt_in2 definitions. Remove
4041 4062 eventually.
4042 4063 (multiple_replace): added credit to original ASPN recipe.
4043 4064
4044 4065 2004-06-15 Fernando Perez <fperez@colorado.edu>
4045 4066
4046 4067 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4047 4068 list of auto-defined aliases.
4048 4069
4049 4070 2004-06-13 Fernando Perez <fperez@colorado.edu>
4050 4071
4051 4072 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4052 4073 install was really requested (so setup.py can be used for other
4053 4074 things under Windows).
4054 4075
4055 4076 2004-06-10 Fernando Perez <fperez@colorado.edu>
4056 4077
4057 4078 * IPython/Logger.py (Logger.create_log): Manually remove any old
4058 4079 backup, since os.remove may fail under Windows. Fixes bug
4059 4080 reported by Thorsten.
4060 4081
4061 4082 2004-06-09 Fernando Perez <fperez@colorado.edu>
4062 4083
4063 4084 * examples/example-embed.py: fixed all references to %n (replaced
4064 4085 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4065 4086 for all examples and the manual as well.
4066 4087
4067 4088 2004-06-08 Fernando Perez <fperez@colorado.edu>
4068 4089
4069 4090 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4070 4091 alignment and color management. All 3 prompt subsystems now
4071 4092 inherit from BasePrompt.
4072 4093
4073 4094 * tools/release: updates for windows installer build and tag rpms
4074 4095 with python version (since paths are fixed).
4075 4096
4076 4097 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4077 4098 which will become eventually obsolete. Also fixed the default
4078 4099 prompt_in2 to use \D, so at least new users start with the correct
4079 4100 defaults.
4080 4101 WARNING: Users with existing ipythonrc files will need to apply
4081 4102 this fix manually!
4082 4103
4083 4104 * setup.py: make windows installer (.exe). This is finally the
4084 4105 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4085 4106 which I hadn't included because it required Python 2.3 (or recent
4086 4107 distutils).
4087 4108
4088 4109 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4089 4110 usage of new '\D' escape.
4090 4111
4091 4112 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4092 4113 lacks os.getuid())
4093 4114 (CachedOutput.set_colors): Added the ability to turn coloring
4094 4115 on/off with @colors even for manually defined prompt colors. It
4095 4116 uses a nasty global, but it works safely and via the generic color
4096 4117 handling mechanism.
4097 4118 (Prompt2.__init__): Introduced new escape '\D' for continuation
4098 4119 prompts. It represents the counter ('\#') as dots.
4099 4120 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4100 4121 need to update their ipythonrc files and replace '%n' with '\D' in
4101 4122 their prompt_in2 settings everywhere. Sorry, but there's
4102 4123 otherwise no clean way to get all prompts to properly align. The
4103 4124 ipythonrc shipped with IPython has been updated.
4104 4125
4105 4126 2004-06-07 Fernando Perez <fperez@colorado.edu>
4106 4127
4107 4128 * setup.py (isfile): Pass local_icons option to latex2html, so the
4108 4129 resulting HTML file is self-contained. Thanks to
4109 4130 dryice-AT-liu.com.cn for the tip.
4110 4131
4111 4132 * pysh.py: I created a new profile 'shell', which implements a
4112 4133 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4113 4134 system shell, nor will it become one anytime soon. It's mainly
4114 4135 meant to illustrate the use of the new flexible bash-like prompts.
4115 4136 I guess it could be used by hardy souls for true shell management,
4116 4137 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4117 4138 profile. This uses the InterpreterExec extension provided by
4118 4139 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4119 4140
4120 4141 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4121 4142 auto-align itself with the length of the previous input prompt
4122 4143 (taking into account the invisible color escapes).
4123 4144 (CachedOutput.__init__): Large restructuring of this class. Now
4124 4145 all three prompts (primary1, primary2, output) are proper objects,
4125 4146 managed by the 'parent' CachedOutput class. The code is still a
4126 4147 bit hackish (all prompts share state via a pointer to the cache),
4127 4148 but it's overall far cleaner than before.
4128 4149
4129 4150 * IPython/genutils.py (getoutputerror): modified to add verbose,
4130 4151 debug and header options. This makes the interface of all getout*
4131 4152 functions uniform.
4132 4153 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4133 4154
4134 4155 * IPython/Magic.py (Magic.default_option): added a function to
4135 4156 allow registering default options for any magic command. This
4136 4157 makes it easy to have profiles which customize the magics globally
4137 4158 for a certain use. The values set through this function are
4138 4159 picked up by the parse_options() method, which all magics should
4139 4160 use to parse their options.
4140 4161
4141 4162 * IPython/genutils.py (warn): modified the warnings framework to
4142 4163 use the Term I/O class. I'm trying to slowly unify all of
4143 4164 IPython's I/O operations to pass through Term.
4144 4165
4145 4166 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4146 4167 the secondary prompt to correctly match the length of the primary
4147 4168 one for any prompt. Now multi-line code will properly line up
4148 4169 even for path dependent prompts, such as the new ones available
4149 4170 via the prompt_specials.
4150 4171
4151 4172 2004-06-06 Fernando Perez <fperez@colorado.edu>
4152 4173
4153 4174 * IPython/Prompts.py (prompt_specials): Added the ability to have
4154 4175 bash-like special sequences in the prompts, which get
4155 4176 automatically expanded. Things like hostname, current working
4156 4177 directory and username are implemented already, but it's easy to
4157 4178 add more in the future. Thanks to a patch by W.J. van der Laan
4158 4179 <gnufnork-AT-hetdigitalegat.nl>
4159 4180 (prompt_specials): Added color support for prompt strings, so
4160 4181 users can define arbitrary color setups for their prompts.
4161 4182
4162 4183 2004-06-05 Fernando Perez <fperez@colorado.edu>
4163 4184
4164 4185 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4165 4186 code to load Gary Bishop's readline and configure it
4166 4187 automatically. Thanks to Gary for help on this.
4167 4188
4168 4189 2004-06-01 Fernando Perez <fperez@colorado.edu>
4169 4190
4170 4191 * IPython/Logger.py (Logger.create_log): fix bug for logging
4171 4192 with no filename (previous fix was incomplete).
4172 4193
4173 4194 2004-05-25 Fernando Perez <fperez@colorado.edu>
4174 4195
4175 4196 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4176 4197 parens would get passed to the shell.
4177 4198
4178 4199 2004-05-20 Fernando Perez <fperez@colorado.edu>
4179 4200
4180 4201 * IPython/Magic.py (Magic.magic_prun): changed default profile
4181 4202 sort order to 'time' (the more common profiling need).
4182 4203
4183 4204 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4184 4205 so that source code shown is guaranteed in sync with the file on
4185 4206 disk (also changed in psource). Similar fix to the one for
4186 4207 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4187 4208 <yann.ledu-AT-noos.fr>.
4188 4209
4189 4210 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4190 4211 with a single option would not be correctly parsed. Closes
4191 4212 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4192 4213 introduced in 0.6.0 (on 2004-05-06).
4193 4214
4194 4215 2004-05-13 *** Released version 0.6.0
4195 4216
4196 4217 2004-05-13 Fernando Perez <fperez@colorado.edu>
4197 4218
4198 4219 * debian/: Added debian/ directory to CVS, so that debian support
4199 4220 is publicly accessible. The debian package is maintained by Jack
4200 4221 Moffit <jack-AT-xiph.org>.
4201 4222
4202 4223 * Documentation: included the notes about an ipython-based system
4203 4224 shell (the hypothetical 'pysh') into the new_design.pdf document,
4204 4225 so that these ideas get distributed to users along with the
4205 4226 official documentation.
4206 4227
4207 4228 2004-05-10 Fernando Perez <fperez@colorado.edu>
4208 4229
4209 4230 * IPython/Logger.py (Logger.create_log): fix recently introduced
4210 4231 bug (misindented line) where logstart would fail when not given an
4211 4232 explicit filename.
4212 4233
4213 4234 2004-05-09 Fernando Perez <fperez@colorado.edu>
4214 4235
4215 4236 * IPython/Magic.py (Magic.parse_options): skip system call when
4216 4237 there are no options to look for. Faster, cleaner for the common
4217 4238 case.
4218 4239
4219 4240 * Documentation: many updates to the manual: describing Windows
4220 4241 support better, Gnuplot updates, credits, misc small stuff. Also
4221 4242 updated the new_design doc a bit.
4222 4243
4223 4244 2004-05-06 *** Released version 0.6.0.rc1
4224 4245
4225 4246 2004-05-06 Fernando Perez <fperez@colorado.edu>
4226 4247
4227 4248 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4228 4249 operations to use the vastly more efficient list/''.join() method.
4229 4250 (FormattedTB.text): Fix
4230 4251 http://www.scipy.net/roundup/ipython/issue12 - exception source
4231 4252 extract not updated after reload. Thanks to Mike Salib
4232 4253 <msalib-AT-mit.edu> for pinning the source of the problem.
4233 4254 Fortunately, the solution works inside ipython and doesn't require
4234 4255 any changes to python proper.
4235 4256
4236 4257 * IPython/Magic.py (Magic.parse_options): Improved to process the
4237 4258 argument list as a true shell would (by actually using the
4238 4259 underlying system shell). This way, all @magics automatically get
4239 4260 shell expansion for variables. Thanks to a comment by Alex
4240 4261 Schmolck.
4241 4262
4242 4263 2004-04-04 Fernando Perez <fperez@colorado.edu>
4243 4264
4244 4265 * IPython/iplib.py (InteractiveShell.interact): Added a special
4245 4266 trap for a debugger quit exception, which is basically impossible
4246 4267 to handle by normal mechanisms, given what pdb does to the stack.
4247 4268 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4248 4269
4249 4270 2004-04-03 Fernando Perez <fperez@colorado.edu>
4250 4271
4251 4272 * IPython/genutils.py (Term): Standardized the names of the Term
4252 4273 class streams to cin/cout/cerr, following C++ naming conventions
4253 4274 (I can't use in/out/err because 'in' is not a valid attribute
4254 4275 name).
4255 4276
4256 4277 * IPython/iplib.py (InteractiveShell.interact): don't increment
4257 4278 the prompt if there's no user input. By Daniel 'Dang' Griffith
4258 4279 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4259 4280 Francois Pinard.
4260 4281
4261 4282 2004-04-02 Fernando Perez <fperez@colorado.edu>
4262 4283
4263 4284 * IPython/genutils.py (Stream.__init__): Modified to survive at
4264 4285 least importing in contexts where stdin/out/err aren't true file
4265 4286 objects, such as PyCrust (they lack fileno() and mode). However,
4266 4287 the recovery facilities which rely on these things existing will
4267 4288 not work.
4268 4289
4269 4290 2004-04-01 Fernando Perez <fperez@colorado.edu>
4270 4291
4271 4292 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4272 4293 use the new getoutputerror() function, so it properly
4273 4294 distinguishes stdout/err.
4274 4295
4275 4296 * IPython/genutils.py (getoutputerror): added a function to
4276 4297 capture separately the standard output and error of a command.
4277 4298 After a comment from dang on the mailing lists. This code is
4278 4299 basically a modified version of commands.getstatusoutput(), from
4279 4300 the standard library.
4280 4301
4281 4302 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4282 4303 '!!' as a special syntax (shorthand) to access @sx.
4283 4304
4284 4305 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4285 4306 command and return its output as a list split on '\n'.
4286 4307
4287 4308 2004-03-31 Fernando Perez <fperez@colorado.edu>
4288 4309
4289 4310 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4290 4311 method to dictionaries used as FakeModule instances if they lack
4291 4312 it. At least pydoc in python2.3 breaks for runtime-defined
4292 4313 functions without this hack. At some point I need to _really_
4293 4314 understand what FakeModule is doing, because it's a gross hack.
4294 4315 But it solves Arnd's problem for now...
4295 4316
4296 4317 2004-02-27 Fernando Perez <fperez@colorado.edu>
4297 4318
4298 4319 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4299 4320 mode would behave erratically. Also increased the number of
4300 4321 possible logs in rotate mod to 999. Thanks to Rod Holland
4301 4322 <rhh@StructureLABS.com> for the report and fixes.
4302 4323
4303 4324 2004-02-26 Fernando Perez <fperez@colorado.edu>
4304 4325
4305 4326 * IPython/genutils.py (page): Check that the curses module really
4306 4327 has the initscr attribute before trying to use it. For some
4307 4328 reason, the Solaris curses module is missing this. I think this
4308 4329 should be considered a Solaris python bug, but I'm not sure.
4309 4330
4310 4331 2004-01-17 Fernando Perez <fperez@colorado.edu>
4311 4332
4312 4333 * IPython/genutils.py (Stream.__init__): Changes to try to make
4313 4334 ipython robust against stdin/out/err being closed by the user.
4314 4335 This is 'user error' (and blocks a normal python session, at least
4315 4336 the stdout case). However, Ipython should be able to survive such
4316 4337 instances of abuse as gracefully as possible. To simplify the
4317 4338 coding and maintain compatibility with Gary Bishop's Term
4318 4339 contributions, I've made use of classmethods for this. I think
4319 4340 this introduces a dependency on python 2.2.
4320 4341
4321 4342 2004-01-13 Fernando Perez <fperez@colorado.edu>
4322 4343
4323 4344 * IPython/numutils.py (exp_safe): simplified the code a bit and
4324 4345 removed the need for importing the kinds module altogether.
4325 4346
4326 4347 2004-01-06 Fernando Perez <fperez@colorado.edu>
4327 4348
4328 4349 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4329 4350 a magic function instead, after some community feedback. No
4330 4351 special syntax will exist for it, but its name is deliberately
4331 4352 very short.
4332 4353
4333 4354 2003-12-20 Fernando Perez <fperez@colorado.edu>
4334 4355
4335 4356 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4336 4357 new functionality, to automagically assign the result of a shell
4337 4358 command to a variable. I'll solicit some community feedback on
4338 4359 this before making it permanent.
4339 4360
4340 4361 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4341 4362 requested about callables for which inspect couldn't obtain a
4342 4363 proper argspec. Thanks to a crash report sent by Etienne
4343 4364 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4344 4365
4345 4366 2003-12-09 Fernando Perez <fperez@colorado.edu>
4346 4367
4347 4368 * IPython/genutils.py (page): patch for the pager to work across
4348 4369 various versions of Windows. By Gary Bishop.
4349 4370
4350 4371 2003-12-04 Fernando Perez <fperez@colorado.edu>
4351 4372
4352 4373 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4353 4374 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4354 4375 While I tested this and it looks ok, there may still be corner
4355 4376 cases I've missed.
4356 4377
4357 4378 2003-12-01 Fernando Perez <fperez@colorado.edu>
4358 4379
4359 4380 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4360 4381 where a line like 'p,q=1,2' would fail because the automagic
4361 4382 system would be triggered for @p.
4362 4383
4363 4384 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4364 4385 cleanups, code unmodified.
4365 4386
4366 4387 * IPython/genutils.py (Term): added a class for IPython to handle
4367 4388 output. In most cases it will just be a proxy for stdout/err, but
4368 4389 having this allows modifications to be made for some platforms,
4369 4390 such as handling color escapes under Windows. All of this code
4370 4391 was contributed by Gary Bishop, with minor modifications by me.
4371 4392 The actual changes affect many files.
4372 4393
4373 4394 2003-11-30 Fernando Perez <fperez@colorado.edu>
4374 4395
4375 4396 * IPython/iplib.py (file_matches): new completion code, courtesy
4376 4397 of Jeff Collins. This enables filename completion again under
4377 4398 python 2.3, which disabled it at the C level.
4378 4399
4379 4400 2003-11-11 Fernando Perez <fperez@colorado.edu>
4380 4401
4381 4402 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4382 4403 for Numeric.array(map(...)), but often convenient.
4383 4404
4384 4405 2003-11-05 Fernando Perez <fperez@colorado.edu>
4385 4406
4386 4407 * IPython/numutils.py (frange): Changed a call from int() to
4387 4408 int(round()) to prevent a problem reported with arange() in the
4388 4409 numpy list.
4389 4410
4390 4411 2003-10-06 Fernando Perez <fperez@colorado.edu>
4391 4412
4392 4413 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4393 4414 prevent crashes if sys lacks an argv attribute (it happens with
4394 4415 embedded interpreters which build a bare-bones sys module).
4395 4416 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4396 4417
4397 4418 2003-09-24 Fernando Perez <fperez@colorado.edu>
4398 4419
4399 4420 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4400 4421 to protect against poorly written user objects where __getattr__
4401 4422 raises exceptions other than AttributeError. Thanks to a bug
4402 4423 report by Oliver Sander <osander-AT-gmx.de>.
4403 4424
4404 4425 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4405 4426 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4406 4427
4407 4428 2003-09-09 Fernando Perez <fperez@colorado.edu>
4408 4429
4409 4430 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4410 4431 unpacking a list whith a callable as first element would
4411 4432 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4412 4433 Collins.
4413 4434
4414 4435 2003-08-25 *** Released version 0.5.0
4415 4436
4416 4437 2003-08-22 Fernando Perez <fperez@colorado.edu>
4417 4438
4418 4439 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4419 4440 improperly defined user exceptions. Thanks to feedback from Mark
4420 4441 Russell <mrussell-AT-verio.net>.
4421 4442
4422 4443 2003-08-20 Fernando Perez <fperez@colorado.edu>
4423 4444
4424 4445 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4425 4446 printing so that it would print multi-line string forms starting
4426 4447 with a new line. This way the formatting is better respected for
4427 4448 objects which work hard to make nice string forms.
4428 4449
4429 4450 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4430 4451 autocall would overtake data access for objects with both
4431 4452 __getitem__ and __call__.
4432 4453
4433 4454 2003-08-19 *** Released version 0.5.0-rc1
4434 4455
4435 4456 2003-08-19 Fernando Perez <fperez@colorado.edu>
4436 4457
4437 4458 * IPython/deep_reload.py (load_tail): single tiny change here
4438 4459 seems to fix the long-standing bug of dreload() failing to work
4439 4460 for dotted names. But this module is pretty tricky, so I may have
4440 4461 missed some subtlety. Needs more testing!.
4441 4462
4442 4463 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4443 4464 exceptions which have badly implemented __str__ methods.
4444 4465 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4445 4466 which I've been getting reports about from Python 2.3 users. I
4446 4467 wish I had a simple test case to reproduce the problem, so I could
4447 4468 either write a cleaner workaround or file a bug report if
4448 4469 necessary.
4449 4470
4450 4471 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4451 4472 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4452 4473 a bug report by Tjabo Kloppenburg.
4453 4474
4454 4475 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4455 4476 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4456 4477 seems rather unstable. Thanks to a bug report by Tjabo
4457 4478 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4458 4479
4459 4480 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4460 4481 this out soon because of the critical fixes in the inner loop for
4461 4482 generators.
4462 4483
4463 4484 * IPython/Magic.py (Magic.getargspec): removed. This (and
4464 4485 _get_def) have been obsoleted by OInspect for a long time, I
4465 4486 hadn't noticed that they were dead code.
4466 4487 (Magic._ofind): restored _ofind functionality for a few literals
4467 4488 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4468 4489 for things like "hello".capitalize?, since that would require a
4469 4490 potentially dangerous eval() again.
4470 4491
4471 4492 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4472 4493 logic a bit more to clean up the escapes handling and minimize the
4473 4494 use of _ofind to only necessary cases. The interactive 'feel' of
4474 4495 IPython should have improved quite a bit with the changes in
4475 4496 _prefilter and _ofind (besides being far safer than before).
4476 4497
4477 4498 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4478 4499 obscure, never reported). Edit would fail to find the object to
4479 4500 edit under some circumstances.
4480 4501 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4481 4502 which were causing double-calling of generators. Those eval calls
4482 4503 were _very_ dangerous, since code with side effects could be
4483 4504 triggered. As they say, 'eval is evil'... These were the
4484 4505 nastiest evals in IPython. Besides, _ofind is now far simpler,
4485 4506 and it should also be quite a bit faster. Its use of inspect is
4486 4507 also safer, so perhaps some of the inspect-related crashes I've
4487 4508 seen lately with Python 2.3 might be taken care of. That will
4488 4509 need more testing.
4489 4510
4490 4511 2003-08-17 Fernando Perez <fperez@colorado.edu>
4491 4512
4492 4513 * IPython/iplib.py (InteractiveShell._prefilter): significant
4493 4514 simplifications to the logic for handling user escapes. Faster
4494 4515 and simpler code.
4495 4516
4496 4517 2003-08-14 Fernando Perez <fperez@colorado.edu>
4497 4518
4498 4519 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4499 4520 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4500 4521 but it should be quite a bit faster. And the recursive version
4501 4522 generated O(log N) intermediate storage for all rank>1 arrays,
4502 4523 even if they were contiguous.
4503 4524 (l1norm): Added this function.
4504 4525 (norm): Added this function for arbitrary norms (including
4505 4526 l-infinity). l1 and l2 are still special cases for convenience
4506 4527 and speed.
4507 4528
4508 4529 2003-08-03 Fernando Perez <fperez@colorado.edu>
4509 4530
4510 4531 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4511 4532 exceptions, which now raise PendingDeprecationWarnings in Python
4512 4533 2.3. There were some in Magic and some in Gnuplot2.
4513 4534
4514 4535 2003-06-30 Fernando Perez <fperez@colorado.edu>
4515 4536
4516 4537 * IPython/genutils.py (page): modified to call curses only for
4517 4538 terminals where TERM=='xterm'. After problems under many other
4518 4539 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4519 4540
4520 4541 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4521 4542 would be triggered when readline was absent. This was just an old
4522 4543 debugging statement I'd forgotten to take out.
4523 4544
4524 4545 2003-06-20 Fernando Perez <fperez@colorado.edu>
4525 4546
4526 4547 * IPython/genutils.py (clock): modified to return only user time
4527 4548 (not counting system time), after a discussion on scipy. While
4528 4549 system time may be a useful quantity occasionally, it may much
4529 4550 more easily be skewed by occasional swapping or other similar
4530 4551 activity.
4531 4552
4532 4553 2003-06-05 Fernando Perez <fperez@colorado.edu>
4533 4554
4534 4555 * IPython/numutils.py (identity): new function, for building
4535 4556 arbitrary rank Kronecker deltas (mostly backwards compatible with
4536 4557 Numeric.identity)
4537 4558
4538 4559 2003-06-03 Fernando Perez <fperez@colorado.edu>
4539 4560
4540 4561 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4541 4562 arguments passed to magics with spaces, to allow trailing '\' to
4542 4563 work normally (mainly for Windows users).
4543 4564
4544 4565 2003-05-29 Fernando Perez <fperez@colorado.edu>
4545 4566
4546 4567 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4547 4568 instead of pydoc.help. This fixes a bizarre behavior where
4548 4569 printing '%s' % locals() would trigger the help system. Now
4549 4570 ipython behaves like normal python does.
4550 4571
4551 4572 Note that if one does 'from pydoc import help', the bizarre
4552 4573 behavior returns, but this will also happen in normal python, so
4553 4574 it's not an ipython bug anymore (it has to do with how pydoc.help
4554 4575 is implemented).
4555 4576
4556 4577 2003-05-22 Fernando Perez <fperez@colorado.edu>
4557 4578
4558 4579 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4559 4580 return [] instead of None when nothing matches, also match to end
4560 4581 of line. Patch by Gary Bishop.
4561 4582
4562 4583 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4563 4584 protection as before, for files passed on the command line. This
4564 4585 prevents the CrashHandler from kicking in if user files call into
4565 4586 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4566 4587 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4567 4588
4568 4589 2003-05-20 *** Released version 0.4.0
4569 4590
4570 4591 2003-05-20 Fernando Perez <fperez@colorado.edu>
4571 4592
4572 4593 * setup.py: added support for manpages. It's a bit hackish b/c of
4573 4594 a bug in the way the bdist_rpm distutils target handles gzipped
4574 4595 manpages, but it works. After a patch by Jack.
4575 4596
4576 4597 2003-05-19 Fernando Perez <fperez@colorado.edu>
4577 4598
4578 4599 * IPython/numutils.py: added a mockup of the kinds module, since
4579 4600 it was recently removed from Numeric. This way, numutils will
4580 4601 work for all users even if they are missing kinds.
4581 4602
4582 4603 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4583 4604 failure, which can occur with SWIG-wrapped extensions. After a
4584 4605 crash report from Prabhu.
4585 4606
4586 4607 2003-05-16 Fernando Perez <fperez@colorado.edu>
4587 4608
4588 4609 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4589 4610 protect ipython from user code which may call directly
4590 4611 sys.excepthook (this looks like an ipython crash to the user, even
4591 4612 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4592 4613 This is especially important to help users of WxWindows, but may
4593 4614 also be useful in other cases.
4594 4615
4595 4616 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4596 4617 an optional tb_offset to be specified, and to preserve exception
4597 4618 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4598 4619
4599 4620 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4600 4621
4601 4622 2003-05-15 Fernando Perez <fperez@colorado.edu>
4602 4623
4603 4624 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4604 4625 installing for a new user under Windows.
4605 4626
4606 4627 2003-05-12 Fernando Perez <fperez@colorado.edu>
4607 4628
4608 4629 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4609 4630 handler for Emacs comint-based lines. Currently it doesn't do
4610 4631 much (but importantly, it doesn't update the history cache). In
4611 4632 the future it may be expanded if Alex needs more functionality
4612 4633 there.
4613 4634
4614 4635 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4615 4636 info to crash reports.
4616 4637
4617 4638 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4618 4639 just like Python's -c. Also fixed crash with invalid -color
4619 4640 option value at startup. Thanks to Will French
4620 4641 <wfrench-AT-bestweb.net> for the bug report.
4621 4642
4622 4643 2003-05-09 Fernando Perez <fperez@colorado.edu>
4623 4644
4624 4645 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4625 4646 to EvalDict (it's a mapping, after all) and simplified its code
4626 4647 quite a bit, after a nice discussion on c.l.py where Gustavo
4627 4648 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4628 4649
4629 4650 2003-04-30 Fernando Perez <fperez@colorado.edu>
4630 4651
4631 4652 * IPython/genutils.py (timings_out): modified it to reduce its
4632 4653 overhead in the common reps==1 case.
4633 4654
4634 4655 2003-04-29 Fernando Perez <fperez@colorado.edu>
4635 4656
4636 4657 * IPython/genutils.py (timings_out): Modified to use the resource
4637 4658 module, which avoids the wraparound problems of time.clock().
4638 4659
4639 4660 2003-04-17 *** Released version 0.2.15pre4
4640 4661
4641 4662 2003-04-17 Fernando Perez <fperez@colorado.edu>
4642 4663
4643 4664 * setup.py (scriptfiles): Split windows-specific stuff over to a
4644 4665 separate file, in an attempt to have a Windows GUI installer.
4645 4666 That didn't work, but part of the groundwork is done.
4646 4667
4647 4668 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4648 4669 indent/unindent with 4 spaces. Particularly useful in combination
4649 4670 with the new auto-indent option.
4650 4671
4651 4672 2003-04-16 Fernando Perez <fperez@colorado.edu>
4652 4673
4653 4674 * IPython/Magic.py: various replacements of self.rc for
4654 4675 self.shell.rc. A lot more remains to be done to fully disentangle
4655 4676 this class from the main Shell class.
4656 4677
4657 4678 * IPython/GnuplotRuntime.py: added checks for mouse support so
4658 4679 that we don't try to enable it if the current gnuplot doesn't
4659 4680 really support it. Also added checks so that we don't try to
4660 4681 enable persist under Windows (where Gnuplot doesn't recognize the
4661 4682 option).
4662 4683
4663 4684 * IPython/iplib.py (InteractiveShell.interact): Added optional
4664 4685 auto-indenting code, after a patch by King C. Shu
4665 4686 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4666 4687 get along well with pasting indented code. If I ever figure out
4667 4688 how to make that part go well, it will become on by default.
4668 4689
4669 4690 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4670 4691 crash ipython if there was an unmatched '%' in the user's prompt
4671 4692 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4672 4693
4673 4694 * IPython/iplib.py (InteractiveShell.interact): removed the
4674 4695 ability to ask the user whether he wants to crash or not at the
4675 4696 'last line' exception handler. Calling functions at that point
4676 4697 changes the stack, and the error reports would have incorrect
4677 4698 tracebacks.
4678 4699
4679 4700 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4680 4701 pass through a peger a pretty-printed form of any object. After a
4681 4702 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4682 4703
4683 4704 2003-04-14 Fernando Perez <fperez@colorado.edu>
4684 4705
4685 4706 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4686 4707 all files in ~ would be modified at first install (instead of
4687 4708 ~/.ipython). This could be potentially disastrous, as the
4688 4709 modification (make line-endings native) could damage binary files.
4689 4710
4690 4711 2003-04-10 Fernando Perez <fperez@colorado.edu>
4691 4712
4692 4713 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4693 4714 handle only lines which are invalid python. This now means that
4694 4715 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4695 4716 for the bug report.
4696 4717
4697 4718 2003-04-01 Fernando Perez <fperez@colorado.edu>
4698 4719
4699 4720 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4700 4721 where failing to set sys.last_traceback would crash pdb.pm().
4701 4722 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4702 4723 report.
4703 4724
4704 4725 2003-03-25 Fernando Perez <fperez@colorado.edu>
4705 4726
4706 4727 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4707 4728 before printing it (it had a lot of spurious blank lines at the
4708 4729 end).
4709 4730
4710 4731 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4711 4732 output would be sent 21 times! Obviously people don't use this
4712 4733 too often, or I would have heard about it.
4713 4734
4714 4735 2003-03-24 Fernando Perez <fperez@colorado.edu>
4715 4736
4716 4737 * setup.py (scriptfiles): renamed the data_files parameter from
4717 4738 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4718 4739 for the patch.
4719 4740
4720 4741 2003-03-20 Fernando Perez <fperez@colorado.edu>
4721 4742
4722 4743 * IPython/genutils.py (error): added error() and fatal()
4723 4744 functions.
4724 4745
4725 4746 2003-03-18 *** Released version 0.2.15pre3
4726 4747
4727 4748 2003-03-18 Fernando Perez <fperez@colorado.edu>
4728 4749
4729 4750 * setupext/install_data_ext.py
4730 4751 (install_data_ext.initialize_options): Class contributed by Jack
4731 4752 Moffit for fixing the old distutils hack. He is sending this to
4732 4753 the distutils folks so in the future we may not need it as a
4733 4754 private fix.
4734 4755
4735 4756 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4736 4757 changes for Debian packaging. See his patch for full details.
4737 4758 The old distutils hack of making the ipythonrc* files carry a
4738 4759 bogus .py extension is gone, at last. Examples were moved to a
4739 4760 separate subdir under doc/, and the separate executable scripts
4740 4761 now live in their own directory. Overall a great cleanup. The
4741 4762 manual was updated to use the new files, and setup.py has been
4742 4763 fixed for this setup.
4743 4764
4744 4765 * IPython/PyColorize.py (Parser.usage): made non-executable and
4745 4766 created a pycolor wrapper around it to be included as a script.
4746 4767
4747 4768 2003-03-12 *** Released version 0.2.15pre2
4748 4769
4749 4770 2003-03-12 Fernando Perez <fperez@colorado.edu>
4750 4771
4751 4772 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4752 4773 long-standing problem with garbage characters in some terminals.
4753 4774 The issue was really that the \001 and \002 escapes must _only_ be
4754 4775 passed to input prompts (which call readline), but _never_ to
4755 4776 normal text to be printed on screen. I changed ColorANSI to have
4756 4777 two classes: TermColors and InputTermColors, each with the
4757 4778 appropriate escapes for input prompts or normal text. The code in
4758 4779 Prompts.py got slightly more complicated, but this very old and
4759 4780 annoying bug is finally fixed.
4760 4781
4761 4782 All the credit for nailing down the real origin of this problem
4762 4783 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4763 4784 *Many* thanks to him for spending quite a bit of effort on this.
4764 4785
4765 4786 2003-03-05 *** Released version 0.2.15pre1
4766 4787
4767 4788 2003-03-03 Fernando Perez <fperez@colorado.edu>
4768 4789
4769 4790 * IPython/FakeModule.py: Moved the former _FakeModule to a
4770 4791 separate file, because it's also needed by Magic (to fix a similar
4771 4792 pickle-related issue in @run).
4772 4793
4773 4794 2003-03-02 Fernando Perez <fperez@colorado.edu>
4774 4795
4775 4796 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4776 4797 the autocall option at runtime.
4777 4798 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4778 4799 across Magic.py to start separating Magic from InteractiveShell.
4779 4800 (Magic._ofind): Fixed to return proper namespace for dotted
4780 4801 names. Before, a dotted name would always return 'not currently
4781 4802 defined', because it would find the 'parent'. s.x would be found,
4782 4803 but since 'x' isn't defined by itself, it would get confused.
4783 4804 (Magic.magic_run): Fixed pickling problems reported by Ralf
4784 4805 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4785 4806 that I'd used when Mike Heeter reported similar issues at the
4786 4807 top-level, but now for @run. It boils down to injecting the
4787 4808 namespace where code is being executed with something that looks
4788 4809 enough like a module to fool pickle.dump(). Since a pickle stores
4789 4810 a named reference to the importing module, we need this for
4790 4811 pickles to save something sensible.
4791 4812
4792 4813 * IPython/ipmaker.py (make_IPython): added an autocall option.
4793 4814
4794 4815 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4795 4816 the auto-eval code. Now autocalling is an option, and the code is
4796 4817 also vastly safer. There is no more eval() involved at all.
4797 4818
4798 4819 2003-03-01 Fernando Perez <fperez@colorado.edu>
4799 4820
4800 4821 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4801 4822 dict with named keys instead of a tuple.
4802 4823
4803 4824 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4804 4825
4805 4826 * setup.py (make_shortcut): Fixed message about directories
4806 4827 created during Windows installation (the directories were ok, just
4807 4828 the printed message was misleading). Thanks to Chris Liechti
4808 4829 <cliechti-AT-gmx.net> for the heads up.
4809 4830
4810 4831 2003-02-21 Fernando Perez <fperez@colorado.edu>
4811 4832
4812 4833 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4813 4834 of ValueError exception when checking for auto-execution. This
4814 4835 one is raised by things like Numeric arrays arr.flat when the
4815 4836 array is non-contiguous.
4816 4837
4817 4838 2003-01-31 Fernando Perez <fperez@colorado.edu>
4818 4839
4819 4840 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4820 4841 not return any value at all (even though the command would get
4821 4842 executed).
4822 4843 (xsys): Flush stdout right after printing the command to ensure
4823 4844 proper ordering of commands and command output in the total
4824 4845 output.
4825 4846 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4826 4847 system/getoutput as defaults. The old ones are kept for
4827 4848 compatibility reasons, so no code which uses this library needs
4828 4849 changing.
4829 4850
4830 4851 2003-01-27 *** Released version 0.2.14
4831 4852
4832 4853 2003-01-25 Fernando Perez <fperez@colorado.edu>
4833 4854
4834 4855 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4835 4856 functions defined in previous edit sessions could not be re-edited
4836 4857 (because the temp files were immediately removed). Now temp files
4837 4858 are removed only at IPython's exit.
4838 4859 (Magic.magic_run): Improved @run to perform shell-like expansions
4839 4860 on its arguments (~users and $VARS). With this, @run becomes more
4840 4861 like a normal command-line.
4841 4862
4842 4863 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4843 4864 bugs related to embedding and cleaned up that code. A fairly
4844 4865 important one was the impossibility to access the global namespace
4845 4866 through the embedded IPython (only local variables were visible).
4846 4867
4847 4868 2003-01-14 Fernando Perez <fperez@colorado.edu>
4848 4869
4849 4870 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4850 4871 auto-calling to be a bit more conservative. Now it doesn't get
4851 4872 triggered if any of '!=()<>' are in the rest of the input line, to
4852 4873 allow comparing callables. Thanks to Alex for the heads up.
4853 4874
4854 4875 2003-01-07 Fernando Perez <fperez@colorado.edu>
4855 4876
4856 4877 * IPython/genutils.py (page): fixed estimation of the number of
4857 4878 lines in a string to be paged to simply count newlines. This
4858 4879 prevents over-guessing due to embedded escape sequences. A better
4859 4880 long-term solution would involve stripping out the control chars
4860 4881 for the count, but it's potentially so expensive I just don't
4861 4882 think it's worth doing.
4862 4883
4863 4884 2002-12-19 *** Released version 0.2.14pre50
4864 4885
4865 4886 2002-12-19 Fernando Perez <fperez@colorado.edu>
4866 4887
4867 4888 * tools/release (version): Changed release scripts to inform
4868 4889 Andrea and build a NEWS file with a list of recent changes.
4869 4890
4870 4891 * IPython/ColorANSI.py (__all__): changed terminal detection
4871 4892 code. Seems to work better for xterms without breaking
4872 4893 konsole. Will need more testing to determine if WinXP and Mac OSX
4873 4894 also work ok.
4874 4895
4875 4896 2002-12-18 *** Released version 0.2.14pre49
4876 4897
4877 4898 2002-12-18 Fernando Perez <fperez@colorado.edu>
4878 4899
4879 4900 * Docs: added new info about Mac OSX, from Andrea.
4880 4901
4881 4902 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4882 4903 allow direct plotting of python strings whose format is the same
4883 4904 of gnuplot data files.
4884 4905
4885 4906 2002-12-16 Fernando Perez <fperez@colorado.edu>
4886 4907
4887 4908 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4888 4909 value of exit question to be acknowledged.
4889 4910
4890 4911 2002-12-03 Fernando Perez <fperez@colorado.edu>
4891 4912
4892 4913 * IPython/ipmaker.py: removed generators, which had been added
4893 4914 by mistake in an earlier debugging run. This was causing trouble
4894 4915 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4895 4916 for pointing this out.
4896 4917
4897 4918 2002-11-17 Fernando Perez <fperez@colorado.edu>
4898 4919
4899 4920 * Manual: updated the Gnuplot section.
4900 4921
4901 4922 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4902 4923 a much better split of what goes in Runtime and what goes in
4903 4924 Interactive.
4904 4925
4905 4926 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4906 4927 being imported from iplib.
4907 4928
4908 4929 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4909 4930 for command-passing. Now the global Gnuplot instance is called
4910 4931 'gp' instead of 'g', which was really a far too fragile and
4911 4932 common name.
4912 4933
4913 4934 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4914 4935 bounding boxes generated by Gnuplot for square plots.
4915 4936
4916 4937 * IPython/genutils.py (popkey): new function added. I should
4917 4938 suggest this on c.l.py as a dict method, it seems useful.
4918 4939
4919 4940 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4920 4941 to transparently handle PostScript generation. MUCH better than
4921 4942 the previous plot_eps/replot_eps (which I removed now). The code
4922 4943 is also fairly clean and well documented now (including
4923 4944 docstrings).
4924 4945
4925 4946 2002-11-13 Fernando Perez <fperez@colorado.edu>
4926 4947
4927 4948 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4928 4949 (inconsistent with options).
4929 4950
4930 4951 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4931 4952 manually disabled, I don't know why. Fixed it.
4932 4953 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4933 4954 eps output.
4934 4955
4935 4956 2002-11-12 Fernando Perez <fperez@colorado.edu>
4936 4957
4937 4958 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4938 4959 don't propagate up to caller. Fixes crash reported by François
4939 4960 Pinard.
4940 4961
4941 4962 2002-11-09 Fernando Perez <fperez@colorado.edu>
4942 4963
4943 4964 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4944 4965 history file for new users.
4945 4966 (make_IPython): fixed bug where initial install would leave the
4946 4967 user running in the .ipython dir.
4947 4968 (make_IPython): fixed bug where config dir .ipython would be
4948 4969 created regardless of the given -ipythondir option. Thanks to Cory
4949 4970 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4950 4971
4951 4972 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4952 4973 type confirmations. Will need to use it in all of IPython's code
4953 4974 consistently.
4954 4975
4955 4976 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4956 4977 context to print 31 lines instead of the default 5. This will make
4957 4978 the crash reports extremely detailed in case the problem is in
4958 4979 libraries I don't have access to.
4959 4980
4960 4981 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4961 4982 line of defense' code to still crash, but giving users fair
4962 4983 warning. I don't want internal errors to go unreported: if there's
4963 4984 an internal problem, IPython should crash and generate a full
4964 4985 report.
4965 4986
4966 4987 2002-11-08 Fernando Perez <fperez@colorado.edu>
4967 4988
4968 4989 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4969 4990 otherwise uncaught exceptions which can appear if people set
4970 4991 sys.stdout to something badly broken. Thanks to a crash report
4971 4992 from henni-AT-mail.brainbot.com.
4972 4993
4973 4994 2002-11-04 Fernando Perez <fperez@colorado.edu>
4974 4995
4975 4996 * IPython/iplib.py (InteractiveShell.interact): added
4976 4997 __IPYTHON__active to the builtins. It's a flag which goes on when
4977 4998 the interaction starts and goes off again when it stops. This
4978 4999 allows embedding code to detect being inside IPython. Before this
4979 5000 was done via __IPYTHON__, but that only shows that an IPython
4980 5001 instance has been created.
4981 5002
4982 5003 * IPython/Magic.py (Magic.magic_env): I realized that in a
4983 5004 UserDict, instance.data holds the data as a normal dict. So I
4984 5005 modified @env to return os.environ.data instead of rebuilding a
4985 5006 dict by hand.
4986 5007
4987 5008 2002-11-02 Fernando Perez <fperez@colorado.edu>
4988 5009
4989 5010 * IPython/genutils.py (warn): changed so that level 1 prints no
4990 5011 header. Level 2 is now the default (with 'WARNING' header, as
4991 5012 before). I think I tracked all places where changes were needed in
4992 5013 IPython, but outside code using the old level numbering may have
4993 5014 broken.
4994 5015
4995 5016 * IPython/iplib.py (InteractiveShell.runcode): added this to
4996 5017 handle the tracebacks in SystemExit traps correctly. The previous
4997 5018 code (through interact) was printing more of the stack than
4998 5019 necessary, showing IPython internal code to the user.
4999 5020
5000 5021 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5001 5022 default. Now that the default at the confirmation prompt is yes,
5002 5023 it's not so intrusive. François' argument that ipython sessions
5003 5024 tend to be complex enough not to lose them from an accidental C-d,
5004 5025 is a valid one.
5005 5026
5006 5027 * IPython/iplib.py (InteractiveShell.interact): added a
5007 5028 showtraceback() call to the SystemExit trap, and modified the exit
5008 5029 confirmation to have yes as the default.
5009 5030
5010 5031 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5011 5032 this file. It's been gone from the code for a long time, this was
5012 5033 simply leftover junk.
5013 5034
5014 5035 2002-11-01 Fernando Perez <fperez@colorado.edu>
5015 5036
5016 5037 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5017 5038 added. If set, IPython now traps EOF and asks for
5018 5039 confirmation. After a request by François Pinard.
5019 5040
5020 5041 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5021 5042 of @abort, and with a new (better) mechanism for handling the
5022 5043 exceptions.
5023 5044
5024 5045 2002-10-27 Fernando Perez <fperez@colorado.edu>
5025 5046
5026 5047 * IPython/usage.py (__doc__): updated the --help information and
5027 5048 the ipythonrc file to indicate that -log generates
5028 5049 ./ipython.log. Also fixed the corresponding info in @logstart.
5029 5050 This and several other fixes in the manuals thanks to reports by
5030 5051 François Pinard <pinard-AT-iro.umontreal.ca>.
5031 5052
5032 5053 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5033 5054 refer to @logstart (instead of @log, which doesn't exist).
5034 5055
5035 5056 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5036 5057 AttributeError crash. Thanks to Christopher Armstrong
5037 5058 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5038 5059 introduced recently (in 0.2.14pre37) with the fix to the eval
5039 5060 problem mentioned below.
5040 5061
5041 5062 2002-10-17 Fernando Perez <fperez@colorado.edu>
5042 5063
5043 5064 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5044 5065 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5045 5066
5046 5067 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5047 5068 this function to fix a problem reported by Alex Schmolck. He saw
5048 5069 it with list comprehensions and generators, which were getting
5049 5070 called twice. The real problem was an 'eval' call in testing for
5050 5071 automagic which was evaluating the input line silently.
5051 5072
5052 5073 This is a potentially very nasty bug, if the input has side
5053 5074 effects which must not be repeated. The code is much cleaner now,
5054 5075 without any blanket 'except' left and with a regexp test for
5055 5076 actual function names.
5056 5077
5057 5078 But an eval remains, which I'm not fully comfortable with. I just
5058 5079 don't know how to find out if an expression could be a callable in
5059 5080 the user's namespace without doing an eval on the string. However
5060 5081 that string is now much more strictly checked so that no code
5061 5082 slips by, so the eval should only happen for things that can
5062 5083 really be only function/method names.
5063 5084
5064 5085 2002-10-15 Fernando Perez <fperez@colorado.edu>
5065 5086
5066 5087 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5067 5088 OSX information to main manual, removed README_Mac_OSX file from
5068 5089 distribution. Also updated credits for recent additions.
5069 5090
5070 5091 2002-10-10 Fernando Perez <fperez@colorado.edu>
5071 5092
5072 5093 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5073 5094 terminal-related issues. Many thanks to Andrea Riciputi
5074 5095 <andrea.riciputi-AT-libero.it> for writing it.
5075 5096
5076 5097 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5077 5098 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5078 5099
5079 5100 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5080 5101 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5081 5102 <syver-en-AT-online.no> who both submitted patches for this problem.
5082 5103
5083 5104 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5084 5105 global embedding to make sure that things don't overwrite user
5085 5106 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5086 5107
5087 5108 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5088 5109 compatibility. Thanks to Hayden Callow
5089 5110 <h.callow-AT-elec.canterbury.ac.nz>
5090 5111
5091 5112 2002-10-04 Fernando Perez <fperez@colorado.edu>
5092 5113
5093 5114 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5094 5115 Gnuplot.File objects.
5095 5116
5096 5117 2002-07-23 Fernando Perez <fperez@colorado.edu>
5097 5118
5098 5119 * IPython/genutils.py (timing): Added timings() and timing() for
5099 5120 quick access to the most commonly needed data, the execution
5100 5121 times. Old timing() renamed to timings_out().
5101 5122
5102 5123 2002-07-18 Fernando Perez <fperez@colorado.edu>
5103 5124
5104 5125 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5105 5126 bug with nested instances disrupting the parent's tab completion.
5106 5127
5107 5128 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5108 5129 all_completions code to begin the emacs integration.
5109 5130
5110 5131 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5111 5132 argument to allow titling individual arrays when plotting.
5112 5133
5113 5134 2002-07-15 Fernando Perez <fperez@colorado.edu>
5114 5135
5115 5136 * setup.py (make_shortcut): changed to retrieve the value of
5116 5137 'Program Files' directory from the registry (this value changes in
5117 5138 non-english versions of Windows). Thanks to Thomas Fanslau
5118 5139 <tfanslau-AT-gmx.de> for the report.
5119 5140
5120 5141 2002-07-10 Fernando Perez <fperez@colorado.edu>
5121 5142
5122 5143 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5123 5144 a bug in pdb, which crashes if a line with only whitespace is
5124 5145 entered. Bug report submitted to sourceforge.
5125 5146
5126 5147 2002-07-09 Fernando Perez <fperez@colorado.edu>
5127 5148
5128 5149 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5129 5150 reporting exceptions (it's a bug in inspect.py, I just set a
5130 5151 workaround).
5131 5152
5132 5153 2002-07-08 Fernando Perez <fperez@colorado.edu>
5133 5154
5134 5155 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5135 5156 __IPYTHON__ in __builtins__ to show up in user_ns.
5136 5157
5137 5158 2002-07-03 Fernando Perez <fperez@colorado.edu>
5138 5159
5139 5160 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5140 5161 name from @gp_set_instance to @gp_set_default.
5141 5162
5142 5163 * IPython/ipmaker.py (make_IPython): default editor value set to
5143 5164 '0' (a string), to match the rc file. Otherwise will crash when
5144 5165 .strip() is called on it.
5145 5166
5146 5167
5147 5168 2002-06-28 Fernando Perez <fperez@colorado.edu>
5148 5169
5149 5170 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5150 5171 of files in current directory when a file is executed via
5151 5172 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5152 5173
5153 5174 * setup.py (manfiles): fix for rpm builds, submitted by RA
5154 5175 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5155 5176
5156 5177 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5157 5178 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5158 5179 string!). A. Schmolck caught this one.
5159 5180
5160 5181 2002-06-27 Fernando Perez <fperez@colorado.edu>
5161 5182
5162 5183 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5163 5184 defined files at the cmd line. __name__ wasn't being set to
5164 5185 __main__.
5165 5186
5166 5187 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5167 5188 regular lists and tuples besides Numeric arrays.
5168 5189
5169 5190 * IPython/Prompts.py (CachedOutput.__call__): Added output
5170 5191 supression for input ending with ';'. Similar to Mathematica and
5171 5192 Matlab. The _* vars and Out[] list are still updated, just like
5172 5193 Mathematica behaves.
5173 5194
5174 5195 2002-06-25 Fernando Perez <fperez@colorado.edu>
5175 5196
5176 5197 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5177 5198 .ini extensions for profiels under Windows.
5178 5199
5179 5200 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5180 5201 string form. Fix contributed by Alexander Schmolck
5181 5202 <a.schmolck-AT-gmx.net>
5182 5203
5183 5204 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5184 5205 pre-configured Gnuplot instance.
5185 5206
5186 5207 2002-06-21 Fernando Perez <fperez@colorado.edu>
5187 5208
5188 5209 * IPython/numutils.py (exp_safe): new function, works around the
5189 5210 underflow problems in Numeric.
5190 5211 (log2): New fn. Safe log in base 2: returns exact integer answer
5191 5212 for exact integer powers of 2.
5192 5213
5193 5214 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5194 5215 properly.
5195 5216
5196 5217 2002-06-20 Fernando Perez <fperez@colorado.edu>
5197 5218
5198 5219 * IPython/genutils.py (timing): new function like
5199 5220 Mathematica's. Similar to time_test, but returns more info.
5200 5221
5201 5222 2002-06-18 Fernando Perez <fperez@colorado.edu>
5202 5223
5203 5224 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5204 5225 according to Mike Heeter's suggestions.
5205 5226
5206 5227 2002-06-16 Fernando Perez <fperez@colorado.edu>
5207 5228
5208 5229 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5209 5230 system. GnuplotMagic is gone as a user-directory option. New files
5210 5231 make it easier to use all the gnuplot stuff both from external
5211 5232 programs as well as from IPython. Had to rewrite part of
5212 5233 hardcopy() b/c of a strange bug: often the ps files simply don't
5213 5234 get created, and require a repeat of the command (often several
5214 5235 times).
5215 5236
5216 5237 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5217 5238 resolve output channel at call time, so that if sys.stderr has
5218 5239 been redirected by user this gets honored.
5219 5240
5220 5241 2002-06-13 Fernando Perez <fperez@colorado.edu>
5221 5242
5222 5243 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5223 5244 IPShell. Kept a copy with the old names to avoid breaking people's
5224 5245 embedded code.
5225 5246
5226 5247 * IPython/ipython: simplified it to the bare minimum after
5227 5248 Holger's suggestions. Added info about how to use it in
5228 5249 PYTHONSTARTUP.
5229 5250
5230 5251 * IPython/Shell.py (IPythonShell): changed the options passing
5231 5252 from a string with funky %s replacements to a straight list. Maybe
5232 5253 a bit more typing, but it follows sys.argv conventions, so there's
5233 5254 less special-casing to remember.
5234 5255
5235 5256 2002-06-12 Fernando Perez <fperez@colorado.edu>
5236 5257
5237 5258 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5238 5259 command. Thanks to a suggestion by Mike Heeter.
5239 5260 (Magic.magic_pfile): added behavior to look at filenames if given
5240 5261 arg is not a defined object.
5241 5262 (Magic.magic_save): New @save function to save code snippets. Also
5242 5263 a Mike Heeter idea.
5243 5264
5244 5265 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5245 5266 plot() and replot(). Much more convenient now, especially for
5246 5267 interactive use.
5247 5268
5248 5269 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5249 5270 filenames.
5250 5271
5251 5272 2002-06-02 Fernando Perez <fperez@colorado.edu>
5252 5273
5253 5274 * IPython/Struct.py (Struct.__init__): modified to admit
5254 5275 initialization via another struct.
5255 5276
5256 5277 * IPython/genutils.py (SystemExec.__init__): New stateful
5257 5278 interface to xsys and bq. Useful for writing system scripts.
5258 5279
5259 5280 2002-05-30 Fernando Perez <fperez@colorado.edu>
5260 5281
5261 5282 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5262 5283 documents. This will make the user download smaller (it's getting
5263 5284 too big).
5264 5285
5265 5286 2002-05-29 Fernando Perez <fperez@colorado.edu>
5266 5287
5267 5288 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5268 5289 fix problems with shelve and pickle. Seems to work, but I don't
5269 5290 know if corner cases break it. Thanks to Mike Heeter
5270 5291 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5271 5292
5272 5293 2002-05-24 Fernando Perez <fperez@colorado.edu>
5273 5294
5274 5295 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5275 5296 macros having broken.
5276 5297
5277 5298 2002-05-21 Fernando Perez <fperez@colorado.edu>
5278 5299
5279 5300 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5280 5301 introduced logging bug: all history before logging started was
5281 5302 being written one character per line! This came from the redesign
5282 5303 of the input history as a special list which slices to strings,
5283 5304 not to lists.
5284 5305
5285 5306 2002-05-20 Fernando Perez <fperez@colorado.edu>
5286 5307
5287 5308 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5288 5309 be an attribute of all classes in this module. The design of these
5289 5310 classes needs some serious overhauling.
5290 5311
5291 5312 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5292 5313 which was ignoring '_' in option names.
5293 5314
5294 5315 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5295 5316 'Verbose_novars' to 'Context' and made it the new default. It's a
5296 5317 bit more readable and also safer than verbose.
5297 5318
5298 5319 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5299 5320 triple-quoted strings.
5300 5321
5301 5322 * IPython/OInspect.py (__all__): new module exposing the object
5302 5323 introspection facilities. Now the corresponding magics are dummy
5303 5324 wrappers around this. Having this module will make it much easier
5304 5325 to put these functions into our modified pdb.
5305 5326 This new object inspector system uses the new colorizing module,
5306 5327 so source code and other things are nicely syntax highlighted.
5307 5328
5308 5329 2002-05-18 Fernando Perez <fperez@colorado.edu>
5309 5330
5310 5331 * IPython/ColorANSI.py: Split the coloring tools into a separate
5311 5332 module so I can use them in other code easier (they were part of
5312 5333 ultraTB).
5313 5334
5314 5335 2002-05-17 Fernando Perez <fperez@colorado.edu>
5315 5336
5316 5337 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5317 5338 fixed it to set the global 'g' also to the called instance, as
5318 5339 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5319 5340 user's 'g' variables).
5320 5341
5321 5342 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5322 5343 global variables (aliases to _ih,_oh) so that users which expect
5323 5344 In[5] or Out[7] to work aren't unpleasantly surprised.
5324 5345 (InputList.__getslice__): new class to allow executing slices of
5325 5346 input history directly. Very simple class, complements the use of
5326 5347 macros.
5327 5348
5328 5349 2002-05-16 Fernando Perez <fperez@colorado.edu>
5329 5350
5330 5351 * setup.py (docdirbase): make doc directory be just doc/IPython
5331 5352 without version numbers, it will reduce clutter for users.
5332 5353
5333 5354 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5334 5355 execfile call to prevent possible memory leak. See for details:
5335 5356 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5336 5357
5337 5358 2002-05-15 Fernando Perez <fperez@colorado.edu>
5338 5359
5339 5360 * IPython/Magic.py (Magic.magic_psource): made the object
5340 5361 introspection names be more standard: pdoc, pdef, pfile and
5341 5362 psource. They all print/page their output, and it makes
5342 5363 remembering them easier. Kept old names for compatibility as
5343 5364 aliases.
5344 5365
5345 5366 2002-05-14 Fernando Perez <fperez@colorado.edu>
5346 5367
5347 5368 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5348 5369 what the mouse problem was. The trick is to use gnuplot with temp
5349 5370 files and NOT with pipes (for data communication), because having
5350 5371 both pipes and the mouse on is bad news.
5351 5372
5352 5373 2002-05-13 Fernando Perez <fperez@colorado.edu>
5353 5374
5354 5375 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5355 5376 bug. Information would be reported about builtins even when
5356 5377 user-defined functions overrode them.
5357 5378
5358 5379 2002-05-11 Fernando Perez <fperez@colorado.edu>
5359 5380
5360 5381 * IPython/__init__.py (__all__): removed FlexCompleter from
5361 5382 __all__ so that things don't fail in platforms without readline.
5362 5383
5363 5384 2002-05-10 Fernando Perez <fperez@colorado.edu>
5364 5385
5365 5386 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5366 5387 it requires Numeric, effectively making Numeric a dependency for
5367 5388 IPython.
5368 5389
5369 5390 * Released 0.2.13
5370 5391
5371 5392 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5372 5393 profiler interface. Now all the major options from the profiler
5373 5394 module are directly supported in IPython, both for single
5374 5395 expressions (@prun) and for full programs (@run -p).
5375 5396
5376 5397 2002-05-09 Fernando Perez <fperez@colorado.edu>
5377 5398
5378 5399 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5379 5400 magic properly formatted for screen.
5380 5401
5381 5402 * setup.py (make_shortcut): Changed things to put pdf version in
5382 5403 doc/ instead of doc/manual (had to change lyxport a bit).
5383 5404
5384 5405 * IPython/Magic.py (Profile.string_stats): made profile runs go
5385 5406 through pager (they are long and a pager allows searching, saving,
5386 5407 etc.)
5387 5408
5388 5409 2002-05-08 Fernando Perez <fperez@colorado.edu>
5389 5410
5390 5411 * Released 0.2.12
5391 5412
5392 5413 2002-05-06 Fernando Perez <fperez@colorado.edu>
5393 5414
5394 5415 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5395 5416 introduced); 'hist n1 n2' was broken.
5396 5417 (Magic.magic_pdb): added optional on/off arguments to @pdb
5397 5418 (Magic.magic_run): added option -i to @run, which executes code in
5398 5419 the IPython namespace instead of a clean one. Also added @irun as
5399 5420 an alias to @run -i.
5400 5421
5401 5422 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5402 5423 fixed (it didn't really do anything, the namespaces were wrong).
5403 5424
5404 5425 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5405 5426
5406 5427 * IPython/__init__.py (__all__): Fixed package namespace, now
5407 5428 'import IPython' does give access to IPython.<all> as
5408 5429 expected. Also renamed __release__ to Release.
5409 5430
5410 5431 * IPython/Debugger.py (__license__): created new Pdb class which
5411 5432 functions like a drop-in for the normal pdb.Pdb but does NOT
5412 5433 import readline by default. This way it doesn't muck up IPython's
5413 5434 readline handling, and now tab-completion finally works in the
5414 5435 debugger -- sort of. It completes things globally visible, but the
5415 5436 completer doesn't track the stack as pdb walks it. That's a bit
5416 5437 tricky, and I'll have to implement it later.
5417 5438
5418 5439 2002-05-05 Fernando Perez <fperez@colorado.edu>
5419 5440
5420 5441 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5421 5442 magic docstrings when printed via ? (explicit \'s were being
5422 5443 printed).
5423 5444
5424 5445 * IPython/ipmaker.py (make_IPython): fixed namespace
5425 5446 identification bug. Now variables loaded via logs or command-line
5426 5447 files are recognized in the interactive namespace by @who.
5427 5448
5428 5449 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5429 5450 log replay system stemming from the string form of Structs.
5430 5451
5431 5452 * IPython/Magic.py (Macro.__init__): improved macros to properly
5432 5453 handle magic commands in them.
5433 5454 (Magic.magic_logstart): usernames are now expanded so 'logstart
5434 5455 ~/mylog' now works.
5435 5456
5436 5457 * IPython/iplib.py (complete): fixed bug where paths starting with
5437 5458 '/' would be completed as magic names.
5438 5459
5439 5460 2002-05-04 Fernando Perez <fperez@colorado.edu>
5440 5461
5441 5462 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5442 5463 allow running full programs under the profiler's control.
5443 5464
5444 5465 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5445 5466 mode to report exceptions verbosely but without formatting
5446 5467 variables. This addresses the issue of ipython 'freezing' (it's
5447 5468 not frozen, but caught in an expensive formatting loop) when huge
5448 5469 variables are in the context of an exception.
5449 5470 (VerboseTB.text): Added '--->' markers at line where exception was
5450 5471 triggered. Much clearer to read, especially in NoColor modes.
5451 5472
5452 5473 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5453 5474 implemented in reverse when changing to the new parse_options().
5454 5475
5455 5476 2002-05-03 Fernando Perez <fperez@colorado.edu>
5456 5477
5457 5478 * IPython/Magic.py (Magic.parse_options): new function so that
5458 5479 magics can parse options easier.
5459 5480 (Magic.magic_prun): new function similar to profile.run(),
5460 5481 suggested by Chris Hart.
5461 5482 (Magic.magic_cd): fixed behavior so that it only changes if
5462 5483 directory actually is in history.
5463 5484
5464 5485 * IPython/usage.py (__doc__): added information about potential
5465 5486 slowness of Verbose exception mode when there are huge data
5466 5487 structures to be formatted (thanks to Archie Paulson).
5467 5488
5468 5489 * IPython/ipmaker.py (make_IPython): Changed default logging
5469 5490 (when simply called with -log) to use curr_dir/ipython.log in
5470 5491 rotate mode. Fixed crash which was occuring with -log before
5471 5492 (thanks to Jim Boyle).
5472 5493
5473 5494 2002-05-01 Fernando Perez <fperez@colorado.edu>
5474 5495
5475 5496 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5476 5497 was nasty -- though somewhat of a corner case).
5477 5498
5478 5499 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5479 5500 text (was a bug).
5480 5501
5481 5502 2002-04-30 Fernando Perez <fperez@colorado.edu>
5482 5503
5483 5504 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5484 5505 a print after ^D or ^C from the user so that the In[] prompt
5485 5506 doesn't over-run the gnuplot one.
5486 5507
5487 5508 2002-04-29 Fernando Perez <fperez@colorado.edu>
5488 5509
5489 5510 * Released 0.2.10
5490 5511
5491 5512 * IPython/__release__.py (version): get date dynamically.
5492 5513
5493 5514 * Misc. documentation updates thanks to Arnd's comments. Also ran
5494 5515 a full spellcheck on the manual (hadn't been done in a while).
5495 5516
5496 5517 2002-04-27 Fernando Perez <fperez@colorado.edu>
5497 5518
5498 5519 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5499 5520 starting a log in mid-session would reset the input history list.
5500 5521
5501 5522 2002-04-26 Fernando Perez <fperez@colorado.edu>
5502 5523
5503 5524 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5504 5525 all files were being included in an update. Now anything in
5505 5526 UserConfig that matches [A-Za-z]*.py will go (this excludes
5506 5527 __init__.py)
5507 5528
5508 5529 2002-04-25 Fernando Perez <fperez@colorado.edu>
5509 5530
5510 5531 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5511 5532 to __builtins__ so that any form of embedded or imported code can
5512 5533 test for being inside IPython.
5513 5534
5514 5535 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5515 5536 changed to GnuplotMagic because it's now an importable module,
5516 5537 this makes the name follow that of the standard Gnuplot module.
5517 5538 GnuplotMagic can now be loaded at any time in mid-session.
5518 5539
5519 5540 2002-04-24 Fernando Perez <fperez@colorado.edu>
5520 5541
5521 5542 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5522 5543 the globals (IPython has its own namespace) and the
5523 5544 PhysicalQuantity stuff is much better anyway.
5524 5545
5525 5546 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5526 5547 embedding example to standard user directory for
5527 5548 distribution. Also put it in the manual.
5528 5549
5529 5550 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5530 5551 instance as first argument (so it doesn't rely on some obscure
5531 5552 hidden global).
5532 5553
5533 5554 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5534 5555 delimiters. While it prevents ().TAB from working, it allows
5535 5556 completions in open (... expressions. This is by far a more common
5536 5557 case.
5537 5558
5538 5559 2002-04-23 Fernando Perez <fperez@colorado.edu>
5539 5560
5540 5561 * IPython/Extensions/InterpreterPasteInput.py: new
5541 5562 syntax-processing module for pasting lines with >>> or ... at the
5542 5563 start.
5543 5564
5544 5565 * IPython/Extensions/PhysicalQ_Interactive.py
5545 5566 (PhysicalQuantityInteractive.__int__): fixed to work with either
5546 5567 Numeric or math.
5547 5568
5548 5569 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5549 5570 provided profiles. Now we have:
5550 5571 -math -> math module as * and cmath with its own namespace.
5551 5572 -numeric -> Numeric as *, plus gnuplot & grace
5552 5573 -physics -> same as before
5553 5574
5554 5575 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5555 5576 user-defined magics wouldn't be found by @magic if they were
5556 5577 defined as class methods. Also cleaned up the namespace search
5557 5578 logic and the string building (to use %s instead of many repeated
5558 5579 string adds).
5559 5580
5560 5581 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5561 5582 of user-defined magics to operate with class methods (cleaner, in
5562 5583 line with the gnuplot code).
5563 5584
5564 5585 2002-04-22 Fernando Perez <fperez@colorado.edu>
5565 5586
5566 5587 * setup.py: updated dependency list so that manual is updated when
5567 5588 all included files change.
5568 5589
5569 5590 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5570 5591 the delimiter removal option (the fix is ugly right now).
5571 5592
5572 5593 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5573 5594 all of the math profile (quicker loading, no conflict between
5574 5595 g-9.8 and g-gnuplot).
5575 5596
5576 5597 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5577 5598 name of post-mortem files to IPython_crash_report.txt.
5578 5599
5579 5600 * Cleanup/update of the docs. Added all the new readline info and
5580 5601 formatted all lists as 'real lists'.
5581 5602
5582 5603 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5583 5604 tab-completion options, since the full readline parse_and_bind is
5584 5605 now accessible.
5585 5606
5586 5607 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5587 5608 handling of readline options. Now users can specify any string to
5588 5609 be passed to parse_and_bind(), as well as the delimiters to be
5589 5610 removed.
5590 5611 (InteractiveShell.__init__): Added __name__ to the global
5591 5612 namespace so that things like Itpl which rely on its existence
5592 5613 don't crash.
5593 5614 (InteractiveShell._prefilter): Defined the default with a _ so
5594 5615 that prefilter() is easier to override, while the default one
5595 5616 remains available.
5596 5617
5597 5618 2002-04-18 Fernando Perez <fperez@colorado.edu>
5598 5619
5599 5620 * Added information about pdb in the docs.
5600 5621
5601 5622 2002-04-17 Fernando Perez <fperez@colorado.edu>
5602 5623
5603 5624 * IPython/ipmaker.py (make_IPython): added rc_override option to
5604 5625 allow passing config options at creation time which may override
5605 5626 anything set in the config files or command line. This is
5606 5627 particularly useful for configuring embedded instances.
5607 5628
5608 5629 2002-04-15 Fernando Perez <fperez@colorado.edu>
5609 5630
5610 5631 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5611 5632 crash embedded instances because of the input cache falling out of
5612 5633 sync with the output counter.
5613 5634
5614 5635 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5615 5636 mode which calls pdb after an uncaught exception in IPython itself.
5616 5637
5617 5638 2002-04-14 Fernando Perez <fperez@colorado.edu>
5618 5639
5619 5640 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5620 5641 readline, fix it back after each call.
5621 5642
5622 5643 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5623 5644 method to force all access via __call__(), which guarantees that
5624 5645 traceback references are properly deleted.
5625 5646
5626 5647 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5627 5648 improve printing when pprint is in use.
5628 5649
5629 5650 2002-04-13 Fernando Perez <fperez@colorado.edu>
5630 5651
5631 5652 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5632 5653 exceptions aren't caught anymore. If the user triggers one, he
5633 5654 should know why he's doing it and it should go all the way up,
5634 5655 just like any other exception. So now @abort will fully kill the
5635 5656 embedded interpreter and the embedding code (unless that happens
5636 5657 to catch SystemExit).
5637 5658
5638 5659 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5639 5660 and a debugger() method to invoke the interactive pdb debugger
5640 5661 after printing exception information. Also added the corresponding
5641 5662 -pdb option and @pdb magic to control this feature, and updated
5642 5663 the docs. After a suggestion from Christopher Hart
5643 5664 (hart-AT-caltech.edu).
5644 5665
5645 5666 2002-04-12 Fernando Perez <fperez@colorado.edu>
5646 5667
5647 5668 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5648 5669 the exception handlers defined by the user (not the CrashHandler)
5649 5670 so that user exceptions don't trigger an ipython bug report.
5650 5671
5651 5672 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5652 5673 configurable (it should have always been so).
5653 5674
5654 5675 2002-03-26 Fernando Perez <fperez@colorado.edu>
5655 5676
5656 5677 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5657 5678 and there to fix embedding namespace issues. This should all be
5658 5679 done in a more elegant way.
5659 5680
5660 5681 2002-03-25 Fernando Perez <fperez@colorado.edu>
5661 5682
5662 5683 * IPython/genutils.py (get_home_dir): Try to make it work under
5663 5684 win9x also.
5664 5685
5665 5686 2002-03-20 Fernando Perez <fperez@colorado.edu>
5666 5687
5667 5688 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5668 5689 sys.displayhook untouched upon __init__.
5669 5690
5670 5691 2002-03-19 Fernando Perez <fperez@colorado.edu>
5671 5692
5672 5693 * Released 0.2.9 (for embedding bug, basically).
5673 5694
5674 5695 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5675 5696 exceptions so that enclosing shell's state can be restored.
5676 5697
5677 5698 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5678 5699 naming conventions in the .ipython/ dir.
5679 5700
5680 5701 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5681 5702 from delimiters list so filenames with - in them get expanded.
5682 5703
5683 5704 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5684 5705 sys.displayhook not being properly restored after an embedded call.
5685 5706
5686 5707 2002-03-18 Fernando Perez <fperez@colorado.edu>
5687 5708
5688 5709 * Released 0.2.8
5689 5710
5690 5711 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5691 5712 some files weren't being included in a -upgrade.
5692 5713 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5693 5714 on' so that the first tab completes.
5694 5715 (InteractiveShell.handle_magic): fixed bug with spaces around
5695 5716 quotes breaking many magic commands.
5696 5717
5697 5718 * setup.py: added note about ignoring the syntax error messages at
5698 5719 installation.
5699 5720
5700 5721 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5701 5722 streamlining the gnuplot interface, now there's only one magic @gp.
5702 5723
5703 5724 2002-03-17 Fernando Perez <fperez@colorado.edu>
5704 5725
5705 5726 * IPython/UserConfig/magic_gnuplot.py: new name for the
5706 5727 example-magic_pm.py file. Much enhanced system, now with a shell
5707 5728 for communicating directly with gnuplot, one command at a time.
5708 5729
5709 5730 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5710 5731 setting __name__=='__main__'.
5711 5732
5712 5733 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5713 5734 mini-shell for accessing gnuplot from inside ipython. Should
5714 5735 extend it later for grace access too. Inspired by Arnd's
5715 5736 suggestion.
5716 5737
5717 5738 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5718 5739 calling magic functions with () in their arguments. Thanks to Arnd
5719 5740 Baecker for pointing this to me.
5720 5741
5721 5742 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5722 5743 infinitely for integer or complex arrays (only worked with floats).
5723 5744
5724 5745 2002-03-16 Fernando Perez <fperez@colorado.edu>
5725 5746
5726 5747 * setup.py: Merged setup and setup_windows into a single script
5727 5748 which properly handles things for windows users.
5728 5749
5729 5750 2002-03-15 Fernando Perez <fperez@colorado.edu>
5730 5751
5731 5752 * Big change to the manual: now the magics are all automatically
5732 5753 documented. This information is generated from their docstrings
5733 5754 and put in a latex file included by the manual lyx file. This way
5734 5755 we get always up to date information for the magics. The manual
5735 5756 now also has proper version information, also auto-synced.
5736 5757
5737 5758 For this to work, an undocumented --magic_docstrings option was added.
5738 5759
5739 5760 2002-03-13 Fernando Perez <fperez@colorado.edu>
5740 5761
5741 5762 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5742 5763 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5743 5764
5744 5765 2002-03-12 Fernando Perez <fperez@colorado.edu>
5745 5766
5746 5767 * IPython/ultraTB.py (TermColors): changed color escapes again to
5747 5768 fix the (old, reintroduced) line-wrapping bug. Basically, if
5748 5769 \001..\002 aren't given in the color escapes, lines get wrapped
5749 5770 weirdly. But giving those screws up old xterms and emacs terms. So
5750 5771 I added some logic for emacs terms to be ok, but I can't identify old
5751 5772 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5752 5773
5753 5774 2002-03-10 Fernando Perez <fperez@colorado.edu>
5754 5775
5755 5776 * IPython/usage.py (__doc__): Various documentation cleanups and
5756 5777 updates, both in usage docstrings and in the manual.
5757 5778
5758 5779 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5759 5780 handling of caching. Set minimum acceptabe value for having a
5760 5781 cache at 20 values.
5761 5782
5762 5783 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5763 5784 install_first_time function to a method, renamed it and added an
5764 5785 'upgrade' mode. Now people can update their config directory with
5765 5786 a simple command line switch (-upgrade, also new).
5766 5787
5767 5788 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5768 5789 @file (convenient for automagic users under Python >= 2.2).
5769 5790 Removed @files (it seemed more like a plural than an abbrev. of
5770 5791 'file show').
5771 5792
5772 5793 * IPython/iplib.py (install_first_time): Fixed crash if there were
5773 5794 backup files ('~') in .ipython/ install directory.
5774 5795
5775 5796 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5776 5797 system. Things look fine, but these changes are fairly
5777 5798 intrusive. Test them for a few days.
5778 5799
5779 5800 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5780 5801 the prompts system. Now all in/out prompt strings are user
5781 5802 controllable. This is particularly useful for embedding, as one
5782 5803 can tag embedded instances with particular prompts.
5783 5804
5784 5805 Also removed global use of sys.ps1/2, which now allows nested
5785 5806 embeddings without any problems. Added command-line options for
5786 5807 the prompt strings.
5787 5808
5788 5809 2002-03-08 Fernando Perez <fperez@colorado.edu>
5789 5810
5790 5811 * IPython/UserConfig/example-embed-short.py (ipshell): added
5791 5812 example file with the bare minimum code for embedding.
5792 5813
5793 5814 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5794 5815 functionality for the embeddable shell to be activated/deactivated
5795 5816 either globally or at each call.
5796 5817
5797 5818 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5798 5819 rewriting the prompt with '--->' for auto-inputs with proper
5799 5820 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5800 5821 this is handled by the prompts class itself, as it should.
5801 5822
5802 5823 2002-03-05 Fernando Perez <fperez@colorado.edu>
5803 5824
5804 5825 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5805 5826 @logstart to avoid name clashes with the math log function.
5806 5827
5807 5828 * Big updates to X/Emacs section of the manual.
5808 5829
5809 5830 * Removed ipython_emacs. Milan explained to me how to pass
5810 5831 arguments to ipython through Emacs. Some day I'm going to end up
5811 5832 learning some lisp...
5812 5833
5813 5834 2002-03-04 Fernando Perez <fperez@colorado.edu>
5814 5835
5815 5836 * IPython/ipython_emacs: Created script to be used as the
5816 5837 py-python-command Emacs variable so we can pass IPython
5817 5838 parameters. I can't figure out how to tell Emacs directly to pass
5818 5839 parameters to IPython, so a dummy shell script will do it.
5819 5840
5820 5841 Other enhancements made for things to work better under Emacs'
5821 5842 various types of terminals. Many thanks to Milan Zamazal
5822 5843 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5823 5844
5824 5845 2002-03-01 Fernando Perez <fperez@colorado.edu>
5825 5846
5826 5847 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5827 5848 that loading of readline is now optional. This gives better
5828 5849 control to emacs users.
5829 5850
5830 5851 * IPython/ultraTB.py (__date__): Modified color escape sequences
5831 5852 and now things work fine under xterm and in Emacs' term buffers
5832 5853 (though not shell ones). Well, in emacs you get colors, but all
5833 5854 seem to be 'light' colors (no difference between dark and light
5834 5855 ones). But the garbage chars are gone, and also in xterms. It
5835 5856 seems that now I'm using 'cleaner' ansi sequences.
5836 5857
5837 5858 2002-02-21 Fernando Perez <fperez@colorado.edu>
5838 5859
5839 5860 * Released 0.2.7 (mainly to publish the scoping fix).
5840 5861
5841 5862 * IPython/Logger.py (Logger.logstate): added. A corresponding
5842 5863 @logstate magic was created.
5843 5864
5844 5865 * IPython/Magic.py: fixed nested scoping problem under Python
5845 5866 2.1.x (automagic wasn't working).
5846 5867
5847 5868 2002-02-20 Fernando Perez <fperez@colorado.edu>
5848 5869
5849 5870 * Released 0.2.6.
5850 5871
5851 5872 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5852 5873 option so that logs can come out without any headers at all.
5853 5874
5854 5875 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5855 5876 SciPy.
5856 5877
5857 5878 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5858 5879 that embedded IPython calls don't require vars() to be explicitly
5859 5880 passed. Now they are extracted from the caller's frame (code
5860 5881 snatched from Eric Jones' weave). Added better documentation to
5861 5882 the section on embedding and the example file.
5862 5883
5863 5884 * IPython/genutils.py (page): Changed so that under emacs, it just
5864 5885 prints the string. You can then page up and down in the emacs
5865 5886 buffer itself. This is how the builtin help() works.
5866 5887
5867 5888 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5868 5889 macro scoping: macros need to be executed in the user's namespace
5869 5890 to work as if they had been typed by the user.
5870 5891
5871 5892 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5872 5893 execute automatically (no need to type 'exec...'). They then
5873 5894 behave like 'true macros'. The printing system was also modified
5874 5895 for this to work.
5875 5896
5876 5897 2002-02-19 Fernando Perez <fperez@colorado.edu>
5877 5898
5878 5899 * IPython/genutils.py (page_file): new function for paging files
5879 5900 in an OS-independent way. Also necessary for file viewing to work
5880 5901 well inside Emacs buffers.
5881 5902 (page): Added checks for being in an emacs buffer.
5882 5903 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5883 5904 same bug in iplib.
5884 5905
5885 5906 2002-02-18 Fernando Perez <fperez@colorado.edu>
5886 5907
5887 5908 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5888 5909 of readline so that IPython can work inside an Emacs buffer.
5889 5910
5890 5911 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5891 5912 method signatures (they weren't really bugs, but it looks cleaner
5892 5913 and keeps PyChecker happy).
5893 5914
5894 5915 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5895 5916 for implementing various user-defined hooks. Currently only
5896 5917 display is done.
5897 5918
5898 5919 * IPython/Prompts.py (CachedOutput._display): changed display
5899 5920 functions so that they can be dynamically changed by users easily.
5900 5921
5901 5922 * IPython/Extensions/numeric_formats.py (num_display): added an
5902 5923 extension for printing NumPy arrays in flexible manners. It
5903 5924 doesn't do anything yet, but all the structure is in
5904 5925 place. Ultimately the plan is to implement output format control
5905 5926 like in Octave.
5906 5927
5907 5928 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5908 5929 methods are found at run-time by all the automatic machinery.
5909 5930
5910 5931 2002-02-17 Fernando Perez <fperez@colorado.edu>
5911 5932
5912 5933 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5913 5934 whole file a little.
5914 5935
5915 5936 * ToDo: closed this document. Now there's a new_design.lyx
5916 5937 document for all new ideas. Added making a pdf of it for the
5917 5938 end-user distro.
5918 5939
5919 5940 * IPython/Logger.py (Logger.switch_log): Created this to replace
5920 5941 logon() and logoff(). It also fixes a nasty crash reported by
5921 5942 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5922 5943
5923 5944 * IPython/iplib.py (complete): got auto-completion to work with
5924 5945 automagic (I had wanted this for a long time).
5925 5946
5926 5947 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5927 5948 to @file, since file() is now a builtin and clashes with automagic
5928 5949 for @file.
5929 5950
5930 5951 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5931 5952 of this was previously in iplib, which had grown to more than 2000
5932 5953 lines, way too long. No new functionality, but it makes managing
5933 5954 the code a bit easier.
5934 5955
5935 5956 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5936 5957 information to crash reports.
5937 5958
5938 5959 2002-02-12 Fernando Perez <fperez@colorado.edu>
5939 5960
5940 5961 * Released 0.2.5.
5941 5962
5942 5963 2002-02-11 Fernando Perez <fperez@colorado.edu>
5943 5964
5944 5965 * Wrote a relatively complete Windows installer. It puts
5945 5966 everything in place, creates Start Menu entries and fixes the
5946 5967 color issues. Nothing fancy, but it works.
5947 5968
5948 5969 2002-02-10 Fernando Perez <fperez@colorado.edu>
5949 5970
5950 5971 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5951 5972 os.path.expanduser() call so that we can type @run ~/myfile.py and
5952 5973 have thigs work as expected.
5953 5974
5954 5975 * IPython/genutils.py (page): fixed exception handling so things
5955 5976 work both in Unix and Windows correctly. Quitting a pager triggers
5956 5977 an IOError/broken pipe in Unix, and in windows not finding a pager
5957 5978 is also an IOError, so I had to actually look at the return value
5958 5979 of the exception, not just the exception itself. Should be ok now.
5959 5980
5960 5981 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5961 5982 modified to allow case-insensitive color scheme changes.
5962 5983
5963 5984 2002-02-09 Fernando Perez <fperez@colorado.edu>
5964 5985
5965 5986 * IPython/genutils.py (native_line_ends): new function to leave
5966 5987 user config files with os-native line-endings.
5967 5988
5968 5989 * README and manual updates.
5969 5990
5970 5991 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5971 5992 instead of StringType to catch Unicode strings.
5972 5993
5973 5994 * IPython/genutils.py (filefind): fixed bug for paths with
5974 5995 embedded spaces (very common in Windows).
5975 5996
5976 5997 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5977 5998 files under Windows, so that they get automatically associated
5978 5999 with a text editor. Windows makes it a pain to handle
5979 6000 extension-less files.
5980 6001
5981 6002 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5982 6003 warning about readline only occur for Posix. In Windows there's no
5983 6004 way to get readline, so why bother with the warning.
5984 6005
5985 6006 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5986 6007 for __str__ instead of dir(self), since dir() changed in 2.2.
5987 6008
5988 6009 * Ported to Windows! Tested on XP, I suspect it should work fine
5989 6010 on NT/2000, but I don't think it will work on 98 et al. That
5990 6011 series of Windows is such a piece of junk anyway that I won't try
5991 6012 porting it there. The XP port was straightforward, showed a few
5992 6013 bugs here and there (fixed all), in particular some string
5993 6014 handling stuff which required considering Unicode strings (which
5994 6015 Windows uses). This is good, but hasn't been too tested :) No
5995 6016 fancy installer yet, I'll put a note in the manual so people at
5996 6017 least make manually a shortcut.
5997 6018
5998 6019 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5999 6020 into a single one, "colors". This now controls both prompt and
6000 6021 exception color schemes, and can be changed both at startup
6001 6022 (either via command-line switches or via ipythonrc files) and at
6002 6023 runtime, with @colors.
6003 6024 (Magic.magic_run): renamed @prun to @run and removed the old
6004 6025 @run. The two were too similar to warrant keeping both.
6005 6026
6006 6027 2002-02-03 Fernando Perez <fperez@colorado.edu>
6007 6028
6008 6029 * IPython/iplib.py (install_first_time): Added comment on how to
6009 6030 configure the color options for first-time users. Put a <return>
6010 6031 request at the end so that small-terminal users get a chance to
6011 6032 read the startup info.
6012 6033
6013 6034 2002-01-23 Fernando Perez <fperez@colorado.edu>
6014 6035
6015 6036 * IPython/iplib.py (CachedOutput.update): Changed output memory
6016 6037 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6017 6038 input history we still use _i. Did this b/c these variable are
6018 6039 very commonly used in interactive work, so the less we need to
6019 6040 type the better off we are.
6020 6041 (Magic.magic_prun): updated @prun to better handle the namespaces
6021 6042 the file will run in, including a fix for __name__ not being set
6022 6043 before.
6023 6044
6024 6045 2002-01-20 Fernando Perez <fperez@colorado.edu>
6025 6046
6026 6047 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6027 6048 extra garbage for Python 2.2. Need to look more carefully into
6028 6049 this later.
6029 6050
6030 6051 2002-01-19 Fernando Perez <fperez@colorado.edu>
6031 6052
6032 6053 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6033 6054 display SyntaxError exceptions properly formatted when they occur
6034 6055 (they can be triggered by imported code).
6035 6056
6036 6057 2002-01-18 Fernando Perez <fperez@colorado.edu>
6037 6058
6038 6059 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6039 6060 SyntaxError exceptions are reported nicely formatted, instead of
6040 6061 spitting out only offset information as before.
6041 6062 (Magic.magic_prun): Added the @prun function for executing
6042 6063 programs with command line args inside IPython.
6043 6064
6044 6065 2002-01-16 Fernando Perez <fperez@colorado.edu>
6045 6066
6046 6067 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6047 6068 to *not* include the last item given in a range. This brings their
6048 6069 behavior in line with Python's slicing:
6049 6070 a[n1:n2] -> a[n1]...a[n2-1]
6050 6071 It may be a bit less convenient, but I prefer to stick to Python's
6051 6072 conventions *everywhere*, so users never have to wonder.
6052 6073 (Magic.magic_macro): Added @macro function to ease the creation of
6053 6074 macros.
6054 6075
6055 6076 2002-01-05 Fernando Perez <fperez@colorado.edu>
6056 6077
6057 6078 * Released 0.2.4.
6058 6079
6059 6080 * IPython/iplib.py (Magic.magic_pdef):
6060 6081 (InteractiveShell.safe_execfile): report magic lines and error
6061 6082 lines without line numbers so one can easily copy/paste them for
6062 6083 re-execution.
6063 6084
6064 6085 * Updated manual with recent changes.
6065 6086
6066 6087 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6067 6088 docstring printing when class? is called. Very handy for knowing
6068 6089 how to create class instances (as long as __init__ is well
6069 6090 documented, of course :)
6070 6091 (Magic.magic_doc): print both class and constructor docstrings.
6071 6092 (Magic.magic_pdef): give constructor info if passed a class and
6072 6093 __call__ info for callable object instances.
6073 6094
6074 6095 2002-01-04 Fernando Perez <fperez@colorado.edu>
6075 6096
6076 6097 * Made deep_reload() off by default. It doesn't always work
6077 6098 exactly as intended, so it's probably safer to have it off. It's
6078 6099 still available as dreload() anyway, so nothing is lost.
6079 6100
6080 6101 2002-01-02 Fernando Perez <fperez@colorado.edu>
6081 6102
6082 6103 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6083 6104 so I wanted an updated release).
6084 6105
6085 6106 2001-12-27 Fernando Perez <fperez@colorado.edu>
6086 6107
6087 6108 * IPython/iplib.py (InteractiveShell.interact): Added the original
6088 6109 code from 'code.py' for this module in order to change the
6089 6110 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6090 6111 the history cache would break when the user hit Ctrl-C, and
6091 6112 interact() offers no way to add any hooks to it.
6092 6113
6093 6114 2001-12-23 Fernando Perez <fperez@colorado.edu>
6094 6115
6095 6116 * setup.py: added check for 'MANIFEST' before trying to remove
6096 6117 it. Thanks to Sean Reifschneider.
6097 6118
6098 6119 2001-12-22 Fernando Perez <fperez@colorado.edu>
6099 6120
6100 6121 * Released 0.2.2.
6101 6122
6102 6123 * Finished (reasonably) writing the manual. Later will add the
6103 6124 python-standard navigation stylesheets, but for the time being
6104 6125 it's fairly complete. Distribution will include html and pdf
6105 6126 versions.
6106 6127
6107 6128 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6108 6129 (MayaVi author).
6109 6130
6110 6131 2001-12-21 Fernando Perez <fperez@colorado.edu>
6111 6132
6112 6133 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6113 6134 good public release, I think (with the manual and the distutils
6114 6135 installer). The manual can use some work, but that can go
6115 6136 slowly. Otherwise I think it's quite nice for end users. Next
6116 6137 summer, rewrite the guts of it...
6117 6138
6118 6139 * Changed format of ipythonrc files to use whitespace as the
6119 6140 separator instead of an explicit '='. Cleaner.
6120 6141
6121 6142 2001-12-20 Fernando Perez <fperez@colorado.edu>
6122 6143
6123 6144 * Started a manual in LyX. For now it's just a quick merge of the
6124 6145 various internal docstrings and READMEs. Later it may grow into a
6125 6146 nice, full-blown manual.
6126 6147
6127 6148 * Set up a distutils based installer. Installation should now be
6128 6149 trivially simple for end-users.
6129 6150
6130 6151 2001-12-11 Fernando Perez <fperez@colorado.edu>
6131 6152
6132 6153 * Released 0.2.0. First public release, announced it at
6133 6154 comp.lang.python. From now on, just bugfixes...
6134 6155
6135 6156 * Went through all the files, set copyright/license notices and
6136 6157 cleaned up things. Ready for release.
6137 6158
6138 6159 2001-12-10 Fernando Perez <fperez@colorado.edu>
6139 6160
6140 6161 * Changed the first-time installer not to use tarfiles. It's more
6141 6162 robust now and less unix-dependent. Also makes it easier for
6142 6163 people to later upgrade versions.
6143 6164
6144 6165 * Changed @exit to @abort to reflect the fact that it's pretty
6145 6166 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6146 6167 becomes significant only when IPyhton is embedded: in that case,
6147 6168 C-D closes IPython only, but @abort kills the enclosing program
6148 6169 too (unless it had called IPython inside a try catching
6149 6170 SystemExit).
6150 6171
6151 6172 * Created Shell module which exposes the actuall IPython Shell
6152 6173 classes, currently the normal and the embeddable one. This at
6153 6174 least offers a stable interface we won't need to change when
6154 6175 (later) the internals are rewritten. That rewrite will be confined
6155 6176 to iplib and ipmaker, but the Shell interface should remain as is.
6156 6177
6157 6178 * Added embed module which offers an embeddable IPShell object,
6158 6179 useful to fire up IPython *inside* a running program. Great for
6159 6180 debugging or dynamical data analysis.
6160 6181
6161 6182 2001-12-08 Fernando Perez <fperez@colorado.edu>
6162 6183
6163 6184 * Fixed small bug preventing seeing info from methods of defined
6164 6185 objects (incorrect namespace in _ofind()).
6165 6186
6166 6187 * Documentation cleanup. Moved the main usage docstrings to a
6167 6188 separate file, usage.py (cleaner to maintain, and hopefully in the
6168 6189 future some perlpod-like way of producing interactive, man and
6169 6190 html docs out of it will be found).
6170 6191
6171 6192 * Added @profile to see your profile at any time.
6172 6193
6173 6194 * Added @p as an alias for 'print'. It's especially convenient if
6174 6195 using automagic ('p x' prints x).
6175 6196
6176 6197 * Small cleanups and fixes after a pychecker run.
6177 6198
6178 6199 * Changed the @cd command to handle @cd - and @cd -<n> for
6179 6200 visiting any directory in _dh.
6180 6201
6181 6202 * Introduced _dh, a history of visited directories. @dhist prints
6182 6203 it out with numbers.
6183 6204
6184 6205 2001-12-07 Fernando Perez <fperez@colorado.edu>
6185 6206
6186 6207 * Released 0.1.22
6187 6208
6188 6209 * Made initialization a bit more robust against invalid color
6189 6210 options in user input (exit, not traceback-crash).
6190 6211
6191 6212 * Changed the bug crash reporter to write the report only in the
6192 6213 user's .ipython directory. That way IPython won't litter people's
6193 6214 hard disks with crash files all over the place. Also print on
6194 6215 screen the necessary mail command.
6195 6216
6196 6217 * With the new ultraTB, implemented LightBG color scheme for light
6197 6218 background terminals. A lot of people like white backgrounds, so I
6198 6219 guess we should at least give them something readable.
6199 6220
6200 6221 2001-12-06 Fernando Perez <fperez@colorado.edu>
6201 6222
6202 6223 * Modified the structure of ultraTB. Now there's a proper class
6203 6224 for tables of color schemes which allow adding schemes easily and
6204 6225 switching the active scheme without creating a new instance every
6205 6226 time (which was ridiculous). The syntax for creating new schemes
6206 6227 is also cleaner. I think ultraTB is finally done, with a clean
6207 6228 class structure. Names are also much cleaner (now there's proper
6208 6229 color tables, no need for every variable to also have 'color' in
6209 6230 its name).
6210 6231
6211 6232 * Broke down genutils into separate files. Now genutils only
6212 6233 contains utility functions, and classes have been moved to their
6213 6234 own files (they had enough independent functionality to warrant
6214 6235 it): ConfigLoader, OutputTrap, Struct.
6215 6236
6216 6237 2001-12-05 Fernando Perez <fperez@colorado.edu>
6217 6238
6218 6239 * IPython turns 21! Released version 0.1.21, as a candidate for
6219 6240 public consumption. If all goes well, release in a few days.
6220 6241
6221 6242 * Fixed path bug (files in Extensions/ directory wouldn't be found
6222 6243 unless IPython/ was explicitly in sys.path).
6223 6244
6224 6245 * Extended the FlexCompleter class as MagicCompleter to allow
6225 6246 completion of @-starting lines.
6226 6247
6227 6248 * Created __release__.py file as a central repository for release
6228 6249 info that other files can read from.
6229 6250
6230 6251 * Fixed small bug in logging: when logging was turned on in
6231 6252 mid-session, old lines with special meanings (!@?) were being
6232 6253 logged without the prepended comment, which is necessary since
6233 6254 they are not truly valid python syntax. This should make session
6234 6255 restores produce less errors.
6235 6256
6236 6257 * The namespace cleanup forced me to make a FlexCompleter class
6237 6258 which is nothing but a ripoff of rlcompleter, but with selectable
6238 6259 namespace (rlcompleter only works in __main__.__dict__). I'll try
6239 6260 to submit a note to the authors to see if this change can be
6240 6261 incorporated in future rlcompleter releases (Dec.6: done)
6241 6262
6242 6263 * More fixes to namespace handling. It was a mess! Now all
6243 6264 explicit references to __main__.__dict__ are gone (except when
6244 6265 really needed) and everything is handled through the namespace
6245 6266 dicts in the IPython instance. We seem to be getting somewhere
6246 6267 with this, finally...
6247 6268
6248 6269 * Small documentation updates.
6249 6270
6250 6271 * Created the Extensions directory under IPython (with an
6251 6272 __init__.py). Put the PhysicalQ stuff there. This directory should
6252 6273 be used for all special-purpose extensions.
6253 6274
6254 6275 * File renaming:
6255 6276 ipythonlib --> ipmaker
6256 6277 ipplib --> iplib
6257 6278 This makes a bit more sense in terms of what these files actually do.
6258 6279
6259 6280 * Moved all the classes and functions in ipythonlib to ipplib, so
6260 6281 now ipythonlib only has make_IPython(). This will ease up its
6261 6282 splitting in smaller functional chunks later.
6262 6283
6263 6284 * Cleaned up (done, I think) output of @whos. Better column
6264 6285 formatting, and now shows str(var) for as much as it can, which is
6265 6286 typically what one gets with a 'print var'.
6266 6287
6267 6288 2001-12-04 Fernando Perez <fperez@colorado.edu>
6268 6289
6269 6290 * Fixed namespace problems. Now builtin/IPyhton/user names get
6270 6291 properly reported in their namespace. Internal namespace handling
6271 6292 is finally getting decent (not perfect yet, but much better than
6272 6293 the ad-hoc mess we had).
6273 6294
6274 6295 * Removed -exit option. If people just want to run a python
6275 6296 script, that's what the normal interpreter is for. Less
6276 6297 unnecessary options, less chances for bugs.
6277 6298
6278 6299 * Added a crash handler which generates a complete post-mortem if
6279 6300 IPython crashes. This will help a lot in tracking bugs down the
6280 6301 road.
6281 6302
6282 6303 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6283 6304 which were boud to functions being reassigned would bypass the
6284 6305 logger, breaking the sync of _il with the prompt counter. This
6285 6306 would then crash IPython later when a new line was logged.
6286 6307
6287 6308 2001-12-02 Fernando Perez <fperez@colorado.edu>
6288 6309
6289 6310 * Made IPython a package. This means people don't have to clutter
6290 6311 their sys.path with yet another directory. Changed the INSTALL
6291 6312 file accordingly.
6292 6313
6293 6314 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6294 6315 sorts its output (so @who shows it sorted) and @whos formats the
6295 6316 table according to the width of the first column. Nicer, easier to
6296 6317 read. Todo: write a generic table_format() which takes a list of
6297 6318 lists and prints it nicely formatted, with optional row/column
6298 6319 separators and proper padding and justification.
6299 6320
6300 6321 * Released 0.1.20
6301 6322
6302 6323 * Fixed bug in @log which would reverse the inputcache list (a
6303 6324 copy operation was missing).
6304 6325
6305 6326 * Code cleanup. @config was changed to use page(). Better, since
6306 6327 its output is always quite long.
6307 6328
6308 6329 * Itpl is back as a dependency. I was having too many problems
6309 6330 getting the parametric aliases to work reliably, and it's just
6310 6331 easier to code weird string operations with it than playing %()s
6311 6332 games. It's only ~6k, so I don't think it's too big a deal.
6312 6333
6313 6334 * Found (and fixed) a very nasty bug with history. !lines weren't
6314 6335 getting cached, and the out of sync caches would crash
6315 6336 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6316 6337 division of labor a bit better. Bug fixed, cleaner structure.
6317 6338
6318 6339 2001-12-01 Fernando Perez <fperez@colorado.edu>
6319 6340
6320 6341 * Released 0.1.19
6321 6342
6322 6343 * Added option -n to @hist to prevent line number printing. Much
6323 6344 easier to copy/paste code this way.
6324 6345
6325 6346 * Created global _il to hold the input list. Allows easy
6326 6347 re-execution of blocks of code by slicing it (inspired by Janko's
6327 6348 comment on 'macros').
6328 6349
6329 6350 * Small fixes and doc updates.
6330 6351
6331 6352 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6332 6353 much too fragile with automagic. Handles properly multi-line
6333 6354 statements and takes parameters.
6334 6355
6335 6356 2001-11-30 Fernando Perez <fperez@colorado.edu>
6336 6357
6337 6358 * Version 0.1.18 released.
6338 6359
6339 6360 * Fixed nasty namespace bug in initial module imports.
6340 6361
6341 6362 * Added copyright/license notes to all code files (except
6342 6363 DPyGetOpt). For the time being, LGPL. That could change.
6343 6364
6344 6365 * Rewrote a much nicer README, updated INSTALL, cleaned up
6345 6366 ipythonrc-* samples.
6346 6367
6347 6368 * Overall code/documentation cleanup. Basically ready for
6348 6369 release. Only remaining thing: licence decision (LGPL?).
6349 6370
6350 6371 * Converted load_config to a class, ConfigLoader. Now recursion
6351 6372 control is better organized. Doesn't include the same file twice.
6352 6373
6353 6374 2001-11-29 Fernando Perez <fperez@colorado.edu>
6354 6375
6355 6376 * Got input history working. Changed output history variables from
6356 6377 _p to _o so that _i is for input and _o for output. Just cleaner
6357 6378 convention.
6358 6379
6359 6380 * Implemented parametric aliases. This pretty much allows the
6360 6381 alias system to offer full-blown shell convenience, I think.
6361 6382
6362 6383 * Version 0.1.17 released, 0.1.18 opened.
6363 6384
6364 6385 * dot_ipython/ipythonrc (alias): added documentation.
6365 6386 (xcolor): Fixed small bug (xcolors -> xcolor)
6366 6387
6367 6388 * Changed the alias system. Now alias is a magic command to define
6368 6389 aliases just like the shell. Rationale: the builtin magics should
6369 6390 be there for things deeply connected to IPython's
6370 6391 architecture. And this is a much lighter system for what I think
6371 6392 is the really important feature: allowing users to define quickly
6372 6393 magics that will do shell things for them, so they can customize
6373 6394 IPython easily to match their work habits. If someone is really
6374 6395 desperate to have another name for a builtin alias, they can
6375 6396 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6376 6397 works.
6377 6398
6378 6399 2001-11-28 Fernando Perez <fperez@colorado.edu>
6379 6400
6380 6401 * Changed @file so that it opens the source file at the proper
6381 6402 line. Since it uses less, if your EDITOR environment is
6382 6403 configured, typing v will immediately open your editor of choice
6383 6404 right at the line where the object is defined. Not as quick as
6384 6405 having a direct @edit command, but for all intents and purposes it
6385 6406 works. And I don't have to worry about writing @edit to deal with
6386 6407 all the editors, less does that.
6387 6408
6388 6409 * Version 0.1.16 released, 0.1.17 opened.
6389 6410
6390 6411 * Fixed some nasty bugs in the page/page_dumb combo that could
6391 6412 crash IPython.
6392 6413
6393 6414 2001-11-27 Fernando Perez <fperez@colorado.edu>
6394 6415
6395 6416 * Version 0.1.15 released, 0.1.16 opened.
6396 6417
6397 6418 * Finally got ? and ?? to work for undefined things: now it's
6398 6419 possible to type {}.get? and get information about the get method
6399 6420 of dicts, or os.path? even if only os is defined (so technically
6400 6421 os.path isn't). Works at any level. For example, after import os,
6401 6422 os?, os.path?, os.path.abspath? all work. This is great, took some
6402 6423 work in _ofind.
6403 6424
6404 6425 * Fixed more bugs with logging. The sanest way to do it was to add
6405 6426 to @log a 'mode' parameter. Killed two in one shot (this mode
6406 6427 option was a request of Janko's). I think it's finally clean
6407 6428 (famous last words).
6408 6429
6409 6430 * Added a page_dumb() pager which does a decent job of paging on
6410 6431 screen, if better things (like less) aren't available. One less
6411 6432 unix dependency (someday maybe somebody will port this to
6412 6433 windows).
6413 6434
6414 6435 * Fixed problem in magic_log: would lock of logging out if log
6415 6436 creation failed (because it would still think it had succeeded).
6416 6437
6417 6438 * Improved the page() function using curses to auto-detect screen
6418 6439 size. Now it can make a much better decision on whether to print
6419 6440 or page a string. Option screen_length was modified: a value 0
6420 6441 means auto-detect, and that's the default now.
6421 6442
6422 6443 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6423 6444 go out. I'll test it for a few days, then talk to Janko about
6424 6445 licences and announce it.
6425 6446
6426 6447 * Fixed the length of the auto-generated ---> prompt which appears
6427 6448 for auto-parens and auto-quotes. Getting this right isn't trivial,
6428 6449 with all the color escapes, different prompt types and optional
6429 6450 separators. But it seems to be working in all the combinations.
6430 6451
6431 6452 2001-11-26 Fernando Perez <fperez@colorado.edu>
6432 6453
6433 6454 * Wrote a regexp filter to get option types from the option names
6434 6455 string. This eliminates the need to manually keep two duplicate
6435 6456 lists.
6436 6457
6437 6458 * Removed the unneeded check_option_names. Now options are handled
6438 6459 in a much saner manner and it's easy to visually check that things
6439 6460 are ok.
6440 6461
6441 6462 * Updated version numbers on all files I modified to carry a
6442 6463 notice so Janko and Nathan have clear version markers.
6443 6464
6444 6465 * Updated docstring for ultraTB with my changes. I should send
6445 6466 this to Nathan.
6446 6467
6447 6468 * Lots of small fixes. Ran everything through pychecker again.
6448 6469
6449 6470 * Made loading of deep_reload an cmd line option. If it's not too
6450 6471 kosher, now people can just disable it. With -nodeep_reload it's
6451 6472 still available as dreload(), it just won't overwrite reload().
6452 6473
6453 6474 * Moved many options to the no| form (-opt and -noopt
6454 6475 accepted). Cleaner.
6455 6476
6456 6477 * Changed magic_log so that if called with no parameters, it uses
6457 6478 'rotate' mode. That way auto-generated logs aren't automatically
6458 6479 over-written. For normal logs, now a backup is made if it exists
6459 6480 (only 1 level of backups). A new 'backup' mode was added to the
6460 6481 Logger class to support this. This was a request by Janko.
6461 6482
6462 6483 * Added @logoff/@logon to stop/restart an active log.
6463 6484
6464 6485 * Fixed a lot of bugs in log saving/replay. It was pretty
6465 6486 broken. Now special lines (!@,/) appear properly in the command
6466 6487 history after a log replay.
6467 6488
6468 6489 * Tried and failed to implement full session saving via pickle. My
6469 6490 idea was to pickle __main__.__dict__, but modules can't be
6470 6491 pickled. This would be a better alternative to replaying logs, but
6471 6492 seems quite tricky to get to work. Changed -session to be called
6472 6493 -logplay, which more accurately reflects what it does. And if we
6473 6494 ever get real session saving working, -session is now available.
6474 6495
6475 6496 * Implemented color schemes for prompts also. As for tracebacks,
6476 6497 currently only NoColor and Linux are supported. But now the
6477 6498 infrastructure is in place, based on a generic ColorScheme
6478 6499 class. So writing and activating new schemes both for the prompts
6479 6500 and the tracebacks should be straightforward.
6480 6501
6481 6502 * Version 0.1.13 released, 0.1.14 opened.
6482 6503
6483 6504 * Changed handling of options for output cache. Now counter is
6484 6505 hardwired starting at 1 and one specifies the maximum number of
6485 6506 entries *in the outcache* (not the max prompt counter). This is
6486 6507 much better, since many statements won't increase the cache
6487 6508 count. It also eliminated some confusing options, now there's only
6488 6509 one: cache_size.
6489 6510
6490 6511 * Added 'alias' magic function and magic_alias option in the
6491 6512 ipythonrc file. Now the user can easily define whatever names he
6492 6513 wants for the magic functions without having to play weird
6493 6514 namespace games. This gives IPython a real shell-like feel.
6494 6515
6495 6516 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6496 6517 @ or not).
6497 6518
6498 6519 This was one of the last remaining 'visible' bugs (that I know
6499 6520 of). I think if I can clean up the session loading so it works
6500 6521 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6501 6522 about licensing).
6502 6523
6503 6524 2001-11-25 Fernando Perez <fperez@colorado.edu>
6504 6525
6505 6526 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6506 6527 there's a cleaner distinction between what ? and ?? show.
6507 6528
6508 6529 * Added screen_length option. Now the user can define his own
6509 6530 screen size for page() operations.
6510 6531
6511 6532 * Implemented magic shell-like functions with automatic code
6512 6533 generation. Now adding another function is just a matter of adding
6513 6534 an entry to a dict, and the function is dynamically generated at
6514 6535 run-time. Python has some really cool features!
6515 6536
6516 6537 * Renamed many options to cleanup conventions a little. Now all
6517 6538 are lowercase, and only underscores where needed. Also in the code
6518 6539 option name tables are clearer.
6519 6540
6520 6541 * Changed prompts a little. Now input is 'In [n]:' instead of
6521 6542 'In[n]:='. This allows it the numbers to be aligned with the
6522 6543 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6523 6544 Python (it was a Mathematica thing). The '...' continuation prompt
6524 6545 was also changed a little to align better.
6525 6546
6526 6547 * Fixed bug when flushing output cache. Not all _p<n> variables
6527 6548 exist, so their deletion needs to be wrapped in a try:
6528 6549
6529 6550 * Figured out how to properly use inspect.formatargspec() (it
6530 6551 requires the args preceded by *). So I removed all the code from
6531 6552 _get_pdef in Magic, which was just replicating that.
6532 6553
6533 6554 * Added test to prefilter to allow redefining magic function names
6534 6555 as variables. This is ok, since the @ form is always available,
6535 6556 but whe should allow the user to define a variable called 'ls' if
6536 6557 he needs it.
6537 6558
6538 6559 * Moved the ToDo information from README into a separate ToDo.
6539 6560
6540 6561 * General code cleanup and small bugfixes. I think it's close to a
6541 6562 state where it can be released, obviously with a big 'beta'
6542 6563 warning on it.
6543 6564
6544 6565 * Got the magic function split to work. Now all magics are defined
6545 6566 in a separate class. It just organizes things a bit, and now
6546 6567 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6547 6568 was too long).
6548 6569
6549 6570 * Changed @clear to @reset to avoid potential confusions with
6550 6571 the shell command clear. Also renamed @cl to @clear, which does
6551 6572 exactly what people expect it to from their shell experience.
6552 6573
6553 6574 Added a check to the @reset command (since it's so
6554 6575 destructive, it's probably a good idea to ask for confirmation).
6555 6576 But now reset only works for full namespace resetting. Since the
6556 6577 del keyword is already there for deleting a few specific
6557 6578 variables, I don't see the point of having a redundant magic
6558 6579 function for the same task.
6559 6580
6560 6581 2001-11-24 Fernando Perez <fperez@colorado.edu>
6561 6582
6562 6583 * Updated the builtin docs (esp. the ? ones).
6563 6584
6564 6585 * Ran all the code through pychecker. Not terribly impressed with
6565 6586 it: lots of spurious warnings and didn't really find anything of
6566 6587 substance (just a few modules being imported and not used).
6567 6588
6568 6589 * Implemented the new ultraTB functionality into IPython. New
6569 6590 option: xcolors. This chooses color scheme. xmode now only selects
6570 6591 between Plain and Verbose. Better orthogonality.
6571 6592
6572 6593 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6573 6594 mode and color scheme for the exception handlers. Now it's
6574 6595 possible to have the verbose traceback with no coloring.
6575 6596
6576 6597 2001-11-23 Fernando Perez <fperez@colorado.edu>
6577 6598
6578 6599 * Version 0.1.12 released, 0.1.13 opened.
6579 6600
6580 6601 * Removed option to set auto-quote and auto-paren escapes by
6581 6602 user. The chances of breaking valid syntax are just too high. If
6582 6603 someone *really* wants, they can always dig into the code.
6583 6604
6584 6605 * Made prompt separators configurable.
6585 6606
6586 6607 2001-11-22 Fernando Perez <fperez@colorado.edu>
6587 6608
6588 6609 * Small bugfixes in many places.
6589 6610
6590 6611 * Removed the MyCompleter class from ipplib. It seemed redundant
6591 6612 with the C-p,C-n history search functionality. Less code to
6592 6613 maintain.
6593 6614
6594 6615 * Moved all the original ipython.py code into ipythonlib.py. Right
6595 6616 now it's just one big dump into a function called make_IPython, so
6596 6617 no real modularity has been gained. But at least it makes the
6597 6618 wrapper script tiny, and since ipythonlib is a module, it gets
6598 6619 compiled and startup is much faster.
6599 6620
6600 6621 This is a reasobably 'deep' change, so we should test it for a
6601 6622 while without messing too much more with the code.
6602 6623
6603 6624 2001-11-21 Fernando Perez <fperez@colorado.edu>
6604 6625
6605 6626 * Version 0.1.11 released, 0.1.12 opened for further work.
6606 6627
6607 6628 * Removed dependency on Itpl. It was only needed in one place. It
6608 6629 would be nice if this became part of python, though. It makes life
6609 6630 *a lot* easier in some cases.
6610 6631
6611 6632 * Simplified the prefilter code a bit. Now all handlers are
6612 6633 expected to explicitly return a value (at least a blank string).
6613 6634
6614 6635 * Heavy edits in ipplib. Removed the help system altogether. Now
6615 6636 obj?/?? is used for inspecting objects, a magic @doc prints
6616 6637 docstrings, and full-blown Python help is accessed via the 'help'
6617 6638 keyword. This cleans up a lot of code (less to maintain) and does
6618 6639 the job. Since 'help' is now a standard Python component, might as
6619 6640 well use it and remove duplicate functionality.
6620 6641
6621 6642 Also removed the option to use ipplib as a standalone program. By
6622 6643 now it's too dependent on other parts of IPython to function alone.
6623 6644
6624 6645 * Fixed bug in genutils.pager. It would crash if the pager was
6625 6646 exited immediately after opening (broken pipe).
6626 6647
6627 6648 * Trimmed down the VerboseTB reporting a little. The header is
6628 6649 much shorter now and the repeated exception arguments at the end
6629 6650 have been removed. For interactive use the old header seemed a bit
6630 6651 excessive.
6631 6652
6632 6653 * Fixed small bug in output of @whos for variables with multi-word
6633 6654 types (only first word was displayed).
6634 6655
6635 6656 2001-11-17 Fernando Perez <fperez@colorado.edu>
6636 6657
6637 6658 * Version 0.1.10 released, 0.1.11 opened for further work.
6638 6659
6639 6660 * Modified dirs and friends. dirs now *returns* the stack (not
6640 6661 prints), so one can manipulate it as a variable. Convenient to
6641 6662 travel along many directories.
6642 6663
6643 6664 * Fixed bug in magic_pdef: would only work with functions with
6644 6665 arguments with default values.
6645 6666
6646 6667 2001-11-14 Fernando Perez <fperez@colorado.edu>
6647 6668
6648 6669 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6649 6670 example with IPython. Various other minor fixes and cleanups.
6650 6671
6651 6672 * Version 0.1.9 released, 0.1.10 opened for further work.
6652 6673
6653 6674 * Added sys.path to the list of directories searched in the
6654 6675 execfile= option. It used to be the current directory and the
6655 6676 user's IPYTHONDIR only.
6656 6677
6657 6678 2001-11-13 Fernando Perez <fperez@colorado.edu>
6658 6679
6659 6680 * Reinstated the raw_input/prefilter separation that Janko had
6660 6681 initially. This gives a more convenient setup for extending the
6661 6682 pre-processor from the outside: raw_input always gets a string,
6662 6683 and prefilter has to process it. We can then redefine prefilter
6663 6684 from the outside and implement extensions for special
6664 6685 purposes.
6665 6686
6666 6687 Today I got one for inputting PhysicalQuantity objects
6667 6688 (from Scientific) without needing any function calls at
6668 6689 all. Extremely convenient, and it's all done as a user-level
6669 6690 extension (no IPython code was touched). Now instead of:
6670 6691 a = PhysicalQuantity(4.2,'m/s**2')
6671 6692 one can simply say
6672 6693 a = 4.2 m/s**2
6673 6694 or even
6674 6695 a = 4.2 m/s^2
6675 6696
6676 6697 I use this, but it's also a proof of concept: IPython really is
6677 6698 fully user-extensible, even at the level of the parsing of the
6678 6699 command line. It's not trivial, but it's perfectly doable.
6679 6700
6680 6701 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6681 6702 the problem of modules being loaded in the inverse order in which
6682 6703 they were defined in
6683 6704
6684 6705 * Version 0.1.8 released, 0.1.9 opened for further work.
6685 6706
6686 6707 * Added magics pdef, source and file. They respectively show the
6687 6708 definition line ('prototype' in C), source code and full python
6688 6709 file for any callable object. The object inspector oinfo uses
6689 6710 these to show the same information.
6690 6711
6691 6712 * Version 0.1.7 released, 0.1.8 opened for further work.
6692 6713
6693 6714 * Separated all the magic functions into a class called Magic. The
6694 6715 InteractiveShell class was becoming too big for Xemacs to handle
6695 6716 (de-indenting a line would lock it up for 10 seconds while it
6696 6717 backtracked on the whole class!)
6697 6718
6698 6719 FIXME: didn't work. It can be done, but right now namespaces are
6699 6720 all messed up. Do it later (reverted it for now, so at least
6700 6721 everything works as before).
6701 6722
6702 6723 * Got the object introspection system (magic_oinfo) working! I
6703 6724 think this is pretty much ready for release to Janko, so he can
6704 6725 test it for a while and then announce it. Pretty much 100% of what
6705 6726 I wanted for the 'phase 1' release is ready. Happy, tired.
6706 6727
6707 6728 2001-11-12 Fernando Perez <fperez@colorado.edu>
6708 6729
6709 6730 * Version 0.1.6 released, 0.1.7 opened for further work.
6710 6731
6711 6732 * Fixed bug in printing: it used to test for truth before
6712 6733 printing, so 0 wouldn't print. Now checks for None.
6713 6734
6714 6735 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6715 6736 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6716 6737 reaches by hand into the outputcache. Think of a better way to do
6717 6738 this later.
6718 6739
6719 6740 * Various small fixes thanks to Nathan's comments.
6720 6741
6721 6742 * Changed magic_pprint to magic_Pprint. This way it doesn't
6722 6743 collide with pprint() and the name is consistent with the command
6723 6744 line option.
6724 6745
6725 6746 * Changed prompt counter behavior to be fully like
6726 6747 Mathematica's. That is, even input that doesn't return a result
6727 6748 raises the prompt counter. The old behavior was kind of confusing
6728 6749 (getting the same prompt number several times if the operation
6729 6750 didn't return a result).
6730 6751
6731 6752 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6732 6753
6733 6754 * Fixed -Classic mode (wasn't working anymore).
6734 6755
6735 6756 * Added colored prompts using Nathan's new code. Colors are
6736 6757 currently hardwired, they can be user-configurable. For
6737 6758 developers, they can be chosen in file ipythonlib.py, at the
6738 6759 beginning of the CachedOutput class def.
6739 6760
6740 6761 2001-11-11 Fernando Perez <fperez@colorado.edu>
6741 6762
6742 6763 * Version 0.1.5 released, 0.1.6 opened for further work.
6743 6764
6744 6765 * Changed magic_env to *return* the environment as a dict (not to
6745 6766 print it). This way it prints, but it can also be processed.
6746 6767
6747 6768 * Added Verbose exception reporting to interactive
6748 6769 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6749 6770 traceback. Had to make some changes to the ultraTB file. This is
6750 6771 probably the last 'big' thing in my mental todo list. This ties
6751 6772 in with the next entry:
6752 6773
6753 6774 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6754 6775 has to specify is Plain, Color or Verbose for all exception
6755 6776 handling.
6756 6777
6757 6778 * Removed ShellServices option. All this can really be done via
6758 6779 the magic system. It's easier to extend, cleaner and has automatic
6759 6780 namespace protection and documentation.
6760 6781
6761 6782 2001-11-09 Fernando Perez <fperez@colorado.edu>
6762 6783
6763 6784 * Fixed bug in output cache flushing (missing parameter to
6764 6785 __init__). Other small bugs fixed (found using pychecker).
6765 6786
6766 6787 * Version 0.1.4 opened for bugfixing.
6767 6788
6768 6789 2001-11-07 Fernando Perez <fperez@colorado.edu>
6769 6790
6770 6791 * Version 0.1.3 released, mainly because of the raw_input bug.
6771 6792
6772 6793 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6773 6794 and when testing for whether things were callable, a call could
6774 6795 actually be made to certain functions. They would get called again
6775 6796 once 'really' executed, with a resulting double call. A disaster
6776 6797 in many cases (list.reverse() would never work!).
6777 6798
6778 6799 * Removed prefilter() function, moved its code to raw_input (which
6779 6800 after all was just a near-empty caller for prefilter). This saves
6780 6801 a function call on every prompt, and simplifies the class a tiny bit.
6781 6802
6782 6803 * Fix _ip to __ip name in magic example file.
6783 6804
6784 6805 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6785 6806 work with non-gnu versions of tar.
6786 6807
6787 6808 2001-11-06 Fernando Perez <fperez@colorado.edu>
6788 6809
6789 6810 * Version 0.1.2. Just to keep track of the recent changes.
6790 6811
6791 6812 * Fixed nasty bug in output prompt routine. It used to check 'if
6792 6813 arg != None...'. Problem is, this fails if arg implements a
6793 6814 special comparison (__cmp__) which disallows comparing to
6794 6815 None. Found it when trying to use the PhysicalQuantity module from
6795 6816 ScientificPython.
6796 6817
6797 6818 2001-11-05 Fernando Perez <fperez@colorado.edu>
6798 6819
6799 6820 * Also added dirs. Now the pushd/popd/dirs family functions
6800 6821 basically like the shell, with the added convenience of going home
6801 6822 when called with no args.
6802 6823
6803 6824 * pushd/popd slightly modified to mimic shell behavior more
6804 6825 closely.
6805 6826
6806 6827 * Added env,pushd,popd from ShellServices as magic functions. I
6807 6828 think the cleanest will be to port all desired functions from
6808 6829 ShellServices as magics and remove ShellServices altogether. This
6809 6830 will provide a single, clean way of adding functionality
6810 6831 (shell-type or otherwise) to IP.
6811 6832
6812 6833 2001-11-04 Fernando Perez <fperez@colorado.edu>
6813 6834
6814 6835 * Added .ipython/ directory to sys.path. This way users can keep
6815 6836 customizations there and access them via import.
6816 6837
6817 6838 2001-11-03 Fernando Perez <fperez@colorado.edu>
6818 6839
6819 6840 * Opened version 0.1.1 for new changes.
6820 6841
6821 6842 * Changed version number to 0.1.0: first 'public' release, sent to
6822 6843 Nathan and Janko.
6823 6844
6824 6845 * Lots of small fixes and tweaks.
6825 6846
6826 6847 * Minor changes to whos format. Now strings are shown, snipped if
6827 6848 too long.
6828 6849
6829 6850 * Changed ShellServices to work on __main__ so they show up in @who
6830 6851
6831 6852 * Help also works with ? at the end of a line:
6832 6853 ?sin and sin?
6833 6854 both produce the same effect. This is nice, as often I use the
6834 6855 tab-complete to find the name of a method, but I used to then have
6835 6856 to go to the beginning of the line to put a ? if I wanted more
6836 6857 info. Now I can just add the ? and hit return. Convenient.
6837 6858
6838 6859 2001-11-02 Fernando Perez <fperez@colorado.edu>
6839 6860
6840 6861 * Python version check (>=2.1) added.
6841 6862
6842 6863 * Added LazyPython documentation. At this point the docs are quite
6843 6864 a mess. A cleanup is in order.
6844 6865
6845 6866 * Auto-installer created. For some bizarre reason, the zipfiles
6846 6867 module isn't working on my system. So I made a tar version
6847 6868 (hopefully the command line options in various systems won't kill
6848 6869 me).
6849 6870
6850 6871 * Fixes to Struct in genutils. Now all dictionary-like methods are
6851 6872 protected (reasonably).
6852 6873
6853 6874 * Added pager function to genutils and changed ? to print usage
6854 6875 note through it (it was too long).
6855 6876
6856 6877 * Added the LazyPython functionality. Works great! I changed the
6857 6878 auto-quote escape to ';', it's on home row and next to '. But
6858 6879 both auto-quote and auto-paren (still /) escapes are command-line
6859 6880 parameters.
6860 6881
6861 6882
6862 6883 2001-11-01 Fernando Perez <fperez@colorado.edu>
6863 6884
6864 6885 * Version changed to 0.0.7. Fairly large change: configuration now
6865 6886 is all stored in a directory, by default .ipython. There, all
6866 6887 config files have normal looking names (not .names)
6867 6888
6868 6889 * Version 0.0.6 Released first to Lucas and Archie as a test
6869 6890 run. Since it's the first 'semi-public' release, change version to
6870 6891 > 0.0.6 for any changes now.
6871 6892
6872 6893 * Stuff I had put in the ipplib.py changelog:
6873 6894
6874 6895 Changes to InteractiveShell:
6875 6896
6876 6897 - Made the usage message a parameter.
6877 6898
6878 6899 - Require the name of the shell variable to be given. It's a bit
6879 6900 of a hack, but allows the name 'shell' not to be hardwired in the
6880 6901 magic (@) handler, which is problematic b/c it requires
6881 6902 polluting the global namespace with 'shell'. This in turn is
6882 6903 fragile: if a user redefines a variable called shell, things
6883 6904 break.
6884 6905
6885 6906 - magic @: all functions available through @ need to be defined
6886 6907 as magic_<name>, even though they can be called simply as
6887 6908 @<name>. This allows the special command @magic to gather
6888 6909 information automatically about all existing magic functions,
6889 6910 even if they are run-time user extensions, by parsing the shell
6890 6911 instance __dict__ looking for special magic_ names.
6891 6912
6892 6913 - mainloop: added *two* local namespace parameters. This allows
6893 6914 the class to differentiate between parameters which were there
6894 6915 before and after command line initialization was processed. This
6895 6916 way, later @who can show things loaded at startup by the
6896 6917 user. This trick was necessary to make session saving/reloading
6897 6918 really work: ideally after saving/exiting/reloading a session,
6898 6919 *everything* should look the same, including the output of @who. I
6899 6920 was only able to make this work with this double namespace
6900 6921 trick.
6901 6922
6902 6923 - added a header to the logfile which allows (almost) full
6903 6924 session restoring.
6904 6925
6905 6926 - prepend lines beginning with @ or !, with a and log
6906 6927 them. Why? !lines: may be useful to know what you did @lines:
6907 6928 they may affect session state. So when restoring a session, at
6908 6929 least inform the user of their presence. I couldn't quite get
6909 6930 them to properly re-execute, but at least the user is warned.
6910 6931
6911 6932 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now